annotate GUI/UI/UIGuilds.cpp @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents 0c67be4ec900
children
rev   line source
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
2 #include <stdlib.h>
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
3 #include <crtdbg.h>
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
4
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
6
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
7 #include "Engine/Engine.h"
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2524
diff changeset
8
2573
0c67be4ec900 DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents: 2541
diff changeset
9 #include "GUI/UI/UIShops.h"
0c67be4ec900 DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents: 2541
diff changeset
10
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
11 #include "..\../Engine/Objects/Items.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
12 #include "..\../GUI/GUIWindow.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
13 #include "..\../Engine/texts.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
14 #include "UIHouses.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
15 #include "..\../GUI/GUIFont.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
16 #include "..\../Engine/Graphics/Render.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
17 #include "..\../Engine/Party.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
18 #include "..\../Engine/Graphics/Texture.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
19 #include "..\../IO/Mouse.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
20 #include "..\../Engine/Events2D.h"
2502
a77c34acdbc9 Media folder
Ritor1
parents: 2501
diff changeset
21 #include "..\../Media/Audio/AudioPlayer.h"
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
22 #include "..\../Engine/LOD.h"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
23
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
24 //----- (004B5D7C) --------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
25 void GuildDialog()
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
26 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
27 signed int base_teach_price; // ebx@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
28 int v6; // esi@13
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
29 signed int v7; // esi@17
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
30 int v8; // esi@22
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
31 // const char *statusbar_string; // ecx@26
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
32 int v13; // ecx@30
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
33 ItemGen *v15; // ST18_4@31
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
34 int v17; // eax@31
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
35 char *v18; // edx@31
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
36 int v26; // ecx@47
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
37 GUIButton *pButton; // eax@49
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
38 int pTextHeight; // eax@55
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
39 unsigned __int16 pTextColor; // ax@55
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
40 POINT cursor; // [sp+26Ch] [bp-80h]@30
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
41 GUIWindow working_window; // [sp+274h] [bp-78h]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
42 int v58; // [sp+2D4h] [bp-18h]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
43 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
44 int v61; // [sp+2E0h] [bp-Ch]@35
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
45 unsigned int v62; // [sp+2E4h] [bp-8h]@13
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
46 int pPrice; // [sp+2E8h] [bp-4h]@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
47 int all_text_height;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
48 int pX;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
49
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
50 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
51 working_window.uFrameX = 483;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
52 working_window.uFrameWidth = 148;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
53 working_window.uFrameZ = 334;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
54 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
55 pPrice = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
56 if ( pPrice < base_teach_price / 3 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
57 pPrice = base_teach_price / 3;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
58 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
59 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
60 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
61 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C - 139]) )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
62 { //you must me member
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
63 pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
64 working_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, Color16(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[121].pText, 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
65 pDialogueWindow->pNumPresenceButton = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
66 return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
67 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
68 if ( !HouseUI_CheckIfPlayerCanInteract() )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
69 return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
70 if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
71 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
72 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
73 strcat(pTmpBuf.data(), "\n \n");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
74 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
75 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
76 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
77 return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
78 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
79 v61 = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
80 pSkillFlag = false;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
81 all_text_height = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
82 for ( int i = pDialogueWindow->pStartingPosActiveItem;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
83 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
84 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
85 if ( pDialogueWindow->GetControl(i)->msg_param == 18 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
86 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
87 all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
88 v61++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
89 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
90 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
91 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
92 if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36]
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
93 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
94 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
95 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &working_window, 0, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
96 v61++;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
97 pSkillFlag = true;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
98 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
99 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
100 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
101 if ( !v61 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
102 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
103 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
104 strcat(pTmpBuf.data(), "\n \n");
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
105 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
106 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
107 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
108 return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
109 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
110 if ( pSkillFlag )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
111 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
112 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
113 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
114 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
115 v58 = (149 - all_text_height) / v61;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
116 if ( v58 > 32 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
117 v58 = 32;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
118 v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
119 for ( int i = pDialogueWindow->pStartingPosActiveItem;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
120 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
121 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
122 pButton = pDialogueWindow->GetControl(i);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
123 if ( pButton->msg_param == 18 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
124 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
125 pButton->uY = v58 + v26;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
126 pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
127 pButton->uHeight = pTextHeight;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
128 v26 = pButton->uY + pTextHeight - 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
129 pButton->uW = v26;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
130 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
131 if ( pDialogueWindow->pCurrentPosActiveItem != i )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
132 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
133 working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
134 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
135 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
136 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
137 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36]
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
138 && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
139 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
140 pButton->uY = v58 + v26;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
141 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &working_window, 0, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
142 pButton->uHeight = pTextHeight;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
143 v26 = pButton->uY + pTextHeight - 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
144 pButton->uW = v26;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
145 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
146 if ( pDialogueWindow->pCurrentPosActiveItem != i )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
147 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
148 working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
149 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
150 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
151 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
152 pButton->uW = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
153 pButton->uHeight = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
154 pButton->uY = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
155 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
156 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
157 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
158 return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
159 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
160 if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
161 {
2573
0c67be4ec900 DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents: 2541
diff changeset
162 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, shop_ui_background);
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
163 v6 = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
164 v62 = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
165 for ( pX = 32; pX < 452; pX += 70 )//расположение в верхнем ряду
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
166 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
167 if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
168 {
2575
a76d408c5132 DrawTranslucent -> DrawTextureGrayShade
a.parshin
parents: 2573
diff changeset
169 pRenderer->DrawTextureAlphaNew(pX/640.0f, 90/480.0f, shop_ui_items_in_store[v6]);
a76d408c5132 DrawTranslucent -> DrawTextureGrayShade
a.parshin
parents: 2573
diff changeset
170 //ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), shop_ui_items_in_store[v6], v6 + 1);
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
171 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
172 v62 += 280;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
173 ++v6;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
174 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
175 v62 = 1680;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
176 v7 = 6;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
177 for ( pX = 32; pX < 452; pX += 70 )//расположение в нижнем ряду
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
178 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
179 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
180 {
2575
a76d408c5132 DrawTranslucent -> DrawTextureGrayShade
a.parshin
parents: 2573
diff changeset
181 pRenderer->DrawTextureAlphaNew(pX/640.0f, 250/480.0f, shop_ui_items_in_store[v7]);
a76d408c5132 DrawTranslucent -> DrawTextureGrayShade
a.parshin
parents: 2573
diff changeset
182 //ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), shop_ui_items_in_store[v7], v7 + 1);
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
183 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
184 v62 += 280;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
185 ++v7;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
186 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
187 if ( HouseUI_CheckIfPlayerCanInteract() )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
188 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
189 v8 = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
190 for ( uint i = 0; i < 12; ++i )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
191 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
192 if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID > 0 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
193 ++v8;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
194 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
195 GetAsyncKeyState(VK_CONTROL);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
196 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);//"Select the Item to Buy"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
197 if ( !v8 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
198 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
199 working_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] - pParty->uTimePlayed);//"Приходите через 14 дней"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
200 return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
201 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
202 pMouse->GetCursorPos(&cursor);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
203 v13 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
204 if ( v13 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
205 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
206 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)window_SpeakInHouse->ptr_1C));
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
207 v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)window_SpeakInHouse->ptr_1C, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
208 v18 = BuildDialogueString(pMerchantsBuyPhrases[v17], uActiveCharacter - 1, v15, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
209 pTextHeight = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
210 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), v18, 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
211 return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
212 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
213 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
214 return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
215 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
216 if ( HouseUI_CheckIfPlayerCanInteract() )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
217 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
218 if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
219 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
220 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pSkillNames[dialog_menu_id-36]); //"You already know the %s skill"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
221 ShowStatusBarString(pTmpBuf.data(), 2);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
222 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
223 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
224 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
225 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
226 if ( pParty->uNumGold < pPrice )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
227 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
228 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
229 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
230 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
231 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
232 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
233 Party::TakeGold(pPrice);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
234 pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
235 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
236 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
237 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
238 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
239 return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
240 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
241 //----- (004BC8D5) --------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
242 void SpellBookGenerator()//for GuildDialogs
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
243 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
244 int pItemNum; // esi@1
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
245 int v4; // esi@7
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
246
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
247 for( int i = 0; i < 12; ++i )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
248 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
249 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType >= 5 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
250 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
251 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 13 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
252 pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
253 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
254 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
255 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 14 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
256 v4 = rand() % 4;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
257 else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 15 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
258 v4 = rand() % 3 + 4;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
259 else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 16 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
260 v4 = rand() % 2 + 7;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
261 if( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 16 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
262 pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * v4 + 400;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
263 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
264 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
265 if ( pItemNum == 487 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
266 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
267 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
268 pItemNum = 486;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
269 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
270 ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
271 item_spellbook->Reset();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
272 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
273 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].IsIdentified();
2575
a76d408c5132 DrawTranslucent -> DrawTextureGrayShade
a.parshin
parents: 2573
diff changeset
274
a76d408c5132 DrawTranslucent -> DrawTextureGrayShade
a.parshin
parents: 2573
diff changeset
275 shop_ui_items_in_store[i] = assets->GetImage_16BitColorKey(pItemsTable->pItems[pItemNum].pIconName, 0x7FF);
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
276 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
277 return;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
278 }