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