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