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