annotate UI/UIGuilds.cpp @ 2462:1d04e48651d4

Render split into interface and realization, added Direct3D 11
author a.parshin
date Tue, 12 Aug 2014 21:34:18 +0300
parents 1921b140607a
children 104fdbea0386
rev   line source
2415
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2402
diff changeset
1 #define _CRTDBG_MAP_ALLOC
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2402
diff changeset
2 #include <stdlib.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2402
diff changeset
3 #include <crtdbg.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2402
diff changeset
4
2253
aff7a7b072b7 adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents: 2069
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
2336
d6887ee81068 header file include cleanup
Grumpy7
parents: 2334
diff changeset
6 #include "..\mm7_unsorted_subs.h"
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
7 #include "..\Items.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
8 #include "..\GUIWindow.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
9 #include "..\mm7_data.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
10 #include "..\texts.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
11 #include "UIHouses.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
12 #include "..\GUIFont.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
13 #include "..\Render.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
14 #include "..\Party.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
15 #include "..\Texture.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
16 #include "..\Mouse.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
17 #include "..\Events2D.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
18 #include "..\AudioPlayer.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
19 #include "..\LOD.h"
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
20
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
21 //----- (004B5D7C) --------------------------------------------------------
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
22 void GuildDialog()
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
23 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
24 signed int base_teach_price; // ebx@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
25 int v6; // esi@13
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
26 signed int v7; // esi@17
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
27 int v8; // esi@22
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2253
diff changeset
28 // const char *statusbar_string; // ecx@26
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
29 int v13; // ecx@30
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
30 ItemGen *v15; // ST18_4@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
31 int v17; // eax@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
32 char *v18; // edx@31
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
33 int v26; // ecx@47
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
34 GUIButton *pButton; // eax@49
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
35 int pTextHeight; // eax@55
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
36 unsigned __int16 pTextColor; // ax@55
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
37 POINT cursor; // [sp+26Ch] [bp-80h]@30
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
38 GUIWindow working_window; // [sp+274h] [bp-78h]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
39 int v58; // [sp+2D4h] [bp-18h]@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
40 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
41 int v61; // [sp+2E0h] [bp-Ch]@35
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
42 unsigned int v62; // [sp+2E4h] [bp-8h]@13
1524
Ritor1
parents: 1460
diff changeset
43 int pPrice; // [sp+2E8h] [bp-4h]@1
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
44 int all_text_height;
1526
f47eab1a70d8 UIHouses.cpp cleaning(continue)
Ritor1
parents: 1524
diff changeset
45 int pX;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
46
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
47 memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow));
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
48 working_window.uFrameX = 483;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
49 working_window.uFrameWidth = 148;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
50 working_window.uFrameZ = 334;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
51 base_teach_price = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier * 500.0);
1524
Ritor1
parents: 1460
diff changeset
52 pPrice = base_teach_price * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100;
Ritor1
parents: 1460
diff changeset
53 if ( pPrice < base_teach_price / 3 )
Ritor1
parents: 1460
diff changeset
54 pPrice = base_teach_price / 3;
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
55 if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
56 {
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
57 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_achieved_awards_bits,
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
58 guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C - 139]) )
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
59 { //you must me member
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
60 pTextHeight = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0);
2069
259df09dfb50 32bits almost there
Nomad
parents: 1920
diff changeset
61 working_window.DrawTitleText(pFontArrus, 0, (212 - pTextHeight) / 2 + 101, Color16(0xFFu, 0xFFu, 0x9Bu), pNPCTopics[121].pText, 3);
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
62 pDialogueWindow->pNumPresenceButton = 0;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
63 return;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
64 }
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
65 if ( !HouseUI_CheckIfPlayerCanInteract() )
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
66 return;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
67 if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
68 {
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
69 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
70 strcat(pTmpBuf.data(), "\n \n");
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
71 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
72 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
2069
259df09dfb50 32bits almost there
Nomad
parents: 1920
diff changeset
73 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
74 return;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
75 }
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
76 v61 = 0;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
77 pSkillFlag = false;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
78 all_text_height = 0;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
79 for ( int i = pDialogueWindow->pStartingPosActiveItem;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
80 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
81 {
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
82 if ( pDialogueWindow->GetControl(i)->msg_param == 18 )
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
83 {
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
84 all_text_height += pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells"
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
85 v61++;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
86 }
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
87 else
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
88 {
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
89 if( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pDialogueWindow->GetControl(i)->msg_param - 36]
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
90 && !pPlayers[uActiveCharacter]->pActiveSkills[pDialogueWindow->GetControl(i)->msg_param - 36] )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
91 {
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
92 all_text_height += pFontArrus->CalcTextHeight(pSkillNames[pDialogueWindow->GetControl(i)->msg_param - 36], &working_window, 0, 0);
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
93 v61++;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
94 pSkillFlag = true;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
95 }
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
96 }
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
97 }
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
98 if ( !v61 )
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
99 {
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
100 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s"
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
101 strcat(pTmpBuf.data(), "\n \n");
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
102 strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
103 pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf.data(), &working_window, 0, 0);
2069
259df09dfb50 32bits almost there
Nomad
parents: 1920
diff changeset
104 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
105 return;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
106 }
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
107 if ( pSkillFlag )
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
108 {
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
109 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], pPrice); //"Skill Cost: %lu"
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
110 working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3);
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
111 }
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
112 v58 = (149 - all_text_height) / v61;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
113 if ( v58 > 32 )
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
114 v58 = 32;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
115 v26 = (149 - v61 * v58 - all_text_height) / 2 - v58 / 2 + 162;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
116 for ( int i = pDialogueWindow->pStartingPosActiveItem;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
117 i < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++i )
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
118 {
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
119 pButton = pDialogueWindow->GetControl(i);
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
120 if ( pButton->msg_param == 18 )
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
121 {
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
122 pButton->uY = v58 + v26;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
123 pTextHeight = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0);
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
124 pButton->uHeight = pTextHeight;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
125 v26 = pButton->uY + pTextHeight - 1;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
126 pButton->uW = v26;
2069
259df09dfb50 32bits almost there
Nomad
parents: 1920
diff changeset
127 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu);
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
128 if ( pDialogueWindow->pCurrentPosActiveItem != i )
2069
259df09dfb50 32bits almost there
Nomad
parents: 1920
diff changeset
129 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu);
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
130 working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pGlobalTXT_LocalizationStrings[400], 3);//"Buy Spells"
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
131 }
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
132 else
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
133 {
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
134 if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][pButton->msg_param - 36]
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
135 && !pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param - 36] )
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
136 {
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
137 pButton->uY = v58 + v26;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
138 pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[pButton->msg_param - 36], &working_window, 0, 0);
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
139 pButton->uHeight = pTextHeight;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
140 v26 = pButton->uY + pTextHeight - 1;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
141 pButton->uW = v26;
2069
259df09dfb50 32bits almost there
Nomad
parents: 1920
diff changeset
142 pTextColor = Color16(0xFFu, 0xFFu, 0x9Bu);
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
143 if ( pDialogueWindow->pCurrentPosActiveItem != i )
2069
259df09dfb50 32bits almost there
Nomad
parents: 1920
diff changeset
144 pTextColor = Color16(0xFFu, 0xFFu, 0xFFu);
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
145 working_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pSkillNames[pButton->msg_param - 36], 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
146 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
147 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
148 {
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
149 pButton->uW = 0;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
150 pButton->uHeight = 0;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
151 pButton->uY = 0;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
152 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
153 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
154 }
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
155 return;
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
156 }
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
157 if ( dialog_menu_id == HOUSE_DIALOGUE_GUILD_BUY_BOOKS ) //buy skill
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
158 {
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
159 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
160 v6 = 0;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
161 v62 = 0;
1526
f47eab1a70d8 UIHouses.cpp cleaning(continue)
Ritor1
parents: 1524
diff changeset
162 for ( pX = 32; pX < 452; pX += 70 )//расположение в верхнем ряду
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
163 {
1526
f47eab1a70d8 UIHouses.cpp cleaning(continue)
Ritor1
parents: 1524
diff changeset
164 if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
165 {
1526
f47eab1a70d8 UIHouses.cpp cleaning(continue)
Ritor1
parents: 1524
diff changeset
166 pRenderer->DrawTextureTransparent(pX, 90, ItemsInShopTexture[v6]);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
167 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
168 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
169 v62 += 280;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
170 ++v6;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
171 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
172 v62 = 1680;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
173 v7 = 6;
1526
f47eab1a70d8 UIHouses.cpp cleaning(continue)
Ritor1
parents: 1524
diff changeset
174 for ( pX = 32; pX < 452; pX += 70 )//расположение в нижнем ряду
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
175 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
176 if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID)
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
177 {
1526
f47eab1a70d8 UIHouses.cpp cleaning(continue)
Ritor1
parents: 1524
diff changeset
178 pRenderer->DrawTextureTransparent(pX, 250, ItemsInShopTexture[v7]);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
179 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
180 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
181 v62 += 280;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
182 ++v7;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
183 }
1393
28f87f5234a1 More hardcoded UI colors moved to varibables.
Nomad
parents: 1300
diff changeset
184 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
185 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
186 v8 = 0;
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
187 for ( uint i = 0; i < 12; ++i )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
188 {
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
189 if ( pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C - 139][i].uItemID > 0 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
190 ++v8;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
191 }
2460
1921b140607a VK_CONTROL
Ritor1
parents: 2415
diff changeset
192 GetAsyncKeyState(VK_CONTROL);
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
193 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0);//"Select the Item to Buy"
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
194 if ( !v8 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
195 {
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
196 working_window.DrawShops_next_generation_time_string(pParty->PartyTimes.Shops_next_generation_time[window_SpeakInHouse->par1C - 139] - pParty->uTimePlayed);//"Приходите через 14 дней"
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
197 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
198 }
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
199 pMouse->GetCursorPos(&cursor);
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
200 v13 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
201 if ( v13 )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
202 {
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
203 v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)window_SpeakInHouse->ptr_1C));
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
204 v17 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)window_SpeakInHouse->ptr_1C, BuildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 2);
1843
2e6d3cd052e0 some char* cast removal + adding const_casts where appropriate
Grumpy7
parents: 1758
diff changeset
205 v18 = BuildDialogueString(pMerchantsBuyPhrases[v17], uActiveCharacter - 1, v15, (char *)window_SpeakInHouse->ptr_1C, 2, 0);
1661
e1d1fe32c194 NPCTopics
Ritor1
parents: 1572
diff changeset
206 pTextHeight = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0);
2069
259df09dfb50 32bits almost there
Nomad
parents: 1920
diff changeset
207 working_window.DrawTitleText(pFontArrus, 0, (174 - pTextHeight) / 2 + 138, Color16(0xFFu, 0xFFu, 0xFFu), v18, 3);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
208 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
209 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
210 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
211 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
212 }
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
213 if ( HouseUI_CheckIfPlayerCanInteract() )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
214 {
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
215 if ( pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
216 {
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
217 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[403], pSkillNames[dialog_menu_id-36]); //"You already know the %s skill"
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
218 ShowStatusBarString(pTmpBuf.data(), 2);
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
219 pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
220 }
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
221 else
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
222 {
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
223 if ( pParty->uNumGold < pPrice )
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
224 {
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
225 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); //"You don't have enough gold"
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
226 PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful);
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
227 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
228 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
229 {
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
230 Party::TakeGold(pPrice);
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
231 pPlayers[uActiveCharacter]->pActiveSkills[dialog_menu_id-36] = 1;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
232 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
233 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
234 }
2402
8cee51ce4382 included directx 11
Ritor1
parents: 2336
diff changeset
235 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
1920
05b433b8cb37 GuildDialog fix and cleared
Ritor1
parents: 1843
diff changeset
236 return;
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
237 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
238 //----- (004BC8D5) --------------------------------------------------------
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
239 void SpellBookGenerator()//for GuildDialogs
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
240 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
241 int pItemNum; // esi@1
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
242 int v4; // esi@7
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
243
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
244 for( int i = 0; i < 12; ++i )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
245 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
246 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType >= 5 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
247 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
248 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 13 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
249 pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
250 else
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
251 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
252 if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 14 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
253 v4 = rand() % 4;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
254 else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 15 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
255 v4 = rand() % 3 + 4;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
256 else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 16 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
257 v4 = rand() % 2 + 7;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
258 if( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 16 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
259 pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * v4 + 400;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
260 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
261 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
262 if ( pItemNum == 487 )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
263 {
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
264 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) )
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
265 pItemNum = 486;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
266 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
267 ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i];
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
268 item_spellbook->Reset();
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
269 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum;
1567
9f8b3e904e14 Player::ReceiveDamage, very small edits; prepended "Is" to item functions returning bool values (broken, indetified, stolen)
Grumpy7
parents: 1529
diff changeset
270 pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].IsIdentified();
1300
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
271 ItemsInShopTexture[i] = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE);
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
272 }
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
273 return;
bedc304ab617 new files in UI
Ritor1
parents:
diff changeset
274 }