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