comparison mm7_2.cpp @ 609:42d5777c2f47

Слияние
author Ritor1
date Wed, 06 Mar 2013 18:22:25 +0600
parents 653724e9c234 f90753ebabe3
children 7bae884b7cd0
comparison
equal deleted inserted replaced
608:653724e9c234 609:42d5777c2f47
317 _this.uFrameZ = 334; 317 _this.uFrameZ = 334;
318 *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 318 *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
319 *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 319 *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
320 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); 320 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
321 _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); 321 _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u);
322 if ( dword_F8B19C != 1 ) 322 switch(dword_F8B19C)
323 { 323 {
324 if ( dword_F8B19C == 7 ) 324 case 1:
325 { 325 {
326 v0 = window_SpeakInHouse; 326 v8 = v14[0];
327 if ( window_SpeakInHouse->field_40 != 1 ) 327 if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
328 { 328 v8 = v13[0];
329 v1 = window_SpeakInHouse->field_40 - 2; 329 _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u);
330 if ( window_SpeakInHouse->field_40 == 2 ) 330 v9 = v14[0];
331 { 331 if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
332 v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); 332 v9 = v13[0];
333 v7 = v6; 333 _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u);
334 if ( !v6 ) 334 break;
335 { 335 }
336 LABEL_17: 336 case 7:
337 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); 337 {
338 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 338 v0 = window_SpeakInHouse;
339 { 339 if ( window_SpeakInHouse->field_40 != 1 )
340 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; 340 {
341 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; 341 v1 = window_SpeakInHouse->field_40 - 2;
342 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 342 if ( window_SpeakInHouse->field_40 == 2 )
343 ++pMessageQueue_50CBD0->uNumMessages; 343 {
344 }*/ 344 v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
345 return; 345 v7 = v6;
346 } 346 if ( !v6 )
347 if ( v6 > pParty->uNumGold ) 347 {
348 { 348 //LABEL_17:
349 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 349 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
350 v7 = pParty->uNumGold; 350 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
351 } 351 {
352 if ( v7 ) 352 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
353 { 353 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
354 Party::TakeGold(v7); 354 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
355 pParty->uNumGoldInBank += v7; 355 ++pMessageQueue_50CBD0->uNumMessages;
356 if ( uActiveCharacter ) 356 }*/
357 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); 357 return;
358 } 358 }
359 v0 = window_SpeakInHouse; 359 if ( v6 > pParty->uNumGold )
360 LABEL_16: 360 {
361 v0->field_40 = 0; 361 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
362 goto LABEL_17; 362 v7 = pParty->uNumGold;
363 } 363 }
364 LABEL_15: 364 if ( v7 )
365 if ( v1 != 1 ) 365 {
366 return; 366 Party::TakeGold(v7);
367 goto LABEL_16; 367 pParty->uNumGoldInBank += v7;
368 } 368 if ( uActiveCharacter )
369 v11 = pGlobalTXT_LocalizationStrings[112]; 369 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
370 v10 = pGlobalTXT_LocalizationStrings[60]; 370 }
371 } 371 v0 = window_SpeakInHouse;
372 else 372 v0->field_40 = 0;
373 { 373 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
374 if ( dword_F8B19C != 8 ) 374 return;
375 return; 375 }
376 v0 = window_SpeakInHouse; 376 if ( v1 != 1 )
377 if ( window_SpeakInHouse->field_40 != 1 ) 377 return;
378 { 378 v0->field_40 = 0;
379 v1 = window_SpeakInHouse->field_40 - 2; 379 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
380 if ( window_SpeakInHouse->field_40 == 2 ) 380 return;
381 { 381 }
382 window_SpeakInHouse->field_40 = 0; 382 v11 = pGlobalTXT_LocalizationStrings[112];
383 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); 383 v10 = pGlobalTXT_LocalizationStrings[60];
384 v3 = v2; 384 sprintf(pTmpBuf, "%s\n%s", v10, v11);
385 if ( v2 ) 385 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
386 { 386 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
387 if ( v2 > pParty->uNumGoldInBank ) 387 v4 = pFontArrus;
388 { 388 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
389 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 389 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
390 v3 = pParty->uNumGoldInBank; 390 break;
391 } 391 }
392 if ( v3 ) 392
393 { 393 case 8:
394 Party::SetGold(pParty->uNumGold + v3); 394 {
395 pParty->uNumGoldInBank -= v3; 395 v0 = window_SpeakInHouse;
396 } 396 if ( window_SpeakInHouse->field_40 != 1 )
397 } 397 {
398 goto LABEL_17; 398 v1 = window_SpeakInHouse->field_40 - 2;
399 } 399 if ( window_SpeakInHouse->field_40 == 2 )
400 goto LABEL_15; 400 {
401 } 401 window_SpeakInHouse->field_40 = 0;
402 v11 = pGlobalTXT_LocalizationStrings[112]; 402 v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
403 v10 = pGlobalTXT_LocalizationStrings[244]; 403 v3 = v2;
404 } 404 if ( v2 )
405 sprintf(pTmpBuf, "%s\n%s", v10, v11); 405 {
406 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); 406 if ( v2 > pParty->uNumGoldInBank )
407 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); 407 {
408 v4 = pFontArrus; 408 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
409 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); 409 v3 = pParty->uNumGoldInBank;
410 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); 410 }
411 return; 411 if ( v3 )
412 } 412 {
413 v8 = v14[0]; 413 Party::SetGold(pParty->uNumGold + v3);
414 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) 414 pParty->uNumGoldInBank -= v3;
415 v8 = v13[0]; 415 }
416 _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u); 416 }
417 v9 = v14[0]; 417 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
418 if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) 418 return;
419 v9 = v13[0]; 419 }
420 _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u); 420 if ( v1 != 1 )
421 return;
422 v0->field_40 = 0;
423 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
424 return;
425 }
426 v11 = pGlobalTXT_LocalizationStrings[112];
427 v10 = pGlobalTXT_LocalizationStrings[244];
428 sprintf(pTmpBuf, "%s\n%s", v10, v11);
429 _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u);
430 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
431 v4 = pFontArrus;
432 v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
433 _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4);
434 return;
435 break;
436 }
437
438 default:
439 {
440 break;
441 }
442 }
421 } 443 }
422 // F8B19C: using guessed type int dword_F8B19C; 444 // F8B19C: using guessed type int dword_F8B19C;
423 445
424 //----- (004B8285) -------------------------------------------------------- 446 //----- (004B8285) --------------------------------------------------------
425 void __cdecl TavernDialog() 447 void __cdecl TavernDialog()
546 if ( v7 <= 0 ) 568 if ( v7 <= 0 )
547 { 569 {
548 v7 = 1; 570 v7 = 1;
549 v83 = 1; 571 v83 = 1;
550 } 572 }
551 if ( dword_F8B19C > 101 ) 573 switch(dword_F8B19C)
552 { 574 {
553 if ( dword_F8B19C == 102 ) 575 case 102:
554 { 576 {
555 v65 = pFontArrus; 577 v65 = pFontArrus;
556 pOutString = pFontArrus; 578 pOutString = pFontArrus;
557 strcpy(pTmpBuf, pNPCTopics[354].pText); 579 strcpy(pTmpBuf, pNPCTopics[354].pText);
558 v78.uFrameWidth = 460; 580 v78.uFrameWidth = 460;
559 v78.uFrameZ = 452; 581 v78.uFrameZ = 452;
560 v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; 582 v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7;
561 if ( 352 - v62 < 8 ) 583 if ( 352 - v62 < 8 )
562 { 584 {
563 pOutString = pFontCreate; 585 pOutString = pFontCreate;
564 v62 = pFontCreate->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; 586 v62 = pFontCreate->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7;
565 } 587 }
566 588
567 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); 589 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
568 pRenderer->_4A6A68( 590 pRenderer->_4A6A68(8u, 352 - v62, pTex, (pTex ? pTex->uTextureHeight : 26) - v62);
569 8u, 591
570 352 - v62, 592 pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428);
571 pTex, 593 v73 = 0;
572 (pTex ? pTex->uTextureHeight : 26) - v62); 594 v70 = 0;
573 595 v68 = 0;
574 pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); 596 v63 = FitTextInAWindow(pTmpBuf, pOutString, &v78, 0xCu, 0);
575 v73 = 0; 597 v64 = pOutString;
576 v70 = 0; 598 window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73);
577 v68 = 0; 599 break;
578 v63 = FitTextInAWindow(pTmpBuf, pOutString, &v78, 0xCu, 0); 600 }
579 v64 = pOutString; 601 case 103:
580 } 602 {
581 else 603 strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText);
582 { 604 v78.uFrameWidth = 460;
583 if ( dword_F8B19C != 103 ) 605 v78.uFrameZ = 452;
584 { 606 v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0);
585 if ( dword_F8B19C != 104 || pArcomageGame->bGameInProgress == 1 ) 607 v62 = v61 + 7;
608
609 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr);
610 pRenderer->_4A6A68(8u, 352 - (v61 + 7), pTex, (pTex ? pTex->uTextureHeight : 26) - (v61 + 7));
611
612 pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428);
613 v73 = 0;
614 v70 = 0;
615 v68 = 0;
616 v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &v78, 0xCu, 0);
617 v64 = pFontArrus;
618 window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73);
619 break;
620 }
621 case 104:
622 {
623 if ( pArcomageGame->bGameInProgress == 1 )
586 return; 624 return;
587 v26 = pTmpBuf; 625 v26 = pTmpBuf;
588 if ( pArcomageGame->uGameResult ) 626 if ( pArcomageGame->uGameResult )
589 { 627 {
590 if ( pArcomageGame->uGameResult == 1 ) 628 if ( pArcomageGame->uGameResult == 1 )
595 else 633 else
596 { 634 {
597 v72 = pGlobalTXT_LocalizationStrings[639];// A tie! 635 v72 = pGlobalTXT_LocalizationStrings[639];// A tie!
598 } 636 }
599 strcpy(pTmpBuf, v72); 637 strcpy(pTmpBuf, v72);
600 LABEL_97: 638 //LABEL_97:
601 v71 = 3; 639 v71 = 3;
602 v69 = v26; 640 v69 = v26;
603 v67 = v84[0]; 641 v67 = v84[0];
604 v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; 642 v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138;
605 goto LABEL_98; 643 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71);
606 } 644 break;
607 strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); 645 }
608 v78.uFrameWidth = 460; 646 case 15:
609 v78.uFrameZ = 452; 647 {
610 v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0);
611 v62 = v61 + 7;
612
613 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr);
614 pRenderer->_4A6A68(
615 8u,
616 352 - (v61 + 7),
617 pTex,
618 (pTex ? pTex->uTextureHeight : 26) - (v61 + 7));
619
620 pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428);
621 v73 = 0;
622 v70 = 0;
623 v68 = 0;
624 v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &v78, 0xCu, 0);
625 v64 = pFontArrus;
626 }
627 window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73);
628 return;
629 }
630 if ( dword_F8B19C != 101 )
631 {
632 if ( dword_F8B19C != 1 )
633 {
634 if ( dword_F8B19C == 15 )
635 {
636 if ( pParty->uNumGold >= (unsigned int)pOutString ) 648 if ( pParty->uNumGold >= (unsigned int)pOutString )
637 { 649 {
638 Party::TakeGold((unsigned int)pOutString); 650 Party::TakeGold((unsigned int)pOutString);
639 v27 = (int)window_SpeakInHouse->ptr_1C; 651 v27 = (int)window_SpeakInHouse->ptr_1C;
640 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 652 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
653 pMessageQueue_50CBD0->pMessages[0].field_8 = 1; 665 pMessageQueue_50CBD0->pMessages[0].field_8 = 1;
654 //LABEL_51: 666 //LABEL_51:
655 ++pMessageQueue_50CBD0->uNumMessages; 667 ++pMessageQueue_50CBD0->uNumMessages;
656 return; 668 return;
657 } 669 }
658 } 670 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
659 else 671 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4);
660 { 672 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
661 if ( dword_F8B19C != 16 ) 673 break;
662 { 674 }
663 if ( dword_F8B19C != 96 || !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 675 case 96:
664 return; 676 {
665 v8 = pDialogueWindow; 677 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
666 *(float *)&v89 = 0.0; 678 return;
667 679 v8 = pDialogueWindow;
668 //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); 680 *(float *)&v89 = 0.0;
669 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); 681
670 682 //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
671 pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100); 683 v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
672 if ( (signed int)pOutString < v9 / 3 ) 684
673 pOutString = (GUIFont *)(v9 / 3); 685 pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100);
674 v10 = v8->pStartingPosActiveItem; 686 if ( (signed int)pOutString < v9 / 3 )
675 v11 = v10 + v8->pNumPresenceButton; 687 pOutString = (GUIFont *)(v9 / 3);
676 v86 = 0; 688 v10 = v8->pStartingPosActiveItem;
677 if ( (signed int)v10 < v11 ) 689 v11 = v10 + v8->pNumPresenceButton;
678 { 690 v86 = 0;
679 do 691 if ( (signed int)v10 < v11 )
680 { 692 {
681 v12 = v8->GetControl(v10)->uControlParam - 36; 693 do
682 if ( byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v12] && !v85->pActiveSkills[v12] ) 694 {
683 { 695 v12 = v8->GetControl(v10)->uControlParam - 36;
684 v13 = pFontArrus->CalcTextHeight(pSkillNames[v12], &v79, 0, 0); 696 if ( byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v12] && !v85->pActiveSkills[v12] )
685 v89 += v13; 697 {
686 ++v86; 698 v13 = pFontArrus->CalcTextHeight(pSkillNames[v12], &v79, 0, 0);
687 } 699 v89 += v13;
688 ++v10; 700 ++v86;
689 } 701 }
690 while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton ); 702 ++v10;
691 if ( v86 ) 703 }
692 { 704 while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton );
693 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); 705 if ( v86 )
694 v79.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 706 {
695 pOutString = (GUIFont *)((149 - v89) / v86); 707 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString);
696 if ( (149 - v89) / v86 > 32 ) 708 v79.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
697 pOutString = (GUIFont *)32; 709 pOutString = (GUIFont *)((149 - v89) / v86);
698 v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162; 710 if ( (149 - v89) / v86 > 32 )
699 v89 = v8->pStartingPosActiveItem; 711 pOutString = (GUIFont *)32;
700 v83 = v14; 712 v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162;
701 if ( v89 < v89 + v8->pNumPresenceButton ) 713 v89 = v8->pStartingPosActiveItem;
702 { 714 v83 = v14;
703 v86 = 2; 715 if ( v89 < v89 + v8->pNumPresenceButton )
704 do 716 {
705 { 717 v86 = 2;
706 v15 = v8->GetControl(v89); 718 do
707 v16 = v15; 719 {
708 v17 = v15->uControlParam - 36; 720 v15 = v8->GetControl(v89);
709 if ( !byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v17] || v85->pActiveSkills[v17] ) 721 v16 = v15;
710 { 722 v17 = v15->uControlParam - 36;
711 v16->uW = 0; 723 if ( !byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v17] || v85->pActiveSkills[v17] )
712 v16->uHeight = 0; 724 {
713 v16->uY = 0; 725 v16->uW = 0;
714 } 726 v16->uHeight = 0;
715 else 727 v16->uY = 0;
716 { 728 }
717 v18 = pSkillNames[v17]; 729 else
718 v16->uY = (unsigned int)((char *)pOutString + v83); 730 {
719 Str[1] = v18; 731 v18 = pSkillNames[v17];
720 v19 = pFontArrus->CalcTextHeight(v18, &v79, 0, 0); 732 v16->uY = (unsigned int)((char *)pOutString + v83);
721 v20 = v16->uY; 733 Str[1] = v18;
722 v21 = v86; 734 v19 = pFontArrus->CalcTextHeight(v18, &v79, 0, 0);
723 v16->uHeight = v19; 735 v20 = v16->uY;
724 v22 = v19 + v20 - 1; 736 v21 = v86;
725 v16->uW = v22; 737 v16->uHeight = v19;
726 v83 = v22; 738 v22 = v19 + v20 - 1;
727 v23 = v84[0]; 739 v16->uW = v22;
728 if ( pDialogueWindow->pCurrentPosActiveItem != v21 ) 740 v83 = v22;
729 v23 = v81; 741 v23 = v84[0];
730 v79.DrawTitleText(pFontArrus, 0, v20, v23, Str[1], 3u); 742 if ( pDialogueWindow->pCurrentPosActiveItem != v21 )
731 } 743 v23 = v81;
732 v24 = v8->pNumPresenceButton; 744 v79.DrawTitleText(pFontArrus, 0, v20, v23, Str[1], 3u);
733 ++v89; 745 }
734 v25 = v8->pStartingPosActiveItem + v24; 746 v24 = v8->pNumPresenceButton;
735 ++v86; 747 ++v89;
736 } 748 v25 = v8->pStartingPosActiveItem + v24;
737 while ( v89 < v25 ); 749 ++v86;
738 } 750 }
739 return; 751 while ( v89 < v25 );
740 } 752 }
741 } 753 return;
742 v26 = pTmpBuf; 754 }
743 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->classType]); 755 }
744 strcat(pTmpBuf, "\n \n"); 756 v26 = pTmpBuf;
745 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); 757 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->classType]);
746 goto LABEL_97; 758 strcat(pTmpBuf, "\n \n");
747 } 759 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
760 v71 = 3;
761 v69 = v26;
762 v67 = v84[0];
763 v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138;
764 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71);
765 return;
766 break;
767 }
768 case 16:
769 {
748 *(_QWORD *)Str = pParty->uNumFoodRations; 770 *(_QWORD *)Str = pParty->uNumFoodRations;
749 //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] ) 771 //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] )
750 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) 772 if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier )
751 { 773 {
752 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); 774 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u);
753 if ( uActiveCharacter ) 775 if ( uActiveCharacter )
754 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); 776 pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0);
755 goto LABEL_43; 777 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
778 return;
756 } 779 }
757 if ( pParty->uNumGold >= v7 ) 780 if ( pParty->uNumGold >= v7 )
758 { 781 {
759 Party::TakeGold(v7); 782 Party::TakeGold(v7);
760 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; 783 //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
761 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; 784 pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
762 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3); 785 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3);
763 v5 = 1; 786 v5 = 1;
764 LABEL_43: 787 //LABEL_43:
765 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); 788 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
766 return; 789 return;
767 //goto LABEL_51; 790 //goto LABEL_51;
768 } 791 }
769 } 792 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
770 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 793 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4);
771 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); 794 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0);
772 goto LABEL_43; 795 break;
773 } 796 }
774 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 797 case 1:
775 return; 798 {
776 v28 = *(int *)v84; 799 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
777 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) 800 return;
778 v28 = v81; 801 v28 = *(int *)v84;
779 sprintf(Dest, format_4E2DC8, v28); 802 if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
780 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); 803 v28 = v81;
781 strcat(Dest, pTmpBuf2); 804 sprintf(Dest, format_4E2DC8, v28);
782 v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0); 805 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString);
783 strcat(Dest, "\n \n"); 806 strcat(Dest, pTmpBuf2);
784 v29 = *(int *)v84; 807 v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0);
785 if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) 808 strcat(Dest, "\n \n");
786 v29 = v81; 809 v29 = *(int *)v84;
787 sprintf(a1, format_4E2DC8, v29); 810 if ( pDialogueWindow->pCurrentPosActiveItem != 3 )
788 sprintf(pTmpBuf2, 811 v29 = v81;
789 pGlobalTXT_LocalizationStrings[86], 812 sprintf(a1, format_4E2DC8, v29);
790 //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], 813 sprintf(pTmpBuf2,
791 (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, 814 pGlobalTXT_LocalizationStrings[86],
792 v83); 815 //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C],
793 strcat(a1, pTmpBuf2); 816 (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier,
794 v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0); 817 v83);
795 strcat(a1, "\n \n"); 818 strcat(a1, pTmpBuf2);
796 v30 = *(int *)v84; 819 v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0);
797 if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) 820 strcat(a1, "\n \n");
798 v30 = v81; 821 v30 = *(int *)v84;
799 sprintf(v77, format_4E2DC8, v30); 822 if ( pDialogueWindow->pCurrentPosActiveItem != 4 )
800 strcat(v77, pGlobalTXT_LocalizationStrings[160]); 823 v30 = v81;
801 v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0); 824 sprintf(v77, format_4E2DC8, v30);
802 strcat(v77, "\n \n"); 825 strcat(v77, pGlobalTXT_LocalizationStrings[160]);
803 v75[0] = 0; 826 v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0);
804 v87 = 0; 827 strcat(v77, "\n \n");
805 v31 = (signed int)window_SpeakInHouse->ptr_1C; 828 v75[0] = 0;
806 if ( v31 >= 108 && v31 <= 120 ) 829 v87 = 0;
807 { 830 v31 = (signed int)window_SpeakInHouse->ptr_1C;
808 v32 = *(int *)v84; 831 if ( v31 >= 108 && v31 <= 120 )
809 if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) 832 {
810 v32 = v81; 833 v32 = *(int *)v84;
811 sprintf(v75, format_4E2DC8, v32); 834 if ( pDialogueWindow->pCurrentPosActiveItem != 5 )
812 strcat(v75, pGlobalTXT_LocalizationStrings[611]); 835 v32 = v81;
813 v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0); 836 sprintf(v75, format_4E2DC8, v32);
814 } 837 strcat(v75, pGlobalTXT_LocalizationStrings[611]);
815 v33 = pDialogueWindow; 838 v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0);
816 Str[1] = (char *)pDialogueWindow; 839 }
817 v34 = pDialogueWindow->pStartingPosActiveItem; 840 v33 = pDialogueWindow;
818 v35 = v34 + pDialogueWindow->pNumPresenceButton; 841 Str[1] = (char *)pDialogueWindow;
819 v36 = LOBYTE(pFontArrus->uFontHeight) - 3; 842 v34 = pDialogueWindow->pStartingPosActiveItem;
820 v37 = -pDialogueWindow->pNumPresenceButton < 0; 843 v35 = v34 + pDialogueWindow->pNumPresenceButton;
821 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; 844 v36 = LOBYTE(pFontArrus->uFontHeight) - 3;
822 if ( !(v37 ^ __OFSUB__(v34, v35)) ) 845 v37 = -pDialogueWindow->pNumPresenceButton < 0;
823 { 846 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
824 LABEL_75: 847 if ( !(v37 ^ __OFSUB__(v34, v35)) )
825 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); 848 {
826 v71 = 3; 849 //LABEL_75:
827 v69 = pTmpBuf; 850 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
828 v67 = 0; 851 v71 = 3;
829 v66 = 146; 852 v69 = pTmpBuf;
830 LABEL_98: 853 v67 = 0;
831 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); 854 v66 = 146;
832 return; 855 //LABEL_98:
833 } 856 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71);
834 while ( 1 ) 857 return;
835 { 858 }
836 v38 = v33->GetControl((unsigned int)pOutString); 859 while ( 1 )
837 if ( v38->uControlParam == 15 ) 860 {
838 { 861 v38 = v33->GetControl((unsigned int)pOutString);
839 v46 = v90; 862 if ( v38->uControlParam == 15 )
840 v38->uHeight = v90; 863 {
841 v38->uY = 146; 864 v46 = v90;
842 v41 = v46 + 145; 865 v38->uHeight = v90;
843 goto LABEL_73; 866 v38->uY = 146;
844 } 867 v41 = v46 + 145;
845 if ( v38->uControlParam == 16 ) 868 v38->uW = v41;
846 { 869 }
847 v44 = v88; 870 else if ( v38->uControlParam == 16 )
848 v45 = v90 + v36 + 146; 871 {
849 v38->uHeight = v88; 872 v44 = v88;
850 v38->uY = v45; 873 v45 = v90 + v36 + 146;
851 v41 = v45 + v44 - 1; 874 v38->uHeight = v88;
852 goto LABEL_73; 875 v38->uY = v45;
853 } 876 v41 = v45 + v44 - 1;
854 if ( v38->uControlParam == 96 ) 877 v38->uW = v41;
855 break; 878 }
856 if ( v38->uControlParam == 101 ) 879 else if ( v38->uControlParam == 96 )
857 { 880 {
858 v39 = v90 + 3 * v36 + v87 + v88 + 146; 881 v42 = v90 + v88 + 2 * v36 + 146;
859 v33 = (GUIWindow *)Str[1]; 882 v43 = v82;
860 v40 = v87; 883 v38->uY = v42;
861 v38->uHeight = v87; 884 v38->uHeight = v43;
862 v38->uY = v39; 885 v41 = v43 + v42 - 1;
863 v41 = v39 + v40 - 1; 886 v38->uW = v41;
864 LABEL_73: 887 }
865 v38->uW = v41; 888 else if ( v38->uControlParam == 101 )
866 } 889 {
867 v47 = v33->pStartingPosActiveItem; 890 v39 = v90 + 3 * v36 + v87 + v88 + 146;
868 pOutString = (GUIFont *)((char *)pOutString + 1); 891 v33 = (GUIWindow *)Str[1];
869 if ( (signed int)pOutString >= v33->pNumPresenceButton + v47 ) 892 v40 = v87;
870 goto LABEL_75; 893 v38->uHeight = v87;
871 } 894 v38->uY = v39;
872 v42 = v90 + v88 + 2 * v36 + 146; 895 v41 = v39 + v40 - 1;
873 v43 = v82; 896 //LABEL_73:
874 v38->uY = v42; 897 v38->uW = v41;
875 v38->uHeight = v43; 898 }
876 v41 = v43 + v42 - 1; 899 v47 = v33->pStartingPosActiveItem;
877 goto LABEL_73; 900 pOutString = (GUIFont *)((char *)pOutString + 1);
878 } 901 if ( (signed int)pOutString >= v33->pNumPresenceButton + v47 )
879 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 902 {
880 { 903 sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75);
881 v48 = 2; 904 v71 = 3;
882 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; 905 v69 = pTmpBuf;
883 pOutString = 0; 906 v67 = 0;
884 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; 907 v66 = 146;
885 if ( pParty->HasItem(0x28Bu) ) 908 v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71);
886 { 909 return;
887 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621]; 910 }
888 v48 = 3; 911 }
889 } 912 break;
890 for ( i = 0; i < v48; ++i ) 913 }
891 { 914 case 101:
892 v50 = pFontArrus->CalcTextHeight(pShopOptions[i], &v79, 0, 0); 915 {
893 pOutString = (GUIFont *)((char *)pOutString + v50); 916 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
894 } 917 {
895 v86 = (174 - (signed int)pOutString) / v48; 918 v48 = 2;
896 v51 = pDialogueWindow; 919 pShopOptions[0] = pGlobalTXT_LocalizationStrings[620];
897 v52 = 174 - v48 * (174 - (signed int)pOutString) / v48 - (signed int)pOutString; 920 pOutString = 0;
898 v53 = v52 - HIDWORD(v52); 921 pShopOptions[1] = pGlobalTXT_LocalizationStrings[622];
899 LODWORD(v52) = pDialogueWindow->pStartingPosActiveItem; 922 if ( pParty->HasItem(0x28Bu) )
900 HIDWORD(v52) = v52 + pDialogueWindow->pNumPresenceButton; 923 {
901 v54 = (v53 >> 1) - v86 / 2 + 138; 924 pShopOptions[2] = pGlobalTXT_LocalizationStrings[621];
902 v37 = -pDialogueWindow->pNumPresenceButton < 0; 925 v48 = 3;
903 v89 = pDialogueWindow->pStartingPosActiveItem; 926 }
904 if ( v37 ^ __OFSUB__((int)v52, HIDWORD(v52)) ) 927 for ( i = 0; i < v48; ++i )
905 { 928 {
906 v85 = (Player *)2; 929 v50 = pFontArrus->CalcTextHeight(pShopOptions[i], &v79, 0, 0);
907 pOutString = (GUIFont *)pShopOptions; 930 pOutString = (GUIFont *)((char *)pOutString + v50);
908 do 931 }
909 { 932 v86 = (174 - (signed int)pOutString) / v48;
910 v55 = v51->GetControl(v89); 933 v51 = pDialogueWindow;
911 v56 = (const char **)pOutString; 934 v52 = 174 - v48 * (174 - (signed int)pOutString) / v48 - (signed int)pOutString;
912 v55->uY = v86 + v54; 935 v53 = v52 - HIDWORD(v52);
913 v57 = pFontArrus->CalcTextHeight(*v56, &v79, 0, 0); 936 LODWORD(v52) = pDialogueWindow->pStartingPosActiveItem;
914 v58 = v55->uY; 937 HIDWORD(v52) = v52 + pDialogueWindow->pNumPresenceButton;
915 v59 = v85; 938 v54 = (v53 >> 1) - v86 / 2 + 138;
916 v55->uHeight = v57; 939 v37 = -pDialogueWindow->pNumPresenceButton < 0;
917 v54 = v57 + v58 - 1; 940 v89 = pDialogueWindow->pStartingPosActiveItem;
918 v55->uW = v54; 941 if ( v37 ^ __OFSUB__((int)v52, HIDWORD(v52)) )
919 v60 = v84[0]; 942 {
920 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v59 ) 943 v85 = (Player *)2;
921 v60 = v81; 944 pOutString = (GUIFont *)pShopOptions;
922 v79.DrawTitleText(pFontArrus, 0, v58, v60, *(const char **)&pOutString->cFirstChar, 3u); 945 do
923 v51 = pDialogueWindow; 946 {
924 v85 = (Player *)((char *)v85 + 1); 947 v55 = v51->GetControl(v89);
925 pOutString = (GUIFont *)((char *)pOutString + 4); 948 v56 = (const char **)pOutString;
926 ++v89; 949 v55->uY = v86 + v54;
927 } 950 v57 = pFontArrus->CalcTextHeight(*v56, &v79, 0, 0);
928 while ( v89 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); 951 v58 = v55->uY;
929 } 952 v59 = v85;
953 v55->uHeight = v57;
954 v54 = v57 + v58 - 1;
955 v55->uW = v54;
956 v60 = v84[0];
957 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v59 )
958 v60 = v81;
959 v79.DrawTitleText(pFontArrus, 0, v58, v60, *(const char **)&pOutString->cFirstChar, 3u);
960 v51 = pDialogueWindow;
961 v85 = (Player *)((char *)v85 + 1);
962 pOutString = (GUIFont *)((char *)pOutString + 4);
963 ++v89;
964 }
965 while ( v89 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
966 }
967 }
968 break;
969 }
970 default:
971 {
972 break;
973 }
930 } 974 }
931 } 975 }
932 976
933 977
934 //----- (004B910F) -------------------------------------------------------- 978 //----- (004B910F) --------------------------------------------------------
1052 v101.uFrameX = 483; 1096 v101.uFrameX = 483;
1053 v101.uFrameWidth = 148; 1097 v101.uFrameWidth = 148;
1054 v101.uFrameZ = 334; 1098 v101.uFrameZ = 334;
1055 v105 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 1099 v105 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
1056 v104 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 1100 v104 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
1057 if ( dword_F8B19C > 5 ) 1101 switch(dword_F8B19C)
1058 { 1102 {
1059 if ( dword_F8B19C == 94 ) 1103 case 94:
1060 { 1104 {
1061 draw_leather(); 1105 draw_leather();
1062 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 1106 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
1063 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; 1107 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];
1064 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; 1108 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];
1065 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; 1109 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];
1066 v65 = 0; 1110 v65 = 0;
1067 v66 = pShopOptions; 1111 v66 = pShopOptions;
1068 do 1112 do
1069 { 1113 {
1070 v67 = pFontArrus->CalcTextHeight(*v66, &v101, 0, 0); 1114 v67 = pFontArrus->CalcTextHeight(*v66, &v101, 0, 0);
1071 ++v66; 1115 ++v66;
1072 v65 += v67; 1116 v65 += v67;
1073 } 1117 }
1074 while ( (signed int)v66 < (signed int)&pShopOptions[3] ); 1118 while ( (signed int)v66 < (signed int)&pShopOptions[3] );
1075 v68 = pDialogueWindow; 1119 v68 = pDialogueWindow;
1076 v109 = (const char **)((174 - v65) / 3); 1120 v109 = (const char **)((174 - v65) / 3);
1077 result = (char *)pDialogueWindow->pStartingPosActiveItem; 1121 result = (char *)pDialogueWindow->pStartingPosActiveItem;
1078 v69 = (int)&result[pDialogueWindow->pNumPresenceButton]; 1122 v69 = (int)&result[pDialogueWindow->pNumPresenceButton];
1079 v70 = (3 * (58 - (signed int)v109) - v65) / 2 - (174 - v65) / 3 / 2 + 138; 1123 v70 = (3 * (58 - (signed int)v109) - v65) / 2 - (174 - v65) / 3 / 2 + 138;
1080 v20 = -pDialogueWindow->pNumPresenceButton < 0; 1124 v20 = -pDialogueWindow->pNumPresenceButton < 0;
1081 v106.y = pDialogueWindow->pStartingPosActiveItem; 1125 v106.y = pDialogueWindow->pStartingPosActiveItem;
1082 if ( v20 ^ __OFSUB__((int)result, (int)v69) ) 1126 if ( v20 ^ __OFSUB__((int)result, (int)v69) )
1083 { 1127 {
1084 _this = (Player *)2; 1128 _this = (Player *)2;
1085 v108 = (int)pShopOptions; 1129 v108 = (int)pShopOptions;
1086 do 1130 do
1087 { 1131 {
1088 v71 = v68->GetControl(v106.y); 1132 v71 = v68->GetControl(v106.y);
1089 v72 = (const char **)v108; 1133 v72 = (const char **)v108;
1090 v71->uY = (unsigned int)((char *)v109 + v70); 1134 v71->uY = (unsigned int)((char *)v109 + v70);
1091 v73 = pFontArrus->CalcTextHeight(*v72, &v101, 0, 0); 1135 v73 = pFontArrus->CalcTextHeight(*v72, &v101, 0, 0);
1092 v74 = v71->uY; 1136 v74 = v71->uY;
1093 v75 = _this; 1137 v75 = _this;
1094 v71->uHeight = v73; 1138 v71->uHeight = v73;
1095 v70 = v73 + v74 - 1; 1139 v70 = v73 + v74 - 1;
1096 v71->uW = v70; 1140 v71->uW = v70;
1097 v76 = v104; 1141 v76 = v104;
1098 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v75 ) 1142 if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v75 )
1099 v76 = v105; 1143 v76 = v105;
1100 v101.DrawTitleText(pFontArrus, 0, v74, v76, *(const char **)v108, 3u); 1144 v101.DrawTitleText(pFontArrus, 0, v74, v76, *(const char **)v108, 3u);
1101 v68 = pDialogueWindow; 1145 v68 = pDialogueWindow;
1102 _this = (Player *)((char *)_this + 1); 1146 _this = (Player *)((char *)_this + 1);
1103 v108 += 4; 1147 v108 += 4;
1104 ++v106.y; 1148 ++v106.y;
1105 result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); 1149 result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem);
1106 } 1150 }
1107 while ( v106.y < (signed int)result ); 1151 while ( v106.y < (signed int)result );
1108 } 1152 }
1109 return result; 1153 break;
1110 } 1154 }
1111 if ( dword_F8B19C != 95 ) 1155 case 96:
1112 { 1156 {
1113 result = (char *)(dword_F8B19C - 96);
1114 if ( dword_F8B19C == 96 )
1115 {
1116 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 1157 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
1117 if ( result ) 1158 if ( result )
1118 { 1159 {
1119 v30 = pDialogueWindow; 1160 v30 = pDialogueWindow;
1120 v3 = 0; 1161 v3 = 0;
1127 v108 = v32 / 3; 1168 v108 = v32 / 3;
1128 v33 = v30->pStartingPosActiveItem; 1169 v33 = v30->pStartingPosActiveItem;
1129 v34 = v33 + v30->pNumPresenceButton; 1170 v34 = v33 + v30->pNumPresenceButton;
1130 v109 = 0; 1171 v109 = 0;
1131 if ( (signed int)v33 >= v34 ) 1172 if ( (signed int)v33 >= v34 )
1132 goto LABEL_105; 1173 {
1174 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);
1175 strcat(pTmpBuf, "\n \n");
1176 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
1177 v7 = pTmpBuf;
1178 v86 = 3;
1179 v84 = pTmpBuf;
1180 v82 = v104;
1181 v80 = 0;
1182 v78 = 0;
1183 v77 = &v101;
1184 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
1185 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
1186 }
1133 do 1187 do
1134 { 1188 {
1135 v35 = v30->GetControl(v33)->uControlParam - 36; 1189 v35 = v30->GetControl(v33)->uControlParam - 36;
1136 if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v35] && !_this->pActiveSkills[v35] ) 1190 if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v35] && !_this->pActiveSkills[v35] )
1137 { 1191 {
1142 ++v33; 1196 ++v33;
1143 } 1197 }
1144 while ( (signed int)v33 < v30->pNumPresenceButton + v30->pStartingPosActiveItem ); 1198 while ( (signed int)v33 < v30->pNumPresenceButton + v30->pStartingPosActiveItem );
1145 if ( !v109 ) 1199 if ( !v109 )
1146 { 1200 {
1147 LABEL_105: 1201 //LABEL_105:
1148 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); 1202 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);
1149 strcat(pTmpBuf, "\n \n"); 1203 strcat(pTmpBuf, "\n \n");
1150 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); 1204 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
1151 v7 = pTmpBuf; 1205 v7 = pTmpBuf;
1152 v86 = 3; 1206 v86 = 3;
1153 v84 = pTmpBuf; 1207 v84 = pTmpBuf;
1154 v82 = v104; 1208 v82 = v104;
1155 v80 = 0; 1209 v80 = 0;
1156 v78 = 0; 1210 v78 = 0;
1157 v77 = &v101; 1211 v77 = &v101;
1158 goto LABEL_15; 1212 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
1213 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
1159 } 1214 }
1160 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108); 1215 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108);
1161 v101.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); 1216 v101.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
1162 v108 = (149 - v106.y) / (signed int)v109; 1217 v108 = (149 - v106.y) / (signed int)v109;
1163 if ( (149 - v106.y) / (signed int)v109 > 32 ) 1218 if ( (149 - v106.y) / (signed int)v109 > 32 )
1203 v109 = (const char **)((char *)v109 + 1); 1258 v109 = (const char **)((char *)v109 + 1);
1204 } 1259 }
1205 while ( v106.y < (signed int)result ); 1260 while ( v106.y < (signed int)result );
1206 } 1261 }
1207 } 1262 }
1208 } 1263 break;
1209 return result; 1264 }
1210 } 1265 case 95:
1211 } 1266 {
1212 else 1267 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
1213 { 1268 v3 = 0;
1214 if ( dword_F8B19C == 5 ) 1269 v109 = 0;
1215 { 1270 v108 = 0;
1216 draw_leather(); 1271 do
1217 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 1272 {
1218 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); 1273 // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] )
1219 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 1274 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID)
1220 if ( result ) 1275 {
1221 { 1276 v52 = word_F8B158[(signed int)v109] + 30;
1222 v27 = pMouse->GetCursorPos(&v99)->x - 14; 1277 v53 = ItemsInShopTexture[(signed int)v109];
1223 v106.x = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v97)->y - 17) >> 5); 1278 v54 = 60 - ((signed int)v53->uTextureWidth >> 1);
1224 result = (char *)pMouse->GetCursorPos(&v95); 1279 pRenderer->DrawTextureTransparent(v54 + v108, word_F8B158[(signed int)v109] + 30, v53);
1225 if ( *(int *)result > 13 ) 1280 sub_40F92A(
1226 { 1281 &pRenderer->pActiveZBuffer[v54 + v108 + 640 * v52],
1227 result = (char *)pMouse->GetCursorPos(&v93); 1282 ItemsInShopTexture[(signed int)v109],
1228 if ( *(int *)result < 462 ) 1283 (int)((char *)v109 + 1));
1229 { 1284 }
1230 result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x); 1285 v109 = (const char **)((char *)v109 + 1);
1231 v3 = 0; 1286 v108 += 70;
1232 if ( result ) 1287 }
1233 { 1288 while ( (signed int)v109 < 6 );
1234 result = (char *)(9 * (int)result); 1289 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
1235 if ( _this->field_1F5[4 * (int)result + 15] & 2 ) 1290 if ( result )
1236 { 1291 {
1237 v85 = 0; 1292 v55 = 0;
1238 v83 = 5; 1293 v106.x = 0;
1239 v81 = window_SpeakInHouse->ptr_1C; 1294 do
1240 v79 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * (int)result + 5]; 1295 {
1241 v28 = (int)window_SpeakInHouse->ptr_1C; 1296 // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
1242 v110 = uActiveCharacter - 1; 1297 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
1243 v29 = _this->_490EEE( 1298 ++v106.x;
1244 (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * (int)result + 5], 1299 ++v55;
1245 1, 1300 }
1246 v28, 1301 while ( v55 < 6 );
1247 5); 1302 v56 = GetAsyncKeyState(17);
1248 v6 = v110; 1303 v57 = _this->CanSteal();
1249 v5 = (char *)pMerchantsRepairPhrases[v29]; 1304 Str = (char *)v57;
1250 goto LABEL_14; 1305 if ( v56 && v57 )
1251 } 1306 {
1252 } 1307 v58 = pGlobalTXT_LocalizationStrings[185];
1253 } 1308 }
1254 } 1309 else
1255 } 1310 {
1256 return result; 1311 v58 = pGlobalTXT_LocalizationStrings[195];
1257 } 1312 if ( dword_F8B19C != 2 )
1258 if ( dword_F8B19C == 1 ) 1313 v58 = pGlobalTXT_LocalizationStrings[196];
1259 { 1314 }
1260 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 1315 DrawTextAtStatusBar(v58, 0);
1261 if ( result ) 1316 if ( v106.x )
1262 { 1317 {
1263 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; 1318 v59 = pMouse->GetCursorPos(&v91);
1264 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; 1319 result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]);
1265 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; 1320 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF )
1266 v14 = 0; 1321 {
1267 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; 1322 v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1;
1268 v15 = pShopOptions; 1323 v106.x = v60;
1269 do 1324 v61 = (int)window_SpeakInHouse->ptr_1C;
1270 { 1325 // v62 = 9 * (v60 + 12 * v61);
1271 v16 = pFontArrus->CalcTextHeight(*v15, &v101, 0, 0); 1326 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
1272 ++v15; 1327 if ( dword_F8B19C != 2 )
1273 v14 += v16; 1328 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
1274 } 1329 if ( !v56 || !Str )
1275 while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); 1330 {
1276 v17 = pDialogueWindow; 1331 v85 = 0;
1277 v103 = (174 - v14) / 4; 1332 v83 = 2;
1278 result = (char *)pDialogueWindow->pStartingPosActiveItem; 1333 v81 = window_SpeakInHouse->ptr_1C;
1279 v18 = (int)&result[pDialogueWindow->pNumPresenceButton]; 1334 v79 = v63;
1280 v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; 1335 v110 = uActiveCharacter - 1;
1281 v20 = -pDialogueWindow->pNumPresenceButton < 0; 1336 v64 = _this->_490EEE(v63, 1, v61, 2);
1282 _this = (Player *)pDialogueWindow->pStartingPosActiveItem; 1337 v6 = v110;
1283 if ( v20 ^ __OFSUB__((int)result, v18) ) 1338 v5 = (char *)pMerchantsBuyPhrases[v64];
1284 { 1339 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
1285 v108 = 2; 1340 v86 = 3;
1286 v109 = (const char **)pShopOptions; 1341 v84 = v7;
1287 do 1342 v82 = v105;
1288 { 1343 v80 = v3;
1289 v21 = v17->GetControl((unsigned int)_this); 1344 v78 = v3;
1290 v22 = v109; 1345 v77 = &v101;
1291 v21->uY = v103 + v19; 1346 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
1292 v23 = pFontArrus->CalcTextHeight(*v22, &v101, 0, 0); 1347 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
1293 v24 = v21->uY; 1348 }
1294 v25 = v108; 1349 v5 = pGlobalTXT_LocalizationStrings[181];
1295 v21->uHeight = v23; 1350 v85 = 0;
1296 v19 = v24 + v23 - 1; 1351 v83 = 2;
1297 v21->uW = v19; 1352 v81 = window_SpeakInHouse->ptr_1C;
1298 v26 = v104; 1353 v79 = v63;
1299 if ( pDialogueWindow->pCurrentPosActiveItem != v25 ) 1354 v6 = uActiveCharacter - 1;
1300 v26 = v105; 1355 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
1301 v101.DrawTitleText(pFontArrus, 0, v24, v26, *v109, 3u); 1356 v86 = 3;
1302 v17 = pDialogueWindow; 1357 v84 = v7;
1303 ++v108; 1358 v82 = v105;
1304 ++v109; 1359 v80 = v3;
1305 _this = (Player *)((char *)_this + 1); 1360 v78 = v3;
1306 result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); 1361 v77 = &v101;
1307 } 1362 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
1308 while ( (signed int)_this < (signed int)result ); 1363 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
1309 } 1364 }
1310 } 1365 }
1311 return result; 1366 else
1312 } 1367 {
1313 if ( dword_F8B19C != 2 ) 1368 v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
1314 { 1369 result =0; //added
1315 if ( dword_F8B19C == 3 ) 1370 }
1316 { 1371 }
1372 break;
1373 }
1374 case 2:
1375 {
1376 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
1377 v3 = 0;
1378 v48 = 0;
1379 v108 = 0;
1380 v109 = 0;
1381 do
1382 {
1383 // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] )
1384 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID);
1385 {
1386 v49 = word_F8B158[(signed int)v48];
1387 v50 = ItemsInShopTexture[(signed int)v48];
1388 v49 += 30;
1389 v51 = 60 - ((signed int)v50->uTextureWidth >> 1);
1390 pRenderer->DrawTextureTransparent(v51 + v108, v49, v50);
1391 sub_40F92A(
1392 &pRenderer->pActiveZBuffer[v51 + v108 + 640 * v49],
1393 ItemsInShopTexture[(signed int)v109],
1394 (int)((char *)v109 + 1));
1395 v48 = v109;
1396 }
1397 v108 += 70;
1398 v48 = (const char **)((char *)v48 + 1);
1399 v109 = v48;
1400 }
1401 while ( (signed int)v48 < 6 );
1402 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
1403 if ( result )
1404 {
1405 v55 = 0;
1406 v106.x = 0;
1407 v106.x = 0;
1408 do
1409 {
1410 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
1411 ++v106.x;
1412 ++v55;
1413 }
1414 while ( v55 < 6 );
1415 v56 = GetAsyncKeyState(17);
1416 v57 = _this->CanSteal();
1417 Str = (char *)v57;
1418 if ( v56 && v57 )
1419 {
1420 v58 = pGlobalTXT_LocalizationStrings[185];
1421 }
1422 else
1423 {
1424 v58 = pGlobalTXT_LocalizationStrings[195];
1425 if ( dword_F8B19C != 2 )
1426 v58 = pGlobalTXT_LocalizationStrings[196];
1427 }
1428 DrawTextAtStatusBar(v58, 0);
1429 if ( v106.x )
1430 {
1431 v59 = pMouse->GetCursorPos(&v91);
1432 result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]);
1433 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF )
1434 {
1435 v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1;
1436 v106.x = v60;
1437 v61 = (int)window_SpeakInHouse->ptr_1C;
1438 // v62 = 9 * (v60 + 12 * v61);
1439 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
1440 if ( dword_F8B19C != 2 )
1441 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
1442 if ( !v56 || !Str )
1443 {
1444 v85 = 0;
1445 v83 = 2;
1446 v81 = window_SpeakInHouse->ptr_1C;
1447 v79 = v63;
1448 v110 = uActiveCharacter - 1;
1449 v64 = _this->_490EEE(v63, 1, v61, 2);
1450 v6 = v110;
1451 v5 = (char *)pMerchantsBuyPhrases[v64];
1452 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
1453 v86 = 3;
1454 v84 = v7;
1455 v82 = v105;
1456 v80 = v3;
1457 v78 = v3;
1458 v77 = &v101;
1459 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
1460 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
1461 }
1462 v5 = pGlobalTXT_LocalizationStrings[181];
1463 v85 = 0;
1464 v83 = 2;
1465 v81 = window_SpeakInHouse->ptr_1C;
1466 v79 = v63;
1467 v6 = uActiveCharacter - 1;
1468 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
1469 v86 = 3;
1470 v84 = v7;
1471 v82 = v105;
1472 v80 = v3;
1473 v78 = v3;
1474 v77 = &v101;
1475 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
1476 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
1477 }
1478 }
1479 else
1480 {
1481 v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
1482 result =0; //added
1483 }
1484 }
1485 break;
1486 }
1487 case 3:
1488 {
1317 draw_leather(); 1489 draw_leather();
1318 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 1490 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
1319 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); 1491 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);
1320 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 1492 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
1321 if ( result ) 1493 if ( result )
1339 v12 = (int)window_SpeakInHouse->ptr_1C; 1511 v12 = (int)window_SpeakInHouse->ptr_1C;
1340 v110 = uActiveCharacter - 1; 1512 v110 = uActiveCharacter - 1;
1341 v13 = _this->_490EEE(v79, 1, v12, 3); 1513 v13 = _this->_490EEE(v79, 1, v12, 3);
1342 v6 = v110; 1514 v6 = v110;
1343 v5 = (char *)pMerchantsSellPhrases[v13]; 1515 v5 = (char *)pMerchantsSellPhrases[v13];
1344 goto LABEL_14; 1516 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
1517 v86 = 3;
1518 v84 = v7;
1519 v82 = v105;
1520 v80 = v3;
1521 v78 = v3;
1522 v77 = &v101;
1523 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
1524 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
1345 } 1525 }
1346 } 1526 }
1347 } 1527 }
1348 } 1528 }
1349 } 1529 break;
1350 else 1530 }
1351 { 1531 case 4:
1352 result = (char *)(dword_F8B19C - 4); 1532 {
1353 if ( dword_F8B19C == 4 ) 1533 draw_leather();
1354 { 1534 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
1355 draw_leather(); 1535 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);
1356 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 1536 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
1357 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); 1537 if ( result )
1358 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 1538 {
1359 if ( result ) 1539 v2 = pMouse->GetCursorPos(&a2)->x - 14;
1360 { 1540 v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5);
1361 v2 = pMouse->GetCursorPos(&a2)->x - 14; 1541 result = (char *)pMouse->GetCursorPos(&v100);
1362 v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5); 1542 if ( *(int *)result > 13 )
1363 result = (char *)pMouse->GetCursorPos(&v100); 1543 {
1364 if ( *(int *)result > 13 ) 1544 result = (char *)pMouse->GetCursorPos(&v92);
1365 { 1545 if ( *(int *)result < 462 )
1366 result = (char *)pMouse->GetCursorPos(&v92); 1546 {
1367 if ( *(int *)result < 462 ) 1547 result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x);
1368 { 1548 v3 = 0;
1369 result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x); 1549 if ( result )
1370 v3 = 0; 1550 {
1371 if ( result ) 1551 v85 = 0;
1372 { 1552 v83 = 4;
1373 v85 = 0; 1553 v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5];
1374 v83 = 4; 1554 if (!v4->Identified())
1375 v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; 1555 {
1376 if (!v4->Identified()) 1556 v81 = window_SpeakInHouse->ptr_1C;
1377 { 1557 v79 = v4;
1378 v81 = window_SpeakInHouse->ptr_1C; 1558 v9 = (int)window_SpeakInHouse->ptr_1C;
1379 v79 = v4; 1559 v110 = uActiveCharacter - 1;
1380 v9 = (int)window_SpeakInHouse->ptr_1C; 1560 v10 = _this->_490EEE(v4, 1, v9, 4);
1381 v110 = uActiveCharacter - 1; 1561 v6 = v110;
1382 v10 = _this->_490EEE(v4, 1, v9, 4); 1562 v5 = (char *)pMerchantsIdentifyPhrases[v10];
1383 v6 = v110; 1563 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
1384 v5 = (char *)pMerchantsIdentifyPhrases[v10]; 1564 v86 = 3;
1385 goto LABEL_14; 1565 v84 = v7;
1386 } 1566 v82 = v105;
1387 v81 = window_SpeakInHouse->ptr_1C; 1567 v80 = v3;
1388 v5 = "%24"; 1568 v78 = v3;
1389 v79 = v4; 1569 v77 = &v101;
1390 LABEL_13: 1570 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
1391 v6 = uActiveCharacter - 1; 1571 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
1392 LABEL_14: 1572 }
1393 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); 1573 v81 = window_SpeakInHouse->ptr_1C;
1394 v86 = 3; 1574 v5 = "%24";
1395 v84 = v7; 1575 v79 = v4;
1396 v82 = v105; 1576 //LABEL_13:
1397 v80 = v3; 1577 v6 = uActiveCharacter - 1;
1398 v78 = v3; 1578 //LABEL_14:
1399 v77 = &v101; 1579 v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85);
1400 LABEL_15: 1580 v86 = 3;
1401 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); 1581 v84 = v7;
1402 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); 1582 v82 = v105;
1403 } 1583 v80 = v3;
1404 } 1584 v78 = v3;
1405 } 1585 v77 = &v101;
1406 } 1586 //LABEL_15:
1407 } 1587 v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80);
1408 } 1588 return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86);
1409 return result; 1589 }
1410 } 1590 }
1411 } 1591 }
1412 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); 1592 }
1413 v3 = 0; 1593 break;
1414 if ( dword_F8B19C == 2 ) 1594 }
1415 { 1595 case 1:
1416 v48 = 0; 1596 {
1417 v108 = 0; 1597 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
1418 v109 = 0; 1598 if ( result )
1419 do 1599 {
1420 { 1600 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];
1421 // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) 1601 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];
1422 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID); 1602 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];
1423 { 1603 v14 = 0;
1424 v49 = word_F8B158[(signed int)v48]; 1604 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
1425 v50 = ItemsInShopTexture[(signed int)v48]; 1605 v15 = pShopOptions;
1426 v49 += 30; 1606 do
1427 v51 = 60 - ((signed int)v50->uTextureWidth >> 1); 1607 {
1428 pRenderer->DrawTextureTransparent(v51 + v108, v49, v50); 1608 v16 = pFontArrus->CalcTextHeight(*v15, &v101, 0, 0);
1429 sub_40F92A( 1609 ++v15;
1430 &pRenderer->pActiveZBuffer[v51 + v108 + 640 * v49], 1610 v14 += v16;
1431 ItemsInShopTexture[(signed int)v109], 1611 }
1432 (int)((char *)v109 + 1)); 1612 while ( (signed int)v15 < (signed int)&unk_F8B1C8 );
1433 v48 = v109; 1613 v17 = pDialogueWindow;
1434 } 1614 v103 = (174 - v14) / 4;
1435 v108 += 70; 1615 result = (char *)pDialogueWindow->pStartingPosActiveItem;
1436 v48 = (const char **)((char *)v48 + 1); 1616 v18 = (int)&result[pDialogueWindow->pNumPresenceButton];
1437 v109 = v48; 1617 v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138;
1438 } 1618 v20 = -pDialogueWindow->pNumPresenceButton < 0;
1439 while ( (signed int)v48 < 6 ); 1619 _this = (Player *)pDialogueWindow->pStartingPosActiveItem;
1440 } 1620 if ( v20 ^ __OFSUB__((int)result, v18) )
1441 else 1621 {
1442 { 1622 v108 = 2;
1443 v109 = 0; 1623 v109 = (const char **)pShopOptions;
1444 v108 = 0; 1624 do
1445 do 1625 {
1446 { 1626 v21 = v17->GetControl((unsigned int)_this);
1447 // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) 1627 v22 = v109;
1448 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) 1628 v21->uY = v103 + v19;
1449 { 1629 v23 = pFontArrus->CalcTextHeight(*v22, &v101, 0, 0);
1450 v52 = word_F8B158[(signed int)v109] + 30; 1630 v24 = v21->uY;
1451 v53 = ItemsInShopTexture[(signed int)v109]; 1631 v25 = v108;
1452 v54 = 60 - ((signed int)v53->uTextureWidth >> 1); 1632 v21->uHeight = v23;
1453 pRenderer->DrawTextureTransparent(v54 + v108, word_F8B158[(signed int)v109] + 30, v53); 1633 v19 = v24 + v23 - 1;
1454 sub_40F92A( 1634 v21->uW = v19;
1455 &pRenderer->pActiveZBuffer[v54 + v108 + 640 * v52], 1635 v26 = v104;
1456 ItemsInShopTexture[(signed int)v109], 1636 if ( pDialogueWindow->pCurrentPosActiveItem != v25 )
1457 (int)((char *)v109 + 1)); 1637 v26 = v105;
1458 } 1638 v101.DrawTitleText(pFontArrus, 0, v24, v26, *v109, 3u);
1459 v109 = (const char **)((char *)v109 + 1); 1639 v17 = pDialogueWindow;
1460 v108 += 70; 1640 ++v108;
1461 } 1641 ++v109;
1462 while ( (signed int)v109 < 6 ); 1642 _this = (Player *)((char *)_this + 1);
1463 } 1643 result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem);
1464 result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 1644 }
1465 if ( result ) 1645 while ( (signed int)_this < (signed int)result );
1466 { 1646 }
1467 v55 = 0; 1647 }
1468 v106.x = 0; 1648 break;
1469 if ( dword_F8B19C == 2 ) 1649 }
1470 { 1650 default:
1471 v106.x = 0; 1651 {
1472 do 1652 if( dword_F8B19C > 5 )
1473 { 1653 result = (char *)(dword_F8B19C - 96);
1474 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) 1654 else
1475 ++v106.x; 1655 result = (char *)(dword_F8B19C - 4);
1476 ++v55; 1656 break;
1477 } 1657 }
1478 while ( v55 < 6 );
1479 }
1480 else
1481 {
1482 do
1483 {
1484 // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
1485 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID)
1486 ++v106.x;
1487 ++v55;
1488 }
1489 while ( v55 < 6 );
1490 }
1491 v56 = GetAsyncKeyState(17);
1492 v57 = _this->CanSteal();
1493 Str = (char *)v57;
1494 if ( v56 && v57 )
1495 {
1496 v58 = pGlobalTXT_LocalizationStrings[185];
1497 }
1498 else
1499 {
1500 v58 = pGlobalTXT_LocalizationStrings[195];
1501 if ( dword_F8B19C != 2 )
1502 v58 = pGlobalTXT_LocalizationStrings[196];
1503 }
1504 DrawTextAtStatusBar(v58, 0);
1505 if ( v106.x )
1506 {
1507 v59 = pMouse->GetCursorPos(&v91);
1508 result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]);
1509 if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF )
1510 {
1511 v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1;
1512 v106.x = v60;
1513 v61 = (int)window_SpeakInHouse->ptr_1C;
1514 // v62 = 9 * (v60 + 12 * v61);
1515 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
1516 if ( dword_F8B19C != 2 )
1517 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
1518 if ( !v56 || !Str )
1519 {
1520 v85 = 0;
1521 v83 = 2;
1522 v81 = window_SpeakInHouse->ptr_1C;
1523 v79 = v63;
1524 v110 = uActiveCharacter - 1;
1525 v64 = _this->_490EEE(v63, 1, v61, 2);
1526 v6 = v110;
1527 v5 = (char *)pMerchantsBuyPhrases[v64];
1528 goto LABEL_14;
1529 }
1530 v5 = pGlobalTXT_LocalizationStrings[181];
1531 v85 = 0;
1532 v83 = 2;
1533 v81 = window_SpeakInHouse->ptr_1C;
1534 v79 = v63;
1535 goto LABEL_13;
1536 }
1537 }
1538 else
1539 {
1540 v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
1541 result =0; //added
1542 }
1543 } 1658 }
1544 return result; 1659 return result;
1545 } 1660 }
1546 1661
1547 1662
11499 } 11614 }
11500 pWindow_MainMenu->Release(); 11615 pWindow_MainMenu->Release();
11501 pIcons_LOD->_4114F2(); 11616 pIcons_LOD->_4114F2();
11502 } 11617 }
11503 11618
11504 int __stdcall pWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam)
11505 {
11506 return DefWindowProcA(hWnd, Msg, wParam, lParam);
11507 }
11508 11619
11509 11620
11510 //----- (004637EB) -------------------------------------------------------- 11621 //----- (004637EB) --------------------------------------------------------
11511 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) 11622 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam)
11512 { 11623 {
13051 if (uGammaPos < 0 || uGammaPos > 9) 13162 if (uGammaPos < 0 || uGammaPos > 9)
13052 uGammaPos = 4; 13163 uGammaPos = 4;
13053 pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6); 13164 pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6);
13054 13165
13055 if ( ReadWindowsRegistryInt("Bloodsplats", 1) ) 13166 if ( ReadWindowsRegistryInt("Bloodsplats", 1) )
13056 pGame->uFlags2 |= 0x20u; 13167 pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS;
13057 else 13168 else
13058 pGame->uFlags2 &= 0xFFFFFFDFu; 13169 pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS;
13059 13170
13060 uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0); 13171 uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0);
13061 dword_6BE384_2dacceloff = ReadWindowsRegistryInt("2dacceloff", 0); 13172 dword_6BE384_2dacceloff = ReadWindowsRegistryInt("2dacceloff", 0);
13062 13173
13063 if (!bNoSound) 13174 if (!bNoSound)
13287 assert(sizeof(EventIndex) == 0xC); 13398 assert(sizeof(EventIndex) == 0xC);
13288 assert(sizeof(_2devent) == 0x34); 13399 assert(sizeof(_2devent) == 0x34);
13289 assert(sizeof(stru176) == 0x20); 13400 assert(sizeof(stru176) == 0x20);
13290 assert(sizeof(SavegameHeader) == 0x64); 13401 assert(sizeof(SavegameHeader) == 0x64);
13291 assert(sizeof(SavegameList) == 0x3138); 13402 assert(sizeof(SavegameList) == 0x3138);
13292 assert(sizeof(StorylineText) == 0x168); 13403 assert(sizeof(StorylineText) == 0x160);
13293 assert(sizeof(FactionTable) == 0x1EF1); 13404 assert(sizeof(FactionTable) == 0x1EF1);
13294 assert(sizeof(Decal) == 0xC20); 13405 assert(sizeof(Decal) == 0xC20);
13295 assert(sizeof(DecalBuilder) == 0x30C038); 13406 assert(sizeof(DecalBuilder) == 0x30C038);
13296 assert(sizeof(MonsterInfo) == 0x58); 13407 assert(sizeof(MonsterInfo) == 0x58);
13297 assert(sizeof(MonsterStats) == 0x5BA0); 13408 assert(sizeof(MonsterStats) == 0x5BA0);
13303 assert(sizeof(GUIButton) == 0xBC); 13414 assert(sizeof(GUIButton) == 0xBC);
13304 assert(sizeof(GUIWindow) == 0x54); 13415 assert(sizeof(GUIWindow) == 0x54);
13305 assert(sizeof(GUIProgressBar) == 0x1B8); 13416 assert(sizeof(GUIProgressBar) == 0x1B8);
13306 assert(sizeof(GUIFont) == 0x1020); 13417 assert(sizeof(GUIFont) == 0x1020);
13307 assert(sizeof(stru262_TurnBased) == 0x40); 13418 assert(sizeof(stru262_TurnBased) == 0x40);
13308 //assert(sizeof(ArcomageGame) == 0xFA); 13419 assert(sizeof(ArcomageGame) == 0xFB);
13309 assert(sizeof(stru277) == 0x14); 13420 assert(sizeof(stru277) == 0x14);
13310 assert(sizeof(ArcomageCard) == 0x6C); 13421 assert(sizeof(ArcomageCard) == 0x6C);
13311 assert(sizeof(stru320) == 0x3FC); 13422 assert(sizeof(stru320) == 0x3FC);
13312 assert(sizeof(TravelInfo) == 0x20); 13423 assert(sizeof(TravelInfo) == 0x20);
13313 assert(sizeof(stru336) == 0x798); 13424 assert(sizeof(stru336) == 0x798);
14543 v4 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType; 14654 v4 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType;
14544 if ( v4 == 4 ) 14655 if ( v4 == 4 )
14545 { 14656 {
14546 if ( v2 ) 14657 if ( v2 )
14547 { 14658 {
14548 LABEL_7:
14549 LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR); 14659 LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
14550 if ( (signed int)SkillToMastery(v5) < 3 ) 14660 if ( (signed int)SkillToMastery(v5) < 3 )
14551 { 14661 {
14552 LABEL_8:
14553 v0->PlaySound(SPEECH_39, 0); 14662 v0->PlaySound(SPEECH_39, 0);
14554 return; 14663 return;
14555 } 14664 }
14556 v3 = pParty->pPickedItem.uItemID; 14665 v3 = pParty->pPickedItem.uItemID;
14557 goto LABEL_16;
14558 } 14666 }
14559 } 14667 }
14560 else 14668 else
14561 { 14669 {
14562 if ( (v4 == 8 || v4 == 1 || v4 == 2) 14670 if ( (v4 == 8 || v4 == 1 || v4 == 2)
14563 && v1 14671 && v1
14564 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uSkillType == 4 ) 14672 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uSkillType == 4 )
14565 goto LABEL_7; 14673 {
14566 } 14674 LOBYTE(v5) = v0->GetActualSkillLevel(PLAYER_SKILL_SPEAR);
14567 LABEL_16: 14675 if ( (signed int)SkillToMastery(v5) < 3 )
14676 {
14677 v0->PlaySound(SPEECH_39, 0);
14678 return;
14679 }
14680 }
14681 }
14568 if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) ) 14682 if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) )
14569 goto LABEL_8; 14683 {
14684
14685 v0->PlaySound(SPEECH_39, 0);
14686 return;
14687 }
14570 if ( pParty->pPickedItem.uItemID == 604 ) 14688 if ( pParty->pPickedItem.uItemID == 604 )
14571 { 14689 {
14572 sub_467E7F_EquipBody(3u); 14690 sub_467E7F_EquipBody(3u);
14573 WetsuitOn(uActiveCharacter); 14691 WetsuitOn(uActiveCharacter);
14574 return; 14692 return;
14583 case 7u: 14701 case 7u:
14584 case 8u: 14702 case 8u:
14585 case 9u: 14703 case 9u:
14586 case 0xBu: 14704 case 0xBu:
14587 if ( !v0->HasSkill(v4) ) 14705 if ( !v0->HasSkill(v4) )
14588 goto LABEL_8; 14706 {
14707 v0->PlaySound(SPEECH_39, 0);
14708 return;
14709 }
14589 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) ) 14710 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) && (v6 != 3 || bUnderwater) )
14590 goto LABEL_95; 14711 {
14712 v46 = 0;
14713 v45 = 0;
14714 v44 = 0;
14715 v43 = 0;
14716 v42 = -1;
14717 v41 = 0;
14718 v40 = 0;
14719 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14720 return;
14721 }
14591 sub_467E7F_EquipBody(v6); 14722 sub_467E7F_EquipBody(v6);
14592 if ( pParty->pPickedItem.uItemID == 604 ) 14723 if ( pParty->pPickedItem.uItemID == 604 )
14593 WetsuitOff(uActiveCharacter); 14724 WetsuitOff(uActiveCharacter);
14594 return; 14725 return;
14595 case 0xAu: 14726 case 0xAu:
14596 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) 14727 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
14597 goto LABEL_95; 14728 {
14729 v46 = 0;
14730 v45 = 0;
14731 v44 = 0;
14732 v43 = 0;
14733 v42 = -1;
14734 v41 = 0;
14735 v40 = 0;
14736 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14737 return;
14738 }
14598 v52 = 10; 14739 v52 = 10;
14599 v7 = (int)&v0->pEquipment.field_28; 14740 v7 = (int)&v0->pEquipment.field_28;
14600 while ( 1 ) 14741 while ( 1 )
14601 { 14742 {
14602 if ( !*(int *)v7 ) 14743 if ( !*(int *)v7 )
14603 { 14744 {
14604 v8 = v0->FindFreeInventorySlot(); 14745 v8 = v0->FindFreeInventorySlot();
14605 if ( (v8 & 0x80000000u) == 0 ) 14746 if ( (v8 & 0x80000000u) == 0 )
14747 {
14748 v9 = v52;
14749 pParty->pPickedItem.uBodyAnchor = v52 + 1;
14750 memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8]));
14751 *(&v0->pEquipment.uOffHand + v9) = v8 + 1;
14752 pMouse->RemoveHoldingItem();
14606 break; 14753 break;
14754 }
14607 } 14755 }
14608 ++v52; 14756 ++v52;
14609 v7 += 4; 14757 v7 += 4;
14610 if ( (signed int)v52 > 15 ) 14758 if ( (signed int)v52 > 15 )
14611 goto LABEL_33; 14759 break;
14612 } 14760 }
14613 v9 = v52;
14614 pParty->pPickedItem.uBodyAnchor = v52 + 1;
14615 memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8]));
14616 *(&v0->pEquipment.uOffHand + v9) = v8 + 1;
14617 pMouse->RemoveHoldingItem();
14618 LABEL_33:
14619 if ( v52 == 16 ) 14761 if ( v52 == 16 )
14620 { 14762 {
14621 v52 = v0->pEquipment.field_3C - 1; 14763 v52 = v0->pEquipment.field_3C - 1;
14622 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 14764 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
14623 v10 = (int)((char *)v0 + 36 * v52); 14765 v10 = (int)((char *)v0 + 36 * v52);
14630 v0->pEquipment.field_3C = v11; 14772 v0->pEquipment.field_3C = v11;
14631 } 14773 }
14632 return; 14774 return;
14633 case 4u: 14775 case 4u:
14634 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) 14776 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
14635 goto LABEL_95; 14777 {
14778 v46 = 0;
14779 v45 = 0;
14780 v44 = 0;
14781 v43 = 0;
14782 v42 = -1;
14783 v41 = 0;
14784 v40 = 0;
14785 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14786 return;
14787 }
14636 if ( !v0->HasSkill(v4) ) 14788 if ( !v0->HasSkill(v4) )
14637 goto LABEL_8; 14789 {
14790 v0->PlaySound(SPEECH_39, 0);
14791 return;
14792 }
14638 if ( v54 ) 14793 if ( v54 )
14639 { 14794 {
14640 --v54; 14795 --v54;
14641 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 14796 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
14642 v12 = (int)((char *)v0 + 36 * v54); 14797 v12 = (int)((char *)v0 + 36 * v54);
14660 { 14815 {
14661 pParty->pPickedItem.uBodyAnchor = 1; 14816 pParty->pPickedItem.uBodyAnchor = 1;
14662 v17 = v52 + 1; 14817 v17 = v52 + 1;
14663 memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52])); 14818 memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52]));
14664 v0->pEquipment.uOffHand = v17; 14819 v0->pEquipment.uOffHand = v17;
14665 goto LABEL_45; 14820 pMouse->RemoveHoldingItem();
14821 return;
14666 } 14822 }
14667 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 14823 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
14668 v15 = (int)((char *)v0 + 36 * (v53 - 1)); 14824 v15 = (int)((char *)v0 + 36 * (v53 - 1));
14669 *(char *)(v15 + 556) = 0; 14825 *(char *)(v15 + 556) = 0;
14670 pParty->pPickedItem.Reset(); 14826 pParty->pPickedItem.Reset();
14679 case 0u: 14835 case 0u:
14680 case 0xCu: 14836 case 0xCu:
14681 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) 14837 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter)
14682 && pParty->pPickedItem.uItemID != 64 14838 && pParty->pPickedItem.uItemID != 64
14683 && pParty->pPickedItem.uItemID != 65 ) 14839 && pParty->pPickedItem.uItemID != 65 )
14684 goto LABEL_95; 14840 {
14841 v46 = 0;
14842 v45 = 0;
14843 v44 = 0;
14844 v43 = 0;
14845 v42 = -1;
14846 v41 = 0;
14847 v40 = 0;
14848 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14849 return;
14850 }
14685 if ( !v0->HasSkill(v4) ) 14851 if ( !v0->HasSkill(v4) )
14686 goto LABEL_8; 14852 {
14853 v0->PlaySound(SPEECH_39, 0);
14854 return;
14855 }
14687 v50 = 0; 14856 v50 = 0;
14688 if ( v4 == 2 && (unsigned __int16)(v0->pActiveSkills[2] & 0xFFC0) 14857 if ( v4 == 2 && (unsigned __int16)(v0->pActiveSkills[2] & 0xFFC0)
14689 || v4 == 1 && (signed int)SkillToMastery(v0->pActiveSkills[1]) >= 3 ) 14858 || v4 == 1 && (signed int)SkillToMastery(v0->pActiveSkills[1]) >= 3 )
14690 { 14859 {
14691 if (pAsyncMouse) 14860 if (pAsyncMouse)
14717 memcpy((void *)(v20 + 532), &_this, 0x24u); 14886 memcpy((void *)(v20 + 532), &_this, 0x24u);
14718 v0->pEquipment.uOffHand = v21; 14887 v0->pEquipment.uOffHand = v21;
14719 if ( !v14 ) 14888 if ( !v14 )
14720 return; 14889 return;
14721 v22 = _this.uItemID; 14890 v22 = _this.uItemID;
14722 LABEL_73:
14723 v50 = v22; 14891 v50 = v22;
14724 goto LABEL_74; 14892 if ( v50 )
14893 stru_A750F8[uActiveCharacter - 1]._494836(
14894 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
14895 uActiveCharacter - 1 + 9);
14896 break;
14725 } 14897 }
14726 v23 = v0->FindFreeInventorySlot(); 14898 v23 = v0->FindFreeInventorySlot();
14727 if ( (v23 & 0x80000000u) != 0 ) 14899 if ( (v23 & 0x80000000u) != 0 )
14728 return; 14900 return;
14729 pParty->pPickedItem.uBodyAnchor = 1; 14901 pParty->pPickedItem.uBodyAnchor = 1;
14730 v50 = (unsigned int)&v0->pInventoryItems[v23]; 14902 v50 = (unsigned int)&v0->pInventoryItems[v23];
14731 memcpy(&v0->pInventoryItems[v23], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v23])); 14903 memcpy(&v0->pInventoryItems[v23], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v23]));
14732 v0->pEquipment.uOffHand = v23 + 1; 14904 v0->pEquipment.uOffHand = v23 + 1;
14733 LABEL_71:
14734 pMouse->RemoveHoldingItem(); 14905 pMouse->RemoveHoldingItem();
14735 if ( v52 != 12 ) 14906 if ( v52 != 12 )
14736 return; 14907 return;
14737 v22 = *(int *)v50; 14908 v22 = *(int *)v50;
14738 goto LABEL_73; 14909 v50 = v22;
14910 if ( v50 )
14911 stru_A750F8[uActiveCharacter - 1]._494836(
14912 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
14913 uActiveCharacter - 1 + 9);
14914 break;
14739 } 14915 }
14740 } 14916 }
14741 } 14917 }
14742 if ( !v53 ) 14918 if ( !v53 )
14743 { 14919 {
14746 return; 14922 return;
14747 pParty->pPickedItem.uBodyAnchor = 2; 14923 pParty->pPickedItem.uBodyAnchor = 2;
14748 v50 = (unsigned int)&v0->pInventoryItems[v26]; 14924 v50 = (unsigned int)&v0->pInventoryItems[v26];
14749 memcpy(&v0->pInventoryItems[v26], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v26])); 14925 memcpy(&v0->pInventoryItems[v26], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v26]));
14750 v0->pEquipment.uMainHand = v26 + 1; 14926 v0->pEquipment.uMainHand = v26 + 1;
14751 goto LABEL_71; 14927 pMouse->RemoveHoldingItem();
14928 if ( v52 != 12 )
14929 return;
14930 v22 = *(int *)v50;
14931 v50 = v22;
14932 if ( v50 )
14933 stru_A750F8[uActiveCharacter - 1]._494836(
14934 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
14935 uActiveCharacter - 1 + 9);
14936 break;
14752 } 14937 }
14753 --v53; 14938 --v53;
14754 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 14939 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
14755 v24 = (int)((char *)v0 + 36 * v53); 14940 v24 = (int)((char *)v0 + 36 * v53);
14756 *(char *)(v24 + 556) = 0; 14941 *(char *)(v24 + 556) = 0;
14763 v0->pEquipment.uMainHand = v25; 14948 v0->pEquipment.uMainHand = v25;
14764 if ( v14 ) 14949 if ( v14 )
14765 v50 = _this.uItemID; 14950 v50 = _this.uItemID;
14766 if ( v51 ) 14951 if ( v51 )
14767 v0->pEquipment.uOffHand = 0; 14952 v0->pEquipment.uOffHand = 0;
14768 LABEL_74:
14769 if ( v50 ) 14953 if ( v50 )
14770 stru_A750F8[uActiveCharacter - 1]._494836( 14954 stru_A750F8[uActiveCharacter - 1]._494836(
14771 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50), 14955 *((int *)&pSpellDatas[66].uNormalLevelRecovery + v50),
14772 uActiveCharacter - 1 + 9); 14956 uActiveCharacter - 1 + 9);
14773 break; 14957 break;
14774 case 1u: 14958 case 1u:
14775 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) ) 14959 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(uActiveCharacter) )
14776 goto LABEL_95; 14960 {
14961 v46 = 0;
14962 v45 = 0;
14963 v44 = 0;
14964 v43 = 0;
14965 v42 = -1;
14966 v41 = 0;
14967 v40 = 0;
14968 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14969 return;
14970 }
14777 if ( !v0->HasSkill(v4) ) 14971 if ( !v0->HasSkill(v4) )
14778 goto LABEL_8; 14972 {
14973 v0->PlaySound(SPEECH_39, 0);
14974 return;
14975 }
14779 if ( v53 ) 14976 if ( v53 )
14780 { 14977 {
14781 if ( v54 ) 14978 if ( v54 )
14782 { 14979 {
14783 v46 = 0; 14980 v46 = 0;
14785 v44 = 0; 14982 v44 = 0;
14786 v43 = 0; 14983 v43 = 0;
14787 v42 = -1; 14984 v42 = -1;
14788 v41 = 0; 14985 v41 = 0;
14789 v40 = 0; 14986 v40 = 0;
14790 goto LABEL_96; 14987 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14988 return;
14791 } 14989 }
14792 --v53; 14990 --v53;
14793 memcpy(&_this, &pParty->pPickedItem, sizeof(_this)); 14991 memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
14794 v27 = (int)((char *)v0 + 36 * v53); 14992 v27 = (int)((char *)v0 + 36 * v53);
14795 *(char *)(v27 + 556) = 0; 14993 *(char *)(v27 + 556) = 0;
14822 { 15020 {
14823 pParty->pPickedItem.uBodyAnchor = 2; 15021 pParty->pPickedItem.uBodyAnchor = 2;
14824 v31 = v52 + 1; 15022 v31 = v52 + 1;
14825 memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52])); 15023 memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52]));
14826 v0->pEquipment.uMainHand = v31; 15024 v0->pEquipment.uMainHand = v31;
14827 LABEL_45:
14828 pMouse->RemoveHoldingItem(); 15025 pMouse->RemoveHoldingItem();
14829 } 15026 }
14830 } 15027 }
14831 } 15028 }
14832 return; 15029 return;
14859 v52 = pItemsTable->pItems[v38->uItemID].uEquipType; 15056 v52 = pItemsTable->pItems[v38->uItemID].uEquipType;
14860 if ( v14 ) 15057 if ( v14 )
14861 { 15058 {
14862 if ( bUnderwater ) 15059 if ( bUnderwater )
14863 { 15060 {
14864 LABEL_95:
14865 v46 = 0; 15061 v46 = 0;
14866 v45 = 0; 15062 v45 = 0;
14867 v44 = 0; 15063 v44 = 0;
14868 v43 = 0; 15064 v43 = 0;
14869 v42 = -1; 15065 v42 = -1;
14870 v41 = 0; 15066 v41 = 0;
14871 v40 = 0; 15067 v40 = 0;
14872 LABEL_96:
14873 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46); 15068 pAudioPlayer->PlaySound(SOUND_27, v40, v41, v42, v43, v44, v45, v46);
14874 return; 15069 return;
14875 } 15070 }
14876 WetsuitOff(uActiveCharacter); 15071 WetsuitOff(uActiveCharacter);
14877 } 15072 }
14992 if ( v1 != (int *)-1 ) 15187 if ( v1 != (int *)-1 )
14993 DoInteractionWithTopmostZObject((unsigned __int16)v1, (signed int)(unsigned __int16)v1 >> 3); 15188 DoInteractionWithTopmostZObject((unsigned __int16)v1, (signed int)(unsigned __int16)v1 >> 3);
14994 } 15189 }
14995 v22 = 0; 15190 v22 = 0;
14996 v1 = (int *)((signed int)(viewparams->uScreenZ + viewparams->uScreenX) >> 1); 15191 v1 = (int *)((signed int)(viewparams->uScreenZ + viewparams->uScreenX) >> 1);
14997 if ( (signed int)viewparams->uScreenY >= (signed int)viewparams->uScreenW ) 15192 if ( (signed int)viewparams->uScreenY < (signed int)viewparams->uScreenW )
14998 goto LABEL_21; 15193 {
14999 v2 = (char *)v1 - 50; 15194 v2 = (char *)v1 - 50;
15000 v1 = (int *)((char *)v1 + 50); 15195 v1 = (int *)((char *)v1 + 50);
15001 v3 = 640 * viewparams->uScreenY; 15196 v3 = 640 * viewparams->uScreenY;
15002 v17 = v2; 15197 v17 = v2;
15003 v20 = v1; 15198 v20 = v1;
15004 v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1; 15199 v18 = ((viewparams->uScreenW - viewparams->uScreenY - 1) >> 1) + 1;
15005 do 15200 do
15006 { 15201 {
15007 if ( (signed int)v2 >= (signed int)v20 ) 15202 if ( (signed int)v2 < (signed int)v20 )
15008 goto LABEL_20; 15203 {
15009 v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; 15204 v1 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
15010 v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]]; 15205 v21 = &pRenderer->pActiveZBuffer[(int)&v2[v3]];
15011 v4 = v22; 15206 v4 = v22;
15012 v5 = (((char *)v20 - v2 - 1) >> 1) + 1; 15207 v5 = (((char *)v20 - v2 - 1) >> 1) + 1;
15013 do 15208 do
15014 { 15209 {
15015 v6 = 0; 15210 v6 = 0;
15016 v7 = *v1 & 0xFFFF; 15211 v7 = *v1 & 0xFFFF;
15017 v19 = 0; 15212 v19 = 0;
15018 if ( v4 > 0 ) 15213 if ( v4 > 0 )
15019 { 15214 {
15020 do 15215 do
15021 { 15216 {
15022 if ( dword_7207F0[v6] == v7 ) 15217 if ( dword_7207F0[v6] == v7 )
15023 break; 15218 break;
15024 ++v6; 15219 ++v6;
15025 v19 = v6; 15220 v19 = v6;
15026 } 15221 }
15027 while ( v6 < v22 ); 15222 while ( v6 < v22 );
15028 } 15223 }
15029 if ( (v7 & 7) == OBJECT_Decoration) 15224 if ( (v7 & 7) == OBJECT_Decoration)
15030 { 15225 {
15031 v16 = (unsigned int)v7 >> 3; 15226 v16 = (unsigned int)v7 >> 3;
15032 if ( (signed int)(((unsigned int)*v21 >> 16) 15227 if ( (signed int)(((unsigned int)*v21 >> 16)
15033 - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)v7 >> 3].uDecorationDescID].uRadius) > 512 ) 15228 - pDecorationList->pDecorations[pLevelDecorations[(unsigned int)v7 >> 3].uDecorationDescID].uRadius) <= 512 )
15034 goto LABEL_18; 15229 if ( v19 == v22 && v4 < 100 )
15035 } 15230 {
15036 else 15231 ++v22;
15037 { 15232 ++v4;
15038 if ( (unsigned int)*v21 > 0x2000000 ) 15233 v8 = *v21;
15039 goto LABEL_18; 15234 dword_7207EC[v4] = v7;
15040 } 15235 dword_72065C[v4] = v8;
15041 if ( v19 == v22 && v4 < 100 ) 15236 }
15042 { 15237 }
15043 ++v22; 15238 else if ( (unsigned int)*v21 <= 0x2000000 )
15044 ++v4; 15239 {
15045 v8 = *v21; 15240 if ( v19 == v22 && v4 < 100 )
15046 dword_7207EC[v4] = v7; 15241 {
15047 dword_72065C[v4] = v8; 15242 ++v22;
15048 } 15243 ++v4;
15049 LABEL_18: 15244 v8 = *v21;
15050 v1 = v21 + 2; 15245 dword_7207EC[v4] = v7;
15051 --v5; 15246 dword_72065C[v4] = v8;
15052 v21 += 2; 15247 }
15053 } 15248 }
15054 while ( v5 ); 15249 v1 = v21 + 2;
15055 v2 = v17; 15250 --v5;
15056 LABEL_20: 15251 v21 += 2;
15057 v3 += 1280; 15252 }
15058 --v18; 15253 while ( v5 );
15059 } 15254 v2 = v17;
15060 while ( v18 ); 15255 }
15061 LABEL_21: 15256 v3 += 1280;
15257 --v18;
15258 }
15259 while ( v18 );
15260 }
15062 if ( v22 > 0 ) 15261 if ( v22 > 0 )
15063 { 15262 {
15064 v9 = dword_720660; 15263 v9 = dword_720660;
15065 v10 = 1; 15264 v10 = 1;
15066 do 15265 do
15231 { 15430 {
15232 if ( a1 >> 9 >= pOutdoor->uNumBModels 15431 if ( a1 >> 9 >= pOutdoor->uNumBModels
15233 || (v7 = &pOutdoor->pBModels[a1 >> 9].pFaces[(a1 >> 3) & 0x3F], BYTE2(v7->uAttributes) & 0x10) 15432 || (v7 = &pOutdoor->pBModels[a1 >> 9].pFaces[(a1 >> 3) & 0x3F], BYTE2(v7->uAttributes) & 0x10)
15234 || (v6 = v7->sCogTriggeredID) == 0 ) 15433 || (v6 = v7->sCogTriggeredID) == 0 )
15235 return 1; 15434 return 1;
15236 LABEL_13:
15237 EventProcessor((signed __int16)v6, v2, 1); 15435 EventProcessor((signed __int16)v6, v2, 1);
15238 return 0; 15436 return 0;
15239 } 15437 }
15240 v4 = &pIndoor->pFaces[a1 >> 3]; 15438 v4 = &pIndoor->pFaces[a1 >> 3];
15241 v5 = v4->uAttributes; 15439 v5 = v4->uAttributes;
15245 return 1; 15443 return 1;
15246 } 15444 }
15247 if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 ) 15445 if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 )
15248 return 1; 15446 return 1;
15249 if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) 15447 if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG )
15250 goto LABEL_13; 15448 {
15449 EventProcessor((signed __int16)v6, v2, 1);
15450 return 0;
15451 }
15251 break; 15452 break;
15252 } 15453 }
15253 return 0; 15454 return 0;
15254 } 15455 }
15255 // 4E28F8: using guessed type int pCurrentScreen; 15456 // 4E28F8: using guessed type int pCurrentScreen;
15751 || pParty->vPosition.y < -22528 15952 || pParty->vPosition.y < -22528
15752 || pParty->vPosition.y > 22528 ) 15953 || pParty->vPosition.y > 22528 )
15753 { 15954 {
15754 strcpy(pOutdoor->pLevelFilename, pCurrentMapName); 15955 strcpy(pOutdoor->pLevelFilename, pCurrentMapName);
15755 v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, (char *)&pOut, 32); 15956 v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, (char *)&pOut, 32);
15756 if ( !bUnderwater && (pParty->uFlags & 0x8C || BYTE1(pParty->uFlags) & 2 || pParty->bFlying) || !v0 ) 15957 if ( !bUnderwater && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER | PARTY_FLAGS_1_FALLING | 0x04) || pParty->uFlags & 0x0200 || pParty->bFlying) || !v0 )
15757 { 15958 {
15758 if ( pParty->vPosition.x < -22528 ) 15959 if ( pParty->vPosition.x < -22528 )
15759 pParty->vPosition.x = -22528; 15960 pParty->vPosition.x = -22528;
15760 if ( pParty->vPosition.x > 22528 ) 15961 if ( pParty->vPosition.x > 22528 )
15761 pParty->vPosition.x = 22528; 15962 pParty->vPosition.x = 22528;