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