Mercurial > mm7
annotate mm7_5.cpp @ 1326:e70fe5d77928
UIMSG_CastSpell_Telekinesis
author | Ritor1 |
---|---|
date | Mon, 01 Jul 2013 09:26:30 +0600 |
parents | 8c2f689b5f0b |
children | f0be1fecd642 3358b59b8fe8 |
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 |
303 | 5 #include <assert.h> |
6 | |
1262 | 7 #include "Texture.h" |
8 #include "mm7_data.h" | |
1016 | 9 #include "VideoPlayer.h" |
10 #include "Sprites.h" | |
11 #include "MapInfo.h" | |
12 #include "BSPModel.h" | |
13 #include "OutdoorCamera.h" | |
14 #include "LightmapBuilder.h" | |
15 #include "DecalBuilder.h" | |
16 #include "Mouse.h" | |
17 #include "Keyboard.h" | |
18 #include "GammaControl.h" | |
19 #include "stru11.h" | |
1263 | 20 #include "mm7_data.h" |
21 #include "FactionTable.h" | |
1016 | 22 #include "Vis.h" |
0 | 23 #include "mm7.h" |
24 #include "Game.h" | |
25 #include "GUIWindow.h" | |
26 #include "GUIFont.h" | |
27 #include "GUIProgressBar.h" | |
28 #include "Party.h" | |
29 #include "AudioPlayer.h" | |
30 #include "Outdoor.h" | |
31 #include "Arcomage.h" | |
32 #include "LOD.h" | |
33 #include "Actor.h" | |
34 #include "Events.h" | |
35 #include "Viewport.h" | |
36 #include "FrameTableInc.h" | |
37 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
38 #include "SpriteObject.h" |
0 | 39 #include "ObjectList.h" |
40 #include "Chest.h" | |
41 #include "PaletteManager.h" | |
42 #include "SaveLoad.h" | |
43 #include "Time.h" | |
44 #include "TurnEngine.h" | |
924 | 45 #include "CastSpellInfo.h" |
0 | 46 #include "stru298.h" |
47 #include "Events2D.h" | |
189 | 48 #include "texts.h" |
0 | 49 #include "Log.h" |
1299 | 50 #include "UI\UIHouses.h" |
1262 | 51 #include "Lights.h" |
52 #include "Lights.h" | |
0 | 53 |
54 //----- (004304E7) -------------------------------------------------------- | |
55 void __cdecl GameUI_MsgProc() | |
56 { | |
978 | 57 //signed int v0; // edi@6 |
1025 | 58 //char *v1; // esi@6 |
0 | 59 unsigned int v2; // edx@7 |
60 Actor *pActor; // ecx@13 | |
61 int v4; // ecx@18 | |
199 | 62 //NPCData *pNPCData0; // eax@18 |
63 //int v6; // edx@20 | |
64 //int v7; // ecx@29 | |
916 | 65 //unsigned int v8; // edx@59 |
66 //unsigned int v9; // ecx@60 | |
0 | 67 unsigned int v10; // ecx@73 |
437 | 68 //unsigned int v11; // eax@75 |
0 | 69 unsigned __int8 v12; // sf@75 |
70 unsigned __int8 v13; // of@75 | |
71 int v14; // eax@98 | |
72 unsigned int v15; // eax@102 | |
73 unsigned __int8 v16; // al@104 | |
74 unsigned __int8 v17; // al@105 | |
75 int v18; // eax@106 | |
76 float v19; // ST64_4@121 | |
77 unsigned int v20; // ecx@121 | |
78 float v21; // ST64_4@126 | |
79 float v22; // ST64_4@127 | |
80 unsigned int v23; // ecx@135 | |
81 unsigned int v24; // ecx@149 | |
82 unsigned int v25; // ecx@165 | |
83 GUIWindow *pWindow; // eax@204 | |
84 unsigned int v27; // edx@204 | |
85 unsigned int v28; // ecx@204 | |
86 GUIWindow *pWindow2; // ecx@248 | |
978 | 87 //int v30; // edx@258 |
88 //const char *v31; // ecx@262 | |
0 | 89 signed int v32; // eax@269 |
90 unsigned int v33; // eax@277 | |
91 unsigned __int8 v34; // al@279 | |
92 unsigned __int8 v35; // al@280 | |
1000 | 93 //GUIWindow *pWindow3; // ecx@332 |
0 | 94 int v37; // eax@341 |
95 int v38; // eax@358 | |
96 SHORT v39; // ax@365 | |
910 | 97 //signed int v40; // eax@365 |
0 | 98 char *v41; // eax@380 |
99 int v42; // eax@396 | |
100 POINT *pPoint; // eax@397 | |
101 signed int v44; // eax@398 | |
102 int v45; // edx@398 | |
103 signed int v46; // ecx@398 | |
104 char v47; // zf@399 | |
105 char v48; // zf@405 | |
106 BLVFace *pBLVFace; // ecx@410 | |
107 ODMFace *pODMFace; // ecx@412 | |
1000 | 108 CastSpellInfo *pSpellInfo; // ecx@415 |
0 | 109 void *v52; // eax@424 |
110 __int16 v53; // ax@431 | |
111 int v54; // eax@432 | |
112 int v55; // ecx@432 | |
113 int v56; // edx@432 | |
114 int v57; // eax@432 | |
115 Player *pPlayer; // edx@442 | |
116 unsigned int v59; // eax@445 | |
117 signed int v60; // ST64_4@459 | |
118 NPCData *pNPCData2; // eax@467 | |
119 unsigned __int64 v62; // kr00_8@467 | |
120 __int16 v63; // dx@479 | |
121 unsigned int v64; // eax@486 | |
122 int v65; // ecx@486 | |
123 int v66; // eax@488 | |
124 char *v67; // eax@489 | |
125 __int16 v68; // dx@498 | |
126 char *v69; // eax@512 | |
127 int v70; // eax@525 | |
128 int v71; // edi@527 | |
129 NPCData *pNPCData3; // esi@527 | |
130 char *v73; // ecx@533 | |
131 signed int v74; // edi@535 | |
132 int v75; // eax@535 | |
133 int v76; // esi@535 | |
134 int v77; // eax@537 | |
135 Player *pPlayer2; // ecx@549 | |
916 | 136 //int v79; // ecx@550 |
137 //unsigned int v80; // edx@550 | |
0 | 138 signed int v81; // eax@552 |
139 POINT *pPoint2; // eax@553 | |
140 signed int v83; // ecx@554 | |
141 signed int v84; // ecx@554 | |
142 GUIButton *pButton; // eax@578 | |
143 unsigned int v86; // eax@583 | |
144 const char *v87; // ecx@595 | |
145 const char *v88; // ecx@596 | |
916 | 146 //unsigned int v89; // eax@598 |
0 | 147 unsigned int v90; // eax@602 |
148 int v91; // edx@605 | |
149 int v92; // eax@605 | |
150 int v93; // edx@605 | |
151 int pPlayerNum; // edx@611 | |
152 int v95; // eax@611 | |
916 | 153 //const char *v96; // ecx@621 |
0 | 154 unsigned int v97; // eax@624 |
155 int v98; // eax@636 | |
156 unsigned __int8 v99; // al@643 | |
157 Player *pPlayer3; // eax@648 | |
158 int v101; // ecx@648 | |
159 int v102; // edx@652 | |
160 int v103; // eax@671 | |
161 Player *pPlayer4; // ecx@718 | |
162 int v105; // eax@718 | |
163 Player *pPlayer5; // ST78_4@758 | |
164 unsigned int v107; // eax@758 | |
165 unsigned int v108; // eax@758 | |
166 unsigned int v115; // eax@764 | |
167 int v116; // eax@776 | |
168 POINT *pPoint3; // eax@777 | |
169 unsigned int v118; // eax@785 | |
170 unsigned int v119; // ecx@786 | |
171 unsigned int v120; // [sp-28h] [bp-624h]@86 | |
172 unsigned int v121; // [sp-28h] [bp-624h]@711 | |
173 unsigned int v122; // [sp-24h] [bp-620h]@86 | |
174 unsigned int v123; // [sp-24h] [bp-620h]@711 | |
175 unsigned int v124; // [sp-20h] [bp-61Ch]@86 | |
176 unsigned int v125; // [sp-20h] [bp-61Ch]@711 | |
177 unsigned int v126; // [sp-1Ch] [bp-618h]@86 | |
178 int v127; // [sp-1Ch] [bp-618h]@107 | |
179 unsigned int v128; // [sp-1Ch] [bp-618h]@711 | |
180 int v129; // [sp-18h] [bp-614h]@86 | |
916 | 181 //signed int v130; // [sp-18h] [bp-614h]@107 |
0 | 182 int v131; // [sp-14h] [bp-610h]@86 |
916 | 183 //unsigned int v132; // [sp-14h] [bp-610h]@107 |
184 //unsigned int v133; // [sp-10h] [bp-60Ch]@60 | |
0 | 185 unsigned int v134; // [sp-10h] [bp-60Ch]@86 |
916 | 186 //signed int v135; // [sp-10h] [bp-60Ch]@107 |
0 | 187 unsigned int v136; // [sp-10h] [bp-60Ch]@121 |
916 | 188 //unsigned int v137; // [sp-Ch] [bp-608h]@60 |
0 | 189 unsigned int v138; // [sp-Ch] [bp-608h]@86 |
916 | 190 //signed int v139; // [sp-Ch] [bp-608h]@107 |
0 | 191 unsigned int v140; // [sp-Ch] [bp-608h]@121 |
192 enum WindowType pWindowType; // [sp-8h] [bp-604h]@56 | |
916 | 193 //enum WindowType pWindowType1; // [sp-8h] [bp-604h]@60 |
0 | 194 unsigned __int8 v143; // [sp-8h] [bp-604h]@86 |
916 | 195 //int v144; // [sp-8h] [bp-604h]@107 |
0 | 196 enum WindowType pWindowType2; // [sp-8h] [bp-604h]@121 |
916 | 197 //const char *v146; // [sp-8h] [bp-604h]@449 |
198 //unsigned int v147; // [sp-8h] [bp-604h]@550 | |
710 | 199 //int v148; // [sp-4h] [bp-600h]@56 |
0 | 200 GUIButton *pButton2; // [sp-4h] [bp-600h]@59 |
201 const char *v150; // [sp-4h] [bp-600h]@86 | |
916 | 202 //unsigned int v151; // [sp-4h] [bp-600h]@107 |
0 | 203 int v152; // [sp-4h] [bp-600h]@121 |
204 int v153; // [sp-4h] [bp-600h]@135 | |
961 | 205 //int v154; // [sp-4h] [bp-600h]@149 |
0 | 206 int v155; // [sp-4h] [bp-600h]@165 |
207 int v156; // [sp-4h] [bp-600h]@204 | |
916 | 208 //const char *v157; // [sp-4h] [bp-600h]@444 |
0 | 209 unsigned int v158; // [sp-4h] [bp-600h]@449 |
916 | 210 //__int16 v159; // [sp-4h] [bp-600h]@550 |
0 | 211 int v160; // [sp-4h] [bp-600h]@599 |
212 const char *v161; // [sp-4h] [bp-600h]@637 | |
710 | 213 //int v162; // [sp+0h] [bp-5FCh]@56 |
916 | 214 //int v163; // [sp+0h] [bp-5FCh]@59 |
0 | 215 Texture *pTexture; // [sp+0h] [bp-5FCh]@86 |
916 | 216 //int v165; // [sp+0h] [bp-5FCh]@107 |
0 | 217 int v166; // [sp+0h] [bp-5FCh]@121 |
218 int v167; // [sp+0h] [bp-5FCh]@135 | |
978 | 219 //int v168; // [sp+0h] [bp-5FCh]@149 |
0 | 220 int v169; // [sp+0h] [bp-5FCh]@165 |
221 int v170; // [sp+0h] [bp-5FCh]@204 | |
978 | 222 //signed int v171; // [sp+0h] [bp-5FCh]@259 |
0 | 223 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287 |
224 char *v173; // [sp+0h] [bp-5FCh]@444 | |
225 char *v174; // [sp+0h] [bp-5FCh]@449 | |
916 | 226 //int v175; // [sp+0h] [bp-5FCh]@550 |
0 | 227 int v176; // [sp+0h] [bp-5FCh]@599 |
228 const char *v177; // [sp+0h] [bp-5FCh]@629 | |
229 char *v178; // [sp+0h] [bp-5FCh]@637 | |
230 int v179; // [sp+4h] [bp-5F8h]@0 | |
199 | 231 //signed int _this; // [sp+14h] [bp-5E8h]@22 |
0 | 232 signed int thisa; // [sp+14h] [bp-5E8h]@251 |
233 signed int thisb; // [sp+14h] [bp-5E8h]@272 | |
234 Player *pPlayer7; // [sp+14h] [bp-5E8h]@373 | |
235 Player *pPlayer8; // [sp+14h] [bp-5E8h]@377 | |
236 char *thise; // [sp+14h] [bp-5E8h]@445 | |
237 Player *pPlayer9; // [sp+14h] [bp-5E8h]@455 | |
238 int thisg; // [sp+14h] [bp-5E8h]@467 | |
239 int thish; // [sp+14h] [bp-5E8h]@528 | |
240 signed int thisi; // [sp+14h] [bp-5E8h]@535 | |
241 MapInfo *pMapInfo; // [sp+14h] [bp-5E8h]@604 | |
242 Player *pPlayer10; // [sp+14h] [bp-5E8h]@641 | |
243 int thisl; // [sp+14h] [bp-5E8h]@648 | |
244 int uMessageParam; // [sp+18h] [bp-5E4h]@7 | |
245 int uAction; // [sp+1Ch] [bp-5E0h]@18 | |
246 NPCData *pNPCData4; // [sp+20h] [bp-5DCh]@23 | |
247 unsigned int uNumSeconds; // [sp+24h] [bp-5D8h]@18 | |
248 char v197; // [sp+2Bh] [bp-5D1h]@101 | |
249 enum UIMessageType uMessage; // [sp+2Ch] [bp-5D0h]@7 | |
250 unsigned int v199; // [sp+30h] [bp-5CCh]@7 | |
251 char *v200; // [sp+34h] [bp-5C8h]@518 | |
252 POINT v201; // [sp+38h] [bp-5C4h]@553 | |
253 POINT v202; // [sp+40h] [bp-5BCh]@141 | |
254 POINT a2; // [sp+48h] [bp-5B4h]@127 | |
255 POINT v204; // [sp+50h] [bp-5ACh]@777 | |
256 POINT v205; // [sp+58h] [bp-5A4h]@171 | |
257 POINT v206; // [sp+60h] [bp-59Ch]@553 | |
258 POINT v207; // [sp+68h] [bp-594h]@155 | |
259 POINT v208; // [sp+70h] [bp-58Ch]@397 | |
260 POINT v209; // [sp+78h] [bp-584h]@777 | |
261 POINT v210; // [sp+80h] [bp-57Ch]@397 | |
262 POINT v211; // [sp+88h] [bp-574h]@704 | |
263 __int64 v212; // [sp+90h] [bp-56Ch]@467 | |
783 | 264 int v213; // [sp+98h] [bp-564h]@385 |
265 char pLevelName[32]; // [sp+9Ch] [bp-560h]@380 | |
266 char pOut[32]; // [sp+BCh] [bp-540h]@370 | |
0 | 267 FrameTableTxtLine v216; // [sp+DCh] [bp-520h]@524 |
268 int v217[9]; // [sp+158h] [bp-4A4h]@652 | |
269 FrameTableTxtLine v218; // [sp+17Ch] [bp-480h]@524 | |
270 char a1[64]; // [sp+1F8h] [bp-404h]@467 | |
271 char Str2[128]; // [sp+238h] [bp-3C4h]@527 | |
272 Actor actor; // [sp+2B8h] [bp-344h]@4 | |
273 | |
274 dword_50CDC8 = 0; | |
275 if ( !pEventTimer->bPaused ) | |
276 { | |
277 pParty->sEyelevel = pParty->uDefaultEyelevel; | |
278 pParty->uPartyHeight = pParty->uDefaultPartyHeight; | |
279 } | |
280 if ( bDialogueUI_InitializeActor_NPC_ID ) | |
281 { | |
282 //Actor::Actor(&actor); | |
283 memset(&actor, 0, 0x344u); | |
284 dword_5B65D0_dialogue_actor_npc_id = bDialogueUI_InitializeActor_NPC_ID; | |
602 | 285 actor.sNPC_ID = bDialogueUI_InitializeActor_NPC_ID; |
1033 | 286 GameUI_InitializeDialogue(&actor, false); |
0 | 287 bDialogueUI_InitializeActor_NPC_ID = 0; |
288 } | |
289 if ( pMessageQueue_50CBD0->uNumMessages ) | |
290 { | |
1025 | 291 //v1 = ""; |
0 | 292 while ( 2 ) |
293 { | |
294 if ( !pMessageQueue_50CBD0->uNumMessages ) | |
295 break; | |
296 | |
297 pMessageQueue_50CBD0->PopMessage(&uMessage, &uMessageParam, (int *)&v199); | |
298 switch ( uMessage ) | |
299 { | |
300 case UIMSG_ChangeGameState: | |
978 | 301 uGameState = GAME_FINISHED; |
4 | 302 continue; |
0 | 303 case UIMSG_PlayArcomage: |
304 pVideoPlayer->_4BF5B2(); | |
305 pArcomageGame->bGameInProgress = 1; | |
306 PrepareArcomage(); | |
4 | 307 continue; |
0 | 308 case UIMSG_StartNPCDialogue: |
309 if ( !uActiveCharacter ) | |
4 | 310 continue; |
978 | 311 viewparams->field_48 = 1; |
0 | 312 if ( pMessageQueue_50CBD0->uNumMessages ) |
313 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
602 | 314 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID; |
0 | 315 pActor = &pActors[uMessageParam]; |
4 | 316 //goto _actor_init_dlg; |
1033 | 317 GameUI_InitializeDialogue(pActor, true); |
4 | 318 continue; |
199 | 319 case UIMSG_StartHireling1Dialogue: |
320 case UIMSG_StartHireling2Dialogue: | |
321 { | |
322 if (bNoNPCHiring || pCurrentScreen) | |
323 continue; | |
324 | |
0 | 325 if ( pMessageQueue_50CBD0->uNumMessages ) |
326 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
327 uAction = 0; | |
201 | 328 int hireling_idx = uMessage - UIMSG_StartHireling1Dialogue; |
0 | 329 v4 = 0; |
199 | 330 |
331 for (uint i = 0; i < 2; ++i) | |
332 //pNPCData0 = pParty->pHirelings; | |
333 //do | |
334 { | |
335 if (pParty->pHirelings[i].pName) | |
336 //{ | |
337 //v6 = uAction++; | |
338 pTmpBuf[uAction++] = i; | |
339 //} | |
340 //++pNPCData0; | |
341 //++v4; | |
342 } | |
343 //while ( (signed int)pNPCData0 < (signed int)&pParty->pPickedItem ); | |
344 | |
345 //_this = 0; | |
346 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
347 { | |
348 auto npc = pNPCStats->pNewNPCData + i; | |
349 //do | |
350 //{ | |
248 | 351 if (npc->Hired() && |
199 | 352 (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)) && |
353 (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) ) | |
0 | 354 { |
199 | 355 //v7 =; |
356 pTmpBuf[uAction++] = i + 2; | |
0 | 357 } |
199 | 358 //++_this; |
359 //++pNPCData4; | |
360 //} | |
361 //while ( _this < (signed int)pNPCStats->uNumNewNPCs ); | |
0 | 362 } |
201 | 363 |
364 if ( (signed int)(hireling_idx + (unsigned __int8)pParty->field_709) < uAction ) | |
0 | 365 { |
366 //Actor::Actor(&actor); | |
367 memset(&actor, 0, 0x344u); | |
602 | 368 actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx; |
0 | 369 pActor = &actor; |
1033 | 370 GameUI_InitializeDialogue(&actor, true); |
0 | 371 } |
372 } | |
4 | 373 continue; |
735 | 374 |
375 case UIMSG_BuyInShop_Identify_Repair: | |
376 UIShop_Buy_Identify_Repair(); | |
377 continue; | |
467 | 378 case UIMSG_ClickNPCTopic: |
379 ClickNPCTopic(uMessageParam); | |
380 continue; | |
651 | 381 case UIMSG_SelectShopDialogueOption: |
382 OnSelectShopDialogueOption(uMessageParam); | |
383 continue; | |
384 case UIMSG_SelectNPCDialogueOption: | |
385 OnSelectNPCDialogueOption((DIALOGUE_TYPE)uMessageParam); | |
4 | 386 continue; |
961 | 387 case UIMSG_ClickHouseNPCPortrait: |
0 | 388 _4B4224_UpdateNPCTopics(uMessageParam); |
4 | 389 continue; |
0 | 390 case UIMSG_StartNewGame: |
391 if ( dword_6BE138 == 124 || uMessageParam ) | |
392 { | |
1006 | 393 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 394 pIcons_LOD->_4114F2(); |
395 if ( pMessageQueue_50CBD0->uNumMessages ) | |
396 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
397 pGUIWindow_CurrentMenu->Release(); | |
978 | 398 uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU; |
151 | 399 pCurrentScreen = SCREEN_GAME; |
978 | 400 viewparams->bRedrawGameUI = 1; |
0 | 401 } |
402 else | |
403 { | |
404 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2u);// "Are you sure? Click again to start a New Game" | |
405 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); | |
406 dword_6BE138 = 124; | |
407 } | |
408 stru_506E40.Release(); | |
4 | 409 continue; |
0 | 410 case UIMSG_Game_OpenLoadGameDialog: |
1006 | 411 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 412 pIcons_LOD->_4114F2(); |
413 if ( pMessageQueue_50CBD0->uNumMessages ) | |
414 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
415 pGUIWindow_CurrentMenu->Release(); | |
151 | 416 pCurrentScreen = SCREEN_LOADGAME; |
1033 | 417 LoadUI_Load(1); |
4 | 418 continue; |
0 | 419 case UIMSG_Quit: |
420 if ( dword_6BE138 == 132 || uMessageParam ) | |
421 { | |
1006 | 422 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 423 pIcons_LOD->_4114F2(); |
424 if ( pMessageQueue_50CBD0->uNumMessages ) | |
425 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
426 pGUIWindow_CurrentMenu->Release(); | |
151 | 427 pCurrentScreen = SCREEN_GAME; |
978 | 428 viewparams->bRedrawGameUI = 1; |
0 | 429 if ( !uMessageParam ) |
430 pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0); | |
978 | 431 uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU; |
0 | 432 } |
433 else | |
434 { | |
369 | 435 ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit" |
0 | 436 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); |
437 dword_6BE138 = 132; | |
438 } | |
4 | 439 stru_506E40.Release(); |
440 continue; | |
151 | 441 case UIMSG_80: |
987 | 442 __debugbreak(); |
1006 | 443 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 444 pIcons_LOD->_4114F2(); |
445 pGUIWindow_CurrentMenu->Release(); | |
151 | 446 pCurrentScreen = SCREEN_OPTIONS; |
710 | 447 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_8, 0, 0); |
11 | 448 continue; |
2 | 449 case UIMSG_ArrowUp: |
450 --pSaveListPosition; | |
451 if ( pSaveListPosition < 0 ) | |
452 pSaveListPosition = 0; | |
962 | 453 GUIWindow::Create(215, 199, 17, 17, WINDOW_PressedButton2, (int)pBtnArrowUp, 0); |
11 | 454 continue; |
2 | 455 case UIMSG_DownArrow: |
456 ++pSaveListPosition; | |
457 if ( pSaveListPosition >= uMessageParam ) | |
458 pSaveListPosition = uMessageParam - 1; | |
962 | 459 GUIWindow::Create(215, 323, 17, 17, WINDOW_PressedButton2, (int)pBtnDownArrow, 0); |
11 | 460 continue; |
2 | 461 case UIMSG_Cancel: |
962 | 462 GUIWindow::Create(350, 302, 106, 42, WINDOW_CloseRestWindowBtn, (int)pBtnCancel, 0); |
11 | 463 continue; |
961 | 464 case UIMSG_SaveLoadBtn: |
465 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); | |
11 | 466 continue; |
3 | 467 case UIMSG_SelectLoadSlot: |
1038 | 468 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
469 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
151 | 470 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam ) |
2 | 471 { |
472 v10 = pSaveListPosition + uMessageParam; | |
473 if ( dword_6BE138 == pSaveListPosition + uMessageParam ) | |
0 | 474 { |
961 | 475 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); |
437 | 476 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); |
0 | 477 } |
478 uLoadGameUI_SelectedSlot = v10; | |
479 dword_6BE138 = v10; | |
480 } | |
481 else | |
482 { | |
3 | 483 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); |
43 | 484 if ( strcmp((const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pGlobalTXT_LocalizationStrings[72]) )// "Empty" |
485 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, (const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot]); | |
0 | 486 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); |
487 } | |
4 | 488 continue; |
0 | 489 case UIMSG_LoadGame: |
490 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) | |
491 { | |
492 LoadGame(uLoadGameUI_SelectedSlot); | |
1214
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1207
diff
changeset
|
493 uGameState = GAME_STATE_LOADING_GAME; |
0 | 494 } |
4 | 495 stru_506E40.Release(); |
496 continue; | |
0 | 497 case UIMSG_SaveGame: |
1038 | 498 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
499 { | |
500 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
837 | 501 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer); |
0 | 502 } |
503 DoSavegame(uLoadGameUI_SelectedSlot); | |
4 | 504 stru_506E40.Release(); |
505 continue; | |
151 | 506 case UIMSG_Game_OpenSaveGameDialog: |
0 | 507 pGUIWindow_CurrentMenu->Release(); |
151 | 508 pCurrentScreen = SCREEN_SAVEGAME; |
1033 | 509 SaveUI_Load(); |
4 | 510 continue; |
369 | 511 case UIMSG_Game_OpenOptionsDialog://Open |
0 | 512 if ( pMessageQueue_50CBD0->uNumMessages ) |
513 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
514 pGUIWindow_CurrentMenu->Release(); | |
978 | 515 viewparams->field_48 = 1; |
151 | 516 pCurrentScreen = SCREEN_OPTIONS; |
948 | 517 |
518 options_menu_skin.uTextureID_Background = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE); | |
519 options_menu_skin.uTextureID_TurnSpeed[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE); | |
520 options_menu_skin.uTextureID_TurnSpeed[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE); | |
521 options_menu_skin.uTextureID_TurnSpeed[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE); | |
522 options_menu_skin.uTextureID_ArrowLeft = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE); | |
523 options_menu_skin.uTextureID_ArrowRight = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE); | |
524 options_menu_skin.uTextureID_SoundLevels[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE); | |
525 options_menu_skin.uTextureID_SoundLevels[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE); | |
526 options_menu_skin.uTextureID_SoundLevels[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE); | |
527 options_menu_skin.uTextureID_SoundLevels[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE); | |
528 options_menu_skin.uTextureID_SoundLevels[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE); | |
529 options_menu_skin.uTextureID_SoundLevels[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE); | |
530 options_menu_skin.uTextureID_SoundLevels[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE); | |
531 options_menu_skin.uTextureID_SoundLevels[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE); | |
532 options_menu_skin.uTextureID_SoundLevels[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE); | |
533 options_menu_skin.uTextureID_SoundLevels[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); | |
534 options_menu_skin.uTextureID_FlipOnExit = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE); | |
535 options_menu_skin.uTextureID_AlwaysRun = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE); | |
536 options_menu_skin.uTextureID_ShowDamage = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE); | |
537 options_menu_skin.uTextureID_WalkSound = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE); | |
538 | |
0 | 539 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0); |
832 | 540 pGUIWindow_CurrentMenu->CreateButton(22, 270, |
948 | 541 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth, |
542 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight, | |
1025 | 543 1, 0, UIMSG_SetTurnSpeed, 0x80, 0, "", 0); |
948 | 544 pGUIWindow_CurrentMenu->CreateButton(93, 270, |
545 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth, | |
546 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight, | |
1025 | 547 1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, "", 0); |
948 | 548 pGUIWindow_CurrentMenu->CreateButton(164, 270, |
549 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth, | |
550 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight, | |
1025 | 551 1, 0, UIMSG_SetTurnSpeed, 0, 0, "", 0); |
948 | 552 |
553 pGUIWindow_CurrentMenu->CreateButton(20, 303, | |
554 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth, | |
555 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight, | |
1025 | 556 1, 0, UIMSG_ToggleWalkSound, 0, 0, "", 0); |
948 | 557 pGUIWindow_CurrentMenu->CreateButton(128, 303, |
558 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth, | |
559 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight, | |
1025 | 560 1, 0, UIMSG_ToggleShowDamage, 0, 0, "", 0); |
948 | 561 pGUIWindow_CurrentMenu->CreateButton(20, 325, |
562 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth, | |
563 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight, | |
1025 | 564 1, 0, UIMSG_ToggleAlwaysRun, 0, 0, "", 0); |
948 | 565 pGUIWindow_CurrentMenu->CreateButton(128, 325, |
566 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth, | |
567 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight, | |
1025 | 568 1, 0, UIMSG_ToggleFlipOnExit, 0, 0, "", 0); |
569 | |
570 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
571 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
572 pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, "", 0); | |
573 | |
574 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
575 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
576 pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, "", 0); | |
577 | |
578 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
579 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
580 pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, "", 0); | |
978 | 581 |
582 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game" | |
1025 | 583 pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, "", 0); |
584 pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, "", 0); | |
948 | 585 continue; |
586 | |
369 | 587 case UIMSG_OpenKeyMappingOptions://Open |
0 | 588 if ( pMessageQueue_50CBD0->uNumMessages ) |
589 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
590 pGUIWindow_CurrentMenu->Release(); | |
591 viewparams->field_48 = 1; | |
151 | 592 pCurrentScreen = SCREEN_KEYBOARD_OPTIONS; |
369 | 593 uTextureID_Optkb[0] = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE); |
594 uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE); | |
595 uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); | |
596 uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE); | |
597 uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE); | |
0 | 598 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_KeyMappingOptions, 0, 0); |
832 | 599 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0); |
600 pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0); | |
601 pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0); | |
602 pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0); | |
603 pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0); | |
604 pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0); | |
605 pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 1u, 0, "", 0); | |
606 pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 2u, 0, "", 0); | |
607 pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 3u, 0, "", 0); | |
608 pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, UIMSG_ChangeKeyButton, 4u, 0, "", 0); | |
609 pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 5u, 0, "", 0); | |
610 pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 6u, 0, "", 0); | |
611 pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 7u, 0, "", 0); | |
612 pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 8u, 0, "", 0); | |
613 pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0); | |
614 pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0); | |
615 pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0); | |
616 pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0); | |
617 pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0); | |
1031 | 618 uGameMenuUI_CurentlySelectedKeyIdx = -1; |
362 | 619 KeyboardPageNum = 1; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
620 memset(GameMenuUI_InvaligKeyBindingsFlags.data(), 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); |
369 | 621 //*(_WORD *)KeyButtonArray[28] = 0; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
622 memcpy(pPrevVirtualCidesMapping.data(), pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); |
1025 | 623 //v1 = ""; |
978 | 624 //v0 = 1; |
11 | 625 continue; |
362 | 626 case UIMSG_ChangeKeyButton: |
1031 | 627 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 ) |
362 | 628 { |
629 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
630 continue; | |
631 } | |
0 | 632 v14 = uMessageParam; |
978 | 633 if ( KeyboardPageNum != 1 ) |
0 | 634 v14 = uMessageParam + 14; |
1031 | 635 uGameMenuUI_CurentlySelectedKeyIdx = v14; |
978 | 636 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu); |
4 | 637 continue; |
0 | 638 case UIMSG_ResetKeyMapping: |
639 v197 = 1; | |
640 pKeyActionMap->SetDefaultMapping(); | |
641 uAction = 0; | |
642 do | |
643 { | |
644 v15 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
645 if ( v15 != pPrevVirtualCidesMapping[uAction] ) | |
646 { | |
647 if ( v197 ) | |
648 { | |
649 v16 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
978 | 650 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v16, 1); |
0 | 651 v197 = 0; |
652 } | |
653 else | |
654 { | |
655 v17 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
656 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v17, 0); | |
657 } | |
658 } | |
659 pPrevVirtualCidesMapping[uAction] = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
660 v18 = uAction++; | |
4 | 661 v13 = uAction > 28; |
0 | 662 v12 = uAction - 28 < 0; |
1031 | 663 GameMenuUI_InvaligKeyBindingsFlags[v18] = 0; |
0 | 664 } |
665 while ( v12 ^ v13 ); | |
369 | 666 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
667 continue; | |
362 | 668 case UIMSG_SelectKeyPage1: |
978 | 669 KeyboardPageNum = 1; |
362 | 670 continue; |
671 case UIMSG_SelectKeyPage2: | |
672 KeyboardPageNum = 2; | |
4 | 673 continue; |
0 | 674 case UIMSG_OpenVideoOptions: |
675 if ( pMessageQueue_50CBD0->uNumMessages ) | |
676 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
677 pGUIWindow_CurrentMenu->Release(); | |
978 | 678 viewparams->field_48 = 1; |
151 | 679 pCurrentScreen = SCREEN_VIDEO_OPTIONS; |
0 | 680 uTextureID_507C10 = pIcons_LOD->LoadTexture("optvid", TEXTURE_16BIT_PALETTE); |
681 uTextureID_507C14 = pIcons_LOD->LoadTexture("opvdH-bs", TEXTURE_16BIT_PALETTE); | |
682 uTextureID_507C18 = pIcons_LOD->LoadTexture("opvdH-cl", TEXTURE_16BIT_PALETTE); | |
683 uTextureID_507C1C = pIcons_LOD->LoadTexture("opvdH-tn", TEXTURE_16BIT_PALETTE); | |
684 uTextureID_507C20 = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE); | |
685 uTextureID_507C24 = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE); | |
686 pTextureIDs_GammaPositions[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE); | |
687 pTextureIDs_GammaPositions[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE); | |
688 pTextureIDs_GammaPositions[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE); | |
689 pTextureIDs_GammaPositions[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE); | |
690 pTextureIDs_GammaPositions[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE); | |
691 pTextureIDs_GammaPositions[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE); | |
692 pTextureIDs_GammaPositions[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE); | |
693 pTextureIDs_GammaPositions[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE); | |
694 pTextureIDs_GammaPositions[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE); | |
695 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); | |
696 uTextureID_507C50 = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE); | |
697 uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE); | |
698 uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE); | |
699 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0); | |
1025 | 700 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0); |
0 | 701 if ( pRenderer->pRenderD3D ) |
702 { | |
1025 | 703 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, "", 0); |
704 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, "", 0); | |
705 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, "", 0); | |
0 | 706 } |
707 if ( !pRenderer->bWindowMode ) | |
708 { | |
978 | 709 //v0 = 1; |
0 | 710 if ( GammaController::IsGammaSupported() ) |
711 { | |
1025 | 712 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C20), 0); |
713 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C24), 0); | |
714 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, "", 0); | |
0 | 715 } |
716 } | |
4 | 717 continue; |
151 | 718 case UIMSG_1A9: |
987 | 719 __debugbreak(); |
0 | 720 if ( uMessageParam == 4 ) |
721 { | |
151 | 722 //--uGammaPos; |
723 if ( (uGammaPos -- -1) < 0 ) | |
0 | 724 { |
725 uGammaPos = 0; | |
369 | 726 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
727 continue; | |
0 | 728 } |
729 v19 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
730 pGame->pGammaController->Initialize(v19); | |
1268 | 731 GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); |
369 | 732 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
733 continue; | |
0 | 734 } |
735 if ( uMessageParam == 5 ) | |
736 { | |
737 ++uGammaPos; | |
738 if ( (signed int)uGammaPos <= 9 ) | |
739 { | |
740 v21 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
741 pGame->pGammaController->Initialize(v21); | |
1268 | 742 GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); |
369 | 743 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
744 continue; | |
0 | 745 } |
746 uGammaPos = 9; | |
747 } | |
748 else | |
749 { | |
750 uGammaPos = (pMouse->GetCursorPos(&a2)->x - 42) / 17; | |
751 v22 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
752 pGame->pGammaController->Initialize(v22); | |
753 } | |
369 | 754 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
755 continue; | |
0 | 756 case UIMSG_ToggleBloodsplats: |
757 pGame->ToggleFlags2(0x20u); | |
4 | 758 continue; |
0 | 759 case UIMSG_ToggleColoredLights: |
760 pRenderer->bUseColoredLights = pRenderer->bUseColoredLights == 0; | |
4 | 761 continue; |
0 | 762 case UIMSG_ToggleTint: |
763 pRenderer->bTinting = pRenderer->bTinting == 0; | |
4 | 764 continue; |
0 | 765 case UIMSG_ChangeMusicVolume: |
766 if ( uMessageParam == 4 ) | |
767 { | |
768 --uMusicVolimeMultiplier; | |
769 if ( (char)uMusicVolimeMultiplier < 1 ) | |
770 uMusicVolimeMultiplier = 0; | |
1268 | 771 GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); |
4 | 772 if ( uMusicVolimeMultiplier ) |
328 | 773 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); |
774 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); | |
4 | 775 continue; |
0 | 776 } |
777 if ( uMessageParam == 5 ) | |
778 { | |
779 ++uMusicVolimeMultiplier; | |
780 if ( (char)uMusicVolimeMultiplier > 9 ) | |
781 uMusicVolimeMultiplier = 9; | |
1268 | 782 GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); |
4 | 783 if ( uMusicVolimeMultiplier ) |
328 | 784 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); |
785 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); | |
4 | 786 continue; |
0 | 787 } |
788 uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17; | |
789 if ( (char)uMusicVolimeMultiplier > 9 ) | |
790 uMusicVolimeMultiplier = 9; | |
791 if ( uMusicVolimeMultiplier ) | |
328 | 792 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); |
793 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
4 | 794 continue; |
0 | 795 case UIMSG_ChangeSoundVolume: |
369 | 796 if ( uMessageParam == 4 )//reduce sound level button left |
0 | 797 { |
798 --uSoundVolumeMultiplier; | |
799 if ( (char)uSoundVolumeMultiplier < 1 ) | |
800 uSoundVolumeMultiplier = 0; | |
1268 | 801 GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); |
328 | 802 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
803 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); | |
804 continue; | |
805 } | |
369 | 806 if ( uMessageParam == 5 )//Increase sound level button right |
0 | 807 { |
808 ++uSoundVolumeMultiplier; | |
809 if ( (char)uSoundVolumeMultiplier > 8 ) | |
810 uSoundVolumeMultiplier = 9; | |
978 | 811 //v168 = 1; |
0 | 812 v24 = 435; |
961 | 813 //v154 = (int)pBtn_SliderRight; |
1268 | 814 GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); |
328 | 815 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
369 | 816 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); |
817 continue; | |
0 | 818 } |
819 uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17; | |
820 if ( (char)uSoundVolumeMultiplier > 8 ) | |
821 uSoundVolumeMultiplier = 9; | |
328 | 822 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
369 | 823 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); |
824 continue; | |
0 | 825 case UIMSG_ToggleFlipOnExit: |
826 bFlipOnExit = bFlipOnExit == 0; | |
4 | 827 continue; |
0 | 828 case UIMSG_ToggleAlwaysRun: |
829 bAlwaysRun = bAlwaysRun == 0; | |
4 | 830 continue; |
0 | 831 case UIMSG_ToggleWalkSound: |
832 bWalkSound = bWalkSound == 0; | |
4 | 833 continue; |
0 | 834 case UIMSG_ToggleShowDamage: |
835 bShowDamage = bShowDamage == 0; | |
4 | 836 continue; |
0 | 837 case UIMSG_ChangeVoiceVolume: |
838 if ( uMessageParam == 4 ) | |
839 { | |
840 --uVoicesVolumeMultiplier; | |
841 if ( (char)uVoicesVolumeMultiplier < 1 ) | |
842 uVoicesVolumeMultiplier = 0; | |
1268 | 843 GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, (char *)1); |
4 | 844 if ( !uVoicesVolumeMultiplier ) |
845 continue; | |
369 | 846 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
847 continue; | |
0 | 848 } |
849 if ( uMessageParam == 5 ) | |
850 { | |
851 ++uVoicesVolumeMultiplier; | |
852 if ( (char)uVoicesVolumeMultiplier > 8 ) | |
853 uVoicesVolumeMultiplier = 9; | |
1268 | 854 GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, (char *)1); |
4 | 855 if ( !uVoicesVolumeMultiplier ) |
856 continue; | |
369 | 857 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
858 continue; | |
0 | 859 } |
860 uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17; | |
861 if ( (char)uVoicesVolumeMultiplier > 8 ) | |
862 uVoicesVolumeMultiplier = 9; | |
863 if ( !uVoicesVolumeMultiplier ) | |
4 | 864 continue; |
369 | 865 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
866 continue; | |
0 | 867 case UIMSG_SetTurnSpeed: |
868 if ( uMessageParam ) | |
869 pParty->sRotationY = uMessageParam * pParty->sRotationY / uMessageParam; | |
870 uTurnSpeed = uMessageParam; | |
4 | 871 continue; |
0 | 872 case UIMSG_SetGraphicsMode: |
873 if ( !bUseLoResSprites ) | |
874 { | |
875 byte_6BE388_graphicsmode = uMessageParam; | |
876 MM7Initialization(); | |
4 | 877 continue; |
0 | 878 } |
879 if ( uMessageParam ) | |
880 { | |
881 if ( uMessageParam == 1 ) | |
882 { | |
883 byte_6BE388_graphicsmode = 0; | |
884 } | |
885 else | |
886 { | |
887 if ( uMessageParam != 2 ) | |
4 | 888 continue; |
0 | 889 byte_6BE388_graphicsmode = 1; |
890 } | |
4 | 891 MM7Initialization(); |
892 continue; | |
0 | 893 } |
894 ModalWindow(pNPCTopics[453].pText, 0); | |
4 | 895 continue; |
369 | 896 case UIMSG_GameMenu_ReturnToGame: |
0 | 897 pGUIWindow_CurrentMenu->Release(); |
898 pEventTimer->Resume(); | |
369 | 899 pCurrentScreen = SCREEN_GAME; |
978 | 900 viewparams->bRedrawGameUI = 1; |
369 | 901 stru_506E40.Release(); |
902 continue; | |
0 | 903 case UIMSG_OpenQuestBook: |
904 if ( pMessageQueue_50CBD0->uNumMessages ) | |
905 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
906 if ( pCurrentScreen ) | |
907 pGUIWindow_CurrentMenu->Release(); | |
908 pEventTimer->Pause(); | |
909 pAudioPlayer->StopChannels(-1, -1); | |
910 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); | |
960 | 911 pBooksWindow = GUIWindow::Create(493u, 355u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Quests, 0); |
0 | 912 bFlashQuestBook = 0; |
4 | 913 continue; |
0 | 914 case UIMSG_OpenAutonotes: |
915 if ( pMessageQueue_50CBD0->uNumMessages ) | |
916 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
917 if ( pCurrentScreen ) | |
918 pGUIWindow_CurrentMenu->Release(); | |
919 pEventTimer->Pause(); | |
920 pAudioPlayer->StopChannels(-1, -1); | |
921 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); | |
960 | 922 pBooksWindow = GUIWindow::Create(527u, 353u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Autonotes, 0); |
0 | 923 bFlashAutonotesBook = 0; |
4 | 924 continue; |
0 | 925 case UIMSG_OpenMapBook: |
926 if ( pMessageQueue_50CBD0->uNumMessages ) | |
927 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
928 if ( pCurrentScreen ) | |
929 pGUIWindow_CurrentMenu->Release(); | |
930 pEventTimer->Pause(); | |
693 | 931 viewparams->sViewCenterX = pParty->vPosition.x; |
932 viewparams->sViewCenterY = pParty->vPosition.y; | |
0 | 933 pAudioPlayer->StopChannels(-1, -1); |
960 | 934 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); |
935 pBooksWindow = GUIWindow::Create(546, 353, 0, 0, WINDOW_BooksWindow, (int)pBtn_Maps, 0); | |
4 | 936 continue; |
0 | 937 case UIMSG_OpenCalendar: |
938 if ( pMessageQueue_50CBD0->uNumMessages ) | |
939 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
940 if ( pCurrentScreen ) | |
941 pGUIWindow_CurrentMenu->Release(); | |
942 pEventTimer->Pause(); | |
943 pAudioPlayer->StopChannels(-1, -1); | |
369 | 944 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); |
960 | 945 pBooksWindow = GUIWindow::Create(570, 354, 0, 0, WINDOW_BooksWindow, (int)pBtn_Calendar, 0); |
4 | 946 continue; |
0 | 947 case UIMSG_OpenHistoryBook: |
948 if ( pMessageQueue_50CBD0->uNumMessages ) | |
949 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
950 if ( pCurrentScreen ) | |
951 pGUIWindow_CurrentMenu->Release(); | |
952 pEventTimer->Pause(); | |
953 pAudioPlayer->StopChannels(-1, -1); | |
954 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); | |
960 | 955 pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, WINDOW_BooksWindow, (int)pBtn_History, 0); |
0 | 956 bFlashHistoryBook = 0; |
4 | 957 continue; |
369 | 958 case UIMSG_Escape:// íàæàòèå Escape and return to game |
0 | 959 back_to_game(); |
960 if ( pMessageQueue_50CBD0->uNumMessages ) | |
961 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
990 | 962 switch ( pCurrentScreen ) |
963 { | |
964 case SCREEN_E: | |
965 __debugbreak(); | |
966 case SCREEN_NPC_DIALOGUE: | |
967 case SCREEN_CHEST: | |
968 case SCREEN_CHEST_INVENTORY: | |
969 case SCREEN_CHANGE_LOCATION: | |
970 case SCREEN_INPUT_BLV: | |
971 case SCREEN_QUICK_REFERENCE: | |
0 | 972 if ( dword_50CDC8 ) |
990 | 973 break; |
11 | 974 CloseWindowBackground(); |
978 | 975 uMessageParam = 1; |
990 | 976 break; |
977 case SCREEN_HOUSE: | |
978 if ( !dword_50CDC8 && !dword_5C35C8 ) | |
979 { | |
980 CloseWindowBackground(); | |
981 dword_5C35C8 = 0; | |
982 uMessageParam = 1; | |
983 break; | |
984 } | |
985 break; | |
986 } | |
0 | 987 if ( !ptr_507BDC ) |
988 { | |
989 pRenderer->ClearZBuffer(0, 479); | |
978 | 990 viewparams->bRedrawGameUI = 1; |
991 viewparams->field_48 = 1; | |
0 | 992 if ( pCurrentScreen ) |
993 { | |
151 | 994 if ( pCurrentScreen > SCREEN_67 ) |
0 | 995 { |
151 | 996 if ( pCurrentScreen == SCREEN_QUICK_REFERENCE ) |
990 | 997 { |
998 pIcons_LOD->_4114F2(); | |
999 if ( pGUIWindow_Settings ) | |
1000 { | |
1001 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
1002 { | |
1003 pMouse->SetCursorBitmap("MICON2"); | |
1004 } | |
1005 else | |
1006 { | |
1007 pGUIWindow_Settings->Release(); | |
1008 pGUIWindow_Settings = 0; | |
1009 pMouse->SetCursorBitmap("MICON1"); | |
1010 GameUI_Footer_TimeLeft = 0; | |
1011 unk_50C9A0 = 0; | |
1012 back_to_game(); | |
1013 } | |
1014 } | |
1015 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
1016 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1017 pGUIWindow_CurrentMenu->Release(); | |
1018 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
1019 window_SpeakInHouse = 0; | |
1020 pGUIWindow_CurrentMenu = 0; | |
1021 pEventTimer->Resume(); | |
1022 pCurrentScreen = SCREEN_GAME; | |
1023 viewparams->bRedrawGameUI = 1; | |
1024 pIcons_LOD->_4355F7(); | |
1025 continue; | |
1026 } | |
0 | 1027 } |
1028 else | |
1029 { | |
151 | 1030 if ( pCurrentScreen < SCREEN_64 ) |
0 | 1031 { |
1032 switch ( pCurrentScreen ) | |
1033 { | |
151 | 1034 case SCREEN_CASTING: |
0 | 1035 pIcons_LOD->_4114F2(); |
1036 if ( some_active_character ) | |
1037 { | |
1038 uActiveCharacter = some_active_character; | |
1039 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1040 some_active_character = 0; | |
1041 if ( pParty->bTurnBasedModeOn ) | |
1042 pTurnEngine->_40471C(); | |
1043 dword_50C9D0 = 0; | |
1044 dword_50C9D4 = 0; | |
1045 dword_50C9D8 = 0; | |
1046 } | |
1047 if ( ptr_50C9A4 && ptr_50C9A4->uItemID ) | |
1048 { | |
1049 LOBYTE(ptr_50C9A4->uAttributes) &= 0xFu; | |
984 | 1050 _50C9A8_item_enchantment_timer = 0; |
0 | 1051 ptr_50C9A4 = 0; |
1052 } | |
4 | 1053 if ( pGUIWindow_Settings ) |
1054 { | |
151 | 1055 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1056 { |
1057 pMouse->SetCursorBitmap("MICON2"); | |
1058 } | |
1059 else | |
1060 { | |
1061 pGUIWindow_Settings->Release(); | |
1062 pGUIWindow_Settings = 0; | |
1063 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1064 GameUI_Footer_TimeLeft = 0; |
4 | 1065 unk_50C9A0 = 0; |
1066 back_to_game(); | |
1067 } | |
1068 } | |
978 | 1069 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1070 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1071 pGUIWindow_CurrentMenu->Release(); | |
336 | 1072 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1073 window_SpeakInHouse = 0; | |
4 | 1074 pGUIWindow_CurrentMenu = 0; |
1075 pEventTimer->Resume(); | |
151 | 1076 pCurrentScreen = SCREEN_GAME; |
978 | 1077 viewparams->bRedrawGameUI = 1; |
4 | 1078 pIcons_LOD->_4355F7(); |
1079 continue; | |
151 | 1080 case SCREEN_BOOKS: |
0 | 1081 pBooksWindow->Release(); |
1082 //crt_deconstruct_ptr_6A0118(); | |
1083 pBooksWindow = 0; | |
1084 pEventTimer->Resume(); | |
4 | 1085 if ( pGUIWindow_Settings ) |
1086 { | |
151 | 1087 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1088 { |
1089 pMouse->SetCursorBitmap("MICON2"); | |
1090 } | |
1091 else | |
1092 { | |
1093 pGUIWindow_Settings->Release(); | |
1094 pGUIWindow_Settings = 0; | |
1095 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1096 GameUI_Footer_TimeLeft = 0; |
4 | 1097 unk_50C9A0 = 0; |
1098 back_to_game(); | |
1099 } | |
1100 } | |
978 | 1101 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1102 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1103 pGUIWindow_CurrentMenu->Release(); | |
336 | 1104 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1105 window_SpeakInHouse = 0; | |
4 | 1106 pGUIWindow_CurrentMenu = 0; |
1107 pEventTimer->Resume(); | |
151 | 1108 pCurrentScreen = SCREEN_GAME; |
978 | 1109 viewparams->bRedrawGameUI = 1; |
4 | 1110 pIcons_LOD->_4355F7(); |
1111 continue; | |
151 | 1112 case SCREEN_SAVEGAME: |
1113 case SCREEN_LOADGAME: | |
0 | 1114 pIcons_LOD->_4114F2(); |
1115 //crt_deconstruct_ptr_6A0118(); | |
4 | 1116 stru_506E40.Release(); |
1117 break; | |
987 | 1118 case SCREEN_CHEST_INVENTORY: |
151 | 1119 pCurrentScreen = SCREEN_CHEST; |
4 | 1120 continue; |
151 | 1121 case SCREEN_CHEST: |
0 | 1122 pWindow2 = pChestWindow; |
1123 pWindow2->Release(); | |
1124 pIcons_LOD->_4114F2(); | |
151 | 1125 pCurrentScreen = SCREEN_GAME; |
978 | 1126 viewparams->bRedrawGameUI = 1; |
0 | 1127 pEventTimer->Resume(); |
4 | 1128 continue; |
151 | 1129 case SCREEN_19: |
987 | 1130 __debugbreak(); |
4 | 1131 pWindow2 = ptr_507BC8; |
1132 pWindow2->Release(); | |
1133 pIcons_LOD->_4114F2(); | |
151 | 1134 pCurrentScreen = SCREEN_GAME; |
978 | 1135 viewparams->bRedrawGameUI = 1; |
4 | 1136 pEventTimer->Resume(); |
1137 continue; | |
369 | 1138 case SCREEN_OPTIONS://Close |
948 | 1139 options_menu_skin.Relaease(); |
1006 | 1140 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1141 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier); |
1142 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier); | |
1143 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier); | |
1144 WriteWindowsRegistryInt("WalkSound", bWalkSound); | |
1145 WriteWindowsRegistryInt("ShowDamage", bShowDamage); | |
1146 WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode); | |
1147 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun); | |
1148 WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit); | |
1149 if ( !uTurnSpeed ) | |
1150 { | |
978 | 1151 WriteWindowsRegistryInt("TurnDelta", 3); |
4 | 1152 stru_506E40.Release(); |
1153 break; | |
0 | 1154 } |
1155 if ( uTurnSpeed == 64 ) | |
1156 { | |
978 | 1157 WriteWindowsRegistryInt("TurnDelta", 2); |
4 | 1158 stru_506E40.Release(); |
1159 break; | |
0 | 1160 } |
1161 if ( uTurnSpeed != 128 ) | |
4 | 1162 { |
1163 stru_506E40.Release(); | |
1164 break; | |
1165 } | |
978 | 1166 WriteWindowsRegistryInt("TurnDelta", 1); |
0 | 1167 stru_506E40.Release(); |
1168 break; | |
151 | 1169 case SCREEN_MENU: |
1006 | 1170 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1171 pIcons_LOD->_4114F2(); |
1006 | 1172 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1173 pIcons_LOD->_4114F2(); |
4 | 1174 stru_506E40.Release(); |
1175 break; | |
151 | 1176 case SCREEN_VIDEO_OPTIONS: |
0 | 1177 if ( pRenderer->pRenderD3D ) |
1178 { | |
1179 WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights); | |
1180 WriteWindowsRegistryInt("Tinting", pRenderer->bTinting); | |
1181 WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pGame->uFlags2) >> 5) & 1); | |
1182 } | |
1183 if ( pRenderer->bWindowMode ) | |
4 | 1184 { |
1185 stru_506E40.Release(); | |
1186 break; | |
1187 } | |
978 | 1188 //v30 = uGammaPos; |
1189 //v31 = "GammaPos"; | |
1190 WriteWindowsRegistryInt("GammaPos", uGammaPos); | |
4 | 1191 stru_506E40.Release(); |
1192 break; | |
1031 | 1193 |
369 | 1194 case SCREEN_KEYBOARD_OPTIONS://Return to game |
0 | 1195 v197 = 1; |
1196 v32 = 0; | |
1031 | 1197 while ( !GameMenuUI_InvaligKeyBindingsFlags[v32]) |
0 | 1198 { |
1199 ++v32; | |
1200 if ( v32 >= 28 ) | |
1201 { | |
362 | 1202 thisb = (signed int)&uTextureID_Optkb; |
1031 | 1203 assert(false && "Invalid condition values"); |
0 | 1204 do |
1205 { | |
1206 if ( *(int *)thisb ) | |
1207 pIcons_LOD->pTextures[*(int *)thisb].Release(); | |
1208 thisb += 4; | |
1209 } | |
1031 | 1210 while ( thisb < (signed int)0x00507C08 ); |
1211 | |
362 | 1212 memset(&uTextureID_Optkb, 0, 0x14u); |
1006 | 1213 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1214 uAction = 0; |
1215 do | |
1216 { | |
1217 v33 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
1218 if ( v33 != pPrevVirtualCidesMapping[uAction] ) | |
1219 { | |
1220 if ( v197 ) | |
1221 { | |
1222 v34 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
978 | 1223 GUI_ReplaceHotkey(v34, LOBYTE(pPrevVirtualCidesMapping[uAction]), 1); |
0 | 1224 v197 = 0; |
1225 } | |
1226 else | |
1227 { | |
1228 v35 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
1229 GUI_ReplaceHotkey(v35, LOBYTE(pPrevVirtualCidesMapping[uAction]), 0); | |
1230 } | |
1231 } | |
978 | 1232 if ( uAction && uAction != 2 && uAction != 3 && uAction != 1 && uAction != 25 && uAction != 26 ) |
1233 pKeyToggleType = (KeyToggleType)1; | |
0 | 1234 else |
1235 pKeyToggleType = (KeyToggleType)0; | |
1236 pKeyActionMap->SetKeyMapping(uAction, pPrevVirtualCidesMapping[uAction], pKeyToggleType); | |
1237 ++uAction; | |
1238 } | |
1239 while ( uAction < 28 ); | |
1240 pKeyActionMap->StoreMappings(); | |
4 | 1241 stru_506E40.Release(); |
1242 break; | |
0 | 1243 } |
1244 } | |
369 | 1245 break; |
916 | 1246 case SCREEN_REST://close rest screen |
0 | 1247 if ( dword_506F14 ) |
1248 { | |
1249 Rest(_506F18_num_hours_to_sleep); | |
1250 pParty->pPlayers[3].pConditions[2] = 0i64; | |
1251 pParty->pPlayers[2].pConditions[2] = 0i64; | |
1252 pParty->pPlayers[1].pConditions[2] = 0i64; | |
1253 pParty->pPlayers[0].pConditions[2] = 0i64; | |
1254 } | |
1255 pTexture_RestUI_CurrentSkyFrame->Release(); | |
1256 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
1257 pTexture_RestUI_CurrentHourglassFrame = 0; | |
1258 pTexture_RestUI_CurrentSkyFrame = 0; | |
1006 | 1259 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1260 pIcons_LOD->_4114F2(); |
1261 _506F18_num_hours_to_sleep = 0; | |
1262 dword_506F14 = 0; | |
978 | 1263 dword_507B94 = 1; |
4 | 1264 if ( pGUIWindow_Settings ) |
1265 { | |
151 | 1266 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1267 { |
1268 pMouse->SetCursorBitmap("MICON2"); | |
1269 } | |
1270 else | |
1271 { | |
1272 pGUIWindow_Settings->Release(); | |
1273 pGUIWindow_Settings = 0; | |
1274 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1275 GameUI_Footer_TimeLeft = 0; |
4 | 1276 unk_50C9A0 = 0; |
1277 back_to_game(); | |
1278 } | |
1279 } | |
978 | 1280 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1281 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1282 pGUIWindow_CurrentMenu->Release(); | |
336 | 1283 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1284 window_SpeakInHouse = 0; | |
4 | 1285 pGUIWindow_CurrentMenu = 0; |
1286 pEventTimer->Resume(); | |
151 | 1287 pCurrentScreen = SCREEN_GAME; |
978 | 1288 viewparams->bRedrawGameUI = 1; |
4 | 1289 pIcons_LOD->_4355F7(); |
1290 continue; | |
151 | 1291 case SCREEN_E: |
987 | 1292 __debugbreak(); |
0 | 1293 pGUIWindow_CurrentMenu->Release(); |
151 | 1294 pCurrentScreen = SCREEN_HOUSE; |
0 | 1295 pIcons_LOD->_4114F2(); |
4 | 1296 continue; |
151 | 1297 case SCREEN_HOUSE: |
0 | 1298 if ( uDialogueType ) |
1299 uDialogueType = 0; | |
978 | 1300 if ( uGameState == GAME_STATE_2 ) |
0 | 1301 { |
1302 while ( sub_4BD8B5() ) | |
1303 ; | |
1304 } | |
1305 else | |
1306 { | |
1307 if ( sub_4BD8B5() ) | |
4 | 1308 continue; |
0 | 1309 } |
1310 sub_4B1D27(); | |
978 | 1311 pAudioPlayer->PlaySound(SOUND_7, 814, 0, -1, 0, 0, 0, 0); |
0 | 1312 pVideoPlayer->Unload(); |
336 | 1313 pGUIWindow_CurrentMenu = window_SpeakInHouse; |
4 | 1314 if ( pGUIWindow_Settings ) |
1315 { | |
151 | 1316 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1317 { |
1318 pMouse->SetCursorBitmap("MICON2"); | |
1319 } | |
1320 else | |
1321 { | |
1322 pGUIWindow_Settings->Release(); | |
1323 pGUIWindow_Settings = 0; | |
1324 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1325 GameUI_Footer_TimeLeft = 0; |
4 | 1326 unk_50C9A0 = 0; |
1327 back_to_game(); | |
1328 } | |
1329 } | |
978 | 1330 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1331 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1332 pGUIWindow_CurrentMenu->Release(); | |
336 | 1333 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1334 window_SpeakInHouse = 0; | |
4 | 1335 pGUIWindow_CurrentMenu = 0; |
1336 pEventTimer->Resume(); | |
151 | 1337 pCurrentScreen = SCREEN_GAME; |
1035 | 1338 viewparams->bRedrawGameUI = true; |
4 | 1339 pIcons_LOD->_4355F7(); |
1340 continue; | |
987 | 1341 case SCREEN_INPUT_BLV://click escape |
0 | 1342 if ( uCurrentHouse_Animation == 153 ) |
735 | 1343 PlayHouseSound(0x99u, HouseSound_Greeting_2); |
0 | 1344 pVideoPlayer->Unload(); |
4 | 1345 if ( dword_5B65CC ) |
1346 { | |
1347 pParty->field_709 = 0; | |
1348 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; | |
1035 | 1349 pParty->CountHirelings(); |
1350 viewparams->bRedrawGameUI = true; | |
4 | 1351 dword_5B65CC = 0; |
1352 } | |
987 | 1353 DialogueEnding(); |
1354 pCurrentScreen = SCREEN_GAME; | |
1035 | 1355 viewparams->bRedrawGameUI = true; |
987 | 1356 continue; |
1357 case SCREEN_NPC_DIALOGUE://click escape | |
0 | 1358 if ( dword_5B65CC ) |
1359 { | |
1360 pParty->field_709 = 0; | |
1361 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; | |
1035 | 1362 pParty->CountHirelings(); |
1363 viewparams->bRedrawGameUI = true; | |
0 | 1364 dword_5B65CC = 0; |
1365 } | |
987 | 1366 //goto LABEL_317; |
1367 DialogueEnding(); | |
1368 pCurrentScreen = SCREEN_GAME; | |
1035 | 1369 viewparams->bRedrawGameUI = true; |
987 | 1370 continue; |
1371 case SCREEN_BRANCHLESS_NPC_DIALOG://click escape | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1372 memset(GameUI_Footer_TimedString.data(), 0, 0xC8u); |
0 | 1373 sub_4452BB(); |
987 | 1374 DialogueEnding(); |
1375 pCurrentScreen = SCREEN_GAME; | |
1035 | 1376 viewparams->bRedrawGameUI = true; |
987 | 1377 continue; |
1378 case SCREEN_CHANGE_LOCATION://click escape | |
0 | 1379 if ( pParty->vPosition.x < -22528 ) |
1380 pParty->vPosition.x = -22528; | |
1381 if ( pParty->vPosition.x > 22528 ) | |
1382 pParty->vPosition.x = 22528; | |
1383 if ( pParty->vPosition.y < -22528 ) | |
1384 pParty->vPosition.y = -22528; | |
1385 if ( pParty->vPosition.y > 22528 ) | |
1386 pParty->vPosition.y = 22528; | |
987 | 1387 DialogueEnding(); |
1388 pCurrentScreen = SCREEN_GAME; | |
1035 | 1389 viewparams->bRedrawGameUI = true; |
987 | 1390 continue; |
151 | 1391 case SCREEN_VIDEO: |
0 | 1392 pVideoPlayer->Unload(); |
4 | 1393 continue; |
151 | 1394 case SCREEN_CHARACTERS: |
992 | 1395 CharacterUI_ReleaseButtons(); |
990 | 1396 sub_419379(); |
1397 pIcons_LOD->_4114F2(); | |
1398 if ( pGUIWindow_Settings ) | |
1399 { | |
1400 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
1401 { | |
1402 pMouse->SetCursorBitmap("MICON2"); | |
1403 } | |
1404 else | |
1405 { | |
1406 pGUIWindow_Settings->Release(); | |
1407 pGUIWindow_Settings = 0; | |
1408 pMouse->SetCursorBitmap("MICON1"); | |
1409 GameUI_Footer_TimeLeft = 0; | |
1410 unk_50C9A0 = 0; | |
1411 back_to_game(); | |
1412 } | |
1413 } | |
1414 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
1415 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1416 pGUIWindow_CurrentMenu->Release(); | |
1417 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
1418 window_SpeakInHouse = 0; | |
1419 pGUIWindow_CurrentMenu = 0; | |
1420 pEventTimer->Resume(); | |
1421 pCurrentScreen = SCREEN_GAME; | |
1035 | 1422 viewparams->bRedrawGameUI = true; |
990 | 1423 pIcons_LOD->_4355F7(); |
1424 continue; | |
0 | 1425 default: |
4 | 1426 if ( pGUIWindow_Settings ) |
1427 { | |
151 | 1428 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1429 { |
1430 pMouse->SetCursorBitmap("MICON2"); | |
1431 } | |
1432 else | |
1433 { | |
1434 pGUIWindow_Settings->Release(); | |
1435 pGUIWindow_Settings = 0; | |
1436 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1437 GameUI_Footer_TimeLeft = 0; |
4 | 1438 unk_50C9A0 = 0; |
1439 back_to_game(); | |
1440 } | |
1441 } | |
978 | 1442 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1443 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1444 pGUIWindow_CurrentMenu->Release(); | |
336 | 1445 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1446 window_SpeakInHouse = 0; | |
4 | 1447 pGUIWindow_CurrentMenu = 0; |
1448 pEventTimer->Resume(); | |
151 | 1449 pCurrentScreen = SCREEN_GAME; |
978 | 1450 viewparams->bRedrawGameUI = 1; |
4 | 1451 pIcons_LOD->_4355F7(); |
1452 continue; | |
0 | 1453 } |
4 | 1454 if ( pGUIWindow_Settings ) |
1455 { | |
151 | 1456 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1457 { |
1458 pMouse->SetCursorBitmap("MICON2"); | |
1459 } | |
1460 else | |
1461 { | |
1462 pGUIWindow_Settings->Release(); | |
1463 pGUIWindow_Settings = 0; | |
1464 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1465 GameUI_Footer_TimeLeft = 0; |
4 | 1466 unk_50C9A0 = 0; |
1467 back_to_game(); | |
1468 } | |
1469 } | |
978 | 1470 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1471 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1472 pGUIWindow_CurrentMenu->Release(); | |
336 | 1473 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1474 window_SpeakInHouse = 0; | |
4 | 1475 pGUIWindow_CurrentMenu = 0; |
1476 pEventTimer->Resume(); | |
151 | 1477 pCurrentScreen = SCREEN_GAME; |
1035 | 1478 viewparams->bRedrawGameUI = true; |
4 | 1479 pIcons_LOD->_4355F7(); |
1480 continue; | |
0 | 1481 } |
991 | 1482 CharacterUI_ReleaseButtons(); |
0 | 1483 sub_419379(); |
1484 pIcons_LOD->_4114F2(); | |
1485 } | |
1486 if ( pGUIWindow_Settings ) | |
1487 { | |
151 | 1488 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
0 | 1489 { |
1490 pMouse->SetCursorBitmap("MICON2"); | |
1491 } | |
1492 else | |
1493 { | |
1494 pGUIWindow_Settings->Release(); | |
1495 pGUIWindow_Settings = 0; | |
1496 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1497 GameUI_Footer_TimeLeft = 0; |
0 | 1498 unk_50C9A0 = 0; |
1499 back_to_game(); | |
1500 } | |
1501 } | |
978 | 1502 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
0 | 1503 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1504 pGUIWindow_CurrentMenu->Release(); | |
336 | 1505 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1506 window_SpeakInHouse = 0; | |
0 | 1507 pGUIWindow_CurrentMenu = 0; |
1508 pEventTimer->Resume(); | |
151 | 1509 pCurrentScreen = SCREEN_GAME; |
1035 | 1510 viewparams->bRedrawGameUI = true; |
0 | 1511 pIcons_LOD->_4355F7(); |
4 | 1512 continue; |
0 | 1513 } |
1514 if ( !pGUIWindow_Settings )//Draw Menu | |
1515 { | |
1516 dword_6BE138 = -1; | |
1268 | 1517 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, (char *)1); |
0 | 1518 pEventTimer->Pause(); |
1519 pAudioPlayer->StopChannels(-1, -1); | |
1035 | 1520 pCurrentScreen = SCREEN_MENU; |
1521 | |
0 | 1522 ++pIcons_LOD->uTexturePacksCount; |
1523 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
1524 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
1035 | 1525 |
961 | 1526 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0); |
362 | 1527 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE); |
1528 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE); | |
1529 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE); | |
1530 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE); | |
1531 uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE); | |
1532 uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); | |
1533 uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE); | |
978 | 1534 pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, 1, 0, UIMSG_StartNewGame, 0, 0x4Eu, |
0 | 1535 pGlobalTXT_LocalizationStrings[614],// "New Game" |
710 | 1536 pIcons_LOD->GetTexture(uTextureID_New1), 0); |
978 | 1537 pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u, |
0 | 1538 pGlobalTXT_LocalizationStrings[615],// "Save Game" |
710 | 1539 pIcons_LOD->GetTexture(uTextureID_Save1), 0); |
978 | 1540 pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu, |
0 | 1541 pGlobalTXT_LocalizationStrings[616],// "Load Game" |
710 | 1542 pIcons_LOD->GetTexture(uTextureID_Load1), 0); |
978 | 1543 pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u, |
0 | 1544 pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:"" |
710 | 1545 pIcons_LOD->GetTexture(uTextureID_Controls1), 0); |
978 | 1546 pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, 1, 0, UIMSG_Quit, 0, 0x51u, |
0 | 1547 pGlobalTXT_LocalizationStrings[618],// "Quit" |
710 | 1548 pIcons_LOD->GetTexture(uTextureID_Quit1), 0); |
978 | 1549 pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, 1, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u, |
0 | 1550 pGlobalTXT_LocalizationStrings[619],// "Return to Game" |
710 | 1551 pIcons_LOD->GetTexture(uTextureID_Resume1), 0); |
978 | 1552 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(6, 1, 0, 0); |
1553 viewparams->field_48 = 1; | |
0 | 1554 stru_506E40.Release(); |
1555 uNumSeconds = (unsigned int)MakeScreenshot(155, 117); | |
1556 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); | |
1557 free((void *)uNumSeconds); | |
1558 stru_506E40._40E55E("gamma.pcx", 0); | |
4 | 1559 continue; |
0 | 1560 } |
1000 | 1561 pGUIWindow_Settings->Release(); |
11 | 1562 pGUIWindow_Settings = 0; |
1563 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1564 GameUI_Footer_TimeLeft = 0; |
11 | 1565 unk_50C9A0 = 0; |
1566 back_to_game(); | |
1567 continue; | |
0 | 1568 } |
1569 sub_41426F(); | |
1570 continue; | |
111 | 1571 case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel |
0 | 1572 if ( uMessageParam ) |
1573 { | |
962 | 1574 GUIWindow::Create(626, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCRight, 0); |
0 | 1575 v37 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + (unsigned __int8)pParty->field_70A - 2; |
1576 if ( (unsigned __int8)pParty->field_709 < v37 ) | |
1577 { | |
111 | 1578 ++pParty->field_709;//??? maybe number of the first cell??? |
0 | 1579 if ( (unsigned __int8)pParty->field_709 >= v37 ) |
1580 pParty->field_709 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + pParty->field_70A - 2; | |
1581 } | |
1582 } | |
1583 else | |
1584 { | |
962 | 1585 GUIWindow::Create(469, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCLeft, 0); |
0 | 1586 if ( pParty->field_709 ) |
1587 { | |
1588 --pParty->field_709; | |
1589 if ( pParty->field_709 < 1 ) | |
1590 pParty->field_709 = 0; | |
1591 } | |
1592 } | |
994 | 1593 GameUI_DrawHiredNPCs(); |
4 | 1594 continue; |
434 | 1595 case UIMSG_TransitionUI_Confirm: |
0 | 1596 if ( pMessageQueue_50CBD0->uNumMessages ) |
1597 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
978 | 1598 dword_50CDC8 = 1; |
0 | 1599 sub_42FBDD(); |
758 | 1600 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful); |
0 | 1601 pVideoPlayer->Unload(); |
960 | 1602 DialogueEnding(); |
978 | 1603 viewparams->bRedrawGameUI = 1; |
0 | 1604 if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz ) |
1605 { | |
1606 if ( dword_59117C_teleportx ) | |
1607 { | |
1608 pParty->vPosition.x = dword_59117C_teleportx; | |
1609 _5B65A8_npcdata_uflags_or_other = dword_59117C_teleportx; | |
1610 } | |
1611 if ( dword_591178_teleporty ) | |
1612 { | |
1613 pParty->vPosition.y = dword_591178_teleporty; | |
1614 _5B65AC_npcdata_fame_or_other = dword_591178_teleporty; | |
1615 } | |
1616 if ( dword_591174_teleportz ) | |
1617 { | |
1618 pParty->vPosition.z = dword_591174_teleportz; | |
1619 _5B65B0_npcdata_rep_or_other = dword_591174_teleportz; | |
1620 pParty->uFallStartY = dword_591174_teleportz; | |
1621 } | |
1622 if ( dword_591170_teleport_directiony ) | |
1623 { | |
1624 pParty->sRotationY = dword_591170_teleport_directiony; | |
1625 _5B65B4_npcdata_loword_house_or_other = dword_591170_teleport_directiony; | |
1626 } | |
1627 if ( dword_59116C_teleport_directionx ) | |
1628 { | |
1629 pParty->sRotationX = dword_59116C_teleport_directionx; | |
1630 _5B65B8_npcdata_hiword_house_or_other = dword_59116C_teleport_directionx; | |
1631 v38 = dword_591168_teleport_speedz; | |
1632 pParty->uFallSpeed = dword_591168_teleport_speedz; | |
1633 dword_5B65BC = dword_591168_teleport_speedz; | |
1634 } | |
1635 else | |
1636 { | |
1637 v38 = dword_5B65BC; | |
1638 } | |
1639 if ( *dword_591164_teleport_map_name != 48 ) | |
1640 { | |
1641 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)2; | |
1642 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; | |
1643 OnMapLeave(); | |
783 | 1644 sub_44987B(dword_591164_teleport_map_name, MapStartPoint_Party); |
0 | 1645 } |
1646 } | |
1647 else | |
1648 { | |
1052 | 1649 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); |
1650 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1651 if ( !_stricmp(byte_6BE3B0.data(), "d05.blv") ) |
0 | 1652 pParty->uTimePlayed += 1474560i64; |
4 | 1653 continue; |
960 | 1654 case UIMSG_TransitionWindowCloseBtn: |
11 | 1655 CloseWindowBackground(); |
0 | 1656 pVideoPlayer->Unload(); |
960 | 1657 DialogueEnding(); |
1035 | 1658 viewparams->bRedrawGameUI = true; |
910 | 1659 continue; |
0 | 1660 case UIMSG_CycleCharacters: |
1661 v39 = GetAsyncKeyState(VK_SHIFT); | |
910 | 1662 uActiveCharacter = CycleCharacter(v39); |
1035 | 1663 viewparams->bRedrawGameUI = true; |
910 | 1664 continue; |
783 | 1665 case UIMSG_OnTravelByFoot: |
0 | 1666 if ( pMessageQueue_50CBD0->uNumMessages ) |
1667 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
978 | 1668 dword_50CDC8 = 1; |
0 | 1669 sub_42FBDD(); |
1670 pNPCData4 = (NPCData *)GetTravelTime(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1671 strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data()); |
0 | 1672 if ( bUnderwater != 1 && pParty->bFlying |
978 | 1673 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 ) |
1674 { | |
1675 viewparams->bRedrawGameUI = 1; | |
11 | 1676 CloseWindowBackground(); |
0 | 1677 if ( pParty->vPosition.x < -22528 ) |
1678 pParty->vPosition.x = -22528; | |
1679 if ( pParty->vPosition.x > 22528 ) | |
1680 pParty->vPosition.x = 22528; | |
1681 if ( pParty->vPosition.y < -22528 ) | |
1682 pParty->vPosition.y = -22528; | |
1683 if ( pParty->vPosition.y > 22528 ) | |
1684 pParty->vPosition.y = 22528; | |
960 | 1685 DialogueEnding(); |
151 | 1686 pCurrentScreen = SCREEN_GAME; |
0 | 1687 } |
1688 else | |
1689 { | |
1690 pParty->field_6E4 = 0; | |
1691 pParty->field_6E0 = 0; | |
1202 | 1692 pCastSpellInfo.data()->_427D48(1); |
960 | 1693 DialogueEnding(); |
0 | 1694 pEventTimer->Pause(); |
434 | 1695 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); |
0 | 1696 ++pGameLoadingUI_ProgressBar->uProgressMax; |
978 | 1697 SaveGame(1, 0); |
0 | 1698 pGameLoadingUI_ProgressBar->Progress(); |
1699 RestAndHeal(1440 * (signed int)pNPCData4); | |
1700 if ( pParty->uNumFoodRations ) | |
1701 { | |
1702 pParty->RestAndHeal(); | |
1703 if ( ((pParty->uNumFoodRations - (signed int)pNPCData4) & 0x80000000u) != 0 ) | |
1704 { | |
1705 pPlayer7 = pParty->pPlayers; | |
1706 do | |
1707 { | |
978 | 1708 pPlayer7->SetCondition(1, 0); |
0 | 1709 ++pPlayer7; |
1710 } | |
1711 while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings ); | |
766 | 1712 ++pParty->days_played_without_rest; |
0 | 1713 } |
1714 Party::TakeFood((unsigned int)pNPCData4); | |
1715 } | |
1716 else | |
1717 { | |
1718 pPlayer8 = pParty->pPlayers; | |
1719 do | |
1720 { | |
978 | 1721 pPlayer8->SetCondition(1, 0); |
0 | 1722 ++pPlayer8; |
1723 } | |
1724 while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings ); | |
766 | 1725 ++pParty->days_played_without_rest; |
0 | 1726 } |
1727 pPaletteManager->ResetNonLocked(); | |
1728 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1729 strcpy(pCurrentMapName.data(), pOut); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1730 strcpy(pLevelName, pCurrentMapName.data()); |
783 | 1731 v41 = strtok(pLevelName, "."); |
1732 strcpy(pLevelName, v41); | |
1733 Level_LoadEvtAndStr(pLevelName); | |
1734 pDecalBuilder->Reset(0); | |
0 | 1735 LoadLevel_InitializeLevelEvt(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1736 uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName.data()); |
0 | 1737 bUnderwater = 0; |
1738 bNoNPCHiring = 0; | |
1739 pGame->uFlags2 &= 0xFFFFFFF7u; | |
1740 if ( Is_out15odm_underwater() ) | |
1741 { | |
1742 bUnderwater = 1; | |
1743 pGame->uFlags2 |= 8u; | |
1744 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1745 if ( !_stricmp(pCurrentMapName.data(), "out15.odm") || !_stricmp(pCurrentMapName.data(), "d47.blv") ) |
0 | 1746 bNoNPCHiring = 1; |
1747 PrepareToLoadODM(1u, (OutdoorCamera *)1); | |
1748 pAudioPlayer->SetMapEAX(); | |
1749 bDialogueUI_InitializeActor_NPC_ID = 0; | |
1750 OnMapLoad(); | |
1751 pOutdoor->SetFog(); | |
1752 TeleportToStartingPoint(uLevel_StartingPointType); | |
783 | 1753 pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v213, 0); |
0 | 1754 pParty->uFallStartY = pParty->vPosition.z; |
1755 sub_461103(); | |
1756 pEventTimer->Resume(); | |
1757 viewparams->bRedrawGameUI = 1; | |
151 | 1758 pCurrentScreen = SCREEN_GAME; |
0 | 1759 pGameLoadingUI_ProgressBar->Release(); |
1760 } | |
978 | 1761 viewparams->bRedrawGameUI = 1; |
910 | 1762 continue; |
987 | 1763 case UIMSG_CHANGE_LOCATION_ClickCencelBtn: |
1764 CloseWindowBackground(); | |
1765 if ( pParty->vPosition.x < -22528 ) | |
1766 pParty->vPosition.x = -22528; | |
1767 if ( pParty->vPosition.x > 22528 ) | |
1768 pParty->vPosition.x = 22528; | |
1769 if ( pParty->vPosition.y < -22528 ) | |
1770 pParty->vPosition.y = -22528; | |
1771 if ( pParty->vPosition.y > 22528 ) | |
1772 pParty->vPosition.y = 22528; | |
1773 DialogueEnding(); | |
1774 pCurrentScreen = SCREEN_GAME; | |
1775 viewparams->bRedrawGameUI = 1; | |
1776 continue; | |
1326 | 1777 case UIMSG_CastSpell_Telekinesis: |
0 | 1778 if ( pRenderer->pRenderD3D ) |
1779 LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
1780 else | |
1781 { | |
1782 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210); | |
1783 pPoint = pMouse->GetCursorPos(&v208); | |
1784 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]]; | |
1785 } | |
1786 v44 = (unsigned __int16)v42; | |
848 | 1787 v45 = PID_TYPE(v44); |
0 | 1788 uNumSeconds = v44; |
848 | 1789 v46 = PID_ID(v44); |
0 | 1790 if ( v45 == 3 ) |
1791 { | |
1792 v47 = pActors[v46].uAIState == Dead; | |
11 | 1793 if ( !v47 ) |
1794 continue; | |
1000 | 1795 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1796 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1797 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1798 pSpellInfo->spell_target_pid = v44; | |
1799 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1800 pGUIWindow_Settings->Release(); | |
11 | 1801 pGUIWindow_Settings = 0; |
1802 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1803 GameUI_Footer_TimeLeft = 0; |
11 | 1804 unk_50C9A0 = 0; |
1805 back_to_game(); | |
1806 continue; | |
0 | 1807 } |
1808 if ( v45 == 2 ) | |
1809 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
1810 v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0; |
0 | 1811 if ( !v47 ) |
4 | 1812 continue; |
1000 | 1813 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1814 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1815 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1816 pSpellInfo->spell_target_pid = v44; | |
1817 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1818 pGUIWindow_Settings->Release(); | |
11 | 1819 pGUIWindow_Settings = 0; |
1820 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1821 GameUI_Footer_TimeLeft = 0; |
11 | 1822 unk_50C9A0 = 0; |
1823 back_to_game(); | |
1824 continue; | |
0 | 1825 } |
1826 if ( v45 == 5 ) | |
1827 { | |
1828 v48 = pLevelDecorations[v46].field_16_event_id == 0; | |
1829 } | |
1830 else | |
1831 { | |
1832 if ( v45 != 6 ) | |
4 | 1833 continue; |
978 | 1834 if ( uCurrentlyLoadedLevelType != 1 ) |
0 | 1835 { |
1836 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F]; | |
1837 if ( !(pODMFace->uAttributes & 0x02000000) || !pODMFace->sCogTriggeredID ) | |
4 | 1838 continue; |
0 | 1839 v44 = uNumSeconds; |
1000 | 1840 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1841 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1842 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1843 pSpellInfo->spell_target_pid = v44; | |
1844 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1845 pGUIWindow_Settings->Release(); | |
11 | 1846 pGUIWindow_Settings = 0; |
1847 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1848 GameUI_Footer_TimeLeft = 0; |
11 | 1849 unk_50C9A0 = 0; |
1850 back_to_game(); | |
1851 continue; | |
0 | 1852 } |
1853 pBLVFace = &pIndoor->pFaces[v46]; | |
1854 if ( !(BYTE3(pBLVFace->uAttributes) & 2) ) | |
4 | 1855 continue; |
0 | 1856 v48 = pIndoor->pFaceExtras[pBLVFace->uFaceExtraID].uEventID == 0; |
1857 } | |
1858 if ( v48 ) | |
4 | 1859 continue; |
1000 | 1860 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1861 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1862 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1863 pSpellInfo->spell_target_pid = v44; | |
1864 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1865 pGUIWindow_Settings->Release(); | |
0 | 1866 pGUIWindow_Settings = 0; |
1867 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1868 GameUI_Footer_TimeLeft = 0; |
0 | 1869 unk_50C9A0 = 0; |
1870 back_to_game(); | |
4 | 1871 continue; |
1000 | 1872 case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade) |
1873 case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure | |
1874 case UIMSG_HiredNPC_CastSpell: | |
0 | 1875 if ( pMessageQueue_50CBD0->uNumMessages ) |
1876 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1877 if ( unk_50C9A0 ) | |
1878 { | |
910 | 1879 uActiveCharacter = uMessageParam; |
978 | 1880 viewparams->bRedrawGameUI = 1; |
0 | 1881 } |
1882 else | |
1883 { | |
1884 if ( pGUIWindow_Settings ) | |
1885 { | |
1000 | 1886 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
0 | 1887 switch ( uMessage ) |
1888 { | |
1000 | 1889 case UIMSG_CastSpell_Character_Big_Improvement: |
1890 LOBYTE(pSpellInfo->field_8) &= 0xFDu; | |
0 | 1891 break; |
1000 | 1892 case UIMSG_CastSpell_Character_Small_Improvement: |
1893 HIBYTE(pSpellInfo->field_8) &= 0xFEu; | |
0 | 1894 break; |
1000 | 1895 case UIMSG_HiredNPC_CastSpell: |
1896 HIBYTE(pSpellInfo->field_8) &= 0xFDu; | |
0 | 1897 break; |
1898 } | |
1000 | 1899 pSpellInfo->uPlayerID_2 = uMessageParam; |
1900 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
0 | 1901 pGUIWindow_Settings->Release(); |
1902 pGUIWindow_Settings = 0; | |
1903 pEventTimer->Resume(); | |
1904 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1905 GameUI_Footer_TimeLeft = 0; |
0 | 1906 unk_50C9A0 = 0; |
1907 } | |
1908 } | |
4 | 1909 continue; |
0 | 1910 case UIMSG_BF: |
987 | 1911 __debugbreak(); |
978 | 1912 dword_50CDC8 = 1; |
0 | 1913 sub_42FBDD(); |
978 | 1914 SaveGame(1, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1915 strcpy(pCurrentMapName.data(), pMapStats->pInfos[uHouse_ExitPic].pFilename); |
978 | 1916 dword_6BE364_game_settings_1 |= 1; |
1917 uGameState = GAME_STATE_2; | |
11 | 1918 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; |
336 | 1919 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; |
4 | 1920 if ( v53 < 0 ) |
0 | 1921 { |
1922 v54 = abs(v53) - 1; | |
1923 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1924 dword_5B65BC = 0; | |
1925 v55 = dword_4E4560[v54]; | |
1926 _5B65AC_npcdata_fame_or_other = dword_4E4578[v54]; | |
1927 v56 = dword_4E4590[v54]; | |
1928 v57 = dword_4E45A8[v54]; | |
1929 _5B65A8_npcdata_uflags_or_other = v55; | |
1930 _5B65B4_npcdata_loword_house_or_other = v57; | |
1931 _5B65B0_npcdata_rep_or_other = v56; | |
1932 dword_5B65C0 = v55 | _5B65AC_npcdata_fame_or_other | v56 | v57; | |
1933 } | |
1934 sub_4BD8B5(); | |
11 | 1935 //goto LABEL_434; |
437 | 1936 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
11 | 1937 { |
990 | 1938 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 1939 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
1940 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
1941 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 1942 }*/ |
978 | 1943 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
11 | 1944 continue; |
710 | 1945 |
1946 case UIMSG_OnCastTownPortal: | |
0 | 1947 pAudioPlayer->StopChannels(-1, -1); |
1268 | 1948 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_TownPortal, (char *)uMessageParam); |
710 | 1949 continue; |
1950 | |
961 | 1951 case UIMSG_OnCastLloydsBeacon: |
0 | 1952 pAudioPlayer->StopChannels(-1, -1); |
961 | 1953 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_LloydsBeacon, 0); |
710 | 1954 continue; |
1955 | |
961 | 1956 case UIMSG_LloydsBeacon_FlippingBtn: |
0 | 1957 bRecallingBeacon = uMessageParam; |
1958 v127 = uMessageParam + 204; | |
916 | 1959 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
1960 continue; | |
961 | 1961 case UIMSG_HintBeaconSlot: |
0 | 1962 if ( !pGUIWindow_CurrentMenu ) |
4 | 1963 continue; |
0 | 1964 pPlayer = pPlayers[_506348_current_lloyd_playerid + 1]; |
1965 uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam]; | |
1966 if ( bRecallingBeacon ) | |
1967 { | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
1968 if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) ) |
4 | 1969 continue; |
0 | 1970 v173 = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(pPlayer->pInstalledBeacons[uMessageParam].field_18))].pName; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1971 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
|
1972 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 1973 continue; |
0 | 1974 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1975 v59 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
0 | 1976 thise = "Not in Map Stats"; |
1977 if ( v59 ) | |
1978 thise = pMapStats->pInfos[v59].pName; | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
1979 if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) || !v59 ) |
0 | 1980 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1981 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], thise);// "Set to %s" |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1982 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 1983 continue; |
0 | 1984 } |
1985 v174 = pMapStats->pInfos[sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName; | |
1986 v158 = (unsigned int)thise; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1987 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s" |
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]; |
2002 pNPCData4 = (NPCData *)&pPlayer9->pInstalledBeacons[uMessageParam]; | |
2003 if ( !*(_QWORD *)&pNPCData4->pName && bRecallingBeacon ) | |
4 | 2004 continue; |
0 | 2005 byte_506360 = 1; |
2006 pPlayer9->CanCastSpell(uRequiredMana); | |
2007 if ( pParty->bTurnBasedModeOn ) | |
2008 { | |
2009 v60 = sRecoveryTime; | |
2010 pParty->pTurnBasedPlayerRecoveryTimes[_506348_current_lloyd_playerid] = sRecoveryTime; | |
2011 pPlayer9->SetRecoveryTime(v60); | |
2012 pTurnEngine->_40471C(); | |
2013 } | |
2014 else | |
2015 { | |
2016 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
2017 } | |
2018 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0); | |
2019 if ( bRecallingBeacon ) | |
2020 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2021 if ( _stricmp(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]) ) |
0 | 2022 { |
978 | 2023 SaveGame(1, 0); |
0 | 2024 OnMapLeave(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2025 strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]); |
978 | 2026 dword_6BE364_game_settings_1 |= 1; |
2027 uGameState = GAME_STATE_2; | |
0 | 2028 _5B65A8_npcdata_uflags_or_other = pNPCData4->uFlags; |
2029 _5B65AC_npcdata_fame_or_other = pNPCData4->fame; | |
2030 _5B65B0_npcdata_rep_or_other = pNPCData4->rep; | |
291 | 2031 _5B65B4_npcdata_loword_house_or_other = LOWORD(pNPCData4->Location2D); |
2032 _5B65B8_npcdata_hiword_house_or_other = HIWORD(pNPCData4->Location2D); | |
978 | 2033 dword_5B65C0 = 1; |
0 | 2034 } |
2035 else | |
2036 { | |
2037 pParty->vPosition.x = pNPCData4->uFlags; | |
2038 pParty->vPosition.y = pNPCData4->fame; | |
2039 pParty->vPosition.z = pNPCData4->rep; | |
2040 pParty->uFallStartY = pParty->vPosition.z; | |
291 | 2041 pParty->sRotationY = LOWORD(pNPCData4->Location2D); |
2042 pParty->sRotationX = HIWORD(pNPCData4->Location2D); | |
0 | 2043 } |
978 | 2044 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
437 | 2045 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2046 { |
305 | 2047 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2048 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
2049 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2050 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2051 }*/ |
0 | 2052 //crt_deconstruct_ptr_6A0118(); |
2053 pBooksWindow->Release(); | |
2054 pGUIWindow_CurrentMenu->Release(); | |
2055 pBooksWindow = 0; | |
2056 pGUIWindow_CurrentMenu = 0; | |
2057 } | |
2058 else | |
2059 { | |
2060 sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1); | |
2061 SaveScreenshot(a1); | |
2062 LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1); | |
2063 v212 = qword_506350 << 7; | |
2064 pNPCData2 = pNPCData4; | |
2065 thisg = 0; | |
2066 v62 = pParty->uTimePlayed + (signed __int64)((double)(qword_506350 << 7) * 0.033333335); | |
2067 pNPCData4->pName = (char *)v62; | |
2068 pNPCData2->uPortraitID = HIDWORD(v62); | |
2069 pNPCData2->uFlags = pParty->vPosition.x; | |
2070 pNPCData2->fame = pParty->vPosition.y; | |
2071 pNPCData2->rep = pParty->vPosition.z; | |
291 | 2072 LOWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationY); |
2073 HIWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationX); | |
837 | 2074 if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 ) |
4 | 2075 continue; |
0 | 2076 uAction = 0; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2077 while ( _stricmp((const char *)pGames_LOD->pSubIndices + uAction, pCurrentMapName.data()) ) |
0 | 2078 { |
2079 ++thisg; | |
2080 uAction += 32; | |
837 | 2081 if ( thisg >= (signed int)pGames_LOD->uNumSubDirs / 2 ) |
4 | 2082 continue; |
0 | 2083 } |
2084 HIWORD(pNPCData4->uProfession) = thisg; | |
2085 } | |
4 | 2086 continue; |
961 | 2087 case UIMSG_ClickTownInTP: |
0 | 2088 if ( uMessageParam ) |
2089 { | |
2090 switch ( uMessageParam ) | |
2091 { | |
2092 case 1: | |
2093 v63 = 208; | |
2094 break; | |
2095 case 2: | |
2096 v63 = 207; | |
2097 break; | |
2098 case 3: | |
2099 v63 = 211; | |
2100 break; | |
2101 case 4: | |
2102 v63 = 209; | |
2103 break; | |
2104 default: | |
2105 if ( uMessageParam != 5 ) | |
2106 { | |
2107 LABEL_486: | |
978 | 2108 SaveGame(1, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2109 v64 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
0 | 2110 v65 = uMessageParam; |
839 | 2111 if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) |
0 | 2112 { |
839 | 2113 pParty->vPosition.x = TownPortalList[v65].pos.x; |
2114 pParty->vPosition.y = TownPortalList[v65].pos.y; | |
2115 pParty->vPosition.z = TownPortalList[v65].pos.z; | |
0 | 2116 pParty->uFallStartY = pParty->vPosition.z; |
839 | 2117 pParty->sRotationY = TownPortalList[v65].rot_y; |
2118 pParty->sRotationX = TownPortalList[v65].rot_x; | |
0 | 2119 } |
2120 else | |
2121 { | |
978 | 2122 SaveGame(1, 0); |
0 | 2123 OnMapLeave(); |
978 | 2124 dword_6BE364_game_settings_1 |= 1; |
2125 uGameState = GAME_STATE_2; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2126 strcpy(pCurrentMapName.data(), pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); |
978 | 2127 dword_5B65C0 = 1; |
839 | 2128 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; |
2129 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; | |
2130 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; | |
2131 v66 = TownPortalList[uMessageParam].rot_x; | |
2132 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y; | |
0 | 2133 _5B65B8_npcdata_hiword_house_or_other = v66; |
2134 InitializeActors(); | |
2135 } | |
1268 | 2136 v67 = (char*)pGUIWindow_CurrentMenu->Hint; |
0 | 2137 if ( v67 ) |
978 | 2138 *((int *)v67 + 17) = 1; |
0 | 2139 else |
710 | 2140 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u); |
437 | 2141 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2142 { |
990 | 2143 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2144 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
2145 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2146 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2147 }*/ |
978 | 2148 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
4 | 2149 continue; |
0 | 2150 } |
2151 v63 = 210; | |
2152 break; | |
2153 } | |
2154 } | |
2155 else | |
2156 { | |
2157 v63 = 206; | |
2158 } | |
484 | 2159 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63) ) |
0 | 2160 return; |
2161 goto LABEL_486; | |
961 | 2162 case UIMSG_HintTownPortal: |
0 | 2163 if ( uMessageParam ) |
2164 { | |
2165 switch ( uMessageParam ) | |
2166 { | |
2167 case 1: | |
2168 v68 = 208; | |
2169 break; | |
2170 case 2: | |
2171 v68 = 207; | |
2172 break; | |
2173 case 3: | |
2174 v68 = 211; | |
2175 break; | |
2176 case 4: | |
2177 v68 = 209; | |
2178 break; | |
2179 default: | |
2180 if ( uMessageParam != 5 ) | |
11 | 2181 //goto LABEL_506; |
2182 { | |
2183 if ( uMessageParam ) | |
2184 { | |
2185 switch ( uMessageParam ) | |
2186 { | |
2187 case 1: | |
2188 v69 = pMapStats->pInfos[4].pName; | |
2189 break; | |
2190 case 2: | |
2191 v69 = pMapStats->pInfos[3].pName; | |
2192 break; | |
2193 case 3: | |
2194 v69 = pMapStats->pInfos[10].pName; | |
2195 break; | |
2196 case 4: | |
2197 v69 = pMapStats->pInfos[7].pName; | |
2198 break; | |
2199 default: | |
2200 if ( uMessageParam != 5 ) | |
2201 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2202 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2203 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2204 continue; |
11 | 2205 } |
2206 v69 = pMapStats->pInfos[8].pName; | |
2207 break; | |
2208 } | |
2209 } | |
2210 else | |
2211 { | |
2212 v69 = pMapStats->pInfos[21].pName; | |
2213 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2214 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2215 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2216 continue; |
11 | 2217 } |
2218 v68 = 210; | |
2219 break; | |
0 | 2220 } |
2221 } | |
2222 else | |
2223 { | |
2224 v68 = 206; | |
2225 } | |
484 | 2226 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v68) ) |
0 | 2227 { |
2228 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); | |
4 | 2229 continue; |
0 | 2230 } |
11 | 2231 //LABEL_506: |
0 | 2232 if ( uMessageParam ) |
2233 { | |
2234 switch ( uMessageParam ) | |
2235 { | |
2236 case 1: | |
2237 v69 = pMapStats->pInfos[4].pName; | |
2238 break; | |
2239 case 2: | |
2240 v69 = pMapStats->pInfos[3].pName; | |
2241 break; | |
2242 case 3: | |
2243 v69 = pMapStats->pInfos[10].pName; | |
2244 break; | |
2245 case 4: | |
2246 v69 = pMapStats->pInfos[7].pName; | |
2247 break; | |
2248 default: | |
2249 if ( uMessageParam != 5 ) | |
2250 //goto LABEL_519; | |
4 | 2251 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2252 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2253 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2254 continue; |
4 | 2255 } |
0 | 2256 v69 = pMapStats->pInfos[8].pName; |
2257 break; | |
2258 } | |
2259 } | |
2260 else | |
2261 { | |
2262 v69 = pMapStats->pInfos[21].pName; | |
2263 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2264 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2265 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2266 continue; |
0 | 2267 case UIMSG_ShowFinalWindow: |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2268 sprintf(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." |
0 | 2269 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." |
2270 pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team." | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2271 ModalWindow(pFinalMessage.data(), 196); |
0 | 2272 uGameState = GAME_STATE_FINAL_WINDOW; |
4 | 2273 continue; |
0 | 2274 case UIMSG_C4: |
987 | 2275 __debugbreak(); |
982 | 2276 uGameState = GAME_STATE_PLAYING; |
0 | 2277 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); |
151 | 2278 case UIMSG_DD: |
990 | 2279 __debugbreak(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2280 sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer); |
703 | 2281 memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); |
701 | 2282 if ( v216.uPropCount == 1 ) |
0 | 2283 { |
837 | 2284 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2); |
0 | 2285 v70 = atoi(v216.pProperties[0]); |
2286 if ( v70 <= 0 || v70 >= 77 ) | |
4 | 2287 continue; |
0 | 2288 v71 = v70; |
2289 strcpy(Str2, pMapStats->pInfos[v70].pFilename); | |
2290 pNPCData3 = 0; | |
2291 if ( (signed int)pNPCData4 > 0 ) | |
2292 { | |
2293 thish = 0; | |
2294 do | |
2295 { | |
1104 | 2296 if ( !_stricmp((const char *)&pGames_LOD->pSubIndices[thish], Str2) ) |
0 | 2297 break; |
2298 ++thish; | |
2299 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1); | |
2300 } | |
2301 while ( (signed int)pNPCData3 < (signed int)pNPCData4 ); | |
2302 if ( (signed int)pNPCData3 < (signed int)pNPCData4 ) | |
2303 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2304 strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); |
0 | 2305 dword_6BE364_game_settings_1 |= 1u; |
978 | 2306 uGameState = GAME_STATE_2; |
0 | 2307 OnMapLeave(); |
4 | 2308 continue; |
0 | 2309 } |
2310 } | |
2311 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName); | |
2312 v73 = Str2; | |
2313 } | |
2314 else | |
2315 { | |
701 | 2316 if ( v216.uPropCount != 3 ) |
11 | 2317 continue; |
0 | 2318 v74 = atoi(v216.pProperties[0]); |
2319 thisi = atoi(v216.pProperties[1]); | |
2320 v75 = atoi(v216.pProperties[2]); | |
2321 v76 = v75; | |
2322 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
2323 { | |
2324 if ( pIndoor->GetSector(v74, thisi, v75) ) | |
2325 { | |
2326 v77 = thisi; | |
2327 pParty->vPosition.x = v74; | |
2328 pParty->vPosition.y = v77; | |
2329 pParty->vPosition.z = v76; | |
2330 pParty->uFallStartY = v76; | |
11 | 2331 continue; |
0 | 2332 } |
2333 } | |
2334 else | |
2335 { | |
2336 if ( v74 > -32768 ) | |
2337 { | |
2338 if ( v74 < 32768 ) | |
2339 { | |
2340 v77 = thisi; | |
2341 if ( thisi > -32768 ) | |
2342 { | |
2343 if ( thisi < 32768 && v76 >= 0 && v76 < 10000 ) | |
11 | 2344 { |
2345 pParty->vPosition.x = v74; | |
2346 pParty->vPosition.y = v77; | |
2347 pParty->vPosition.z = v76; | |
2348 pParty->uFallStartY = v76; | |
2349 continue; | |
2350 } | |
0 | 2351 } |
2352 } | |
2353 } | |
2354 } | |
2355 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
2356 v73 = "Can't jump to that location!"; | |
2357 } | |
2358 ShowStatusBarString(v73, 6u); | |
4 | 2359 continue; |
961 | 2360 case UIMSG_CastQuickSpell: |
0 | 2361 if ( bUnderwater == 1 ) |
362 | 2362 { |
2363 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" | |
2364 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
2365 continue; | |
2366 } | |
0 | 2367 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) ) |
11 | 2368 continue; |
362 | 2369 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); |
11 | 2370 continue; |
1000 | 2371 case UIMSG_CastSpell_Monster_Improvement: |
2372 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, | |
0 | 2373 if ( pRenderer->pRenderD3D ) |
2374 { | |
2375 v81 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
2376 } | |
2377 else | |
2378 { | |
2379 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v206); | |
2380 pPoint2 = pMouse->GetCursorPos(&v201); | |
2381 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]]; | |
2382 } | |
2383 v83 = v81; | |
2384 v44 = (unsigned __int16)v81; | |
2385 v84 = v83 >> 16; | |
848 | 2386 if ( PID_TYPE(v44) != 3 || v84 >= 5120 ) |
4 | 2387 continue; |
1000 | 2388 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
2389 if ( uMessage == UIMSG_CastSpell_Shoot_Monster ) | |
2390 { | |
2391 LOBYTE(pSpellInfo->field_8) &= 0xF7; | |
0 | 2392 } |
2393 else | |
2394 { | |
1000 | 2395 if ( uMessage == UIMSG_CastSpell_Monster_Improvement ) |
2396 HIBYTE(pSpellInfo->field_8) &= 0xFEu; | |
0 | 2397 else |
1000 | 2398 HIBYTE(pSpellInfo->field_8) &= 0xFDu; |
2399 } | |
2400 pSpellInfo->uPlayerID_2 = uMessageParam; | |
2401 pSpellInfo->spell_target_pid = v44; | |
2402 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2403 pGUIWindow_Settings->Release(); | |
11 | 2404 pGUIWindow_Settings = 0; |
2405 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2406 GameUI_Footer_TimeLeft = 0; |
11 | 2407 unk_50C9A0 = 0; |
2408 back_to_game(); | |
2409 continue; | |
151 | 2410 case UIMSG_1C: |
987 | 2411 __debugbreak(); |
0 | 2412 if ( !uActiveCharacter || pCurrentScreen ) |
4 | 2413 continue; |
710 | 2414 ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0); |
151 | 2415 pCurrentScreen = SCREEN_19; |
0 | 2416 pEventTimer->Pause(); |
4 | 2417 continue; |
151 | 2418 case UIMSG_1B: |
987 | 2419 __debugbreak(); |
0 | 2420 if ( !uActiveCharacter ) |
4 | 2421 continue; |
978 | 2422 if ( pParty->bTurnBasedModeOn != 1 ) |
11 | 2423 { |
2424 if ( pActors[uMessageParam].uAIState == 5 ) | |
2425 stru_50C198.LootActor(&pActors[uMessageParam]); | |
2426 else | |
2427 Actor::StealFrom(uMessageParam); | |
2428 continue; | |
2429 } | |
978 | 2430 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) |
4 | 2431 continue; |
0 | 2432 if ( !(pTurnEngine->field_18 & 2) ) |
2433 { | |
2434 if ( pActors[uMessageParam].uAIState == 5 ) | |
2435 stru_50C198.LootActor(&pActors[uMessageParam]); | |
2436 else | |
2437 Actor::StealFrom(uMessageParam); | |
2438 } | |
4 | 2439 continue; |
271 | 2440 |
2441 case UIMSG_Attack: | |
0 | 2442 if ( !uActiveCharacter ) |
4 | 2443 continue; |
978 | 2444 if ( pParty->bTurnBasedModeOn != 1 ) |
11 | 2445 { |
2446 _42ECB5_PlayerAttacksActor(); | |
2447 continue; | |
2448 } | |
978 | 2449 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) |
4 | 2450 continue; |
0 | 2451 if ( !(pTurnEngine->field_18 & 2) ) |
2452 _42ECB5_PlayerAttacksActor(); | |
4 | 2453 continue; |
151 | 2454 case UIMSG_ExitRest: |
1268 | 2455 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" |
11 | 2456 continue; |
151 | 2457 case UIMSG_Wait5Minutes: |
0 | 2458 if ( dword_506F14 == 2 ) |
916 | 2459 { |
2460 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2461 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2462 continue; | |
11 | 2463 } |
962 | 2464 GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2, |
1268 | 2465 (int)pButton_RestUI_Wait5Minutes, pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" |
978 | 2466 dword_506F14 = 1; |
0 | 2467 _506F18_num_hours_to_sleep = 5; |
4 | 2468 continue; |
151 | 2469 case UIMSG_Wait1Hour: |
0 | 2470 if ( dword_506F14 == 2 ) |
916 | 2471 { |
2472 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2473 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2474 continue; | |
11 | 2475 } |
962 | 2476 GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2, |
1268 | 2477 (int)pButton_RestUI_Wait1Hour, pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" |
978 | 2478 dword_506F14 = 1; |
0 | 2479 _506F18_num_hours_to_sleep = 60; |
4 | 2480 continue; |
907 | 2481 case UIMSG_RentRoom: |
0 | 2482 dword_506F14 = 2; |
1033 | 2483 RestUI_Load(); |
758 | 2484 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; |
0 | 2485 _506F18_num_hours_to_sleep = v86; |
2486 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) | |
2487 _506F18_num_hours_to_sleep = v86 + 720; | |
11 | 2488 dword_506F14 = 2; |
2489 pParty->RestAndHeal(); | |
766 | 2490 pParty->days_played_without_rest = 0; |
2491 pParty->pPlayers[3].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2492 pParty->pPlayers[2].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2493 pParty->pPlayers[1].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2494 pParty->pPlayers[0].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
11 | 2495 continue; |
907 | 2496 case UIMSG_RestWindow: |
0 | 2497 if ( pMessageQueue_50CBD0->uNumMessages ) |
2498 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2499 if ( pCurrentScreen ) | |
4 | 2500 continue; |
0 | 2501 if ( sub_42F4DA() ) |
11 | 2502 { |
978 | 2503 if ( pParty->bTurnBasedModeOn == 1 ) |
11 | 2504 { |
916 | 2505 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" |
11 | 2506 continue; |
2507 } | |
2508 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2509 if ( pParty->uFlags & 0x88 ) | |
2510 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
916 | 2511 ShowStatusBarString(v88, 2); |
11 | 2512 if ( !uActiveCharacter ) |
2513 continue; | |
916 | 2514 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); |
2515 continue; | |
11 | 2516 } |
978 | 2517 if ( pParty->bTurnBasedModeOn == 1 ) |
916 | 2518 { |
2519 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
11 | 2520 continue; |
2521 } | |
0 | 2522 if ( !(pParty->uFlags & 0x88) ) |
2523 { | |
1033 | 2524 RestUI_Load(); |
4 | 2525 continue; |
0 | 2526 } |
978 | 2527 if ( pParty->bTurnBasedModeOn == 1 ) |
0 | 2528 { |
916 | 2529 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" |
11 | 2530 continue; |
0 | 2531 } |
2532 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2533 if ( pParty->uFlags & 0x88 ) | |
2534 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
2535 ShowStatusBarString(v88, 2u); | |
2536 if ( !uActiveCharacter ) | |
4 | 2537 continue; |
916 | 2538 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); |
2539 continue; | |
907 | 2540 case UIMSG_Rest8Hour: |
0 | 2541 if ( dword_506F14 ) |
916 | 2542 { |
2543 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2544 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2545 continue; | |
11 | 2546 } |
0 | 2547 if ( pParty->uNumFoodRations < uRestUI_FoodRequiredToRest ) |
2548 { | |
2549 ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2u);// "You don't have enough food to rest" | |
2550 if ( uActiveCharacter && pPlayers[uActiveCharacter]->CanAct() ) | |
916 | 2551 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_108, 0); |
0 | 2552 } |
2553 else | |
2554 { | |
2555 pParty->pPlayers[3].pConditions[2] = pParty->uTimePlayed; | |
2556 pParty->pPlayers[2].pConditions[2] = pParty->uTimePlayed; | |
2557 pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed; | |
2558 pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2559 v90 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
0 | 2560 if ( !v90 ) |
2561 v90 = rand() % (signed int)pMapStats->uNumMaps + 1; | |
2562 pMapInfo = &pMapStats->pInfos[v90]; | |
237 | 2563 if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent ) |
0 | 2564 { |
2565 v91 = rand() % 100; | |
237 | 2566 v92 = pMapInfo->EncM1percent; |
0 | 2567 v93 = v91 + 1; |
2568 if ( v93 > v92 ) | |
237 | 2569 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); |
0 | 2570 else |
978 | 2571 pNPCData4 = (NPCData *)1; |
0 | 2572 if ( !sub_45063B(pMapInfo, (int)pNPCData4) ) |
2573 pNPCData4 = 0; | |
2574 if ( pNPCData4 ) | |
2575 { | |
2576 pPlayerNum = rand() % 4; | |
2577 LODWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
2578 HIDWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
2579 v95 = rand(); | |
2580 Rest(v95 % 6 + 60); | |
2581 _506F18_num_hours_to_sleep = 0; | |
2582 dword_506F14 = 0; | |
437 | 2583 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2584 { |
990 | 2585 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2586 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
2587 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2588 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2589 }*/ |
2590 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
916 | 2591 ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!" |
2592 pAudioPlayer->PlaySound((SoundID)227, 0, 0, -1, 0, 0, 0, 0); | |
2593 continue; | |
0 | 2594 } |
2595 } | |
2596 Party::TakeFood(uRestUI_FoodRequiredToRest); | |
2597 _506F18_num_hours_to_sleep = 480; | |
2598 dword_506F14 = 2; | |
2599 pParty->RestAndHeal(); | |
766 | 2600 pParty->days_played_without_rest = 0; |
2601 pParty->pPlayers[3].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2602 pParty->pPlayers[2].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2603 pParty->pPlayers[1].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2604 pParty->pPlayers[0].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
0 | 2605 } |
4 | 2606 continue; |
151 | 2607 case UIMSG_AlreadyResting: |
0 | 2608 if ( dword_506F14 == 2 ) |
2609 { | |
916 | 2610 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" |
362 | 2611 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2612 continue; | |
0 | 2613 } |
962 | 2614 GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2, |
1268 | 2615 (int)pButton_RestUI_WaitUntilDawn, pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" |
758 | 2616 v97 = _494820_training_time(pParty->uCurrentHour); |
978 | 2617 dword_506F14 = 1; |
0 | 2618 _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute; |
4 | 2619 continue; |
960 | 2620 case UIMSG_HintSelectRemoveQuickSpellBtn: |
688 | 2621 if ( quick_spell_at_page && byte_506550 ) |
2622 { | |
2623 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
|
2624 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[483], v173); |
0 | 2625 } |
2626 else | |
2627 { | |
2628 if ( pPlayers[uActiveCharacter]->uQuickSpell ) | |
2629 v177 = pGlobalTXT_LocalizationStrings[584];// "Click here to remove your Quick Spell" | |
2630 else | |
2631 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
|
2632 strcpy(pTmpBuf.data(), v177); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2633 } |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2634 GameUI_SetFooterString(pTmpBuf.data()); |
4 | 2635 continue; |
370 | 2636 case UIMSG_SPellbook_ShowHightlightedSpellInfo: |
4 | 2637 if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter], |
0 | 2638 !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402)) ) |
4 | 2639 continue; |
0 | 2640 if ( sub_4637E0_is_there_popup_onscreen() ) |
2641 dword_507B00_spell_info_to_draw_in_popup = uMessageParam + 1; | |
2642 v98 = *(char *)(uNumSeconds + 6734); | |
688 | 2643 if ( quick_spell_at_page - 1 == uMessageParam ) |
0 | 2644 { |
2645 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2646 v161 = pGlobalTXT_LocalizationStrings[485]; | |
2647 } | |
2648 else | |
2649 { | |
2650 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2651 v161 = pGlobalTXT_LocalizationStrings[486]; | |
2652 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2653 sprintfex(pTmpBuf.data(), v161, v178); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2654 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 2655 continue; |
960 | 2656 case UIMSG_ClickInstallRemoveQuickSpellBtn: |
962 | 2657 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0); |
0 | 2658 if ( !uActiveCharacter ) |
4 | 2659 continue; |
0 | 2660 pPlayer10 = pPlayers[uActiveCharacter]; |
688 | 2661 if ( !byte_506550 || !quick_spell_at_page ) |
0 | 2662 { |
2663 pPlayer10->uQuickSpell = 0; | |
688 | 2664 quick_spell_at_page = 0; |
916 | 2665 pAudioPlayer->PlaySound((SoundID)203, 0, 0, -1, 0, 0, 0, 0); |
2666 continue; | |
0 | 2667 } |
688 | 2668 v99 = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; |
0 | 2669 pPlayers[uActiveCharacter]->uQuickSpell = v99; |
2670 stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter); | |
2671 if ( uActiveCharacter ) | |
187 | 2672 pPlayer10->PlaySound(SPEECH_12, 0); |
0 | 2673 byte_506550 = 0; |
4 | 2674 continue; |
1118 | 2675 case UIMSG_SpellBook_PressTab: |
2676 //__debugbreak(); | |
0 | 2677 if ( !uActiveCharacter ) |
4 | 2678 continue; |
0 | 2679 pPlayer3 = pPlayers[uActiveCharacter]; |
2680 pNPCData4 = 0; | |
2681 uAction = 0; | |
2682 v101 = 0; | |
2683 thisl = (int)&pPlayer3->pActiveSkills[12]; | |
2684 do | |
2685 { | |
2686 if ( *(short *)thisl ) | |
2687 { | |
198 | 2688 if ( pPlayer3->lastOpenedSpellbookPage == v101 ) |
0 | 2689 uAction = (int)pNPCData4; |
2690 v102 = (int)pNPCData4; | |
2691 pNPCData4 = (NPCData *)((char *)pNPCData4 + 1); | |
2692 v217[v102] = v101; | |
2693 } | |
2694 thisl += 2; | |
2695 ++v101; | |
2696 } | |
2697 while ( v101 < 9 ); | |
2698 if ( !pNPCData4 ) | |
11 | 2699 { |
2700 v127 = rand() % 2 + 204; | |
916 | 2701 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2702 continue; | |
11 | 2703 } |
0 | 2704 if ( GetAsyncKeyState(16) ) |
2705 { | |
2706 --uAction; | |
2707 if ( uAction < 0 ) | |
2708 uAction = (int)((char *)pNPCData4 - 1); | |
2709 } | |
2710 else | |
2711 { | |
2712 ++uAction; | |
2713 if ( uAction >= (signed int)pNPCData4 ) | |
2714 uAction = 0; | |
2715 } | |
2716 sub_41140B(); | |
198 | 2717 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); |
11 | 2718 pGUIWindow_CurrentMenu->OpenSpellBook(); |
2719 v127 = rand() % 2 + 204; | |
916 | 2720 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2721 continue; | |
832 | 2722 case UIMSG_OpenSpellbookPage: |
198 | 2723 if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage ) |
4 | 2724 continue; |
0 | 2725 sub_41140B(); |
198 | 2726 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; |
11 | 2727 pGUIWindow_CurrentMenu->OpenSpellBook(); |
0 | 2728 v127 = rand() % 2 + 204; |
916 | 2729 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2730 continue; | |
437 | 2731 case UIMSG_SelectSpell: |
2732 { | |
2733 if (pTurnEngine->field_4 == 3) | |
2734 continue; | |
2735 if (!uActiveCharacter) | |
2736 continue; | |
2737 | |
2738 // uNumSeconds = (unsigned int)pPlayers[uActiveCharacter]; | |
2739 auto player = pPlayers[uActiveCharacter]; | |
2740 if (player->spellbook.pChapters[player->lastOpenedSpellbookPage].bIsSpellAvailable[uMessageParam]) | |
2741 //if ( *(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + &lastOpenedSpellbookPage) + uMessageParam + 402) ) | |
2742 { | |
688 | 2743 if ( quick_spell_at_page - 1 == uMessageParam ) |
0 | 2744 { |
2745 pGUIWindow_CurrentMenu->Release(); | |
2746 pEventTimer->Resume(); | |
978 | 2747 viewparams->bRedrawGameUI = 1; |
151 | 2748 pCurrentScreen = SCREEN_GAME; |
0 | 2749 pIcons_LOD->_4114F2(); |
688 | 2750 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; |
1000 | 2751 /*if ( dword_50C9E8 < 40 ) |
0 | 2752 { |
437 | 2753 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook; |
2754 dword_50C9EC[3 * dword_50C9E8 + 1] = v103; | |
2755 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1; | |
0 | 2756 ++dword_50C9E8; |
1000 | 2757 }*/ |
1012 | 2758 pMessageQueue_50C9E8->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); |
2759 // pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); | |
0 | 2760 } |
2761 else | |
2762 { | |
2763 byte_506550 = 1; | |
688 | 2764 quick_spell_at_page = uMessageParam + 1; |
0 | 2765 } |
437 | 2766 } |
2767 } | |
2768 continue; | |
370 | 2769 |
2770 case UIMSG_CastSpellFromBook: | |
2771 if ( pTurnEngine->field_4 != 3 ) | |
2772 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0); | |
2773 continue; | |
2774 | |
1019 | 2775 case UIMSG_SpellScrollUse: |
987 | 2776 __debugbreak(); |
0 | 2777 if ( pTurnEngine->field_4 != 3 ) |
978 | 2778 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0); |
4 | 2779 continue; |
907 | 2780 case UIMSG_SpellBookWindow: |
0 | 2781 if ( pTurnEngine->field_4 == 3 ) |
4 | 2782 continue; |
0 | 2783 if ( bUnderwater == 1 ) |
2784 { | |
362 | 2785 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" |
916 | 2786 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
0 | 2787 } |
2788 else | |
2789 { | |
2790 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2791 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2792 if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery ) | |
2793 { | |
2794 if ( !pCurrentScreen ) | |
2795 { | |
962 | 2796 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); |
151 | 2797 pCurrentScreen = SCREEN_SPELL_BOOK; |
0 | 2798 pEventTimer->Pause(); |
710 | 2799 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); |
0 | 2800 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); |
978 | 2801 viewparams->field_48 = 1; |
4 | 2802 continue; |
0 | 2803 } |
151 | 2804 if ( pCurrentScreen != SCREEN_REST |
2805 && pCurrentScreen != SCREEN_CHARACTERS | |
2806 && (pCurrentScreen <= SCREEN_63 | |
2807 || pCurrentScreen > SCREEN_67) ) | |
11 | 2808 { |
2809 pGUIWindow_CurrentMenu->Release(); | |
962 | 2810 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); |
151 | 2811 pCurrentScreen = SCREEN_SPELL_BOOK; |
11 | 2812 pEventTimer->Pause(); |
710 | 2813 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); |
11 | 2814 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); |
978 | 2815 viewparams->field_48 = 1; |
11 | 2816 continue; |
2817 } | |
2818 } | |
2819 } | |
2820 continue; | |
2821 case UIMSG_QuickReference: | |
0 | 2822 if ( pMessageQueue_50CBD0->uNumMessages ) |
2823 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2824 if ( pCurrentScreen ) | |
2825 pGUIWindow_CurrentMenu->Release(); | |
2826 ++pIcons_LOD->uTexturePacksCount; | |
2827 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2828 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
962 | 2829 GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0); |
978 | 2830 viewparams->bRedrawGameUI = 1; |
0 | 2831 pEventTimer->Pause(); |
2832 pAudioPlayer->StopChannels(-1, -1); | |
151 | 2833 pCurrentScreen = SCREEN_QUICK_REFERENCE; |
710 | 2834 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0); |
0 | 2835 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); |
978 | 2836 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 2837 pGlobalTXT_LocalizationStrings[79],// "Exit" |
973 | 2838 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179); |
4 | 2839 continue; |
358 | 2840 case UIMSG_GameMenuButton: |
0 | 2841 if ( pCurrentScreen ) |
2842 { | |
2843 pGUIWindow_CurrentMenu->Release(); | |
2844 pEventTimer->Resume(); | |
151 | 2845 pCurrentScreen = SCREEN_GAME; |
978 | 2846 viewparams->bRedrawGameUI = 1; |
0 | 2847 } |
2848 stru_506E40.Release(); | |
2849 uNumSeconds = (unsigned int)MakeScreenshot(155, 117); | |
2850 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); | |
2851 free((void *)uNumSeconds); | |
2852 stru_506E40._40E55E("gamma.pcx", 0); | |
962 | 2853 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton, (int)pBtn_GameSettings, 0); |
11 | 2854 //LABEL_453: |
437 | 2855 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
4 | 2856 continue; |
990 | 2857 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 2858 //goto LABEL_770; |
2859 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2860 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 2861 ++pMessageQueue_50CBD0->uNumMessages;*/ |
2862 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
11 | 2863 continue; |
1101
3e5d70cfe20e
Award order fix, changed UIMSG_C0 to UIMSG_ClickAwardScrollBar
Grumpy7
parents:
1091
diff
changeset
|
2864 case UIMSG_ClickAwardScrollBar: |
978 | 2865 dword_50651C = 1; |
0 | 2866 if ( pMouse->GetCursorPos(&v211)->y > 178 ) |
2867 dword_50651C = -1; | |
4 | 2868 continue; |
961 | 2869 case UIMSG_ClickAwardsUpBtn: |
962 | 2870 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0); |
990 | 2871 BtnUp_flag = 1; |
4 | 2872 continue; |
961 | 2873 case UIMSG_ClickAwardsDownBtn: |
962 | 2874 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0); |
990 | 2875 BtnDown_flag = 1; |
4 | 2876 continue; |
910 | 2877 case UIMSG_ChangeDetaliz: |
978 | 2878 bRingsShownInCharScreen ^= 1; |
910 | 2879 pCharacterScreen_DetalizBtn->Release(); |
697 | 2880 pCharacterScreen_DollBtn->Release(); |
0 | 2881 if ( bRingsShownInCharScreen ) |
2882 { | |
973 | 2883 v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight; |
2884 v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth; | |
0 | 2885 v123 = 445; |
2886 v121 = 470; | |
2887 } | |
2888 else | |
2889 { | |
2890 v128 = 30; | |
2891 v125 = 30; | |
2892 v123 = 300; | |
2893 v121 = 600; | |
2894 } | |
978 | 2895 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0, |
0 | 2896 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" |
2897 0); | |
1025 | 2898 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); |
978 | 2899 viewparams->bRedrawGameUI = 1; |
910 | 2900 continue; |
2901 case UIMSG_ClickPaperdoll: | |
0 | 2902 OnPaperdollLeftClick(); |
4 | 2903 continue; |
960 | 2904 case UIMSG_ClickStatsBtn: |
0 | 2905 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; |
991 | 2906 CharacterUI_ReleaseButtons(); |
0 | 2907 sub_419379(); |
962 | 2908 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0); |
960 | 2909 continue; |
2910 case UIMSG_ClickSkillsBtn: | |
0 | 2911 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; |
991 | 2912 CharacterUI_ReleaseButtons(); |
0 | 2913 sub_419379(); |
991 | 2914 CharacterUI_SkillsTab_CreateButtons(); |
962 | 2915 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0); |
11 | 2916 continue; |
0 | 2917 case UIMSG_SkillUp: |
2918 pPlayer4 = pPlayers[uActiveCharacter]; | |
2919 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam]; | |
2920 LOWORD(v2) = *(short *)v105; | |
2921 uNumSeconds = v2; | |
2922 if ( pPlayer4->uSkillPoints < (v2 & 0x3F) + 1 ) | |
2923 { | |
2924 v87 = pGlobalTXT_LocalizationStrings[488];// "You don't have enough skill points!" | |
2925 } | |
2926 else | |
2927 { | |
2928 if ( (uNumSeconds & 0x3F) < 0x3C ) | |
2929 { | |
2930 *(short *)v105 = uNumSeconds + 1; | |
2931 pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F; | |
187 | 2932 pPlayer4->PlaySound(SPEECH_14, 0); |
916 | 2933 pAudioPlayer->PlaySound((SoundID)20001, 0, 0, -1, 0, 0, 0, 0); |
2934 continue; | |
0 | 2935 } |
2936 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!" | |
2937 } | |
916 | 2938 ShowStatusBarString(v87, 2); |
4 | 2939 continue; |
960 | 2940 case UIMSG_ClickInventoryBtn: |
0 | 2941 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; |
2942 sub_419379(); | |
991 | 2943 CharacterUI_ReleaseButtons(); |
962 | 2944 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0); |
960 | 2945 continue; |
2946 case UIMSG_ClickExitCharacterWindowBtn: | |
2947 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0); | |
2948 continue; | |
2949 case UIMSG_ClickAwardsBtn: | |
0 | 2950 sub_419379(); |
991 | 2951 CharacterUI_ReleaseButtons(); |
0 | 2952 sub_419220(); |
2953 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; | |
962 | 2954 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0); |
521 | 2955 FillAwardsData(); |
4 | 2956 continue; |
1000 | 2957 case UIMSG_ClickBooksBtn: |
0 | 2958 switch ( uMessageParam ) |
2959 { | |
990 | 2960 case 11://Page UP |
2961 BtnUp_flag = 1; | |
2962 pButton = pBtn_Book_2; | |
2963 break; | |
2964 case 10://Page DOWN | |
2965 BtnDown_flag = 1; | |
2966 pButton = pBtn_Book_1; | |
2967 break; | |
1000 | 2968 case 0://Zoom plus |
0 | 2969 pButton = pBtn_Book_1; |
990 | 2970 BtnDown_flag = 1; |
0 | 2971 break; |
1000 | 2972 case 1://Zoom minus |
2973 pButton = pBtn_Book_2; | |
990 | 2974 BtnUp_flag = 1; |
0 | 2975 break; |
990 | 2976 case 2://Potions |
2977 Book_PageBtn3_flag = 1; | |
0 | 2978 if ( dword_506364 ) |
4 | 2979 continue; |
0 | 2980 pButton = pBtn_Book_3; |
2981 break; | |
990 | 2982 case 3://fountains |
2983 Book_PageBtn4_flag = 1; | |
0 | 2984 if ( dword_506364 ) |
4 | 2985 continue; |
0 | 2986 pButton = pBtn_Book_4; |
2987 break; | |
990 | 2988 case 4://obelisks |
2989 Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag | |
0 | 2990 if ( dword_506364 ) |
4 | 2991 continue; |
0 | 2992 pButton = pBtn_Book_5; |
2993 break; | |
990 | 2994 case 5://seer |
2995 Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag | |
0 | 2996 if ( dword_506364 ) |
4 | 2997 continue; |
0 | 2998 pButton = pBtn_Book_6; |
2999 break; | |
990 | 3000 case 6://misc |
0 | 3001 pButton = pBtn_Autonotes_Misc; |
990 | 3002 Autonotes_Misc_page_flag = 1; |
0 | 3003 break; |
990 | 3004 case 7://Instructors |
0 | 3005 pButton = pBtn_Autonotes_Instructors; |
990 | 3006 Autonotes_Instructors_page_flag = 1; |
0 | 3007 break; |
990 | 3008 default: |
3009 continue; | |
0 | 3010 } |
1268 | 3011 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); |
11 | 3012 continue; |
0 | 3013 case UIMSG_SelectCharacter: |
3014 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3015 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3016 GameUI_OnPlayerPortraitLeftClick(uMessageParam); | |
4 | 3017 continue; |
0 | 3018 case UIMSG_ShowStatus_Funds: |
3019 v174 = (char *)pParty->uNumGoldInBank; | |
3020 v158 = pParty->uNumGold + pParty->uNumGoldInBank; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3021 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[489], v158, v174);// "You have %d total gold, %d in the Bank" |
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_DateTime: |
3025 pNPCData4 = (NPCData *)pParty->uCurrentHour; | |
3026 if ( (signed int)pParty->uCurrentHour <= 12 ) | |
3027 { | |
3028 if ( !pNPCData4 ) | |
3029 pNPCData4 = (NPCData *)12; | |
3030 } | |
3031 else | |
3032 { | |
3033 pNPCData4 = (NPCData *)((char *)pNPCData4 - 12); | |
3034 } | |
978 | 3035 if ( pParty->uCurrentHour < 0xC || (uNumSeconds = 1, pParty->uCurrentHour >= 0x18) ) |
0 | 3036 uNumSeconds = 0; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3037 sprintf(pTmpBuf.data(), "%d:%02d%s %s %d %s %d", pNPCData4, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7], |
0 | 3038 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
|
3039 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 3040 continue; |
0 | 3041 case UIMSG_ShowStatus_Food: |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3042 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
|
3043 GameUI_SetFooterString(pTmpBuf.data()); |
306 | 3044 continue; |
0 | 3045 case UIMSG_ShowStatus_Player: |
3046 pPlayer5 = pPlayers[uMessageParam]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3047 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
|
3048 strcat(pTmpBuf.data(), ": "); |
0 | 3049 v107 = pPlayer5->GetMajorConditionIdx(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3050 strcat(pTmpBuf.data(), aCharacterConditionNames[v107]); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3051 GameUI_SetFooterString(pTmpBuf.data()); |
0 | 3052 v108 = 8 * uMessageParam - 8; |
3053 LOBYTE(v108) = v108 | 4; | |
888 | 3054 pMouse->uPointingObjectID = PID(OBJECT_Player,v108); |
4 | 3055 continue; |
0 | 3056 case UIMSG_ShowStatus_ManaHP: |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3057 sprintf(pTmpBuf.data(), "%d / %d %s %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(), |
1000 | 3058 pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(), |
3059 pGlobalTXT_LocalizationStrings[212]); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3060 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 3061 continue; |
987 | 3062 case UIMSG_CHEST_ClickItem: |
3063 if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) | |
3064 { | |
3065 OnInventoryLeftClick(); | |
11 | 3066 continue; |
3067 } | |
987 | 3068 OnChestLeftClick(); |
4 | 3069 continue; |
151 | 3070 case UIMSG_InventoryLeftClick: |
987 | 3071 OnInventoryLeftClick(); |
4 | 3072 continue; |
960 | 3073 case UIMSG_MouseLeftClickInGame: |
0 | 3074 if ( !pRenderer->pRenderD3D ) |
11 | 3075 { |
3076 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3077 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3078 OnGameViewportClick(); | |
3079 continue; | |
3080 } | |
0 | 3081 v115 = pMessageQueue_50CBD0->uNumMessages; |
3082 if ( !pMessageQueue_50CBD0->uNumMessages ) | |
11 | 3083 { |
990 | 3084 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3085 /*if ( (signed int)v115 < 40 ) |
11 | 3086 //goto LABEL_769; |
3087 { | |
990 | 3088 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
11 | 3089 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
3090 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3091 ++pMessageQueue_50CBD0->uNumMessages; | |
3092 continue; | |
437 | 3093 }*/ |
11 | 3094 continue; |
3095 } | |
0 | 3096 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
3097 { | |
978 | 3098 pMessageQueue_50CBD0->uNumMessages = 1; |
990 | 3099 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3100 /*v115 = v0; |
0 | 3101 pMessageQueue_50CBD0->uNumMessages = v0; |
990 | 3102 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
0 | 3103 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
11 | 3104 //goto LABEL_771; |
3105 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 3106 ++pMessageQueue_50CBD0->uNumMessages;*/ |
11 | 3107 continue; |
0 | 3108 } |
3109 v115 = 0; | |
3110 pMessageQueue_50CBD0->uNumMessages = 0; | |
990 | 3111 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3112 /*if ( (signed int)v115 < 40 ) |
11 | 3113 //goto LABEL_769; |
3114 { | |
990 | 3115 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
11 | 3116 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
3117 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3118 ++pMessageQueue_50CBD0->uNumMessages; | |
3119 continue; | |
437 | 3120 }*/ |
4 | 3121 continue; |
990 | 3122 case UIMSG_MouseLeftClickInScreen://ñðàáàòûâàåò ïðè íàæàòèè íà ïðàâóþ êíîïêó ìûøè ïîñëå UIMSG_MouseLeftClickInGame |
0 | 3123 if ( pMessageQueue_50CBD0->uNumMessages ) |
3124 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3125 OnGameViewportClick(); | |
4 | 3126 continue; |
151 | 3127 case UIMSG_F: |
987 | 3128 __debugbreak(); |
0 | 3129 if ( pRenderer->pRenderD3D ) |
3130 { | |
3131 LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
3132 } | |
3133 else | |
3134 { | |
3135 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209); | |
3136 pPoint3 = pMouse->GetCursorPos(&v204); | |
3137 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]]; | |
3138 } | |
3139 pButton2 = (GUIButton *)(unsigned __int16)v116; | |
960 | 3140 GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0); |
11 | 3141 continue; |
151 | 3142 case UIMSG_54: |
987 | 3143 __debugbreak(); |
0 | 3144 pButton2 = (GUIButton *)uMessageParam; |
990 | 3145 GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0); |
4 | 3146 continue; |
201 | 3147 case UIMSG_Game_Action: |
0 | 3148 if ( pMessageQueue_50CBD0->uNumMessages ) |
3149 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3150 OnPressSpace(); | |
4 | 3151 continue; |
960 | 3152 case UIMSG_ClickZoomOutBtn: |
0 | 3153 if ( pCurrentScreen ) |
4 | 3154 continue; |
0 | 3155 pParty->uFlags |= 2u; |
1000 | 3156 GUIWindow::Create(519, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomOut, 0); |
0 | 3157 uNumSeconds = 131072; |
3158 v118 = 2 * viewparams->uMinimapZoom; | |
3159 ++viewparams->field_28; | |
3160 viewparams->uMinimapZoom *= 2; | |
3161 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
3162 { | |
3163 if ( (signed int)v118 > 4096 ) | |
3164 { | |
3165 viewparams->uMinimapZoom = 4096; | |
3166 viewparams->field_28 = 12; | |
3167 } | |
4 | 3168 continue; |
0 | 3169 } |
3170 v119 = 2048; | |
3171 if ( (signed int)v118 <= 2048 ) | |
960 | 3172 { |
1051 | 3173 _576E2C_current_minimap_zoom = v118; |
960 | 3174 dword_576E28 = viewparams->field_28; |
3175 break; | |
3176 } | |
0 | 3177 viewparams->field_28 = 11; |
960 | 3178 viewparams->uMinimapZoom = v119; |
1051 | 3179 _576E2C_current_minimap_zoom = v119; |
960 | 3180 dword_576E28 = viewparams->field_28; |
3181 break; | |
3182 case UIMSG_ClickZoomInBtn: | |
0 | 3183 if ( pCurrentScreen ) |
4 | 3184 continue; |
0 | 3185 pParty->uFlags |= 2u; |
1000 | 3186 GUIWindow::Create(574, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomIn, 0); |
0 | 3187 uNumSeconds = 32768; |
3188 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
3189 --viewparams->field_28; | |
3190 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
3191 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3192 { | |
3193 v119 = 512; | |
3194 if ( (signed int)v118 < 512 ) | |
3195 { | |
3196 viewparams->field_28 = 9; | |
3197 v118 = v119; | |
3198 viewparams->uMinimapZoom = v119; | |
3199 } | |
1051 | 3200 _576E2C_current_minimap_zoom = v118; |
0 | 3201 dword_576E28 = viewparams->field_28; |
3202 } | |
3203 else | |
3204 { | |
3205 if ( (signed int)v118 < 256 ) | |
3206 { | |
3207 viewparams->uMinimapZoom = 256; | |
3208 viewparams->field_28 = 8; | |
3209 } | |
3210 } | |
4 | 3211 default: |
3212 continue; | |
0 | 3213 } |
3214 } | |
3215 } | |
1012 | 3216 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8; |
3217 memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages); | |
3218 //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8); | |
3219 //dword_50C9E8 = 0; | |
3220 | |
3221 | |
3222 pMessageQueue_50C9E8->uNumMessages=0; | |
0 | 3223 if ( dword_50C9DC ) |
3224 { | |
437 | 3225 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 3226 { |
3227 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC; | |
3228 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = (int)ptr_50C9E0; | |
3229 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3230 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 3231 }*/ |
3232 pMessageQueue_50CBD0->AddMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0); | |
0 | 3233 dword_50C9DC = 0; |
3234 } | |
3235 else | |
3236 { | |
3237 if ( dword_50C9D0 > 0 ) | |
3238 { | |
3239 dword_50C9D8 -= pEventTimer->uTimeElapsed; | |
3240 if ( dword_50C9D8 <= 0 ) | |
3241 { | |
437 | 3242 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 3243 { |
3244 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9D0; | |
3245 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = dword_50C9D4; | |
3246 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3247 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 3248 }*/ |
3249 pMessageQueue_50CBD0->AddMessage((UIMessageType)dword_50C9D0, dword_50C9D4, 0); | |
0 | 3250 dword_50C9D0 = 0; |
3251 dword_50C9D4 = 0; | |
3252 dword_50C9D8 = 0; | |
3253 } | |
3254 } | |
3255 } | |
1202 | 3256 pCastSpellInfo.data()->_427E01_cast_spell(); |
0 | 3257 } |
3258 | |
3259 //----- (004356FF) -------------------------------------------------------- | |
3260 void __cdecl back_to_game() | |
3261 { | |
3262 dword_507BF0_is_there_popup_onscreen = 0; | |
3263 dword_4E455C = 1; | |
3264 dword_50CDCC = 0; | |
3265 if ( pGUIWindow_ScrollWindow ) | |
3266 free_book_subwindow(); | |
3267 if ( !pCurrentScreen && !pGUIWindow_Settings ) | |
3268 pEventTimer->Resume(); | |
3269 viewparams->bRedrawGameUI = 1; | |
3270 } | |
782 | 3271 |
0 | 3272 //----- (00435748) -------------------------------------------------------- |
3273 void __cdecl GUI_MainMenuMessageProc() | |
3274 { | |
967 | 3275 Player *pPlayer; // ebx@2 |
0 | 3276 void *v3; // edi@21 |
3277 signed int v4; // eax@29 | |
3278 int v5; // ecx@29 | |
821 | 3279 PLAYER_SKILL_TYPE v6; // edi@37 |
0 | 3280 GUIWindow *pWindow; // eax@56 |
3281 GUIButton *pButton; // eax@59 | |
3282 int v15; // edi@70 | |
3283 char v20; // dl@116 | |
3284 unsigned int v21; // eax@116 | |
3285 unsigned int v25; // eax@120 | |
3286 unsigned int v26; // ecx@127 | |
3287 SoundID pSoundID; // [sp-2Ch] [bp-3Ch]@36 | |
3288 signed int v41; // [sp-10h] [bp-20h]@29 | |
971 | 3289 int pParam; // [sp+4h] [bp-Ch]@3 |
0 | 3290 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3 |
967 | 3291 int pSex; // [sp+Ch] [bp-4h]@3 |
0 | 3292 |
3293 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3294 { | |
2 | 3295 pPlayer = pParty->pPlayers; |
0 | 3296 do |
3297 { | |
187 | 3298 int param2; |
971 | 3299 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, ¶m2); |
3300 auto player = &pParty->pPlayers[pParam]; | |
187 | 3301 |
3 | 3302 switch (pUIMessageType) // For buttons of window MainMenu |
2 | 3303 { |
165 | 3304 case UIMSG_MainMenu_ShowPartyCreationWnd: |
962 | 3305 GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); |
0 | 3306 SetCurrentMenuID(MENU_NEWGAME); |
960 | 3307 break; |
165 | 3308 case UIMSG_MainMenu_ShowLoadWindow: |
962 | 3309 GUIWindow::Create(495, 227, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnLoad, 0); |
0 | 3310 SetCurrentMenuID(MENU_SAVELOAD); |
960 | 3311 break; |
165 | 3312 case UIMSG_ShowCredits: |
962 | 3313 GUIWindow::Create(495, 282, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnCredits, 0); |
0 | 3314 SetCurrentMenuID(MENU_CREDITS); |
960 | 3315 break; |
165 | 3316 case UIMSG_ExitToWindows: |
962 | 3317 GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); |
982 | 3318 SetCurrentMenuID(MENU_EXIT_GAME); |
960 | 3319 break; |
187 | 3320 case UIMSG_PlayerCreation_SelectAttribute: |
960 | 3321 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3322 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
3323 uPlayerCreationUI_SelectedCharacter = pParam; | |
960 | 3324 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3325 break; | |
187 | 3326 case UIMSG_PlayerCreation_VoicePrev: |
967 | 3327 pSex = player->GetSexByVoice(); |
960 | 3328 do |
3329 { | |
3330 if (player->uVoiceID == 0) | |
3331 player->uVoiceID = 19; | |
3332 else --player->uVoiceID; | |
3333 } | |
967 | 3334 while (player->GetSexByVoice() != pSex); |
971 | 3335 pButton = pCreationUI_BtnPressLeft2[pParam]; |
1268 | 3336 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); |
960 | 3337 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3338 player->PlaySound(SPEECH_PickMe, 0); | |
3339 break; | |
187 | 3340 case UIMSG_PlayerCreation_VoiceNext: |
967 | 3341 pSex = player->GetSexByVoice(); |
3342 do | |
3343 { | |
3344 player->uVoiceID = (player->uVoiceID + 1) % 20; | |
3345 } | |
3346 while (player->GetSexByVoice() != pSex); | |
971 | 3347 pButton = pCreationUI_BtnPressRight2[pParam]; |
1268 | 3348 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); |
967 | 3349 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3350 player->PlaySound(SPEECH_PickMe, 0); | |
3351 break; | |
187 | 3352 case UIMSG_PlayerCreation_FacePrev: |
971 | 3353 pPlayer = &pParty->pPlayers[pParam]; |
1014 | 3354 if (!pPlayer->uCurrentFace) |
3355 pPlayer->uCurrentFace = 19; | |
960 | 3356 else |
1014 | 3357 pPlayer->uCurrentFace -= 1; |
3358 pPlayer->uVoiceID = pPlayer->uCurrentFace; | |
960 | 3359 pPlayer->SetInitialStats(); |
3360 pPlayer->SetSexByVoice(); | |
3361 pPlayer->RandomizeName(); | |
971 | 3362 v25 = pParam; |
960 | 3363 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3364 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3365 uPlayerCreationUI_SelectedCharacter = v25; |
1268 | 3366 GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], (char *)1); |
960 | 3367 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); |
3368 pPlayer->PlaySound(SPEECH_PickMe, 0); | |
3369 break; | |
187 | 3370 case UIMSG_PlayerCreation_FaceNext: |
971 | 3371 pPlayer = &pParty->pPlayers[pParam]; |
1014 | 3372 v20 = (char)((int)pPlayer->uCurrentFace + 1) % 20; |
3373 pPlayer->uCurrentFace = v20; | |
960 | 3374 pPlayer->uVoiceID = v20; |
3375 pPlayer->SetInitialStats(); | |
3376 pPlayer->SetSexByVoice(); | |
3377 pPlayer->RandomizeName(); | |
971 | 3378 v21 = pParam; |
960 | 3379 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3380 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3381 uPlayerCreationUI_SelectedCharacter = v21; |
1268 | 3382 GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], (char *)1); |
960 | 3383 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3384 pPlayer->PlaySound(SPEECH_PickMe, 0); | |
3385 break; | |
3386 case UIMSG_PlayerCreationClickPlus: | |
1268 | 3387 GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, (char *)1); |
960 | 3388 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
3389 pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); | |
3390 break; | |
3391 case UIMSG_PlayerCreationClickMinus: | |
1268 | 3392 GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, (char *)1); |
960 | 3393 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
3394 pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); | |
3395 break; | |
3396 case UIMSG_PlayerCreationSelectActiveSkill: | |
967 | 3397 pPlayer = &pPlayer[uPlayerCreationUI_SelectedCharacter]; |
971 | 3398 v6 = pPlayer->GetSkillIdxByOrder(pParam + 4); |
967 | 3399 if ( pPlayer->GetSkillIdxByOrder(3) == 37 ) |
3400 pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1; | |
3401 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); | |
3402 break; | |
960 | 3403 case UIMSG_PlayerCreationSelectClass: |
971 | 3404 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam); |
960 | 3405 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3406 break; | |
3407 case UIMSG_PlayerCreationClickOK: | |
962 | 3408 GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0); |
1273 | 3409 if ( PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Chose4Skills() ) |
960 | 3410 GameUI_Footer_TimeLeft = GetTickCount() + 4000; |
3411 else | |
982 | 3412 uGameState = GAME_STATE_STARTING_NEW_GAME; |
960 | 3413 break; |
3414 case UIMSG_PlayerCreationClickReset: | |
962 | 3415 GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0); |
960 | 3416 pParty->Reset(); |
3417 break; | |
3418 case UIMSG_PlayerCreationRemoveUpSkill: | |
971 | 3419 uPlayerCreationUI_SelectedCharacter = pParam; |
960 | 3420 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; |
3421 //int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; | |
3422 v41 = 2; | |
971 | 3423 v5 = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3424 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; |
3425 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) | |
3426 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; | |
3427 break; | |
3428 case UIMSG_PlayerCreationChangeName: | |
3429 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); | |
971 | 3430 v3 = (void *)pParam; |
3431 uPlayerCreationUI_SelectedCharacter = pParam; | |
960 | 3432 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu); |
3433 pGUIWindow_CurrentMenu->ptr_1C = v3; | |
3434 break; | |
3435 case UIMSG_ChangeGameState: | |
978 | 3436 uGameState = GAME_FINISHED; |
960 | 3437 break; |
3438 case UIMSG_11: | |
3439 pMouse->SetCursorBitmap("MICON2"); | |
3440 break; | |
3441 case UIMSG_3A: | |
3442 SetCurrentMenuID(MENU_10); | |
3443 break; | |
165 | 3444 case UIMSG_LoadGame: |
0 | 3445 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) |
960 | 3446 break; |
961 | 3447 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
960 | 3448 break; |
165 | 3449 case UIMSG_SelectLoadSlot: |
0 | 3450 //main menu save/load wnd clicking on savegame lines |
1038 | 3451 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
3452 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
971 | 3453 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition ) |
0 | 3454 { |
3455 //load clicked line | |
971 | 3456 v26 = pParam + pSaveListPosition; |
3457 if ( dword_6BE138 == pParam + pSaveListPosition ) | |
0 | 3458 { |
961 | 3459 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); |
437 | 3460 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); |
0 | 3461 } |
3462 uLoadGameUI_SelectedSlot = v26; | |
3463 dword_6BE138 = v26; | |
3464 } | |
3465 else | |
3466 { | |
3467 //typing in the line | |
3 | 3468 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); |
0 | 3469 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); |
3470 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); | |
3471 } | |
960 | 3472 break; |
961 | 3473 case UIMSG_SaveLoadBtn: |
3474 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); | |
960 | 3475 break; |
165 | 3476 case UIMSG_DownArrow: |
3 | 3477 ++pSaveListPosition; |
971 | 3478 if ( pSaveListPosition >= pParam ) |
3479 pSaveListPosition = pParam - 1; | |
3 | 3480 if ( pSaveListPosition < 1 ) |
3481 pSaveListPosition = 0; | |
3482 pWindow = pGUIWindow_CurrentMenu; | |
962 | 3483 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_PressedButton2, (int)pBtnDownArrow, 0); |
960 | 3484 break; |
165 | 3485 case UIMSG_Cancel: |
960 | 3486 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0); |
3487 break; | |
165 | 3488 case UIMSG_ArrowUp: |
3 | 3489 --pSaveListPosition; |
3490 if ( pSaveListPosition < 0 ) | |
3491 pSaveListPosition = 0; | |
3492 pWindow = pGUIWindow_CurrentMenu; | |
962 | 3493 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_PressedButton2, (int)pBtnArrowUp, 0); |
960 | 3494 break; |
3495 case UIMSG_AD: | |
962 | 3496 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); |
961 | 3497 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
960 | 3498 break; |
3499 case UIMSG_AE: | |
962 | 3500 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); |
165 | 3501 SetCurrentMenuID(MENU_10); |
960 | 3502 break; |
3503 case UIMSG_Escape: | |
0 | 3504 if ( ptr_507BDC ) |
3505 { | |
3506 sub_41426F(); | |
960 | 3507 break; |
0 | 3508 } |
3509 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) ) | |
960 | 3510 break; |
0 | 3511 v15 = 1; |
3512 pVideoPlayer->bStopBeforeSchedule = 1; | |
3513 viewparams->bRedrawGameUI = 1; | |
3514 viewparams->field_48 = 1; | |
165 | 3515 if ( !GetCurrentMenuID() || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC ) |
3516 { | |
3517 if ( pCurrentScreen == SCREEN_VIDEO ) | |
3518 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
3519 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
3520 { | |
3521 SetCurrentMenuID(MENU_CREATEPARTY); | |
960 | 3522 break; |
0 | 3523 } |
165 | 3524 if (GetCurrentMenuID() == MENU_CREDITSPROC) |
3525 { | |
3526 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
960 | 3527 break; |
0 | 3528 } |
437 | 3529 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); |
960 | 3530 break; |
0 | 3531 } |
971 | 3532 if ( GetCurrentMenuID() == MENU_CREDITSPROC && !pCurrentScreen ) |
3533 { | |
3534 if ( pCurrentScreen == SCREEN_VIDEO ) | |
3535 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
3536 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
3537 { | |
3538 SetCurrentMenuID(MENU_CREATEPARTY); | |
3539 break; | |
3540 } | |
3541 if (GetCurrentMenuID() == MENU_CREDITSPROC) | |
3542 { | |
3543 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
3544 break; | |
3545 } | |
3546 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); | |
3547 break; | |
3548 } | |
151 | 3549 if ( pCurrentScreen == SCREEN_LOADGAME ) |
0 | 3550 { |
3551 pIcons_LOD->_4114F2(); | |
3552 //crt_deconstruct_ptr_6A0118(); | |
3553 pTexture_PCX.Release(); | |
3554 pTexture_PCX.Load("title.pcx", 0); | |
3555 SetCurrentMenuID(MENU_MAIN); | |
3556 v15 = 1; | |
3557 pGUIWindow_CurrentMenu->Release(); | |
3558 pGUIWindow2->Release(); | |
3559 pGUIWindow2 = 0; | |
3560 pEventTimer->Resume(); | |
151 | 3561 pCurrentScreen = SCREEN_GAME; |
0 | 3562 viewparams->bRedrawGameUI = v15; |
960 | 3563 break; |
0 | 3564 } |
151 | 3565 if ( pCurrentScreen == SCREEN_VIDEO ) |
0 | 3566 { |
3567 pVideoPlayer->Unload(); | |
3568 } | |
3569 else | |
3570 { | |
151 | 3571 if ( pCurrentScreen != SCREEN_1B ) |
2 | 3572 { |
3573 pGUIWindow_CurrentMenu->Release(); | |
3574 pGUIWindow2->Release(); | |
3575 pGUIWindow2 = 0; | |
3576 pEventTimer->Resume(); | |
151 | 3577 pCurrentScreen = SCREEN_GAME; |
2 | 3578 viewparams->bRedrawGameUI = v15; |
960 | 3579 break; |
2 | 3580 } |
0 | 3581 //VideoPlayer::dtor(); |
3582 } | |
960 | 3583 break; |
3584 case UIMSG_PlayerCreationRemoveDownSkill: | |
971 | 3585 uPlayerCreationUI_SelectedCharacter = pParam; |
165 | 3586 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 |
971 | 3587 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
165 | 3588 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3) |
0 | 3589 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; |
960 | 3590 break; |
3591 default: | |
3592 break; | |
0 | 3593 } |
3594 } | |
3595 while ( pMessageQueue_50CBD0->uNumMessages ); | |
3596 } | |
3597 } | |
3598 | |
3599 //----- (00436427) -------------------------------------------------------- | |
3600 double __cdecl get_shading_dist_mist() | |
3601 { | |
3602 double result; // st7@2 | |
3603 | |
3604 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3605 result = (double)pOutdoorCamera->shading_dist_mist; | |
3606 else | |
3607 result = 16192.0; | |
3608 return result; | |
3609 } | |
3610 | |
3611 //----- (0043648F) -------------------------------------------------------- | |
3612 void Vec3_short__to_RenderVertexSoft(RenderVertexSoft *_this, Vec3_short_ *a2) | |
3613 { | |
3614 _this->flt_2C = 0.0; | |
3615 | |
3616 _this->vWorldPosition.x = a2->x; | |
3617 _this->vWorldPosition.y = a2->y; | |
3618 _this->vWorldPosition.z = a2->z; | |
3619 } | |
3620 | |
3621 //----- (004369DB) -------------------------------------------------------- | |
3622 void Vec3_float_::Normalize() | |
3623 { | |
1025 | 3624 this->x = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->x; |
3625 this->y = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->y; | |
3626 this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z; | |
0 | 3627 } |
3628 | |
1262 | 3629 //----- (00438526) -------------------------------------------------------- |
3630 stru11::stru11() | |
3631 { | |
3632 stru11 *v1; // esi@1 | |
3633 signed int v2; // eax@1 | |
3634 char *v3; // edx@1 | |
3635 | |
3636 v1 = this; | |
3637 v2 = 0; | |
3638 this->cpuid_00000000_eax_numops = 0; | |
3639 this->cpuid_00000001_eax = 0; | |
3640 this->cpuid_00000001_edx = 0; | |
3641 this->field_38 = 0; | |
3642 this->field_3C = 0; | |
3643 this->cpuid_80000000_edx = 0; | |
3644 this->cpuid_80000001_eax = 0; | |
3645 this->cpuid_80000001_edx = 0; | |
3646 this->cpuid_80000005_ebx = 0; | |
3647 this->cpuid_80000005_ecx = 0; | |
3648 this->cpuid_80000005_edx = 0; | |
3649 this->cpuid_80000006_ecx = 0; | |
3650 this->field_AC = 0; | |
3651 this->uProcessorManufacturer = 0; | |
3652 LOBYTE(this->cpuid_80000002_registers2[0]) = 0; | |
3653 v3 = (char *)&this->cpuid_00000002_eax; | |
3654 do | |
3655 { | |
3656 if ( v2 < 3 ) | |
3657 *((int *)v3 - 9) = 0; | |
3658 if ( v2 < 4 ) | |
3659 *(int *)v3 = 0; | |
3660 if ( v2 < 12 ) | |
3661 *((int *)v3 + 17) = 0; | |
3662 if ( v2 < 13 ) | |
3663 this->pCPUString[v2] = 0; | |
3664 if ( v2 < 30 ) | |
3665 *((char *)this->field_40 + v2) = 0; | |
3666 *((char *)&this->cpuid_80000002_registers2[0] + v2++ + 1) = 0; | |
3667 v3 += 4; | |
3668 } | |
3669 while ( v2 < 48 ); | |
3670 CheckCPU(); | |
3671 } | |
3672 | |
0 | 3673 //----- (004385B5) -------------------------------------------------------- |
3674 void stru11::CheckCPU() | |
3675 { | |
3676 LOG_DECOMPILATION_WARNING(); | |
3677 /* | |
3678 int v5; // [sp-4h] [bp-10h]@0 | |
3679 signed int v6; // [sp+4h] [bp-8h]@1 | |
3680 signed int v7; // [sp+8h] [bp-4h]@1 | |
3681 | |
3682 _CF = 0; | |
3683 _OF = 0; | |
3684 _ZF = 1; | |
3685 _SF = 0; | |
3686 v7 = 0; | |
3687 __asm { pushf } | |
3688 v6 = 3; | |
3689 if ( v5 != (v5 ^ 0x40000) ) | |
3690 { | |
3691 __asm { popf } | |
3692 v6 = 4; | |
3693 __asm { pushf } | |
3694 if ( v5 != (v5 ^ 0x200000) ) | |
3695 { | |
3696 v7 = 1; | |
3697 v6 = 0; | |
3698 } | |
3699 } | |
3700 if ( v6 == 3 ) | |
3701 { | |
3702 this->field_AC = 1; | |
3703 } | |
3704 else | |
3705 { | |
3706 if ( v6 == 4 ) | |
3707 { | |
3708 this->field_AC = 2; | |
3709 } | |
3710 else | |
3711 { | |
3712 if ( v7 ) | |
3713 { | |
3714 this->field_AC = 2; | |
3715 RunCPUID(); | |
3716 } | |
3717 else | |
3718 { | |
3719 this->field_AC = 0; | |
3720 } | |
3721 } | |
3722 }*/ | |
3723 } | |
3724 | |
3725 //----- (00438659) -------------------------------------------------------- | |
3726 void stru11::RunCPUID() | |
3727 { | |
3728 __debugbreak(); | |
3729 /*stru11 *v6; // esi@1 | |
3730 unsigned int uNumOps; // edi@1 | |
3731 int uNumExtOps; // edi@16 | |
3732 char pCyrixString[16]; // [sp+Ch] [bp-60h]@1 | |
3733 char pCentaurString[16]; // [sp+1Ch] [bp-50h]@1 | |
3734 char pAMDString[16]; // [sp+2Ch] [bp-40h]@1 | |
3735 char pIntelString[16]; // [sp+3Ch] [bp-30h]@1 | |
3736 char pCPUString[16]; // [sp+4Ch] [bp-20h]@1 | |
3737 stru11 *thisa; // [sp+5Ch] [bp-10h]@1 | |
3738 char *v35; // [sp+60h] [bp-Ch]@1 | |
3739 int v36; // [sp+64h] [bp-8h]@1 | |
3740 int v37; // [sp+68h] [bp-4h]@1 | |
3741 | |
3742 thisa = this; | |
3743 *(int *)pIntelString = *(int *)"GenuineIntel"; | |
3744 *(int *)&pIntelString[4] = *(int *)"ineIntel"; | |
3745 *(int *)&pIntelString[8] = *(int *)"ntel"; | |
3746 pIntelString[12] = aGenuineintel[12]; | |
3747 *(int *)pAMDString = *(int *)"AuthenticAMD"; | |
3748 *(int *)&pAMDString[4] = *(int *)"enticAMD"; | |
3749 *(int *)&pAMDString[8] = *(int *)"cAMD"; | |
3750 pAMDString[12] = aAuthenticamd[12]; | |
3751 *(int *)pCyrixString = *(int *)"CyrixInstead"; | |
3752 *(int *)&pCyrixString[4] = *(int *)"xInstead"; | |
3753 *(int *)&pCyrixString[8] = *(int *)"tead"; | |
3754 pCyrixString[12] = aCyrixinstead[12]; | |
3755 *(int *)pCentaurString = *(int *)"CentaurHauls"; | |
3756 *(int *)&pCentaurString[4] = *(int *)"aurHauls"; | |
3757 *(int *)&pCentaurString[8] = *(int *)"auls"; | |
3758 v37 = 0; | |
3759 v36 = 0; | |
3760 pCentaurString[12] = aCentaurhauls[12]; | |
3761 v35 = pCPUString; | |
3762 pCPUString[12] = 0; | |
3763 _EAX = 0; | |
3764 __asm { cpuid } | |
3765 v37 = _EAX; | |
3766 *(int *)pCPUString = _EBX; | |
3767 *(int *)&pCPUString[4] = _EDX; | |
3768 *(int *)&pCPUString[8] = _ECX; | |
3769 v6 = thisa; | |
3770 uNumOps = _EAX; | |
3771 thisa->cpuid_00000000_ebx_vendorstr1 = _EBX; | |
3772 v6->cpuid_00000000_edx_vendorstr2 = *(int *)&pCPUString[4]; | |
3773 v6->cpuid_00000000_ecx_vendorstr3 = *(int *)&pCPUString[8]; | |
3774 v6->cpuid_00000000_eax_numops = _EAX; | |
3775 strcpy(v6->pCPUString, pCPUString); | |
3776 if ( strcmp(pIntelString, pCPUString) ) | |
3777 { | |
3778 if ( strcmp(pAMDString, pCPUString) ) | |
3779 { | |
3780 if ( strcmp(pCyrixString, pCPUString) ) | |
3781 { | |
3782 if ( strcmp(pCentaurString, pCPUString) ) | |
3783 v6->uProcessorManufacturer = 0; | |
3784 else | |
3785 v6->uProcessorManufacturer = 4; | |
3786 } | |
3787 else | |
3788 { | |
3789 v6->uProcessorManufacturer = 3; | |
3790 } | |
3791 } | |
3792 else | |
3793 { | |
3794 v6->uProcessorManufacturer = 2; | |
3795 } | |
3796 } | |
3797 else | |
3798 { | |
3799 v6->uProcessorManufacturer = 1; | |
3800 } | |
3801 if ( uNumOps >= 1 ) | |
3802 RunCPUID_op1(); | |
3803 if ( uNumOps >= 2 ) | |
3804 RunCPUID_op2(); | |
3805 _EAX = 0x80000000u; | |
3806 __asm { cpuid } | |
3807 if ( !(_EAX & 0x80000000) ) | |
3808 _EAX = 0x80000000u; | |
3809 v36 = _EAX; | |
3810 v6->cpuid_80000000_edx = _EAX; | |
3811 uNumExtOps = _EAX ^ 0x80000000; | |
3812 if ( (_EAX ^ 0x80000000u) >= 1 ) | |
3813 { | |
3814 _EAX = 0x80000001u; | |
3815 __asm { cpuid } | |
3816 thisa = (stru11 *)_EAX; | |
3817 v35 = (char *)_EDX; | |
3818 v6->cpuid_80000001_eax = _EAX; | |
3819 v6->cpuid_80000001_edx = (int)v35; | |
3820 } | |
3821 if ( (unsigned int)uNumExtOps >= 4 ) | |
3822 RunCPUID_ext2_3_4(); | |
3823 if ( (unsigned int)uNumExtOps >= 5 ) | |
3824 { | |
3825 _EAX = 0x80000005u; | |
3826 __asm { cpuid } | |
3827 thisa = (stru11 *)_EBX; | |
3828 v35 = (char *)_ECX; | |
3829 v36 = _EDX; | |
3830 v6->cpuid_80000005_ebx = _EBX; | |
3831 v6->cpuid_80000005_ecx = (int)v35; | |
3832 v6->cpuid_80000005_edx = v36; | |
3833 } | |
3834 if ( (unsigned int)uNumExtOps >= 6 ) | |
3835 { | |
3836 _EAX = 0x80000006u; | |
3837 __asm { cpuid } | |
3838 v6->cpuid_80000006_ecx = _ECX; | |
3839 }*/ | |
3840 } | |
3841 | |
3842 //----- (00438821) -------------------------------------------------------- | |
3843 void stru11::RunCPUID_op1() | |
3844 { | |
3845 __debugbreak(); | |
3846 /*stru11 *v1; // esi@1 | |
3847 unsigned int v7; // ecx@1 | |
3848 int v8; // eax@3 | |
3849 int v9; // eax@10 | |
3850 signed int v10; // eax@11 | |
3851 int v11; // ecx@11 | |
3852 int v12; // eax@15 | |
3853 signed int v13; // eax@19 | |
3854 int v14; // ecx@19 | |
3855 signed int v15; // eax@25 | |
3856 int v16; // ecx@25 | |
3857 signed int v17; // eax@34 | |
3858 int v18; // ecx@34 | |
3859 | |
3860 v1 = this; | |
3861 _EAX = 1; | |
3862 __asm { cpuid } | |
3863 v7 = _EAX; | |
3864 v1->cpuid_00000001_edx = _EDX; | |
3865 v1->cpuid_00000001_eax = _EAX; | |
3866 if ( (_EAX & 0x3000) == 8192 ) | |
3867 { | |
3868 LOBYTE(v1->cpuid_80000002_registers2[0]) = 1; | |
3869 v7 = 0; | |
3870 } | |
3871 v8 = (v7 >> 8) & 0xF; | |
3872 switch ( v8 ) | |
3873 { | |
3874 case 4: | |
3875 v1->field_AC = 2; | |
3876 break; | |
3877 case 5: | |
3878 v1->field_AC = 15; | |
3879 break; | |
3880 case 6: | |
3881 v1->field_AC = 36; | |
3882 break; | |
3883 default: | |
3884 v1->field_AC = 49; | |
3885 break; | |
3886 } | |
3887 v9 = v1->uProcessorManufacturer; | |
3888 if ( v9 == 1 ) | |
3889 { | |
3890 v10 = 0; | |
3891 v11 = v7 & 0x3FF0; | |
3892 while ( v11 != dword_4E4948[2 * v10] ) | |
3893 { | |
3894 ++v10; | |
3895 if ( v10 >= 17 ) | |
3896 return; | |
3897 } | |
3898 v12 = dword_4E494C[2 * v10]; | |
3899 goto LABEL_39; | |
3900 } | |
3901 if ( v9 == 2 ) | |
3902 { | |
3903 if ( (v7 & 0xF00) == dword_4E49D0[0] ) | |
3904 { | |
3905 v12 = dword_4E49D4[0]; | |
3906 } | |
3907 else | |
3908 { | |
3909 v13 = 1; | |
3910 v14 = v7 & 0x3FF0; | |
3911 while ( v14 != dword_4E49D0[2 * v13] ) | |
3912 { | |
3913 ++v13; | |
3914 if ( v13 >= 9 ) | |
3915 return; | |
3916 } | |
3917 v12 = dword_4E49D4[2 * v13]; | |
3918 } | |
3919 goto LABEL_39; | |
3920 } | |
3921 if ( v9 != 3 ) | |
3922 { | |
3923 if ( v9 != 4 ) | |
3924 return; | |
3925 v17 = 0; | |
3926 v18 = v7 & 0x3FF0; | |
3927 while ( v18 != dword_4E4A40[2 * v17] ) | |
3928 { | |
3929 ++v17; | |
3930 if ( v17 >= 2 ) | |
3931 return; | |
3932 } | |
3933 v12 = dword_4E4A44[2 * v17]; | |
3934 goto LABEL_39; | |
3935 } | |
3936 v15 = 1; | |
3937 v16 = v7 & 0x3FF0; | |
3938 while ( v16 != dword_4E4A18[2 * v15] ) | |
3939 { | |
3940 ++v15; | |
3941 if ( v15 >= 5 ) | |
3942 goto LABEL_30; | |
3943 } | |
3944 v1->field_AC = dword_4E4A1C[2 * v15]; | |
3945 LABEL_30: | |
3946 v12 = 24; | |
3947 if ( v1->field_AC == 24 ) | |
3948 { | |
3949 if ( _EDX != 1 ) | |
3950 v12 = (((_EDX != 261) - 1) & 0xA) + 15; | |
3951 LABEL_39: | |
3952 v1->field_AC = v12; | |
3953 }*/ | |
3954 } | |
3955 | |
3956 //----- (00438992) -------------------------------------------------------- | |
3957 void stru11::RunCPUID_op2() | |
3958 { | |
3959 __debugbreak(); | |
3960 /* | |
3961 stru11 *v1; // edi@1 | |
3962 int v7; // eax@1 | |
3963 signed int v8; // ecx@2 | |
3964 unsigned __int8 v9; // al@3 | |
3965 signed int v10; // ecx@14 | |
3966 unsigned __int8 v11; // al@15 | |
3967 int v12; // [sp+Ch] [bp-14h]@1 | |
3968 int v13; // [sp+10h] [bp-10h]@1 | |
3969 int v14; // [sp+14h] [bp-Ch]@1 | |
3970 int v15; // [sp+18h] [bp-8h]@1 | |
3971 int *v16; // [sp+1Ch] [bp-4h]@1 | |
3972 | |
3973 v1 = this; | |
3974 v16 = &v12; | |
3975 _EAX = 2; | |
3976 __asm { cpuid } | |
3977 v12 = _EAX; | |
3978 v13 = _EBX; | |
3979 v14 = _ECX; | |
3980 v15 = _EDX; | |
3981 v1->cpuid_00000002_eax = _EAX; | |
3982 v1->cpuid_00000002_ebx = v13; | |
3983 v1->cpuid_00000002_ecx = v14; | |
3984 v1->cpuid_00000002_edx = v15; | |
3985 v7 = v1->field_AC; | |
3986 if ( v7 == 40 ) | |
3987 { | |
3988 v8 = 0; | |
3989 while ( 1 ) | |
3990 { | |
3991 v9 = *((char *)&v12 + v8); | |
3992 if ( v9 == 64 ) | |
3993 { | |
3994 v1->field_AC = 43; | |
3995 return; | |
3996 } | |
3997 if ( v9 >= 0x41u && v9 <= 0x43u ) | |
3998 { | |
3999 v1->field_AC = 41; | |
4000 return; | |
4001 } | |
4002 if ( v9 >= 0x44u && v9 <= 0x45u ) | |
4003 break; | |
4004 ++v8; | |
4005 if ( v8 >= 16 ) | |
4006 return; | |
4007 } | |
4008 v1->field_AC = 42; | |
4009 } | |
4010 else | |
4011 { | |
4012 if ( v7 == 45 ) | |
4013 { | |
4014 v10 = 0; | |
4015 while ( 1 ) | |
4016 { | |
4017 v11 = *((char *)&v12 + v10); | |
4018 if ( v11 >= 0x40u && v11 <= 0x43u ) | |
4019 { | |
4020 v1->field_AC = 46; | |
4021 return; | |
4022 } | |
4023 if ( v11 >= 0x44u && v11 <= 0x45u ) | |
4024 break; | |
4025 ++v10; | |
4026 if ( v10 >= 16 ) | |
4027 return; | |
4028 } | |
4029 v1->field_AC = 47; | |
4030 } | |
4031 }*/ | |
4032 } | |
4033 | |
4034 //----- (00438A67) -------------------------------------------------------- | |
4035 void stru11::RunCPUID_ext2_3_4() | |
4036 { | |
4037 __debugbreak(); | |
4038 /*stru11 *v1; // edi@1 | |
4039 stru11 *v17; // eax@1 | |
4040 int v18[3][4]; // [sp+Ch] [bp-38h]@1 | |
4041 stru11 *v19; // [sp+3Ch] [bp-8h]@1 | |
4042 | |
4043 v1 = this; | |
4044 v19 = this; | |
4045 _EAX = 0x80000002u; | |
4046 __asm { cpuid } | |
4047 v18[0][0] = _EAX; | |
4048 *(_QWORD *)&v18[0][1] = __PAIR__(_ECX, _EBX); | |
4049 v18[0][3] = _EDX; | |
4050 _EAX = 0x80000003u; | |
4051 __asm { cpuid } | |
4052 v18[1][0] = _EAX; | |
4053 *(_QWORD *)&v18[1][1] = __PAIR__(_ECX, _EBX); | |
4054 v18[1][3] = _EDX; | |
4055 _EAX = 0x80000004u; | |
4056 __asm { cpuid } | |
4057 v18[2][0] = _EAX; | |
4058 *(_QWORD *)&v18[2][1] = __PAIR__(_ECX, _EBX); | |
4059 v18[2][3] = _EDX; | |
4060 v17 = v19; | |
4061 memcpy(v1->cpuid_80000002_registers, v18, 0x30u); | |
4062 memcpy((char *)&v17->cpuid_80000002_registers2[0] + 1, v18, 0x30u);*/ | |
4063 } | |
4064 | |
4065 //----- (00438F8F) -------------------------------------------------------- | |
783 | 4066 void __cdecl area_of_effect__damage_evaluate() |
0 | 4067 { |
4068 int v0; // edx@1 | |
4069 char *v1; // esi@2 | |
4070 int v2; // ecx@3 | |
4071 signed int v3; // eax@3 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4072 SpriteObject *v4; // eax@4 |
0 | 4073 signed int v5; // eax@4 |
4074 signed int v6; // eax@6 | |
4075 unsigned int v7; // edi@6 | |
4076 int v8; // eax@6 | |
4077 __int16 v9; // bx@8 | |
4078 int v10; // edi@8 | |
4079 Vec3_int_ v11; // ST04_12@9 | |
4080 int v12; // ST0C_4@10 | |
4081 Actor *v13; // edi@11 | |
4082 int v14; // edx@15 | |
4083 int v15; // edx@15 | |
4084 int v16; // ebx@15 | |
4085 signed int v17; // eax@15 | |
4086 int v18; // edi@15 | |
4087 int v19; // edi@15 | |
4088 Vec3_int_ v20; // ST04_12@16 | |
4089 Vec3_int_ *v21; // eax@17 | |
4090 unsigned int v22; // edx@17 | |
4091 int v23; // edx@18 | |
4092 int v24; // eax@18 | |
4093 Vec3_int_ v25; // ST04_12@19 | |
4094 unsigned int v26; // ebx@20 | |
89 | 4095 Player *v27; // edi@20 |
90 | 4096 Actor *v28; // edi@27 |
0 | 4097 int v29; // ebx@29 |
4098 int v30; // eax@29 | |
4099 int v31; // edx@29 | |
4100 int v32; // eax@29 | |
4101 int v33; // ST24_4@29 | |
4102 Vec3_int_ v34; // ST04_12@30 | |
4103 Vec3_int_ *v35; // eax@31 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4104 SpriteObject *v36; // [sp+0h] [bp-28h]@0 |
0 | 4105 signed int v37; // [sp+4h] [bp-24h]@5 |
4106 int v38; // [sp+4h] [bp-24h]@15 | |
4107 signed int v39; // [sp+8h] [bp-20h]@3 | |
4108 int v40; // [sp+8h] [bp-20h]@15 | |
4109 int v41; // [sp+Ch] [bp-1Ch]@5 | |
4110 int v42; // [sp+Ch] [bp-1Ch]@15 | |
4111 int v43; // [sp+10h] [bp-18h]@1 | |
4112 int v44; // [sp+14h] [bp-14h]@15 | |
4113 unsigned int uActorID; // [sp+18h] [bp-10h]@6 | |
4114 Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 | |
4115 int a1; // [sp+20h] [bp-8h]@8 | |
4116 int v48; // [sp+24h] [bp-4h]@8 | |
4117 | |
4118 v0 = 0; | |
4119 v43 = 0; | |
4120 if ( stru_50FE08.count > 0 ) | |
4121 { | |
4122 pVelocity = &stru_50FE08.vec_4B4; | |
4123 v1 = (char *)stru_50FE08.pZs; | |
4124 do | |
4125 { | |
848 | 4126 v2 = PID_TYPE(*((short *)v1 - 300)); |
4127 v3 = PID_ID((signed int)*((short *)v1 - 300)); | |
4128 v39 = PID_ID((signed int)*((short *)v1 - 300)); | |
0 | 4129 if ( v2 == 2 ) |
4130 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4131 v4 = &pSpriteObjects[v3]; |
0 | 4132 v36 = v4; |
822 | 4133 v5 = v4->spell_caster_pid; |
848 | 4134 v2 = PID_TYPE(v5); |
4135 v3 = PID_ID(v5); | |
0 | 4136 } |
4137 v41 = v2; | |
4138 v37 = v3; | |
4139 if ( stru_50FE08.field_3EC[v0] & 1 ) | |
4140 { | |
417 | 4141 v6 = ai_near_actors_targets_pid[v3]; |
848 | 4142 v7 = PID_ID(v6); |
4143 v8 = PID_TYPE(v6) - 3; | |
0 | 4144 uActorID = v7; |
4145 if ( v8 ) | |
4146 { | |
4147 if ( v8 == 1 ) | |
4148 { | |
4149 v9 = *(short *)v1; | |
4150 v10 = pParty->vPosition.y - *((short *)v1 - 100); | |
4151 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
4152 v48 = v10; | |
4153 if ( a1 * a1 | |
4154 + v10 * v10 | |
4155 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) | |
4156 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
4157 { | |
4158 v11.z = *(short *)v1; | |
4159 v11.y = *((short *)v1 - 100); | |
4160 v11.x = *((short *)v1 - 200); | |
4161 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v11) ) | |
4162 { | |
4163 v12 = stru_50C198.which_player_would_attack(&pActors[v39]); | |
4164 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v12); | |
4165 } | |
4166 } | |
4167 } | |
4168 } | |
4169 else | |
4170 { | |
4171 v13 = &pActors[v7]; | |
4172 if ( SHIDWORD(v13->pActorBuffs[6].uExpireTime) > 0 | |
4173 || SHIDWORD(v13->pActorBuffs[6].uExpireTime) >= 0 && LODWORD(v13->pActorBuffs[6].uExpireTime) | |
4174 || v13->CanAct() ) | |
4175 { | |
4176 v14 = v13->vPosition.y; | |
4177 v40 = v13->vPosition.x; | |
4178 v38 = v14; | |
4179 v15 = v14 - *((short *)v1 - 100); | |
4180 v16 = *(short *)v1; | |
4181 v42 = v13->vPosition.z; | |
4182 a1 = v40 - *((short *)v1 - 200); | |
4183 v17 = v13->uActorHeight; | |
4184 v18 = v13->uActorRadius; | |
4185 v44 = v42; | |
4186 v19 = *((short *)v1 + 100) + v18; | |
4187 v48 = v15; | |
4188 if ( a1 * a1 + v15 * v15 + (v42 + (v17 >> 1) - v16) * (v42 + (v17 >> 1) - v16) < (unsigned int)(v19 * v19) ) | |
4189 { | |
4190 v20.z = *(short *)v1; | |
4191 v20.y = *((short *)v1 - 100); | |
4192 v20.x = *((short *)v1 - 200); | |
4193 if ( sub_407A1C(v40, v38, v42 + 50, v20) ) | |
4194 { | |
4195 Vec3_int_::Normalize(&a1, &v48, &v44); | |
4196 v21 = pVelocity; | |
4197 v22 = uActorID; | |
4198 pVelocity->x = a1; | |
4199 v21->y = v48; | |
4200 v21->z = v44; | |
4201 sub_43B1B0(*((short *)v1 - 300), v22, v21, stru_50FE08.field_450[v43]); | |
4202 } | |
4203 } | |
4204 } | |
4205 } | |
4206 } | |
4207 else | |
4208 { | |
4209 v23 = pParty->vPosition.y - *((short *)v1 - 100); | |
4210 v24 = ((signed int)pParty->uPartyHeight >> 1) - *(short *)v1; | |
4211 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
4212 v48 = v23; | |
4213 if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
4214 { | |
4215 v25.z = *(short *)v1; | |
4216 v25.y = *((short *)v1 - 100); | |
4217 v25.x = *((short *)v1 - 200); | |
4218 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v25) ) | |
4219 { | |
4220 v26 = 0; | |
89 | 4221 v27 = pParty->pPlayers;//[0].pConditions[15]; |
0 | 4222 do |
4223 { | |
89 | 4224 if ( !(HIDWORD(v27->pConditions[14]) | LODWORD(v27->pConditions[14])) && !v27->pConditions[15] && !v27->pConditions[16] ) |
0 | 4225 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v26); |
89 | 4226 ++v27; |
0 | 4227 ++v26; |
4228 } | |
89 | 4229 while ( v27 <= &pParty->pPlayers[3] ); |
0 | 4230 } |
4231 } | |
4232 uActorID = 0; | |
4233 if ( (signed int)uNumActors > 0 ) | |
4234 { | |
1202 | 4235 v28 = pActors.data();//[0].vPosition.z; |
0 | 4236 do |
4237 { | |
91 | 4238 if ( v28->CanAct() ) |
0 | 4239 { |
4240 v29 = *(short *)v1; | |
91 | 4241 v30 = v28->vPosition.y - *((short *)v1 - 100); |
4242 a1 = v28->vPosition.x - *((short *)v1 - 200); | |
90 | 4243 v31 = v28->vPosition.z; |
0 | 4244 v48 = v30; |
4245 v44 = v31; | |
90 | 4246 v32 = (v28->uActorHeight >> 1) - v29; |
91 | 4247 v33 = v28->uActorRadius + *((short *)v1 + 100); |
0 | 4248 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) |
4249 { | |
4250 v34.z = *(short *)v1; | |
4251 v34.y = *((short *)v1 - 100); | |
4252 v34.x = *((short *)v1 - 200); | |
90 | 4253 if ( sub_407A1C(v28->vPosition.x, v28->vPosition.y, v28->vPosition.z + 50, v34) ) |
0 | 4254 { |
4255 Vec3_int_::Normalize(&a1, &v48, &v44); | |
4256 v35 = pVelocity; | |
4257 pVelocity->x = a1; | |
4258 v35->y = v48; | |
4259 v35->z = v44; | |
4260 switch ( v41 ) | |
4261 { | |
303 | 4262 case OBJECT_Player: |
0 | 4263 DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); |
4264 break; | |
303 | 4265 case OBJECT_Actor: |
90 | 4266 if ( v36 && pActors[v37].GetActorsRelation(v28) ) |
0 | 4267 sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); |
4268 break; | |
303 | 4269 case OBJECT_Item: |
0 | 4270 sub_43B057(*((short *)v1 - 300), uActorID, v35); |
4271 break; | |
4272 } | |
4273 } | |
4274 } | |
4275 } | |
4276 ++uActorID; | |
90 | 4277 ++v28; |
0 | 4278 } |
4279 while ( (signed int)uActorID < (signed int)uNumActors ); | |
4280 } | |
4281 } | |
4282 ++pVelocity; | |
4283 v0 = v43 + 1; | |
4284 v1 += 2; | |
4285 ++v43; | |
4286 } | |
4287 while ( v43 < stru_50FE08.count ); | |
4288 } | |
4289 stru_50FE08.count = 0; | |
4290 } | |
4291 // 50FE08: using guessed type stru298 stru_50FE08; | |
4292 | |
4293 // 4D864C: using guessed type char byte_4D864C; | |
4294 | |
4295 //----- (0043A97E) -------------------------------------------------------- | |
4296 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) | |
4297 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4298 if ( PID_TYPE(a2) == OBJECT_BLVDoor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4299 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4300 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4301 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4302 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4303 |
0 | 4304 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
|
4305 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
|
4306 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4307 else if (PID_TYPE(a2) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4308 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4309 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4310 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4311 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4312 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4313 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
|
4314 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid)) |
0 | 4315 { |
4316 case OBJECT_Actor: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4317 sub_43B1B0(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61); |
0 | 4318 break; |
4319 case OBJECT_Player: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4320 DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 4321 break; |
4322 case OBJECT_Item: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4323 sub_43B057(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 4324 break; |
4325 } | |
4326 } | |
4327 } | |
4328 | |
4329 //----- (0043AA99) -------------------------------------------------------- | |
4330 void __fastcall Vec3_int_::Rotate(int sDepth, int sRotY, int sRotX, Vec3_int_ v, int *outx, int *outy, int *outz) | |
4331 { | |
147 | 4332 float cosf_x = cosf(3.14159265f * sRotX / 1024.0f), |
1025 | 4333 sinf_x = sinf(3.14159265f * sRotX / 1024.0f), |
147 | 4334 cosf_y = cosf(3.14159265f * sRotY / 1024.0f), |
4335 sinf_y = sinf(3.14159265f * sRotY / 1024.0f); | |
1045 | 4336 |
1025 | 4337 *outx = v.x + ((unsigned __int64)(sinf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16))); |
4338 *outy = v.y + ((unsigned __int64)(cosf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16))); | |
4339 *outz = v.z + ((unsigned __int64)(sinf_x * (signed __int64)sDepth) >> 16); | |
0 | 4340 } |
4341 | |
4342 //----- (0043AB61) -------------------------------------------------------- | |
4343 void Vec3_int_::Normalize(int *x, int *y, int *z) | |
4344 { | |
1025 | 4345 *x *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); |
4346 *y *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); | |
4347 *z *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); | |
0 | 4348 } |
4349 | |
4350 //----- (0043AE12) -------------------------------------------------------- | |
4351 double __fastcall sub_43AE12(signed int a1) | |
4352 { | |
4353 signed int v1; // ST00_4@1 | |
4354 signed int v2; // ecx@1 | |
4355 double v3; // st7@1 | |
4356 double result; // st7@6 | |
4357 | |
4358 v1 = a1; | |
4359 v2 = 0; | |
4360 v3 = (double)v1; | |
4361 do | |
4362 { | |
4363 if ( v3 < flt_4E4A80[v2 + 5] ) | |
4364 break; | |
4365 ++v2; | |
4366 } | |
4367 while ( v2 < 5 ); | |
4368 if ( v2 <= 0 || v2 >= 5 ) | |
4369 { | |
4370 if ( v2 ) | |
4371 result = flt_4E4A80[4]; | |
4372 else | |
4373 result = flt_4E4A80[0]; | |
4374 } | |
4375 else | |
4376 { | |
1033 | 4377 result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 3]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2]; |
0 | 4378 } |
4379 return result; | |
4380 } | |
4381 | |
4382 //----- (0043B057) -------------------------------------------------------- | |
4383 void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, Vec3_int_ *pVelocity) | |
4384 { | |
4385 Actor *pActor; // esi@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4386 SpriteObject *v4; // eax@3 |
0 | 4387 int v5; // ecx@3 |
4388 int v6; // eax@4 | |
4389 int v7; // edi@4 | |
4390 unsigned int uActorIDa; // [sp+8h] [bp-8h]@1 | |
4391 unsigned int a2; // [sp+Ch] [bp-4h]@1 | |
4392 int a2a; // [sp+Ch] [bp-4h]@8 | |
4393 | |
4394 uActorIDa = uActorID; | |
4395 pActor = &pActors[uActorID]; | |
4396 a2 = uObjID; | |
303 | 4397 if ( !pActors[uActorID].IsNotAlive() ) |
0 | 4398 { |
848 | 4399 if ( PID_TYPE(a2) == OBJECT_Item) |
4400 { | |
4401 v4 = &pSpriteObjects[PID_ID(a2)]; | |
822 | 4402 v5 = v4->spell_id; |
0 | 4403 if ( v5 ) |
4404 { | |
822 | 4405 v6 = _43AFE3_calc_spell_damage(v5, v4->spell_level, v4->spell_skill, pActor->sCurrentHP); |
0 | 4406 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6); |
4407 pActor->sCurrentHP -= v7; | |
4408 if ( v7 ) | |
4409 { | |
4410 if ( pActor->sCurrentHP > 0 ) | |
1060 | 4411 Actor::AI_Stun(uActorIDa, a2, 0); |
0 | 4412 else |
4413 Actor::Die(uActorIDa); | |
4414 a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP; | |
4415 if ( 20 * v7 / (signed int)pActor->pMonsterInfo.uHP > 10 ) | |
4416 a2a = 10; | |
4417 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
4418 { | |
4419 pVelocity->x = (unsigned __int64)(a2a * (signed __int64)pVelocity->x) >> 16; | |
4420 pVelocity->y = (unsigned __int64)(a2a * (signed __int64)pVelocity->y) >> 16; | |
4421 pVelocity->z = (unsigned __int64)(a2a * (signed __int64)pVelocity->z) >> 16; | |
4422 pActor->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
4423 pActor->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
4424 pActor->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
4425 } | |
4426 Actor::AddBloodsplatOnDamageOverlay(uActorIDa, 1, v7); | |
4427 } | |
4428 else | |
4429 { | |
1060 | 4430 Actor::AI_Stun(uActorIDa, a2, 0); |
0 | 4431 } |
4432 } | |
4433 } | |
4434 } | |
4435 } | |
4436 | |
4437 //----- (0043B1B0) -------------------------------------------------------- | |
322 | 4438 void sub_43B1B0(signed int a1, unsigned int a2, Vec3_int_ *pVelocity, signed int a4) |
0 | 4439 { |
4440 int v4; // ebx@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4441 SpriteObject *v5; // eax@2 |
0 | 4442 bool v6; // eax@3 |
4443 Actor *v7; // esi@4 | |
4444 Actor *v8; // edi@4 | |
4445 char v9; // zf@5 | |
4446 __int64 v10; // qax@8 | |
4447 signed __int16 v11; // cx@9 | |
4448 signed int v12; // ecx@20 | |
4449 int v13; // ecx@22 | |
4450 int v14; // edi@30 | |
4451 unsigned int uActorID; // [sp+Ch] [bp-8h]@1 | |
4452 signed int v17; // [sp+10h] [bp-4h]@1 | |
4453 int v18; // [sp+20h] [bp+Ch]@34 | |
4454 | |
4455 v4 = 0; | |
4456 uActorID = a2; | |
4457 v17 = a1; | |
848 | 4458 if ( PID_TYPE(a1) == OBJECT_Item) |
4459 { | |
4460 v5 = &pSpriteObjects[PID_ID(a1)]; | |
0 | 4461 v4 = v5->field_60_distance_related_prolly_lod; |
822 | 4462 v17 = v5->spell_caster_pid; |
0 | 4463 } |
848 | 4464 LOWORD(v6) = PID_TYPE(v17); |
303 | 4465 if ( v6 == OBJECT_Actor) |
0 | 4466 { |
4467 v7 = &pActors[a2]; | |
848 | 4468 v8 = &pActors[PID_ID(v17)]; |
303 | 4469 v6 = pActors[a2].IsNotAlive(); |
0 | 4470 if ( !v6 ) |
4471 { | |
4472 v9 = v7->uAIState == 7; | |
4473 v7->uLastCharacterIDToHit = v17; | |
4474 if ( v9 ) | |
4475 BYTE2(v7->uAttributes) |= 2u; | |
4476 v6 = stru_50C198._4273BB(v8, v7, v4, 0); | |
4477 if ( v6 ) | |
4478 { | |
4479 v10 = (unsigned int)Actor::_43B3E0_CalcDamage(v8, a4); | |
4480 if ( (signed __int64)v8->pActorBuffs[3].uExpireTime > 0 ) | |
4481 { | |
4482 v11 = v8->pActorBuffs[3].uPower; | |
4483 if ( v11 ) | |
4484 v10 = (signed int)v10 / (unsigned __int16)v11; | |
4485 } | |
4486 if ( SHIDWORD(v7->pActorBuffs[5].uExpireTime) >= SHIDWORD(v10) | |
4487 && (SHIDWORD(v7->pActorBuffs[5].uExpireTime) > SHIDWORD(v10) | |
4488 || LODWORD(v7->pActorBuffs[5].uExpireTime) > HIDWORD(v10)) ) | |
4489 LODWORD(v10) = 0; | |
4490 if ( a4 != HIDWORD(v10) ) | |
4491 { | |
4492 if ( a4 - HIDWORD(v10) == 1 ) | |
4493 { | |
4494 v12 = v8->pMonsterInfo.uAttack2Type; | |
4495 if ( SHIDWORD(v7->pActorBuffs[15].uExpireTime) >= SHIDWORD(v10) | |
4496 && (SHIDWORD(v7->pActorBuffs[15].uExpireTime) > SHIDWORD(v10) | |
4497 || LODWORD(v7->pActorBuffs[15].uExpireTime) > HIDWORD(v10)) ) | |
4498 LODWORD(v10) = (signed int)v10 >> 1; | |
4499 goto LABEL_30; | |
4500 } | |
4501 if ( a4 - HIDWORD(v10) == 2 ) | |
4502 { | |
4503 v13 = v7->pMonsterInfo.uSpell1ID; | |
4504 } | |
4505 else | |
4506 { | |
4507 if ( a4 - HIDWORD(v10) != 3 ) | |
4508 { | |
4509 if ( a4 - HIDWORD(v10) == 4 ) | |
4510 v12 = v8->pMonsterInfo.field_3C_some_special_attack; | |
4511 else | |
4512 v12 = 4; | |
4513 LABEL_30: | |
4514 v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10); | |
4515 v7->sCurrentHP -= v14; | |
4516 if ( v14 ) | |
4517 { | |
4518 if ( v7->sCurrentHP > 0 ) | |
1060 | 4519 Actor::AI_Stun(uActorID, v17, 0); |
0 | 4520 else |
4521 Actor::Die(uActorID); | |
322 | 4522 Actor::AggroSurroundingPeasants(uActorID, 0); |
0 | 4523 v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP; |
4524 if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) | |
4525 v18 = 10; | |
4526 if ( !MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
4527 { | |
4528 pVelocity->x = (unsigned __int64)(v18 * (signed __int64)pVelocity->x) >> 16; | |
4529 pVelocity->y = (unsigned __int64)(v18 * (signed __int64)pVelocity->y) >> 16; | |
4530 pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; | |
4531 v7->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
4532 v7->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
4533 v7->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
4534 } | |
322 | 4535 Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v14); |
0 | 4536 } |
4537 else | |
4538 { | |
1060 | 4539 Actor::AI_Stun(uActorID, v17, 0); |
0 | 4540 } |
322 | 4541 return; |
0 | 4542 } |
4543 v13 = v7->pMonsterInfo.uSpell2ID; | |
4544 } | |
4545 v12 = LOBYTE(pSpellStats->pInfos[v13].uSchool); | |
4546 goto LABEL_30; | |
4547 } | |
4548 v12 = v8->pMonsterInfo.uAttack1Type; | |
4549 goto LABEL_30; | |
4550 } | |
4551 } | |
4552 } | |
4553 } | |
4554 | |
1297 | 4555 // A750D8: using guessed type __int64 qword_A750D8; |
4556 | |
4557 | |
0 | 4558 // A750D8: using guessed type __int64 qword_A750D8; |
4559 | |
1297 | 4560 |
0 | 4561 // A750D8: using guessed type __int64 qword_A750D8; |
4562 | |
4563 //----- (0043F515) -------------------------------------------------------- | |
657 | 4564 void FindBillboardsLightLevels_BLV() |
0 | 4565 { |
4566 for (uint i = 0; i < uNumBillboardsToDraw; ++i) | |
4567 { | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
4568 auto p = &pBillboardRenderList[i]; |
0 | 4569 |
4570 if (p->field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !p->uIndoorSectorID) | |
657 | 4571 p->dimming_level = 0; |
0 | 4572 else |
657 | 4573 p->dimming_level = _43F55F_get_billboard_light_level(p, -1); |
0 | 4574 } |
4575 } | |
4576 | |
4577 //----- (0043F55F) -------------------------------------------------------- | |
4578 int __fastcall _43F55F_get_billboard_light_level(RenderBillboard *a1, int uBaseLightLevel) | |
4579 { | |
4580 signed int v3; // ecx@2 | |
4581 | |
4582 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
4583 { | |
4584 v3 = pIndoor->pSectors[a1->uIndoorSectorID].uMinAmbientLightLevel; | |
4585 } | |
4586 else | |
4587 { | |
4588 if ( uBaseLightLevel == -1 ) | |
657 | 4589 v3 = a1->dimming_level; |
0 | 4590 else |
4591 v3 = uBaseLightLevel; | |
4592 } | |
430 | 4593 return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->world_x, a1->world_y, a1->world_z); |
0 | 4594 } |
4595 | |
4596 //----- (0043F5C8) -------------------------------------------------------- | |
4597 int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z) | |
4598 { | |
4599 int v5; // esi@1 | |
4600 signed int v6; // edi@1 | |
4601 int v8; // eax@6 | |
4602 int v9; // ebx@6 | |
4603 unsigned int v10; // ecx@6 | |
4604 unsigned int v11; // edx@9 | |
4605 unsigned int v12; // edx@11 | |
4606 signed int v13; // ecx@12 | |
4607 BLVLightMM7 *v16; // esi@20 | |
4608 int v17; // ebx@21 | |
4609 int v18; // eax@24 | |
4610 int v19; // ebx@24 | |
4611 unsigned int v20; // ecx@24 | |
4612 int v21; // edx@25 | |
4613 unsigned int v22; // edx@27 | |
4614 unsigned int v23; // edx@29 | |
4615 signed int v24; // ecx@30 | |
4616 int v26; // ebx@35 | |
4617 int v27; // eax@38 | |
4618 int v28; // ebx@38 | |
4619 unsigned int v29; // ecx@38 | |
4620 int v30; // edx@39 | |
4621 unsigned int v31; // edx@41 | |
4622 unsigned int v32; // edx@43 | |
4623 signed int v33; // ecx@44 | |
4624 int v37; // [sp+Ch] [bp-18h]@37 | |
4625 int v38; // [sp+10h] [bp-14h]@5 | |
4626 int v39; // [sp+10h] [bp-14h]@23 | |
4627 int v40; // [sp+10h] [bp-14h]@36 | |
4628 int v42; // [sp+14h] [bp-10h]@22 | |
4629 unsigned int v43; // [sp+18h] [bp-Ch]@12 | |
4630 unsigned int v44; // [sp+18h] [bp-Ch]@30 | |
4631 unsigned int v45; // [sp+18h] [bp-Ch]@44 | |
4632 | |
4633 v6 = uBaseLightLevel; | |
4634 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i) | |
4635 { | |
4636 auto p = pMobileLightsStack->pLights + i; | |
4637 | |
4638 auto distX = abs(p->vPosition.x - x); | |
4639 if ( distX <= p->uRadius) | |
4640 { | |
4641 auto distY = abs(p->vPosition.y - y); | |
4642 if ( distY <= p->uRadius) | |
4643 { | |
4644 auto distZ = abs(p->vPosition.z - z); | |
4645 if ( distZ <= p->uRadius) | |
4646 { | |
4647 v8 = distX; | |
4648 v9 = distY; | |
4649 v10 = distZ; | |
4650 if (distX < distY) | |
4651 { | |
4652 v8 = distY; | |
4653 v9 = distX; | |
4654 } | |
4655 if ( v8 < distZ ) | |
4656 { | |
4657 v11 = v8; | |
4658 v8 = distZ; | |
4659 v10 = v11; | |
4660 } | |
4661 if ( v9 < (signed int)v10 ) | |
4662 { | |
4663 v12 = v10; | |
4664 v10 = v9; | |
4665 v9 = v12; | |
4666 } | |
4667 v43 = ((unsigned int)(11 * v9) / 32) + (v10 / 4) + v8; | |
4668 v13 = p->uRadius; | |
4669 if ( (signed int)v43 < v13 ) | |
4670 v6 += ((unsigned __int64)(30i64 * (signed int)(v43 << 16) / v13) >> 16) - 30; | |
4671 } | |
4672 } | |
4673 } | |
4674 } | |
4675 | |
4676 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4677 { | |
4678 auto pSector = pIndoor->pSectors + uSectorID; | |
4679 | |
4680 for (uint i = 0; i < pSector->uNumLights; ++i) | |
4681 { | |
4682 v16 = pIndoor->pLights + pSector->pLights[i]; | |
4683 if (~v16->uAtributes & 8) | |
4684 { | |
4685 v17 = abs(v16->vPosition.x - x); | |
4686 if ( v17 <= v16->uRadius ) | |
4687 { | |
4688 v42 = abs(v16->vPosition.y - y); | |
4689 if ( v42 <= v16->uRadius ) | |
4690 { | |
4691 v39 = abs(v16->vPosition.z - z); | |
4692 if ( v39 <= v16->uRadius ) | |
4693 { | |
4694 v18 = v17; | |
4695 v19 = v42; | |
4696 v20 = v39; | |
4697 if ( v18 < v42 ) | |
4698 { | |
4699 v21 = v18; | |
4700 v18 = v42; | |
4701 v19 = v21; | |
4702 } | |
4703 if ( v18 < v39 ) | |
4704 { | |
4705 v22 = v18; | |
4706 v18 = v39; | |
4707 v20 = v22; | |
4708 } | |
4709 if ( v19 < (signed int)v20 ) | |
4710 { | |
4711 v23 = v20; | |
4712 v20 = v19; | |
4713 v19 = v23; | |
4714 } | |
4715 v44 = ((unsigned int)(11 * v19) >> 5) + (v20 >> 2) + v18; | |
4716 v24 = v16->uRadius; | |
4717 if ( (signed int)v44 < v24 ) | |
4718 v6 += ((unsigned __int64)(30i64 * (signed int)(v44 << 16) / v24) >> 16) - 30; | |
4719 } | |
4720 } | |
4721 } | |
4722 } | |
4723 } | |
4724 } | |
4725 | |
4726 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i) | |
4727 { | |
4728 auto p = pStationaryLightsStack->pLights + i; | |
4729 v26 = abs(p->vPosition.x - x); | |
4730 if ( v26 <= p->uRadius) | |
4731 { | |
4732 v40 = abs(p->vPosition.y - y); | |
4733 if ( v40 <= p->uRadius) | |
4734 { | |
4735 v37 = abs(p->vPosition.z - z); | |
4736 if ( v37 <= p->uRadius) | |
4737 { | |
4738 v27 = v26; | |
4739 v28 = v40; | |
4740 v29 = v37; | |
4741 if ( v27 < v40 ) | |
4742 { | |
4743 v30 = v27; | |
4744 v27 = v40; | |
4745 v28 = v30; | |
4746 } | |
4747 if ( v27 < v37 ) | |
4748 { | |
4749 v31 = v27; | |
4750 v27 = v37; | |
4751 v29 = v31; | |
4752 } | |
4753 if ( v28 < (signed int)v29 ) | |
4754 { | |
4755 v32 = v29; | |
4756 v29 = v28; | |
4757 v28 = v32; | |
4758 } | |
4759 v45 = ((unsigned int)(11 * v28) >> 5) + (v29 >> 2) + v27; | |
4760 v33 = p->uRadius; | |
4761 if ( (signed int)v45 < v33 ) | |
4762 v6 += ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / v33) >> 16) - 30; | |
4763 } | |
4764 } | |
4765 } | |
4766 } | |
4767 | |
4768 if ( v6 <= 31 ) | |
4769 { | |
4770 if ( v6 < 0 ) | |
4771 v6 = 0; | |
4772 } | |
4773 else | |
4774 { | |
4775 v6 = 31; | |
4776 } | |
4777 return v6; | |
4778 } | |
4779 | |
4780 //----- (00406051) -------------------------------------------------------- | |
4781 __int16 stru262_TurnBased::StartTurn() | |
4782 { | |
4783 stru262_TurnBased *v1; // esi@1 | |
4784 int v2; // ecx@1 | |
4785 int v3; // ebx@1 | |
4786 char *v4; // edi@1 | |
4787 int v5; // eax@4 | |
4788 int v6; // eax@12 | |
4789 char *v7; // eax@15 | |
4790 TurnBased_QueueElem *v8; // edi@17 | |
4791 unsigned int v9; // edx@23 | |
4792 char *v10; // eax@26 | |
4793 int v11; // eax@30 | |
4794 int v12; // ebx@30 | |
4795 char *v13; // edi@31 | |
4796 int v15; // [sp+Ch] [bp-10h]@5 | |
4797 TurnBased_QueueElem *v16; // [sp+10h] [bp-Ch]@3 | |
4798 int v17; // [sp+14h] [bp-8h]@2 | |
4799 int v18; // [sp+14h] [bp-8h]@16 | |
4800 signed int v19; // [sp+18h] [bp-4h]@1 | |
4801 int v20; // [sp+18h] [bp-4h]@14 | |
4802 | |
4803 v1 = this; | |
4804 v2 = 0; | |
4805 v19 = 0; | |
4806 v3 = v1->uActorQueueSize; | |
4807 v1->field_1C = 0; | |
4808 v4 = (char *)&v1->pQueue[v3].field_4; | |
4809 do | |
4810 { | |
4811 v17 = v2; | |
4812 if ( v1->uActorQueueSize <= v2 ) | |
4813 goto LABEL_11; | |
4814 v16 = v1->pQueue; | |
4815 while ( 1 ) | |
4816 { | |
4817 v5 = v16->uPackedID; | |
848 | 4818 if ( PID_TYPE(v16->uPackedID) == OBJECT_Player) |
0 | 4819 break; |
4820 LABEL_8: | |
4821 ++v17; | |
4822 ++v16; | |
4823 if ( v17 >= v1->uActorQueueSize ) | |
4824 goto LABEL_11; | |
4825 } | |
848 | 4826 v15 = PID_ID(v5); |
4827 if ( !pPlayers[(PID_ID(v5)) + 1]->CanAct() || v19 != v15 ) | |
0 | 4828 { |
4829 v2 = 0; | |
4830 goto LABEL_8; | |
4831 } | |
4832 v2 = 0; | |
4833 LABEL_11: | |
4834 if ( v17 == v1->uActorQueueSize ) | |
4835 { | |
4836 *(int *)v4 = 100; | |
4837 v6 = 8 * v19; | |
862 | 4838 LOBYTE(v6) = PID(OBJECT_Player,v19); |
0 | 4839 *((int *)v4 + 2) = v2; |
4840 *((int *)v4 - 1) = v6; | |
4841 *((int *)v4 + 1) = v2; | |
4842 ++v3; | |
4843 v4 += 16; | |
4844 } | |
4845 ++v19; | |
4846 } | |
4847 while ( v19 < 4 ); | |
4848 v1->uActorQueueSize = v3; | |
4849 v20 = v2; | |
4850 if ( ai_arrays_size > v2 ) | |
4851 { | |
4852 v7 = (char *)&v1->pQueue[v3].field_4; | |
4853 do | |
4854 { | |
4855 v18 = v2; | |
4856 if ( v1->uActorQueueSize > v2 ) | |
4857 { | |
4858 v8 = v1->pQueue; | |
4859 do | |
4860 { | |
848 | 4861 if ( PID_TYPE(v8->uPackedID) == OBJECT_Actor && ai_near_actors_ids[v20] == PID_ID(v8->uPackedID) ) |
0 | 4862 break; |
4863 ++v18; | |
4864 ++v8; | |
4865 } | |
4866 while ( v18 < v1->uActorQueueSize ); | |
4867 v2 = 0; | |
4868 } | |
4869 if ( v18 == v1->uActorQueueSize ) | |
4870 { | |
390 | 4871 v9 = ai_near_actors_ids[v20]; |
0 | 4872 *(int *)v7 = 1; |
4873 *((int *)v7 + 2) = v2; | |
862 | 4874 *((int *)v7 - 1) = PID(OBJECT_Actor,v9); |
0 | 4875 *((int *)v7 + 1) = v2; |
4876 ++v3; | |
4877 v7 += 16; | |
4878 } | |
4879 ++v20; | |
4880 } | |
4881 while ( v20 < ai_arrays_size ); | |
4882 } | |
4883 ++v1->field_0; | |
4884 v1->uActorQueueSize = v3; | |
4885 v1->field_10 = 100; | |
4886 if ( v3 > 0 ) | |
4887 { | |
4888 v10 = (char *)&v1->pQueue[0].field_4; | |
4889 do | |
4890 { | |
4891 if ( *(int *)v10 <= 0 ) | |
4892 *(int *)v10 = 100; | |
4893 ++v2; | |
4894 v10 += 16; | |
4895 } | |
4896 while ( v2 < v1->uActorQueueSize ); | |
4897 } | |
4898 LOWORD(v11) = v1->_4063A1(); | |
4899 v12 = 0; | |
4900 if ( v1->uActorQueueSize > 0 ) | |
4901 { | |
4902 v13 = (char *)&v1->pQueue[0].field_4; | |
4903 do | |
4904 { | |
848 | 4905 v11 = PID_TYPE(*((int *)v13 - 1)); |
0 | 4906 if ( (char)v11 == 4 ) |
4907 break; | |
4908 if ( *(int *)v13 > 0 ) | |
4909 break; | |
4910 LOWORD(v11) = v1->_40680F(v12++); | |
4911 v13 += 16; | |
4912 } | |
4913 while ( v12 < v1->uActorQueueSize ); | |
4914 } | |
4915 return v11; | |
4916 } | |
4917 // 4F75D8: using guessed type int ai_arrays_size; | |
4918 | |
4919 //----- (004061CA) -------------------------------------------------------- | |
4920 void stru262_TurnBased::NextTurn() | |
4921 { | |
4922 stru262_TurnBased *v1; // esi@1 | |
4923 TurnBased_QueueElem *v2; // ebp@1 | |
4924 int v3; // ebx@1 | |
4925 int v4; // edi@7 | |
4926 Actor *v5; // eax@9 | |
4927 int v6; // ecx@9 | |
4928 signed int v7; // ebx@17 | |
4929 int v8; // ebp@27 | |
4930 TurnBased_QueueElem *v9; // edi@28 | |
4931 int v10; // ecx@30 | |
4932 unsigned __int16 v11; // ax@30 | |
4933 signed int v12; // edx@35 | |
4934 signed int v13; // [sp+10h] [bp-4h]@7 | |
4935 | |
4936 v1 = this; | |
4937 _404544(); | |
4938 v2 = v1->pQueue; | |
4939 v3 = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4940 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4941 uActiveCharacter = PID_ID(v1->pQueue[0].uPackedID) + 1; |
0 | 4942 else |
4943 uActiveCharacter = 0; | |
4944 viewparams->bRedrawGameUI = 1; | |
4945 if ( v1->field_1C ) | |
4946 { | |
4947 pTurnEngine->field_18 |= 2u; | |
4948 return; | |
4949 } | |
4950 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
4951 if ( v1->pQueue[0].field_4 <= 0 ) | |
4952 return; | |
4953 v4 = 0; | |
4954 v13 = 0; | |
4955 if ( v1->uActorQueueSize <= 0 ) | |
4956 goto LABEL_27; | |
4957 do | |
4958 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4959 if (PID_TYPE(v2->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4960 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
4961 v5 = &pActors[PID_ID(v2->uPackedID)]; |
0 | 4962 LOWORD(v6) = v5->uAIState; |
4963 if ( (short)v6 == 4 | |
4964 || (short)v6 == 8 | |
4965 || (short)v6 == 2 | |
4966 || (short)v6 == 3 | |
4967 || (short)v6 == 12 | |
4968 || (short)v6 == 13 | |
4969 || (short)v6 == 18 | |
4970 || (short)v6 == 17 ) | |
4971 { | |
4972 v7 = v5->uCurrentActionLength; | |
4973 v5->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
4974 if ( (signed int)v5->uCurrentActionTime < v7 ) | |
4975 { | |
4976 v13 = 1; | |
4977 LABEL_19: | |
4978 v3 = 0; | |
4979 goto LABEL_20; | |
4980 } | |
4981 v6 = (signed __int16)v6; | |
4982 if ( (signed __int16)v6 == 4 ) | |
4983 { | |
4984 v3 = 0; | |
4985 v5->uAIState = Dead; | |
4986 v5->uCurrentActionTime = 0; | |
4987 v5->uCurrentActionLength = 0; | |
4988 v5->UpdateAnimation(); | |
4989 } | |
4990 else | |
4991 { | |
4992 if ( v6 != 8 ) | |
4993 goto LABEL_19; | |
4994 v3 = 0; | |
848 | 4995 Actor::AI_StandOrBored(PID_ID(v2->uPackedID), ai_near_actors_targets_pid[PID_ID(v2->uPackedID)], 32, 0); |
0 | 4996 } |
4997 } | |
4998 } | |
4999 LABEL_20: | |
5000 ++v4; | |
5001 ++v2; | |
5002 } | |
5003 while ( v4 < v1->uActorQueueSize ); | |
5004 if ( v13 != v3 ) | |
5005 { | |
5006 v1->field_18 |= 1u; | |
5007 return; | |
5008 } | |
5009 LABEL_27: | |
5010 v1->field_18 &= 0xFFFFFFFEu; | |
5011 v8 = 0; | |
5012 if ( v1->uActorQueueSize > v3 ) | |
5013 { | |
5014 v9 = v1->pQueue; | |
5015 do | |
5016 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5017 if (PID_TYPE(v9->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5018 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5019 v10 = PID_ID(v9->uPackedID); |
0 | 5020 v11 = pActors[v10].uAIState; |
5021 if ( v11 != 5 ) | |
5022 { | |
5023 if ( v11 != 4 && v11 != 11 && v11 != 19 ) | |
5024 { | |
5025 if ( v11 != 17 ) | |
5026 { | |
417 | 5027 v12 = ai_near_actors_targets_pid[v10]; |
0 | 5028 v9->uActionLength = v3; |
414 | 5029 Actor::AI_StandOrBored(v10, v12, 32, (AIDirection *)v3); |
0 | 5030 } |
5031 } | |
5032 } | |
5033 } | |
5034 ++v8; | |
5035 ++v9; | |
5036 } | |
5037 while ( v8 < v1->uActorQueueSize ); | |
5038 } | |
5039 v1->field_4 = 3; | |
5040 pParty->uTimePlayed += __PAIR__(v3, 213); | |
5041 _494035_timed_effects__water_walking_damage__etc(); | |
5042 v1->uActionPointsLeft = 130; | |
5043 } | |
5044 | |
5045 //----- (004063A1) -------------------------------------------------------- | |
5046 int stru262_TurnBased::_4063A1() | |
5047 { | |
5048 stru262_TurnBased *v1; // esi@1 | |
5049 int v2; // ebp@1 | |
5050 signed int result; // eax@1 | |
5051 int v4; // edx@1 | |
5052 int v5; // edx@3 | |
5053 int v6; // edi@4 | |
5054 int v7; // ecx@5 | |
5055 Actor *v8; // ecx@11 | |
5056 unsigned __int16 v9; // dx@12 | |
5057 int v10; // edi@16 | |
5058 int v11; // edx@17 | |
5059 char v12; // zf@18 | |
5060 | |
5061 v1 = this; | |
5062 _404544(); | |
5063 v2 = (int)&v1->pQueue[0].field_4; | |
5064 result = 1; | |
5065 viewparams->bRedrawGameUI = 1; | |
5066 v4 = v1->pQueue[0].field_4; | |
5067 if ( v4 ) | |
5068 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5069 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 5070 { |
5071 v5 = v1->uActorQueueSize; | |
5072 while ( 1 ) | |
5073 { | |
5074 v6 = 0; | |
5075 if ( v5 > 0 ) | |
5076 { | |
5077 v7 = (int)&v1->pQueue[0].field_4; | |
5078 do | |
5079 { | |
5080 --*(int *)v7; | |
5081 v5 = v1->uActorQueueSize; | |
5082 ++v6; | |
5083 v7 += 16; | |
5084 } | |
5085 while ( v6 < v5 ); | |
5086 } | |
5087 --v1->field_10; | |
5088 if ( v1->field_10 <= 0 ) | |
5089 break; | |
5090 if ( !*(int *)v2 ) | |
5091 goto LABEL_9; | |
5092 } | |
5093 LABEL_24: | |
5094 result = 1; | |
5095 } | |
5096 else | |
5097 { | |
848 | 5098 v8 = &pActors[PID_ID(v1->pQueue[0].uPackedID)]; |
0 | 5099 if ( v4 > 0 ) |
5100 { | |
5101 do | |
5102 { | |
5103 v9 = v8->uAIState; | |
5104 if ( v9 == 5 ) | |
5105 break; | |
5106 if ( v9 == 4 || v9 == 19 || v9 == 11 ) | |
5107 break; | |
5108 v10 = 0; | |
5109 if ( v1->uActorQueueSize > 0 ) | |
5110 { | |
5111 v11 = (int)&v1->pQueue[0].field_4; | |
5112 do | |
5113 { | |
5114 v12 = (*(int *)v11)-- == 1; | |
5115 if ( v12 ) | |
5116 *(int *)(v11 + 4) = 0; | |
5117 ++v10; | |
5118 v11 += 16; | |
5119 } | |
5120 while ( v10 < v1->uActorQueueSize ); | |
5121 } | |
5122 --v1->field_10; | |
5123 if ( v1->field_10 <= 0 ) | |
5124 goto LABEL_24; | |
5125 } | |
5126 while ( *(int *)v2 > 0 ); | |
5127 } | |
5128 LABEL_9: | |
5129 result = 0; | |
5130 } | |
5131 } | |
5132 return result; | |
5133 } | |
5134 | |
5135 //----- (00406457) -------------------------------------------------------- | |
5136 int stru262_TurnBased::_406457(int a2) | |
5137 { | |
5138 stru262_TurnBased *v2; // esi@1 | |
5139 signed int v3; // eax@1 | |
5140 signed int v4; // ecx@2 | |
5141 char *v5; // edx@2 | |
5142 signed int v6; // eax@2 | |
5143 int result; // eax@11 | |
5144 int v8; // edx@13 | |
5145 int v9; // ecx@14 | |
5146 char v10; // zf@15 | |
5147 | |
5148 v2 = this; | |
5149 v3 = *(&this->field_0 + 4 * (a2 + 2)); | |
848 | 5150 if ( (*((char *)&this->field_0 + 16 * PID_TYPE(a2 + 2))) == OBJECT_Player) |
5151 { | |
5152 v4 = PID_ID(v3); | |
5153 v5 = (char *)&pParty->pTurnBasedPlayerRecoveryTimes[PID_ID(v3)]; | |
0 | 5154 v6 = *(int *)v5; |
5155 if ( *(int *)v5 ) | |
5156 *(int *)v5 = 0; | |
5157 else | |
5158 v6 = pPlayers[v4 + 1]->GetAttackRecoveryTime(0); | |
5159 if ( v6 < 30 ) | |
5160 v6 = 30; | |
5161 } | |
5162 else | |
5163 { | |
848 | 5164 v6 = pMonsterStats->pInfos[pActors[PID_ID(v3)].pMonsterInfo.uID].uRecoveryTime; |
0 | 5165 } |
5166 v2->pQueue[a2].field_4 = v6; | |
5167 v2->_404544(); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5168 if (PID_TYPE(v2->pQueue[0].uPackedID) == OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5169 uActiveCharacter = PID_ID(v2->pQueue[0].uPackedID) + 1; |
0 | 5170 else |
5171 uActiveCharacter = 0; | |
5172 result = (int)&v2->pQueue[0].field_4; | |
5173 viewparams->bRedrawGameUI = 1; | |
5174 while ( *(int *)result > 0 ) | |
5175 { | |
5176 if ( v2->field_10 <= 0 ) | |
5177 break; | |
5178 v8 = 0; | |
5179 if ( v2->uActorQueueSize > 0 ) | |
5180 { | |
5181 v9 = (int)&v2->pQueue[0].field_4; | |
5182 do | |
5183 { | |
5184 v10 = (*(int *)v9)-- == 1; | |
5185 if ( v10 ) | |
5186 *(int *)(v9 + 4) = 0; | |
5187 ++v8; | |
5188 v9 += 16; | |
5189 } | |
5190 while ( v8 < v2->uActorQueueSize ); | |
5191 } | |
5192 --v2->field_10; | |
5193 if ( v2->field_10 <= 0 ) | |
5194 break; | |
5195 } | |
5196 return result; | |
5197 } | |
5198 | |
5199 //----- (0040652A) -------------------------------------------------------- | |
5200 void stru262_TurnBased::_40652A() | |
5201 { | |
848 | 5202 int *v1; // edx@2 |
0 | 5203 Actor *v2; // eax@5 |
5204 unsigned __int16 v3; // si@5 | |
5205 unsigned int v4; // esi@8 | |
5206 int v5; // [sp+Ch] [bp-4h]@1 | |
5207 | |
5208 v5 = 0; | |
5209 if ( this->uActorQueueSize > 0 ) | |
5210 { | |
848 | 5211 v1 = &this->pQueue[0].field_4; |
0 | 5212 do |
5213 { | |
5214 if ( !*(int *)v1 ) | |
5215 { | |
848 | 5216 if ( PID_TYPE(*(v1 - 4)) == OBJECT_Player) |
0 | 5217 return; |
848 | 5218 v2 = &pActors[PID_ID(*(v1 - 1))]; |
0 | 5219 v3 = v2->uAIState; |
141 | 5220 if (v3 == Standing || v3 == Fleeing || v3 == Fidgeting) |
0 | 5221 { |
5222 v4 = pMonsterStats->pInfos[v2->pMonsterInfo.uID].uRecoveryTime; | |
5223 *(int *)v1 = v4; | |
5224 if ( (signed __int64)v2->pActorBuffs[7].uExpireTime > 0 ) | |
5225 *(int *)v1 = 2 * v4; | |
5226 } | |
5227 } | |
5228 ++v5; | |
5229 v1 += 16; | |
5230 } | |
5231 while ( v5 < this->uActorQueueSize ); | |
5232 } | |
5233 } | |
5234 | |
5235 //----- (004065B0) -------------------------------------------------------- | |
322 | 5236 void stru262_TurnBased::_4065B0() |
0 | 5237 { |
5238 stru262_TurnBased *v1; // esi@1 | |
5239 signed int v2; // eax@1 | |
5240 int v3; // ebx@6 | |
5241 int v4; // edi@7 | |
5242 unsigned int v5; // edi@14 | |
5243 | |
5244 v1 = this; | |
5245 LOWORD(v2) = _404544(); | |
5246 if ( v1->pQueue[0].field_4 <= 0 | |
848 | 5247 || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, PID_TYPE(v1->pQueue[0].uPackedID) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (PID_ID(v2)) + 1, uActiveCharacter = v2), |
0 | 5248 viewparams->bRedrawGameUI = 1, |
5249 v1->pQueue[0].field_4 <= 0) ) | |
5250 { | |
5251 v3 = 0; | |
5252 if ( v1->uActorQueueSize > 0 ) | |
5253 { | |
5254 v4 = (int)v1->pQueue; | |
5255 do | |
5256 { | |
5257 v2 = *(int *)v4; | |
848 | 5258 if ( PID_TYPE(*(char *)v4) == OBJECT_Player || *(int *)(v4 + 4) > 0 ) |
0 | 5259 break; |
5260 if ( *(int *)(v4 + 8) <= 0 ) | |
5261 { | |
5262 LOWORD(v2) = v2 & 3; | |
5263 if ( (char)v2 == 3 ) | |
5264 LOWORD(v2) = v1->_40680F(v3); | |
5265 } | |
5266 ++v3; | |
5267 v4 += 16; | |
5268 } | |
5269 while ( v3 < v1->uActorQueueSize ); | |
5270 } | |
5271 } | |
5272 v5 = 0; | |
5273 if ( v1->uActorQueueSize > 0 ) | |
5274 { | |
5275 do | |
322 | 5276 v1->_406648(v5++); |
0 | 5277 while ( (signed int)v5 < v1->uActorQueueSize ); |
5278 } | |
5279 } | |
5280 | |
5281 //----- (00406648) -------------------------------------------------------- | |
322 | 5282 void stru262_TurnBased::_406648(unsigned int a2) |
0 | 5283 { |
5284 TurnBased_QueueElem *v1; // ecx@1 | |
5285 int v3; // eax@1 | |
5286 unsigned int v4; // ebx@2 | |
5287 Actor *v5; // esi@2 | |
5288 signed int v6; // edi@5 | |
5289 int v7; // ecx@6 | |
5290 int v8; // eax@6 | |
5291 int v9; // eax@7 | |
5292 int v10; // eax@8 | |
5293 int v11; // eax@9 | |
5294 int v12; // eax@10 | |
5295 int v13; // eax@11 | |
5296 int v14; // eax@14 | |
5297 unsigned int v15; // ecx@14 | |
5298 unsigned int v16; // edx@14 | |
5299 int v17; // eax@17 | |
5300 int v18; // eax@20 | |
5301 char v19; // al@24 | |
5302 unsigned int v21; // [sp-8h] [bp-50h]@16 | |
5303 int v22; // [sp-8h] [bp-50h]@17 | |
5304 AIDirection *v23; // [sp-4h] [bp-4Ch]@14 | |
5305 unsigned int v24; // [sp-4h] [bp-4Ch]@17 | |
5306 char v25; // [sp-4h] [bp-4Ch]@20 | |
5307 AIDirection a3; // [sp+Ch] [bp-3Ch]@2 | |
5308 AIDirection a4; // [sp+28h] [bp-20h]@2 | |
5309 TurnBased_QueueElem *v28; // [sp+44h] [bp-4h]@1 | |
5310 unsigned int a2a; // [sp+50h] [bp+8h]@2 | |
5311 | |
5312 v1 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); | |
5313 v28 = v1; | |
5314 v3 = v1->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5315 if (PID_TYPE(v1->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5316 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5317 v4 = PID_ID(v3); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5318 a2a = ai_near_actors_targets_pid[PID_ID(v3)]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5319 memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0), sizeof(a3)); |
0 | 5320 memcpy(&a4, &a3, sizeof(a4)); |
848 | 5321 v5 = &pActors[PID_ID(v3)]; |
0 | 5322 LOWORD(v3) = v5->uAIState; |
5323 if ( (short)v3 != Dead ) | |
5324 { | |
5325 if ( (short)v3 != Disabled ) | |
5326 { | |
5327 if ( (short)v3 != Removed ) | |
5328 { | |
5329 v6 = v5->uCurrentActionLength; | |
5330 v5->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
5331 if ( (signed int)v5->uCurrentActionTime >= v6 ) | |
5332 { | |
5333 v7 = (signed __int16)v3; | |
5334 v8 = (signed __int16)v3 - 2; | |
5335 if ( !v8 ) | |
5336 { | |
5337 v19 = stru_50C198.special_ability_use_check(&pActors[v4], v4); | |
5338 stru_50FE08.Add( | |
5339 v28->uPackedID, | |
5340 5120, | |
5341 v5->vPosition.x, | |
5342 v5->vPosition.y, | |
5343 v5->vPosition.z + ((signed int)v5->uActorHeight >> 1), | |
5344 v19, | |
5345 1); | |
5346 goto LABEL_25; | |
5347 } | |
5348 v9 = v8 - 1; | |
5349 if ( v9 ) | |
5350 { | |
5351 v10 = v9 - 1; | |
5352 if ( !v10 ) | |
5353 goto LABEL_21; | |
5354 v11 = v10 - 4; | |
5355 if ( !v11 ) | |
5356 goto LABEL_25; | |
5357 v12 = v11 - 4; | |
5358 if ( v12 ) | |
5359 { | |
5360 v13 = v12 - 1; | |
5361 if ( v13 ) | |
5362 { | |
5363 if ( v13 != Dead ) | |
5364 { | |
5365 if ( v7 != 4 ) | |
5366 { | |
5367 v14 = rand(); | |
5368 v15 = v4; | |
5369 v23 = &a4; | |
5370 v16 = a2a; | |
5371 if ( !(v14 % 2) ) | |
5372 { | |
414 | 5373 Actor::AI_Bored(v4, a2a, &a4); |
322 | 5374 return; |
0 | 5375 } |
5376 v21 = 64; | |
5377 LABEL_26: | |
413 | 5378 Actor::AI_Stand(v15, v16, v21, v23); |
322 | 5379 return; |
0 | 5380 } |
5381 LABEL_21: | |
5382 v5->uCurrentActionTime = 0; | |
5383 v5->uCurrentActionLength = 0; | |
5384 v5->uAIState = Dead; | |
322 | 5385 pActors[v4].UpdateAnimation(); |
5386 return; | |
0 | 5387 } |
5388 v24 = v5->pMonsterInfo.uSpellSkillAndMastery2; | |
5389 v22 = 3; | |
5390 v17 = v5->pMonsterInfo.uSpell2ID; | |
5391 } | |
5392 else | |
5393 { | |
5394 v24 = v5->pMonsterInfo.uSpellSkillAndMastery1; | |
5395 v22 = 2; | |
5396 v17 = v5->pMonsterInfo.uSpell1ID; | |
5397 } | |
1060 | 5398 Actor::AI_SpellAttack(v4, &a4, v17, v22, v24); |
0 | 5399 LABEL_25: |
5400 v16 = a2a; | |
5401 v23 = &a4; | |
5402 v21 = 0; | |
5403 v15 = v4; | |
5404 goto LABEL_26; | |
5405 } | |
5406 v18 = v5->pMonsterInfo.uMissleAttack2Type; | |
5407 v25 = 1; | |
5408 } | |
5409 else | |
5410 { | |
5411 v18 = v5->pMonsterInfo.uMissleAttack1Type; | |
5412 v25 = 0; | |
5413 } | |
1060 | 5414 Actor::AI_RangedAttack(v4, &a4, v18, v25); |
0 | 5415 goto LABEL_25; |
5416 } | |
5417 } | |
5418 } | |
5419 } | |
5420 } | |
5421 } | |
5422 // 50FE08: using guessed type stru298 stru_50FE08; | |
5423 | |
5424 //----- (0040680F) -------------------------------------------------------- | |
5425 __int16 stru262_TurnBased::_40680F(int a2) | |
5426 { | |
5427 TurnBased_QueueElem *v2; // eax@1 | |
848 | 5428 unsigned int v3; // eax@1 |
5429 unsigned int v4; // edi@2 | |
0 | 5430 Actor *v5; // ebx@2 |
5431 unsigned int *v6; // esi@7 | |
5432 AIDirection *v7; // esi@10 | |
5433 int v8; // eax@10 | |
5434 unsigned int v9; // ecx@10 | |
5435 signed int v10; // eax@13 | |
5436 unsigned __int8 v11; // sf@19 | |
5437 unsigned __int8 v12; // of@19 | |
5438 int v13; // esi@29 | |
5439 bool v14; // eax@29 | |
5440 unsigned __int8 v15; // cl@33 | |
5441 AIDirection a3; // [sp+Ch] [bp-44h]@10 | |
5442 AIDirection v18; // [sp+28h] [bp-28h]@10 | |
5443 int a2a; // [sp+44h] [bp-Ch]@2 | |
5444 unsigned int v20; // [sp+48h] [bp-8h]@10 | |
5445 TurnBased_QueueElem *v21; // [sp+4Ch] [bp-4h]@1 | |
5446 signed int v22; // [sp+58h] [bp+8h]@10 | |
5447 | |
5448 v2 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); | |
5449 v21 = v2; | |
5450 v2->uActionLength = 0; | |
848 | 5451 v3 = v2->uPackedID; |
0 | 5452 if ( (unsigned __int8)v3 & 3 ) |
5453 { | |
848 | 5454 v3 = PID_ID(v3); |
0 | 5455 v4 = v3; |
848 | 5456 a2a = v3; |
5457 v5 = &pActors[v3]; | |
0 | 5458 LOWORD(v3) = v5->uAIState; |
5459 if ( (short)v3 != 5 ) | |
5460 { | |
5461 if ( (short)v3 != 4 && (short)v3 != 11 && (short)v3 != 19 && (short)v3 != 17 ) | |
5462 { | |
417 | 5463 v6 = (unsigned int *)&ai_near_actors_targets_pid[(int)v4]; |
5464 Actor::_SelectTarget((unsigned int)v4, &ai_near_actors_targets_pid[(int)v4], true); | |
0 | 5465 if ( v5->pMonsterInfo.uHostilityType && !*v6 ) |
5466 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
5467 v22 = *v6; | |
862 | 5468 v7 = Actor::GetDirectionInfo(PID(OBJECT_Actor,(int)v4), *v6, &a3, 0); |
0 | 5469 v8 = v5->uActorRadius; |
5470 memcpy(&a3, v7, sizeof(a3)); | |
5471 memcpy(&v18, &a3, sizeof(v18)); | |
5472 v9 = a3.uDistance - v8; | |
5473 v20 = a3.uDistance - v8; | |
5474 if ( ((a3.uDistance - v8) & 0x80000000u) != 0 ) | |
5475 { | |
5476 v9 = 0; | |
5477 v20 = 0; | |
5478 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5479 if (PID_TYPE(v22) == OBJECT_Actor) |
1263 | 5480 //v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3); |
5481 v10 = pFactionTable->relations[(pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID) / 3 + 1][(v5->pMonsterInfo.uID - 1) / 3 + 1]; | |
0 | 5482 else |
5483 v10 = 4; | |
5484 if ( v10 == 1 ) | |
5485 { | |
5486 if ( (double)(signed int)v20 < 307.2 ) | |
5487 goto LABEL_25; | |
5488 } | |
5489 else | |
5490 { | |
5491 if ( v10 == 2 ) | |
5492 { | |
5493 v12 = __OFSUB__(v9, 1024); | |
5494 v11 = ((v9 - 1024) & 0x80000000u) != 0; | |
5495 } | |
5496 else | |
5497 { | |
5498 if ( v10 == 3 ) | |
5499 { | |
5500 v12 = __OFSUB__(v9, 2560); | |
5501 v11 = ((v9 - 2560) & 0x80000000u) != 0; | |
5502 } | |
5503 else | |
5504 { | |
5505 if ( v10 != 4 ) | |
5506 goto LABEL_26; | |
5507 v12 = __OFSUB__(v9, 5120); | |
5508 v11 = ((v9 - 5120) & 0x80000000u) != 0; | |
5509 } | |
5510 } | |
5511 if ( v11 ^ v12 ) | |
5512 { | |
5513 LABEL_25: | |
5514 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
5515 goto LABEL_26; | |
5516 } | |
5517 } | |
5518 LABEL_26: | |
5519 if ( v5->pMonsterInfo.uHostilityType != 4 || !v22 || (signed int)v9 >= 5120 ) | |
5520 { | |
5521 v13 = a2a; | |
5522 goto LABEL_47; | |
5523 } | |
5524 v13 = a2a; | |
5525 v14 = stru_50C198.special_ability_use_check(v5, a2a); | |
5526 if ( v14 == 1 ) | |
5527 { | |
5528 if ( v5->pMonsterInfo.uMissleAttack2Type ) | |
5529 { | |
1060 | 5530 Actor::AI_MissileAttack2(v13, v22, &v18); |
0 | 5531 goto LABEL_43; |
5532 } | |
5533 } | |
5534 else | |
5535 { | |
5536 if ( v14 > 1 && v14 <= 3 ) | |
5537 { | |
5538 if ( v14 == 2 ) | |
5539 v15 = v5->pMonsterInfo.uSpell1ID; | |
5540 else | |
5541 v15 = v5->pMonsterInfo.uSpell2ID; | |
5542 if ( v15 ) | |
5543 { | |
5544 if ( v14 == 2 ) | |
1060 | 5545 Actor::AI_SpellAttack1(v13, v22, &v18); |
0 | 5546 else |
1060 | 5547 Actor::AI_SpellAttack2(v13, v22, &v18); |
0 | 5548 goto LABEL_43; |
5549 } | |
5550 goto LABEL_44; | |
5551 } | |
5552 if ( v5->pMonsterInfo.uMissleAttack1Type ) | |
5553 { | |
1060 | 5554 Actor::AI_MissileAttack1(v13, v22, &v18); |
0 | 5555 LABEL_43: |
848 | 5556 //v3 = v21; |
0 | 5557 v21->field_C = 1; |
5558 LABEL_48: | |
848 | 5559 v21->uActionLength = v5->uCurrentActionLength; |
5560 //return (signed __int16)v3; | |
5561 return (signed __int16)&v21; | |
0 | 5562 } |
5563 } | |
5564 LABEL_44: | |
5565 if ( (double)(signed int)v20 < 307.2 ) | |
5566 { | |
1060 | 5567 Actor::AI_MeleeAttack(v13, v22, &v18); |
848 | 5568 //v3 = v21; |
0 | 5569 v21->field_C = 3; |
5570 goto LABEL_48; | |
5571 } | |
5572 LABEL_47: | |
413 | 5573 Actor::AI_Stand(v13, v22, 0x40u, &v18); |
848 | 5574 //v3 = v21; |
0 | 5575 v21->field_C = 0; |
5576 goto LABEL_48; | |
5577 } | |
5578 } | |
5579 } | |
5580 return (signed __int16)v3; | |
5581 } | |
5582 | |
5583 //----- (00406A63) -------------------------------------------------------- | |
5584 void stru262_TurnBased::_406A63() | |
5585 { | |
5586 stru262_TurnBased *v1; // ebx@1 | |
5587 int v2; // esi@1 | |
5588 unsigned __int8 v3; // zf@1 | |
5589 unsigned __int8 v4; // sf@1 | |
5590 signed int v5; // ecx@4 | |
5591 AIDirection a3; // [sp+8h] [bp-44h]@5 | |
5592 AIDirection v7; // [sp+24h] [bp-28h]@5 | |
5593 unsigned int v8; // [sp+40h] [bp-Ch]@5 | |
5594 signed int a2; // [sp+44h] [bp-8h]@1 | |
5595 TurnBased_QueueElem *v10; // [sp+48h] [bp-4h]@2 | |
5596 | |
5597 v1 = this; | |
5598 v2 = 0; | |
5599 this->field_8 = 64; | |
5600 dword_50C994 = 0; | |
5601 uActiveCharacter = 0; | |
5602 v3 = this->uActorQueueSize == 0; | |
5603 v4 = this->uActorQueueSize < 0; | |
5604 a2 = 0; | |
5605 if ( !(v4 | v3) ) | |
5606 { | |
5607 v10 = this->pQueue; | |
5608 while ( 1 ) | |
5609 { | |
5610 v5 = v10->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5611 if (PID_TYPE(v10->uPackedID) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5612 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5613 v8 = ai_near_actors_targets_pid[PID_ID(v5)]; |
0 | 5614 memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7)); |
5615 if ( !v1->_406D10(a2) ) | |
848 | 5616 Actor::AI_Stand(PID_ID(v10->uPackedID), v8, 0x20u, &v7); |
0 | 5617 } |
5618 ++a2; | |
5619 ++v10; | |
5620 if ( a2 >= v1->uActorQueueSize ) | |
5621 break; | |
5622 v2 = 0; | |
5623 } | |
5624 } | |
5625 } | |
5626 // 50C994: using guessed type int dword_50C994; | |
5627 | |
5628 //----- (00406AFE) -------------------------------------------------------- | |
5629 void stru262_TurnBased::_406AFE() | |
5630 { | |
5631 stru262_TurnBased *v1; // edi@1 | |
5632 TurnBased_QueueElem *v2; // ebx@2 | |
5633 int v3; // esi@4 | |
5634 int v4; // ecx@5 | |
5635 AIDirection a3; // [sp+4h] [bp-48h]@5 | |
5636 AIDirection v6; // [sp+20h] [bp-2Ch]@5 | |
5637 stru262_TurnBased *v7; // [sp+3Ch] [bp-10h]@1 | |
5638 unsigned int v8; // [sp+40h] [bp-Ch]@4 | |
5639 unsigned int v9; // [sp+44h] [bp-8h]@5 | |
5640 int v10; // [sp+48h] [bp-4h]@1 | |
5641 | |
5642 v10 = 0; | |
5643 v1 = this; | |
5644 v7 = this; | |
5645 if ( this->uActorQueueSize > 0 ) | |
5646 { | |
5647 v2 = this->pQueue; | |
5648 do | |
5649 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5650 if (PID_TYPE(v2->uPackedID) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5651 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5652 v3 = PID_ID(v2->uPackedID); |
0 | 5653 v8 = v3; |
5654 if ( pActors[v3].CanAct() ) | |
5655 { | |
5656 v4 = v2->uPackedID; | |
417 | 5657 v9 = ai_near_actors_targets_pid[v3]; |
0 | 5658 memcpy(&v6, Actor::GetDirectionInfo(v4, v9, &a3, 0), sizeof(v6)); |
413 | 5659 Actor::AI_Stand(v8, v9, 0x20u, &v6); |
0 | 5660 v2->field_C = 0; |
5661 v2->uActionLength = 0; | |
5662 v1 = v7; | |
5663 } | |
5664 } | |
5665 ++v10; | |
5666 ++v2; | |
5667 } | |
5668 while ( v10 < v1->uActorQueueSize ); | |
5669 } | |
5670 v1->field_4 = 2; | |
5671 v1->field_8 = 100; | |
5672 } | |
5673 | |
5674 //----- (00406B9F) -------------------------------------------------------- | |
5675 int stru262_TurnBased::_406B9F() | |
5676 { | |
5677 signed int result; // eax@1 | |
5678 unsigned __int8 v2; // zf@1 | |
5679 unsigned __int8 v3; // sf@1 | |
5680 int v4; // esi@4 | |
5681 unsigned int v5; // esi@5 | |
5682 Actor *v6; // ebx@5 | |
5683 unsigned __int16 v7; // cx@15 | |
5684 AIDirection a3; // [sp+0h] [bp-50h]@15 | |
5685 AIDirection v9; // [sp+1Ch] [bp-34h]@15 | |
5686 signed int a1; // [sp+38h] [bp-18h]@4 | |
5687 stru262_TurnBased *thisa; // [sp+3Ch] [bp-14h]@1 | |
5688 unsigned int v12; // [sp+40h] [bp-10h]@5 | |
5689 unsigned int v13; // [sp+44h] [bp-Ch]@8 | |
5690 TurnBased_QueueElem *v14; // [sp+48h] [bp-8h]@2 | |
5691 signed int a2; // [sp+4Ch] [bp-4h]@1 | |
5692 | |
5693 result = 0; | |
5694 thisa = this; | |
5695 v2 = this->uActorQueueSize == 0; | |
5696 v3 = this->uActorQueueSize < 0; | |
5697 a2 = 0; | |
5698 if ( !(v3 | v2) ) | |
5699 { | |
5700 v14 = this->pQueue; | |
5701 while ( 1 ) | |
5702 { | |
5703 v4 = v14->uPackedID; | |
5704 a1 = v14->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5705 if (PID_TYPE(a1) != OBJECT_Player) |
0 | 5706 { |
848 | 5707 v5 = PID_ID(v4); |
0 | 5708 v12 = v5; |
5709 v6 = &pActors[v5]; | |
5710 if ( SHIDWORD(v6->pActorBuffs[5].uExpireTime) < result | |
5711 || SHIDWORD(v6->pActorBuffs[5].uExpireTime) <= result && LODWORD(v6->pActorBuffs[5].uExpireTime) <= result ) | |
5712 v13 = result; | |
5713 else | |
5714 v13 = 1; | |
5715 if ( SHIDWORD(v6->pActorBuffs[6].uExpireTime) >= result | |
5716 && (SHIDWORD(v6->pActorBuffs[6].uExpireTime) > result || LODWORD(v6->pActorBuffs[6].uExpireTime) > result) ) | |
5717 result = 1; | |
1110 | 5718 if ( !(v13 != 0 || result || v6->uAIState == 5 || v6->uAIState == 11 || v6->uAIState == 19) ) |
0 | 5719 { |
417 | 5720 v13 = ai_near_actors_targets_pid[v5]; |
0 | 5721 memcpy(&v9, Actor::GetDirectionInfo(a1, v13, &a3, 0), sizeof(v9)); |
5722 v7 = v6->uAIState; | |
5723 if ( v7 == 6 || v7 == 1 ) | |
5724 { | |
5725 if ( (double)(signed int)v9.uDistance < 307.2 ) | |
5726 goto LABEL_26; | |
5727 } | |
5728 v6->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
5729 if ( (signed int)v6->uCurrentActionTime > v6->uCurrentActionLength ) | |
5730 { | |
5731 if ( v7 == 4 ) | |
5732 { | |
5733 v6->uCurrentActionTime = 0; | |
5734 v6->uCurrentActionLength = 0; | |
5735 v6->uAIState = Dead; | |
5736 v6->UpdateAnimation(); | |
5737 } | |
5738 if ( !thisa->_406D10(a2) ) | |
5739 LABEL_26: | |
413 | 5740 Actor::AI_Stand(v12, v13, 0x20u, &v9); |
0 | 5741 } |
5742 } | |
5743 } | |
5744 ++a2; | |
5745 result = (signed int)thisa; | |
5746 ++v14; | |
5747 if ( a2 >= thisa->uActorQueueSize ) | |
5748 break; | |
5749 result = 0; | |
5750 } | |
5751 } | |
5752 return result; | |
5753 } | |
5754 | |
5755 //----- (00406D10) -------------------------------------------------------- | |
5756 bool stru262_TurnBased::_406D10(signed int a2) | |
5757 { | |
5758 int v2; // ecx@1 | |
920 | 5759 //int v3; // ecx@2 |
5760 Actor *actor; // ebx@2 | |
5761 //unsigned __int16 v5; // dx@2 | |
0 | 5762 int *v6; // esi@7 |
5763 TurnBased_QueueElem *v7; // edi@7 | |
5764 int v8; // eax@7 | |
5765 AIDirection *v9; // esi@10 | |
5766 int v10; // eax@10 | |
5767 unsigned int v11; // ecx@10 | |
920 | 5768 unsigned __int8 pHostileType; // al@12 |
0 | 5769 unsigned __int8 v13; // sf@16 |
5770 unsigned __int8 v14; // of@16 | |
5771 unsigned int v15; // edx@22 | |
5772 unsigned int v16; // ecx@23 | |
5773 TurnBased_QueueElem *v17; // eax@25 | |
5774 double v18; // st7@33 | |
5775 double v19; // st6@33 | |
5776 int v21; // [sp-8h] [bp-5Ch]@23 | |
5777 int v22; // [sp-8h] [bp-5Ch]@26 | |
5778 AIDirection *v23; // [sp-4h] [bp-58h]@23 | |
5779 int v24; // [sp-4h] [bp-58h]@26 | |
5780 AIDirection a3; // [sp+Ch] [bp-48h]@10 | |
5781 AIDirection pDir; // [sp+28h] [bp-2Ch]@10 | |
5782 int v27; // [sp+44h] [bp-10h]@33 | |
5783 unsigned int v28; // [sp+48h] [bp-Ch]@10 | |
5784 TurnBased_QueueElem *v29; // [sp+4Ch] [bp-8h]@7 | |
5785 unsigned int uActorID; // [sp+50h] [bp-4h]@2 | |
5786 unsigned int a2a; // [sp+5Ch] [bp+8h]@7 | |
5787 | |
920 | 5788 __debugbreak();//ñðàáàòûâàåò ïðè ïîøàãîâîì ðåæèìå ïîñëå ïÿòè øàãîâ |
0 | 5789 v2 = *(&this->field_0 + 4 * (a2 + 2)); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5790 if (PID_TYPE(v2) == OBJECT_Player) |
0 | 5791 return 0; |
920 | 5792 uActorID = PID_ID(v2); |
5793 //uActorID = v3; | |
5794 actor = &pActors[uActorID]; | |
5795 //v5 = v4->uAIState; | |
5796 if ( actor->uAIState == 5 || actor->uAIState == 4 || actor->uAIState == 11 || actor->uAIState == 19 || actor->uAIState == 17 ) | |
0 | 5797 return 1; |
920 | 5798 v6 = &ai_near_actors_targets_pid[uActorID]; |
0 | 5799 v7 = &pTurnEngine->pQueue[a2]; |
5800 v8 = *v6; | |
5801 v29 = &pTurnEngine->pQueue[a2]; | |
5802 a2a = v8; | |
920 | 5803 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true); |
5804 if ( actor->pMonsterInfo.uHostilityType && !*v6 ) | |
5805 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
0 | 5806 v9 = Actor::GetDirectionInfo(v7->uPackedID, a2a, &a3, 0); |
920 | 5807 v10 = actor->uActorRadius; |
0 | 5808 memcpy(&a3, v9, sizeof(a3)); |
5809 memcpy(&pDir, &a3, sizeof(pDir)); | |
5810 v11 = a3.uDistance - v10; | |
5811 v28 = a3.uDistance - v10; | |
5812 if ( ((a3.uDistance - v10) & 0x80000000u) != 0 ) | |
5813 { | |
5814 v11 = 0; | |
5815 v28 = 0; | |
5816 } | |
920 | 5817 pHostileType = actor->pMonsterInfo.uHostilityType; |
5818 if ( pHostileType == 1 ) | |
0 | 5819 { |
5820 if ( (double)(signed int)v28 >= 307.2 ) | |
5821 goto LABEL_21; | |
920 | 5822 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
0 | 5823 goto LABEL_21; |
5824 } | |
920 | 5825 if ( pHostileType == 2 ) |
0 | 5826 { |
5827 v14 = __OFSUB__(v11, 1024); | |
5828 v13 = ((v11 - 1024) & 0x80000000u) != 0; | |
5829 } | |
5830 else | |
5831 { | |
920 | 5832 if ( pHostileType != 3 ) |
0 | 5833 goto LABEL_21; |
5834 v14 = __OFSUB__(v11, 2560); | |
5835 v13 = ((v11 - 2560) & 0x80000000u) != 0; | |
5836 } | |
5837 if ( v13 ^ v14 ) | |
920 | 5838 { |
5839 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
5840 } | |
0 | 5841 LABEL_21: |
920 | 5842 if ( (signed __int64)actor->pActorBuffs[4].uExpireTime > 0 ) |
5843 { | |
0 | 5844 if ( (signed int)v11 < 10240 ) |
5845 { | |
1060 | 5846 Actor::AI_Flee(uActorID, a2a, 0, &pDir); |
920 | 5847 v29->field_C = 4; |
5848 v29->uActionLength = actor->uCurrentActionLength; | |
5849 return 1; | |
5850 } | |
1060 | 5851 Actor::AI_4032B2(uActorID, a2a, 1024, 0); |
920 | 5852 v29->field_C = 2; |
5853 v29->uActionLength = actor->uCurrentActionLength; | |
5854 return 1; | |
5855 } | |
5856 if ( actor->pMonsterInfo.uHostilityType != 4 ) | |
0 | 5857 goto LABEL_46; |
920 | 5858 if ( !(actor->uAttributes & 0x020000) || actor->pMonsterInfo.uAIType == 1 ) |
5859 { | |
5860 if ( actor->pMonsterInfo.uAIType == 1 ) | |
5861 { | |
5862 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
5863 { | |
5864 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
5865 v29->field_C = 4; | |
5866 v29->uActionLength = actor->uCurrentActionLength; | |
5867 return 1; | |
5868 } | |
1060 | 5869 Actor::AI_Flee(uActorID, a2a, 32, 0); |
920 | 5870 v29->field_C = 4; |
5871 v29->uActionLength = actor->uCurrentActionLength; | |
5872 return 1; | |
5873 } | |
5874 if ( actor->pMonsterInfo.uAIType == 2 ) | |
5875 { | |
5876 v27 = actor->sCurrentHP; | |
0 | 5877 v18 = (double)v27; |
920 | 5878 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.2; |
0 | 5879 if ( v19 > v18 && (signed int)v11 < 10240 ) |
5880 { | |
920 | 5881 if ( actor->pMonsterInfo.uMovementType == 5 ) |
5882 { | |
5883 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
5884 v29->field_C = 4; | |
5885 v29->uActionLength = actor->uCurrentActionLength; | |
5886 return 1; | |
5887 } | |
1060 | 5888 Actor::AI_Flee(uActorID, a2a, 32, 0); |
0 | 5889 v29->field_C = 4; |
920 | 5890 v29->uActionLength = actor->uCurrentActionLength; |
5891 return 1; | |
5892 } | |
5893 goto LABEL_39; | |
5894 } | |
5895 if ( actor->pMonsterInfo.uAIType == 3 ) | |
5896 { | |
5897 v27 = actor->sCurrentHP; | |
5898 v18 = (double)v27; | |
5899 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.1; | |
5900 if ( v19 > v18 && (signed int)v11 < 10240 ) | |
5901 { | |
5902 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
5903 { | |
5904 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
5905 v29->field_C = 4; | |
5906 v29->uActionLength = actor->uCurrentActionLength; | |
5907 return 1; | |
5908 } | |
1060 | 5909 Actor::AI_Flee(uActorID, a2a, 32, 0); |
920 | 5910 v29->field_C = 4; |
5911 v29->uActionLength = actor->uCurrentActionLength; | |
0 | 5912 return 1; |
5913 } | |
5914 goto LABEL_39; | |
5915 } | |
5916 } | |
5917 LABEL_39: | |
5918 if ( (double)(signed int)v28 < 307.2 ) | |
5919 return 0; | |
5920 if ( (signed int)v11 < 5120 ) | |
5921 { | |
920 | 5922 if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 ) |
1060 | 5923 Actor::AI_Pursue1(uActorID, a2a, uActorID, 32, &pDir); |
0 | 5924 else |
1060 | 5925 Actor::AI_Pursue2(uActorID, a2a, 32, &pDir, 307); |
920 | 5926 v29->field_C = 2; |
5927 v29->uActionLength = actor->uCurrentActionLength; | |
5928 return 1; | |
0 | 5929 } |
5930 LABEL_46: | |
920 | 5931 if ( !actor->pMonsterInfo.uMovementType ) |
5932 { | |
1060 | 5933 Actor::AI_4032B2(uActorID, a2a, 1024, 32); |
920 | 5934 v29->field_C = 2; |
5935 v29->uActionLength = actor->uCurrentActionLength; | |
5936 return 1; | |
5937 } | |
5938 if ( actor->pMonsterInfo.uMovementType == 1 ) | |
5939 { | |
1060 | 5940 Actor::AI_4032B2(uActorID, a2a, 2560, 32); |
0 | 5941 v29->field_C = 2; |
920 | 5942 v29->uActionLength = actor->uCurrentActionLength; |
5943 return 1; | |
5944 } | |
5945 if ( actor->pMonsterInfo.uMovementType == 2 ) | |
5946 { | |
1060 | 5947 Actor::AI_4032B2(uActorID, a2a, 5120, 32); |
920 | 5948 v29->field_C = 2; |
5949 v29->uActionLength = actor->uCurrentActionLength; | |
5950 return 1; | |
5951 } | |
5952 if ( actor->pMonsterInfo.uMovementType == 4 ) | |
0 | 5953 { |
1060 | 5954 Actor::AI_4032B2(uActorID, a2a, 10240, 32); |
0 | 5955 v29->field_C = 2; |
920 | 5956 v29->uActionLength = actor->uCurrentActionLength; |
5957 return 1; | |
5958 } | |
5959 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
5960 { | |
5961 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
5962 v29->field_C = 2; | |
5963 v29->uActionLength = actor->uCurrentActionLength; | |
5964 return 1; | |
0 | 5965 } |
5966 return 1; | |
5967 } | |
5968 | |
5969 //----- (00406FA8) -------------------------------------------------------- | |
5970 void stru262_TurnBased::_406FA8() | |
5971 { | |
5972 unsigned __int8 v1; // zf@1 | |
5973 unsigned __int8 v2; // sf@1 | |
5974 TurnBased_QueueElem *v3; // edi@2 | |
5975 int v4; // eax@4 | |
5976 Actor *v5; // ebx@4 | |
5977 unsigned __int16 v6; // cx@4 | |
5978 unsigned int *v7; // edx@8 | |
5979 unsigned int v8; // esi@8 | |
5980 unsigned __int8 v9; // of@13 | |
5981 AIDirection a3; // [sp+Ch] [bp-6Ch]@8 | |
5982 AIDirection v11; // [sp+28h] [bp-50h]@8 | |
5983 AIDirection a4; // [sp+44h] [bp-34h]@8 | |
5984 stru262_TurnBased *v13; // [sp+60h] [bp-18h]@1 | |
5985 TurnBased_QueueElem *v14; // [sp+64h] [bp-14h]@2 | |
5986 int uActorID; // [sp+68h] [bp-10h]@4 | |
5987 unsigned int a2; // [sp+6Ch] [bp-Ch]@8 | |
5988 int v17; // [sp+70h] [bp-8h]@1 | |
5989 unsigned int v18; // [sp+74h] [bp-4h]@2 | |
5990 | |
5991 v17 = 0; | |
5992 v1 = this->uActorQueueSize == 0; | |
5993 v2 = this->uActorQueueSize < 0; | |
5994 v13 = this; | |
5995 if ( !(v2 | v1) ) | |
5996 { | |
5997 v3 = this->pQueue; | |
5998 v18 = (char *)&pTurnEngine - (char *)this; | |
5999 v14 = this->pQueue; | |
6000 do | |
6001 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6002 if (PID_TYPE(v3->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6003 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6004 v4 = PID_ID(v3->uPackedID); |
0 | 6005 uActorID = v4; |
6006 v5 = &pActors[v4]; | |
6007 v6 = v5->uAIState; | |
6008 if ( v6 != 5 ) | |
6009 { | |
6010 if ( v6 != 11 ) | |
6011 { | |
6012 if ( v6 != 19 ) | |
6013 { | |
6014 if ( v6 != 17 ) | |
6015 { | |
417 | 6016 v7 = (unsigned int *)&ai_near_actors_targets_pid[v4]; |
0 | 6017 a2 = *v7; |
6018 v8 = a2; | |
417 | 6019 Actor::_SelectTarget(v4, (int *)v7, true); |
0 | 6020 memcpy(&v11, Actor::GetDirectionInfo(*(int *)((char *)&v3->uPackedID + v18), v8, &a3, 0), sizeof(v11)); |
6021 memcpy(&a4, &v11, sizeof(a4)); | |
6022 v5->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
6023 if ( (signed int)v5->uCurrentActionTime >= v5->uCurrentActionLength ) | |
6024 { | |
6025 if (v5->uAIState == Dying) | |
6026 { | |
6027 v5->uCurrentActionTime = 0; | |
6028 v5->uCurrentActionLength = 0; | |
6029 v5->uAIState = Dead; | |
6030 v5->UpdateAnimation(); | |
6031 return; | |
6032 } | |
6033 if ( rand() % 2 ) | |
413 | 6034 Actor::AI_Stand(uActorID, a2, 0x40u, &a4); |
0 | 6035 else |
414 | 6036 Actor::AI_Bored(uActorID, a2, &a4); |
0 | 6037 } |
6038 } | |
6039 } | |
6040 } | |
6041 } | |
6042 } | |
6043 ++v17; | |
6044 v3 = v14 + 1; | |
6045 v9 = __OFSUB__(v17, v13->uActorQueueSize); | |
6046 v2 = v17 - v13->uActorQueueSize < 0; | |
6047 ++v14; | |
6048 } | |
6049 while ( v2 ^ v9 ); | |
6050 } | |
6051 } | |
6052 | |
6053 //----- (004070EF) -------------------------------------------------------- | |
6054 bool __fastcall sub_4070EF_prolly_collide_objects(unsigned int uObjID, unsigned int uObj2ID) | |
6055 { | |
6056 signed int v2; // eax@1 | |
6057 unsigned int v3; // ecx@1 | |
6058 signed int v4; // esi@1 | |
6059 int v5; // ecx@2 | |
6060 signed int v6; // eax@4 | |
6061 int v7; // eax@4 | |
6062 float v8; // ST24_4@5 | |
6063 double v9; // ST18_8@5 | |
6064 signed int v10; // eax@6 | |
6065 int v11; // ecx@6 | |
6066 signed int v12; // eax@7 | |
6067 int v13; // esi@7 | |
6068 int v14; // esi@8 | |
6069 int v15; // esi@9 | |
6070 signed int v16; // eax@11 | |
6071 int v17; // edi@11 | |
6072 int v18; // esi@11 | |
6073 int v19; // eax@13 | |
6074 float v20; // ST24_4@14 | |
6075 double v21; // ST18_8@14 | |
6076 signed int v22; // eax@15 | |
6077 int v23; // ebx@16 | |
6078 signed int v24; // ecx@16 | |
6079 int v25; // eax@18 | |
6080 int v26; // eax@28 | |
6081 BLVSector *v27; // edx@31 | |
6082 int v28; // ecx@31 | |
6083 BLVFace *v29; // ebx@32 | |
6084 Vec3_short_ *v30; // esi@32 | |
6085 int v31; // eax@32 | |
6086 int v32; // ST50_4@44 | |
6087 int v33; // ST54_4@44 | |
6088 int v34; // eax@44 | |
6089 char v35; // zf@44 | |
6090 int v36; // edi@44 | |
6091 int v37; // eax@45 | |
6092 signed int v38; // esi@45 | |
6093 int v39; // ST4C_4@49 | |
6094 signed __int64 v40; // qtt@50 | |
6095 __int16 v42; // bx@58 | |
6096 int v43; // [sp-8h] [bp-70h]@11 | |
6097 int v44; // [sp-4h] [bp-6Ch]@11 | |
6098 int v45; // [sp+Ch] [bp-5Ch]@32 | |
6099 __int16 v46; // [sp+10h] [bp-58h]@32 | |
6100 int v47; // [sp+18h] [bp-50h]@20 | |
6101 int v48; // [sp+1Ch] [bp-4Ch]@20 | |
6102 int v49; // [sp+20h] [bp-48h]@20 | |
6103 int v50; // [sp+24h] [bp-44h]@16 | |
6104 signed int v51; // [sp+24h] [bp-44h]@27 | |
6105 signed int v52; // [sp+28h] [bp-40h]@26 | |
6106 signed int v53; // [sp+2Ch] [bp-3Ch]@23 | |
6107 signed int v54; // [sp+30h] [bp-38h]@22 | |
6108 signed int v55; // [sp+34h] [bp-34h]@21 | |
6109 signed int v56; // [sp+38h] [bp-30h]@20 | |
6110 signed int v57; // [sp+3Ch] [bp-2Ch]@28 | |
6111 int v58; // [sp+44h] [bp-24h]@50 | |
6112 int v59; // [sp+48h] [bp-20h]@44 | |
6113 int v60; // [sp+50h] [bp-18h]@11 | |
6114 signed int v61; // [sp+50h] [bp-18h]@31 | |
6115 int v62; // [sp+54h] [bp-14h]@16 | |
6116 int v63; // [sp+58h] [bp-10h]@4 | |
6117 int v64; // [sp+5Ch] [bp-Ch]@4 | |
6118 int v65; // [sp+60h] [bp-8h]@4 | |
6119 int v66; // [sp+64h] [bp-4h]@7 | |
6120 | |
848 | 6121 v2 = PID_ID(uObjID); |
6122 v3 = PID_TYPE(uObjID) - 2; | |
0 | 6123 v4 = uObj2ID; |
6124 if ( v3 ) | |
6125 { | |
6126 v5 = v3 - 1; | |
6127 if ( v5 ) | |
6128 { | |
6129 if ( v5 != 2 ) | |
6130 return 0; | |
6131 v6 = v2; | |
6132 v63 = pLevelDecorations[v6].vPosition.x; | |
6133 v64 = pLevelDecorations[v6].vPosition.y; | |
6134 v65 = pLevelDecorations[v6].vPosition.z; | |
6135 v7 = pIndoor->GetSector(v63, v64, v65); | |
6136 } | |
6137 else | |
6138 { | |
6139 v63 = pActors[v2].vPosition.x; | |
6140 v64 = pActors[v2].vPosition.y; | |
6141 v8 = (double)pActors[v2].uActorHeight * 0.69999999; | |
6142 v9 = v8 + 6.7553994e15; | |
6143 v65 = LODWORD(v9) + pActors[v2].vPosition.z; | |
6144 v7 = pActors[v2].uSectorID; | |
6145 } | |
6146 } | |
6147 else | |
6148 { | |
6149 v10 = v2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
6150 v63 = pSpriteObjects[v10].vPosition.x; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
6151 v64 = pSpriteObjects[v10].vPosition.y; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
6152 v11 = pSpriteObjects[v10].vPosition.z; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
6153 v7 = pSpriteObjects[v10].uSectorID; |
0 | 6154 v65 = v11; |
6155 } | |
6156 v66 = v7; | |
848 | 6157 v12 = PID_ID(v4); |
6158 v13 = PID_TYPE(v4) - 2; | |
0 | 6159 if ( v13 ) |
6160 { | |
6161 v14 = v13 - 1; | |
6162 if ( v14 ) | |
6163 { | |
6164 v15 = v14 - 1; | |
6165 if ( v15 ) | |
6166 { | |
6167 if ( v15 != 1 ) | |
6168 return 0; | |
6169 v16 = v12; | |
6170 v17 = pLevelDecorations[v16].vPosition.z; | |
6171 v18 = pLevelDecorations[v16].vPosition.x; | |
6172 v44 = pLevelDecorations[v16].vPosition.z; | |
6173 v60 = pLevelDecorations[v16].vPosition.y; | |
6174 v43 = pLevelDecorations[v16].vPosition.y; | |
6175 } | |
6176 else | |
6177 { | |
6178 v18 = pParty->vPosition.x; | |
6179 v17 = pParty->sEyelevel + pParty->vPosition.z; | |
6180 v60 = pParty->vPosition.y; | |
6181 v44 = pParty->sEyelevel + pParty->vPosition.z; | |
6182 v43 = pParty->vPosition.y; | |
6183 } | |
6184 v19 = pIndoor->GetSector(v18, v43, v44); | |
6185 } | |
6186 else | |
6187 { | |
6188 v60 = pActors[v12].vPosition.y; | |
6189 v18 = pActors[v12].vPosition.x; | |
6190 v20 = (double)pActors[v12].uActorHeight * 0.69999999; | |
6191 v21 = v20 + 6.7553994e15; | |
6192 v17 = LODWORD(v21) + pActors[v12].vPosition.z; | |
6193 v19 = pActors[v12].uSectorID; | |
6194 } | |
6195 } | |
6196 else | |
6197 { | |
6198 v22 = v12; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
6199 v18 = pSpriteObjects[v22].vPosition.x; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
6200 v17 = pSpriteObjects[v22].vPosition.z; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
6201 v60 = pSpriteObjects[v22].vPosition.y; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
6202 v19 = pSpriteObjects[v22].uSectorID; |
0 | 6203 } |
6204 v62 = v19; | |
6205 v23 = v18 - v63; | |
6206 v50 = v17 - v65; | |
295 | 6207 v24 = integer_sqrt(v23 * v23 + (v60 - v64) * (v60 - v64) + v50 * v50); |
0 | 6208 if ( v24 > 5120 ) |
6209 return 0; | |
6210 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
6211 return 1; | |
6212 v25 = 65536; | |
6213 if ( v24 ) | |
6214 v25 = 65536 / v24; | |
6215 v49 = v23 * v25; | |
6216 v47 = v50 * v25; | |
6217 v48 = (v60 - v64) * v25; | |
6218 v56 = v63; | |
6219 if ( v63 < v18 ) | |
6220 { | |
6221 v55 = v18; | |
6222 } | |
6223 else | |
6224 { | |
6225 v56 = v18; | |
6226 v55 = v63; | |
6227 } | |
6228 v54 = v64; | |
6229 if ( v64 < v60 ) | |
6230 { | |
6231 v53 = v60; | |
6232 } | |
6233 else | |
6234 { | |
6235 v54 = v60; | |
6236 v53 = v64; | |
6237 } | |
6238 v52 = v65; | |
6239 if ( v65 < v17 ) | |
6240 { | |
6241 v51 = v17; | |
6242 } | |
6243 else | |
6244 { | |
6245 v52 = v17; | |
6246 v51 = v65; | |
6247 } | |
6248 v57 = 0; | |
6249 v26 = v66; | |
6250 while ( 2 ) | |
6251 { | |
6252 if ( v26 == v62 ) | |
6253 return 1; | |
6254 if ( v57 >= 30 || (v27 = pIndoor->pSectors, v28 = v66, v61 = 0, pIndoor->pSectors[v66].uNumPortals <= 0) ) | |
6255 break; | |
6256 while ( 1 ) | |
6257 { | |
6258 v29 = &pIndoor->pFaces[v27[v28].pPortals[v61]]; | |
6259 v30 = &pIndoor->pVertices[*v29->pVertexIDs]; | |
6260 v45 = *(int *)&v30->x; | |
6261 v46 = v30->z; | |
6262 v31 = v29->pFacePlane_old.vNormal.z * (v46 - v65) | |
6263 + v29->pFacePlane_old.vNormal.y * (SHIWORD(v45) - v64) | |
6264 + v29->pFacePlane_old.vNormal.x * ((signed __int16)v45 - v63); | |
6265 if ( v66 != v29->uSectorID ) | |
6266 v31 = -v31; | |
6267 if ( v31 >= 0 && (signed __int16)v45 != v63 && SHIWORD(v45) != v64 && v46 != v65 | |
6268 || v56 > v29->pBounding.x2 | |
6269 || v55 < v29->pBounding.x1 | |
6270 || v54 > v29->pBounding.y2 | |
6271 || v53 < v29->pBounding.y1 | |
6272 || v52 > v29->pBounding.z2 | |
6273 || v51 < v29->pBounding.z1 ) | |
6274 goto LABEL_54; | |
6275 v32 = (unsigned __int64)(v49 * (signed __int64)v29->pFacePlane_old.vNormal.x) >> 16; | |
6276 v33 = (unsigned __int64)(v47 * (signed __int64)v29->pFacePlane_old.vNormal.z) >> 16; | |
6277 v34 = (unsigned __int64)(v48 * (signed __int64)v29->pFacePlane_old.vNormal.y) >> 16; | |
6278 v35 = v32 + v33 + v34 == 0; | |
6279 v36 = v32 + v33 + v34; | |
6280 v59 = v32 + v33 + v34; | |
6281 if ( v35 ) | |
6282 goto LABEL_53; | |
6283 v37 = v65 * v29->pFacePlane_old.vNormal.z; | |
6284 v38 = -(v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y); | |
6285 if ( v36 <= 0 ) | |
6286 break; | |
6287 if ( v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y <= 0 ) | |
6288 goto LABEL_49; | |
6289 LABEL_53: | |
6290 v27 = pIndoor->pSectors; | |
6291 LABEL_54: | |
6292 ++v61; | |
6293 if ( v61 >= v27[v28].uNumPortals ) | |
6294 goto LABEL_55; | |
6295 } | |
6296 if ( v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y < 0 ) | |
6297 goto LABEL_53; | |
6298 LABEL_49: | |
6299 v39 = abs(-(v29->pFacePlane_old.dist | |
6300 + v37 | |
6301 + v63 * v29->pFacePlane_old.vNormal.x | |
6302 + v64 * v29->pFacePlane_old.vNormal.y)) >> 14; | |
6303 if ( v39 > abs(v36) | |
6304 || (LODWORD(v40) = v38 << 16, HIDWORD(v40) = v38 >> 16, v58 = v40 / v59, (signed int)(v40 / v59) < 0) | |
6305 || !sub_4075DB( | |
6306 v63 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v49) >> 16) + 32768) >> 16), | |
6307 v64 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v48) >> 16) + 32768) >> 16), | |
6308 v65 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v47) >> 16) + 32768) >> 16), | |
6309 v29) ) | |
6310 { | |
6311 v28 = v66; | |
6312 goto LABEL_53; | |
6313 } | |
6314 if ( v29->uSectorID == v66 ) | |
6315 v42 = v29->uBackSectorID; | |
6316 else | |
6317 v42 = v29->uSectorID; | |
6318 v26 = v42; | |
6319 if ( v42 != v66 ) | |
6320 { | |
6321 ++v57; | |
6322 v66 = v42; | |
6323 continue; | |
6324 } | |
6325 break; | |
6326 } | |
6327 LABEL_55: | |
6328 if ( v66 != v62 ) | |
6329 return 0; | |
6330 return 1; | |
6331 } | |
6332 | |
6333 //----- (004075DB) -------------------------------------------------------- | |
6334 bool __fastcall sub_4075DB(int a1, int a2, int a3, BLVFace *a4) | |
6335 { | |
6336 BLVFace *v4; // eax@1 | |
6337 unsigned int v5; // esi@1 | |
6338 signed int v6; // esi@2 | |
6339 char v7; // zf@2 | |
6340 int v8; // edi@2 | |
6341 Vec3_short_ *v9; // ecx@3 | |
6342 int v10; // edx@4 | |
6343 signed int v11; // esi@7 | |
6344 Vec3_short_ *v12; // ecx@8 | |
6345 int v13; // edx@9 | |
6346 signed int v14; // esi@11 | |
6347 Vec3_short_ *v15; // ecx@12 | |
6348 int v16; // edx@13 | |
6349 int v17; // eax@14 | |
6350 bool v18; // esi@14 | |
6351 int v19; // ecx@14 | |
6352 int v20; // ecx@16 | |
6353 int v21; // edx@16 | |
6354 int v22; // eax@17 | |
6355 signed int v23; // ebx@18 | |
6356 int v24; // esi@20 | |
6357 signed int v25; // eax@22 | |
6358 signed __int64 v26; // qtt@22 | |
6359 bool result; // eax@25 | |
6360 int v28; // [sp+8h] [bp-14h]@14 | |
6361 int v29; // [sp+10h] [bp-Ch]@14 | |
6362 signed int a3a; // [sp+24h] [bp+8h]@14 | |
6363 int a4a; // [sp+28h] [bp+Ch]@2 | |
6364 | |
6365 v4 = a4; | |
6366 v5 = a4->uAttributes; | |
6367 if ( v5 & 0x100 ) | |
6368 { | |
6369 v6 = 0; | |
6370 v7 = a4->uNumVertices == 0; | |
6371 a4a = a1; | |
6372 v8 = a2; | |
6373 if ( !v7 ) | |
6374 { | |
6375 v9 = pIndoor->pVertices; | |
6376 do | |
6377 { | |
6378 dword_4F5D98_xs[v6] = v9[v4->pVertexIDs[v6]].x; | |
6379 v10 = v4->pVertexIDs[v6++]; | |
6380 dword_4F5CC4_ys[v6] = v9[v10].y; | |
6381 } | |
6382 while ( v6 < v4->uNumVertices ); | |
6383 } | |
6384 } | |
6385 else | |
6386 { | |
6387 v8 = a3; | |
6388 if ( v5 & 0x200 ) | |
6389 { | |
6390 v11 = 0; | |
6391 v7 = a4->uNumVertices == 0; | |
6392 a4a = a1; | |
6393 if ( !v7 ) | |
6394 { | |
6395 v12 = pIndoor->pVertices; | |
6396 do | |
6397 { | |
6398 dword_4F5D98_xs[v11] = v12[v4->pVertexIDs[v11]].x; | |
6399 v13 = v4->pVertexIDs[v11++]; | |
6400 dword_4F5CC4_ys[v11] = v12[v13].z; | |
6401 } | |
6402 while ( v11 < v4->uNumVertices ); | |
6403 } | |
6404 } | |
6405 else | |
6406 { | |
6407 v14 = 0; | |
6408 v7 = a4->uNumVertices == 0; | |
6409 a4a = a2; | |
6410 if ( !v7 ) | |
6411 { | |
6412 v15 = pIndoor->pVertices; | |
6413 do | |
6414 { | |
6415 dword_4F5D98_xs[v14] = v15[v4->pVertexIDs[v14]].y; | |
6416 v16 = v4->pVertexIDs[v14++]; | |
6417 dword_4F5CC4_ys[v14] = v15[v16].z; | |
6418 } | |
6419 while ( v14 < v4->uNumVertices ); | |
6420 } | |
6421 } | |
6422 } | |
6423 v17 = v4->uNumVertices; | |
6424 a3a = 0; | |
6425 dword_4F5D98_xs[v17] = dword_4F5D98_xs[0]; | |
6426 dword_4F5CC4_ys[v17 + 1] = dword_4F5CC4_ys[1]; | |
6427 v28 = v17; | |
6428 v18 = dword_4F5CC4_ys[1] >= v8; | |
6429 v19 = 0; | |
6430 v29 = 0; | |
6431 if ( v17 <= 0 ) | |
6432 goto LABEL_29; | |
6433 do | |
6434 { | |
6435 if ( a3a >= 2 ) | |
6436 break; | |
6437 v20 = v19; | |
6438 v21 = dword_4F5CC4_ys[v20 + 2]; | |
1110 | 6439 if ( v18 ^ (v21 >= v8) ) |
0 | 6440 { |
6441 v22 = dword_4F5D98_xs[v20 + 1]; | |
6442 if ( v22 >= a4a ) | |
6443 v23 = 0; | |
6444 else | |
6445 v23 = 2; | |
1110 | 6446 v24 = v23 | (dword_4F5D98_xs[v20] < a4a); |
0 | 6447 if ( v24 != 3 ) |
6448 { | |
6449 if ( !v24 | |
6450 || (v25 = v22 - dword_4F5D98_xs[v20], | |
6451 LODWORD(v26) = v25 << 16, | |
6452 HIDWORD(v26) = v25 >> 16, | |
6453 dword_4F5D98_xs[v20] | |
6454 + ((signed int)(((unsigned __int64)(v26 | |
6455 / (v21 - dword_4F5CC4_ys[v20 + 1]) | |
6456 * ((v8 - dword_4F5CC4_ys[v20 + 1]) << 16)) >> 16) | |
6457 + 32768) >> 16) >= a4a) ) | |
6458 ++a3a; | |
6459 } | |
6460 } | |
6461 v18 = v21 >= v8; | |
6462 v19 = v29++ + 1; | |
6463 } | |
6464 while ( v29 < v28 ); | |
6465 result = 1; | |
6466 if ( a3a != 1 ) | |
6467 LABEL_29: | |
6468 result = 0; | |
6469 return result; | |
6470 } | |
6471 | |
6472 //----- (004077F1) -------------------------------------------------------- | |
6473 bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *a4, BSPVertexBuffer *a5) | |
6474 { | |
6475 ODMFace *v5; // eax@1 | |
6476 unsigned int v6; // esi@1 | |
6477 signed int v7; // edi@1 | |
6478 char v8; // zf@2 | |
6479 unsigned __int16 *v9; // edx@3 | |
6480 int v10; // ecx@4 | |
6481 unsigned __int16 *v11; // edx@8 | |
6482 int v12; // ecx@9 | |
6483 int v13; // edx@12 | |
6484 int v14; // ecx@13 | |
6485 int v15; // esi@14 | |
6486 bool v16; // edi@14 | |
6487 int v17; // ecx@16 | |
6488 int v18; // edx@16 | |
6489 int v19; // eax@17 | |
6490 signed int v20; // ebx@18 | |
6491 int v21; // edi@20 | |
6492 signed int v22; // eax@22 | |
6493 signed __int64 v23; // qtt@22 | |
6494 bool result; // eax@25 | |
6495 int v25; // [sp+14h] [bp-8h]@14 | |
6496 int a4a; // [sp+28h] [bp+Ch]@2 | |
6497 signed int a5a; // [sp+2Ch] [bp+10h]@14 | |
6498 | |
6499 v5 = a4; | |
6500 v6 = a4->uAttributes; | |
6501 v7 = 0; | |
6502 if ( v6 & 0x100 ) | |
6503 { | |
6504 v8 = a4->uNumVertices == 0; | |
6505 a4a = a1; | |
6506 a3 = a2; | |
6507 if ( !v8 ) | |
6508 { | |
6509 v9 = v5->pVertexIDs; | |
6510 do | |
6511 { | |
6512 ++v7; | |
6513 dword_4F5BF4_xs[v7] = a5->pVertices[*v9].x; | |
6514 v10 = *v9; | |
6515 ++v9; | |
6516 dword_4F5B24_ys[v7] = a5->pVertices[v10].y; | |
6517 } | |
6518 while ( v7 < v5->uNumVertices ); | |
6519 } | |
6520 } | |
6521 else | |
6522 { | |
6523 if ( v6 & 0x200 ) | |
6524 { | |
6525 v8 = a4->uNumVertices == 0; | |
6526 a4a = a1; | |
6527 if ( !v8 ) | |
6528 { | |
6529 v11 = v5->pVertexIDs; | |
6530 do | |
6531 { | |
6532 ++v7; | |
6533 dword_4F5BF4_xs[v7] = a5->pVertices[*v11].x; | |
6534 v12 = *v11; | |
6535 ++v11; | |
6536 dword_4F5B24_ys[v7] = a5->pVertices[v12].z; | |
6537 } | |
6538 while ( v7 < v5->uNumVertices ); | |
6539 } | |
6540 } | |
6541 else | |
6542 { | |
6543 v8 = a4->uNumVertices == 0; | |
6544 a4a = a2; | |
6545 if ( !v8 ) | |
6546 { | |
6547 v13 = (int)v5->pVertexIDs; | |
6548 do | |
6549 { | |
6550 ++v7; | |
6551 dword_4F5BF4_xs[v7] = a5->pVertices[*(short *)v13].y; | |
6552 v14 = *(short *)v13; | |
6553 v13 += 2; | |
6554 dword_4F5B24_ys[v7] = a5->pVertices[v14].z; | |
6555 } | |
6556 while ( v7 < v5->uNumVertices ); | |
6557 } | |
6558 } | |
6559 } | |
6560 v15 = v5->uNumVertices; | |
6561 a5a = 0; | |
6562 dword_4F5BF4_xs[v15 + 1] = dword_4F5BF4_xs[1]; | |
6563 dword_4F5B24_ys[v15 + 1] = dword_4F5B24_ys[1]; | |
6564 v25 = 0; | |
6565 v16 = dword_4F5B24_ys[1] >= a3; | |
6566 if ( v15 <= 0 ) | |
6567 goto LABEL_29; | |
6568 do | |
6569 { | |
6570 if ( a5a >= 2 ) | |
6571 break; | |
6572 v17 = v25; | |
6573 v18 = dword_4F5B24_ys[v25 + 2]; | |
1110 | 6574 if ( v16 ^ (v18 >= a3) ) |
0 | 6575 { |
6576 v19 = dword_4F5BF4_xs[v17 + 2]; | |
6577 if ( v19 >= a4a ) | |
6578 v20 = 0; | |
6579 else | |
6580 v20 = 2; | |
1110 | 6581 v21 = v20 | (dword_4F5BF4_xs[v17 + 1] < a4a); |
0 | 6582 if ( v21 != 3 ) |
6583 { | |
6584 if ( !v21 | |
6585 || (v22 = v19 - dword_4F5BF4_xs[v17 + 1], | |
6586 LODWORD(v23) = v22 << 16, | |
6587 HIDWORD(v23) = v22 >> 16, | |
6588 dword_4F5BF4_xs[v17 + 1] | |
6589 + ((signed int)(((unsigned __int64)(v23 | |
6590 / (v18 - dword_4F5B24_ys[v17 + 1]) | |
6591 * ((a3 - dword_4F5B24_ys[v17 + 1]) << 16)) >> 16) | |
6592 + 32768) >> 16) >= a4a) ) | |
6593 ++a5a; | |
6594 } | |
6595 } | |
6596 ++v25; | |
6597 v16 = v18 >= a3; | |
6598 } | |
6599 while ( v25 < v15 ); | |
6600 result = 1; | |
6601 if ( a5a != 1 ) | |
6602 LABEL_29: | |
6603 result = 0; | |
6604 return result; | |
6605 } | |
6606 | |
6607 //----- (004088E9) -------------------------------------------------------- | |
6608 signed int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6) | |
6609 { | |
6610 int v6; // esi@1 | |
6611 int v7; // edi@1 | |
6612 int v8; // eax@1 | |
6613 signed int result; // eax@1 | |
6614 int v10; // [sp+Ch] [bp-4h]@1 | |
6615 int v11; // [sp+18h] [bp+8h]@1 | |
6616 | |
6617 v6 = a1; | |
6618 v10 = a2; | |
6619 v7 = a3 - a1; | |
6620 v11 = abs(a3 - a1); | |
6621 v8 = abs(a4 - v10); | |
295 | 6622 result = integer_sqrt(v11 * v11 + v8 * v8); |
0 | 6623 if ( result ) |
6624 result = abs((v7 * (v10 - a6) - (a4 - v10) * (v6 - a5)) / result); | |
6625 return result; | |
6626 } | |
6627 | |
6628 //----- (0040DEDB) -------------------------------------------------------- | |
6629 unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor) | |
6630 { | |
949 | 6631 return TargetColor((unsigned __int8)uColor, BYTE1(uColor), BYTE2(uColor)); |
0 | 6632 } |
6633 | |
6634 //----- (0040DEF3) -------------------------------------------------------- | |
949 | 6635 unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b ) |
983 | 6636 { |
688 | 6637 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) + |
6638 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) + | |
6639 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); | |
0 | 6640 } |
6641 | |
6642 //----- (0040DFA7) -------------------------------------------------------- | |
6643 int __stdcall retzero_sub_40DFA7(int a1) | |
6644 { | |
6645 return 0; | |
6646 } | |
6647 // 40DFA7: using guessed type int __stdcall retzero_sub_40DFA7(int); | |
6648 | |
1184 | 6649 |
0 | 6650 |
6651 //----- (0040F82D) -------------------------------------------------------- | |
6652 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) | |
6653 { | |
973 | 6654 assert(uTextureId != -1); |
6655 ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue); | |
0 | 6656 } |
6657 | |
1160 | 6658 |
0 | 6659 |
6660 //----- (0040F89C) -------------------------------------------------------- | |
6661 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue) | |
6662 { | |
6663 void *v3; // eax@3 | |
6664 void *v4; // esi@5 | |
6665 int *v5; // edi@5 | |
6666 int v6; // eax@5 | |
6667 int v7; // ecx@6 | |
6668 Texture *v8; // [sp+Ch] [bp-14h]@1 | |
6669 int *v9; // [sp+10h] [bp-10h]@1 | |
6670 int v10; // [sp+14h] [bp-Ch]@1 | |
6671 int v11; // [sp+18h] [bp-8h]@1 | |
6672 void *v12; // [sp+1Ch] [bp-4h]@5 | |
6673 | |
6674 v10 = pTex->uTextureWidth; | |
6675 v8 = pTex; | |
6676 v9 = pZBuffer; | |
6677 v11 = pTex->uTextureHeight; | |
6678 if ( pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize ) | |
6679 v3 = pTex->UnzipPalette(); | |
6680 else | |
710 | 6681 v3 = pTex->pLevelOfDetail0_prolly_alpha_mask; |
0 | 6682 v12 = v3; |
6683 v4 = v3; | |
6684 v5 = v9; | |
6685 v6 = 0; | |
6686 do | |
6687 { | |
6688 v7 = v10; | |
6689 do | |
6690 { | |
6691 LOBYTE(v6) = *(char *)v4; | |
6692 v4 = (char *)v4 + 1; | |
6693 if ( v6 ) | |
6694 *v5 = uZValue; | |
6695 ++v5; | |
6696 --v7; | |
6697 } | |
6698 while ( v7 ); | |
6699 v5 += 640 - v10; | |
6700 --v11; | |
6701 } | |
6702 while ( v11 ); | |
6703 if ( pIcons_LOD->dword_011BA4 ) | |
6704 { | |
6705 if ( v8->uDecompressedSize ) | |
6706 free(v12); | |
6707 } | |
6708 } | |
6709 | |
6710 //----- (0040F92A) -------------------------------------------------------- | |
6711 void __fastcall sub_40F92A(int *pZBuffer, Texture *a2, int a3) | |
6712 { | |
6713 Texture *v3; // esi@1 | |
6714 void *v4; // eax@3 | |
6715 int *v5; // edi@5 | |
6716 int v6; // ecx@6 | |
6717 int *v7; // [sp+Ch] [bp-10h]@1 | |
6718 int v8; // [sp+10h] [bp-Ch]@1 | |
6719 int v9; // [sp+18h] [bp-4h]@1 | |
6720 | |
6721 v3 = a2; | |
6722 v7 = pZBuffer; | |
6723 v8 = a2->uTextureWidth; | |
6724 v9 = a2->uTextureHeight; | |
6725 if ( pIcons_LOD->dword_011BA4 && a2->uDecompressedSize ) | |
6726 v4 = a2->UnzipPalette(); | |
6727 else | |
710 | 6728 v4 = a2->pLevelOfDetail0_prolly_alpha_mask; |
0 | 6729 v5 = v7; |
6730 do | |
6731 { | |
6732 v6 = v8; | |
6733 do | |
6734 { | |
6735 *v5 = a3; | |
6736 ++v5; | |
6737 --v6; | |
6738 } | |
6739 while ( v6 ); | |
6740 v5 += 640 - v8; | |
6741 --v9; | |
6742 } | |
6743 while ( v9 ); | |
6744 if ( pIcons_LOD->dword_011BA4 ) | |
6745 { | |
6746 if ( v3->uDecompressedSize ) | |
6747 free(v4); | |
6748 } | |
6749 } | |
6750 | |
6751 //----- (00410D99) -------------------------------------------------------- | |
6752 signed int __fastcall sub_410D99_get_map_index(int a1) | |
6753 { | |
6754 int v1; // edi@1 | |
6755 signed int v2; // ebp@1 | |
6756 const char **v3; // esi@2 | |
6757 char *v4; // ebx@2 | |
6758 | |
6759 v1 = a1; | |
6760 v2 = 1; | |
1104 | 6761 if ( _stricmp(pMapStats->pInfos[1].pFilename, (const char *)&pGames_LOD->pSubIndices[a1]) ) |
0 | 6762 { |
6763 v3 = (const char **)&pMapStats->pInfos[1].pFilename; | |
6764 v4 = (char *)&pMapStats->pInfos[1].pFilename; | |
6765 do | |
6766 { | |
6767 if ( !*(int *)v4 ) | |
6768 break; | |
6769 v3 += 17; | |
6770 ++v2; | |
6771 v4 = (char *)v3; | |
6772 } | |
1104 | 6773 while ( _stricmp(*v3, (const char *)&pGames_LOD->pSubIndices[v1]) ); |
0 | 6774 } |
6775 return v2; | |
6776 } | |
6777 | |
6778 // 4E28F8: using guessed type int pCurrentScreen; | |
6779 | |
762 | 6780 void LoadFonts_and_DrawCopyrightWindow() |
6781 { | |
6782 MainMenuUI_LoadFontsAndSomeStuff(); | |
6783 DrawCopyrightWindow(); | |
6784 } | |
0 | 6785 |
6786 | |
6787 //----- (00416196) -------------------------------------------------------- | |
1033 | 6788 void identify_item() |
0 | 6789 { |
6790 Player *v0; // esi@2 | |
6791 POINT *v1; // edi@2 | |
6792 signed int v2; // ecx@5 | |
6793 signed int v3; // eax@5 | |
6794 int v4; // eax@5 | |
6795 char v5; // sf@5 | |
6796 int v6; // eax@5 | |
6797 int v7; // eax@7 | |
6798 unsigned __int16 v8; // ax@10 | |
6799 int v9; // edi@10 | |
6800 int v10; // eax@10 | |
6801 int v11; // edx@13 | |
6802 LONG v12; // edx@23 | |
6803 signed int v13; // edx@23 | |
6804 int v14; // edx@25 | |
6805 unsigned int v15; // edi@25 | |
6806 signed int v16; // edx@27 | |
6807 int v17; // eax@54 | |
6808 unsigned int v18; // edx@57 | |
6809 int v19; // eax@65 | |
6810 int v20; // edi@67 | |
6811 int v21; // eax@72 | |
6812 int v22; // ecx@74 | |
6813 int v23; // edx@78 | |
6814 int v24; // eax@79 | |
6815 int v25; // eax@80 | |
6816 int v26; // eax@84 | |
6817 ItemGen *v27; // esi@98 | |
6818 unsigned int v28; // eax@98 | |
6819 ItemGen *v29; // edi@98 | |
6820 unsigned int v30; // ecx@103 | |
6821 double v31; // st7@112 | |
6822 unsigned __int64 v32; // qax@113 | |
6823 unsigned int v33; // ecx@117 | |
6824 int v34; // eax@126 | |
6825 unsigned int v35; // ecx@127 | |
6826 double v36; // st7@132 | |
6827 signed __int64 v37; // qax@135 | |
6828 unsigned int v38; // eax@138 | |
6829 Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 | |
6830 int *v40; // [sp-Ch] [bp-9Ch]@83 | |
6831 int *v41; // [sp-8h] [bp-98h]@83 | |
6832 int *v42; // [sp-4h] [bp-94h]@83 | |
6833 GUIWindow v43; // [sp+Ch] [bp-84h]@137 | |
6834 unsigned int pY; // [sp+60h] [bp-30h]@2 | |
6835 int v45; // [sp+64h] [bp-2Ch]@10 | |
6836 unsigned int pX; // [sp+68h] [bp-28h]@2 | |
6837 int v47; // [sp+6Ch] [bp-24h]@25 | |
6838 POINT y; // [sp+70h] [bp-20h]@2 | |
6839 POINT a2; // [sp+78h] [bp-18h]@2 | |
6840 Vec3_int_ pOut; // [sp+80h] [bp-10h]@2 | |
6841 unsigned int v51; // [sp+8Ch] [bp-4h]@23 | |
6842 | |
6843 if ( dword_50CDCC ) | |
6844 return; | |
6845 v0 = pPlayers[uActiveCharacter]; | |
6846 v1 = pMouse->GetCursorPos(&a2); | |
6847 pOut.z = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&y)->y]] & 0xFFFF; | |
6848 pMouse->GetClickPos(&pX, &pY); | |
6849 if ( !pOut.z ) | |
6850 { | |
6851 if ( (signed int)pX <= 13 | |
6852 || (signed int)pX >= 462 | |
6853 || (v2 = pX - 14, | |
6854 v3 = pY - 17, | |
6855 pX = v2, | |
6856 pY = v3, | |
6857 v4 = 14 * (v3 >> 5), | |
6858 v2 >>= 5, | |
6859 v5 = v2 + v4 < 0, | |
6860 v6 = v2 + v4, | |
6861 pOut.z = v6, | |
6862 v5) | |
6863 || v6 > 126 | |
6864 || (v7 = v0->GetItemIDAtInventoryIndex(&pOut.z)) == 0 ) | |
6865 return; | |
6866 pOut.z = v7; | |
6867 } | |
6868 if ( !v0->CanAct() ) | |
6869 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6870 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[427], v0->pName, pGlobalTXT_LocalizationStrings[541]); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
6871 v43.Hint = pTmpBuf.data(); |
0 | 6872 v43.uFrameWidth = 384; |
6873 v43.uFrameHeight = 180; | |
6874 v43.uFrameY = 40; | |
6875 if ( pMouse->GetCursorPos(&a2)->x <= 320 ) | |
6876 v38 = pMouse->GetCursorPos(&a2)->x + 30; | |
6877 else | |
6878 v38 = pMouse->GetCursorPos(&a2)->x - 414; | |
6879 v43.uFrameX = v38; | |
6880 v43.DrawMessageBox(0); | |
6881 return; | |
6882 } | |
6883 --pOut.z; | |
6884 LOBYTE(v8) = v0->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY); | |
6885 v9 = v8 & 0x3F; | |
6886 v45 = v8 & 0x3F; | |
6887 pOut.y = SkillToMastery(v8); | |
6888 v10 = pOut.z; | |
6889 if ( pParty->pPickedItem.uItemID == 220 ) | |
6890 { | |
6891 LABEL_116: | |
6892 GameUI_DrawItemInfo(&v0->pInventoryItems[v10]); | |
6893 return; | |
6894 } | |
6895 if ( (signed int)pParty->pPickedItem.uItemID < 200 | |
6896 || (signed int)pParty->pPickedItem.uItemID > 219 | |
6897 || (v11 = (int)((char *)v0 + 36 * pOut.z), *(int *)(v11 + 532) != 220) ) | |
6898 { | |
6899 if ( (signed int)pParty->pPickedItem.uItemID < 221 | |
6900 || (signed int)pParty->pPickedItem.uItemID > 271 | |
6901 || (v12 = (LONG)((char *)v0 + 36 * pOut.z), a2.y = v12, v13 = *(int *)(v12 + 532), v51 = v13, v13 < 221) | |
6902 || v13 > 271 ) | |
6903 { | |
6904 if ( pParty->pPickedItem.uItemID != 236 | |
6905 && ((signed int)pParty->pPickedItem.uItemID < 246 || (signed int)pParty->pPickedItem.uItemID > 250) | |
6906 && pParty->pPickedItem.uItemID != 263 | |
6907 && pParty->pPickedItem.uItemID != 233 ) | |
6908 goto LABEL_116; | |
6909 v27 = &v0->pInventoryItems[pOut.z]; | |
6910 v28 = v27->uItemID; | |
6911 v51 = pItemsTable->pItems[v27->uItemID].uEquipType; | |
570 | 6912 v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEnchantmentType); |
0 | 6913 if ( pParty->pPickedItem.uItemID != 233 ) |
6914 { | |
6915 if ( pParty->pPickedItem.uItemID == 236 ) | |
6916 { | |
6917 v35 = v27->uAttributes; | |
6918 if ( v35 & 2 || (v51 & 0x80000000u) != 0 || (signed int)v51 > 12 || (signed int)v28 >= 500 ) | |
6919 goto LABEL_92; | |
6920 LOWORD(v35) = v35 | 0x210; | |
6921 v27->uAttributes = v35; | |
6922 } | |
6923 else | |
6924 { | |
6925 if ( (signed int)pParty->pPickedItem.uItemID <= 245 ) | |
6926 goto LABEL_92; | |
6927 if ( (signed int)pParty->pPickedItem.uItemID <= 250 ) | |
6928 { | |
6929 v27->UpdateTempBonus(pParty->uTimePlayed); | |
6930 v33 = v27->uItemID; | |
6931 if ( (signed int)v27->uItemID >= 64 && (signed int)v33 <= 65 | |
6932 || (pOut.y = v27->uAttributes, pOut.y & 2) | |
377 | 6933 || v27->uSpecEnchantmentType |
570 | 6934 || v27->uEnchantmentType |
0 | 6935 || v51 && v51 != 1 && v51 != 2 |
6936 || (signed int)v33 >= 500 ) | |
6937 goto LABEL_92; | |
6938 v34 = *(int *)&aSbwb00[4 * pParty->pPickedItem.uItemID + 4]; | |
6939 a2.y = (int)v29 << 7; | |
6940 v31 = (double)(signed int)((int)v29 << 7); | |
377 | 6941 v27->uSpecEnchantmentType = v34; |
0 | 6942 } |
6943 else | |
6944 { | |
6945 if ( pParty->pPickedItem.uItemID != 263 | |
6946 || (v27->UpdateTempBonus(pParty->uTimePlayed), v30 = v27->uItemID, (signed int)v27->uItemID >= 64) | |
6947 && (signed int)v30 <= 65 | |
6948 || (pOut.y = v27->uAttributes, pOut.y & 2) | |
377 | 6949 || v27->uSpecEnchantmentType |
570 | 6950 || v27->uEnchantmentType |
0 | 6951 || v51 && v51 != 1 && v51 != 2 |
6952 || (signed int)v30 >= 500 ) | |
6953 goto LABEL_92; | |
6954 a2.y = (int)v29 << 7; | |
377 | 6955 v27->uSpecEnchantmentType = 40; |
0 | 6956 v31 = (double)a2.y; |
6957 } | |
6958 v32 = pParty->uTimePlayed + (signed int)(signed __int64)(v31 * 0.033333335); | |
6959 LODWORD(v27->uExpireTime) = v32; | |
6960 LODWORD(v32) = pOut.y; | |
6961 LOBYTE(v32) = LOBYTE(pOut.y) | 0x18; | |
6962 HIDWORD(v27->uExpireTime) = HIDWORD(v32); | |
6963 v27->uAttributes = v32; | |
6964 } | |
984 | 6965 _50C9A8_item_enchantment_timer = 256; |
0 | 6966 goto LABEL_92; |
6967 } | |
570 | 6968 v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; |
0 | 6969 if ( v36 < 0.0 ) |
6970 v36 = 0.0; | |
6971 if ( v51 != 12 ) | |
6972 { | |
6973 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
6974 return; | |
6975 } | |
6976 a2.y = v27->uMaxCharges; | |
6977 v37 = (signed __int64)((double)a2.y - v36 * (double)a2.y); | |
6978 v27->uMaxCharges = v37; | |
6979 v27->uNumCharges = (unsigned __int8)v37; | |
6980 goto LABEL_92; | |
6981 } | |
6982 v14 = v13 - 222; | |
6983 v15 = pParty->pPickedItem.uItemID - 222; | |
6984 v47 = v14; | |
6985 y.y = 0; | |
6986 if ( pParty->pPickedItem.uItemID == 221 || v51 == 221 ) | |
6987 { | |
6988 v16 = 5; | |
6989 } | |
6990 else | |
6991 { | |
6992 v16 = *(short *)&pItemsTable->field_EDE0[2 * (v14 + 50 * v15) + 388]; | |
6993 v10 = pOut.z; | |
6994 } | |
6995 v51 = v16; | |
6996 if ( v45 ) | |
6997 { | |
6998 if ( v16 < 225 || v16 > 227 ) | |
6999 { | |
7000 if ( v16 < 228 || v16 > 239 ) | |
7001 { | |
7002 if ( v16 < 240 || v16 > 261 ) | |
7003 { | |
7004 if ( v16 >= 262 && pOut.y != 4 ) | |
7005 { | |
7006 LABEL_53: | |
7007 v51 = 4; | |
7008 goto LABEL_54; | |
7009 } | |
7010 } | |
7011 else | |
7012 { | |
7013 if ( pOut.y <= 2 ) | |
7014 { | |
7015 LABEL_38: | |
7016 v51 = 3; | |
7017 goto LABEL_54; | |
7018 } | |
7019 } | |
7020 } | |
7021 else | |
7022 { | |
7023 if ( pOut.y == 1 ) | |
7024 { | |
7025 LABEL_35: | |
7026 v51 = 2; | |
7027 goto LABEL_54; | |
7028 } | |
7029 } | |
7030 } | |
7031 } | |
7032 else | |
7033 { | |
7034 if ( v16 >= 225 && v16 <= 227 ) | |
7035 { | |
7036 v51 = 1; | |
7037 goto LABEL_54; | |
7038 } | |
7039 if ( v16 >= 228 && v16 <= 239 ) | |
7040 goto LABEL_35; | |
7041 if ( v16 >= 240 && v16 <= 261 ) | |
7042 goto LABEL_38; | |
7043 if ( v16 >= 262 ) | |
7044 goto LABEL_53; | |
7045 } | |
7046 LABEL_54: | |
7047 pOut.y = 0; | |
7048 pOut.x = v10 + 1; | |
7049 v17 = (int)v0->pInventoryIndices; | |
7050 while ( *(int *)v17 != pOut.x ) | |
7051 { | |
7052 ++pOut.y; | |
7053 v17 += 4; | |
7054 if ( pOut.y >= 126 ) | |
7055 { | |
7056 v18 = y.y; | |
7057 goto LABEL_59; | |
7058 } | |
7059 } | |
7060 v18 = pOut.y; | |
7061 LABEL_59: | |
7062 if ( !v51 ) | |
7063 { | |
7064 LABEL_115: | |
7065 v10 = pOut.z; | |
7066 goto LABEL_116; | |
7067 } | |
7068 if ( v51 == 1 ) | |
7069 { | |
7070 v0->RemoveItemAtInventoryIndex(v18); | |
7071 v26 = rand(); | |
1036 | 7072 v0->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); |
0 | 7073 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); |
437 | 7074 |
7075 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1033 | 7076 |
0 | 7077 v42 = (int *)&a2.y; |
7078 v41 = (int *)&y.y; | |
7079 v40 = (int *)&pOut; | |
7080 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
7081 } | |
7082 else | |
7083 { | |
7084 if ( v51 == 2 ) | |
7085 { | |
7086 v0->RemoveItemAtInventoryIndex(v18); | |
7087 v25 = rand(); | |
1036 | 7088 v0->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); |
0 | 7089 v23 = 1; |
7090 } | |
7091 else | |
7092 { | |
7093 if ( v51 == 3 ) | |
7094 { | |
7095 v0->RemoveItemAtInventoryIndex(v18); | |
7096 v24 = rand(); | |
1036 | 7097 v0->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); |
0 | 7098 v23 = 5; |
7099 } | |
7100 else | |
7101 { | |
7102 if ( v51 != 4 ) | |
7103 { | |
7104 if ( v51 != 5 ) | |
7105 { | |
1014 | 7106 v19 = v0->AddItem(-1, 0xDCu); |
0 | 7107 if ( v19 ) |
1019 | 7108 // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; |
7109 v0->pOwnItems[v19-1].uAttributes=ITEM_IDENTIFIED; | |
0 | 7110 v20 = v47 + 50 * v15; |
7111 v0->pInventoryItems[pOut.z].uItemID = v51; | |
570 | 7112 v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType |
7113 + v0->pInventoryItems[pOut.z].uEnchantmentType) | |
0 | 7114 / 2; |
222 | 7115 v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 |
0 | 7116 LABEL_74: |
7117 v22 = (int)((char *)v0 + 36 * pOut.z); | |
222 | 7118 if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) |
0 | 7119 *(int *)(v22 + 552) |= 1u; |
7120 if ( !dword_4E455C ) | |
7121 goto LABEL_92; | |
187 | 7122 v0->PlaySound(SPEECH_16, 0); |
0 | 7123 goto LABEL_91; |
7124 } | |
7125 if ( v45 ) | |
7126 { | |
7127 if ( *(int *)(a2.y + 532) == 221 ) | |
7128 *(int *)(a2.y + 532) = pParty->pPickedItem.uItemID; | |
7129 else | |
570 | 7130 *(int *)(a2.y + 536) = pParty->pPickedItem.uEnchantmentType; |
1014 | 7131 v21 = v0->AddItem(-1, 0xDCu); |
0 | 7132 if ( v21 ) |
1019 | 7133 //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; |
7134 v0->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; | |
0 | 7135 goto LABEL_74; |
7136 } | |
7137 goto LABEL_115; | |
7138 } | |
7139 v0->RemoveItemAtInventoryIndex(v18); | |
7140 v0->SetCondition(0x10u, 0); | |
7141 v23 = 0; | |
7142 } | |
7143 } | |
1012 | 7144 v0->ItemsEnchant(v23); |
0 | 7145 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); |
437 | 7146 |
7147 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1033 | 7148 |
0 | 7149 v42 = (int *)&a2.y; |
7150 v41 = (int *)&y.y; | |
7151 v40 = (int *)&pOut; | |
7152 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
7153 } | |
7154 *(_QWORD *)&v39.x = *(_QWORD *)&pParty->vPosition.x; | |
7155 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, v40, v41, v42); | |
7156 sub_42F7EB_DropItemAt(0x41Bu, pOut.x, y.y, a2.y, 0, 1, 0, 0, 0); | |
7157 if ( dword_4E455C ) | |
7158 { | |
7159 if ( v0->CanAct() ) | |
187 | 7160 v0->PlaySound(SPEECH_17, 0); |
0 | 7161 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); |
7162 LABEL_91: | |
7163 dword_4E455C = 0; | |
7164 } | |
7165 LABEL_92: | |
7166 pMouse->RemoveHoldingItem(); | |
7167 dword_50CDCC = 1; | |
7168 return; | |
7169 } | |
7170 *(int *)(v11 + 536) = v9 + pItemsTable->pItems[pParty->pPickedItem.uItemID].uDamageDice; | |
7171 switch ( pParty->pPickedItem.uItemID ) | |
7172 { | |
7173 case 0xC8u: | |
7174 case 0xC9u: | |
7175 case 0xCAu: | |
7176 case 0xCBu: | |
7177 case 0xCCu: | |
7178 v0->pInventoryItems[pOut.z].uItemID = 222; | |
7179 break; | |
7180 case 0xCDu: | |
7181 case 0xCEu: | |
7182 case 0xCFu: | |
7183 case 0xD0u: | |
7184 case 0xD1u: | |
7185 v0->pInventoryItems[pOut.z].uItemID = 223; | |
7186 break; | |
7187 case 0xD2u: | |
7188 case 0xD3u: | |
7189 case 0xD4u: | |
7190 case 0xD5u: | |
7191 case 0xD6u: | |
7192 v0->pInventoryItems[pOut.z].uItemID = 224; | |
7193 break; | |
7194 case 0xD7u: | |
7195 case 0xD8u: | |
7196 case 0xD9u: | |
7197 case 0xDAu: | |
7198 case 0xDBu: | |
7199 v0->pInventoryItems[pOut.z].uItemID = 221; | |
7200 break; | |
7201 default: | |
7202 break; | |
7203 } | |
7204 pMouse->RemoveHoldingItem(); | |
7205 dword_50CDCC = 1; | |
7206 if ( dword_4E455C ) | |
7207 { | |
187 | 7208 v0->PlaySound(SPEECH_16, 0); |
0 | 7209 dword_4E455C = 0; |
7210 } | |
7211 } | |
7212 | |
7213 //----- (004179BC) -------------------------------------------------------- | |
1006 | 7214 void __fastcall sub_4179BC_draw_tooltip( const char *a1, const char *a2 ) |
7215 { | |
0 | 7216 const char *v2; // ebx@1 |
7217 const char *v3; // edi@1 | |
7218 unsigned int v4; // eax@1 | |
7219 GUIWindow Dst; // [sp+Ch] [bp-5Ch]@1 | |
7220 POINT v6; // [sp+60h] [bp-8h]@1 | |
7221 | |
7222 v2 = a2; | |
7223 v3 = a1; | |
7224 memset(&Dst, 0, 0x54u); | |
7225 Dst.uFrameWidth = 384; | |
7226 Dst.uFrameHeight = 256; | |
7227 Dst.uFrameX = 128; | |
7228 Dst.uFrameY = pMouse->GetCursorPos(&v6)->y + 30; | |
7229 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(v2, &Dst, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; | |
7230 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
7231 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
7232 Dst.DrawMessageBox(0); | |
7233 Dst.uFrameX += 12; | |
7234 Dst.uFrameWidth -= 24; | |
7235 Dst.uFrameY += 12; | |
7236 Dst.uFrameHeight -= 12; | |
7237 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
7238 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
949 | 7239 v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7240 sprintf(pTmpBuf.data(), format_4E2D80, v4, v3); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7241 Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u); |
1006 | 7242 Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0); |
0 | 7243 } |
7244 | |
7245 //----- (00417AD4) -------------------------------------------------------- | |
983 | 7246 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) |
273 | 7247 { |
0 | 7248 int v8; // eax@10 |
7249 int v12; // eax@14 | |
7250 unsigned int yellow; // [sp+Ch] [bp-Ch]@1 | |
7251 unsigned int red; // [sp+10h] [bp-8h]@1 | |
7252 unsigned int white; // [sp+14h] [bp-4h]@1 | |
7253 | |
949 | 7254 white = TargetColor(0xFFu, 0xFFu, 0xFFu); |
7255 red = TargetColor(0xFFu, 0, 0); | |
7256 yellow = TargetColor(0xFFu, 0xFFu, 0); | |
269 | 7257 if ( !(uPlayerClass % 4) ) |
7258 { | |
273 | 7259 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level ) |
269 | 7260 return white; |
273 | 7261 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level |
7262 && byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level ) | |
269 | 7263 { |
7264 v12 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType]; | |
273 | 7265 if ( v12 < skill_level ) |
269 | 7266 return red; |
0 | 7267 } |
7268 return yellow; | |
7269 } | |
273 | 7270 if ( (uPlayerClass % 4) == 1 ) |
7271 { | |
7272 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level ) | |
269 | 7273 return white; |
273 | 7274 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level ) |
269 | 7275 { |
7276 v8 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType]; | |
273 | 7277 if ( v8 < skill_level) |
7278 return red; | |
0 | 7279 } |
7280 return yellow; | |
7281 } | |
273 | 7282 if ( (uPlayerClass % 4) == 2 || (uPlayerClass % 4) == 3 ) |
7283 { | |
7284 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level ) | |
0 | 7285 return red; |
269 | 7286 } |
7287 return white; | |
1296 | 7288 } |