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