Mercurial > mm7
annotate mm7_5.cpp @ 1264:6bc88137a019
Merge
author | Gloval |
---|---|
date | Thu, 13 Jun 2013 00:56:22 +0400 |
parents | 73269755dd89 0aeac0b9ca30 |
children | 2929c4406d2c |
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" |
629 | 50 #include "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); | |
978 | 731 GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 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); | |
978 | 742 GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 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; | |
978 | 771 GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 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; | |
978 | 782 GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 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; | |
978 | 801 GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 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; |
978 | 814 GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 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; | |
978 | 843 GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 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; | |
978 | 854 GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 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; | |
978 | 1517 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, 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; | |
1777 case UIMSG_CastSpell_BE://??? | |
1778 __debugbreak(); | |
0 | 1779 if ( pRenderer->pRenderD3D ) |
1780 { | |
1781 LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
1782 } | |
1783 else | |
1784 { | |
1785 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210); | |
1786 pPoint = pMouse->GetCursorPos(&v208); | |
1787 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]]; | |
1788 } | |
1789 v44 = (unsigned __int16)v42; | |
848 | 1790 v45 = PID_TYPE(v44); |
0 | 1791 uNumSeconds = v44; |
848 | 1792 v46 = PID_ID(v44); |
0 | 1793 if ( v45 == 3 ) |
1794 { | |
1795 v47 = pActors[v46].uAIState == Dead; | |
11 | 1796 if ( !v47 ) |
1797 continue; | |
1000 | 1798 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1799 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1800 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1801 pSpellInfo->spell_target_pid = v44; | |
1802 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1803 pGUIWindow_Settings->Release(); | |
11 | 1804 pGUIWindow_Settings = 0; |
1805 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1806 GameUI_Footer_TimeLeft = 0; |
11 | 1807 unk_50C9A0 = 0; |
1808 back_to_game(); | |
1809 continue; | |
0 | 1810 } |
1811 if ( v45 == 2 ) | |
1812 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
1813 v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0; |
0 | 1814 if ( !v47 ) |
4 | 1815 continue; |
1000 | 1816 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1817 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1818 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1819 pSpellInfo->spell_target_pid = v44; | |
1820 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1821 pGUIWindow_Settings->Release(); | |
11 | 1822 pGUIWindow_Settings = 0; |
1823 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1824 GameUI_Footer_TimeLeft = 0; |
11 | 1825 unk_50C9A0 = 0; |
1826 back_to_game(); | |
1827 continue; | |
0 | 1828 } |
1829 if ( v45 == 5 ) | |
1830 { | |
1831 v48 = pLevelDecorations[v46].field_16_event_id == 0; | |
1832 } | |
1833 else | |
1834 { | |
1835 if ( v45 != 6 ) | |
4 | 1836 continue; |
978 | 1837 if ( uCurrentlyLoadedLevelType != 1 ) |
0 | 1838 { |
1839 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F]; | |
1840 if ( !(pODMFace->uAttributes & 0x02000000) || !pODMFace->sCogTriggeredID ) | |
4 | 1841 continue; |
0 | 1842 v44 = uNumSeconds; |
1000 | 1843 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1844 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1845 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1846 pSpellInfo->spell_target_pid = v44; | |
1847 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1848 pGUIWindow_Settings->Release(); | |
11 | 1849 pGUIWindow_Settings = 0; |
1850 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1851 GameUI_Footer_TimeLeft = 0; |
11 | 1852 unk_50C9A0 = 0; |
1853 back_to_game(); | |
1854 continue; | |
0 | 1855 } |
1856 pBLVFace = &pIndoor->pFaces[v46]; | |
1857 if ( !(BYTE3(pBLVFace->uAttributes) & 2) ) | |
4 | 1858 continue; |
0 | 1859 v48 = pIndoor->pFaceExtras[pBLVFace->uFaceExtraID].uEventID == 0; |
1860 } | |
1861 if ( v48 ) | |
4 | 1862 continue; |
1000 | 1863 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1864 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1865 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1866 pSpellInfo->spell_target_pid = v44; | |
1867 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1868 pGUIWindow_Settings->Release(); | |
0 | 1869 pGUIWindow_Settings = 0; |
1870 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1871 GameUI_Footer_TimeLeft = 0; |
0 | 1872 unk_50C9A0 = 0; |
1873 back_to_game(); | |
4 | 1874 continue; |
1000 | 1875 case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade) |
1876 case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure | |
1877 case UIMSG_HiredNPC_CastSpell: | |
0 | 1878 if ( pMessageQueue_50CBD0->uNumMessages ) |
1879 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1880 if ( unk_50C9A0 ) | |
1881 { | |
910 | 1882 uActiveCharacter = uMessageParam; |
978 | 1883 viewparams->bRedrawGameUI = 1; |
0 | 1884 } |
1885 else | |
1886 { | |
1887 if ( pGUIWindow_Settings ) | |
1888 { | |
1000 | 1889 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
0 | 1890 switch ( uMessage ) |
1891 { | |
1000 | 1892 case UIMSG_CastSpell_Character_Big_Improvement: |
1893 LOBYTE(pSpellInfo->field_8) &= 0xFDu; | |
0 | 1894 break; |
1000 | 1895 case UIMSG_CastSpell_Character_Small_Improvement: |
1896 HIBYTE(pSpellInfo->field_8) &= 0xFEu; | |
0 | 1897 break; |
1000 | 1898 case UIMSG_HiredNPC_CastSpell: |
1899 HIBYTE(pSpellInfo->field_8) &= 0xFDu; | |
0 | 1900 break; |
1901 } | |
1000 | 1902 pSpellInfo->uPlayerID_2 = uMessageParam; |
1903 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
0 | 1904 pGUIWindow_Settings->Release(); |
1905 pGUIWindow_Settings = 0; | |
1906 pEventTimer->Resume(); | |
1907 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1908 GameUI_Footer_TimeLeft = 0; |
0 | 1909 unk_50C9A0 = 0; |
1910 } | |
1911 } | |
4 | 1912 continue; |
0 | 1913 case UIMSG_BF: |
987 | 1914 __debugbreak(); |
978 | 1915 dword_50CDC8 = 1; |
0 | 1916 sub_42FBDD(); |
978 | 1917 SaveGame(1, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1918 strcpy(pCurrentMapName.data(), pMapStats->pInfos[uHouse_ExitPic].pFilename); |
978 | 1919 dword_6BE364_game_settings_1 |= 1; |
1920 uGameState = GAME_STATE_2; | |
11 | 1921 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; |
336 | 1922 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; |
4 | 1923 if ( v53 < 0 ) |
0 | 1924 { |
1925 v54 = abs(v53) - 1; | |
1926 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1927 dword_5B65BC = 0; | |
1928 v55 = dword_4E4560[v54]; | |
1929 _5B65AC_npcdata_fame_or_other = dword_4E4578[v54]; | |
1930 v56 = dword_4E4590[v54]; | |
1931 v57 = dword_4E45A8[v54]; | |
1932 _5B65A8_npcdata_uflags_or_other = v55; | |
1933 _5B65B4_npcdata_loword_house_or_other = v57; | |
1934 _5B65B0_npcdata_rep_or_other = v56; | |
1935 dword_5B65C0 = v55 | _5B65AC_npcdata_fame_or_other | v56 | v57; | |
1936 } | |
1937 sub_4BD8B5(); | |
11 | 1938 //goto LABEL_434; |
437 | 1939 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
11 | 1940 { |
990 | 1941 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 1942 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
1943 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
1944 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 1945 }*/ |
978 | 1946 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
11 | 1947 continue; |
710 | 1948 |
1949 case UIMSG_OnCastTownPortal: | |
0 | 1950 pAudioPlayer->StopChannels(-1, -1); |
710 | 1951 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_TownPortal, uMessageParam); |
1952 continue; | |
1953 | |
961 | 1954 case UIMSG_OnCastLloydsBeacon: |
0 | 1955 pAudioPlayer->StopChannels(-1, -1); |
961 | 1956 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_LloydsBeacon, 0); |
710 | 1957 continue; |
1958 | |
961 | 1959 case UIMSG_LloydsBeacon_FlippingBtn: |
0 | 1960 bRecallingBeacon = uMessageParam; |
1961 v127 = uMessageParam + 204; | |
916 | 1962 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
1963 continue; | |
961 | 1964 case UIMSG_HintBeaconSlot: |
0 | 1965 if ( !pGUIWindow_CurrentMenu ) |
4 | 1966 continue; |
0 | 1967 pPlayer = pPlayers[_506348_current_lloyd_playerid + 1]; |
1968 uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam]; | |
1969 if ( bRecallingBeacon ) | |
1970 { | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
1971 if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) ) |
4 | 1972 continue; |
0 | 1973 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
|
1974 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
|
1975 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 1976 continue; |
0 | 1977 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1978 v59 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
0 | 1979 thise = "Not in Map Stats"; |
1980 if ( v59 ) | |
1981 thise = pMapStats->pInfos[v59].pName; | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
1982 if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) || !v59 ) |
0 | 1983 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1984 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
|
1985 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 1986 continue; |
0 | 1987 } |
1988 v174 = pMapStats->pInfos[sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName; | |
1989 v158 = (unsigned int)thise; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1990 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
|
1991 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 1992 continue; |
961 | 1993 case UIMSG_CloseAfterInstallBeacon: |
978 | 1994 dword_50CDC8 = 1; |
437 | 1995 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
1996 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) | |
11 | 1997 continue; |
990 | 1998 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 1999 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
2000 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 2001 ++pMessageQueue_50CBD0->uNumMessages;*/ |
11 | 2002 continue; |
961 | 2003 case UIMSG_InstallBeacon: |
0 | 2004 pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1]; |
2005 pNPCData4 = (NPCData *)&pPlayer9->pInstalledBeacons[uMessageParam]; | |
2006 if ( !*(_QWORD *)&pNPCData4->pName && bRecallingBeacon ) | |
4 | 2007 continue; |
0 | 2008 byte_506360 = 1; |
2009 pPlayer9->CanCastSpell(uRequiredMana); | |
2010 if ( pParty->bTurnBasedModeOn ) | |
2011 { | |
2012 v60 = sRecoveryTime; | |
2013 pParty->pTurnBasedPlayerRecoveryTimes[_506348_current_lloyd_playerid] = sRecoveryTime; | |
2014 pPlayer9->SetRecoveryTime(v60); | |
2015 pTurnEngine->_40471C(); | |
2016 } | |
2017 else | |
2018 { | |
2019 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
2020 } | |
2021 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0); | |
2022 if ( bRecallingBeacon ) | |
2023 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2024 if ( _stricmp(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]) ) |
0 | 2025 { |
978 | 2026 SaveGame(1, 0); |
0 | 2027 OnMapLeave(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2028 strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]); |
978 | 2029 dword_6BE364_game_settings_1 |= 1; |
2030 uGameState = GAME_STATE_2; | |
0 | 2031 _5B65A8_npcdata_uflags_or_other = pNPCData4->uFlags; |
2032 _5B65AC_npcdata_fame_or_other = pNPCData4->fame; | |
2033 _5B65B0_npcdata_rep_or_other = pNPCData4->rep; | |
291 | 2034 _5B65B4_npcdata_loword_house_or_other = LOWORD(pNPCData4->Location2D); |
2035 _5B65B8_npcdata_hiword_house_or_other = HIWORD(pNPCData4->Location2D); | |
978 | 2036 dword_5B65C0 = 1; |
0 | 2037 } |
2038 else | |
2039 { | |
2040 pParty->vPosition.x = pNPCData4->uFlags; | |
2041 pParty->vPosition.y = pNPCData4->fame; | |
2042 pParty->vPosition.z = pNPCData4->rep; | |
2043 pParty->uFallStartY = pParty->vPosition.z; | |
291 | 2044 pParty->sRotationY = LOWORD(pNPCData4->Location2D); |
2045 pParty->sRotationX = HIWORD(pNPCData4->Location2D); | |
0 | 2046 } |
978 | 2047 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
437 | 2048 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2049 { |
305 | 2050 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2051 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
2052 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2053 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2054 }*/ |
0 | 2055 //crt_deconstruct_ptr_6A0118(); |
2056 pBooksWindow->Release(); | |
2057 pGUIWindow_CurrentMenu->Release(); | |
2058 pBooksWindow = 0; | |
2059 pGUIWindow_CurrentMenu = 0; | |
2060 } | |
2061 else | |
2062 { | |
2063 sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1); | |
2064 SaveScreenshot(a1); | |
2065 LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1); | |
2066 v212 = qword_506350 << 7; | |
2067 pNPCData2 = pNPCData4; | |
2068 thisg = 0; | |
2069 v62 = pParty->uTimePlayed + (signed __int64)((double)(qword_506350 << 7) * 0.033333335); | |
2070 pNPCData4->pName = (char *)v62; | |
2071 pNPCData2->uPortraitID = HIDWORD(v62); | |
2072 pNPCData2->uFlags = pParty->vPosition.x; | |
2073 pNPCData2->fame = pParty->vPosition.y; | |
2074 pNPCData2->rep = pParty->vPosition.z; | |
291 | 2075 LOWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationY); |
2076 HIWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationX); | |
837 | 2077 if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 ) |
4 | 2078 continue; |
0 | 2079 uAction = 0; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2080 while ( _stricmp((const char *)pGames_LOD->pSubIndices + uAction, pCurrentMapName.data()) ) |
0 | 2081 { |
2082 ++thisg; | |
2083 uAction += 32; | |
837 | 2084 if ( thisg >= (signed int)pGames_LOD->uNumSubDirs / 2 ) |
4 | 2085 continue; |
0 | 2086 } |
2087 HIWORD(pNPCData4->uProfession) = thisg; | |
2088 } | |
4 | 2089 continue; |
961 | 2090 case UIMSG_ClickTownInTP: |
0 | 2091 if ( uMessageParam ) |
2092 { | |
2093 switch ( uMessageParam ) | |
2094 { | |
2095 case 1: | |
2096 v63 = 208; | |
2097 break; | |
2098 case 2: | |
2099 v63 = 207; | |
2100 break; | |
2101 case 3: | |
2102 v63 = 211; | |
2103 break; | |
2104 case 4: | |
2105 v63 = 209; | |
2106 break; | |
2107 default: | |
2108 if ( uMessageParam != 5 ) | |
2109 { | |
2110 LABEL_486: | |
978 | 2111 SaveGame(1, 0); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2112 v64 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
0 | 2113 v65 = uMessageParam; |
839 | 2114 if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) |
0 | 2115 { |
839 | 2116 pParty->vPosition.x = TownPortalList[v65].pos.x; |
2117 pParty->vPosition.y = TownPortalList[v65].pos.y; | |
2118 pParty->vPosition.z = TownPortalList[v65].pos.z; | |
0 | 2119 pParty->uFallStartY = pParty->vPosition.z; |
839 | 2120 pParty->sRotationY = TownPortalList[v65].rot_y; |
2121 pParty->sRotationX = TownPortalList[v65].rot_x; | |
0 | 2122 } |
2123 else | |
2124 { | |
978 | 2125 SaveGame(1, 0); |
0 | 2126 OnMapLeave(); |
978 | 2127 dword_6BE364_game_settings_1 |= 1; |
2128 uGameState = GAME_STATE_2; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2129 strcpy(pCurrentMapName.data(), pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); |
978 | 2130 dword_5B65C0 = 1; |
839 | 2131 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; |
2132 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; | |
2133 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; | |
2134 v66 = TownPortalList[uMessageParam].rot_x; | |
2135 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y; | |
0 | 2136 _5B65B8_npcdata_hiword_house_or_other = v66; |
2137 InitializeActors(); | |
2138 } | |
2139 v67 = pGUIWindow_CurrentMenu->Hint; | |
2140 if ( v67 ) | |
978 | 2141 *((int *)v67 + 17) = 1; |
0 | 2142 else |
710 | 2143 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u); |
437 | 2144 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2145 { |
990 | 2146 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2147 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
2148 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2149 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2150 }*/ |
978 | 2151 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
4 | 2152 continue; |
0 | 2153 } |
2154 v63 = 210; | |
2155 break; | |
2156 } | |
2157 } | |
2158 else | |
2159 { | |
2160 v63 = 206; | |
2161 } | |
484 | 2162 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63) ) |
0 | 2163 return; |
2164 goto LABEL_486; | |
961 | 2165 case UIMSG_HintTownPortal: |
0 | 2166 if ( uMessageParam ) |
2167 { | |
2168 switch ( uMessageParam ) | |
2169 { | |
2170 case 1: | |
2171 v68 = 208; | |
2172 break; | |
2173 case 2: | |
2174 v68 = 207; | |
2175 break; | |
2176 case 3: | |
2177 v68 = 211; | |
2178 break; | |
2179 case 4: | |
2180 v68 = 209; | |
2181 break; | |
2182 default: | |
2183 if ( uMessageParam != 5 ) | |
11 | 2184 //goto LABEL_506; |
2185 { | |
2186 if ( uMessageParam ) | |
2187 { | |
2188 switch ( uMessageParam ) | |
2189 { | |
2190 case 1: | |
2191 v69 = pMapStats->pInfos[4].pName; | |
2192 break; | |
2193 case 2: | |
2194 v69 = pMapStats->pInfos[3].pName; | |
2195 break; | |
2196 case 3: | |
2197 v69 = pMapStats->pInfos[10].pName; | |
2198 break; | |
2199 case 4: | |
2200 v69 = pMapStats->pInfos[7].pName; | |
2201 break; | |
2202 default: | |
2203 if ( uMessageParam != 5 ) | |
2204 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2205 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2206 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2207 continue; |
11 | 2208 } |
2209 v69 = pMapStats->pInfos[8].pName; | |
2210 break; | |
2211 } | |
2212 } | |
2213 else | |
2214 { | |
2215 v69 = pMapStats->pInfos[21].pName; | |
2216 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2217 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2218 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2219 continue; |
11 | 2220 } |
2221 v68 = 210; | |
2222 break; | |
0 | 2223 } |
2224 } | |
2225 else | |
2226 { | |
2227 v68 = 206; | |
2228 } | |
484 | 2229 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v68) ) |
0 | 2230 { |
2231 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); | |
4 | 2232 continue; |
0 | 2233 } |
11 | 2234 //LABEL_506: |
0 | 2235 if ( uMessageParam ) |
2236 { | |
2237 switch ( uMessageParam ) | |
2238 { | |
2239 case 1: | |
2240 v69 = pMapStats->pInfos[4].pName; | |
2241 break; | |
2242 case 2: | |
2243 v69 = pMapStats->pInfos[3].pName; | |
2244 break; | |
2245 case 3: | |
2246 v69 = pMapStats->pInfos[10].pName; | |
2247 break; | |
2248 case 4: | |
2249 v69 = pMapStats->pInfos[7].pName; | |
2250 break; | |
2251 default: | |
2252 if ( uMessageParam != 5 ) | |
2253 //goto LABEL_519; | |
4 | 2254 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2255 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v200); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2256 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2257 continue; |
4 | 2258 } |
0 | 2259 v69 = pMapStats->pInfos[8].pName; |
2260 break; | |
2261 } | |
2262 } | |
2263 else | |
2264 { | |
2265 v69 = pMapStats->pInfos[21].pName; | |
2266 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2267 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[35], v69); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2268 GameUI_SetFooterString(pTmpBuf.data()); |
916 | 2269 continue; |
0 | 2270 case UIMSG_ShowFinalWindow: |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2271 sprintf(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." |
0 | 2272 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." |
2273 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
|
2274 ModalWindow(pFinalMessage.data(), 196); |
0 | 2275 uGameState = GAME_STATE_FINAL_WINDOW; |
4 | 2276 continue; |
0 | 2277 case UIMSG_C4: |
987 | 2278 __debugbreak(); |
982 | 2279 uGameState = GAME_STATE_PLAYING; |
0 | 2280 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); |
151 | 2281 case UIMSG_DD: |
990 | 2282 __debugbreak(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2283 sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer); |
703 | 2284 memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); |
701 | 2285 if ( v216.uPropCount == 1 ) |
0 | 2286 { |
837 | 2287 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2); |
0 | 2288 v70 = atoi(v216.pProperties[0]); |
2289 if ( v70 <= 0 || v70 >= 77 ) | |
4 | 2290 continue; |
0 | 2291 v71 = v70; |
2292 strcpy(Str2, pMapStats->pInfos[v70].pFilename); | |
2293 pNPCData3 = 0; | |
2294 if ( (signed int)pNPCData4 > 0 ) | |
2295 { | |
2296 thish = 0; | |
2297 do | |
2298 { | |
1104 | 2299 if ( !_stricmp((const char *)&pGames_LOD->pSubIndices[thish], Str2) ) |
0 | 2300 break; |
2301 ++thish; | |
2302 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1); | |
2303 } | |
2304 while ( (signed int)pNPCData3 < (signed int)pNPCData4 ); | |
2305 if ( (signed int)pNPCData3 < (signed int)pNPCData4 ) | |
2306 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2307 strcpy(pCurrentMapName.data(), (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); |
0 | 2308 dword_6BE364_game_settings_1 |= 1u; |
978 | 2309 uGameState = GAME_STATE_2; |
0 | 2310 OnMapLeave(); |
4 | 2311 continue; |
0 | 2312 } |
2313 } | |
2314 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName); | |
2315 v73 = Str2; | |
2316 } | |
2317 else | |
2318 { | |
701 | 2319 if ( v216.uPropCount != 3 ) |
11 | 2320 continue; |
0 | 2321 v74 = atoi(v216.pProperties[0]); |
2322 thisi = atoi(v216.pProperties[1]); | |
2323 v75 = atoi(v216.pProperties[2]); | |
2324 v76 = v75; | |
2325 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
2326 { | |
2327 if ( pIndoor->GetSector(v74, thisi, v75) ) | |
2328 { | |
2329 v77 = thisi; | |
2330 pParty->vPosition.x = v74; | |
2331 pParty->vPosition.y = v77; | |
2332 pParty->vPosition.z = v76; | |
2333 pParty->uFallStartY = v76; | |
11 | 2334 continue; |
0 | 2335 } |
2336 } | |
2337 else | |
2338 { | |
2339 if ( v74 > -32768 ) | |
2340 { | |
2341 if ( v74 < 32768 ) | |
2342 { | |
2343 v77 = thisi; | |
2344 if ( thisi > -32768 ) | |
2345 { | |
2346 if ( thisi < 32768 && v76 >= 0 && v76 < 10000 ) | |
11 | 2347 { |
2348 pParty->vPosition.x = v74; | |
2349 pParty->vPosition.y = v77; | |
2350 pParty->vPosition.z = v76; | |
2351 pParty->uFallStartY = v76; | |
2352 continue; | |
2353 } | |
0 | 2354 } |
2355 } | |
2356 } | |
2357 } | |
2358 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
2359 v73 = "Can't jump to that location!"; | |
2360 } | |
2361 ShowStatusBarString(v73, 6u); | |
4 | 2362 continue; |
961 | 2363 case UIMSG_CastQuickSpell: |
0 | 2364 if ( bUnderwater == 1 ) |
362 | 2365 { |
2366 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" | |
2367 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
2368 continue; | |
2369 } | |
0 | 2370 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) ) |
11 | 2371 continue; |
362 | 2372 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); |
11 | 2373 continue; |
1000 | 2374 case UIMSG_CastSpell_Monster_Improvement: |
2375 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, | |
0 | 2376 if ( pRenderer->pRenderD3D ) |
2377 { | |
2378 v81 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
2379 } | |
2380 else | |
2381 { | |
2382 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v206); | |
2383 pPoint2 = pMouse->GetCursorPos(&v201); | |
2384 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]]; | |
2385 } | |
2386 v83 = v81; | |
2387 v44 = (unsigned __int16)v81; | |
2388 v84 = v83 >> 16; | |
848 | 2389 if ( PID_TYPE(v44) != 3 || v84 >= 5120 ) |
4 | 2390 continue; |
1000 | 2391 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
2392 if ( uMessage == UIMSG_CastSpell_Shoot_Monster ) | |
2393 { | |
2394 LOBYTE(pSpellInfo->field_8) &= 0xF7; | |
0 | 2395 } |
2396 else | |
2397 { | |
1000 | 2398 if ( uMessage == UIMSG_CastSpell_Monster_Improvement ) |
2399 HIBYTE(pSpellInfo->field_8) &= 0xFEu; | |
0 | 2400 else |
1000 | 2401 HIBYTE(pSpellInfo->field_8) &= 0xFDu; |
2402 } | |
2403 pSpellInfo->uPlayerID_2 = uMessageParam; | |
2404 pSpellInfo->spell_target_pid = v44; | |
2405 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2406 pGUIWindow_Settings->Release(); | |
11 | 2407 pGUIWindow_Settings = 0; |
2408 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2409 GameUI_Footer_TimeLeft = 0; |
11 | 2410 unk_50C9A0 = 0; |
2411 back_to_game(); | |
2412 continue; | |
151 | 2413 case UIMSG_1C: |
987 | 2414 __debugbreak(); |
0 | 2415 if ( !uActiveCharacter || pCurrentScreen ) |
4 | 2416 continue; |
710 | 2417 ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0); |
151 | 2418 pCurrentScreen = SCREEN_19; |
0 | 2419 pEventTimer->Pause(); |
4 | 2420 continue; |
151 | 2421 case UIMSG_1B: |
987 | 2422 __debugbreak(); |
0 | 2423 if ( !uActiveCharacter ) |
4 | 2424 continue; |
978 | 2425 if ( pParty->bTurnBasedModeOn != 1 ) |
11 | 2426 { |
2427 if ( pActors[uMessageParam].uAIState == 5 ) | |
2428 stru_50C198.LootActor(&pActors[uMessageParam]); | |
2429 else | |
2430 Actor::StealFrom(uMessageParam); | |
2431 continue; | |
2432 } | |
978 | 2433 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) |
4 | 2434 continue; |
0 | 2435 if ( !(pTurnEngine->field_18 & 2) ) |
2436 { | |
2437 if ( pActors[uMessageParam].uAIState == 5 ) | |
2438 stru_50C198.LootActor(&pActors[uMessageParam]); | |
2439 else | |
2440 Actor::StealFrom(uMessageParam); | |
2441 } | |
4 | 2442 continue; |
271 | 2443 |
2444 case UIMSG_Attack: | |
0 | 2445 if ( !uActiveCharacter ) |
4 | 2446 continue; |
978 | 2447 if ( pParty->bTurnBasedModeOn != 1 ) |
11 | 2448 { |
2449 _42ECB5_PlayerAttacksActor(); | |
2450 continue; | |
2451 } | |
978 | 2452 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) |
4 | 2453 continue; |
0 | 2454 if ( !(pTurnEngine->field_18 & 2) ) |
2455 _42ECB5_PlayerAttacksActor(); | |
4 | 2456 continue; |
151 | 2457 case UIMSG_ExitRest: |
962 | 2458 GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);// "Exit Rest" |
11 | 2459 continue; |
151 | 2460 case UIMSG_Wait5Minutes: |
0 | 2461 if ( dword_506F14 == 2 ) |
916 | 2462 { |
2463 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2464 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2465 continue; | |
11 | 2466 } |
962 | 2467 GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2, |
0 | 2468 (int)pButton_RestUI_Wait5Minutes, (int)pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" |
978 | 2469 dword_506F14 = 1; |
0 | 2470 _506F18_num_hours_to_sleep = 5; |
4 | 2471 continue; |
151 | 2472 case UIMSG_Wait1Hour: |
0 | 2473 if ( dword_506F14 == 2 ) |
916 | 2474 { |
2475 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2476 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2477 continue; | |
11 | 2478 } |
962 | 2479 GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2, |
0 | 2480 (int)pButton_RestUI_Wait1Hour, (int)pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" |
978 | 2481 dword_506F14 = 1; |
0 | 2482 _506F18_num_hours_to_sleep = 60; |
4 | 2483 continue; |
907 | 2484 case UIMSG_RentRoom: |
0 | 2485 dword_506F14 = 2; |
1033 | 2486 RestUI_Load(); |
758 | 2487 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; |
0 | 2488 _506F18_num_hours_to_sleep = v86; |
2489 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) | |
2490 _506F18_num_hours_to_sleep = v86 + 720; | |
11 | 2491 dword_506F14 = 2; |
2492 pParty->RestAndHeal(); | |
766 | 2493 pParty->days_played_without_rest = 0; |
2494 pParty->pPlayers[3].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2495 pParty->pPlayers[2].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2496 pParty->pPlayers[1].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2497 pParty->pPlayers[0].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
11 | 2498 continue; |
907 | 2499 case UIMSG_RestWindow: |
0 | 2500 if ( pMessageQueue_50CBD0->uNumMessages ) |
2501 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2502 if ( pCurrentScreen ) | |
4 | 2503 continue; |
0 | 2504 if ( sub_42F4DA() ) |
11 | 2505 { |
978 | 2506 if ( pParty->bTurnBasedModeOn == 1 ) |
11 | 2507 { |
916 | 2508 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" |
11 | 2509 continue; |
2510 } | |
2511 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2512 if ( pParty->uFlags & 0x88 ) | |
2513 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
916 | 2514 ShowStatusBarString(v88, 2); |
11 | 2515 if ( !uActiveCharacter ) |
2516 continue; | |
916 | 2517 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); |
2518 continue; | |
11 | 2519 } |
978 | 2520 if ( pParty->bTurnBasedModeOn == 1 ) |
916 | 2521 { |
2522 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
11 | 2523 continue; |
2524 } | |
0 | 2525 if ( !(pParty->uFlags & 0x88) ) |
2526 { | |
1033 | 2527 RestUI_Load(); |
4 | 2528 continue; |
0 | 2529 } |
978 | 2530 if ( pParty->bTurnBasedModeOn == 1 ) |
0 | 2531 { |
916 | 2532 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" |
11 | 2533 continue; |
0 | 2534 } |
2535 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2536 if ( pParty->uFlags & 0x88 ) | |
2537 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
2538 ShowStatusBarString(v88, 2u); | |
2539 if ( !uActiveCharacter ) | |
4 | 2540 continue; |
916 | 2541 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); |
2542 continue; | |
907 | 2543 case UIMSG_Rest8Hour: |
0 | 2544 if ( dword_506F14 ) |
916 | 2545 { |
2546 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2547 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2548 continue; | |
11 | 2549 } |
0 | 2550 if ( pParty->uNumFoodRations < uRestUI_FoodRequiredToRest ) |
2551 { | |
2552 ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2u);// "You don't have enough food to rest" | |
2553 if ( uActiveCharacter && pPlayers[uActiveCharacter]->CanAct() ) | |
916 | 2554 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_108, 0); |
0 | 2555 } |
2556 else | |
2557 { | |
2558 pParty->pPlayers[3].pConditions[2] = pParty->uTimePlayed; | |
2559 pParty->pPlayers[2].pConditions[2] = pParty->uTimePlayed; | |
2560 pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed; | |
2561 pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2562 v90 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
0 | 2563 if ( !v90 ) |
2564 v90 = rand() % (signed int)pMapStats->uNumMaps + 1; | |
2565 pMapInfo = &pMapStats->pInfos[v90]; | |
237 | 2566 if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent ) |
0 | 2567 { |
2568 v91 = rand() % 100; | |
237 | 2569 v92 = pMapInfo->EncM1percent; |
0 | 2570 v93 = v91 + 1; |
2571 if ( v93 > v92 ) | |
237 | 2572 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); |
0 | 2573 else |
978 | 2574 pNPCData4 = (NPCData *)1; |
0 | 2575 if ( !sub_45063B(pMapInfo, (int)pNPCData4) ) |
2576 pNPCData4 = 0; | |
2577 if ( pNPCData4 ) | |
2578 { | |
2579 pPlayerNum = rand() % 4; | |
2580 LODWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
2581 HIDWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
2582 v95 = rand(); | |
2583 Rest(v95 % 6 + 60); | |
2584 _506F18_num_hours_to_sleep = 0; | |
2585 dword_506F14 = 0; | |
437 | 2586 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2587 { |
990 | 2588 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2589 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
2590 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2591 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2592 }*/ |
2593 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
916 | 2594 ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!" |
2595 pAudioPlayer->PlaySound((SoundID)227, 0, 0, -1, 0, 0, 0, 0); | |
2596 continue; | |
0 | 2597 } |
2598 } | |
2599 Party::TakeFood(uRestUI_FoodRequiredToRest); | |
2600 _506F18_num_hours_to_sleep = 480; | |
2601 dword_506F14 = 2; | |
2602 pParty->RestAndHeal(); | |
766 | 2603 pParty->days_played_without_rest = 0; |
2604 pParty->pPlayers[3].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2605 pParty->pPlayers[2].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2606 pParty->pPlayers[1].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2607 pParty->pPlayers[0].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
0 | 2608 } |
4 | 2609 continue; |
151 | 2610 case UIMSG_AlreadyResting: |
0 | 2611 if ( dword_506F14 == 2 ) |
2612 { | |
916 | 2613 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" |
362 | 2614 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2615 continue; | |
0 | 2616 } |
962 | 2617 GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2, |
0 | 2618 (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" |
758 | 2619 v97 = _494820_training_time(pParty->uCurrentHour); |
978 | 2620 dword_506F14 = 1; |
0 | 2621 _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute; |
4 | 2622 continue; |
960 | 2623 case UIMSG_HintSelectRemoveQuickSpellBtn: |
688 | 2624 if ( quick_spell_at_page && byte_506550 ) |
2625 { | |
2626 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
|
2627 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[483], v173); |
0 | 2628 } |
2629 else | |
2630 { | |
2631 if ( pPlayers[uActiveCharacter]->uQuickSpell ) | |
2632 v177 = pGlobalTXT_LocalizationStrings[584];// "Click here to remove your Quick Spell" | |
2633 else | |
2634 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
|
2635 strcpy(pTmpBuf.data(), v177); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2636 } |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2637 GameUI_SetFooterString(pTmpBuf.data()); |
4 | 2638 continue; |
370 | 2639 case UIMSG_SPellbook_ShowHightlightedSpellInfo: |
4 | 2640 if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter], |
0 | 2641 !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402)) ) |
4 | 2642 continue; |
0 | 2643 if ( sub_4637E0_is_there_popup_onscreen() ) |
2644 dword_507B00_spell_info_to_draw_in_popup = uMessageParam + 1; | |
2645 v98 = *(char *)(uNumSeconds + 6734); | |
688 | 2646 if ( quick_spell_at_page - 1 == uMessageParam ) |
0 | 2647 { |
2648 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2649 v161 = pGlobalTXT_LocalizationStrings[485]; | |
2650 } | |
2651 else | |
2652 { | |
2653 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2654 v161 = pGlobalTXT_LocalizationStrings[486]; | |
2655 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2656 sprintfex(pTmpBuf.data(), v161, v178); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2657 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 2658 continue; |
960 | 2659 case UIMSG_ClickInstallRemoveQuickSpellBtn: |
962 | 2660 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0); |
0 | 2661 if ( !uActiveCharacter ) |
4 | 2662 continue; |
0 | 2663 pPlayer10 = pPlayers[uActiveCharacter]; |
688 | 2664 if ( !byte_506550 || !quick_spell_at_page ) |
0 | 2665 { |
2666 pPlayer10->uQuickSpell = 0; | |
688 | 2667 quick_spell_at_page = 0; |
916 | 2668 pAudioPlayer->PlaySound((SoundID)203, 0, 0, -1, 0, 0, 0, 0); |
2669 continue; | |
0 | 2670 } |
688 | 2671 v99 = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; |
0 | 2672 pPlayers[uActiveCharacter]->uQuickSpell = v99; |
2673 stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter); | |
2674 if ( uActiveCharacter ) | |
187 | 2675 pPlayer10->PlaySound(SPEECH_12, 0); |
0 | 2676 byte_506550 = 0; |
4 | 2677 continue; |
1118 | 2678 case UIMSG_SpellBook_PressTab: |
2679 //__debugbreak(); | |
0 | 2680 if ( !uActiveCharacter ) |
4 | 2681 continue; |
0 | 2682 pPlayer3 = pPlayers[uActiveCharacter]; |
2683 pNPCData4 = 0; | |
2684 uAction = 0; | |
2685 v101 = 0; | |
2686 thisl = (int)&pPlayer3->pActiveSkills[12]; | |
2687 do | |
2688 { | |
2689 if ( *(short *)thisl ) | |
2690 { | |
198 | 2691 if ( pPlayer3->lastOpenedSpellbookPage == v101 ) |
0 | 2692 uAction = (int)pNPCData4; |
2693 v102 = (int)pNPCData4; | |
2694 pNPCData4 = (NPCData *)((char *)pNPCData4 + 1); | |
2695 v217[v102] = v101; | |
2696 } | |
2697 thisl += 2; | |
2698 ++v101; | |
2699 } | |
2700 while ( v101 < 9 ); | |
2701 if ( !pNPCData4 ) | |
11 | 2702 { |
2703 v127 = rand() % 2 + 204; | |
916 | 2704 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2705 continue; | |
11 | 2706 } |
0 | 2707 if ( GetAsyncKeyState(16) ) |
2708 { | |
2709 --uAction; | |
2710 if ( uAction < 0 ) | |
2711 uAction = (int)((char *)pNPCData4 - 1); | |
2712 } | |
2713 else | |
2714 { | |
2715 ++uAction; | |
2716 if ( uAction >= (signed int)pNPCData4 ) | |
2717 uAction = 0; | |
2718 } | |
2719 sub_41140B(); | |
198 | 2720 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); |
11 | 2721 pGUIWindow_CurrentMenu->OpenSpellBook(); |
2722 v127 = rand() % 2 + 204; | |
916 | 2723 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2724 continue; | |
832 | 2725 case UIMSG_OpenSpellbookPage: |
198 | 2726 if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage ) |
4 | 2727 continue; |
0 | 2728 sub_41140B(); |
198 | 2729 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; |
11 | 2730 pGUIWindow_CurrentMenu->OpenSpellBook(); |
0 | 2731 v127 = rand() % 2 + 204; |
916 | 2732 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2733 continue; | |
437 | 2734 case UIMSG_SelectSpell: |
2735 { | |
2736 if (pTurnEngine->field_4 == 3) | |
2737 continue; | |
2738 if (!uActiveCharacter) | |
2739 continue; | |
2740 | |
2741 // uNumSeconds = (unsigned int)pPlayers[uActiveCharacter]; | |
2742 auto player = pPlayers[uActiveCharacter]; | |
2743 if (player->spellbook.pChapters[player->lastOpenedSpellbookPage].bIsSpellAvailable[uMessageParam]) | |
2744 //if ( *(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + &lastOpenedSpellbookPage) + uMessageParam + 402) ) | |
2745 { | |
688 | 2746 if ( quick_spell_at_page - 1 == uMessageParam ) |
0 | 2747 { |
2748 pGUIWindow_CurrentMenu->Release(); | |
2749 pEventTimer->Resume(); | |
978 | 2750 viewparams->bRedrawGameUI = 1; |
151 | 2751 pCurrentScreen = SCREEN_GAME; |
0 | 2752 pIcons_LOD->_4114F2(); |
688 | 2753 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; |
1000 | 2754 /*if ( dword_50C9E8 < 40 ) |
0 | 2755 { |
437 | 2756 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook; |
2757 dword_50C9EC[3 * dword_50C9E8 + 1] = v103; | |
2758 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1; | |
0 | 2759 ++dword_50C9E8; |
1000 | 2760 }*/ |
1012 | 2761 pMessageQueue_50C9E8->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); |
2762 // pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); | |
0 | 2763 } |
2764 else | |
2765 { | |
2766 byte_506550 = 1; | |
688 | 2767 quick_spell_at_page = uMessageParam + 1; |
0 | 2768 } |
437 | 2769 } |
2770 } | |
2771 continue; | |
370 | 2772 |
2773 case UIMSG_CastSpellFromBook: | |
2774 if ( pTurnEngine->field_4 != 3 ) | |
2775 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0); | |
2776 continue; | |
2777 | |
1019 | 2778 case UIMSG_SpellScrollUse: |
987 | 2779 __debugbreak(); |
0 | 2780 if ( pTurnEngine->field_4 != 3 ) |
978 | 2781 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0); |
4 | 2782 continue; |
907 | 2783 case UIMSG_SpellBookWindow: |
0 | 2784 if ( pTurnEngine->field_4 == 3 ) |
4 | 2785 continue; |
0 | 2786 if ( bUnderwater == 1 ) |
2787 { | |
362 | 2788 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" |
916 | 2789 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
0 | 2790 } |
2791 else | |
2792 { | |
2793 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2794 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2795 if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery ) | |
2796 { | |
2797 if ( !pCurrentScreen ) | |
2798 { | |
962 | 2799 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); |
151 | 2800 pCurrentScreen = SCREEN_SPELL_BOOK; |
0 | 2801 pEventTimer->Pause(); |
710 | 2802 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); |
0 | 2803 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); |
978 | 2804 viewparams->field_48 = 1; |
4 | 2805 continue; |
0 | 2806 } |
151 | 2807 if ( pCurrentScreen != SCREEN_REST |
2808 && pCurrentScreen != SCREEN_CHARACTERS | |
2809 && (pCurrentScreen <= SCREEN_63 | |
2810 || pCurrentScreen > SCREEN_67) ) | |
11 | 2811 { |
2812 pGUIWindow_CurrentMenu->Release(); | |
962 | 2813 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); |
151 | 2814 pCurrentScreen = SCREEN_SPELL_BOOK; |
11 | 2815 pEventTimer->Pause(); |
710 | 2816 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); |
11 | 2817 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); |
978 | 2818 viewparams->field_48 = 1; |
11 | 2819 continue; |
2820 } | |
2821 } | |
2822 } | |
2823 continue; | |
2824 case UIMSG_QuickReference: | |
0 | 2825 if ( pMessageQueue_50CBD0->uNumMessages ) |
2826 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2827 if ( pCurrentScreen ) | |
2828 pGUIWindow_CurrentMenu->Release(); | |
2829 ++pIcons_LOD->uTexturePacksCount; | |
2830 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2831 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
962 | 2832 GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0); |
978 | 2833 viewparams->bRedrawGameUI = 1; |
0 | 2834 pEventTimer->Pause(); |
2835 pAudioPlayer->StopChannels(-1, -1); | |
151 | 2836 pCurrentScreen = SCREEN_QUICK_REFERENCE; |
710 | 2837 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0); |
0 | 2838 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); |
978 | 2839 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 2840 pGlobalTXT_LocalizationStrings[79],// "Exit" |
973 | 2841 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179); |
4 | 2842 continue; |
358 | 2843 case UIMSG_GameMenuButton: |
0 | 2844 if ( pCurrentScreen ) |
2845 { | |
2846 pGUIWindow_CurrentMenu->Release(); | |
2847 pEventTimer->Resume(); | |
151 | 2848 pCurrentScreen = SCREEN_GAME; |
978 | 2849 viewparams->bRedrawGameUI = 1; |
0 | 2850 } |
2851 stru_506E40.Release(); | |
2852 uNumSeconds = (unsigned int)MakeScreenshot(155, 117); | |
2853 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); | |
2854 free((void *)uNumSeconds); | |
2855 stru_506E40._40E55E("gamma.pcx", 0); | |
962 | 2856 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton, (int)pBtn_GameSettings, 0); |
11 | 2857 //LABEL_453: |
437 | 2858 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
4 | 2859 continue; |
990 | 2860 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 2861 //goto LABEL_770; |
2862 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2863 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 2864 ++pMessageQueue_50CBD0->uNumMessages;*/ |
2865 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
11 | 2866 continue; |
1101
3e5d70cfe20e
Award order fix, changed UIMSG_C0 to UIMSG_ClickAwardScrollBar
Grumpy7
parents:
1091
diff
changeset
|
2867 case UIMSG_ClickAwardScrollBar: |
978 | 2868 dword_50651C = 1; |
0 | 2869 if ( pMouse->GetCursorPos(&v211)->y > 178 ) |
2870 dword_50651C = -1; | |
4 | 2871 continue; |
961 | 2872 case UIMSG_ClickAwardsUpBtn: |
962 | 2873 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0); |
990 | 2874 BtnUp_flag = 1; |
4 | 2875 continue; |
961 | 2876 case UIMSG_ClickAwardsDownBtn: |
962 | 2877 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0); |
990 | 2878 BtnDown_flag = 1; |
4 | 2879 continue; |
910 | 2880 case UIMSG_ChangeDetaliz: |
978 | 2881 bRingsShownInCharScreen ^= 1; |
910 | 2882 pCharacterScreen_DetalizBtn->Release(); |
697 | 2883 pCharacterScreen_DollBtn->Release(); |
0 | 2884 if ( bRingsShownInCharScreen ) |
2885 { | |
973 | 2886 v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight; |
2887 v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth; | |
0 | 2888 v123 = 445; |
2889 v121 = 470; | |
2890 } | |
2891 else | |
2892 { | |
2893 v128 = 30; | |
2894 v125 = 30; | |
2895 v123 = 300; | |
2896 v121 = 600; | |
2897 } | |
978 | 2898 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0, |
0 | 2899 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" |
2900 0); | |
1025 | 2901 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); |
978 | 2902 viewparams->bRedrawGameUI = 1; |
910 | 2903 continue; |
2904 case UIMSG_ClickPaperdoll: | |
0 | 2905 OnPaperdollLeftClick(); |
4 | 2906 continue; |
960 | 2907 case UIMSG_ClickStatsBtn: |
0 | 2908 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; |
991 | 2909 CharacterUI_ReleaseButtons(); |
0 | 2910 sub_419379(); |
962 | 2911 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0); |
960 | 2912 continue; |
2913 case UIMSG_ClickSkillsBtn: | |
0 | 2914 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; |
991 | 2915 CharacterUI_ReleaseButtons(); |
0 | 2916 sub_419379(); |
991 | 2917 CharacterUI_SkillsTab_CreateButtons(); |
962 | 2918 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0); |
11 | 2919 continue; |
0 | 2920 case UIMSG_SkillUp: |
2921 pPlayer4 = pPlayers[uActiveCharacter]; | |
2922 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam]; | |
2923 LOWORD(v2) = *(short *)v105; | |
2924 uNumSeconds = v2; | |
2925 if ( pPlayer4->uSkillPoints < (v2 & 0x3F) + 1 ) | |
2926 { | |
2927 v87 = pGlobalTXT_LocalizationStrings[488];// "You don't have enough skill points!" | |
2928 } | |
2929 else | |
2930 { | |
2931 if ( (uNumSeconds & 0x3F) < 0x3C ) | |
2932 { | |
2933 *(short *)v105 = uNumSeconds + 1; | |
2934 pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F; | |
187 | 2935 pPlayer4->PlaySound(SPEECH_14, 0); |
916 | 2936 pAudioPlayer->PlaySound((SoundID)20001, 0, 0, -1, 0, 0, 0, 0); |
2937 continue; | |
0 | 2938 } |
2939 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!" | |
2940 } | |
916 | 2941 ShowStatusBarString(v87, 2); |
4 | 2942 continue; |
960 | 2943 case UIMSG_ClickInventoryBtn: |
0 | 2944 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; |
2945 sub_419379(); | |
991 | 2946 CharacterUI_ReleaseButtons(); |
962 | 2947 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0); |
960 | 2948 continue; |
2949 case UIMSG_ClickExitCharacterWindowBtn: | |
2950 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0); | |
2951 continue; | |
2952 case UIMSG_ClickAwardsBtn: | |
0 | 2953 sub_419379(); |
991 | 2954 CharacterUI_ReleaseButtons(); |
0 | 2955 sub_419220(); |
2956 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; | |
962 | 2957 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0); |
521 | 2958 FillAwardsData(); |
4 | 2959 continue; |
1000 | 2960 case UIMSG_ClickBooksBtn: |
0 | 2961 switch ( uMessageParam ) |
2962 { | |
990 | 2963 case 11://Page UP |
2964 BtnUp_flag = 1; | |
2965 pButton = pBtn_Book_2; | |
2966 break; | |
2967 case 10://Page DOWN | |
2968 BtnDown_flag = 1; | |
2969 pButton = pBtn_Book_1; | |
2970 break; | |
1000 | 2971 case 0://Zoom plus |
0 | 2972 pButton = pBtn_Book_1; |
990 | 2973 BtnDown_flag = 1; |
0 | 2974 break; |
1000 | 2975 case 1://Zoom minus |
2976 pButton = pBtn_Book_2; | |
990 | 2977 BtnUp_flag = 1; |
0 | 2978 break; |
990 | 2979 case 2://Potions |
2980 Book_PageBtn3_flag = 1; | |
0 | 2981 if ( dword_506364 ) |
4 | 2982 continue; |
0 | 2983 pButton = pBtn_Book_3; |
2984 break; | |
990 | 2985 case 3://fountains |
2986 Book_PageBtn4_flag = 1; | |
0 | 2987 if ( dword_506364 ) |
4 | 2988 continue; |
0 | 2989 pButton = pBtn_Book_4; |
2990 break; | |
990 | 2991 case 4://obelisks |
2992 Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag | |
0 | 2993 if ( dword_506364 ) |
4 | 2994 continue; |
0 | 2995 pButton = pBtn_Book_5; |
2996 break; | |
990 | 2997 case 5://seer |
2998 Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag | |
0 | 2999 if ( dword_506364 ) |
4 | 3000 continue; |
0 | 3001 pButton = pBtn_Book_6; |
3002 break; | |
990 | 3003 case 6://misc |
0 | 3004 pButton = pBtn_Autonotes_Misc; |
990 | 3005 Autonotes_Misc_page_flag = 1; |
0 | 3006 break; |
990 | 3007 case 7://Instructors |
0 | 3008 pButton = pBtn_Autonotes_Instructors; |
990 | 3009 Autonotes_Instructors_page_flag = 1; |
0 | 3010 break; |
990 | 3011 default: |
3012 continue; | |
0 | 3013 } |
978 | 3014 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); |
11 | 3015 continue; |
0 | 3016 case UIMSG_SelectCharacter: |
3017 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3018 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3019 GameUI_OnPlayerPortraitLeftClick(uMessageParam); | |
4 | 3020 continue; |
0 | 3021 case UIMSG_ShowStatus_Funds: |
3022 v174 = (char *)pParty->uNumGoldInBank; | |
3023 v158 = pParty->uNumGold + pParty->uNumGoldInBank; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3024 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
|
3025 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 3026 continue; |
0 | 3027 case UIMSG_ShowStatus_DateTime: |
3028 pNPCData4 = (NPCData *)pParty->uCurrentHour; | |
3029 if ( (signed int)pParty->uCurrentHour <= 12 ) | |
3030 { | |
3031 if ( !pNPCData4 ) | |
3032 pNPCData4 = (NPCData *)12; | |
3033 } | |
3034 else | |
3035 { | |
3036 pNPCData4 = (NPCData *)((char *)pNPCData4 - 12); | |
3037 } | |
978 | 3038 if ( pParty->uCurrentHour < 0xC || (uNumSeconds = 1, pParty->uCurrentHour >= 0x18) ) |
0 | 3039 uNumSeconds = 0; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3040 sprintf(pTmpBuf.data(), "%d:%02d%s %s %d %s %d", pNPCData4, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7], |
0 | 3041 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
|
3042 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 3043 continue; |
0 | 3044 case UIMSG_ShowStatus_Food: |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3045 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
|
3046 GameUI_SetFooterString(pTmpBuf.data()); |
306 | 3047 continue; |
0 | 3048 case UIMSG_ShowStatus_Player: |
3049 pPlayer5 = pPlayers[uMessageParam]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3050 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
|
3051 strcat(pTmpBuf.data(), ": "); |
0 | 3052 v107 = pPlayer5->GetMajorConditionIdx(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3053 strcat(pTmpBuf.data(), aCharacterConditionNames[v107]); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3054 GameUI_SetFooterString(pTmpBuf.data()); |
0 | 3055 v108 = 8 * uMessageParam - 8; |
3056 LOBYTE(v108) = v108 | 4; | |
888 | 3057 pMouse->uPointingObjectID = PID(OBJECT_Player,v108); |
4 | 3058 continue; |
0 | 3059 case UIMSG_ShowStatus_ManaHP: |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3060 sprintf(pTmpBuf.data(), "%d / %d %s %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(), |
1000 | 3061 pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(), |
3062 pGlobalTXT_LocalizationStrings[212]); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3063 GameUI_SetFooterString(pTmpBuf.data()); |
11 | 3064 continue; |
987 | 3065 case UIMSG_CHEST_ClickItem: |
3066 if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) | |
3067 { | |
3068 OnInventoryLeftClick(); | |
11 | 3069 continue; |
3070 } | |
987 | 3071 OnChestLeftClick(); |
4 | 3072 continue; |
151 | 3073 case UIMSG_InventoryLeftClick: |
987 | 3074 OnInventoryLeftClick(); |
4 | 3075 continue; |
960 | 3076 case UIMSG_MouseLeftClickInGame: |
0 | 3077 if ( !pRenderer->pRenderD3D ) |
11 | 3078 { |
3079 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3080 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3081 OnGameViewportClick(); | |
3082 continue; | |
3083 } | |
0 | 3084 v115 = pMessageQueue_50CBD0->uNumMessages; |
3085 if ( !pMessageQueue_50CBD0->uNumMessages ) | |
11 | 3086 { |
990 | 3087 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3088 /*if ( (signed int)v115 < 40 ) |
11 | 3089 //goto LABEL_769; |
3090 { | |
990 | 3091 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
11 | 3092 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
3093 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3094 ++pMessageQueue_50CBD0->uNumMessages; | |
3095 continue; | |
437 | 3096 }*/ |
11 | 3097 continue; |
3098 } | |
0 | 3099 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
3100 { | |
978 | 3101 pMessageQueue_50CBD0->uNumMessages = 1; |
990 | 3102 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3103 /*v115 = v0; |
0 | 3104 pMessageQueue_50CBD0->uNumMessages = v0; |
990 | 3105 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
0 | 3106 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
11 | 3107 //goto LABEL_771; |
3108 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 3109 ++pMessageQueue_50CBD0->uNumMessages;*/ |
11 | 3110 continue; |
0 | 3111 } |
3112 v115 = 0; | |
3113 pMessageQueue_50CBD0->uNumMessages = 0; | |
990 | 3114 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3115 /*if ( (signed int)v115 < 40 ) |
11 | 3116 //goto LABEL_769; |
3117 { | |
990 | 3118 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
11 | 3119 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
3120 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3121 ++pMessageQueue_50CBD0->uNumMessages; | |
3122 continue; | |
437 | 3123 }*/ |
4 | 3124 continue; |
990 | 3125 case UIMSG_MouseLeftClickInScreen://ñðàáàòûâàåò ïðè íàæàòèè íà ïðàâóþ êíîïêó ìûøè ïîñëå UIMSG_MouseLeftClickInGame |
0 | 3126 if ( pMessageQueue_50CBD0->uNumMessages ) |
3127 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3128 OnGameViewportClick(); | |
4 | 3129 continue; |
151 | 3130 case UIMSG_F: |
987 | 3131 __debugbreak(); |
0 | 3132 if ( pRenderer->pRenderD3D ) |
3133 { | |
3134 LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
3135 } | |
3136 else | |
3137 { | |
3138 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209); | |
3139 pPoint3 = pMouse->GetCursorPos(&v204); | |
3140 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]]; | |
3141 } | |
3142 pButton2 = (GUIButton *)(unsigned __int16)v116; | |
960 | 3143 GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0); |
11 | 3144 continue; |
151 | 3145 case UIMSG_54: |
987 | 3146 __debugbreak(); |
0 | 3147 pButton2 = (GUIButton *)uMessageParam; |
990 | 3148 GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0); |
4 | 3149 continue; |
201 | 3150 case UIMSG_Game_Action: |
0 | 3151 if ( pMessageQueue_50CBD0->uNumMessages ) |
3152 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3153 OnPressSpace(); | |
4 | 3154 continue; |
960 | 3155 case UIMSG_ClickZoomOutBtn: |
0 | 3156 if ( pCurrentScreen ) |
4 | 3157 continue; |
0 | 3158 pParty->uFlags |= 2u; |
1000 | 3159 GUIWindow::Create(519, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomOut, 0); |
0 | 3160 uNumSeconds = 131072; |
3161 v118 = 2 * viewparams->uMinimapZoom; | |
3162 ++viewparams->field_28; | |
3163 viewparams->uMinimapZoom *= 2; | |
3164 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
3165 { | |
3166 if ( (signed int)v118 > 4096 ) | |
3167 { | |
3168 viewparams->uMinimapZoom = 4096; | |
3169 viewparams->field_28 = 12; | |
3170 } | |
4 | 3171 continue; |
0 | 3172 } |
3173 v119 = 2048; | |
3174 if ( (signed int)v118 <= 2048 ) | |
960 | 3175 { |
1051 | 3176 _576E2C_current_minimap_zoom = v118; |
960 | 3177 dword_576E28 = viewparams->field_28; |
3178 break; | |
3179 } | |
0 | 3180 viewparams->field_28 = 11; |
960 | 3181 viewparams->uMinimapZoom = v119; |
1051 | 3182 _576E2C_current_minimap_zoom = v119; |
960 | 3183 dword_576E28 = viewparams->field_28; |
3184 break; | |
3185 case UIMSG_ClickZoomInBtn: | |
0 | 3186 if ( pCurrentScreen ) |
4 | 3187 continue; |
0 | 3188 pParty->uFlags |= 2u; |
1000 | 3189 GUIWindow::Create(574, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomIn, 0); |
0 | 3190 uNumSeconds = 32768; |
3191 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
3192 --viewparams->field_28; | |
3193 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
3194 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3195 { | |
3196 v119 = 512; | |
3197 if ( (signed int)v118 < 512 ) | |
3198 { | |
3199 viewparams->field_28 = 9; | |
3200 v118 = v119; | |
3201 viewparams->uMinimapZoom = v119; | |
3202 } | |
1051 | 3203 _576E2C_current_minimap_zoom = v118; |
0 | 3204 dword_576E28 = viewparams->field_28; |
3205 } | |
3206 else | |
3207 { | |
3208 if ( (signed int)v118 < 256 ) | |
3209 { | |
3210 viewparams->uMinimapZoom = 256; | |
3211 viewparams->field_28 = 8; | |
3212 } | |
3213 } | |
4 | 3214 default: |
3215 continue; | |
0 | 3216 } |
3217 } | |
3218 } | |
1012 | 3219 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8; |
3220 memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages); | |
3221 //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8); | |
3222 //dword_50C9E8 = 0; | |
3223 | |
3224 | |
3225 pMessageQueue_50C9E8->uNumMessages=0; | |
0 | 3226 if ( dword_50C9DC ) |
3227 { | |
437 | 3228 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 3229 { |
3230 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC; | |
3231 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = (int)ptr_50C9E0; | |
3232 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3233 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 3234 }*/ |
3235 pMessageQueue_50CBD0->AddMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0); | |
0 | 3236 dword_50C9DC = 0; |
3237 } | |
3238 else | |
3239 { | |
3240 if ( dword_50C9D0 > 0 ) | |
3241 { | |
3242 dword_50C9D8 -= pEventTimer->uTimeElapsed; | |
3243 if ( dword_50C9D8 <= 0 ) | |
3244 { | |
437 | 3245 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 3246 { |
3247 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9D0; | |
3248 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = dword_50C9D4; | |
3249 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3250 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 3251 }*/ |
3252 pMessageQueue_50CBD0->AddMessage((UIMessageType)dword_50C9D0, dword_50C9D4, 0); | |
0 | 3253 dword_50C9D0 = 0; |
3254 dword_50C9D4 = 0; | |
3255 dword_50C9D8 = 0; | |
3256 } | |
3257 } | |
3258 } | |
1202 | 3259 pCastSpellInfo.data()->_427E01_cast_spell(); |
0 | 3260 } |
3261 | |
3262 //----- (004356FF) -------------------------------------------------------- | |
3263 void __cdecl back_to_game() | |
3264 { | |
3265 dword_507BF0_is_there_popup_onscreen = 0; | |
3266 dword_4E455C = 1; | |
3267 dword_50CDCC = 0; | |
3268 if ( pGUIWindow_ScrollWindow ) | |
3269 free_book_subwindow(); | |
3270 if ( !pCurrentScreen && !pGUIWindow_Settings ) | |
3271 pEventTimer->Resume(); | |
3272 viewparams->bRedrawGameUI = 1; | |
3273 } | |
782 | 3274 |
0 | 3275 //----- (00435748) -------------------------------------------------------- |
3276 void __cdecl GUI_MainMenuMessageProc() | |
3277 { | |
967 | 3278 Player *pPlayer; // ebx@2 |
0 | 3279 void *v3; // edi@21 |
3280 signed int v4; // eax@29 | |
3281 int v5; // ecx@29 | |
821 | 3282 PLAYER_SKILL_TYPE v6; // edi@37 |
0 | 3283 GUIWindow *pWindow; // eax@56 |
3284 GUIButton *pButton; // eax@59 | |
3285 int v15; // edi@70 | |
3286 char v20; // dl@116 | |
3287 unsigned int v21; // eax@116 | |
3288 unsigned int v25; // eax@120 | |
3289 unsigned int v26; // ecx@127 | |
3290 SoundID pSoundID; // [sp-2Ch] [bp-3Ch]@36 | |
3291 signed int v41; // [sp-10h] [bp-20h]@29 | |
971 | 3292 int pParam; // [sp+4h] [bp-Ch]@3 |
0 | 3293 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3 |
967 | 3294 int pSex; // [sp+Ch] [bp-4h]@3 |
0 | 3295 |
3296 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3297 { | |
2 | 3298 pPlayer = pParty->pPlayers; |
0 | 3299 do |
3300 { | |
187 | 3301 int param2; |
971 | 3302 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, ¶m2); |
3303 auto player = &pParty->pPlayers[pParam]; | |
187 | 3304 |
3 | 3305 switch (pUIMessageType) // For buttons of window MainMenu |
2 | 3306 { |
165 | 3307 case UIMSG_MainMenu_ShowPartyCreationWnd: |
962 | 3308 GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); |
0 | 3309 SetCurrentMenuID(MENU_NEWGAME); |
960 | 3310 break; |
165 | 3311 case UIMSG_MainMenu_ShowLoadWindow: |
962 | 3312 GUIWindow::Create(495, 227, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnLoad, 0); |
0 | 3313 SetCurrentMenuID(MENU_SAVELOAD); |
960 | 3314 break; |
165 | 3315 case UIMSG_ShowCredits: |
962 | 3316 GUIWindow::Create(495, 282, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnCredits, 0); |
0 | 3317 SetCurrentMenuID(MENU_CREDITS); |
960 | 3318 break; |
165 | 3319 case UIMSG_ExitToWindows: |
962 | 3320 GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); |
982 | 3321 SetCurrentMenuID(MENU_EXIT_GAME); |
960 | 3322 break; |
187 | 3323 case UIMSG_PlayerCreation_SelectAttribute: |
960 | 3324 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3325 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
3326 uPlayerCreationUI_SelectedCharacter = pParam; | |
960 | 3327 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3328 break; | |
187 | 3329 case UIMSG_PlayerCreation_VoicePrev: |
967 | 3330 pSex = player->GetSexByVoice(); |
960 | 3331 do |
3332 { | |
3333 if (player->uVoiceID == 0) | |
3334 player->uVoiceID = 19; | |
3335 else --player->uVoiceID; | |
3336 } | |
967 | 3337 while (player->GetSexByVoice() != pSex); |
971 | 3338 pButton = pCreationUI_BtnPressLeft2[pParam]; |
962 | 3339 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); |
960 | 3340 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3341 player->PlaySound(SPEECH_PickMe, 0); | |
3342 break; | |
187 | 3343 case UIMSG_PlayerCreation_VoiceNext: |
967 | 3344 pSex = player->GetSexByVoice(); |
3345 do | |
3346 { | |
3347 player->uVoiceID = (player->uVoiceID + 1) % 20; | |
3348 } | |
3349 while (player->GetSexByVoice() != pSex); | |
971 | 3350 pButton = pCreationUI_BtnPressRight2[pParam]; |
967 | 3351 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); |
3352 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); | |
3353 player->PlaySound(SPEECH_PickMe, 0); | |
3354 break; | |
187 | 3355 case UIMSG_PlayerCreation_FacePrev: |
971 | 3356 pPlayer = &pParty->pPlayers[pParam]; |
1014 | 3357 if (!pPlayer->uCurrentFace) |
3358 pPlayer->uCurrentFace = 19; | |
960 | 3359 else |
1014 | 3360 pPlayer->uCurrentFace -= 1; |
3361 pPlayer->uVoiceID = pPlayer->uCurrentFace; | |
960 | 3362 pPlayer->SetInitialStats(); |
3363 pPlayer->SetSexByVoice(); | |
3364 pPlayer->RandomizeName(); | |
971 | 3365 v25 = pParam; |
960 | 3366 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3367 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3368 uPlayerCreationUI_SelectedCharacter = v25; |
962 | 3369 GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], 1); |
960 | 3370 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); |
3371 pPlayer->PlaySound(SPEECH_PickMe, 0); | |
3372 break; | |
187 | 3373 case UIMSG_PlayerCreation_FaceNext: |
971 | 3374 pPlayer = &pParty->pPlayers[pParam]; |
1014 | 3375 v20 = (char)((int)pPlayer->uCurrentFace + 1) % 20; |
3376 pPlayer->uCurrentFace = v20; | |
960 | 3377 pPlayer->uVoiceID = v20; |
3378 pPlayer->SetInitialStats(); | |
3379 pPlayer->SetSexByVoice(); | |
3380 pPlayer->RandomizeName(); | |
971 | 3381 v21 = pParam; |
960 | 3382 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3383 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3384 uPlayerCreationUI_SelectedCharacter = v21; |
962 | 3385 GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], 1); |
960 | 3386 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3387 pPlayer->PlaySound(SPEECH_PickMe, 0); | |
3388 break; | |
3389 case UIMSG_PlayerCreationClickPlus: | |
962 | 3390 GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, 1); |
960 | 3391 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
3392 pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); | |
3393 break; | |
3394 case UIMSG_PlayerCreationClickMinus: | |
962 | 3395 GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, 1); |
960 | 3396 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
3397 pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); | |
3398 break; | |
3399 case UIMSG_PlayerCreationSelectActiveSkill: | |
967 | 3400 pPlayer = &pPlayer[uPlayerCreationUI_SelectedCharacter]; |
971 | 3401 v6 = pPlayer->GetSkillIdxByOrder(pParam + 4); |
967 | 3402 if ( pPlayer->GetSkillIdxByOrder(3) == 37 ) |
3403 pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1; | |
3404 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); | |
3405 break; | |
960 | 3406 case UIMSG_PlayerCreationSelectClass: |
971 | 3407 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam); |
960 | 3408 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3409 break; | |
3410 case UIMSG_PlayerCreationClickOK: | |
962 | 3411 GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0); |
960 | 3412 if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() ) |
3413 GameUI_Footer_TimeLeft = GetTickCount() + 4000; | |
3414 else | |
982 | 3415 uGameState = GAME_STATE_STARTING_NEW_GAME; |
960 | 3416 break; |
3417 case UIMSG_PlayerCreationClickReset: | |
962 | 3418 GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0); |
960 | 3419 pParty->Reset(); |
3420 break; | |
3421 case UIMSG_PlayerCreationRemoveUpSkill: | |
971 | 3422 uPlayerCreationUI_SelectedCharacter = pParam; |
960 | 3423 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; |
3424 //int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; | |
3425 v41 = 2; | |
971 | 3426 v5 = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3427 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; |
3428 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) | |
3429 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; | |
3430 break; | |
3431 case UIMSG_PlayerCreationChangeName: | |
3432 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); | |
971 | 3433 v3 = (void *)pParam; |
3434 uPlayerCreationUI_SelectedCharacter = pParam; | |
960 | 3435 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu); |
3436 pGUIWindow_CurrentMenu->ptr_1C = v3; | |
3437 break; | |
3438 case UIMSG_ChangeGameState: | |
978 | 3439 uGameState = GAME_FINISHED; |
960 | 3440 break; |
3441 case UIMSG_11: | |
3442 pMouse->SetCursorBitmap("MICON2"); | |
3443 break; | |
3444 case UIMSG_3A: | |
3445 SetCurrentMenuID(MENU_10); | |
3446 break; | |
165 | 3447 case UIMSG_LoadGame: |
0 | 3448 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) |
960 | 3449 break; |
961 | 3450 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
960 | 3451 break; |
165 | 3452 case UIMSG_SelectLoadSlot: |
0 | 3453 //main menu save/load wnd clicking on savegame lines |
1038 | 3454 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
3455 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
971 | 3456 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition ) |
0 | 3457 { |
3458 //load clicked line | |
971 | 3459 v26 = pParam + pSaveListPosition; |
3460 if ( dword_6BE138 == pParam + pSaveListPosition ) | |
0 | 3461 { |
961 | 3462 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); |
437 | 3463 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); |
0 | 3464 } |
3465 uLoadGameUI_SelectedSlot = v26; | |
3466 dword_6BE138 = v26; | |
3467 } | |
3468 else | |
3469 { | |
3470 //typing in the line | |
3 | 3471 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); |
0 | 3472 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); |
3473 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); | |
3474 } | |
960 | 3475 break; |
961 | 3476 case UIMSG_SaveLoadBtn: |
3477 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); | |
960 | 3478 break; |
165 | 3479 case UIMSG_DownArrow: |
3 | 3480 ++pSaveListPosition; |
971 | 3481 if ( pSaveListPosition >= pParam ) |
3482 pSaveListPosition = pParam - 1; | |
3 | 3483 if ( pSaveListPosition < 1 ) |
3484 pSaveListPosition = 0; | |
3485 pWindow = pGUIWindow_CurrentMenu; | |
962 | 3486 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_PressedButton2, (int)pBtnDownArrow, 0); |
960 | 3487 break; |
165 | 3488 case UIMSG_Cancel: |
960 | 3489 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0); |
3490 break; | |
165 | 3491 case UIMSG_ArrowUp: |
3 | 3492 --pSaveListPosition; |
3493 if ( pSaveListPosition < 0 ) | |
3494 pSaveListPosition = 0; | |
3495 pWindow = pGUIWindow_CurrentMenu; | |
962 | 3496 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_PressedButton2, (int)pBtnArrowUp, 0); |
960 | 3497 break; |
3498 case UIMSG_AD: | |
962 | 3499 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); |
961 | 3500 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
960 | 3501 break; |
3502 case UIMSG_AE: | |
962 | 3503 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); |
165 | 3504 SetCurrentMenuID(MENU_10); |
960 | 3505 break; |
3506 case UIMSG_Escape: | |
0 | 3507 if ( ptr_507BDC ) |
3508 { | |
3509 sub_41426F(); | |
960 | 3510 break; |
0 | 3511 } |
3512 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) ) | |
960 | 3513 break; |
0 | 3514 v15 = 1; |
3515 pVideoPlayer->bStopBeforeSchedule = 1; | |
3516 viewparams->bRedrawGameUI = 1; | |
3517 viewparams->field_48 = 1; | |
165 | 3518 if ( !GetCurrentMenuID() || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC ) |
3519 { | |
3520 if ( pCurrentScreen == SCREEN_VIDEO ) | |
3521 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
3522 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
3523 { | |
3524 SetCurrentMenuID(MENU_CREATEPARTY); | |
960 | 3525 break; |
0 | 3526 } |
165 | 3527 if (GetCurrentMenuID() == MENU_CREDITSPROC) |
3528 { | |
3529 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
960 | 3530 break; |
0 | 3531 } |
437 | 3532 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); |
960 | 3533 break; |
0 | 3534 } |
971 | 3535 if ( GetCurrentMenuID() == MENU_CREDITSPROC && !pCurrentScreen ) |
3536 { | |
3537 if ( pCurrentScreen == SCREEN_VIDEO ) | |
3538 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
3539 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
3540 { | |
3541 SetCurrentMenuID(MENU_CREATEPARTY); | |
3542 break; | |
3543 } | |
3544 if (GetCurrentMenuID() == MENU_CREDITSPROC) | |
3545 { | |
3546 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
3547 break; | |
3548 } | |
3549 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); | |
3550 break; | |
3551 } | |
151 | 3552 if ( pCurrentScreen == SCREEN_LOADGAME ) |
0 | 3553 { |
3554 pIcons_LOD->_4114F2(); | |
3555 //crt_deconstruct_ptr_6A0118(); | |
3556 pTexture_PCX.Release(); | |
3557 pTexture_PCX.Load("title.pcx", 0); | |
3558 SetCurrentMenuID(MENU_MAIN); | |
3559 v15 = 1; | |
3560 pGUIWindow_CurrentMenu->Release(); | |
3561 pGUIWindow2->Release(); | |
3562 pGUIWindow2 = 0; | |
3563 pEventTimer->Resume(); | |
151 | 3564 pCurrentScreen = SCREEN_GAME; |
0 | 3565 viewparams->bRedrawGameUI = v15; |
960 | 3566 break; |
0 | 3567 } |
151 | 3568 if ( pCurrentScreen == SCREEN_VIDEO ) |
0 | 3569 { |
3570 pVideoPlayer->Unload(); | |
3571 } | |
3572 else | |
3573 { | |
151 | 3574 if ( pCurrentScreen != SCREEN_1B ) |
2 | 3575 { |
3576 pGUIWindow_CurrentMenu->Release(); | |
3577 pGUIWindow2->Release(); | |
3578 pGUIWindow2 = 0; | |
3579 pEventTimer->Resume(); | |
151 | 3580 pCurrentScreen = SCREEN_GAME; |
2 | 3581 viewparams->bRedrawGameUI = v15; |
960 | 3582 break; |
2 | 3583 } |
0 | 3584 //VideoPlayer::dtor(); |
3585 } | |
960 | 3586 break; |
3587 case UIMSG_PlayerCreationRemoveDownSkill: | |
971 | 3588 uPlayerCreationUI_SelectedCharacter = pParam; |
165 | 3589 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 |
971 | 3590 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
165 | 3591 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3) |
0 | 3592 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; |
960 | 3593 break; |
3594 default: | |
3595 break; | |
0 | 3596 } |
3597 } | |
3598 while ( pMessageQueue_50CBD0->uNumMessages ); | |
3599 } | |
3600 } | |
3601 | |
3602 //----- (00436427) -------------------------------------------------------- | |
3603 double __cdecl get_shading_dist_mist() | |
3604 { | |
3605 double result; // st7@2 | |
3606 | |
3607 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3608 result = (double)pOutdoorCamera->shading_dist_mist; | |
3609 else | |
3610 result = 16192.0; | |
3611 return result; | |
3612 } | |
3613 | |
3614 //----- (0043648F) -------------------------------------------------------- | |
3615 void Vec3_short__to_RenderVertexSoft(RenderVertexSoft *_this, Vec3_short_ *a2) | |
3616 { | |
3617 _this->flt_2C = 0.0; | |
3618 | |
3619 _this->vWorldPosition.x = a2->x; | |
3620 _this->vWorldPosition.y = a2->y; | |
3621 _this->vWorldPosition.z = a2->z; | |
3622 } | |
3623 | |
3624 //----- (004369DB) -------------------------------------------------------- | |
3625 void Vec3_float_::Normalize() | |
3626 { | |
1025 | 3627 this->x = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->x; |
3628 this->y = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->y; | |
3629 this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z; | |
0 | 3630 } |
3631 | |
1262 | 3632 //----- (00438526) -------------------------------------------------------- |
3633 stru11::stru11() | |
3634 { | |
3635 stru11 *v1; // esi@1 | |
3636 signed int v2; // eax@1 | |
3637 char *v3; // edx@1 | |
3638 | |
3639 v1 = this; | |
3640 v2 = 0; | |
3641 this->cpuid_00000000_eax_numops = 0; | |
3642 this->cpuid_00000001_eax = 0; | |
3643 this->cpuid_00000001_edx = 0; | |
3644 this->field_38 = 0; | |
3645 this->field_3C = 0; | |
3646 this->cpuid_80000000_edx = 0; | |
3647 this->cpuid_80000001_eax = 0; | |
3648 this->cpuid_80000001_edx = 0; | |
3649 this->cpuid_80000005_ebx = 0; | |
3650 this->cpuid_80000005_ecx = 0; | |
3651 this->cpuid_80000005_edx = 0; | |
3652 this->cpuid_80000006_ecx = 0; | |
3653 this->field_AC = 0; | |
3654 this->uProcessorManufacturer = 0; | |
3655 LOBYTE(this->cpuid_80000002_registers2[0]) = 0; | |
3656 v3 = (char *)&this->cpuid_00000002_eax; | |
3657 do | |
3658 { | |
3659 if ( v2 < 3 ) | |
3660 *((int *)v3 - 9) = 0; | |
3661 if ( v2 < 4 ) | |
3662 *(int *)v3 = 0; | |
3663 if ( v2 < 12 ) | |
3664 *((int *)v3 + 17) = 0; | |
3665 if ( v2 < 13 ) | |
3666 this->pCPUString[v2] = 0; | |
3667 if ( v2 < 30 ) | |
3668 *((char *)this->field_40 + v2) = 0; | |
3669 *((char *)&this->cpuid_80000002_registers2[0] + v2++ + 1) = 0; | |
3670 v3 += 4; | |
3671 } | |
3672 while ( v2 < 48 ); | |
3673 CheckCPU(); | |
3674 } | |
3675 | |
0 | 3676 //----- (004385B5) -------------------------------------------------------- |
3677 void stru11::CheckCPU() | |
3678 { | |
3679 LOG_DECOMPILATION_WARNING(); | |
3680 /* | |
3681 int v5; // [sp-4h] [bp-10h]@0 | |
3682 signed int v6; // [sp+4h] [bp-8h]@1 | |
3683 signed int v7; // [sp+8h] [bp-4h]@1 | |
3684 | |
3685 _CF = 0; | |
3686 _OF = 0; | |
3687 _ZF = 1; | |
3688 _SF = 0; | |
3689 v7 = 0; | |
3690 __asm { pushf } | |
3691 v6 = 3; | |
3692 if ( v5 != (v5 ^ 0x40000) ) | |
3693 { | |
3694 __asm { popf } | |
3695 v6 = 4; | |
3696 __asm { pushf } | |
3697 if ( v5 != (v5 ^ 0x200000) ) | |
3698 { | |
3699 v7 = 1; | |
3700 v6 = 0; | |
3701 } | |
3702 } | |
3703 if ( v6 == 3 ) | |
3704 { | |
3705 this->field_AC = 1; | |
3706 } | |
3707 else | |
3708 { | |
3709 if ( v6 == 4 ) | |
3710 { | |
3711 this->field_AC = 2; | |
3712 } | |
3713 else | |
3714 { | |
3715 if ( v7 ) | |
3716 { | |
3717 this->field_AC = 2; | |
3718 RunCPUID(); | |
3719 } | |
3720 else | |
3721 { | |
3722 this->field_AC = 0; | |
3723 } | |
3724 } | |
3725 }*/ | |
3726 } | |
3727 | |
3728 //----- (00438659) -------------------------------------------------------- | |
3729 void stru11::RunCPUID() | |
3730 { | |
3731 __debugbreak(); | |
3732 /*stru11 *v6; // esi@1 | |
3733 unsigned int uNumOps; // edi@1 | |
3734 int uNumExtOps; // edi@16 | |
3735 char pCyrixString[16]; // [sp+Ch] [bp-60h]@1 | |
3736 char pCentaurString[16]; // [sp+1Ch] [bp-50h]@1 | |
3737 char pAMDString[16]; // [sp+2Ch] [bp-40h]@1 | |
3738 char pIntelString[16]; // [sp+3Ch] [bp-30h]@1 | |
3739 char pCPUString[16]; // [sp+4Ch] [bp-20h]@1 | |
3740 stru11 *thisa; // [sp+5Ch] [bp-10h]@1 | |
3741 char *v35; // [sp+60h] [bp-Ch]@1 | |
3742 int v36; // [sp+64h] [bp-8h]@1 | |
3743 int v37; // [sp+68h] [bp-4h]@1 | |
3744 | |
3745 thisa = this; | |
3746 *(int *)pIntelString = *(int *)"GenuineIntel"; | |
3747 *(int *)&pIntelString[4] = *(int *)"ineIntel"; | |
3748 *(int *)&pIntelString[8] = *(int *)"ntel"; | |
3749 pIntelString[12] = aGenuineintel[12]; | |
3750 *(int *)pAMDString = *(int *)"AuthenticAMD"; | |
3751 *(int *)&pAMDString[4] = *(int *)"enticAMD"; | |
3752 *(int *)&pAMDString[8] = *(int *)"cAMD"; | |
3753 pAMDString[12] = aAuthenticamd[12]; | |
3754 *(int *)pCyrixString = *(int *)"CyrixInstead"; | |
3755 *(int *)&pCyrixString[4] = *(int *)"xInstead"; | |
3756 *(int *)&pCyrixString[8] = *(int *)"tead"; | |
3757 pCyrixString[12] = aCyrixinstead[12]; | |
3758 *(int *)pCentaurString = *(int *)"CentaurHauls"; | |
3759 *(int *)&pCentaurString[4] = *(int *)"aurHauls"; | |
3760 *(int *)&pCentaurString[8] = *(int *)"auls"; | |
3761 v37 = 0; | |
3762 v36 = 0; | |
3763 pCentaurString[12] = aCentaurhauls[12]; | |
3764 v35 = pCPUString; | |
3765 pCPUString[12] = 0; | |
3766 _EAX = 0; | |
3767 __asm { cpuid } | |
3768 v37 = _EAX; | |
3769 *(int *)pCPUString = _EBX; | |
3770 *(int *)&pCPUString[4] = _EDX; | |
3771 *(int *)&pCPUString[8] = _ECX; | |
3772 v6 = thisa; | |
3773 uNumOps = _EAX; | |
3774 thisa->cpuid_00000000_ebx_vendorstr1 = _EBX; | |
3775 v6->cpuid_00000000_edx_vendorstr2 = *(int *)&pCPUString[4]; | |
3776 v6->cpuid_00000000_ecx_vendorstr3 = *(int *)&pCPUString[8]; | |
3777 v6->cpuid_00000000_eax_numops = _EAX; | |
3778 strcpy(v6->pCPUString, pCPUString); | |
3779 if ( strcmp(pIntelString, pCPUString) ) | |
3780 { | |
3781 if ( strcmp(pAMDString, pCPUString) ) | |
3782 { | |
3783 if ( strcmp(pCyrixString, pCPUString) ) | |
3784 { | |
3785 if ( strcmp(pCentaurString, pCPUString) ) | |
3786 v6->uProcessorManufacturer = 0; | |
3787 else | |
3788 v6->uProcessorManufacturer = 4; | |
3789 } | |
3790 else | |
3791 { | |
3792 v6->uProcessorManufacturer = 3; | |
3793 } | |
3794 } | |
3795 else | |
3796 { | |
3797 v6->uProcessorManufacturer = 2; | |
3798 } | |
3799 } | |
3800 else | |
3801 { | |
3802 v6->uProcessorManufacturer = 1; | |
3803 } | |
3804 if ( uNumOps >= 1 ) | |
3805 RunCPUID_op1(); | |
3806 if ( uNumOps >= 2 ) | |
3807 RunCPUID_op2(); | |
3808 _EAX = 0x80000000u; | |
3809 __asm { cpuid } | |
3810 if ( !(_EAX & 0x80000000) ) | |
3811 _EAX = 0x80000000u; | |
3812 v36 = _EAX; | |
3813 v6->cpuid_80000000_edx = _EAX; | |
3814 uNumExtOps = _EAX ^ 0x80000000; | |
3815 if ( (_EAX ^ 0x80000000u) >= 1 ) | |
3816 { | |
3817 _EAX = 0x80000001u; | |
3818 __asm { cpuid } | |
3819 thisa = (stru11 *)_EAX; | |
3820 v35 = (char *)_EDX; | |
3821 v6->cpuid_80000001_eax = _EAX; | |
3822 v6->cpuid_80000001_edx = (int)v35; | |
3823 } | |
3824 if ( (unsigned int)uNumExtOps >= 4 ) | |
3825 RunCPUID_ext2_3_4(); | |
3826 if ( (unsigned int)uNumExtOps >= 5 ) | |
3827 { | |
3828 _EAX = 0x80000005u; | |
3829 __asm { cpuid } | |
3830 thisa = (stru11 *)_EBX; | |
3831 v35 = (char *)_ECX; | |
3832 v36 = _EDX; | |
3833 v6->cpuid_80000005_ebx = _EBX; | |
3834 v6->cpuid_80000005_ecx = (int)v35; | |
3835 v6->cpuid_80000005_edx = v36; | |
3836 } | |
3837 if ( (unsigned int)uNumExtOps >= 6 ) | |
3838 { | |
3839 _EAX = 0x80000006u; | |
3840 __asm { cpuid } | |
3841 v6->cpuid_80000006_ecx = _ECX; | |
3842 }*/ | |
3843 } | |
3844 | |
3845 //----- (00438821) -------------------------------------------------------- | |
3846 void stru11::RunCPUID_op1() | |
3847 { | |
3848 __debugbreak(); | |
3849 /*stru11 *v1; // esi@1 | |
3850 unsigned int v7; // ecx@1 | |
3851 int v8; // eax@3 | |
3852 int v9; // eax@10 | |
3853 signed int v10; // eax@11 | |
3854 int v11; // ecx@11 | |
3855 int v12; // eax@15 | |
3856 signed int v13; // eax@19 | |
3857 int v14; // ecx@19 | |
3858 signed int v15; // eax@25 | |
3859 int v16; // ecx@25 | |
3860 signed int v17; // eax@34 | |
3861 int v18; // ecx@34 | |
3862 | |
3863 v1 = this; | |
3864 _EAX = 1; | |
3865 __asm { cpuid } | |
3866 v7 = _EAX; | |
3867 v1->cpuid_00000001_edx = _EDX; | |
3868 v1->cpuid_00000001_eax = _EAX; | |
3869 if ( (_EAX & 0x3000) == 8192 ) | |
3870 { | |
3871 LOBYTE(v1->cpuid_80000002_registers2[0]) = 1; | |
3872 v7 = 0; | |
3873 } | |
3874 v8 = (v7 >> 8) & 0xF; | |
3875 switch ( v8 ) | |
3876 { | |
3877 case 4: | |
3878 v1->field_AC = 2; | |
3879 break; | |
3880 case 5: | |
3881 v1->field_AC = 15; | |
3882 break; | |
3883 case 6: | |
3884 v1->field_AC = 36; | |
3885 break; | |
3886 default: | |
3887 v1->field_AC = 49; | |
3888 break; | |
3889 } | |
3890 v9 = v1->uProcessorManufacturer; | |
3891 if ( v9 == 1 ) | |
3892 { | |
3893 v10 = 0; | |
3894 v11 = v7 & 0x3FF0; | |
3895 while ( v11 != dword_4E4948[2 * v10] ) | |
3896 { | |
3897 ++v10; | |
3898 if ( v10 >= 17 ) | |
3899 return; | |
3900 } | |
3901 v12 = dword_4E494C[2 * v10]; | |
3902 goto LABEL_39; | |
3903 } | |
3904 if ( v9 == 2 ) | |
3905 { | |
3906 if ( (v7 & 0xF00) == dword_4E49D0[0] ) | |
3907 { | |
3908 v12 = dword_4E49D4[0]; | |
3909 } | |
3910 else | |
3911 { | |
3912 v13 = 1; | |
3913 v14 = v7 & 0x3FF0; | |
3914 while ( v14 != dword_4E49D0[2 * v13] ) | |
3915 { | |
3916 ++v13; | |
3917 if ( v13 >= 9 ) | |
3918 return; | |
3919 } | |
3920 v12 = dword_4E49D4[2 * v13]; | |
3921 } | |
3922 goto LABEL_39; | |
3923 } | |
3924 if ( v9 != 3 ) | |
3925 { | |
3926 if ( v9 != 4 ) | |
3927 return; | |
3928 v17 = 0; | |
3929 v18 = v7 & 0x3FF0; | |
3930 while ( v18 != dword_4E4A40[2 * v17] ) | |
3931 { | |
3932 ++v17; | |
3933 if ( v17 >= 2 ) | |
3934 return; | |
3935 } | |
3936 v12 = dword_4E4A44[2 * v17]; | |
3937 goto LABEL_39; | |
3938 } | |
3939 v15 = 1; | |
3940 v16 = v7 & 0x3FF0; | |
3941 while ( v16 != dword_4E4A18[2 * v15] ) | |
3942 { | |
3943 ++v15; | |
3944 if ( v15 >= 5 ) | |
3945 goto LABEL_30; | |
3946 } | |
3947 v1->field_AC = dword_4E4A1C[2 * v15]; | |
3948 LABEL_30: | |
3949 v12 = 24; | |
3950 if ( v1->field_AC == 24 ) | |
3951 { | |
3952 if ( _EDX != 1 ) | |
3953 v12 = (((_EDX != 261) - 1) & 0xA) + 15; | |
3954 LABEL_39: | |
3955 v1->field_AC = v12; | |
3956 }*/ | |
3957 } | |
3958 | |
3959 //----- (00438992) -------------------------------------------------------- | |
3960 void stru11::RunCPUID_op2() | |
3961 { | |
3962 __debugbreak(); | |
3963 /* | |
3964 stru11 *v1; // edi@1 | |
3965 int v7; // eax@1 | |
3966 signed int v8; // ecx@2 | |
3967 unsigned __int8 v9; // al@3 | |
3968 signed int v10; // ecx@14 | |
3969 unsigned __int8 v11; // al@15 | |
3970 int v12; // [sp+Ch] [bp-14h]@1 | |
3971 int v13; // [sp+10h] [bp-10h]@1 | |
3972 int v14; // [sp+14h] [bp-Ch]@1 | |
3973 int v15; // [sp+18h] [bp-8h]@1 | |
3974 int *v16; // [sp+1Ch] [bp-4h]@1 | |
3975 | |
3976 v1 = this; | |
3977 v16 = &v12; | |
3978 _EAX = 2; | |
3979 __asm { cpuid } | |
3980 v12 = _EAX; | |
3981 v13 = _EBX; | |
3982 v14 = _ECX; | |
3983 v15 = _EDX; | |
3984 v1->cpuid_00000002_eax = _EAX; | |
3985 v1->cpuid_00000002_ebx = v13; | |
3986 v1->cpuid_00000002_ecx = v14; | |
3987 v1->cpuid_00000002_edx = v15; | |
3988 v7 = v1->field_AC; | |
3989 if ( v7 == 40 ) | |
3990 { | |
3991 v8 = 0; | |
3992 while ( 1 ) | |
3993 { | |
3994 v9 = *((char *)&v12 + v8); | |
3995 if ( v9 == 64 ) | |
3996 { | |
3997 v1->field_AC = 43; | |
3998 return; | |
3999 } | |
4000 if ( v9 >= 0x41u && v9 <= 0x43u ) | |
4001 { | |
4002 v1->field_AC = 41; | |
4003 return; | |
4004 } | |
4005 if ( v9 >= 0x44u && v9 <= 0x45u ) | |
4006 break; | |
4007 ++v8; | |
4008 if ( v8 >= 16 ) | |
4009 return; | |
4010 } | |
4011 v1->field_AC = 42; | |
4012 } | |
4013 else | |
4014 { | |
4015 if ( v7 == 45 ) | |
4016 { | |
4017 v10 = 0; | |
4018 while ( 1 ) | |
4019 { | |
4020 v11 = *((char *)&v12 + v10); | |
4021 if ( v11 >= 0x40u && v11 <= 0x43u ) | |
4022 { | |
4023 v1->field_AC = 46; | |
4024 return; | |
4025 } | |
4026 if ( v11 >= 0x44u && v11 <= 0x45u ) | |
4027 break; | |
4028 ++v10; | |
4029 if ( v10 >= 16 ) | |
4030 return; | |
4031 } | |
4032 v1->field_AC = 47; | |
4033 } | |
4034 }*/ | |
4035 } | |
4036 | |
4037 //----- (00438A67) -------------------------------------------------------- | |
4038 void stru11::RunCPUID_ext2_3_4() | |
4039 { | |
4040 __debugbreak(); | |
4041 /*stru11 *v1; // edi@1 | |
4042 stru11 *v17; // eax@1 | |
4043 int v18[3][4]; // [sp+Ch] [bp-38h]@1 | |
4044 stru11 *v19; // [sp+3Ch] [bp-8h]@1 | |
4045 | |
4046 v1 = this; | |
4047 v19 = this; | |
4048 _EAX = 0x80000002u; | |
4049 __asm { cpuid } | |
4050 v18[0][0] = _EAX; | |
4051 *(_QWORD *)&v18[0][1] = __PAIR__(_ECX, _EBX); | |
4052 v18[0][3] = _EDX; | |
4053 _EAX = 0x80000003u; | |
4054 __asm { cpuid } | |
4055 v18[1][0] = _EAX; | |
4056 *(_QWORD *)&v18[1][1] = __PAIR__(_ECX, _EBX); | |
4057 v18[1][3] = _EDX; | |
4058 _EAX = 0x80000004u; | |
4059 __asm { cpuid } | |
4060 v18[2][0] = _EAX; | |
4061 *(_QWORD *)&v18[2][1] = __PAIR__(_ECX, _EBX); | |
4062 v18[2][3] = _EDX; | |
4063 v17 = v19; | |
4064 memcpy(v1->cpuid_80000002_registers, v18, 0x30u); | |
4065 memcpy((char *)&v17->cpuid_80000002_registers2[0] + 1, v18, 0x30u);*/ | |
4066 } | |
4067 | |
4068 //----- (00438BDF) -------------------------------------------------------- | |
4069 bool MonsterStats::BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype) | |
4070 { | |
4071 unsigned __int8 v2; // zf@15 | |
4072 char v3; // sf@15 | |
4073 unsigned __int8 v4; // of@15 | |
4074 bool result; // eax@33 | |
4075 | |
4076 switch ( eSupertype ) | |
4077 { | |
4078 case MONSTER_SUPERTYPE_UNDEAD: | |
4079 if ( (signed int)uMonsterInfoID >= MONSTER_GHOST_1 && (signed int)uMonsterInfoID <= MONSTER_GHOST_3 | |
4080 || (signed int)uMonsterInfoID >= MONSTER_LICH_1 && (signed int)uMonsterInfoID <= MONSTER_LICH_3 | |
4081 || (signed int)uMonsterInfoID >= MONSTER_SKELETON_1 && (signed int)uMonsterInfoID <= MONSTER_SKELETON_3 | |
4082 || (signed int)uMonsterInfoID >= MONSTER_VAMPIRE_1 && (signed int)uMonsterInfoID <= MONSTER_VAMPIRE_3 | |
4083 || (signed int)uMonsterInfoID >= MONSTER_WIGHT_1 && (signed int)uMonsterInfoID <= MONSTER_WIGHT_3 | |
4084 || (signed int)uMonsterInfoID >= MONSTER_ZOMBIE_1 && (signed int)uMonsterInfoID <= MONSTER_ZOMBIE_3 ) | |
4085 goto ret_true; | |
4086 if ( (signed int)uMonsterInfoID < MONSTER_GHOUL_1 ) | |
4087 goto ret_false; | |
4088 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_GHOUL_3); | |
4089 v2 = uMonsterInfoID == MONSTER_GHOUL_3; | |
4090 v3 = ((uMonsterInfoID - MONSTER_GHOUL_3) & 0x80000000u) != 0; | |
4091 goto false_if_outside; | |
4092 case MONSTER_SUPERTYPE_KREEGAN: | |
4093 if ( (signed int)uMonsterInfoID < MONSTER_DEVIL_1 ) | |
4094 goto ret_false; | |
4095 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DEVIL_3); | |
4096 v2 = uMonsterInfoID == MONSTER_DEVIL_3; | |
4097 v3 = ((uMonsterInfoID - MONSTER_DEVIL_3) & 0x80000000u) != 0; | |
4098 goto false_if_outside; | |
4099 case MONSTER_SUPERTYPE_ELF: | |
4100 if ( (signed int)uMonsterInfoID >= MONSTER_PEASANT_ELF_FEMALE_1_1 | |
4101 && (signed int)uMonsterInfoID <= MONSTER_PEASANT_ELF_MALE_3_3 | |
4102 || (signed int)uMonsterInfoID >= MONSTER_ELF_ARCHER_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_ARCHER_3 ) | |
4103 goto ret_true; | |
4104 if ( (signed int)uMonsterInfoID < MONSTER_ELF_SPEARMAN_1 ) | |
4105 goto ret_false; | |
4106 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELF_SPEARMAN_3); | |
4107 v2 = uMonsterInfoID == MONSTER_ELF_SPEARMAN_3; | |
4108 v3 = ((uMonsterInfoID - MONSTER_ELF_SPEARMAN_3) & 0x80000000u) != 0; | |
4109 goto false_if_outside; | |
4110 case MONSTER_SUPERTYPE_DRAGON: | |
4111 if ( (signed int)uMonsterInfoID < MONSTER_DRAGON_1 ) | |
4112 goto ret_false; | |
4113 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DRAGON_3); | |
4114 v2 = uMonsterInfoID == MONSTER_DRAGON_3; | |
4115 v3 = ((uMonsterInfoID - MONSTER_DRAGON_3) & 0x80000000u) != 0; | |
4116 goto false_if_outside; | |
4117 case MONSTER_SUPERTYPE_WATER_ELEMENTAL: | |
4118 if ( (signed int)uMonsterInfoID < MONSTER_ELEMENTAL_WATER_1 ) | |
4119 goto ret_false; | |
4120 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELEMENTAL_WATER_3); | |
4121 v2 = uMonsterInfoID == MONSTER_ELEMENTAL_WATER_3; | |
4122 v3 = ((uMonsterInfoID - MONSTER_ELEMENTAL_WATER_3) & 0x80000000u) != 0; | |
4123 goto false_if_outside; | |
4124 case MONSTER_SUPERTYPE_TREANT: | |
4125 if ( (signed int)uMonsterInfoID < MONSTER_TREANT_1 ) | |
4126 goto ret_false; | |
4127 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TREANT_3); | |
4128 v2 = uMonsterInfoID == MONSTER_TREANT_3; | |
4129 v3 = ((uMonsterInfoID - MONSTER_TREANT_3) & 0x80000000u) != 0; | |
4130 goto false_if_outside; | |
4131 case MONSTER_SUPERTYPE_TITAN: | |
4132 if ( (signed int)uMonsterInfoID < MONSTER_TITAN_1 ) | |
4133 goto ret_false; | |
4134 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TITAN_3); | |
4135 v2 = uMonsterInfoID == MONSTER_TITAN_3; | |
4136 v3 = ((uMonsterInfoID - MONSTER_TITAN_3) & 0x80000000u) != 0; | |
4137 false_if_outside: | |
4138 if ( !((unsigned __int8)(v3 ^ v4) | v2) ) | |
4139 goto ret_false; | |
4140 ret_true: | |
4141 result = 1; | |
4142 break; | |
4143 default: | |
4144 ret_false: | |
4145 result = 0; | |
4146 break; | |
4147 } | |
4148 return result; | |
4149 } | |
4150 | |
4151 //----- (00438F8F) -------------------------------------------------------- | |
783 | 4152 void __cdecl area_of_effect__damage_evaluate() |
0 | 4153 { |
4154 int v0; // edx@1 | |
4155 char *v1; // esi@2 | |
4156 int v2; // ecx@3 | |
4157 signed int v3; // eax@3 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4158 SpriteObject *v4; // eax@4 |
0 | 4159 signed int v5; // eax@4 |
4160 signed int v6; // eax@6 | |
4161 unsigned int v7; // edi@6 | |
4162 int v8; // eax@6 | |
4163 __int16 v9; // bx@8 | |
4164 int v10; // edi@8 | |
4165 Vec3_int_ v11; // ST04_12@9 | |
4166 int v12; // ST0C_4@10 | |
4167 Actor *v13; // edi@11 | |
4168 int v14; // edx@15 | |
4169 int v15; // edx@15 | |
4170 int v16; // ebx@15 | |
4171 signed int v17; // eax@15 | |
4172 int v18; // edi@15 | |
4173 int v19; // edi@15 | |
4174 Vec3_int_ v20; // ST04_12@16 | |
4175 Vec3_int_ *v21; // eax@17 | |
4176 unsigned int v22; // edx@17 | |
4177 int v23; // edx@18 | |
4178 int v24; // eax@18 | |
4179 Vec3_int_ v25; // ST04_12@19 | |
4180 unsigned int v26; // ebx@20 | |
89 | 4181 Player *v27; // edi@20 |
90 | 4182 Actor *v28; // edi@27 |
0 | 4183 int v29; // ebx@29 |
4184 int v30; // eax@29 | |
4185 int v31; // edx@29 | |
4186 int v32; // eax@29 | |
4187 int v33; // ST24_4@29 | |
4188 Vec3_int_ v34; // ST04_12@30 | |
4189 Vec3_int_ *v35; // eax@31 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4190 SpriteObject *v36; // [sp+0h] [bp-28h]@0 |
0 | 4191 signed int v37; // [sp+4h] [bp-24h]@5 |
4192 int v38; // [sp+4h] [bp-24h]@15 | |
4193 signed int v39; // [sp+8h] [bp-20h]@3 | |
4194 int v40; // [sp+8h] [bp-20h]@15 | |
4195 int v41; // [sp+Ch] [bp-1Ch]@5 | |
4196 int v42; // [sp+Ch] [bp-1Ch]@15 | |
4197 int v43; // [sp+10h] [bp-18h]@1 | |
4198 int v44; // [sp+14h] [bp-14h]@15 | |
4199 unsigned int uActorID; // [sp+18h] [bp-10h]@6 | |
4200 Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 | |
4201 int a1; // [sp+20h] [bp-8h]@8 | |
4202 int v48; // [sp+24h] [bp-4h]@8 | |
4203 | |
4204 v0 = 0; | |
4205 v43 = 0; | |
4206 if ( stru_50FE08.count > 0 ) | |
4207 { | |
4208 pVelocity = &stru_50FE08.vec_4B4; | |
4209 v1 = (char *)stru_50FE08.pZs; | |
4210 do | |
4211 { | |
848 | 4212 v2 = PID_TYPE(*((short *)v1 - 300)); |
4213 v3 = PID_ID((signed int)*((short *)v1 - 300)); | |
4214 v39 = PID_ID((signed int)*((short *)v1 - 300)); | |
0 | 4215 if ( v2 == 2 ) |
4216 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4217 v4 = &pSpriteObjects[v3]; |
0 | 4218 v36 = v4; |
822 | 4219 v5 = v4->spell_caster_pid; |
848 | 4220 v2 = PID_TYPE(v5); |
4221 v3 = PID_ID(v5); | |
0 | 4222 } |
4223 v41 = v2; | |
4224 v37 = v3; | |
4225 if ( stru_50FE08.field_3EC[v0] & 1 ) | |
4226 { | |
417 | 4227 v6 = ai_near_actors_targets_pid[v3]; |
848 | 4228 v7 = PID_ID(v6); |
4229 v8 = PID_TYPE(v6) - 3; | |
0 | 4230 uActorID = v7; |
4231 if ( v8 ) | |
4232 { | |
4233 if ( v8 == 1 ) | |
4234 { | |
4235 v9 = *(short *)v1; | |
4236 v10 = pParty->vPosition.y - *((short *)v1 - 100); | |
4237 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
4238 v48 = v10; | |
4239 if ( a1 * a1 | |
4240 + v10 * v10 | |
4241 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) | |
4242 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
4243 { | |
4244 v11.z = *(short *)v1; | |
4245 v11.y = *((short *)v1 - 100); | |
4246 v11.x = *((short *)v1 - 200); | |
4247 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v11) ) | |
4248 { | |
4249 v12 = stru_50C198.which_player_would_attack(&pActors[v39]); | |
4250 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v12); | |
4251 } | |
4252 } | |
4253 } | |
4254 } | |
4255 else | |
4256 { | |
4257 v13 = &pActors[v7]; | |
4258 if ( SHIDWORD(v13->pActorBuffs[6].uExpireTime) > 0 | |
4259 || SHIDWORD(v13->pActorBuffs[6].uExpireTime) >= 0 && LODWORD(v13->pActorBuffs[6].uExpireTime) | |
4260 || v13->CanAct() ) | |
4261 { | |
4262 v14 = v13->vPosition.y; | |
4263 v40 = v13->vPosition.x; | |
4264 v38 = v14; | |
4265 v15 = v14 - *((short *)v1 - 100); | |
4266 v16 = *(short *)v1; | |
4267 v42 = v13->vPosition.z; | |
4268 a1 = v40 - *((short *)v1 - 200); | |
4269 v17 = v13->uActorHeight; | |
4270 v18 = v13->uActorRadius; | |
4271 v44 = v42; | |
4272 v19 = *((short *)v1 + 100) + v18; | |
4273 v48 = v15; | |
4274 if ( a1 * a1 + v15 * v15 + (v42 + (v17 >> 1) - v16) * (v42 + (v17 >> 1) - v16) < (unsigned int)(v19 * v19) ) | |
4275 { | |
4276 v20.z = *(short *)v1; | |
4277 v20.y = *((short *)v1 - 100); | |
4278 v20.x = *((short *)v1 - 200); | |
4279 if ( sub_407A1C(v40, v38, v42 + 50, v20) ) | |
4280 { | |
4281 Vec3_int_::Normalize(&a1, &v48, &v44); | |
4282 v21 = pVelocity; | |
4283 v22 = uActorID; | |
4284 pVelocity->x = a1; | |
4285 v21->y = v48; | |
4286 v21->z = v44; | |
4287 sub_43B1B0(*((short *)v1 - 300), v22, v21, stru_50FE08.field_450[v43]); | |
4288 } | |
4289 } | |
4290 } | |
4291 } | |
4292 } | |
4293 else | |
4294 { | |
4295 v23 = pParty->vPosition.y - *((short *)v1 - 100); | |
4296 v24 = ((signed int)pParty->uPartyHeight >> 1) - *(short *)v1; | |
4297 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
4298 v48 = v23; | |
4299 if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
4300 { | |
4301 v25.z = *(short *)v1; | |
4302 v25.y = *((short *)v1 - 100); | |
4303 v25.x = *((short *)v1 - 200); | |
4304 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v25) ) | |
4305 { | |
4306 v26 = 0; | |
89 | 4307 v27 = pParty->pPlayers;//[0].pConditions[15]; |
0 | 4308 do |
4309 { | |
89 | 4310 if ( !(HIDWORD(v27->pConditions[14]) | LODWORD(v27->pConditions[14])) && !v27->pConditions[15] && !v27->pConditions[16] ) |
0 | 4311 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v26); |
89 | 4312 ++v27; |
0 | 4313 ++v26; |
4314 } | |
89 | 4315 while ( v27 <= &pParty->pPlayers[3] ); |
0 | 4316 } |
4317 } | |
4318 uActorID = 0; | |
4319 if ( (signed int)uNumActors > 0 ) | |
4320 { | |
1202 | 4321 v28 = pActors.data();//[0].vPosition.z; |
0 | 4322 do |
4323 { | |
91 | 4324 if ( v28->CanAct() ) |
0 | 4325 { |
4326 v29 = *(short *)v1; | |
91 | 4327 v30 = v28->vPosition.y - *((short *)v1 - 100); |
4328 a1 = v28->vPosition.x - *((short *)v1 - 200); | |
90 | 4329 v31 = v28->vPosition.z; |
0 | 4330 v48 = v30; |
4331 v44 = v31; | |
90 | 4332 v32 = (v28->uActorHeight >> 1) - v29; |
91 | 4333 v33 = v28->uActorRadius + *((short *)v1 + 100); |
0 | 4334 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) |
4335 { | |
4336 v34.z = *(short *)v1; | |
4337 v34.y = *((short *)v1 - 100); | |
4338 v34.x = *((short *)v1 - 200); | |
90 | 4339 if ( sub_407A1C(v28->vPosition.x, v28->vPosition.y, v28->vPosition.z + 50, v34) ) |
0 | 4340 { |
4341 Vec3_int_::Normalize(&a1, &v48, &v44); | |
4342 v35 = pVelocity; | |
4343 pVelocity->x = a1; | |
4344 v35->y = v48; | |
4345 v35->z = v44; | |
4346 switch ( v41 ) | |
4347 { | |
303 | 4348 case OBJECT_Player: |
0 | 4349 DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); |
4350 break; | |
303 | 4351 case OBJECT_Actor: |
90 | 4352 if ( v36 && pActors[v37].GetActorsRelation(v28) ) |
0 | 4353 sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); |
4354 break; | |
303 | 4355 case OBJECT_Item: |
0 | 4356 sub_43B057(*((short *)v1 - 300), uActorID, v35); |
4357 break; | |
4358 } | |
4359 } | |
4360 } | |
4361 } | |
4362 ++uActorID; | |
90 | 4363 ++v28; |
0 | 4364 } |
4365 while ( (signed int)uActorID < (signed int)uNumActors ); | |
4366 } | |
4367 } | |
4368 ++pVelocity; | |
4369 v0 = v43 + 1; | |
4370 v1 += 2; | |
4371 ++v43; | |
4372 } | |
4373 while ( v43 < stru_50FE08.count ); | |
4374 } | |
4375 stru_50FE08.count = 0; | |
4376 } | |
4377 // 50FE08: using guessed type stru298 stru_50FE08; | |
4378 | |
4379 //----- (00439474) -------------------------------------------------------- | |
187 | 4380 void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) |
0 | 4381 { |
303 | 4382 //signed int v3; // eax@1 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4383 SpriteObject *v4; // ebx@1 |
303 | 4384 //int v5; // edx@3 |
4385 //bool uPlayerID; // eax@3 | |
4386 //Player *pPlayer; // edi@4 | |
0 | 4387 Actor *pMonster; // esi@7 |
921 | 4388 //SpriteObject *v9; // ebx@12 |
0 | 4389 int v10; // eax@12 |
4390 int v11; // ebx@12 | |
4391 unsigned int v12; // ecx@12 | |
4392 int v13; // edx@15 | |
4393 int v14; // edx@17 | |
4394 int v15; // eax@24 | |
4395 unsigned __int16 v16; // cx@25 | |
4396 int v17; // eax@29 | |
4397 int v18; // eax@38 | |
4398 unsigned __int8 v19; // zf@38 | |
4399 unsigned __int8 v20; // sf@38 | |
4400 int v21; // edx@44 | |
4401 int v22; // eax@44 | |
4402 unsigned __int8 v23; // zf@44 | |
4403 unsigned __int8 v24; // sf@44 | |
4404 int v25; // edx@51 | |
4405 int v26; // ecx@51 | |
303 | 4406 //signed int v27; // eax@51 |
4407 //int v28; // eax@53 | |
0 | 4408 signed int v29; // eax@76 |
4409 signed int v30; // eax@84 | |
4410 signed int v31; // eax@92 | |
4411 int v32; // eax@94 | |
4412 int v33; // eax@100 | |
4413 int v34; // eax@104 | |
4414 signed int v35; // eax@104 | |
4415 double v36; // st7@104 | |
4416 float v37; // ST08_4@104 | |
4417 float v38; // ST04_4@104 | |
4418 float v39; // ST00_4@104 | |
4419 int v40; // ebx@107 | |
4420 unsigned int v41; // ebx@109 | |
4421 signed __int64 v42; // qax@125 | |
4422 unsigned __int16 v43; // ax@132 | |
4423 char v44; // bl@132 | |
4424 unsigned __int16 v45; // ax@132 | |
4425 unsigned __int64 v46; // [sp+Ch] [bp-60h]@6 | |
4426 const char *v47; // [sp+14h] [bp-58h]@104 | |
4427 char *pPlayerName; // [sp+18h] [bp-54h]@12 | |
4428 char *pMonsterName; // [sp+1Ch] [bp-50h]@6 | |
4429 int v50; // [sp+20h] [bp-4Ch]@6 | |
303 | 4430 //unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6 |
0 | 4431 int v52; // [sp+34h] [bp-38h]@12 |
303 | 4432 //int v53; // [sp+38h] [bp-34h]@10 |
4433 //int v54; // [sp+3Ch] [bp-30h]@1 | |
4434 //int v55; // [sp+40h] [bp-2Ch]@12 | |
0 | 4435 signed int a4; // [sp+44h] [bp-28h]@1 |
4436 PlayerEquipment *v57; // [sp+48h] [bp-24h]@10 | |
303 | 4437 //int v58; // [sp+4Ch] [bp-20h]@10 |
0 | 4438 int v59; // [sp+50h] [bp-1Ch]@1 |
4439 unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1 | |
4440 int v61; // [sp+58h] [bp-14h]@1 | |
387 | 4441 bool v62; // [sp+5Ch] [bp-10h]@1 |
0 | 4442 int uDamageAmount; // [sp+60h] [bp-Ch]@1 |
4443 int a2; // [sp+64h] [bp-8h]@27 | |
4444 int a3; // [sp+6Bh] [bp-1h]@6 | |
4445 | |
303 | 4446 //v3 = a1; |
0 | 4447 v4 = 0; |
4448 uActorID_Monster_ = uActorID_Monster; | |
303 | 4449 //v54 = a1; |
0 | 4450 uDamageAmount = 0; |
4451 a4 = 0; | |
4452 v61 = 0; | |
4453 v59 = 0; | |
4454 v62 = 0; | |
848 | 4455 if ( PID_TYPE(a1) == OBJECT_Item) |
4456 { | |
4457 v4 = &pSpriteObjects[PID_ID(a1)]; | |
303 | 4458 //uDamageAmount = (int)v4; |
0 | 4459 v61 = v4->field_60_distance_related_prolly_lod; |
822 | 4460 a1 = v4->spell_caster_pid; |
303 | 4461 //v54 = v4->field_58_pid; |
4462 } | |
4463 //v5 = a1 & 7; | |
4464 //uPlayerID = a1 >> 3; | |
848 | 4465 if (PID_TYPE(a1) != OBJECT_Player) |
187 | 4466 return; |
303 | 4467 |
848 | 4468 assert(PID_ID(abs(a1)) < 4); |
4469 auto player = &pParty->pPlayers[PID_ID(a1)]; | |
0 | 4470 pMonster = &pActors[uActorID_Monster_]; |
303 | 4471 //uPlayerID = pMonster->IsAlive(); |
4472 if (pMonster->IsNotAlive()) | |
187 | 4473 return; |
303 | 4474 |
0 | 4475 BYTE1(pMonster->uAttributes) |= 0xC0u; |
4476 if ( pMonster->uAIState == Fleeing ) | |
4477 pMonster->uAttributes |= 0x20000u; | |
303 | 4478 //v57 = 0; |
4479 //v53 = 0; | |
4480 //v58 = 0; | |
4481 bool hit_will_stun = false, | |
4482 hit_will_paralyze = false; | |
0 | 4483 if ( !v4 ) |
4484 { | |
303 | 4485 //v51 = (unsigned __int64 *)player->pEquipment.uMainHand; |
4486 int main_hand_idx = player->pEquipment.uMainHand; | |
0 | 4487 v59 = 1; |
816 | 4488 if ( player->HasItemEquipped(EQUIP_MAIN_HAND) ) |
303 | 4489 { |
4490 auto main_hand_skill = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; | |
4491 //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; | |
4492 //v28 = SkillToMastery(player->pActiveSkills[v55]); | |
4493 auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]); | |
4494 //uDamageAmount = v28; | |
4495 switch (main_hand_skill) | |
4496 { | |
4497 case PLAYER_SKILL_STAFF: | |
4498 if (main_hand_mastery >= 3) | |
4499 { | |
1108
a1fd8045ffb1
probably erroneous semicolons removed, mace and staff stun chance work as they should
Grumpy7
parents:
1104
diff
changeset
|
4500 if (rand() % 100 < (player->GetActualSkillLevel(PLAYER_SKILL_STAFF) & 0x3F)) // stun chance when mastery >= 3 |
303 | 4501 hit_will_stun = true; |
4502 } | |
4503 break; | |
4504 | |
4505 case PLAYER_SKILL_MACE: | |
4506 if (main_hand_mastery >= 3) | |
4507 { | |
1108
a1fd8045ffb1
probably erroneous semicolons removed, mace and staff stun chance work as they should
Grumpy7
parents:
1104
diff
changeset
|
4508 if (rand() % 100 < (player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F)) |
303 | 4509 hit_will_stun = true; |
4510 } | |
4511 if (main_hand_mastery >= 4) | |
4512 { | |
1108
a1fd8045ffb1
probably erroneous semicolons removed, mace and staff stun chance work as they should
Grumpy7
parents:
1104
diff
changeset
|
4513 if (rand() % 100 < (player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F)) |
303 | 4514 hit_will_paralyze = true; |
4515 } | |
4516 break; | |
0 | 4517 } |
4518 } | |
4519 v50 = pMonster->pMonsterInfo.uID; | |
4520 a2 = 4; | |
303 | 4521 //v27 = player->CalculateMeleeDamageTo(0, 0, v50); |
4522 uDamageAmount = player->CalculateMeleeDamageTo(0, 0, v50); | |
4523 //if ( !v57 ) | |
4524 goto LABEL_67; | |
4525 //goto LABEL_69; | |
4526 } | |
4527 | |
4528 | |
822 | 4529 v19 = v4->spell_id == SPELL_DARK_SOULDRINKER; |
0 | 4530 v61 = v4->field_60_distance_related_prolly_lod; |
4531 if ( !v19 ) | |
4532 { | |
921 | 4533 //v9 = (SpriteObject *)uDamageAmount; |
4534 v50 = pParty->vPosition.x - v4->vPosition.x; | |
303 | 4535 //v55 = abs(v50); |
921 | 4536 pMonsterName = (char *)(pParty->vPosition.y - v4->vPosition.y); |
303 | 4537 //v51 = (unsigned __int64 *)abs((int)pMonsterName); |
921 | 4538 pPlayerName = (char *)(pParty->vPosition.z - v4->vPosition.z); |
0 | 4539 v52 = abs((int)pPlayerName); |
303 | 4540 v61 = abs(v50); |
4541 v10 = abs(v50); | |
4542 v11 = (int)abs((int)pMonsterName); | |
0 | 4543 v12 = v52; |
303 | 4544 if ( v10 < v11) |
4545 { | |
4546 v10 = (int)v11; | |
4547 v11 = v10; | |
0 | 4548 } |
4549 if ( v10 < v52 ) | |
4550 { | |
4551 v13 = v10; | |
4552 v10 = v52; | |
4553 v12 = v13; | |
4554 } | |
4555 if ( v11 < (signed int)v12 ) | |
4556 { | |
4557 v14 = v12; | |
4558 v12 = v11; | |
4559 v11 = v14; | |
4560 } | |
303 | 4561 //uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; |
4562 v61 = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; | |
4563 if ( v61 >= 2560 ) | |
0 | 4564 { |
4565 if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) | |
187 | 4566 return; |
0 | 4567 v61 = 2; |
4568 } | |
4569 else | |
4570 { | |
4571 v61 = 1; | |
4572 } | |
921 | 4573 //v4 = (SpriteObject *)uDamageAmount; |
0 | 4574 } |
303 | 4575 |
822 | 4576 v15 = v4->spell_id; |
4577 if ( v15 == SPELL_LASER_PROJECTILE ) | |
0 | 4578 { |
303 | 4579 v16 = player->pActiveSkills[7]; |
0 | 4580 v61 = 1; |
4581 if ( (signed int)SkillToMastery(v16) >= 3 ) | |
303 | 4582 a4 = player->pActiveSkills[7] & 0x3F; |
0 | 4583 a2 = 4; |
303 | 4584 uDamageAmount = player->CalculateMeleeDamageTo(1, 1, 0); |
0 | 4585 goto LABEL_67; |
4586 } | |
822 | 4587 if ( v15 != SPELL_BOW_ARROW ) |
4588 { | |
4589 if ( v15 == SPELL_101 ) | |
0 | 4590 { |
4591 a2 = 0; | |
303 | 4592 v18 = player->CalculateRangedDamageTo(0); |
0 | 4593 v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; |
4594 v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; | |
4595 uDamageAmount = v18; | |
4596 if ( !v20 && (!(v20 | v19) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4597 uDamageAmount >>= 1; | |
4598 v59 = 1; | |
4599 goto LABEL_67; | |
4600 } | |
822 | 4601 if ( v15 == SPELL_EARTH_BLADES ) |
4602 { | |
4603 a4 = 5 * v4->spell_level; | |
303 | 4604 a2 = player->GetSpellSchool(0x27u); |
822 | 4605 v21 = v4->spell_level; |
0 | 4606 v50 = pMonster->sCurrentHP; |
822 | 4607 pMonsterName = (char *)v4->spell_skill; |
4608 v22 = _43AFE3_calc_spell_damage(39, v21, v4->spell_skill, v50); | |
0 | 4609 v23 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; |
4610 v24 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; | |
4611 uDamageAmount = v22; | |
4612 if ( !v24 && (!(v24 | v23) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4613 uDamageAmount >>= 1; | |
4614 v59 = 0; | |
4615 LABEL_67: | |
303 | 4616 if ( !stru_50C198.PlayerHitOrMiss(player, pMonster, v61, a4) ) |
4617 { | |
4618 //LABEL_68: | |
4619 player->PlaySound(SPEECH_52, 0); | |
187 | 4620 return; |
0 | 4621 } |
4622 goto LABEL_69; | |
4623 } | |
822 | 4624 if ( v15 == SPELL_EARTH_STUN ) |
0 | 4625 { |
4626 uDamageAmount = 0; | |
4627 a2 = 4; | |
303 | 4628 hit_will_stun = 1; |
0 | 4629 goto LABEL_67; |
4630 } | |
822 | 4631 a2 = player->GetSpellSchool(v4->spell_id); |
4632 v25 = v4->spell_level; | |
4633 v26 = v4->spell_id; | |
0 | 4634 v50 = pMonster->sCurrentHP; |
822 | 4635 pMonsterName = (char *)v4->spell_skill; |
303 | 4636 //v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); |
0 | 4637 v59 = 0; |
303 | 4638 //v57 = (PlayerEquipment *)1; |
4639 //LABEL_65: | |
822 | 4640 uDamageAmount = _43AFE3_calc_spell_damage(v26, v25, v4->spell_skill, v50); |
303 | 4641 //if ( !v57 ) |
4642 // goto LABEL_67; | |
4643 goto LABEL_69; | |
0 | 4644 } |
4645 v50 = pMonster->word_000086_some_monster_id; | |
4646 a2 = 4; | |
303 | 4647 v17 = player->CalculateRangedDamageTo(v50); |
0 | 4648 v19 = v4->stru_24.uItemID == 0; |
4649 uDamageAmount = v17; | |
303 | 4650 v57 = 0; |
377 | 4651 if ( !v19 && v4->stru_24.uSpecEnchantmentType == 3 ) |
0 | 4652 { |
4653 a2 = 0; | |
4654 v57 = (PlayerEquipment *)1; | |
4655 } | |
4656 if ( SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) >= 0 | |
4657 && (SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) > 0 || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4658 uDamageAmount >>= 1; | |
4659 v59 = 1; | |
303 | 4660 //LABEL_66: |
0 | 4661 if ( !v57 ) |
4662 goto LABEL_67; | |
4663 LABEL_69: | |
303 | 4664 if (player->Weak()) |
4665 uDamageAmount /= 1; | |
0 | 4666 if ( (signed __int64)pMonster->pActorBuffs[5].uExpireTime > 0 ) |
4667 uDamageAmount = 0; | |
4668 v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, uDamageAmount); | |
303 | 4669 if ( !v4 && player->IsUnarmed() && (signed __int64)player->pPlayerBuffs[6].uExpireTime > 0 ) |
4670 { | |
4671 v50 = player->pPlayerBuffs[6].uPower; | |
0 | 4672 v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, v50); |
4673 v61 += v29; | |
4674 } | |
4675 uDamageAmount = v61; | |
4676 if ( v59 ) | |
4677 { | |
4678 if ( v4 ) | |
4679 { | |
4680 a4 = v4->stru_24._439DF3_get_additional_damage(&a2, &v62); | |
4681 if ( v62 && pMonster->sCurrentHP > 0 ) | |
4682 { | |
303 | 4683 player->sHealth += v61 / 5; |
4684 if ( player->sHealth > player->GetMaxHealth() ) | |
4685 player->sHealth = player->GetMaxHealth(); | |
0 | 4686 v62 = 0; |
4687 } | |
4688 v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); | |
4689 uDamageAmount = v61 + v30; | |
4690 } | |
4691 else | |
4692 { | |
4693 v59 = 0; | |
303 | 4694 v57 = &player->pEquipment; |
0 | 4695 do |
4696 { | |
303 | 4697 if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) |
4698 { | |
898 | 4699 auto _s = (ItemGen *)&player->pInventoryItems[v57->uShield - 1]; |
0 | 4700 a4 = _s->_439DF3_get_additional_damage(&a2, &v62); |
4701 if ( v62 && pMonster->sCurrentHP > 0 ) | |
4702 { | |
303 | 4703 player->sHealth += v61 / 5; |
4704 if ( player->sHealth > player->GetMaxHealth() ) | |
4705 player->sHealth = player->GetMaxHealth(); | |
0 | 4706 v62 = 0; |
4707 } | |
4708 v31 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); | |
4709 uDamageAmount += v31; | |
4710 } | |
4711 ++v59; | |
4712 v57 = (PlayerEquipment *)((char *)v57 + 4); | |
4713 } | |
4714 while ( v59 <= 1 ); | |
4715 } | |
4716 } | |
4717 v32 = uDamageAmount; | |
4718 pMonster->sCurrentHP -= uDamageAmount; | |
303 | 4719 if ( !v32 && !hit_will_stun ) |
4720 { | |
4721 player->PlaySound(SPEECH_52, 0); | |
4722 return; | |
4723 } | |
0 | 4724 if ( pMonster->sCurrentHP > 0 ) |
4725 { | |
1060 | 4726 Actor::AI_Stun(uActorID_Monster_, a1, 0); |
322 | 4727 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); |
0 | 4728 if ( bShowDamage ) |
4729 { | |
4730 v50 = uDamageAmount; | |
4731 pMonsterName = (char *)pMonster; | |
303 | 4732 pPlayerName = player->pName; |
0 | 4733 if ( v4 ) |
4734 v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points" | |
4735 else | |
4736 v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage" | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4737 sprintfex(pTmpBuf.data(), v47, pPlayerName, pMonsterName, v50); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4738 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 4739 } |
4740 v41 = 0; | |
4741 } | |
4742 else | |
4743 { | |
4744 if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 ) | |
4745 { | |
4746 v33 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; | |
303 | 4747 //v55 = v33; |
0 | 4748 if ( pRenderer->pRenderD3D ) |
4749 { | |
573 | 4750 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) |
0 | 4751 { |
4752 v50 = 0; | |
4753 pMonsterName = 0; | |
4754 v34 = pMonster->vPosition.z; | |
303 | 4755 *(float *)&pPlayerName = (double)v33; |
4756 //v51 = (unsigned __int64 *)v34; | |
0 | 4757 *(float *)&v47 = 0.0; |
4758 v35 = pMonster->vPosition.y; | |
4759 *((float *)&v46 + 1) = 0.0; | |
4760 *(float *)&v46 = 1.0; | |
303 | 4761 v36 = (double)(signed int)pMonster->vPosition.z; |
4762 //v51 = (unsigned __int64 *)v35; | |
0 | 4763 v37 = v36; |
303 | 4764 //v51 = (unsigned __int64 *)pMonster->vPosition.x; |
0 | 4765 v38 = (double)v35; |
303 | 4766 v39 = (double)(signed int)pMonster->vPosition.x; |
0 | 4767 pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0); |
4768 } | |
4769 } | |
4770 } | |
4771 Actor::Die(uActorID_Monster_); | |
322 | 4772 Actor::ApplyFineForKillingPeasant(uActorID_Monster_); |
4773 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); | |
0 | 4774 if ( pMonster->pMonsterInfo.uExp ) |
792 | 4775 GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp); |
187 | 4776 v40 = SPEECH_51; |
0 | 4777 if ( rand() % 100 < 20 ) |
4778 v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1; | |
303 | 4779 player->PlaySound((PlayerSpeech)v40, 0); |
0 | 4780 v41 = 0; |
4781 if ( bShowDamage ) | |
4782 { | |
4783 v50 = (int)pMonster; | |
4784 pMonsterName = (char *)uDamageAmount; | |
303 | 4785 pPlayerName = player->pName; // "%s inflicts %lu points killing %s" |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4786 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4787 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 4788 } |
4789 } | |
4790 if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41 | |
4791 && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41 | |
4792 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41) | |
4793 && uDamageAmount != v41 ) | |
1036 | 4794 player->ReceiveDamage(uDamageAmount, (DAMAGE_TYPE)a2); |
0 | 4795 v50 = 24; |
4796 v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; | |
303 | 4797 if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41) |
0 | 4798 && stru_50C198.GetMagicalResistance(pMonster, 3u) ) |
4799 { | |
4800 LODWORD(v42) = 20; | |
4801 v59 = 10; | |
4802 if ( pParty->bTurnBasedModeOn == v41 ) | |
4803 v42 = (signed __int64)(flt_6BE3A8_debug_recmod2 * 42.66666666666666); | |
4804 pMonster->pMonsterInfo.uRecoveryTime += v42; | |
4805 if ( bShowDamage != v41 ) | |
4806 { | |
4807 v50 = (int)pMonster; | |
303 | 4808 pMonsterName = player->pName; // "%s stuns %s" |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4809 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[635], player->pName, pMonster); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4810 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 4811 } |
4812 } | |
303 | 4813 if ( hit_will_paralyze != v41 ) |
0 | 4814 { |
4815 if ( pMonster->CanAct() ) | |
4816 { | |
303 | 4817 if ( stru_50C198.GetMagicalResistance(pMonster, 3) ) |
4818 { | |
4819 LOBYTE(v43) = player->GetActualSkillLevel(PLAYER_SKILL_MACE); | |
0 | 4820 v44 = v43; |
4821 v45 = SkillToMastery(v43); | |
303 | 4822 //v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F)); |
4823 v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(7680 * (v44 & 0x3F)) * 0.033333335); | |
0 | 4824 pMonster->pActorBuffs[6].Apply(v46, v45, 0, 0, 0); |
4825 if ( bShowDamage ) | |
4826 { | |
4827 v50 = (int)pMonster; | |
303 | 4828 pMonsterName = player->pName; // "%s paralyzes %s" |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4829 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[636], player->pName, pMonster); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
4830 ShowStatusBarString(pTmpBuf.data(), 2u); |
0 | 4831 } |
4832 } | |
4833 } | |
4834 } | |
4835 if ( v59 > 10 ) | |
4836 v59 = 10; | |
4837 if ( !MonsterStats::BelongsToSupertype(pMonster->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
4838 { | |
4839 pVelocity->x = (unsigned __int64)(v59 * (signed __int64)pVelocity->x) >> 16; | |
4840 pVelocity->y = (unsigned __int64)(v59 * (signed __int64)pVelocity->y) >> 16; | |
4841 pVelocity->z = (unsigned __int64)(v59 * (signed __int64)pVelocity->z) >> 16; | |
4842 pMonster->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
4843 pMonster->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
4844 pMonster->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
4845 } | |
187 | 4846 Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster_, 1, v61); |
0 | 4847 } |
4848 // 4D864C: using guessed type char byte_4D864C; | |
4849 | |
4850 //----- (00439FCB) -------------------------------------------------------- | |
4851 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) | |
4852 { | |
4853 signed int v4; // esi@1 | |
4854 unsigned int v5; // ecx@1 | |
4855 Player *v6; // ebx@3 | |
4856 Actor *v7; // esi@3 | |
4857 unsigned int v8; // eax@4 | |
4858 char *v9; // eax@5 | |
4859 signed int v10; // eax@6 | |
4860 int v11; // edx@8 | |
4861 int v12; // edx@9 | |
4862 int v13; // edx@10 | |
4863 int v14; // edx@16 | |
4864 int v15; // edx@17 | |
4865 int v16; // edx@18 | |
4866 enum SoundID v17; // eax@24 | |
4867 int v18; // eax@26 | |
4868 unsigned __int8 v19; // zf@26 | |
4869 unsigned __int8 v20; // sf@26 | |
4870 unsigned __int16 v21; // ax@29 | |
4871 signed int v22; // edi@36 | |
4872 int v23; // eax@38 | |
4873 signed int v24; // eax@44 | |
4874 unsigned __int16 v25; // cx@47 | |
4875 signed int v26; // eax@49 | |
4876 int v27; // eax@54 | |
4877 float v28; // ST18_4@58 | |
4878 double v29; // st7@58 | |
4879 float v30; // ST08_4@58 | |
4880 double v31; // st7@58 | |
4881 float v32; // ST04_4@58 | |
4882 float v33; // ST00_4@58 | |
4883 int v34; // edi@61 | |
4884 int v35; // eax@70 | |
4885 double v36; // st7@70 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4886 SpriteObject *v37; // ebx@77 |
0 | 4887 int v38; // edi@77 |
4888 int v39; // esi@77 | |
4889 int v40; // eax@77 | |
4890 int v41; // eax@77 | |
4891 int v42; // eax@78 | |
42 | 4892 Player *v43; // eax@81 |
0 | 4893 Actor *v44; // esi@82 |
42 | 4894 Player *v45; // edi@84 |
0 | 4895 unsigned __int16 v46; // ax@84 |
4896 int v47; // ebx@105 | |
4897 int v48; // eax@107 | |
4898 unsigned __int16 v49; // ax@116 | |
4899 int v50; // ebx@123 | |
4900 unsigned __int16 v51; // ax@124 | |
4901 char v52; // bl@124 | |
4902 int v53; // eax@128 | |
4903 signed int v54; // eax@134 | |
4904 unsigned __int16 v55; // cx@137 | |
4905 signed int v56; // eax@139 | |
4906 int v57; // eax@144 | |
4907 float v58; // ST18_4@148 | |
4908 double v59; // st7@148 | |
4909 float v60; // ST08_4@148 | |
4910 double v61; // st7@148 | |
4911 float v62; // ST04_4@148 | |
4912 float v63; // ST00_4@148 | |
4913 int v64; // ebx@151 | |
4914 int v65; // eax@161 | |
4915 double v66; // st7@161 | |
4916 signed int v67; // ecx@164 | |
4917 signed int v68; // eax@170 | |
4918 int v69; // ecx@170 | |
4919 int v70; // eax@171 | |
4920 enum SoundID v71; // [sp+20h] [bp-34h]@12 | |
4921 int v72; // [sp+30h] [bp-24h]@164 | |
4922 double v73; // [sp+40h] [bp-14h]@72 | |
4923 signed int v74; // [sp+44h] [bp-10h]@1 | |
4924 unsigned int v75; // [sp+48h] [bp-Ch]@3 | |
4925 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 | |
4926 int v77; // [sp+50h] [bp-4h]@26 | |
4927 signed int a4a; // [sp+60h] [bp+Ch]@162 | |
4928 Player *a4b; // [sp+60h] [bp+Ch]@168 | |
4929 | |
848 | 4930 v4 = PID_ID(uObjID); |
4931 v5 = PID_TYPE(uObjID) - 2; | |
0 | 4932 v74 = a2; |
4933 uActorID = v4; | |
4934 if ( v5 ) | |
4935 { | |
4936 if ( v5 != 1 | |
4937 || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], | |
4938 v75 = v6->sHealth, | |
4939 !stru_50C198.ActorHitOrMiss(v7, v6)) ) | |
4940 return; | |
898 | 4941 v8 = v6->pEquipment.uArmor; |
0 | 4942 if ( !v8 |
4943 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) | |
4944 || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) | |
4945 || v10 > 11 ) | |
4946 { | |
4947 v14 = rand() % 4; | |
4948 if ( !v14 ) | |
4949 { | |
4950 v71 = (SoundID)108; | |
4951 goto LABEL_24; | |
4952 } | |
4953 v15 = v14 - 1; | |
4954 if ( !v15 ) | |
4955 { | |
4956 v71 = (SoundID)109; | |
4957 goto LABEL_24; | |
4958 } | |
4959 v16 = v15 - 1; | |
4960 if ( !v16 ) | |
4961 { | |
4962 v71 = (SoundID)110; | |
4963 goto LABEL_24; | |
4964 } | |
4965 if ( v16 == 1 ) | |
4966 { | |
4967 v71 = (SoundID)44; | |
4968 goto LABEL_24; | |
4969 } | |
4970 } | |
4971 else | |
4972 { | |
4973 v11 = rand() % 4; | |
4974 if ( !v11 ) | |
4975 { | |
4976 v71 = (SoundID)105; | |
4977 goto LABEL_24; | |
4978 } | |
4979 v12 = v11 - 1; | |
4980 if ( !v12 ) | |
4981 { | |
4982 v71 = (SoundID)106; | |
4983 goto LABEL_24; | |
4984 } | |
4985 v13 = v12 - 1; | |
4986 if ( !v13 ) | |
4987 { | |
4988 v71 = (SoundID)107; | |
4989 goto LABEL_24; | |
4990 } | |
4991 if ( v13 == 1 ) | |
4992 { | |
4993 v71 = (SoundID)45; | |
4994 LABEL_24: | |
4995 v17 = v71; | |
4996 goto LABEL_26; | |
4997 } | |
4998 } | |
4999 v17 = (SoundID)a4; | |
5000 LABEL_26: | |
862 | 5001 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); |
0 | 5002 v18 = Actor::_43B3E0_CalcDamage(v7, v74); |
5003 v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; | |
5004 v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; | |
5005 v77 = v18; | |
5006 if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) | |
5007 { | |
5008 v21 = v7->pActorBuffs[3].uPower; | |
5009 if ( v21 ) | |
5010 v77 /= (signed int)v21; | |
5011 } | |
5012 if ( v74 ) | |
5013 { | |
5014 if ( v74 == 1 ) | |
5015 { | |
5016 v22 = v7->pMonsterInfo.uAttack2Type; | |
5017 } | |
5018 else | |
5019 { | |
5020 if ( v74 == 2 ) | |
5021 { | |
5022 v23 = v7->pMonsterInfo.uSpell1ID; | |
5023 } | |
5024 else | |
5025 { | |
5026 if ( v74 != 3 ) | |
5027 { | |
5028 if ( v74 == 4 ) | |
5029 v22 = v7->pMonsterInfo.field_3C_some_special_attack; | |
5030 else | |
5031 v22 = 4; | |
5032 goto LABEL_43; | |
5033 } | |
5034 v23 = v7->pMonsterInfo.uSpell2ID; | |
5035 } | |
5036 v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); | |
5037 } | |
5038 } | |
5039 else | |
5040 { | |
5041 v22 = v7->pMonsterInfo.uAttack1Type; | |
5042 } | |
5043 LABEL_43: | |
5044 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
5045 { | |
1036 | 5046 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); |
0 | 5047 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 |
5048 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) | |
5049 { | |
5050 v25 = v7->uAIState; | |
5051 if ( v25 != 5 ) | |
5052 { | |
5053 if ( v25 != 4 ) | |
5054 { | |
5055 v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); | |
5056 v7->sCurrentHP -= v26; | |
5057 if ( v26 ) | |
5058 { | |
5059 if ( v7->sCurrentHP >= 1 ) | |
5060 { | |
1060 | 5061 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); |
322 | 5062 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 5063 } |
5064 else | |
5065 { | |
5066 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) | |
5067 { | |
5068 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; | |
5069 v74 = v27; | |
5070 if ( pRenderer->pRenderD3D ) | |
5071 { | |
573 | 5072 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) |
0 | 5073 { |
5074 v28 = (double)v74; | |
5075 v74 = v7->vPosition.z; | |
5076 v29 = (double)v74; | |
5077 v74 = v7->vPosition.y; | |
5078 v30 = v29; | |
5079 v31 = (double)v74; | |
5080 v74 = v7->vPosition.x; | |
5081 v32 = v31; | |
5082 v33 = (double)v74; | |
5083 pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0); | |
5084 } | |
5085 } | |
5086 } | |
5087 Actor::Die(uActorID); | |
322 | 5088 Actor::ApplyFineForKillingPeasant(uActorID); |
5089 Actor::AggroSurroundingPeasants(uActorID, 1); | |
0 | 5090 if ( v7->pMonsterInfo.uExp ) |
792 | 5091 GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); |
187 | 5092 v34 = SPEECH_51; |
0 | 5093 if ( rand() % 100 < 20 ) |
5094 v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; | |
187 | 5095 v6->PlaySound((PlayerSpeech)v34, 0); |
0 | 5096 } |
5097 } | |
5098 } | |
5099 } | |
5100 } | |
5101 if ( !(dword_6BE368_debug_settings_2 & 0x10) | |
5102 && v7->pMonsterInfo.uSpecialAttack | |
5103 && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) | |
5104 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); | |
5105 } | |
5106 if ( !pParty->bTurnBasedModeOn ) | |
5107 { | |
5108 v35 = v6->GetActualEndurance(); | |
1036 | 5109 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; |
0 | 5110 v6->SetRecoveryTime((signed __int64)v36); |
5111 } | |
5112 if ( v77 ) | |
5113 { | |
5114 v73 = (double)(signed int)v75; | |
5115 if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) | |
5116 { | |
5117 if ( v6->sHealth > 0 ) | |
5118 { | |
5119 if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) | |
187 | 5120 v6->PlaySound(SPEECH_48, 0); |
0 | 5121 } |
5122 } | |
5123 } | |
5124 viewparams->bRedrawGameUI = 1; | |
5125 return; | |
5126 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5127 v37 = &pSpriteObjects[uActorID]; |
848 | 5128 v38 = PID_TYPE(v37->spell_caster_pid); |
5129 v39 = PID_ID(v37->spell_caster_pid); | |
5130 v40 = PID_TYPE(v37->spell_caster_pid); | |
5131 uActorID = PID_ID(v37->spell_caster_pid); | |
0 | 5132 v41 = v40 - 2; |
5133 if ( !v41 ) | |
5134 goto LABEL_80; | |
5135 v42 = v41 - 1; | |
5136 if ( !v42 ) | |
5137 { | |
5138 v44 = &pActors[v39]; | |
5139 if ( a4 == -1 ) | |
5140 a4 = stru_50C198.which_player_would_attack(v44); | |
42 | 5141 v45 = &pParty->pPlayers[a4]; |
0 | 5142 v77 = Actor::_43B3E0_CalcDamage(v44, v74); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5143 v46 = v37->uType; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5144 if ( v37->uType == 545 ) |
0 | 5145 { |
42 | 5146 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); |
0 | 5147 v52 = v51; |
5148 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) ) | |
5149 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5150 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[637], v45->pName); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5151 ShowStatusBarString(pTmpBuf.data(), 2u); |
187 | 5152 v45->PlaySound(SPEECH_6, 0); |
0 | 5153 return; |
5154 } | |
5155 } | |
5156 else | |
5157 { | |
5158 if ( v46 != 555 | |
5159 && v46 != 510 | |
5160 && v46 != 500 | |
5161 && v46 != 515 | |
5162 && v46 != 505 | |
5163 && v46 != 530 | |
5164 && v46 != 525 | |
5165 && v46 != 520 | |
5166 && v46 != 535 | |
5167 && v46 != 540 ) | |
5168 goto LABEL_115; | |
5169 } | |
42 | 5170 if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) |
0 | 5171 return; |
42 | 5172 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) |
0 | 5173 v77 >>= 1; |
42 | 5174 if ( v45->HasEnchantedItemEquipped(36) ) |
0 | 5175 v77 >>= 1; |
42 | 5176 if ( v45->HasEnchantedItemEquipped(69) ) |
0 | 5177 v77 >>= 1; |
42 | 5178 if ( v45->HasItemEquipped(EQUIP_ARMOUR) |
898 | 5179 && *(_DWORD *)&v45->pInventoryItems[v45->pEquipment.uArmor-1] == 504 ) |
0 | 5180 v77 >>= 1; |
5181 v75 = 0; | |
42 | 5182 v47 = (int)&v45->pEquipment; |
0 | 5183 do |
5184 { | |
42 | 5185 if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) ) |
0 | 5186 { |
5187 v48 = *(int *)&v45[36 * *(int *)v47 + 496]; | |
5188 if ( v48 == 520 ) | |
5189 v77 >>= 1; | |
5190 if ( v48 == 531 ) | |
5191 v77 >>= 1; | |
816 | 5192 if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 ) |
0 | 5193 v77 >>= 1; |
5194 } | |
5195 ++v75; | |
5196 v47 += 4; | |
5197 } | |
5198 while ( (signed int)v75 <= 1 ); | |
5199 LABEL_115: | |
5200 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) | |
5201 { | |
5202 v49 = v44->pActorBuffs[3].uPower; | |
5203 if ( v49 ) | |
5204 v77 /= (signed int)v49; | |
5205 } | |
5206 if ( !v74 ) | |
5207 { | |
5208 v50 = v44->pMonsterInfo.uAttack1Type; | |
5209 goto LABEL_133; | |
5210 } | |
5211 if ( v74 == 1 ) | |
5212 { | |
5213 v50 = v44->pMonsterInfo.uAttack2Type; | |
5214 goto LABEL_133; | |
5215 } | |
5216 if ( v74 == 2 ) | |
5217 { | |
5218 v53 = v44->pMonsterInfo.uSpell1ID; | |
5219 } | |
5220 else | |
5221 { | |
5222 if ( v74 != 3 ) | |
5223 { | |
5224 if ( v74 == 4 ) | |
5225 v50 = v44->pMonsterInfo.field_3C_some_special_attack; | |
5226 else | |
5227 v50 = 4; | |
5228 LABEL_133: | |
5229 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
5230 { | |
1036 | 5231 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); |
42 | 5232 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) |
5233 { | |
5234 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) | |
0 | 5235 { |
5236 v55 = v44->uAIState; | |
5237 if ( v55 != 5 ) | |
5238 { | |
5239 if ( v55 != 4 ) | |
5240 { | |
5241 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); | |
5242 v44->sCurrentHP -= v56; | |
5243 if ( v56 ) | |
5244 { | |
5245 if ( v44->sCurrentHP >= 1 ) | |
5246 { | |
1060 | 5247 Actor::AI_Stun(uActorID, PID(OBJECT_Player,a4), 0); |
322 | 5248 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 5249 } |
5250 else | |
5251 { | |
5252 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) | |
5253 { | |
5254 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius; | |
5255 v75 = v57; | |
5256 if ( pRenderer->pRenderD3D ) | |
5257 { | |
573 | 5258 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) |
0 | 5259 { |
5260 v58 = (double)(signed int)v75; | |
5261 v75 = v44->vPosition.z; | |
5262 v59 = (double)(signed int)v75; | |
5263 v75 = v44->vPosition.y; | |
5264 v60 = v59; | |
5265 v61 = (double)(signed int)v75; | |
5266 v75 = v44->vPosition.x; | |
5267 v62 = v61; | |
5268 v63 = (double)(signed int)v75; | |
5269 pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0); | |
5270 } | |
5271 } | |
5272 } | |
5273 Actor::Die(uActorID); | |
322 | 5274 Actor::ApplyFineForKillingPeasant(uActorID); |
5275 Actor::AggroSurroundingPeasants(uActorID, 1); | |
0 | 5276 if ( v44->pMonsterInfo.uExp ) |
792 | 5277 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); |
187 | 5278 v64 = SPEECH_51; |
0 | 5279 if ( rand() % 100 < 20 ) |
5280 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; | |
187 | 5281 v45->PlaySound((PlayerSpeech)v64, 0); |
0 | 5282 } |
5283 } | |
5284 } | |
5285 } | |
5286 } | |
5287 } | |
5288 } | |
5289 if ( !v74 | |
5290 && !(dword_6BE368_debug_settings_2 & 0x10) | |
5291 && v44->pMonsterInfo.uSpecialAttack | |
5292 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) | |
42 | 5293 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); |
0 | 5294 if ( !pParty->bTurnBasedModeOn ) |
5295 { | |
42 | 5296 v65 = v45->GetActualEndurance(); |
1036 | 5297 v66 = (double)(20 - v45->GetParameterBonus(v65)) |
0 | 5298 * flt_6BE3A4_debug_recmod1 |
5299 * 2.133333333333333; | |
42 | 5300 v45->SetRecoveryTime((signed __int64)v66); |
0 | 5301 } |
5302 return; | |
5303 } | |
5304 v53 = v44->pMonsterInfo.uSpell2ID; | |
5305 } | |
5306 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); | |
5307 goto LABEL_133; | |
5308 } | |
5309 if ( v42 != 1 ) | |
5310 return; | |
5311 LABEL_80: | |
5312 if ( a4 != -1 ) | |
5313 { | |
42 | 5314 v43 = &pParty->pPlayers[a4]; |
0 | 5315 LABEL_168: |
42 | 5316 a4b = v43; |
822 | 5317 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) |
0 | 5318 { |
42 | 5319 v70 = v43->GetMaxHealth(); |
822 | 5320 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); |
5321 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); | |
0 | 5322 } |
5323 else | |
5324 { | |
5325 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); | |
5326 v69 = 0; | |
5327 } | |
1036 | 5328 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); |
303 | 5329 if ( v38 == OBJECT_Player && !qword_A750D8 ) |
0 | 5330 { |
5331 qword_A750D8 = 256i64; | |
5332 word_A750E0 = 44; | |
5333 word_A750E2 = uActorID + 1; | |
5334 } | |
5335 return; | |
5336 } | |
5337 v74 = 0; | |
5338 a4a = 1; | |
5339 do | |
5340 { | |
5341 if ( pPlayers[a4a]->CanAct() ) | |
5342 { | |
5343 v67 = v74++; | |
5344 *(&v72 + v67) = a4a; | |
5345 } | |
5346 ++a4a; | |
5347 } | |
5348 while ( a4a <= 4 ); | |
5349 if ( v74 ) | |
5350 { | |
42 | 5351 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; |
0 | 5352 goto LABEL_168; |
5353 } | |
5354 } | |
5355 | |
5356 //----- (0043A97E) -------------------------------------------------------- | |
5357 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) | |
5358 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5359 if ( PID_TYPE(a2) == OBJECT_BLVDoor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5360 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5361 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5362 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5363 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5364 |
0 | 5365 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
|
5366 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
|
5367 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5368 else if (PID_TYPE(a2) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5369 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5370 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5371 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5372 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5373 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5374 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
|
5375 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid)) |
0 | 5376 { |
5377 case OBJECT_Actor: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5378 sub_43B1B0(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61); |
0 | 5379 break; |
5380 case OBJECT_Player: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5381 DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 5382 break; |
5383 case OBJECT_Item: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5384 sub_43B057(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 5385 break; |
5386 } | |
5387 } | |
5388 } | |
5389 | |
5390 //----- (0043AA99) -------------------------------------------------------- | |
5391 void __fastcall Vec3_int_::Rotate(int sDepth, int sRotY, int sRotX, Vec3_int_ v, int *outx, int *outy, int *outz) | |
5392 { | |
147 | 5393 float cosf_x = cosf(3.14159265f * sRotX / 1024.0f), |
1025 | 5394 sinf_x = sinf(3.14159265f * sRotX / 1024.0f), |
147 | 5395 cosf_y = cosf(3.14159265f * sRotY / 1024.0f), |
5396 sinf_y = sinf(3.14159265f * sRotY / 1024.0f); | |
1045 | 5397 |
1025 | 5398 *outx = v.x + ((unsigned __int64)(sinf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16))); |
5399 *outy = v.y + ((unsigned __int64)(cosf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16))); | |
5400 *outz = v.z + ((unsigned __int64)(sinf_x * (signed __int64)sDepth) >> 16); | |
0 | 5401 } |
5402 | |
5403 //----- (0043AB61) -------------------------------------------------------- | |
5404 void Vec3_int_::Normalize(int *x, int *y, int *z) | |
5405 { | |
1025 | 5406 *x *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); |
5407 *y *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); | |
5408 *z *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); | |
0 | 5409 } |
5410 | |
5411 //----- (0043AE12) -------------------------------------------------------- | |
5412 double __fastcall sub_43AE12(signed int a1) | |
5413 { | |
5414 signed int v1; // ST00_4@1 | |
5415 signed int v2; // ecx@1 | |
5416 double v3; // st7@1 | |
5417 double result; // st7@6 | |
5418 | |
5419 v1 = a1; | |
5420 v2 = 0; | |
5421 v3 = (double)v1; | |
5422 do | |
5423 { | |
5424 if ( v3 < flt_4E4A80[v2 + 5] ) | |
5425 break; | |
5426 ++v2; | |
5427 } | |
5428 while ( v2 < 5 ); | |
5429 if ( v2 <= 0 || v2 >= 5 ) | |
5430 { | |
5431 if ( v2 ) | |
5432 result = flt_4E4A80[4]; | |
5433 else | |
5434 result = flt_4E4A80[0]; | |
5435 } | |
5436 else | |
5437 { | |
1033 | 5438 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 | 5439 } |
5440 return result; | |
5441 } | |
5442 | |
5443 //----- (0043AFE3) -------------------------------------------------------- | |
5444 int __fastcall _43AFE3_calc_spell_damage(int a1, int a2, signed int a3, int a4) | |
5445 { | |
5446 int result; // eax@1 | |
5447 unsigned int v5; // [sp-4h] [bp-8h]@9 | |
5448 | |
5449 result = 0; | |
5450 if ( a1 == 7 ) | |
5451 { | |
5452 if ( a3 <= 0 ) | |
5453 return result; | |
5454 if ( a3 <= 2 ) | |
5455 { | |
5456 v5 = 6; | |
5457 } | |
5458 else | |
5459 { | |
5460 if ( a3 == 3 ) | |
5461 { | |
5462 v5 = 8; | |
5463 } | |
5464 else | |
5465 { | |
5466 if ( a3 != 4 ) | |
5467 return result; | |
5468 v5 = 10; | |
5469 } | |
5470 } | |
5471 result = GetDiceResult(a2, v5); | |
5472 } | |
5473 else | |
5474 { | |
5475 if ( a1 == 44 ) | |
5476 result = a4 * (LOBYTE(pSpellDatas[40].field_10) + 2 * a2) / 100; | |
5477 else | |
5478 result = *((char *)&pSpellDatas[0].field_10 + 20 * a1) | |
5479 + GetDiceResult(a2, *((char *)&pSpellDatas[0].field_10 + 20 * a1 + 1)); | |
5480 } | |
5481 return result; | |
5482 } | |
5483 | |
5484 //----- (0043B057) -------------------------------------------------------- | |
5485 void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, Vec3_int_ *pVelocity) | |
5486 { | |
5487 Actor *pActor; // esi@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5488 SpriteObject *v4; // eax@3 |
0 | 5489 int v5; // ecx@3 |
5490 int v6; // eax@4 | |
5491 int v7; // edi@4 | |
5492 unsigned int uActorIDa; // [sp+8h] [bp-8h]@1 | |
5493 unsigned int a2; // [sp+Ch] [bp-4h]@1 | |
5494 int a2a; // [sp+Ch] [bp-4h]@8 | |
5495 | |
5496 uActorIDa = uActorID; | |
5497 pActor = &pActors[uActorID]; | |
5498 a2 = uObjID; | |
303 | 5499 if ( !pActors[uActorID].IsNotAlive() ) |
0 | 5500 { |
848 | 5501 if ( PID_TYPE(a2) == OBJECT_Item) |
5502 { | |
5503 v4 = &pSpriteObjects[PID_ID(a2)]; | |
822 | 5504 v5 = v4->spell_id; |
0 | 5505 if ( v5 ) |
5506 { | |
822 | 5507 v6 = _43AFE3_calc_spell_damage(v5, v4->spell_level, v4->spell_skill, pActor->sCurrentHP); |
0 | 5508 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6); |
5509 pActor->sCurrentHP -= v7; | |
5510 if ( v7 ) | |
5511 { | |
5512 if ( pActor->sCurrentHP > 0 ) | |
1060 | 5513 Actor::AI_Stun(uActorIDa, a2, 0); |
0 | 5514 else |
5515 Actor::Die(uActorIDa); | |
5516 a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP; | |
5517 if ( 20 * v7 / (signed int)pActor->pMonsterInfo.uHP > 10 ) | |
5518 a2a = 10; | |
5519 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
5520 { | |
5521 pVelocity->x = (unsigned __int64)(a2a * (signed __int64)pVelocity->x) >> 16; | |
5522 pVelocity->y = (unsigned __int64)(a2a * (signed __int64)pVelocity->y) >> 16; | |
5523 pVelocity->z = (unsigned __int64)(a2a * (signed __int64)pVelocity->z) >> 16; | |
5524 pActor->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
5525 pActor->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
5526 pActor->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
5527 } | |
5528 Actor::AddBloodsplatOnDamageOverlay(uActorIDa, 1, v7); | |
5529 } | |
5530 else | |
5531 { | |
1060 | 5532 Actor::AI_Stun(uActorIDa, a2, 0); |
0 | 5533 } |
5534 } | |
5535 } | |
5536 } | |
5537 } | |
5538 | |
5539 //----- (0043B1B0) -------------------------------------------------------- | |
322 | 5540 void sub_43B1B0(signed int a1, unsigned int a2, Vec3_int_ *pVelocity, signed int a4) |
0 | 5541 { |
5542 int v4; // ebx@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5543 SpriteObject *v5; // eax@2 |
0 | 5544 bool v6; // eax@3 |
5545 Actor *v7; // esi@4 | |
5546 Actor *v8; // edi@4 | |
5547 char v9; // zf@5 | |
5548 __int64 v10; // qax@8 | |
5549 signed __int16 v11; // cx@9 | |
5550 signed int v12; // ecx@20 | |
5551 int v13; // ecx@22 | |
5552 int v14; // edi@30 | |
5553 unsigned int uActorID; // [sp+Ch] [bp-8h]@1 | |
5554 signed int v17; // [sp+10h] [bp-4h]@1 | |
5555 int v18; // [sp+20h] [bp+Ch]@34 | |
5556 | |
5557 v4 = 0; | |
5558 uActorID = a2; | |
5559 v17 = a1; | |
848 | 5560 if ( PID_TYPE(a1) == OBJECT_Item) |
5561 { | |
5562 v5 = &pSpriteObjects[PID_ID(a1)]; | |
0 | 5563 v4 = v5->field_60_distance_related_prolly_lod; |
822 | 5564 v17 = v5->spell_caster_pid; |
0 | 5565 } |
848 | 5566 LOWORD(v6) = PID_TYPE(v17); |
303 | 5567 if ( v6 == OBJECT_Actor) |
0 | 5568 { |
5569 v7 = &pActors[a2]; | |
848 | 5570 v8 = &pActors[PID_ID(v17)]; |
303 | 5571 v6 = pActors[a2].IsNotAlive(); |
0 | 5572 if ( !v6 ) |
5573 { | |
5574 v9 = v7->uAIState == 7; | |
5575 v7->uLastCharacterIDToHit = v17; | |
5576 if ( v9 ) | |
5577 BYTE2(v7->uAttributes) |= 2u; | |
5578 v6 = stru_50C198._4273BB(v8, v7, v4, 0); | |
5579 if ( v6 ) | |
5580 { | |
5581 v10 = (unsigned int)Actor::_43B3E0_CalcDamage(v8, a4); | |
5582 if ( (signed __int64)v8->pActorBuffs[3].uExpireTime > 0 ) | |
5583 { | |
5584 v11 = v8->pActorBuffs[3].uPower; | |
5585 if ( v11 ) | |
5586 v10 = (signed int)v10 / (unsigned __int16)v11; | |
5587 } | |
5588 if ( SHIDWORD(v7->pActorBuffs[5].uExpireTime) >= SHIDWORD(v10) | |
5589 && (SHIDWORD(v7->pActorBuffs[5].uExpireTime) > SHIDWORD(v10) | |
5590 || LODWORD(v7->pActorBuffs[5].uExpireTime) > HIDWORD(v10)) ) | |
5591 LODWORD(v10) = 0; | |
5592 if ( a4 != HIDWORD(v10) ) | |
5593 { | |
5594 if ( a4 - HIDWORD(v10) == 1 ) | |
5595 { | |
5596 v12 = v8->pMonsterInfo.uAttack2Type; | |
5597 if ( SHIDWORD(v7->pActorBuffs[15].uExpireTime) >= SHIDWORD(v10) | |
5598 && (SHIDWORD(v7->pActorBuffs[15].uExpireTime) > SHIDWORD(v10) | |
5599 || LODWORD(v7->pActorBuffs[15].uExpireTime) > HIDWORD(v10)) ) | |
5600 LODWORD(v10) = (signed int)v10 >> 1; | |
5601 goto LABEL_30; | |
5602 } | |
5603 if ( a4 - HIDWORD(v10) == 2 ) | |
5604 { | |
5605 v13 = v7->pMonsterInfo.uSpell1ID; | |
5606 } | |
5607 else | |
5608 { | |
5609 if ( a4 - HIDWORD(v10) != 3 ) | |
5610 { | |
5611 if ( a4 - HIDWORD(v10) == 4 ) | |
5612 v12 = v8->pMonsterInfo.field_3C_some_special_attack; | |
5613 else | |
5614 v12 = 4; | |
5615 LABEL_30: | |
5616 v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10); | |
5617 v7->sCurrentHP -= v14; | |
5618 if ( v14 ) | |
5619 { | |
5620 if ( v7->sCurrentHP > 0 ) | |
1060 | 5621 Actor::AI_Stun(uActorID, v17, 0); |
0 | 5622 else |
5623 Actor::Die(uActorID); | |
322 | 5624 Actor::AggroSurroundingPeasants(uActorID, 0); |
0 | 5625 v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP; |
5626 if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) | |
5627 v18 = 10; | |
5628 if ( !MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
5629 { | |
5630 pVelocity->x = (unsigned __int64)(v18 * (signed __int64)pVelocity->x) >> 16; | |
5631 pVelocity->y = (unsigned __int64)(v18 * (signed __int64)pVelocity->y) >> 16; | |
5632 pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; | |
5633 v7->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
5634 v7->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
5635 v7->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
5636 } | |
322 | 5637 Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v14); |
0 | 5638 } |
5639 else | |
5640 { | |
1060 | 5641 Actor::AI_Stun(uActorID, v17, 0); |
0 | 5642 } |
322 | 5643 return; |
0 | 5644 } |
5645 v13 = v7->pMonsterInfo.uSpell2ID; | |
5646 } | |
5647 v12 = LOBYTE(pSpellStats->pInfos[v13].uSchool); | |
5648 goto LABEL_30; | |
5649 } | |
5650 v12 = v8->pMonsterInfo.uAttack1Type; | |
5651 goto LABEL_30; | |
5652 } | |
5653 } | |
5654 } | |
5655 } | |
5656 | |
5657 //----- (0043C91D) -------------------------------------------------------- | |
899 | 5658 int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder) |
0 | 5659 { |
5660 int result; // eax@2 | |
5661 char v5; // zf@3 | |
5662 const char *v6; // [sp-Ch] [bp-18h]@88 | |
5663 signed int v7; // [sp-8h] [bp-14h]@61 | |
5664 int v8; // [sp-4h] [bp-10h]@61 | |
5665 signed int v9; // [sp-4h] [bp-10h]@69 | |
5666 | |
5667 result = 0; //BUG fn is void | |
899 | 5668 if ( item_id <= 500 ) |
0 | 5669 { |
5670 //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0; | |
899 | 5671 v5 = party_has_equipment[(item_id - 100) + 32 + 2] == 0; |
5672 switch ( item_id ) | |
5673 { | |
5674 case 516: | |
5675 v5 = byte_5111F6[2] == 0; | |
5676 break; | |
5677 case 505: | |
5678 v5 = byte_5111F6[1] == 0; | |
5679 break; | |
5680 case 504: | |
5681 v5 = byte_5111F6[0] == 0; | |
5682 break; | |
5683 case 533: | |
5684 v5 = byte_5111F6[16] == 0; | |
5685 break; | |
5686 case 512: | |
5687 v5 = byte_5111F6[3] == 0; | |
5688 break; | |
5689 case 521: | |
5690 v5 = byte_5111F6[4] == 0; | |
5691 break; | |
5692 case 522: | |
5693 v5 = byte_5111F6[5] == 0; | |
5694 break; | |
5695 case 523: | |
5696 v5 = byte_5111F6[6] == 0; | |
5697 break; | |
5698 case 532: | |
5699 v5 = byte_5111F6[7] == 0; | |
5700 break; | |
5701 case 544: | |
5702 v5 = byte_5111F6[8] == 0; | |
5703 break; | |
5704 case 524: | |
5705 v5 = byte_5111F6[9] == 0; | |
5706 break; | |
5707 case 535: | |
5708 v5 = byte_5111F6[10] == 0; | |
5709 break; | |
5710 case 525: | |
5711 v5 = byte_5111F6[11] == 0; | |
5712 break; | |
5713 case 530: | |
5714 v5 = byte_5111F6[12] == 0; | |
5715 break; | |
5716 case 547: | |
5717 v5 = byte_5111F6[13] == 0; | |
5718 break; | |
5719 case 548: | |
5720 v5 = byte_5111F6[14] == 0; | |
5721 break; | |
5722 case 550: | |
5723 v5 = byte_5111F6[15] == 0; | |
5724 break; | |
5725 default: | |
5726 break; | |
5727 } | |
0 | 5728 if ( v5 ) |
5729 return result; | |
5730 result = 516; | |
899 | 5731 if ( item_id < 66 || item_id > 78 ) |
5732 { | |
5733 if ( item_id == 516 ) | |
5734 { | |
5735 if ( !shoulder ) | |
5736 return sprintf(pOut, "item%3.3dv%d", 234, index); | |
5737 if ( shoulder == 1 ) | |
5738 return sprintf(pOut, "item%3.3dv%da1", 234, index); | |
5739 if ( shoulder == 2 ) | |
5740 return sprintf(pOut, "item%3.3dv%da2", 234, index); | |
5741 } | |
5742 if ( item_id != 504 && item_id != 505 && item_id != 533 ) | |
5743 { | |
5744 if ( (item_id < 100 || item_id > 104) && item_id != 524 && item_id != 535 ) | |
5745 { | |
5746 if ( item_id >= 115 && item_id <= 119 || item_id == 512 ) | |
5747 { | |
5748 if ( item_id == 512 ) | |
5749 item_id = 312; | |
5750 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5751 } | |
5752 if ( (item_id < 89 || item_id > 99) && item_id != 521 && item_id != 522 && item_id != 523 && item_id != 532 && item_id != 544 ) | |
0 | 5753 { |
5754 result = 525; | |
899 | 5755 if ( (item_id < 105 || item_id > 109) && item_id != 525 && item_id != 530 && item_id != 547 && item_id != 548 && item_id != 550 ) |
0 | 5756 return result; |
899 | 5757 switch ( item_id ) |
0 | 5758 { |
5759 case 525: | |
899 | 5760 item_id = 325; |
0 | 5761 break; |
5762 case 530: | |
899 | 5763 item_id = 330; |
0 | 5764 break; |
5765 case 547: | |
899 | 5766 item_id = 347; |
0 | 5767 break; |
5768 case 548: | |
899 | 5769 item_id = 348; |
0 | 5770 break; |
5771 case 550: | |
899 | 5772 item_id = 350; |
0 | 5773 break; |
5774 } | |
899 | 5775 if ( !shoulder ) |
5776 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5777 return sprintf(pOut, "item%3.3dv%da1", item_id, index); | |
5778 } | |
5779 if ( item_id == 521 ) | |
5780 return sprintf(pOut, "item%3.3dv%d", 239, index); | |
5781 if ( item_id == 522 ) | |
5782 return sprintf(pOut, "item%3.3dv%d", 240, index); | |
5783 if ( item_id == 523 ) | |
5784 return sprintf(pOut, "item%3.3dv%d", 241, index); | |
5785 if ( item_id != 532 ) | |
5786 { | |
5787 if ( item_id == 544 ) | |
5788 item_id = 344; | |
5789 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5790 } | |
5791 return sprintf(pOut, "item%3.3dv%d", 93, index); | |
5792 } | |
5793 if ( item_id == 524 ) | |
5794 return sprintf(pOut, "item%3.3dv%d", 324, index); | |
5795 if ( item_id == 535 ) | |
5796 item_id = 104; | |
5797 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5798 } | |
5799 } | |
5800 if ( item_id != 516 ) | |
5801 { | |
5802 switch ( item_id ) | |
0 | 5803 { |
5804 case 504: | |
899 | 5805 item_id = 235; |
0 | 5806 break; |
5807 case 505: | |
899 | 5808 item_id = 236; |
0 | 5809 break; |
5810 case 533: | |
899 | 5811 item_id = 73; |
0 | 5812 break; |
5813 } | |
899 | 5814 if ( !shoulder ) |
5815 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5816 if ( shoulder == 1 ) | |
5817 return sprintf(pOut, "item%3.3dv%da1", item_id, index); | |
5818 if ( shoulder == 2 ) | |
5819 return sprintf(pOut, "item%3.3dv%da2", item_id, index); | |
5820 } | |
5821 if ( !shoulder ) | |
5822 return sprintf(pOut, "item%3.3dv%d", 234, index); | |
5823 if ( shoulder == 1 ) | |
5824 return sprintf(pOut, "item%3.3dv%da1", 234, index); | |
5825 if ( shoulder == 2 ) | |
5826 return sprintf(pOut, "item%3.3dv%da2", 234, index); | |
5827 } | |
5828 result = item_id - 504; | |
0 | 5829 return result; |
5830 } | |
5831 | |
5832 //----- (0043ED6F) -------------------------------------------------------- | |
5833 bool _43ED6F_check_party_races(bool a1) | |
5834 { | |
5835 bool v6; // zf@5 | |
5836 | |
5837 for (uint i = 0; i < 4; ++i) | |
5838 { | |
5839 auto player = pParty->pPlayers + i; | |
5840 auto race = player->GetRace(); | |
5841 | |
5842 if (race != CHARACTER_RACE_HUMAN && | |
5843 race != CHARACTER_RACE_ELF && | |
5844 race != CHARACTER_RACE_GOBLIN) | |
5845 v6 = a1 == 1; | |
5846 else | |
5847 v6 = !a1; | |
5848 | |
5849 if (v6) | |
5850 return true; | |
5851 } | |
5852 return false; | |
5853 } | |
5854 // A750D8: using guessed type __int64 qword_A750D8; | |
5855 | |
5856 //----- (0043EDB9) -------------------------------------------------------- | |
4 | 5857 bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) |
5858 { | |
5859 unsigned int pNum; // ebp@1 | |
5860 Player **pPlayer; // ebx@1 | |
5861 Player *pPlayer2; // esi@2 | |
5862 enum CHARACTER_RACE pRace; // edi@2 | |
5863 bool pSex; // eax@2 | |
0 | 5864 char v6; // zf@7 |
5865 | |
4 | 5866 //pPlayer = &pPlayers[1]; |
5867 /*pNum = a1; | |
5868 | |
0 | 5869 while ( 1 ) |
5870 { | |
4 | 5871 pPlayer2 = *pPlayer; |
5872 pRace = pPlayer2->GetRace(); | |
5873 pSex = pPlayer2->GetSexByVoice(); | |
5874 if ( !pRace ) | |
5875 break; | |
5876 if ( pRace == 1 || pRace == 2 ) | |
0 | 5877 break; |
4 | 5878 if ( !pSex && pNum == 2 )// |
5879 //goto LABEL_15; | |
5880 { | |
5881 pSex = 1; | |
5882 return pSex; | |
5883 } | |
5884 v6 = pNum == 3;// | |
0 | 5885 LABEL_11: |
5886 if ( v6 ) | |
4 | 5887 //goto LABEL_15; |
5888 { | |
5889 pSex = 1; | |
5890 return pSex; | |
5891 } | |
5892 ++pPlayer; | |
5893 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )// | |
5894 { | |
5895 pSex = 0; | |
5896 return pSex; | |
5897 } | |
5898 } | |
5899 if ( pSex || pNum ) | |
5900 { | |
5901 v6 = pNum == 1; | |
0 | 5902 goto LABEL_11; |
5903 } | |
4 | 5904 //LABEL_15: |
5905 pSex = 1; | |
5906 return pSex;*/ | |
871 | 5907 for (uint i = 1; i <= 4; ++i) |
4 | 5908 { |
5909 pRace = pPlayers[i]->GetRace(); | |
5910 pSex = pPlayers[i]->GetSexByVoice(); | |
5911 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 ) | |
5912 return 1; | |
5913 } | |
5914 return 0; | |
0 | 5915 } |
5916 // A750D8: using guessed type __int64 qword_A750D8; | |
5917 | |
5918 //----- (0043EE15) -------------------------------------------------------- | |
899 | 5919 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) |
5920 { | |
0 | 5921 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) |
5922 { | |
899 | 5923 for ( uint i = 0; i < 126; ++i ) |
5924 { | |
5925 if ( pPlayer->pInventoryIndices[i] > 0 ) | |
5926 { | |
5927 if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pInventoryIndices[i] - 1].uItemID == uItemID ) | |
5928 return true; | |
5929 } | |
5930 } | |
5931 for ( uint i = 0; i < 16; ++i ) | |
5932 { | |
5933 if ( pPlayer->pEquipment.pIndices[i] ) | |
5934 { | |
5935 if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) | |
5936 return true; | |
5937 } | |
5938 } | |
5939 } | |
5940 return false; | |
0 | 5941 } |
5942 | |
5943 //----- (0043EE77) -------------------------------------------------------- | |
5944 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1) | |
5945 { | |
5946 bool result; // eax@0 | |
5947 Player *v2; // edx@3 | |
5948 int v3; // ecx@3 | |
5949 Player **pPlayers; // esi@8 | |
5950 unsigned int v5; // ecx@8 | |
5951 Player *v6; // edx@9 | |
5952 | |
5953 if ( a1 < 1 || a1 > 4 ) | |
5954 { | |
5955 if ( !a1 ) | |
5956 { | |
5957 pPlayers = &::pPlayers[1]; | |
5958 v5 = 604; | |
5959 while ( 1 ) | |
5960 { | |
899 | 5961 result = Player_has_item(v5, *pPlayers, 0); |
0 | 5962 if ( !result ) |
5963 break; | |
898 | 5964 result = v6->pEquipment.uArmor; |
0 | 5965 if ( !result ) |
5966 break; | |
5967 result *= 9; | |
5968 if ( *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v5 ) | |
5969 break; | |
5970 ++pPlayers; | |
5971 if ( (signed int)pPlayers >= (signed int)&qword_A750D8 ) | |
5972 goto LABEL_13; | |
5973 } | |
5974 } | |
5975 goto LABEL_6; | |
5976 } | |
899 | 5977 result = Player_has_item(604u, ::pPlayers[a1], 0); |
0 | 5978 if ( !result |
898 | 5979 || (result = v2->pEquipment.uArmor) == 0 |
0 | 5980 || (result *= 9, *(int *)&v2->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v3) ) |
5981 { | |
5982 LABEL_6: | |
5983 LOBYTE(result) = 0; | |
5984 return result; | |
5985 } | |
5986 LABEL_13: | |
5987 LOBYTE(result) = 1; | |
5988 return result; | |
5989 } | |
5990 // A750D8: using guessed type __int64 qword_A750D8; | |
5991 | |
5992 | |
5993 //----- (0043F333) -------------------------------------------------------- | |
5994 void BspRenderer::MakeVisibleSectorList() | |
5995 { | |
5996 int v6; // ebx@3 | |
5997 | |
5998 uNumVisibleNotEmptySectors = 0; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
5999 for (uint i = 0; i < num_nodes; ++i) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6000 { |
0 | 6001 if (!uNumVisibleNotEmptySectors) |
6002 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6003 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6004 continue; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6005 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6006 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6007 v6 = 0; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6008 while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != nodes[i].uSectorID ) |
0 | 6009 { |
6010 ++v6; | |
6011 if ( v6 >= uNumVisibleNotEmptySectors) | |
6012 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6013 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6014 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6015 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6016 |
0 | 6017 } |
6018 } | |
6019 | |
6020 //----- (0043F515) -------------------------------------------------------- | |
657 | 6021 void FindBillboardsLightLevels_BLV() |
0 | 6022 { |
6023 for (uint i = 0; i < uNumBillboardsToDraw; ++i) | |
6024 { | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
6025 auto p = &pBillboardRenderList[i]; |
0 | 6026 |
6027 if (p->field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !p->uIndoorSectorID) | |
657 | 6028 p->dimming_level = 0; |
0 | 6029 else |
657 | 6030 p->dimming_level = _43F55F_get_billboard_light_level(p, -1); |
0 | 6031 } |
6032 } | |
6033 | |
6034 //----- (0043F55F) -------------------------------------------------------- | |
6035 int __fastcall _43F55F_get_billboard_light_level(RenderBillboard *a1, int uBaseLightLevel) | |
6036 { | |
6037 signed int v3; // ecx@2 | |
6038 | |
6039 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
6040 { | |
6041 v3 = pIndoor->pSectors[a1->uIndoorSectorID].uMinAmbientLightLevel; | |
6042 } | |
6043 else | |
6044 { | |
6045 if ( uBaseLightLevel == -1 ) | |
657 | 6046 v3 = a1->dimming_level; |
0 | 6047 else |
6048 v3 = uBaseLightLevel; | |
6049 } | |
430 | 6050 return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->world_x, a1->world_y, a1->world_z); |
0 | 6051 } |
6052 | |
6053 //----- (0043F5C8) -------------------------------------------------------- | |
6054 int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z) | |
6055 { | |
6056 int v5; // esi@1 | |
6057 signed int v6; // edi@1 | |
6058 int v8; // eax@6 | |
6059 int v9; // ebx@6 | |
6060 unsigned int v10; // ecx@6 | |
6061 unsigned int v11; // edx@9 | |
6062 unsigned int v12; // edx@11 | |
6063 signed int v13; // ecx@12 | |
6064 BLVLightMM7 *v16; // esi@20 | |
6065 int v17; // ebx@21 | |
6066 int v18; // eax@24 | |
6067 int v19; // ebx@24 | |
6068 unsigned int v20; // ecx@24 | |
6069 int v21; // edx@25 | |
6070 unsigned int v22; // edx@27 | |
6071 unsigned int v23; // edx@29 | |
6072 signed int v24; // ecx@30 | |
6073 int v26; // ebx@35 | |
6074 int v27; // eax@38 | |
6075 int v28; // ebx@38 | |
6076 unsigned int v29; // ecx@38 | |
6077 int v30; // edx@39 | |
6078 unsigned int v31; // edx@41 | |
6079 unsigned int v32; // edx@43 | |
6080 signed int v33; // ecx@44 | |
6081 int v37; // [sp+Ch] [bp-18h]@37 | |
6082 int v38; // [sp+10h] [bp-14h]@5 | |
6083 int v39; // [sp+10h] [bp-14h]@23 | |
6084 int v40; // [sp+10h] [bp-14h]@36 | |
6085 int v42; // [sp+14h] [bp-10h]@22 | |
6086 unsigned int v43; // [sp+18h] [bp-Ch]@12 | |
6087 unsigned int v44; // [sp+18h] [bp-Ch]@30 | |
6088 unsigned int v45; // [sp+18h] [bp-Ch]@44 | |
6089 | |
6090 v6 = uBaseLightLevel; | |
6091 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i) | |
6092 { | |
6093 auto p = pMobileLightsStack->pLights + i; | |
6094 | |
6095 auto distX = abs(p->vPosition.x - x); | |
6096 if ( distX <= p->uRadius) | |
6097 { | |
6098 auto distY = abs(p->vPosition.y - y); | |
6099 if ( distY <= p->uRadius) | |
6100 { | |
6101 auto distZ = abs(p->vPosition.z - z); | |
6102 if ( distZ <= p->uRadius) | |
6103 { | |
6104 v8 = distX; | |
6105 v9 = distY; | |
6106 v10 = distZ; | |
6107 if (distX < distY) | |
6108 { | |
6109 v8 = distY; | |
6110 v9 = distX; | |
6111 } | |
6112 if ( v8 < distZ ) | |
6113 { | |
6114 v11 = v8; | |
6115 v8 = distZ; | |
6116 v10 = v11; | |
6117 } | |
6118 if ( v9 < (signed int)v10 ) | |
6119 { | |
6120 v12 = v10; | |
6121 v10 = v9; | |
6122 v9 = v12; | |
6123 } | |
6124 v43 = ((unsigned int)(11 * v9) / 32) + (v10 / 4) + v8; | |
6125 v13 = p->uRadius; | |
6126 if ( (signed int)v43 < v13 ) | |
6127 v6 += ((unsigned __int64)(30i64 * (signed int)(v43 << 16) / v13) >> 16) - 30; | |
6128 } | |
6129 } | |
6130 } | |
6131 } | |
6132 | |
6133 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6134 { | |
6135 auto pSector = pIndoor->pSectors + uSectorID; | |
6136 | |
6137 for (uint i = 0; i < pSector->uNumLights; ++i) | |
6138 { | |
6139 v16 = pIndoor->pLights + pSector->pLights[i]; | |
6140 if (~v16->uAtributes & 8) | |
6141 { | |
6142 v17 = abs(v16->vPosition.x - x); | |
6143 if ( v17 <= v16->uRadius ) | |
6144 { | |
6145 v42 = abs(v16->vPosition.y - y); | |
6146 if ( v42 <= v16->uRadius ) | |
6147 { | |
6148 v39 = abs(v16->vPosition.z - z); | |
6149 if ( v39 <= v16->uRadius ) | |
6150 { | |
6151 v18 = v17; | |
6152 v19 = v42; | |
6153 v20 = v39; | |
6154 if ( v18 < v42 ) | |
6155 { | |
6156 v21 = v18; | |
6157 v18 = v42; | |
6158 v19 = v21; | |
6159 } | |
6160 if ( v18 < v39 ) | |
6161 { | |
6162 v22 = v18; | |
6163 v18 = v39; | |
6164 v20 = v22; | |
6165 } | |
6166 if ( v19 < (signed int)v20 ) | |
6167 { | |
6168 v23 = v20; | |
6169 v20 = v19; | |
6170 v19 = v23; | |
6171 } | |
6172 v44 = ((unsigned int)(11 * v19) >> 5) + (v20 >> 2) + v18; | |
6173 v24 = v16->uRadius; | |
6174 if ( (signed int)v44 < v24 ) | |
6175 v6 += ((unsigned __int64)(30i64 * (signed int)(v44 << 16) / v24) >> 16) - 30; | |
6176 } | |
6177 } | |
6178 } | |
6179 } | |
6180 } | |
6181 } | |
6182 | |
6183 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i) | |
6184 { | |
6185 auto p = pStationaryLightsStack->pLights + i; | |
6186 v26 = abs(p->vPosition.x - x); | |
6187 if ( v26 <= p->uRadius) | |
6188 { | |
6189 v40 = abs(p->vPosition.y - y); | |
6190 if ( v40 <= p->uRadius) | |
6191 { | |
6192 v37 = abs(p->vPosition.z - z); | |
6193 if ( v37 <= p->uRadius) | |
6194 { | |
6195 v27 = v26; | |
6196 v28 = v40; | |
6197 v29 = v37; | |
6198 if ( v27 < v40 ) | |
6199 { | |
6200 v30 = v27; | |
6201 v27 = v40; | |
6202 v28 = v30; | |
6203 } | |
6204 if ( v27 < v37 ) | |
6205 { | |
6206 v31 = v27; | |
6207 v27 = v37; | |
6208 v29 = v31; | |
6209 } | |
6210 if ( v28 < (signed int)v29 ) | |
6211 { | |
6212 v32 = v29; | |
6213 v29 = v28; | |
6214 v28 = v32; | |
6215 } | |
6216 v45 = ((unsigned int)(11 * v28) >> 5) + (v29 >> 2) + v27; | |
6217 v33 = p->uRadius; | |
6218 if ( (signed int)v45 < v33 ) | |
6219 v6 += ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / v33) >> 16) - 30; | |
6220 } | |
6221 } | |
6222 } | |
6223 } | |
6224 | |
6225 if ( v6 <= 31 ) | |
6226 { | |
6227 if ( v6 < 0 ) | |
6228 v6 = 0; | |
6229 } | |
6230 else | |
6231 { | |
6232 v6 = 31; | |
6233 } | |
6234 return v6; | |
6235 } | |
6236 | |
6237 //----- (00406051) -------------------------------------------------------- | |
6238 __int16 stru262_TurnBased::StartTurn() | |
6239 { | |
6240 stru262_TurnBased *v1; // esi@1 | |
6241 int v2; // ecx@1 | |
6242 int v3; // ebx@1 | |
6243 char *v4; // edi@1 | |
6244 int v5; // eax@4 | |
6245 int v6; // eax@12 | |
6246 char *v7; // eax@15 | |
6247 TurnBased_QueueElem *v8; // edi@17 | |
6248 unsigned int v9; // edx@23 | |
6249 char *v10; // eax@26 | |
6250 int v11; // eax@30 | |
6251 int v12; // ebx@30 | |
6252 char *v13; // edi@31 | |
6253 int v15; // [sp+Ch] [bp-10h]@5 | |
6254 TurnBased_QueueElem *v16; // [sp+10h] [bp-Ch]@3 | |
6255 int v17; // [sp+14h] [bp-8h]@2 | |
6256 int v18; // [sp+14h] [bp-8h]@16 | |
6257 signed int v19; // [sp+18h] [bp-4h]@1 | |
6258 int v20; // [sp+18h] [bp-4h]@14 | |
6259 | |
6260 v1 = this; | |
6261 v2 = 0; | |
6262 v19 = 0; | |
6263 v3 = v1->uActorQueueSize; | |
6264 v1->field_1C = 0; | |
6265 v4 = (char *)&v1->pQueue[v3].field_4; | |
6266 do | |
6267 { | |
6268 v17 = v2; | |
6269 if ( v1->uActorQueueSize <= v2 ) | |
6270 goto LABEL_11; | |
6271 v16 = v1->pQueue; | |
6272 while ( 1 ) | |
6273 { | |
6274 v5 = v16->uPackedID; | |
848 | 6275 if ( PID_TYPE(v16->uPackedID) == OBJECT_Player) |
0 | 6276 break; |
6277 LABEL_8: | |
6278 ++v17; | |
6279 ++v16; | |
6280 if ( v17 >= v1->uActorQueueSize ) | |
6281 goto LABEL_11; | |
6282 } | |
848 | 6283 v15 = PID_ID(v5); |
6284 if ( !pPlayers[(PID_ID(v5)) + 1]->CanAct() || v19 != v15 ) | |
0 | 6285 { |
6286 v2 = 0; | |
6287 goto LABEL_8; | |
6288 } | |
6289 v2 = 0; | |
6290 LABEL_11: | |
6291 if ( v17 == v1->uActorQueueSize ) | |
6292 { | |
6293 *(int *)v4 = 100; | |
6294 v6 = 8 * v19; | |
862 | 6295 LOBYTE(v6) = PID(OBJECT_Player,v19); |
0 | 6296 *((int *)v4 + 2) = v2; |
6297 *((int *)v4 - 1) = v6; | |
6298 *((int *)v4 + 1) = v2; | |
6299 ++v3; | |
6300 v4 += 16; | |
6301 } | |
6302 ++v19; | |
6303 } | |
6304 while ( v19 < 4 ); | |
6305 v1->uActorQueueSize = v3; | |
6306 v20 = v2; | |
6307 if ( ai_arrays_size > v2 ) | |
6308 { | |
6309 v7 = (char *)&v1->pQueue[v3].field_4; | |
6310 do | |
6311 { | |
6312 v18 = v2; | |
6313 if ( v1->uActorQueueSize > v2 ) | |
6314 { | |
6315 v8 = v1->pQueue; | |
6316 do | |
6317 { | |
848 | 6318 if ( PID_TYPE(v8->uPackedID) == OBJECT_Actor && ai_near_actors_ids[v20] == PID_ID(v8->uPackedID) ) |
0 | 6319 break; |
6320 ++v18; | |
6321 ++v8; | |
6322 } | |
6323 while ( v18 < v1->uActorQueueSize ); | |
6324 v2 = 0; | |
6325 } | |
6326 if ( v18 == v1->uActorQueueSize ) | |
6327 { | |
390 | 6328 v9 = ai_near_actors_ids[v20]; |
0 | 6329 *(int *)v7 = 1; |
6330 *((int *)v7 + 2) = v2; | |
862 | 6331 *((int *)v7 - 1) = PID(OBJECT_Actor,v9); |
0 | 6332 *((int *)v7 + 1) = v2; |
6333 ++v3; | |
6334 v7 += 16; | |
6335 } | |
6336 ++v20; | |
6337 } | |
6338 while ( v20 < ai_arrays_size ); | |
6339 } | |
6340 ++v1->field_0; | |
6341 v1->uActorQueueSize = v3; | |
6342 v1->field_10 = 100; | |
6343 if ( v3 > 0 ) | |
6344 { | |
6345 v10 = (char *)&v1->pQueue[0].field_4; | |
6346 do | |
6347 { | |
6348 if ( *(int *)v10 <= 0 ) | |
6349 *(int *)v10 = 100; | |
6350 ++v2; | |
6351 v10 += 16; | |
6352 } | |
6353 while ( v2 < v1->uActorQueueSize ); | |
6354 } | |
6355 LOWORD(v11) = v1->_4063A1(); | |
6356 v12 = 0; | |
6357 if ( v1->uActorQueueSize > 0 ) | |
6358 { | |
6359 v13 = (char *)&v1->pQueue[0].field_4; | |
6360 do | |
6361 { | |
848 | 6362 v11 = PID_TYPE(*((int *)v13 - 1)); |
0 | 6363 if ( (char)v11 == 4 ) |
6364 break; | |
6365 if ( *(int *)v13 > 0 ) | |
6366 break; | |
6367 LOWORD(v11) = v1->_40680F(v12++); | |
6368 v13 += 16; | |
6369 } | |
6370 while ( v12 < v1->uActorQueueSize ); | |
6371 } | |
6372 return v11; | |
6373 } | |
6374 // 4F75D8: using guessed type int ai_arrays_size; | |
6375 | |
6376 //----- (004061CA) -------------------------------------------------------- | |
6377 void stru262_TurnBased::NextTurn() | |
6378 { | |
6379 stru262_TurnBased *v1; // esi@1 | |
6380 TurnBased_QueueElem *v2; // ebp@1 | |
6381 int v3; // ebx@1 | |
6382 int v4; // edi@7 | |
6383 Actor *v5; // eax@9 | |
6384 int v6; // ecx@9 | |
6385 signed int v7; // ebx@17 | |
6386 int v8; // ebp@27 | |
6387 TurnBased_QueueElem *v9; // edi@28 | |
6388 int v10; // ecx@30 | |
6389 unsigned __int16 v11; // ax@30 | |
6390 signed int v12; // edx@35 | |
6391 signed int v13; // [sp+10h] [bp-4h]@7 | |
6392 | |
6393 v1 = this; | |
6394 _404544(); | |
6395 v2 = v1->pQueue; | |
6396 v3 = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6397 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6398 uActiveCharacter = PID_ID(v1->pQueue[0].uPackedID) + 1; |
0 | 6399 else |
6400 uActiveCharacter = 0; | |
6401 viewparams->bRedrawGameUI = 1; | |
6402 if ( v1->field_1C ) | |
6403 { | |
6404 pTurnEngine->field_18 |= 2u; | |
6405 return; | |
6406 } | |
6407 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
6408 if ( v1->pQueue[0].field_4 <= 0 ) | |
6409 return; | |
6410 v4 = 0; | |
6411 v13 = 0; | |
6412 if ( v1->uActorQueueSize <= 0 ) | |
6413 goto LABEL_27; | |
6414 do | |
6415 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6416 if (PID_TYPE(v2->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6417 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6418 v5 = &pActors[PID_ID(v2->uPackedID)]; |
0 | 6419 LOWORD(v6) = v5->uAIState; |
6420 if ( (short)v6 == 4 | |
6421 || (short)v6 == 8 | |
6422 || (short)v6 == 2 | |
6423 || (short)v6 == 3 | |
6424 || (short)v6 == 12 | |
6425 || (short)v6 == 13 | |
6426 || (short)v6 == 18 | |
6427 || (short)v6 == 17 ) | |
6428 { | |
6429 v7 = v5->uCurrentActionLength; | |
6430 v5->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
6431 if ( (signed int)v5->uCurrentActionTime < v7 ) | |
6432 { | |
6433 v13 = 1; | |
6434 LABEL_19: | |
6435 v3 = 0; | |
6436 goto LABEL_20; | |
6437 } | |
6438 v6 = (signed __int16)v6; | |
6439 if ( (signed __int16)v6 == 4 ) | |
6440 { | |
6441 v3 = 0; | |
6442 v5->uAIState = Dead; | |
6443 v5->uCurrentActionTime = 0; | |
6444 v5->uCurrentActionLength = 0; | |
6445 v5->UpdateAnimation(); | |
6446 } | |
6447 else | |
6448 { | |
6449 if ( v6 != 8 ) | |
6450 goto LABEL_19; | |
6451 v3 = 0; | |
848 | 6452 Actor::AI_StandOrBored(PID_ID(v2->uPackedID), ai_near_actors_targets_pid[PID_ID(v2->uPackedID)], 32, 0); |
0 | 6453 } |
6454 } | |
6455 } | |
6456 LABEL_20: | |
6457 ++v4; | |
6458 ++v2; | |
6459 } | |
6460 while ( v4 < v1->uActorQueueSize ); | |
6461 if ( v13 != v3 ) | |
6462 { | |
6463 v1->field_18 |= 1u; | |
6464 return; | |
6465 } | |
6466 LABEL_27: | |
6467 v1->field_18 &= 0xFFFFFFFEu; | |
6468 v8 = 0; | |
6469 if ( v1->uActorQueueSize > v3 ) | |
6470 { | |
6471 v9 = v1->pQueue; | |
6472 do | |
6473 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6474 if (PID_TYPE(v9->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6475 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6476 v10 = PID_ID(v9->uPackedID); |
0 | 6477 v11 = pActors[v10].uAIState; |
6478 if ( v11 != 5 ) | |
6479 { | |
6480 if ( v11 != 4 && v11 != 11 && v11 != 19 ) | |
6481 { | |
6482 if ( v11 != 17 ) | |
6483 { | |
417 | 6484 v12 = ai_near_actors_targets_pid[v10]; |
0 | 6485 v9->uActionLength = v3; |
414 | 6486 Actor::AI_StandOrBored(v10, v12, 32, (AIDirection *)v3); |
0 | 6487 } |
6488 } | |
6489 } | |
6490 } | |
6491 ++v8; | |
6492 ++v9; | |
6493 } | |
6494 while ( v8 < v1->uActorQueueSize ); | |
6495 } | |
6496 v1->field_4 = 3; | |
6497 pParty->uTimePlayed += __PAIR__(v3, 213); | |
6498 _494035_timed_effects__water_walking_damage__etc(); | |
6499 v1->uActionPointsLeft = 130; | |
6500 } | |
6501 | |
6502 //----- (004063A1) -------------------------------------------------------- | |
6503 int stru262_TurnBased::_4063A1() | |
6504 { | |
6505 stru262_TurnBased *v1; // esi@1 | |
6506 int v2; // ebp@1 | |
6507 signed int result; // eax@1 | |
6508 int v4; // edx@1 | |
6509 int v5; // edx@3 | |
6510 int v6; // edi@4 | |
6511 int v7; // ecx@5 | |
6512 Actor *v8; // ecx@11 | |
6513 unsigned __int16 v9; // dx@12 | |
6514 int v10; // edi@16 | |
6515 int v11; // edx@17 | |
6516 char v12; // zf@18 | |
6517 | |
6518 v1 = this; | |
6519 _404544(); | |
6520 v2 = (int)&v1->pQueue[0].field_4; | |
6521 result = 1; | |
6522 viewparams->bRedrawGameUI = 1; | |
6523 v4 = v1->pQueue[0].field_4; | |
6524 if ( v4 ) | |
6525 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6526 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 6527 { |
6528 v5 = v1->uActorQueueSize; | |
6529 while ( 1 ) | |
6530 { | |
6531 v6 = 0; | |
6532 if ( v5 > 0 ) | |
6533 { | |
6534 v7 = (int)&v1->pQueue[0].field_4; | |
6535 do | |
6536 { | |
6537 --*(int *)v7; | |
6538 v5 = v1->uActorQueueSize; | |
6539 ++v6; | |
6540 v7 += 16; | |
6541 } | |
6542 while ( v6 < v5 ); | |
6543 } | |
6544 --v1->field_10; | |
6545 if ( v1->field_10 <= 0 ) | |
6546 break; | |
6547 if ( !*(int *)v2 ) | |
6548 goto LABEL_9; | |
6549 } | |
6550 LABEL_24: | |
6551 result = 1; | |
6552 } | |
6553 else | |
6554 { | |
848 | 6555 v8 = &pActors[PID_ID(v1->pQueue[0].uPackedID)]; |
0 | 6556 if ( v4 > 0 ) |
6557 { | |
6558 do | |
6559 { | |
6560 v9 = v8->uAIState; | |
6561 if ( v9 == 5 ) | |
6562 break; | |
6563 if ( v9 == 4 || v9 == 19 || v9 == 11 ) | |
6564 break; | |
6565 v10 = 0; | |
6566 if ( v1->uActorQueueSize > 0 ) | |
6567 { | |
6568 v11 = (int)&v1->pQueue[0].field_4; | |
6569 do | |
6570 { | |
6571 v12 = (*(int *)v11)-- == 1; | |
6572 if ( v12 ) | |
6573 *(int *)(v11 + 4) = 0; | |
6574 ++v10; | |
6575 v11 += 16; | |
6576 } | |
6577 while ( v10 < v1->uActorQueueSize ); | |
6578 } | |
6579 --v1->field_10; | |
6580 if ( v1->field_10 <= 0 ) | |
6581 goto LABEL_24; | |
6582 } | |
6583 while ( *(int *)v2 > 0 ); | |
6584 } | |
6585 LABEL_9: | |
6586 result = 0; | |
6587 } | |
6588 } | |
6589 return result; | |
6590 } | |
6591 | |
6592 //----- (00406457) -------------------------------------------------------- | |
6593 int stru262_TurnBased::_406457(int a2) | |
6594 { | |
6595 stru262_TurnBased *v2; // esi@1 | |
6596 signed int v3; // eax@1 | |
6597 signed int v4; // ecx@2 | |
6598 char *v5; // edx@2 | |
6599 signed int v6; // eax@2 | |
6600 int result; // eax@11 | |
6601 int v8; // edx@13 | |
6602 int v9; // ecx@14 | |
6603 char v10; // zf@15 | |
6604 | |
6605 v2 = this; | |
6606 v3 = *(&this->field_0 + 4 * (a2 + 2)); | |
848 | 6607 if ( (*((char *)&this->field_0 + 16 * PID_TYPE(a2 + 2))) == OBJECT_Player) |
6608 { | |
6609 v4 = PID_ID(v3); | |
6610 v5 = (char *)&pParty->pTurnBasedPlayerRecoveryTimes[PID_ID(v3)]; | |
0 | 6611 v6 = *(int *)v5; |
6612 if ( *(int *)v5 ) | |
6613 *(int *)v5 = 0; | |
6614 else | |
6615 v6 = pPlayers[v4 + 1]->GetAttackRecoveryTime(0); | |
6616 if ( v6 < 30 ) | |
6617 v6 = 30; | |
6618 } | |
6619 else | |
6620 { | |
848 | 6621 v6 = pMonsterStats->pInfos[pActors[PID_ID(v3)].pMonsterInfo.uID].uRecoveryTime; |
0 | 6622 } |
6623 v2->pQueue[a2].field_4 = v6; | |
6624 v2->_404544(); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6625 if (PID_TYPE(v2->pQueue[0].uPackedID) == OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6626 uActiveCharacter = PID_ID(v2->pQueue[0].uPackedID) + 1; |
0 | 6627 else |
6628 uActiveCharacter = 0; | |
6629 result = (int)&v2->pQueue[0].field_4; | |
6630 viewparams->bRedrawGameUI = 1; | |
6631 while ( *(int *)result > 0 ) | |
6632 { | |
6633 if ( v2->field_10 <= 0 ) | |
6634 break; | |
6635 v8 = 0; | |
6636 if ( v2->uActorQueueSize > 0 ) | |
6637 { | |
6638 v9 = (int)&v2->pQueue[0].field_4; | |
6639 do | |
6640 { | |
6641 v10 = (*(int *)v9)-- == 1; | |
6642 if ( v10 ) | |
6643 *(int *)(v9 + 4) = 0; | |
6644 ++v8; | |
6645 v9 += 16; | |
6646 } | |
6647 while ( v8 < v2->uActorQueueSize ); | |
6648 } | |
6649 --v2->field_10; | |
6650 if ( v2->field_10 <= 0 ) | |
6651 break; | |
6652 } | |
6653 return result; | |
6654 } | |
6655 | |
6656 //----- (0040652A) -------------------------------------------------------- | |
6657 void stru262_TurnBased::_40652A() | |
6658 { | |
848 | 6659 int *v1; // edx@2 |
0 | 6660 Actor *v2; // eax@5 |
6661 unsigned __int16 v3; // si@5 | |
6662 unsigned int v4; // esi@8 | |
6663 int v5; // [sp+Ch] [bp-4h]@1 | |
6664 | |
6665 v5 = 0; | |
6666 if ( this->uActorQueueSize > 0 ) | |
6667 { | |
848 | 6668 v1 = &this->pQueue[0].field_4; |
0 | 6669 do |
6670 { | |
6671 if ( !*(int *)v1 ) | |
6672 { | |
848 | 6673 if ( PID_TYPE(*(v1 - 4)) == OBJECT_Player) |
0 | 6674 return; |
848 | 6675 v2 = &pActors[PID_ID(*(v1 - 1))]; |
0 | 6676 v3 = v2->uAIState; |
141 | 6677 if (v3 == Standing || v3 == Fleeing || v3 == Fidgeting) |
0 | 6678 { |
6679 v4 = pMonsterStats->pInfos[v2->pMonsterInfo.uID].uRecoveryTime; | |
6680 *(int *)v1 = v4; | |
6681 if ( (signed __int64)v2->pActorBuffs[7].uExpireTime > 0 ) | |
6682 *(int *)v1 = 2 * v4; | |
6683 } | |
6684 } | |
6685 ++v5; | |
6686 v1 += 16; | |
6687 } | |
6688 while ( v5 < this->uActorQueueSize ); | |
6689 } | |
6690 } | |
6691 | |
6692 //----- (004065B0) -------------------------------------------------------- | |
322 | 6693 void stru262_TurnBased::_4065B0() |
0 | 6694 { |
6695 stru262_TurnBased *v1; // esi@1 | |
6696 signed int v2; // eax@1 | |
6697 int v3; // ebx@6 | |
6698 int v4; // edi@7 | |
6699 unsigned int v5; // edi@14 | |
6700 | |
6701 v1 = this; | |
6702 LOWORD(v2) = _404544(); | |
6703 if ( v1->pQueue[0].field_4 <= 0 | |
848 | 6704 || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, PID_TYPE(v1->pQueue[0].uPackedID) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (PID_ID(v2)) + 1, uActiveCharacter = v2), |
0 | 6705 viewparams->bRedrawGameUI = 1, |
6706 v1->pQueue[0].field_4 <= 0) ) | |
6707 { | |
6708 v3 = 0; | |
6709 if ( v1->uActorQueueSize > 0 ) | |
6710 { | |
6711 v4 = (int)v1->pQueue; | |
6712 do | |
6713 { | |
6714 v2 = *(int *)v4; | |
848 | 6715 if ( PID_TYPE(*(char *)v4) == OBJECT_Player || *(int *)(v4 + 4) > 0 ) |
0 | 6716 break; |
6717 if ( *(int *)(v4 + 8) <= 0 ) | |
6718 { | |
6719 LOWORD(v2) = v2 & 3; | |
6720 if ( (char)v2 == 3 ) | |
6721 LOWORD(v2) = v1->_40680F(v3); | |
6722 } | |
6723 ++v3; | |
6724 v4 += 16; | |
6725 } | |
6726 while ( v3 < v1->uActorQueueSize ); | |
6727 } | |
6728 } | |
6729 v5 = 0; | |
6730 if ( v1->uActorQueueSize > 0 ) | |
6731 { | |
6732 do | |
322 | 6733 v1->_406648(v5++); |
0 | 6734 while ( (signed int)v5 < v1->uActorQueueSize ); |
6735 } | |
6736 } | |
6737 | |
6738 //----- (00406648) -------------------------------------------------------- | |
322 | 6739 void stru262_TurnBased::_406648(unsigned int a2) |
0 | 6740 { |
6741 TurnBased_QueueElem *v1; // ecx@1 | |
6742 int v3; // eax@1 | |
6743 unsigned int v4; // ebx@2 | |
6744 Actor *v5; // esi@2 | |
6745 signed int v6; // edi@5 | |
6746 int v7; // ecx@6 | |
6747 int v8; // eax@6 | |
6748 int v9; // eax@7 | |
6749 int v10; // eax@8 | |
6750 int v11; // eax@9 | |
6751 int v12; // eax@10 | |
6752 int v13; // eax@11 | |
6753 int v14; // eax@14 | |
6754 unsigned int v15; // ecx@14 | |
6755 unsigned int v16; // edx@14 | |
6756 int v17; // eax@17 | |
6757 int v18; // eax@20 | |
6758 char v19; // al@24 | |
6759 unsigned int v21; // [sp-8h] [bp-50h]@16 | |
6760 int v22; // [sp-8h] [bp-50h]@17 | |
6761 AIDirection *v23; // [sp-4h] [bp-4Ch]@14 | |
6762 unsigned int v24; // [sp-4h] [bp-4Ch]@17 | |
6763 char v25; // [sp-4h] [bp-4Ch]@20 | |
6764 AIDirection a3; // [sp+Ch] [bp-3Ch]@2 | |
6765 AIDirection a4; // [sp+28h] [bp-20h]@2 | |
6766 TurnBased_QueueElem *v28; // [sp+44h] [bp-4h]@1 | |
6767 unsigned int a2a; // [sp+50h] [bp+8h]@2 | |
6768 | |
6769 v1 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); | |
6770 v28 = v1; | |
6771 v3 = v1->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6772 if (PID_TYPE(v1->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6773 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6774 v4 = PID_ID(v3); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6775 a2a = ai_near_actors_targets_pid[PID_ID(v3)]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6776 memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0), sizeof(a3)); |
0 | 6777 memcpy(&a4, &a3, sizeof(a4)); |
848 | 6778 v5 = &pActors[PID_ID(v3)]; |
0 | 6779 LOWORD(v3) = v5->uAIState; |
6780 if ( (short)v3 != Dead ) | |
6781 { | |
6782 if ( (short)v3 != Disabled ) | |
6783 { | |
6784 if ( (short)v3 != Removed ) | |
6785 { | |
6786 v6 = v5->uCurrentActionLength; | |
6787 v5->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
6788 if ( (signed int)v5->uCurrentActionTime >= v6 ) | |
6789 { | |
6790 v7 = (signed __int16)v3; | |
6791 v8 = (signed __int16)v3 - 2; | |
6792 if ( !v8 ) | |
6793 { | |
6794 v19 = stru_50C198.special_ability_use_check(&pActors[v4], v4); | |
6795 stru_50FE08.Add( | |
6796 v28->uPackedID, | |
6797 5120, | |
6798 v5->vPosition.x, | |
6799 v5->vPosition.y, | |
6800 v5->vPosition.z + ((signed int)v5->uActorHeight >> 1), | |
6801 v19, | |
6802 1); | |
6803 goto LABEL_25; | |
6804 } | |
6805 v9 = v8 - 1; | |
6806 if ( v9 ) | |
6807 { | |
6808 v10 = v9 - 1; | |
6809 if ( !v10 ) | |
6810 goto LABEL_21; | |
6811 v11 = v10 - 4; | |
6812 if ( !v11 ) | |
6813 goto LABEL_25; | |
6814 v12 = v11 - 4; | |
6815 if ( v12 ) | |
6816 { | |
6817 v13 = v12 - 1; | |
6818 if ( v13 ) | |
6819 { | |
6820 if ( v13 != Dead ) | |
6821 { | |
6822 if ( v7 != 4 ) | |
6823 { | |
6824 v14 = rand(); | |
6825 v15 = v4; | |
6826 v23 = &a4; | |
6827 v16 = a2a; | |
6828 if ( !(v14 % 2) ) | |
6829 { | |
414 | 6830 Actor::AI_Bored(v4, a2a, &a4); |
322 | 6831 return; |
0 | 6832 } |
6833 v21 = 64; | |
6834 LABEL_26: | |
413 | 6835 Actor::AI_Stand(v15, v16, v21, v23); |
322 | 6836 return; |
0 | 6837 } |
6838 LABEL_21: | |
6839 v5->uCurrentActionTime = 0; | |
6840 v5->uCurrentActionLength = 0; | |
6841 v5->uAIState = Dead; | |
322 | 6842 pActors[v4].UpdateAnimation(); |
6843 return; | |
0 | 6844 } |
6845 v24 = v5->pMonsterInfo.uSpellSkillAndMastery2; | |
6846 v22 = 3; | |
6847 v17 = v5->pMonsterInfo.uSpell2ID; | |
6848 } | |
6849 else | |
6850 { | |
6851 v24 = v5->pMonsterInfo.uSpellSkillAndMastery1; | |
6852 v22 = 2; | |
6853 v17 = v5->pMonsterInfo.uSpell1ID; | |
6854 } | |
1060 | 6855 Actor::AI_SpellAttack(v4, &a4, v17, v22, v24); |
0 | 6856 LABEL_25: |
6857 v16 = a2a; | |
6858 v23 = &a4; | |
6859 v21 = 0; | |
6860 v15 = v4; | |
6861 goto LABEL_26; | |
6862 } | |
6863 v18 = v5->pMonsterInfo.uMissleAttack2Type; | |
6864 v25 = 1; | |
6865 } | |
6866 else | |
6867 { | |
6868 v18 = v5->pMonsterInfo.uMissleAttack1Type; | |
6869 v25 = 0; | |
6870 } | |
1060 | 6871 Actor::AI_RangedAttack(v4, &a4, v18, v25); |
0 | 6872 goto LABEL_25; |
6873 } | |
6874 } | |
6875 } | |
6876 } | |
6877 } | |
6878 } | |
6879 // 50FE08: using guessed type stru298 stru_50FE08; | |
6880 | |
6881 //----- (0040680F) -------------------------------------------------------- | |
6882 __int16 stru262_TurnBased::_40680F(int a2) | |
6883 { | |
6884 TurnBased_QueueElem *v2; // eax@1 | |
848 | 6885 unsigned int v3; // eax@1 |
6886 unsigned int v4; // edi@2 | |
0 | 6887 Actor *v5; // ebx@2 |
6888 unsigned int *v6; // esi@7 | |
6889 AIDirection *v7; // esi@10 | |
6890 int v8; // eax@10 | |
6891 unsigned int v9; // ecx@10 | |
6892 signed int v10; // eax@13 | |
6893 unsigned __int8 v11; // sf@19 | |
6894 unsigned __int8 v12; // of@19 | |
6895 int v13; // esi@29 | |
6896 bool v14; // eax@29 | |
6897 unsigned __int8 v15; // cl@33 | |
6898 AIDirection a3; // [sp+Ch] [bp-44h]@10 | |
6899 AIDirection v18; // [sp+28h] [bp-28h]@10 | |
6900 int a2a; // [sp+44h] [bp-Ch]@2 | |
6901 unsigned int v20; // [sp+48h] [bp-8h]@10 | |
6902 TurnBased_QueueElem *v21; // [sp+4Ch] [bp-4h]@1 | |
6903 signed int v22; // [sp+58h] [bp+8h]@10 | |
6904 | |
6905 v2 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); | |
6906 v21 = v2; | |
6907 v2->uActionLength = 0; | |
848 | 6908 v3 = v2->uPackedID; |
0 | 6909 if ( (unsigned __int8)v3 & 3 ) |
6910 { | |
848 | 6911 v3 = PID_ID(v3); |
0 | 6912 v4 = v3; |
848 | 6913 a2a = v3; |
6914 v5 = &pActors[v3]; | |
0 | 6915 LOWORD(v3) = v5->uAIState; |
6916 if ( (short)v3 != 5 ) | |
6917 { | |
6918 if ( (short)v3 != 4 && (short)v3 != 11 && (short)v3 != 19 && (short)v3 != 17 ) | |
6919 { | |
417 | 6920 v6 = (unsigned int *)&ai_near_actors_targets_pid[(int)v4]; |
6921 Actor::_SelectTarget((unsigned int)v4, &ai_near_actors_targets_pid[(int)v4], true); | |
0 | 6922 if ( v5->pMonsterInfo.uHostilityType && !*v6 ) |
6923 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
6924 v22 = *v6; | |
862 | 6925 v7 = Actor::GetDirectionInfo(PID(OBJECT_Actor,(int)v4), *v6, &a3, 0); |
0 | 6926 v8 = v5->uActorRadius; |
6927 memcpy(&a3, v7, sizeof(a3)); | |
6928 memcpy(&v18, &a3, sizeof(v18)); | |
6929 v9 = a3.uDistance - v8; | |
6930 v20 = a3.uDistance - v8; | |
6931 if ( ((a3.uDistance - v8) & 0x80000000u) != 0 ) | |
6932 { | |
6933 v9 = 0; | |
6934 v20 = 0; | |
6935 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6936 if (PID_TYPE(v22) == OBJECT_Actor) |
1263 | 6937 //v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3); |
6938 v10 = pFactionTable->relations[(pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID) / 3 + 1][(v5->pMonsterInfo.uID - 1) / 3 + 1]; | |
0 | 6939 else |
6940 v10 = 4; | |
6941 if ( v10 == 1 ) | |
6942 { | |
6943 if ( (double)(signed int)v20 < 307.2 ) | |
6944 goto LABEL_25; | |
6945 } | |
6946 else | |
6947 { | |
6948 if ( v10 == 2 ) | |
6949 { | |
6950 v12 = __OFSUB__(v9, 1024); | |
6951 v11 = ((v9 - 1024) & 0x80000000u) != 0; | |
6952 } | |
6953 else | |
6954 { | |
6955 if ( v10 == 3 ) | |
6956 { | |
6957 v12 = __OFSUB__(v9, 2560); | |
6958 v11 = ((v9 - 2560) & 0x80000000u) != 0; | |
6959 } | |
6960 else | |
6961 { | |
6962 if ( v10 != 4 ) | |
6963 goto LABEL_26; | |
6964 v12 = __OFSUB__(v9, 5120); | |
6965 v11 = ((v9 - 5120) & 0x80000000u) != 0; | |
6966 } | |
6967 } | |
6968 if ( v11 ^ v12 ) | |
6969 { | |
6970 LABEL_25: | |
6971 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
6972 goto LABEL_26; | |
6973 } | |
6974 } | |
6975 LABEL_26: | |
6976 if ( v5->pMonsterInfo.uHostilityType != 4 || !v22 || (signed int)v9 >= 5120 ) | |
6977 { | |
6978 v13 = a2a; | |
6979 goto LABEL_47; | |
6980 } | |
6981 v13 = a2a; | |
6982 v14 = stru_50C198.special_ability_use_check(v5, a2a); | |
6983 if ( v14 == 1 ) | |
6984 { | |
6985 if ( v5->pMonsterInfo.uMissleAttack2Type ) | |
6986 { | |
1060 | 6987 Actor::AI_MissileAttack2(v13, v22, &v18); |
0 | 6988 goto LABEL_43; |
6989 } | |
6990 } | |
6991 else | |
6992 { | |
6993 if ( v14 > 1 && v14 <= 3 ) | |
6994 { | |
6995 if ( v14 == 2 ) | |
6996 v15 = v5->pMonsterInfo.uSpell1ID; | |
6997 else | |
6998 v15 = v5->pMonsterInfo.uSpell2ID; | |
6999 if ( v15 ) | |
7000 { | |
7001 if ( v14 == 2 ) | |
1060 | 7002 Actor::AI_SpellAttack1(v13, v22, &v18); |
0 | 7003 else |
1060 | 7004 Actor::AI_SpellAttack2(v13, v22, &v18); |
0 | 7005 goto LABEL_43; |
7006 } | |
7007 goto LABEL_44; | |
7008 } | |
7009 if ( v5->pMonsterInfo.uMissleAttack1Type ) | |
7010 { | |
1060 | 7011 Actor::AI_MissileAttack1(v13, v22, &v18); |
0 | 7012 LABEL_43: |
848 | 7013 //v3 = v21; |
0 | 7014 v21->field_C = 1; |
7015 LABEL_48: | |
848 | 7016 v21->uActionLength = v5->uCurrentActionLength; |
7017 //return (signed __int16)v3; | |
7018 return (signed __int16)&v21; | |
0 | 7019 } |
7020 } | |
7021 LABEL_44: | |
7022 if ( (double)(signed int)v20 < 307.2 ) | |
7023 { | |
1060 | 7024 Actor::AI_MeleeAttack(v13, v22, &v18); |
848 | 7025 //v3 = v21; |
0 | 7026 v21->field_C = 3; |
7027 goto LABEL_48; | |
7028 } | |
7029 LABEL_47: | |
413 | 7030 Actor::AI_Stand(v13, v22, 0x40u, &v18); |
848 | 7031 //v3 = v21; |
0 | 7032 v21->field_C = 0; |
7033 goto LABEL_48; | |
7034 } | |
7035 } | |
7036 } | |
7037 return (signed __int16)v3; | |
7038 } | |
7039 | |
7040 //----- (00406A63) -------------------------------------------------------- | |
7041 void stru262_TurnBased::_406A63() | |
7042 { | |
7043 stru262_TurnBased *v1; // ebx@1 | |
7044 int v2; // esi@1 | |
7045 unsigned __int8 v3; // zf@1 | |
7046 unsigned __int8 v4; // sf@1 | |
7047 signed int v5; // ecx@4 | |
7048 AIDirection a3; // [sp+8h] [bp-44h]@5 | |
7049 AIDirection v7; // [sp+24h] [bp-28h]@5 | |
7050 unsigned int v8; // [sp+40h] [bp-Ch]@5 | |
7051 signed int a2; // [sp+44h] [bp-8h]@1 | |
7052 TurnBased_QueueElem *v10; // [sp+48h] [bp-4h]@2 | |
7053 | |
7054 v1 = this; | |
7055 v2 = 0; | |
7056 this->field_8 = 64; | |
7057 dword_50C994 = 0; | |
7058 uActiveCharacter = 0; | |
7059 v3 = this->uActorQueueSize == 0; | |
7060 v4 = this->uActorQueueSize < 0; | |
7061 a2 = 0; | |
7062 if ( !(v4 | v3) ) | |
7063 { | |
7064 v10 = this->pQueue; | |
7065 while ( 1 ) | |
7066 { | |
7067 v5 = v10->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7068 if (PID_TYPE(v10->uPackedID) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7069 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7070 v8 = ai_near_actors_targets_pid[PID_ID(v5)]; |
0 | 7071 memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7)); |
7072 if ( !v1->_406D10(a2) ) | |
848 | 7073 Actor::AI_Stand(PID_ID(v10->uPackedID), v8, 0x20u, &v7); |
0 | 7074 } |
7075 ++a2; | |
7076 ++v10; | |
7077 if ( a2 >= v1->uActorQueueSize ) | |
7078 break; | |
7079 v2 = 0; | |
7080 } | |
7081 } | |
7082 } | |
7083 // 50C994: using guessed type int dword_50C994; | |
7084 | |
7085 //----- (00406AFE) -------------------------------------------------------- | |
7086 void stru262_TurnBased::_406AFE() | |
7087 { | |
7088 stru262_TurnBased *v1; // edi@1 | |
7089 TurnBased_QueueElem *v2; // ebx@2 | |
7090 int v3; // esi@4 | |
7091 int v4; // ecx@5 | |
7092 AIDirection a3; // [sp+4h] [bp-48h]@5 | |
7093 AIDirection v6; // [sp+20h] [bp-2Ch]@5 | |
7094 stru262_TurnBased *v7; // [sp+3Ch] [bp-10h]@1 | |
7095 unsigned int v8; // [sp+40h] [bp-Ch]@4 | |
7096 unsigned int v9; // [sp+44h] [bp-8h]@5 | |
7097 int v10; // [sp+48h] [bp-4h]@1 | |
7098 | |
7099 v10 = 0; | |
7100 v1 = this; | |
7101 v7 = this; | |
7102 if ( this->uActorQueueSize > 0 ) | |
7103 { | |
7104 v2 = this->pQueue; | |
7105 do | |
7106 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7107 if (PID_TYPE(v2->uPackedID) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7108 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7109 v3 = PID_ID(v2->uPackedID); |
0 | 7110 v8 = v3; |
7111 if ( pActors[v3].CanAct() ) | |
7112 { | |
7113 v4 = v2->uPackedID; | |
417 | 7114 v9 = ai_near_actors_targets_pid[v3]; |
0 | 7115 memcpy(&v6, Actor::GetDirectionInfo(v4, v9, &a3, 0), sizeof(v6)); |
413 | 7116 Actor::AI_Stand(v8, v9, 0x20u, &v6); |
0 | 7117 v2->field_C = 0; |
7118 v2->uActionLength = 0; | |
7119 v1 = v7; | |
7120 } | |
7121 } | |
7122 ++v10; | |
7123 ++v2; | |
7124 } | |
7125 while ( v10 < v1->uActorQueueSize ); | |
7126 } | |
7127 v1->field_4 = 2; | |
7128 v1->field_8 = 100; | |
7129 } | |
7130 | |
7131 //----- (00406B9F) -------------------------------------------------------- | |
7132 int stru262_TurnBased::_406B9F() | |
7133 { | |
7134 signed int result; // eax@1 | |
7135 unsigned __int8 v2; // zf@1 | |
7136 unsigned __int8 v3; // sf@1 | |
7137 int v4; // esi@4 | |
7138 unsigned int v5; // esi@5 | |
7139 Actor *v6; // ebx@5 | |
7140 unsigned __int16 v7; // cx@15 | |
7141 AIDirection a3; // [sp+0h] [bp-50h]@15 | |
7142 AIDirection v9; // [sp+1Ch] [bp-34h]@15 | |
7143 signed int a1; // [sp+38h] [bp-18h]@4 | |
7144 stru262_TurnBased *thisa; // [sp+3Ch] [bp-14h]@1 | |
7145 unsigned int v12; // [sp+40h] [bp-10h]@5 | |
7146 unsigned int v13; // [sp+44h] [bp-Ch]@8 | |
7147 TurnBased_QueueElem *v14; // [sp+48h] [bp-8h]@2 | |
7148 signed int a2; // [sp+4Ch] [bp-4h]@1 | |
7149 | |
7150 result = 0; | |
7151 thisa = this; | |
7152 v2 = this->uActorQueueSize == 0; | |
7153 v3 = this->uActorQueueSize < 0; | |
7154 a2 = 0; | |
7155 if ( !(v3 | v2) ) | |
7156 { | |
7157 v14 = this->pQueue; | |
7158 while ( 1 ) | |
7159 { | |
7160 v4 = v14->uPackedID; | |
7161 a1 = v14->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7162 if (PID_TYPE(a1) != OBJECT_Player) |
0 | 7163 { |
848 | 7164 v5 = PID_ID(v4); |
0 | 7165 v12 = v5; |
7166 v6 = &pActors[v5]; | |
7167 if ( SHIDWORD(v6->pActorBuffs[5].uExpireTime) < result | |
7168 || SHIDWORD(v6->pActorBuffs[5].uExpireTime) <= result && LODWORD(v6->pActorBuffs[5].uExpireTime) <= result ) | |
7169 v13 = result; | |
7170 else | |
7171 v13 = 1; | |
7172 if ( SHIDWORD(v6->pActorBuffs[6].uExpireTime) >= result | |
7173 && (SHIDWORD(v6->pActorBuffs[6].uExpireTime) > result || LODWORD(v6->pActorBuffs[6].uExpireTime) > result) ) | |
7174 result = 1; | |
1110 | 7175 if ( !(v13 != 0 || result || v6->uAIState == 5 || v6->uAIState == 11 || v6->uAIState == 19) ) |
0 | 7176 { |
417 | 7177 v13 = ai_near_actors_targets_pid[v5]; |
0 | 7178 memcpy(&v9, Actor::GetDirectionInfo(a1, v13, &a3, 0), sizeof(v9)); |
7179 v7 = v6->uAIState; | |
7180 if ( v7 == 6 || v7 == 1 ) | |
7181 { | |
7182 if ( (double)(signed int)v9.uDistance < 307.2 ) | |
7183 goto LABEL_26; | |
7184 } | |
7185 v6->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
7186 if ( (signed int)v6->uCurrentActionTime > v6->uCurrentActionLength ) | |
7187 { | |
7188 if ( v7 == 4 ) | |
7189 { | |
7190 v6->uCurrentActionTime = 0; | |
7191 v6->uCurrentActionLength = 0; | |
7192 v6->uAIState = Dead; | |
7193 v6->UpdateAnimation(); | |
7194 } | |
7195 if ( !thisa->_406D10(a2) ) | |
7196 LABEL_26: | |
413 | 7197 Actor::AI_Stand(v12, v13, 0x20u, &v9); |
0 | 7198 } |
7199 } | |
7200 } | |
7201 ++a2; | |
7202 result = (signed int)thisa; | |
7203 ++v14; | |
7204 if ( a2 >= thisa->uActorQueueSize ) | |
7205 break; | |
7206 result = 0; | |
7207 } | |
7208 } | |
7209 return result; | |
7210 } | |
7211 | |
7212 //----- (00406D10) -------------------------------------------------------- | |
7213 bool stru262_TurnBased::_406D10(signed int a2) | |
7214 { | |
7215 int v2; // ecx@1 | |
920 | 7216 //int v3; // ecx@2 |
7217 Actor *actor; // ebx@2 | |
7218 //unsigned __int16 v5; // dx@2 | |
0 | 7219 int *v6; // esi@7 |
7220 TurnBased_QueueElem *v7; // edi@7 | |
7221 int v8; // eax@7 | |
7222 AIDirection *v9; // esi@10 | |
7223 int v10; // eax@10 | |
7224 unsigned int v11; // ecx@10 | |
920 | 7225 unsigned __int8 pHostileType; // al@12 |
0 | 7226 unsigned __int8 v13; // sf@16 |
7227 unsigned __int8 v14; // of@16 | |
7228 unsigned int v15; // edx@22 | |
7229 unsigned int v16; // ecx@23 | |
7230 TurnBased_QueueElem *v17; // eax@25 | |
7231 double v18; // st7@33 | |
7232 double v19; // st6@33 | |
7233 int v21; // [sp-8h] [bp-5Ch]@23 | |
7234 int v22; // [sp-8h] [bp-5Ch]@26 | |
7235 AIDirection *v23; // [sp-4h] [bp-58h]@23 | |
7236 int v24; // [sp-4h] [bp-58h]@26 | |
7237 AIDirection a3; // [sp+Ch] [bp-48h]@10 | |
7238 AIDirection pDir; // [sp+28h] [bp-2Ch]@10 | |
7239 int v27; // [sp+44h] [bp-10h]@33 | |
7240 unsigned int v28; // [sp+48h] [bp-Ch]@10 | |
7241 TurnBased_QueueElem *v29; // [sp+4Ch] [bp-8h]@7 | |
7242 unsigned int uActorID; // [sp+50h] [bp-4h]@2 | |
7243 unsigned int a2a; // [sp+5Ch] [bp+8h]@7 | |
7244 | |
920 | 7245 __debugbreak();//ñðàáàòûâàåò ïðè ïîøàãîâîì ðåæèìå ïîñëå ïÿòè øàãîâ |
0 | 7246 v2 = *(&this->field_0 + 4 * (a2 + 2)); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7247 if (PID_TYPE(v2) == OBJECT_Player) |
0 | 7248 return 0; |
920 | 7249 uActorID = PID_ID(v2); |
7250 //uActorID = v3; | |
7251 actor = &pActors[uActorID]; | |
7252 //v5 = v4->uAIState; | |
7253 if ( actor->uAIState == 5 || actor->uAIState == 4 || actor->uAIState == 11 || actor->uAIState == 19 || actor->uAIState == 17 ) | |
0 | 7254 return 1; |
920 | 7255 v6 = &ai_near_actors_targets_pid[uActorID]; |
0 | 7256 v7 = &pTurnEngine->pQueue[a2]; |
7257 v8 = *v6; | |
7258 v29 = &pTurnEngine->pQueue[a2]; | |
7259 a2a = v8; | |
920 | 7260 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true); |
7261 if ( actor->pMonsterInfo.uHostilityType && !*v6 ) | |
7262 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
0 | 7263 v9 = Actor::GetDirectionInfo(v7->uPackedID, a2a, &a3, 0); |
920 | 7264 v10 = actor->uActorRadius; |
0 | 7265 memcpy(&a3, v9, sizeof(a3)); |
7266 memcpy(&pDir, &a3, sizeof(pDir)); | |
7267 v11 = a3.uDistance - v10; | |
7268 v28 = a3.uDistance - v10; | |
7269 if ( ((a3.uDistance - v10) & 0x80000000u) != 0 ) | |
7270 { | |
7271 v11 = 0; | |
7272 v28 = 0; | |
7273 } | |
920 | 7274 pHostileType = actor->pMonsterInfo.uHostilityType; |
7275 if ( pHostileType == 1 ) | |
0 | 7276 { |
7277 if ( (double)(signed int)v28 >= 307.2 ) | |
7278 goto LABEL_21; | |
920 | 7279 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
0 | 7280 goto LABEL_21; |
7281 } | |
920 | 7282 if ( pHostileType == 2 ) |
0 | 7283 { |
7284 v14 = __OFSUB__(v11, 1024); | |
7285 v13 = ((v11 - 1024) & 0x80000000u) != 0; | |
7286 } | |
7287 else | |
7288 { | |
920 | 7289 if ( pHostileType != 3 ) |
0 | 7290 goto LABEL_21; |
7291 v14 = __OFSUB__(v11, 2560); | |
7292 v13 = ((v11 - 2560) & 0x80000000u) != 0; | |
7293 } | |
7294 if ( v13 ^ v14 ) | |
920 | 7295 { |
7296 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
7297 } | |
0 | 7298 LABEL_21: |
920 | 7299 if ( (signed __int64)actor->pActorBuffs[4].uExpireTime > 0 ) |
7300 { | |
0 | 7301 if ( (signed int)v11 < 10240 ) |
7302 { | |
1060 | 7303 Actor::AI_Flee(uActorID, a2a, 0, &pDir); |
920 | 7304 v29->field_C = 4; |
7305 v29->uActionLength = actor->uCurrentActionLength; | |
7306 return 1; | |
7307 } | |
1060 | 7308 Actor::AI_4032B2(uActorID, a2a, 1024, 0); |
920 | 7309 v29->field_C = 2; |
7310 v29->uActionLength = actor->uCurrentActionLength; | |
7311 return 1; | |
7312 } | |
7313 if ( actor->pMonsterInfo.uHostilityType != 4 ) | |
0 | 7314 goto LABEL_46; |
920 | 7315 if ( !(actor->uAttributes & 0x020000) || actor->pMonsterInfo.uAIType == 1 ) |
7316 { | |
7317 if ( actor->pMonsterInfo.uAIType == 1 ) | |
7318 { | |
7319 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
7320 { | |
7321 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7322 v29->field_C = 4; | |
7323 v29->uActionLength = actor->uCurrentActionLength; | |
7324 return 1; | |
7325 } | |
1060 | 7326 Actor::AI_Flee(uActorID, a2a, 32, 0); |
920 | 7327 v29->field_C = 4; |
7328 v29->uActionLength = actor->uCurrentActionLength; | |
7329 return 1; | |
7330 } | |
7331 if ( actor->pMonsterInfo.uAIType == 2 ) | |
7332 { | |
7333 v27 = actor->sCurrentHP; | |
0 | 7334 v18 = (double)v27; |
920 | 7335 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.2; |
0 | 7336 if ( v19 > v18 && (signed int)v11 < 10240 ) |
7337 { | |
920 | 7338 if ( actor->pMonsterInfo.uMovementType == 5 ) |
7339 { | |
7340 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7341 v29->field_C = 4; | |
7342 v29->uActionLength = actor->uCurrentActionLength; | |
7343 return 1; | |
7344 } | |
1060 | 7345 Actor::AI_Flee(uActorID, a2a, 32, 0); |
0 | 7346 v29->field_C = 4; |
920 | 7347 v29->uActionLength = actor->uCurrentActionLength; |
7348 return 1; | |
7349 } | |
7350 goto LABEL_39; | |
7351 } | |
7352 if ( actor->pMonsterInfo.uAIType == 3 ) | |
7353 { | |
7354 v27 = actor->sCurrentHP; | |
7355 v18 = (double)v27; | |
7356 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.1; | |
7357 if ( v19 > v18 && (signed int)v11 < 10240 ) | |
7358 { | |
7359 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
7360 { | |
7361 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7362 v29->field_C = 4; | |
7363 v29->uActionLength = actor->uCurrentActionLength; | |
7364 return 1; | |
7365 } | |
1060 | 7366 Actor::AI_Flee(uActorID, a2a, 32, 0); |
920 | 7367 v29->field_C = 4; |
7368 v29->uActionLength = actor->uCurrentActionLength; | |
0 | 7369 return 1; |
7370 } | |
7371 goto LABEL_39; | |
7372 } | |
7373 } | |
7374 LABEL_39: | |
7375 if ( (double)(signed int)v28 < 307.2 ) | |
7376 return 0; | |
7377 if ( (signed int)v11 < 5120 ) | |
7378 { | |
920 | 7379 if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 ) |
1060 | 7380 Actor::AI_Pursue1(uActorID, a2a, uActorID, 32, &pDir); |
0 | 7381 else |
1060 | 7382 Actor::AI_Pursue2(uActorID, a2a, 32, &pDir, 307); |
920 | 7383 v29->field_C = 2; |
7384 v29->uActionLength = actor->uCurrentActionLength; | |
7385 return 1; | |
0 | 7386 } |
7387 LABEL_46: | |
920 | 7388 if ( !actor->pMonsterInfo.uMovementType ) |
7389 { | |
1060 | 7390 Actor::AI_4032B2(uActorID, a2a, 1024, 32); |
920 | 7391 v29->field_C = 2; |
7392 v29->uActionLength = actor->uCurrentActionLength; | |
7393 return 1; | |
7394 } | |
7395 if ( actor->pMonsterInfo.uMovementType == 1 ) | |
7396 { | |
1060 | 7397 Actor::AI_4032B2(uActorID, a2a, 2560, 32); |
0 | 7398 v29->field_C = 2; |
920 | 7399 v29->uActionLength = actor->uCurrentActionLength; |
7400 return 1; | |
7401 } | |
7402 if ( actor->pMonsterInfo.uMovementType == 2 ) | |
7403 { | |
1060 | 7404 Actor::AI_4032B2(uActorID, a2a, 5120, 32); |
920 | 7405 v29->field_C = 2; |
7406 v29->uActionLength = actor->uCurrentActionLength; | |
7407 return 1; | |
7408 } | |
7409 if ( actor->pMonsterInfo.uMovementType == 4 ) | |
0 | 7410 { |
1060 | 7411 Actor::AI_4032B2(uActorID, a2a, 10240, 32); |
0 | 7412 v29->field_C = 2; |
920 | 7413 v29->uActionLength = actor->uCurrentActionLength; |
7414 return 1; | |
7415 } | |
7416 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
7417 { | |
7418 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7419 v29->field_C = 2; | |
7420 v29->uActionLength = actor->uCurrentActionLength; | |
7421 return 1; | |
0 | 7422 } |
7423 return 1; | |
7424 } | |
7425 | |
7426 //----- (00406FA8) -------------------------------------------------------- | |
7427 void stru262_TurnBased::_406FA8() | |
7428 { | |
7429 unsigned __int8 v1; // zf@1 | |
7430 unsigned __int8 v2; // sf@1 | |
7431 TurnBased_QueueElem *v3; // edi@2 | |
7432 int v4; // eax@4 | |
7433 Actor *v5; // ebx@4 | |
7434 unsigned __int16 v6; // cx@4 | |
7435 unsigned int *v7; // edx@8 | |
7436 unsigned int v8; // esi@8 | |
7437 unsigned __int8 v9; // of@13 | |
7438 AIDirection a3; // [sp+Ch] [bp-6Ch]@8 | |
7439 AIDirection v11; // [sp+28h] [bp-50h]@8 | |
7440 AIDirection a4; // [sp+44h] [bp-34h]@8 | |
7441 stru262_TurnBased *v13; // [sp+60h] [bp-18h]@1 | |
7442 TurnBased_QueueElem *v14; // [sp+64h] [bp-14h]@2 | |
7443 int uActorID; // [sp+68h] [bp-10h]@4 | |
7444 unsigned int a2; // [sp+6Ch] [bp-Ch]@8 | |
7445 int v17; // [sp+70h] [bp-8h]@1 | |
7446 unsigned int v18; // [sp+74h] [bp-4h]@2 | |
7447 | |
7448 v17 = 0; | |
7449 v1 = this->uActorQueueSize == 0; | |
7450 v2 = this->uActorQueueSize < 0; | |
7451 v13 = this; | |
7452 if ( !(v2 | v1) ) | |
7453 { | |
7454 v3 = this->pQueue; | |
7455 v18 = (char *)&pTurnEngine - (char *)this; | |
7456 v14 = this->pQueue; | |
7457 do | |
7458 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7459 if (PID_TYPE(v3->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7460 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7461 v4 = PID_ID(v3->uPackedID); |
0 | 7462 uActorID = v4; |
7463 v5 = &pActors[v4]; | |
7464 v6 = v5->uAIState; | |
7465 if ( v6 != 5 ) | |
7466 { | |
7467 if ( v6 != 11 ) | |
7468 { | |
7469 if ( v6 != 19 ) | |
7470 { | |
7471 if ( v6 != 17 ) | |
7472 { | |
417 | 7473 v7 = (unsigned int *)&ai_near_actors_targets_pid[v4]; |
0 | 7474 a2 = *v7; |
7475 v8 = a2; | |
417 | 7476 Actor::_SelectTarget(v4, (int *)v7, true); |
0 | 7477 memcpy(&v11, Actor::GetDirectionInfo(*(int *)((char *)&v3->uPackedID + v18), v8, &a3, 0), sizeof(v11)); |
7478 memcpy(&a4, &v11, sizeof(a4)); | |
7479 v5->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
7480 if ( (signed int)v5->uCurrentActionTime >= v5->uCurrentActionLength ) | |
7481 { | |
7482 if (v5->uAIState == Dying) | |
7483 { | |
7484 v5->uCurrentActionTime = 0; | |
7485 v5->uCurrentActionLength = 0; | |
7486 v5->uAIState = Dead; | |
7487 v5->UpdateAnimation(); | |
7488 return; | |
7489 } | |
7490 if ( rand() % 2 ) | |
413 | 7491 Actor::AI_Stand(uActorID, a2, 0x40u, &a4); |
0 | 7492 else |
414 | 7493 Actor::AI_Bored(uActorID, a2, &a4); |
0 | 7494 } |
7495 } | |
7496 } | |
7497 } | |
7498 } | |
7499 } | |
7500 ++v17; | |
7501 v3 = v14 + 1; | |
7502 v9 = __OFSUB__(v17, v13->uActorQueueSize); | |
7503 v2 = v17 - v13->uActorQueueSize < 0; | |
7504 ++v14; | |
7505 } | |
7506 while ( v2 ^ v9 ); | |
7507 } | |
7508 } | |
7509 | |
7510 //----- (004070EF) -------------------------------------------------------- | |
7511 bool __fastcall sub_4070EF_prolly_collide_objects(unsigned int uObjID, unsigned int uObj2ID) | |
7512 { | |
7513 signed int v2; // eax@1 | |
7514 unsigned int v3; // ecx@1 | |
7515 signed int v4; // esi@1 | |
7516 int v5; // ecx@2 | |
7517 signed int v6; // eax@4 | |
7518 int v7; // eax@4 | |
7519 float v8; // ST24_4@5 | |
7520 double v9; // ST18_8@5 | |
7521 signed int v10; // eax@6 | |
7522 int v11; // ecx@6 | |
7523 signed int v12; // eax@7 | |
7524 int v13; // esi@7 | |
7525 int v14; // esi@8 | |
7526 int v15; // esi@9 | |
7527 signed int v16; // eax@11 | |
7528 int v17; // edi@11 | |
7529 int v18; // esi@11 | |
7530 int v19; // eax@13 | |
7531 float v20; // ST24_4@14 | |
7532 double v21; // ST18_8@14 | |
7533 signed int v22; // eax@15 | |
7534 int v23; // ebx@16 | |
7535 signed int v24; // ecx@16 | |
7536 int v25; // eax@18 | |
7537 int v26; // eax@28 | |
7538 BLVSector *v27; // edx@31 | |
7539 int v28; // ecx@31 | |
7540 BLVFace *v29; // ebx@32 | |
7541 Vec3_short_ *v30; // esi@32 | |
7542 int v31; // eax@32 | |
7543 int v32; // ST50_4@44 | |
7544 int v33; // ST54_4@44 | |
7545 int v34; // eax@44 | |
7546 char v35; // zf@44 | |
7547 int v36; // edi@44 | |
7548 int v37; // eax@45 | |
7549 signed int v38; // esi@45 | |
7550 int v39; // ST4C_4@49 | |
7551 signed __int64 v40; // qtt@50 | |
7552 __int16 v42; // bx@58 | |
7553 int v43; // [sp-8h] [bp-70h]@11 | |
7554 int v44; // [sp-4h] [bp-6Ch]@11 | |
7555 int v45; // [sp+Ch] [bp-5Ch]@32 | |
7556 __int16 v46; // [sp+10h] [bp-58h]@32 | |
7557 int v47; // [sp+18h] [bp-50h]@20 | |
7558 int v48; // [sp+1Ch] [bp-4Ch]@20 | |
7559 int v49; // [sp+20h] [bp-48h]@20 | |
7560 int v50; // [sp+24h] [bp-44h]@16 | |
7561 signed int v51; // [sp+24h] [bp-44h]@27 | |
7562 signed int v52; // [sp+28h] [bp-40h]@26 | |
7563 signed int v53; // [sp+2Ch] [bp-3Ch]@23 | |
7564 signed int v54; // [sp+30h] [bp-38h]@22 | |
7565 signed int v55; // [sp+34h] [bp-34h]@21 | |
7566 signed int v56; // [sp+38h] [bp-30h]@20 | |
7567 signed int v57; // [sp+3Ch] [bp-2Ch]@28 | |
7568 int v58; // [sp+44h] [bp-24h]@50 | |
7569 int v59; // [sp+48h] [bp-20h]@44 | |
7570 int v60; // [sp+50h] [bp-18h]@11 | |
7571 signed int v61; // [sp+50h] [bp-18h]@31 | |
7572 int v62; // [sp+54h] [bp-14h]@16 | |
7573 int v63; // [sp+58h] [bp-10h]@4 | |
7574 int v64; // [sp+5Ch] [bp-Ch]@4 | |
7575 int v65; // [sp+60h] [bp-8h]@4 | |
7576 int v66; // [sp+64h] [bp-4h]@7 | |
7577 | |
848 | 7578 v2 = PID_ID(uObjID); |
7579 v3 = PID_TYPE(uObjID) - 2; | |
0 | 7580 v4 = uObj2ID; |
7581 if ( v3 ) | |
7582 { | |
7583 v5 = v3 - 1; | |
7584 if ( v5 ) | |
7585 { | |
7586 if ( v5 != 2 ) | |
7587 return 0; | |
7588 v6 = v2; | |
7589 v63 = pLevelDecorations[v6].vPosition.x; | |
7590 v64 = pLevelDecorations[v6].vPosition.y; | |
7591 v65 = pLevelDecorations[v6].vPosition.z; | |
7592 v7 = pIndoor->GetSector(v63, v64, v65); | |
7593 } | |
7594 else | |
7595 { | |
7596 v63 = pActors[v2].vPosition.x; | |
7597 v64 = pActors[v2].vPosition.y; | |
7598 v8 = (double)pActors[v2].uActorHeight * 0.69999999; | |
7599 v9 = v8 + 6.7553994e15; | |
7600 v65 = LODWORD(v9) + pActors[v2].vPosition.z; | |
7601 v7 = pActors[v2].uSectorID; | |
7602 } | |
7603 } | |
7604 else | |
7605 { | |
7606 v10 = v2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7607 v63 = pSpriteObjects[v10].vPosition.x; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7608 v64 = pSpriteObjects[v10].vPosition.y; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7609 v11 = pSpriteObjects[v10].vPosition.z; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7610 v7 = pSpriteObjects[v10].uSectorID; |
0 | 7611 v65 = v11; |
7612 } | |
7613 v66 = v7; | |
848 | 7614 v12 = PID_ID(v4); |
7615 v13 = PID_TYPE(v4) - 2; | |
0 | 7616 if ( v13 ) |
7617 { | |
7618 v14 = v13 - 1; | |
7619 if ( v14 ) | |
7620 { | |
7621 v15 = v14 - 1; | |
7622 if ( v15 ) | |
7623 { | |
7624 if ( v15 != 1 ) | |
7625 return 0; | |
7626 v16 = v12; | |
7627 v17 = pLevelDecorations[v16].vPosition.z; | |
7628 v18 = pLevelDecorations[v16].vPosition.x; | |
7629 v44 = pLevelDecorations[v16].vPosition.z; | |
7630 v60 = pLevelDecorations[v16].vPosition.y; | |
7631 v43 = pLevelDecorations[v16].vPosition.y; | |
7632 } | |
7633 else | |
7634 { | |
7635 v18 = pParty->vPosition.x; | |
7636 v17 = pParty->sEyelevel + pParty->vPosition.z; | |
7637 v60 = pParty->vPosition.y; | |
7638 v44 = pParty->sEyelevel + pParty->vPosition.z; | |
7639 v43 = pParty->vPosition.y; | |
7640 } | |
7641 v19 = pIndoor->GetSector(v18, v43, v44); | |
7642 } | |
7643 else | |
7644 { | |
7645 v60 = pActors[v12].vPosition.y; | |
7646 v18 = pActors[v12].vPosition.x; | |
7647 v20 = (double)pActors[v12].uActorHeight * 0.69999999; | |
7648 v21 = v20 + 6.7553994e15; | |
7649 v17 = LODWORD(v21) + pActors[v12].vPosition.z; | |
7650 v19 = pActors[v12].uSectorID; | |
7651 } | |
7652 } | |
7653 else | |
7654 { | |
7655 v22 = v12; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7656 v18 = pSpriteObjects[v22].vPosition.x; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7657 v17 = pSpriteObjects[v22].vPosition.z; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7658 v60 = pSpriteObjects[v22].vPosition.y; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7659 v19 = pSpriteObjects[v22].uSectorID; |
0 | 7660 } |
7661 v62 = v19; | |
7662 v23 = v18 - v63; | |
7663 v50 = v17 - v65; | |
295 | 7664 v24 = integer_sqrt(v23 * v23 + (v60 - v64) * (v60 - v64) + v50 * v50); |
0 | 7665 if ( v24 > 5120 ) |
7666 return 0; | |
7667 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
7668 return 1; | |
7669 v25 = 65536; | |
7670 if ( v24 ) | |
7671 v25 = 65536 / v24; | |
7672 v49 = v23 * v25; | |
7673 v47 = v50 * v25; | |
7674 v48 = (v60 - v64) * v25; | |
7675 v56 = v63; | |
7676 if ( v63 < v18 ) | |
7677 { | |
7678 v55 = v18; | |
7679 } | |
7680 else | |
7681 { | |
7682 v56 = v18; | |
7683 v55 = v63; | |
7684 } | |
7685 v54 = v64; | |
7686 if ( v64 < v60 ) | |
7687 { | |
7688 v53 = v60; | |
7689 } | |
7690 else | |
7691 { | |
7692 v54 = v60; | |
7693 v53 = v64; | |
7694 } | |
7695 v52 = v65; | |
7696 if ( v65 < v17 ) | |
7697 { | |
7698 v51 = v17; | |
7699 } | |
7700 else | |
7701 { | |
7702 v52 = v17; | |
7703 v51 = v65; | |
7704 } | |
7705 v57 = 0; | |
7706 v26 = v66; | |
7707 while ( 2 ) | |
7708 { | |
7709 if ( v26 == v62 ) | |
7710 return 1; | |
7711 if ( v57 >= 30 || (v27 = pIndoor->pSectors, v28 = v66, v61 = 0, pIndoor->pSectors[v66].uNumPortals <= 0) ) | |
7712 break; | |
7713 while ( 1 ) | |
7714 { | |
7715 v29 = &pIndoor->pFaces[v27[v28].pPortals[v61]]; | |
7716 v30 = &pIndoor->pVertices[*v29->pVertexIDs]; | |
7717 v45 = *(int *)&v30->x; | |
7718 v46 = v30->z; | |
7719 v31 = v29->pFacePlane_old.vNormal.z * (v46 - v65) | |
7720 + v29->pFacePlane_old.vNormal.y * (SHIWORD(v45) - v64) | |
7721 + v29->pFacePlane_old.vNormal.x * ((signed __int16)v45 - v63); | |
7722 if ( v66 != v29->uSectorID ) | |
7723 v31 = -v31; | |
7724 if ( v31 >= 0 && (signed __int16)v45 != v63 && SHIWORD(v45) != v64 && v46 != v65 | |
7725 || v56 > v29->pBounding.x2 | |
7726 || v55 < v29->pBounding.x1 | |
7727 || v54 > v29->pBounding.y2 | |
7728 || v53 < v29->pBounding.y1 | |
7729 || v52 > v29->pBounding.z2 | |
7730 || v51 < v29->pBounding.z1 ) | |
7731 goto LABEL_54; | |
7732 v32 = (unsigned __int64)(v49 * (signed __int64)v29->pFacePlane_old.vNormal.x) >> 16; | |
7733 v33 = (unsigned __int64)(v47 * (signed __int64)v29->pFacePlane_old.vNormal.z) >> 16; | |
7734 v34 = (unsigned __int64)(v48 * (signed __int64)v29->pFacePlane_old.vNormal.y) >> 16; | |
7735 v35 = v32 + v33 + v34 == 0; | |
7736 v36 = v32 + v33 + v34; | |
7737 v59 = v32 + v33 + v34; | |
7738 if ( v35 ) | |
7739 goto LABEL_53; | |
7740 v37 = v65 * v29->pFacePlane_old.vNormal.z; | |
7741 v38 = -(v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y); | |
7742 if ( v36 <= 0 ) | |
7743 break; | |
7744 if ( v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y <= 0 ) | |
7745 goto LABEL_49; | |
7746 LABEL_53: | |
7747 v27 = pIndoor->pSectors; | |
7748 LABEL_54: | |
7749 ++v61; | |
7750 if ( v61 >= v27[v28].uNumPortals ) | |
7751 goto LABEL_55; | |
7752 } | |
7753 if ( v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y < 0 ) | |
7754 goto LABEL_53; | |
7755 LABEL_49: | |
7756 v39 = abs(-(v29->pFacePlane_old.dist | |
7757 + v37 | |
7758 + v63 * v29->pFacePlane_old.vNormal.x | |
7759 + v64 * v29->pFacePlane_old.vNormal.y)) >> 14; | |
7760 if ( v39 > abs(v36) | |
7761 || (LODWORD(v40) = v38 << 16, HIDWORD(v40) = v38 >> 16, v58 = v40 / v59, (signed int)(v40 / v59) < 0) | |
7762 || !sub_4075DB( | |
7763 v63 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v49) >> 16) + 32768) >> 16), | |
7764 v64 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v48) >> 16) + 32768) >> 16), | |
7765 v65 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v47) >> 16) + 32768) >> 16), | |
7766 v29) ) | |
7767 { | |
7768 v28 = v66; | |
7769 goto LABEL_53; | |
7770 } | |
7771 if ( v29->uSectorID == v66 ) | |
7772 v42 = v29->uBackSectorID; | |
7773 else | |
7774 v42 = v29->uSectorID; | |
7775 v26 = v42; | |
7776 if ( v42 != v66 ) | |
7777 { | |
7778 ++v57; | |
7779 v66 = v42; | |
7780 continue; | |
7781 } | |
7782 break; | |
7783 } | |
7784 LABEL_55: | |
7785 if ( v66 != v62 ) | |
7786 return 0; | |
7787 return 1; | |
7788 } | |
7789 | |
7790 //----- (004075DB) -------------------------------------------------------- | |
7791 bool __fastcall sub_4075DB(int a1, int a2, int a3, BLVFace *a4) | |
7792 { | |
7793 BLVFace *v4; // eax@1 | |
7794 unsigned int v5; // esi@1 | |
7795 signed int v6; // esi@2 | |
7796 char v7; // zf@2 | |
7797 int v8; // edi@2 | |
7798 Vec3_short_ *v9; // ecx@3 | |
7799 int v10; // edx@4 | |
7800 signed int v11; // esi@7 | |
7801 Vec3_short_ *v12; // ecx@8 | |
7802 int v13; // edx@9 | |
7803 signed int v14; // esi@11 | |
7804 Vec3_short_ *v15; // ecx@12 | |
7805 int v16; // edx@13 | |
7806 int v17; // eax@14 | |
7807 bool v18; // esi@14 | |
7808 int v19; // ecx@14 | |
7809 int v20; // ecx@16 | |
7810 int v21; // edx@16 | |
7811 int v22; // eax@17 | |
7812 signed int v23; // ebx@18 | |
7813 int v24; // esi@20 | |
7814 signed int v25; // eax@22 | |
7815 signed __int64 v26; // qtt@22 | |
7816 bool result; // eax@25 | |
7817 int v28; // [sp+8h] [bp-14h]@14 | |
7818 int v29; // [sp+10h] [bp-Ch]@14 | |
7819 signed int a3a; // [sp+24h] [bp+8h]@14 | |
7820 int a4a; // [sp+28h] [bp+Ch]@2 | |
7821 | |
7822 v4 = a4; | |
7823 v5 = a4->uAttributes; | |
7824 if ( v5 & 0x100 ) | |
7825 { | |
7826 v6 = 0; | |
7827 v7 = a4->uNumVertices == 0; | |
7828 a4a = a1; | |
7829 v8 = a2; | |
7830 if ( !v7 ) | |
7831 { | |
7832 v9 = pIndoor->pVertices; | |
7833 do | |
7834 { | |
7835 dword_4F5D98_xs[v6] = v9[v4->pVertexIDs[v6]].x; | |
7836 v10 = v4->pVertexIDs[v6++]; | |
7837 dword_4F5CC4_ys[v6] = v9[v10].y; | |
7838 } | |
7839 while ( v6 < v4->uNumVertices ); | |
7840 } | |
7841 } | |
7842 else | |
7843 { | |
7844 v8 = a3; | |
7845 if ( v5 & 0x200 ) | |
7846 { | |
7847 v11 = 0; | |
7848 v7 = a4->uNumVertices == 0; | |
7849 a4a = a1; | |
7850 if ( !v7 ) | |
7851 { | |
7852 v12 = pIndoor->pVertices; | |
7853 do | |
7854 { | |
7855 dword_4F5D98_xs[v11] = v12[v4->pVertexIDs[v11]].x; | |
7856 v13 = v4->pVertexIDs[v11++]; | |
7857 dword_4F5CC4_ys[v11] = v12[v13].z; | |
7858 } | |
7859 while ( v11 < v4->uNumVertices ); | |
7860 } | |
7861 } | |
7862 else | |
7863 { | |
7864 v14 = 0; | |
7865 v7 = a4->uNumVertices == 0; | |
7866 a4a = a2; | |
7867 if ( !v7 ) | |
7868 { | |
7869 v15 = pIndoor->pVertices; | |
7870 do | |
7871 { | |
7872 dword_4F5D98_xs[v14] = v15[v4->pVertexIDs[v14]].y; | |
7873 v16 = v4->pVertexIDs[v14++]; | |
7874 dword_4F5CC4_ys[v14] = v15[v16].z; | |
7875 } | |
7876 while ( v14 < v4->uNumVertices ); | |
7877 } | |
7878 } | |
7879 } | |
7880 v17 = v4->uNumVertices; | |
7881 a3a = 0; | |
7882 dword_4F5D98_xs[v17] = dword_4F5D98_xs[0]; | |
7883 dword_4F5CC4_ys[v17 + 1] = dword_4F5CC4_ys[1]; | |
7884 v28 = v17; | |
7885 v18 = dword_4F5CC4_ys[1] >= v8; | |
7886 v19 = 0; | |
7887 v29 = 0; | |
7888 if ( v17 <= 0 ) | |
7889 goto LABEL_29; | |
7890 do | |
7891 { | |
7892 if ( a3a >= 2 ) | |
7893 break; | |
7894 v20 = v19; | |
7895 v21 = dword_4F5CC4_ys[v20 + 2]; | |
1110 | 7896 if ( v18 ^ (v21 >= v8) ) |
0 | 7897 { |
7898 v22 = dword_4F5D98_xs[v20 + 1]; | |
7899 if ( v22 >= a4a ) | |
7900 v23 = 0; | |
7901 else | |
7902 v23 = 2; | |
1110 | 7903 v24 = v23 | (dword_4F5D98_xs[v20] < a4a); |
0 | 7904 if ( v24 != 3 ) |
7905 { | |
7906 if ( !v24 | |
7907 || (v25 = v22 - dword_4F5D98_xs[v20], | |
7908 LODWORD(v26) = v25 << 16, | |
7909 HIDWORD(v26) = v25 >> 16, | |
7910 dword_4F5D98_xs[v20] | |
7911 + ((signed int)(((unsigned __int64)(v26 | |
7912 / (v21 - dword_4F5CC4_ys[v20 + 1]) | |
7913 * ((v8 - dword_4F5CC4_ys[v20 + 1]) << 16)) >> 16) | |
7914 + 32768) >> 16) >= a4a) ) | |
7915 ++a3a; | |
7916 } | |
7917 } | |
7918 v18 = v21 >= v8; | |
7919 v19 = v29++ + 1; | |
7920 } | |
7921 while ( v29 < v28 ); | |
7922 result = 1; | |
7923 if ( a3a != 1 ) | |
7924 LABEL_29: | |
7925 result = 0; | |
7926 return result; | |
7927 } | |
7928 | |
7929 //----- (004077F1) -------------------------------------------------------- | |
7930 bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *a4, BSPVertexBuffer *a5) | |
7931 { | |
7932 ODMFace *v5; // eax@1 | |
7933 unsigned int v6; // esi@1 | |
7934 signed int v7; // edi@1 | |
7935 char v8; // zf@2 | |
7936 unsigned __int16 *v9; // edx@3 | |
7937 int v10; // ecx@4 | |
7938 unsigned __int16 *v11; // edx@8 | |
7939 int v12; // ecx@9 | |
7940 int v13; // edx@12 | |
7941 int v14; // ecx@13 | |
7942 int v15; // esi@14 | |
7943 bool v16; // edi@14 | |
7944 int v17; // ecx@16 | |
7945 int v18; // edx@16 | |
7946 int v19; // eax@17 | |
7947 signed int v20; // ebx@18 | |
7948 int v21; // edi@20 | |
7949 signed int v22; // eax@22 | |
7950 signed __int64 v23; // qtt@22 | |
7951 bool result; // eax@25 | |
7952 int v25; // [sp+14h] [bp-8h]@14 | |
7953 int a4a; // [sp+28h] [bp+Ch]@2 | |
7954 signed int a5a; // [sp+2Ch] [bp+10h]@14 | |
7955 | |
7956 v5 = a4; | |
7957 v6 = a4->uAttributes; | |
7958 v7 = 0; | |
7959 if ( v6 & 0x100 ) | |
7960 { | |
7961 v8 = a4->uNumVertices == 0; | |
7962 a4a = a1; | |
7963 a3 = a2; | |
7964 if ( !v8 ) | |
7965 { | |
7966 v9 = v5->pVertexIDs; | |
7967 do | |
7968 { | |
7969 ++v7; | |
7970 dword_4F5BF4_xs[v7] = a5->pVertices[*v9].x; | |
7971 v10 = *v9; | |
7972 ++v9; | |
7973 dword_4F5B24_ys[v7] = a5->pVertices[v10].y; | |
7974 } | |
7975 while ( v7 < v5->uNumVertices ); | |
7976 } | |
7977 } | |
7978 else | |
7979 { | |
7980 if ( v6 & 0x200 ) | |
7981 { | |
7982 v8 = a4->uNumVertices == 0; | |
7983 a4a = a1; | |
7984 if ( !v8 ) | |
7985 { | |
7986 v11 = v5->pVertexIDs; | |
7987 do | |
7988 { | |
7989 ++v7; | |
7990 dword_4F5BF4_xs[v7] = a5->pVertices[*v11].x; | |
7991 v12 = *v11; | |
7992 ++v11; | |
7993 dword_4F5B24_ys[v7] = a5->pVertices[v12].z; | |
7994 } | |
7995 while ( v7 < v5->uNumVertices ); | |
7996 } | |
7997 } | |
7998 else | |
7999 { | |
8000 v8 = a4->uNumVertices == 0; | |
8001 a4a = a2; | |
8002 if ( !v8 ) | |
8003 { | |
8004 v13 = (int)v5->pVertexIDs; | |
8005 do | |
8006 { | |
8007 ++v7; | |
8008 dword_4F5BF4_xs[v7] = a5->pVertices[*(short *)v13].y; | |
8009 v14 = *(short *)v13; | |
8010 v13 += 2; | |
8011 dword_4F5B24_ys[v7] = a5->pVertices[v14].z; | |
8012 } | |
8013 while ( v7 < v5->uNumVertices ); | |
8014 } | |
8015 } | |
8016 } | |
8017 v15 = v5->uNumVertices; | |
8018 a5a = 0; | |
8019 dword_4F5BF4_xs[v15 + 1] = dword_4F5BF4_xs[1]; | |
8020 dword_4F5B24_ys[v15 + 1] = dword_4F5B24_ys[1]; | |
8021 v25 = 0; | |
8022 v16 = dword_4F5B24_ys[1] >= a3; | |
8023 if ( v15 <= 0 ) | |
8024 goto LABEL_29; | |
8025 do | |
8026 { | |
8027 if ( a5a >= 2 ) | |
8028 break; | |
8029 v17 = v25; | |
8030 v18 = dword_4F5B24_ys[v25 + 2]; | |
1110 | 8031 if ( v16 ^ (v18 >= a3) ) |
0 | 8032 { |
8033 v19 = dword_4F5BF4_xs[v17 + 2]; | |
8034 if ( v19 >= a4a ) | |
8035 v20 = 0; | |
8036 else | |
8037 v20 = 2; | |
1110 | 8038 v21 = v20 | (dword_4F5BF4_xs[v17 + 1] < a4a); |
0 | 8039 if ( v21 != 3 ) |
8040 { | |
8041 if ( !v21 | |
8042 || (v22 = v19 - dword_4F5BF4_xs[v17 + 1], | |
8043 LODWORD(v23) = v22 << 16, | |
8044 HIDWORD(v23) = v22 >> 16, | |
8045 dword_4F5BF4_xs[v17 + 1] | |
8046 + ((signed int)(((unsigned __int64)(v23 | |
8047 / (v18 - dword_4F5B24_ys[v17 + 1]) | |
8048 * ((a3 - dword_4F5B24_ys[v17 + 1]) << 16)) >> 16) | |
8049 + 32768) >> 16) >= a4a) ) | |
8050 ++a5a; | |
8051 } | |
8052 } | |
8053 ++v25; | |
8054 v16 = v18 >= a3; | |
8055 } | |
8056 while ( v25 < v15 ); | |
8057 result = 1; | |
8058 if ( a5a != 1 ) | |
8059 LABEL_29: | |
8060 result = 0; | |
8061 return result; | |
8062 } | |
8063 | |
8064 //----- (00407A1C) -------------------------------------------------------- | |
8065 bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v) | |
8066 { | |
8067 unsigned int v4; // esi@1 | |
8068 Vec3_int_ v5; // ST08_12@2 | |
8069 int v6; // edi@2 | |
8070 int v7; // ebx@2 | |
8071 int v8; // esi@2 | |
8072 signed int v9; // ecx@2 | |
8073 int v10; // eax@2 | |
8074 int v11; // ecx@4 | |
8075 int v12; // eax@4 | |
8076 int v13; // ebx@4 | |
8077 int v14; // edx@6 | |
8078 char *v15; // edi@16 | |
8079 ODMFace *v16; // esi@19 | |
8080 int v17; // ST34_4@25 | |
8081 int v18; // ST38_4@25 | |
8082 int v19; // eax@25 | |
8083 char v20; // zf@25 | |
8084 int v21; // ebx@25 | |
8085 int v22; // eax@26 | |
8086 signed int v23; // edi@26 | |
8087 int v24; // ST34_4@30 | |
8088 signed __int64 v25; // qtt@31 | |
8089 int v26; // eax@31 | |
8090 Vec3_int_ v27; // ST08_12@37 | |
8091 Vec3_int_ v28; // ST08_12@37 | |
8092 int v29; // edi@37 | |
8093 int v30; // ebx@37 | |
8094 int v31; // esi@37 | |
8095 signed int v32; // ecx@37 | |
8096 int v33; // eax@37 | |
8097 int v34; // ecx@39 | |
8098 int v35; // eax@39 | |
8099 int v36; // ebx@39 | |
8100 int v37; // edx@41 | |
8101 char *v38; // edi@51 | |
8102 ODMFace *v39; // esi@54 | |
8103 int v40; // ebx@60 | |
8104 int v41; // eax@61 | |
8105 signed int v42; // edi@61 | |
8106 signed __int64 v43; // qtt@66 | |
8107 int v44; // eax@66 | |
8108 Vec3_int_ v45; // ST08_12@73 | |
8109 int v46; // edi@73 | |
8110 int v47; // ebx@73 | |
8111 int v48; // esi@73 | |
8112 signed int v49; // ecx@73 | |
8113 int v50; // eax@73 | |
8114 int v51; // edx@75 | |
8115 int v52; // ecx@75 | |
8116 int v53; // eax@75 | |
8117 int v54; // ebx@75 | |
8118 int v55; // edi@77 | |
8119 int v56; // ecx@77 | |
8120 int v57; // eax@81 | |
8121 int v58; // esi@81 | |
8122 int v59; // eax@90 | |
8123 BLVSector *v60; // edx@90 | |
8124 int v61; // ecx@90 | |
8125 BLVFace *v62; // esi@91 | |
8126 int v63; // ST34_4@98 | |
8127 int v64; // ST30_4@98 | |
8128 int v65; // eax@98 | |
8129 int v66; // ebx@98 | |
8130 int v67; // eax@99 | |
8131 signed int v68; // edi@99 | |
8132 int v69; // ST2C_4@103 | |
8133 signed __int64 v70; // qtt@104 | |
8134 int v71; // eax@104 | |
8135 Vec3_int_ v72; // ST08_12@111 | |
8136 Vec3_int_ v73; // ST08_12@111 | |
8137 int v74; // edi@111 | |
8138 int v75; // ebx@111 | |
8139 int v76; // esi@111 | |
8140 signed int v77; // ecx@111 | |
8141 int v78; // eax@111 | |
8142 int v79; // edx@113 | |
8143 int v80; // ecx@113 | |
8144 int v81; // eax@113 | |
8145 int v82; // ebx@113 | |
8146 int v83; // edi@115 | |
8147 int v84; // ecx@115 | |
8148 int v85; // eax@119 | |
8149 int v86; // esi@119 | |
8150 int v87; // ecx@128 | |
8151 BLVSector *v88; // eax@128 | |
8152 int v89; // ecx@128 | |
8153 BLVFace *v90; // esi@129 | |
8154 int v91; // ebx@136 | |
8155 int v92; // eax@137 | |
8156 signed int v93; // edi@137 | |
8157 signed __int64 v94; // qtt@142 | |
8158 int v95; // eax@142 | |
8159 Vec3_int_ v97; // [sp-18h] [bp-94h]@1 | |
8160 int v98; // [sp-Ch] [bp-88h]@88 | |
8161 int v99; // [sp-Ch] [bp-88h]@126 | |
8162 int v100; // [sp-8h] [bp-84h]@88 | |
8163 int v101; // [sp-8h] [bp-84h]@126 | |
8164 int v102; // [sp-4h] [bp-80h]@88 | |
8165 int v103; // [sp-4h] [bp-80h]@126 | |
8166 int v104; // [sp+Ch] [bp-70h]@13 | |
8167 int v105; // [sp+Ch] [bp-70h]@48 | |
8168 int v106; // [sp+10h] [bp-6Ch]@18 | |
8169 int v107; // [sp+10h] [bp-6Ch]@98 | |
8170 int v108; // [sp+10h] [bp-6Ch]@104 | |
8171 int v109; // [sp+18h] [bp-64h]@25 | |
8172 int v110; // [sp+18h] [bp-64h]@31 | |
8173 int i; // [sp+18h] [bp-64h]@90 | |
8174 int v112; // [sp+18h] [bp-64h]@128 | |
8175 signed int v113; // [sp+20h] [bp-5Ch]@1 | |
8176 signed int v114; // [sp+24h] [bp-58h]@1 | |
8177 unsigned __int64 a4; // [sp+28h] [bp-54h]@1 | |
8178 unsigned int a4_8; // [sp+30h] [bp-4Ch]@1 | |
8179 int v117; // [sp+34h] [bp-48h]@4 | |
8180 int v118; // [sp+34h] [bp-48h]@39 | |
8181 int v119; // [sp+34h] [bp-48h]@75 | |
8182 int v120; // [sp+34h] [bp-48h]@113 | |
8183 int v121; // [sp+38h] [bp-44h]@4 | |
8184 int v122; // [sp+38h] [bp-44h]@39 | |
8185 int v123; // [sp+38h] [bp-44h]@76 | |
8186 int v124; // [sp+38h] [bp-44h]@114 | |
8187 int v125; // [sp+3Ch] [bp-40h]@4 | |
8188 int v126; // [sp+3Ch] [bp-40h]@39 | |
8189 int v127; // [sp+3Ch] [bp-40h]@77 | |
8190 int v128; // [sp+3Ch] [bp-40h]@115 | |
8191 int v129; // [sp+40h] [bp-3Ch]@11 | |
8192 int v130; // [sp+40h] [bp-3Ch]@46 | |
8193 int v131; // [sp+40h] [bp-3Ch]@78 | |
8194 int v132; // [sp+40h] [bp-3Ch]@116 | |
8195 int v133; // [sp+44h] [bp-38h]@10 | |
8196 int v134; // [sp+44h] [bp-38h]@45 | |
8197 int v135; // [sp+44h] [bp-38h]@81 | |
8198 int v136; // [sp+44h] [bp-38h]@119 | |
8199 int v137; // [sp+48h] [bp-34h]@7 | |
8200 int v138; // [sp+48h] [bp-34h]@42 | |
8201 int v139; // [sp+48h] [bp-34h]@82 | |
8202 int v140; // [sp+48h] [bp-34h]@120 | |
8203 int v141; // [sp+4Ch] [bp-30h]@6 | |
8204 int v142; // [sp+4Ch] [bp-30h]@41 | |
8205 int v143; // [sp+4Ch] [bp-30h]@75 | |
8206 int v144; // [sp+4Ch] [bp-30h]@113 | |
8207 int v145; // [sp+50h] [bp-2Ch]@5 | |
8208 int v146; // [sp+50h] [bp-2Ch]@40 | |
8209 int v147; // [sp+50h] [bp-2Ch]@75 | |
8210 int v148; // [sp+50h] [bp-2Ch]@113 | |
8211 int v149; // [sp+54h] [bp-28h]@4 | |
8212 int v150; // [sp+54h] [bp-28h]@39 | |
8213 int v151; // [sp+54h] [bp-28h]@75 | |
8214 int v152; // [sp+54h] [bp-28h]@113 | |
8215 int sDepth; // [sp+58h] [bp-24h]@17 | |
8216 int sDeptha; // [sp+58h] [bp-24h]@52 | |
8217 int sDepthb; // [sp+58h] [bp-24h]@90 | |
8218 char *a5; // [sp+5Ch] [bp-20h]@16 | |
8219 char *a5a; // [sp+5Ch] [bp-20h]@51 | |
8220 signed int a5b; // [sp+5Ch] [bp-20h]@83 | |
8221 signed int a5c; // [sp+5Ch] [bp-20h]@121 | |
8222 signed int v160; // [sp+60h] [bp-1Ch]@12 | |
8223 signed int v161; // [sp+60h] [bp-1Ch]@47 | |
8224 int v162; // [sp+60h] [bp-1Ch]@128 | |
8225 int v163; // [sp+64h] [bp-18h]@2 | |
8226 int outx; // [sp+68h] [bp-14h]@2 | |
8227 int outy; // [sp+6Ch] [bp-10h]@2 | |
8228 int outz; // [sp+70h] [bp-Ch]@2 | |
8229 Vec3_int_ pOut; // [sp+74h] [bp-8h]@2 | |
8230 int ya; // [sp+84h] [bp+8h]@60 | |
8231 int yb; // [sp+84h] [bp+8h]@136 | |
8232 int ve; // [sp+88h] [bp+Ch]@60 | |
8233 int va; // [sp+88h] [bp+Ch]@60 | |
8234 int vb; // [sp+88h] [bp+Ch]@66 | |
8235 int vf; // [sp+88h] [bp+Ch]@136 | |
8236 int vc; // [sp+88h] [bp+Ch]@136 | |
8237 int vd; // [sp+88h] [bp+Ch]@142 | |
8238 int v_4; // [sp+8Ch] [bp+10h]@60 | |
8239 int v_4a; // [sp+8Ch] [bp+10h]@65 | |
8240 int v_4b; // [sp+8Ch] [bp+10h]@136 | |
8241 int v_4c; // [sp+8Ch] [bp+10h]@141 | |
8242 int v_8; // [sp+90h] [bp+14h]@53 | |
8243 | |
8244 a4 = __PAIR__(z, x); | |
8245 v4 = stru_5C6E00->Atan2(v.x - x, v.y - z); | |
8246 v114 = 0; | |
8247 v97.z = y; | |
8248 v113 = 0; | |
8249 a4_8 = v4; | |
8250 *(_QWORD *)&v97.x = a4; | |
8251 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
8252 { | |
8253 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
8254 v45.z = v.z; | |
8255 *(_QWORD *)&v45.x = *(_QWORD *)&v; | |
8256 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &v163); | |
8257 v46 = outy - pOut.y; | |
8258 v47 = v163 - outz; | |
8259 v48 = outx - pOut.x; | |
295 | 8260 v49 = integer_sqrt(v48 * v48 + v46 * v46 + v47 * v47); |
0 | 8261 v50 = 65536; |
8262 if ( v49 ) | |
8263 v50 = 65536 / v49; | |
8264 v51 = outx; | |
8265 v143 = v48 * v50; | |
8266 v52 = v46 * v50; | |
8267 v53 = v47 * v50; | |
8268 v54 = pOut.x; | |
8269 v147 = v52; | |
8270 v151 = v53; | |
8271 v119 = pOut.x; | |
8272 if ( pOut.x < outx ) | |
8273 { | |
8274 v123 = outx; | |
8275 } | |
8276 else | |
8277 { | |
8278 v119 = outx; | |
8279 v123 = pOut.x; | |
8280 } | |
8281 v55 = pOut.y; | |
8282 v56 = outy; | |
8283 v127 = pOut.y; | |
8284 if ( pOut.y < outy ) | |
8285 { | |
8286 v131 = outy; | |
8287 } | |
8288 else | |
8289 { | |
8290 v127 = outy; | |
8291 v131 = pOut.y; | |
8292 } | |
8293 v57 = v163; | |
8294 v58 = outz; | |
8295 v135 = outz; | |
8296 if ( outz < v163 ) | |
8297 { | |
8298 v139 = v163; | |
8299 } | |
8300 else | |
8301 { | |
8302 v135 = v163; | |
8303 v139 = outz; | |
8304 } | |
8305 a5b = 0; | |
8306 while ( !v114 ) | |
8307 { | |
8308 if ( a5b ) | |
8309 { | |
8310 v102 = v58; | |
8311 v100 = v55; | |
8312 v98 = v54; | |
8313 } | |
8314 else | |
8315 { | |
8316 v102 = v57; | |
8317 v100 = v56; | |
8318 v98 = v51; | |
8319 } | |
8320 v59 = pIndoor->GetSector(v98, v100, v102); | |
8321 v60 = pIndoor->pSectors; | |
8322 v61 = 116 * v59; | |
8323 sDepthb = 0; | |
8324 for ( i = 116 * v59; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
543
diff
changeset
|
8325 sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v61) |
0 | 8326 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61); |
8327 ++sDepthb ) | |
8328 { | |
8329 v62 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v60->pWalls + v61))[sDepthb]]; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
8330 if ( v62->Portal() |
0 | 8331 || v119 > v62->pBounding.x2 |
8332 || v123 < v62->pBounding.x1 | |
8333 || v127 > v62->pBounding.y2 | |
8334 || v131 < v62->pBounding.y1 | |
8335 || v135 > v62->pBounding.z2 | |
8336 || v139 < v62->pBounding.z1 | |
8337 || (v63 = (unsigned __int64)(v143 * (signed __int64)v62->pFacePlane_old.vNormal.x) >> 16, | |
8338 v64 = (unsigned __int64)(v151 * (signed __int64)v62->pFacePlane_old.vNormal.z) >> 16, | |
8339 v65 = (unsigned __int64)(v147 * (signed __int64)v62->pFacePlane_old.vNormal.y) >> 16, | |
8340 v20 = v63 + v64 + v65 == 0, | |
8341 v66 = v63 + v64 + v65, | |
8342 v107 = v63 + v64 + v65, | |
8343 v20) ) | |
8344 goto LABEL_107; | |
8345 v67 = outz * v62->pFacePlane_old.vNormal.z; | |
8346 v68 = -(v62->pFacePlane_old.dist | |
8347 + v67 | |
8348 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8349 + pOut.x * v62->pFacePlane_old.vNormal.x); | |
8350 if ( v66 <= 0 ) | |
8351 { | |
8352 if ( v62->pFacePlane_old.dist | |
8353 + v67 | |
8354 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8355 + pOut.x * v62->pFacePlane_old.vNormal.x < 0 ) | |
8356 goto LABEL_107; | |
8357 } | |
8358 else | |
8359 { | |
8360 if ( v62->pFacePlane_old.dist | |
8361 + v67 | |
8362 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8363 + pOut.x * v62->pFacePlane_old.vNormal.x > 0 ) | |
8364 goto LABEL_107; | |
8365 } | |
8366 v69 = abs(-(v62->pFacePlane_old.dist | |
8367 + v67 | |
8368 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8369 + pOut.x * v62->pFacePlane_old.vNormal.x)) >> 14; | |
8370 if ( v69 <= abs(v66) ) | |
8371 { | |
8372 LODWORD(v70) = v68 << 16; | |
8373 HIDWORD(v70) = v68 >> 16; | |
8374 v71 = v70 / v107; | |
8375 v108 = v70 / v107; | |
8376 if ( v71 >= 0 ) | |
8377 { | |
8378 if ( sub_4075DB( | |
8379 pOut.x + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v143) >> 16) + 32768) >> 16), | |
8380 pOut.y + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v147) >> 16) + 32768) >> 16), | |
8381 outz + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v151) >> 16) + 32768) >> 16), | |
8382 v62) ) | |
8383 { | |
8384 v114 = 1; | |
8385 break; | |
8386 } | |
8387 } | |
8388 } | |
8389 v61 = i; | |
8390 LABEL_107: | |
8391 v60 = pIndoor->pSectors; | |
8392 } | |
8393 ++a5b; | |
8394 if ( a5b >= 2 ) | |
8395 break; | |
8396 v57 = v163; | |
8397 v56 = outy; | |
8398 v51 = outx; | |
8399 v58 = outz; | |
8400 v55 = pOut.y; | |
8401 v54 = pOut.x; | |
8402 } | |
8403 v72.z = y; | |
8404 *(_QWORD *)&v72.x = a4; | |
8405 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz); | |
8406 v73.z = v.z; | |
8407 *(_QWORD *)&v73.x = *(_QWORD *)&v; | |
8408 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163); | |
8409 v74 = outy - pOut.y; | |
8410 v75 = v163 - outz; | |
8411 v76 = outx - pOut.x; | |
295 | 8412 v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75); |
0 | 8413 v78 = 65536; |
8414 if ( v77 ) | |
8415 v78 = 65536 / v77; | |
8416 v79 = outx; | |
8417 v144 = v76 * v78; | |
8418 v80 = v74 * v78; | |
8419 v81 = v75 * v78; | |
8420 v82 = pOut.x; | |
8421 v148 = v80; | |
8422 v152 = v81; | |
8423 v120 = pOut.x; | |
8424 if ( pOut.x < outx ) | |
8425 { | |
8426 v124 = outx; | |
8427 } | |
8428 else | |
8429 { | |
8430 v120 = outx; | |
8431 v124 = pOut.x; | |
8432 } | |
8433 v83 = pOut.y; | |
8434 v84 = outy; | |
8435 v128 = pOut.y; | |
8436 if ( pOut.y < outy ) | |
8437 { | |
8438 v132 = outy; | |
8439 } | |
8440 else | |
8441 { | |
8442 v128 = outy; | |
8443 v132 = pOut.y; | |
8444 } | |
8445 v85 = v163; | |
8446 v86 = outz; | |
8447 v136 = outz; | |
8448 if ( outz < v163 ) | |
8449 { | |
8450 v140 = v163; | |
8451 } | |
8452 else | |
8453 { | |
8454 v136 = v163; | |
8455 v140 = outz; | |
8456 } | |
8457 a5c = 0; | |
8458 while ( 1 ) | |
8459 { | |
8460 if ( v113 ) | |
8461 return !v114 || !v113; | |
8462 if ( a5c ) | |
8463 { | |
8464 v103 = v86; | |
8465 v101 = v83; | |
8466 v99 = v82; | |
8467 } | |
8468 else | |
8469 { | |
8470 v103 = v85; | |
8471 v101 = v84; | |
8472 v99 = v79; | |
8473 } | |
8474 v87 = pIndoor->GetSector(v99, v101, v103); | |
8475 v88 = pIndoor->pSectors; | |
8476 v89 = 116 * v87; | |
8477 v162 = 0; | |
8478 v112 = v89; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
543
diff
changeset
|
8479 if ( *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) |
0 | 8480 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 ) |
8481 break; | |
8482 LABEL_148: | |
8483 ++a5c; | |
8484 if ( a5c >= 2 ) | |
8485 return !v114 || !v113; | |
8486 v85 = v163; | |
8487 v84 = outy; | |
8488 v79 = outx; | |
8489 v86 = outz; | |
8490 v83 = pOut.y; | |
8491 v82 = pOut.x; | |
8492 } | |
8493 while ( 1 ) | |
8494 { | |
8495 v90 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v88->pWalls + v89))[v162]]; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
8496 if ( v90->Portal() |
0 | 8497 || v120 > v90->pBounding.x2 |
8498 || v124 < v90->pBounding.x1 | |
8499 || v128 > v90->pBounding.y2 | |
8500 || v132 < v90->pBounding.y1 | |
8501 || v136 > v90->pBounding.z2 | |
8502 || v140 < v90->pBounding.z1 | |
8503 || (yb = (unsigned __int64)(v144 * (signed __int64)v90->pFacePlane_old.vNormal.x) >> 16, | |
8504 v_4b = (unsigned __int64)(v148 * (signed __int64)v90->pFacePlane_old.vNormal.y) >> 16, | |
8505 vf = (unsigned __int64)(v152 * (signed __int64)v90->pFacePlane_old.vNormal.z) >> 16, | |
8506 v20 = yb + vf + v_4b == 0, | |
8507 v91 = yb + vf + v_4b, | |
8508 vc = yb + vf + v_4b, | |
8509 v20) ) | |
8510 goto LABEL_145; | |
8511 v92 = outz * v90->pFacePlane_old.vNormal.z; | |
8512 v93 = -(v90->pFacePlane_old.dist | |
8513 + v92 | |
8514 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8515 + pOut.x * v90->pFacePlane_old.vNormal.x); | |
8516 if ( v91 <= 0 ) | |
8517 { | |
8518 if ( v90->pFacePlane_old.dist | |
8519 + v92 | |
8520 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8521 + pOut.x * v90->pFacePlane_old.vNormal.x < 0 ) | |
8522 goto LABEL_145; | |
8523 } | |
8524 else | |
8525 { | |
8526 if ( v90->pFacePlane_old.dist | |
8527 + v92 | |
8528 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8529 + pOut.x * v90->pFacePlane_old.vNormal.x > 0 ) | |
8530 goto LABEL_145; | |
8531 } | |
8532 v_4c = abs(-(v90->pFacePlane_old.dist | |
8533 + v92 | |
8534 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8535 + pOut.x * v90->pFacePlane_old.vNormal.x)) >> 14; | |
8536 if ( v_4c <= abs(v91) ) | |
8537 { | |
8538 LODWORD(v94) = v93 << 16; | |
8539 HIDWORD(v94) = v93 >> 16; | |
8540 v95 = v94 / vc; | |
8541 vd = v94 / vc; | |
8542 if ( v95 >= 0 ) | |
8543 { | |
8544 if ( sub_4075DB( | |
8545 pOut.x + ((signed int)(((unsigned __int64)(vd * (signed __int64)v144) >> 16) + 32768) >> 16), | |
8546 pOut.y + ((signed int)(((unsigned __int64)(vd * (signed __int64)v148) >> 16) + 32768) >> 16), | |
8547 outz + ((signed int)(((unsigned __int64)(vd * (signed __int64)v152) >> 16) + 32768) >> 16), | |
8548 v90) ) | |
8549 { | |
8550 v113 = 1; | |
8551 goto LABEL_148; | |
8552 } | |
8553 } | |
8554 } | |
8555 v89 = v112; | |
8556 LABEL_145: | |
8557 v88 = pIndoor->pSectors; | |
8558 ++v162; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
543
diff
changeset
|
8559 if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) |
0 | 8560 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) ) |
8561 goto LABEL_148; | |
8562 } | |
8563 } | |
8564 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
8565 v5.z = v.z; | |
8566 *(_QWORD *)&v5.x = *(_QWORD *)&v; | |
8567 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v5, &outx, &outy, &v163); | |
8568 v6 = outy - pOut.y; | |
8569 v7 = v163 - outz; | |
8570 v8 = outx - pOut.x; | |
295 | 8571 v9 = integer_sqrt(v8 * v8 + v6 * v6 + v7 * v7); |
0 | 8572 v10 = 65536; |
8573 if ( v9 ) | |
8574 v10 = 65536 / v9; | |
8575 v125 = v8 * v10; | |
8576 v11 = v10; | |
8577 v12 = v7 * v10; | |
8578 v13 = pOut.x; | |
8579 v117 = v12; | |
8580 v121 = v6 * v11; | |
8581 v149 = pOut.x; | |
8582 if ( pOut.x < outx ) | |
8583 { | |
8584 v145 = outx; | |
8585 } | |
8586 else | |
8587 { | |
8588 v149 = outx; | |
8589 v145 = pOut.x; | |
8590 } | |
8591 v14 = outy; | |
8592 v141 = pOut.y; | |
8593 if ( pOut.y < outy ) | |
8594 { | |
8595 v137 = outy; | |
8596 } | |
8597 else | |
8598 { | |
8599 v141 = outy; | |
8600 v137 = pOut.y; | |
8601 } | |
8602 v133 = outz; | |
8603 if ( outz < v163 ) | |
8604 { | |
8605 v129 = v163; | |
8606 } | |
8607 else | |
8608 { | |
8609 v133 = v163; | |
8610 v129 = outz; | |
8611 } | |
8612 v160 = 0; | |
8613 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
8614 { | |
8615 v104 = 0; | |
8616 while ( 1 ) | |
8617 { | |
8618 v15 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
8619 a5 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
8620 if ( sub_4088E9(v13, pOut.y, outx, v14, pOutdoor->pBModels[v104].vPosition.x, pOutdoor->pBModels[v104].vPosition.y) <= pOutdoor->pBModels[v104].sBoundingRadius + 128 ) | |
8621 { | |
8622 sDepth = 0; | |
8623 if ( *((int *)v15 + 2) > 0 ) | |
8624 break; | |
8625 } | |
8626 LABEL_36: | |
8627 ++v160; | |
8628 ++v104; | |
8629 if ( v160 >= (signed int)pOutdoor->uNumBModels ) | |
8630 goto LABEL_37; | |
8631 v14 = outy; | |
8632 v13 = pOut.x; | |
8633 } | |
8634 v106 = 0; | |
8635 while ( 1 ) | |
8636 { | |
8637 v16 = (ODMFace *)(v106 + *((int *)a5 + 4)); | |
8638 if ( v149 > v16->pBoundingBox.x2 | |
8639 || v145 < v16->pBoundingBox.x1 | |
8640 || v141 > v16->pBoundingBox.y2 | |
8641 || v137 < v16->pBoundingBox.y1 | |
8642 || v133 > v16->pBoundingBox.z2 | |
8643 || v129 < v16->pBoundingBox.z1 | |
8644 || (v17 = (unsigned __int64)(v125 * (signed __int64)v16->pFacePlane.vNormal.x) >> 16, | |
8645 v18 = (unsigned __int64)(v121 * (signed __int64)v16->pFacePlane.vNormal.y) >> 16, | |
8646 v19 = (unsigned __int64)(v117 * (signed __int64)v16->pFacePlane.vNormal.z) >> 16, | |
8647 v20 = v17 + v18 + v19 == 0, | |
8648 v21 = v17 + v18 + v19, | |
8649 v109 = v17 + v18 + v19, | |
8650 v20) ) | |
8651 goto LABEL_33; | |
8652 v22 = pOut.y * v16->pFacePlane.vNormal.y; | |
8653 v23 = -(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x); | |
8654 if ( v21 <= 0 ) | |
8655 { | |
8656 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x < 0 ) | |
8657 goto LABEL_33; | |
8658 } | |
8659 else | |
8660 { | |
8661 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x > 0 ) | |
8662 goto LABEL_33; | |
8663 } | |
8664 v24 = abs(-(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x)) >> 14; | |
8665 if ( v24 <= abs(v21) ) | |
8666 { | |
8667 LODWORD(v25) = v23 << 16; | |
8668 HIDWORD(v25) = v23 >> 16; | |
8669 v26 = v25 / v109; | |
8670 v110 = v25 / v109; | |
8671 if ( v26 >= 0 ) | |
8672 { | |
8673 if ( sub_4077F1( | |
8674 pOut.x + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v125) >> 16) + 32768) >> 16), | |
8675 pOut.y + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v121) >> 16) + 32768) >> 16), | |
8676 outz + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v117) >> 16) + 32768) >> 16), | |
8677 v16, | |
8678 (BSPVertexBuffer *)a5) ) | |
8679 { | |
8680 v114 = 1; | |
8681 goto LABEL_36; | |
8682 } | |
8683 } | |
8684 } | |
8685 LABEL_33: | |
8686 ++sDepth; | |
8687 v106 += 308; | |
8688 if ( sDepth >= *((int *)a5 + 2) ) | |
8689 goto LABEL_36; | |
8690 } | |
8691 } | |
8692 LABEL_37: | |
8693 v27.z = y; | |
8694 *(_QWORD *)&v27.x = a4; | |
8695 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz); | |
8696 v28.z = v.z; | |
8697 *(_QWORD *)&v28.x = *(_QWORD *)&v; | |
8698 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163); | |
8699 v29 = outy - pOut.y; | |
8700 v30 = v163 - outz; | |
8701 v31 = outx - pOut.x; | |
295 | 8702 v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30); |
0 | 8703 v33 = 65536; |
8704 if ( v32 ) | |
8705 v33 = 65536 / v32; | |
8706 v126 = v31 * v33; | |
8707 v34 = v33; | |
8708 v35 = v30 * v33; | |
8709 v36 = pOut.x; | |
8710 v118 = v35; | |
8711 v122 = v29 * v34; | |
8712 v150 = pOut.x; | |
8713 if ( pOut.x < outx ) | |
8714 { | |
8715 v146 = outx; | |
8716 } | |
8717 else | |
8718 { | |
8719 v150 = outx; | |
8720 v146 = pOut.x; | |
8721 } | |
8722 v37 = outy; | |
8723 v142 = pOut.y; | |
8724 if ( pOut.y < outy ) | |
8725 { | |
8726 v138 = outy; | |
8727 } | |
8728 else | |
8729 { | |
8730 v142 = outy; | |
8731 v138 = pOut.y; | |
8732 } | |
8733 v134 = outz; | |
8734 if ( outz < v163 ) | |
8735 { | |
8736 v130 = v163; | |
8737 } | |
8738 else | |
8739 { | |
8740 v134 = v163; | |
8741 v130 = outz; | |
8742 } | |
8743 v161 = 0; | |
8744 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
8745 { | |
8746 v105 = 0; | |
8747 while ( 1 ) | |
8748 { | |
8749 v38 = (char *)&pOutdoor->pBModels[v105].pVertices; | |
8750 a5a = (char *)&pOutdoor->pBModels[v105].pVertices; | |
8751 if ( sub_4088E9(v36, pOut.y, outx, v37, pOutdoor->pBModels[v105].vPosition.x, pOutdoor->pBModels[v105].vPosition.y) <= pOutdoor->pBModels[v105].sBoundingRadius + 128 ) | |
8752 { | |
8753 sDeptha = 0; | |
8754 if ( *((int *)v38 + 2) > 0 ) | |
8755 break; | |
8756 } | |
8757 LABEL_71: | |
8758 ++v161; | |
8759 ++v105; | |
8760 if ( v161 >= (signed int)pOutdoor->uNumBModels ) | |
8761 return !v114 || !v113; | |
8762 v37 = outy; | |
8763 v36 = pOut.x; | |
8764 } | |
8765 v_8 = 0; | |
8766 while ( 1 ) | |
8767 { | |
8768 v39 = (ODMFace *)(v_8 + *((int *)a5a + 4)); | |
8769 if ( v150 > v39->pBoundingBox.x2 | |
8770 || v146 < v39->pBoundingBox.x1 | |
8771 || v142 > v39->pBoundingBox.y2 | |
8772 || v138 < v39->pBoundingBox.y1 | |
8773 || v134 > v39->pBoundingBox.z2 | |
8774 || v130 < v39->pBoundingBox.z1 | |
8775 || (ya = (unsigned __int64)(v126 * (signed __int64)v39->pFacePlane.vNormal.x) >> 16, | |
8776 ve = (unsigned __int64)(v122 * (signed __int64)v39->pFacePlane.vNormal.y) >> 16, | |
8777 v_4 = (unsigned __int64)(v118 * (signed __int64)v39->pFacePlane.vNormal.z) >> 16, | |
8778 v20 = ya + ve + v_4 == 0, | |
8779 v40 = ya + ve + v_4, | |
8780 va = ya + ve + v_4, | |
8781 v20) ) | |
8782 goto LABEL_68; | |
8783 v41 = pOut.y * v39->pFacePlane.vNormal.y; | |
8784 v42 = -(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x); | |
8785 if ( v40 <= 0 ) | |
8786 { | |
8787 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x < 0 ) | |
8788 goto LABEL_68; | |
8789 } | |
8790 else | |
8791 { | |
8792 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x > 0 ) | |
8793 goto LABEL_68; | |
8794 } | |
8795 v_4a = abs(-(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x)) >> 14; | |
8796 if ( v_4a <= abs(v40) ) | |
8797 { | |
8798 LODWORD(v43) = v42 << 16; | |
8799 HIDWORD(v43) = v42 >> 16; | |
8800 v44 = v43 / va; | |
8801 vb = v43 / va; | |
8802 if ( v44 >= 0 ) | |
8803 { | |
8804 if ( sub_4077F1( | |
8805 pOut.x + ((signed int)(((unsigned __int64)(vb * (signed __int64)v126) >> 16) + 32768) >> 16), | |
8806 pOut.y + ((signed int)(((unsigned __int64)(vb * (signed __int64)v122) >> 16) + 32768) >> 16), | |
8807 outz + ((signed int)(((unsigned __int64)(vb * (signed __int64)v118) >> 16) + 32768) >> 16), | |
8808 v39, | |
8809 (BSPVertexBuffer *)a5a) ) | |
8810 { | |
8811 v113 = 1; | |
8812 goto LABEL_71; | |
8813 } | |
8814 } | |
8815 } | |
8816 LABEL_68: | |
8817 ++sDeptha; | |
8818 v_8 += 308; | |
8819 if ( sDeptha >= *((int *)a5a + 2) ) | |
8820 goto LABEL_71; | |
8821 } | |
8822 } | |
8823 return !v114 || !v113; | |
8824 } | |
8825 | |
8826 //----- (00408768) -------------------------------------------------------- | |
8827 void InitializeActors() | |
8828 { | |
8829 signed int v5; // [sp+Ch] [bp-10h]@1 | |
8830 signed int v6; // [sp+10h] [bp-Ch]@1 | |
8831 signed int v7; // [sp+14h] [bp-8h]@1 | |
8832 signed int v8; // [sp+18h] [bp-4h]@1 | |
8833 | |
8834 v8 = 0; | |
8835 v6 = 0; | |
8836 v7 = 0; | |
8837 v5 = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
8838 if ( !_stricmp(pCurrentMapName.data(), "d25.blv") ) |
0 | 8839 v8 = 1; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
8840 if ( !_stricmp(pCurrentMapName.data(), "d26.blv") ) |
0 | 8841 v6 = 1; |
484 | 8842 if (_449B57_test_bit(pParty->_quest_bits, 99)) |
0 | 8843 v7 = 1; |
484 | 8844 if (_449B57_test_bit(pParty->_quest_bits, 100)) |
0 | 8845 v5 = 1; |
413 | 8846 |
417 | 8847 Log::Warning(L"%S %S %u", __FILE__, __FUNCTION__, __LINE__); // ai_near_actors_targets_pid[i] for AI_Stand seems always 0; original code behaviour is identical |
0 | 8848 for (uint i = 0; i < uNumActors; ++i) |
8849 { | |
1202 | 8850 auto actor = &pActors[i]; |
0 | 8851 |
8852 if (actor->CanAct() || actor->uAIState == Disabled) | |
8853 { | |
8854 actor->vPosition.x = actor->vInitialPosition.x; | |
8855 actor->vPosition.y = actor->vInitialPosition.y; | |
8856 actor->vPosition.z = actor->vInitialPosition.z; | |
8857 actor->sCurrentHP = actor->pMonsterInfo.uHP; | |
8858 if (actor->uAIState != Disabled) | |
413 | 8859 { |
417 | 8860 Actor::AI_Stand(i, ai_near_actors_targets_pid[i], actor->pMonsterInfo.uRecoveryTime, 0); |
413 | 8861 } |
0 | 8862 } |
8863 | |
8864 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
8865 | |
8866 if (!v8 || v7) | |
8867 if (!v6 || v5) | |
322 | 8868 if (actor->IsPeasant()) |
0 | 8869 BYTE2(actor->uAttributes) &= 0xF7u; |
8870 | |
8871 BYTE2(actor->uAttributes) &= 0x7Fu; | |
8872 if (BYTE2(actor->uAttributes) & 0x40) | |
8873 Actor::_4031C1_update_job(i, pParty->uCurrentHour, 1); | |
8874 } | |
8875 } | |
8876 | |
8877 //----- (00408896) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8878 void InitializeSpriteObjects() |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8879 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8880 for (uint i = 0; i < uNumSpriteObjects; ++i) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8881 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
8882 auto item = &pSpriteObjects[i]; |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8883 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8884 if (item->uType && |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8885 (item->uSoundID & 8 || pObjectList->pObjects[item->uType].uFlags & 0x10)) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8886 SpriteObject::OnInteraction(i); |
0 | 8887 } |
8888 | |
8889 for (uint i = 0; i < 100; ++i) | |
8890 array_5118E8.pElements[i].field_C_time_left = 0; | |
8891 } | |
8892 | |
8893 //----- (004088E9) -------------------------------------------------------- | |
8894 signed int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6) | |
8895 { | |
8896 int v6; // esi@1 | |
8897 int v7; // edi@1 | |
8898 int v8; // eax@1 | |
8899 signed int result; // eax@1 | |
8900 int v10; // [sp+Ch] [bp-4h]@1 | |
8901 int v11; // [sp+18h] [bp+8h]@1 | |
8902 | |
8903 v6 = a1; | |
8904 v10 = a2; | |
8905 v7 = a3 - a1; | |
8906 v11 = abs(a3 - a1); | |
8907 v8 = abs(a4 - v10); | |
295 | 8908 result = integer_sqrt(v11 * v11 + v8 * v8); |
0 | 8909 if ( result ) |
8910 result = abs((v7 * (v10 - a6) - (a4 - v10) * (v6 - a5)) / result); | |
8911 return result; | |
8912 } | |
8913 | |
8914 //----- (00408A27) -------------------------------------------------------- | |
8915 unsigned int __thiscall SearchAliveActors(unsigned int *pTotalActors) | |
8916 { | |
8917 unsigned int *v1; // esi@1 | |
8918 int v2; // eax@1 | |
8919 unsigned int v3; // ebp@1 | |
8920 signed int v4; // ebx@1 | |
8921 Actor *v5; // edi@2 | |
8922 unsigned int v6; // eax@3 | |
8923 int v8; // [sp+Ch] [bp-4h]@1 | |
8924 | |
8925 v1 = pTotalActors; | |
8926 v2 = GetAlertStatus(); | |
8927 v3 = 0; | |
8928 v4 = 0; | |
8929 *v1 = 0; | |
8930 v8 = v2; | |
8931 if ( (signed int)uNumActors > 0 ) | |
8932 { | |
1202 | 8933 v5 = pActors.data(); |
0 | 8934 do |
8935 { | |
8936 v6 = v5->uAttributes; | |
8937 if ( (v6 & 0x100000) == v8 ) | |
8938 { | |
8939 ++*v1; | |
303 | 8940 if ( v5->IsNotAlive() == 1 ) |
0 | 8941 ++v3; |
8942 } | |
8943 ++v4; | |
8944 ++v5; | |
8945 } | |
8946 while ( v4 < (signed int)uNumActors ); | |
8947 } | |
8948 return v3; | |
8949 } | |
8950 | |
8951 //----- (00408A7E) -------------------------------------------------------- | |
8952 unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID) | |
8953 { | |
8954 unsigned int *v2; // esi@1 | |
8955 signed int v3; // ebx@1 | |
82 | 8956 Actor *v4; // edi@2 |
0 | 8957 int v5; // eax@3 |
8958 int v7; // [sp+8h] [bp-Ch]@1 | |
8959 int v8; // [sp+Ch] [bp-8h]@1 | |
8960 unsigned int v9; // [sp+10h] [bp-4h]@1 | |
8961 | |
8962 v7 = uMonsterID; | |
8963 v2 = pTotalActors; | |
8964 v3 = 0; | |
8965 v8 = GetAlertStatus(); | |
8966 *v2 = 0; | |
8967 v9 = 0; | |
8968 if ( (signed int)uNumActors > 0 ) | |
8969 { | |
1202 | 8970 v4 = pActors.data();//[0].pMonsterInfo.uID; |
0 | 8971 do |
8972 { | |
82 | 8973 v5 = v4->uAttributes; // actor::attributes |
0 | 8974 if ( (v5 & 0x100000) == v8 ) |
8975 { | |
82 | 8976 if ( v4->pMonsterInfo.field_33 == v7 ) |
0 | 8977 { |
8978 ++*v2; | |
303 | 8979 if ( v4->IsNotAlive() == 1 ) |
0 | 8980 ++v9; |
8981 } | |
8982 } | |
8983 ++v3; | |
82 | 8984 ++v4; |
0 | 8985 } |
8986 while ( v3 < (signed int)uNumActors ); | |
8987 } | |
8988 return v9; | |
8989 } | |
8990 | |
8991 //----- (00408AE7) -------------------------------------------------------- | |
8992 unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup) | |
8993 { | |
8994 unsigned int *v2; // esi@1 | |
8995 signed int v3; // ebx@1 | |
82 | 8996 Actor *v4; // edi@2 |
0 | 8997 int v5; // eax@3 |
8998 unsigned int v7; // [sp+8h] [bp-Ch]@1 | |
8999 int v8; // [sp+Ch] [bp-8h]@1 | |
9000 unsigned int v9; // [sp+10h] [bp-4h]@1 | |
9001 | |
9002 v7 = uGroup; | |
9003 v2 = pTotalActors; | |
9004 v3 = 0; | |
9005 v8 = GetAlertStatus(); | |
9006 *v2 = 0; | |
9007 v9 = 0; | |
9008 if ( (signed int)uNumActors > 0 ) | |
9009 { | |
1202 | 9010 v4 = pActors.data();//[0].uGroup; |
0 | 9011 do |
9012 { | |
82 | 9013 v5 = v4->uAttributes; |
0 | 9014 if ( (v5 & 0x100000) == v8 ) |
9015 { | |
82 | 9016 if ( v4->uGroup == v7 ) |
0 | 9017 { |
9018 ++*v2; | |
303 | 9019 if ( v4->IsNotAlive() == 1 ) |
0 | 9020 ++v9; |
9021 } | |
9022 } | |
9023 ++v3; | |
82 | 9024 ++v4; |
0 | 9025 } |
9026 while ( v3 < (signed int)uNumActors ); | |
9027 } | |
9028 return v9; | |
9029 } | |
9030 | |
9031 //----- (00408B54) -------------------------------------------------------- | |
9032 unsigned int __fastcall SearchActorByID(unsigned int *pTotalActors, unsigned int a2) | |
9033 { | |
9034 unsigned int v2; // edi@1 | |
9035 unsigned int *v3; // esi@1 | |
9036 int v4; // eax@1 | |
9037 unsigned int v5; // ebx@1 | |
9038 unsigned int v6; // edx@1 | |
9039 | |
9040 v2 = a2; | |
9041 v3 = pTotalActors; | |
9042 v4 = GetAlertStatus(); | |
9043 v5 = 0; | |
9044 *v3 = 0; | |
9045 v6 = pActors[v2].uAttributes; | |
9046 if ( (v6 & 0x100000) == v4 ) | |
9047 { | |
9048 *v3 = 1; | |
303 | 9049 if ( pActors[v2].IsNotAlive() == 1 ) |
0 | 9050 v5 = 1; |
9051 } | |
9052 return v5; | |
9053 } | |
9054 | |
9055 | |
1183 | 9056 |
9057 | |
0 | 9058 |
9059 //----- (0040DEDB) -------------------------------------------------------- | |
9060 unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor) | |
9061 { | |
949 | 9062 return TargetColor((unsigned __int8)uColor, BYTE1(uColor), BYTE2(uColor)); |
0 | 9063 } |
9064 | |
9065 //----- (0040DEF3) -------------------------------------------------------- | |
949 | 9066 unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b ) |
983 | 9067 { |
688 | 9068 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) + |
9069 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) + | |
9070 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); | |
0 | 9071 } |
9072 | |
9073 //----- (0040DF3D) -------------------------------------------------------- | |
9074 void __cdecl CallRenderPresent() | |
9075 { | |
9076 pRenderer->Present(); | |
9077 } | |
9078 | |
9079 //----- (0040DFA7) -------------------------------------------------------- | |
9080 int __stdcall retzero_sub_40DFA7(int a1) | |
9081 { | |
9082 return 0; | |
9083 } | |
9084 // 40DFA7: using guessed type int __stdcall retzero_sub_40DFA7(int); | |
9085 | |
1184 | 9086 |
0 | 9087 |
9088 //----- (0040F82D) -------------------------------------------------------- | |
9089 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) | |
9090 { | |
973 | 9091 assert(uTextureId != -1); |
9092 ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue); | |
0 | 9093 } |
9094 | |
1160 | 9095 |
0 | 9096 |
9097 //----- (0040F89C) -------------------------------------------------------- | |
9098 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue) | |
9099 { | |
9100 void *v3; // eax@3 | |
9101 void *v4; // esi@5 | |
9102 int *v5; // edi@5 | |
9103 int v6; // eax@5 | |
9104 int v7; // ecx@6 | |
9105 Texture *v8; // [sp+Ch] [bp-14h]@1 | |
9106 int *v9; // [sp+10h] [bp-10h]@1 | |
9107 int v10; // [sp+14h] [bp-Ch]@1 | |
9108 int v11; // [sp+18h] [bp-8h]@1 | |
9109 void *v12; // [sp+1Ch] [bp-4h]@5 | |
9110 | |
9111 v10 = pTex->uTextureWidth; | |
9112 v8 = pTex; | |
9113 v9 = pZBuffer; | |
9114 v11 = pTex->uTextureHeight; | |
9115 if ( pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize ) | |
9116 v3 = pTex->UnzipPalette(); | |
9117 else | |
710 | 9118 v3 = pTex->pLevelOfDetail0_prolly_alpha_mask; |
0 | 9119 v12 = v3; |
9120 v4 = v3; | |
9121 v5 = v9; | |
9122 v6 = 0; | |
9123 do | |
9124 { | |
9125 v7 = v10; | |
9126 do | |
9127 { | |
9128 LOBYTE(v6) = *(char *)v4; | |
9129 v4 = (char *)v4 + 1; | |
9130 if ( v6 ) | |
9131 *v5 = uZValue; | |
9132 ++v5; | |
9133 --v7; | |
9134 } | |
9135 while ( v7 ); | |
9136 v5 += 640 - v10; | |
9137 --v11; | |
9138 } | |
9139 while ( v11 ); | |
9140 if ( pIcons_LOD->dword_011BA4 ) | |
9141 { | |
9142 if ( v8->uDecompressedSize ) | |
9143 free(v12); | |
9144 } | |
9145 } | |
9146 | |
9147 //----- (0040F92A) -------------------------------------------------------- | |
9148 void __fastcall sub_40F92A(int *pZBuffer, Texture *a2, int a3) | |
9149 { | |
9150 Texture *v3; // esi@1 | |
9151 void *v4; // eax@3 | |
9152 int *v5; // edi@5 | |
9153 int v6; // ecx@6 | |
9154 int *v7; // [sp+Ch] [bp-10h]@1 | |
9155 int v8; // [sp+10h] [bp-Ch]@1 | |
9156 int v9; // [sp+18h] [bp-4h]@1 | |
9157 | |
9158 v3 = a2; | |
9159 v7 = pZBuffer; | |
9160 v8 = a2->uTextureWidth; | |
9161 v9 = a2->uTextureHeight; | |
9162 if ( pIcons_LOD->dword_011BA4 && a2->uDecompressedSize ) | |
9163 v4 = a2->UnzipPalette(); | |
9164 else | |
710 | 9165 v4 = a2->pLevelOfDetail0_prolly_alpha_mask; |
0 | 9166 v5 = v7; |
9167 do | |
9168 { | |
9169 v6 = v8; | |
9170 do | |
9171 { | |
9172 *v5 = a3; | |
9173 ++v5; | |
9174 --v6; | |
9175 } | |
9176 while ( v6 ); | |
9177 v5 += 640 - v8; | |
9178 --v9; | |
9179 } | |
9180 while ( v9 ); | |
9181 if ( pIcons_LOD->dword_011BA4 ) | |
9182 { | |
9183 if ( v3->uDecompressedSize ) | |
9184 free(v4); | |
9185 } | |
9186 } | |
9187 | |
9188 | |
9189 | |
9190 | |
9191 | |
9192 | |
9193 | |
9194 | |
9195 | |
9196 | |
9197 | |
9198 | |
9199 | |
9200 | |
9201 //----- (00410AF5) -------------------------------------------------------- | |
9202 void __cdecl SetMoonPhaseNames() | |
9203 { | |
9204 aMoonPhaseNames[0] = pGlobalTXT_LocalizationStrings[150]; | |
9205 aMoonPhaseNames[1] = pGlobalTXT_LocalizationStrings[171]; | |
9206 aMoonPhaseNames[2] = pGlobalTXT_LocalizationStrings[102]; | |
9207 aMoonPhaseNames[3] = pGlobalTXT_LocalizationStrings[169]; | |
9208 aMoonPhaseNames[4] = pGlobalTXT_LocalizationStrings[92]; | |
9209 } | |
9210 | |
9211 | |
9212 //----- (00410D99) -------------------------------------------------------- | |
9213 signed int __fastcall sub_410D99_get_map_index(int a1) | |
9214 { | |
9215 int v1; // edi@1 | |
9216 signed int v2; // ebp@1 | |
9217 const char **v3; // esi@2 | |
9218 char *v4; // ebx@2 | |
9219 | |
9220 v1 = a1; | |
9221 v2 = 1; | |
1104 | 9222 if ( _stricmp(pMapStats->pInfos[1].pFilename, (const char *)&pGames_LOD->pSubIndices[a1]) ) |
0 | 9223 { |
9224 v3 = (const char **)&pMapStats->pInfos[1].pFilename; | |
9225 v4 = (char *)&pMapStats->pInfos[1].pFilename; | |
9226 do | |
9227 { | |
9228 if ( !*(int *)v4 ) | |
9229 break; | |
9230 v3 += 17; | |
9231 ++v2; | |
9232 v4 = (char *)v3; | |
9233 } | |
1104 | 9234 while ( _stricmp(*v3, (const char *)&pGames_LOD->pSubIndices[v1]) ); |
0 | 9235 } |
9236 return v2; | |
9237 } | |
9238 | |
9239 //----- (00410DEC) -------------------------------------------------------- | |
9240 unsigned int __cdecl DrawLloydBeaconsScreen() | |
9241 { | |
961 | 9242 Player *pPlayer; // esi@1 |
0 | 9243 char *v1; // eax@1 |
9244 unsigned __int16 v2; // ax@6 | |
9245 unsigned int result; // eax@11 | |
9246 unsigned int v4; // esi@13 | |
9247 unsigned int v5; // ecx@13 | |
9248 char v6; // zf@13 | |
9249 LloydBeacon *v7; // esi@14 | |
9250 int v8; // eax@14 | |
9251 unsigned __int64 v9; // kr08_8@14 | |
9252 unsigned int v10; // esi@14 | |
9253 unsigned int v11; // eax@14 | |
9254 char *v12; // eax@19 | |
9255 char *v13; // ecx@22 | |
9256 int v14; // eax@27 | |
9257 Texture *v19; // [sp-4h] [bp-8Ch]@4 | |
961 | 9258 GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1 |
0 | 9259 unsigned int v23; // [sp+64h] [bp-24h]@14 |
9260 __int64 v24; // [sp+68h] [bp-20h]@14 | |
9261 unsigned int v25; // [sp+70h] [bp-18h]@13 | |
9262 char *Str; // [sp+74h] [bp-14h]@14 | |
9263 int v27; // [sp+78h] [bp-10h]@11 | |
9264 LloydBeacon *v28; // [sp+7Ch] [bp-Ch]@12 | |
9265 RGBTexture *v29; // [sp+80h] [bp-8h]@12 | |
9266 int uNumMaxBeacons; // [sp+84h] [bp-4h]@6 | |
9267 | |
961 | 9268 pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid]; |
0 | 9269 pRenderer->DrawTextureIndexed(8u, 8u, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]); |
9270 v1 = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon | |
961 | 9271 pWindow.uFrameX = game_viewport_x; |
9272 pWindow.uFrameY = game_viewport_y; | |
9273 pWindow.uFrameWidth = 428; | |
9274 pWindow.uFrameHeight = game_viewport_height; | |
9275 pWindow.uFrameZ = 435; | |
9276 pWindow.uFrameW = game_viewport_w; | |
0 | 9277 if ( !bRecallingBeacon ) |
9278 v1 = pGlobalTXT_LocalizationStrings[375]; // Set Beacon | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
9279 sprintf(pTmpBuf.data(), "%s", v1); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
9280 pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf.data(), 3u); |
0 | 9281 if ( bRecallingBeacon ) |
9282 { | |
9283 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on); | |
9284 v19 = pTex_tab_an_6a__zoom_off; | |
9285 } | |
9286 else | |
9287 { | |
9288 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6a__zoom_off); | |
9289 v19 = pTex_tab_an_6b__zoom_on; | |
9290 } | |
9291 pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19); | |
961 | 9292 v2 = pPlayer->pActiveSkills[14]; |
0 | 9293 uNumMaxBeacons = 1; |
9294 if ( HIBYTE(v2) & 1 || (v2 & 0x80u) != 0 ) | |
9295 { | |
9296 uNumMaxBeacons = 5; | |
9297 } | |
9298 else | |
9299 { | |
9300 if ( v2 & 0x40 ) | |
9301 uNumMaxBeacons = 3; | |
9302 } | |
9303 result = 0; | |
9304 v27 = 0; | |
9305 if ( uNumMaxBeacons > 0 ) | |
9306 { | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
9307 v29 = pSavegameThumbnails.data(); |
961 | 9308 v28 = pPlayer->pInstalledBeacons; |
0 | 9309 while ( 1 ) |
9310 { | |
961 | 9311 pWindow.uFrameWidth = 92; |
0 | 9312 v4 = result; |
961 | 9313 pWindow.uFrameHeight = 68; |
0 | 9314 v5 = pLloydsBeaconsPreviewXs[result]; |
961 | 9315 pWindow.uFrameY = pLloydsBeaconsPreviewYs[result]; |
9316 v25 = pWindow.uFrameY; | |
9317 pWindow.uFrameX = v5; | |
9318 pWindow.uFrameW = pWindow.uFrameY + 67; | |
0 | 9319 v6 = v29->pPixels == 0; |
961 | 9320 pWindow.uFrameZ = v5 + 91; |
0 | 9321 if ( !v6 ) |
9322 break; | |
9323 if ( !bRecallingBeacon ) | |
9324 { | |
961 | 9325 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook); |
9326 v14 = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0); | |
9327 pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - v14 / 2, 1, pGlobalTXT_LocalizationStrings[19], 3); | |
0 | 9328 } |
9329 LABEL_29: | |
9330 ++v29; | |
9331 ++v28; | |
9332 result = v27++ + 1; | |
9333 if ( v27 >= uNumMaxBeacons ) | |
9334 goto LABEL_30; | |
9335 } | |
961 | 9336 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook); |
0 | 9337 pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[v4], pLloydsBeaconsPreviewYs[v4], v29); |
9338 v7 = v28; | |
9339 Str = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(v28->field_18))].pName; | |
961 | 9340 v8 = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0); |
9341 pWindow.uFrameY += -6 - v8; | |
9342 pWindow.DrawTitleText(pSpellFont, 0, 0, 1u, Str, 3u); | |
0 | 9343 v9 = v7->uBeaconTime - pParty->uTimePlayed; |
9344 LODWORD(v24) = LODWORD(v7->uBeaconTime) - LODWORD(pParty->uTimePlayed); | |
9345 HIDWORD(v24) = HIDWORD(v9); | |
9346 v23 = (unsigned __int64)((signed __int64)((double)v24 * 0.234375) / 60 / 60) >> 32; | |
9347 v10 = (signed __int64)((double)v24 * 0.234375) / 60 / 60; | |
9348 v11 = v10 / 0x18; | |
9349 if ( (unsigned int)((signed __int64)((double)v24 * 0.234375) / 60 / 60) / 0x18 ) | |
9350 { | |
9351 v13 = pGlobalTXT_LocalizationStrings[57]; // Days | |
9352 if ( v11 > 1 ) | |
9353 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
9354 sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13); |
961 | 9355 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
9356 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); |
0 | 9357 goto LABEL_29; |
9358 } | |
9359 } | |
9360 else | |
9361 { | |
9362 if ( (signed __int64)(__PAIR__(v23, v10) + 1) <= 23 ) | |
9363 { | |
9364 if ( (v23 & 0x80000000u) != 0 || (signed int)v23 <= 0 && v10 <= 1 ) | |
9365 v12 = pGlobalTXT_LocalizationStrings[109];// Hour | |
9366 else | |
9367 v12 = pGlobalTXT_LocalizationStrings[110];// Hours | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
9368 sprintf(pTmpBuf.data(), "%lu %s", v10 + 1, v12); |
961 | 9369 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
9370 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); |
961 | 9371 goto LABEL_29; |
0 | 9372 } |
9373 } | |
9374 v13 = pGlobalTXT_LocalizationStrings[56]; // Day | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
9375 sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13); |
961 | 9376 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
9377 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3); |
961 | 9378 goto LABEL_29; |
0 | 9379 } |
9380 LABEL_30: | |
9381 if ( byte_506360 ) | |
9382 { | |
437 | 9383 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 9384 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
9385 { | |
961 | 9386 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CloseAfterInstallBeacon; |
0 | 9387 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9388 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
9389 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; | |
9390 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 9391 }*/ |
961 | 9392 pMessageQueue_50CBD0->AddMessage(UIMSG_CloseAfterInstallBeacon, 0, 0); |
0 | 9393 } |
9394 return result; | |
9395 } | |
9396 | |
9397 | |
9398 //----- (00413FF1) -------------------------------------------------------- | |
995 | 9399 void SetMonthNames() |
0 | 9400 { |
9401 aMonthNames[0] = pGlobalTXT_LocalizationStrings[415]; | |
9402 aMonthNames[1] = pGlobalTXT_LocalizationStrings[416]; | |
9403 aMonthNames[2] = pGlobalTXT_LocalizationStrings[417]; | |
9404 aMonthNames[3] = pGlobalTXT_LocalizationStrings[418]; | |
9405 aMonthNames[4] = pGlobalTXT_LocalizationStrings[419]; | |
9406 aMonthNames[5] = pGlobalTXT_LocalizationStrings[420]; | |
9407 aMonthNames[6] = pGlobalTXT_LocalizationStrings[421]; | |
9408 aMonthNames[7] = pGlobalTXT_LocalizationStrings[422]; | |
9409 aMonthNames[8] = pGlobalTXT_LocalizationStrings[423]; | |
9410 aMonthNames[9] = pGlobalTXT_LocalizationStrings[424]; | |
9411 aMonthNames[10] = pGlobalTXT_LocalizationStrings[425]; | |
9412 aMonthNames[11] = pGlobalTXT_LocalizationStrings[426]; | |
9413 } | |
9414 | |
9415 //----- (0041406F) -------------------------------------------------------- | |
995 | 9416 void SetDayNames() |
0 | 9417 { |
9418 aDayNames[0] = pGlobalTXT_LocalizationStrings[145]; | |
9419 aDayNames[1] = pGlobalTXT_LocalizationStrings[230]; | |
9420 aDayNames[2] = pGlobalTXT_LocalizationStrings[243]; | |
9421 aDayNames[3] = pGlobalTXT_LocalizationStrings[227]; | |
9422 aDayNames[4] = pGlobalTXT_LocalizationStrings[91]; | |
9423 aDayNames[5] = pGlobalTXT_LocalizationStrings[188]; | |
9424 aDayNames[6] = pGlobalTXT_LocalizationStrings[222]; | |
9425 } | |
9426 | |
9427 //----- (004140BB) -------------------------------------------------------- | |
995 | 9428 void SetSpellSchoolNames() |
0 | 9429 { |
9430 aSpellSchoolNames[0] = pGlobalTXT_LocalizationStrings[87]; | |
9431 aSpellSchoolNames[1] = pGlobalTXT_LocalizationStrings[6]; | |
9432 aSpellSchoolNames[2] = pGlobalTXT_LocalizationStrings[240]; | |
9433 aSpellSchoolNames[3] = pGlobalTXT_LocalizationStrings[70]; | |
9434 aSpellSchoolNames[4] = pGlobalTXT_LocalizationStrings[214]; | |
9435 aSpellSchoolNames[5] = pGlobalTXT_LocalizationStrings[142]; | |
9436 aSpellSchoolNames[6] = pGlobalTXT_LocalizationStrings[29]; | |
9437 aSpellSchoolNames[7] = pGlobalTXT_LocalizationStrings[133]; | |
9438 aSpellSchoolNames[8] = pGlobalTXT_LocalizationStrings[54]; | |
9439 } | |
9440 | |
9441 //----- (0041411B) -------------------------------------------------------- | |
995 | 9442 void SetAttributeNames() |
0 | 9443 { |
9444 aAttributeNames[0] = pGlobalTXT_LocalizationStrings[144]; | |
9445 aAttributeNames[1] = pGlobalTXT_LocalizationStrings[116]; | |
9446 aAttributeNames[2] = pGlobalTXT_LocalizationStrings[163]; | |
9447 aAttributeNames[3] = pGlobalTXT_LocalizationStrings[75]; | |
9448 aAttributeNames[4] = pGlobalTXT_LocalizationStrings[1]; | |
9449 aAttributeNames[5] = pGlobalTXT_LocalizationStrings[211]; | |
9450 aAttributeNames[6] = pGlobalTXT_LocalizationStrings[136]; | |
9451 } | |
9452 | |
9453 //----- (00414162) -------------------------------------------------------- | |
995 | 9454 void uGameUIFontMain_initialize() |
0 | 9455 { |
949 | 9456 uGameUIFontMain = TargetColor(0xAu, 0, 0); |
0 | 9457 } |
9458 | |
9459 //----- (00414174) -------------------------------------------------------- | |
995 | 9460 void uGameUIFontShadow_initialize() |
0 | 9461 { |
949 | 9462 uGameUIFontShadow = TargetColor(0xE6u, 214u, 193u); |
0 | 9463 } |
9464 | |
9465 | |
9466 | |
9467 | |
9468 //----- (0041420D) -------------------------------------------------------- | |
9469 void __cdecl sub_41420D_press_esc() | |
9470 { | |
9471 GUIWindow v0; // [sp+4h] [bp-54h]@1 | |
9472 | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
9473 sprintf(pTmpBuf2.data(), "%s\n \n%s", ptr_507BDC->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
9474 v0.Hint = pTmpBuf2.data(); |
0 | 9475 v0.uFrameWidth = 400; |
9476 v0.uFrameHeight = 100; | |
9477 v0.uFrameX = 120; | |
9478 v0.uFrameY = 140; | |
9479 v0.uFrameZ = 519; | |
9480 v0.uFrameW = 239; | |
9481 v0.DrawMessageBox(0); | |
9482 } | |
9483 | |
9484 //----- (0041426F) -------------------------------------------------------- | |
9485 void __cdecl sub_41426F() | |
9486 { | |
9487 GUIWindow *v0; // ecx@1 | |
9488 | |
9489 v0 = ptr_507BDC; | |
437 | 9490 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BDC->ptr_1C, 0, 0); |
1038 | 9491 |
0 | 9492 v0->Release(); |
9493 ptr_507BDC = 0; | |
9494 pCurrentScreen = dword_506F0C[0]; | |
9495 pEventTimer->Resume(); | |
9496 } | |
9497 // 4E28F8: using guessed type int pCurrentScreen; | |
9498 | |
706 | 9499 |
9500 | |
762 | 9501 void LoadFonts_and_DrawCopyrightWindow() |
9502 { | |
9503 MainMenuUI_LoadFontsAndSomeStuff(); | |
9504 DrawCopyrightWindow(); | |
9505 } | |
0 | 9506 |
9507 //----- (00415485) -------------------------------------------------------- | |
573 | 9508 void DrawCopyrightWindow() |
0 | 9509 { |
9510 GUIWindow Dst; // [sp+8h] [bp-54h]@1 | |
9511 | |
9512 memset(&Dst, 0, 0x54u); | |
9513 Dst.uFrameWidth = 624; | |
9514 Dst.uFrameHeight = 256; | |
9515 Dst.uFrameX = 8; | |
9516 Dst.uFrameY = 30; // c 1999 The 3DO Company. | |
9517 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(pGlobalTXT_LocalizationStrings[157], &Dst, 24, 0) | |
9518 + 2 * LOBYTE(pFontSmallnum->uFontHeight) | |
9519 + 24; | |
9520 Dst.uFrameY = 470 - Dst.uFrameHeight; | |
9521 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
9522 Dst.uFrameW = 469; | |
1004 | 9523 //Dst.Hint = "abcagfdsgsg ljsrengvlkjesnfkjwnef"; |
0 | 9524 Dst.DrawMessageBox(0); |
1004 | 9525 |
0 | 9526 Dst.uFrameWidth -= 24; |
9527 Dst.uFrameX += 12; | |
9528 Dst.uFrameY += 12; | |
9529 Dst.uFrameHeight -= 12; | |
9530 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
9531 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
1004 | 9532 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3); |
0 | 9533 } |
9534 | |
9535 | |
9536 | |
9537 //----- (004156F0) -------------------------------------------------------- | |
1031 | 9538 void GUI_UpdateWindows() |
0 | 9539 { |
9540 GUIWindow *pWindow; // esi@4 | |
1033 | 9541 //unsigned int pWindowType; // eax@4 |
0 | 9542 char *pHint; // edx@66 |
9543 GUIButton *pButtonPtr_1C; // ebp@79 | |
4 | 9544 char *pHint1; // edx@80 |
0 | 9545 int v26; // eax@98 |
9546 unsigned int v27; // ebp@106 | |
9547 GUIWindow *pGUIWindow2; // ecx@109 | |
9548 GUIFont *pGUIFont; // ST1C_4@115 | |
9549 int v31; // eax@115 | |
959 | 9550 GUIButton *pButton; // ebp@118 |
0 | 9551 int v39; // eax@129 |
9552 unsigned int pNumMessages; // eax@142 | |
9553 GUIButton *pGUIButton; // ebp@146 | |
973 | 9554 //unsigned int pX; // [sp-1Ch] [bp-124h]@17 |
9555 //unsigned int pY; // [sp-18h] [bp-120h]@17 | |
9556 //Texture *pTexture; // [sp-14h] [bp-11Ch]@17 | |
9557 //Texture *pTexture2; // [sp-14h] [bp-11Ch]@86 | |
0 | 9558 int i; // [sp+0h] [bp-108h]@3 |
9559 ItemGen pItemGen; // [sp+4h] [bp-104h]@98 | |
9560 GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133 | |
9561 ItemGen ItemGen2; // [sp+E4h] [bp-24h]@129 | |
9562 | |
9563 if (GetCurrentMenuID() != MENU_CREATEPARTY) | |
972 | 9564 UI_OnKeyDown(VK_NEXT); |
9565 | |
0 | 9566 for ( i = 1; i <= uNumVisibleWindows; ++i ) |
9567 { | |
9568 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; | |
9569 switch (pWindow->eWindowType) | |
9570 { | |
970 | 9571 case WINDOW_OptionsButtons: |
962 | 9572 { |
973 | 9573 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y, |
9574 pViewport->uViewportTL_X, pIcons_LOD->GetTexture(uTextureID_Options)); | |
962 | 9575 viewparams->bRedrawGameUI = 1; |
9576 continue; | |
9577 } | |
970 | 9578 case WINDOW_CharacterRecord: |
962 | 9579 { |
991 | 9580 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]); |
962 | 9581 continue; |
9582 } | |
970 | 9583 case WINDOW_Options: |
962 | 9584 { |
1031 | 9585 GameMenuUI_Options_Draw(); |
962 | 9586 continue; |
9587 } | |
970 | 9588 case WINDOW_Book: |
962 | 9589 { |
995 | 9590 BookUI_Draw((WindowType)(int)pWindow->ptr_1C); |
962 | 9591 continue; |
9592 } | |
970 | 9593 case WINDOW_Dialogue: |
962 | 9594 { |
1033 | 9595 GameUI_DrawDialogue(); |
962 | 9596 continue; |
9597 } | |
970 | 9598 case WINDOW_QuickReference: |
962 | 9599 { |
991 | 9600 GameUI_QuickRef_Draw(); |
962 | 9601 continue; |
9602 } | |
970 | 9603 case WINDOW_Rest: |
962 | 9604 { |
9605 RestUI_Draw(); | |
9606 continue; | |
9607 } | |
970 | 9608 case WINDOW_ChangeLocation: |
962 | 9609 { |
9610 TravelUI_Draw(); | |
9611 continue; | |
9612 } | |
970 | 9613 case WINDOW_SpellBook: |
962 | 9614 { |
1004 | 9615 DrawSpellBookContent(pPlayers[uActiveCharacter]); |
962 | 9616 continue; |
9617 } | |
970 | 9618 case WINDOW_GreetingNPC: |
962 | 9619 { |
1033 | 9620 GameUI_DrawBranchlessDialogue(); |
962 | 9621 continue; |
9622 } | |
970 | 9623 case WINDOW_Chest: |
962 | 9624 { |
9625 if ( pCurrentScreen == SCREEN_CHEST ) | |
9626 { | |
9627 Chest::DrawChestUI((unsigned int)pWindow->ptr_1C); | |
9628 } | |
987 | 9629 else if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) |
962 | 9630 { |
9631 pRenderer->ClearZBuffer(0, 479); | |
9632 draw_leather(); | |
984 | 9633 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
973 | 9634 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId)); |
962 | 9635 } |
9636 continue; | |
9637 } | |
970 | 9638 case WINDOW_SaveLoadButtons: |
962 | 9639 { |
1033 | 9640 SaveUI_Draw(); |
962 | 9641 continue; |
9642 } | |
970 | 9643 case WINDOW_MainMenu_Load: |
961 | 9644 { |
1033 | 9645 LoadUI_Draw(); |
962 | 9646 continue; |
9647 } | |
970 | 9648 case WINDOW_HouseInterior: |
962 | 9649 { |
9650 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager(); | |
9651 if ( !window_SpeakInHouse ) | |
9652 continue; | |
970 | 9653 if ( (signed int)window_SpeakInHouse->ptr_1C >= 53 ) |
9654 continue; | |
9655 if ( pParty->field_3C._shop_ban_times[(signed int)window_SpeakInHouse->ptr_1C] <=pParty->uTimePlayed ) | |
962 | 9656 { |
970 | 9657 if ( (signed int)window_SpeakInHouse->ptr_1C < 53 ) |
9658 { | |
9659 pParty->field_3C._shop_ban_times[(signed int)window_SpeakInHouse->ptr_1C] = 0; | |
962 | 9660 } |
9661 continue; | |
9662 } | |
9663 pNumMessages = pMessageQueue_50CBD0->uNumMessages; | |
9664 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
9665 continue; | |
9666 } | |
970 | 9667 case WINDOW_Transition: |
962 | 9668 { |
9669 TransitionUI_Draw(); | |
9670 continue; | |
9671 } | |
970 | 9672 case WINDOW_Scroll: |
962 | 9673 { |
9674 CreateScrollWindow(); | |
9675 continue; | |
9676 } | |
970 | 9677 case WINDOW_CastSpell_InInventory: |
962 | 9678 { |
9679 pRenderer->ClearZBuffer(0, 479); | |
9680 draw_leather(); | |
984 | 9681 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
991 | 9682 CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]); |
973 | 9683 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u)); |
962 | 9684 continue; |
9685 } | |
970 | 9686 case WINDOW_FinalWindow: |
962 | 9687 { |
9688 sub_41420D_press_esc(); | |
9689 continue; | |
9690 } | |
970 | 9691 case WINDOW_50: |
962 | 9692 { |
9693 v27 = TargetColor(255, 255, 255); | |
1038 | 9694 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
962 | 9695 { |
9696 ptr_507BD0->DrawMessageBox(0); | |
9697 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
9698 v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); | |
9699 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate); | |
9700 continue; | |
9701 } | |
1038 | 9702 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) |
962 | 9703 { |
1038 | 9704 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
962 | 9705 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); |
9706 pEventTimer->Resume(); | |
9707 ptr_507BD0->Release(); | |
1038 | 9708 pCurrentScreen = SCREEN_GAME; |
9709 viewparams->bRedrawGameUI = true; | |
962 | 9710 continue; |
9711 } | |
1038 | 9712 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) |
962 | 9713 { |
1038 | 9714 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
962 | 9715 pEventTimer->Resume(); |
9716 ptr_507BD0->Release(); | |
9717 continue; | |
9718 } | |
9719 } | |
970 | 9720 case WINDOW_59: |
962 | 9721 { |
9722 pWindow->DrawMessageBox(0); | |
9723 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | |
9724 pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
9725 if ( !pKeyActionMap->field_204 ) | |
9726 { | |
9727 ItemGen2.Reset(); | |
9728 pWindow->Release(); | |
9729 pEventTimer->Resume(); | |
9730 pCurrentScreen = 0; | |
1038 | 9731 viewparams->bRedrawGameUI = true; |
962 | 9732 v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); |
9733 if ( v26 > 0 ) | |
9734 { | |
9735 if ( v26 < 800 ) | |
9736 { | |
9737 ItemGen2.uAttributes |= 1u; | |
9738 ItemGen2.uItemID = v26; | |
9739 if ( pItemsTable->pItems[v26].uEquipType == 12 ) | |
9740 { | |
9741 ItemGen2.uNumCharges = rand() % 6 + pItemsTable->pItems[ItemGen2.uItemID].uDamageMod + 1; | |
9742 ItemGen2.uMaxCharges = LOBYTE(ItemGen2.uNumCharges); | |
9743 } | |
9744 else | |
9745 { | |
9746 if ( v26 >= 221 && v26 < 271 ) | |
9747 ItemGen2.uEnchantmentType = rand() % 10 + 1; | |
9748 } | |
9749 pItemsTable->SetSpecialBonus(&ItemGen2); | |
9750 pParty->SetHoldingItem(&ItemGen2); | |
9751 } | |
9752 } | |
9753 } | |
9754 continue; | |
9755 } | |
970 | 9756 case WINDOW_PressedButton2: |
962 | 9757 { |
9758 if ( pWindow->Hint != (char *)1 ) | |
9759 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
9760 pButton = (GUIButton *)pWindow->ptr_1C; | |
9761 if ( pButton->uX >= 0 && pButton->uX <= 640 ) | |
9762 { | |
9763 if ( pButton->uY >= 0 && pButton->uY <= 480 ) | |
9764 { | |
9765 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
9766 viewparams->bRedrawGameUI = 1; | |
9767 if ( pWindow->Hint ) | |
9768 { | |
970 | 9769 if ( pWindow->Hint != (char *)1 ) |
962 | 9770 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
9771 } | |
9772 pWindow->Release(); | |
9773 continue; | |
9774 } | |
9775 } | |
9776 viewparams->bRedrawGameUI = 1; | |
9777 if ( pWindow->Hint ) | |
9778 { | |
970 | 9779 if ( pWindow->Hint != (char *)1 ) |
962 | 9780 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
9781 } | |
9782 pWindow->Release(); | |
9783 continue; | |
9784 } | |
970 | 9785 case WINDOW_CharactersPressedButton: |
962 | 9786 { |
9787 if ( pWindow->Hint != (char *)1 ) | |
9788 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
9789 pButton = (GUIButton *)pWindow->ptr_1C; | |
9790 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
9791 viewparams->bRedrawGameUI = 1; | |
9792 if ( pWindow->Hint ) | |
9793 { | |
970 | 9794 if ( pWindow->Hint != (char *)1 ) |
962 | 9795 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
9796 } | |
9797 pWindow->Release(); | |
9798 continue; | |
9799 } | |
970 | 9800 case WINDOW_PressedButton: |
962 | 9801 { |
9802 if ( pWindow->Hint != (char *)1 ) | |
9803 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
9804 pButton = (GUIButton *)pWindow->ptr_1C; | |
9805 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
9806 viewparams->bRedrawGameUI = 1; | |
9807 if ( pWindow->Hint ) | |
9808 { | |
970 | 9809 if ( pWindow->Hint != (char *)1 ) |
962 | 9810 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
9811 } | |
9812 pWindow->Release(); | |
9813 continue; | |
9814 } | |
970 | 9815 case WINDOW_5D: |
962 | 9816 { |
9817 if ( pWindow->Hint != (char *)1 ) | |
9818 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
9819 pButton = (GUIButton *)pWindow->ptr_1C; | |
9820 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
9821 viewparams->bRedrawGameUI = 1; | |
9822 pWindow->Release(); | |
9823 continue; | |
9824 } | |
970 | 9825 case WINDOW_SaveLoadBtn: |
961 | 9826 { |
9827 if (pWindow->Hint != (char *)1) | |
9828 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
962 | 9829 pButton = (GUIButton *)pWindow->ptr_1C; |
9830 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
961 | 9831 pHint = pWindow->Hint; |
9832 viewparams->bRedrawGameUI = 1; | |
9833 if ( pHint && pHint != (char *)1 ) | |
962 | 9834 pButton->DrawLabel(pHint, pFontCreate, 0, 0); |
961 | 9835 pWindow->Release(); |
9836 if (pCurrentScreen == SCREEN_SAVEGAME) | |
9837 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0); | |
9838 else | |
9839 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); | |
962 | 9840 continue; |
9841 } | |
970 | 9842 case WINDOW_LoadGame_CancelBtn: |
962 | 9843 { |
9844 if ( pWindow->Hint != (char *)1 ) | |
9845 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
9846 pButton = (GUIButton *)pWindow->ptr_1C; | |
9847 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
9848 viewparams->bRedrawGameUI = 1; | |
9849 if ( pWindow->Hint && pWindow->Hint != (char *)1 ) | |
9850 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
9851 pWindow->Release(); | |
9852 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
9853 continue; | |
9854 } | |
970 | 9855 case WINDOW_CloseRestWindowBtn: |
962 | 9856 { |
9857 if ( pWindow->Hint != (char *)1 ) | |
9858 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
9859 pGUIButton = (GUIButton *)pWindow->ptr_1C; | |
9860 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]); | |
9861 pHint = pWindow->Hint; | |
9862 viewparams->bRedrawGameUI = 1; | |
9863 if ( pHint && pHint != (char *)1 ) | |
9864 pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
9865 pWindow->Release(); | |
9866 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
9867 continue; | |
9868 } | |
970 | 9869 case WINDOW_ExitCharacterWindow: |
962 | 9870 { |
9871 if ( pWindow->Hint != (char *)1 ) | |
9872 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
9873 pButton = (GUIButton *)pWindow->ptr_1C; | |
9874 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
9875 pHint = pWindow->Hint; | |
9876 viewparams->bRedrawGameUI = 1; | |
9877 if ( pHint && pHint != (char *)1 ) | |
9878 pButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
9879 pWindow->Release(); | |
9880 pNumMessages = pMessageQueue_50CBD0->uNumMessages; | |
9881 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
9882 continue; | |
9883 } | |
970 | 9884 case WINDOW_RestWindow: |
962 | 9885 { |
9886 memset(&GUIButton2, 0, 0xBCu); | |
9887 GUIButton2.uZ = 197; | |
9888 GUIButton2.uW = 197; | |
9889 GUIButton2.uX = 27; | |
9890 GUIButton2.uY = 161; | |
9891 GUIButton2.uWidth = 171; | |
9892 GUIButton2.uHeight = 37; | |
9893 GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent; | |
9894 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
9895 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15)); | |
9896 viewparams->bRedrawGameUI = 1; | |
9897 GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);//Îòäûõ è ëå÷åíèå 8 ÷àñîâ | |
9898 GUIButton2.pParent = 0; | |
9899 pGUIWindow2 = pWindow; | |
9900 pGUIWindow2->Release(); | |
9901 continue; | |
9902 } | |
970 | 9903 case WINDOW_BooksWindow: |
962 | 9904 { |
9905 pButton = (GUIButton *)pWindow->ptr_1C; | |
973 | 9906 pRenderer->DrawTextureIndexed(pWindow->uFrameY, |
9907 pWindow->uFrameX, pButton->pTextures[0]); | |
1033 | 9908 viewparams->bRedrawGameUI = true; |
962 | 9909 continue; |
9910 } | |
970 | 9911 case WINDOW_CharacterWindow_Inventory: |
962 | 9912 { |
9913 pWindow->DrawMessageBox(0); | |
9914 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | |
9915 pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
9916 if ( !pKeyActionMap->field_204 ) | |
9917 { | |
9918 ItemGen2.Reset(); | |
9919 pWindow->Release(); | |
9920 pEventTimer->Resume(); | |
9921 pCurrentScreen = SCREEN_GAME; | |
9922 viewparams->bRedrawGameUI = 1; | |
9923 v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
9924 if ( v39 > 0 ) | |
9925 { | |
9926 if ( v39 < 800 ) | |
9927 SpawnActor(v39); | |
9928 } | |
9929 } | |
9930 continue; | |
9931 } | |
970 | 9932 case WINDOW_KeyMappingOptions: |
962 | 9933 { |
9934 GameMenuUI_DrawKeyBindings(); | |
9935 continue; | |
9936 } | |
970 | 9937 case WINDOW_VideoOptions: |
962 | 9938 { |
9939 GameMenuUI_DrawVideoOptions(); | |
9940 continue; | |
9941 } | |
9942 default: | |
9943 { | |
9944 continue; | |
9945 } | |
9946 } | |
0 | 9947 } |
9948 if ( GetCurrentMenuID() == -1 ) | |
9949 GameUI_DrawFoodAndGold(); | |
9950 if ( sub_4637E0_is_there_popup_onscreen() ) | |
9951 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0); | |
9952 } | |
9953 | |
9954 //----- (00416196) -------------------------------------------------------- | |
1033 | 9955 void identify_item() |
0 | 9956 { |
9957 Player *v0; // esi@2 | |
9958 POINT *v1; // edi@2 | |
9959 signed int v2; // ecx@5 | |
9960 signed int v3; // eax@5 | |
9961 int v4; // eax@5 | |
9962 char v5; // sf@5 | |
9963 int v6; // eax@5 | |
9964 int v7; // eax@7 | |
9965 unsigned __int16 v8; // ax@10 | |
9966 int v9; // edi@10 | |
9967 int v10; // eax@10 | |
9968 int v11; // edx@13 | |
9969 LONG v12; // edx@23 | |
9970 signed int v13; // edx@23 | |
9971 int v14; // edx@25 | |
9972 unsigned int v15; // edi@25 | |
9973 signed int v16; // edx@27 | |
9974 int v17; // eax@54 | |
9975 unsigned int v18; // edx@57 | |
9976 int v19; // eax@65 | |
9977 int v20; // edi@67 | |
9978 int v21; // eax@72 | |
9979 int v22; // ecx@74 | |
9980 int v23; // edx@78 | |
9981 int v24; // eax@79 | |
9982 int v25; // eax@80 | |
9983 int v26; // eax@84 | |
9984 ItemGen *v27; // esi@98 | |
9985 unsigned int v28; // eax@98 | |
9986 ItemGen *v29; // edi@98 | |
9987 unsigned int v30; // ecx@103 | |
9988 double v31; // st7@112 | |
9989 unsigned __int64 v32; // qax@113 | |
9990 unsigned int v33; // ecx@117 | |
9991 int v34; // eax@126 | |
9992 unsigned int v35; // ecx@127 | |
9993 double v36; // st7@132 | |
9994 signed __int64 v37; // qax@135 | |
9995 unsigned int v38; // eax@138 | |
9996 Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 | |
9997 int *v40; // [sp-Ch] [bp-9Ch]@83 | |
9998 int *v41; // [sp-8h] [bp-98h]@83 | |
9999 int *v42; // [sp-4h] [bp-94h]@83 | |
10000 GUIWindow v43; // [sp+Ch] [bp-84h]@137 | |
10001 unsigned int pY; // [sp+60h] [bp-30h]@2 | |
10002 int v45; // [sp+64h] [bp-2Ch]@10 | |
10003 unsigned int pX; // [sp+68h] [bp-28h]@2 | |
10004 int v47; // [sp+6Ch] [bp-24h]@25 | |
10005 POINT y; // [sp+70h] [bp-20h]@2 | |
10006 POINT a2; // [sp+78h] [bp-18h]@2 | |
10007 Vec3_int_ pOut; // [sp+80h] [bp-10h]@2 | |
10008 unsigned int v51; // [sp+8Ch] [bp-4h]@23 | |
10009 | |
10010 if ( dword_50CDCC ) | |
10011 return; | |
10012 v0 = pPlayers[uActiveCharacter]; | |
10013 v1 = pMouse->GetCursorPos(&a2); | |
10014 pOut.z = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&y)->y]] & 0xFFFF; | |
10015 pMouse->GetClickPos(&pX, &pY); | |
10016 if ( !pOut.z ) | |
10017 { | |
10018 if ( (signed int)pX <= 13 | |
10019 || (signed int)pX >= 462 | |
10020 || (v2 = pX - 14, | |
10021 v3 = pY - 17, | |
10022 pX = v2, | |
10023 pY = v3, | |
10024 v4 = 14 * (v3 >> 5), | |
10025 v2 >>= 5, | |
10026 v5 = v2 + v4 < 0, | |
10027 v6 = v2 + v4, | |
10028 pOut.z = v6, | |
10029 v5) | |
10030 || v6 > 126 | |
10031 || (v7 = v0->GetItemIDAtInventoryIndex(&pOut.z)) == 0 ) | |
10032 return; | |
10033 pOut.z = v7; | |
10034 } | |
10035 if ( !v0->CanAct() ) | |
10036 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
10037 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
|
10038 v43.Hint = pTmpBuf.data(); |
0 | 10039 v43.uFrameWidth = 384; |
10040 v43.uFrameHeight = 180; | |
10041 v43.uFrameY = 40; | |
10042 if ( pMouse->GetCursorPos(&a2)->x <= 320 ) | |
10043 v38 = pMouse->GetCursorPos(&a2)->x + 30; | |
10044 else | |
10045 v38 = pMouse->GetCursorPos(&a2)->x - 414; | |
10046 v43.uFrameX = v38; | |
10047 v43.DrawMessageBox(0); | |
10048 return; | |
10049 } | |
10050 --pOut.z; | |
10051 LOBYTE(v8) = v0->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY); | |
10052 v9 = v8 & 0x3F; | |
10053 v45 = v8 & 0x3F; | |
10054 pOut.y = SkillToMastery(v8); | |
10055 v10 = pOut.z; | |
10056 if ( pParty->pPickedItem.uItemID == 220 ) | |
10057 { | |
10058 LABEL_116: | |
10059 GameUI_DrawItemInfo(&v0->pInventoryItems[v10]); | |
10060 return; | |
10061 } | |
10062 if ( (signed int)pParty->pPickedItem.uItemID < 200 | |
10063 || (signed int)pParty->pPickedItem.uItemID > 219 | |
10064 || (v11 = (int)((char *)v0 + 36 * pOut.z), *(int *)(v11 + 532) != 220) ) | |
10065 { | |
10066 if ( (signed int)pParty->pPickedItem.uItemID < 221 | |
10067 || (signed int)pParty->pPickedItem.uItemID > 271 | |
10068 || (v12 = (LONG)((char *)v0 + 36 * pOut.z), a2.y = v12, v13 = *(int *)(v12 + 532), v51 = v13, v13 < 221) | |
10069 || v13 > 271 ) | |
10070 { | |
10071 if ( pParty->pPickedItem.uItemID != 236 | |
10072 && ((signed int)pParty->pPickedItem.uItemID < 246 || (signed int)pParty->pPickedItem.uItemID > 250) | |
10073 && pParty->pPickedItem.uItemID != 263 | |
10074 && pParty->pPickedItem.uItemID != 233 ) | |
10075 goto LABEL_116; | |
10076 v27 = &v0->pInventoryItems[pOut.z]; | |
10077 v28 = v27->uItemID; | |
10078 v51 = pItemsTable->pItems[v27->uItemID].uEquipType; | |
570 | 10079 v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEnchantmentType); |
0 | 10080 if ( pParty->pPickedItem.uItemID != 233 ) |
10081 { | |
10082 if ( pParty->pPickedItem.uItemID == 236 ) | |
10083 { | |
10084 v35 = v27->uAttributes; | |
10085 if ( v35 & 2 || (v51 & 0x80000000u) != 0 || (signed int)v51 > 12 || (signed int)v28 >= 500 ) | |
10086 goto LABEL_92; | |
10087 LOWORD(v35) = v35 | 0x210; | |
10088 v27->uAttributes = v35; | |
10089 } | |
10090 else | |
10091 { | |
10092 if ( (signed int)pParty->pPickedItem.uItemID <= 245 ) | |
10093 goto LABEL_92; | |
10094 if ( (signed int)pParty->pPickedItem.uItemID <= 250 ) | |
10095 { | |
10096 v27->UpdateTempBonus(pParty->uTimePlayed); | |
10097 v33 = v27->uItemID; | |
10098 if ( (signed int)v27->uItemID >= 64 && (signed int)v33 <= 65 | |
10099 || (pOut.y = v27->uAttributes, pOut.y & 2) | |
377 | 10100 || v27->uSpecEnchantmentType |
570 | 10101 || v27->uEnchantmentType |
0 | 10102 || v51 && v51 != 1 && v51 != 2 |
10103 || (signed int)v33 >= 500 ) | |
10104 goto LABEL_92; | |
10105 v34 = *(int *)&aSbwb00[4 * pParty->pPickedItem.uItemID + 4]; | |
10106 a2.y = (int)v29 << 7; | |
10107 v31 = (double)(signed int)((int)v29 << 7); | |
377 | 10108 v27->uSpecEnchantmentType = v34; |
0 | 10109 } |
10110 else | |
10111 { | |
10112 if ( pParty->pPickedItem.uItemID != 263 | |
10113 || (v27->UpdateTempBonus(pParty->uTimePlayed), v30 = v27->uItemID, (signed int)v27->uItemID >= 64) | |
10114 && (signed int)v30 <= 65 | |
10115 || (pOut.y = v27->uAttributes, pOut.y & 2) | |
377 | 10116 || v27->uSpecEnchantmentType |
570 | 10117 || v27->uEnchantmentType |
0 | 10118 || v51 && v51 != 1 && v51 != 2 |
10119 || (signed int)v30 >= 500 ) | |
10120 goto LABEL_92; | |
10121 a2.y = (int)v29 << 7; | |
377 | 10122 v27->uSpecEnchantmentType = 40; |
0 | 10123 v31 = (double)a2.y; |
10124 } | |
10125 v32 = pParty->uTimePlayed + (signed int)(signed __int64)(v31 * 0.033333335); | |
10126 LODWORD(v27->uExpireTime) = v32; | |
10127 LODWORD(v32) = pOut.y; | |
10128 LOBYTE(v32) = LOBYTE(pOut.y) | 0x18; | |
10129 HIDWORD(v27->uExpireTime) = HIDWORD(v32); | |
10130 v27->uAttributes = v32; | |
10131 } | |
984 | 10132 _50C9A8_item_enchantment_timer = 256; |
0 | 10133 goto LABEL_92; |
10134 } | |
570 | 10135 v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; |
0 | 10136 if ( v36 < 0.0 ) |
10137 v36 = 0.0; | |
10138 if ( v51 != 12 ) | |
10139 { | |
10140 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
10141 return; | |
10142 } | |
10143 a2.y = v27->uMaxCharges; | |
10144 v37 = (signed __int64)((double)a2.y - v36 * (double)a2.y); | |
10145 v27->uMaxCharges = v37; | |
10146 v27->uNumCharges = (unsigned __int8)v37; | |
10147 goto LABEL_92; | |
10148 } | |
10149 v14 = v13 - 222; | |
10150 v15 = pParty->pPickedItem.uItemID - 222; | |
10151 v47 = v14; | |
10152 y.y = 0; | |
10153 if ( pParty->pPickedItem.uItemID == 221 || v51 == 221 ) | |
10154 { | |
10155 v16 = 5; | |
10156 } | |
10157 else | |
10158 { | |
10159 v16 = *(short *)&pItemsTable->field_EDE0[2 * (v14 + 50 * v15) + 388]; | |
10160 v10 = pOut.z; | |
10161 } | |
10162 v51 = v16; | |
10163 if ( v45 ) | |
10164 { | |
10165 if ( v16 < 225 || v16 > 227 ) | |
10166 { | |
10167 if ( v16 < 228 || v16 > 239 ) | |
10168 { | |
10169 if ( v16 < 240 || v16 > 261 ) | |
10170 { | |
10171 if ( v16 >= 262 && pOut.y != 4 ) | |
10172 { | |
10173 LABEL_53: | |
10174 v51 = 4; | |
10175 goto LABEL_54; | |
10176 } | |
10177 } | |
10178 else | |
10179 { | |
10180 if ( pOut.y <= 2 ) | |
10181 { | |
10182 LABEL_38: | |
10183 v51 = 3; | |
10184 goto LABEL_54; | |
10185 } | |
10186 } | |
10187 } | |
10188 else | |
10189 { | |
10190 if ( pOut.y == 1 ) | |
10191 { | |
10192 LABEL_35: | |
10193 v51 = 2; | |
10194 goto LABEL_54; | |
10195 } | |
10196 } | |
10197 } | |
10198 } | |
10199 else | |
10200 { | |
10201 if ( v16 >= 225 && v16 <= 227 ) | |
10202 { | |
10203 v51 = 1; | |
10204 goto LABEL_54; | |
10205 } | |
10206 if ( v16 >= 228 && v16 <= 239 ) | |
10207 goto LABEL_35; | |
10208 if ( v16 >= 240 && v16 <= 261 ) | |
10209 goto LABEL_38; | |
10210 if ( v16 >= 262 ) | |
10211 goto LABEL_53; | |
10212 } | |
10213 LABEL_54: | |
10214 pOut.y = 0; | |
10215 pOut.x = v10 + 1; | |
10216 v17 = (int)v0->pInventoryIndices; | |
10217 while ( *(int *)v17 != pOut.x ) | |
10218 { | |
10219 ++pOut.y; | |
10220 v17 += 4; | |
10221 if ( pOut.y >= 126 ) | |
10222 { | |
10223 v18 = y.y; | |
10224 goto LABEL_59; | |
10225 } | |
10226 } | |
10227 v18 = pOut.y; | |
10228 LABEL_59: | |
10229 if ( !v51 ) | |
10230 { | |
10231 LABEL_115: | |
10232 v10 = pOut.z; | |
10233 goto LABEL_116; | |
10234 } | |
10235 if ( v51 == 1 ) | |
10236 { | |
10237 v0->RemoveItemAtInventoryIndex(v18); | |
10238 v26 = rand(); | |
1036 | 10239 v0->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); |
0 | 10240 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); |
437 | 10241 |
10242 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1033 | 10243 |
0 | 10244 v42 = (int *)&a2.y; |
10245 v41 = (int *)&y.y; | |
10246 v40 = (int *)&pOut; | |
10247 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
10248 } | |
10249 else | |
10250 { | |
10251 if ( v51 == 2 ) | |
10252 { | |
10253 v0->RemoveItemAtInventoryIndex(v18); | |
10254 v25 = rand(); | |
1036 | 10255 v0->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); |
0 | 10256 v23 = 1; |
10257 } | |
10258 else | |
10259 { | |
10260 if ( v51 == 3 ) | |
10261 { | |
10262 v0->RemoveItemAtInventoryIndex(v18); | |
10263 v24 = rand(); | |
1036 | 10264 v0->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); |
0 | 10265 v23 = 5; |
10266 } | |
10267 else | |
10268 { | |
10269 if ( v51 != 4 ) | |
10270 { | |
10271 if ( v51 != 5 ) | |
10272 { | |
1014 | 10273 v19 = v0->AddItem(-1, 0xDCu); |
0 | 10274 if ( v19 ) |
1019 | 10275 // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; |
10276 v0->pOwnItems[v19-1].uAttributes=ITEM_IDENTIFIED; | |
0 | 10277 v20 = v47 + 50 * v15; |
10278 v0->pInventoryItems[pOut.z].uItemID = v51; | |
570 | 10279 v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType |
10280 + v0->pInventoryItems[pOut.z].uEnchantmentType) | |
0 | 10281 / 2; |
222 | 10282 v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 |
0 | 10283 LABEL_74: |
10284 v22 = (int)((char *)v0 + 36 * pOut.z); | |
222 | 10285 if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) |
0 | 10286 *(int *)(v22 + 552) |= 1u; |
10287 if ( !dword_4E455C ) | |
10288 goto LABEL_92; | |
187 | 10289 v0->PlaySound(SPEECH_16, 0); |
0 | 10290 goto LABEL_91; |
10291 } | |
10292 if ( v45 ) | |
10293 { | |
10294 if ( *(int *)(a2.y + 532) == 221 ) | |
10295 *(int *)(a2.y + 532) = pParty->pPickedItem.uItemID; | |
10296 else | |
570 | 10297 *(int *)(a2.y + 536) = pParty->pPickedItem.uEnchantmentType; |
1014 | 10298 v21 = v0->AddItem(-1, 0xDCu); |
0 | 10299 if ( v21 ) |
1019 | 10300 //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; |
10301 v0->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; | |
0 | 10302 goto LABEL_74; |
10303 } | |
10304 goto LABEL_115; | |
10305 } | |
10306 v0->RemoveItemAtInventoryIndex(v18); | |
10307 v0->SetCondition(0x10u, 0); | |
10308 v23 = 0; | |
10309 } | |
10310 } | |
1012 | 10311 v0->ItemsEnchant(v23); |
0 | 10312 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); |
437 | 10313 |
10314 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1033 | 10315 |
0 | 10316 v42 = (int *)&a2.y; |
10317 v41 = (int *)&y.y; | |
10318 v40 = (int *)&pOut; | |
10319 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
10320 } | |
10321 *(_QWORD *)&v39.x = *(_QWORD *)&pParty->vPosition.x; | |
10322 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, v40, v41, v42); | |
10323 sub_42F7EB_DropItemAt(0x41Bu, pOut.x, y.y, a2.y, 0, 1, 0, 0, 0); | |
10324 if ( dword_4E455C ) | |
10325 { | |
10326 if ( v0->CanAct() ) | |
187 | 10327 v0->PlaySound(SPEECH_17, 0); |
0 | 10328 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); |
10329 LABEL_91: | |
10330 dword_4E455C = 0; | |
10331 } | |
10332 LABEL_92: | |
10333 pMouse->RemoveHoldingItem(); | |
10334 dword_50CDCC = 1; | |
10335 return; | |
10336 } | |
10337 *(int *)(v11 + 536) = v9 + pItemsTable->pItems[pParty->pPickedItem.uItemID].uDamageDice; | |
10338 switch ( pParty->pPickedItem.uItemID ) | |
10339 { | |
10340 case 0xC8u: | |
10341 case 0xC9u: | |
10342 case 0xCAu: | |
10343 case 0xCBu: | |
10344 case 0xCCu: | |
10345 v0->pInventoryItems[pOut.z].uItemID = 222; | |
10346 break; | |
10347 case 0xCDu: | |
10348 case 0xCEu: | |
10349 case 0xCFu: | |
10350 case 0xD0u: | |
10351 case 0xD1u: | |
10352 v0->pInventoryItems[pOut.z].uItemID = 223; | |
10353 break; | |
10354 case 0xD2u: | |
10355 case 0xD3u: | |
10356 case 0xD4u: | |
10357 case 0xD5u: | |
10358 case 0xD6u: | |
10359 v0->pInventoryItems[pOut.z].uItemID = 224; | |
10360 break; | |
10361 case 0xD7u: | |
10362 case 0xD8u: | |
10363 case 0xD9u: | |
10364 case 0xDAu: | |
10365 case 0xDBu: | |
10366 v0->pInventoryItems[pOut.z].uItemID = 221; | |
10367 break; | |
10368 default: | |
10369 break; | |
10370 } | |
10371 pMouse->RemoveHoldingItem(); | |
10372 dword_50CDCC = 1; | |
10373 if ( dword_4E455C ) | |
10374 { | |
187 | 10375 v0->PlaySound(SPEECH_16, 0); |
0 | 10376 dword_4E455C = 0; |
10377 } | |
10378 } | |
10379 | |
10380 | |
10381 | |
706 | 10382 |
0 | 10383 |
10384 //----- (004175C0) -------------------------------------------------------- | |
141 | 10385 void UI_OnMouseLeftClick(int *pXY) |
0 | 10386 { |
10387 int *pXY_; // esi@1 | |
10388 signed int y; // eax@7 | |
10389 signed int x; // ecx@7 | |
10390 unsigned int v4; // eax@11 | |
10391 signed int v5; // eax@17 | |
10392 signed int v6; // esi@19 | |
10393 int v7; // esi@30 | |
10394 GUIWindow *v8; // edx@31 | |
10395 GUIButton *i; // esi@37 | |
10396 signed int v10; // eax@50 | |
10397 int v11; // ecx@52 | |
10398 unsigned int pX; // [sp+14h] [bp-8h]@7 | |
10399 unsigned int pY; // [sp+18h] [bp-4h]@7 | |
10400 | |
10401 pXY_ = pXY; | |
151 | 10402 if ( pCurrentScreen == SCREEN_VIDEO |
0 | 10403 || sub_4637E0_is_there_popup_onscreen() ) |
10404 return; | |
10405 if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 ) | |
10406 { | |
10407 sub_4452BB(); | |
10408 return; | |
10409 } | |
10410 if ( pXY_ ) | |
10411 { | |
10412 x = *pXY_; | |
10413 y = pXY_[1]; | |
10414 pX = *pXY_; | |
10415 pY = y; | |
10416 } | |
10417 else | |
10418 { | |
10419 pMouse->GetClickPos(&pX, &pY); | |
10420 y = pY; | |
10421 x = pX; | |
10422 } | |
271 | 10423 if ( pCurrentScreen != SCREEN_GAME || !dword_507B98_ctrl_pressed ) |
0 | 10424 goto LABEL_30; |
10425 v4 = GetCurrentMenuID(); | |
10426 x = pX; | |
10427 if ( (v4 & 0x80000000u) == 0 | |
693 | 10428 || (signed int)pX < (signed int)pViewport->uViewportTL_X |
10429 || (signed int)pX > (signed int)pViewport->uViewportBR_X ) | |
0 | 10430 { |
10431 y = pY; | |
10432 LABEL_30: | |
10433 v7 = uNumVisibleWindows; | |
10434 if ( uNumVisibleWindows < 0 ) | |
10435 return; | |
10436 while ( 1 ) | |
10437 { | |
10438 //v8 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[v7]]; | |
10439 v8 = &pWindowList[pVisibleWindowsIdxs[v7] - 1]; | |
10440 if ( x >= (signed int)v8->uFrameX ) | |
10441 { | |
10442 if ( x <= (signed int)v8->uFrameZ && y >= (signed int)v8->uFrameY && y <= (signed int)v8->uFrameW ) | |
10443 break; | |
10444 } | |
10445 --v7; | |
10446 if ( v7 < 0 ) | |
10447 return; | |
10448 } | |
10449 for ( i = v8->pControlsHead; ; i = i->pNext ) | |
10450 { | |
10451 if ( !i ) | |
10452 return; | |
10453 if ( i->uButtonType == 1 ) | |
10454 goto LABEL_41; | |
10455 if ( i->uButtonType != 2 ) | |
10456 break; | |
10457 if ( (signed int)(signed __int64)sqrt((double)((x - i->uX) * (x - i->uX) + (y - i->uY) * (y - i->uY))) < (signed int)i->uWidth ) | |
10458 goto LABEL_50; | |
10459 y = pY; | |
10460 x = pX; | |
10461 LABEL_45: | |
10462 ; | |
10463 } | |
10464 if ( i->uButtonType != 3 ) | |
10465 goto LABEL_45; | |
10466 LABEL_41: | |
10467 if ( x >= (signed int)i->uX && x <= (signed int)i->uZ && y >= (signed int)i->uY && y <= (signed int)i->uW ) | |
10468 { | |
10469 LABEL_50: | |
271 | 10470 i->field_2C_is_pushed = 1; |
0 | 10471 v10 = pMessageQueue_50CBD0->uNumMessages; |
10472 if ( pMessageQueue_50CBD0->uNumMessages ) | |
10473 { | |
10474 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
10475 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
10476 } | |
10477 //v11 = i->uControlParam; | |
832 | 10478 pMessageQueue_50CBD0->AddMessage(i->msg, i->msg_param, 0); |
0 | 10479 return; |
10480 } | |
10481 goto LABEL_45; | |
10482 } | |
10483 y = pY; | |
693 | 10484 if ( (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y ) |
0 | 10485 goto LABEL_30; |
10486 if ( pRenderer->pRenderD3D ) | |
10487 v5 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
10488 else | |
10489 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
10490 v6 = (unsigned __int16)v5; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
10491 if (PID_TYPE(v5) == OBJECT_Actor |
0 | 10492 && uActiveCharacter |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
10493 && v5 < 0x2000000 |
0 | 10494 && pPlayers[uActiveCharacter]->CanAct() |
10495 && pPlayers[uActiveCharacter]->CanSteal() ) | |
10496 { | |
437 | 10497 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 10498 { |
990 | 10499 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_1B; |
0 | 10500 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3; |
10501 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
10502 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 10503 }*/ |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
10504 pMessageQueue_50CBD0->AddMessage(UIMSG_1B, PID_ID(v6), 0); |
437 | 10505 |
0 | 10506 if ( pParty->bTurnBasedModeOn == 1 ) |
10507 { | |
10508 if ( pTurnEngine->field_4 == 3 ) | |
10509 pTurnEngine->field_18 |= 8u; | |
10510 } | |
10511 } | |
10512 } | |
10513 | |
10514 | |
10515 | |
10516 //----- (00417871) -------------------------------------------------------- | |
10517 void __thiscall sub_417871(int *pXY) | |
10518 { | |
10519 POINT v1; // [sp+0h] [bp-18h]@5 | |
10520 POINT a2; // [sp+8h] [bp-10h]@5 | |
10521 unsigned int pY; // [sp+10h] [bp-8h]@3 | |
10522 unsigned int pX; // [sp+14h] [bp-4h]@3 | |
10523 | |
10524 if ( !pRenderer->pRenderD3D ) | |
10525 { | |
10526 if ( pXY ) | |
10527 { | |
10528 pX = *pXY; | |
10529 pY = pXY[1]; | |
10530 } | |
10531 else | |
10532 { | |
10533 pMouse->GetClickPos(&pX, &pY); | |
10534 } | |
10535 pMouse->GetCursorPos(&a2); | |
10536 pMouse->GetCursorPos(&v1); | |
10537 } | |
10538 } | |
10539 | |
10540 //----- (004178FE) -------------------------------------------------------- | |
10541 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2) | |
10542 { | |
10543 unsigned __int16 v2; // dx@2 | |
10544 unsigned __int16 v3; // cx@2 | |
10545 int v5; // eax@5 | |
10546 unsigned __int16 v6; // [sp-4h] [bp-8h]@2 | |
10547 | |
10548 if ( a1 <= a2 ) | |
10549 { | |
10550 if ( a1 == a2 ) | |
10551 return 0; | |
10552 v5 = 100 * a1 / a2; | |
10553 v3 = 255; | |
10554 if ( v5 >= 25 ) | |
10555 { | |
10556 v6 = 100; | |
10557 v2 = 255; | |
10558 } | |
10559 else | |
10560 { | |
10561 v6 = 0; | |
10562 v2 = 0; | |
10563 } | |
10564 } | |
10565 else | |
10566 { | |
10567 v6 = 0; | |
10568 v2 = 255; | |
10569 v3 = 0; | |
10570 } | |
949 | 10571 return TargetColor(v3, v2, v6); |
0 | 10572 } |
10573 | |
10574 //----- (00417939) -------------------------------------------------------- | |
10575 signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx) | |
10576 { | |
10577 unsigned int v1; // ebx@1 | |
10578 signed int v2; // edi@1 | |
10579 unsigned int v3; // esi@1 | |
10580 unsigned int v4; // eax@1 | |
10581 unsigned int v6; // [sp+Ch] [bp-4h]@1 | |
10582 | |
10583 v1 = uConditionIdx; | |
10584 v2 = 65535; | |
949 | 10585 v3 = TargetColor(0xE1u, 0xCDu, 0x23u); |
10586 v6 = TargetColor(0xFFu, 0x23u, 0); | |
10587 v4 = TargetColor(0, 0xFFu, 0); | |
0 | 10588 switch ( v1 ) |
10589 { | |
10590 case 0u: | |
10591 case 1u: | |
10592 case 3u: | |
10593 case 4u: | |
10594 case 5u: | |
10595 case 6u: | |
10596 case 7u: | |
10597 v2 = v4; | |
10598 break; | |
10599 case 2u: | |
10600 case 8u: | |
10601 case 9u: | |
10602 case 0xCu: | |
10603 case 0xDu: | |
10604 v2 = v3; | |
10605 break; | |
10606 case 0xAu: | |
10607 case 0xBu: | |
10608 case 0xEu: | |
10609 case 0xFu: | |
10610 case 0x10u: | |
10611 v2 = v6; | |
10612 break; | |
10613 default: | |
10614 return v2; | |
10615 } | |
10616 return v2; | |
10617 } | |
10618 | |
10619 //----- (004179BC) -------------------------------------------------------- | |
1006 | 10620 void __fastcall sub_4179BC_draw_tooltip( const char *a1, const char *a2 ) |
10621 { | |
0 | 10622 const char *v2; // ebx@1 |
10623 const char *v3; // edi@1 | |
10624 unsigned int v4; // eax@1 | |
10625 GUIWindow Dst; // [sp+Ch] [bp-5Ch]@1 | |
10626 POINT v6; // [sp+60h] [bp-8h]@1 | |
10627 | |
10628 v2 = a2; | |
10629 v3 = a1; | |
10630 memset(&Dst, 0, 0x54u); | |
10631 Dst.uFrameWidth = 384; | |
10632 Dst.uFrameHeight = 256; | |
10633 Dst.uFrameX = 128; | |
10634 Dst.uFrameY = pMouse->GetCursorPos(&v6)->y + 30; | |
10635 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(v2, &Dst, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; | |
10636 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
10637 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
10638 Dst.DrawMessageBox(0); | |
10639 Dst.uFrameX += 12; | |
10640 Dst.uFrameWidth -= 24; | |
10641 Dst.uFrameY += 12; | |
10642 Dst.uFrameHeight -= 12; | |
10643 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
10644 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
949 | 10645 v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
10646 sprintf(pTmpBuf.data(), format_4E2D80, v4, v3); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
10647 Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u); |
1006 | 10648 Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0); |
0 | 10649 } |
10650 | |
10651 //----- (00417AD4) -------------------------------------------------------- | |
983 | 10652 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) |
273 | 10653 { |
0 | 10654 int v8; // eax@10 |
10655 int v12; // eax@14 | |
10656 unsigned int yellow; // [sp+Ch] [bp-Ch]@1 | |
10657 unsigned int red; // [sp+10h] [bp-8h]@1 | |
10658 unsigned int white; // [sp+14h] [bp-4h]@1 | |
10659 | |
949 | 10660 white = TargetColor(0xFFu, 0xFFu, 0xFFu); |
10661 red = TargetColor(0xFFu, 0, 0); | |
10662 yellow = TargetColor(0xFFu, 0xFFu, 0); | |
269 | 10663 if ( !(uPlayerClass % 4) ) |
10664 { | |
273 | 10665 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level ) |
269 | 10666 return white; |
273 | 10667 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level |
10668 && byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level ) | |
269 | 10669 { |
10670 v12 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType]; | |
273 | 10671 if ( v12 < skill_level ) |
269 | 10672 return red; |
0 | 10673 } |
10674 return yellow; | |
10675 } | |
273 | 10676 if ( (uPlayerClass % 4) == 1 ) |
10677 { | |
10678 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level ) | |
269 | 10679 return white; |
273 | 10680 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level ) |
269 | 10681 { |
10682 v8 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType]; | |
273 | 10683 if ( v8 < skill_level) |
10684 return red; | |
0 | 10685 } |
10686 return yellow; | |
10687 } | |
273 | 10688 if ( (uPlayerClass % 4) == 2 || (uPlayerClass % 4) == 3 ) |
10689 { | |
10690 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level ) | |
0 | 10691 return red; |
269 | 10692 } |
10693 return white; | |
0 | 10694 } |
10695 | |
10696 | |
10697 //----- (00419220) -------------------------------------------------------- | |
10698 void __cdecl sub_419220() | |
10699 { | |
10700 GUIButton *i; // eax@2 | |
10701 | |
10702 if ( !dword_507CBC ) | |
10703 { | |
10704 dword_507CBC = 1; | |
10705 for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) | |
10706 { | |
832 | 10707 if ( i->msg == UIMSG_InventoryLeftClick ) |
0 | 10708 { |
1091 | 10709 dword_50698C_uX = i->uX; |
10710 dword_506988_uY = i->uY; | |
10711 dword_506984_uZ = i->uZ; | |
10712 dword_506980_uW = i->uW; | |
0 | 10713 i->uW = 0; |
10714 i->uZ = 0; | |
10715 i->uY = 0; | |
10716 i->uX = 0; | |
10717 } | |
10718 } | |
973 | 10719 pBtn_Up = pGUIWindow_CurrentMenu->CreateButton(438, 46, |
10720 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureWidth, | |
10721 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureHeight, | |
10722 1, 0, UIMSG_ClickAwardsUpBtn, 0, 0, "", | |
10723 pIcons_LOD->GetTexture(uTextureID_ar_up_up), | |
10724 pIcons_LOD->GetTexture(uTextureID_ar_up_dn), 0); | |
10725 pBtn_Down = pGUIWindow_CurrentMenu->CreateButton(438, 292, | |
10726 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureWidth, | |
10727 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureHeight, | |
10728 1, 0, UIMSG_ClickAwardsDownBtn, 0, 0, "", | |
10729 pIcons_LOD->GetTexture(uTextureID_ar_dn_up), | |
10730 pIcons_LOD->GetTexture(uTextureID_ar_dn_dn), 0); | |
1101
3e5d70cfe20e
Award order fix, changed UIMSG_C0 to UIMSG_ClickAwardScrollBar
Grumpy7
parents:
1091
diff
changeset
|
10731 ptr_507BA4 = pGUIWindow_CurrentMenu->CreateButton(440, 62, 16, 232, 1, 0, UIMSG_ClickAwardScrollBar, 0, 0, "", 0); |
0 | 10732 } |
10733 } | |
10734 | |
10735 | |
10736 | |
10737 //----- (00419379) -------------------------------------------------------- | |
10738 void __cdecl sub_419379() | |
10739 { | |
960 | 10740 GUIButton *pButton; // esi@2 |
0 | 10741 |
10742 if ( dword_507CBC ) | |
10743 { | |
10744 dword_507CBC = 0; | |
697 | 10745 ptr_507BA4->Release(); |
10746 pBtn_Up->Release(); | |
10747 pBtn_Down->Release(); | |
0 | 10748 pBtn_Down = 0; |
10749 pBtn_Up = 0; | |
960 | 10750 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) |
10751 { | |
10752 if ( pButton->msg == UIMSG_InventoryLeftClick ) | |
10753 { | |
1091 | 10754 pButton->uX = dword_50698C_uX; |
10755 pButton->uY = dword_506988_uY; | |
10756 pButton->uZ = dword_506984_uZ; | |
10757 pButton->uW = dword_506980_uW; | |
972 | 10758 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0); |
10759 } | |
10760 } | |
10761 } | |
10762 } | |
10763 | |
10764 |