Mercurial > mm7
annotate mm7_5.cpp @ 1702:5cbd88f8a2eb
fixing paperdoll bug
author | Grumpy7 |
---|---|
date | Sun, 22 Sep 2013 19:48:02 +0200 |
parents | 7d99124bccd8 |
children | 8251e59fd7c1 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4 |
1262 | 5 #include "Texture.h" |
6 #include "mm7_data.h" | |
1016 | 7 #include "VideoPlayer.h" |
8 #include "Sprites.h" | |
9 #include "MapInfo.h" | |
10 #include "BSPModel.h" | |
11 #include "LightmapBuilder.h" | |
12 #include "DecalBuilder.h" | |
13 #include "Mouse.h" | |
14 #include "Keyboard.h" | |
15 #include "GammaControl.h" | |
1263 | 16 #include "mm7_data.h" |
17 #include "FactionTable.h" | |
1016 | 18 #include "Vis.h" |
0 | 19 #include "mm7.h" |
20 #include "Game.h" | |
21 #include "GUIWindow.h" | |
22 #include "GUIFont.h" | |
23 #include "GUIProgressBar.h" | |
24 #include "Party.h" | |
25 #include "AudioPlayer.h" | |
26 #include "Outdoor.h" | |
27 #include "Arcomage.h" | |
28 #include "LOD.h" | |
29 #include "Actor.h" | |
30 #include "Events.h" | |
31 #include "Viewport.h" | |
32 #include "FrameTableInc.h" | |
33 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
34 #include "SpriteObject.h" |
0 | 35 #include "ObjectList.h" |
36 #include "Chest.h" | |
37 #include "PaletteManager.h" | |
38 #include "SaveLoad.h" | |
39 #include "Time.h" | |
40 #include "TurnEngine.h" | |
924 | 41 #include "CastSpellInfo.h" |
0 | 42 #include "stru298.h" |
43 #include "Events2D.h" | |
189 | 44 #include "texts.h" |
0 | 45 #include "Log.h" |
1299 | 46 #include "UI\UIHouses.h" |
1262 | 47 #include "Lights.h" |
48 #include "Lights.h" | |
0 | 49 |
50 //----- (004304E7) -------------------------------------------------------- | |
1458 | 51 void GameUI_MsgProc() |
0 | 52 { |
978 | 53 //signed int v0; // edi@6 |
1025 | 54 //char *v1; // esi@6 |
0 | 55 unsigned int v2; // edx@7 |
56 Actor *pActor; // ecx@13 | |
57 int v4; // ecx@18 | |
199 | 58 //NPCData *pNPCData0; // eax@18 |
59 //int v6; // edx@20 | |
60 //int v7; // ecx@29 | |
916 | 61 //unsigned int v8; // edx@59 |
62 //unsigned int v9; // ecx@60 | |
0 | 63 unsigned int v10; // ecx@73 |
437 | 64 //unsigned int v11; // eax@75 |
0 | 65 unsigned __int8 v12; // sf@75 |
66 unsigned __int8 v13; // of@75 | |
67 int v14; // eax@98 | |
68 unsigned int v15; // eax@102 | |
69 unsigned __int8 v16; // al@104 | |
70 unsigned __int8 v17; // al@105 | |
71 int v18; // eax@106 | |
72 float v19; // ST64_4@121 | |
73 unsigned int v20; // ecx@121 | |
74 float v21; // ST64_4@126 | |
75 float v22; // ST64_4@127 | |
76 unsigned int v23; // ecx@135 | |
77 unsigned int v24; // ecx@149 | |
78 unsigned int v25; // ecx@165 | |
79 GUIWindow *pWindow; // eax@204 | |
80 unsigned int v27; // edx@204 | |
81 unsigned int v28; // ecx@204 | |
82 GUIWindow *pWindow2; // ecx@248 | |
978 | 83 //int v30; // edx@258 |
84 //const char *v31; // ecx@262 | |
0 | 85 signed int v32; // eax@269 |
86 unsigned int v33; // eax@277 | |
87 unsigned __int8 v34; // al@279 | |
88 unsigned __int8 v35; // al@280 | |
1000 | 89 //GUIWindow *pWindow3; // ecx@332 |
0 | 90 int v37; // eax@341 |
91 int v38; // eax@358 | |
92 SHORT v39; // ax@365 | |
910 | 93 //signed int v40; // eax@365 |
0 | 94 char *v41; // eax@380 |
95 int v42; // eax@396 | |
96 POINT *pPoint; // eax@397 | |
97 signed int v44; // eax@398 | |
98 int v45; // edx@398 | |
99 signed int v46; // ecx@398 | |
100 char v47; // zf@399 | |
101 char v48; // zf@405 | |
102 BLVFace *pBLVFace; // ecx@410 | |
103 ODMFace *pODMFace; // ecx@412 | |
1000 | 104 CastSpellInfo *pSpellInfo; // ecx@415 |
0 | 105 void *v52; // eax@424 |
106 __int16 v53; // ax@431 | |
107 int v54; // eax@432 | |
108 int v55; // ecx@432 | |
109 int v56; // edx@432 | |
110 int v57; // eax@432 | |
111 Player *pPlayer; // edx@442 | |
1430 | 112 unsigned int pMapNum; // eax@445 |
0 | 113 signed int v60; // ST64_4@459 |
1430 | 114 //NPCData *pNPCData2; // eax@467 |
115 //unsigned __int64 v62; // kr00_8@467 | |
0 | 116 __int16 v63; // dx@479 |
117 unsigned int v64; // eax@486 | |
118 int v65; // ecx@486 | |
119 int v66; // eax@488 | |
120 char *v67; // eax@489 | |
121 __int16 v68; // dx@498 | |
122 char *v69; // eax@512 | |
123 int v70; // eax@525 | |
124 int v71; // edi@527 | |
125 NPCData *pNPCData3; // esi@527 | |
126 char *v73; // ecx@533 | |
127 signed int v74; // edi@535 | |
128 int v75; // eax@535 | |
129 int v76; // esi@535 | |
130 int v77; // eax@537 | |
131 Player *pPlayer2; // ecx@549 | |
916 | 132 //int v79; // ecx@550 |
133 //unsigned int v80; // edx@550 | |
0 | 134 signed int v81; // eax@552 |
135 POINT *pPoint2; // eax@553 | |
136 signed int v83; // ecx@554 | |
137 signed int v84; // ecx@554 | |
138 GUIButton *pButton; // eax@578 | |
139 unsigned int v86; // eax@583 | |
140 const char *v87; // ecx@595 | |
141 const char *v88; // ecx@596 | |
916 | 142 //unsigned int v89; // eax@598 |
0 | 143 unsigned int v90; // eax@602 |
144 int v91; // edx@605 | |
145 int v92; // eax@605 | |
146 int v93; // edx@605 | |
147 int pPlayerNum; // edx@611 | |
148 int v95; // eax@611 | |
916 | 149 //const char *v96; // ecx@621 |
0 | 150 unsigned int v97; // eax@624 |
151 int v98; // eax@636 | |
152 unsigned __int8 v99; // al@643 | |
153 Player *pPlayer3; // eax@648 | |
154 int v101; // ecx@648 | |
155 int v102; // edx@652 | |
156 int v103; // eax@671 | |
157 Player *pPlayer4; // ecx@718 | |
158 int v105; // eax@718 | |
159 Player *pPlayer5; // ST78_4@758 | |
160 unsigned int v107; // eax@758 | |
161 unsigned int v108; // eax@758 | |
162 unsigned int v115; // eax@764 | |
163 int v116; // eax@776 | |
164 POINT *pPoint3; // eax@777 | |
165 unsigned int v118; // eax@785 | |
166 unsigned int v119; // ecx@786 | |
167 unsigned int v120; // [sp-28h] [bp-624h]@86 | |
168 unsigned int v121; // [sp-28h] [bp-624h]@711 | |
169 unsigned int v122; // [sp-24h] [bp-620h]@86 | |
170 unsigned int v123; // [sp-24h] [bp-620h]@711 | |
171 unsigned int v124; // [sp-20h] [bp-61Ch]@86 | |
172 unsigned int v125; // [sp-20h] [bp-61Ch]@711 | |
173 unsigned int v126; // [sp-1Ch] [bp-618h]@86 | |
174 int v127; // [sp-1Ch] [bp-618h]@107 | |
175 unsigned int v128; // [sp-1Ch] [bp-618h]@711 | |
176 int v129; // [sp-18h] [bp-614h]@86 | |
916 | 177 //signed int v130; // [sp-18h] [bp-614h]@107 |
0 | 178 int v131; // [sp-14h] [bp-610h]@86 |
916 | 179 //unsigned int v132; // [sp-14h] [bp-610h]@107 |
180 //unsigned int v133; // [sp-10h] [bp-60Ch]@60 | |
0 | 181 unsigned int v134; // [sp-10h] [bp-60Ch]@86 |
916 | 182 //signed int v135; // [sp-10h] [bp-60Ch]@107 |
0 | 183 unsigned int v136; // [sp-10h] [bp-60Ch]@121 |
916 | 184 //unsigned int v137; // [sp-Ch] [bp-608h]@60 |
0 | 185 unsigned int v138; // [sp-Ch] [bp-608h]@86 |
916 | 186 //signed int v139; // [sp-Ch] [bp-608h]@107 |
0 | 187 unsigned int v140; // [sp-Ch] [bp-608h]@121 |
188 enum WindowType pWindowType; // [sp-8h] [bp-604h]@56 | |
916 | 189 //enum WindowType pWindowType1; // [sp-8h] [bp-604h]@60 |
0 | 190 unsigned __int8 v143; // [sp-8h] [bp-604h]@86 |
916 | 191 //int v144; // [sp-8h] [bp-604h]@107 |
0 | 192 enum WindowType pWindowType2; // [sp-8h] [bp-604h]@121 |
916 | 193 //const char *v146; // [sp-8h] [bp-604h]@449 |
194 //unsigned int v147; // [sp-8h] [bp-604h]@550 | |
710 | 195 //int v148; // [sp-4h] [bp-600h]@56 |
0 | 196 GUIButton *pButton2; // [sp-4h] [bp-600h]@59 |
197 const char *v150; // [sp-4h] [bp-600h]@86 | |
916 | 198 //unsigned int v151; // [sp-4h] [bp-600h]@107 |
0 | 199 int v152; // [sp-4h] [bp-600h]@121 |
200 int v153; // [sp-4h] [bp-600h]@135 | |
961 | 201 //int v154; // [sp-4h] [bp-600h]@149 |
0 | 202 int v155; // [sp-4h] [bp-600h]@165 |
203 int v156; // [sp-4h] [bp-600h]@204 | |
916 | 204 //const char *v157; // [sp-4h] [bp-600h]@444 |
1430 | 205 //unsigned int v158; // [sp-4h] [bp-600h]@449 |
916 | 206 //__int16 v159; // [sp-4h] [bp-600h]@550 |
0 | 207 int v160; // [sp-4h] [bp-600h]@599 |
208 const char *v161; // [sp-4h] [bp-600h]@637 | |
710 | 209 //int v162; // [sp+0h] [bp-5FCh]@56 |
916 | 210 //int v163; // [sp+0h] [bp-5FCh]@59 |
0 | 211 Texture *pTexture; // [sp+0h] [bp-5FCh]@86 |
916 | 212 //int v165; // [sp+0h] [bp-5FCh]@107 |
0 | 213 int v166; // [sp+0h] [bp-5FCh]@121 |
214 int v167; // [sp+0h] [bp-5FCh]@135 | |
978 | 215 //int v168; // [sp+0h] [bp-5FCh]@149 |
0 | 216 int v169; // [sp+0h] [bp-5FCh]@165 |
217 int v170; // [sp+0h] [bp-5FCh]@204 | |
978 | 218 //signed int v171; // [sp+0h] [bp-5FCh]@259 |
0 | 219 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287 |
220 char *v173; // [sp+0h] [bp-5FCh]@444 | |
221 char *v174; // [sp+0h] [bp-5FCh]@449 | |
916 | 222 //int v175; // [sp+0h] [bp-5FCh]@550 |
0 | 223 int v176; // [sp+0h] [bp-5FCh]@599 |
224 const char *v177; // [sp+0h] [bp-5FCh]@629 | |
225 char *v178; // [sp+0h] [bp-5FCh]@637 | |
226 int v179; // [sp+4h] [bp-5F8h]@0 | |
199 | 227 //signed int _this; // [sp+14h] [bp-5E8h]@22 |
0 | 228 signed int thisa; // [sp+14h] [bp-5E8h]@251 |
229 signed int thisb; // [sp+14h] [bp-5E8h]@272 | |
230 Player *pPlayer7; // [sp+14h] [bp-5E8h]@373 | |
231 Player *pPlayer8; // [sp+14h] [bp-5E8h]@377 | |
1430 | 232 char *pMapName; // [sp+14h] [bp-5E8h]@445 |
0 | 233 Player *pPlayer9; // [sp+14h] [bp-5E8h]@455 |
234 int thisg; // [sp+14h] [bp-5E8h]@467 | |
235 int thish; // [sp+14h] [bp-5E8h]@528 | |
236 signed int thisi; // [sp+14h] [bp-5E8h]@535 | |
237 MapInfo *pMapInfo; // [sp+14h] [bp-5E8h]@604 | |
238 Player *pPlayer10; // [sp+14h] [bp-5E8h]@641 | |
239 int thisl; // [sp+14h] [bp-5E8h]@648 | |
240 int uMessageParam; // [sp+18h] [bp-5E4h]@7 | |
241 int uAction; // [sp+1Ch] [bp-5E0h]@18 | |
242 NPCData *pNPCData4; // [sp+20h] [bp-5DCh]@23 | |
243 unsigned int uNumSeconds; // [sp+24h] [bp-5D8h]@18 | |
244 char v197; // [sp+2Bh] [bp-5D1h]@101 | |
245 enum UIMessageType uMessage; // [sp+2Ch] [bp-5D0h]@7 | |
246 unsigned int v199; // [sp+30h] [bp-5CCh]@7 | |
247 char *v200; // [sp+34h] [bp-5C8h]@518 | |
248 POINT v201; // [sp+38h] [bp-5C4h]@553 | |
249 POINT v202; // [sp+40h] [bp-5BCh]@141 | |
250 POINT a2; // [sp+48h] [bp-5B4h]@127 | |
251 POINT v204; // [sp+50h] [bp-5ACh]@777 | |
252 POINT v205; // [sp+58h] [bp-5A4h]@171 | |
253 POINT v206; // [sp+60h] [bp-59Ch]@553 | |
254 POINT v207; // [sp+68h] [bp-594h]@155 | |
255 POINT v208; // [sp+70h] [bp-58Ch]@397 | |
256 POINT v209; // [sp+78h] [bp-584h]@777 | |
257 POINT v210; // [sp+80h] [bp-57Ch]@397 | |
258 POINT v211; // [sp+88h] [bp-574h]@704 | |
1430 | 259 //__int64 v212; // [sp+90h] [bp-56Ch]@467 |
783 | 260 int v213; // [sp+98h] [bp-564h]@385 |
261 char pLevelName[32]; // [sp+9Ch] [bp-560h]@380 | |
262 char pOut[32]; // [sp+BCh] [bp-540h]@370 | |
0 | 263 FrameTableTxtLine v216; // [sp+DCh] [bp-520h]@524 |
264 int v217[9]; // [sp+158h] [bp-4A4h]@652 | |
265 FrameTableTxtLine v218; // [sp+17Ch] [bp-480h]@524 | |
266 char a1[64]; // [sp+1F8h] [bp-404h]@467 | |
267 char Str2[128]; // [sp+238h] [bp-3C4h]@527 | |
268 Actor actor; // [sp+2B8h] [bp-344h]@4 | |
269 | |
270 dword_50CDC8 = 0; | |
271 if ( !pEventTimer->bPaused ) | |
272 { | |
273 pParty->sEyelevel = pParty->uDefaultEyelevel; | |
274 pParty->uPartyHeight = pParty->uDefaultPartyHeight; | |
275 } | |
276 if ( bDialogueUI_InitializeActor_NPC_ID ) | |
277 { | |
278 //Actor::Actor(&actor); | |
279 memset(&actor, 0, 0x344u); | |
280 dword_5B65D0_dialogue_actor_npc_id = bDialogueUI_InitializeActor_NPC_ID; | |
602 | 281 actor.sNPC_ID = bDialogueUI_InitializeActor_NPC_ID; |
1033 | 282 GameUI_InitializeDialogue(&actor, false); |
0 | 283 bDialogueUI_InitializeActor_NPC_ID = 0; |
284 } | |
285 if ( pMessageQueue_50CBD0->uNumMessages ) | |
286 { | |
1025 | 287 //v1 = ""; |
0 | 288 while ( 2 ) |
289 { | |
290 if ( !pMessageQueue_50CBD0->uNumMessages ) | |
291 break; | |
292 | |
293 pMessageQueue_50CBD0->PopMessage(&uMessage, &uMessageParam, (int *)&v199); | |
294 switch ( uMessage ) | |
295 { | |
296 case UIMSG_ChangeGameState: | |
978 | 297 uGameState = GAME_FINISHED; |
4 | 298 continue; |
0 | 299 case UIMSG_PlayArcomage: |
300 pVideoPlayer->_4BF5B2(); | |
301 pArcomageGame->bGameInProgress = 1; | |
302 PrepareArcomage(); | |
4 | 303 continue; |
0 | 304 case UIMSG_StartNPCDialogue: |
305 if ( !uActiveCharacter ) | |
4 | 306 continue; |
978 | 307 viewparams->field_48 = 1; |
0 | 308 if ( pMessageQueue_50CBD0->uNumMessages ) |
309 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
602 | 310 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID; |
0 | 311 pActor = &pActors[uMessageParam]; |
4 | 312 //goto _actor_init_dlg; |
1033 | 313 GameUI_InitializeDialogue(pActor, true); |
4 | 314 continue; |
199 | 315 case UIMSG_StartHireling1Dialogue: |
316 case UIMSG_StartHireling2Dialogue: | |
317 { | |
318 if (bNoNPCHiring || pCurrentScreen) | |
319 continue; | |
320 | |
0 | 321 if ( pMessageQueue_50CBD0->uNumMessages ) |
322 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
323 uAction = 0; | |
201 | 324 int hireling_idx = uMessage - UIMSG_StartHireling1Dialogue; |
0 | 325 v4 = 0; |
199 | 326 |
327 for (uint i = 0; i < 2; ++i) | |
328 //pNPCData0 = pParty->pHirelings; | |
329 //do | |
330 { | |
331 if (pParty->pHirelings[i].pName) | |
332 //{ | |
333 //v6 = uAction++; | |
334 pTmpBuf[uAction++] = i; | |
335 //} | |
336 //++pNPCData0; | |
337 //++v4; | |
338 } | |
339 //while ( (signed int)pNPCData0 < (signed int)&pParty->pPickedItem ); | |
340 | |
341 //_this = 0; | |
342 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
343 { | |
344 auto npc = pNPCStats->pNewNPCData + i; | |
345 //do | |
346 //{ | |
248 | 347 if (npc->Hired() && |
199 | 348 (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)) && |
349 (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) ) | |
0 | 350 { |
199 | 351 //v7 =; |
352 pTmpBuf[uAction++] = i + 2; | |
0 | 353 } |
199 | 354 //++_this; |
355 //++pNPCData4; | |
356 //} | |
357 //while ( _this < (signed int)pNPCStats->uNumNewNPCs ); | |
0 | 358 } |
201 | 359 |
360 if ( (signed int)(hireling_idx + (unsigned __int8)pParty->field_709) < uAction ) | |
0 | 361 { |
362 //Actor::Actor(&actor); | |
363 memset(&actor, 0, 0x344u); | |
602 | 364 actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx; |
0 | 365 pActor = &actor; |
1033 | 366 GameUI_InitializeDialogue(&actor, true); |
0 | 367 } |
368 } | |
4 | 369 continue; |
735 | 370 |
371 case UIMSG_BuyInShop_Identify_Repair: | |
372 UIShop_Buy_Identify_Repair(); | |
373 continue; | |
467 | 374 case UIMSG_ClickNPCTopic: |
375 ClickNPCTopic(uMessageParam); | |
376 continue; | |
651 | 377 case UIMSG_SelectShopDialogueOption: |
378 OnSelectShopDialogueOption(uMessageParam); | |
379 continue; | |
380 case UIMSG_SelectNPCDialogueOption: | |
381 OnSelectNPCDialogueOption((DIALOGUE_TYPE)uMessageParam); | |
4 | 382 continue; |
961 | 383 case UIMSG_ClickHouseNPCPortrait: |
0 | 384 _4B4224_UpdateNPCTopics(uMessageParam); |
4 | 385 continue; |
0 | 386 case UIMSG_StartNewGame: |
387 if ( dword_6BE138 == 124 || uMessageParam ) | |
388 { | |
1006 | 389 pIcons_LOD->SyncLoadedFilesCount(); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
390 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 391 if ( pMessageQueue_50CBD0->uNumMessages ) |
392 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
393 pGUIWindow_CurrentMenu->Release(); | |
978 | 394 uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU; |
151 | 395 pCurrentScreen = SCREEN_GAME; |
978 | 396 viewparams->bRedrawGameUI = 1; |
0 | 397 } |
398 else | |
399 { | |
400 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2u);// "Are you sure? Click again to start a New Game" | |
401 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); | |
402 dword_6BE138 = 124; | |
403 } | |
404 stru_506E40.Release(); | |
4 | 405 continue; |
0 | 406 case UIMSG_Game_OpenLoadGameDialog: |
1006 | 407 pIcons_LOD->SyncLoadedFilesCount(); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
408 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 409 if ( pMessageQueue_50CBD0->uNumMessages ) |
410 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
411 pGUIWindow_CurrentMenu->Release(); | |
151 | 412 pCurrentScreen = SCREEN_LOADGAME; |
1033 | 413 LoadUI_Load(1); |
4 | 414 continue; |
0 | 415 case UIMSG_Quit: |
416 if ( dword_6BE138 == 132 || uMessageParam ) | |
417 { | |
1006 | 418 pIcons_LOD->SyncLoadedFilesCount(); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
419 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 420 if ( pMessageQueue_50CBD0->uNumMessages ) |
421 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
422 pGUIWindow_CurrentMenu->Release(); | |
151 | 423 pCurrentScreen = SCREEN_GAME; |
978 | 424 viewparams->bRedrawGameUI = 1; |
0 | 425 if ( !uMessageParam ) |
426 pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0); | |
978 | 427 uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU; |
0 | 428 } |
429 else | |
430 { | |
369 | 431 ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit" |
0 | 432 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); |
433 dword_6BE138 = 132; | |
434 } | |
4 | 435 stru_506E40.Release(); |
436 continue; | |
151 | 437 case UIMSG_80: |
987 | 438 __debugbreak(); |
1006 | 439 pIcons_LOD->SyncLoadedFilesCount(); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
440 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 441 pGUIWindow_CurrentMenu->Release(); |
151 | 442 pCurrentScreen = SCREEN_OPTIONS; |
710 | 443 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_8, 0, 0); |
11 | 444 continue; |
2 | 445 case UIMSG_ArrowUp: |
446 --pSaveListPosition; | |
447 if ( pSaveListPosition < 0 ) | |
448 pSaveListPosition = 0; | |
962 | 449 GUIWindow::Create(215, 199, 17, 17, WINDOW_PressedButton2, (int)pBtnArrowUp, 0); |
11 | 450 continue; |
2 | 451 case UIMSG_DownArrow: |
452 ++pSaveListPosition; | |
453 if ( pSaveListPosition >= uMessageParam ) | |
454 pSaveListPosition = uMessageParam - 1; | |
962 | 455 GUIWindow::Create(215, 323, 17, 17, WINDOW_PressedButton2, (int)pBtnDownArrow, 0); |
11 | 456 continue; |
2 | 457 case UIMSG_Cancel: |
962 | 458 GUIWindow::Create(350, 302, 106, 42, WINDOW_CloseRestWindowBtn, (int)pBtnCancel, 0); |
11 | 459 continue; |
961 | 460 case UIMSG_SaveLoadBtn: |
461 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); | |
11 | 462 continue; |
3 | 463 case UIMSG_SelectLoadSlot: |
1038 | 464 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
465 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
151 | 466 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam ) |
2 | 467 { |
468 v10 = pSaveListPosition + uMessageParam; | |
469 if ( dword_6BE138 == pSaveListPosition + uMessageParam ) | |
0 | 470 { |
961 | 471 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); |
437 | 472 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); |
0 | 473 } |
474 uLoadGameUI_SelectedSlot = v10; | |
475 dword_6BE138 = v10; | |
476 } | |
477 else | |
478 { | |
3 | 479 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); |
43 | 480 if ( strcmp((const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pGlobalTXT_LocalizationStrings[72]) )// "Empty" |
481 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, (const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot]); | |
0 | 482 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); |
483 } | |
4 | 484 continue; |
0 | 485 case UIMSG_LoadGame: |
486 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) | |
487 { | |
488 LoadGame(uLoadGameUI_SelectedSlot); | |
1214
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1207
diff
changeset
|
489 uGameState = GAME_STATE_LOADING_GAME; |
0 | 490 } |
4 | 491 stru_506E40.Release(); |
492 continue; | |
0 | 493 case UIMSG_SaveGame: |
1038 | 494 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
495 { | |
496 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
837 | 497 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer); |
0 | 498 } |
499 DoSavegame(uLoadGameUI_SelectedSlot); | |
4 | 500 stru_506E40.Release(); |
501 continue; | |
151 | 502 case UIMSG_Game_OpenSaveGameDialog: |
0 | 503 pGUIWindow_CurrentMenu->Release(); |
151 | 504 pCurrentScreen = SCREEN_SAVEGAME; |
1033 | 505 SaveUI_Load(); |
4 | 506 continue; |
369 | 507 case UIMSG_Game_OpenOptionsDialog://Open |
0 | 508 if ( pMessageQueue_50CBD0->uNumMessages ) |
509 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
510 pGUIWindow_CurrentMenu->Release(); | |
978 | 511 viewparams->field_48 = 1; |
151 | 512 pCurrentScreen = SCREEN_OPTIONS; |
948 | 513 |
514 options_menu_skin.uTextureID_Background = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE); | |
515 options_menu_skin.uTextureID_TurnSpeed[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE); | |
516 options_menu_skin.uTextureID_TurnSpeed[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE); | |
517 options_menu_skin.uTextureID_TurnSpeed[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE); | |
518 options_menu_skin.uTextureID_ArrowLeft = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE); | |
519 options_menu_skin.uTextureID_ArrowRight = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE); | |
520 options_menu_skin.uTextureID_SoundLevels[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE); | |
521 options_menu_skin.uTextureID_SoundLevels[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE); | |
522 options_menu_skin.uTextureID_SoundLevels[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE); | |
523 options_menu_skin.uTextureID_SoundLevels[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE); | |
524 options_menu_skin.uTextureID_SoundLevels[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE); | |
525 options_menu_skin.uTextureID_SoundLevels[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE); | |
526 options_menu_skin.uTextureID_SoundLevels[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE); | |
527 options_menu_skin.uTextureID_SoundLevels[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE); | |
528 options_menu_skin.uTextureID_SoundLevels[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE); | |
529 options_menu_skin.uTextureID_SoundLevels[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); | |
530 options_menu_skin.uTextureID_FlipOnExit = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE); | |
531 options_menu_skin.uTextureID_AlwaysRun = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE); | |
532 options_menu_skin.uTextureID_ShowDamage = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE); | |
533 options_menu_skin.uTextureID_WalkSound = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE); | |
534 | |
0 | 535 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0); |
832 | 536 pGUIWindow_CurrentMenu->CreateButton(22, 270, |
948 | 537 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth, |
538 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight, | |
1025 | 539 1, 0, UIMSG_SetTurnSpeed, 0x80, 0, "", 0); |
948 | 540 pGUIWindow_CurrentMenu->CreateButton(93, 270, |
541 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth, | |
542 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight, | |
1025 | 543 1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, "", 0); |
948 | 544 pGUIWindow_CurrentMenu->CreateButton(164, 270, |
545 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth, | |
546 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight, | |
1025 | 547 1, 0, UIMSG_SetTurnSpeed, 0, 0, "", 0); |
948 | 548 |
549 pGUIWindow_CurrentMenu->CreateButton(20, 303, | |
550 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth, | |
551 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight, | |
1025 | 552 1, 0, UIMSG_ToggleWalkSound, 0, 0, "", 0); |
948 | 553 pGUIWindow_CurrentMenu->CreateButton(128, 303, |
554 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth, | |
555 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight, | |
1025 | 556 1, 0, UIMSG_ToggleShowDamage, 0, 0, "", 0); |
948 | 557 pGUIWindow_CurrentMenu->CreateButton(20, 325, |
558 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth, | |
559 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight, | |
1025 | 560 1, 0, UIMSG_ToggleAlwaysRun, 0, 0, "", 0); |
948 | 561 pGUIWindow_CurrentMenu->CreateButton(128, 325, |
562 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth, | |
563 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight, | |
1025 | 564 1, 0, UIMSG_ToggleFlipOnExit, 0, 0, "", 0); |
565 | |
566 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
567 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
568 pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, "", 0); | |
569 | |
570 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
571 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
572 pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, "", 0); | |
573 | |
574 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
575 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
576 pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, "", 0); | |
978 | 577 |
578 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game" | |
1025 | 579 pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, "", 0); |
580 pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, "", 0); | |
948 | 581 continue; |
582 | |
369 | 583 case UIMSG_OpenKeyMappingOptions://Open |
0 | 584 if ( pMessageQueue_50CBD0->uNumMessages ) |
585 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
586 pGUIWindow_CurrentMenu->Release(); | |
587 viewparams->field_48 = 1; | |
151 | 588 pCurrentScreen = SCREEN_KEYBOARD_OPTIONS; |
369 | 589 uTextureID_Optkb[0] = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE); |
590 uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE); | |
591 uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); | |
592 uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE); | |
593 uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE); | |
0 | 594 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_KeyMappingOptions, 0, 0); |
832 | 595 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0); |
596 pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0); | |
597 pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0); | |
598 pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0); | |
599 pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0); | |
600 pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0); | |
601 pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 1u, 0, "", 0); | |
602 pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 2u, 0, "", 0); | |
603 pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 3u, 0, "", 0); | |
604 pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, UIMSG_ChangeKeyButton, 4u, 0, "", 0); | |
605 pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 5u, 0, "", 0); | |
606 pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 6u, 0, "", 0); | |
607 pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 7u, 0, "", 0); | |
608 pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 8u, 0, "", 0); | |
609 pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0); | |
610 pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0); | |
611 pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0); | |
612 pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0); | |
613 pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0); | |
1031 | 614 uGameMenuUI_CurentlySelectedKeyIdx = -1; |
362 | 615 KeyboardPageNum = 1; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
616 memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); |
369 | 617 //*(_WORD *)KeyButtonArray[28] = 0; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
618 memcpy(pPrevVirtualCidesMapping.data(), pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); |
1025 | 619 //v1 = ""; |
978 | 620 //v0 = 1; |
11 | 621 continue; |
362 | 622 case UIMSG_ChangeKeyButton: |
1031 | 623 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 ) |
362 | 624 { |
625 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
626 continue; | |
627 } | |
0 | 628 v14 = uMessageParam; |
978 | 629 if ( KeyboardPageNum != 1 ) |
0 | 630 v14 = uMessageParam + 14; |
1031 | 631 uGameMenuUI_CurentlySelectedKeyIdx = v14; |
978 | 632 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu); |
4 | 633 continue; |
0 | 634 case UIMSG_ResetKeyMapping: |
635 v197 = 1; | |
636 pKeyActionMap->SetDefaultMapping(); | |
637 uAction = 0; | |
638 do | |
639 { | |
640 v15 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
641 if ( v15 != pPrevVirtualCidesMapping[uAction] ) | |
642 { | |
643 if ( v197 ) | |
644 { | |
645 v16 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
978 | 646 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v16, 1); |
0 | 647 v197 = 0; |
648 } | |
649 else | |
650 { | |
651 v17 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
652 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v17, 0); | |
653 } | |
654 } | |
655 pPrevVirtualCidesMapping[uAction] = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
656 v18 = uAction++; | |
4 | 657 v13 = uAction > 28; |
0 | 658 v12 = uAction - 28 < 0; |
1031 | 659 GameMenuUI_InvaligKeyBindingsFlags[v18] = 0; |
0 | 660 } |
661 while ( v12 ^ v13 ); | |
369 | 662 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
663 continue; | |
362 | 664 case UIMSG_SelectKeyPage1: |
978 | 665 KeyboardPageNum = 1; |
362 | 666 continue; |
667 case UIMSG_SelectKeyPage2: | |
668 KeyboardPageNum = 2; | |
4 | 669 continue; |
0 | 670 case UIMSG_OpenVideoOptions: |
671 if ( pMessageQueue_50CBD0->uNumMessages ) | |
672 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
673 pGUIWindow_CurrentMenu->Release(); | |
978 | 674 viewparams->field_48 = 1; |
151 | 675 pCurrentScreen = SCREEN_VIDEO_OPTIONS; |
1676
483cc7f0d86c
GameMenuUI_DrawKeyBindings() and GameMenuUI_DrawVideoOptions() cleared
Ritor1
parents:
1643
diff
changeset
|
676 optvid_base_texture_id = pIcons_LOD->LoadTexture("optvid", TEXTURE_16BIT_PALETTE); |
483cc7f0d86c
GameMenuUI_DrawKeyBindings() and GameMenuUI_DrawVideoOptions() cleared
Ritor1
parents:
1643
diff
changeset
|
677 bloodsplats_texture_id = pIcons_LOD->LoadTexture("opvdH-bs", TEXTURE_16BIT_PALETTE); |
483cc7f0d86c
GameMenuUI_DrawKeyBindings() and GameMenuUI_DrawVideoOptions() cleared
Ritor1
parents:
1643
diff
changeset
|
678 us_colored_lights_texture_id = pIcons_LOD->LoadTexture("opvdH-cl", TEXTURE_16BIT_PALETTE); |
483cc7f0d86c
GameMenuUI_DrawKeyBindings() and GameMenuUI_DrawVideoOptions() cleared
Ritor1
parents:
1643
diff
changeset
|
679 tinting_texture_id = pIcons_LOD->LoadTexture("opvdH-tn", TEXTURE_16BIT_PALETTE); |
0 | 680 uTextureID_507C20 = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE); |
681 uTextureID_507C24 = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE); | |
682 pTextureIDs_GammaPositions[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE); | |
683 pTextureIDs_GammaPositions[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE); | |
684 pTextureIDs_GammaPositions[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE); | |
685 pTextureIDs_GammaPositions[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE); | |
686 pTextureIDs_GammaPositions[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE); | |
687 pTextureIDs_GammaPositions[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE); | |
688 pTextureIDs_GammaPositions[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE); | |
689 pTextureIDs_GammaPositions[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE); | |
690 pTextureIDs_GammaPositions[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE); | |
691 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); | |
1676
483cc7f0d86c
GameMenuUI_DrawKeyBindings() and GameMenuUI_DrawVideoOptions() cleared
Ritor1
parents:
1643
diff
changeset
|
692 not_available_bloodsplats_texture_id = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE); |
483cc7f0d86c
GameMenuUI_DrawKeyBindings() and GameMenuUI_DrawVideoOptions() cleared
Ritor1
parents:
1643
diff
changeset
|
693 not_available_us_colored_lights_texture_id = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE); |
483cc7f0d86c
GameMenuUI_DrawKeyBindings() and GameMenuUI_DrawVideoOptions() cleared
Ritor1
parents:
1643
diff
changeset
|
694 not_available_tinting_texture_id = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE); |
0 | 695 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0); |
1025 | 696 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0); |
0 | 697 if ( pRenderer->pRenderD3D ) |
698 { | |
1025 | 699 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, "", 0); |
700 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, "", 0); | |
701 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, "", 0); | |
0 | 702 } |
703 if ( !pRenderer->bWindowMode ) | |
704 { | |
978 | 705 //v0 = 1; |
0 | 706 if ( GammaController::IsGammaSupported() ) |
707 { | |
1025 | 708 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C20), 0); |
709 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C24), 0); | |
710 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, "", 0); | |
0 | 711 } |
712 } | |
4 | 713 continue; |
151 | 714 case UIMSG_1A9: |
987 | 715 __debugbreak(); |
0 | 716 if ( uMessageParam == 4 ) |
717 { | |
151 | 718 //--uGammaPos; |
719 if ( (uGammaPos -- -1) < 0 ) | |
0 | 720 { |
721 uGammaPos = 0; | |
369 | 722 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
723 continue; | |
0 | 724 } |
725 v19 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
726 pGame->pGammaController->Initialize(v19); | |
1268 | 727 GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); |
369 | 728 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
729 continue; | |
0 | 730 } |
731 if ( uMessageParam == 5 ) | |
732 { | |
733 ++uGammaPos; | |
734 if ( (signed int)uGammaPos <= 9 ) | |
735 { | |
736 v21 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
737 pGame->pGammaController->Initialize(v21); | |
1268 | 738 GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); |
369 | 739 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
740 continue; | |
0 | 741 } |
742 uGammaPos = 9; | |
743 } | |
744 else | |
745 { | |
746 uGammaPos = (pMouse->GetCursorPos(&a2)->x - 42) / 17; | |
747 v22 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
748 pGame->pGammaController->Initialize(v22); | |
749 } | |
369 | 750 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
751 continue; | |
0 | 752 case UIMSG_ToggleBloodsplats: |
753 pGame->ToggleFlags2(0x20u); | |
4 | 754 continue; |
0 | 755 case UIMSG_ToggleColoredLights: |
756 pRenderer->bUseColoredLights = pRenderer->bUseColoredLights == 0; | |
4 | 757 continue; |
0 | 758 case UIMSG_ToggleTint: |
759 pRenderer->bTinting = pRenderer->bTinting == 0; | |
4 | 760 continue; |
0 | 761 case UIMSG_ChangeMusicVolume: |
762 if ( uMessageParam == 4 ) | |
763 { | |
764 --uMusicVolimeMultiplier; | |
765 if ( (char)uMusicVolimeMultiplier < 1 ) | |
766 uMusicVolimeMultiplier = 0; | |
1268 | 767 GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); |
4 | 768 if ( uMusicVolimeMultiplier ) |
328 | 769 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); |
770 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); | |
4 | 771 continue; |
0 | 772 } |
773 if ( uMessageParam == 5 ) | |
774 { | |
775 ++uMusicVolimeMultiplier; | |
776 if ( (char)uMusicVolimeMultiplier > 9 ) | |
777 uMusicVolimeMultiplier = 9; | |
1268 | 778 GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); |
4 | 779 if ( uMusicVolimeMultiplier ) |
328 | 780 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); |
781 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); | |
4 | 782 continue; |
0 | 783 } |
784 uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17; | |
785 if ( (char)uMusicVolimeMultiplier > 9 ) | |
786 uMusicVolimeMultiplier = 9; | |
787 if ( uMusicVolimeMultiplier ) | |
328 | 788 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); |
789 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
4 | 790 continue; |
0 | 791 case UIMSG_ChangeSoundVolume: |
369 | 792 if ( uMessageParam == 4 )//reduce sound level button left |
0 | 793 { |
794 --uSoundVolumeMultiplier; | |
795 if ( (char)uSoundVolumeMultiplier < 1 ) | |
796 uSoundVolumeMultiplier = 0; | |
1268 | 797 GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); |
328 | 798 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
799 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); | |
800 continue; | |
801 } | |
369 | 802 if ( uMessageParam == 5 )//Increase sound level button right |
0 | 803 { |
804 ++uSoundVolumeMultiplier; | |
805 if ( (char)uSoundVolumeMultiplier > 8 ) | |
806 uSoundVolumeMultiplier = 9; | |
978 | 807 //v168 = 1; |
0 | 808 v24 = 435; |
961 | 809 //v154 = (int)pBtn_SliderRight; |
1268 | 810 GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); |
328 | 811 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
369 | 812 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); |
813 continue; | |
0 | 814 } |
815 uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17; | |
816 if ( (char)uSoundVolumeMultiplier > 8 ) | |
817 uSoundVolumeMultiplier = 9; | |
328 | 818 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
369 | 819 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); |
820 continue; | |
0 | 821 case UIMSG_ToggleFlipOnExit: |
822 bFlipOnExit = bFlipOnExit == 0; | |
4 | 823 continue; |
0 | 824 case UIMSG_ToggleAlwaysRun: |
825 bAlwaysRun = bAlwaysRun == 0; | |
4 | 826 continue; |
0 | 827 case UIMSG_ToggleWalkSound: |
828 bWalkSound = bWalkSound == 0; | |
4 | 829 continue; |
0 | 830 case UIMSG_ToggleShowDamage: |
831 bShowDamage = bShowDamage == 0; | |
4 | 832 continue; |
0 | 833 case UIMSG_ChangeVoiceVolume: |
834 if ( uMessageParam == 4 ) | |
835 { | |
836 --uVoicesVolumeMultiplier; | |
837 if ( (char)uVoicesVolumeMultiplier < 1 ) | |
838 uVoicesVolumeMultiplier = 0; | |
1268 | 839 GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); |
4 | 840 if ( !uVoicesVolumeMultiplier ) |
841 continue; | |
369 | 842 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
843 continue; | |
0 | 844 } |
845 if ( uMessageParam == 5 ) | |
846 { | |
847 ++uVoicesVolumeMultiplier; | |
848 if ( (char)uVoicesVolumeMultiplier > 8 ) | |
849 uVoicesVolumeMultiplier = 9; | |
1268 | 850 GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); |
4 | 851 if ( !uVoicesVolumeMultiplier ) |
852 continue; | |
369 | 853 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
854 continue; | |
0 | 855 } |
856 uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17; | |
857 if ( (char)uVoicesVolumeMultiplier > 8 ) | |
858 uVoicesVolumeMultiplier = 9; | |
859 if ( !uVoicesVolumeMultiplier ) | |
4 | 860 continue; |
369 | 861 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
862 continue; | |
0 | 863 case UIMSG_SetTurnSpeed: |
864 if ( uMessageParam ) | |
865 pParty->sRotationY = uMessageParam * pParty->sRotationY / uMessageParam; | |
866 uTurnSpeed = uMessageParam; | |
4 | 867 continue; |
0 | 868 case UIMSG_SetGraphicsMode: |
869 if ( !bUseLoResSprites ) | |
870 { | |
871 byte_6BE388_graphicsmode = uMessageParam; | |
872 MM7Initialization(); | |
4 | 873 continue; |
0 | 874 } |
875 if ( uMessageParam ) | |
876 { | |
877 if ( uMessageParam == 1 ) | |
878 { | |
879 byte_6BE388_graphicsmode = 0; | |
880 } | |
881 else | |
882 { | |
883 if ( uMessageParam != 2 ) | |
4 | 884 continue; |
0 | 885 byte_6BE388_graphicsmode = 1; |
886 } | |
4 | 887 MM7Initialization(); |
888 continue; | |
0 | 889 } |
1458 | 890 ModalWindow(pNPCTopics[453].pText, UIMSG_0); |
4 | 891 continue; |
369 | 892 case UIMSG_GameMenu_ReturnToGame: |
0 | 893 pGUIWindow_CurrentMenu->Release(); |
894 pEventTimer->Resume(); | |
369 | 895 pCurrentScreen = SCREEN_GAME; |
978 | 896 viewparams->bRedrawGameUI = 1; |
369 | 897 stru_506E40.Release(); |
898 continue; | |
0 | 899 case UIMSG_OpenQuestBook: |
900 if ( pMessageQueue_50CBD0->uNumMessages ) | |
901 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
902 if ( pCurrentScreen ) | |
903 pGUIWindow_CurrentMenu->Release(); | |
904 pEventTimer->Pause(); | |
905 pAudioPlayer->StopChannels(-1, -1); | |
906 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); | |
960 | 907 pBooksWindow = GUIWindow::Create(493u, 355u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Quests, 0); |
0 | 908 bFlashQuestBook = 0; |
4 | 909 continue; |
0 | 910 case UIMSG_OpenAutonotes: |
911 if ( pMessageQueue_50CBD0->uNumMessages ) | |
912 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
913 if ( pCurrentScreen ) | |
914 pGUIWindow_CurrentMenu->Release(); | |
915 pEventTimer->Pause(); | |
916 pAudioPlayer->StopChannels(-1, -1); | |
917 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); | |
960 | 918 pBooksWindow = GUIWindow::Create(527u, 353u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Autonotes, 0); |
0 | 919 bFlashAutonotesBook = 0; |
4 | 920 continue; |
0 | 921 case UIMSG_OpenMapBook: |
922 if ( pMessageQueue_50CBD0->uNumMessages ) | |
923 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
924 if ( pCurrentScreen ) | |
925 pGUIWindow_CurrentMenu->Release(); | |
926 pEventTimer->Pause(); | |
693 | 927 viewparams->sViewCenterX = pParty->vPosition.x; |
928 viewparams->sViewCenterY = pParty->vPosition.y; | |
0 | 929 pAudioPlayer->StopChannels(-1, -1); |
960 | 930 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); |
931 pBooksWindow = GUIWindow::Create(546, 353, 0, 0, WINDOW_BooksWindow, (int)pBtn_Maps, 0); | |
4 | 932 continue; |
0 | 933 case UIMSG_OpenCalendar: |
934 if ( pMessageQueue_50CBD0->uNumMessages ) | |
935 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
936 if ( pCurrentScreen ) | |
937 pGUIWindow_CurrentMenu->Release(); | |
938 pEventTimer->Pause(); | |
939 pAudioPlayer->StopChannels(-1, -1); | |
369 | 940 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); |
960 | 941 pBooksWindow = GUIWindow::Create(570, 354, 0, 0, WINDOW_BooksWindow, (int)pBtn_Calendar, 0); |
4 | 942 continue; |
0 | 943 case UIMSG_OpenHistoryBook: |
944 if ( pMessageQueue_50CBD0->uNumMessages ) | |
945 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
946 if ( pCurrentScreen ) | |
947 pGUIWindow_CurrentMenu->Release(); | |
948 pEventTimer->Pause(); | |
949 pAudioPlayer->StopChannels(-1, -1); | |
950 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); | |
960 | 951 pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, WINDOW_BooksWindow, (int)pBtn_History, 0); |
0 | 952 bFlashHistoryBook = 0; |
4 | 953 continue; |
369 | 954 case UIMSG_Escape:// íàæàòèå Escape and return to game |
0 | 955 back_to_game(); |
956 if ( pMessageQueue_50CBD0->uNumMessages ) | |
957 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
990 | 958 switch ( pCurrentScreen ) |
959 { | |
960 case SCREEN_E: | |
961 __debugbreak(); | |
962 case SCREEN_NPC_DIALOGUE: | |
963 case SCREEN_CHEST: | |
964 case SCREEN_CHEST_INVENTORY: | |
965 case SCREEN_CHANGE_LOCATION: | |
966 case SCREEN_INPUT_BLV: | |
967 case SCREEN_QUICK_REFERENCE: | |
0 | 968 if ( dword_50CDC8 ) |
990 | 969 break; |
11 | 970 CloseWindowBackground(); |
978 | 971 uMessageParam = 1; |
990 | 972 break; |
973 case SCREEN_HOUSE: | |
974 if ( !dword_50CDC8 && !dword_5C35C8 ) | |
975 { | |
976 CloseWindowBackground(); | |
977 dword_5C35C8 = 0; | |
978 uMessageParam = 1; | |
979 break; | |
980 } | |
981 break; | |
982 } | |
1458 | 983 if ( !pModalWindow ) |
0 | 984 { |
985 pRenderer->ClearZBuffer(0, 479); | |
978 | 986 viewparams->bRedrawGameUI = 1; |
987 viewparams->field_48 = 1; | |
0 | 988 if ( pCurrentScreen ) |
989 { | |
151 | 990 if ( pCurrentScreen > SCREEN_67 ) |
0 | 991 { |
151 | 992 if ( pCurrentScreen == SCREEN_QUICK_REFERENCE ) |
990 | 993 { |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
994 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
990 | 995 if ( pGUIWindow_Settings ) |
996 { | |
997 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
998 { | |
999 pMouse->SetCursorBitmap("MICON2"); | |
1000 } | |
1001 else | |
1002 { | |
1003 pGUIWindow_Settings->Release(); | |
1004 pGUIWindow_Settings = 0; | |
1005 pMouse->SetCursorBitmap("MICON1"); | |
1006 GameUI_Footer_TimeLeft = 0; | |
1682 | 1007 _50C9A0_IsEnchantingInProgress = 0; |
990 | 1008 back_to_game(); |
1009 } | |
1010 } | |
1011 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
1012 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1013 pGUIWindow_CurrentMenu->Release(); | |
1014 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
1015 window_SpeakInHouse = 0; | |
1016 pGUIWindow_CurrentMenu = 0; | |
1017 pEventTimer->Resume(); | |
1018 pCurrentScreen = SCREEN_GAME; | |
1019 viewparams->bRedrawGameUI = 1; | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1020 pIcons_LOD->RemoveTexturesFromTextureList(); |
990 | 1021 continue; |
1022 } | |
0 | 1023 } |
1024 else | |
1025 { | |
151 | 1026 if ( pCurrentScreen < SCREEN_64 ) |
0 | 1027 { |
1028 switch ( pCurrentScreen ) | |
1029 { | |
151 | 1030 case SCREEN_CASTING: |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1031 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 1032 if ( some_active_character ) |
1033 { | |
1034 uActiveCharacter = some_active_character; | |
1035 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1036 some_active_character = 0; | |
1037 if ( pParty->bTurnBasedModeOn ) | |
1448 | 1038 pTurnEngine->ApplyPlayerAction(); |
1682 | 1039 _50C9D0_AfterEnchClickEventId = 0; |
1040 _50C9D4_AfterEnchClickEventSecondParam = 0; | |
1041 _50C9D8_AfterEnchClickEventTimeout = 0; | |
0 | 1042 } |
1682 | 1043 if ( ptr_50C9A4_ItemToEnchant && ptr_50C9A4_ItemToEnchant->uItemID ) |
0 | 1044 { |
1682 | 1045 LOBYTE(ptr_50C9A4_ItemToEnchant->uAttributes) &= 0xFu; |
984 | 1046 _50C9A8_item_enchantment_timer = 0; |
1682 | 1047 ptr_50C9A4_ItemToEnchant = 0; |
0 | 1048 } |
4 | 1049 if ( pGUIWindow_Settings ) |
1050 { | |
151 | 1051 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1052 { |
1053 pMouse->SetCursorBitmap("MICON2"); | |
1054 } | |
1055 else | |
1056 { | |
1057 pGUIWindow_Settings->Release(); | |
1058 pGUIWindow_Settings = 0; | |
1059 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1060 GameUI_Footer_TimeLeft = 0; |
1682 | 1061 _50C9A0_IsEnchantingInProgress = 0; |
4 | 1062 back_to_game(); |
1063 } | |
1064 } | |
978 | 1065 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1066 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1067 pGUIWindow_CurrentMenu->Release(); | |
336 | 1068 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1069 window_SpeakInHouse = 0; | |
4 | 1070 pGUIWindow_CurrentMenu = 0; |
1071 pEventTimer->Resume(); | |
151 | 1072 pCurrentScreen = SCREEN_GAME; |
978 | 1073 viewparams->bRedrawGameUI = 1; |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1074 pIcons_LOD->RemoveTexturesFromTextureList(); |
4 | 1075 continue; |
151 | 1076 case SCREEN_BOOKS: |
0 | 1077 pBooksWindow->Release(); |
1078 //crt_deconstruct_ptr_6A0118(); | |
1079 pBooksWindow = 0; | |
1080 pEventTimer->Resume(); | |
4 | 1081 if ( pGUIWindow_Settings ) |
1082 { | |
151 | 1083 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1084 { |
1085 pMouse->SetCursorBitmap("MICON2"); | |
1086 } | |
1087 else | |
1088 { | |
1089 pGUIWindow_Settings->Release(); | |
1090 pGUIWindow_Settings = 0; | |
1091 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1092 GameUI_Footer_TimeLeft = 0; |
1682 | 1093 _50C9A0_IsEnchantingInProgress = 0; |
4 | 1094 back_to_game(); |
1095 } | |
1096 } | |
978 | 1097 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1098 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1099 pGUIWindow_CurrentMenu->Release(); | |
336 | 1100 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1101 window_SpeakInHouse = 0; | |
4 | 1102 pGUIWindow_CurrentMenu = 0; |
1103 pEventTimer->Resume(); | |
151 | 1104 pCurrentScreen = SCREEN_GAME; |
978 | 1105 viewparams->bRedrawGameUI = 1; |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1106 pIcons_LOD->RemoveTexturesFromTextureList(); |
4 | 1107 continue; |
151 | 1108 case SCREEN_SAVEGAME: |
1109 case SCREEN_LOADGAME: | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1110 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 1111 //crt_deconstruct_ptr_6A0118(); |
4 | 1112 stru_506E40.Release(); |
1113 break; | |
987 | 1114 case SCREEN_CHEST_INVENTORY: |
151 | 1115 pCurrentScreen = SCREEN_CHEST; |
4 | 1116 continue; |
151 | 1117 case SCREEN_CHEST: |
0 | 1118 pWindow2 = pChestWindow; |
1119 pWindow2->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1120 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
151 | 1121 pCurrentScreen = SCREEN_GAME; |
978 | 1122 viewparams->bRedrawGameUI = 1; |
0 | 1123 pEventTimer->Resume(); |
4 | 1124 continue; |
151 | 1125 case SCREEN_19: |
987 | 1126 __debugbreak(); |
4 | 1127 pWindow2 = ptr_507BC8; |
1128 pWindow2->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1129 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
151 | 1130 pCurrentScreen = SCREEN_GAME; |
978 | 1131 viewparams->bRedrawGameUI = 1; |
4 | 1132 pEventTimer->Resume(); |
1133 continue; | |
369 | 1134 case SCREEN_OPTIONS://Close |
948 | 1135 options_menu_skin.Relaease(); |
1006 | 1136 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1137 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier); |
1138 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier); | |
1139 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier); | |
1140 WriteWindowsRegistryInt("WalkSound", bWalkSound); | |
1141 WriteWindowsRegistryInt("ShowDamage", bShowDamage); | |
1142 WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode); | |
1143 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun); | |
1144 WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit); | |
1145 if ( !uTurnSpeed ) | |
1146 { | |
978 | 1147 WriteWindowsRegistryInt("TurnDelta", 3); |
4 | 1148 stru_506E40.Release(); |
1149 break; | |
0 | 1150 } |
1151 if ( uTurnSpeed == 64 ) | |
1152 { | |
978 | 1153 WriteWindowsRegistryInt("TurnDelta", 2); |
4 | 1154 stru_506E40.Release(); |
1155 break; | |
0 | 1156 } |
1157 if ( uTurnSpeed != 128 ) | |
4 | 1158 { |
1159 stru_506E40.Release(); | |
1160 break; | |
1161 } | |
978 | 1162 WriteWindowsRegistryInt("TurnDelta", 1); |
0 | 1163 stru_506E40.Release(); |
1164 break; | |
151 | 1165 case SCREEN_MENU: |
1006 | 1166 pIcons_LOD->SyncLoadedFilesCount(); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1167 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1006 | 1168 pIcons_LOD->SyncLoadedFilesCount(); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1169 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
4 | 1170 stru_506E40.Release(); |
1171 break; | |
151 | 1172 case SCREEN_VIDEO_OPTIONS: |
0 | 1173 if ( pRenderer->pRenderD3D ) |
1174 { | |
1175 WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights); | |
1176 WriteWindowsRegistryInt("Tinting", pRenderer->bTinting); | |
1177 WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pGame->uFlags2) >> 5) & 1); | |
1178 } | |
1179 if ( pRenderer->bWindowMode ) | |
4 | 1180 { |
1181 stru_506E40.Release(); | |
1182 break; | |
1183 } | |
978 | 1184 //v30 = uGammaPos; |
1185 //v31 = "GammaPos"; | |
1186 WriteWindowsRegistryInt("GammaPos", uGammaPos); | |
4 | 1187 stru_506E40.Release(); |
1188 break; | |
1031 | 1189 |
369 | 1190 case SCREEN_KEYBOARD_OPTIONS://Return to game |
0 | 1191 v197 = 1; |
1192 v32 = 0; | |
1031 | 1193 while ( !GameMenuUI_InvaligKeyBindingsFlags[v32]) |
0 | 1194 { |
1195 ++v32; | |
1196 if ( v32 >= 28 ) | |
1197 { | |
362 | 1198 thisb = (signed int)&uTextureID_Optkb; |
1031 | 1199 assert(false && "Invalid condition values"); |
0 | 1200 do |
1201 { | |
1202 if ( *(int *)thisb ) | |
1203 pIcons_LOD->pTextures[*(int *)thisb].Release(); | |
1204 thisb += 4; | |
1205 } | |
1031 | 1206 while ( thisb < (signed int)0x00507C08 ); |
1207 | |
362 | 1208 memset(&uTextureID_Optkb, 0, 0x14u); |
1006 | 1209 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1210 uAction = 0; |
1211 do | |
1212 { | |
1213 v33 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
1214 if ( v33 != pPrevVirtualCidesMapping[uAction] ) | |
1215 { | |
1216 if ( v197 ) | |
1217 { | |
1218 v34 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
978 | 1219 GUI_ReplaceHotkey(v34, LOBYTE(pPrevVirtualCidesMapping[uAction]), 1); |
0 | 1220 v197 = 0; |
1221 } | |
1222 else | |
1223 { | |
1224 v35 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
1225 GUI_ReplaceHotkey(v35, LOBYTE(pPrevVirtualCidesMapping[uAction]), 0); | |
1226 } | |
1227 } | |
978 | 1228 if ( uAction && uAction != 2 && uAction != 3 && uAction != 1 && uAction != 25 && uAction != 26 ) |
1229 pKeyToggleType = (KeyToggleType)1; | |
0 | 1230 else |
1231 pKeyToggleType = (KeyToggleType)0; | |
1232 pKeyActionMap->SetKeyMapping(uAction, pPrevVirtualCidesMapping[uAction], pKeyToggleType); | |
1233 ++uAction; | |
1234 } | |
1235 while ( uAction < 28 ); | |
1236 pKeyActionMap->StoreMappings(); | |
4 | 1237 stru_506E40.Release(); |
1238 break; | |
0 | 1239 } |
1240 } | |
369 | 1241 break; |
916 | 1242 case SCREEN_REST://close rest screen |
0 | 1243 if ( dword_506F14 ) |
1244 { | |
1396 | 1245 Rest(_506F18_num_minutes_to_sleep); |
1520 | 1246 pParty->pPlayers[3].SetAsleep(false); |
1247 pParty->pPlayers[2].SetAsleep(false); | |
1248 pParty->pPlayers[1].SetAsleep(false); | |
1249 pParty->pPlayers[0].SetAsleep(false); | |
0 | 1250 } |
1251 pTexture_RestUI_CurrentSkyFrame->Release(); | |
1252 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
1253 pTexture_RestUI_CurrentHourglassFrame = 0; | |
1254 pTexture_RestUI_CurrentSkyFrame = 0; | |
1006 | 1255 pIcons_LOD->SyncLoadedFilesCount(); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1256 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
1520 | 1257 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
1258 { | |
1259 pOutdoor->UpdateSunlightVectors(); | |
1260 pOutdoor->UpdateFog(); | |
1261 } | |
1396 | 1262 _506F18_num_minutes_to_sleep = 0; |
0 | 1263 dword_506F14 = 0; |
978 | 1264 dword_507B94 = 1; |
4 | 1265 if ( pGUIWindow_Settings ) |
1266 { | |
151 | 1267 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1268 { |
1269 pMouse->SetCursorBitmap("MICON2"); | |
1270 } | |
1271 else | |
1272 { | |
1273 pGUIWindow_Settings->Release(); | |
1274 pGUIWindow_Settings = 0; | |
1275 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1276 GameUI_Footer_TimeLeft = 0; |
1682 | 1277 _50C9A0_IsEnchantingInProgress = 0; |
4 | 1278 back_to_game(); |
1279 } | |
1520 | 1280 } |
1281 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
4 | 1282 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1520 | 1283 pGUIWindow_CurrentMenu->Release(); |
1284 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
1285 window_SpeakInHouse = 0; | |
1286 pGUIWindow_CurrentMenu = 0; | |
1287 pEventTimer->Resume(); | |
1288 pCurrentScreen = SCREEN_GAME; | |
1289 viewparams->bRedrawGameUI = 1; | |
1290 pIcons_LOD->RemoveTexturesFromTextureList(); | |
1291 continue; | |
151 | 1292 case SCREEN_E: |
987 | 1293 __debugbreak(); |
0 | 1294 pGUIWindow_CurrentMenu->Release(); |
151 | 1295 pCurrentScreen = SCREEN_HOUSE; |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1296 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
4 | 1297 continue; |
151 | 1298 case SCREEN_HOUSE: |
0 | 1299 if ( uDialogueType ) |
1300 uDialogueType = 0; | |
978 | 1301 if ( uGameState == GAME_STATE_2 ) |
0 | 1302 { |
1303 while ( sub_4BD8B5() ) | |
1304 ; | |
1305 } | |
1306 else | |
1307 { | |
1308 if ( sub_4BD8B5() ) | |
4 | 1309 continue; |
0 | 1310 } |
1407 | 1311 GetHouseGoodbyeSpeech(); |
978 | 1312 pAudioPlayer->PlaySound(SOUND_7, 814, 0, -1, 0, 0, 0, 0); |
0 | 1313 pVideoPlayer->Unload(); |
336 | 1314 pGUIWindow_CurrentMenu = window_SpeakInHouse; |
4 | 1315 if ( pGUIWindow_Settings ) |
1316 { | |
151 | 1317 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1318 { |
1319 pMouse->SetCursorBitmap("MICON2"); | |
1320 } | |
1321 else | |
1322 { | |
1323 pGUIWindow_Settings->Release(); | |
1324 pGUIWindow_Settings = 0; | |
1325 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1326 GameUI_Footer_TimeLeft = 0; |
1682 | 1327 _50C9A0_IsEnchantingInProgress = 0; |
4 | 1328 back_to_game(); |
1329 } | |
1330 } | |
978 | 1331 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1332 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1333 pGUIWindow_CurrentMenu->Release(); | |
336 | 1334 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1335 window_SpeakInHouse = 0; | |
4 | 1336 pGUIWindow_CurrentMenu = 0; |
1337 pEventTimer->Resume(); | |
151 | 1338 pCurrentScreen = SCREEN_GAME; |
1035 | 1339 viewparams->bRedrawGameUI = true; |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1340 pIcons_LOD->RemoveTexturesFromTextureList(); |
4 | 1341 continue; |
987 | 1342 case SCREEN_INPUT_BLV://click escape |
0 | 1343 if ( uCurrentHouse_Animation == 153 ) |
735 | 1344 PlayHouseSound(0x99u, HouseSound_Greeting_2); |
0 | 1345 pVideoPlayer->Unload(); |
4 | 1346 if ( dword_5B65CC ) |
1347 { | |
1348 pParty->field_709 = 0; | |
1349 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; | |
1035 | 1350 pParty->CountHirelings(); |
1351 viewparams->bRedrawGameUI = true; | |
4 | 1352 dword_5B65CC = 0; |
1353 } | |
987 | 1354 DialogueEnding(); |
1355 pCurrentScreen = SCREEN_GAME; | |
1035 | 1356 viewparams->bRedrawGameUI = true; |
987 | 1357 continue; |
1358 case SCREEN_NPC_DIALOGUE://click escape | |
0 | 1359 if ( dword_5B65CC ) |
1360 { | |
1361 pParty->field_709 = 0; | |
1362 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; | |
1035 | 1363 pParty->CountHirelings(); |
1364 viewparams->bRedrawGameUI = true; | |
0 | 1365 dword_5B65CC = 0; |
1366 } | |
987 | 1367 //goto LABEL_317; |
1368 DialogueEnding(); | |
1369 pCurrentScreen = SCREEN_GAME; | |
1035 | 1370 viewparams->bRedrawGameUI = true; |
987 | 1371 continue; |
1372 case SCREEN_BRANCHLESS_NPC_DIALOG://click escape | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1373 memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); |
0 | 1374 sub_4452BB(); |
987 | 1375 DialogueEnding(); |
1376 pCurrentScreen = SCREEN_GAME; | |
1035 | 1377 viewparams->bRedrawGameUI = true; |
987 | 1378 continue; |
1379 case SCREEN_CHANGE_LOCATION://click escape | |
0 | 1380 if ( pParty->vPosition.x < -22528 ) |
1381 pParty->vPosition.x = -22528; | |
1382 if ( pParty->vPosition.x > 22528 ) | |
1383 pParty->vPosition.x = 22528; | |
1384 if ( pParty->vPosition.y < -22528 ) | |
1385 pParty->vPosition.y = -22528; | |
1386 if ( pParty->vPosition.y > 22528 ) | |
1387 pParty->vPosition.y = 22528; | |
987 | 1388 DialogueEnding(); |
1389 pCurrentScreen = SCREEN_GAME; | |
1035 | 1390 viewparams->bRedrawGameUI = true; |
987 | 1391 continue; |
151 | 1392 case SCREEN_VIDEO: |
0 | 1393 pVideoPlayer->Unload(); |
4 | 1394 continue; |
151 | 1395 case SCREEN_CHARACTERS: |
992 | 1396 CharacterUI_ReleaseButtons(); |
1458 | 1397 ReleaseAwardsScrollBar(); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1398 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
990 | 1399 if ( pGUIWindow_Settings ) |
1400 { | |
1401 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
1402 { | |
1403 pMouse->SetCursorBitmap("MICON2"); | |
1404 } | |
1405 else | |
1406 { | |
1407 pGUIWindow_Settings->Release(); | |
1408 pGUIWindow_Settings = 0; | |
1409 pMouse->SetCursorBitmap("MICON1"); | |
1410 GameUI_Footer_TimeLeft = 0; | |
1682 | 1411 _50C9A0_IsEnchantingInProgress = 0; |
990 | 1412 back_to_game(); |
1413 } | |
1414 } | |
1415 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
1416 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1417 pGUIWindow_CurrentMenu->Release(); | |
1418 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
1419 window_SpeakInHouse = 0; | |
1420 pGUIWindow_CurrentMenu = 0; | |
1421 pEventTimer->Resume(); | |
1422 pCurrentScreen = SCREEN_GAME; | |
1035 | 1423 viewparams->bRedrawGameUI = true; |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1424 pIcons_LOD->RemoveTexturesFromTextureList(); |
990 | 1425 continue; |
0 | 1426 default: |
4 | 1427 if ( pGUIWindow_Settings ) |
1428 { | |
151 | 1429 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1430 { |
1431 pMouse->SetCursorBitmap("MICON2"); | |
1432 } | |
1433 else | |
1434 { | |
1435 pGUIWindow_Settings->Release(); | |
1436 pGUIWindow_Settings = 0; | |
1437 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1438 GameUI_Footer_TimeLeft = 0; |
1682 | 1439 _50C9A0_IsEnchantingInProgress = 0; |
4 | 1440 back_to_game(); |
1441 } | |
1442 } | |
978 | 1443 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1444 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1445 pGUIWindow_CurrentMenu->Release(); | |
336 | 1446 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1447 window_SpeakInHouse = 0; | |
4 | 1448 pGUIWindow_CurrentMenu = 0; |
1449 pEventTimer->Resume(); | |
151 | 1450 pCurrentScreen = SCREEN_GAME; |
978 | 1451 viewparams->bRedrawGameUI = 1; |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1452 pIcons_LOD->RemoveTexturesFromTextureList(); |
4 | 1453 continue; |
0 | 1454 } |
4 | 1455 if ( pGUIWindow_Settings ) |
1456 { | |
151 | 1457 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1458 { |
1459 pMouse->SetCursorBitmap("MICON2"); | |
1460 } | |
1461 else | |
1462 { | |
1463 pGUIWindow_Settings->Release(); | |
1464 pGUIWindow_Settings = 0; | |
1465 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1466 GameUI_Footer_TimeLeft = 0; |
1682 | 1467 _50C9A0_IsEnchantingInProgress = 0; |
4 | 1468 back_to_game(); |
1469 } | |
1470 } | |
978 | 1471 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1472 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1473 pGUIWindow_CurrentMenu->Release(); | |
336 | 1474 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1475 window_SpeakInHouse = 0; | |
4 | 1476 pGUIWindow_CurrentMenu = 0; |
1477 pEventTimer->Resume(); | |
151 | 1478 pCurrentScreen = SCREEN_GAME; |
1035 | 1479 viewparams->bRedrawGameUI = true; |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1480 pIcons_LOD->RemoveTexturesFromTextureList(); |
4 | 1481 continue; |
0 | 1482 } |
991 | 1483 CharacterUI_ReleaseButtons(); |
1458 | 1484 ReleaseAwardsScrollBar(); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1485 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 1486 } |
1487 if ( pGUIWindow_Settings ) | |
1488 { | |
151 | 1489 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
0 | 1490 { |
1491 pMouse->SetCursorBitmap("MICON2"); | |
1492 } | |
1493 else | |
1494 { | |
1495 pGUIWindow_Settings->Release(); | |
1496 pGUIWindow_Settings = 0; | |
1497 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1498 GameUI_Footer_TimeLeft = 0; |
1682 | 1499 _50C9A0_IsEnchantingInProgress = 0; |
0 | 1500 back_to_game(); |
1501 } | |
1502 } | |
978 | 1503 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
0 | 1504 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1505 pGUIWindow_CurrentMenu->Release(); | |
336 | 1506 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1507 window_SpeakInHouse = 0; | |
0 | 1508 pGUIWindow_CurrentMenu = 0; |
1509 pEventTimer->Resume(); | |
151 | 1510 pCurrentScreen = SCREEN_GAME; |
1035 | 1511 viewparams->bRedrawGameUI = true; |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1512 pIcons_LOD->RemoveTexturesFromTextureList(); |
4 | 1513 continue; |
0 | 1514 } |
1515 if ( !pGUIWindow_Settings )//Draw Menu | |
1516 { | |
1517 dword_6BE138 = -1; | |
1268 | 1518 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, (char *)1); |
0 | 1519 pEventTimer->Pause(); |
1520 pAudioPlayer->StopChannels(-1, -1); | |
1035 | 1521 pCurrentScreen = SCREEN_MENU; |
1522 | |
0 | 1523 ++pIcons_LOD->uTexturePacksCount; |
1524 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
1525 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
1035 | 1526 |
961 | 1527 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0); |
362 | 1528 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE); |
1529 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE); | |
1530 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE); | |
1531 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE); | |
1532 uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE); | |
1533 uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); | |
1534 uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE); | |
978 | 1535 pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, 1, 0, UIMSG_StartNewGame, 0, 0x4Eu, |
0 | 1536 pGlobalTXT_LocalizationStrings[614],// "New Game" |
710 | 1537 pIcons_LOD->GetTexture(uTextureID_New1), 0); |
978 | 1538 pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u, |
0 | 1539 pGlobalTXT_LocalizationStrings[615],// "Save Game" |
710 | 1540 pIcons_LOD->GetTexture(uTextureID_Save1), 0); |
978 | 1541 pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu, |
0 | 1542 pGlobalTXT_LocalizationStrings[616],// "Load Game" |
710 | 1543 pIcons_LOD->GetTexture(uTextureID_Load1), 0); |
978 | 1544 pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u, |
0 | 1545 pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:"" |
710 | 1546 pIcons_LOD->GetTexture(uTextureID_Controls1), 0); |
978 | 1547 pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, 1, 0, UIMSG_Quit, 0, 0x51u, |
0 | 1548 pGlobalTXT_LocalizationStrings[618],// "Quit" |
710 | 1549 pIcons_LOD->GetTexture(uTextureID_Quit1), 0); |
978 | 1550 pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, 1, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u, |
0 | 1551 pGlobalTXT_LocalizationStrings[619],// "Return to Game" |
710 | 1552 pIcons_LOD->GetTexture(uTextureID_Resume1), 0); |
978 | 1553 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(6, 1, 0, 0); |
1554 viewparams->field_48 = 1; | |
0 | 1555 stru_506E40.Release(); |
1556 uNumSeconds = (unsigned int)MakeScreenshot(155, 117); | |
1557 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); | |
1558 free((void *)uNumSeconds); | |
1559 stru_506E40._40E55E("gamma.pcx", 0); | |
4 | 1560 continue; |
0 | 1561 } |
1000 | 1562 pGUIWindow_Settings->Release(); |
11 | 1563 pGUIWindow_Settings = 0; |
1564 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1565 GameUI_Footer_TimeLeft = 0; |
1682 | 1566 _50C9A0_IsEnchantingInProgress = 0; |
11 | 1567 back_to_game(); |
1568 continue; | |
0 | 1569 } |
1458 | 1570 ModalWindow_Release(); |
0 | 1571 continue; |
111 | 1572 case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel |
0 | 1573 if ( uMessageParam ) |
1574 { | |
962 | 1575 GUIWindow::Create(626, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCRight, 0); |
0 | 1576 v37 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + (unsigned __int8)pParty->field_70A - 2; |
1577 if ( (unsigned __int8)pParty->field_709 < v37 ) | |
1578 { | |
111 | 1579 ++pParty->field_709;//??? maybe number of the first cell??? |
0 | 1580 if ( (unsigned __int8)pParty->field_709 >= v37 ) |
1581 pParty->field_709 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + pParty->field_70A - 2; | |
1582 } | |
1583 } | |
1584 else | |
1585 { | |
962 | 1586 GUIWindow::Create(469, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCLeft, 0); |
0 | 1587 if ( pParty->field_709 ) |
1588 { | |
1589 --pParty->field_709; | |
1590 if ( pParty->field_709 < 1 ) | |
1591 pParty->field_709 = 0; | |
1592 } | |
1593 } | |
994 | 1594 GameUI_DrawHiredNPCs(); |
4 | 1595 continue; |
434 | 1596 case UIMSG_TransitionUI_Confirm: |
0 | 1597 if ( pMessageQueue_50CBD0->uNumMessages ) |
1598 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
978 | 1599 dword_50CDC8 = 1; |
0 | 1600 sub_42FBDD(); |
758 | 1601 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful); |
0 | 1602 pVideoPlayer->Unload(); |
960 | 1603 DialogueEnding(); |
978 | 1604 viewparams->bRedrawGameUI = 1; |
0 | 1605 if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz ) |
1606 { | |
1607 if ( dword_59117C_teleportx ) | |
1608 { | |
1609 pParty->vPosition.x = dword_59117C_teleportx; | |
1610 _5B65A8_npcdata_uflags_or_other = dword_59117C_teleportx; | |
1611 } | |
1612 if ( dword_591178_teleporty ) | |
1613 { | |
1614 pParty->vPosition.y = dword_591178_teleporty; | |
1615 _5B65AC_npcdata_fame_or_other = dword_591178_teleporty; | |
1616 } | |
1617 if ( dword_591174_teleportz ) | |
1618 { | |
1619 pParty->vPosition.z = dword_591174_teleportz; | |
1620 _5B65B0_npcdata_rep_or_other = dword_591174_teleportz; | |
1621 pParty->uFallStartY = dword_591174_teleportz; | |
1622 } | |
1623 if ( dword_591170_teleport_directiony ) | |
1624 { | |
1625 pParty->sRotationY = dword_591170_teleport_directiony; | |
1626 _5B65B4_npcdata_loword_house_or_other = dword_591170_teleport_directiony; | |
1627 } | |
1628 if ( dword_59116C_teleport_directionx ) | |
1629 { | |
1630 pParty->sRotationX = dword_59116C_teleport_directionx; | |
1631 _5B65B8_npcdata_hiword_house_or_other = dword_59116C_teleport_directionx; | |
1632 v38 = dword_591168_teleport_speedz; | |
1633 pParty->uFallSpeed = dword_591168_teleport_speedz; | |
1634 dword_5B65BC = dword_591168_teleport_speedz; | |
1635 } | |
1636 else | |
1637 { | |
1638 v38 = dword_5B65BC; | |
1639 } | |
1640 if ( *dword_591164_teleport_map_name != 48 ) | |
1641 { | |
1642 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)2; | |
1643 dword_5B65C0 = _5B65A8_npcdata_uflags_or_other | _5B65AC_npcdata_fame_or_other | _5B65B0_npcdata_rep_or_other | _5B65B4_npcdata_loword_house_or_other | _5B65B8_npcdata_hiword_house_or_other | v38; | |
1644 OnMapLeave(); | |
783 | 1645 sub_44987B(dword_591164_teleport_map_name, MapStartPoint_Party); |
0 | 1646 } |
1647 } | |
1648 else | |
1649 { | |
1052 | 1650 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); |
1651 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1652 if ( !_stricmp(byte_6BE3B0.data(), "d05.blv") ) |
0 | 1653 pParty->uTimePlayed += 1474560i64; |
4 | 1654 continue; |
960 | 1655 case UIMSG_TransitionWindowCloseBtn: |
11 | 1656 CloseWindowBackground(); |
0 | 1657 pVideoPlayer->Unload(); |
960 | 1658 DialogueEnding(); |
1035 | 1659 viewparams->bRedrawGameUI = true; |
910 | 1660 continue; |
0 | 1661 case UIMSG_CycleCharacters: |
1662 v39 = GetAsyncKeyState(VK_SHIFT); | |
910 | 1663 uActiveCharacter = CycleCharacter(v39); |
1035 | 1664 viewparams->bRedrawGameUI = true; |
910 | 1665 continue; |
783 | 1666 case UIMSG_OnTravelByFoot: |
0 | 1667 if ( pMessageQueue_50CBD0->uNumMessages ) |
1668 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
978 | 1669 dword_50CDC8 = 1; |
0 | 1670 sub_42FBDD(); |
1430 | 1671 //pNPCData4 = (NPCData *)GetTravelTime(); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
1672 strcpy(pOutdoor->pLevelFilename, pCurrentMapName); |
0 | 1673 if ( bUnderwater != 1 && pParty->bFlying |
978 | 1674 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 ) |
1675 { | |
1676 viewparams->bRedrawGameUI = 1; | |
11 | 1677 CloseWindowBackground(); |
0 | 1678 if ( pParty->vPosition.x < -22528 ) |
1679 pParty->vPosition.x = -22528; | |
1680 if ( pParty->vPosition.x > 22528 ) | |
1681 pParty->vPosition.x = 22528; | |
1682 if ( pParty->vPosition.y < -22528 ) | |
1683 pParty->vPosition.y = -22528; | |
1684 if ( pParty->vPosition.y > 22528 ) | |
1685 pParty->vPosition.y = 22528; | |
960 | 1686 DialogueEnding(); |
151 | 1687 pCurrentScreen = SCREEN_GAME; |
0 | 1688 } |
1689 else | |
1690 { | |
1691 pParty->field_6E4 = 0; | |
1692 pParty->field_6E0 = 0; | |
1517 | 1693 CastSpellInfoHelpers::_427D48(); |
960 | 1694 DialogueEnding(); |
0 | 1695 pEventTimer->Pause(); |
434 | 1696 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); |
0 | 1697 ++pGameLoadingUI_ProgressBar->uProgressMax; |
978 | 1698 SaveGame(1, 0); |
0 | 1699 pGameLoadingUI_ProgressBar->Progress(); |
1430 | 1700 RestAndHeal(1440 * (signed int)GetTravelTime()); |
0 | 1701 if ( pParty->uNumFoodRations ) |
1702 { | |
1703 pParty->RestAndHeal(); | |
1430 | 1704 if ( ((pParty->uNumFoodRations - (signed int)GetTravelTime()) & 0x80000000u) != 0 ) |
0 | 1705 { |
1706 pPlayer7 = pParty->pPlayers; | |
1707 do | |
1708 { | |
978 | 1709 pPlayer7->SetCondition(1, 0); |
0 | 1710 ++pPlayer7; |
1711 } | |
1712 while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings ); | |
766 | 1713 ++pParty->days_played_without_rest; |
0 | 1714 } |
1430 | 1715 Party::TakeFood((unsigned int)GetTravelTime()); |
0 | 1716 } |
1717 else | |
1718 { | |
1719 pPlayer8 = pParty->pPlayers; | |
1720 do | |
1721 { | |
978 | 1722 pPlayer8->SetCondition(1, 0); |
0 | 1723 ++pPlayer8; |
1724 } | |
1725 while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings ); | |
766 | 1726 ++pParty->days_played_without_rest; |
0 | 1727 } |
1728 pPaletteManager->ResetNonLocked(); | |
1729 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
1730 strcpy(pCurrentMapName, pOut); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
1731 strcpy(pLevelName, pCurrentMapName); |
783 | 1732 v41 = strtok(pLevelName, "."); |
1733 strcpy(pLevelName, v41); | |
1734 Level_LoadEvtAndStr(pLevelName); | |
1735 pDecalBuilder->Reset(0); | |
0 | 1736 LoadLevel_InitializeLevelEvt(); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
1737 uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 1738 bUnderwater = 0; |
1739 bNoNPCHiring = 0; | |
1740 pGame->uFlags2 &= 0xFFFFFFF7u; | |
1741 if ( Is_out15odm_underwater() ) | |
1742 { | |
1743 bUnderwater = 1; | |
1744 pGame->uFlags2 |= 8u; | |
1745 } | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
1746 if ( !_stricmp(pCurrentMapName, "out15.odm") || !_stricmp(pCurrentMapName, "d47.blv") ) |
0 | 1747 bNoNPCHiring = 1; |
1637 | 1748 PrepareToLoadODM(1u, (ODMRenderParams *)1); |
0 | 1749 pAudioPlayer->SetMapEAX(); |
1750 bDialogueUI_InitializeActor_NPC_ID = 0; | |
1751 OnMapLoad(); | |
1752 pOutdoor->SetFog(); | |
1753 TeleportToStartingPoint(uLevel_StartingPointType); | |
783 | 1754 pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v213, 0); |
0 | 1755 pParty->uFallStartY = pParty->vPosition.z; |
1459 | 1756 _461103_load_level_sub(); |
0 | 1757 pEventTimer->Resume(); |
1758 viewparams->bRedrawGameUI = 1; | |
151 | 1759 pCurrentScreen = SCREEN_GAME; |
0 | 1760 pGameLoadingUI_ProgressBar->Release(); |
1761 } | |
978 | 1762 viewparams->bRedrawGameUI = 1; |
910 | 1763 continue; |
987 | 1764 case UIMSG_CHANGE_LOCATION_ClickCencelBtn: |
1765 CloseWindowBackground(); | |
1766 if ( pParty->vPosition.x < -22528 ) | |
1767 pParty->vPosition.x = -22528; | |
1768 if ( pParty->vPosition.x > 22528 ) | |
1769 pParty->vPosition.x = 22528; | |
1770 if ( pParty->vPosition.y < -22528 ) | |
1771 pParty->vPosition.y = -22528; | |
1772 if ( pParty->vPosition.y > 22528 ) | |
1773 pParty->vPosition.y = 22528; | |
1774 DialogueEnding(); | |
1775 pCurrentScreen = SCREEN_GAME; | |
1776 viewparams->bRedrawGameUI = 1; | |
1777 continue; | |
1326 | 1778 case UIMSG_CastSpell_Telekinesis: |
0 | 1779 if ( pRenderer->pRenderD3D ) |
1780 LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
1781 else | |
1782 { | |
1783 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210); | |
1784 pPoint = pMouse->GetCursorPos(&v208); | |
1785 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]]; | |
1786 } | |
1787 v44 = (unsigned __int16)v42; | |
848 | 1788 v45 = PID_TYPE(v44); |
0 | 1789 uNumSeconds = v44; |
848 | 1790 v46 = PID_ID(v44); |
0 | 1791 if ( v45 == 3 ) |
1792 { | |
1793 v47 = pActors[v46].uAIState == Dead; | |
11 | 1794 if ( !v47 ) |
1795 continue; | |
1000 | 1796 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1519 | 1797 pSpellInfo->uFlags &= ~0x40u; |
1000 | 1798 pSpellInfo->uPlayerID_2 = uMessageParam; |
1799 pSpellInfo->spell_target_pid = v44; | |
1800 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1801 pGUIWindow_Settings->Release(); | |
11 | 1802 pGUIWindow_Settings = 0; |
1803 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1804 GameUI_Footer_TimeLeft = 0; |
1682 | 1805 _50C9A0_IsEnchantingInProgress = 0; |
11 | 1806 back_to_game(); |
1807 continue; | |
0 | 1808 } |
1809 if ( v45 == 2 ) | |
1810 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
1811 v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0; |
0 | 1812 if ( !v47 ) |
4 | 1813 continue; |
1000 | 1814 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1519 | 1815 pSpellInfo->uFlags &= ~0x40u; |
1000 | 1816 pSpellInfo->uPlayerID_2 = uMessageParam; |
1817 pSpellInfo->spell_target_pid = v44; | |
1818 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1819 pGUIWindow_Settings->Release(); | |
11 | 1820 pGUIWindow_Settings = 0; |
1821 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1822 GameUI_Footer_TimeLeft = 0; |
1682 | 1823 _50C9A0_IsEnchantingInProgress = 0; |
11 | 1824 back_to_game(); |
1825 continue; | |
0 | 1826 } |
1827 if ( v45 == 5 ) | |
1828 { | |
1514
965af46e8793
Rename LevelDecoration::field_16_event_id to LevelDecoration::uEventID.
yoctozepto
parents:
1504
diff
changeset
|
1829 v48 = pLevelDecorations[v46].uEventID == 0; |
0 | 1830 } |
1831 else | |
1832 { | |
1833 if ( v45 != 6 ) | |
4 | 1834 continue; |
978 | 1835 if ( uCurrentlyLoadedLevelType != 1 ) |
0 | 1836 { |
1837 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F]; | |
1838 if ( !(pODMFace->uAttributes & 0x02000000) || !pODMFace->sCogTriggeredID ) | |
4 | 1839 continue; |
0 | 1840 v44 = uNumSeconds; |
1000 | 1841 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1519 | 1842 pSpellInfo->uFlags &= ~0x40u; |
1000 | 1843 pSpellInfo->uPlayerID_2 = uMessageParam; |
1844 pSpellInfo->spell_target_pid = v44; | |
1845 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1846 pGUIWindow_Settings->Release(); | |
11 | 1847 pGUIWindow_Settings = 0; |
1848 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1849 GameUI_Footer_TimeLeft = 0; |
1682 | 1850 _50C9A0_IsEnchantingInProgress = 0; |
11 | 1851 back_to_game(); |
1852 continue; | |
0 | 1853 } |
1854 pBLVFace = &pIndoor->pFaces[v46]; | |
1855 if ( !(BYTE3(pBLVFace->uAttributes) & 2) ) | |
4 | 1856 continue; |
0 | 1857 v48 = pIndoor->pFaceExtras[pBLVFace->uFaceExtraID].uEventID == 0; |
1858 } | |
1859 if ( v48 ) | |
4 | 1860 continue; |
1000 | 1861 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1519 | 1862 pSpellInfo->uFlags &= ~0x40u; |
1000 | 1863 pSpellInfo->uPlayerID_2 = uMessageParam; |
1864 pSpellInfo->spell_target_pid = v44; | |
1865 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1866 pGUIWindow_Settings->Release(); | |
0 | 1867 pGUIWindow_Settings = 0; |
1868 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1869 GameUI_Footer_TimeLeft = 0; |
1682 | 1870 _50C9A0_IsEnchantingInProgress = 0; |
0 | 1871 back_to_game(); |
4 | 1872 continue; |
1000 | 1873 case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade) |
1874 case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure | |
1875 case UIMSG_HiredNPC_CastSpell: | |
0 | 1876 if ( pMessageQueue_50CBD0->uNumMessages ) |
1877 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1682 | 1878 if ( _50C9A0_IsEnchantingInProgress ) |
0 | 1879 { |
910 | 1880 uActiveCharacter = uMessageParam; |
978 | 1881 viewparams->bRedrawGameUI = 1; |
0 | 1882 } |
1883 else | |
1884 { | |
1885 if ( pGUIWindow_Settings ) | |
1886 { | |
1000 | 1887 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
0 | 1888 switch ( uMessage ) |
1889 { | |
1000 | 1890 case UIMSG_CastSpell_Character_Big_Improvement: |
1519 | 1891 pSpellInfo->uFlags &= ~0x02u; |
0 | 1892 break; |
1000 | 1893 case UIMSG_CastSpell_Character_Small_Improvement: |
1519 | 1894 pSpellInfo->uFlags &= ~0x0100u; |
0 | 1895 break; |
1000 | 1896 case UIMSG_HiredNPC_CastSpell: |
1519 | 1897 pSpellInfo->uFlags &= ~0x0200u; |
0 | 1898 break; |
1899 } | |
1000 | 1900 pSpellInfo->uPlayerID_2 = uMessageParam; |
1901 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
0 | 1902 pGUIWindow_Settings->Release(); |
1903 pGUIWindow_Settings = 0; | |
1904 pEventTimer->Resume(); | |
1905 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1906 GameUI_Footer_TimeLeft = 0; |
1682 | 1907 _50C9A0_IsEnchantingInProgress = 0; |
0 | 1908 } |
1909 } | |
4 | 1910 continue; |
0 | 1911 case UIMSG_BF: |
987 | 1912 __debugbreak(); |
978 | 1913 dword_50CDC8 = 1; |
0 | 1914 sub_42FBDD(); |
978 | 1915 SaveGame(1, 0); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
1916 strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename); |
978 | 1917 dword_6BE364_game_settings_1 |= 1; |
1918 uGameState = GAME_STATE_2; | |
11 | 1919 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; |
336 | 1920 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; |
4 | 1921 if ( v53 < 0 ) |
0 | 1922 { |
1923 v54 = abs(v53) - 1; | |
1924 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1925 dword_5B65BC = 0; | |
1926 v55 = dword_4E4560[v54]; | |
1927 _5B65AC_npcdata_fame_or_other = dword_4E4578[v54]; | |
1928 v56 = dword_4E4590[v54]; | |
1929 v57 = dword_4E45A8[v54]; | |
1930 _5B65A8_npcdata_uflags_or_other = v55; | |
1931 _5B65B4_npcdata_loword_house_or_other = v57; | |
1932 _5B65B0_npcdata_rep_or_other = v56; | |
1933 dword_5B65C0 = v55 | _5B65AC_npcdata_fame_or_other | v56 | v57; | |
1934 } | |
1935 sub_4BD8B5(); | |
11 | 1936 //goto LABEL_434; |
437 | 1937 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
11 | 1938 { |
990 | 1939 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 1940 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
1941 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
1942 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 1943 }*/ |
978 | 1944 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
11 | 1945 continue; |
710 | 1946 |
1947 case UIMSG_OnCastTownPortal: | |
0 | 1948 pAudioPlayer->StopChannels(-1, -1); |
1268 | 1949 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_TownPortal, (char *)uMessageParam); |
710 | 1950 continue; |
1951 | |
961 | 1952 case UIMSG_OnCastLloydsBeacon: |
0 | 1953 pAudioPlayer->StopChannels(-1, -1); |
961 | 1954 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_LloydsBeacon, 0); |
710 | 1955 continue; |
1956 | |
961 | 1957 case UIMSG_LloydsBeacon_FlippingBtn: |
0 | 1958 bRecallingBeacon = uMessageParam; |
1959 v127 = uMessageParam + 204; | |
916 | 1960 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
1961 continue; | |
961 | 1962 case UIMSG_HintBeaconSlot: |
0 | 1963 if ( !pGUIWindow_CurrentMenu ) |
4 | 1964 continue; |
0 | 1965 pPlayer = pPlayers[_506348_current_lloyd_playerid + 1]; |
1966 uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam]; | |
1967 if ( bRecallingBeacon ) | |
1968 { | |
1430 | 1969 if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) ) |
4 | 1970 continue; |
1430 | 1971 v173 = pMapStats->pInfos[sub_410D99_get_map_index(pPlayer->pInstalledBeacons[uMessageParam].SaveFileID)].pName; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1972 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s" |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1973 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 1974 continue; |
0 | 1975 } |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
1976 pMapNum = pMapStats->GetMapInfo(pCurrentMapName); |
1430 | 1977 pMapName = "Not in Map Stats"; |
1978 if ( pMapNum ) | |
1979 pMapName = pMapStats->pInfos[pMapNum].pName; | |
1980 if ( !*((int *)&pSavegameThumbnails[10 * uMessageParam].pPixels ) || !pMapNum ) | |
0 | 1981 { |
1430 | 1982 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], pMapName);// "Set to %s" |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1983 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 1984 continue; |
0 | 1985 } |
1986 v174 = pMapStats->pInfos[sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName; | |
1430 | 1987 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], (unsigned int)pMapName, v174);// "Set %s over %s" |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1988 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 1989 continue; |
961 | 1990 case UIMSG_CloseAfterInstallBeacon: |
978 | 1991 dword_50CDC8 = 1; |
437 | 1992 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
1993 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) | |
11 | 1994 continue; |
990 | 1995 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 1996 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
1997 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 1998 ++pMessageQueue_50CBD0->uNumMessages;*/ |
11 | 1999 continue; |
961 | 2000 case UIMSG_InstallBeacon: |
0 | 2001 pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1]; |
1430 | 2002 if ( !pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime && bRecallingBeacon ) |
4 | 2003 continue; |
0 | 2004 byte_506360 = 1; |
2005 pPlayer9->CanCastSpell(uRequiredMana); | |
2006 if ( pParty->bTurnBasedModeOn ) | |
2007 { | |
2008 v60 = sRecoveryTime; | |
2009 pParty->pTurnBasedPlayerRecoveryTimes[_506348_current_lloyd_playerid] = sRecoveryTime; | |
2010 pPlayer9->SetRecoveryTime(v60); | |
1448 | 2011 pTurnEngine->ApplyPlayerAction(); |
0 | 2012 } |
2013 else | |
2014 { | |
2015 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
2016 } | |
2017 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0); | |
2018 if ( bRecallingBeacon ) | |
2019 { | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
2020 if ( _stricmp(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]) ) |
0 | 2021 { |
978 | 2022 SaveGame(1, 0); |
0 | 2023 OnMapLeave(); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
2024 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID]); |
978 | 2025 dword_6BE364_game_settings_1 |= 1; |
2026 uGameState = GAME_STATE_2; | |
1430 | 2027 _5B65A8_npcdata_uflags_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; |
2028 _5B65AC_npcdata_fame_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; | |
2029 _5B65B0_npcdata_rep_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; | |
2030 _5B65B4_npcdata_loword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X; | |
2031 _5B65B8_npcdata_hiword_house_or_other = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y; | |
978 | 2032 dword_5B65C0 = 1; |
0 | 2033 } |
2034 else | |
2035 { | |
1430 | 2036 pParty->vPosition.x = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X; |
2037 pParty->vPosition.y = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y; | |
2038 pParty->vPosition.z = pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z; | |
0 | 2039 pParty->uFallStartY = pParty->vPosition.z; |
1430 | 2040 pParty->sRotationY = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X; |
2041 pParty->sRotationX = pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y; | |
0 | 2042 } |
978 | 2043 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
0 | 2044 pBooksWindow->Release(); |
2045 pGUIWindow_CurrentMenu->Release(); | |
2046 pBooksWindow = 0; | |
2047 pGUIWindow_CurrentMenu = 0; | |
2048 } | |
2049 else | |
2050 { | |
2051 sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1); | |
2052 SaveScreenshot(a1); | |
2053 LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1); | |
1430 | 2054 pPlayer9->pInstalledBeacons[uMessageParam].uBeaconTime = pParty->uTimePlayed + (signed __int64)((double)(qword_506350 << 7) * 0.033333335); |
2055 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_X = pParty->vPosition.x; | |
2056 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Y = pParty->vPosition.y; | |
2057 pPlayer9->pInstalledBeacons[uMessageParam].PartyPos_Z = pParty->vPosition.z; | |
2058 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_X = LOWORD(pParty->sRotationY); | |
2059 pPlayer9->pInstalledBeacons[uMessageParam].PartyRot_Y = LOWORD(pParty->sRotationX); | |
837 | 2060 if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 ) |
4 | 2061 continue; |
1430 | 2062 for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg ) |
0 | 2063 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
2064 if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName) ) |
1430 | 2065 pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg; |
0 | 2066 } |
2067 } | |
4 | 2068 continue; |
961 | 2069 case UIMSG_ClickTownInTP: |
0 | 2070 if ( uMessageParam ) |
2071 { | |
2072 switch ( uMessageParam ) | |
2073 { | |
2074 case 1: | |
2075 v63 = 208; | |
2076 break; | |
2077 case 2: | |
2078 v63 = 207; | |
2079 break; | |
2080 case 3: | |
2081 v63 = 211; | |
2082 break; | |
2083 case 4: | |
2084 v63 = 209; | |
2085 break; | |
2086 default: | |
2087 if ( uMessageParam != 5 ) | |
2088 { | |
2089 LABEL_486: | |
978 | 2090 SaveGame(1, 0); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
2091 v64 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 2092 v65 = uMessageParam; |
839 | 2093 if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) |
0 | 2094 { |
839 | 2095 pParty->vPosition.x = TownPortalList[v65].pos.x; |
2096 pParty->vPosition.y = TownPortalList[v65].pos.y; | |
2097 pParty->vPosition.z = TownPortalList[v65].pos.z; | |
0 | 2098 pParty->uFallStartY = pParty->vPosition.z; |
839 | 2099 pParty->sRotationY = TownPortalList[v65].rot_y; |
2100 pParty->sRotationX = TownPortalList[v65].rot_x; | |
0 | 2101 } |
2102 else | |
2103 { | |
978 | 2104 SaveGame(1, 0); |
0 | 2105 OnMapLeave(); |
978 | 2106 dword_6BE364_game_settings_1 |= 1; |
2107 uGameState = GAME_STATE_2; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
2108 strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); |
978 | 2109 dword_5B65C0 = 1; |
839 | 2110 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; |
2111 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; | |
2112 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; | |
2113 v66 = TownPortalList[uMessageParam].rot_x; | |
2114 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y; | |
0 | 2115 _5B65B8_npcdata_hiword_house_or_other = v66; |
2116 InitializeActors(); | |
2117 } | |
1268 | 2118 v67 = (char*)pGUIWindow_CurrentMenu->Hint; |
0 | 2119 if ( v67 ) |
978 | 2120 *((int *)v67 + 17) = 1; |
0 | 2121 else |
710 | 2122 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u); |
437 | 2123 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2124 { |
990 | 2125 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2126 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
2127 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2128 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2129 }*/ |
978 | 2130 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
4 | 2131 continue; |
0 | 2132 } |
2133 v63 = 210; | |
2134 break; | |
2135 } | |
2136 } | |
2137 else | |
2138 { | |
2139 v63 = 206; | |
2140 } | |
484 | 2141 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63) ) |
0 | 2142 return; |
2143 goto LABEL_486; | |
961 | 2144 case UIMSG_HintTownPortal: |
0 | 2145 if ( uMessageParam ) |
2146 { | |
2147 switch ( uMessageParam ) | |
2148 { | |
2149 case 1: | |
2150 v68 = 208; | |
2151 break; | |
2152 case 2: | |
2153 v68 = 207; | |
2154 break; | |
2155 case 3: | |
2156 v68 = 211; | |
2157 break; | |
2158 case 4: | |
2159 v68 = 209; | |
2160 break; | |
2161 default: | |
2162 if ( uMessageParam != 5 ) | |
11 | 2163 //goto LABEL_506; |
2164 { | |
2165 if ( uMessageParam ) | |
2166 { | |
2167 switch ( uMessageParam ) | |
2168 { | |
2169 case 1: | |
2170 v69 = pMapStats->pInfos[4].pName; | |
2171 break; | |
2172 case 2: | |
2173 v69 = pMapStats->pInfos[3].pName; | |
2174 break; | |
2175 case 3: | |
2176 v69 = pMapStats->pInfos[10].pName; | |
2177 break; | |
2178 case 4: | |
2179 v69 = pMapStats->pInfos[7].pName; | |
2180 break; | |
2181 default: | |
2182 if ( uMessageParam != 5 ) | |
2183 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1407
diff
changeset
|
2184 __debugbreak(); // warning C4700: uninitialized local variable 'v200' used |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2185 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2186 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2187 continue; |
11 | 2188 } |
2189 v69 = pMapStats->pInfos[8].pName; | |
2190 break; | |
2191 } | |
2192 } | |
2193 else | |
2194 { | |
2195 v69 = pMapStats->pInfos[21].pName; | |
2196 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2197 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2198 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2199 continue; |
11 | 2200 } |
2201 v68 = 210; | |
2202 break; | |
0 | 2203 } |
2204 } | |
2205 else | |
2206 { | |
2207 v68 = 206; | |
2208 } | |
484 | 2209 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v68) ) |
0 | 2210 { |
2211 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); | |
4 | 2212 continue; |
0 | 2213 } |
11 | 2214 //LABEL_506: |
0 | 2215 if ( uMessageParam ) |
2216 { | |
2217 switch ( uMessageParam ) | |
2218 { | |
2219 case 1: | |
2220 v69 = pMapStats->pInfos[4].pName; | |
2221 break; | |
2222 case 2: | |
2223 v69 = pMapStats->pInfos[3].pName; | |
2224 break; | |
2225 case 3: | |
2226 v69 = pMapStats->pInfos[10].pName; | |
2227 break; | |
2228 case 4: | |
2229 v69 = pMapStats->pInfos[7].pName; | |
2230 break; | |
2231 default: | |
2232 if ( uMessageParam != 5 ) | |
2233 //goto LABEL_519; | |
4 | 2234 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2235 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2236 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2237 continue; |
4 | 2238 } |
0 | 2239 v69 = pMapStats->pInfos[8].pName; |
2240 break; | |
2241 } | |
2242 } | |
2243 else | |
2244 { | |
2245 v69 = pMapStats->pInfos[21].pName; | |
2246 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2247 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2248 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2249 continue; |
0 | 2250 case UIMSG_ShowFinalWindow: |
1412 | 2251 sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." |
0 | 2252 pGlobalTXT_LocalizationStrings[118],// "We hope that you've enjoyed playing Might and Magic VII as much as we did making it. We have saved this screen as MM7_WIN.PCX in your MM7 directory. You can print it out as proof of your accomplishment." |
2253 pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team." | |
1458 | 2254 ModalWindow(pFinalMessage.data(), UIMSG_OnFinalWindowClose); |
0 | 2255 uGameState = GAME_STATE_FINAL_WINDOW; |
4 | 2256 continue; |
1458 | 2257 case UIMSG_OnFinalWindowClose: |
987 | 2258 __debugbreak(); |
982 | 2259 uGameState = GAME_STATE_PLAYING; |
0 | 2260 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); |
1458 | 2261 __debugbreak(); // missed break/continue? |
151 | 2262 case UIMSG_DD: |
990 | 2263 __debugbreak(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2264 sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer); |
703 | 2265 memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); |
701 | 2266 if ( v216.uPropCount == 1 ) |
0 | 2267 { |
837 | 2268 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2); |
0 | 2269 v70 = atoi(v216.pProperties[0]); |
2270 if ( v70 <= 0 || v70 >= 77 ) | |
4 | 2271 continue; |
0 | 2272 v71 = v70; |
2273 strcpy(Str2, pMapStats->pInfos[v70].pFilename); | |
2274 pNPCData3 = 0; | |
2275 if ( (signed int)pNPCData4 > 0 ) | |
2276 { | |
2277 thish = 0; | |
2278 do | |
2279 { | |
1104 | 2280 if ( !_stricmp((const char *)&pGames_LOD->pSubIndices[thish], Str2) ) |
0 | 2281 break; |
2282 ++thish; | |
2283 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1); | |
2284 } | |
2285 while ( (signed int)pNPCData3 < (signed int)pNPCData4 ); | |
2286 if ( (signed int)pNPCData3 < (signed int)pNPCData4 ) | |
2287 { | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
2288 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); |
0 | 2289 dword_6BE364_game_settings_1 |= 1u; |
978 | 2290 uGameState = GAME_STATE_2; |
0 | 2291 OnMapLeave(); |
4 | 2292 continue; |
0 | 2293 } |
2294 } | |
2295 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName); | |
2296 v73 = Str2; | |
2297 } | |
2298 else | |
2299 { | |
701 | 2300 if ( v216.uPropCount != 3 ) |
11 | 2301 continue; |
0 | 2302 v74 = atoi(v216.pProperties[0]); |
2303 thisi = atoi(v216.pProperties[1]); | |
2304 v75 = atoi(v216.pProperties[2]); | |
2305 v76 = v75; | |
2306 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
2307 { | |
2308 if ( pIndoor->GetSector(v74, thisi, v75) ) | |
2309 { | |
2310 v77 = thisi; | |
2311 pParty->vPosition.x = v74; | |
2312 pParty->vPosition.y = v77; | |
2313 pParty->vPosition.z = v76; | |
2314 pParty->uFallStartY = v76; | |
11 | 2315 continue; |
0 | 2316 } |
2317 } | |
2318 else | |
2319 { | |
2320 if ( v74 > -32768 ) | |
2321 { | |
2322 if ( v74 < 32768 ) | |
2323 { | |
2324 v77 = thisi; | |
2325 if ( thisi > -32768 ) | |
2326 { | |
2327 if ( thisi < 32768 && v76 >= 0 && v76 < 10000 ) | |
11 | 2328 { |
2329 pParty->vPosition.x = v74; | |
2330 pParty->vPosition.y = v77; | |
2331 pParty->vPosition.z = v76; | |
2332 pParty->uFallStartY = v76; | |
2333 continue; | |
2334 } | |
0 | 2335 } |
2336 } | |
2337 } | |
2338 } | |
2339 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
2340 v73 = "Can't jump to that location!"; | |
2341 } | |
2342 ShowStatusBarString(v73, 6u); | |
4 | 2343 continue; |
961 | 2344 case UIMSG_CastQuickSpell: |
0 | 2345 if ( bUnderwater == 1 ) |
362 | 2346 { |
2347 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" | |
2348 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
2349 continue; | |
2350 } | |
0 | 2351 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) ) |
11 | 2352 continue; |
362 | 2353 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); |
11 | 2354 continue; |
1000 | 2355 case UIMSG_CastSpell_Monster_Improvement: |
2356 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, | |
0 | 2357 if ( pRenderer->pRenderD3D ) |
2358 { | |
2359 v81 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
2360 } | |
2361 else | |
2362 { | |
2363 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v206); | |
2364 pPoint2 = pMouse->GetCursorPos(&v201); | |
2365 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]]; | |
2366 } | |
2367 v83 = v81; | |
2368 v44 = (unsigned __int16)v81; | |
2369 v84 = v83 >> 16; | |
848 | 2370 if ( PID_TYPE(v44) != 3 || v84 >= 5120 ) |
4 | 2371 continue; |
1000 | 2372 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
2373 if ( uMessage == UIMSG_CastSpell_Shoot_Monster ) | |
2374 { | |
1519 | 2375 pSpellInfo->uFlags &= ~0x08; |
0 | 2376 } |
2377 else | |
2378 { | |
1000 | 2379 if ( uMessage == UIMSG_CastSpell_Monster_Improvement ) |
1519 | 2380 pSpellInfo->uFlags &= ~0x0100u; |
0 | 2381 else |
1519 | 2382 pSpellInfo->uFlags &= ~0x0200u; |
1000 | 2383 } |
2384 pSpellInfo->uPlayerID_2 = uMessageParam; | |
2385 pSpellInfo->spell_target_pid = v44; | |
2386 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2387 pGUIWindow_Settings->Release(); | |
11 | 2388 pGUIWindow_Settings = 0; |
2389 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2390 GameUI_Footer_TimeLeft = 0; |
1682 | 2391 _50C9A0_IsEnchantingInProgress = 0; |
11 | 2392 back_to_game(); |
2393 continue; | |
151 | 2394 case UIMSG_1C: |
987 | 2395 __debugbreak(); |
0 | 2396 if ( !uActiveCharacter || pCurrentScreen ) |
4 | 2397 continue; |
710 | 2398 ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0); |
151 | 2399 pCurrentScreen = SCREEN_19; |
0 | 2400 pEventTimer->Pause(); |
4 | 2401 continue; |
1687
5f01f1ed97f4
Player::StealFromActor cleanup, renamed UIMSG_1B to UIMSG_STEALFROMACTOR
Grumpy7
parents:
1685
diff
changeset
|
2402 case UIMSG_STEALFROMACTOR: |
0 | 2403 if ( !uActiveCharacter ) |
4 | 2404 continue; |
978 | 2405 if ( pParty->bTurnBasedModeOn != 1 ) |
11 | 2406 { |
2407 if ( pActors[uMessageParam].uAIState == 5 ) | |
2408 stru_50C198.LootActor(&pActors[uMessageParam]); | |
2409 else | |
2410 Actor::StealFrom(uMessageParam); | |
2411 continue; | |
2412 } | |
1340 | 2413 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3 ) |
4 | 2414 continue; |
1450 | 2415 if ( !(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS) ) |
0 | 2416 { |
2417 if ( pActors[uMessageParam].uAIState == 5 ) | |
2418 stru_50C198.LootActor(&pActors[uMessageParam]); | |
2419 else | |
2420 Actor::StealFrom(uMessageParam); | |
2421 } | |
4 | 2422 continue; |
271 | 2423 |
2424 case UIMSG_Attack: | |
0 | 2425 if ( !uActiveCharacter ) |
4 | 2426 continue; |
978 | 2427 if ( pParty->bTurnBasedModeOn != 1 ) |
11 | 2428 { |
2429 _42ECB5_PlayerAttacksActor(); | |
2430 continue; | |
2431 } | |
1340 | 2432 if ( pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3 ) |
4 | 2433 continue; |
1450 | 2434 if ( !(pTurnEngine->field_18 & TE_HAVE_PENDING_ACTIONS) ) |
0 | 2435 _42ECB5_PlayerAttacksActor(); |
4 | 2436 continue; |
151 | 2437 case UIMSG_ExitRest: |
1268 | 2438 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" |
11 | 2439 continue; |
151 | 2440 case UIMSG_Wait5Minutes: |
0 | 2441 if ( dword_506F14 == 2 ) |
916 | 2442 { |
2443 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2444 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2445 continue; | |
11 | 2446 } |
962 | 2447 GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2, |
1268 | 2448 (int)pButton_RestUI_Wait5Minutes, pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" |
978 | 2449 dword_506F14 = 1; |
1396 | 2450 _506F18_num_minutes_to_sleep = 5; |
4 | 2451 continue; |
151 | 2452 case UIMSG_Wait1Hour: |
0 | 2453 if ( dword_506F14 == 2 ) |
916 | 2454 { |
2455 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2456 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2457 continue; | |
11 | 2458 } |
962 | 2459 GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2, |
1268 | 2460 (int)pButton_RestUI_Wait1Hour, pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" |
978 | 2461 dword_506F14 = 1; |
1396 | 2462 _506F18_num_minutes_to_sleep = 60; |
4 | 2463 continue; |
907 | 2464 case UIMSG_RentRoom: |
0 | 2465 dword_506F14 = 2; |
1033 | 2466 RestUI_Load(); |
758 | 2467 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; |
1396 | 2468 _506F18_num_minutes_to_sleep = v86; |
2469 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) // 107 = Emerald Isle tavern | |
2470 _506F18_num_minutes_to_sleep = v86 + 12 * 60; | |
11 | 2471 dword_506F14 = 2; |
2472 pParty->RestAndHeal(); | |
766 | 2473 pParty->days_played_without_rest = 0; |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
2474 pParty->pPlayers[3].SetAsleep(1); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
2475 pParty->pPlayers[2].SetAsleep(1); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
2476 pParty->pPlayers[1].SetAsleep(1); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
2477 pParty->pPlayers[0].SetAsleep(1); |
11 | 2478 continue; |
907 | 2479 case UIMSG_RestWindow: |
0 | 2480 if ( pMessageQueue_50CBD0->uNumMessages ) |
2481 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2482 if ( pCurrentScreen ) | |
4 | 2483 continue; |
1458 | 2484 if ( _42F4DA_check_actor_proximity() ) |
11 | 2485 { |
978 | 2486 if ( pParty->bTurnBasedModeOn == 1 ) |
11 | 2487 { |
916 | 2488 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" |
11 | 2489 continue; |
2490 } | |
2491 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2492 if ( pParty->uFlags & 0x88 ) | |
2493 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
916 | 2494 ShowStatusBarString(v88, 2); |
11 | 2495 if ( !uActiveCharacter ) |
2496 continue; | |
916 | 2497 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); |
2498 continue; | |
11 | 2499 } |
978 | 2500 if ( pParty->bTurnBasedModeOn == 1 ) |
916 | 2501 { |
2502 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
11 | 2503 continue; |
2504 } | |
0 | 2505 if ( !(pParty->uFlags & 0x88) ) |
2506 { | |
1033 | 2507 RestUI_Load(); |
4 | 2508 continue; |
0 | 2509 } |
978 | 2510 if ( pParty->bTurnBasedModeOn == 1 ) |
0 | 2511 { |
916 | 2512 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" |
11 | 2513 continue; |
0 | 2514 } |
2515 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2516 if ( pParty->uFlags & 0x88 ) | |
2517 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
2518 ShowStatusBarString(v88, 2u); | |
2519 if ( !uActiveCharacter ) | |
4 | 2520 continue; |
916 | 2521 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); |
2522 continue; | |
907 | 2523 case UIMSG_Rest8Hour: |
0 | 2524 if ( dword_506F14 ) |
916 | 2525 { |
2526 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2527 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2528 continue; | |
11 | 2529 } |
0 | 2530 if ( pParty->uNumFoodRations < uRestUI_FoodRequiredToRest ) |
2531 { | |
2532 ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2u);// "You don't have enough food to rest" | |
2533 if ( uActiveCharacter && pPlayers[uActiveCharacter]->CanAct() ) | |
916 | 2534 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_108, 0); |
0 | 2535 } |
2536 else | |
2537 { | |
2538 pParty->pPlayers[3].pConditions[2] = pParty->uTimePlayed; | |
2539 pParty->pPlayers[2].pConditions[2] = pParty->uTimePlayed; | |
2540 pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed; | |
2541 pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1473
diff
changeset
|
2542 v90 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 2543 if ( !v90 ) |
2544 v90 = rand() % (signed int)pMapStats->uNumMaps + 1; | |
2545 pMapInfo = &pMapStats->pInfos[v90]; | |
237 | 2546 if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent ) |
0 | 2547 { |
2548 v91 = rand() % 100; | |
237 | 2549 v92 = pMapInfo->EncM1percent; |
0 | 2550 v93 = v91 + 1; |
2551 if ( v93 > v92 ) | |
237 | 2552 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); |
0 | 2553 else |
978 | 2554 pNPCData4 = (NPCData *)1; |
1415 | 2555 if ( !_45063B_spawn_some_monster(pMapInfo, (int)pNPCData4) ) |
0 | 2556 pNPCData4 = 0; |
2557 if ( pNPCData4 ) | |
2558 { | |
2559 pPlayerNum = rand() % 4; | |
2560 LODWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
2561 HIDWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
2562 v95 = rand(); | |
2563 Rest(v95 % 6 + 60); | |
1396 | 2564 _506F18_num_minutes_to_sleep = 0; |
0 | 2565 dword_506F14 = 0; |
437 | 2566 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2567 { |
990 | 2568 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2569 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
2570 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2571 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2572 }*/ |
2573 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
916 | 2574 ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!" |
2575 pAudioPlayer->PlaySound((SoundID)227, 0, 0, -1, 0, 0, 0, 0); | |
2576 continue; | |
0 | 2577 } |
2578 } | |
2579 Party::TakeFood(uRestUI_FoodRequiredToRest); | |
1396 | 2580 _506F18_num_minutes_to_sleep = 480; |
0 | 2581 dword_506F14 = 2; |
2582 pParty->RestAndHeal(); | |
766 | 2583 pParty->days_played_without_rest = 0; |
1361
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
2584 pParty->pPlayers[3].SetAsleep(1); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
2585 pParty->pPlayers[2].SetAsleep(1); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
2586 pParty->pPlayers[1].SetAsleep(1); |
b3ac17fd12de
Moved condition checking to a separate class, extracted it from player::SetCondition
Grumpy7
parents:
1358
diff
changeset
|
2587 pParty->pPlayers[0].SetAsleep(1); |
0 | 2588 } |
4 | 2589 continue; |
151 | 2590 case UIMSG_AlreadyResting: |
0 | 2591 if ( dword_506F14 == 2 ) |
2592 { | |
916 | 2593 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" |
362 | 2594 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2595 continue; | |
0 | 2596 } |
962 | 2597 GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2, |
1268 | 2598 (int)pButton_RestUI_WaitUntilDawn, pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" |
758 | 2599 v97 = _494820_training_time(pParty->uCurrentHour); |
978 | 2600 dword_506F14 = 1; |
1396 | 2601 _506F18_num_minutes_to_sleep = 60 * v97 - pParty->uCurrentMinute; |
4 | 2602 continue; |
960 | 2603 case UIMSG_HintSelectRemoveQuickSpellBtn: |
688 | 2604 if ( quick_spell_at_page && byte_506550 ) |
2605 { | |
2606 v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2607 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[483], v173); |
0 | 2608 } |
2609 else | |
2610 { | |
2611 if ( pPlayers[uActiveCharacter]->uQuickSpell ) | |
2612 v177 = pGlobalTXT_LocalizationStrings[584];// "Click here to remove your Quick Spell" | |
2613 else | |
2614 v177 = pGlobalTXT_LocalizationStrings[484];// "Select a spell then click here to set a QuickSpell" | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2615 strcpy(pTmpBuf.data(), v177); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2616 } |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2617 GameUI_SetFooterString(pTmpBuf.data()); |
4 | 2618 continue; |
370 | 2619 case UIMSG_SPellbook_ShowHightlightedSpellInfo: |
4 | 2620 if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter], |
0 | 2621 !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402)) ) |
4 | 2622 continue; |
0 | 2623 if ( sub_4637E0_is_there_popup_onscreen() ) |
2624 dword_507B00_spell_info_to_draw_in_popup = uMessageParam + 1; | |
2625 v98 = *(char *)(uNumSeconds + 6734); | |
688 | 2626 if ( quick_spell_at_page - 1 == uMessageParam ) |
0 | 2627 { |
2628 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2629 v161 = pGlobalTXT_LocalizationStrings[485]; | |
2630 } | |
2631 else | |
2632 { | |
2633 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2634 v161 = pGlobalTXT_LocalizationStrings[486]; | |
2635 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2636 sprintfex(pTmpBuf.data(), v161, v178); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2637 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 2638 continue; |
960 | 2639 case UIMSG_ClickInstallRemoveQuickSpellBtn: |
962 | 2640 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0); |
0 | 2641 if ( !uActiveCharacter ) |
4 | 2642 continue; |
0 | 2643 pPlayer10 = pPlayers[uActiveCharacter]; |
688 | 2644 if ( !byte_506550 || !quick_spell_at_page ) |
0 | 2645 { |
2646 pPlayer10->uQuickSpell = 0; | |
688 | 2647 quick_spell_at_page = 0; |
916 | 2648 pAudioPlayer->PlaySound((SoundID)203, 0, 0, -1, 0, 0, 0, 0); |
2649 continue; | |
0 | 2650 } |
688 | 2651 v99 = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; |
0 | 2652 pPlayers[uActiveCharacter]->uQuickSpell = v99; |
1397 | 2653 stru_AA1058[uActiveCharacter - 1]._494836(v99, uActiveCharacter); |
0 | 2654 if ( uActiveCharacter ) |
187 | 2655 pPlayer10->PlaySound(SPEECH_12, 0); |
0 | 2656 byte_506550 = 0; |
4 | 2657 continue; |
1118 | 2658 case UIMSG_SpellBook_PressTab: |
2659 //__debugbreak(); | |
0 | 2660 if ( !uActiveCharacter ) |
4 | 2661 continue; |
0 | 2662 pPlayer3 = pPlayers[uActiveCharacter]; |
2663 pNPCData4 = 0; | |
2664 uAction = 0; | |
2665 v101 = 0; | |
2666 thisl = (int)&pPlayer3->pActiveSkills[12]; | |
2667 do | |
2668 { | |
2669 if ( *(short *)thisl ) | |
2670 { | |
198 | 2671 if ( pPlayer3->lastOpenedSpellbookPage == v101 ) |
0 | 2672 uAction = (int)pNPCData4; |
2673 v102 = (int)pNPCData4; | |
2674 pNPCData4 = (NPCData *)((char *)pNPCData4 + 1); | |
2675 v217[v102] = v101; | |
2676 } | |
2677 thisl += 2; | |
2678 ++v101; | |
2679 } | |
2680 while ( v101 < 9 ); | |
2681 if ( !pNPCData4 ) | |
11 | 2682 { |
2683 v127 = rand() % 2 + 204; | |
916 | 2684 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2685 continue; | |
11 | 2686 } |
0 | 2687 if ( GetAsyncKeyState(16) ) |
2688 { | |
2689 --uAction; | |
2690 if ( uAction < 0 ) | |
2691 uAction = (int)((char *)pNPCData4 - 1); | |
2692 } | |
2693 else | |
2694 { | |
2695 ++uAction; | |
2696 if ( uAction >= (signed int)pNPCData4 ) | |
2697 uAction = 0; | |
2698 } | |
1402 | 2699 OnCloseSpellBookPage(); |
198 | 2700 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); |
11 | 2701 pGUIWindow_CurrentMenu->OpenSpellBook(); |
2702 v127 = rand() % 2 + 204; | |
916 | 2703 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2704 continue; | |
832 | 2705 case UIMSG_OpenSpellbookPage: |
1340 | 2706 if ( pTurnEngine->turn_stage == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage ) |
4 | 2707 continue; |
1402 | 2708 OnCloseSpellBookPage(); |
198 | 2709 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; |
11 | 2710 pGUIWindow_CurrentMenu->OpenSpellBook(); |
0 | 2711 v127 = rand() % 2 + 204; |
916 | 2712 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2713 continue; | |
437 | 2714 case UIMSG_SelectSpell: |
2715 { | |
1340 | 2716 if (pTurnEngine->turn_stage == 3) |
437 | 2717 continue; |
2718 if (!uActiveCharacter) | |
2719 continue; | |
2720 | |
2721 // uNumSeconds = (unsigned int)pPlayers[uActiveCharacter]; | |
2722 auto player = pPlayers[uActiveCharacter]; | |
2723 if (player->spellbook.pChapters[player->lastOpenedSpellbookPage].bIsSpellAvailable[uMessageParam]) | |
2724 //if ( *(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + &lastOpenedSpellbookPage) + uMessageParam + 402) ) | |
2725 { | |
688 | 2726 if ( quick_spell_at_page - 1 == uMessageParam ) |
0 | 2727 { |
2728 pGUIWindow_CurrentMenu->Release(); | |
2729 pEventTimer->Resume(); | |
978 | 2730 viewparams->bRedrawGameUI = 1; |
151 | 2731 pCurrentScreen = SCREEN_GAME; |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
2732 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
688 | 2733 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; |
1000 | 2734 /*if ( dword_50C9E8 < 40 ) |
0 | 2735 { |
437 | 2736 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook; |
2737 dword_50C9EC[3 * dword_50C9E8 + 1] = v103; | |
2738 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1; | |
0 | 2739 ++dword_50C9E8; |
1000 | 2740 }*/ |
1012 | 2741 pMessageQueue_50C9E8->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); |
2742 // pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); | |
0 | 2743 } |
2744 else | |
2745 { | |
2746 byte_506550 = 1; | |
688 | 2747 quick_spell_at_page = uMessageParam + 1; |
0 | 2748 } |
437 | 2749 } |
2750 } | |
2751 continue; | |
370 | 2752 |
2753 case UIMSG_CastSpellFromBook: | |
1340 | 2754 if ( pTurnEngine->turn_stage != 3 ) |
370 | 2755 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0); |
2756 continue; | |
2757 | |
1019 | 2758 case UIMSG_SpellScrollUse: |
987 | 2759 __debugbreak(); |
1340 | 2760 if ( pTurnEngine->turn_stage != 3 ) |
978 | 2761 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0); |
4 | 2762 continue; |
907 | 2763 case UIMSG_SpellBookWindow: |
1340 | 2764 if ( pTurnEngine->turn_stage == 3 ) |
4 | 2765 continue; |
0 | 2766 if ( bUnderwater == 1 ) |
2767 { | |
362 | 2768 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" |
916 | 2769 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
0 | 2770 } |
2771 else | |
2772 { | |
2773 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2774 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2775 if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery ) | |
2776 { | |
2777 if ( !pCurrentScreen ) | |
2778 { | |
962 | 2779 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); |
151 | 2780 pCurrentScreen = SCREEN_SPELL_BOOK; |
0 | 2781 pEventTimer->Pause(); |
710 | 2782 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); |
0 | 2783 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); |
978 | 2784 viewparams->field_48 = 1; |
4 | 2785 continue; |
0 | 2786 } |
151 | 2787 if ( pCurrentScreen != SCREEN_REST |
2788 && pCurrentScreen != SCREEN_CHARACTERS | |
2789 && (pCurrentScreen <= SCREEN_63 | |
2790 || pCurrentScreen > SCREEN_67) ) | |
11 | 2791 { |
2792 pGUIWindow_CurrentMenu->Release(); | |
962 | 2793 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); |
151 | 2794 pCurrentScreen = SCREEN_SPELL_BOOK; |
11 | 2795 pEventTimer->Pause(); |
710 | 2796 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); |
11 | 2797 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); |
978 | 2798 viewparams->field_48 = 1; |
11 | 2799 continue; |
2800 } | |
2801 } | |
2802 } | |
2803 continue; | |
2804 case UIMSG_QuickReference: | |
0 | 2805 if ( pMessageQueue_50CBD0->uNumMessages ) |
2806 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2807 if ( pCurrentScreen ) | |
2808 pGUIWindow_CurrentMenu->Release(); | |
2809 ++pIcons_LOD->uTexturePacksCount; | |
2810 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2811 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
962 | 2812 GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0); |
978 | 2813 viewparams->bRedrawGameUI = 1; |
0 | 2814 pEventTimer->Pause(); |
2815 pAudioPlayer->StopChannels(-1, -1); | |
151 | 2816 pCurrentScreen = SCREEN_QUICK_REFERENCE; |
710 | 2817 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0); |
0 | 2818 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); |
978 | 2819 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 2820 pGlobalTXT_LocalizationStrings[79],// "Exit" |
973 | 2821 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179); |
4 | 2822 continue; |
358 | 2823 case UIMSG_GameMenuButton: |
0 | 2824 if ( pCurrentScreen ) |
2825 { | |
2826 pGUIWindow_CurrentMenu->Release(); | |
2827 pEventTimer->Resume(); | |
151 | 2828 pCurrentScreen = SCREEN_GAME; |
978 | 2829 viewparams->bRedrawGameUI = 1; |
0 | 2830 } |
2831 stru_506E40.Release(); | |
2832 uNumSeconds = (unsigned int)MakeScreenshot(155, 117); | |
2833 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); | |
2834 free((void *)uNumSeconds); | |
2835 stru_506E40._40E55E("gamma.pcx", 0); | |
962 | 2836 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton, (int)pBtn_GameSettings, 0); |
11 | 2837 //LABEL_453: |
437 | 2838 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
4 | 2839 continue; |
990 | 2840 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 2841 //goto LABEL_770; |
2842 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2843 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 2844 ++pMessageQueue_50CBD0->uNumMessages;*/ |
2845 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
11 | 2846 continue; |
1101
3e5d70cfe20e
Award order fix, changed UIMSG_C0 to UIMSG_ClickAwardScrollBar
Grumpy7
parents:
1091
diff
changeset
|
2847 case UIMSG_ClickAwardScrollBar: |
1446 | 2848 books_page_number = 1; |
0 | 2849 if ( pMouse->GetCursorPos(&v211)->y > 178 ) |
1446 | 2850 books_page_number = -1; |
4 | 2851 continue; |
961 | 2852 case UIMSG_ClickAwardsUpBtn: |
962 | 2853 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0); |
990 | 2854 BtnUp_flag = 1; |
4 | 2855 continue; |
961 | 2856 case UIMSG_ClickAwardsDownBtn: |
962 | 2857 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0); |
990 | 2858 BtnDown_flag = 1; |
4 | 2859 continue; |
910 | 2860 case UIMSG_ChangeDetaliz: |
978 | 2861 bRingsShownInCharScreen ^= 1; |
910 | 2862 pCharacterScreen_DetalizBtn->Release(); |
697 | 2863 pCharacterScreen_DollBtn->Release(); |
0 | 2864 if ( bRingsShownInCharScreen ) |
2865 { | |
973 | 2866 v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight; |
2867 v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth; | |
0 | 2868 v123 = 445; |
2869 v121 = 470; | |
2870 } | |
2871 else | |
2872 { | |
2873 v128 = 30; | |
2874 v125 = 30; | |
2875 v123 = 300; | |
2876 v121 = 600; | |
2877 } | |
978 | 2878 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0, |
0 | 2879 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" |
2880 0); | |
1025 | 2881 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); |
978 | 2882 viewparams->bRedrawGameUI = 1; |
910 | 2883 continue; |
2884 case UIMSG_ClickPaperdoll: | |
0 | 2885 OnPaperdollLeftClick(); |
4 | 2886 continue; |
960 | 2887 case UIMSG_ClickStatsBtn: |
0 | 2888 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; |
991 | 2889 CharacterUI_ReleaseButtons(); |
1458 | 2890 ReleaseAwardsScrollBar(); |
962 | 2891 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0); |
960 | 2892 continue; |
2893 case UIMSG_ClickSkillsBtn: | |
0 | 2894 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; |
991 | 2895 CharacterUI_ReleaseButtons(); |
1458 | 2896 ReleaseAwardsScrollBar(); |
991 | 2897 CharacterUI_SkillsTab_CreateButtons(); |
962 | 2898 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0); |
11 | 2899 continue; |
0 | 2900 case UIMSG_SkillUp: |
2901 pPlayer4 = pPlayers[uActiveCharacter]; | |
2902 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam]; | |
2903 LOWORD(v2) = *(short *)v105; | |
2904 uNumSeconds = v2; | |
2905 if ( pPlayer4->uSkillPoints < (v2 & 0x3F) + 1 ) | |
2906 { | |
2907 v87 = pGlobalTXT_LocalizationStrings[488];// "You don't have enough skill points!" | |
2908 } | |
2909 else | |
2910 { | |
2911 if ( (uNumSeconds & 0x3F) < 0x3C ) | |
2912 { | |
2913 *(short *)v105 = uNumSeconds + 1; | |
2914 pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F; | |
187 | 2915 pPlayer4->PlaySound(SPEECH_14, 0); |
916 | 2916 pAudioPlayer->PlaySound((SoundID)20001, 0, 0, -1, 0, 0, 0, 0); |
2917 continue; | |
0 | 2918 } |
2919 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!" | |
2920 } | |
916 | 2921 ShowStatusBarString(v87, 2); |
4 | 2922 continue; |
960 | 2923 case UIMSG_ClickInventoryBtn: |
0 | 2924 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; |
1458 | 2925 ReleaseAwardsScrollBar(); |
991 | 2926 CharacterUI_ReleaseButtons(); |
962 | 2927 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0); |
960 | 2928 continue; |
2929 case UIMSG_ClickExitCharacterWindowBtn: | |
2930 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0); | |
2931 continue; | |
2932 case UIMSG_ClickAwardsBtn: | |
1458 | 2933 ReleaseAwardsScrollBar(); |
991 | 2934 CharacterUI_ReleaseButtons(); |
1455 | 2935 CreateAwardsScrollBar(); |
0 | 2936 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; |
962 | 2937 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0); |
521 | 2938 FillAwardsData(); |
4 | 2939 continue; |
1000 | 2940 case UIMSG_ClickBooksBtn: |
0 | 2941 switch ( uMessageParam ) |
2942 { | |
990 | 2943 case 11://Page UP |
2944 BtnUp_flag = 1; | |
2945 pButton = pBtn_Book_2; | |
2946 break; | |
2947 case 10://Page DOWN | |
2948 BtnDown_flag = 1; | |
2949 pButton = pBtn_Book_1; | |
2950 break; | |
1000 | 2951 case 0://Zoom plus |
0 | 2952 pButton = pBtn_Book_1; |
990 | 2953 BtnDown_flag = 1; |
0 | 2954 break; |
1000 | 2955 case 1://Zoom minus |
2956 pButton = pBtn_Book_2; | |
990 | 2957 BtnUp_flag = 1; |
0 | 2958 break; |
990 | 2959 case 2://Potions |
2960 Book_PageBtn3_flag = 1; | |
0 | 2961 if ( dword_506364 ) |
4 | 2962 continue; |
0 | 2963 pButton = pBtn_Book_3; |
2964 break; | |
990 | 2965 case 3://fountains |
2966 Book_PageBtn4_flag = 1; | |
0 | 2967 if ( dword_506364 ) |
4 | 2968 continue; |
0 | 2969 pButton = pBtn_Book_4; |
2970 break; | |
990 | 2971 case 4://obelisks |
2972 Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag | |
0 | 2973 if ( dword_506364 ) |
4 | 2974 continue; |
0 | 2975 pButton = pBtn_Book_5; |
2976 break; | |
990 | 2977 case 5://seer |
2978 Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag | |
0 | 2979 if ( dword_506364 ) |
4 | 2980 continue; |
0 | 2981 pButton = pBtn_Book_6; |
2982 break; | |
990 | 2983 case 6://misc |
0 | 2984 pButton = pBtn_Autonotes_Misc; |
990 | 2985 Autonotes_Misc_page_flag = 1; |
0 | 2986 break; |
990 | 2987 case 7://Instructors |
0 | 2988 pButton = pBtn_Autonotes_Instructors; |
990 | 2989 Autonotes_Instructors_page_flag = 1; |
0 | 2990 break; |
990 | 2991 default: |
2992 continue; | |
0 | 2993 } |
1268 | 2994 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); |
11 | 2995 continue; |
0 | 2996 case UIMSG_SelectCharacter: |
2997 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2998 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2999 GameUI_OnPlayerPortraitLeftClick(uMessageParam); | |
4 | 3000 continue; |
0 | 3001 case UIMSG_ShowStatus_Funds: |
3002 v174 = (char *)pParty->uNumGoldInBank; | |
1430 | 3003 //v158 = pParty->uNumGold + pParty->uNumGoldInBank; |
3004 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], pParty->uNumGold + pParty->uNumGoldInBank, v174);// "You have %d total gold, %d in the Bank" | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3005 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 3006 continue; |
0 | 3007 case UIMSG_ShowStatus_DateTime: |
3008 pNPCData4 = (NPCData *)pParty->uCurrentHour; | |
3009 if ( (signed int)pParty->uCurrentHour <= 12 ) | |
3010 { | |
3011 if ( !pNPCData4 ) | |
3012 pNPCData4 = (NPCData *)12; | |
3013 } | |
3014 else | |
3015 { | |
3016 pNPCData4 = (NPCData *)((char *)pNPCData4 - 12); | |
3017 } | |
978 | 3018 if ( pParty->uCurrentHour < 0xC || (uNumSeconds = 1, pParty->uCurrentHour >= 0x18) ) |
0 | 3019 uNumSeconds = 0; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3020 sprintf(pTmpBuf.data(), "%d:%02d%s %s %d %s %d", pNPCData4, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7], |
0 | 3021 7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3022 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 3023 continue; |
0 | 3024 case UIMSG_ShowStatus_Food: |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3025 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food" |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3026 GameUI_SetFooterString(pTmpBuf.data()); |
306 | 3027 continue; |
0 | 3028 case UIMSG_ShowStatus_Player: |
3029 pPlayer5 = pPlayers[uMessageParam]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3030 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s" |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3031 strcat(pTmpBuf.data(), ": "); |
0 | 3032 v107 = pPlayer5->GetMajorConditionIdx(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3033 strcat(pTmpBuf.data(), aCharacterConditionNames[v107]); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3034 GameUI_SetFooterString(pTmpBuf.data()); |
0 | 3035 v108 = 8 * uMessageParam - 8; |
3036 LOBYTE(v108) = v108 | 4; | |
888 | 3037 pMouse->uPointingObjectID = PID(OBJECT_Player,v108); |
4 | 3038 continue; |
0 | 3039 case UIMSG_ShowStatus_ManaHP: |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3040 sprintf(pTmpBuf.data(), "%d / %d %s %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(), |
1000 | 3041 pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(), |
3042 pGlobalTXT_LocalizationStrings[212]); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3043 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 3044 continue; |
987 | 3045 case UIMSG_CHEST_ClickItem: |
3046 if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) | |
3047 { | |
1683 | 3048 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); |
11 | 3049 continue; |
3050 } | |
987 | 3051 OnChestLeftClick(); |
4 | 3052 continue; |
151 | 3053 case UIMSG_InventoryLeftClick: |
1685
2a309997c42f
Player::StealFromShop started cleanup, fixing a few errors caused by not commiting everything
Grumpy7
parents:
1683
diff
changeset
|
3054 pPlayers[uActiveCharacter]->OnInventoryLeftClick(); |
4 | 3055 continue; |
960 | 3056 case UIMSG_MouseLeftClickInGame: |
0 | 3057 if ( !pRenderer->pRenderD3D ) |
11 | 3058 { |
3059 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3060 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3061 OnGameViewportClick(); | |
3062 continue; | |
3063 } | |
0 | 3064 v115 = pMessageQueue_50CBD0->uNumMessages; |
3065 if ( !pMessageQueue_50CBD0->uNumMessages ) | |
11 | 3066 { |
990 | 3067 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3068 /*if ( (signed int)v115 < 40 ) |
11 | 3069 //goto LABEL_769; |
3070 { | |
990 | 3071 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
11 | 3072 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
3073 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3074 ++pMessageQueue_50CBD0->uNumMessages; | |
3075 continue; | |
437 | 3076 }*/ |
11 | 3077 continue; |
3078 } | |
0 | 3079 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
3080 { | |
978 | 3081 pMessageQueue_50CBD0->uNumMessages = 1; |
990 | 3082 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3083 /*v115 = v0; |
0 | 3084 pMessageQueue_50CBD0->uNumMessages = v0; |
990 | 3085 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
0 | 3086 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
11 | 3087 //goto LABEL_771; |
3088 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 3089 ++pMessageQueue_50CBD0->uNumMessages;*/ |
11 | 3090 continue; |
0 | 3091 } |
3092 v115 = 0; | |
3093 pMessageQueue_50CBD0->uNumMessages = 0; | |
990 | 3094 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3095 /*if ( (signed int)v115 < 40 ) |
11 | 3096 //goto LABEL_769; |
3097 { | |
990 | 3098 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
11 | 3099 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
3100 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3101 ++pMessageQueue_50CBD0->uNumMessages; | |
3102 continue; | |
437 | 3103 }*/ |
4 | 3104 continue; |
990 | 3105 case UIMSG_MouseLeftClickInScreen://ñðàáàòûâàåò ïðè íàæàòèè íà ïðàâóþ êíîïêó ìûøè ïîñëå UIMSG_MouseLeftClickInGame |
0 | 3106 if ( pMessageQueue_50CBD0->uNumMessages ) |
3107 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3108 OnGameViewportClick(); | |
4 | 3109 continue; |
151 | 3110 case UIMSG_F: |
987 | 3111 __debugbreak(); |
0 | 3112 if ( pRenderer->pRenderD3D ) |
3113 { | |
3114 LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
3115 } | |
3116 else | |
3117 { | |
3118 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209); | |
3119 pPoint3 = pMouse->GetCursorPos(&v204); | |
3120 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]]; | |
3121 } | |
3122 pButton2 = (GUIButton *)(unsigned __int16)v116; | |
960 | 3123 GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0); |
11 | 3124 continue; |
151 | 3125 case UIMSG_54: |
987 | 3126 __debugbreak(); |
0 | 3127 pButton2 = (GUIButton *)uMessageParam; |
990 | 3128 GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0); |
4 | 3129 continue; |
201 | 3130 case UIMSG_Game_Action: |
0 | 3131 if ( pMessageQueue_50CBD0->uNumMessages ) |
3132 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3133 OnPressSpace(); | |
4 | 3134 continue; |
960 | 3135 case UIMSG_ClickZoomOutBtn: |
0 | 3136 if ( pCurrentScreen ) |
4 | 3137 continue; |
0 | 3138 pParty->uFlags |= 2u; |
1000 | 3139 GUIWindow::Create(519, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomOut, 0); |
0 | 3140 uNumSeconds = 131072; |
3141 v118 = 2 * viewparams->uMinimapZoom; | |
3142 ++viewparams->field_28; | |
3143 viewparams->uMinimapZoom *= 2; | |
3144 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
3145 { | |
3146 if ( (signed int)v118 > 4096 ) | |
3147 { | |
3148 viewparams->uMinimapZoom = 4096; | |
3149 viewparams->field_28 = 12; | |
3150 } | |
4 | 3151 continue; |
0 | 3152 } |
3153 v119 = 2048; | |
3154 if ( (signed int)v118 <= 2048 ) | |
960 | 3155 { |
1051 | 3156 _576E2C_current_minimap_zoom = v118; |
960 | 3157 dword_576E28 = viewparams->field_28; |
3158 break; | |
3159 } | |
0 | 3160 viewparams->field_28 = 11; |
960 | 3161 viewparams->uMinimapZoom = v119; |
1051 | 3162 _576E2C_current_minimap_zoom = v119; |
960 | 3163 dword_576E28 = viewparams->field_28; |
3164 break; | |
3165 case UIMSG_ClickZoomInBtn: | |
0 | 3166 if ( pCurrentScreen ) |
4 | 3167 continue; |
0 | 3168 pParty->uFlags |= 2u; |
1000 | 3169 GUIWindow::Create(574, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomIn, 0); |
0 | 3170 uNumSeconds = 32768; |
3171 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
3172 --viewparams->field_28; | |
3173 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
3174 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3175 { | |
3176 v119 = 512; | |
3177 if ( (signed int)v118 < 512 ) | |
3178 { | |
3179 viewparams->field_28 = 9; | |
3180 v118 = v119; | |
3181 viewparams->uMinimapZoom = v119; | |
3182 } | |
1051 | 3183 _576E2C_current_minimap_zoom = v118; |
0 | 3184 dword_576E28 = viewparams->field_28; |
3185 } | |
3186 else | |
3187 { | |
3188 if ( (signed int)v118 < 256 ) | |
3189 { | |
3190 viewparams->uMinimapZoom = 256; | |
3191 viewparams->field_28 = 8; | |
3192 } | |
3193 } | |
4 | 3194 default: |
3195 continue; | |
0 | 3196 } |
3197 } | |
3198 } | |
1012 | 3199 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8; |
3200 memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages); | |
3201 //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8); | |
3202 //dword_50C9E8 = 0; | |
3203 | |
3204 | |
3205 pMessageQueue_50C9E8->uNumMessages=0; | |
0 | 3206 if ( dword_50C9DC ) |
3207 { | |
437 | 3208 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 3209 { |
3210 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC; | |
3211 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = (int)ptr_50C9E0; | |
3212 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3213 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 3214 }*/ |
3215 pMessageQueue_50CBD0->AddMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0); | |
0 | 3216 dword_50C9DC = 0; |
3217 } | |
3218 else | |
3219 { | |
1682 | 3220 if ( _50C9D0_AfterEnchClickEventId > 0 ) |
0 | 3221 { |
1682 | 3222 _50C9D8_AfterEnchClickEventTimeout -= pEventTimer->uTimeElapsed; |
3223 if ( _50C9D8_AfterEnchClickEventTimeout <= 0 ) | |
0 | 3224 { |
437 | 3225 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 3226 { |
3227 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9D0; | |
3228 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = dword_50C9D4; | |
3229 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3230 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 3231 }*/ |
1682 | 3232 pMessageQueue_50CBD0->AddMessage((UIMessageType)_50C9D0_AfterEnchClickEventId, _50C9D4_AfterEnchClickEventSecondParam, 0); |
3233 _50C9D0_AfterEnchClickEventId = 0; | |
3234 _50C9D4_AfterEnchClickEventSecondParam = 0; | |
3235 _50C9D8_AfterEnchClickEventTimeout = 0; | |
0 | 3236 } |
3237 } | |
3238 } | |
1517 | 3239 CastSpellInfoHelpers::_427E01_cast_spell(); |
0 | 3240 } |
3241 | |
3242 //----- (004356FF) -------------------------------------------------------- | |
1575 | 3243 void back_to_game() |
0 | 3244 { |
3245 dword_507BF0_is_there_popup_onscreen = 0; | |
3246 dword_4E455C = 1; | |
1575 | 3247 |
3248 extern int no_rightlick_in_inventory; | |
3249 no_rightlick_in_inventory = false; | |
3250 | |
0 | 3251 if ( pGUIWindow_ScrollWindow ) |
3252 free_book_subwindow(); | |
3253 if ( !pCurrentScreen && !pGUIWindow_Settings ) | |
3254 pEventTimer->Resume(); | |
3255 viewparams->bRedrawGameUI = 1; | |
3256 } | |
782 | 3257 |
0 | 3258 //----- (00435748) -------------------------------------------------------- |
1458 | 3259 void GUI_MainMenuMessageProc() |
0 | 3260 { |
967 | 3261 Player *pPlayer; // ebx@2 |
0 | 3262 void *v3; // edi@21 |
3263 signed int v4; // eax@29 | |
3264 int v5; // ecx@29 | |
821 | 3265 PLAYER_SKILL_TYPE v6; // edi@37 |
0 | 3266 GUIWindow *pWindow; // eax@56 |
3267 GUIButton *pButton; // eax@59 | |
3268 int v15; // edi@70 | |
3269 char v20; // dl@116 | |
3270 unsigned int v21; // eax@116 | |
3271 unsigned int v25; // eax@120 | |
3272 unsigned int v26; // ecx@127 | |
3273 SoundID pSoundID; // [sp-2Ch] [bp-3Ch]@36 | |
3274 signed int v41; // [sp-10h] [bp-20h]@29 | |
971 | 3275 int pParam; // [sp+4h] [bp-Ch]@3 |
0 | 3276 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3 |
967 | 3277 int pSex; // [sp+Ch] [bp-4h]@3 |
0 | 3278 |
3279 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3280 { | |
2 | 3281 pPlayer = pParty->pPlayers; |
0 | 3282 do |
3283 { | |
187 | 3284 int param2; |
971 | 3285 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, ¶m2); |
3286 auto player = &pParty->pPlayers[pParam]; | |
187 | 3287 |
3 | 3288 switch (pUIMessageType) // For buttons of window MainMenu |
2 | 3289 { |
165 | 3290 case UIMSG_MainMenu_ShowPartyCreationWnd: |
962 | 3291 GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); |
0 | 3292 SetCurrentMenuID(MENU_NEWGAME); |
960 | 3293 break; |
165 | 3294 case UIMSG_MainMenu_ShowLoadWindow: |
962 | 3295 GUIWindow::Create(495, 227, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnLoad, 0); |
0 | 3296 SetCurrentMenuID(MENU_SAVELOAD); |
960 | 3297 break; |
165 | 3298 case UIMSG_ShowCredits: |
962 | 3299 GUIWindow::Create(495, 282, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnCredits, 0); |
0 | 3300 SetCurrentMenuID(MENU_CREDITS); |
960 | 3301 break; |
165 | 3302 case UIMSG_ExitToWindows: |
962 | 3303 GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); |
982 | 3304 SetCurrentMenuID(MENU_EXIT_GAME); |
960 | 3305 break; |
187 | 3306 case UIMSG_PlayerCreation_SelectAttribute: |
960 | 3307 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3308 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
3309 uPlayerCreationUI_SelectedCharacter = pParam; | |
960 | 3310 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3311 break; | |
187 | 3312 case UIMSG_PlayerCreation_VoicePrev: |
967 | 3313 pSex = player->GetSexByVoice(); |
960 | 3314 do |
3315 { | |
3316 if (player->uVoiceID == 0) | |
3317 player->uVoiceID = 19; | |
3318 else --player->uVoiceID; | |
3319 } | |
967 | 3320 while (player->GetSexByVoice() != pSex); |
971 | 3321 pButton = pCreationUI_BtnPressLeft2[pParam]; |
1268 | 3322 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); |
960 | 3323 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3324 player->PlaySound(SPEECH_PickMe, 0); | |
3325 break; | |
187 | 3326 case UIMSG_PlayerCreation_VoiceNext: |
967 | 3327 pSex = player->GetSexByVoice(); |
3328 do | |
3329 { | |
3330 player->uVoiceID = (player->uVoiceID + 1) % 20; | |
3331 } | |
3332 while (player->GetSexByVoice() != pSex); | |
971 | 3333 pButton = pCreationUI_BtnPressRight2[pParam]; |
1268 | 3334 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); |
967 | 3335 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3336 player->PlaySound(SPEECH_PickMe, 0); | |
3337 break; | |
187 | 3338 case UIMSG_PlayerCreation_FacePrev: |
971 | 3339 pPlayer = &pParty->pPlayers[pParam]; |
1014 | 3340 if (!pPlayer->uCurrentFace) |
3341 pPlayer->uCurrentFace = 19; | |
960 | 3342 else |
1014 | 3343 pPlayer->uCurrentFace -= 1; |
3344 pPlayer->uVoiceID = pPlayer->uCurrentFace; | |
960 | 3345 pPlayer->SetInitialStats(); |
3346 pPlayer->SetSexByVoice(); | |
3347 pPlayer->RandomizeName(); | |
971 | 3348 v25 = pParam; |
960 | 3349 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3350 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3351 uPlayerCreationUI_SelectedCharacter = v25; |
1268 | 3352 GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], (char *)1); |
960 | 3353 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); |
3354 pPlayer->PlaySound(SPEECH_PickMe, 0); | |
3355 break; | |
187 | 3356 case UIMSG_PlayerCreation_FaceNext: |
971 | 3357 pPlayer = &pParty->pPlayers[pParam]; |
1014 | 3358 v20 = (char)((int)pPlayer->uCurrentFace + 1) % 20; |
3359 pPlayer->uCurrentFace = v20; | |
960 | 3360 pPlayer->uVoiceID = v20; |
3361 pPlayer->SetInitialStats(); | |
3362 pPlayer->SetSexByVoice(); | |
3363 pPlayer->RandomizeName(); | |
971 | 3364 v21 = pParam; |
960 | 3365 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3366 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3367 uPlayerCreationUI_SelectedCharacter = v21; |
1268 | 3368 GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], (char *)1); |
960 | 3369 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3370 pPlayer->PlaySound(SPEECH_PickMe, 0); | |
3371 break; | |
3372 case UIMSG_PlayerCreationClickPlus: | |
1268 | 3373 GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, (char *)1); |
960 | 3374 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
3375 pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); | |
3376 break; | |
3377 case UIMSG_PlayerCreationClickMinus: | |
1268 | 3378 GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, (char *)1); |
960 | 3379 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
3380 pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); | |
3381 break; | |
3382 case UIMSG_PlayerCreationSelectActiveSkill: | |
967 | 3383 pPlayer = &pPlayer[uPlayerCreationUI_SelectedCharacter]; |
971 | 3384 v6 = pPlayer->GetSkillIdxByOrder(pParam + 4); |
967 | 3385 if ( pPlayer->GetSkillIdxByOrder(3) == 37 ) |
3386 pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1; | |
3387 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); | |
3388 break; | |
960 | 3389 case UIMSG_PlayerCreationSelectClass: |
971 | 3390 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam); |
960 | 3391 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3392 break; | |
3393 case UIMSG_PlayerCreationClickOK: | |
962 | 3394 GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0); |
1459 | 3395 if ( PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Choose4Skills() ) |
960 | 3396 GameUI_Footer_TimeLeft = GetTickCount() + 4000; |
3397 else | |
982 | 3398 uGameState = GAME_STATE_STARTING_NEW_GAME; |
960 | 3399 break; |
3400 case UIMSG_PlayerCreationClickReset: | |
962 | 3401 GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0); |
960 | 3402 pParty->Reset(); |
3403 break; | |
3404 case UIMSG_PlayerCreationRemoveUpSkill: | |
971 | 3405 uPlayerCreationUI_SelectedCharacter = pParam; |
960 | 3406 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; |
3407 //int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; | |
3408 v41 = 2; | |
971 | 3409 v5 = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3410 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; |
3411 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) | |
3412 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; | |
3413 break; | |
3414 case UIMSG_PlayerCreationChangeName: | |
3415 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); | |
971 | 3416 v3 = (void *)pParam; |
3417 uPlayerCreationUI_SelectedCharacter = pParam; | |
960 | 3418 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu); |
3419 pGUIWindow_CurrentMenu->ptr_1C = v3; | |
3420 break; | |
3421 case UIMSG_ChangeGameState: | |
978 | 3422 uGameState = GAME_FINISHED; |
960 | 3423 break; |
1412 | 3424 case UIMSG_ChangeCursor: |
960 | 3425 pMouse->SetCursorBitmap("MICON2"); |
3426 break; | |
3427 case UIMSG_3A: | |
1458 | 3428 SetCurrentMenuID(MENU_DebugBLVLevel); |
960 | 3429 break; |
165 | 3430 case UIMSG_LoadGame: |
0 | 3431 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) |
960 | 3432 break; |
961 | 3433 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
960 | 3434 break; |
165 | 3435 case UIMSG_SelectLoadSlot: |
0 | 3436 //main menu save/load wnd clicking on savegame lines |
1038 | 3437 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
3438 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
971 | 3439 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition ) |
0 | 3440 { |
3441 //load clicked line | |
971 | 3442 v26 = pParam + pSaveListPosition; |
3443 if ( dword_6BE138 == pParam + pSaveListPosition ) | |
0 | 3444 { |
961 | 3445 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); |
437 | 3446 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); |
0 | 3447 } |
3448 uLoadGameUI_SelectedSlot = v26; | |
3449 dword_6BE138 = v26; | |
3450 } | |
3451 else | |
3452 { | |
3453 //typing in the line | |
3 | 3454 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); |
0 | 3455 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); |
3456 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); | |
3457 } | |
960 | 3458 break; |
961 | 3459 case UIMSG_SaveLoadBtn: |
3460 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); | |
960 | 3461 break; |
165 | 3462 case UIMSG_DownArrow: |
3 | 3463 ++pSaveListPosition; |
971 | 3464 if ( pSaveListPosition >= pParam ) |
3465 pSaveListPosition = pParam - 1; | |
3 | 3466 if ( pSaveListPosition < 1 ) |
3467 pSaveListPosition = 0; | |
3468 pWindow = pGUIWindow_CurrentMenu; | |
962 | 3469 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_PressedButton2, (int)pBtnDownArrow, 0); |
960 | 3470 break; |
165 | 3471 case UIMSG_Cancel: |
960 | 3472 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0); |
3473 break; | |
165 | 3474 case UIMSG_ArrowUp: |
3 | 3475 --pSaveListPosition; |
3476 if ( pSaveListPosition < 0 ) | |
3477 pSaveListPosition = 0; | |
3478 pWindow = pGUIWindow_CurrentMenu; | |
962 | 3479 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_PressedButton2, (int)pBtnArrowUp, 0); |
960 | 3480 break; |
3481 case UIMSG_AD: | |
962 | 3482 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); |
961 | 3483 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
960 | 3484 break; |
3485 case UIMSG_AE: | |
962 | 3486 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); |
1458 | 3487 SetCurrentMenuID(MENU_DebugBLVLevel); |
960 | 3488 break; |
3489 case UIMSG_Escape: | |
1458 | 3490 if ( pModalWindow ) |
0 | 3491 { |
1458 | 3492 ModalWindow_Release(); |
960 | 3493 break; |
0 | 3494 } |
3495 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) ) | |
960 | 3496 break; |
0 | 3497 v15 = 1; |
3498 pVideoPlayer->bStopBeforeSchedule = 1; | |
3499 viewparams->bRedrawGameUI = 1; | |
3500 viewparams->field_48 = 1; | |
165 | 3501 if ( !GetCurrentMenuID() || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC ) |
3502 { | |
3503 if ( pCurrentScreen == SCREEN_VIDEO ) | |
3504 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
3505 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
3506 { | |
3507 SetCurrentMenuID(MENU_CREATEPARTY); | |
960 | 3508 break; |
0 | 3509 } |
165 | 3510 if (GetCurrentMenuID() == MENU_CREDITSPROC) |
3511 { | |
3512 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
960 | 3513 break; |
0 | 3514 } |
437 | 3515 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); |
960 | 3516 break; |
0 | 3517 } |
971 | 3518 if ( GetCurrentMenuID() == MENU_CREDITSPROC && !pCurrentScreen ) |
3519 { | |
3520 if ( pCurrentScreen == SCREEN_VIDEO ) | |
3521 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
3522 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
3523 { | |
3524 SetCurrentMenuID(MENU_CREATEPARTY); | |
3525 break; | |
3526 } | |
3527 if (GetCurrentMenuID() == MENU_CREDITSPROC) | |
3528 { | |
3529 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
3530 break; | |
3531 } | |
3532 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); | |
3533 break; | |
3534 } | |
151 | 3535 if ( pCurrentScreen == SCREEN_LOADGAME ) |
0 | 3536 { |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
3537 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 3538 //crt_deconstruct_ptr_6A0118(); |
3539 pTexture_PCX.Release(); | |
3540 pTexture_PCX.Load("title.pcx", 0); | |
3541 SetCurrentMenuID(MENU_MAIN); | |
3542 v15 = 1; | |
3543 pGUIWindow_CurrentMenu->Release(); | |
3544 pGUIWindow2->Release(); | |
3545 pGUIWindow2 = 0; | |
3546 pEventTimer->Resume(); | |
151 | 3547 pCurrentScreen = SCREEN_GAME; |
0 | 3548 viewparams->bRedrawGameUI = v15; |
960 | 3549 break; |
0 | 3550 } |
151 | 3551 if ( pCurrentScreen == SCREEN_VIDEO ) |
0 | 3552 { |
3553 pVideoPlayer->Unload(); | |
3554 } | |
3555 else | |
3556 { | |
151 | 3557 if ( pCurrentScreen != SCREEN_1B ) |
2 | 3558 { |
3559 pGUIWindow_CurrentMenu->Release(); | |
3560 pGUIWindow2->Release(); | |
3561 pGUIWindow2 = 0; | |
3562 pEventTimer->Resume(); | |
151 | 3563 pCurrentScreen = SCREEN_GAME; |
2 | 3564 viewparams->bRedrawGameUI = v15; |
960 | 3565 break; |
2 | 3566 } |
0 | 3567 //VideoPlayer::dtor(); |
3568 } | |
960 | 3569 break; |
3570 case UIMSG_PlayerCreationRemoveDownSkill: | |
971 | 3571 uPlayerCreationUI_SelectedCharacter = pParam; |
1677 | 3572 //__debugbreak(); |
165 | 3573 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 |
971 | 3574 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
165 | 3575 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3) |
0 | 3576 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; |
960 | 3577 break; |
3578 default: | |
3579 break; | |
0 | 3580 } |
3581 } | |
3582 while ( pMessageQueue_50CBD0->uNumMessages ); | |
3583 } | |
3584 } | |
3585 | |
3586 //----- (0043648F) -------------------------------------------------------- | |
3587 void Vec3_short__to_RenderVertexSoft(RenderVertexSoft *_this, Vec3_short_ *a2) | |
3588 { | |
3589 _this->flt_2C = 0.0; | |
3590 | |
3591 _this->vWorldPosition.x = a2->x; | |
3592 _this->vWorldPosition.y = a2->y; | |
3593 _this->vWorldPosition.z = a2->z; | |
3594 } | |
3595 | |
3596 //----- (004369DB) -------------------------------------------------------- | |
3597 void Vec3_float_::Normalize() | |
3598 { | |
1025 | 3599 this->x = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->x; |
3600 this->y = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->y; | |
3601 this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z; | |
0 | 3602 } |
3603 | |
3604 //----- (00438F8F) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1384
diff
changeset
|
3605 void area_of_effect__damage_evaluate() |
0 | 3606 { |
3607 int v0; // edx@1 | |
3608 char *v1; // esi@2 | |
3609 int v2; // ecx@3 | |
3610 signed int v3; // eax@3 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
3611 SpriteObject *v4; // eax@4 |
0 | 3612 signed int v5; // eax@4 |
3613 signed int v6; // eax@6 | |
3614 unsigned int v7; // edi@6 | |
3615 int v8; // eax@6 | |
3616 __int16 v9; // bx@8 | |
3617 int v10; // edi@8 | |
3618 Vec3_int_ v11; // ST04_12@9 | |
3619 int v12; // ST0C_4@10 | |
3620 Actor *v13; // edi@11 | |
3621 int v14; // edx@15 | |
3622 int v15; // edx@15 | |
3623 int v16; // ebx@15 | |
3624 signed int v17; // eax@15 | |
3625 int v18; // edi@15 | |
3626 int v19; // edi@15 | |
3627 Vec3_int_ v20; // ST04_12@16 | |
3628 Vec3_int_ *v21; // eax@17 | |
3629 unsigned int v22; // edx@17 | |
3630 int v23; // edx@18 | |
3631 int v24; // eax@18 | |
3632 Vec3_int_ v25; // ST04_12@19 | |
3633 unsigned int v26; // ebx@20 | |
89 | 3634 Player *v27; // edi@20 |
90 | 3635 Actor *v28; // edi@27 |
0 | 3636 int v29; // ebx@29 |
3637 int v30; // eax@29 | |
3638 int v31; // edx@29 | |
3639 int v32; // eax@29 | |
3640 int v33; // ST24_4@29 | |
3641 Vec3_int_ v34; // ST04_12@30 | |
3642 Vec3_int_ *v35; // eax@31 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
3643 SpriteObject *v36; // [sp+0h] [bp-28h]@0 |
0 | 3644 signed int v37; // [sp+4h] [bp-24h]@5 |
3645 int v38; // [sp+4h] [bp-24h]@15 | |
3646 signed int v39; // [sp+8h] [bp-20h]@3 | |
3647 int v40; // [sp+8h] [bp-20h]@15 | |
3648 int v41; // [sp+Ch] [bp-1Ch]@5 | |
3649 int v42; // [sp+Ch] [bp-1Ch]@15 | |
3650 int v43; // [sp+10h] [bp-18h]@1 | |
3651 int v44; // [sp+14h] [bp-14h]@15 | |
3652 unsigned int uActorID; // [sp+18h] [bp-10h]@6 | |
3653 Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 | |
3654 int a1; // [sp+20h] [bp-8h]@8 | |
3655 int v48; // [sp+24h] [bp-4h]@8 | |
3656 | |
3657 v0 = 0; | |
3658 v43 = 0; | |
3659 if ( stru_50FE08.count > 0 ) | |
3660 { | |
3661 pVelocity = &stru_50FE08.vec_4B4; | |
3662 v1 = (char *)stru_50FE08.pZs; | |
3663 do | |
3664 { | |
848 | 3665 v2 = PID_TYPE(*((short *)v1 - 300)); |
3666 v3 = PID_ID((signed int)*((short *)v1 - 300)); | |
3667 v39 = PID_ID((signed int)*((short *)v1 - 300)); | |
0 | 3668 if ( v2 == 2 ) |
3669 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
3670 v4 = &pSpriteObjects[v3]; |
0 | 3671 v36 = v4; |
822 | 3672 v5 = v4->spell_caster_pid; |
848 | 3673 v2 = PID_TYPE(v5); |
3674 v3 = PID_ID(v5); | |
0 | 3675 } |
3676 v41 = v2; | |
3677 v37 = v3; | |
3678 if ( stru_50FE08.field_3EC[v0] & 1 ) | |
3679 { | |
417 | 3680 v6 = ai_near_actors_targets_pid[v3]; |
848 | 3681 v7 = PID_ID(v6); |
3682 v8 = PID_TYPE(v6) - 3; | |
0 | 3683 uActorID = v7; |
3684 if ( v8 ) | |
3685 { | |
3686 if ( v8 == 1 ) | |
3687 { | |
3688 v9 = *(short *)v1; | |
3689 v10 = pParty->vPosition.y - *((short *)v1 - 100); | |
3690 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
3691 v48 = v10; | |
3692 if ( a1 * a1 | |
3693 + v10 * v10 | |
3694 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) | |
3695 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
3696 { | |
3697 v11.z = *(short *)v1; | |
3698 v11.y = *((short *)v1 - 100); | |
3699 v11.x = *((short *)v1 - 200); | |
3700 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v11) ) | |
3701 { | |
3702 v12 = stru_50C198.which_player_would_attack(&pActors[v39]); | |
3703 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v12); | |
3704 } | |
3705 } | |
3706 } | |
3707 } | |
3708 else | |
3709 { | |
3710 v13 = &pActors[v7]; | |
3711 if ( SHIDWORD(v13->pActorBuffs[6].uExpireTime) > 0 | |
3712 || SHIDWORD(v13->pActorBuffs[6].uExpireTime) >= 0 && LODWORD(v13->pActorBuffs[6].uExpireTime) | |
3713 || v13->CanAct() ) | |
3714 { | |
3715 v14 = v13->vPosition.y; | |
3716 v40 = v13->vPosition.x; | |
3717 v38 = v14; | |
3718 v15 = v14 - *((short *)v1 - 100); | |
3719 v16 = *(short *)v1; | |
3720 v42 = v13->vPosition.z; | |
3721 a1 = v40 - *((short *)v1 - 200); | |
3722 v17 = v13->uActorHeight; | |
3723 v18 = v13->uActorRadius; | |
3724 v44 = v42; | |
3725 v19 = *((short *)v1 + 100) + v18; | |
3726 v48 = v15; | |
3727 if ( a1 * a1 + v15 * v15 + (v42 + (v17 >> 1) - v16) * (v42 + (v17 >> 1) - v16) < (unsigned int)(v19 * v19) ) | |
3728 { | |
3729 v20.z = *(short *)v1; | |
3730 v20.y = *((short *)v1 - 100); | |
3731 v20.x = *((short *)v1 - 200); | |
3732 if ( sub_407A1C(v40, v38, v42 + 50, v20) ) | |
3733 { | |
3734 Vec3_int_::Normalize(&a1, &v48, &v44); | |
3735 v21 = pVelocity; | |
3736 v22 = uActorID; | |
3737 pVelocity->x = a1; | |
3738 v21->y = v48; | |
3739 v21->z = v44; | |
3740 sub_43B1B0(*((short *)v1 - 300), v22, v21, stru_50FE08.field_450[v43]); | |
3741 } | |
3742 } | |
3743 } | |
3744 } | |
3745 } | |
3746 else | |
3747 { | |
3748 v23 = pParty->vPosition.y - *((short *)v1 - 100); | |
3749 v24 = ((signed int)pParty->uPartyHeight >> 1) - *(short *)v1; | |
3750 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
3751 v48 = v23; | |
3752 if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
3753 { | |
3754 v25.z = *(short *)v1; | |
3755 v25.y = *((short *)v1 - 100); | |
3756 v25.x = *((short *)v1 - 200); | |
3757 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v25) ) | |
3758 { | |
3759 v26 = 0; | |
89 | 3760 v27 = pParty->pPlayers;//[0].pConditions[15]; |
0 | 3761 do |
3762 { | |
89 | 3763 if ( !(HIDWORD(v27->pConditions[14]) | LODWORD(v27->pConditions[14])) && !v27->pConditions[15] && !v27->pConditions[16] ) |
0 | 3764 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v26); |
89 | 3765 ++v27; |
0 | 3766 ++v26; |
3767 } | |
89 | 3768 while ( v27 <= &pParty->pPlayers[3] ); |
0 | 3769 } |
3770 } | |
3771 uActorID = 0; | |
3772 if ( (signed int)uNumActors > 0 ) | |
3773 { | |
1202 | 3774 v28 = pActors.data();//[0].vPosition.z; |
0 | 3775 do |
3776 { | |
91 | 3777 if ( v28->CanAct() ) |
0 | 3778 { |
3779 v29 = *(short *)v1; | |
91 | 3780 v30 = v28->vPosition.y - *((short *)v1 - 100); |
3781 a1 = v28->vPosition.x - *((short *)v1 - 200); | |
90 | 3782 v31 = v28->vPosition.z; |
0 | 3783 v48 = v30; |
3784 v44 = v31; | |
90 | 3785 v32 = (v28->uActorHeight >> 1) - v29; |
91 | 3786 v33 = v28->uActorRadius + *((short *)v1 + 100); |
0 | 3787 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) |
3788 { | |
3789 v34.z = *(short *)v1; | |
3790 v34.y = *((short *)v1 - 100); | |
3791 v34.x = *((short *)v1 - 200); | |
90 | 3792 if ( sub_407A1C(v28->vPosition.x, v28->vPosition.y, v28->vPosition.z + 50, v34) ) |
0 | 3793 { |
3794 Vec3_int_::Normalize(&a1, &v48, &v44); | |
3795 v35 = pVelocity; | |
3796 pVelocity->x = a1; | |
3797 v35->y = v48; | |
3798 v35->z = v44; | |
3799 switch ( v41 ) | |
3800 { | |
303 | 3801 case OBJECT_Player: |
0 | 3802 DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); |
3803 break; | |
303 | 3804 case OBJECT_Actor: |
90 | 3805 if ( v36 && pActors[v37].GetActorsRelation(v28) ) |
0 | 3806 sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); |
3807 break; | |
303 | 3808 case OBJECT_Item: |
0 | 3809 sub_43B057(*((short *)v1 - 300), uActorID, v35); |
3810 break; | |
3811 } | |
3812 } | |
3813 } | |
3814 } | |
3815 ++uActorID; | |
90 | 3816 ++v28; |
0 | 3817 } |
3818 while ( (signed int)uActorID < (signed int)uNumActors ); | |
3819 } | |
3820 } | |
3821 ++pVelocity; | |
3822 v0 = v43 + 1; | |
3823 v1 += 2; | |
3824 ++v43; | |
3825 } | |
3826 while ( v43 < stru_50FE08.count ); | |
3827 } | |
3828 stru_50FE08.count = 0; | |
3829 } | |
3830 | |
3831 | |
3832 //----- (0043A97E) -------------------------------------------------------- | |
3833 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) | |
3834 { | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1384
diff
changeset
|
3835 if (PID_TYPE(a2) == OBJECT_BLVDoor) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3836 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3837 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3838 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3839 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3840 |
0 | 3841 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3842 DamagePlayerFromMonster(PID(OBJECT_Item, uLayingItemID), pSpriteObjects[uLayingItemID].field_61, &layingitem_vel_50FDFC, 0xFFFFFFFFu); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3843 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3844 else if (PID_TYPE(a2) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3845 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3846 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3847 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3848 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3849 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3850 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3851 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid)) |
0 | 3852 { |
3853 case OBJECT_Actor: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3854 sub_43B1B0(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61); |
0 | 3855 break; |
3856 case OBJECT_Player: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3857 DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 3858 break; |
3859 case OBJECT_Item: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
3860 sub_43B057(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 3861 break; |
3862 } | |
3863 } | |
3864 } | |
3865 | |
3866 //----- (0043AE12) -------------------------------------------------------- | |
3867 double __fastcall sub_43AE12(signed int a1) | |
3868 { | |
3869 signed int v1; // ST00_4@1 | |
3870 signed int v2; // ecx@1 | |
3871 double v3; // st7@1 | |
3872 double result; // st7@6 | |
3873 | |
3874 v1 = a1; | |
3875 v2 = 0; | |
3876 v3 = (double)v1; | |
3877 do | |
3878 { | |
3879 if ( v3 < flt_4E4A80[v2 + 5] ) | |
3880 break; | |
3881 ++v2; | |
3882 } | |
3883 while ( v2 < 5 ); | |
3884 if ( v2 <= 0 || v2 >= 5 ) | |
3885 { | |
3886 if ( v2 ) | |
3887 result = flt_4E4A80[4]; | |
3888 else | |
3889 result = flt_4E4A80[0]; | |
3890 } | |
3891 else | |
3892 { | |
1469 | 3893 result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 1]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2]; |
0 | 3894 } |
3895 return result; | |
3896 } | |
3897 | |
3898 //----- (0043B057) -------------------------------------------------------- | |
3899 void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, Vec3_int_ *pVelocity) | |
3900 { | |
3901 Actor *pActor; // esi@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
3902 SpriteObject *v4; // eax@3 |
0 | 3903 int v5; // ecx@3 |
3904 int v6; // eax@4 | |
3905 int v7; // edi@4 | |
3906 unsigned int uActorIDa; // [sp+8h] [bp-8h]@1 | |
3907 unsigned int a2; // [sp+Ch] [bp-4h]@1 | |
3908 int a2a; // [sp+Ch] [bp-4h]@8 | |
3909 | |
3910 uActorIDa = uActorID; | |
3911 pActor = &pActors[uActorID]; | |
3912 a2 = uObjID; | |
303 | 3913 if ( !pActors[uActorID].IsNotAlive() ) |
0 | 3914 { |
848 | 3915 if ( PID_TYPE(a2) == OBJECT_Item) |
3916 { | |
3917 v4 = &pSpriteObjects[PID_ID(a2)]; | |
822 | 3918 v5 = v4->spell_id; |
0 | 3919 if ( v5 ) |
3920 { | |
822 | 3921 v6 = _43AFE3_calc_spell_damage(v5, v4->spell_level, v4->spell_skill, pActor->sCurrentHP); |
0 | 3922 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6); |
3923 pActor->sCurrentHP -= v7; | |
3924 if ( v7 ) | |
3925 { | |
3926 if ( pActor->sCurrentHP > 0 ) | |
1060 | 3927 Actor::AI_Stun(uActorIDa, a2, 0); |
0 | 3928 else |
3929 Actor::Die(uActorIDa); | |
3930 a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP; | |
3931 if ( 20 * v7 / (signed int)pActor->pMonsterInfo.uHP > 10 ) | |
3932 a2a = 10; | |
3933 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
3934 { | |
3935 pVelocity->x = (unsigned __int64)(a2a * (signed __int64)pVelocity->x) >> 16; | |
3936 pVelocity->y = (unsigned __int64)(a2a * (signed __int64)pVelocity->y) >> 16; | |
3937 pVelocity->z = (unsigned __int64)(a2a * (signed __int64)pVelocity->z) >> 16; | |
3938 pActor->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
3939 pActor->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
3940 pActor->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
3941 } | |
3942 Actor::AddBloodsplatOnDamageOverlay(uActorIDa, 1, v7); | |
3943 } | |
3944 else | |
3945 { | |
1060 | 3946 Actor::AI_Stun(uActorIDa, a2, 0); |
0 | 3947 } |
3948 } | |
3949 } | |
3950 } | |
3951 } | |
3952 | |
3953 //----- (0043B1B0) -------------------------------------------------------- | |
322 | 3954 void sub_43B1B0(signed int a1, unsigned int a2, Vec3_int_ *pVelocity, signed int a4) |
0 | 3955 { |
3956 int v4; // ebx@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
3957 SpriteObject *v5; // eax@2 |
0 | 3958 bool v6; // eax@3 |
3959 Actor *v7; // esi@4 | |
3960 Actor *v8; // edi@4 | |
3961 char v9; // zf@5 | |
3962 __int64 v10; // qax@8 | |
3963 signed __int16 v11; // cx@9 | |
3964 signed int v12; // ecx@20 | |
3965 int v13; // ecx@22 | |
3966 int v14; // edi@30 | |
3967 unsigned int uActorID; // [sp+Ch] [bp-8h]@1 | |
3968 signed int v17; // [sp+10h] [bp-4h]@1 | |
3969 int v18; // [sp+20h] [bp+Ch]@34 | |
3970 | |
3971 v4 = 0; | |
3972 uActorID = a2; | |
3973 v17 = a1; | |
848 | 3974 if ( PID_TYPE(a1) == OBJECT_Item) |
3975 { | |
3976 v5 = &pSpriteObjects[PID_ID(a1)]; | |
0 | 3977 v4 = v5->field_60_distance_related_prolly_lod; |
822 | 3978 v17 = v5->spell_caster_pid; |
0 | 3979 } |
848 | 3980 LOWORD(v6) = PID_TYPE(v17); |
303 | 3981 if ( v6 == OBJECT_Actor) |
0 | 3982 { |
3983 v7 = &pActors[a2]; | |
848 | 3984 v8 = &pActors[PID_ID(v17)]; |
303 | 3985 v6 = pActors[a2].IsNotAlive(); |
0 | 3986 if ( !v6 ) |
3987 { | |
3988 v9 = v7->uAIState == 7; | |
3989 v7->uLastCharacterIDToHit = v17; | |
3990 if ( v9 ) | |
3991 BYTE2(v7->uAttributes) |= 2u; | |
3992 v6 = stru_50C198._4273BB(v8, v7, v4, 0); | |
3993 if ( v6 ) | |
3994 { | |
3995 v10 = (unsigned int)Actor::_43B3E0_CalcDamage(v8, a4); | |
3996 if ( (signed __int64)v8->pActorBuffs[3].uExpireTime > 0 ) | |
3997 { | |
3998 v11 = v8->pActorBuffs[3].uPower; | |
3999 if ( v11 ) | |
4000 v10 = (signed int)v10 / (unsigned __int16)v11; | |
4001 } | |
4002 if ( SHIDWORD(v7->pActorBuffs[5].uExpireTime) >= SHIDWORD(v10) | |
4003 && (SHIDWORD(v7->pActorBuffs[5].uExpireTime) > SHIDWORD(v10) | |
4004 || LODWORD(v7->pActorBuffs[5].uExpireTime) > HIDWORD(v10)) ) | |
4005 LODWORD(v10) = 0; | |
4006 if ( a4 != HIDWORD(v10) ) | |
4007 { | |
4008 if ( a4 - HIDWORD(v10) == 1 ) | |
4009 { | |
4010 v12 = v8->pMonsterInfo.uAttack2Type; | |
4011 if ( SHIDWORD(v7->pActorBuffs[15].uExpireTime) >= SHIDWORD(v10) | |
4012 && (SHIDWORD(v7->pActorBuffs[15].uExpireTime) > SHIDWORD(v10) | |
4013 || LODWORD(v7->pActorBuffs[15].uExpireTime) > HIDWORD(v10)) ) | |
4014 LODWORD(v10) = (signed int)v10 >> 1; | |
4015 goto LABEL_30; | |
4016 } | |
4017 if ( a4 - HIDWORD(v10) == 2 ) | |
4018 { | |
4019 v13 = v7->pMonsterInfo.uSpell1ID; | |
4020 } | |
4021 else | |
4022 { | |
4023 if ( a4 - HIDWORD(v10) != 3 ) | |
4024 { | |
4025 if ( a4 - HIDWORD(v10) == 4 ) | |
4026 v12 = v8->pMonsterInfo.field_3C_some_special_attack; | |
4027 else | |
4028 v12 = 4; | |
4029 LABEL_30: | |
4030 v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10); | |
4031 v7->sCurrentHP -= v14; | |
4032 if ( v14 ) | |
4033 { | |
4034 if ( v7->sCurrentHP > 0 ) | |
1060 | 4035 Actor::AI_Stun(uActorID, v17, 0); |
0 | 4036 else |
4037 Actor::Die(uActorID); | |
322 | 4038 Actor::AggroSurroundingPeasants(uActorID, 0); |
0 | 4039 v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP; |
4040 if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) | |
4041 v18 = 10; | |
4042 if ( !MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
4043 { | |
4044 pVelocity->x = (unsigned __int64)(v18 * (signed __int64)pVelocity->x) >> 16; | |
4045 pVelocity->y = (unsigned __int64)(v18 * (signed __int64)pVelocity->y) >> 16; | |
4046 pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; | |
4047 v7->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
4048 v7->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
4049 v7->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
4050 } | |
322 | 4051 Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v14); |
0 | 4052 } |
4053 else | |
4054 { | |
1060 | 4055 Actor::AI_Stun(uActorID, v17, 0); |
0 | 4056 } |
322 | 4057 return; |
0 | 4058 } |
4059 v13 = v7->pMonsterInfo.uSpell2ID; | |
4060 } | |
4061 v12 = LOBYTE(pSpellStats->pInfos[v13].uSchool); | |
4062 goto LABEL_30; | |
4063 } | |
4064 v12 = v8->pMonsterInfo.uAttack1Type; | |
4065 goto LABEL_30; | |
4066 } | |
4067 } | |
4068 } | |
4069 } | |
4070 | |
4071 | |
4072 //----- (0043F515) -------------------------------------------------------- | |
657 | 4073 void FindBillboardsLightLevels_BLV() |
0 | 4074 { |
4075 for (uint i = 0; i < uNumBillboardsToDraw; ++i) | |
4076 { | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
4077 auto p = &pBillboardRenderList[i]; |
0 | 4078 |
4079 if (p->field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !p->uIndoorSectorID) | |
657 | 4080 p->dimming_level = 0; |
0 | 4081 else |
657 | 4082 p->dimming_level = _43F55F_get_billboard_light_level(p, -1); |
0 | 4083 } |
4084 } | |
4085 | |
4086 //----- (0043F55F) -------------------------------------------------------- | |
4087 int __fastcall _43F55F_get_billboard_light_level(RenderBillboard *a1, int uBaseLightLevel) | |
4088 { | |
4089 signed int v3; // ecx@2 | |
4090 | |
4091 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
4092 { | |
4093 v3 = pIndoor->pSectors[a1->uIndoorSectorID].uMinAmbientLightLevel; | |
4094 } | |
4095 else | |
4096 { | |
4097 if ( uBaseLightLevel == -1 ) | |
657 | 4098 v3 = a1->dimming_level; |
0 | 4099 else |
4100 v3 = uBaseLightLevel; | |
4101 } | |
430 | 4102 return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->world_x, a1->world_y, a1->world_z); |
0 | 4103 } |
4104 | |
4105 //----- (0043F5C8) -------------------------------------------------------- | |
4106 int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z) | |
4107 { | |
4108 int v5; // esi@1 | |
4109 signed int v6; // edi@1 | |
4110 int v8; // eax@6 | |
4111 int v9; // ebx@6 | |
4112 unsigned int v10; // ecx@6 | |
4113 unsigned int v11; // edx@9 | |
4114 unsigned int v12; // edx@11 | |
4115 signed int v13; // ecx@12 | |
4116 BLVLightMM7 *v16; // esi@20 | |
4117 int v17; // ebx@21 | |
4118 int v18; // eax@24 | |
4119 int v19; // ebx@24 | |
4120 unsigned int v20; // ecx@24 | |
4121 int v21; // edx@25 | |
4122 unsigned int v22; // edx@27 | |
4123 unsigned int v23; // edx@29 | |
4124 signed int v24; // ecx@30 | |
4125 int v26; // ebx@35 | |
4126 int v27; // eax@38 | |
4127 int v28; // ebx@38 | |
4128 unsigned int v29; // ecx@38 | |
4129 int v30; // edx@39 | |
4130 unsigned int v31; // edx@41 | |
4131 unsigned int v32; // edx@43 | |
4132 signed int v33; // ecx@44 | |
4133 int v37; // [sp+Ch] [bp-18h]@37 | |
4134 int v38; // [sp+10h] [bp-14h]@5 | |
4135 int v39; // [sp+10h] [bp-14h]@23 | |
4136 int v40; // [sp+10h] [bp-14h]@36 | |
4137 int v42; // [sp+14h] [bp-10h]@22 | |
4138 unsigned int v43; // [sp+18h] [bp-Ch]@12 | |
4139 unsigned int v44; // [sp+18h] [bp-Ch]@30 | |
4140 unsigned int v45; // [sp+18h] [bp-Ch]@44 | |
4141 | |
4142 v6 = uBaseLightLevel; | |
4143 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i) | |
4144 { | |
4145 auto p = pMobileLightsStack->pLights + i; | |
4146 | |
4147 auto distX = abs(p->vPosition.x - x); | |
4148 if ( distX <= p->uRadius) | |
4149 { | |
4150 auto distY = abs(p->vPosition.y - y); | |
4151 if ( distY <= p->uRadius) | |
4152 { | |
4153 auto distZ = abs(p->vPosition.z - z); | |
4154 if ( distZ <= p->uRadius) | |
4155 { | |
4156 v8 = distX; | |
4157 v9 = distY; | |
4158 v10 = distZ; | |
4159 if (distX < distY) | |
4160 { | |
4161 v8 = distY; | |
4162 v9 = distX; | |
4163 } | |
4164 if ( v8 < distZ ) | |
4165 { | |
4166 v11 = v8; | |
4167 v8 = distZ; | |
4168 v10 = v11; | |
4169 } | |
4170 if ( v9 < (signed int)v10 ) | |
4171 { | |
4172 v12 = v10; | |
4173 v10 = v9; | |
4174 v9 = v12; | |
4175 } | |
4176 v43 = ((unsigned int)(11 * v9) / 32) + (v10 / 4) + v8; | |
4177 v13 = p->uRadius; | |
4178 if ( (signed int)v43 < v13 ) | |
4179 v6 += ((unsigned __int64)(30i64 * (signed int)(v43 << 16) / v13) >> 16) - 30; | |
4180 } | |
4181 } | |
4182 } | |
4183 } | |
4184 | |
4185 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4186 { | |
4187 auto pSector = pIndoor->pSectors + uSectorID; | |
4188 | |
4189 for (uint i = 0; i < pSector->uNumLights; ++i) | |
4190 { | |
4191 v16 = pIndoor->pLights + pSector->pLights[i]; | |
4192 if (~v16->uAtributes & 8) | |
4193 { | |
4194 v17 = abs(v16->vPosition.x - x); | |
4195 if ( v17 <= v16->uRadius ) | |
4196 { | |
4197 v42 = abs(v16->vPosition.y - y); | |
4198 if ( v42 <= v16->uRadius ) | |
4199 { | |
4200 v39 = abs(v16->vPosition.z - z); | |
4201 if ( v39 <= v16->uRadius ) | |
4202 { | |
4203 v18 = v17; | |
4204 v19 = v42; | |
4205 v20 = v39; | |
4206 if ( v18 < v42 ) | |
4207 { | |
4208 v21 = v18; | |
4209 v18 = v42; | |
4210 v19 = v21; | |
4211 } | |
4212 if ( v18 < v39 ) | |
4213 { | |
4214 v22 = v18; | |
4215 v18 = v39; | |
4216 v20 = v22; | |
4217 } | |
4218 if ( v19 < (signed int)v20 ) | |
4219 { | |
4220 v23 = v20; | |
4221 v20 = v19; | |
4222 v19 = v23; | |
4223 } | |
4224 v44 = ((unsigned int)(11 * v19) >> 5) + (v20 >> 2) + v18; | |
4225 v24 = v16->uRadius; | |
4226 if ( (signed int)v44 < v24 ) | |
4227 v6 += ((unsigned __int64)(30i64 * (signed int)(v44 << 16) / v24) >> 16) - 30; | |
4228 } | |
4229 } | |
4230 } | |
4231 } | |
4232 } | |
4233 } | |
4234 | |
4235 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i) | |
4236 { | |
4237 auto p = pStationaryLightsStack->pLights + i; | |
4238 v26 = abs(p->vPosition.x - x); | |
4239 if ( v26 <= p->uRadius) | |
4240 { | |
4241 v40 = abs(p->vPosition.y - y); | |
4242 if ( v40 <= p->uRadius) | |
4243 { | |
4244 v37 = abs(p->vPosition.z - z); | |
4245 if ( v37 <= p->uRadius) | |
4246 { | |
4247 v27 = v26; | |
4248 v28 = v40; | |
4249 v29 = v37; | |
4250 if ( v27 < v40 ) | |
4251 { | |
4252 v30 = v27; | |
4253 v27 = v40; | |
4254 v28 = v30; | |
4255 } | |
4256 if ( v27 < v37 ) | |
4257 { | |
4258 v31 = v27; | |
4259 v27 = v37; | |
4260 v29 = v31; | |
4261 } | |
4262 if ( v28 < (signed int)v29 ) | |
4263 { | |
4264 v32 = v29; | |
4265 v29 = v28; | |
4266 v28 = v32; | |
4267 } | |
4268 v45 = ((unsigned int)(11 * v28) >> 5) + (v29 >> 2) + v27; | |
4269 v33 = p->uRadius; | |
4270 if ( (signed int)v45 < v33 ) | |
4271 v6 += ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / v33) >> 16) - 30; | |
4272 } | |
4273 } | |
4274 } | |
4275 } | |
4276 | |
4277 if ( v6 <= 31 ) | |
4278 { | |
4279 if ( v6 < 0 ) | |
4280 v6 = 0; | |
4281 } | |
4282 else | |
4283 { | |
4284 v6 = 31; | |
4285 } | |
4286 return v6; | |
4287 } | |
4288 | |
4289 | |
4290 //----- (004070EF) -------------------------------------------------------- | |
1493 | 4291 bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID) |
0 | 4292 { |
4293 signed int v2; // eax@1 | |
4294 int v5; // ecx@2 | |
1615 | 4295 int obj1_sector; // eax@4 |
0 | 4296 float v8; // ST24_4@5 |
4297 double v9; // ST18_8@5 | |
4298 int v11; // ecx@6 | |
4299 signed int v12; // eax@7 | |
4300 int v13; // esi@7 | |
4301 int v14; // esi@8 | |
4302 int v15; // esi@9 | |
1493 | 4303 int obj2_z; // edi@11 |
4304 int obj2_x; // esi@11 | |
4305 int obj2_sector; // eax@13 | |
0 | 4306 float v20; // ST24_4@14 |
4307 double v21; // ST18_8@14 | |
1615 | 4308 int dist_x; // ebx@16 |
4309 signed int dist_3d; // ecx@16 | |
0 | 4310 int v25; // eax@18 |
4311 BLVFace *v29; // ebx@32 | |
4312 Vec3_short_ *v30; // esi@32 | |
4313 int v31; // eax@32 | |
4314 int v32; // ST50_4@44 | |
4315 int v33; // ST54_4@44 | |
4316 int v34; // eax@44 | |
4317 signed int v38; // esi@45 | |
4318 signed __int64 v40; // qtt@50 | |
1615 | 4319 __int16 next_sector; // bx@58 |
0 | 4320 int v43; // [sp-8h] [bp-70h]@11 |
4321 int v44; // [sp-4h] [bp-6Ch]@11 | |
4322 int v47; // [sp+18h] [bp-50h]@20 | |
4323 int v48; // [sp+1Ch] [bp-4Ch]@20 | |
4324 int v49; // [sp+20h] [bp-48h]@20 | |
1615 | 4325 int dist_z; // [sp+24h] [bp-44h]@16 |
4326 signed int higher_z; // [sp+24h] [bp-44h]@27 | |
4327 signed int lower_z; // [sp+28h] [bp-40h]@26 | |
4328 signed int higher_y; // [sp+2Ch] [bp-3Ch]@23 | |
4329 signed int lower_y; // [sp+30h] [bp-38h]@22 | |
4330 signed int higher_x; // [sp+34h] [bp-34h]@21 | |
4331 signed int lower_x; // [sp+38h] [bp-30h]@20 | |
4332 signed int sectors_visited; // [sp+3Ch] [bp-2Ch]@28 | |
0 | 4333 int v58; // [sp+44h] [bp-24h]@50 |
4334 int v59; // [sp+48h] [bp-20h]@44 | |
1493 | 4335 int obj2_y; // [sp+50h] [bp-18h]@11 |
1615 | 4336 int obj1_x; // [sp+58h] [bp-10h]@4 |
4337 int obj1_y; // [sp+5Ch] [bp-Ch]@4 | |
4338 int obj1_z; // [sp+60h] [bp-8h]@4 | |
4339 int current_sector; // [sp+64h] [bp-4h]@7 | |
4340 int dist_y; | |
4341 int v70; | |
0 | 4342 |
848 | 4343 v2 = PID_ID(uObjID); |
1615 | 4344 switch( PID_TYPE(uObjID) ) |
0 | 4345 { |
1615 | 4346 case OBJECT_Decoration: |
4347 obj1_x = pLevelDecorations[v2].vPosition.x; | |
4348 obj1_y = pLevelDecorations[v2].vPosition.y; | |
4349 obj1_z = pLevelDecorations[v2].vPosition.z; | |
4350 obj1_sector = pIndoor->GetSector(obj1_x, obj1_y, obj1_z); | |
4351 break; | |
4352 case OBJECT_Actor: | |
4353 obj1_x = pActors[v2].vPosition.x; | |
4354 obj1_y = pActors[v2].vPosition.y; | |
0 | 4355 v8 = (double)pActors[v2].uActorHeight * 0.69999999; |
1493 | 4356 //v9 = v8 + 6.7553994e15; |
1615 | 4357 //obj1_z = LODWORD(v9) + pActors[v2].vPosition.z; |
4358 obj1_z = (int)v8 + pActors[v2].vPosition.z; | |
4359 obj1_sector = pActors[v2].uSectorID; | |
4360 break; | |
4361 case OBJECT_Item: | |
4362 obj1_x = pSpriteObjects[v2].vPosition.x; | |
4363 obj1_y = pSpriteObjects[v2].vPosition.y; | |
4364 obj1_z = pSpriteObjects[v2].vPosition.z; | |
4365 obj1_sector = pSpriteObjects[v2].uSectorID; | |
4366 break; | |
4367 default: | |
4368 return 0; | |
0 | 4369 } |
1493 | 4370 v12 = PID_ID(uObj2ID); |
1615 | 4371 switch( PID_TYPE(uObj2ID) ) |
1493 | 4372 { |
1615 | 4373 case OBJECT_Decoration: |
4374 obj2_z = pLevelDecorations[v12].vPosition.z; | |
4375 obj2_x = pLevelDecorations[v12].vPosition.x; | |
4376 obj2_y = pLevelDecorations[v12].vPosition.y; | |
4377 obj2_sector = pIndoor->GetSector(obj2_x, obj2_y, obj2_z); | |
4378 break; | |
4379 case OBJECT_Player: | |
4380 obj2_x = pParty->vPosition.x; | |
4381 obj2_z = pParty->sEyelevel + pParty->vPosition.z; | |
4382 obj2_y = pParty->vPosition.y; | |
4383 obj2_sector = pIndoor->GetSector(obj2_x, obj2_y, obj2_z); | |
4384 break; | |
4385 case OBJECT_Actor: | |
4386 obj2_y = pActors[v12].vPosition.y; | |
4387 obj2_x = pActors[v12].vPosition.x; | |
4388 v20 = (double)pActors[v12].uActorHeight * 0.69999999; | |
4389 //v21 = v20 + 6.7553994e15; | |
4390 //obj2_z = LODWORD(v21) + pActors[v12].vPosition.z; | |
4391 obj2_z = (int)v20 + pActors[v12].vPosition.z; | |
4392 obj2_sector = pActors[v12].uSectorID; | |
4393 break; | |
4394 case OBJECT_Item: | |
4395 obj2_x = pSpriteObjects[v12].vPosition.x; | |
4396 obj2_z = pSpriteObjects[v12].vPosition.z; | |
4397 obj2_y = pSpriteObjects[v12].vPosition.y; | |
4398 obj2_sector = pSpriteObjects[v12].uSectorID; | |
4399 break; | |
4400 default: | |
4401 return 0; | |
1493 | 4402 } |
1615 | 4403 dist_x = obj2_x - obj1_x; |
4404 dist_z = obj2_z - obj1_z; | |
4405 dist_y = obj2_y - obj1_y; | |
4406 dist_3d = integer_sqrt(dist_x * dist_x + dist_y * dist_y + dist_z * dist_z); | |
4407 //range check | |
4408 if ( dist_3d > 5120 ) | |
0 | 4409 return 0; |
4410 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4411 return 1; | |
4412 v25 = 65536; | |
1615 | 4413 if ( dist_3d ) |
4414 v25 = 65536 / dist_3d; | |
4415 v49 = dist_x * v25; | |
4416 v47 = dist_z * v25; | |
4417 v48 = dist_y * v25; | |
4418 if ( obj1_x < obj2_x ) | |
0 | 4419 { |
1615 | 4420 lower_x = obj1_x; |
4421 higher_x = obj2_x; | |
0 | 4422 } |
4423 else | |
4424 { | |
1615 | 4425 lower_x = obj2_x; |
4426 higher_x = obj1_x; | |
0 | 4427 } |
1615 | 4428 if ( obj1_y < obj2_y ) |
0 | 4429 { |
1615 | 4430 lower_y = obj1_y; |
4431 higher_y = obj2_y; | |
0 | 4432 } |
4433 else | |
4434 { | |
1615 | 4435 lower_y = obj2_y; |
4436 higher_y = obj1_y; | |
0 | 4437 } |
1615 | 4438 if ( obj1_z < obj2_z ) |
0 | 4439 { |
1615 | 4440 lower_z = obj1_z; |
4441 higher_z = obj2_z; | |
0 | 4442 } |
4443 else | |
4444 { | |
1615 | 4445 lower_z = obj2_z; |
4446 higher_z = obj1_z; | |
0 | 4447 } |
1615 | 4448 sectors_visited = 0; |
4449 //monster in same sector with player | |
4450 if ( obj1_sector == obj2_sector ) | |
0 | 4451 return 1; |
1615 | 4452 //search starts from monster |
4453 current_sector = obj1_sector; | |
4454 for( int current_portal = 0; current_portal < pIndoor->pSectors[current_sector].uNumPortals; current_portal++ ) | |
4455 { | |
4456 v29 = &pIndoor->pFaces[pIndoor->pSectors[current_sector].pPortals[current_portal]]; | |
4457 v30 = &pIndoor->pVertices[*v29->pVertexIDs]; | |
4458 v31 = v29->pFacePlane_old.vNormal.z * (v30->z - obj1_z) | |
4459 + v29->pFacePlane_old.vNormal.y * (v30->y - obj1_y) | |
4460 + v29->pFacePlane_old.vNormal.x * (v30->x - obj1_x); | |
4461 | |
4462 if ( current_sector != v29->uSectorID ) | |
4463 v31 = -v31; | |
4464 | |
4465 if ( v31 >= 0 && v30->x != obj1_x && v30->y != obj1_y && v30->z != obj1_z) | |
4466 continue; | |
4467 | |
4468 if( lower_x > v29->pBounding.x2 | |
4469 || higher_x < v29->pBounding.x1 | |
4470 || lower_y > v29->pBounding.y2 | |
4471 || higher_y < v29->pBounding.y1 | |
4472 || lower_z > v29->pBounding.z2 | |
4473 || higher_z < v29->pBounding.z1 ) | |
4474 { | |
4475 continue; | |
4476 } | |
4477 | |
1643 | 4478 v32 = fixpoint_mul(v29->pFacePlane_old.vNormal.x,v49); |
4479 v33 = fixpoint_mul(v29->pFacePlane_old.vNormal.z,v47); | |
4480 v34 = fixpoint_mul(v29->pFacePlane_old.vNormal.y,v48); | |
1615 | 4481 v59 = v32 + v33 + v34; |
4482 if ( v59 ) | |
1493 | 4483 { |
1615 | 4484 v70 = v29->pFacePlane_old.dist |
4485 + obj1_z * v29->pFacePlane_old.vNormal.z | |
4486 + obj1_x * v29->pFacePlane_old.vNormal.x | |
4487 + obj1_y * v29->pFacePlane_old.vNormal.y; | |
4488 v38 = -v70; | |
4489 | |
4490 // if ( v59 <= 0 ^ v70 <= 0 ) | |
4491 | |
4492 /* TEMPORARY | |
4493 if ( v59 <= 0 && v70 <= 0 ) | |
4494 { | |
4495 continue; | |
4496 } | |
4497 if ( !(v59 <= 0 && v70 <= 0) ) | |
4498 { | |
4499 continue; | |
4500 } | |
4501 */ | |
4502 | |
4503 if( abs(v38) >> 14 > abs(v59) ) | |
4504 continue; | |
4505 | |
1643 | 4506 v58 = fixpoint_div(v38,v59); |
1615 | 4507 |
4508 if( v58 < 0 ) | |
4509 { | |
1616 | 4510 continue; |
1615 | 4511 } |
1493 | 4512 |
1615 | 4513 if(!sub_4075DB( |
1643 | 4514 obj1_x + ((fixpoint_mul(v49,v58) + 32768) >> 16), |
4515 obj1_y + ((fixpoint_mul(v48,v58) + 32768) >> 16), | |
4516 obj1_z + ((fixpoint_mul(v47,v58) + 32768) >> 16), | |
1615 | 4517 v29) ) |
4518 { | |
1616 | 4519 continue; |
1615 | 4520 } |
4521 | |
4522 //if there is no next sector turn back | |
4523 if ( v29->uSectorID == current_sector ) | |
4524 next_sector = v29->uBackSectorID; | |
4525 else | |
4526 next_sector = v29->uSectorID; | |
4527 | |
4528 //no more portals, quit | |
4529 if ( next_sector == current_sector ) | |
4530 { | |
4531 break; | |
4532 } | |
4533 | |
4534 ++sectors_visited; | |
4535 current_sector = next_sector; | |
4536 | |
4537 //found player, quit | |
4538 if ( next_sector == obj2_sector ) | |
4539 return 1; | |
4540 | |
4541 current_sector = next_sector; | |
4542 | |
4543 //did we hit limit for portals? | |
4544 //does the next room have portals? | |
4545 if ( sectors_visited < 30 && pIndoor->pSectors[current_sector].uNumPortals > 0) | |
4546 { | |
4547 current_portal=-1; | |
4548 continue; | |
4549 } | |
4550 else | |
4551 break; | |
4552 } | |
4553 } | |
4554 //did we stop in the sector where player is? | |
4555 if ( current_sector != obj2_sector ) | |
0 | 4556 return 0; |
4557 return 1; | |
4558 } | |
4559 | |
4560 //----- (004075DB) -------------------------------------------------------- | |
1616 | 4561 bool __fastcall sub_4075DB(int x, int y, int z, BLVFace *a4) |
0 | 4562 { |
4563 unsigned int v5; // esi@1 | |
4564 char v7; // zf@2 | |
4565 int v8; // edi@2 | |
4566 Vec3_short_ *v9; // ecx@3 | |
4567 int v10; // edx@4 | |
4568 Vec3_short_ *v12; // ecx@8 | |
4569 int v13; // edx@9 | |
4570 Vec3_short_ *v15; // ecx@12 | |
4571 int v16; // edx@13 | |
4572 bool v18; // esi@14 | |
4573 int v19; // ecx@14 | |
4574 int v20; // ecx@16 | |
4575 int v21; // edx@16 | |
4576 int v22; // eax@17 | |
4577 signed int v23; // ebx@18 | |
4578 int v24; // esi@20 | |
4579 signed int v25; // eax@22 | |
4580 signed __int64 v26; // qtt@22 | |
4581 bool result; // eax@25 | |
4582 int v29; // [sp+10h] [bp-Ch]@14 | |
4583 signed int a3a; // [sp+24h] [bp+8h]@14 | |
4584 int a4a; // [sp+28h] [bp+Ch]@2 | |
4585 | |
1493 | 4586 //__debugbreak(); |
1458 | 4587 |
0 | 4588 v5 = a4->uAttributes; |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4589 v9 = pIndoor->pVertices; |
1471 | 4590 if ( v5 & FACE_XY_PLANE ) |
0 | 4591 { |
1616 | 4592 a4a = x; |
4593 v8 = y; | |
1471 | 4594 for(int i = 0; i < a4->uNumVertices; i++) |
4595 { | |
4596 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x; | |
1615 | 4597 dword_4F5CC8_ys[i] = v9[a4->pVertexIDs[i]].y; |
1471 | 4598 } |
0 | 4599 } |
4600 else | |
4601 { | |
1616 | 4602 v8 = z; |
4603 if ( v5 & FACE_XZ_PLANE ) | |
0 | 4604 { |
1616 | 4605 a4a = x; |
1471 | 4606 for(int i = 0; i < a4->uNumVertices; i++) |
4607 { | |
4608 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x; | |
1615 | 4609 dword_4F5CC8_ys[i] = v9[a4->pVertexIDs[i]].z; |
1471 | 4610 } |
0 | 4611 } |
4612 else | |
4613 { | |
1616 | 4614 a4a = y; |
1471 | 4615 for(int i = 0; i < a4->uNumVertices; i++) |
4616 { | |
4617 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].y; | |
1615 | 4618 dword_4F5CC8_ys[i] = v9[a4->pVertexIDs[i]].z; |
1471 | 4619 } |
0 | 4620 } |
4621 } | |
4622 a3a = 0; | |
1471 | 4623 dword_4F5D98_xs[a4->uNumVertices] = dword_4F5D98_xs[0]; |
1615 | 4624 dword_4F5CC8_ys[a4->uNumVertices] = dword_4F5CC8_ys[0]; |
4625 for(int i = 0; i < a4->uNumVertices && a3a < 2; i++) | |
0 | 4626 { |
1615 | 4627 if ( dword_4F5CC8_ys[i] >= v8 ^ (dword_4F5CC8_ys[i + 1] >= v8) ) |
0 | 4628 { |
1615 | 4629 //if( dword_4F5D98_xs[i + 1] >= a4a || dword_4F5D98_xs[i] >= a4a) |
4630 if( !(dword_4F5D98_xs[i + 1] >= a4a && dword_4F5D98_xs[i] < a4a)) | |
0 | 4631 { |
1615 | 4632 if ( (dword_4F5D98_xs[i + 1] < a4a && dword_4F5D98_xs[i] >= a4a) ) |
4633 ++a3a; | |
4634 //|| (v25 = dword_4F5D98_xs[i + 1] - dword_4F5D98_xs[i],LODWORD(v26) = v25 << 16, HIDWORD(v26) = v25 >> 16, | |
4635 //dword_4F5D98_xs[i] + ((signed int)(((unsigned __int64)(v26 / (dword_4F5CC4_ys[i + 2] - dword_4F5CC4_ys[i + 1])* ((v8 - dword_4F5CC4_ys[i + 1]) << 16)) >> 16) | |
4636 // + 32768) >> 16) >= a4a) ) | |
4637 else | |
4638 { | |
1643 | 4639 v25 = fixpoint_div(dword_4F5D98_xs[i + 1] - dword_4F5D98_xs[i], dword_4F5CC8_ys[i + 1] - dword_4F5CC8_ys[i]); |
4640 if( dword_4F5D98_xs[i] + (fixpoint_mul(v25, (v8 - dword_4F5CC8_ys[i]) << 16) + 32768 >> 16) >= a4a) | |
1615 | 4641 ++a3a; |
4642 } | |
0 | 4643 } |
4644 } | |
4645 } | |
4646 result = 1; | |
4647 if ( a3a != 1 ) | |
4648 result = 0; | |
4649 return result; | |
4650 } | |
4651 | |
4652 //----- (004077F1) -------------------------------------------------------- | |
4653 bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *a4, BSPVertexBuffer *a5) | |
4654 { | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4655 //ODMFace *v5; // eax@1 |
1473 | 4656 Vec3_int_ *v9; |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4657 unsigned int v5; // esi@1 |
0 | 4658 signed int v7; // edi@1 |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4659 //char v8; // zf@2 |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4660 //unsigned __int16 *v9; // edx@3 |
0 | 4661 int v10; // ecx@4 |
4662 unsigned __int16 *v11; // edx@8 | |
4663 int v12; // ecx@9 | |
4664 int v13; // edx@12 | |
4665 int v14; // ecx@13 | |
4666 int v15; // esi@14 | |
4667 bool v16; // edi@14 | |
4668 int v17; // ecx@16 | |
4669 int v18; // edx@16 | |
4670 int v19; // eax@17 | |
4671 signed int v20; // ebx@18 | |
4672 int v21; // edi@20 | |
4673 signed int v22; // eax@22 | |
4674 signed __int64 v23; // qtt@22 | |
1545 | 4675 //bool result; // eax@25 |
4676 //int v25; // [sp+14h] [bp-8h]@14 | |
0 | 4677 int a4a; // [sp+28h] [bp+Ch]@2 |
4678 signed int a5a; // [sp+2Ch] [bp+10h]@14 | |
4679 | |
1458 | 4680 __debugbreak(); |
4681 | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4682 v5 = a4->uAttributes; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4683 v9 = a5->pVertices; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4684 if ( v5 & FACE_XY_PLANE ) |
0 | 4685 { |
4686 a4a = a1; | |
4687 a3 = a2; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4688 for(int i = 0; i < a4->uNumVertices; i++) |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4689 { |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4690 dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4691 dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].y; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4692 } |
0 | 4693 } |
4694 else | |
4695 { | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4696 if ( v5 & FACE_XY_PLANE ) |
0 | 4697 { |
4698 a4a = a1; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4699 for(int i = 0; i < a4->uNumVertices; i++) |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4700 { |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4701 dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4702 dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4703 } |
0 | 4704 } |
4705 else | |
4706 { | |
4707 a4a = a2; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4708 for(int i = 0; i < a4->uNumVertices; i++) |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4709 { |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4710 dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].y; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4711 dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4712 } |
0 | 4713 } |
4714 } | |
4715 a5a = 0; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4716 dword_4F5BF4_xs[a4->uNumVertices + 1] = dword_4F5BF4_xs[1]; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4717 dword_4F5B24_ys[a4->uNumVertices + 1] = dword_4F5B24_ys[1]; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4718 for(int i = 0; i < a4->uNumVertices; i++) |
0 | 4719 { |
4720 if ( a5a >= 2 ) | |
4721 break; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4722 if ( dword_4F5B24_ys[i + 1] >= a3 ^ (dword_4F5B24_ys[i + 2] >= a3) ) |
0 | 4723 { |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4724 if( dword_4F5BF4_xs[i + 2] >= a4a || dword_4F5BF4_xs[i] >= a4a) |
0 | 4725 { |
1545 | 4726 if (dword_4F5BF4_xs[i + 2] >= a4a && dword_4F5BF4_xs[i + 1] >= a4a) |
4727 ++a5a; | |
4728 else | |
4729 { | |
4730 v23 = (__int64)(dword_4F5BF4_xs[i + 2] - dword_4F5BF4_xs[i + 1]) << 16; | |
4731 __int64 _a = dword_4F5B24_ys[i + 2] - dword_4F5B24_ys[i + 1]; | |
4732 __int64 _b = (__int64)(a3 - dword_4F5B24_ys[i + 1]) << 16; | |
4733 | |
4734 if (dword_4F5BF4_xs[i + 1] + ((((v23 / _a * _b) >> 16) + 32768) >> 16) >= a4a) | |
4735 ++a5a; | |
4736 } | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4737 } |
0 | 4738 } |
4739 } | |
1545 | 4740 |
0 | 4741 if ( a5a != 1 ) |
1545 | 4742 return false; |
4743 return true; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
4744 |
0 | 4745 } |
4746 | |
4747 //----- (004088E9) -------------------------------------------------------- | |
1459 | 4748 int __fastcall sub_4088E9(int x1, int y1, int x2, int y2, int x3, int y3) |
0 | 4749 { |
4750 int v8; // eax@1 | |
4751 signed int result; // eax@1 | |
4752 int v11; // [sp+18h] [bp+8h]@1 | |
4753 | |
1459 | 4754 v11 = abs(x2 - x1); |
4755 v8 = abs(y2 - y1); | |
295 | 4756 result = integer_sqrt(v11 * v11 + v8 * v8); |
0 | 4757 if ( result ) |
1459 | 4758 result = abs(((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / result); |
0 | 4759 return result; |
4760 } | |
4761 | |
4762 //----- (0040DEF3) -------------------------------------------------------- | |
949 | 4763 unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b ) |
983 | 4764 { |
688 | 4765 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) + |
4766 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) + | |
4767 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); | |
0 | 4768 } |
4769 | |
1184 | 4770 |
0 | 4771 |
4772 //----- (0040F82D) -------------------------------------------------------- | |
4773 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) | |
4774 { | |
973 | 4775 assert(uTextureId != -1); |
4776 ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue); | |
0 | 4777 } |
4778 | |
1160 | 4779 |
0 | 4780 |
4781 //----- (0040F89C) -------------------------------------------------------- | |
4782 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue) | |
4783 { | |
4784 void *v3; // eax@3 | |
4785 void *v4; // esi@5 | |
4786 int *v5; // edi@5 | |
4787 int v6; // eax@5 | |
4788 int v7; // ecx@6 | |
4789 Texture *v8; // [sp+Ch] [bp-14h]@1 | |
4790 int *v9; // [sp+10h] [bp-10h]@1 | |
4791 int v10; // [sp+14h] [bp-Ch]@1 | |
4792 int v11; // [sp+18h] [bp-8h]@1 | |
4793 void *v12; // [sp+1Ch] [bp-4h]@5 | |
4794 | |
4795 v10 = pTex->uTextureWidth; | |
4796 v8 = pTex; | |
4797 v9 = pZBuffer; | |
4798 v11 = pTex->uTextureHeight; | |
4799 if ( pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize ) | |
4800 v3 = pTex->UnzipPalette(); | |
4801 else | |
710 | 4802 v3 = pTex->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4803 v12 = v3; |
4804 v4 = v3; | |
4805 v5 = v9; | |
4806 v6 = 0; | |
4807 do | |
4808 { | |
4809 v7 = v10; | |
4810 do | |
4811 { | |
4812 LOBYTE(v6) = *(char *)v4; | |
4813 v4 = (char *)v4 + 1; | |
4814 if ( v6 ) | |
4815 *v5 = uZValue; | |
4816 ++v5; | |
4817 --v7; | |
4818 } | |
4819 while ( v7 ); | |
4820 v5 += 640 - v10; | |
4821 --v11; | |
4822 } | |
4823 while ( v11 ); | |
4824 if ( pIcons_LOD->dword_011BA4 ) | |
4825 { | |
4826 if ( v8->uDecompressedSize ) | |
4827 free(v12); | |
4828 } | |
4829 } | |
4830 | |
4831 //----- (0040F92A) -------------------------------------------------------- | |
1458 | 4832 void __fastcall ZBuffer_DoFill2(int *pZBuffer, Texture *a2, int a3) |
0 | 4833 { |
4834 Texture *v3; // esi@1 | |
4835 void *v4; // eax@3 | |
4836 int *v5; // edi@5 | |
4837 int v6; // ecx@6 | |
4838 int *v7; // [sp+Ch] [bp-10h]@1 | |
4839 int v8; // [sp+10h] [bp-Ch]@1 | |
4840 int v9; // [sp+18h] [bp-4h]@1 | |
4841 | |
4842 v3 = a2; | |
4843 v7 = pZBuffer; | |
4844 v8 = a2->uTextureWidth; | |
4845 v9 = a2->uTextureHeight; | |
4846 if ( pIcons_LOD->dword_011BA4 && a2->uDecompressedSize ) | |
4847 v4 = a2->UnzipPalette(); | |
4848 else | |
710 | 4849 v4 = a2->pLevelOfDetail0_prolly_alpha_mask; |
0 | 4850 v5 = v7; |
4851 do | |
4852 { | |
4853 v6 = v8; | |
4854 do | |
4855 { | |
4856 *v5 = a3; | |
4857 ++v5; | |
4858 --v6; | |
4859 } | |
4860 while ( v6 ); | |
4861 v5 += 640 - v8; | |
4862 --v9; | |
4863 } | |
4864 while ( v9 ); | |
4865 if ( pIcons_LOD->dword_011BA4 ) | |
4866 { | |
4867 if ( v3->uDecompressedSize ) | |
4868 free(v4); | |
4869 } | |
4870 } | |
4871 | |
4872 //----- (00410D99) -------------------------------------------------------- | |
1458 | 4873 int __fastcall sub_410D99_get_map_index(int a1) |
0 | 4874 { |
4875 int v1; // edi@1 | |
4876 signed int v2; // ebp@1 | |
4877 const char **v3; // esi@2 | |
4878 char *v4; // ebx@2 | |
4879 | |
4880 v1 = a1; | |
4881 v2 = 1; | |
1104 | 4882 if ( _stricmp(pMapStats->pInfos[1].pFilename, (const char *)&pGames_LOD->pSubIndices[a1]) ) |
0 | 4883 { |
4884 v3 = (const char **)&pMapStats->pInfos[1].pFilename; | |
4885 v4 = (char *)&pMapStats->pInfos[1].pFilename; | |
4886 do | |
4887 { | |
4888 if ( !*(int *)v4 ) | |
4889 break; | |
4890 v3 += 17; | |
4891 ++v2; | |
4892 v4 = (char *)v3; | |
4893 } | |
1104 | 4894 while ( _stricmp(*v3, (const char *)&pGames_LOD->pSubIndices[v1]) ); |
0 | 4895 } |
4896 return v2; | |
4897 } | |
4898 | |
4899 // 4E28F8: using guessed type int pCurrentScreen; | |
4900 | |
762 | 4901 void LoadFonts_and_DrawCopyrightWindow() |
4902 { | |
4903 MainMenuUI_LoadFontsAndSomeStuff(); | |
4904 DrawCopyrightWindow(); | |
4905 } | |
0 | 4906 |
4907 | |
1575 | 4908 int no_rightlick_in_inventory = false; // 0050CDCC |
0 | 4909 //----- (00416196) -------------------------------------------------------- |
1575 | 4910 void OnInventoryItemRightClick() |
0 | 4911 { |
1575 | 4912 //Player *v0; // esi@2 |
4913 //POINT *v1; // edi@2 | |
4914 //signed int v2; // ecx@5 | |
4915 //signed int v3; // eax@5 | |
4916 //int v4; // eax@5 | |
4917 //char v5; // sf@5 | |
4918 //int v6; // eax@5 | |
0 | 4919 int v7; // eax@7 |
1575 | 4920 //unsigned __int16 v8; // ax@10 |
0 | 4921 int v9; // edi@10 |
1576 | 4922 //int v10; // eax@10 |
1575 | 4923 //int v11; // edx@13 |
4924 //LONG v12; // edx@23 | |
4925 //signed int v13; // edx@23 | |
0 | 4926 int v14; // edx@25 |
4927 unsigned int v15; // edi@25 | |
4928 signed int v16; // edx@27 | |
4929 int v17; // eax@54 | |
4930 unsigned int v18; // edx@57 | |
4931 int v19; // eax@65 | |
4932 int v20; // edi@67 | |
4933 int v21; // eax@72 | |
4934 int v22; // ecx@74 | |
4935 int v23; // edx@78 | |
4936 int v24; // eax@79 | |
4937 int v25; // eax@80 | |
4938 int v26; // eax@84 | |
4939 ItemGen *v27; // esi@98 | |
1575 | 4940 //unsigned int v28; // eax@98 |
1576 | 4941 //ItemGen *v29; // edi@98 |
4942 //unsigned int v30; // ecx@103 | |
0 | 4943 double v31; // st7@112 |
1576 | 4944 //unsigned __int64 v32; // qax@113 |
1575 | 4945 //unsigned int v33; // ecx@117 |
1576 | 4946 //int v34; // eax@126 |
1575 | 4947 //unsigned int v35; // ecx@127 |
0 | 4948 double v36; // st7@132 |
4949 signed __int64 v37; // qax@135 | |
1575 | 4950 //unsigned int v38; // eax@138 |
0 | 4951 Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 |
1575 | 4952 //int *v40; // [sp-Ch] [bp-9Ch]@83 |
4953 //int *v41; // [sp-8h] [bp-98h]@83 | |
4954 //int *v42; // [sp-4h] [bp-94h]@83 | |
0 | 4955 GUIWindow v43; // [sp+Ch] [bp-84h]@137 |
1575 | 4956 //unsigned int pY; // [sp+60h] [bp-30h]@2 |
0 | 4957 int v45; // [sp+64h] [bp-2Ch]@10 |
1575 | 4958 //unsigned int pX; // [sp+68h] [bp-28h]@2 |
1576 | 4959 //int v47; // [sp+6Ch] [bp-24h]@25 |
1575 | 4960 //POINT y; // [sp+70h] [bp-20h]@2 |
0 | 4961 POINT a2; // [sp+78h] [bp-18h]@2 |
1575 | 4962 //Vec3_int_ pOut; // [sp+80h] [bp-10h]@2 |
0 | 4963 unsigned int v51; // [sp+8Ch] [bp-4h]@23 |
4964 | |
1575 | 4965 if (no_rightlick_in_inventory) |
4966 return; | |
4967 | |
1614 | 4968 pMouse->GetCursorPos(&a2); |
1575 | 4969 if (a2.x <= 13 || a2.x >= 462) |
0 | 4970 return; |
1575 | 4971 |
4972 auto player = pPlayers[uActiveCharacter]; | |
4973 | |
4974 int item_pid = pRenderer->pActiveZBuffer[a2.x + pSRZBufferLineOffsets[a2.y]] & 0xFFFF; | |
4975 //pMouse->GetClickPos(&pX, &pY); | |
4976 if (!item_pid) | |
0 | 4977 { |
1575 | 4978 int inventory_mouse_x = a2.x - 14; |
4979 int inventory_mouse_y = a2.y - 17; | |
4980 | |
4981 int mouse_cell_x = inventory_mouse_x / 32; | |
4982 int mouse_cell_y = inventory_mouse_y / 32; | |
4983 | |
4984 if (mouse_cell_x + mouse_cell_y < 0) | |
4985 return; | |
4986 | |
4987 int inventory_idx = mouse_cell_x + 14 * mouse_cell_y; | |
4988 if (inventory_idx > 126) | |
0 | 4989 return; |
1575 | 4990 |
4991 v7 = player->GetItemIDAtInventoryIndex(&inventory_idx); | |
4992 if (v7 == 0) | |
4993 return; | |
4994 | |
4995 item_pid = v7; | |
0 | 4996 } |
1575 | 4997 |
4998 if (!player->CanAct()) | |
0 | 4999 { |
1575 | 5000 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], player->pName, pGlobalTXT_LocalizationStrings[541]); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5001 v43.Hint = pTmpBuf.data(); |
0 | 5002 v43.uFrameWidth = 384; |
5003 v43.uFrameHeight = 180; | |
1575 | 5004 if (a2.x <= 320 ) |
5005 v43.uFrameX = a2.x + 30; | |
5006 else | |
5007 v43.uFrameX = a2.x - 414; | |
0 | 5008 v43.uFrameY = 40; |
5009 v43.DrawMessageBox(0); | |
5010 return; | |
5011 } | |
1575 | 5012 |
5013 --item_pid; | |
5014 int alchemy_level = (int8_t)player->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY); | |
5015 v9 = alchemy_level & 0x3F; | |
5016 //v45 = alchemy_level & 0x3F; | |
5017 int alchemy_skill = SkillToMastery(alchemy_level); | |
1576 | 5018 |
5019 auto item = &player->pInventoryItemList[item_pid]; | |
5020 if (pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE) | |
0 | 5021 { |
1577 | 5022 __show_item_desc: |
1576 | 5023 GameUI_DrawItemInfo(item); |
0 | 5024 return; |
5025 } | |
1575 | 5026 |
1576 | 5027 if (pParty->pPickedItem.uItemID == ITEM_POTION_RECHARGE_ITEM) |
5028 { | |
5029 if (item->uItemID != ITEM_POTION_BOTTLE && // cant recharge bottle | |
5030 item->uItemID < ITEM_POTION_CATALYST && // cant recharge | |
5031 item->uItemID > ITEM_POTION_REJUVENATION) // all potions | |
5032 { | |
5033 if (pItemsTable->pItems[item->uItemID].uEquipType != EQUIP_WAND) // can recharge only wands | |
5034 { | |
5035 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
5036 return; | |
5037 } | |
5038 | |
5039 v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; | |
5040 if ( v36 < 0.0 ) | |
5041 v36 = 0.0; | |
5042 v37 = (signed __int64)((double)item->uMaxCharges - v36 * (double)item->uMaxCharges); | |
5043 item->uMaxCharges = v37; | |
5044 item->uNumCharges = v37; | |
5045 | |
5046 pMouse->RemoveHoldingItem(); | |
5047 no_rightlick_in_inventory = 1; | |
5048 return; | |
5049 } | |
1577 | 5050 goto __show_item_desc; |
1576 | 5051 } |
5052 | |
5053 else if (pParty->pPickedItem.uItemID == ITEM_POTION_HARDEN_ITEM) | |
5054 { | |
5055 if (item->uItemID != ITEM_POTION_BOTTLE && // cant harden bottle | |
5056 item->uItemID < ITEM_POTION_CATALYST && // cant harden | |
5057 item->uItemID > ITEM_POTION_REJUVENATION) // all potions | |
5058 { | |
5059 if (item->IsBroken() || // cant harden broken items | |
5060 item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts | |
5061 pItemsTable->pItems[item->uItemID].uEquipType < EQUIP_OFF_HAND || | |
5062 pItemsTable->pItems[item->uItemID].uEquipType > EQUIP_WAND) | |
5063 goto __invalid_item; | |
5064 | |
5065 item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_ENCHANTED; | |
5066 | |
5067 _50C9A8_item_enchantment_timer = 256; | |
5068 pMouse->RemoveHoldingItem(); | |
5069 no_rightlick_in_inventory = true; | |
5070 return; | |
5071 } | |
1577 | 5072 goto __show_item_desc; |
1576 | 5073 } |
5074 | |
5075 else if (pParty->pPickedItem.uItemID >= ITEM_POTION_FLAMING_POTION && | |
5076 pParty->pPickedItem.uItemID <= ITEM_POTION_SWIFT_POTION || | |
5077 pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) | |
5078 { | |
5079 if (item->uItemID != ITEM_POTION_BOTTLE && // cant enchant bottle | |
5080 item->uItemID < ITEM_POTION_CATALYST && // cant enchant | |
5081 item->uItemID > ITEM_POTION_REJUVENATION) // all potions | |
5082 { | |
5083 if (item->uItemID >= ITEM_BLASTER && item->uItemID <= ITEM_LASER_RIFLE || | |
5084 item->uItemID >= ITEM_ARTIFACT_PUCK || | |
5085 item->IsBroken() || | |
5086 item->uSpecEnchantmentType || | |
5087 item->uEnchantmentType || | |
5088 pItemsTable->pItems[item->uItemID].uEquipType >= EQUIP_ARMOUR) // only melee weapons and bows | |
5089 goto __invalid_item; | |
5090 | |
5091 item->UpdateTempBonus(pParty->uTimePlayed); | |
5092 if (pParty->pPickedItem.uItemID == ITEM_POTION_SLAYING_POTION) | |
5093 { | |
5094 item->uSpecEnchantmentType = 40; // of Slaying | |
5095 v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); | |
5096 } | |
5097 else | |
5098 { | |
5099 static int _4E2904_enchantment_by_potion_lut[] = | |
5100 { | |
5101 164, 93, 22, | |
5102 164, 93, 22, | |
5103 11, 5, 13, 7, 59 | |
5104 }; | |
5105 item->uSpecEnchantmentType = _4E2904_enchantment_by_potion_lut[pParty->pPickedItem.uItemID - 240]; | |
5106 v31 = (double)(1800 * pParty->pPickedItem.uEnchantmentType * 128); | |
5107 } | |
5108 | |
5109 v27->uExpireTime = pParty->uTimePlayed + v31 * 0.033333335; | |
5110 v27->uAttributes = alchemy_skill | 0x18; | |
5111 | |
5112 _50C9A8_item_enchantment_timer = 256; | |
5113 pMouse->RemoveHoldingItem(); | |
5114 no_rightlick_in_inventory = true; | |
5115 return; | |
5116 } | |
1577 | 5117 goto __show_item_desc; |
1576 | 5118 } |
5119 | |
5120 | |
5121 | |
1575 | 5122 if (pParty->pPickedItem.uItemID < ITEM_REAGENT_WIDOWSWEEP_BERRIES || |
5123 pParty->pPickedItem.uItemID > ITEM_REAGENT_PHILOSOPHERS_STONE || | |
5124 player->pInventoryItemList[item_pid].uItemID != ITEM_POTION_BOTTLE) | |
0 | 5125 { |
1575 | 5126 if (pParty->pPickedItem.uItemID < ITEM_POTION_CATALYST || |
5127 pParty->pPickedItem.uItemID > ITEM_POTION_REJUVENATION || | |
5128 player->pInventoryItemList[item_pid].uItemID < ITEM_POTION_CATALYST || | |
1576 | 5129 player->pInventoryItemList[item_pid].uItemID > ITEM_POTION_REJUVENATION) |
0 | 5130 { |
1575 | 5131 if (pParty->pPickedItem.uItemID != ITEM_POTION_HARDEN_ITEM && |
5132 (pParty->pPickedItem.uItemID < ITEM_POTION_FLAMING_POTION || pParty->pPickedItem.uItemID > ITEM_POTION_SWIFT_POTION) && | |
5133 pParty->pPickedItem.uItemID != ITEM_POTION_SLAYING_POTION && | |
5134 pParty->pPickedItem.uItemID != ITEM_POTION_RECHARGE_ITEM) | |
1577 | 5135 goto __show_item_desc; |
1576 | 5136 } |
1575 | 5137 |
1576 | 5138 // src not reagent, dst not bottle |
5139 // src potion, dst potion | |
1575 | 5140 |
1576 | 5141 v14 = item->uItemID - ITEM_POTION_CURE_WOUNDS; |
5142 v15 = pParty->pPickedItem.uItemID - ITEM_POTION_CURE_WOUNDS; | |
5143 | |
5144 if ( pParty->pPickedItem.uItemID == ITEM_POTION_CATALYST || | |
5145 item->uItemID == ITEM_POTION_CATALYST ) | |
0 | 5146 { |
5147 v16 = 5; | |
5148 } | |
5149 else | |
5150 { | |
1576 | 5151 v16 = pItemsTable->potion_data[v15][v14 + 2]; |
0 | 5152 } |
5153 v51 = v16; | |
1575 | 5154 if ( v9 ) |
0 | 5155 { |
1576 | 5156 if ( v16 < ITEM_POTION_CURE_DISEASE || v16 > ITEM_POTION_AWAKEN ) |
0 | 5157 { |
1576 | 5158 if ( v16 < ITEM_POTION_HASTE || v16 > ITEM_POTION_CURE_INSANITY ) |
0 | 5159 { |
1576 | 5160 if ( v16 < ITEM_POTION_MIGHT_BOOST || v16 > ITEM_POTION_BODY_RESISTANE ) |
0 | 5161 { |
1576 | 5162 if ( v16 >= ITEM_POTION_STONE_TO_FLESH && alchemy_level != 4 ) |
0 | 5163 { |
5164 LABEL_53: | |
5165 v51 = 4; | |
5166 goto LABEL_54; | |
5167 } | |
5168 } | |
5169 else | |
5170 { | |
1575 | 5171 if ( alchemy_level <= 2 ) |
0 | 5172 { |
5173 LABEL_38: | |
5174 v51 = 3; | |
5175 goto LABEL_54; | |
5176 } | |
5177 } | |
5178 } | |
5179 else | |
5180 { | |
1575 | 5181 if ( alchemy_level == 1 ) |
0 | 5182 { |
5183 LABEL_35: | |
5184 v51 = 2; | |
5185 goto LABEL_54; | |
5186 } | |
5187 } | |
5188 } | |
5189 } | |
5190 else | |
5191 { | |
1576 | 5192 if ( v16 >= ITEM_POTION_CURE_DISEASE && v16 <= ITEM_POTION_AWAKEN ) |
0 | 5193 { |
5194 v51 = 1; | |
5195 goto LABEL_54; | |
5196 } | |
1576 | 5197 if ( v16 >= ITEM_POTION_HASTE && v16 <= ITEM_POTION_CURE_INSANITY ) |
0 | 5198 goto LABEL_35; |
1576 | 5199 if ( v16 >= ITEM_POTION_MIGHT_BOOST && v16 <= ITEM_POTION_BODY_RESISTANE ) |
0 | 5200 goto LABEL_38; |
1576 | 5201 if ( v16 >= ITEM_POTION_STONE_TO_FLESH ) |
0 | 5202 goto LABEL_53; |
5203 } | |
5204 LABEL_54: | |
1575 | 5205 int pOut_y = 0; |
1576 | 5206 int pOut_x = item_pid + 1; |
1575 | 5207 v17 = (int)player->pInventoryMatrix; |
5208 while ( *(int *)v17 != pOut_x ) | |
0 | 5209 { |
1575 | 5210 ++pOut_y; |
0 | 5211 v17 += 4; |
1575 | 5212 if ( pOut_y >= 126 ) |
0 | 5213 { |
1575 | 5214 v18 = pOut_y; |
0 | 5215 goto LABEL_59; |
5216 } | |
5217 } | |
1575 | 5218 v18 = pOut_y; |
0 | 5219 LABEL_59: |
5220 if ( !v51 ) | |
1577 | 5221 goto __show_item_desc;; |
0 | 5222 if ( v51 == 1 ) |
5223 { | |
1575 | 5224 player->RemoveItemAtInventoryIndex(v18); |
0 | 5225 v26 = rand(); |
1575 | 5226 player->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); |
0 | 5227 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); |
437 | 5228 |
5229 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1033 | 5230 |
0 | 5231 v39.z = pParty->vPosition.z + pParty->sEyelevel; |
5232 } | |
5233 else | |
5234 { | |
5235 if ( v51 == 2 ) | |
5236 { | |
1575 | 5237 player->RemoveItemAtInventoryIndex(v18); |
0 | 5238 v25 = rand(); |
1575 | 5239 player->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); |
0 | 5240 v23 = 1; |
5241 } | |
5242 else | |
5243 { | |
5244 if ( v51 == 3 ) | |
5245 { | |
1575 | 5246 player->RemoveItemAtInventoryIndex(v18); |
0 | 5247 v24 = rand(); |
1575 | 5248 player->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); |
0 | 5249 v23 = 5; |
5250 } | |
5251 else | |
5252 { | |
5253 if ( v51 != 4 ) | |
5254 { | |
5255 if ( v51 != 5 ) | |
5256 { | |
1575 | 5257 v19 = player->AddItem(-1, 0xDCu); |
0 | 5258 if ( v19 ) |
1019 | 5259 // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; |
1575 | 5260 player->pOwnItems[v19-1].uAttributes = ITEM_IDENTIFIED; |
1576 | 5261 v20 = v14 + 50 * v15; |
1575 | 5262 player->pInventoryItemList[item_pid].uItemID = v51; |
5263 player->pInventoryItemList[item_pid].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType | |
5264 + player->pInventoryItemList[item_pid].uEnchantmentType) | |
0 | 5265 / 2; |
1575 | 5266 player->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 |
0 | 5267 LABEL_74: |
1575 | 5268 v22 = (int)((char *)player + 36 * item_pid); |
222 | 5269 if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) |
0 | 5270 *(int *)(v22 + 552) |= 1u; |
5271 if ( !dword_4E455C ) | |
1419 | 5272 { |
5273 pMouse->RemoveHoldingItem(); | |
1575 | 5274 no_rightlick_in_inventory = 1; |
1419 | 5275 return; |
5276 } | |
1575 | 5277 player->PlaySound(SPEECH_16, 0); |
1419 | 5278 dword_4E455C = 0; |
5279 pMouse->RemoveHoldingItem(); | |
1575 | 5280 no_rightlick_in_inventory = 1; |
1419 | 5281 return; |
0 | 5282 } |
1575 | 5283 if ( v9 ) |
0 | 5284 { |
1575 | 5285 if ( *(int *)(player + 36 * item_pid + 532) == 221 ) |
5286 *(int *)(player + 36 * item_pid + 532) = pParty->pPickedItem.uItemID; | |
0 | 5287 else |
1575 | 5288 *(int *)(player + 36 * item_pid + 536) = pParty->pPickedItem.uEnchantmentType; |
5289 v21 = player->AddItem(-1, 0xDCu); | |
0 | 5290 if ( v21 ) |
1019 | 5291 //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; |
1575 | 5292 player->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; |
0 | 5293 goto LABEL_74; |
5294 } | |
1577 | 5295 goto __show_item_desc; |
0 | 5296 } |
1575 | 5297 player->RemoveItemAtInventoryIndex(v18); |
5298 player->SetCondition(0x10u, 0); | |
0 | 5299 v23 = 0; |
5300 } | |
5301 } | |
1575 | 5302 player->ItemsEnchant(v23); |
0 | 5303 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); |
437 | 5304 |
5305 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1033 | 5306 |
0 | 5307 v39.z = pParty->vPosition.z + pParty->sEyelevel; |
5308 } | |
1575 | 5309 v39.x = pParty->vPosition.x; |
5310 v39.y = pParty->vPosition.y; | |
5311 | |
5312 int rot_x, rot_y, rot_z; | |
5313 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, &rot_x, &rot_y, &rot_z); | |
5314 sub_42F7EB_DropItemAt(0x41Bu, rot_x, rot_y, rot_z, 0, 1, 0, 0, 0); | |
0 | 5315 if ( dword_4E455C ) |
5316 { | |
1575 | 5317 if ( player->CanAct() ) |
5318 player->PlaySound(SPEECH_17, 0); | |
0 | 5319 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); |
5320 dword_4E455C = 0; | |
5321 } | |
5322 pMouse->RemoveHoldingItem(); | |
1575 | 5323 no_rightlick_in_inventory = 1; |
0 | 5324 return; |
5325 } | |
1575 | 5326 |
1576 | 5327 // end alchemy |
5328 | |
1575 | 5329 player->pInventoryItemList[item_pid].uEnchantmentType = v9 + pItemsTable->pItems[pParty->pPickedItem.uItemID].uDamageDice; |
0 | 5330 switch ( pParty->pPickedItem.uItemID ) |
5331 { | |
5332 case 0xC8u: | |
5333 case 0xC9u: | |
5334 case 0xCAu: | |
5335 case 0xCBu: | |
5336 case 0xCCu: | |
1575 | 5337 player->pInventoryItemList[item_pid].uItemID = 222; |
0 | 5338 break; |
5339 case 0xCDu: | |
5340 case 0xCEu: | |
5341 case 0xCFu: | |
5342 case 0xD0u: | |
5343 case 0xD1u: | |
1575 | 5344 player->pInventoryItemList[item_pid].uItemID = 223; |
0 | 5345 break; |
5346 case 0xD2u: | |
5347 case 0xD3u: | |
5348 case 0xD4u: | |
5349 case 0xD5u: | |
5350 case 0xD6u: | |
1575 | 5351 player->pInventoryItemList[item_pid].uItemID = 224; |
0 | 5352 break; |
5353 case 0xD7u: | |
5354 case 0xD8u: | |
5355 case 0xD9u: | |
5356 case 0xDAu: | |
5357 case 0xDBu: | |
1575 | 5358 player->pInventoryItemList[item_pid].uItemID = 221; |
0 | 5359 break; |
5360 default: | |
5361 break; | |
5362 } | |
5363 pMouse->RemoveHoldingItem(); | |
1575 | 5364 no_rightlick_in_inventory = 1; |
0 | 5365 if ( dword_4E455C ) |
5366 { | |
1575 | 5367 player->PlaySound(SPEECH_16, 0); |
0 | 5368 dword_4E455C = 0; |
5369 } | |
1576 | 5370 return; |
5371 | |
5372 | |
5373 __invalid_item: | |
5374 pMouse->RemoveHoldingItem(); | |
5375 no_rightlick_in_inventory = true; | |
5376 return; | |
0 | 5377 } |
5378 | |
5379 //----- (00417AD4) -------------------------------------------------------- | |
983 | 5380 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) |
1393 | 5381 { |
5382 switch (uPlayerClass % 4) | |
269 | 5383 { |
1393 | 5384 case 0: |
269 | 5385 { |
1393 | 5386 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level) |
5387 return ui_character_skillinfo_can_learn; | |
5388 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level && | |
5389 byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level) | |
5390 { | |
5391 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType] < skill_level) | |
5392 return ui_character_skillinfo_cant_learn; | |
5393 } | |
5394 return ui_character_skillinfo_can_learn_gm; | |
0 | 5395 } |
1393 | 5396 break; |
5397 | |
5398 case 1: | |
269 | 5399 { |
1393 | 5400 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level) |
5401 return ui_character_skillinfo_can_learn; | |
5402 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level) | |
5403 { | |
5404 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level) | |
5405 return ui_character_skillinfo_cant_learn; | |
5406 } | |
5407 return ui_character_skillinfo_can_learn_gm; | |
0 | 5408 } |
1393 | 5409 break; |
5410 | |
5411 case 2: | |
5412 case 3: | |
5413 { | |
5414 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level) | |
5415 return ui_character_skillinfo_cant_learn; | |
5416 return ui_character_skillinfo_can_learn; | |
5417 } | |
5418 break; | |
0 | 5419 } |
1575 | 5420 Error("Invalid player class: %u", uPlayerClass); |
1296 | 5421 } |