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