comparison UIPartyCreation.cpp @ 706:d6236f6a9882

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