1298
|
1 #ifdef _MSC_VER
|
|
2 #define _CRT_SECURE_NO_WARNINGS
|
|
3 #endif
|
|
4
|
|
5 #include <assert.h>
|
|
6
|
|
7
|
1299
|
8 #include "..\Mouse.h"
|
|
9 #include "..\Keyboard.h"
|
1298
|
10
|
1299
|
11 #include "..\Game.h"
|
|
12 #include "..\GUIWindow.h"
|
|
13 #include "..\GUIFont.h"
|
|
14 #include "..\Party.h"
|
|
15 #include "..\AudioPlayer.h"
|
|
16 #include "..\Render.h"
|
|
17 #include "..\LOD.h"
|
|
18 #include "..\Allocator.h"
|
|
19 #include "..\Time.h"
|
|
20 #include "..\IconFrameTable.h"
|
|
21 #include "..\texts.h"
|
1298
|
22
|
1299
|
23 #include "..\mm7_data.h"
|
1298
|
24
|
|
25
|
|
26
|
|
27 //----- (004908DE) --------------------------------------------------------
|
|
28 signed int __cdecl PlayerCreation_Chose4Skills()
|
|
29 {
|
|
30 Player *v0; // esi@1
|
|
31 signed int v1; // edx@2
|
|
32 unsigned short *v2; // eax@2
|
|
33 signed int v3; // ecx@2
|
|
34
|
|
35 v0 = pParty->pPlayers;//[0].pActiveSkills;
|
|
36 while ( 1 )
|
|
37 {
|
|
38 v1 = 0;
|
|
39 v2 = v0->pActiveSkills;
|
|
40 v3 = 37;
|
|
41 do
|
|
42 {
|
|
43 if ( *v2 )
|
|
44 ++v1;
|
|
45 ++v2;
|
|
46 --v3;
|
|
47 }
|
|
48 while ( v3 );
|
|
49 if ( v1 < 4 )
|
|
50 break;
|
|
51 ++v0;
|
|
52 if ( v0 > &pParty->pPlayers[3] )
|
|
53 return 1;
|
|
54 }
|
|
55 return 0;
|
|
56 }
|
|
57
|
|
58
|
|
59
|
|
60
|
|
61 //----- (00491CB5) --------------------------------------------------------
|
|
62 void __cdecl LoadPlayerPortraintsAndVoices()
|
|
63 {
|
|
64 //Texture **v0; // ebx@1
|
|
65 //int v1; // eax@2
|
|
66 //int v2; // edi@3
|
|
67 char *v3; // esi@5
|
|
68 char *v4; // [sp+10h] [bp-4h]@1
|
|
69
|
|
70 pIcons_LOD->pFacesLock = pIcons_LOD->uNumLoadedFiles;
|
|
71
|
|
72 for (uint i = 0; i < 4; ++i)
|
|
73 for (uint j = 0; j < 56; ++j)
|
|
74 {
|
|
75 sprintf(pTmpBuf.data(), "%s%02d", pPlayerPortraitsNames[pParty->pPlayers[i].uCurrentFace], j + 1);
|
|
76 pTextures_PlayerFaces[i][j] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
|
|
77 }
|
|
78
|
|
79 pTexture_PlayerFaceEradicated = pIcons_LOD->LoadTexturePtr("ERADCATE", TEXTURE_16BIT_PALETTE);
|
|
80 pTexture_PlayerFaceDead = pIcons_LOD->LoadTexturePtr("DEAD", TEXTURE_16BIT_PALETTE);
|
|
81 pTexture_PlayerFaceMask = pIcons_LOD->LoadTexturePtr("FACEMASK", TEXTURE_16BIT_PALETTE);
|
|
82
|
|
83 if (SoundSetAction[24][0])
|
|
84 for (uint i = 0; i < 4; ++i)
|
|
85 {
|
|
86 pSoundList->LoadSound(2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4998, 0);
|
|
87 pSoundList->LoadSound(2 * (SoundSetAction[24][0] + 50 * pParty->pPlayers[i].uVoiceID) + 4999, 0);
|
|
88 }
|
|
89 }
|
|
90
|
|
91 //----- (00491DE7) --------------------------------------------------------
|
|
92 int __fastcall ReloadPlayerPortraits(int a1, int a2)
|
|
93 {
|
|
94 int result; // eax@1
|
|
95 const char **v3; // ebp@1
|
|
96 Texture **v4; // ebx@1
|
|
97 int v5; // esi@2
|
|
98
|
|
99 result = 0;
|
|
100 v3 = &pPlayerPortraitsNames[a2];
|
|
101 v4 = pTextures_PlayerFaces[a1].data();
|
|
102 do
|
|
103 {
|
|
104 v5 = result + 1;
|
|
105 sprintf(pTmpBuf.data(), "%s%02d", *v3, result + 1);
|
|
106 pIcons_LOD->ReloadTexture(*v4, pTmpBuf.data(), 2);
|
|
107 result = v5;
|
|
108 ++v4;
|
|
109 }
|
|
110 while ( v5 < 56 );
|
|
111 return result;
|
|
112 }
|
|
113 //----- (00495B39) --------------------------------------------------------
|
|
114 void PlayerCreationUI_Draw()
|
|
115 {
|
|
116 int pTextCenter; // eax@3
|
|
117 IconFrame *pFrame; // eax@3
|
|
118 int pX; // ecx@7
|
|
119 GUIButton *uPosActiveItem; // edi@12
|
|
120 int uNumLet; // eax@14
|
|
121 char v8; // al@17
|
|
122 int v9; // ecx@17
|
|
123 char v10; // sf@17
|
|
124 size_t v16; // eax@28
|
|
125 int v17; // eax@33
|
|
126 int uStatLevel; // eax@44
|
|
127 unsigned int pStatColor; // eax@44
|
|
128 PLAYER_SKILL_TYPE pSkillsType; // eax@44
|
|
129 int v51; // eax@49
|
|
130 char *v52; // edi@52
|
|
131 char v53; // al@52
|
|
132 PLAYER_CLASS_TYPE uClassType; // edi@53
|
|
133 int pColorText; // eax@53
|
|
134 PLAYER_SKILL_TYPE pSkillId; // edi@72
|
|
135 size_t pLenText; // eax@72
|
|
136 signed int v104; // ecx@72
|
|
137 int pTextY; // ST08_4@81
|
|
138 signed int pBonusNum; // edi@82
|
|
139 const char *uRaceName; // [sp+0h] [bp-170h]@39
|
|
140 char pText[200]; // [sp+10h] [bp-160h]@14
|
|
141 GUIWindow pWindow; // [sp+D8h] [bp-98h]@83
|
|
142 size_t v120; // [sp+130h] [bp-40h]@25
|
|
143 int uColor1; // [sp+144h] [bp-2Ch]@1
|
|
144 int v126; // [sp+148h] [bp-28h]@25
|
|
145 int uColorGreen; // [sp+14Ch] [bp-24h]@1
|
|
146 int pIntervalY; // [sp+150h] [bp-20h]@14
|
|
147 int pX_Numbers; // [sp+154h] [bp-1Ch]@18
|
|
148 int uColorTeal; // [sp+158h] [bp-18h]@1
|
|
149 int uColorWhite; // [sp+15Ch] [bp-14h]@1
|
|
150 int uX; // [sp+160h] [bp-10h]@18
|
|
151 unsigned int v133; // [sp+164h] [bp-Ch]@25
|
|
152 int pOrder; // [sp+168h] [bp-8h]@14
|
|
153 int pIntervalX;
|
|
154 int pCorrective;
|
|
155 const char *pSkillName;
|
|
156
|
|
157 uColor1 = TargetColor(0xD1, 0xBB, 0x61);
|
|
158 uColorTeal = TargetColor(0, 0xF7, 0xF7);
|
|
159 uColorGreen = TargetColor(0, 0xFF, 0);
|
|
160 uColorWhite = TargetColor(0xFF, 0xFF, 0xFF);
|
|
161 pRenderer->BeginScene();
|
|
162 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX);
|
|
163 uPlayerCreationUI_SkySliderPos = (GetTickCount() % 12800) / 20;
|
|
164 pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos, 2, pTexture_MAKESKY);
|
|
165 pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos - 640, 2, pTexture_MAKESKY);
|
|
166 pRenderer->DrawTextureTransparent(0, 0, pTexture_MAKETOP);
|
|
167
|
|
168 uPlayerCreationUI_SelectedCharacter = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) / 7;
|
|
169 switch (uPlayerCreationUI_SelectedCharacter)
|
|
170 {
|
|
171 case 0: pX = 12; break;
|
|
172 case 1: pX = 171; break;
|
|
173 case 2: pX = 329; break;
|
|
174 case 3: pX = 488; break;
|
|
175 default:
|
|
176 assert(false && "Invalid selected character");
|
|
177 }
|
|
178
|
|
179 pTextCenter = pFontCChar->AlignText_Center(640, pGlobalTXT_LocalizationStrings[51]);
|
|
180 pGUIWindow_CurrentMenu->DrawText(pFontCChar, pTextCenter + 1, 0, 0, pGlobalTXT_LocalizationStrings[51], 0, 0, 0);
|
|
181 pRenderer->DrawTextureTransparent(17, 35, pPlayerPortraits[pParty->pPlayers[0].uCurrentFace]);
|
|
182 pRenderer->DrawTextureTransparent(176, 35, pPlayerPortraits[pParty->pPlayers[1].uCurrentFace]);
|
|
183 pRenderer->DrawTextureTransparent(335, 35, pPlayerPortraits[pParty->pPlayers[2].uCurrentFace]);
|
|
184 pRenderer->DrawTextureTransparent(494, 35, pPlayerPortraits[pParty->pPlayers[3].uCurrentFace]);
|
|
185 pFrame = pIconsFrameTable->GetFrame(uIconID_CharacterFrame, pEventTimer->uStartTime);
|
|
186
|
|
187
|
|
188 pRenderer->DrawTextureTransparent(pX, 29, &pIcons_LOD->pTextures[pFrame->uTextureID]);
|
|
189 uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->pCurrentPosActiveItem);
|
|
190 uPlayerCreationUI_ArrowAnim = 19 - (GetTickCount() % 500) / 25;
|
|
191 pRenderer->DrawTextureTransparent(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim]);
|
|
192 pRenderer->DrawTextureTransparent(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim]);
|
|
193
|
|
194 memset(pText, 0, 200);
|
|
195 strcpy(pText, pGlobalTXT_LocalizationStrings[205]);// "Skills"
|
|
196 uNumLet = strlen(pText) - 1;
|
|
197 pOrder = uNumLet;
|
|
198 if ( uNumLet >= 0 )
|
|
199 {
|
|
200 while ( 1 )
|
|
201 {
|
|
202 v8 = toupper((unsigned __int8)pText[uNumLet]);
|
|
203 v9 = pOrder;
|
|
204 v10 = pOrder-- - 1 < 0;
|
|
205 pText[v9] = v8;
|
|
206 if ( v10 )
|
|
207 break;
|
|
208 uNumLet = pOrder;
|
|
209 }
|
|
210 }
|
|
211
|
|
212 pIntervalX = 18;
|
|
213 pIntervalY = pFontCreate->uFontHeight - 2;
|
|
214 //v124 = 0;
|
|
215 uX = 32;
|
|
216 pX_Numbers = 493;
|
|
217
|
|
218 for (int i = 0; i < 4; ++i)
|
|
219 {
|
|
220 auto player = pParty->pPlayers + i;
|
|
221
|
|
222 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pIntervalX + 73, 100, 0, pClassNames[player->classType], 0, 0, 0);
|
|
223 pRenderer->DrawTextureTransparent(pIntervalX + 77, 50, pTexture_IC_KNIGHT[player->classType / 4]);
|
|
224
|
|
225 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_NONE && pGUIWindow_CurrentMenu->ptr_1C == (void *)i )
|
|
226 {
|
|
227 switch ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 )
|
|
228 {
|
|
229 case WINDOW_INPUT_IN_PROGRESS://press name panel
|
|
230 v17 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, 159 * (int)pGUIWindow_CurrentMenu->ptr_1C + 18, 124, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 120, 1);
|
|
231 pGUIWindow_CurrentMenu->DrawFlashingInputCursor(159 * (unsigned int)pGUIWindow_CurrentMenu->ptr_1C + v17 + 20, 124, pFontCreate);
|
|
232 break;
|
|
233 case WINDOW_INPUT_CONFIRMED: // press enter
|
|
234 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
235 v120 = strlen((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
236 v126 = 0;
|
|
237 v133 = 0;
|
|
238 if ( strlen((const char *)pKeyActionMap->pPressedKeysBuffer) )//edit name
|
|
239 {
|
|
240 do
|
|
241 {
|
|
242 if ( pKeyActionMap->pPressedKeysBuffer[v133] == ' ' )
|
|
243 ++v126;
|
|
244 ++v133;
|
|
245 v16 = strlen((const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
246 }
|
|
247 while ( v133 < v16 );
|
|
248 }
|
|
249 if ( v120 && v126 != v120 )
|
|
250 strcpy(player->pName, (const char *)pKeyActionMap->pPressedKeysBuffer);
|
|
251 pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, player->pName, 130, 0);
|
|
252 *(short *)&player->field_1988[27] = 1;
|
|
253 break;
|
|
254 case WINDOW_INPUT_CANCELLED: // press escape
|
|
255 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
256 pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, player->pName, 130, 0);
|
|
257 SetCurrentMenuID(MENU_NAMEPANELESC);
|
|
258 break;
|
|
259 }
|
|
260 }
|
|
261 else
|
|
262 {
|
|
263 pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, player->pName, 130, 0);
|
|
264 }
|
|
265
|
|
266 switch (player->GetRace())
|
|
267 {
|
|
268 case 0: uRaceName = pGlobalTXT_LocalizationStrings[99]; break; // "Human"
|
|
269 case 1: uRaceName = pGlobalTXT_LocalizationStrings[103]; break; // "Dwarf"
|
|
270 case 2: uRaceName = pGlobalTXT_LocalizationStrings[106]; break; // "Goblin"
|
|
271 case 3: uRaceName = pGlobalTXT_LocalizationStrings[101]; break; // "Elf"
|
|
272 };
|
|
273 strcpy(pTmpBuf.data(), uRaceName);
|
|
274 pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX + 72, pIntervalY + 12, 0, pTmpBuf.data(), 130, 0);//Race Name
|
|
275
|
|
276 pTextCenter = pFontCreate->AlignText_Center(150, pText);
|
|
277 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + uX - 24, 291, uColor1, pText, 0, 0, 0); // Skills
|
|
278
|
|
279 uStatLevel = player->GetActualMight();
|
|
280 sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[144], pX_Numbers, uStatLevel);// "Might"
|
|
281 pStatColor = player->GetStatColor(0);
|
|
282 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
|
|
283
|
|
284 uStatLevel = player->GetActualIntelligence();
|
|
285 sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[116], pX_Numbers, uStatLevel);// "Intellect"
|
|
286 pStatColor = player->GetStatColor(1);
|
|
287 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
|
|
288
|
|
289 uStatLevel = player->GetActualWillpower();
|
|
290 sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[163], pX_Numbers, uStatLevel);// "Personality"
|
|
291 pStatColor = player->GetStatColor(2);
|
|
292 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 2 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
|
|
293
|
|
294 uStatLevel = player->GetActualEndurance();
|
|
295 sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[75], pX_Numbers, uStatLevel);// "Endurance"
|
|
296 pStatColor = player->GetStatColor(3);
|
|
297 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 3 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
|
|
298
|
|
299 uStatLevel = player->GetActualAccuracy();
|
|
300 sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[1], pX_Numbers, uStatLevel);// "Accuracy"
|
|
301 pStatColor = player->GetStatColor(4);
|
|
302 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 4 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
|
|
303
|
|
304 uStatLevel = player->GetActualSpeed();
|
|
305 sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[211], pX_Numbers, uStatLevel);// "Speed"
|
|
306 pStatColor = player->GetStatColor(5);
|
|
307 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 5 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
|
|
308
|
|
309 uStatLevel = player->GetActualLuck();
|
|
310 sprintf(pTmpBuf.data(), "%s\r%03d%d", pGlobalTXT_LocalizationStrings[136], pX_Numbers, uStatLevel);// "Luck"
|
|
311 pStatColor = player->GetStatColor(6);
|
|
312 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 6 * pIntervalY + 169, pStatColor, pTmpBuf.data(), 0, 0, 0);
|
|
313
|
|
314
|
|
315 pSkillsType = player->GetSkillIdxByOrder(0);
|
|
316 pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]);
|
|
317 sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
|
|
318 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 311, uColorWhite, pTmpBuf.data(), 0, 0, 0);
|
|
319
|
|
320 pSkillsType = player->GetSkillIdxByOrder(1);
|
|
321 pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]);
|
|
322 sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
|
|
323 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, pIntervalY + 311, uColorWhite, pTmpBuf.data(), 0, 0, 0);
|
|
324
|
|
325 pSkillsType = player->GetSkillIdxByOrder(2);
|
|
326 pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]);
|
|
327 sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
|
|
328 pColorText = uColorGreen;
|
|
329 if ( (signed int)pSkillsType >= 37 )
|
|
330 pColorText = uColorTeal;
|
|
331 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 2 * pIntervalY + 311, pColorText, pTmpBuf.data(), 0, 0, 0);
|
|
332
|
|
333 pSkillsType = player->GetSkillIdxByOrder(3);
|
|
334 pTextCenter = pFontCreate->AlignText_Center(150, pSkillNames[pSkillsType]);
|
|
335 sprintf(pTmpBuf.data(), "\t%03u%s", pTextCenter, pSkillNames[pSkillsType]);
|
|
336 pColorText = uColorGreen;
|
|
337 if ( (signed int)pSkillsType >= 37 )
|
|
338 pColorText = uColorTeal;
|
|
339 pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 3 * pIntervalY + 311, pColorText, pTmpBuf.data(), 0, 0, 0);
|
|
340
|
|
341 //v124 = (char *)v124 + 1;
|
|
342 pIntervalX += 159;
|
|
343 pX_Numbers -= 158;
|
|
344 uX += 158;
|
|
345 }
|
|
346
|
|
347 strcpy(pText, pGlobalTXT_LocalizationStrings[41]);// "Class"
|
|
348 v51 = strlen(pText) - 1;
|
|
349 pOrder = v51;
|
|
350 if ( v51 >= 0 )
|
|
351 {
|
|
352 while ( 1 )
|
|
353 {
|
|
354 v52 = &pText[v51];
|
|
355 v53 = toupper((unsigned __int8)pText[v51]);
|
|
356 v10 = pOrder-- - 1 < 0;
|
|
357 *v52 = v53;
|
|
358 if ( v10 )
|
|
359 break;
|
|
360 v51 = pOrder;
|
|
361 }
|
|
362 }
|
|
363 uClassType = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].classType;
|
|
364 pTextCenter = pFontCreate->AlignText_Center(193, pText);
|
|
365 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 324, 395, uColor1, pText, 0, 0, 0);//Classes
|
|
366
|
|
367 pColorText = uColorTeal;
|
|
368 if ( uClassType )
|
|
369 pColorText = uColorWhite;
|
|
370 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[0]);
|
|
371 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 417, pColorText, pClassNames[0], 0, 0, 0);
|
|
372
|
|
373 pColorText = uColorTeal;
|
|
374 if ( uClassType != PLAYER_CLASS_PALADIN )
|
|
375 pColorText = uColorWhite;
|
|
376 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[12]);
|
|
377 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, pIntervalY + 417, pColorText, pClassNames[12], 0, 0, 0);
|
|
378
|
|
379 pColorText = uColorTeal;
|
|
380 if ( uClassType != PLAYER_CLASS_DRUID )
|
|
381 pColorText = uColorWhite;
|
|
382 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[20]);
|
|
383 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 323, 2 * pIntervalY + 417, pColorText, pClassNames[20], 0, 0, 0);
|
|
384
|
|
385 pColorText = uColorTeal;
|
|
386 if ( uClassType != PLAYER_CLASS_CLERIC )
|
|
387 pColorText = uColorWhite;
|
|
388 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[24]);
|
|
389 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 417, pColorText, pClassNames[24], 0, 0, 0);
|
|
390
|
|
391 pColorText = uColorTeal;
|
|
392 if ( uClassType != PLAYER_CLASS_DRUID)
|
|
393 pColorText = uColorWhite;
|
|
394 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[28]);
|
|
395 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, pIntervalY + 417, pColorText, pClassNames[28], 0, 0, 0);
|
|
396
|
|
397 pColorText = uColorTeal;
|
|
398 if ( uClassType != PLAYER_CLASS_SORCERER )
|
|
399 pColorText = uColorWhite;
|
|
400 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[32]);
|
|
401 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 388, 2 * pIntervalY + 417, pColorText, pClassNames[32], 0, 0, 0);
|
|
402
|
|
403 pColorText = uColorTeal;
|
|
404 if ( uClassType != PLAYER_CLASS_ARCHER )
|
|
405 pColorText = uColorWhite;
|
|
406 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[16]);
|
|
407 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 417, pColorText, pClassNames[16], 0, 0, 0);
|
|
408
|
|
409 pColorText = uColorTeal;
|
|
410 if ( uClassType != PLAYER_CLASS_MONK )
|
|
411 pColorText = uColorWhite;
|
|
412 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[8]);
|
|
413 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, pIntervalY + 417, pColorText, pClassNames[8], 0, 0, 0);
|
|
414
|
|
415 pColorText = uColorTeal;
|
|
416 if ( uClassType != PLAYER_CLASS_THEIF )
|
|
417 pColorText = uColorWhite;
|
|
418 pTextCenter = pFontCreate->AlignText_Center(65, pClassNames[4]);
|
|
419 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 453, 2 * pIntervalY + 417, pColorText, pClassNames[4], 0, 0, 0);
|
|
420
|
|
421 pTextCenter = pFontCreate->AlignText_Center(236, pGlobalTXT_LocalizationStrings[20]); // "Available Skills"
|
|
422 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 37, 395, uColor1, pGlobalTXT_LocalizationStrings[20], 0, 0, 0);
|
|
423 for (uint i = 0; i < 9; ++i)
|
|
424 {
|
|
425 pSkillId = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(i + 4);
|
|
426 strcpy(pText, pSkillNames[pSkillId]);
|
|
427 pLenText = strlen(pText);
|
|
428 v104 = 0;
|
|
429 if ( (signed int)pLenText > 0 )
|
|
430 {
|
|
431 if ( pText[v104] == 32 )
|
|
432 {
|
|
433 pText[v104] = 0;
|
|
434 }
|
|
435 else
|
|
436 {
|
|
437 while ( pText[v104] != 32 )
|
|
438 {
|
|
439 ++v104;
|
|
440 if ( v104 >= (signed int)pLenText )
|
|
441 break;
|
|
442 }
|
|
443 }
|
|
444 }
|
|
445 pCorrective = -10;//-5
|
|
446 if ( (signed int)pLenText < 8 )//if ( (signed int)v124 > 2 )
|
|
447 pCorrective = 0;
|
|
448 pColorText = uColorTeal;
|
|
449 if ( !pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pSkillId] )
|
|
450 pColorText = uColorWhite;
|
|
451 pTextCenter = pFontCreate->AlignText_Center(100, pText);
|
|
452 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 100 * (i / 3) + pTextCenter + pCorrective + 17, pIntervalY * (i % 3) + 417, pColorText, pText, 0, 0, 0);
|
|
453 }
|
|
454
|
|
455 pTextCenter = pFontCreate->AlignText_Center(0x5C, pGlobalTXT_LocalizationStrings[30]);// "Bonus"
|
|
456 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 533, 394, uColor1, pGlobalTXT_LocalizationStrings[30], 0, 0, 0);
|
|
457 pBonusNum = PlayerCreation_GetUnspentAttributePointCount();
|
|
458 sprintf(pTmpBuf.data(), "%d", pBonusNum);
|
|
459 pTextCenter = pFontCreate->AlignText_Center(84, pTmpBuf.data());
|
|
460 pGUIWindow_CurrentMenu->DrawText(pFontCreate, pTextCenter + 530, 410, uColorWhite, pTmpBuf.data(), 0, 0, 0);
|
|
461 if ( GameUI_Footer_TimeLeft > GetTickCount() )
|
|
462 {
|
|
463 pWindow.Hint = pGlobalTXT_LocalizationStrings[412];// "Create Party cannot be completed unless you have assigned all characters 2 extra skills and have spent all of your bonus points."
|
|
464 if ( pBonusNum < 0 )
|
|
465 pWindow.Hint = pGlobalTXT_LocalizationStrings[413];// "You can't spend more than 50 points."
|
|
466 pWindow.uFrameWidth = 300;
|
|
467 pWindow.uFrameHeight = 100;
|
|
468 pWindow.uFrameX = 170;
|
|
469 pWindow.uFrameY = 140;
|
|
470 pWindow.uFrameZ = 469;
|
|
471 pWindow.uFrameW = 239;
|
|
472 pWindow.DrawMessageBox(0);
|
|
473 }
|
|
474 pRenderer->EndScene();
|
|
475 }
|
|
476
|
|
477 //----- (0049695A) --------------------------------------------------------
|
|
478 void __cdecl PlayerCreationUI_Initialize()
|
|
479 {
|
|
480 unsigned int v0; // ebx@5
|
|
481 unsigned int v1; // eax@6
|
|
482 int v2; // ecx@6
|
|
483 //unsigned int v3; // eax@8
|
|
484 //signed int v4; // ecx@8
|
|
485 signed int uControlParam; // [sp+10h] [bp-Ch]@7
|
|
486 unsigned int uControlParama; // [sp+10h] [bp-Ch]@9
|
|
487 unsigned int uControlParamb; // [sp+10h] [bp-Ch]@11
|
|
488 unsigned int uControlParamc; // [sp+10h] [bp-Ch]@13
|
|
489 signed int uControlParamd; // [sp+10h] [bp-Ch]@15
|
|
490 signed int uX; // [sp+14h] [bp-8h]@5
|
|
491 unsigned int uXa; // [sp+14h] [bp-8h]@9
|
|
492 unsigned int uXb; // [sp+14h] [bp-8h]@11
|
|
493 unsigned int uXc; // [sp+14h] [bp-8h]@13
|
|
494 signed int uXd; // [sp+14h] [bp-8h]@16
|
|
495
|
|
496 pMessageQueue_50CBD0->Flush();
|
|
497
|
|
498 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f);
|
|
499 ++pIcons_LOD->uTexturePacksCount;
|
|
500 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
501 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
502 pCurrentScreen = SCREEN_PARTY_CREATION;
|
|
503 uPlayerCreationUI_ArrowAnim = 0;
|
|
504 uPlayerCreationUI_SkySliderPos = 0;
|
|
505 uPlayerCreationUI_SelectedCharacter = 0;
|
|
506 v0 = LOBYTE(pFontCreate->uFontHeight) - 2;
|
|
507 pTexture_IC_KNIGHT[0] = pIcons_LOD->LoadTexturePtr("IC_KNIGHT", TEXTURE_16BIT_PALETTE);
|
|
508 pTexture_IC_KNIGHT[1] = pIcons_LOD->LoadTexturePtr("IC_THIEF", TEXTURE_16BIT_PALETTE);
|
|
509 pTexture_IC_KNIGHT[2] = pIcons_LOD->LoadTexturePtr("IC_MONK", TEXTURE_16BIT_PALETTE);
|
|
510 pTexture_IC_KNIGHT[3] = pIcons_LOD->LoadTexturePtr("IC_PALAD", TEXTURE_16BIT_PALETTE);
|
|
511 pTexture_IC_KNIGHT[4] = pIcons_LOD->LoadTexturePtr("IC_ARCH", TEXTURE_16BIT_PALETTE);
|
|
512 pTexture_IC_KNIGHT[5] = pIcons_LOD->LoadTexturePtr("IC_RANGER", TEXTURE_16BIT_PALETTE);
|
|
513 pTexture_IC_KNIGHT[6] = pIcons_LOD->LoadTexturePtr("IC_CLER", TEXTURE_16BIT_PALETTE);
|
|
514 pTexture_IC_KNIGHT[7] = pIcons_LOD->LoadTexturePtr("IC_DRUID", TEXTURE_16BIT_PALETTE);
|
|
515 pTexture_IC_KNIGHT[8] = pIcons_LOD->LoadTexturePtr("IC_SORC", TEXTURE_16BIT_PALETTE);
|
|
516 pTexture_MAKETOP = pIcons_LOD->LoadTexturePtr("MAKETOP", TEXTURE_16BIT_PALETTE);
|
|
517 pTexture_MAKESKY = pIcons_LOD->LoadTexturePtr("MAKESKY", TEXTURE_16BIT_PALETTE);
|
|
518 for(uX=0;uX < 22;++uX ) // load PlayerPortraits texture
|
|
519 {
|
|
520 sprintf(pTmpBuf.data(), "%s01", pPlayerPortraitsNames[uX]);
|
|
521 v1 = pIcons_LOD->LoadTexture(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
|
|
522 pPlayerPortraits[uX] = &pIcons_LOD->pTextures[v1];
|
|
523
|
|
524 }
|
|
525 pTexture_PlayerFaceMask = pIcons_LOD->LoadTexturePtr("FACEMASK", TEXTURE_16BIT_PALETTE);
|
|
526 pTexture_buttminu = pIcons_LOD->LoadTexturePtr("buttminu", TEXTURE_16BIT_PALETTE);
|
|
527 pTexture_buttplus = pIcons_LOD->LoadTexturePtr("buttplus", TEXTURE_16BIT_PALETTE);
|
|
528 pTexture_pressrigh = pIcons_LOD->LoadTexturePtr("presrigh", TEXTURE_16BIT_PALETTE);
|
|
529 pTexture_presleft = pIcons_LOD->LoadTexturePtr("presleft", TEXTURE_16BIT_PALETTE);
|
|
530 uControlParam = 1;
|
|
531 do
|
|
532 {
|
|
533 sprintf(pTmpBuf.data(), "arrowl%d", uControlParam);
|
|
534 pTextures_arrowl[uControlParam] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
|
|
535
|
|
536 sprintf(pTmpBuf.data(), "arrowr%d", uControlParam);
|
|
537 pTextures_arrowr[uControlParam] = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE);
|
|
538 }
|
|
539 while ( ++uControlParam < 20 );
|
|
540 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
|
|
541 uControlParama = 0;
|
|
542 uXa = 8;
|
|
543 do
|
|
544 {
|
|
545 pGUIWindow_CurrentMenu->CreateButton(uXa, 120, 145, 25, 1, 0, UIMSG_PlayerCreationChangeName, uControlParama, 0, "", 0);
|
|
546 uXa += 158;
|
|
547 ++uControlParama;
|
|
548 }
|
|
549 while ( (signed int)uXa < 640 );
|
|
550
|
|
551 pCreationUI_BtnPressLeft[0] = pGUIWindow_CurrentMenu->CreateButton( 10, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev, 0, 0, "", pTexture_presleft, 0);
|
|
552 pCreationUI_BtnPressLeft[1] = pGUIWindow_CurrentMenu->CreateButton(169, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev, 1, 0, "", pTexture_presleft, 0);
|
|
553 pCreationUI_BtnPressLeft[2] = pGUIWindow_CurrentMenu->CreateButton(327, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev, 2, 0, "", pTexture_presleft, 0);
|
|
554 pCreationUI_BtnPressLeft[3] = pGUIWindow_CurrentMenu->CreateButton(486, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FacePrev, 3, 0, "", pTexture_presleft, 0);
|
|
555 pCreationUI_BtnPressRight[0] = pGUIWindow_CurrentMenu->CreateButton( 74, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext, 0, 0, "", pTexture_pressrigh, 0);
|
|
556 pCreationUI_BtnPressRight[1] = pGUIWindow_CurrentMenu->CreateButton(233, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext, 1, 0, "", pTexture_pressrigh, 0);
|
|
557 pCreationUI_BtnPressRight[2] = pGUIWindow_CurrentMenu->CreateButton(391, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext, 2, 0, "", pTexture_pressrigh, 0);
|
|
558 pCreationUI_BtnPressRight[3] = pGUIWindow_CurrentMenu->CreateButton(549, 32, 11, 13, 1, 0, UIMSG_PlayerCreation_FaceNext, 3, 0, "", pTexture_pressrigh, 0);
|
|
559 pCreationUI_BtnPressLeft2[0] = pGUIWindow_CurrentMenu->CreateButton( 10, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 0, 0, "", pTexture_presleft, 0);
|
|
560 pCreationUI_BtnPressLeft2[1] = pGUIWindow_CurrentMenu->CreateButton(169, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 1, 0, "", pTexture_presleft, 0);
|
|
561 pCreationUI_BtnPressLeft2[2] = pGUIWindow_CurrentMenu->CreateButton(327, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 2, 0, "", pTexture_presleft, 0);
|
|
562 pCreationUI_BtnPressLeft2[3] = pGUIWindow_CurrentMenu->CreateButton(486, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoicePrev, 3, 0, "", pTexture_presleft, 0);
|
|
563 pCreationUI_BtnPressRight2[0] = pGUIWindow_CurrentMenu->CreateButton( 74, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 0, 0, "", pTexture_pressrigh, 0);
|
|
564 pCreationUI_BtnPressRight2[1] = pGUIWindow_CurrentMenu->CreateButton(233, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 1, 0, "", pTexture_pressrigh, 0);
|
|
565 pCreationUI_BtnPressRight2[2] = pGUIWindow_CurrentMenu->CreateButton(391, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 2, 0, "", pTexture_pressrigh, 0);
|
|
566 pCreationUI_BtnPressRight2[3] = pGUIWindow_CurrentMenu->CreateButton(549, 103, 11, 13, 1, 0, UIMSG_PlayerCreation_VoiceNext, 3, 0, "", pTexture_pressrigh, 0);
|
|
567
|
|
568 uControlParamb = 0;
|
|
569 uXb = 8;
|
|
570 do
|
|
571 {
|
|
572 pGUIWindow_CurrentMenu->CreateButton(uXb, 308, 150, v0, 1, 0, UIMSG_48, uControlParamb, 0, "", 0);
|
|
573 pGUIWindow_CurrentMenu->CreateButton(uXb, v0 + 308, 150, v0, 1, 0, UIMSG_49, uControlParamb, 0, "", 0);
|
|
574 pGUIWindow_CurrentMenu->CreateButton(uXb, 2 * v0 + 308, 150, v0, 1, 0, UIMSG_PlayerCreationRemoveUpSkill, uControlParamb, 0, "", 0);
|
|
575 pGUIWindow_CurrentMenu->CreateButton(uXb, 3 * v0 + 308, 150, v0, 1, 0, UIMSG_PlayerCreationRemoveDownSkill, uControlParamb, 0, "", 0);
|
|
576 uXb += 158;
|
|
577 ++uControlParamb;
|
|
578 }
|
|
579 while ( (signed int)uXb < 640 );
|
|
580
|
|
581 pGUIWindow_CurrentMenu->CreateButton( 5, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 0, '1', "", 0);
|
|
582 pGUIWindow_CurrentMenu->CreateButton(163, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 1, '2', "", 0);
|
|
583 pGUIWindow_CurrentMenu->CreateButton(321, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 2, '3', "", 0);
|
|
584 pGUIWindow_CurrentMenu->CreateButton(479, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 3, '4', "", 0);
|
|
585
|
|
586 uXc = 23;
|
|
587 uControlParamc = 2;
|
|
588 do
|
|
589 {
|
|
590 pGUIWindow_CurrentMenu->CreateButton(uXc, 169, 120, 20, 1, 0, UIMSG_0, uControlParamc - 2, 0, "", 0);
|
|
591 pGUIWindow_CurrentMenu->CreateButton(uXc, v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc - 1, 0, "", 0);
|
|
592 pGUIWindow_CurrentMenu->CreateButton(uXc, 2 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc, 0, "", 0);
|
|
593 pGUIWindow_CurrentMenu->CreateButton(uXc, 3 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc + 1, 0, "", 0);
|
|
594 pGUIWindow_CurrentMenu->CreateButton(uXc, 4 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc + 2, 0, "", 0);
|
|
595 pGUIWindow_CurrentMenu->CreateButton(uXc, 5 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc + 3, 0, "", 0);
|
|
596 pGUIWindow_CurrentMenu->CreateButton(uXc, 6 * v0 + 169, 120, 20, 1, 0, UIMSG_0, uControlParamc + 4, 0, "", 0);
|
|
597 uControlParamc += 7;
|
|
598 uXc += 158;
|
|
599 }
|
|
600 while ( (signed int)uControlParamc < 30 );
|
|
601 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(28, 0, 7, 40);
|
|
602
|
|
603 pGUIWindow_CurrentMenu->CreateButton(323, 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0, 0, "", 0);
|
|
604 pGUIWindow_CurrentMenu->CreateButton(323, v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0xC, 0, "", 0);
|
|
605 pGUIWindow_CurrentMenu->CreateButton(323, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x14, 0, "", 0);
|
|
606 pGUIWindow_CurrentMenu->CreateButton(388, 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x18, 0, "", 0);
|
|
607 pGUIWindow_CurrentMenu->CreateButton(388, v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x1C, 0, "", 0);
|
|
608 pGUIWindow_CurrentMenu->CreateButton(388, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x20, 0, "", 0);
|
|
609 pGUIWindow_CurrentMenu->CreateButton(453, 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x10, 0, "", 0);
|
|
610 pGUIWindow_CurrentMenu->CreateButton(453, v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 8, 0, "", 0);
|
|
611 pGUIWindow_CurrentMenu->CreateButton(453, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 4, 0, "", 0);
|
|
612
|
|
613 uControlParamd = 0;
|
|
614 do
|
|
615 {
|
|
616 uXd = -5;
|
|
617 if ( uControlParamd <= 3 )
|
|
618 uXd = 0;
|
|
619 pGUIWindow_CurrentMenu->CreateButton(100 * (uControlParamd / 3) + uXd + 17, v0 * (uControlParamd % 3) + 417, 100, v0, 1, 0, UIMSG_PlayerCreationSelectActiveSkill,
|
|
620 uControlParamd, 0, "", 0);
|
|
621 ++uControlParamd;
|
|
622 }
|
|
623 while ( uControlParamd < 9 );
|
|
624
|
|
625 pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickOK, 0, '\r', "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE), 0);
|
|
626 pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickReset, 0, 'C', "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE2), 0);
|
|
627 pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickMinus, 0, '-', "", pTexture_buttminu, 0);
|
|
628 pPlayerCreationUI_BtnPlus = pGUIWindow_CurrentMenu->CreateButton(613, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickPlus, 1, '+', "", pTexture_buttplus, 0);
|
|
629
|
|
630 pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL);
|
|
631 }
|
|
632 // 4E28F8: using guessed type int pCurrentScreen;
|
|
633
|
|
634 //----- (0049750E) --------------------------------------------------------
|
|
635 void DeleteCCharFont()
|
|
636 {
|
|
637 pAllocator->FreeChunk(pFontCChar);
|
|
638 pFontCChar = 0;
|
|
639 }
|
|
640 //----- (00497526) --------------------------------------------------------
|
|
641 bool PlayerCreationUI_Loop()
|
|
642 {
|
|
643 //RGBTexture *pTexture; // ebx@1
|
|
644 //UINT v1; // esi@1
|
|
645 unsigned int v2; // ecx@3
|
|
646 LONG uMouseX; // edi@6
|
|
647 LONG uMouseY; // eax@6
|
|
648 GUIButton *pControlsHead; // edx@6
|
|
649 //unsigned int pNumMessage; // ecx@7
|
|
650 int pControlParam; // esi@12
|
|
651 signed int v8; // edi@30
|
|
652 int v9; // edx@31
|
|
653 char *v10; // ebx@37
|
|
654 Player *v11; // esi@38
|
|
655 //signed int uSpellBookPageCount; // ecx@40
|
|
656 int v13; // eax@40
|
|
657 //signed int uSkillIdx; // eax@45
|
|
658 int v15; // eax@70
|
|
659 signed int v16; // ecx@70
|
|
660 //unsigned int v18; // [sp-4h] [bp-84h]@48
|
|
661 ItemGen item; // [sp+Ch] [bp-74h]@37
|
|
662 char v20[32]; // [sp+30h] [bp-50h]@29
|
|
663 //char v21; // [sp+31h] [bp-4Fh]@29
|
|
664 //__int16 v22; // [sp+4Dh] [bp-33h]@29
|
|
665 char v23; // [sp+4Fh] [bp-31h]@29
|
|
666 MSG Msg; // [sp+50h] [bp-30h]@17
|
|
667 POINT v25; // [sp+6Ch] [bp-14h]@6
|
|
668 bool v26; // [sp+74h] [bp-Ch]@1
|
|
669 //POINT v24; // [sp+78h] [bp-8h]@6
|
|
670 //Player *pPlayer;
|
|
671
|
|
672 //pTexture = &pTexture_PCX;
|
|
673 v26 = 0;
|
|
674 pTexture_PCX.Release();
|
|
675 pTexture_PCX.Load("makeme.pcx", 0);
|
|
676
|
|
677 v2 = 6;
|
|
678 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
679 //LABEL_27:
|
|
680 SetCurrentMenuID((MENU_STATE)v2);
|
|
681 while ( GetCurrentMenuID() == MENU_CREATEPARTY )
|
|
682 {
|
|
683 uMouseX = pMouse->GetCursorPos(&v25)->x;
|
|
684 uMouseY = pMouse->GetCursorPos(&v25)->y;
|
|
685 pControlsHead = pGUIWindow_CurrentMenu->pControlsHead;
|
|
686
|
|
687 //does nothing actually
|
|
688 /*if ( pControlsHead != (GUIButton *)v1 )
|
|
689 {
|
|
690 pNumMessage = pMessageQueue_50CBD0->uNumMessages;
|
|
691 do
|
|
692 {
|
|
693 if ( uMouseX >= (signed int)pControlsHead->uX && uMouseX <= (signed int)pControlsHead->uZ
|
|
694 && uMouseY >= (signed int)pControlsHead->uY && uMouseY <= (signed int)pControlsHead->uW )//mouse movement
|
|
695 {
|
|
696 pControlParam = pControlsHead->uControlParam;
|
|
697 pMessageQueue_50CBD0->AddMessage((UIMessageType)pControlsHead->field_1C, pControlParam, 0);
|
|
698 v1 = 0;
|
|
699 }
|
|
700 pControlsHead = pControlsHead->pNext;
|
|
701 }
|
|
702 while ( pControlsHead != (GUIButton *)v1 );
|
|
703 }*/
|
|
704
|
|
705 while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) )
|
|
706 {
|
|
707 if ( Msg.message == WM_QUIT )
|
|
708 Game_DeinitializeAndTerminate(0);
|
|
709 TranslateMessage(&Msg);
|
|
710 DispatchMessageA(&Msg);
|
|
711 }
|
|
712 if ( BYTE1(dword_6BE364_game_settings_1) & 1 )
|
|
713 {
|
|
714 WaitMessage();
|
|
715 }
|
|
716 else
|
|
717 {
|
|
718 PlayerCreationUI_Draw();
|
|
719 GUI_MainMenuMessageProc();
|
|
720 pRenderer->BeginScene();
|
|
721 GUI_UpdateWindows();
|
|
722 pRenderer->EndScene();
|
|
723 pRenderer->Present();
|
|
724 if ( uGameState == GAME_FINISHED )//if click Esc in PlayerCreation Window
|
|
725 {
|
|
726 v26 = 1;
|
|
727 //v2 = 0;
|
|
728 //goto LABEL_27;
|
|
729 SetCurrentMenuID(MENU_MAIN);
|
|
730 continue;
|
|
731 }
|
|
732 if ( uGameState == GAME_STATE_STARTING_NEW_GAME )//if click OK in PlayerCreation Window
|
|
733 {
|
|
734 uGameState = GAME_STATE_PLAYING;
|
|
735 //v2 = 1;
|
|
736 //goto LABEL_27;
|
|
737 SetCurrentMenuID(MENU_NEWGAME);
|
|
738 continue;
|
|
739 }
|
|
740 }
|
|
741 }
|
|
742 pTexture_PCX.Release();
|
|
743 pGUIWindow_CurrentMenu->Release();
|
|
744 pIcons_LOD->_4114F2();
|
|
745
|
|
746 int v1 = 0;
|
|
747 memset(v20, 0, 32);
|
|
748 do
|
|
749 {
|
|
750 v8 = 0;
|
|
751 do
|
|
752 {
|
|
753 v9 = rand() % 32;
|
|
754 if ( !v20[v9] )
|
|
755 break;
|
|
756 ++v8;
|
|
757 }
|
|
758 while ( v8 < 10 );
|
|
759 if ( v8 == 10 )
|
|
760 {
|
|
761 v9 = 0;
|
|
762 if ( v20[0] )
|
|
763 {
|
|
764 do
|
|
765 ++v9;
|
|
766 while ( v20[v9] );
|
|
767 }
|
|
768 }
|
|
769 pParty->field_854[v1++] = v9;
|
|
770 v20[v9] = 1;
|
|
771 }
|
|
772 while ( (signed int)v1 < 32 );
|
|
773 //v10 = (char *)&pParty->pPlayers[0].sResMagicBase;
|
|
774
|
|
775 item.Reset();
|
|
776 //for ( pPlayer = &pParty->pPlayers[0]; pPlayer < &pParty->pPlayers[4]; pPlayer++)
|
|
777 for (uint i = 0; i < 4; ++i)
|
|
778 {
|
|
779 auto player = &pParty->pPlayers[i];
|
|
780 //v11 = pPlayer;
|
|
781 if (player->classType == PLAYER_CLASS_KNIGHT)
|
|
782 player->sResMagicBase = 10;
|
|
783 //*((short *)v10 + 400) = 0;
|
|
784 player->pPlayerBuffs[22].uExpireTime = 0;
|
|
785 for (uint j = 0; j < 9; j++)
|
|
786 {
|
|
787 if (player->pActiveSkills[PLAYER_SKILL_FIRE + j])
|
|
788 {
|
|
789 player->lastOpenedSpellbookPage = j;
|
|
790 break;
|
|
791 }
|
|
792 }
|
|
793 pItemsTable->GenerateItem(2, 40, &item);
|
|
794 player->AddItem2(-1, &item);
|
|
795 //uSkillIdx = 0;
|
|
796 //v24.y = 0;
|
|
797
|
|
798 player->sHealth = player->GetMaxHealth();
|
|
799 player->sMana = player->GetMaxMana();
|
|
800 for (uint j = 0; j < 37; ++j)
|
|
801 {
|
|
802 if (!player->pActiveSkills[j])
|
|
803 continue;
|
|
804
|
|
805 switch (j)
|
|
806 {
|
|
807 case PLAYER_SKILL_STAFF: player->AddItem(-1, 61); break;
|
|
808 case PLAYER_SKILL_SWORD: player->AddItem(-1, 1); break;
|
|
809 case PLAYER_SKILL_DAGGER: player->AddItem(-1, 15); break;
|
|
810 case PLAYER_SKILL_AXE: player->AddItem(-1, 23); break;
|
|
811 case PLAYER_SKILL_SPEAR: player->AddItem(-1, 31); break;
|
|
812 case PLAYER_SKILL_BOW: player->AddItem(-1, 47); break;
|
|
813 case PLAYER_SKILL_MACE: player->AddItem(-1, 50); break;
|
|
814 case PLAYER_SKILL_BLASTER: assert(false); break;
|
|
815 case PLAYER_SKILL_SHIELD: player->AddItem(-1, 84); break;
|
|
816 case PLAYER_SKILL_LEATHER: player->AddItem(-1, 66); break;
|
|
817 case PLAYER_SKILL_CHAIN: player->AddItem(-1, 71); break;
|
|
818 case PLAYER_SKILL_PLATE: player->AddItem(-1, 76); break;
|
|
819 case PLAYER_SKILL_FIRE:
|
|
820 player->AddItem(-1, 0x191);
|
|
821 player->spellbook.pFireSpellbook.bIsSpellAvailable[0] = true;
|
|
822 break;
|
|
823 case PLAYER_SKILL_AIR:
|
|
824 player->AddItem(-1, 0x19C);
|
|
825 player->spellbook.pAirSpellbook.bIsSpellAvailable[0] = true;
|
|
826 break;
|
|
827 case PLAYER_SKILL_WATER:
|
|
828 player->AddItem(-1, 0x1A7);
|
|
829 player->spellbook.pWaterSpellbook.bIsSpellAvailable[0] = true;
|
|
830 break;
|
|
831 case PLAYER_SKILL_EARTH:
|
|
832 player->AddItem(-1, 0x1B2);
|
|
833 player->spellbook.pEarthSpellbook.bIsSpellAvailable[0] = true;
|
|
834 break;
|
|
835 case PLAYER_SKILL_SPIRIT:
|
|
836 player->AddItem(-1, 0x1BD);
|
|
837 player->spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true;
|
|
838 break;
|
|
839 case PLAYER_SKILL_MIND:
|
|
840 player->AddItem(-1, 0x1C8);
|
|
841 player->spellbook.pMindSpellbook.bIsSpellAvailable[0] = true;
|
|
842 break;
|
|
843 case PLAYER_SKILL_BODY:
|
|
844 player->AddItem(-1, 0x1D3);
|
|
845 player->spellbook.pBodySpellbook.bIsSpellAvailable[0] = true;
|
|
846 break;
|
|
847 case PLAYER_SKILL_LIGHT:
|
|
848 case PLAYER_SKILL_DARK:
|
|
849 case PLAYER_SKILL_DIPLOMACY:
|
|
850 assert(false);
|
|
851 break;
|
|
852 case PLAYER_SKILL_ITEM_ID:
|
|
853 case PLAYER_SKILL_REPAIR:
|
|
854 case PLAYER_SKILL_MEDITATION:
|
|
855 case PLAYER_SKILL_PERCEPTION:
|
|
856 case PLAYER_SKILL_TRAP_DISARM:
|
|
857 case PLAYER_SKILL_LEARNING:
|
|
858 player->AddItem(-1, 0xDC);
|
|
859 player->AddItem(-1, 5 * (rand() % 3 + 40));
|
|
860 break;
|
|
861 case PLAYER_SKILL_DODGE: player->AddItem(-1, 115); break;
|
|
862 case PLAYER_SKILL_UNARMED: player->AddItem(-1, 110); break;
|
|
863 default:
|
|
864 break;
|
|
865 }
|
|
866
|
|
867 for (uint k = 0; k < 138; k++)
|
|
868 {
|
|
869 if (player->pOwnItems[k].uItemID)
|
|
870 player->pOwnItems[k].SetIdentified();
|
|
871 }
|
|
872 }
|
|
873 }
|
|
874
|
|
875 pAudioPlayer->StopChannels(-1, -1);
|
|
876 return v26;
|
|
877 } |