World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Файл UIShops.h

См. исходные тексты.

Функции

void WeaponShopWares (GUIWindow dialogwin, bool special=0)
 
void ArmorShopWares (GUIWindow dialogwin, bool special=0)
 
void AlchemyMagicShopWares (GUIWindow dialogwin, BuildingType building, bool special=0)
 
void UIShop_Buy_Identify_Repair ()
 
void sub_4B1523_showSpellbookInfo (int spellItemId)
 
void ShowPopupShopItem ()
 
void GetHouseGoodbyeSpeech ()
 
void sub_4B1447_party_fine (int shopId, int stealingResult, int fineToAdd)
 

Переменные

class Imageshop_ui_background
 
std::array< class Image *, 12 > shop_ui_items_in_store
 

Функции

◆ WeaponShopWares()

void WeaponShopWares ( GUIWindow  dialogwin,
bool  special = 0 
)

См. определение в файле UIShops.cpp строка 327

327  {
328  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f, shop_ui_background);
329  int item_X = 0;
330 
331  for (uint i = 0; i < 6; ++i) {
332  if ((special == 0 &&
333  pParty
334  ->StandartItemsInShops[(unsigned int)
336  .uItemID) ||
337  (special == 1 &&
338  pParty
339  ->SpecialItemsInShops[(unsigned int)
341  .uItemID)) {
342  render->DrawTextureAlphaNew(
343  ((60 -
344  ((signed int)shop_ui_items_in_store[i]->GetWidth() / 2)) +
345  item_X) /
346  640.0f,
347  (weapons_Ypos[i] + 30) / 480.0f, shop_ui_items_in_store[i]);
348  }
349 
350  item_X += 70;
351  }
352 
354  uint item_num = 0;
355  for (uint i = 0; i < 6; ++i) {
356  if ((special == 0 &&
357  pParty
358  ->StandartItemsInShops[(unsigned int)
360  .uItemID) ||
361  (special == 1 &&
362  pParty
363  ->SpecialItemsInShops[(unsigned int)
365  .uItemID)) {
366  ++item_num;
367  }
368  }
369 
370  if (OS_IfCtrlPressed() && pPlayers[uActiveCharacter]->CanSteal())
372  localization->GetString(185),
373  0); // Steal item / Украсть предмет
374  else
376  localization->GetString(195),
377  0); // Buy item / Выберите предмет для покупки
378 
379  if (item_num) { // this shoudl go into func??
381  ItemGen *item;
382 
383  int testx = (pt.x - 30) / 70;
384  if (testx >= 0 && testx < 6) { // testx limits check
385  if (special == 0) {
386  item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
387  } else {
388  item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
389  }
390 
391  if (item->uItemID) { // item picking
392  int testpos =
393  ((60 - ((signed int)shop_ui_items_in_store[testx]
394  ->GetWidth() /
395  2)) +
396  testx * 70);
397 
398  if (pt.x >= testpos &&
399  pt.x < (testpos + (signed int)shop_ui_items_in_store[testx]->GetWidth())) {
400  if (pt.y >= weapons_Ypos[testx] + 30 &&
401  pt.y < (weapons_Ypos[testx] + 30 + shop_ui_items_in_store[testx]->GetHeight())) {
402  String str;
403  if (!OS_IfCtrlPressed() ||
404  !pPlayers[uActiveCharacter]->CanSteal()) {
405  str = BuildDialogueString(
406  pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(
408  (int)window_SpeakInHouse->ptr_1C, 2)],
409  uActiveCharacter - 1, item,
410  (char *)window_SpeakInHouse->ptr_1C, 2);
411  } else {
412  str = BuildDialogueString(
413  localization->GetString(181),
414  uActiveCharacter - 1, item,
415  (char *)window_SpeakInHouse->ptr_1C, 2);
416  }
417  dialogwin.DrawTitleText(
418  pFontArrus, 0,
419  (174 - pFontArrus->CalcTextHeight(
420  str, dialogwin.uFrameWidth, 0)) /
421  2 +
422  138,
423  Color16(0xFFu, 0xFFu, 0xFFu), str, 3);
424  }
425  }
426  }
427  }
428  } else { // shop empty
431  [(unsigned int)window_SpeakInHouse->ptr_1C] -
432  pParty->GetPlayingTime()); //Приходите через 7 дней
433  }
434  }
435 }

Перекрестные ссылки BuildDialogueString(), BuildingType_WeaponShop, GUIFont::CalcTextHeight(), Color16(), GUIWindow::DrawShops_next_generation_time_string(), GUIWindow::DrawTitleText(), GameUI_StatusBar_DrawImmediate(), Mouse::GetCursorPos(), Party::GetPlayingTime(), Localization::GetString(), HouseUI_CheckIfPlayerCanInteract(), localization, OS_IfCtrlPressed(), Party::PartyTimes, pFontArrus, pMerchantsBuyPhrases, pParty, pPlayers, GUIWindow::ptr_1C, render, Engine_::IocContainer::ResolveMouse(), shop_ui_background, shop_ui_items_in_store, PartyTimeStruct::Shops_next_generation_time, Party::SpecialItemsInShops, Party::StandartItemsInShops, uActiveCharacter, GUIWindow::uFrameWidth, ItemGen::uItemID, weapons_Ypos, window_SpeakInHouse, Point::x и Point::y.

Используется в WeaponShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ ArmorShopWares()

void ArmorShopWares ( GUIWindow  dialogwin,
bool  special = 0 
)

См. определение в файле UIShops.cpp строка 483

483  {
484  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f, shop_ui_background);
485  int item_x = 0;
486 
487  for (int i = 0; i < 8; ++i) {
488  if ((special == 0 &&
490  .uItemID) ||
491  (special == 1 &&
493  .uItemID)) {
494  if (i >= 4) { // low row
495  render->DrawTextureAlphaNew(
496  ((90 - (shop_ui_items_in_store[i]->GetWidth() / 2)) +
497  item_x - 420) /
498  640.0f,
499  126 / 480.0f, shop_ui_items_in_store[i]);
500  } else {
501  render->DrawTextureAlphaNew(
502  ((86 - (shop_ui_items_in_store[i]->GetWidth() / 2)) +
503  item_x) /
504  640.0f,
505  (98 - shop_ui_items_in_store[i]->GetHeight()) / 480.0f,
507  }
508  }
509  item_x += 105;
510  }
511 
513  int pItemCount = 0;
514  for (int i = 0; i < 8; ++i) {
515  if ((special == 0 &&
517  .uItemID) ||
518  (special == 1 &&
520  .uItemID))
521  ++pItemCount;
522  }
523 
524  if (OS_IfCtrlPressed() == 0 ||
525  pPlayers[uActiveCharacter]->CanSteal() == 0)
527  0); // Select the Item to Buy
528  else
530  0); // Steal item
531 
532  if (pItemCount) { // this should go into func??
534 
535  int testx = (pt.x - 40) / 105;
536  // testx limits check
537  if (testx >= 0 && testx < 4) {
538  if (pt.y >= 126) {
539  testx += 4;
540  }
541 
542  ItemGen *item;
543  if (special == 0) {
544  item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
545  } else {
546  item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
547  }
548 
549  if (item->uItemID) {
550  int testpos;
551  if (testx >= 4) {
552  testpos =
553  ((90 - (shop_ui_items_in_store[testx]->GetWidth() / 2)) +
554  (testx * 105) - 420); // low row
555  } else {
556  testpos =
557  ((86 - (shop_ui_items_in_store[testx]->GetWidth() / 2)) +
558  testx * 105);
559  }
560 
561  if (pt.x >= testpos &&
562  pt.x <= testpos + shop_ui_items_in_store[testx]->GetWidth()) {
563  if ((pt.y >= 126 &&
564  pt.y < (126 + shop_ui_items_in_store[testx]->GetHeight())) ||
565  (pt.y <= 98 &&
566  pt.y >= (98 - shop_ui_items_in_store[testx]->GetHeight()))) {
567  // y is 126 to 126 + height low or 98-height to 98
568 
569  String str;
570  if (!OS_IfCtrlPressed() ||
571  !pPlayers[uActiveCharacter]->CanSteal()) {
572  str = BuildDialogueString(
574  [pPlayers[uActiveCharacter]->SelectPhrasesTransaction(
576  uActiveCharacter - 1, item,
577  (char *)window_SpeakInHouse->ptr_1C, 2);
578  } else {
579  str = BuildDialogueString(
580  localization->GetString(181),
581  uActiveCharacter - 1, item,
582  (char *)window_SpeakInHouse->ptr_1C,
583  2); // "Steal %24"
584  }
585  dialogwin.DrawTitleText(
586  pFontArrus, 0,
587  (174 - pFontArrus->CalcTextHeight(str, dialogwin.uFrameWidth, 0)) / 2 + 138,
588  Color16(0xFFu, 0xFFu, 0xFFu), str, 3);
589  }
590  }
591  }
592  }
593  } else {
594  // empty shop
598  }
599  }
600 }

Перекрестные ссылки BuildDialogueString(), BuildingType_ArmorShop, GUIFont::CalcTextHeight(), Color16(), GUIWindow::DrawShops_next_generation_time_string(), GUIWindow::DrawTitleText(), GameUI_StatusBar_DrawImmediate(), Mouse::GetCursorPos(), Party::GetPlayingTime(), Localization::GetString(), HouseUI_CheckIfPlayerCanInteract(), localization, OS_IfCtrlPressed(), GUIWindow::par1C, Party::PartyTimes, pFontArrus, pMerchantsBuyPhrases, pParty, pPlayers, GUIWindow::ptr_1C, render, Engine_::IocContainer::ResolveMouse(), shop_ui_background, shop_ui_items_in_store, PartyTimeStruct::Shops_next_generation_time, Party::SpecialItemsInShops, Party::StandartItemsInShops, uActiveCharacter, GUIWindow::uFrameWidth, ItemGen::uItemID, window_SpeakInHouse, Point::x и Point::y.

Используется в ArmorShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ AlchemyMagicShopWares()

void AlchemyMagicShopWares ( GUIWindow  dialogwin,
BuildingType  building,
bool  special = 0 
)

См. определение в файле UIShops.cpp строка 648

649  {
650  render->DrawTextureAlphaNew(8 / 640.0f, 8 / 480.0f, shop_ui_background);
651 
652  int itemx;
653  int itemy;
654 
655  for (uint i = 0; i < 12; ++i) {
656  if ((special == 0 &&
658  .uItemID) ||
659  (special == 1 &&
661  .uItemID)) {
662  if (i >= 6) { // low row
663  itemy = 308 - shop_ui_items_in_store[i]->GetHeight();
664  if (itemy < 0) itemy = 0;
665 
666  itemx = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 +
667  40 - 450;
668 
669  } else {
670  itemy = 152 - shop_ui_items_in_store[i]->GetHeight();
671  if (itemy < 0) itemy = 0;
672 
673  itemx = 75 * i - shop_ui_items_in_store[i]->GetWidth() / 2 + 40;
674  }
675 
676  if (i == 0 || i == 6) {
677  if (itemx < 18) itemx = 18;
678  }
679 
680  if (i == 5 || i == 11) {
681  if (itemx > 457 - shop_ui_items_in_store[i]->GetWidth())
682  itemx = 457 - shop_ui_items_in_store[i]->GetWidth();
683  }
684 
685  render->DrawTextureAlphaNew(itemx / 640.0f, itemy / 480.0f,
687  }
688  }
689 
691  int item_num = 0;
692 
693  for (uint i = 0; i < 12; ++i) {
694  if (special == 0 &&
695  pParty
696  ->StandartItemsInShops[(unsigned int)window_SpeakInHouse
697  ->ptr_1C][i]
698  .uItemID ||
699  special == 1 &&
700  pParty
701  ->SpecialItemsInShops[(unsigned int)window_SpeakInHouse
702  ->ptr_1C][i]
703  .uItemID)
704  ++item_num;
705  }
706 
707  if (OS_IfCtrlPressed() && pPlayers[uActiveCharacter]->CanSteal())
709  else
711 
712  if (item_num) {
714 
715  int testx = (pt.x) / 75;
716  // testx limits check
717  if (testx >= 0 && testx < 6) {
718  if (pt.y > 152) {
719  testx += 6;
720  }
721 
722  ItemGen *item;
723  if (special == 0) {
724  item = &pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
725  } else {
726  item = &pParty->SpecialItemsInShops[(int)window_SpeakInHouse->ptr_1C][testx];
727  }
728 
729  if (item->uItemID) { // item picking
730  int testpos;
731  if (pt.y > 152) {
732  testpos = 75 * testx - shop_ui_items_in_store[testx]->GetWidth() / 2 + 40 - 450;
733  } else {
734  testpos = 75 * testx - shop_ui_items_in_store[testx]->GetWidth() / 2 + 40;
735  }
736 
737  if (pt.x >= testpos &&
738  pt.x <= testpos + shop_ui_items_in_store[testx]->GetWidth()) {
739  if ((pt.y <= 308 &&
740  pt.y >= (308 - shop_ui_items_in_store[testx]->GetHeight())) ||
741  (pt.y <= 152 &&
742  pt.y >= (152 - shop_ui_items_in_store[testx]->GetHeight()))) {
743  // y is 152-h to 152 or 308-height to 308
744 
745  String str;
746  if (!OS_IfCtrlPressed() ||
747  !pPlayers[uActiveCharacter]->CanSteal()) {
748  str = BuildDialogueString(
751  ->SelectPhrasesTransaction(
752  item, building,
754  2)],
755  uActiveCharacter - 1, item,
756  (char *)window_SpeakInHouse->ptr_1C, 2);
757  } else {
758  str = BuildDialogueString(
759  localization->GetString(181),
760  uActiveCharacter - 1, item,
761  (char *)window_SpeakInHouse->ptr_1C,
762  2); // "Steal %24"
763  }
764  dialogwin.DrawTitleText(
765  pFontArrus, 0,
766  (174 - pFontArrus->CalcTextHeight(
767  str, dialogwin.uFrameWidth, 0)) /
768  2 +
769  138,
770  Color16(0xFFu, 0xFFu, 0xFFu), str, 3);
771  }
772  }
773  }
774  }
775  } else {
776  // shop empty
779  [(unsigned int)window_SpeakInHouse->ptr_1C] -
781  }
782  }
783 }

Перекрестные ссылки BuildDialogueString(), GUIFont::CalcTextHeight(), Color16(), GUIWindow::DrawShops_next_generation_time_string(), GUIWindow::DrawTitleText(), GameUI_StatusBar_DrawImmediate(), Mouse::GetCursorPos(), Party::GetPlayingTime(), Localization::GetString(), HouseUI_CheckIfPlayerCanInteract(), localization, OS_IfCtrlPressed(), GUIWindow::par1C, Party::PartyTimes, pFontArrus, pMerchantsBuyPhrases, pParty, pPlayers, GUIWindow::ptr_1C, render, Engine_::IocContainer::ResolveMouse(), shop_ui_background, shop_ui_items_in_store, PartyTimeStruct::Shops_next_generation_time, Party::SpecialItemsInShops, Party::StandartItemsInShops, uActiveCharacter, GUIWindow::uFrameWidth, ItemGen::uItemID, window_SpeakInHouse, Point::x и Point::y.

Используется в AlchemistDialog() и MagicShopDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ UIShop_Buy_Identify_Repair()

void UIShop_Buy_Identify_Repair ( )

См. определение в файле UIShops.cpp строка 874

874  {
875  unsigned int pItemID; // esi@20
876  ItemGen *item; // esi@21
877 
878  // int v18; // ecx@37
879  float pPriceMultiplier; // ST1C_4@38
880  int taken_item; // eax@40
881  ItemGen *bought_item; // esi@51
882  int party_reputation; // eax@55
883  int v39; // eax@63
884  int v42; // esi@74
885  signed int v43; // ebx@74
886  unsigned __int16 *pSkill; // esi@77
887  int v55; // [sp+0h] [bp-B4h]@26
888  int a6; // [sp+98h] [bp-1Ch]@57
889  int a3; // [sp+9Ch] [bp-18h]@53
890  unsigned int uNumSeconds; // [sp+A4h] [bp-10h]@53
891  unsigned int invindex; // [sp+A8h] [bp-Ch]@9
892  int uPriceItemService; // [sp+ACh] [bp-8h]@12
893 
895  pPlayers[uActiveCharacter]->OnInventoryLeftClick();
896  return;
897  }
898 
900  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
901  return;
902  }
903 
905 
906  switch (dialog_menu_id) {
909  pPlayers[uActiveCharacter]->OnInventoryLeftClick();
910  break;
911  }
912 
914  int testx = (pt.x - 32) / 70;
915  if (testx >= 0 && testx < 6) {
916  if (pt.y >= 250) {
917  testx += 6;
918  }
919 
920  bought_item = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][testx];
921  if (bought_item->uItemID) {
922  int testpos;
923  if (pt.y >= 250) {
924  testpos = 32 + 70 * testx - 420;
925  } else {
926  testpos = 32 + 70 * testx;
927  }
928 
929  if (pt.x >= testpos &&
930  pt.x <= testpos + shop_ui_items_in_store[testx]->GetWidth()) {
931  if ((pt.y >= 90 &&
932  pt.y <= (90 + shop_ui_items_in_store[testx]->GetHeight())) ||
933  (pt.y >= 250 &&
934  pt.y <= (250 + shop_ui_items_in_store[testx]->GetHeight()))) {
935  pPriceMultiplier =
937  uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(
938  bought_item->GetValue(), pPriceMultiplier);
939 
940  if (pParty->GetGold() < uPriceItemService) {
942  (unsigned int)window_SpeakInHouse->ptr_1C,
943  (HouseSoundID)2);
944  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
945  return;
946  }
947 
948  taken_item = pPlayers[uActiveCharacter]->AddItem(
949  -1, bought_item->uItemID);
950  if (taken_item) {
951  bought_item->SetIdentified();
952  memcpy(
953  &pPlayers[uActiveCharacter]->pInventoryItemList[taken_item - 1],
954  bought_item, 0x24u);
955  dword_F8B1E4 = 1;
956  Party::TakeGold(uPriceItemService);
958  bought_item->Reset();
959  render->ClearZBuffer(0, 479);
960  pPlayers[uActiveCharacter]->PlaySound(
961  (PlayerSpeech)SPEECH_75, 0);
962  return;
963  }
964 
965  pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
966  GameUI_StatusBar_OnEvent(localization->GetString(563)); // "Pack is Full!"
967  break;
968  }
969  }
970  }
971  }
972 
973  return; // no item
974  break;
975  }
976 
978  invindex = ((pt.x - 14) >> 5) + 14 * ((pt.y - 17) >> 5);
979  if (pt.x <= 13 || pt.x >= 462 ||
980  (pItemID = pPlayers[uActiveCharacter]->GetItemListAtInventoryIndex(invindex),
981  !pItemID))
982  return;
983 
985  ->pInventoryItemList[pItemID - 1]
986  .MerchandiseTest((int)window_SpeakInHouse->ptr_1C)) {
987  dword_F8B1E4 = 1;
988  pPlayers[uActiveCharacter]->SalesProcess(
989  invindex, pItemID - 1, (int)window_SpeakInHouse->ptr_1C);
991  render->ClearZBuffer(0, 479);
992  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)77, 0);
993  return;
994  }
995 
996  pPlayers[uActiveCharacter]->PlaySound(SPEECH_79, 0);
997  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
998  break;
999  }
1000 
1002  invindex = ((pt.x - 14) >> 5) + 14 * ((pt.y - 17) >> 5);
1003  if (pt.x <= 13 || pt.x >= 462 ||
1004  (pItemID = pPlayers[uActiveCharacter]->GetItemListAtInventoryIndex(invindex),
1005  !pItemID))
1006  return;
1007 
1008  uPriceItemService =
1009  pPlayers[uActiveCharacter]->GetPriceIdentification(
1011  item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1012 
1013  if (!(item->uAttributes & ITEM_IDENTIFIED)) {
1014  if (item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C)) {
1015  if (pParty->GetGold() >= uPriceItemService) {
1016  dword_F8B1E4 = 1;
1017  Party::TakeGold(uPriceItemService);
1018  item->uAttributes |= ITEM_IDENTIFIED;
1019  pPlayers[uActiveCharacter]->PlaySound(SPEECH_73, 0);
1021  return;
1022  }
1023 
1024  PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C,
1025  (HouseSoundID)2);
1026  return;
1027  }
1028 
1029  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
1030  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
1031  return;
1032  }
1033 
1034  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
1035  break;
1036  }
1037 
1039  invindex = ((pt.x - 14) >> 5) + 14 * ((pt.y - 17) >> 5);
1040  if (pt.x <= 13 || pt.x >= 462 ||
1041  (pItemID = pPlayers[uActiveCharacter]->GetItemListAtInventoryIndex(
1042  invindex),
1043  !pItemID))
1044  return;
1045 
1046  item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1];
1047  pPriceMultiplier =
1048  p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]
1050  uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(
1051  item->GetValue(), pPriceMultiplier);
1052 
1053  if (item->uAttributes & ITEM_BROKEN) {
1054  if (item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C)) {
1055  if (pParty->GetGold() >= uPriceItemService) {
1056  dword_F8B1E4 = 1;
1057  Party::TakeGold(uPriceItemService);
1058  item->uAttributes =
1059  (item->uAttributes & 0xFFFFFFFD) | 1;
1060  pPlayers[uActiveCharacter]->PlaySound(SPEECH_74, 0);
1062  return;
1063  }
1064 
1065  PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C,
1066  (HouseSoundID)2);
1067  return;
1068  }
1069 
1070  pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0);
1071  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)79, 0);
1072  return;
1073  }
1074 
1075  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)76, 0);
1076  break;
1077  }
1078 
1081  int testx;
1082  int testpos;
1083 
1084  switch (in_current_building_type) {
1086 
1087  testx = (pt.x - 30) / 70;
1088  if (testx >= 0 && testx < 6) {
1090  bought_item =
1092  [(int)window_SpeakInHouse->ptr_1C][testx];
1093  else
1094  bought_item =
1096  [(int)window_SpeakInHouse->ptr_1C][testx];
1097 
1098  if (bought_item->uItemID) {
1099  testpos =
1100  ((60 -
1101  ((signed int)shop_ui_items_in_store[testx]
1102  ->GetWidth() /
1103  2)) +
1104  testx * 70);
1105  if (pt.x >= testpos &&
1106  pt.x <
1107  (testpos +
1108  (signed int)shop_ui_items_in_store[testx]
1109  ->GetWidth())) {
1110  if (pt.y >= weapons_Ypos[testx] + 30 &&
1111  pt.y < (weapons_Ypos[testx] + 30 +
1112  shop_ui_items_in_store[testx]
1113  ->GetHeight())) {
1114  break; // good
1115  }
1116  } else {
1117  bought_item = nullptr;
1118  return;
1119  }
1120  } else {
1121  return;
1122  }
1123  }
1124  break;
1125 
1127 
1128  testx = (pt.x - 40) / 105;
1129  if (testx >= 0 && testx < 4) {
1130  if (pt.y >= 126) {
1131  testx += 4;
1132  }
1133 
1135  bought_item =
1137  [(int)window_SpeakInHouse->ptr_1C][testx];
1138  else
1139  bought_item =
1141  [(int)window_SpeakInHouse->ptr_1C][testx];
1142 
1143  if (bought_item->uItemID) {
1144  if (testx >= 4) {
1145  testpos = ((90 - (shop_ui_items_in_store[testx]
1146  ->GetWidth() /
1147  2)) +
1148  (testx * 105) - 420); // low row
1149  } else {
1150  testpos = ((86 - (shop_ui_items_in_store[testx]
1151  ->GetWidth() /
1152  2)) +
1153  testx * 105);
1154  }
1155 
1156  if (pt.x >= testpos &&
1157  pt.x <=
1158  testpos + shop_ui_items_in_store[testx]
1159  ->GetWidth()) {
1160  if ((pt.y >= 126 &&
1161  pt.y <
1162  (126 + shop_ui_items_in_store[testx]
1163  ->GetHeight())) ||
1164  (pt.y <= 98 &&
1165  pt.y >=
1166  (98 - shop_ui_items_in_store[testx]
1167  ->GetHeight()))) {
1168  break; // good
1169  }
1170  } else {
1171  bought_item = nullptr;
1172  return;
1173  }
1174  } else {
1175  return;
1176  }
1177  }
1178  break;
1179 
1182 
1183  testx = (pt.x) / 75;
1184  if (testx >= 0 && testx < 6) {
1185  if (pt.y > 152) {
1186  testx += 6;
1187  }
1188 
1190  bought_item =
1192  [(int)window_SpeakInHouse->ptr_1C][testx];
1193  else
1194  bought_item =
1196  [(int)window_SpeakInHouse->ptr_1C][testx];
1197 
1198  if (bought_item->uItemID) {
1199  if (pt.y > 152) {
1200  testpos =
1201  75 * testx -
1202  shop_ui_items_in_store[testx]->GetWidth() /
1203  2 +
1204  40 - 450;
1205  } else {
1206  testpos =
1207  75 * testx -
1208  shop_ui_items_in_store[testx]->GetWidth() /
1209  2 +
1210  40;
1211  }
1212 
1213  if (pt.x >= testpos &&
1214  pt.x <=
1215  testpos + shop_ui_items_in_store[testx]
1216  ->GetWidth()) {
1217  if ((pt.y <= 308 &&
1218  pt.y >=
1219  (308 - shop_ui_items_in_store[testx]
1220  ->GetHeight())) ||
1221  (pt.y <= 152 &&
1222  pt.y >=
1223  (152 - shop_ui_items_in_store[testx]
1224  ->GetHeight()))) {
1225  // y is 152-h to 152 or 308-height to 308
1226  break; // good
1227  }
1228  } else {
1229  bought_item = nullptr;
1230  return;
1231  }
1232  } else {
1233  return;
1234  }
1235  }
1236  break;
1237 
1238  default:
1239  return;
1240  }
1241 
1242  uPriceItemService = pPlayers[uActiveCharacter]->GetBuyingPrice(
1243  bought_item->GetValue(),
1244  p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]
1245  .fPriceMultiplier);
1246  uNumSeconds = 0;
1247  a3 = 0;
1250  ._steal_perm;
1251  party_reputation = pParty->GetPartyReputation();
1252  if (pPlayers[uActiveCharacter]->CanSteal() && OS_IfCtrlPressed()) {
1253  uNumSeconds = pPlayers[uActiveCharacter]->StealFromShop(
1254  bought_item, a3, party_reputation, 0, &a6);
1255  if (!uNumSeconds) {
1256  // caught stealing no item
1258  return;
1259  }
1260  } else if (pParty->GetGold() < uPriceItemService) {
1262  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
1263  return;
1264  }
1265 
1266  v39 = pPlayers[uActiveCharacter]->AddItem(-1, bought_item->uItemID);
1267  if (v39) {
1268  bought_item->SetIdentified();
1269  memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1],
1270  bought_item, sizeof(ItemGen));
1271  if (uNumSeconds != 0) { // stolen
1273  ->pInventoryItemList[v39 - 1]
1274  .SetStolen();
1276  uNumSeconds, a6);
1277  } else {
1278  dword_F8B1E4 = 1;
1279  Party::TakeGold(uPriceItemService);
1280  }
1282  bought_item->Reset();
1283  render->ClearZBuffer(0, 479);
1285  0);
1286  return;
1287  } else {
1288  pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0);
1290  localization->GetString(563)); // "Pack is Full!"
1291  return;
1292  }
1293  break;
1294  }
1295  default: // if click video screen in shop
1296  {
1297  if (dialog_menu_id >= 36 && dialog_menu_id <= 72) {
1298  __debugbreak(); // please do record these dialogue ids to the
1299  // HOUSE_DIALOGUE_MENU enum
1300 
1301  v42 = dialog_menu_id - 36;
1302  // v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 *
1303  // (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
1304  v43 =
1305  (signed __int64)(p2DEvents[(unsigned int)
1307  1]
1308  .flt_24 *
1309  500.0);
1310  uPriceItemService =
1311  v43 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) /
1312  100;
1313  if (uPriceItemService < v43 / 3) uPriceItemService = v43 / 3;
1315  [pPlayers[uActiveCharacter]->classType][v42]) {
1316  pSkill = &pPlayers[uActiveCharacter]->pActiveSkills[v42];
1317  if (!*pSkill) {
1318  if (pParty->GetGold() < uPriceItemService) {
1319  GameUI_StatusBar_OnEvent(localization->GetString(LSTR_NOT_ENOUGH_GOLD));
1322  v55 = 4;
1323  else
1324  v55 = 2;
1326  (unsigned int)window_SpeakInHouse->ptr_1C,
1327  (HouseSoundID)v55);
1328  return;
1329  }
1330  Party::TakeGold(uPriceItemService);
1331  dword_F8B1E4 = 1;
1332  *pSkill = 1;
1333  pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)78, 0);
1334  return;
1335  }
1336  }
1337  }
1338  break;
1339  }
1340  }
1341 }

Перекрестные ссылки __debugbreak(), MapInfo::_steal_perm, ViewingParams::bRedrawGameUI, BuildingType_AlchemistShop, BuildingType_ArmorShop, BuildingType_MagicShop, BuildingType_Training, BuildingType_WeaponShop, byte_4ED970_skill_learn_ability_by_class_table, current_character_screen_window, current_screen_type, dialog_menu_id, dword_F8B1E4, _2devent::flt_24, _2devent::fPriceMultiplier, GameUI_StatusBar_OnEvent(), Mouse::GetCursorPos(), Party::GetGold(), MapStats::GetMapInfo(), Party::GetPartyReputation(), Localization::GetString(), ItemGen::GetValue(), HOUSE_DIALOGUE_GUILD_BUY_BOOKS, HOUSE_DIALOGUE_SHOP_BUY_SPECIAL, HOUSE_DIALOGUE_SHOP_BUY_STANDARD, HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT, HOUSE_DIALOGUE_SHOP_IDENTIFY, HOUSE_DIALOGUE_SHOP_REPAIR, HOUSE_DIALOGUE_SHOP_SELL, HouseUI_CheckIfPlayerCanInteract(), in_current_building_type, ITEM_BROKEN, ITEM_IDENTIFIED, localization, ItemGen::MerchandiseTest(), OS_IfCtrlPressed(), p2DEvents, GUIWindow::par1C, pAudioPlayer, pCurrentMapName, MapStats::pInfos, PlayHouseSound(), AudioPlayer::PlaySound(), pMapStats, pParty, pPlayers, GUIWindow::ptr_1C, render, ItemGen::Reset(), Engine_::IocContainer::ResolveMouse(), SCREEN_E, ItemGen::SetIdentified(), shop_ui_items_in_store, SOUND_error, Party::SpecialItemsInShops, SPEECH_73, SPEECH_74, SPEECH_75, SPEECH_79, SPEECH_NoRoom, Party::SpellBooksInGuilds, Party::StandartItemsInShops, sub_4B1447_party_fine(), Party::TakeGold(), uActiveCharacter, ItemGen::uAttributes, ItemGen::uItemID, viewparams, weapons_Ypos, WINDOW_CharacterWindow_Inventory, window_SpeakInHouse, Point::x и Point::y.

Используется в Application::Game::EventLoop().

+ Граф вызовов:
+ Граф вызова функции:

◆ sub_4B1523_showSpellbookInfo()

void sub_4B1523_showSpellbookInfo ( int  spellItemId)

См. определение в файле UIShops.cpp строка 1577

1577  {
1578  int v4; // eax@4
1579  long v5; // ecx@4
1580  int v6; // eax@10
1581  char *v7; // ST44_4@12
1582  unsigned __int16 v8; // ax@12
1583  int v13; // [sp+6Ch] [bp-8h]@4
1584  int v14; // [sp+70h] [bp-4h]@4
1585 
1586  int spellId = spellItemId - 399;
1587  int spellLevel = (spellItemId - 400) % 11 + 1;
1588  unsigned int spellSchool = 4 * (spellItemId - 400) / 11;
1589 
1590  // sprintf(tmp_str.data(), "%s%03d", spellbook_texture_filename_suffices[v11
1591  // / 4], v2); not used
1592 
1594  unsigned int v3 = 30;
1595  if (a2.y <= 320) {
1596  v3 = a2.y + 30;
1597  }
1598 
1599  GUIWindow a1;
1600  a1.uFrameY = v3;
1601  a1.uFrameWidth = 328;
1602  a1.uFrameHeight = 68;
1603  a1.uFrameX = 90;
1604  a1.uFrameZ = 417;
1605  a1.uFrameW = v3 + 67;
1610  v5 = a2.y;
1611  if (v14 > a2.y) v5 = v14;
1612  if (v13 > v5) v5 = v13;
1613  if (v4 > v5) v5 = v4;
1614 
1615  auto str = StringPrintf(
1616  "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%"
1617  "s\t000\n%s\t%03d:\t%03d%s",
1618  pSpellStats->pInfos[spellId].pDescription,
1619  localization->GetString(431), // "Normal"
1620  v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pBasicSkillDesc,
1621  localization->GetString(433), // "Expert"
1622  v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pExpertSkillDesc,
1623  localization->GetString(432), // "Master"
1624  v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pMasterSkillDesc,
1625  localization->GetString(96), // "Grand"
1626  v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pGrandmasterSkillDesc);
1627  v6 = pFontSmallnum->CalcTextHeight(str, a1.uFrameWidth, 0);
1628  a1.uFrameHeight += v6;
1629  if (a1.uFrameHeight < 150) {
1630  a1.uFrameHeight = 150;
1631  }
1633  a1.DrawMessageBox(0);
1634  a1.uFrameWidth -= 12;
1635  a1.uFrameHeight -= 12;
1636  v7 = pSpellStats->pInfos[spellId].pName;
1637  a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
1638  a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
1639  v8 = Color16(0xFFu, 0xFFu, 0x9Bu);
1640  a1.DrawTitleText(pFontArrus, 0x78u, 0xCu, v8, v7, 3u);
1641  a1.DrawText(pFontSmallnum, 120, 44, 0, str, 0, 0, 0);
1642  a1.uFrameZ = a1.uFrameX + 107;
1643  a1.uFrameWidth = 108;
1644  a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0,
1645  localization->GetSkillName(spellSchool / 4 + 12), 3u);
1646 
1647  str = StringPrintf("%s\n%d", localization->GetString(522),
1648  *(&pSpellDatas[0].uNormalLevelMana + 10 * spellId));
1649  a1.DrawTitleText(pFontComic, 0xCu,
1650  a1.uFrameHeight - pFontComic->GetHeight() - 16, 0, str, 3);
1651 }

Перекрестные ссылки GUIFont::CalcTextHeight(), Color16(), GUIWindow::DrawMessageBox(), GUIWindow::DrawText(), GUIWindow::DrawTitleText(), game_viewport_width, Mouse::GetCursorPos(), GUIFont::GetHeight(), GUIFont::GetLineWidth(), Localization::GetSkillName(), Localization::GetString(), localization, SpellInfo::pBasicSkillDesc, SpellInfo::pDescription, SpellInfo::pExpertSkillDesc, pFontArrus, pFontComic, pFontSmallnum, SpellInfo::pGrandmasterSkillDesc, SpellStats::pInfos, SpellInfo::pMasterSkillDesc, SpellInfo::pName, pSpellDatas, pSpellStats, Engine_::IocContainer::ResolveMouse(), StringPrintf(), GUIWindow::uFrameHeight, GUIWindow::uFrameW, GUIWindow::uFrameWidth, GUIWindow::uFrameX, GUIWindow::uFrameY, GUIWindow::uFrameZ и Point::y.

Используется в ShowPopupShopItem().

+ Граф вызовов:
+ Граф вызова функции:

◆ ShowPopupShopItem()

void ShowPopupShopItem ( )

См. определение в файле UIShops.cpp строка 1344

1344  {
1345  ItemGen *item; // ecx@13
1346  int invindex;
1347  int testpos;
1348 
1349  if (in_current_building_type <= 0) return;
1351 
1353  int testx;
1354 
1358  switch (in_current_building_type) {
1359  case BuildingType_WeaponShop: {
1360  testx = (pt.x - 30) / 70;
1361  if (testx >= 0 && testx < 6) {
1363  item =
1365  [(int)window_SpeakInHouse->ptr_1C][testx];
1366  else
1367  item =
1369  [(int)window_SpeakInHouse->ptr_1C][testx];
1370 
1371  if (item->uItemID) {
1372  testpos =
1373  ((60 -
1374  (shop_ui_items_in_store[testx]->GetWidth() /
1375  2)) +
1376  testx * 70);
1377  if (pt.x >= testpos &&
1378  pt.x <
1379  (testpos + shop_ui_items_in_store[testx]
1380  ->GetWidth())) {
1381  if (pt.y >= weapons_Ypos[testx] + 30 &&
1382  pt.y < (weapons_Ypos[testx] + 30 +
1383  shop_ui_items_in_store[testx]
1384  ->GetHeight())) {
1385  GameUI_DrawItemInfo(item);
1386  }
1387  } else {
1388  return;
1389  }
1390  }
1391  } else {
1392  return;
1393  }
1394 
1395  break;
1396  }
1397 
1399  testx = (pt.x - 40) / 105;
1400  if (testx >= 0 && testx < 4) {
1401  if (pt.y >= 126) {
1402  testx += 4;
1403  }
1404 
1406  item =
1408  [(int)window_SpeakInHouse->ptr_1C][testx];
1409  else
1410  item =
1412  [(int)window_SpeakInHouse->ptr_1C][testx];
1413 
1414  if (item->uItemID) {
1415  if (testx >= 4) {
1416  testpos = ((90 - (shop_ui_items_in_store[testx]
1417  ->GetWidth() /
1418  2)) +
1419  (testx * 105) - 420); // low row
1420  } else {
1421  testpos = ((86 - (shop_ui_items_in_store[testx]
1422  ->GetWidth() /
1423  2)) +
1424  testx * 105);
1425  }
1426 
1427  if (pt.x >= testpos &&
1428  pt.x <=
1429  testpos + shop_ui_items_in_store[testx]
1430  ->GetWidth()) {
1431  if ((pt.y >= 126 &&
1432  pt.y <
1433  (126 + shop_ui_items_in_store[testx]
1434  ->GetHeight())) ||
1435  (pt.y <= 98 &&
1436  pt.y >=
1437  (98 - shop_ui_items_in_store[testx]
1438  ->GetHeight()))) {
1439  GameUI_DrawItemInfo(item);
1440  } else {
1441  return;
1442  }
1443  }
1444  } else {
1445  return;
1446  }
1447  }
1448  break;
1449 
1452  testx = (pt.x) / 75;
1453  // testx limits check
1454  if (testx >= 0 && testx < 6) {
1455  if (pt.y >= 152) {
1456  testx += 6;
1457  }
1458 
1460  item =
1462  [(int)window_SpeakInHouse->ptr_1C][testx];
1463  else
1464  item =
1466  [(int)window_SpeakInHouse->ptr_1C][testx];
1467 
1468  if (item->uItemID) {
1469  if (pt.y > 152) {
1470  testpos =
1471  75 * testx -
1472  shop_ui_items_in_store[testx]->GetWidth() /
1473  2 +
1474  40 - 450;
1475  } else {
1476  testpos =
1477  75 * testx -
1478  shop_ui_items_in_store[testx]->GetWidth() /
1479  2 +
1480  40;
1481  }
1482 
1483  if (pt.x >= testpos &&
1484  pt.x <=
1485  testpos + shop_ui_items_in_store[testx]
1486  ->GetWidth()) {
1487  if ((pt.y <= 308 &&
1488  pt.y >=
1489  (308 - shop_ui_items_in_store[testx]
1490  ->GetHeight())) ||
1491  (pt.y <= 152 &&
1492  pt.y >=
1493  (152 - shop_ui_items_in_store[testx]
1494  ->GetHeight()))) {
1495  GameUI_DrawItemInfo(item);
1496  } else {
1497  return;
1498  }
1499  }
1500  } else {
1501  return;
1502  }
1503  }
1504  break;
1505 
1506  default:
1507  // v3 = render->pActiveZBuffer[mouse.x +
1508  // pSRZBufferLineOffsets[mouse.y]] & 0xFFFF; if (!v3)
1509  // return;
1510  // v7 = &pParty->StandartItemsInShops[(unsigned
1511  // int)window_SpeakInHouse->ptr_1C][v3 - 1]; if
1512  // (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL) v7 =
1513  // &pParty->SpecialItemsInShops[(unsigned
1514  // int)window_SpeakInHouse->ptr_1C][v3 - 1];
1515  // GameUI_DrawItemInfo(v7);
1516  return;
1517  break;
1518  }
1519  }
1520 
1524  invindex = ((pt.x - 14) >> 5) + 14 * ((pt.y - 17) >> 5);
1525  if (pt.x <= 13 || pt.x >= 462 ||
1526  !pPlayers[uActiveCharacter]->GetItemListAtInventoryIndex(
1527  invindex))
1528  return;
1529 
1531  pPlayers[uActiveCharacter]->GetItemAtInventoryIndex(invindex));
1532  return;
1533  }
1534  }
1535 
1538  int testx = (pt.x - 32) / 70;
1539  if (testx >= 0 && testx < 6) {
1540  if (pt.y >= 250) {
1541  testx += 6;
1542  }
1543 
1545  [testx];
1546 
1547  if (item->uItemID) {
1548  int testpos;
1549  if (pt.y >= 250) {
1550  testpos = 32 + 70 * testx - 420;
1551  } else {
1552  testpos = 32 + 70 * testx;
1553  }
1554 
1555  if (pt.x >= testpos &&
1556  pt.x <=
1557  testpos + shop_ui_items_in_store[testx]->GetWidth()) {
1558  if ((pt.y >= 90 &&
1559  pt.y <=
1560  (90 +
1561  shop_ui_items_in_store[testx]->GetHeight())) ||
1562  (pt.y >= 250 &&
1563  pt.y <=
1564  (250 +
1565  shop_ui_items_in_store[testx]->GetHeight()))) {
1566  unsigned int guildId =
1567  (unsigned int)window_SpeakInHouse->ptr_1C - 139;
1569  pParty->SpellBooksInGuilds[guildId][testx].uItemID);
1570  }
1571  }
1572  }
1573  }
1574  }
1575 }

Перекрестные ссылки BuildingType_16, BuildingType_AlchemistShop, BuildingType_ArmorShop, BuildingType_MagicShop, BuildingType_WeaponShop, dialog_menu_id, GameUI_DrawItemInfo(), Mouse::GetCursorPos(), HOUSE_DIALOGUE_GUILD_BUY_BOOKS, HOUSE_DIALOGUE_SHOP_BUY_SPECIAL, HOUSE_DIALOGUE_SHOP_BUY_STANDARD, HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT, HOUSE_DIALOGUE_SHOP_REPAIR, HOUSE_DIALOGUE_SHOP_SELL, in_current_building_type, GUIWindow::par1C, pParty, pPlayers, GUIWindow::ptr_1C, Engine_::IocContainer::ResolveMouse(), shop_ui_items_in_store, Party::SpecialItemsInShops, Party::SpellBooksInGuilds, Party::StandartItemsInShops, sub_4B1523_showSpellbookInfo(), uActiveCharacter, ItemGen::uItemID, weapons_Ypos, window_SpeakInHouse, Point::x и Point::y.

Используется в UI_OnMouseRightClick().

+ Граф вызовов:
+ Граф вызова функции:

◆ GetHouseGoodbyeSpeech()

void GetHouseGoodbyeSpeech ( )

См. определение в файле UIShops.cpp строка 1654

1654  {
1655  signed int v2; // edi@10
1656  signed int v5; // edi@20
1657  int v7[4]; // [sp+Ch] [bp-10h]@12
1658 
1659  if (in_current_building_type > 0) {
1662  if (!dword_F8B1E4) return;
1663  } else {
1665  }
1667  return;
1668  }
1669  if ((signed __int64)pParty->PartyTimes
1670  ._shop_ban_times[(unsigned int)window_SpeakInHouse->ptr_1C] <=
1671  pParty->GetPlayingTime()) {
1672  if (pParty->GetGold() <= 10000) {
1673  if (!dword_F8B1E4) return;
1675  return;
1676  }
1677  PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C,
1678  (HouseSoundID)(dword_F8B1E4 + 3));
1680  v5 = 0;
1681  for (uint i = 1; i <= 4; ++i) {
1682  if (pPlayers[i]->CanAct()) v7[v5++] = i;
1683  }
1684  if (v5) {
1687  uSpeakingCharacter = v7[rand() % v5];
1688  return;
1689  }
1690  }
1691  } else { // caught stealing
1693  v2 = 0;
1694  for (uint i = 1; i <= 4; ++i) {
1695  if (pPlayers[i]->CanAct()) v7[v2++] = i;
1696  }
1697  if (v2) {
1700  uSpeakingCharacter = v7[rand() % v2];
1701  return;
1702  }
1703  }
1704  }
1705  }
1706 }

Перекрестные ссылки _A750D8_player_speech_timer, PartyTimeStruct::_shop_ban_times, BuildingType_Bank, BuildingType_MagicShop, BuildingType_Temple, dword_F8B1E4, Party::GetGold(), Party::GetPlayingTime(), HouseSound_Goodbye, HouseSound_Greeting_2, in_current_building_type, Party::PartyTimes, PlayerSpeechID, PlayHouseSound(), pParty, pPlayers, GUIWindow::ptr_1C, SPEECH_80, uSpeakingCharacter и window_SpeakInHouse.

Используется в Application::Game::EventLoop() и TavernDialog().

+ Граф вызовов:
+ Граф вызова функции:

◆ sub_4B1447_party_fine()

void sub_4B1447_party_fine ( int  shopId,
int  stealingResult,
int  fineToAdd 
)

См. определение в файле UIShops.cpp строка 1709

1710  { // not working properly??
1711  int v3; // esi@1
1712  DDM_DLV_Header *v7; // eax@14
1713 
1714  if (stealingResult == 0 || stealingResult == 1) { // got caught
1715  if (pParty->uFine < 4000000) {
1716  if (fineToAdd + pParty->uFine < 0)
1717  pParty->uFine = 0;
1718  else if (fineToAdd + pParty->uFine > 4000000)
1719  pParty->uFine = 4000000;
1720  else
1721  pParty->uFine += fineToAdd;
1722  }
1723  if (pParty->uFine) {
1724  for (uint i = 1; i <= 4; ++i) {
1725  if (!_449B57_test_bit(pPlayers[i]->_achieved_awards_bits, PLAYER_GUILD_BITS__FINED))
1726  _449B7E_toggle_bit(pPlayers[i]->_achieved_awards_bits, PLAYER_GUILD_BITS__FINED, 1);
1727  }
1728  }
1729  if (stealingResult == 1)
1730  v3 = 2;
1731  else
1732  v3 = 1;
1733 
1734  pParty->PartyTimes._shop_ban_times[shopId] =
1736  GameTime::FromDays(1)); // only ban when caught
1737  } else {
1738  v3 = 2;
1739  }
1740 
1741  pParty->InTheShopFlags[shopId] = 1;
1742  v7 = &pOutdoor->ddm;
1744  v7->uReputation += v3;
1745  if (v7->uReputation > 10000) v7->uReputation = 10000;
1746 }

Перекрестные ссылки _449B57_test_bit(), _449B7E_toggle_bit(), PartyTimeStruct::_shop_ban_times, OutdoorLocation::ddm, IndoorLocation::dlv, GameTime::FromDays(), Party::GetPlayingTime(), Party::InTheShopFlags, LEVEL_Outdoor, Party::PartyTimes, pIndoor, pOutdoor, pParty, pPlayers, uCurrentlyLoadedLevelType, Party::uFine и DDM_DLV_Header::uReputation.

Используется в UIShop_Buy_Identify_Repair().

+ Граф вызовов:
+ Граф вызова функции:

Переменные

◆ shop_ui_background

class Image* shop_ui_background

См. определение в файле UIShops.cpp строка 33

Используется в AlchemyMagicShopWares(), ArmorShopWares(), GuildDialog(), HouseDialogPressCloseBtn() и WeaponShopWares().

◆ shop_ui_items_in_store

std::array<class Image *, 12> shop_ui_items_in_store

См. определение в файле UIShops.cpp строка 35

Используется в AlchemyMagicShopWares(), ArmorShopWares(), GuildDialog(), ShowPopupShopItem(), SpellBookGenerator(), UIShop_Buy_Identify_Repair() и WeaponShopWares().

GUIWindow::DrawText
void DrawText(GUIFont *font, int x, int y, unsigned short uFontColor, const char *str, bool present_time_transparency=false, int max_text_height=0, int uFontShadowColor=0)
Definition: GUIWindow.cpp:694
GUIWindow::uFrameW
unsigned int uFrameW
Definition: GUIWindow.h:473
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
uSpeakingCharacter
int uSpeakingCharacter
Definition: mm7_data.cpp:764
MapStats::pInfos
MapInfo pInfos[77]
Definition: MapInfo.h:79
Party::GetPlayingTime
GameTime & GetPlayingTime()
Definition: Party.h:230
HOUSE_DIALOGUE_SHOP_BUY_SPECIAL
@ HOUSE_DIALOGUE_SHOP_BUY_SPECIAL
Definition: UIHouses.h:32
BuildingType_Training
@ BuildingType_Training
Definition: Events2D.h:34
Mouse::GetCursorPos
Point GetCursorPos()
Definition: Mouse.cpp:108
GUIWindow
Definition: GUIWindow.h:433
BuildingType_16
@ BuildingType_16
Definition: Events2D.h:20
Party::uFine
int uFine
Definition: Party.h:324
ItemGen::SetIdentified
void SetIdentified()
Definition: Items.h:307
shop_ui_background
Image * shop_ui_background
Definition: UIShops.cpp:33
_449B57_test_bit
bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2)
Definition: Party.cpp:1185
SpellStats::pInfos
SpellInfo pInfos[100]
Definition: Spells.h:192
PartyTimeStruct::Shops_next_generation_time
std::array< GameTime, 85 > Shops_next_generation_time
Definition: Party.h:143
dialog_menu_id
HOUSE_DIALOGUE_MENU dialog_menu_id
Definition: UIHouses.cpp:50
PlayerSpeechID
enum PlayerSpeech PlayerSpeechID
Definition: Player.cpp:48
SPEECH_80
@ SPEECH_80
Definition: Player.h:126
BuildingType_ArmorShop
@ BuildingType_ArmorShop
Definition: Events2D.h:6
MapStats::GetMapInfo
MAP_TYPE GetMapInfo(const String &Str2)
Definition: MapInfo.cpp:225
AudioPlayer::PlaySound
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
Definition: AudioPlayer.cpp:195
Party::InTheShopFlags
std::array< int, 53 > InTheShopFlags
Definition: Party.h:323
game_viewport_width
unsigned int game_viewport_width
Definition: mm7_data.cpp:194
SpellInfo::pName
char * pName
Definition: Spells.h:176
weapons_Ypos
std::array< int16_t, 6 > weapons_Ypos
Definition: mm7_data.cpp:769
SOUND_error
@ SOUND_error
Definition: AudioPlayer.h:19
localization
Localization * localization
Definition: Localization.cpp:11
Point::x
unsigned int x
Definition: Point.h:7
GameUI_StatusBar_DrawImmediate
void GameUI_StatusBar_DrawImmediate(const String &str, int color)
Definition: UIStatusBar.cpp:88
GUIWindow::DrawTitleText
void DrawTitleText(GUIFont *font, int horizontal_margin, int vertical_margin, unsigned __int16 uDefaultColor, const char *pInString, int line_spacing)
Definition: GUIWindow.cpp:665
GUIFont::GetLineWidth
unsigned int GetLineWidth(const String &str)
Definition: GUIFont.cpp:278
HouseSound_Greeting_2
@ HouseSound_Greeting_2
Definition: UIHouses.h:115
GUIFont::GetHeight
unsigned int GetHeight() const
Definition: GUIFont.cpp:84
BuildingType_Bank
@ BuildingType_Bank
Definition: Events2D.h:26
ItemGen::Reset
void Reset()
Definition: Items.cpp:133
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
GUIWindow::uFrameWidth
unsigned int uFrameWidth
Definition: GUIWindow.h:470
Localization::GetSkillName
const char * GetSkillName(unsigned int index) const
Definition: Localization.h:51
pIndoor
IndoorLocation * pIndoor
Definition: Indoor.cpp:49
GUIWindow::uFrameZ
unsigned int uFrameZ
Definition: GUIWindow.h:472
_2devent::flt_24
float flt_24
Definition: Events2D.h:54
current_screen_type
enum CURRENT_SCREEN current_screen_type
Definition: GUIWindow.cpp:83
Party::PartyTimes
PartyTimeStruct PartyTimes
Definition: Party.h:249
p2DEvents
_2devent p2DEvents[525]
Definition: Events.cpp:57
pMapStats
struct MapStats * pMapStats
Definition: mm7_data.cpp:20
CURRENT_SCREEN::SCREEN_E
@ SCREEN_E
current_character_screen_window
enum WindowType current_character_screen_window
Definition: GUIWindow.cpp:78
in_current_building_type
BuildingType in_current_building_type
Definition: UIHouses.cpp:49
BuildingType_WeaponShop
@ BuildingType_WeaponShop
Definition: Events2D.h:5
ItemGen::uAttributes
unsigned int uAttributes
Definition: Items.h:349
window_SpeakInHouse
GUIWindow * window_SpeakInHouse
Definition: GUIWindow.cpp:51
pParty
Party * pParty
Definition: Party.cpp:30
pFontArrus
GUIFont * pFontArrus
Definition: GUIFont.cpp:18
HOUSE_DIALOGUE_GUILD_BUY_BOOKS
@ HOUSE_DIALOGUE_GUILD_BUY_BOOKS
Definition: UIHouses.h:25
HouseSoundID
HouseSoundID
Definition: UIHouses.h:112
WINDOW_CharacterWindow_Inventory
@ WINDOW_CharacterWindow_Inventory
Definition: GUIWindow.h:330
viewparams
struct ViewingParams * viewparams
Definition: mm7_data.cpp:22
GUIWindow::DrawMessageBox
void DrawMessageBox(bool inside_game_viewport)
Definition: GUIWindow.cpp:319
ItemGen::uItemID
int uItemID
Definition: Items.h:326
pSpellDatas
std::array< SpellData, 100 > pSpellDatas
Definition: Spells.cpp:170
GUIWindow::uFrameHeight
unsigned int uFrameHeight
Definition: GUIWindow.h:471
BuildingType_Temple
@ BuildingType_Temple
Definition: Events2D.h:27
Engine_::IocContainer::ResolveMouse
static Mouse * ResolveMouse()
Definition: IocContainer.cpp:88
IndoorLocation::dlv
struct DDM_DLV_Header dlv
Definition: Indoor.h:648
Party::TakeGold
static void TakeGold(int amount)
Definition: Party.cpp:292
GUIFont::CalcTextHeight
unsigned int CalcTextHeight(const String &str, unsigned int width, int x_offset, bool return_on_carriage=false)
Definition: GUIFont.cpp:246
BuildingType_MagicShop
@ BuildingType_MagicShop
Definition: Events2D.h:7
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
DDM_DLV_Header::uReputation
int uReputation
Definition: Indoor.h:96
shop_ui_items_in_store
std::array< Image *, 12 > shop_ui_items_in_store
Definition: UIShops.cpp:35
sub_4B1523_showSpellbookInfo
void sub_4B1523_showSpellbookInfo(int spellItemId)
Definition: UIShops.cpp:1577
LEVEL_Outdoor
@ LEVEL_Outdoor
Definition: Indoor.h:287
DDM_DLV_Header
Definition: Indoor.h:82
SpellInfo::pExpertSkillDesc
char * pExpertSkillDesc
Definition: Spells.h:180
PlayHouseSound
void PlayHouseSound(unsigned int uHouseID, HouseSoundID sound)
Definition: UIHouses.cpp:1036
pCurrentMapName
String pCurrentMapName
Definition: mm7_data.cpp:712
Party::StandartItemsInShops
std::array< std::array< ItemGen, 12 >, 53 > StandartItemsInShops
Definition: Party.h:314
GUIWindow::uFrameY
unsigned int uFrameY
Definition: GUIWindow.h:469
pSpellStats
struct SpellStats * pSpellStats
Definition: Spells.cpp:32
pFontComic
GUIFont * pFontComic
Definition: GUIFont.cpp:24
Party::GetPartyReputation
int GetPartyReputation()
Definition: Party.cpp:922
OutdoorLocation::ddm
struct DDM_DLV_Header ddm
Definition: Outdoor.h:131
HouseUI_CheckIfPlayerCanInteract
bool HouseUI_CheckIfPlayerCanInteract()
Definition: UIHouses.cpp:797
BuildDialogueString
String BuildDialogueString(const char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, GameTime *a6)
Definition: GUIWindow.cpp:2189
HOUSE_DIALOGUE_SHOP_SELL
@ HOUSE_DIALOGUE_SHOP_SELL
Definition: UIHouses.h:10
OS_IfCtrlPressed
bool OS_IfCtrlPressed()
Definition: Lin.cpp:23
SPEECH_75
@ SPEECH_75
Definition: Player.h:121
Point::y
unsigned int y
Definition: Point.h:8
dword_F8B1E4
int dword_F8B1E4
Definition: mm7_data.cpp:779
GameUI_DrawItemInfo
void GameUI_DrawItemInfo(struct ItemGen *inspect_item)
Definition: UIPopup.cpp:168
BuildingType_AlchemistShop
@ BuildingType_AlchemistShop
Definition: Events2D.h:8
v2
GLfloat GLfloat GLfloat v2
Definition: SDL_opengl_glext.h:695
ITEM_IDENTIFIED
@ ITEM_IDENTIFIED
Definition: Items.h:26
uint
unsigned int uint
Definition: MM7.h:4
ITEM_BROKEN
@ ITEM_BROKEN
Definition: Items.h:27
uActiveCharacter
unsigned int uActiveCharacter
Definition: mm7_data.cpp:555
v3
GLfloat GLfloat GLfloat GLfloat v3
Definition: SDL_opengl_glext.h:696
_449B7E_toggle_bit
void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle)
Definition: Party.cpp:1190
__debugbreak
void __cdecl __debugbreak(void)
MapInfo::_steal_perm
int _steal_perm
Definition: MapInfo.h:47
_2devent::fPriceMultiplier
float fPriceMultiplier
Definition: Events2D.h:53
GUIWindow::par1C
unsigned int par1C
Definition: GUIWindow.h:477
GameUI_StatusBar_OnEvent
void GameUI_StatusBar_OnEvent(const String &str, unsigned int num_seconds)
Definition: UIStatusBar.cpp:33
SPEECH_79
@ SPEECH_79
Definition: Player.h:125
GUIWindow::ptr_1C
void * ptr_1C
Definition: GUIWindow.h:476
ViewingParams::bRedrawGameUI
int bRedrawGameUI
Definition: Viewport.h:74
PartyTimeStruct::_shop_ban_times
std::array< GameTime, 53 > _shop_ban_times
Definition: Party.h:144
SPEECH_74
@ SPEECH_74
Definition: Player.h:120
GameTime::FromDays
static GameTime FromDays(int days)
Definition: Time.h:92
GUIWindow::DrawShops_next_generation_time_string
void DrawShops_next_generation_time_string(GameTime time)
Definition: GUIWindow.cpp:648
uCurrentlyLoadedLevelType
LEVEL_TYPE uCurrentlyLoadedLevelType
Definition: Indoor.cpp:52
pMerchantsBuyPhrases
std::array< const char *, 7 > pMerchantsBuyPhrases
Definition: mm7_data.cpp:748
HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT
@ HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT
Definition: UIHouses.h:31
GUIWindow::uFrameX
unsigned int uFrameX
Definition: GUIWindow.h:468
HOUSE_DIALOGUE_SHOP_BUY_STANDARD
@ HOUSE_DIALOGUE_SHOP_BUY_STANDARD
Definition: UIHouses.h:9
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
SpellInfo::pDescription
char * pDescription
Definition: Spells.h:178
Point
Definition: Point.h:3
ItemGen
Definition: Items.h:263
ItemGen::GetValue
unsigned int GetValue()
Definition: Items.cpp:588
sub_4B1447_party_fine
void sub_4B1447_party_fine(int shopId, int stealingResult, int fineToAdd)
Definition: UIShops.cpp:1709
PlayerSpeech
PlayerSpeech
Definition: Player.h:46
HOUSE_DIALOGUE_SHOP_REPAIR
@ HOUSE_DIALOGUE_SHOP_REPAIR
Definition: UIHouses.h:12
Color16
uint16_t Color16(uint32_t r, uint32_t g, uint32_t b)
Definition: Engine.cpp:148
pOutdoor
OutdoorLocation * pOutdoor
Definition: Outdoor.cpp:48
SPEECH_73
@ SPEECH_73
Definition: Player.h:119
_A750D8_player_speech_timer
int64_t _A750D8_player_speech_timer
Definition: mm7_data.cpp:763
SpellInfo::pBasicSkillDesc
char * pBasicSkillDesc
Definition: Spells.h:179
Party::SpellBooksInGuilds
std::array< std::array< ItemGen, 12 >, 32 > SpellBooksInGuilds
Definition: Party.h:316
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
Party::SpecialItemsInShops
std::array< std::array< ItemGen, 12 >, 53 > SpecialItemsInShops
Definition: Party.h:315
HOUSE_DIALOGUE_SHOP_IDENTIFY
@ HOUSE_DIALOGUE_SHOP_IDENTIFY
Definition: UIHouses.h:11
String
std::string String
Definition: Strings.h:10
HouseSound_Goodbye
@ HouseSound_Goodbye
Definition: UIHouses.h:116
byte_4ED970_skill_learn_ability_by_class_table
std::array< std::array< char, 37 >, 36 > byte_4ED970_skill_learn_ability_by_class_table
Definition: mm7_data.cpp:425
GameTime
Definition: Time.h:14
Party::GetGold
int GetGold() const
Definition: Party.cpp:264
pFontSmallnum
GUIFont * pFontSmallnum
Definition: GUIFont.cpp:25
SpellInfo::pGrandmasterSkillDesc
char * pGrandmasterSkillDesc
Definition: Spells.h:182
SPEECH_NoRoom
@ SPEECH_NoRoom
Definition: Player.h:61
SpellInfo::pMasterSkillDesc
char * pMasterSkillDesc
Definition: Spells.h:181
ItemGen::MerchandiseTest
bool MerchandiseTest(int _2da_idx)
Definition: Items.cpp:1626
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52