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