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