Mercurial > mm7
annotate mm7_5.cpp @ 1057:37498d2cceed
Слияние
author | Ritor1 |
---|---|
date | Thu, 23 May 2013 21:37:22 +0600 |
parents | 010a844ef4a0 d48c762de563 |
children | b79139c3b5c8 |
rev | line source |
---|---|
303 | 1 #include <assert.h> |
2 | |
1016 | 3 #include "VideoPlayer.h" |
4 #include "Sprites.h" | |
5 #include "MapInfo.h" | |
6 #include "BSPModel.h" | |
7 #include "OutdoorCamera.h" | |
8 #include "LightmapBuilder.h" | |
9 #include "DecalBuilder.h" | |
10 #include "Mouse.h" | |
11 #include "Keyboard.h" | |
12 #include "GammaControl.h" | |
13 #include "stru11.h" | |
14 | |
15 #include "Vis.h" | |
0 | 16 #include "mm7.h" |
17 #include "Game.h" | |
18 #include "GUIWindow.h" | |
19 #include "GUIFont.h" | |
20 #include "GUIProgressBar.h" | |
21 #include "Party.h" | |
22 #include "AudioPlayer.h" | |
23 #include "Outdoor.h" | |
24 #include "Arcomage.h" | |
25 #include "LOD.h" | |
26 #include "Actor.h" | |
27 #include "Events.h" | |
28 #include "Viewport.h" | |
29 #include "FrameTableInc.h" | |
30 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
31 #include "SpriteObject.h" |
0 | 32 #include "ObjectList.h" |
33 #include "Chest.h" | |
34 #include "PaletteManager.h" | |
35 #include "SaveLoad.h" | |
36 #include "Time.h" | |
37 #include "TurnEngine.h" | |
924 | 38 #include "CastSpellInfo.h" |
0 | 39 #include "stru298.h" |
40 #include "Events2D.h" | |
189 | 41 #include "texts.h" |
0 | 42 #include "Log.h" |
629 | 43 #include "UIHouses.h" |
0 | 44 #include "mm7_data.h" |
45 | |
46 //----- (004304E7) -------------------------------------------------------- | |
47 void __cdecl GameUI_MsgProc() | |
48 { | |
978 | 49 //signed int v0; // edi@6 |
1025 | 50 //char *v1; // esi@6 |
0 | 51 unsigned int v2; // edx@7 |
52 Actor *pActor; // ecx@13 | |
53 int v4; // ecx@18 | |
199 | 54 //NPCData *pNPCData0; // eax@18 |
55 //int v6; // edx@20 | |
56 //int v7; // ecx@29 | |
916 | 57 //unsigned int v8; // edx@59 |
58 //unsigned int v9; // ecx@60 | |
0 | 59 unsigned int v10; // ecx@73 |
437 | 60 //unsigned int v11; // eax@75 |
0 | 61 unsigned __int8 v12; // sf@75 |
62 unsigned __int8 v13; // of@75 | |
63 int v14; // eax@98 | |
64 unsigned int v15; // eax@102 | |
65 unsigned __int8 v16; // al@104 | |
66 unsigned __int8 v17; // al@105 | |
67 int v18; // eax@106 | |
68 float v19; // ST64_4@121 | |
69 unsigned int v20; // ecx@121 | |
70 float v21; // ST64_4@126 | |
71 float v22; // ST64_4@127 | |
72 unsigned int v23; // ecx@135 | |
73 unsigned int v24; // ecx@149 | |
74 unsigned int v25; // ecx@165 | |
75 GUIWindow *pWindow; // eax@204 | |
76 unsigned int v27; // edx@204 | |
77 unsigned int v28; // ecx@204 | |
78 GUIWindow *pWindow2; // ecx@248 | |
978 | 79 //int v30; // edx@258 |
80 //const char *v31; // ecx@262 | |
0 | 81 signed int v32; // eax@269 |
82 unsigned int v33; // eax@277 | |
83 unsigned __int8 v34; // al@279 | |
84 unsigned __int8 v35; // al@280 | |
1000 | 85 //GUIWindow *pWindow3; // ecx@332 |
0 | 86 int v37; // eax@341 |
87 int v38; // eax@358 | |
88 SHORT v39; // ax@365 | |
910 | 89 //signed int v40; // eax@365 |
0 | 90 char *v41; // eax@380 |
91 int v42; // eax@396 | |
92 POINT *pPoint; // eax@397 | |
93 signed int v44; // eax@398 | |
94 int v45; // edx@398 | |
95 signed int v46; // ecx@398 | |
96 char v47; // zf@399 | |
97 char v48; // zf@405 | |
98 BLVFace *pBLVFace; // ecx@410 | |
99 ODMFace *pODMFace; // ecx@412 | |
1000 | 100 CastSpellInfo *pSpellInfo; // ecx@415 |
0 | 101 void *v52; // eax@424 |
102 __int16 v53; // ax@431 | |
103 int v54; // eax@432 | |
104 int v55; // ecx@432 | |
105 int v56; // edx@432 | |
106 int v57; // eax@432 | |
107 Player *pPlayer; // edx@442 | |
108 unsigned int v59; // eax@445 | |
109 signed int v60; // ST64_4@459 | |
110 NPCData *pNPCData2; // eax@467 | |
111 unsigned __int64 v62; // kr00_8@467 | |
112 __int16 v63; // dx@479 | |
113 unsigned int v64; // eax@486 | |
114 int v65; // ecx@486 | |
115 int v66; // eax@488 | |
116 char *v67; // eax@489 | |
117 __int16 v68; // dx@498 | |
118 char *v69; // eax@512 | |
119 int v70; // eax@525 | |
120 int v71; // edi@527 | |
121 NPCData *pNPCData3; // esi@527 | |
122 char *v73; // ecx@533 | |
123 signed int v74; // edi@535 | |
124 int v75; // eax@535 | |
125 int v76; // esi@535 | |
126 int v77; // eax@537 | |
127 Player *pPlayer2; // ecx@549 | |
916 | 128 //int v79; // ecx@550 |
129 //unsigned int v80; // edx@550 | |
0 | 130 signed int v81; // eax@552 |
131 POINT *pPoint2; // eax@553 | |
132 signed int v83; // ecx@554 | |
133 signed int v84; // ecx@554 | |
134 GUIButton *pButton; // eax@578 | |
135 unsigned int v86; // eax@583 | |
136 const char *v87; // ecx@595 | |
137 const char *v88; // ecx@596 | |
916 | 138 //unsigned int v89; // eax@598 |
0 | 139 unsigned int v90; // eax@602 |
140 int v91; // edx@605 | |
141 int v92; // eax@605 | |
142 int v93; // edx@605 | |
143 int pPlayerNum; // edx@611 | |
144 int v95; // eax@611 | |
916 | 145 //const char *v96; // ecx@621 |
0 | 146 unsigned int v97; // eax@624 |
147 int v98; // eax@636 | |
148 unsigned __int8 v99; // al@643 | |
149 Player *pPlayer3; // eax@648 | |
150 int v101; // ecx@648 | |
151 int v102; // edx@652 | |
152 int v103; // eax@671 | |
153 Player *pPlayer4; // ecx@718 | |
154 int v105; // eax@718 | |
155 Player *pPlayer5; // ST78_4@758 | |
156 unsigned int v107; // eax@758 | |
157 unsigned int v108; // eax@758 | |
158 unsigned int v115; // eax@764 | |
159 int v116; // eax@776 | |
160 POINT *pPoint3; // eax@777 | |
161 unsigned int v118; // eax@785 | |
162 unsigned int v119; // ecx@786 | |
163 unsigned int v120; // [sp-28h] [bp-624h]@86 | |
164 unsigned int v121; // [sp-28h] [bp-624h]@711 | |
165 unsigned int v122; // [sp-24h] [bp-620h]@86 | |
166 unsigned int v123; // [sp-24h] [bp-620h]@711 | |
167 unsigned int v124; // [sp-20h] [bp-61Ch]@86 | |
168 unsigned int v125; // [sp-20h] [bp-61Ch]@711 | |
169 unsigned int v126; // [sp-1Ch] [bp-618h]@86 | |
170 int v127; // [sp-1Ch] [bp-618h]@107 | |
171 unsigned int v128; // [sp-1Ch] [bp-618h]@711 | |
172 int v129; // [sp-18h] [bp-614h]@86 | |
916 | 173 //signed int v130; // [sp-18h] [bp-614h]@107 |
0 | 174 int v131; // [sp-14h] [bp-610h]@86 |
916 | 175 //unsigned int v132; // [sp-14h] [bp-610h]@107 |
176 //unsigned int v133; // [sp-10h] [bp-60Ch]@60 | |
0 | 177 unsigned int v134; // [sp-10h] [bp-60Ch]@86 |
916 | 178 //signed int v135; // [sp-10h] [bp-60Ch]@107 |
0 | 179 unsigned int v136; // [sp-10h] [bp-60Ch]@121 |
916 | 180 //unsigned int v137; // [sp-Ch] [bp-608h]@60 |
0 | 181 unsigned int v138; // [sp-Ch] [bp-608h]@86 |
916 | 182 //signed int v139; // [sp-Ch] [bp-608h]@107 |
0 | 183 unsigned int v140; // [sp-Ch] [bp-608h]@121 |
184 enum WindowType pWindowType; // [sp-8h] [bp-604h]@56 | |
916 | 185 //enum WindowType pWindowType1; // [sp-8h] [bp-604h]@60 |
0 | 186 unsigned __int8 v143; // [sp-8h] [bp-604h]@86 |
916 | 187 //int v144; // [sp-8h] [bp-604h]@107 |
0 | 188 enum WindowType pWindowType2; // [sp-8h] [bp-604h]@121 |
916 | 189 //const char *v146; // [sp-8h] [bp-604h]@449 |
190 //unsigned int v147; // [sp-8h] [bp-604h]@550 | |
710 | 191 //int v148; // [sp-4h] [bp-600h]@56 |
0 | 192 GUIButton *pButton2; // [sp-4h] [bp-600h]@59 |
193 const char *v150; // [sp-4h] [bp-600h]@86 | |
916 | 194 //unsigned int v151; // [sp-4h] [bp-600h]@107 |
0 | 195 int v152; // [sp-4h] [bp-600h]@121 |
196 int v153; // [sp-4h] [bp-600h]@135 | |
961 | 197 //int v154; // [sp-4h] [bp-600h]@149 |
0 | 198 int v155; // [sp-4h] [bp-600h]@165 |
199 int v156; // [sp-4h] [bp-600h]@204 | |
916 | 200 //const char *v157; // [sp-4h] [bp-600h]@444 |
0 | 201 unsigned int v158; // [sp-4h] [bp-600h]@449 |
916 | 202 //__int16 v159; // [sp-4h] [bp-600h]@550 |
0 | 203 int v160; // [sp-4h] [bp-600h]@599 |
204 const char *v161; // [sp-4h] [bp-600h]@637 | |
710 | 205 //int v162; // [sp+0h] [bp-5FCh]@56 |
916 | 206 //int v163; // [sp+0h] [bp-5FCh]@59 |
0 | 207 Texture *pTexture; // [sp+0h] [bp-5FCh]@86 |
916 | 208 //int v165; // [sp+0h] [bp-5FCh]@107 |
0 | 209 int v166; // [sp+0h] [bp-5FCh]@121 |
210 int v167; // [sp+0h] [bp-5FCh]@135 | |
978 | 211 //int v168; // [sp+0h] [bp-5FCh]@149 |
0 | 212 int v169; // [sp+0h] [bp-5FCh]@165 |
213 int v170; // [sp+0h] [bp-5FCh]@204 | |
978 | 214 //signed int v171; // [sp+0h] [bp-5FCh]@259 |
0 | 215 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287 |
216 char *v173; // [sp+0h] [bp-5FCh]@444 | |
217 char *v174; // [sp+0h] [bp-5FCh]@449 | |
916 | 218 //int v175; // [sp+0h] [bp-5FCh]@550 |
0 | 219 int v176; // [sp+0h] [bp-5FCh]@599 |
220 const char *v177; // [sp+0h] [bp-5FCh]@629 | |
221 char *v178; // [sp+0h] [bp-5FCh]@637 | |
222 int v179; // [sp+4h] [bp-5F8h]@0 | |
199 | 223 //signed int _this; // [sp+14h] [bp-5E8h]@22 |
0 | 224 signed int thisa; // [sp+14h] [bp-5E8h]@251 |
225 signed int thisb; // [sp+14h] [bp-5E8h]@272 | |
226 Player *pPlayer7; // [sp+14h] [bp-5E8h]@373 | |
227 Player *pPlayer8; // [sp+14h] [bp-5E8h]@377 | |
228 char *thise; // [sp+14h] [bp-5E8h]@445 | |
229 Player *pPlayer9; // [sp+14h] [bp-5E8h]@455 | |
230 int thisg; // [sp+14h] [bp-5E8h]@467 | |
231 int thish; // [sp+14h] [bp-5E8h]@528 | |
232 signed int thisi; // [sp+14h] [bp-5E8h]@535 | |
233 MapInfo *pMapInfo; // [sp+14h] [bp-5E8h]@604 | |
234 Player *pPlayer10; // [sp+14h] [bp-5E8h]@641 | |
235 int thisl; // [sp+14h] [bp-5E8h]@648 | |
236 int uMessageParam; // [sp+18h] [bp-5E4h]@7 | |
237 int uAction; // [sp+1Ch] [bp-5E0h]@18 | |
238 NPCData *pNPCData4; // [sp+20h] [bp-5DCh]@23 | |
239 unsigned int uNumSeconds; // [sp+24h] [bp-5D8h]@18 | |
240 char v197; // [sp+2Bh] [bp-5D1h]@101 | |
241 enum UIMessageType uMessage; // [sp+2Ch] [bp-5D0h]@7 | |
242 unsigned int v199; // [sp+30h] [bp-5CCh]@7 | |
243 char *v200; // [sp+34h] [bp-5C8h]@518 | |
244 POINT v201; // [sp+38h] [bp-5C4h]@553 | |
245 POINT v202; // [sp+40h] [bp-5BCh]@141 | |
246 POINT a2; // [sp+48h] [bp-5B4h]@127 | |
247 POINT v204; // [sp+50h] [bp-5ACh]@777 | |
248 POINT v205; // [sp+58h] [bp-5A4h]@171 | |
249 POINT v206; // [sp+60h] [bp-59Ch]@553 | |
250 POINT v207; // [sp+68h] [bp-594h]@155 | |
251 POINT v208; // [sp+70h] [bp-58Ch]@397 | |
252 POINT v209; // [sp+78h] [bp-584h]@777 | |
253 POINT v210; // [sp+80h] [bp-57Ch]@397 | |
254 POINT v211; // [sp+88h] [bp-574h]@704 | |
255 __int64 v212; // [sp+90h] [bp-56Ch]@467 | |
783 | 256 int v213; // [sp+98h] [bp-564h]@385 |
257 char pLevelName[32]; // [sp+9Ch] [bp-560h]@380 | |
258 char pOut[32]; // [sp+BCh] [bp-540h]@370 | |
0 | 259 FrameTableTxtLine v216; // [sp+DCh] [bp-520h]@524 |
260 int v217[9]; // [sp+158h] [bp-4A4h]@652 | |
261 FrameTableTxtLine v218; // [sp+17Ch] [bp-480h]@524 | |
262 char a1[64]; // [sp+1F8h] [bp-404h]@467 | |
263 char Str2[128]; // [sp+238h] [bp-3C4h]@527 | |
264 Actor actor; // [sp+2B8h] [bp-344h]@4 | |
265 | |
266 dword_50CDC8 = 0; | |
267 if ( !pEventTimer->bPaused ) | |
268 { | |
269 pParty->sEyelevel = pParty->uDefaultEyelevel; | |
270 pParty->uPartyHeight = pParty->uDefaultPartyHeight; | |
271 } | |
272 if ( bDialogueUI_InitializeActor_NPC_ID ) | |
273 { | |
274 //Actor::Actor(&actor); | |
275 memset(&actor, 0, 0x344u); | |
276 dword_5B65D0_dialogue_actor_npc_id = bDialogueUI_InitializeActor_NPC_ID; | |
602 | 277 actor.sNPC_ID = bDialogueUI_InitializeActor_NPC_ID; |
1033 | 278 GameUI_InitializeDialogue(&actor, false); |
0 | 279 bDialogueUI_InitializeActor_NPC_ID = 0; |
280 } | |
281 if ( pMessageQueue_50CBD0->uNumMessages ) | |
282 { | |
1025 | 283 //v1 = ""; |
0 | 284 while ( 2 ) |
285 { | |
286 if ( !pMessageQueue_50CBD0->uNumMessages ) | |
287 break; | |
288 | |
289 pMessageQueue_50CBD0->PopMessage(&uMessage, &uMessageParam, (int *)&v199); | |
290 switch ( uMessage ) | |
291 { | |
292 case UIMSG_ChangeGameState: | |
978 | 293 uGameState = GAME_FINISHED; |
4 | 294 continue; |
0 | 295 case UIMSG_PlayArcomage: |
296 pVideoPlayer->_4BF5B2(); | |
297 pArcomageGame->bGameInProgress = 1; | |
298 PrepareArcomage(); | |
4 | 299 continue; |
0 | 300 case UIMSG_StartNPCDialogue: |
301 if ( !uActiveCharacter ) | |
4 | 302 continue; |
978 | 303 viewparams->field_48 = 1; |
0 | 304 if ( pMessageQueue_50CBD0->uNumMessages ) |
305 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
602 | 306 dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID; |
0 | 307 pActor = &pActors[uMessageParam]; |
4 | 308 //goto _actor_init_dlg; |
1033 | 309 GameUI_InitializeDialogue(pActor, true); |
4 | 310 continue; |
199 | 311 case UIMSG_StartHireling1Dialogue: |
312 case UIMSG_StartHireling2Dialogue: | |
313 { | |
314 if (bNoNPCHiring || pCurrentScreen) | |
315 continue; | |
316 | |
0 | 317 if ( pMessageQueue_50CBD0->uNumMessages ) |
318 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
319 uAction = 0; | |
201 | 320 int hireling_idx = uMessage - UIMSG_StartHireling1Dialogue; |
0 | 321 v4 = 0; |
199 | 322 |
323 for (uint i = 0; i < 2; ++i) | |
324 //pNPCData0 = pParty->pHirelings; | |
325 //do | |
326 { | |
327 if (pParty->pHirelings[i].pName) | |
328 //{ | |
329 //v6 = uAction++; | |
330 pTmpBuf[uAction++] = i; | |
331 //} | |
332 //++pNPCData0; | |
333 //++v4; | |
334 } | |
335 //while ( (signed int)pNPCData0 < (signed int)&pParty->pPickedItem ); | |
336 | |
337 //_this = 0; | |
338 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
339 { | |
340 auto npc = pNPCStats->pNewNPCData + i; | |
341 //do | |
342 //{ | |
248 | 343 if (npc->Hired() && |
199 | 344 (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)) && |
345 (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) ) | |
0 | 346 { |
199 | 347 //v7 =; |
348 pTmpBuf[uAction++] = i + 2; | |
0 | 349 } |
199 | 350 //++_this; |
351 //++pNPCData4; | |
352 //} | |
353 //while ( _this < (signed int)pNPCStats->uNumNewNPCs ); | |
0 | 354 } |
201 | 355 |
356 if ( (signed int)(hireling_idx + (unsigned __int8)pParty->field_709) < uAction ) | |
0 | 357 { |
358 //Actor::Actor(&actor); | |
359 memset(&actor, 0, 0x344u); | |
602 | 360 actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx; |
0 | 361 pActor = &actor; |
1033 | 362 GameUI_InitializeDialogue(&actor, true); |
0 | 363 } |
364 } | |
4 | 365 continue; |
735 | 366 |
367 case UIMSG_BuyInShop_Identify_Repair: | |
368 UIShop_Buy_Identify_Repair(); | |
369 continue; | |
467 | 370 case UIMSG_ClickNPCTopic: |
371 ClickNPCTopic(uMessageParam); | |
372 continue; | |
651 | 373 case UIMSG_SelectShopDialogueOption: |
374 OnSelectShopDialogueOption(uMessageParam); | |
375 continue; | |
376 case UIMSG_SelectNPCDialogueOption: | |
377 OnSelectNPCDialogueOption((DIALOGUE_TYPE)uMessageParam); | |
4 | 378 continue; |
961 | 379 case UIMSG_ClickHouseNPCPortrait: |
0 | 380 _4B4224_UpdateNPCTopics(uMessageParam); |
4 | 381 continue; |
0 | 382 case UIMSG_StartNewGame: |
383 if ( dword_6BE138 == 124 || uMessageParam ) | |
384 { | |
1006 | 385 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 386 pIcons_LOD->_4114F2(); |
387 if ( pMessageQueue_50CBD0->uNumMessages ) | |
388 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
389 pGUIWindow_CurrentMenu->Release(); | |
978 | 390 uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU; |
151 | 391 pCurrentScreen = SCREEN_GAME; |
978 | 392 viewparams->bRedrawGameUI = 1; |
0 | 393 } |
394 else | |
395 { | |
396 ShowStatusBarString(pGlobalTXT_LocalizationStrings[201], 2u);// "Are you sure? Click again to start a New Game" | |
397 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); | |
398 dword_6BE138 = 124; | |
399 } | |
400 stru_506E40.Release(); | |
4 | 401 continue; |
0 | 402 case UIMSG_Game_OpenLoadGameDialog: |
1006 | 403 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 404 pIcons_LOD->_4114F2(); |
405 if ( pMessageQueue_50CBD0->uNumMessages ) | |
406 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
407 pGUIWindow_CurrentMenu->Release(); | |
151 | 408 pCurrentScreen = SCREEN_LOADGAME; |
1033 | 409 LoadUI_Load(1); |
4 | 410 continue; |
0 | 411 case UIMSG_Quit: |
412 if ( dword_6BE138 == 132 || uMessageParam ) | |
413 { | |
1006 | 414 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 415 pIcons_LOD->_4114F2(); |
416 if ( pMessageQueue_50CBD0->uNumMessages ) | |
417 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
418 pGUIWindow_CurrentMenu->Release(); | |
151 | 419 pCurrentScreen = SCREEN_GAME; |
978 | 420 viewparams->bRedrawGameUI = 1; |
0 | 421 if ( !uMessageParam ) |
422 pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0); | |
978 | 423 uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU; |
0 | 424 } |
425 else | |
426 { | |
369 | 427 ShowStatusBarString(pGlobalTXT_LocalizationStrings[82], 2);// "Are you sure? Click again to quit" |
0 | 428 pAudioPlayer->PlaySound(SOUND_20001, 0, 0, -1, 0, 0, 0, 0); |
429 dword_6BE138 = 132; | |
430 } | |
4 | 431 stru_506E40.Release(); |
432 continue; | |
151 | 433 case UIMSG_80: |
987 | 434 __debugbreak(); |
1006 | 435 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 436 pIcons_LOD->_4114F2(); |
437 pGUIWindow_CurrentMenu->Release(); | |
151 | 438 pCurrentScreen = SCREEN_OPTIONS; |
710 | 439 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_8, 0, 0); |
11 | 440 continue; |
2 | 441 case UIMSG_ArrowUp: |
442 --pSaveListPosition; | |
443 if ( pSaveListPosition < 0 ) | |
444 pSaveListPosition = 0; | |
962 | 445 GUIWindow::Create(215, 199, 17, 17, WINDOW_PressedButton2, (int)pBtnArrowUp, 0); |
11 | 446 continue; |
2 | 447 case UIMSG_DownArrow: |
448 ++pSaveListPosition; | |
449 if ( pSaveListPosition >= uMessageParam ) | |
450 pSaveListPosition = uMessageParam - 1; | |
962 | 451 GUIWindow::Create(215, 323, 17, 17, WINDOW_PressedButton2, (int)pBtnDownArrow, 0); |
11 | 452 continue; |
2 | 453 case UIMSG_Cancel: |
962 | 454 GUIWindow::Create(350, 302, 106, 42, WINDOW_CloseRestWindowBtn, (int)pBtnCancel, 0); |
11 | 455 continue; |
961 | 456 case UIMSG_SaveLoadBtn: |
457 GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); | |
11 | 458 continue; |
3 | 459 case UIMSG_SelectLoadSlot: |
1038 | 460 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
461 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
151 | 462 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam ) |
2 | 463 { |
464 v10 = pSaveListPosition + uMessageParam; | |
465 if ( dword_6BE138 == pSaveListPosition + uMessageParam ) | |
0 | 466 { |
961 | 467 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); |
437 | 468 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); |
0 | 469 } |
470 uLoadGameUI_SelectedSlot = v10; | |
471 dword_6BE138 = v10; | |
472 } | |
473 else | |
474 { | |
3 | 475 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); |
43 | 476 if ( strcmp((const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pGlobalTXT_LocalizationStrings[72]) )// "Empty" |
477 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, (const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot]); | |
0 | 478 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); |
479 } | |
4 | 480 continue; |
0 | 481 case UIMSG_LoadGame: |
482 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) | |
483 { | |
484 LoadGame(uLoadGameUI_SelectedSlot); | |
978 | 485 uGameState = GAME_STATE_3; |
0 | 486 } |
4 | 487 stru_506E40.Release(); |
488 continue; | |
0 | 489 case UIMSG_SaveGame: |
1038 | 490 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
491 { | |
492 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
837 | 493 strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer); |
0 | 494 } |
495 DoSavegame(uLoadGameUI_SelectedSlot); | |
4 | 496 stru_506E40.Release(); |
497 continue; | |
151 | 498 case UIMSG_Game_OpenSaveGameDialog: |
0 | 499 pGUIWindow_CurrentMenu->Release(); |
151 | 500 pCurrentScreen = SCREEN_SAVEGAME; |
1033 | 501 SaveUI_Load(); |
4 | 502 continue; |
369 | 503 case UIMSG_Game_OpenOptionsDialog://Open |
0 | 504 if ( pMessageQueue_50CBD0->uNumMessages ) |
505 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
506 pGUIWindow_CurrentMenu->Release(); | |
978 | 507 viewparams->field_48 = 1; |
151 | 508 pCurrentScreen = SCREEN_OPTIONS; |
948 | 509 |
510 options_menu_skin.uTextureID_Background = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE); | |
511 options_menu_skin.uTextureID_TurnSpeed[2] = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE); | |
512 options_menu_skin.uTextureID_TurnSpeed[1] = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE); | |
513 options_menu_skin.uTextureID_TurnSpeed[0] = pIcons_LOD->LoadTexture("con_Smoo", TEXTURE_16BIT_PALETTE); | |
514 options_menu_skin.uTextureID_ArrowLeft = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE); | |
515 options_menu_skin.uTextureID_ArrowRight = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE); | |
516 options_menu_skin.uTextureID_SoundLevels[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE); | |
517 options_menu_skin.uTextureID_SoundLevels[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE); | |
518 options_menu_skin.uTextureID_SoundLevels[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE); | |
519 options_menu_skin.uTextureID_SoundLevels[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE); | |
520 options_menu_skin.uTextureID_SoundLevels[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE); | |
521 options_menu_skin.uTextureID_SoundLevels[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE); | |
522 options_menu_skin.uTextureID_SoundLevels[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE); | |
523 options_menu_skin.uTextureID_SoundLevels[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE); | |
524 options_menu_skin.uTextureID_SoundLevels[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE); | |
525 options_menu_skin.uTextureID_SoundLevels[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); | |
526 options_menu_skin.uTextureID_FlipOnExit = pIcons_LOD->LoadTexture("option04", TEXTURE_16BIT_PALETTE); | |
527 options_menu_skin.uTextureID_AlwaysRun = pIcons_LOD->LoadTexture("option03", TEXTURE_16BIT_PALETTE); | |
528 options_menu_skin.uTextureID_ShowDamage = pIcons_LOD->LoadTexture("option02", TEXTURE_16BIT_PALETTE); | |
529 options_menu_skin.uTextureID_WalkSound = pIcons_LOD->LoadTexture("option01", TEXTURE_16BIT_PALETTE); | |
530 | |
0 | 531 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Options, 0, 0); |
832 | 532 pGUIWindow_CurrentMenu->CreateButton(22, 270, |
948 | 533 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth, |
534 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight, | |
1025 | 535 1, 0, UIMSG_SetTurnSpeed, 0x80, 0, "", 0); |
948 | 536 pGUIWindow_CurrentMenu->CreateButton(93, 270, |
537 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth, | |
538 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight, | |
1025 | 539 1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, "", 0); |
948 | 540 pGUIWindow_CurrentMenu->CreateButton(164, 270, |
541 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth, | |
542 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight, | |
1025 | 543 1, 0, UIMSG_SetTurnSpeed, 0, 0, "", 0); |
948 | 544 |
545 pGUIWindow_CurrentMenu->CreateButton(20, 303, | |
546 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth, | |
547 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight, | |
1025 | 548 1, 0, UIMSG_ToggleWalkSound, 0, 0, "", 0); |
948 | 549 pGUIWindow_CurrentMenu->CreateButton(128, 303, |
550 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth, | |
551 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight, | |
1025 | 552 1, 0, UIMSG_ToggleShowDamage, 0, 0, "", 0); |
948 | 553 pGUIWindow_CurrentMenu->CreateButton(20, 325, |
554 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth, | |
555 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight, | |
1025 | 556 1, 0, UIMSG_ToggleAlwaysRun, 0, 0, "", 0); |
948 | 557 pGUIWindow_CurrentMenu->CreateButton(128, 325, |
558 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth, | |
559 pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight, | |
1025 | 560 1, 0, UIMSG_ToggleFlipOnExit, 0, 0, "", 0); |
561 | |
562 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
563 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
564 pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, "", 0); | |
565 | |
566 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
567 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
568 pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, "", 0); | |
569 | |
570 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); | |
571 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, "", pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); | |
572 pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, "", 0); | |
978 | 573 |
574 pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game" | |
1025 | 575 pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, "", 0); |
576 pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, "", 0); | |
948 | 577 continue; |
578 | |
369 | 579 case UIMSG_OpenKeyMappingOptions://Open |
0 | 580 if ( pMessageQueue_50CBD0->uNumMessages ) |
581 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
582 pGUIWindow_CurrentMenu->Release(); | |
583 viewparams->field_48 = 1; | |
151 | 584 pCurrentScreen = SCREEN_KEYBOARD_OPTIONS; |
369 | 585 uTextureID_Optkb[0] = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE); |
586 uTextureID_Optkb[1] = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE); | |
587 uTextureID_Optkb[2] = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); | |
588 uTextureID_Optkb[3] = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE); | |
589 uTextureID_Optkb[4] = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE); | |
0 | 590 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_KeyMappingOptions, 0, 0); |
832 | 591 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0); |
592 pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage1, 0, 0, "", 0); | |
593 pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, UIMSG_SelectKeyPage2, 0, 0, "", 0); | |
594 pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_ResetKeyMapping, 0, 0, "", 0); | |
595 pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0, "", 0); | |
596 pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0, 0, "", 0); | |
597 pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 1u, 0, "", 0); | |
598 pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 2u, 0, "", 0); | |
599 pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 3u, 0, "", 0); | |
600 pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, UIMSG_ChangeKeyButton, 4u, 0, "", 0); | |
601 pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 5u, 0, "", 0); | |
602 pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 6u, 0, "", 0); | |
603 pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 7u, 0, "", 0); | |
604 pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 8u, 0, "", 0); | |
605 pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 9u, 0, "", 0); | |
606 pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xAu, 0, "", 0); | |
607 pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xBu, 0, "", 0); | |
608 pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xCu, 0, "", 0); | |
609 pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, UIMSG_ChangeKeyButton, 0xDu, 0, "", 0); | |
1031 | 610 uGameMenuUI_CurentlySelectedKeyIdx = -1; |
362 | 611 KeyboardPageNum = 1; |
1031 | 612 memset(GameMenuUI_InvaligKeyBindingsFlags, 0, sizeof(GameMenuUI_InvaligKeyBindingsFlags)); |
369 | 613 //*(_WORD *)KeyButtonArray[28] = 0; |
0 | 614 memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); |
1025 | 615 //v1 = ""; |
978 | 616 //v0 = 1; |
11 | 617 continue; |
362 | 618 case UIMSG_ChangeKeyButton: |
1031 | 619 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 ) |
362 | 620 { |
621 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
622 continue; | |
623 } | |
0 | 624 v14 = uMessageParam; |
978 | 625 if ( KeyboardPageNum != 1 ) |
0 | 626 v14 = uMessageParam + 14; |
1031 | 627 uGameMenuUI_CurentlySelectedKeyIdx = v14; |
978 | 628 pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu); |
4 | 629 continue; |
0 | 630 case UIMSG_ResetKeyMapping: |
631 v197 = 1; | |
632 pKeyActionMap->SetDefaultMapping(); | |
633 uAction = 0; | |
634 do | |
635 { | |
636 v15 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
637 if ( v15 != pPrevVirtualCidesMapping[uAction] ) | |
638 { | |
639 if ( v197 ) | |
640 { | |
641 v16 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
978 | 642 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v16, 1); |
0 | 643 v197 = 0; |
644 } | |
645 else | |
646 { | |
647 v17 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
648 GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v17, 0); | |
649 } | |
650 } | |
651 pPrevVirtualCidesMapping[uAction] = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
652 v18 = uAction++; | |
4 | 653 v13 = uAction > 28; |
0 | 654 v12 = uAction - 28 < 0; |
1031 | 655 GameMenuUI_InvaligKeyBindingsFlags[v18] = 0; |
0 | 656 } |
657 while ( v12 ^ v13 ); | |
369 | 658 pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); |
659 continue; | |
362 | 660 case UIMSG_SelectKeyPage1: |
978 | 661 KeyboardPageNum = 1; |
362 | 662 continue; |
663 case UIMSG_SelectKeyPage2: | |
664 KeyboardPageNum = 2; | |
4 | 665 continue; |
0 | 666 case UIMSG_OpenVideoOptions: |
667 if ( pMessageQueue_50CBD0->uNumMessages ) | |
668 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
669 pGUIWindow_CurrentMenu->Release(); | |
978 | 670 viewparams->field_48 = 1; |
151 | 671 pCurrentScreen = SCREEN_VIDEO_OPTIONS; |
0 | 672 uTextureID_507C10 = pIcons_LOD->LoadTexture("optvid", TEXTURE_16BIT_PALETTE); |
673 uTextureID_507C14 = pIcons_LOD->LoadTexture("opvdH-bs", TEXTURE_16BIT_PALETTE); | |
674 uTextureID_507C18 = pIcons_LOD->LoadTexture("opvdH-cl", TEXTURE_16BIT_PALETTE); | |
675 uTextureID_507C1C = pIcons_LOD->LoadTexture("opvdH-tn", TEXTURE_16BIT_PALETTE); | |
676 uTextureID_507C20 = pIcons_LOD->LoadTexture("con_ArrL", TEXTURE_16BIT_PALETTE); | |
677 uTextureID_507C24 = pIcons_LOD->LoadTexture("con_ArrR", TEXTURE_16BIT_PALETTE); | |
678 pTextureIDs_GammaPositions[0] = pIcons_LOD->LoadTexture("convol10", TEXTURE_16BIT_PALETTE); | |
679 pTextureIDs_GammaPositions[1] = pIcons_LOD->LoadTexture("convol20", TEXTURE_16BIT_PALETTE); | |
680 pTextureIDs_GammaPositions[2] = pIcons_LOD->LoadTexture("convol30", TEXTURE_16BIT_PALETTE); | |
681 pTextureIDs_GammaPositions[3] = pIcons_LOD->LoadTexture("convol40", TEXTURE_16BIT_PALETTE); | |
682 pTextureIDs_GammaPositions[4] = pIcons_LOD->LoadTexture("convol50", TEXTURE_16BIT_PALETTE); | |
683 pTextureIDs_GammaPositions[5] = pIcons_LOD->LoadTexture("convol60", TEXTURE_16BIT_PALETTE); | |
684 pTextureIDs_GammaPositions[6] = pIcons_LOD->LoadTexture("convol70", TEXTURE_16BIT_PALETTE); | |
685 pTextureIDs_GammaPositions[7] = pIcons_LOD->LoadTexture("convol80", TEXTURE_16BIT_PALETTE); | |
686 pTextureIDs_GammaPositions[8] = pIcons_LOD->LoadTexture("convol90", TEXTURE_16BIT_PALETTE); | |
687 pTextureIDs_GammaPositions[9] = pIcons_LOD->LoadTexture("convol00", TEXTURE_16BIT_PALETTE); | |
688 uTextureID_507C50 = pIcons_LOD->LoadTexture("opvdG-bs", TEXTURE_16BIT_PALETTE); | |
689 uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE); | |
690 uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE); | |
691 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0); | |
1025 | 692 pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, "", 0); |
0 | 693 if ( pRenderer->pRenderD3D ) |
694 { | |
1025 | 695 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, "", 0); |
696 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, "", 0); | |
697 pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, "", 0); | |
0 | 698 } |
699 if ( !pRenderer->bWindowMode ) | |
700 { | |
978 | 701 //v0 = 1; |
0 | 702 if ( GammaController::IsGammaSupported() ) |
703 { | |
1025 | 704 pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C20), 0); |
705 pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(0xD5u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 5u, 0, "", pIcons_LOD->GetTexture(uTextureID_507C24), 0); | |
706 pGUIWindow_CurrentMenu->CreateButton(42, 162, 170, 18, 1, 0, UIMSG_1A9, 0, 0, "", 0); | |
0 | 707 } |
708 } | |
4 | 709 continue; |
151 | 710 case UIMSG_1A9: |
987 | 711 __debugbreak(); |
0 | 712 if ( uMessageParam == 4 ) |
713 { | |
151 | 714 //--uGammaPos; |
715 if ( (uGammaPos -- -1) < 0 ) | |
0 | 716 { |
717 uGammaPos = 0; | |
369 | 718 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
719 continue; | |
0 | 720 } |
721 v19 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
722 pGame->pGammaController->Initialize(v19); | |
978 | 723 GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); |
369 | 724 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
725 continue; | |
0 | 726 } |
727 if ( uMessageParam == 5 ) | |
728 { | |
729 ++uGammaPos; | |
730 if ( (signed int)uGammaPos <= 9 ) | |
731 { | |
732 v21 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
733 pGame->pGammaController->Initialize(v21); | |
978 | 734 GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); |
369 | 735 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
736 continue; | |
0 | 737 } |
738 uGammaPos = 9; | |
739 } | |
740 else | |
741 { | |
742 uGammaPos = (pMouse->GetCursorPos(&a2)->x - 42) / 17; | |
743 v22 = (double)(signed int)uGammaPos * 0.1 + 0.6; | |
744 pGame->pGammaController->Initialize(v22); | |
745 } | |
369 | 746 pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); |
747 continue; | |
0 | 748 case UIMSG_ToggleBloodsplats: |
749 pGame->ToggleFlags2(0x20u); | |
4 | 750 continue; |
0 | 751 case UIMSG_ToggleColoredLights: |
752 pRenderer->bUseColoredLights = pRenderer->bUseColoredLights == 0; | |
4 | 753 continue; |
0 | 754 case UIMSG_ToggleTint: |
755 pRenderer->bTinting = pRenderer->bTinting == 0; | |
4 | 756 continue; |
0 | 757 case UIMSG_ChangeMusicVolume: |
758 if ( uMessageParam == 4 ) | |
759 { | |
760 --uMusicVolimeMultiplier; | |
761 if ( (char)uMusicVolimeMultiplier < 1 ) | |
762 uMusicVolimeMultiplier = 0; | |
978 | 763 GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); |
4 | 764 if ( uMusicVolimeMultiplier ) |
328 | 765 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); |
766 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); | |
4 | 767 continue; |
0 | 768 } |
769 if ( uMessageParam == 5 ) | |
770 { | |
771 ++uMusicVolimeMultiplier; | |
772 if ( (char)uMusicVolimeMultiplier > 9 ) | |
773 uMusicVolimeMultiplier = 9; | |
978 | 774 GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); |
4 | 775 if ( uMusicVolimeMultiplier ) |
328 | 776 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); |
777 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); | |
4 | 778 continue; |
0 | 779 } |
780 uMusicVolimeMultiplier = (pMouse->GetCursorPos(&v202)->x - 263) / 17; | |
781 if ( (char)uMusicVolimeMultiplier > 9 ) | |
782 uMusicVolimeMultiplier = 9; | |
783 if ( uMusicVolimeMultiplier ) | |
328 | 784 pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f, 0); |
785 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
4 | 786 continue; |
0 | 787 case UIMSG_ChangeSoundVolume: |
369 | 788 if ( uMessageParam == 4 )//reduce sound level button left |
0 | 789 { |
790 --uSoundVolumeMultiplier; | |
791 if ( (char)uSoundVolumeMultiplier < 1 ) | |
792 uSoundVolumeMultiplier = 0; | |
978 | 793 GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); |
328 | 794 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
795 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); | |
796 continue; | |
797 } | |
369 | 798 if ( uMessageParam == 5 )//Increase sound level button right |
0 | 799 { |
800 ++uSoundVolumeMultiplier; | |
801 if ( (char)uSoundVolumeMultiplier > 8 ) | |
802 uSoundVolumeMultiplier = 9; | |
978 | 803 //v168 = 1; |
0 | 804 v24 = 435; |
961 | 805 //v154 = (int)pBtn_SliderRight; |
978 | 806 GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); |
328 | 807 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
369 | 808 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); |
809 continue; | |
0 | 810 } |
811 uSoundVolumeMultiplier = (pMouse->GetCursorPos(&v207)->x - 263) / 17; | |
812 if ( (char)uSoundVolumeMultiplier > 8 ) | |
813 uSoundVolumeMultiplier = 9; | |
328 | 814 pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); |
369 | 815 pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); |
816 continue; | |
0 | 817 case UIMSG_ToggleFlipOnExit: |
818 bFlipOnExit = bFlipOnExit == 0; | |
4 | 819 continue; |
0 | 820 case UIMSG_ToggleAlwaysRun: |
821 bAlwaysRun = bAlwaysRun == 0; | |
4 | 822 continue; |
0 | 823 case UIMSG_ToggleWalkSound: |
824 bWalkSound = bWalkSound == 0; | |
4 | 825 continue; |
0 | 826 case UIMSG_ToggleShowDamage: |
827 bShowDamage = bShowDamage == 0; | |
4 | 828 continue; |
0 | 829 case UIMSG_ChangeVoiceVolume: |
830 if ( uMessageParam == 4 ) | |
831 { | |
832 --uVoicesVolumeMultiplier; | |
833 if ( (char)uVoicesVolumeMultiplier < 1 ) | |
834 uVoicesVolumeMultiplier = 0; | |
978 | 835 GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); |
4 | 836 if ( !uVoicesVolumeMultiplier ) |
837 continue; | |
369 | 838 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
839 continue; | |
0 | 840 } |
841 if ( uMessageParam == 5 ) | |
842 { | |
843 ++uVoicesVolumeMultiplier; | |
844 if ( (char)uVoicesVolumeMultiplier > 8 ) | |
845 uVoicesVolumeMultiplier = 9; | |
978 | 846 GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); |
4 | 847 if ( !uVoicesVolumeMultiplier ) |
848 continue; | |
369 | 849 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
850 continue; | |
0 | 851 } |
852 uVoicesVolumeMultiplier = (pMouse->GetCursorPos(&v205)->x - 263) / 17; | |
853 if ( (char)uVoicesVolumeMultiplier > 8 ) | |
854 uVoicesVolumeMultiplier = 9; | |
855 if ( !uVoicesVolumeMultiplier ) | |
4 | 856 continue; |
369 | 857 pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); |
858 continue; | |
0 | 859 case UIMSG_SetTurnSpeed: |
860 if ( uMessageParam ) | |
861 pParty->sRotationY = uMessageParam * pParty->sRotationY / uMessageParam; | |
862 uTurnSpeed = uMessageParam; | |
4 | 863 continue; |
0 | 864 case UIMSG_SetGraphicsMode: |
865 if ( !bUseLoResSprites ) | |
866 { | |
867 byte_6BE388_graphicsmode = uMessageParam; | |
868 MM7Initialization(); | |
4 | 869 continue; |
0 | 870 } |
871 if ( uMessageParam ) | |
872 { | |
873 if ( uMessageParam == 1 ) | |
874 { | |
875 byte_6BE388_graphicsmode = 0; | |
876 } | |
877 else | |
878 { | |
879 if ( uMessageParam != 2 ) | |
4 | 880 continue; |
0 | 881 byte_6BE388_graphicsmode = 1; |
882 } | |
4 | 883 MM7Initialization(); |
884 continue; | |
0 | 885 } |
886 ModalWindow(pNPCTopics[453].pText, 0); | |
4 | 887 continue; |
369 | 888 case UIMSG_GameMenu_ReturnToGame: |
0 | 889 pGUIWindow_CurrentMenu->Release(); |
890 pEventTimer->Resume(); | |
369 | 891 pCurrentScreen = SCREEN_GAME; |
978 | 892 viewparams->bRedrawGameUI = 1; |
369 | 893 stru_506E40.Release(); |
894 continue; | |
0 | 895 case UIMSG_OpenQuestBook: |
896 if ( pMessageQueue_50CBD0->uNumMessages ) | |
897 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
898 if ( pCurrentScreen ) | |
899 pGUIWindow_CurrentMenu->Release(); | |
900 pEventTimer->Pause(); | |
901 pAudioPlayer->StopChannels(-1, -1); | |
902 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); | |
960 | 903 pBooksWindow = GUIWindow::Create(493u, 355u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Quests, 0); |
0 | 904 bFlashQuestBook = 0; |
4 | 905 continue; |
0 | 906 case UIMSG_OpenAutonotes: |
907 if ( pMessageQueue_50CBD0->uNumMessages ) | |
908 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
909 if ( pCurrentScreen ) | |
910 pGUIWindow_CurrentMenu->Release(); | |
911 pEventTimer->Pause(); | |
912 pAudioPlayer->StopChannels(-1, -1); | |
913 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); | |
960 | 914 pBooksWindow = GUIWindow::Create(527u, 353u, 0, 0, WINDOW_BooksWindow, (int)pBtn_Autonotes, 0); |
0 | 915 bFlashAutonotesBook = 0; |
4 | 916 continue; |
0 | 917 case UIMSG_OpenMapBook: |
918 if ( pMessageQueue_50CBD0->uNumMessages ) | |
919 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
920 if ( pCurrentScreen ) | |
921 pGUIWindow_CurrentMenu->Release(); | |
922 pEventTimer->Pause(); | |
693 | 923 viewparams->sViewCenterX = pParty->vPosition.x; |
924 viewparams->sViewCenterY = pParty->vPosition.y; | |
0 | 925 pAudioPlayer->StopChannels(-1, -1); |
960 | 926 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); |
927 pBooksWindow = GUIWindow::Create(546, 353, 0, 0, WINDOW_BooksWindow, (int)pBtn_Maps, 0); | |
4 | 928 continue; |
0 | 929 case UIMSG_OpenCalendar: |
930 if ( pMessageQueue_50CBD0->uNumMessages ) | |
931 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
932 if ( pCurrentScreen ) | |
933 pGUIWindow_CurrentMenu->Release(); | |
934 pEventTimer->Pause(); | |
935 pAudioPlayer->StopChannels(-1, -1); | |
369 | 936 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); |
960 | 937 pBooksWindow = GUIWindow::Create(570, 354, 0, 0, WINDOW_BooksWindow, (int)pBtn_Calendar, 0); |
4 | 938 continue; |
0 | 939 case UIMSG_OpenHistoryBook: |
940 if ( pMessageQueue_50CBD0->uNumMessages ) | |
941 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
942 if ( pCurrentScreen ) | |
943 pGUIWindow_CurrentMenu->Release(); | |
944 pEventTimer->Pause(); | |
945 pAudioPlayer->StopChannels(-1, -1); | |
946 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, uMessage, 0); | |
960 | 947 pBooksWindow = GUIWindow::Create(0x258u, 0x169u, 0, 0, WINDOW_BooksWindow, (int)pBtn_History, 0); |
0 | 948 bFlashHistoryBook = 0; |
4 | 949 continue; |
369 | 950 case UIMSG_Escape:// Escape and return to game |
0 | 951 back_to_game(); |
952 if ( pMessageQueue_50CBD0->uNumMessages ) | |
953 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
990 | 954 switch ( pCurrentScreen ) |
955 { | |
956 case SCREEN_E: | |
957 __debugbreak(); | |
958 case SCREEN_NPC_DIALOGUE: | |
959 case SCREEN_CHEST: | |
960 case SCREEN_CHEST_INVENTORY: | |
961 case SCREEN_CHANGE_LOCATION: | |
962 case SCREEN_INPUT_BLV: | |
963 case SCREEN_QUICK_REFERENCE: | |
0 | 964 if ( dword_50CDC8 ) |
990 | 965 break; |
11 | 966 CloseWindowBackground(); |
978 | 967 uMessageParam = 1; |
990 | 968 break; |
969 case SCREEN_HOUSE: | |
970 if ( !dword_50CDC8 && !dword_5C35C8 ) | |
971 { | |
972 CloseWindowBackground(); | |
973 dword_5C35C8 = 0; | |
974 uMessageParam = 1; | |
975 break; | |
976 } | |
977 break; | |
978 } | |
0 | 979 if ( !ptr_507BDC ) |
980 { | |
981 pRenderer->ClearZBuffer(0, 479); | |
978 | 982 viewparams->bRedrawGameUI = 1; |
983 viewparams->field_48 = 1; | |
0 | 984 if ( pCurrentScreen ) |
985 { | |
151 | 986 if ( pCurrentScreen > SCREEN_67 ) |
0 | 987 { |
151 | 988 if ( pCurrentScreen == SCREEN_QUICK_REFERENCE ) |
990 | 989 { |
990 pIcons_LOD->_4114F2(); | |
991 if ( pGUIWindow_Settings ) | |
992 { | |
993 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
994 { | |
995 pMouse->SetCursorBitmap("MICON2"); | |
996 } | |
997 else | |
998 { | |
999 pGUIWindow_Settings->Release(); | |
1000 pGUIWindow_Settings = 0; | |
1001 pMouse->SetCursorBitmap("MICON1"); | |
1002 GameUI_Footer_TimeLeft = 0; | |
1003 unk_50C9A0 = 0; | |
1004 back_to_game(); | |
1005 } | |
1006 } | |
1007 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
1008 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1009 pGUIWindow_CurrentMenu->Release(); | |
1010 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
1011 window_SpeakInHouse = 0; | |
1012 pGUIWindow_CurrentMenu = 0; | |
1013 pEventTimer->Resume(); | |
1014 pCurrentScreen = SCREEN_GAME; | |
1015 viewparams->bRedrawGameUI = 1; | |
1016 pIcons_LOD->_4355F7(); | |
1017 continue; | |
1018 } | |
0 | 1019 } |
1020 else | |
1021 { | |
151 | 1022 if ( pCurrentScreen < SCREEN_64 ) |
0 | 1023 { |
1024 switch ( pCurrentScreen ) | |
1025 { | |
151 | 1026 case SCREEN_CASTING: |
0 | 1027 pIcons_LOD->_4114F2(); |
1028 if ( some_active_character ) | |
1029 { | |
1030 uActiveCharacter = some_active_character; | |
1031 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1032 some_active_character = 0; | |
1033 if ( pParty->bTurnBasedModeOn ) | |
1034 pTurnEngine->_40471C(); | |
1035 dword_50C9D0 = 0; | |
1036 dword_50C9D4 = 0; | |
1037 dword_50C9D8 = 0; | |
1038 } | |
1039 if ( ptr_50C9A4 && ptr_50C9A4->uItemID ) | |
1040 { | |
1041 LOBYTE(ptr_50C9A4->uAttributes) &= 0xFu; | |
984 | 1042 _50C9A8_item_enchantment_timer = 0; |
0 | 1043 ptr_50C9A4 = 0; |
1044 } | |
4 | 1045 if ( pGUIWindow_Settings ) |
1046 { | |
151 | 1047 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1048 { |
1049 pMouse->SetCursorBitmap("MICON2"); | |
1050 } | |
1051 else | |
1052 { | |
1053 pGUIWindow_Settings->Release(); | |
1054 pGUIWindow_Settings = 0; | |
1055 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1056 GameUI_Footer_TimeLeft = 0; |
4 | 1057 unk_50C9A0 = 0; |
1058 back_to_game(); | |
1059 } | |
1060 } | |
978 | 1061 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1062 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1063 pGUIWindow_CurrentMenu->Release(); | |
336 | 1064 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1065 window_SpeakInHouse = 0; | |
4 | 1066 pGUIWindow_CurrentMenu = 0; |
1067 pEventTimer->Resume(); | |
151 | 1068 pCurrentScreen = SCREEN_GAME; |
978 | 1069 viewparams->bRedrawGameUI = 1; |
4 | 1070 pIcons_LOD->_4355F7(); |
1071 continue; | |
151 | 1072 case SCREEN_BOOKS: |
0 | 1073 pBooksWindow->Release(); |
1074 //crt_deconstruct_ptr_6A0118(); | |
1075 pBooksWindow = 0; | |
1076 pEventTimer->Resume(); | |
4 | 1077 if ( pGUIWindow_Settings ) |
1078 { | |
151 | 1079 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1080 { |
1081 pMouse->SetCursorBitmap("MICON2"); | |
1082 } | |
1083 else | |
1084 { | |
1085 pGUIWindow_Settings->Release(); | |
1086 pGUIWindow_Settings = 0; | |
1087 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1088 GameUI_Footer_TimeLeft = 0; |
4 | 1089 unk_50C9A0 = 0; |
1090 back_to_game(); | |
1091 } | |
1092 } | |
978 | 1093 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1094 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1095 pGUIWindow_CurrentMenu->Release(); | |
336 | 1096 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1097 window_SpeakInHouse = 0; | |
4 | 1098 pGUIWindow_CurrentMenu = 0; |
1099 pEventTimer->Resume(); | |
151 | 1100 pCurrentScreen = SCREEN_GAME; |
978 | 1101 viewparams->bRedrawGameUI = 1; |
4 | 1102 pIcons_LOD->_4355F7(); |
1103 continue; | |
151 | 1104 case SCREEN_SAVEGAME: |
1105 case SCREEN_LOADGAME: | |
0 | 1106 pIcons_LOD->_4114F2(); |
1107 //crt_deconstruct_ptr_6A0118(); | |
4 | 1108 stru_506E40.Release(); |
1109 break; | |
987 | 1110 case SCREEN_CHEST_INVENTORY: |
151 | 1111 pCurrentScreen = SCREEN_CHEST; |
4 | 1112 continue; |
151 | 1113 case SCREEN_CHEST: |
0 | 1114 pWindow2 = pChestWindow; |
1115 pWindow2->Release(); | |
1116 pIcons_LOD->_4114F2(); | |
151 | 1117 pCurrentScreen = SCREEN_GAME; |
978 | 1118 viewparams->bRedrawGameUI = 1; |
0 | 1119 pEventTimer->Resume(); |
4 | 1120 continue; |
151 | 1121 case SCREEN_19: |
987 | 1122 __debugbreak(); |
4 | 1123 pWindow2 = ptr_507BC8; |
1124 pWindow2->Release(); | |
1125 pIcons_LOD->_4114F2(); | |
151 | 1126 pCurrentScreen = SCREEN_GAME; |
978 | 1127 viewparams->bRedrawGameUI = 1; |
4 | 1128 pEventTimer->Resume(); |
1129 continue; | |
369 | 1130 case SCREEN_OPTIONS://Close |
948 | 1131 options_menu_skin.Relaease(); |
1006 | 1132 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1133 WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier); |
1134 WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier); | |
1135 WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier); | |
1136 WriteWindowsRegistryInt("WalkSound", bWalkSound); | |
1137 WriteWindowsRegistryInt("ShowDamage", bShowDamage); | |
1138 WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode); | |
1139 WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun); | |
1140 WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit); | |
1141 if ( !uTurnSpeed ) | |
1142 { | |
978 | 1143 WriteWindowsRegistryInt("TurnDelta", 3); |
4 | 1144 stru_506E40.Release(); |
1145 break; | |
0 | 1146 } |
1147 if ( uTurnSpeed == 64 ) | |
1148 { | |
978 | 1149 WriteWindowsRegistryInt("TurnDelta", 2); |
4 | 1150 stru_506E40.Release(); |
1151 break; | |
0 | 1152 } |
1153 if ( uTurnSpeed != 128 ) | |
4 | 1154 { |
1155 stru_506E40.Release(); | |
1156 break; | |
1157 } | |
978 | 1158 WriteWindowsRegistryInt("TurnDelta", 1); |
0 | 1159 stru_506E40.Release(); |
1160 break; | |
151 | 1161 case SCREEN_MENU: |
1006 | 1162 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1163 pIcons_LOD->_4114F2(); |
1006 | 1164 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1165 pIcons_LOD->_4114F2(); |
4 | 1166 stru_506E40.Release(); |
1167 break; | |
151 | 1168 case SCREEN_VIDEO_OPTIONS: |
0 | 1169 if ( pRenderer->pRenderD3D ) |
1170 { | |
1171 WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights); | |
1172 WriteWindowsRegistryInt("Tinting", pRenderer->bTinting); | |
1173 WriteWindowsRegistryInt("Bloodsplats", (LOBYTE(pGame->uFlags2) >> 5) & 1); | |
1174 } | |
1175 if ( pRenderer->bWindowMode ) | |
4 | 1176 { |
1177 stru_506E40.Release(); | |
1178 break; | |
1179 } | |
978 | 1180 //v30 = uGammaPos; |
1181 //v31 = "GammaPos"; | |
1182 WriteWindowsRegistryInt("GammaPos", uGammaPos); | |
4 | 1183 stru_506E40.Release(); |
1184 break; | |
1031 | 1185 |
369 | 1186 case SCREEN_KEYBOARD_OPTIONS://Return to game |
0 | 1187 v197 = 1; |
1188 v32 = 0; | |
1031 | 1189 while ( !GameMenuUI_InvaligKeyBindingsFlags[v32]) |
0 | 1190 { |
1191 ++v32; | |
1192 if ( v32 >= 28 ) | |
1193 { | |
362 | 1194 thisb = (signed int)&uTextureID_Optkb; |
1031 | 1195 assert(false && "Invalid condition values"); |
0 | 1196 do |
1197 { | |
1198 if ( *(int *)thisb ) | |
1199 pIcons_LOD->pTextures[*(int *)thisb].Release(); | |
1200 thisb += 4; | |
1201 } | |
1031 | 1202 while ( thisb < (signed int)0x00507C08 ); |
1203 | |
362 | 1204 memset(&uTextureID_Optkb, 0, 0x14u); |
1006 | 1205 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1206 uAction = 0; |
1207 do | |
1208 { | |
1209 v33 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
1210 if ( v33 != pPrevVirtualCidesMapping[uAction] ) | |
1211 { | |
1212 if ( v197 ) | |
1213 { | |
1214 v34 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
978 | 1215 GUI_ReplaceHotkey(v34, LOBYTE(pPrevVirtualCidesMapping[uAction]), 1); |
0 | 1216 v197 = 0; |
1217 } | |
1218 else | |
1219 { | |
1220 v35 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); | |
1221 GUI_ReplaceHotkey(v35, LOBYTE(pPrevVirtualCidesMapping[uAction]), 0); | |
1222 } | |
1223 } | |
978 | 1224 if ( uAction && uAction != 2 && uAction != 3 && uAction != 1 && uAction != 25 && uAction != 26 ) |
1225 pKeyToggleType = (KeyToggleType)1; | |
0 | 1226 else |
1227 pKeyToggleType = (KeyToggleType)0; | |
1228 pKeyActionMap->SetKeyMapping(uAction, pPrevVirtualCidesMapping[uAction], pKeyToggleType); | |
1229 ++uAction; | |
1230 } | |
1231 while ( uAction < 28 ); | |
1232 pKeyActionMap->StoreMappings(); | |
4 | 1233 stru_506E40.Release(); |
1234 break; | |
0 | 1235 } |
1236 } | |
369 | 1237 break; |
916 | 1238 case SCREEN_REST://close rest screen |
0 | 1239 if ( dword_506F14 ) |
1240 { | |
1241 Rest(_506F18_num_hours_to_sleep); | |
1242 pParty->pPlayers[3].pConditions[2] = 0i64; | |
1243 pParty->pPlayers[2].pConditions[2] = 0i64; | |
1244 pParty->pPlayers[1].pConditions[2] = 0i64; | |
1245 pParty->pPlayers[0].pConditions[2] = 0i64; | |
1246 } | |
1247 pTexture_RestUI_CurrentSkyFrame->Release(); | |
1248 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
1249 pTexture_RestUI_CurrentHourglassFrame = 0; | |
1250 pTexture_RestUI_CurrentSkyFrame = 0; | |
1006 | 1251 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 1252 pIcons_LOD->_4114F2(); |
1253 _506F18_num_hours_to_sleep = 0; | |
1254 dword_506F14 = 0; | |
978 | 1255 dword_507B94 = 1; |
4 | 1256 if ( pGUIWindow_Settings ) |
1257 { | |
151 | 1258 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1259 { |
1260 pMouse->SetCursorBitmap("MICON2"); | |
1261 } | |
1262 else | |
1263 { | |
1264 pGUIWindow_Settings->Release(); | |
1265 pGUIWindow_Settings = 0; | |
1266 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1267 GameUI_Footer_TimeLeft = 0; |
4 | 1268 unk_50C9A0 = 0; |
1269 back_to_game(); | |
1270 } | |
1271 } | |
978 | 1272 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1273 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1274 pGUIWindow_CurrentMenu->Release(); | |
336 | 1275 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1276 window_SpeakInHouse = 0; | |
4 | 1277 pGUIWindow_CurrentMenu = 0; |
1278 pEventTimer->Resume(); | |
151 | 1279 pCurrentScreen = SCREEN_GAME; |
978 | 1280 viewparams->bRedrawGameUI = 1; |
4 | 1281 pIcons_LOD->_4355F7(); |
1282 continue; | |
151 | 1283 case SCREEN_E: |
987 | 1284 __debugbreak(); |
0 | 1285 pGUIWindow_CurrentMenu->Release(); |
151 | 1286 pCurrentScreen = SCREEN_HOUSE; |
0 | 1287 pIcons_LOD->_4114F2(); |
4 | 1288 continue; |
151 | 1289 case SCREEN_HOUSE: |
0 | 1290 if ( uDialogueType ) |
1291 uDialogueType = 0; | |
978 | 1292 if ( uGameState == GAME_STATE_2 ) |
0 | 1293 { |
1294 while ( sub_4BD8B5() ) | |
1295 ; | |
1296 } | |
1297 else | |
1298 { | |
1299 if ( sub_4BD8B5() ) | |
4 | 1300 continue; |
0 | 1301 } |
1302 sub_4B1D27(); | |
978 | 1303 pAudioPlayer->PlaySound(SOUND_7, 814, 0, -1, 0, 0, 0, 0); |
0 | 1304 pVideoPlayer->Unload(); |
336 | 1305 pGUIWindow_CurrentMenu = window_SpeakInHouse; |
4 | 1306 if ( pGUIWindow_Settings ) |
1307 { | |
151 | 1308 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1309 { |
1310 pMouse->SetCursorBitmap("MICON2"); | |
1311 } | |
1312 else | |
1313 { | |
1314 pGUIWindow_Settings->Release(); | |
1315 pGUIWindow_Settings = 0; | |
1316 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1317 GameUI_Footer_TimeLeft = 0; |
4 | 1318 unk_50C9A0 = 0; |
1319 back_to_game(); | |
1320 } | |
1321 } | |
978 | 1322 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1323 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1324 pGUIWindow_CurrentMenu->Release(); | |
336 | 1325 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1326 window_SpeakInHouse = 0; | |
4 | 1327 pGUIWindow_CurrentMenu = 0; |
1328 pEventTimer->Resume(); | |
151 | 1329 pCurrentScreen = SCREEN_GAME; |
1035 | 1330 viewparams->bRedrawGameUI = true; |
4 | 1331 pIcons_LOD->_4355F7(); |
1332 continue; | |
987 | 1333 case SCREEN_INPUT_BLV://click escape |
0 | 1334 if ( uCurrentHouse_Animation == 153 ) |
735 | 1335 PlayHouseSound(0x99u, HouseSound_Greeting_2); |
0 | 1336 pVideoPlayer->Unload(); |
4 | 1337 if ( dword_5B65CC ) |
1338 { | |
1339 pParty->field_709 = 0; | |
1340 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; | |
1035 | 1341 pParty->CountHirelings(); |
1342 viewparams->bRedrawGameUI = true; | |
4 | 1343 dword_5B65CC = 0; |
1344 } | |
987 | 1345 DialogueEnding(); |
1346 pCurrentScreen = SCREEN_GAME; | |
1035 | 1347 viewparams->bRedrawGameUI = true; |
987 | 1348 continue; |
1349 case SCREEN_NPC_DIALOGUE://click escape | |
0 | 1350 if ( dword_5B65CC ) |
1351 { | |
1352 pParty->field_709 = 0; | |
1353 LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; | |
1035 | 1354 pParty->CountHirelings(); |
1355 viewparams->bRedrawGameUI = true; | |
0 | 1356 dword_5B65CC = 0; |
1357 } | |
987 | 1358 //goto LABEL_317; |
1359 DialogueEnding(); | |
1360 pCurrentScreen = SCREEN_GAME; | |
1035 | 1361 viewparams->bRedrawGameUI = true; |
987 | 1362 continue; |
1363 case SCREEN_BRANCHLESS_NPC_DIALOG://click escape | |
783 | 1364 memset(GameUI_Footer_TimedString, 0, 0xC8u); |
0 | 1365 sub_4452BB(); |
987 | 1366 DialogueEnding(); |
1367 pCurrentScreen = SCREEN_GAME; | |
1035 | 1368 viewparams->bRedrawGameUI = true; |
987 | 1369 continue; |
1370 case SCREEN_CHANGE_LOCATION://click escape | |
0 | 1371 if ( pParty->vPosition.x < -22528 ) |
1372 pParty->vPosition.x = -22528; | |
1373 if ( pParty->vPosition.x > 22528 ) | |
1374 pParty->vPosition.x = 22528; | |
1375 if ( pParty->vPosition.y < -22528 ) | |
1376 pParty->vPosition.y = -22528; | |
1377 if ( pParty->vPosition.y > 22528 ) | |
1378 pParty->vPosition.y = 22528; | |
987 | 1379 DialogueEnding(); |
1380 pCurrentScreen = SCREEN_GAME; | |
1035 | 1381 viewparams->bRedrawGameUI = true; |
987 | 1382 continue; |
151 | 1383 case SCREEN_VIDEO: |
0 | 1384 pVideoPlayer->Unload(); |
4 | 1385 continue; |
151 | 1386 case SCREEN_CHARACTERS: |
992 | 1387 CharacterUI_ReleaseButtons(); |
990 | 1388 sub_419379(); |
1389 pIcons_LOD->_4114F2(); | |
1390 if ( pGUIWindow_Settings ) | |
1391 { | |
1392 if ( pCurrentScreen == SCREEN_CHARACTERS ) | |
1393 { | |
1394 pMouse->SetCursorBitmap("MICON2"); | |
1395 } | |
1396 else | |
1397 { | |
1398 pGUIWindow_Settings->Release(); | |
1399 pGUIWindow_Settings = 0; | |
1400 pMouse->SetCursorBitmap("MICON1"); | |
1401 GameUI_Footer_TimeLeft = 0; | |
1402 unk_50C9A0 = 0; | |
1403 back_to_game(); | |
1404 } | |
1405 } | |
1406 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) | |
1407 uActiveCharacter = pParty->GetNextActiveCharacter(); | |
1408 pGUIWindow_CurrentMenu->Release(); | |
1409 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) | |
1410 window_SpeakInHouse = 0; | |
1411 pGUIWindow_CurrentMenu = 0; | |
1412 pEventTimer->Resume(); | |
1413 pCurrentScreen = SCREEN_GAME; | |
1035 | 1414 viewparams->bRedrawGameUI = true; |
990 | 1415 pIcons_LOD->_4355F7(); |
1416 continue; | |
0 | 1417 default: |
4 | 1418 if ( pGUIWindow_Settings ) |
1419 { | |
151 | 1420 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1421 { |
1422 pMouse->SetCursorBitmap("MICON2"); | |
1423 } | |
1424 else | |
1425 { | |
1426 pGUIWindow_Settings->Release(); | |
1427 pGUIWindow_Settings = 0; | |
1428 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1429 GameUI_Footer_TimeLeft = 0; |
4 | 1430 unk_50C9A0 = 0; |
1431 back_to_game(); | |
1432 } | |
1433 } | |
978 | 1434 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1435 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1436 pGUIWindow_CurrentMenu->Release(); | |
336 | 1437 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1438 window_SpeakInHouse = 0; | |
4 | 1439 pGUIWindow_CurrentMenu = 0; |
1440 pEventTimer->Resume(); | |
151 | 1441 pCurrentScreen = SCREEN_GAME; |
978 | 1442 viewparams->bRedrawGameUI = 1; |
4 | 1443 pIcons_LOD->_4355F7(); |
1444 continue; | |
0 | 1445 } |
4 | 1446 if ( pGUIWindow_Settings ) |
1447 { | |
151 | 1448 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
4 | 1449 { |
1450 pMouse->SetCursorBitmap("MICON2"); | |
1451 } | |
1452 else | |
1453 { | |
1454 pGUIWindow_Settings->Release(); | |
1455 pGUIWindow_Settings = 0; | |
1456 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1457 GameUI_Footer_TimeLeft = 0; |
4 | 1458 unk_50C9A0 = 0; |
1459 back_to_game(); | |
1460 } | |
1461 } | |
978 | 1462 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
4 | 1463 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1464 pGUIWindow_CurrentMenu->Release(); | |
336 | 1465 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1466 window_SpeakInHouse = 0; | |
4 | 1467 pGUIWindow_CurrentMenu = 0; |
1468 pEventTimer->Resume(); | |
151 | 1469 pCurrentScreen = SCREEN_GAME; |
1035 | 1470 viewparams->bRedrawGameUI = true; |
4 | 1471 pIcons_LOD->_4355F7(); |
1472 continue; | |
0 | 1473 } |
991 | 1474 CharacterUI_ReleaseButtons(); |
0 | 1475 sub_419379(); |
1476 pIcons_LOD->_4114F2(); | |
1477 } | |
1478 if ( pGUIWindow_Settings ) | |
1479 { | |
151 | 1480 if ( pCurrentScreen == SCREEN_CHARACTERS ) |
0 | 1481 { |
1482 pMouse->SetCursorBitmap("MICON2"); | |
1483 } | |
1484 else | |
1485 { | |
1486 pGUIWindow_Settings->Release(); | |
1487 pGUIWindow_Settings = 0; | |
1488 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1489 GameUI_Footer_TimeLeft = 0; |
0 | 1490 unk_50C9A0 = 0; |
1491 back_to_game(); | |
1492 } | |
1493 } | |
978 | 1494 if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) |
0 | 1495 uActiveCharacter = pParty->GetNextActiveCharacter(); |
1496 pGUIWindow_CurrentMenu->Release(); | |
336 | 1497 if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) |
1498 window_SpeakInHouse = 0; | |
0 | 1499 pGUIWindow_CurrentMenu = 0; |
1500 pEventTimer->Resume(); | |
151 | 1501 pCurrentScreen = SCREEN_GAME; |
1035 | 1502 viewparams->bRedrawGameUI = true; |
0 | 1503 pIcons_LOD->_4355F7(); |
4 | 1504 continue; |
0 | 1505 } |
1506 if ( !pGUIWindow_Settings )//Draw Menu | |
1507 { | |
1508 dword_6BE138 = -1; | |
978 | 1509 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, 1); |
0 | 1510 pEventTimer->Pause(); |
1511 pAudioPlayer->StopChannels(-1, -1); | |
1035 | 1512 pCurrentScreen = SCREEN_MENU; |
1513 | |
0 | 1514 ++pIcons_LOD->uTexturePacksCount; |
1515 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
1516 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
1035 | 1517 |
961 | 1518 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0); |
362 | 1519 uTextureID_Options = pIcons_LOD->LoadTexture("options", TEXTURE_16BIT_PALETTE); |
1520 uTextureID_New1 = pIcons_LOD->LoadTexture("new1", TEXTURE_16BIT_PALETTE); | |
1521 uTextureID_Load1 = pIcons_LOD->LoadTexture("load1", TEXTURE_16BIT_PALETTE); | |
1522 uTextureID_Save1 = pIcons_LOD->LoadTexture("save1", TEXTURE_16BIT_PALETTE); | |
1523 uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE); | |
1524 uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); | |
1525 uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE); | |
978 | 1526 pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, 1, 0, UIMSG_StartNewGame, 0, 0x4Eu, |
0 | 1527 pGlobalTXT_LocalizationStrings[614],// "New Game" |
710 | 1528 pIcons_LOD->GetTexture(uTextureID_New1), 0); |
978 | 1529 pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u, |
0 | 1530 pGlobalTXT_LocalizationStrings[615],// "Save Game" |
710 | 1531 pIcons_LOD->GetTexture(uTextureID_Save1), 0); |
978 | 1532 pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu, |
0 | 1533 pGlobalTXT_LocalizationStrings[616],// "Load Game" |
710 | 1534 pIcons_LOD->GetTexture(uTextureID_Load1), 0); |
978 | 1535 pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u, |
0 | 1536 pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:"" |
710 | 1537 pIcons_LOD->GetTexture(uTextureID_Controls1), 0); |
978 | 1538 pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, 1, 0, UIMSG_Quit, 0, 0x51u, |
0 | 1539 pGlobalTXT_LocalizationStrings[618],// "Quit" |
710 | 1540 pIcons_LOD->GetTexture(uTextureID_Quit1), 0); |
978 | 1541 pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, 1, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u, |
0 | 1542 pGlobalTXT_LocalizationStrings[619],// "Return to Game" |
710 | 1543 pIcons_LOD->GetTexture(uTextureID_Resume1), 0); |
978 | 1544 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(6, 1, 0, 0); |
1545 viewparams->field_48 = 1; | |
0 | 1546 stru_506E40.Release(); |
1547 uNumSeconds = (unsigned int)MakeScreenshot(155, 117); | |
1548 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); | |
1549 free((void *)uNumSeconds); | |
1550 stru_506E40._40E55E("gamma.pcx", 0); | |
4 | 1551 continue; |
0 | 1552 } |
1000 | 1553 pGUIWindow_Settings->Release(); |
11 | 1554 pGUIWindow_Settings = 0; |
1555 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1556 GameUI_Footer_TimeLeft = 0; |
11 | 1557 unk_50C9A0 = 0; |
1558 back_to_game(); | |
1559 continue; | |
0 | 1560 } |
1561 sub_41426F(); | |
1562 continue; | |
111 | 1563 case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel |
0 | 1564 if ( uMessageParam ) |
1565 { | |
962 | 1566 GUIWindow::Create(626, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCRight, 0); |
0 | 1567 v37 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + (unsigned __int8)pParty->field_70A - 2; |
1568 if ( (unsigned __int8)pParty->field_709 < v37 ) | |
1569 { | |
111 | 1570 ++pParty->field_709;//??? maybe number of the first cell??? |
0 | 1571 if ( (unsigned __int8)pParty->field_709 >= v37 ) |
1572 pParty->field_709 = (pParty->pHirelings[0].pName != 0) + (pParty->pHirelings[1].pName != 0) + pParty->field_70A - 2; | |
1573 } | |
1574 } | |
1575 else | |
1576 { | |
962 | 1577 GUIWindow::Create(469, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCLeft, 0); |
0 | 1578 if ( pParty->field_709 ) |
1579 { | |
1580 --pParty->field_709; | |
1581 if ( pParty->field_709 < 1 ) | |
1582 pParty->field_709 = 0; | |
1583 } | |
1584 } | |
994 | 1585 GameUI_DrawHiredNPCs(); |
4 | 1586 continue; |
434 | 1587 case UIMSG_TransitionUI_Confirm: |
0 | 1588 if ( pMessageQueue_50CBD0->uNumMessages ) |
1589 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
978 | 1590 dword_50CDC8 = 1; |
0 | 1591 sub_42FBDD(); |
758 | 1592 PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful); |
0 | 1593 pVideoPlayer->Unload(); |
960 | 1594 DialogueEnding(); |
978 | 1595 viewparams->bRedrawGameUI = 1; |
0 | 1596 if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz ) |
1597 { | |
1598 if ( dword_59117C_teleportx ) | |
1599 { | |
1600 pParty->vPosition.x = dword_59117C_teleportx; | |
1601 _5B65A8_npcdata_uflags_or_other = dword_59117C_teleportx; | |
1602 } | |
1603 if ( dword_591178_teleporty ) | |
1604 { | |
1605 pParty->vPosition.y = dword_591178_teleporty; | |
1606 _5B65AC_npcdata_fame_or_other = dword_591178_teleporty; | |
1607 } | |
1608 if ( dword_591174_teleportz ) | |
1609 { | |
1610 pParty->vPosition.z = dword_591174_teleportz; | |
1611 _5B65B0_npcdata_rep_or_other = dword_591174_teleportz; | |
1612 pParty->uFallStartY = dword_591174_teleportz; | |
1613 } | |
1614 if ( dword_591170_teleport_directiony ) | |
1615 { | |
1616 pParty->sRotationY = dword_591170_teleport_directiony; | |
1617 _5B65B4_npcdata_loword_house_or_other = dword_591170_teleport_directiony; | |
1618 } | |
1619 if ( dword_59116C_teleport_directionx ) | |
1620 { | |
1621 pParty->sRotationX = dword_59116C_teleport_directionx; | |
1622 _5B65B8_npcdata_hiword_house_or_other = dword_59116C_teleport_directionx; | |
1623 v38 = dword_591168_teleport_speedz; | |
1624 pParty->uFallSpeed = dword_591168_teleport_speedz; | |
1625 dword_5B65BC = dword_591168_teleport_speedz; | |
1626 } | |
1627 else | |
1628 { | |
1629 v38 = dword_5B65BC; | |
1630 } | |
1631 if ( *dword_591164_teleport_map_name != 48 ) | |
1632 { | |
1633 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)2; | |
1634 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; | |
1635 OnMapLeave(); | |
783 | 1636 sub_44987B(dword_591164_teleport_map_name, MapStartPoint_Party); |
0 | 1637 } |
1638 } | |
1639 else | |
1640 { | |
1052 | 1641 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); |
1642 } | |
0 | 1643 if ( !_strcmpi(byte_6BE3B0, "d05.blv") ) |
1644 pParty->uTimePlayed += 1474560i64; | |
4 | 1645 continue; |
960 | 1646 case UIMSG_TransitionWindowCloseBtn: |
11 | 1647 CloseWindowBackground(); |
0 | 1648 pVideoPlayer->Unload(); |
960 | 1649 DialogueEnding(); |
1035 | 1650 viewparams->bRedrawGameUI = true; |
910 | 1651 continue; |
0 | 1652 case UIMSG_CycleCharacters: |
1653 v39 = GetAsyncKeyState(VK_SHIFT); | |
910 | 1654 uActiveCharacter = CycleCharacter(v39); |
1035 | 1655 viewparams->bRedrawGameUI = true; |
910 | 1656 continue; |
783 | 1657 case UIMSG_OnTravelByFoot: |
0 | 1658 if ( pMessageQueue_50CBD0->uNumMessages ) |
1659 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
978 | 1660 dword_50CDC8 = 1; |
0 | 1661 sub_42FBDD(); |
1662 pNPCData4 = (NPCData *)GetTravelTime(); | |
1663 strcpy(pOutdoor->pLevelFilename, pCurrentMapName); | |
1664 if ( bUnderwater != 1 && pParty->bFlying | |
978 | 1665 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 ) |
1666 { | |
1667 viewparams->bRedrawGameUI = 1; | |
11 | 1668 CloseWindowBackground(); |
0 | 1669 if ( pParty->vPosition.x < -22528 ) |
1670 pParty->vPosition.x = -22528; | |
1671 if ( pParty->vPosition.x > 22528 ) | |
1672 pParty->vPosition.x = 22528; | |
1673 if ( pParty->vPosition.y < -22528 ) | |
1674 pParty->vPosition.y = -22528; | |
1675 if ( pParty->vPosition.y > 22528 ) | |
1676 pParty->vPosition.y = 22528; | |
960 | 1677 DialogueEnding(); |
151 | 1678 pCurrentScreen = SCREEN_GAME; |
0 | 1679 } |
1680 else | |
1681 { | |
1682 pParty->field_6E4 = 0; | |
1683 pParty->field_6E0 = 0; | |
978 | 1684 pCastSpellInfo->_427D48(1); |
960 | 1685 DialogueEnding(); |
0 | 1686 pEventTimer->Pause(); |
434 | 1687 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); |
0 | 1688 ++pGameLoadingUI_ProgressBar->uProgressMax; |
978 | 1689 SaveGame(1, 0); |
0 | 1690 pGameLoadingUI_ProgressBar->Progress(); |
1691 RestAndHeal(1440 * (signed int)pNPCData4); | |
1692 if ( pParty->uNumFoodRations ) | |
1693 { | |
1694 pParty->RestAndHeal(); | |
1695 if ( ((pParty->uNumFoodRations - (signed int)pNPCData4) & 0x80000000u) != 0 ) | |
1696 { | |
1697 pPlayer7 = pParty->pPlayers; | |
1698 do | |
1699 { | |
978 | 1700 pPlayer7->SetCondition(1, 0); |
0 | 1701 ++pPlayer7; |
1702 } | |
1703 while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings ); | |
766 | 1704 ++pParty->days_played_without_rest; |
0 | 1705 } |
1706 Party::TakeFood((unsigned int)pNPCData4); | |
1707 } | |
1708 else | |
1709 { | |
1710 pPlayer8 = pParty->pPlayers; | |
1711 do | |
1712 { | |
978 | 1713 pPlayer8->SetCondition(1, 0); |
0 | 1714 ++pPlayer8; |
1715 } | |
1716 while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings ); | |
766 | 1717 ++pParty->days_played_without_rest; |
0 | 1718 } |
1719 pPaletteManager->ResetNonLocked(); | |
1720 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
783 | 1721 strcpy(pCurrentMapName, pOut); |
1722 strcpy(pLevelName, pCurrentMapName); | |
1723 v41 = strtok(pLevelName, "."); | |
1724 strcpy(pLevelName, v41); | |
1725 Level_LoadEvtAndStr(pLevelName); | |
1726 pDecalBuilder->Reset(0); | |
0 | 1727 LoadLevel_InitializeLevelEvt(); |
1728 uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName); | |
1729 bUnderwater = 0; | |
1730 bNoNPCHiring = 0; | |
1731 pGame->uFlags2 &= 0xFFFFFFF7u; | |
1732 if ( Is_out15odm_underwater() ) | |
1733 { | |
1734 bUnderwater = 1; | |
1735 pGame->uFlags2 |= 8u; | |
1736 } | |
1737 if ( !_strcmpi(pCurrentMapName, "out15.odm") || !_strcmpi(pCurrentMapName, "d47.blv") ) | |
1738 bNoNPCHiring = 1; | |
1739 PrepareToLoadODM(1u, (OutdoorCamera *)1); | |
1740 pAudioPlayer->SetMapEAX(); | |
1741 bDialogueUI_InitializeActor_NPC_ID = 0; | |
1742 OnMapLoad(); | |
1743 pOutdoor->SetFog(); | |
1744 TeleportToStartingPoint(uLevel_StartingPointType); | |
783 | 1745 pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v213, 0); |
0 | 1746 pParty->uFallStartY = pParty->vPosition.z; |
1747 sub_461103(); | |
1748 pEventTimer->Resume(); | |
1749 viewparams->bRedrawGameUI = 1; | |
151 | 1750 pCurrentScreen = SCREEN_GAME; |
0 | 1751 pGameLoadingUI_ProgressBar->Release(); |
1752 } | |
978 | 1753 viewparams->bRedrawGameUI = 1; |
910 | 1754 continue; |
987 | 1755 case UIMSG_CHANGE_LOCATION_ClickCencelBtn: |
1756 CloseWindowBackground(); | |
1757 if ( pParty->vPosition.x < -22528 ) | |
1758 pParty->vPosition.x = -22528; | |
1759 if ( pParty->vPosition.x > 22528 ) | |
1760 pParty->vPosition.x = 22528; | |
1761 if ( pParty->vPosition.y < -22528 ) | |
1762 pParty->vPosition.y = -22528; | |
1763 if ( pParty->vPosition.y > 22528 ) | |
1764 pParty->vPosition.y = 22528; | |
1765 DialogueEnding(); | |
1766 pCurrentScreen = SCREEN_GAME; | |
1767 viewparams->bRedrawGameUI = 1; | |
1768 continue; | |
1769 case UIMSG_CastSpell_BE://??? | |
1770 __debugbreak(); | |
0 | 1771 if ( pRenderer->pRenderD3D ) |
1772 { | |
1773 LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
1774 } | |
1775 else | |
1776 { | |
1777 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210); | |
1778 pPoint = pMouse->GetCursorPos(&v208); | |
1779 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]]; | |
1780 } | |
1781 v44 = (unsigned __int16)v42; | |
848 | 1782 v45 = PID_TYPE(v44); |
0 | 1783 uNumSeconds = v44; |
848 | 1784 v46 = PID_ID(v44); |
0 | 1785 if ( v45 == 3 ) |
1786 { | |
1787 v47 = pActors[v46].uAIState == Dead; | |
11 | 1788 if ( !v47 ) |
1789 continue; | |
1000 | 1790 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1791 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1792 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1793 pSpellInfo->spell_target_pid = v44; | |
1794 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1795 pGUIWindow_Settings->Release(); | |
11 | 1796 pGUIWindow_Settings = 0; |
1797 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1798 GameUI_Footer_TimeLeft = 0; |
11 | 1799 unk_50C9A0 = 0; |
1800 back_to_game(); | |
1801 continue; | |
0 | 1802 } |
1803 if ( v45 == 2 ) | |
1804 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
1805 v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0; |
0 | 1806 if ( !v47 ) |
4 | 1807 continue; |
1000 | 1808 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1809 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1810 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1811 pSpellInfo->spell_target_pid = v44; | |
1812 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1813 pGUIWindow_Settings->Release(); | |
11 | 1814 pGUIWindow_Settings = 0; |
1815 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1816 GameUI_Footer_TimeLeft = 0; |
11 | 1817 unk_50C9A0 = 0; |
1818 back_to_game(); | |
1819 continue; | |
0 | 1820 } |
1821 if ( v45 == 5 ) | |
1822 { | |
1823 v48 = pLevelDecorations[v46].field_16_event_id == 0; | |
1824 } | |
1825 else | |
1826 { | |
1827 if ( v45 != 6 ) | |
4 | 1828 continue; |
978 | 1829 if ( uCurrentlyLoadedLevelType != 1 ) |
0 | 1830 { |
1831 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F]; | |
1832 if ( !(pODMFace->uAttributes & 0x02000000) || !pODMFace->sCogTriggeredID ) | |
4 | 1833 continue; |
0 | 1834 v44 = uNumSeconds; |
1000 | 1835 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1836 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1837 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1838 pSpellInfo->spell_target_pid = v44; | |
1839 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1840 pGUIWindow_Settings->Release(); | |
11 | 1841 pGUIWindow_Settings = 0; |
1842 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1843 GameUI_Footer_TimeLeft = 0; |
11 | 1844 unk_50C9A0 = 0; |
1845 back_to_game(); | |
1846 continue; | |
0 | 1847 } |
1848 pBLVFace = &pIndoor->pFaces[v46]; | |
1849 if ( !(BYTE3(pBLVFace->uAttributes) & 2) ) | |
4 | 1850 continue; |
0 | 1851 v48 = pIndoor->pFaceExtras[pBLVFace->uFaceExtraID].uEventID == 0; |
1852 } | |
1853 if ( v48 ) | |
4 | 1854 continue; |
1000 | 1855 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1856 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1857 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1858 pSpellInfo->spell_target_pid = v44; | |
1859 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1860 pGUIWindow_Settings->Release(); | |
0 | 1861 pGUIWindow_Settings = 0; |
1862 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1863 GameUI_Footer_TimeLeft = 0; |
0 | 1864 unk_50C9A0 = 0; |
1865 back_to_game(); | |
4 | 1866 continue; |
1000 | 1867 case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade) |
1868 case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure | |
1869 case UIMSG_HiredNPC_CastSpell: | |
0 | 1870 if ( pMessageQueue_50CBD0->uNumMessages ) |
1871 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1872 if ( unk_50C9A0 ) | |
1873 { | |
910 | 1874 uActiveCharacter = uMessageParam; |
978 | 1875 viewparams->bRedrawGameUI = 1; |
0 | 1876 } |
1877 else | |
1878 { | |
1879 if ( pGUIWindow_Settings ) | |
1880 { | |
1000 | 1881 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
0 | 1882 switch ( uMessage ) |
1883 { | |
1000 | 1884 case UIMSG_CastSpell_Character_Big_Improvement: |
1885 LOBYTE(pSpellInfo->field_8) &= 0xFDu; | |
0 | 1886 break; |
1000 | 1887 case UIMSG_CastSpell_Character_Small_Improvement: |
1888 HIBYTE(pSpellInfo->field_8) &= 0xFEu; | |
0 | 1889 break; |
1000 | 1890 case UIMSG_HiredNPC_CastSpell: |
1891 HIBYTE(pSpellInfo->field_8) &= 0xFDu; | |
0 | 1892 break; |
1893 } | |
1000 | 1894 pSpellInfo->uPlayerID_2 = uMessageParam; |
1895 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
0 | 1896 pGUIWindow_Settings->Release(); |
1897 pGUIWindow_Settings = 0; | |
1898 pEventTimer->Resume(); | |
1899 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1900 GameUI_Footer_TimeLeft = 0; |
0 | 1901 unk_50C9A0 = 0; |
1902 } | |
1903 } | |
4 | 1904 continue; |
0 | 1905 case UIMSG_BF: |
987 | 1906 __debugbreak(); |
978 | 1907 dword_50CDC8 = 1; |
0 | 1908 sub_42FBDD(); |
978 | 1909 SaveGame(1, 0); |
0 | 1910 strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename); |
978 | 1911 dword_6BE364_game_settings_1 |= 1; |
1912 uGameState = GAME_STATE_2; | |
11 | 1913 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; |
336 | 1914 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; |
4 | 1915 if ( v53 < 0 ) |
0 | 1916 { |
1917 v54 = abs(v53) - 1; | |
1918 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1919 dword_5B65BC = 0; | |
1920 v55 = dword_4E4560[v54]; | |
1921 _5B65AC_npcdata_fame_or_other = dword_4E4578[v54]; | |
1922 v56 = dword_4E4590[v54]; | |
1923 v57 = dword_4E45A8[v54]; | |
1924 _5B65A8_npcdata_uflags_or_other = v55; | |
1925 _5B65B4_npcdata_loword_house_or_other = v57; | |
1926 _5B65B0_npcdata_rep_or_other = v56; | |
1927 dword_5B65C0 = v55 | _5B65AC_npcdata_fame_or_other | v56 | v57; | |
1928 } | |
1929 sub_4BD8B5(); | |
11 | 1930 //goto LABEL_434; |
437 | 1931 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
11 | 1932 { |
990 | 1933 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 1934 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
1935 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
1936 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 1937 }*/ |
978 | 1938 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
11 | 1939 continue; |
710 | 1940 |
1941 case UIMSG_OnCastTownPortal: | |
0 | 1942 pAudioPlayer->StopChannels(-1, -1); |
710 | 1943 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_TownPortal, uMessageParam); |
1944 continue; | |
1945 | |
961 | 1946 case UIMSG_OnCastLloydsBeacon: |
0 | 1947 pAudioPlayer->StopChannels(-1, -1); |
961 | 1948 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_LloydsBeacon, 0); |
710 | 1949 continue; |
1950 | |
961 | 1951 case UIMSG_LloydsBeacon_FlippingBtn: |
0 | 1952 bRecallingBeacon = uMessageParam; |
1953 v127 = uMessageParam + 204; | |
916 | 1954 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
1955 continue; | |
961 | 1956 case UIMSG_HintBeaconSlot: |
0 | 1957 if ( !pGUIWindow_CurrentMenu ) |
4 | 1958 continue; |
0 | 1959 pPlayer = pPlayers[_506348_current_lloyd_playerid + 1]; |
1960 uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam]; | |
1961 if ( bRecallingBeacon ) | |
1962 { | |
1963 if ( !*((int *)&pSavegameThumbnails->pPixels + 10 * uMessageParam) ) | |
4 | 1964 continue; |
0 | 1965 v173 = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(pPlayer->pInstalledBeacons[uMessageParam].field_18))].pName; |
916 | 1966 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s" |
994 | 1967 GameUI_SetFooterString(pTmpBuf); |
916 | 1968 continue; |
0 | 1969 } |
1970 v59 = pMapStats->GetMapInfo(pCurrentMapName); | |
1971 thise = "Not in Map Stats"; | |
1972 if ( v59 ) | |
1973 thise = pMapStats->pInfos[v59].pName; | |
1974 if ( !*((int *)&pSavegameThumbnails->pPixels + 10 * uMessageParam) || !v59 ) | |
1975 { | |
916 | 1976 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[476], thise);// "Set to %s" |
994 | 1977 GameUI_SetFooterString(pTmpBuf); |
916 | 1978 continue; |
0 | 1979 } |
1980 v174 = pMapStats->pInfos[sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName; | |
1981 v158 = (unsigned int)thise; | |
916 | 1982 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s" |
994 | 1983 GameUI_SetFooterString(pTmpBuf); |
11 | 1984 continue; |
961 | 1985 case UIMSG_CloseAfterInstallBeacon: |
978 | 1986 dword_50CDC8 = 1; |
437 | 1987 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
1988 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) | |
11 | 1989 continue; |
990 | 1990 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 1991 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
1992 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 1993 ++pMessageQueue_50CBD0->uNumMessages;*/ |
11 | 1994 continue; |
961 | 1995 case UIMSG_InstallBeacon: |
0 | 1996 pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1]; |
1997 pNPCData4 = (NPCData *)&pPlayer9->pInstalledBeacons[uMessageParam]; | |
1998 if ( !*(_QWORD *)&pNPCData4->pName && bRecallingBeacon ) | |
4 | 1999 continue; |
0 | 2000 byte_506360 = 1; |
2001 pPlayer9->CanCastSpell(uRequiredMana); | |
2002 if ( pParty->bTurnBasedModeOn ) | |
2003 { | |
2004 v60 = sRecoveryTime; | |
2005 pParty->pTurnBasedPlayerRecoveryTimes[_506348_current_lloyd_playerid] = sRecoveryTime; | |
2006 pPlayer9->SetRecoveryTime(v60); | |
2007 pTurnEngine->_40471C(); | |
2008 } | |
2009 else | |
2010 { | |
2011 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
2012 } | |
2013 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0); | |
2014 if ( bRecallingBeacon ) | |
2015 { | |
2016 if ( _strcmpi(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]) ) | |
2017 { | |
978 | 2018 SaveGame(1, 0); |
0 | 2019 OnMapLeave(); |
2020 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]); | |
978 | 2021 dword_6BE364_game_settings_1 |= 1; |
2022 uGameState = GAME_STATE_2; | |
0 | 2023 _5B65A8_npcdata_uflags_or_other = pNPCData4->uFlags; |
2024 _5B65AC_npcdata_fame_or_other = pNPCData4->fame; | |
2025 _5B65B0_npcdata_rep_or_other = pNPCData4->rep; | |
291 | 2026 _5B65B4_npcdata_loword_house_or_other = LOWORD(pNPCData4->Location2D); |
2027 _5B65B8_npcdata_hiword_house_or_other = HIWORD(pNPCData4->Location2D); | |
978 | 2028 dword_5B65C0 = 1; |
0 | 2029 } |
2030 else | |
2031 { | |
2032 pParty->vPosition.x = pNPCData4->uFlags; | |
2033 pParty->vPosition.y = pNPCData4->fame; | |
2034 pParty->vPosition.z = pNPCData4->rep; | |
2035 pParty->uFallStartY = pParty->vPosition.z; | |
291 | 2036 pParty->sRotationY = LOWORD(pNPCData4->Location2D); |
2037 pParty->sRotationX = HIWORD(pNPCData4->Location2D); | |
0 | 2038 } |
978 | 2039 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
437 | 2040 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2041 { |
305 | 2042 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2043 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
2044 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2045 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2046 }*/ |
0 | 2047 //crt_deconstruct_ptr_6A0118(); |
2048 pBooksWindow->Release(); | |
2049 pGUIWindow_CurrentMenu->Release(); | |
2050 pBooksWindow = 0; | |
2051 pGUIWindow_CurrentMenu = 0; | |
2052 } | |
2053 else | |
2054 { | |
2055 sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1); | |
2056 SaveScreenshot(a1); | |
2057 LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1); | |
2058 v212 = qword_506350 << 7; | |
2059 pNPCData2 = pNPCData4; | |
2060 thisg = 0; | |
2061 v62 = pParty->uTimePlayed + (signed __int64)((double)(qword_506350 << 7) * 0.033333335); | |
2062 pNPCData4->pName = (char *)v62; | |
2063 pNPCData2->uPortraitID = HIDWORD(v62); | |
2064 pNPCData2->uFlags = pParty->vPosition.x; | |
2065 pNPCData2->fame = pParty->vPosition.y; | |
2066 pNPCData2->rep = pParty->vPosition.z; | |
291 | 2067 LOWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationY); |
2068 HIWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationX); | |
837 | 2069 if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 ) |
4 | 2070 continue; |
0 | 2071 uAction = 0; |
2072 while ( _strcmpi((const char *)pGames_LOD->pSubIndices + uAction, pCurrentMapName) ) | |
2073 { | |
2074 ++thisg; | |
2075 uAction += 32; | |
837 | 2076 if ( thisg >= (signed int)pGames_LOD->uNumSubDirs / 2 ) |
4 | 2077 continue; |
0 | 2078 } |
2079 HIWORD(pNPCData4->uProfession) = thisg; | |
2080 } | |
4 | 2081 continue; |
961 | 2082 case UIMSG_ClickTownInTP: |
0 | 2083 if ( uMessageParam ) |
2084 { | |
2085 switch ( uMessageParam ) | |
2086 { | |
2087 case 1: | |
2088 v63 = 208; | |
2089 break; | |
2090 case 2: | |
2091 v63 = 207; | |
2092 break; | |
2093 case 3: | |
2094 v63 = 211; | |
2095 break; | |
2096 case 4: | |
2097 v63 = 209; | |
2098 break; | |
2099 default: | |
2100 if ( uMessageParam != 5 ) | |
2101 { | |
2102 LABEL_486: | |
978 | 2103 SaveGame(1, 0); |
0 | 2104 v64 = pMapStats->GetMapInfo(pCurrentMapName); |
2105 v65 = uMessageParam; | |
839 | 2106 if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) |
0 | 2107 { |
839 | 2108 pParty->vPosition.x = TownPortalList[v65].pos.x; |
2109 pParty->vPosition.y = TownPortalList[v65].pos.y; | |
2110 pParty->vPosition.z = TownPortalList[v65].pos.z; | |
0 | 2111 pParty->uFallStartY = pParty->vPosition.z; |
839 | 2112 pParty->sRotationY = TownPortalList[v65].rot_y; |
2113 pParty->sRotationX = TownPortalList[v65].rot_x; | |
0 | 2114 } |
2115 else | |
2116 { | |
978 | 2117 SaveGame(1, 0); |
0 | 2118 OnMapLeave(); |
978 | 2119 dword_6BE364_game_settings_1 |= 1; |
2120 uGameState = GAME_STATE_2; | |
839 | 2121 strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); |
978 | 2122 dword_5B65C0 = 1; |
839 | 2123 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; |
2124 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; | |
2125 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; | |
2126 v66 = TownPortalList[uMessageParam].rot_x; | |
2127 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y; | |
0 | 2128 _5B65B8_npcdata_hiword_house_or_other = v66; |
2129 InitializeActors(); | |
2130 } | |
2131 v67 = pGUIWindow_CurrentMenu->Hint; | |
2132 if ( v67 ) | |
978 | 2133 *((int *)v67 + 17) = 1; |
0 | 2134 else |
710 | 2135 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u); |
437 | 2136 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2137 { |
990 | 2138 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2139 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
2140 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2141 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2142 }*/ |
978 | 2143 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
4 | 2144 continue; |
0 | 2145 } |
2146 v63 = 210; | |
2147 break; | |
2148 } | |
2149 } | |
2150 else | |
2151 { | |
2152 v63 = 206; | |
2153 } | |
484 | 2154 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63) ) |
0 | 2155 return; |
2156 goto LABEL_486; | |
961 | 2157 case UIMSG_HintTownPortal: |
0 | 2158 if ( uMessageParam ) |
2159 { | |
2160 switch ( uMessageParam ) | |
2161 { | |
2162 case 1: | |
2163 v68 = 208; | |
2164 break; | |
2165 case 2: | |
2166 v68 = 207; | |
2167 break; | |
2168 case 3: | |
2169 v68 = 211; | |
2170 break; | |
2171 case 4: | |
2172 v68 = 209; | |
2173 break; | |
2174 default: | |
2175 if ( uMessageParam != 5 ) | |
11 | 2176 //goto LABEL_506; |
2177 { | |
2178 if ( uMessageParam ) | |
2179 { | |
2180 switch ( uMessageParam ) | |
2181 { | |
2182 case 1: | |
2183 v69 = pMapStats->pInfos[4].pName; | |
2184 break; | |
2185 case 2: | |
2186 v69 = pMapStats->pInfos[3].pName; | |
2187 break; | |
2188 case 3: | |
2189 v69 = pMapStats->pInfos[10].pName; | |
2190 break; | |
2191 case 4: | |
2192 v69 = pMapStats->pInfos[7].pName; | |
2193 break; | |
2194 default: | |
2195 if ( uMessageParam != 5 ) | |
2196 { | |
916 | 2197 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v200); |
994 | 2198 GameUI_SetFooterString(pTmpBuf); |
916 | 2199 continue; |
11 | 2200 } |
2201 v69 = pMapStats->pInfos[8].pName; | |
2202 break; | |
2203 } | |
2204 } | |
2205 else | |
2206 { | |
2207 v69 = pMapStats->pInfos[21].pName; | |
2208 } | |
916 | 2209 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v69); |
994 | 2210 GameUI_SetFooterString(pTmpBuf); |
916 | 2211 continue; |
11 | 2212 } |
2213 v68 = 210; | |
2214 break; | |
0 | 2215 } |
2216 } | |
2217 else | |
2218 { | |
2219 v68 = 206; | |
2220 } | |
484 | 2221 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v68) ) |
0 | 2222 { |
2223 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); | |
4 | 2224 continue; |
0 | 2225 } |
11 | 2226 //LABEL_506: |
0 | 2227 if ( uMessageParam ) |
2228 { | |
2229 switch ( uMessageParam ) | |
2230 { | |
2231 case 1: | |
2232 v69 = pMapStats->pInfos[4].pName; | |
2233 break; | |
2234 case 2: | |
2235 v69 = pMapStats->pInfos[3].pName; | |
2236 break; | |
2237 case 3: | |
2238 v69 = pMapStats->pInfos[10].pName; | |
2239 break; | |
2240 case 4: | |
2241 v69 = pMapStats->pInfos[7].pName; | |
2242 break; | |
2243 default: | |
2244 if ( uMessageParam != 5 ) | |
2245 //goto LABEL_519; | |
4 | 2246 { |
916 | 2247 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v200); |
994 | 2248 GameUI_SetFooterString(pTmpBuf); |
916 | 2249 continue; |
4 | 2250 } |
0 | 2251 v69 = pMapStats->pInfos[8].pName; |
2252 break; | |
2253 } | |
2254 } | |
2255 else | |
2256 { | |
2257 v69 = pMapStats->pInfos[21].pName; | |
2258 } | |
916 | 2259 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v69); |
994 | 2260 GameUI_SetFooterString(pTmpBuf); |
916 | 2261 continue; |
0 | 2262 case UIMSG_ShowFinalWindow: |
2263 sprintf(pFinalMessage, "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." | |
2264 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." | |
2265 pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team." | |
2266 ModalWindow(pFinalMessage, 196); | |
2267 uGameState = GAME_STATE_FINAL_WINDOW; | |
4 | 2268 continue; |
0 | 2269 case UIMSG_C4: |
987 | 2270 __debugbreak(); |
982 | 2271 uGameState = GAME_STATE_PLAYING; |
0 | 2272 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); |
151 | 2273 case UIMSG_DD: |
990 | 2274 __debugbreak(); |
0 | 2275 sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer); |
703 | 2276 memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); |
701 | 2277 if ( v216.uPropCount == 1 ) |
0 | 2278 { |
837 | 2279 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2); |
0 | 2280 v70 = atoi(v216.pProperties[0]); |
2281 if ( v70 <= 0 || v70 >= 77 ) | |
4 | 2282 continue; |
0 | 2283 v71 = v70; |
2284 strcpy(Str2, pMapStats->pInfos[v70].pFilename); | |
2285 pNPCData3 = 0; | |
2286 if ( (signed int)pNPCData4 > 0 ) | |
2287 { | |
2288 thish = 0; | |
2289 do | |
2290 { | |
2291 if ( !_strcmpi((const char *)&pGames_LOD->pSubIndices[thish], Str2) ) | |
2292 break; | |
2293 ++thish; | |
2294 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1); | |
2295 } | |
2296 while ( (signed int)pNPCData3 < (signed int)pNPCData4 ); | |
2297 if ( (signed int)pNPCData3 < (signed int)pNPCData4 ) | |
2298 { | |
2299 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); | |
2300 dword_6BE364_game_settings_1 |= 1u; | |
978 | 2301 uGameState = GAME_STATE_2; |
0 | 2302 OnMapLeave(); |
4 | 2303 continue; |
0 | 2304 } |
2305 } | |
2306 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName); | |
2307 v73 = Str2; | |
2308 } | |
2309 else | |
2310 { | |
701 | 2311 if ( v216.uPropCount != 3 ) |
11 | 2312 continue; |
0 | 2313 v74 = atoi(v216.pProperties[0]); |
2314 thisi = atoi(v216.pProperties[1]); | |
2315 v75 = atoi(v216.pProperties[2]); | |
2316 v76 = v75; | |
2317 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
2318 { | |
2319 if ( pIndoor->GetSector(v74, thisi, v75) ) | |
2320 { | |
2321 v77 = thisi; | |
2322 pParty->vPosition.x = v74; | |
2323 pParty->vPosition.y = v77; | |
2324 pParty->vPosition.z = v76; | |
2325 pParty->uFallStartY = v76; | |
11 | 2326 continue; |
0 | 2327 } |
2328 } | |
2329 else | |
2330 { | |
2331 if ( v74 > -32768 ) | |
2332 { | |
2333 if ( v74 < 32768 ) | |
2334 { | |
2335 v77 = thisi; | |
2336 if ( thisi > -32768 ) | |
2337 { | |
2338 if ( thisi < 32768 && v76 >= 0 && v76 < 10000 ) | |
11 | 2339 { |
2340 pParty->vPosition.x = v74; | |
2341 pParty->vPosition.y = v77; | |
2342 pParty->vPosition.z = v76; | |
2343 pParty->uFallStartY = v76; | |
2344 continue; | |
2345 } | |
0 | 2346 } |
2347 } | |
2348 } | |
2349 } | |
2350 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
2351 v73 = "Can't jump to that location!"; | |
2352 } | |
2353 ShowStatusBarString(v73, 6u); | |
4 | 2354 continue; |
961 | 2355 case UIMSG_CastQuickSpell: |
0 | 2356 if ( bUnderwater == 1 ) |
362 | 2357 { |
2358 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" | |
2359 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
2360 continue; | |
2361 } | |
0 | 2362 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) ) |
11 | 2363 continue; |
362 | 2364 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); |
11 | 2365 continue; |
1000 | 2366 case UIMSG_CastSpell_Monster_Improvement: |
2367 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, | |
0 | 2368 if ( pRenderer->pRenderD3D ) |
2369 { | |
2370 v81 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
2371 } | |
2372 else | |
2373 { | |
2374 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v206); | |
2375 pPoint2 = pMouse->GetCursorPos(&v201); | |
2376 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]]; | |
2377 } | |
2378 v83 = v81; | |
2379 v44 = (unsigned __int16)v81; | |
2380 v84 = v83 >> 16; | |
848 | 2381 if ( PID_TYPE(v44) != 3 || v84 >= 5120 ) |
4 | 2382 continue; |
1000 | 2383 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
2384 if ( uMessage == UIMSG_CastSpell_Shoot_Monster ) | |
2385 { | |
2386 LOBYTE(pSpellInfo->field_8) &= 0xF7; | |
0 | 2387 } |
2388 else | |
2389 { | |
1000 | 2390 if ( uMessage == UIMSG_CastSpell_Monster_Improvement ) |
2391 HIBYTE(pSpellInfo->field_8) &= 0xFEu; | |
0 | 2392 else |
1000 | 2393 HIBYTE(pSpellInfo->field_8) &= 0xFDu; |
2394 } | |
2395 pSpellInfo->uPlayerID_2 = uMessageParam; | |
2396 pSpellInfo->spell_target_pid = v44; | |
2397 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2398 pGUIWindow_Settings->Release(); | |
11 | 2399 pGUIWindow_Settings = 0; |
2400 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2401 GameUI_Footer_TimeLeft = 0; |
11 | 2402 unk_50C9A0 = 0; |
2403 back_to_game(); | |
2404 continue; | |
151 | 2405 case UIMSG_1C: |
987 | 2406 __debugbreak(); |
0 | 2407 if ( !uActiveCharacter || pCurrentScreen ) |
4 | 2408 continue; |
710 | 2409 ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0); |
151 | 2410 pCurrentScreen = SCREEN_19; |
0 | 2411 pEventTimer->Pause(); |
4 | 2412 continue; |
151 | 2413 case UIMSG_1B: |
987 | 2414 __debugbreak(); |
0 | 2415 if ( !uActiveCharacter ) |
4 | 2416 continue; |
978 | 2417 if ( pParty->bTurnBasedModeOn != 1 ) |
11 | 2418 { |
2419 if ( pActors[uMessageParam].uAIState == 5 ) | |
2420 stru_50C198.LootActor(&pActors[uMessageParam]); | |
2421 else | |
2422 Actor::StealFrom(uMessageParam); | |
2423 continue; | |
2424 } | |
978 | 2425 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) |
4 | 2426 continue; |
0 | 2427 if ( !(pTurnEngine->field_18 & 2) ) |
2428 { | |
2429 if ( pActors[uMessageParam].uAIState == 5 ) | |
2430 stru_50C198.LootActor(&pActors[uMessageParam]); | |
2431 else | |
2432 Actor::StealFrom(uMessageParam); | |
2433 } | |
4 | 2434 continue; |
271 | 2435 |
2436 case UIMSG_Attack: | |
0 | 2437 if ( !uActiveCharacter ) |
4 | 2438 continue; |
978 | 2439 if ( pParty->bTurnBasedModeOn != 1 ) |
11 | 2440 { |
2441 _42ECB5_PlayerAttacksActor(); | |
2442 continue; | |
2443 } | |
978 | 2444 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) |
4 | 2445 continue; |
0 | 2446 if ( !(pTurnEngine->field_18 & 2) ) |
2447 _42ECB5_PlayerAttacksActor(); | |
4 | 2448 continue; |
151 | 2449 case UIMSG_ExitRest: |
962 | 2450 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 | 2451 continue; |
151 | 2452 case UIMSG_Wait5Minutes: |
0 | 2453 if ( dword_506F14 == 2 ) |
916 | 2454 { |
2455 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2456 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2457 continue; | |
11 | 2458 } |
962 | 2459 GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2, |
0 | 2460 (int)pButton_RestUI_Wait5Minutes, (int)pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" |
978 | 2461 dword_506F14 = 1; |
0 | 2462 _506F18_num_hours_to_sleep = 5; |
4 | 2463 continue; |
151 | 2464 case UIMSG_Wait1Hour: |
0 | 2465 if ( dword_506F14 == 2 ) |
916 | 2466 { |
2467 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2468 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2469 continue; | |
11 | 2470 } |
962 | 2471 GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2, |
0 | 2472 (int)pButton_RestUI_Wait1Hour, (int)pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" |
978 | 2473 dword_506F14 = 1; |
0 | 2474 _506F18_num_hours_to_sleep = 60; |
4 | 2475 continue; |
907 | 2476 case UIMSG_RentRoom: |
0 | 2477 dword_506F14 = 2; |
1033 | 2478 RestUI_Load(); |
758 | 2479 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; |
0 | 2480 _506F18_num_hours_to_sleep = v86; |
2481 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) | |
2482 _506F18_num_hours_to_sleep = v86 + 720; | |
11 | 2483 dword_506F14 = 2; |
2484 pParty->RestAndHeal(); | |
766 | 2485 pParty->days_played_without_rest = 0; |
2486 pParty->pPlayers[3].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2487 pParty->pPlayers[2].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2488 pParty->pPlayers[1].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2489 pParty->pPlayers[0].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
11 | 2490 continue; |
907 | 2491 case UIMSG_RestWindow: |
0 | 2492 if ( pMessageQueue_50CBD0->uNumMessages ) |
2493 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2494 if ( pCurrentScreen ) | |
4 | 2495 continue; |
0 | 2496 if ( sub_42F4DA() ) |
11 | 2497 { |
978 | 2498 if ( pParty->bTurnBasedModeOn == 1 ) |
11 | 2499 { |
916 | 2500 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" |
11 | 2501 continue; |
2502 } | |
2503 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2504 if ( pParty->uFlags & 0x88 ) | |
2505 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
916 | 2506 ShowStatusBarString(v88, 2); |
11 | 2507 if ( !uActiveCharacter ) |
2508 continue; | |
916 | 2509 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); |
2510 continue; | |
11 | 2511 } |
978 | 2512 if ( pParty->bTurnBasedModeOn == 1 ) |
916 | 2513 { |
2514 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
11 | 2515 continue; |
2516 } | |
0 | 2517 if ( !(pParty->uFlags & 0x88) ) |
2518 { | |
1033 | 2519 RestUI_Load(); |
4 | 2520 continue; |
0 | 2521 } |
978 | 2522 if ( pParty->bTurnBasedModeOn == 1 ) |
0 | 2523 { |
916 | 2524 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" |
11 | 2525 continue; |
0 | 2526 } |
2527 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2528 if ( pParty->uFlags & 0x88 ) | |
2529 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
2530 ShowStatusBarString(v88, 2u); | |
2531 if ( !uActiveCharacter ) | |
4 | 2532 continue; |
916 | 2533 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); |
2534 continue; | |
907 | 2535 case UIMSG_Rest8Hour: |
0 | 2536 if ( dword_506F14 ) |
916 | 2537 { |
2538 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2539 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2540 continue; | |
11 | 2541 } |
0 | 2542 if ( pParty->uNumFoodRations < uRestUI_FoodRequiredToRest ) |
2543 { | |
2544 ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2u);// "You don't have enough food to rest" | |
2545 if ( uActiveCharacter && pPlayers[uActiveCharacter]->CanAct() ) | |
916 | 2546 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_108, 0); |
0 | 2547 } |
2548 else | |
2549 { | |
2550 pParty->pPlayers[3].pConditions[2] = pParty->uTimePlayed; | |
2551 pParty->pPlayers[2].pConditions[2] = pParty->uTimePlayed; | |
2552 pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed; | |
2553 pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed; | |
2554 v90 = pMapStats->GetMapInfo(pCurrentMapName); | |
2555 if ( !v90 ) | |
2556 v90 = rand() % (signed int)pMapStats->uNumMaps + 1; | |
2557 pMapInfo = &pMapStats->pInfos[v90]; | |
237 | 2558 if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent ) |
0 | 2559 { |
2560 v91 = rand() % 100; | |
237 | 2561 v92 = pMapInfo->EncM1percent; |
0 | 2562 v93 = v91 + 1; |
2563 if ( v93 > v92 ) | |
237 | 2564 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); |
0 | 2565 else |
978 | 2566 pNPCData4 = (NPCData *)1; |
0 | 2567 if ( !sub_45063B(pMapInfo, (int)pNPCData4) ) |
2568 pNPCData4 = 0; | |
2569 if ( pNPCData4 ) | |
2570 { | |
2571 pPlayerNum = rand() % 4; | |
2572 LODWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
2573 HIDWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
2574 v95 = rand(); | |
2575 Rest(v95 % 6 + 60); | |
2576 _506F18_num_hours_to_sleep = 0; | |
2577 dword_506F14 = 0; | |
437 | 2578 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2579 { |
990 | 2580 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2581 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
2582 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2583 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2584 }*/ |
2585 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
916 | 2586 ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!" |
2587 pAudioPlayer->PlaySound((SoundID)227, 0, 0, -1, 0, 0, 0, 0); | |
2588 continue; | |
0 | 2589 } |
2590 } | |
2591 Party::TakeFood(uRestUI_FoodRequiredToRest); | |
2592 _506F18_num_hours_to_sleep = 480; | |
2593 dword_506F14 = 2; | |
2594 pParty->RestAndHeal(); | |
766 | 2595 pParty->days_played_without_rest = 0; |
2596 pParty->pPlayers[3].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2597 pParty->pPlayers[2].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2598 pParty->pPlayers[1].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2599 pParty->pPlayers[0].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
0 | 2600 } |
4 | 2601 continue; |
151 | 2602 case UIMSG_AlreadyResting: |
0 | 2603 if ( dword_506F14 == 2 ) |
2604 { | |
916 | 2605 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" |
362 | 2606 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2607 continue; | |
0 | 2608 } |
962 | 2609 GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2, |
0 | 2610 (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" |
758 | 2611 v97 = _494820_training_time(pParty->uCurrentHour); |
978 | 2612 dword_506F14 = 1; |
0 | 2613 _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute; |
4 | 2614 continue; |
960 | 2615 case UIMSG_HintSelectRemoveQuickSpellBtn: |
688 | 2616 if ( quick_spell_at_page && byte_506550 ) |
2617 { | |
2618 v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName; | |
916 | 2619 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[483], v173); |
0 | 2620 } |
2621 else | |
2622 { | |
2623 if ( pPlayers[uActiveCharacter]->uQuickSpell ) | |
2624 v177 = pGlobalTXT_LocalizationStrings[584];// "Click here to remove your Quick Spell" | |
2625 else | |
2626 v177 = pGlobalTXT_LocalizationStrings[484];// "Select a spell then click here to set a QuickSpell" | |
2627 strcpy(pTmpBuf, v177); | |
2628 } | |
994 | 2629 GameUI_SetFooterString(pTmpBuf); |
4 | 2630 continue; |
370 | 2631 case UIMSG_SPellbook_ShowHightlightedSpellInfo: |
4 | 2632 if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter], |
0 | 2633 !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402)) ) |
4 | 2634 continue; |
0 | 2635 if ( sub_4637E0_is_there_popup_onscreen() ) |
2636 dword_507B00_spell_info_to_draw_in_popup = uMessageParam + 1; | |
2637 v98 = *(char *)(uNumSeconds + 6734); | |
688 | 2638 if ( quick_spell_at_page - 1 == uMessageParam ) |
0 | 2639 { |
2640 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2641 v161 = pGlobalTXT_LocalizationStrings[485]; | |
2642 } | |
2643 else | |
2644 { | |
2645 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2646 v161 = pGlobalTXT_LocalizationStrings[486]; | |
2647 } | |
809 | 2648 sprintfex(pTmpBuf, v161, v178); |
994 | 2649 GameUI_SetFooterString(pTmpBuf); |
11 | 2650 continue; |
960 | 2651 case UIMSG_ClickInstallRemoveQuickSpellBtn: |
962 | 2652 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0); |
0 | 2653 if ( !uActiveCharacter ) |
4 | 2654 continue; |
0 | 2655 pPlayer10 = pPlayers[uActiveCharacter]; |
688 | 2656 if ( !byte_506550 || !quick_spell_at_page ) |
0 | 2657 { |
2658 pPlayer10->uQuickSpell = 0; | |
688 | 2659 quick_spell_at_page = 0; |
916 | 2660 pAudioPlayer->PlaySound((SoundID)203, 0, 0, -1, 0, 0, 0, 0); |
2661 continue; | |
0 | 2662 } |
688 | 2663 v99 = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; |
0 | 2664 pPlayers[uActiveCharacter]->uQuickSpell = v99; |
2665 stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter); | |
2666 if ( uActiveCharacter ) | |
187 | 2667 pPlayer10->PlaySound(SPEECH_12, 0); |
0 | 2668 byte_506550 = 0; |
4 | 2669 continue; |
151 | 2670 case UIMSG_33: |
987 | 2671 __debugbreak(); |
0 | 2672 if ( !uActiveCharacter ) |
4 | 2673 continue; |
0 | 2674 pPlayer3 = pPlayers[uActiveCharacter]; |
2675 pNPCData4 = 0; | |
2676 uAction = 0; | |
2677 v101 = 0; | |
2678 thisl = (int)&pPlayer3->pActiveSkills[12]; | |
2679 do | |
2680 { | |
2681 if ( *(short *)thisl ) | |
2682 { | |
198 | 2683 if ( pPlayer3->lastOpenedSpellbookPage == v101 ) |
0 | 2684 uAction = (int)pNPCData4; |
2685 v102 = (int)pNPCData4; | |
2686 pNPCData4 = (NPCData *)((char *)pNPCData4 + 1); | |
2687 v217[v102] = v101; | |
2688 } | |
2689 thisl += 2; | |
2690 ++v101; | |
2691 } | |
2692 while ( v101 < 9 ); | |
2693 if ( !pNPCData4 ) | |
11 | 2694 { |
2695 v127 = rand() % 2 + 204; | |
916 | 2696 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2697 continue; | |
11 | 2698 } |
0 | 2699 if ( GetAsyncKeyState(16) ) |
2700 { | |
2701 --uAction; | |
2702 if ( uAction < 0 ) | |
2703 uAction = (int)((char *)pNPCData4 - 1); | |
2704 } | |
2705 else | |
2706 { | |
2707 ++uAction; | |
2708 if ( uAction >= (signed int)pNPCData4 ) | |
2709 uAction = 0; | |
2710 } | |
2711 sub_41140B(); | |
198 | 2712 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); |
11 | 2713 pGUIWindow_CurrentMenu->OpenSpellBook(); |
2714 v127 = rand() % 2 + 204; | |
916 | 2715 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2716 continue; | |
832 | 2717 case UIMSG_OpenSpellbookPage: |
198 | 2718 if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage ) |
4 | 2719 continue; |
0 | 2720 sub_41140B(); |
198 | 2721 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; |
11 | 2722 pGUIWindow_CurrentMenu->OpenSpellBook(); |
0 | 2723 v127 = rand() % 2 + 204; |
916 | 2724 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2725 continue; | |
437 | 2726 case UIMSG_SelectSpell: |
2727 { | |
2728 if (pTurnEngine->field_4 == 3) | |
2729 continue; | |
2730 if (!uActiveCharacter) | |
2731 continue; | |
2732 | |
2733 // uNumSeconds = (unsigned int)pPlayers[uActiveCharacter]; | |
2734 auto player = pPlayers[uActiveCharacter]; | |
2735 if (player->spellbook.pChapters[player->lastOpenedSpellbookPage].bIsSpellAvailable[uMessageParam]) | |
2736 //if ( *(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + &lastOpenedSpellbookPage) + uMessageParam + 402) ) | |
2737 { | |
688 | 2738 if ( quick_spell_at_page - 1 == uMessageParam ) |
0 | 2739 { |
2740 pGUIWindow_CurrentMenu->Release(); | |
2741 pEventTimer->Resume(); | |
978 | 2742 viewparams->bRedrawGameUI = 1; |
151 | 2743 pCurrentScreen = SCREEN_GAME; |
0 | 2744 pIcons_LOD->_4114F2(); |
688 | 2745 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; |
1000 | 2746 /*if ( dword_50C9E8 < 40 ) |
0 | 2747 { |
437 | 2748 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook; |
2749 dword_50C9EC[3 * dword_50C9E8 + 1] = v103; | |
2750 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1; | |
0 | 2751 ++dword_50C9E8; |
1000 | 2752 }*/ |
1012 | 2753 pMessageQueue_50C9E8->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); |
2754 // pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); | |
0 | 2755 } |
2756 else | |
2757 { | |
2758 byte_506550 = 1; | |
688 | 2759 quick_spell_at_page = uMessageParam + 1; |
0 | 2760 } |
437 | 2761 } |
2762 } | |
2763 continue; | |
370 | 2764 |
2765 case UIMSG_CastSpellFromBook: | |
2766 if ( pTurnEngine->field_4 != 3 ) | |
2767 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0); | |
2768 continue; | |
2769 | |
1019 | 2770 case UIMSG_SpellScrollUse: |
987 | 2771 __debugbreak(); |
0 | 2772 if ( pTurnEngine->field_4 != 3 ) |
978 | 2773 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0); |
4 | 2774 continue; |
907 | 2775 case UIMSG_SpellBookWindow: |
0 | 2776 if ( pTurnEngine->field_4 == 3 ) |
4 | 2777 continue; |
0 | 2778 if ( bUnderwater == 1 ) |
2779 { | |
362 | 2780 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" |
916 | 2781 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
0 | 2782 } |
2783 else | |
2784 { | |
2785 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2786 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2787 if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery ) | |
2788 { | |
2789 if ( !pCurrentScreen ) | |
2790 { | |
962 | 2791 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); |
151 | 2792 pCurrentScreen = SCREEN_SPELL_BOOK; |
0 | 2793 pEventTimer->Pause(); |
710 | 2794 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); |
0 | 2795 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); |
978 | 2796 viewparams->field_48 = 1; |
4 | 2797 continue; |
0 | 2798 } |
151 | 2799 if ( pCurrentScreen != SCREEN_REST |
2800 && pCurrentScreen != SCREEN_CHARACTERS | |
2801 && (pCurrentScreen <= SCREEN_63 | |
2802 || pCurrentScreen > SCREEN_67) ) | |
11 | 2803 { |
2804 pGUIWindow_CurrentMenu->Release(); | |
962 | 2805 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); |
151 | 2806 pCurrentScreen = SCREEN_SPELL_BOOK; |
11 | 2807 pEventTimer->Pause(); |
710 | 2808 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); |
11 | 2809 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); |
978 | 2810 viewparams->field_48 = 1; |
11 | 2811 continue; |
2812 } | |
2813 } | |
2814 } | |
2815 continue; | |
2816 case UIMSG_QuickReference: | |
0 | 2817 if ( pMessageQueue_50CBD0->uNumMessages ) |
2818 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2819 if ( pCurrentScreen ) | |
2820 pGUIWindow_CurrentMenu->Release(); | |
2821 ++pIcons_LOD->uTexturePacksCount; | |
2822 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2823 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
962 | 2824 GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0); |
978 | 2825 viewparams->bRedrawGameUI = 1; |
0 | 2826 pEventTimer->Pause(); |
2827 pAudioPlayer->StopChannels(-1, -1); | |
151 | 2828 pCurrentScreen = SCREEN_QUICK_REFERENCE; |
710 | 2829 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0); |
0 | 2830 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); |
978 | 2831 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 2832 pGlobalTXT_LocalizationStrings[79],// "Exit" |
973 | 2833 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179); |
4 | 2834 continue; |
358 | 2835 case UIMSG_GameMenuButton: |
0 | 2836 if ( pCurrentScreen ) |
2837 { | |
2838 pGUIWindow_CurrentMenu->Release(); | |
2839 pEventTimer->Resume(); | |
151 | 2840 pCurrentScreen = SCREEN_GAME; |
978 | 2841 viewparams->bRedrawGameUI = 1; |
0 | 2842 } |
2843 stru_506E40.Release(); | |
2844 uNumSeconds = (unsigned int)MakeScreenshot(155, 117); | |
2845 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); | |
2846 free((void *)uNumSeconds); | |
2847 stru_506E40._40E55E("gamma.pcx", 0); | |
962 | 2848 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton, (int)pBtn_GameSettings, 0); |
11 | 2849 //LABEL_453: |
437 | 2850 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
4 | 2851 continue; |
990 | 2852 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 2853 //goto LABEL_770; |
2854 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2855 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 2856 ++pMessageQueue_50CBD0->uNumMessages;*/ |
2857 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
11 | 2858 continue; |
0 | 2859 case UIMSG_C0: |
987 | 2860 __debugbreak(); |
978 | 2861 dword_50651C = 1; |
0 | 2862 if ( pMouse->GetCursorPos(&v211)->y > 178 ) |
2863 dword_50651C = -1; | |
4 | 2864 continue; |
961 | 2865 case UIMSG_ClickAwardsUpBtn: |
962 | 2866 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0); |
990 | 2867 BtnUp_flag = 1; |
4 | 2868 continue; |
961 | 2869 case UIMSG_ClickAwardsDownBtn: |
962 | 2870 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0); |
990 | 2871 BtnDown_flag = 1; |
4 | 2872 continue; |
910 | 2873 case UIMSG_ChangeDetaliz: |
978 | 2874 bRingsShownInCharScreen ^= 1; |
910 | 2875 pCharacterScreen_DetalizBtn->Release(); |
697 | 2876 pCharacterScreen_DollBtn->Release(); |
0 | 2877 if ( bRingsShownInCharScreen ) |
2878 { | |
973 | 2879 v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight; |
2880 v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth; | |
0 | 2881 v123 = 445; |
2882 v121 = 470; | |
2883 } | |
2884 else | |
2885 { | |
2886 v128 = 30; | |
2887 v125 = 30; | |
2888 v123 = 300; | |
2889 v121 = 600; | |
2890 } | |
978 | 2891 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0, |
0 | 2892 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" |
2893 0); | |
1025 | 2894 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); |
978 | 2895 viewparams->bRedrawGameUI = 1; |
910 | 2896 continue; |
2897 case UIMSG_ClickPaperdoll: | |
0 | 2898 OnPaperdollLeftClick(); |
4 | 2899 continue; |
960 | 2900 case UIMSG_ClickStatsBtn: |
0 | 2901 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; |
991 | 2902 CharacterUI_ReleaseButtons(); |
0 | 2903 sub_419379(); |
962 | 2904 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0); |
960 | 2905 continue; |
2906 case UIMSG_ClickSkillsBtn: | |
0 | 2907 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; |
991 | 2908 CharacterUI_ReleaseButtons(); |
0 | 2909 sub_419379(); |
991 | 2910 CharacterUI_SkillsTab_CreateButtons(); |
962 | 2911 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0); |
11 | 2912 continue; |
0 | 2913 case UIMSG_SkillUp: |
2914 pPlayer4 = pPlayers[uActiveCharacter]; | |
2915 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam]; | |
2916 LOWORD(v2) = *(short *)v105; | |
2917 uNumSeconds = v2; | |
2918 if ( pPlayer4->uSkillPoints < (v2 & 0x3F) + 1 ) | |
2919 { | |
2920 v87 = pGlobalTXT_LocalizationStrings[488];// "You don't have enough skill points!" | |
2921 } | |
2922 else | |
2923 { | |
2924 if ( (uNumSeconds & 0x3F) < 0x3C ) | |
2925 { | |
2926 *(short *)v105 = uNumSeconds + 1; | |
2927 pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F; | |
187 | 2928 pPlayer4->PlaySound(SPEECH_14, 0); |
916 | 2929 pAudioPlayer->PlaySound((SoundID)20001, 0, 0, -1, 0, 0, 0, 0); |
2930 continue; | |
0 | 2931 } |
2932 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!" | |
2933 } | |
916 | 2934 ShowStatusBarString(v87, 2); |
4 | 2935 continue; |
960 | 2936 case UIMSG_ClickInventoryBtn: |
0 | 2937 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; |
2938 sub_419379(); | |
991 | 2939 CharacterUI_ReleaseButtons(); |
962 | 2940 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0); |
960 | 2941 continue; |
2942 case UIMSG_ClickExitCharacterWindowBtn: | |
2943 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0); | |
2944 continue; | |
2945 case UIMSG_ClickAwardsBtn: | |
0 | 2946 sub_419379(); |
991 | 2947 CharacterUI_ReleaseButtons(); |
0 | 2948 sub_419220(); |
2949 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; | |
962 | 2950 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0); |
521 | 2951 FillAwardsData(); |
4 | 2952 continue; |
1000 | 2953 case UIMSG_ClickBooksBtn: |
0 | 2954 switch ( uMessageParam ) |
2955 { | |
990 | 2956 case 11://Page UP |
2957 BtnUp_flag = 1; | |
2958 pButton = pBtn_Book_2; | |
2959 break; | |
2960 case 10://Page DOWN | |
2961 BtnDown_flag = 1; | |
2962 pButton = pBtn_Book_1; | |
2963 break; | |
1000 | 2964 case 0://Zoom plus |
0 | 2965 pButton = pBtn_Book_1; |
990 | 2966 BtnDown_flag = 1; |
0 | 2967 break; |
1000 | 2968 case 1://Zoom minus |
2969 pButton = pBtn_Book_2; | |
990 | 2970 BtnUp_flag = 1; |
0 | 2971 break; |
990 | 2972 case 2://Potions |
2973 Book_PageBtn3_flag = 1; | |
0 | 2974 if ( dword_506364 ) |
4 | 2975 continue; |
0 | 2976 pButton = pBtn_Book_3; |
2977 break; | |
990 | 2978 case 3://fountains |
2979 Book_PageBtn4_flag = 1; | |
0 | 2980 if ( dword_506364 ) |
4 | 2981 continue; |
0 | 2982 pButton = pBtn_Book_4; |
2983 break; | |
990 | 2984 case 4://obelisks |
2985 Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag | |
0 | 2986 if ( dword_506364 ) |
4 | 2987 continue; |
0 | 2988 pButton = pBtn_Book_5; |
2989 break; | |
990 | 2990 case 5://seer |
2991 Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag | |
0 | 2992 if ( dword_506364 ) |
4 | 2993 continue; |
0 | 2994 pButton = pBtn_Book_6; |
2995 break; | |
990 | 2996 case 6://misc |
0 | 2997 pButton = pBtn_Autonotes_Misc; |
990 | 2998 Autonotes_Misc_page_flag = 1; |
0 | 2999 break; |
990 | 3000 case 7://Instructors |
0 | 3001 pButton = pBtn_Autonotes_Instructors; |
990 | 3002 Autonotes_Instructors_page_flag = 1; |
0 | 3003 break; |
990 | 3004 default: |
3005 continue; | |
0 | 3006 } |
978 | 3007 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); |
11 | 3008 continue; |
0 | 3009 case UIMSG_SelectCharacter: |
3010 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3011 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3012 GameUI_OnPlayerPortraitLeftClick(uMessageParam); | |
4 | 3013 continue; |
0 | 3014 case UIMSG_ShowStatus_Funds: |
3015 v174 = (char *)pParty->uNumGoldInBank; | |
3016 v158 = pParty->uNumGold + pParty->uNumGoldInBank; | |
916 | 3017 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[489], v158, v174);// "You have %d total gold, %d in the Bank" |
994 | 3018 GameUI_SetFooterString(pTmpBuf); |
11 | 3019 continue; |
0 | 3020 case UIMSG_ShowStatus_DateTime: |
3021 pNPCData4 = (NPCData *)pParty->uCurrentHour; | |
3022 if ( (signed int)pParty->uCurrentHour <= 12 ) | |
3023 { | |
3024 if ( !pNPCData4 ) | |
3025 pNPCData4 = (NPCData *)12; | |
3026 } | |
3027 else | |
3028 { | |
3029 pNPCData4 = (NPCData *)((char *)pNPCData4 - 12); | |
3030 } | |
978 | 3031 if ( pParty->uCurrentHour < 0xC || (uNumSeconds = 1, pParty->uCurrentHour >= 0x18) ) |
0 | 3032 uNumSeconds = 0; |
3033 sprintf(pTmpBuf, "%d:%02d%s %s %d %s %d", pNPCData4, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7], | |
3034 7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear); | |
994 | 3035 GameUI_SetFooterString(pTmpBuf); |
11 | 3036 continue; |
0 | 3037 case UIMSG_ShowStatus_Food: |
306 | 3038 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food" |
994 | 3039 GameUI_SetFooterString(pTmpBuf); |
306 | 3040 continue; |
0 | 3041 case UIMSG_ShowStatus_Player: |
3042 pPlayer5 = pPlayers[uMessageParam]; | |
264 | 3043 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s" |
0 | 3044 strcat(pTmpBuf, ": "); |
3045 v107 = pPlayer5->GetMajorConditionIdx(); | |
3046 strcat(pTmpBuf, aCharacterConditionNames[v107]); | |
994 | 3047 GameUI_SetFooterString(pTmpBuf); |
0 | 3048 v108 = 8 * uMessageParam - 8; |
3049 LOBYTE(v108) = v108 | 4; | |
888 | 3050 pMouse->uPointingObjectID = PID(OBJECT_Player,v108); |
4 | 3051 continue; |
0 | 3052 case UIMSG_ShowStatus_ManaHP: |
1000 | 3053 sprintf(pTmpBuf, "%d / %d %s %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(), |
3054 pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(), | |
3055 pGlobalTXT_LocalizationStrings[212]); | |
994 | 3056 GameUI_SetFooterString(pTmpBuf); |
11 | 3057 continue; |
987 | 3058 case UIMSG_CHEST_ClickItem: |
3059 if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) | |
3060 { | |
3061 OnInventoryLeftClick(); | |
11 | 3062 continue; |
3063 } | |
987 | 3064 OnChestLeftClick(); |
4 | 3065 continue; |
151 | 3066 case UIMSG_InventoryLeftClick: |
987 | 3067 OnInventoryLeftClick(); |
4 | 3068 continue; |
960 | 3069 case UIMSG_MouseLeftClickInGame: |
0 | 3070 if ( !pRenderer->pRenderD3D ) |
11 | 3071 { |
3072 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3073 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3074 OnGameViewportClick(); | |
3075 continue; | |
3076 } | |
0 | 3077 v115 = pMessageQueue_50CBD0->uNumMessages; |
3078 if ( !pMessageQueue_50CBD0->uNumMessages ) | |
11 | 3079 { |
990 | 3080 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3081 /*if ( (signed int)v115 < 40 ) |
11 | 3082 //goto LABEL_769; |
3083 { | |
990 | 3084 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
11 | 3085 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
3086 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3087 ++pMessageQueue_50CBD0->uNumMessages; | |
3088 continue; | |
437 | 3089 }*/ |
11 | 3090 continue; |
3091 } | |
0 | 3092 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
3093 { | |
978 | 3094 pMessageQueue_50CBD0->uNumMessages = 1; |
990 | 3095 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3096 /*v115 = v0; |
0 | 3097 pMessageQueue_50CBD0->uNumMessages = v0; |
990 | 3098 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
0 | 3099 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
11 | 3100 //goto LABEL_771; |
3101 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 3102 ++pMessageQueue_50CBD0->uNumMessages;*/ |
11 | 3103 continue; |
0 | 3104 } |
3105 v115 = 0; | |
3106 pMessageQueue_50CBD0->uNumMessages = 0; | |
990 | 3107 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3108 /*if ( (signed int)v115 < 40 ) |
11 | 3109 //goto LABEL_769; |
3110 { | |
990 | 3111 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
11 | 3112 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
3113 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3114 ++pMessageQueue_50CBD0->uNumMessages; | |
3115 continue; | |
437 | 3116 }*/ |
4 | 3117 continue; |
990 | 3118 case UIMSG_MouseLeftClickInScreen:// UIMSG_MouseLeftClickInGame |
0 | 3119 if ( pMessageQueue_50CBD0->uNumMessages ) |
3120 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3121 OnGameViewportClick(); | |
4 | 3122 continue; |
151 | 3123 case UIMSG_F: |
987 | 3124 __debugbreak(); |
0 | 3125 if ( pRenderer->pRenderD3D ) |
3126 { | |
3127 LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
3128 } | |
3129 else | |
3130 { | |
3131 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209); | |
3132 pPoint3 = pMouse->GetCursorPos(&v204); | |
3133 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]]; | |
3134 } | |
3135 pButton2 = (GUIButton *)(unsigned __int16)v116; | |
960 | 3136 GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0); |
11 | 3137 continue; |
151 | 3138 case UIMSG_54: |
987 | 3139 __debugbreak(); |
0 | 3140 pButton2 = (GUIButton *)uMessageParam; |
990 | 3141 GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0); |
4 | 3142 continue; |
201 | 3143 case UIMSG_Game_Action: |
0 | 3144 if ( pMessageQueue_50CBD0->uNumMessages ) |
3145 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3146 OnPressSpace(); | |
4 | 3147 continue; |
960 | 3148 case UIMSG_ClickZoomOutBtn: |
0 | 3149 if ( pCurrentScreen ) |
4 | 3150 continue; |
0 | 3151 pParty->uFlags |= 2u; |
1000 | 3152 GUIWindow::Create(519, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomOut, 0); |
0 | 3153 uNumSeconds = 131072; |
3154 v118 = 2 * viewparams->uMinimapZoom; | |
3155 ++viewparams->field_28; | |
3156 viewparams->uMinimapZoom *= 2; | |
3157 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
3158 { | |
3159 if ( (signed int)v118 > 4096 ) | |
3160 { | |
3161 viewparams->uMinimapZoom = 4096; | |
3162 viewparams->field_28 = 12; | |
3163 } | |
4 | 3164 continue; |
0 | 3165 } |
3166 v119 = 2048; | |
3167 if ( (signed int)v118 <= 2048 ) | |
960 | 3168 { |
1051 | 3169 _576E2C_current_minimap_zoom = v118; |
960 | 3170 dword_576E28 = viewparams->field_28; |
3171 break; | |
3172 } | |
0 | 3173 viewparams->field_28 = 11; |
960 | 3174 viewparams->uMinimapZoom = v119; |
1051 | 3175 _576E2C_current_minimap_zoom = v119; |
960 | 3176 dword_576E28 = viewparams->field_28; |
3177 break; | |
3178 case UIMSG_ClickZoomInBtn: | |
0 | 3179 if ( pCurrentScreen ) |
4 | 3180 continue; |
0 | 3181 pParty->uFlags |= 2u; |
1000 | 3182 GUIWindow::Create(574, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomIn, 0); |
0 | 3183 uNumSeconds = 32768; |
3184 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
3185 --viewparams->field_28; | |
3186 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
3187 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3188 { | |
3189 v119 = 512; | |
3190 if ( (signed int)v118 < 512 ) | |
3191 { | |
3192 viewparams->field_28 = 9; | |
3193 v118 = v119; | |
3194 viewparams->uMinimapZoom = v119; | |
3195 } | |
1051 | 3196 _576E2C_current_minimap_zoom = v118; |
0 | 3197 dword_576E28 = viewparams->field_28; |
3198 } | |
3199 else | |
3200 { | |
3201 if ( (signed int)v118 < 256 ) | |
3202 { | |
3203 viewparams->uMinimapZoom = 256; | |
3204 viewparams->field_28 = 8; | |
3205 } | |
3206 } | |
4 | 3207 default: |
3208 continue; | |
0 | 3209 } |
3210 } | |
3211 } | |
1012 | 3212 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8; |
3213 memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages); | |
3214 //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8); | |
3215 //dword_50C9E8 = 0; | |
3216 | |
3217 | |
3218 pMessageQueue_50C9E8->uNumMessages=0; | |
0 | 3219 if ( dword_50C9DC ) |
3220 { | |
437 | 3221 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 3222 { |
3223 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC; | |
3224 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = (int)ptr_50C9E0; | |
3225 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3226 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 3227 }*/ |
3228 pMessageQueue_50CBD0->AddMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0); | |
0 | 3229 dword_50C9DC = 0; |
3230 } | |
3231 else | |
3232 { | |
3233 if ( dword_50C9D0 > 0 ) | |
3234 { | |
3235 dword_50C9D8 -= pEventTimer->uTimeElapsed; | |
3236 if ( dword_50C9D8 <= 0 ) | |
3237 { | |
437 | 3238 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 3239 { |
3240 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9D0; | |
3241 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = dword_50C9D4; | |
3242 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3243 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 3244 }*/ |
3245 pMessageQueue_50CBD0->AddMessage((UIMessageType)dword_50C9D0, dword_50C9D4, 0); | |
0 | 3246 dword_50C9D0 = 0; |
3247 dword_50C9D4 = 0; | |
3248 dword_50C9D8 = 0; | |
3249 } | |
3250 } | |
3251 } | |
924 | 3252 pCastSpellInfo->_427E01_cast_spell(); |
0 | 3253 } |
3254 | |
3255 //----- (004356FF) -------------------------------------------------------- | |
3256 void __cdecl back_to_game() | |
3257 { | |
3258 dword_507BF0_is_there_popup_onscreen = 0; | |
3259 dword_4E455C = 1; | |
3260 dword_50CDCC = 0; | |
3261 if ( pGUIWindow_ScrollWindow ) | |
3262 free_book_subwindow(); | |
3263 if ( !pCurrentScreen && !pGUIWindow_Settings ) | |
3264 pEventTimer->Resume(); | |
3265 viewparams->bRedrawGameUI = 1; | |
3266 } | |
782 | 3267 |
0 | 3268 //----- (00435748) -------------------------------------------------------- |
3269 void __cdecl GUI_MainMenuMessageProc() | |
3270 { | |
967 | 3271 Player *pPlayer; // ebx@2 |
0 | 3272 void *v3; // edi@21 |
3273 signed int v4; // eax@29 | |
3274 int v5; // ecx@29 | |
821 | 3275 PLAYER_SKILL_TYPE v6; // edi@37 |
0 | 3276 GUIWindow *pWindow; // eax@56 |
3277 GUIButton *pButton; // eax@59 | |
3278 int v15; // edi@70 | |
3279 char v20; // dl@116 | |
3280 unsigned int v21; // eax@116 | |
3281 unsigned int v25; // eax@120 | |
3282 unsigned int v26; // ecx@127 | |
3283 SoundID pSoundID; // [sp-2Ch] [bp-3Ch]@36 | |
3284 signed int v41; // [sp-10h] [bp-20h]@29 | |
971 | 3285 int pParam; // [sp+4h] [bp-Ch]@3 |
0 | 3286 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3 |
967 | 3287 int pSex; // [sp+Ch] [bp-4h]@3 |
0 | 3288 |
3289 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3290 { | |
2 | 3291 pPlayer = pParty->pPlayers; |
0 | 3292 do |
3293 { | |
187 | 3294 int param2; |
971 | 3295 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, ¶m2); |
3296 auto player = &pParty->pPlayers[pParam]; | |
187 | 3297 |
3 | 3298 switch (pUIMessageType) // For buttons of window MainMenu |
2 | 3299 { |
165 | 3300 case UIMSG_MainMenu_ShowPartyCreationWnd: |
962 | 3301 GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); |
0 | 3302 SetCurrentMenuID(MENU_NEWGAME); |
960 | 3303 break; |
165 | 3304 case UIMSG_MainMenu_ShowLoadWindow: |
962 | 3305 GUIWindow::Create(495, 227, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnLoad, 0); |
0 | 3306 SetCurrentMenuID(MENU_SAVELOAD); |
960 | 3307 break; |
165 | 3308 case UIMSG_ShowCredits: |
962 | 3309 GUIWindow::Create(495, 282, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnCredits, 0); |
0 | 3310 SetCurrentMenuID(MENU_CREDITS); |
960 | 3311 break; |
165 | 3312 case UIMSG_ExitToWindows: |
962 | 3313 GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); |
982 | 3314 SetCurrentMenuID(MENU_EXIT_GAME); |
960 | 3315 break; |
187 | 3316 case UIMSG_PlayerCreation_SelectAttribute: |
960 | 3317 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3318 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
3319 uPlayerCreationUI_SelectedCharacter = pParam; | |
960 | 3320 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3321 break; | |
187 | 3322 case UIMSG_PlayerCreation_VoicePrev: |
967 | 3323 pSex = player->GetSexByVoice(); |
960 | 3324 do |
3325 { | |
3326 if (player->uVoiceID == 0) | |
3327 player->uVoiceID = 19; | |
3328 else --player->uVoiceID; | |
3329 } | |
967 | 3330 while (player->GetSexByVoice() != pSex); |
971 | 3331 pButton = pCreationUI_BtnPressLeft2[pParam]; |
962 | 3332 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); |
960 | 3333 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3334 player->PlaySound(SPEECH_PickMe, 0); | |
3335 break; | |
187 | 3336 case UIMSG_PlayerCreation_VoiceNext: |
967 | 3337 pSex = player->GetSexByVoice(); |
3338 do | |
3339 { | |
3340 player->uVoiceID = (player->uVoiceID + 1) % 20; | |
3341 } | |
3342 while (player->GetSexByVoice() != pSex); | |
971 | 3343 pButton = pCreationUI_BtnPressRight2[pParam]; |
967 | 3344 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); |
3345 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); | |
3346 player->PlaySound(SPEECH_PickMe, 0); | |
3347 break; | |
187 | 3348 case UIMSG_PlayerCreation_FacePrev: |
971 | 3349 pPlayer = &pParty->pPlayers[pParam]; |
1014 | 3350 if (!pPlayer->uCurrentFace) |
3351 pPlayer->uCurrentFace = 19; | |
960 | 3352 else |
1014 | 3353 pPlayer->uCurrentFace -= 1; |
3354 pPlayer->uVoiceID = pPlayer->uCurrentFace; | |
960 | 3355 pPlayer->SetInitialStats(); |
3356 pPlayer->SetSexByVoice(); | |
3357 pPlayer->RandomizeName(); | |
971 | 3358 v25 = pParam; |
960 | 3359 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3360 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3361 uPlayerCreationUI_SelectedCharacter = v25; |
962 | 3362 GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], 1); |
960 | 3363 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); |
3364 pPlayer->PlaySound(SPEECH_PickMe, 0); | |
3365 break; | |
187 | 3366 case UIMSG_PlayerCreation_FaceNext: |
971 | 3367 pPlayer = &pParty->pPlayers[pParam]; |
1014 | 3368 v20 = (char)((int)pPlayer->uCurrentFace + 1) % 20; |
3369 pPlayer->uCurrentFace = v20; | |
960 | 3370 pPlayer->uVoiceID = v20; |
3371 pPlayer->SetInitialStats(); | |
3372 pPlayer->SetSexByVoice(); | |
3373 pPlayer->RandomizeName(); | |
971 | 3374 v21 = pParam; |
960 | 3375 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3376 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3377 uPlayerCreationUI_SelectedCharacter = v21; |
962 | 3378 GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], 1); |
960 | 3379 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3380 pPlayer->PlaySound(SPEECH_PickMe, 0); | |
3381 break; | |
3382 case UIMSG_PlayerCreationClickPlus: | |
962 | 3383 GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, 1); |
960 | 3384 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
3385 pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); | |
3386 break; | |
3387 case UIMSG_PlayerCreationClickMinus: | |
962 | 3388 GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, 1); |
960 | 3389 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
3390 pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); | |
3391 break; | |
3392 case UIMSG_PlayerCreationSelectActiveSkill: | |
967 | 3393 pPlayer = &pPlayer[uPlayerCreationUI_SelectedCharacter]; |
971 | 3394 v6 = pPlayer->GetSkillIdxByOrder(pParam + 4); |
967 | 3395 if ( pPlayer->GetSkillIdxByOrder(3) == 37 ) |
3396 pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1; | |
3397 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); | |
3398 break; | |
960 | 3399 case UIMSG_PlayerCreationSelectClass: |
971 | 3400 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam); |
960 | 3401 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3402 break; | |
3403 case UIMSG_PlayerCreationClickOK: | |
962 | 3404 GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0); |
960 | 3405 if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() ) |
3406 GameUI_Footer_TimeLeft = GetTickCount() + 4000; | |
3407 else | |
982 | 3408 uGameState = GAME_STATE_STARTING_NEW_GAME; |
960 | 3409 break; |
3410 case UIMSG_PlayerCreationClickReset: | |
962 | 3411 GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0); |
960 | 3412 pParty->Reset(); |
3413 break; | |
3414 case UIMSG_PlayerCreationRemoveUpSkill: | |
971 | 3415 uPlayerCreationUI_SelectedCharacter = pParam; |
960 | 3416 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; |
3417 //int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; | |
3418 v41 = 2; | |
971 | 3419 v5 = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3420 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; |
3421 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) | |
3422 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; | |
3423 break; | |
3424 case UIMSG_PlayerCreationChangeName: | |
3425 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); | |
971 | 3426 v3 = (void *)pParam; |
3427 uPlayerCreationUI_SelectedCharacter = pParam; | |
960 | 3428 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu); |
3429 pGUIWindow_CurrentMenu->ptr_1C = v3; | |
3430 break; | |
3431 case UIMSG_ChangeGameState: | |
978 | 3432 uGameState = GAME_FINISHED; |
960 | 3433 break; |
3434 case UIMSG_11: | |
3435 pMouse->SetCursorBitmap("MICON2"); | |
3436 break; | |
3437 case UIMSG_3A: | |
3438 SetCurrentMenuID(MENU_10); | |
3439 break; | |
165 | 3440 case UIMSG_LoadGame: |
0 | 3441 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) |
960 | 3442 break; |
961 | 3443 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
960 | 3444 break; |
165 | 3445 case UIMSG_SelectLoadSlot: |
0 | 3446 //main menu save/load wnd clicking on savegame lines |
1038 | 3447 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
3448 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
971 | 3449 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition ) |
0 | 3450 { |
3451 //load clicked line | |
971 | 3452 v26 = pParam + pSaveListPosition; |
3453 if ( dword_6BE138 == pParam + pSaveListPosition ) | |
0 | 3454 { |
961 | 3455 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); |
437 | 3456 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); |
0 | 3457 } |
3458 uLoadGameUI_SelectedSlot = v26; | |
3459 dword_6BE138 = v26; | |
3460 } | |
3461 else | |
3462 { | |
3463 //typing in the line | |
3 | 3464 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); |
0 | 3465 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); |
3466 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); | |
3467 } | |
960 | 3468 break; |
961 | 3469 case UIMSG_SaveLoadBtn: |
3470 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); | |
960 | 3471 break; |
165 | 3472 case UIMSG_DownArrow: |
3 | 3473 ++pSaveListPosition; |
971 | 3474 if ( pSaveListPosition >= pParam ) |
3475 pSaveListPosition = pParam - 1; | |
3 | 3476 if ( pSaveListPosition < 1 ) |
3477 pSaveListPosition = 0; | |
3478 pWindow = pGUIWindow_CurrentMenu; | |
962 | 3479 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_PressedButton2, (int)pBtnDownArrow, 0); |
960 | 3480 break; |
165 | 3481 case UIMSG_Cancel: |
960 | 3482 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0); |
3483 break; | |
165 | 3484 case UIMSG_ArrowUp: |
3 | 3485 --pSaveListPosition; |
3486 if ( pSaveListPosition < 0 ) | |
3487 pSaveListPosition = 0; | |
3488 pWindow = pGUIWindow_CurrentMenu; | |
962 | 3489 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_PressedButton2, (int)pBtnArrowUp, 0); |
960 | 3490 break; |
3491 case UIMSG_AD: | |
962 | 3492 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); |
961 | 3493 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
960 | 3494 break; |
3495 case UIMSG_AE: | |
962 | 3496 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); |
165 | 3497 SetCurrentMenuID(MENU_10); |
960 | 3498 break; |
3499 case UIMSG_Escape: | |
0 | 3500 if ( ptr_507BDC ) |
3501 { | |
3502 sub_41426F(); | |
960 | 3503 break; |
0 | 3504 } |
3505 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) ) | |
960 | 3506 break; |
0 | 3507 v15 = 1; |
3508 pVideoPlayer->bStopBeforeSchedule = 1; | |
3509 viewparams->bRedrawGameUI = 1; | |
3510 viewparams->field_48 = 1; | |
165 | 3511 if ( !GetCurrentMenuID() || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC ) |
3512 { | |
3513 if ( pCurrentScreen == SCREEN_VIDEO ) | |
3514 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
3515 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
3516 { | |
3517 SetCurrentMenuID(MENU_CREATEPARTY); | |
960 | 3518 break; |
0 | 3519 } |
165 | 3520 if (GetCurrentMenuID() == MENU_CREDITSPROC) |
3521 { | |
3522 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
960 | 3523 break; |
0 | 3524 } |
437 | 3525 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); |
960 | 3526 break; |
0 | 3527 } |
971 | 3528 if ( GetCurrentMenuID() == MENU_CREDITSPROC && !pCurrentScreen ) |
3529 { | |
3530 if ( pCurrentScreen == SCREEN_VIDEO ) | |
3531 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
3532 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
3533 { | |
3534 SetCurrentMenuID(MENU_CREATEPARTY); | |
3535 break; | |
3536 } | |
3537 if (GetCurrentMenuID() == MENU_CREDITSPROC) | |
3538 { | |
3539 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
3540 break; | |
3541 } | |
3542 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); | |
3543 break; | |
3544 } | |
151 | 3545 if ( pCurrentScreen == SCREEN_LOADGAME ) |
0 | 3546 { |
3547 pIcons_LOD->_4114F2(); | |
3548 //crt_deconstruct_ptr_6A0118(); | |
3549 pTexture_PCX.Release(); | |
3550 pTexture_PCX.Load("title.pcx", 0); | |
3551 SetCurrentMenuID(MENU_MAIN); | |
3552 v15 = 1; | |
3553 pGUIWindow_CurrentMenu->Release(); | |
3554 pGUIWindow2->Release(); | |
3555 pGUIWindow2 = 0; | |
3556 pEventTimer->Resume(); | |
151 | 3557 pCurrentScreen = SCREEN_GAME; |
0 | 3558 viewparams->bRedrawGameUI = v15; |
960 | 3559 break; |
0 | 3560 } |
151 | 3561 if ( pCurrentScreen == SCREEN_VIDEO ) |
0 | 3562 { |
3563 pVideoPlayer->Unload(); | |
3564 } | |
3565 else | |
3566 { | |
151 | 3567 if ( pCurrentScreen != SCREEN_1B ) |
2 | 3568 { |
3569 pGUIWindow_CurrentMenu->Release(); | |
3570 pGUIWindow2->Release(); | |
3571 pGUIWindow2 = 0; | |
3572 pEventTimer->Resume(); | |
151 | 3573 pCurrentScreen = SCREEN_GAME; |
2 | 3574 viewparams->bRedrawGameUI = v15; |
960 | 3575 break; |
2 | 3576 } |
0 | 3577 //VideoPlayer::dtor(); |
3578 } | |
960 | 3579 break; |
3580 case UIMSG_PlayerCreationRemoveDownSkill: | |
971 | 3581 uPlayerCreationUI_SelectedCharacter = pParam; |
165 | 3582 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 |
971 | 3583 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
165 | 3584 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3) |
0 | 3585 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; |
960 | 3586 break; |
3587 default: | |
3588 break; | |
0 | 3589 } |
3590 } | |
3591 while ( pMessageQueue_50CBD0->uNumMessages ); | |
3592 } | |
3593 } | |
3594 | |
3595 //----- (00436427) -------------------------------------------------------- | |
3596 double __cdecl get_shading_dist_mist() | |
3597 { | |
3598 double result; // st7@2 | |
3599 | |
3600 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3601 result = (double)pOutdoorCamera->shading_dist_mist; | |
3602 else | |
3603 result = 16192.0; | |
3604 return result; | |
3605 } | |
3606 | |
3607 //----- (0043648F) -------------------------------------------------------- | |
3608 void Vec3_short__to_RenderVertexSoft(RenderVertexSoft *_this, Vec3_short_ *a2) | |
3609 { | |
3610 _this->flt_2C = 0.0; | |
3611 | |
3612 _this->vWorldPosition.x = a2->x; | |
3613 _this->vWorldPosition.y = a2->y; | |
3614 _this->vWorldPosition.z = a2->z; | |
3615 } | |
3616 | |
3617 //----- (004369DB) -------------------------------------------------------- | |
3618 void Vec3_float_::Normalize() | |
3619 { | |
1025 | 3620 this->x = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->x; |
3621 this->y = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->y; | |
3622 this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z; | |
0 | 3623 } |
3624 | |
3625 //----- (004385B5) -------------------------------------------------------- | |
3626 void stru11::CheckCPU() | |
3627 { | |
3628 LOG_DECOMPILATION_WARNING(); | |
3629 /* | |
3630 int v5; // [sp-4h] [bp-10h]@0 | |
3631 signed int v6; // [sp+4h] [bp-8h]@1 | |
3632 signed int v7; // [sp+8h] [bp-4h]@1 | |
3633 | |
3634 _CF = 0; | |
3635 _OF = 0; | |
3636 _ZF = 1; | |
3637 _SF = 0; | |
3638 v7 = 0; | |
3639 __asm { pushf } | |
3640 v6 = 3; | |
3641 if ( v5 != (v5 ^ 0x40000) ) | |
3642 { | |
3643 __asm { popf } | |
3644 v6 = 4; | |
3645 __asm { pushf } | |
3646 if ( v5 != (v5 ^ 0x200000) ) | |
3647 { | |
3648 v7 = 1; | |
3649 v6 = 0; | |
3650 } | |
3651 } | |
3652 if ( v6 == 3 ) | |
3653 { | |
3654 this->field_AC = 1; | |
3655 } | |
3656 else | |
3657 { | |
3658 if ( v6 == 4 ) | |
3659 { | |
3660 this->field_AC = 2; | |
3661 } | |
3662 else | |
3663 { | |
3664 if ( v7 ) | |
3665 { | |
3666 this->field_AC = 2; | |
3667 RunCPUID(); | |
3668 } | |
3669 else | |
3670 { | |
3671 this->field_AC = 0; | |
3672 } | |
3673 } | |
3674 }*/ | |
3675 } | |
3676 | |
3677 //----- (00438659) -------------------------------------------------------- | |
3678 void stru11::RunCPUID() | |
3679 { | |
3680 __debugbreak(); | |
3681 /*stru11 *v6; // esi@1 | |
3682 unsigned int uNumOps; // edi@1 | |
3683 int uNumExtOps; // edi@16 | |
3684 char pCyrixString[16]; // [sp+Ch] [bp-60h]@1 | |
3685 char pCentaurString[16]; // [sp+1Ch] [bp-50h]@1 | |
3686 char pAMDString[16]; // [sp+2Ch] [bp-40h]@1 | |
3687 char pIntelString[16]; // [sp+3Ch] [bp-30h]@1 | |
3688 char pCPUString[16]; // [sp+4Ch] [bp-20h]@1 | |
3689 stru11 *thisa; // [sp+5Ch] [bp-10h]@1 | |
3690 char *v35; // [sp+60h] [bp-Ch]@1 | |
3691 int v36; // [sp+64h] [bp-8h]@1 | |
3692 int v37; // [sp+68h] [bp-4h]@1 | |
3693 | |
3694 thisa = this; | |
3695 *(int *)pIntelString = *(int *)"GenuineIntel"; | |
3696 *(int *)&pIntelString[4] = *(int *)"ineIntel"; | |
3697 *(int *)&pIntelString[8] = *(int *)"ntel"; | |
3698 pIntelString[12] = aGenuineintel[12]; | |
3699 *(int *)pAMDString = *(int *)"AuthenticAMD"; | |
3700 *(int *)&pAMDString[4] = *(int *)"enticAMD"; | |
3701 *(int *)&pAMDString[8] = *(int *)"cAMD"; | |
3702 pAMDString[12] = aAuthenticamd[12]; | |
3703 *(int *)pCyrixString = *(int *)"CyrixInstead"; | |
3704 *(int *)&pCyrixString[4] = *(int *)"xInstead"; | |
3705 *(int *)&pCyrixString[8] = *(int *)"tead"; | |
3706 pCyrixString[12] = aCyrixinstead[12]; | |
3707 *(int *)pCentaurString = *(int *)"CentaurHauls"; | |
3708 *(int *)&pCentaurString[4] = *(int *)"aurHauls"; | |
3709 *(int *)&pCentaurString[8] = *(int *)"auls"; | |
3710 v37 = 0; | |
3711 v36 = 0; | |
3712 pCentaurString[12] = aCentaurhauls[12]; | |
3713 v35 = pCPUString; | |
3714 pCPUString[12] = 0; | |
3715 _EAX = 0; | |
3716 __asm { cpuid } | |
3717 v37 = _EAX; | |
3718 *(int *)pCPUString = _EBX; | |
3719 *(int *)&pCPUString[4] = _EDX; | |
3720 *(int *)&pCPUString[8] = _ECX; | |
3721 v6 = thisa; | |
3722 uNumOps = _EAX; | |
3723 thisa->cpuid_00000000_ebx_vendorstr1 = _EBX; | |
3724 v6->cpuid_00000000_edx_vendorstr2 = *(int *)&pCPUString[4]; | |
3725 v6->cpuid_00000000_ecx_vendorstr3 = *(int *)&pCPUString[8]; | |
3726 v6->cpuid_00000000_eax_numops = _EAX; | |
3727 strcpy(v6->pCPUString, pCPUString); | |
3728 if ( strcmp(pIntelString, pCPUString) ) | |
3729 { | |
3730 if ( strcmp(pAMDString, pCPUString) ) | |
3731 { | |
3732 if ( strcmp(pCyrixString, pCPUString) ) | |
3733 { | |
3734 if ( strcmp(pCentaurString, pCPUString) ) | |
3735 v6->uProcessorManufacturer = 0; | |
3736 else | |
3737 v6->uProcessorManufacturer = 4; | |
3738 } | |
3739 else | |
3740 { | |
3741 v6->uProcessorManufacturer = 3; | |
3742 } | |
3743 } | |
3744 else | |
3745 { | |
3746 v6->uProcessorManufacturer = 2; | |
3747 } | |
3748 } | |
3749 else | |
3750 { | |
3751 v6->uProcessorManufacturer = 1; | |
3752 } | |
3753 if ( uNumOps >= 1 ) | |
3754 RunCPUID_op1(); | |
3755 if ( uNumOps >= 2 ) | |
3756 RunCPUID_op2(); | |
3757 _EAX = 0x80000000u; | |
3758 __asm { cpuid } | |
3759 if ( !(_EAX & 0x80000000) ) | |
3760 _EAX = 0x80000000u; | |
3761 v36 = _EAX; | |
3762 v6->cpuid_80000000_edx = _EAX; | |
3763 uNumExtOps = _EAX ^ 0x80000000; | |
3764 if ( (_EAX ^ 0x80000000u) >= 1 ) | |
3765 { | |
3766 _EAX = 0x80000001u; | |
3767 __asm { cpuid } | |
3768 thisa = (stru11 *)_EAX; | |
3769 v35 = (char *)_EDX; | |
3770 v6->cpuid_80000001_eax = _EAX; | |
3771 v6->cpuid_80000001_edx = (int)v35; | |
3772 } | |
3773 if ( (unsigned int)uNumExtOps >= 4 ) | |
3774 RunCPUID_ext2_3_4(); | |
3775 if ( (unsigned int)uNumExtOps >= 5 ) | |
3776 { | |
3777 _EAX = 0x80000005u; | |
3778 __asm { cpuid } | |
3779 thisa = (stru11 *)_EBX; | |
3780 v35 = (char *)_ECX; | |
3781 v36 = _EDX; | |
3782 v6->cpuid_80000005_ebx = _EBX; | |
3783 v6->cpuid_80000005_ecx = (int)v35; | |
3784 v6->cpuid_80000005_edx = v36; | |
3785 } | |
3786 if ( (unsigned int)uNumExtOps >= 6 ) | |
3787 { | |
3788 _EAX = 0x80000006u; | |
3789 __asm { cpuid } | |
3790 v6->cpuid_80000006_ecx = _ECX; | |
3791 }*/ | |
3792 } | |
3793 | |
3794 //----- (00438821) -------------------------------------------------------- | |
3795 void stru11::RunCPUID_op1() | |
3796 { | |
3797 __debugbreak(); | |
3798 /*stru11 *v1; // esi@1 | |
3799 unsigned int v7; // ecx@1 | |
3800 int v8; // eax@3 | |
3801 int v9; // eax@10 | |
3802 signed int v10; // eax@11 | |
3803 int v11; // ecx@11 | |
3804 int v12; // eax@15 | |
3805 signed int v13; // eax@19 | |
3806 int v14; // ecx@19 | |
3807 signed int v15; // eax@25 | |
3808 int v16; // ecx@25 | |
3809 signed int v17; // eax@34 | |
3810 int v18; // ecx@34 | |
3811 | |
3812 v1 = this; | |
3813 _EAX = 1; | |
3814 __asm { cpuid } | |
3815 v7 = _EAX; | |
3816 v1->cpuid_00000001_edx = _EDX; | |
3817 v1->cpuid_00000001_eax = _EAX; | |
3818 if ( (_EAX & 0x3000) == 8192 ) | |
3819 { | |
3820 LOBYTE(v1->cpuid_80000002_registers2[0]) = 1; | |
3821 v7 = 0; | |
3822 } | |
3823 v8 = (v7 >> 8) & 0xF; | |
3824 switch ( v8 ) | |
3825 { | |
3826 case 4: | |
3827 v1->field_AC = 2; | |
3828 break; | |
3829 case 5: | |
3830 v1->field_AC = 15; | |
3831 break; | |
3832 case 6: | |
3833 v1->field_AC = 36; | |
3834 break; | |
3835 default: | |
3836 v1->field_AC = 49; | |
3837 break; | |
3838 } | |
3839 v9 = v1->uProcessorManufacturer; | |
3840 if ( v9 == 1 ) | |
3841 { | |
3842 v10 = 0; | |
3843 v11 = v7 & 0x3FF0; | |
3844 while ( v11 != dword_4E4948[2 * v10] ) | |
3845 { | |
3846 ++v10; | |
3847 if ( v10 >= 17 ) | |
3848 return; | |
3849 } | |
3850 v12 = dword_4E494C[2 * v10]; | |
3851 goto LABEL_39; | |
3852 } | |
3853 if ( v9 == 2 ) | |
3854 { | |
3855 if ( (v7 & 0xF00) == dword_4E49D0[0] ) | |
3856 { | |
3857 v12 = dword_4E49D4[0]; | |
3858 } | |
3859 else | |
3860 { | |
3861 v13 = 1; | |
3862 v14 = v7 & 0x3FF0; | |
3863 while ( v14 != dword_4E49D0[2 * v13] ) | |
3864 { | |
3865 ++v13; | |
3866 if ( v13 >= 9 ) | |
3867 return; | |
3868 } | |
3869 v12 = dword_4E49D4[2 * v13]; | |
3870 } | |
3871 goto LABEL_39; | |
3872 } | |
3873 if ( v9 != 3 ) | |
3874 { | |
3875 if ( v9 != 4 ) | |
3876 return; | |
3877 v17 = 0; | |
3878 v18 = v7 & 0x3FF0; | |
3879 while ( v18 != dword_4E4A40[2 * v17] ) | |
3880 { | |
3881 ++v17; | |
3882 if ( v17 >= 2 ) | |
3883 return; | |
3884 } | |
3885 v12 = dword_4E4A44[2 * v17]; | |
3886 goto LABEL_39; | |
3887 } | |
3888 v15 = 1; | |
3889 v16 = v7 & 0x3FF0; | |
3890 while ( v16 != dword_4E4A18[2 * v15] ) | |
3891 { | |
3892 ++v15; | |
3893 if ( v15 >= 5 ) | |
3894 goto LABEL_30; | |
3895 } | |
3896 v1->field_AC = dword_4E4A1C[2 * v15]; | |
3897 LABEL_30: | |
3898 v12 = 24; | |
3899 if ( v1->field_AC == 24 ) | |
3900 { | |
3901 if ( _EDX != 1 ) | |
3902 v12 = (((_EDX != 261) - 1) & 0xA) + 15; | |
3903 LABEL_39: | |
3904 v1->field_AC = v12; | |
3905 }*/ | |
3906 } | |
3907 | |
3908 //----- (00438992) -------------------------------------------------------- | |
3909 void stru11::RunCPUID_op2() | |
3910 { | |
3911 __debugbreak(); | |
3912 /* | |
3913 stru11 *v1; // edi@1 | |
3914 int v7; // eax@1 | |
3915 signed int v8; // ecx@2 | |
3916 unsigned __int8 v9; // al@3 | |
3917 signed int v10; // ecx@14 | |
3918 unsigned __int8 v11; // al@15 | |
3919 int v12; // [sp+Ch] [bp-14h]@1 | |
3920 int v13; // [sp+10h] [bp-10h]@1 | |
3921 int v14; // [sp+14h] [bp-Ch]@1 | |
3922 int v15; // [sp+18h] [bp-8h]@1 | |
3923 int *v16; // [sp+1Ch] [bp-4h]@1 | |
3924 | |
3925 v1 = this; | |
3926 v16 = &v12; | |
3927 _EAX = 2; | |
3928 __asm { cpuid } | |
3929 v12 = _EAX; | |
3930 v13 = _EBX; | |
3931 v14 = _ECX; | |
3932 v15 = _EDX; | |
3933 v1->cpuid_00000002_eax = _EAX; | |
3934 v1->cpuid_00000002_ebx = v13; | |
3935 v1->cpuid_00000002_ecx = v14; | |
3936 v1->cpuid_00000002_edx = v15; | |
3937 v7 = v1->field_AC; | |
3938 if ( v7 == 40 ) | |
3939 { | |
3940 v8 = 0; | |
3941 while ( 1 ) | |
3942 { | |
3943 v9 = *((char *)&v12 + v8); | |
3944 if ( v9 == 64 ) | |
3945 { | |
3946 v1->field_AC = 43; | |
3947 return; | |
3948 } | |
3949 if ( v9 >= 0x41u && v9 <= 0x43u ) | |
3950 { | |
3951 v1->field_AC = 41; | |
3952 return; | |
3953 } | |
3954 if ( v9 >= 0x44u && v9 <= 0x45u ) | |
3955 break; | |
3956 ++v8; | |
3957 if ( v8 >= 16 ) | |
3958 return; | |
3959 } | |
3960 v1->field_AC = 42; | |
3961 } | |
3962 else | |
3963 { | |
3964 if ( v7 == 45 ) | |
3965 { | |
3966 v10 = 0; | |
3967 while ( 1 ) | |
3968 { | |
3969 v11 = *((char *)&v12 + v10); | |
3970 if ( v11 >= 0x40u && v11 <= 0x43u ) | |
3971 { | |
3972 v1->field_AC = 46; | |
3973 return; | |
3974 } | |
3975 if ( v11 >= 0x44u && v11 <= 0x45u ) | |
3976 break; | |
3977 ++v10; | |
3978 if ( v10 >= 16 ) | |
3979 return; | |
3980 } | |
3981 v1->field_AC = 47; | |
3982 } | |
3983 }*/ | |
3984 } | |
3985 | |
3986 //----- (00438A67) -------------------------------------------------------- | |
3987 void stru11::RunCPUID_ext2_3_4() | |
3988 { | |
3989 __debugbreak(); | |
3990 /*stru11 *v1; // edi@1 | |
3991 stru11 *v17; // eax@1 | |
3992 int v18[3][4]; // [sp+Ch] [bp-38h]@1 | |
3993 stru11 *v19; // [sp+3Ch] [bp-8h]@1 | |
3994 | |
3995 v1 = this; | |
3996 v19 = this; | |
3997 _EAX = 0x80000002u; | |
3998 __asm { cpuid } | |
3999 v18[0][0] = _EAX; | |
4000 *(_QWORD *)&v18[0][1] = __PAIR__(_ECX, _EBX); | |
4001 v18[0][3] = _EDX; | |
4002 _EAX = 0x80000003u; | |
4003 __asm { cpuid } | |
4004 v18[1][0] = _EAX; | |
4005 *(_QWORD *)&v18[1][1] = __PAIR__(_ECX, _EBX); | |
4006 v18[1][3] = _EDX; | |
4007 _EAX = 0x80000004u; | |
4008 __asm { cpuid } | |
4009 v18[2][0] = _EAX; | |
4010 *(_QWORD *)&v18[2][1] = __PAIR__(_ECX, _EBX); | |
4011 v18[2][3] = _EDX; | |
4012 v17 = v19; | |
4013 memcpy(v1->cpuid_80000002_registers, v18, 0x30u); | |
4014 memcpy((char *)&v17->cpuid_80000002_registers2[0] + 1, v18, 0x30u);*/ | |
4015 } | |
4016 | |
4017 //----- (00438BDF) -------------------------------------------------------- | |
4018 bool MonsterStats::BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype) | |
4019 { | |
4020 unsigned __int8 v2; // zf@15 | |
4021 char v3; // sf@15 | |
4022 unsigned __int8 v4; // of@15 | |
4023 bool result; // eax@33 | |
4024 | |
4025 switch ( eSupertype ) | |
4026 { | |
4027 case MONSTER_SUPERTYPE_UNDEAD: | |
4028 if ( (signed int)uMonsterInfoID >= MONSTER_GHOST_1 && (signed int)uMonsterInfoID <= MONSTER_GHOST_3 | |
4029 || (signed int)uMonsterInfoID >= MONSTER_LICH_1 && (signed int)uMonsterInfoID <= MONSTER_LICH_3 | |
4030 || (signed int)uMonsterInfoID >= MONSTER_SKELETON_1 && (signed int)uMonsterInfoID <= MONSTER_SKELETON_3 | |
4031 || (signed int)uMonsterInfoID >= MONSTER_VAMPIRE_1 && (signed int)uMonsterInfoID <= MONSTER_VAMPIRE_3 | |
4032 || (signed int)uMonsterInfoID >= MONSTER_WIGHT_1 && (signed int)uMonsterInfoID <= MONSTER_WIGHT_3 | |
4033 || (signed int)uMonsterInfoID >= MONSTER_ZOMBIE_1 && (signed int)uMonsterInfoID <= MONSTER_ZOMBIE_3 ) | |
4034 goto ret_true; | |
4035 if ( (signed int)uMonsterInfoID < MONSTER_GHOUL_1 ) | |
4036 goto ret_false; | |
4037 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_GHOUL_3); | |
4038 v2 = uMonsterInfoID == MONSTER_GHOUL_3; | |
4039 v3 = ((uMonsterInfoID - MONSTER_GHOUL_3) & 0x80000000u) != 0; | |
4040 goto false_if_outside; | |
4041 case MONSTER_SUPERTYPE_KREEGAN: | |
4042 if ( (signed int)uMonsterInfoID < MONSTER_DEVIL_1 ) | |
4043 goto ret_false; | |
4044 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DEVIL_3); | |
4045 v2 = uMonsterInfoID == MONSTER_DEVIL_3; | |
4046 v3 = ((uMonsterInfoID - MONSTER_DEVIL_3) & 0x80000000u) != 0; | |
4047 goto false_if_outside; | |
4048 case MONSTER_SUPERTYPE_ELF: | |
4049 if ( (signed int)uMonsterInfoID >= MONSTER_PEASANT_ELF_FEMALE_1_1 | |
4050 && (signed int)uMonsterInfoID <= MONSTER_PEASANT_ELF_MALE_3_3 | |
4051 || (signed int)uMonsterInfoID >= MONSTER_ELF_ARCHER_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_ARCHER_3 ) | |
4052 goto ret_true; | |
4053 if ( (signed int)uMonsterInfoID < MONSTER_ELF_SPEARMAN_1 ) | |
4054 goto ret_false; | |
4055 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELF_SPEARMAN_3); | |
4056 v2 = uMonsterInfoID == MONSTER_ELF_SPEARMAN_3; | |
4057 v3 = ((uMonsterInfoID - MONSTER_ELF_SPEARMAN_3) & 0x80000000u) != 0; | |
4058 goto false_if_outside; | |
4059 case MONSTER_SUPERTYPE_DRAGON: | |
4060 if ( (signed int)uMonsterInfoID < MONSTER_DRAGON_1 ) | |
4061 goto ret_false; | |
4062 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DRAGON_3); | |
4063 v2 = uMonsterInfoID == MONSTER_DRAGON_3; | |
4064 v3 = ((uMonsterInfoID - MONSTER_DRAGON_3) & 0x80000000u) != 0; | |
4065 goto false_if_outside; | |
4066 case MONSTER_SUPERTYPE_WATER_ELEMENTAL: | |
4067 if ( (signed int)uMonsterInfoID < MONSTER_ELEMENTAL_WATER_1 ) | |
4068 goto ret_false; | |
4069 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELEMENTAL_WATER_3); | |
4070 v2 = uMonsterInfoID == MONSTER_ELEMENTAL_WATER_3; | |
4071 v3 = ((uMonsterInfoID - MONSTER_ELEMENTAL_WATER_3) & 0x80000000u) != 0; | |
4072 goto false_if_outside; | |
4073 case MONSTER_SUPERTYPE_TREANT: | |
4074 if ( (signed int)uMonsterInfoID < MONSTER_TREANT_1 ) | |
4075 goto ret_false; | |
4076 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TREANT_3); | |
4077 v2 = uMonsterInfoID == MONSTER_TREANT_3; | |
4078 v3 = ((uMonsterInfoID - MONSTER_TREANT_3) & 0x80000000u) != 0; | |
4079 goto false_if_outside; | |
4080 case MONSTER_SUPERTYPE_TITAN: | |
4081 if ( (signed int)uMonsterInfoID < MONSTER_TITAN_1 ) | |
4082 goto ret_false; | |
4083 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TITAN_3); | |
4084 v2 = uMonsterInfoID == MONSTER_TITAN_3; | |
4085 v3 = ((uMonsterInfoID - MONSTER_TITAN_3) & 0x80000000u) != 0; | |
4086 false_if_outside: | |
4087 if ( !((unsigned __int8)(v3 ^ v4) | v2) ) | |
4088 goto ret_false; | |
4089 ret_true: | |
4090 result = 1; | |
4091 break; | |
4092 default: | |
4093 ret_false: | |
4094 result = 0; | |
4095 break; | |
4096 } | |
4097 return result; | |
4098 } | |
4099 | |
4100 //----- (00438F8F) -------------------------------------------------------- | |
783 | 4101 void __cdecl area_of_effect__damage_evaluate() |
0 | 4102 { |
4103 int v0; // edx@1 | |
4104 char *v1; // esi@2 | |
4105 int v2; // ecx@3 | |
4106 signed int v3; // eax@3 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4107 SpriteObject *v4; // eax@4 |
0 | 4108 signed int v5; // eax@4 |
4109 signed int v6; // eax@6 | |
4110 unsigned int v7; // edi@6 | |
4111 int v8; // eax@6 | |
4112 __int16 v9; // bx@8 | |
4113 int v10; // edi@8 | |
4114 Vec3_int_ v11; // ST04_12@9 | |
4115 int v12; // ST0C_4@10 | |
4116 Actor *v13; // edi@11 | |
4117 int v14; // edx@15 | |
4118 int v15; // edx@15 | |
4119 int v16; // ebx@15 | |
4120 signed int v17; // eax@15 | |
4121 int v18; // edi@15 | |
4122 int v19; // edi@15 | |
4123 Vec3_int_ v20; // ST04_12@16 | |
4124 Vec3_int_ *v21; // eax@17 | |
4125 unsigned int v22; // edx@17 | |
4126 int v23; // edx@18 | |
4127 int v24; // eax@18 | |
4128 Vec3_int_ v25; // ST04_12@19 | |
4129 unsigned int v26; // ebx@20 | |
89 | 4130 Player *v27; // edi@20 |
90 | 4131 Actor *v28; // edi@27 |
0 | 4132 int v29; // ebx@29 |
4133 int v30; // eax@29 | |
4134 int v31; // edx@29 | |
4135 int v32; // eax@29 | |
4136 int v33; // ST24_4@29 | |
4137 Vec3_int_ v34; // ST04_12@30 | |
4138 Vec3_int_ *v35; // eax@31 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4139 SpriteObject *v36; // [sp+0h] [bp-28h]@0 |
0 | 4140 signed int v37; // [sp+4h] [bp-24h]@5 |
4141 int v38; // [sp+4h] [bp-24h]@15 | |
4142 signed int v39; // [sp+8h] [bp-20h]@3 | |
4143 int v40; // [sp+8h] [bp-20h]@15 | |
4144 int v41; // [sp+Ch] [bp-1Ch]@5 | |
4145 int v42; // [sp+Ch] [bp-1Ch]@15 | |
4146 int v43; // [sp+10h] [bp-18h]@1 | |
4147 int v44; // [sp+14h] [bp-14h]@15 | |
4148 unsigned int uActorID; // [sp+18h] [bp-10h]@6 | |
4149 Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 | |
4150 int a1; // [sp+20h] [bp-8h]@8 | |
4151 int v48; // [sp+24h] [bp-4h]@8 | |
4152 | |
4153 v0 = 0; | |
4154 v43 = 0; | |
4155 if ( stru_50FE08.count > 0 ) | |
4156 { | |
4157 pVelocity = &stru_50FE08.vec_4B4; | |
4158 v1 = (char *)stru_50FE08.pZs; | |
4159 do | |
4160 { | |
848 | 4161 v2 = PID_TYPE(*((short *)v1 - 300)); |
4162 v3 = PID_ID((signed int)*((short *)v1 - 300)); | |
4163 v39 = PID_ID((signed int)*((short *)v1 - 300)); | |
0 | 4164 if ( v2 == 2 ) |
4165 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4166 v4 = &pSpriteObjects[v3]; |
0 | 4167 v36 = v4; |
822 | 4168 v5 = v4->spell_caster_pid; |
848 | 4169 v2 = PID_TYPE(v5); |
4170 v3 = PID_ID(v5); | |
0 | 4171 } |
4172 v41 = v2; | |
4173 v37 = v3; | |
4174 if ( stru_50FE08.field_3EC[v0] & 1 ) | |
4175 { | |
417 | 4176 v6 = ai_near_actors_targets_pid[v3]; |
848 | 4177 v7 = PID_ID(v6); |
4178 v8 = PID_TYPE(v6) - 3; | |
0 | 4179 uActorID = v7; |
4180 if ( v8 ) | |
4181 { | |
4182 if ( v8 == 1 ) | |
4183 { | |
4184 v9 = *(short *)v1; | |
4185 v10 = pParty->vPosition.y - *((short *)v1 - 100); | |
4186 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
4187 v48 = v10; | |
4188 if ( a1 * a1 | |
4189 + v10 * v10 | |
4190 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) | |
4191 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
4192 { | |
4193 v11.z = *(short *)v1; | |
4194 v11.y = *((short *)v1 - 100); | |
4195 v11.x = *((short *)v1 - 200); | |
4196 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v11) ) | |
4197 { | |
4198 v12 = stru_50C198.which_player_would_attack(&pActors[v39]); | |
4199 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v12); | |
4200 } | |
4201 } | |
4202 } | |
4203 } | |
4204 else | |
4205 { | |
4206 v13 = &pActors[v7]; | |
4207 if ( SHIDWORD(v13->pActorBuffs[6].uExpireTime) > 0 | |
4208 || SHIDWORD(v13->pActorBuffs[6].uExpireTime) >= 0 && LODWORD(v13->pActorBuffs[6].uExpireTime) | |
4209 || v13->CanAct() ) | |
4210 { | |
4211 v14 = v13->vPosition.y; | |
4212 v40 = v13->vPosition.x; | |
4213 v38 = v14; | |
4214 v15 = v14 - *((short *)v1 - 100); | |
4215 v16 = *(short *)v1; | |
4216 v42 = v13->vPosition.z; | |
4217 a1 = v40 - *((short *)v1 - 200); | |
4218 v17 = v13->uActorHeight; | |
4219 v18 = v13->uActorRadius; | |
4220 v44 = v42; | |
4221 v19 = *((short *)v1 + 100) + v18; | |
4222 v48 = v15; | |
4223 if ( a1 * a1 + v15 * v15 + (v42 + (v17 >> 1) - v16) * (v42 + (v17 >> 1) - v16) < (unsigned int)(v19 * v19) ) | |
4224 { | |
4225 v20.z = *(short *)v1; | |
4226 v20.y = *((short *)v1 - 100); | |
4227 v20.x = *((short *)v1 - 200); | |
4228 if ( sub_407A1C(v40, v38, v42 + 50, v20) ) | |
4229 { | |
4230 Vec3_int_::Normalize(&a1, &v48, &v44); | |
4231 v21 = pVelocity; | |
4232 v22 = uActorID; | |
4233 pVelocity->x = a1; | |
4234 v21->y = v48; | |
4235 v21->z = v44; | |
4236 sub_43B1B0(*((short *)v1 - 300), v22, v21, stru_50FE08.field_450[v43]); | |
4237 } | |
4238 } | |
4239 } | |
4240 } | |
4241 } | |
4242 else | |
4243 { | |
4244 v23 = pParty->vPosition.y - *((short *)v1 - 100); | |
4245 v24 = ((signed int)pParty->uPartyHeight >> 1) - *(short *)v1; | |
4246 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
4247 v48 = v23; | |
4248 if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
4249 { | |
4250 v25.z = *(short *)v1; | |
4251 v25.y = *((short *)v1 - 100); | |
4252 v25.x = *((short *)v1 - 200); | |
4253 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v25) ) | |
4254 { | |
4255 v26 = 0; | |
89 | 4256 v27 = pParty->pPlayers;//[0].pConditions[15]; |
0 | 4257 do |
4258 { | |
89 | 4259 if ( !(HIDWORD(v27->pConditions[14]) | LODWORD(v27->pConditions[14])) && !v27->pConditions[15] && !v27->pConditions[16] ) |
0 | 4260 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v26); |
89 | 4261 ++v27; |
0 | 4262 ++v26; |
4263 } | |
89 | 4264 while ( v27 <= &pParty->pPlayers[3] ); |
0 | 4265 } |
4266 } | |
4267 uActorID = 0; | |
4268 if ( (signed int)uNumActors > 0 ) | |
4269 { | |
90 | 4270 v28 = pActors;//[0].vPosition.z; |
0 | 4271 do |
4272 { | |
91 | 4273 if ( v28->CanAct() ) |
0 | 4274 { |
4275 v29 = *(short *)v1; | |
91 | 4276 v30 = v28->vPosition.y - *((short *)v1 - 100); |
4277 a1 = v28->vPosition.x - *((short *)v1 - 200); | |
90 | 4278 v31 = v28->vPosition.z; |
0 | 4279 v48 = v30; |
4280 v44 = v31; | |
90 | 4281 v32 = (v28->uActorHeight >> 1) - v29; |
91 | 4282 v33 = v28->uActorRadius + *((short *)v1 + 100); |
0 | 4283 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) |
4284 { | |
4285 v34.z = *(short *)v1; | |
4286 v34.y = *((short *)v1 - 100); | |
4287 v34.x = *((short *)v1 - 200); | |
90 | 4288 if ( sub_407A1C(v28->vPosition.x, v28->vPosition.y, v28->vPosition.z + 50, v34) ) |
0 | 4289 { |
4290 Vec3_int_::Normalize(&a1, &v48, &v44); | |
4291 v35 = pVelocity; | |
4292 pVelocity->x = a1; | |
4293 v35->y = v48; | |
4294 v35->z = v44; | |
4295 switch ( v41 ) | |
4296 { | |
303 | 4297 case OBJECT_Player: |
0 | 4298 DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); |
4299 break; | |
303 | 4300 case OBJECT_Actor: |
90 | 4301 if ( v36 && pActors[v37].GetActorsRelation(v28) ) |
0 | 4302 sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); |
4303 break; | |
303 | 4304 case OBJECT_Item: |
0 | 4305 sub_43B057(*((short *)v1 - 300), uActorID, v35); |
4306 break; | |
4307 } | |
4308 } | |
4309 } | |
4310 } | |
4311 ++uActorID; | |
90 | 4312 ++v28; |
0 | 4313 } |
4314 while ( (signed int)uActorID < (signed int)uNumActors ); | |
4315 } | |
4316 } | |
4317 ++pVelocity; | |
4318 v0 = v43 + 1; | |
4319 v1 += 2; | |
4320 ++v43; | |
4321 } | |
4322 while ( v43 < stru_50FE08.count ); | |
4323 } | |
4324 stru_50FE08.count = 0; | |
4325 } | |
4326 // 50FE08: using guessed type stru298 stru_50FE08; | |
4327 | |
4328 //----- (00439474) -------------------------------------------------------- | |
187 | 4329 void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) |
0 | 4330 { |
303 | 4331 //signed int v3; // eax@1 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4332 SpriteObject *v4; // ebx@1 |
303 | 4333 //int v5; // edx@3 |
4334 //bool uPlayerID; // eax@3 | |
4335 //Player *pPlayer; // edi@4 | |
0 | 4336 Actor *pMonster; // esi@7 |
921 | 4337 //SpriteObject *v9; // ebx@12 |
0 | 4338 int v10; // eax@12 |
4339 int v11; // ebx@12 | |
4340 unsigned int v12; // ecx@12 | |
4341 int v13; // edx@15 | |
4342 int v14; // edx@17 | |
4343 int v15; // eax@24 | |
4344 unsigned __int16 v16; // cx@25 | |
4345 int v17; // eax@29 | |
4346 int v18; // eax@38 | |
4347 unsigned __int8 v19; // zf@38 | |
4348 unsigned __int8 v20; // sf@38 | |
4349 int v21; // edx@44 | |
4350 int v22; // eax@44 | |
4351 unsigned __int8 v23; // zf@44 | |
4352 unsigned __int8 v24; // sf@44 | |
4353 int v25; // edx@51 | |
4354 int v26; // ecx@51 | |
303 | 4355 //signed int v27; // eax@51 |
4356 //int v28; // eax@53 | |
0 | 4357 signed int v29; // eax@76 |
4358 signed int v30; // eax@84 | |
4359 signed int v31; // eax@92 | |
4360 int v32; // eax@94 | |
4361 int v33; // eax@100 | |
4362 int v34; // eax@104 | |
4363 signed int v35; // eax@104 | |
4364 double v36; // st7@104 | |
4365 float v37; // ST08_4@104 | |
4366 float v38; // ST04_4@104 | |
4367 float v39; // ST00_4@104 | |
4368 int v40; // ebx@107 | |
4369 unsigned int v41; // ebx@109 | |
4370 signed __int64 v42; // qax@125 | |
4371 unsigned __int16 v43; // ax@132 | |
4372 char v44; // bl@132 | |
4373 unsigned __int16 v45; // ax@132 | |
4374 unsigned __int64 v46; // [sp+Ch] [bp-60h]@6 | |
4375 const char *v47; // [sp+14h] [bp-58h]@104 | |
4376 char *pPlayerName; // [sp+18h] [bp-54h]@12 | |
4377 char *pMonsterName; // [sp+1Ch] [bp-50h]@6 | |
4378 int v50; // [sp+20h] [bp-4Ch]@6 | |
303 | 4379 //unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6 |
0 | 4380 int v52; // [sp+34h] [bp-38h]@12 |
303 | 4381 //int v53; // [sp+38h] [bp-34h]@10 |
4382 //int v54; // [sp+3Ch] [bp-30h]@1 | |
4383 //int v55; // [sp+40h] [bp-2Ch]@12 | |
0 | 4384 signed int a4; // [sp+44h] [bp-28h]@1 |
4385 PlayerEquipment *v57; // [sp+48h] [bp-24h]@10 | |
303 | 4386 //int v58; // [sp+4Ch] [bp-20h]@10 |
0 | 4387 int v59; // [sp+50h] [bp-1Ch]@1 |
4388 unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1 | |
4389 int v61; // [sp+58h] [bp-14h]@1 | |
387 | 4390 bool v62; // [sp+5Ch] [bp-10h]@1 |
0 | 4391 int uDamageAmount; // [sp+60h] [bp-Ch]@1 |
4392 int a2; // [sp+64h] [bp-8h]@27 | |
4393 int a3; // [sp+6Bh] [bp-1h]@6 | |
4394 | |
303 | 4395 //v3 = a1; |
0 | 4396 v4 = 0; |
4397 uActorID_Monster_ = uActorID_Monster; | |
303 | 4398 //v54 = a1; |
0 | 4399 uDamageAmount = 0; |
4400 a4 = 0; | |
4401 v61 = 0; | |
4402 v59 = 0; | |
4403 v62 = 0; | |
848 | 4404 if ( PID_TYPE(a1) == OBJECT_Item) |
4405 { | |
4406 v4 = &pSpriteObjects[PID_ID(a1)]; | |
303 | 4407 //uDamageAmount = (int)v4; |
0 | 4408 v61 = v4->field_60_distance_related_prolly_lod; |
822 | 4409 a1 = v4->spell_caster_pid; |
303 | 4410 //v54 = v4->field_58_pid; |
4411 } | |
4412 //v5 = a1 & 7; | |
4413 //uPlayerID = a1 >> 3; | |
848 | 4414 if (PID_TYPE(a1) != OBJECT_Player) |
187 | 4415 return; |
303 | 4416 |
848 | 4417 assert(PID_ID(abs(a1)) < 4); |
4418 auto player = &pParty->pPlayers[PID_ID(a1)]; | |
0 | 4419 pMonster = &pActors[uActorID_Monster_]; |
303 | 4420 //uPlayerID = pMonster->IsAlive(); |
4421 if (pMonster->IsNotAlive()) | |
187 | 4422 return; |
303 | 4423 |
0 | 4424 BYTE1(pMonster->uAttributes) |= 0xC0u; |
4425 if ( pMonster->uAIState == Fleeing ) | |
4426 pMonster->uAttributes |= 0x20000u; | |
303 | 4427 //v57 = 0; |
4428 //v53 = 0; | |
4429 //v58 = 0; | |
4430 bool hit_will_stun = false, | |
4431 hit_will_paralyze = false; | |
0 | 4432 if ( !v4 ) |
4433 { | |
303 | 4434 //v51 = (unsigned __int64 *)player->pEquipment.uMainHand; |
4435 int main_hand_idx = player->pEquipment.uMainHand; | |
0 | 4436 v59 = 1; |
816 | 4437 if ( player->HasItemEquipped(EQUIP_MAIN_HAND) ) |
303 | 4438 { |
4439 auto main_hand_skill = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; | |
4440 //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; | |
4441 //v28 = SkillToMastery(player->pActiveSkills[v55]); | |
4442 auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]); | |
4443 //uDamageAmount = v28; | |
4444 switch (main_hand_skill) | |
4445 { | |
4446 case PLAYER_SKILL_STAFF: | |
4447 if (main_hand_mastery >= 3) | |
4448 { | |
4449 if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_STAFF) & 0x3F) // stun chance when mastery >= 3 | |
4450 hit_will_stun = true; | |
4451 } | |
4452 break; | |
4453 | |
4454 case PLAYER_SKILL_MACE: | |
4455 if (main_hand_mastery >= 3) | |
4456 { | |
4457 if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F) | |
4458 hit_will_stun = true; | |
4459 } | |
4460 if (main_hand_mastery >= 4) | |
4461 { | |
4462 if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F) | |
4463 hit_will_paralyze = true; | |
4464 } | |
4465 break; | |
0 | 4466 } |
4467 } | |
4468 v50 = pMonster->pMonsterInfo.uID; | |
4469 a2 = 4; | |
303 | 4470 //v27 = player->CalculateMeleeDamageTo(0, 0, v50); |
4471 uDamageAmount = player->CalculateMeleeDamageTo(0, 0, v50); | |
4472 //if ( !v57 ) | |
4473 goto LABEL_67; | |
4474 //goto LABEL_69; | |
4475 } | |
4476 | |
4477 | |
822 | 4478 v19 = v4->spell_id == SPELL_DARK_SOULDRINKER; |
0 | 4479 v61 = v4->field_60_distance_related_prolly_lod; |
4480 if ( !v19 ) | |
4481 { | |
921 | 4482 //v9 = (SpriteObject *)uDamageAmount; |
4483 v50 = pParty->vPosition.x - v4->vPosition.x; | |
303 | 4484 //v55 = abs(v50); |
921 | 4485 pMonsterName = (char *)(pParty->vPosition.y - v4->vPosition.y); |
303 | 4486 //v51 = (unsigned __int64 *)abs((int)pMonsterName); |
921 | 4487 pPlayerName = (char *)(pParty->vPosition.z - v4->vPosition.z); |
0 | 4488 v52 = abs((int)pPlayerName); |
303 | 4489 v61 = abs(v50); |
4490 v10 = abs(v50); | |
4491 v11 = (int)abs((int)pMonsterName); | |
0 | 4492 v12 = v52; |
303 | 4493 if ( v10 < v11) |
4494 { | |
4495 v10 = (int)v11; | |
4496 v11 = v10; | |
0 | 4497 } |
4498 if ( v10 < v52 ) | |
4499 { | |
4500 v13 = v10; | |
4501 v10 = v52; | |
4502 v12 = v13; | |
4503 } | |
4504 if ( v11 < (signed int)v12 ) | |
4505 { | |
4506 v14 = v12; | |
4507 v12 = v11; | |
4508 v11 = v14; | |
4509 } | |
303 | 4510 //uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; |
4511 v61 = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; | |
4512 if ( v61 >= 2560 ) | |
0 | 4513 { |
4514 if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) | |
187 | 4515 return; |
0 | 4516 v61 = 2; |
4517 } | |
4518 else | |
4519 { | |
4520 v61 = 1; | |
4521 } | |
921 | 4522 //v4 = (SpriteObject *)uDamageAmount; |
0 | 4523 } |
303 | 4524 |
822 | 4525 v15 = v4->spell_id; |
4526 if ( v15 == SPELL_LASER_PROJECTILE ) | |
0 | 4527 { |
303 | 4528 v16 = player->pActiveSkills[7]; |
0 | 4529 v61 = 1; |
4530 if ( (signed int)SkillToMastery(v16) >= 3 ) | |
303 | 4531 a4 = player->pActiveSkills[7] & 0x3F; |
0 | 4532 a2 = 4; |
303 | 4533 uDamageAmount = player->CalculateMeleeDamageTo(1, 1, 0); |
0 | 4534 goto LABEL_67; |
4535 } | |
822 | 4536 if ( v15 != SPELL_BOW_ARROW ) |
4537 { | |
4538 if ( v15 == SPELL_101 ) | |
0 | 4539 { |
4540 a2 = 0; | |
303 | 4541 v18 = player->CalculateRangedDamageTo(0); |
0 | 4542 v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; |
4543 v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; | |
4544 uDamageAmount = v18; | |
4545 if ( !v20 && (!(v20 | v19) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4546 uDamageAmount >>= 1; | |
4547 v59 = 1; | |
4548 goto LABEL_67; | |
4549 } | |
822 | 4550 if ( v15 == SPELL_EARTH_BLADES ) |
4551 { | |
4552 a4 = 5 * v4->spell_level; | |
303 | 4553 a2 = player->GetSpellSchool(0x27u); |
822 | 4554 v21 = v4->spell_level; |
0 | 4555 v50 = pMonster->sCurrentHP; |
822 | 4556 pMonsterName = (char *)v4->spell_skill; |
4557 v22 = _43AFE3_calc_spell_damage(39, v21, v4->spell_skill, v50); | |
0 | 4558 v23 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; |
4559 v24 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; | |
4560 uDamageAmount = v22; | |
4561 if ( !v24 && (!(v24 | v23) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4562 uDamageAmount >>= 1; | |
4563 v59 = 0; | |
4564 LABEL_67: | |
303 | 4565 if ( !stru_50C198.PlayerHitOrMiss(player, pMonster, v61, a4) ) |
4566 { | |
4567 //LABEL_68: | |
4568 player->PlaySound(SPEECH_52, 0); | |
187 | 4569 return; |
0 | 4570 } |
4571 goto LABEL_69; | |
4572 } | |
822 | 4573 if ( v15 == SPELL_EARTH_STUN ) |
0 | 4574 { |
4575 uDamageAmount = 0; | |
4576 a2 = 4; | |
303 | 4577 hit_will_stun = 1; |
0 | 4578 goto LABEL_67; |
4579 } | |
822 | 4580 a2 = player->GetSpellSchool(v4->spell_id); |
4581 v25 = v4->spell_level; | |
4582 v26 = v4->spell_id; | |
0 | 4583 v50 = pMonster->sCurrentHP; |
822 | 4584 pMonsterName = (char *)v4->spell_skill; |
303 | 4585 //v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); |
0 | 4586 v59 = 0; |
303 | 4587 //v57 = (PlayerEquipment *)1; |
4588 //LABEL_65: | |
822 | 4589 uDamageAmount = _43AFE3_calc_spell_damage(v26, v25, v4->spell_skill, v50); |
303 | 4590 //if ( !v57 ) |
4591 // goto LABEL_67; | |
4592 goto LABEL_69; | |
0 | 4593 } |
4594 v50 = pMonster->word_000086_some_monster_id; | |
4595 a2 = 4; | |
303 | 4596 v17 = player->CalculateRangedDamageTo(v50); |
0 | 4597 v19 = v4->stru_24.uItemID == 0; |
4598 uDamageAmount = v17; | |
303 | 4599 v57 = 0; |
377 | 4600 if ( !v19 && v4->stru_24.uSpecEnchantmentType == 3 ) |
0 | 4601 { |
4602 a2 = 0; | |
4603 v57 = (PlayerEquipment *)1; | |
4604 } | |
4605 if ( SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) >= 0 | |
4606 && (SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) > 0 || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4607 uDamageAmount >>= 1; | |
4608 v59 = 1; | |
303 | 4609 //LABEL_66: |
0 | 4610 if ( !v57 ) |
4611 goto LABEL_67; | |
4612 LABEL_69: | |
303 | 4613 if (player->Weak()) |
4614 uDamageAmount /= 1; | |
0 | 4615 if ( (signed __int64)pMonster->pActorBuffs[5].uExpireTime > 0 ) |
4616 uDamageAmount = 0; | |
4617 v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, uDamageAmount); | |
303 | 4618 if ( !v4 && player->IsUnarmed() && (signed __int64)player->pPlayerBuffs[6].uExpireTime > 0 ) |
4619 { | |
4620 v50 = player->pPlayerBuffs[6].uPower; | |
0 | 4621 v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, v50); |
4622 v61 += v29; | |
4623 } | |
4624 uDamageAmount = v61; | |
4625 if ( v59 ) | |
4626 { | |
4627 if ( v4 ) | |
4628 { | |
4629 a4 = v4->stru_24._439DF3_get_additional_damage(&a2, &v62); | |
4630 if ( v62 && pMonster->sCurrentHP > 0 ) | |
4631 { | |
303 | 4632 player->sHealth += v61 / 5; |
4633 if ( player->sHealth > player->GetMaxHealth() ) | |
4634 player->sHealth = player->GetMaxHealth(); | |
0 | 4635 v62 = 0; |
4636 } | |
4637 v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); | |
4638 uDamageAmount = v61 + v30; | |
4639 } | |
4640 else | |
4641 { | |
4642 v59 = 0; | |
303 | 4643 v57 = &player->pEquipment; |
0 | 4644 do |
4645 { | |
303 | 4646 if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) |
4647 { | |
898 | 4648 auto _s = (ItemGen *)&player->pInventoryItems[v57->uShield - 1]; |
0 | 4649 a4 = _s->_439DF3_get_additional_damage(&a2, &v62); |
4650 if ( v62 && pMonster->sCurrentHP > 0 ) | |
4651 { | |
303 | 4652 player->sHealth += v61 / 5; |
4653 if ( player->sHealth > player->GetMaxHealth() ) | |
4654 player->sHealth = player->GetMaxHealth(); | |
0 | 4655 v62 = 0; |
4656 } | |
4657 v31 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); | |
4658 uDamageAmount += v31; | |
4659 } | |
4660 ++v59; | |
4661 v57 = (PlayerEquipment *)((char *)v57 + 4); | |
4662 } | |
4663 while ( v59 <= 1 ); | |
4664 } | |
4665 } | |
4666 v32 = uDamageAmount; | |
4667 pMonster->sCurrentHP -= uDamageAmount; | |
303 | 4668 if ( !v32 && !hit_will_stun ) |
4669 { | |
4670 player->PlaySound(SPEECH_52, 0); | |
4671 return; | |
4672 } | |
0 | 4673 if ( pMonster->sCurrentHP > 0 ) |
4674 { | |
861 | 4675 Actor::Stun(uActorID_Monster_, a1, 0); |
322 | 4676 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); |
0 | 4677 if ( bShowDamage ) |
4678 { | |
4679 v50 = uDamageAmount; | |
4680 pMonsterName = (char *)pMonster; | |
303 | 4681 pPlayerName = player->pName; |
0 | 4682 if ( v4 ) |
4683 v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points" | |
4684 else | |
4685 v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage" | |
303 | 4686 sprintfex(pTmpBuf, v47, pPlayerName, pMonsterName, v50); |
0 | 4687 ShowStatusBarString(pTmpBuf, 2u); |
4688 } | |
4689 v41 = 0; | |
4690 } | |
4691 else | |
4692 { | |
4693 if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 ) | |
4694 { | |
4695 v33 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; | |
303 | 4696 //v55 = v33; |
0 | 4697 if ( pRenderer->pRenderD3D ) |
4698 { | |
573 | 4699 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) |
0 | 4700 { |
4701 v50 = 0; | |
4702 pMonsterName = 0; | |
4703 v34 = pMonster->vPosition.z; | |
303 | 4704 *(float *)&pPlayerName = (double)v33; |
4705 //v51 = (unsigned __int64 *)v34; | |
0 | 4706 *(float *)&v47 = 0.0; |
4707 v35 = pMonster->vPosition.y; | |
4708 *((float *)&v46 + 1) = 0.0; | |
4709 *(float *)&v46 = 1.0; | |
303 | 4710 v36 = (double)(signed int)pMonster->vPosition.z; |
4711 //v51 = (unsigned __int64 *)v35; | |
0 | 4712 v37 = v36; |
303 | 4713 //v51 = (unsigned __int64 *)pMonster->vPosition.x; |
0 | 4714 v38 = (double)v35; |
303 | 4715 v39 = (double)(signed int)pMonster->vPosition.x; |
0 | 4716 pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0); |
4717 } | |
4718 } | |
4719 } | |
4720 Actor::Die(uActorID_Monster_); | |
322 | 4721 Actor::ApplyFineForKillingPeasant(uActorID_Monster_); |
4722 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); | |
0 | 4723 if ( pMonster->pMonsterInfo.uExp ) |
792 | 4724 GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp); |
187 | 4725 v40 = SPEECH_51; |
0 | 4726 if ( rand() % 100 < 20 ) |
4727 v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1; | |
303 | 4728 player->PlaySound((PlayerSpeech)v40, 0); |
0 | 4729 v41 = 0; |
4730 if ( bShowDamage ) | |
4731 { | |
4732 v50 = (int)pMonster; | |
4733 pMonsterName = (char *)uDamageAmount; | |
303 | 4734 pPlayerName = player->pName; // "%s inflicts %lu points killing %s" |
809 | 4735 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster); |
0 | 4736 ShowStatusBarString(pTmpBuf, 2u); |
4737 } | |
4738 } | |
4739 if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41 | |
4740 && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41 | |
4741 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41) | |
4742 && uDamageAmount != v41 ) | |
1036 | 4743 player->ReceiveDamage(uDamageAmount, (DAMAGE_TYPE)a2); |
0 | 4744 v50 = 24; |
4745 v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; | |
303 | 4746 if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41) |
0 | 4747 && stru_50C198.GetMagicalResistance(pMonster, 3u) ) |
4748 { | |
4749 LODWORD(v42) = 20; | |
4750 v59 = 10; | |
4751 if ( pParty->bTurnBasedModeOn == v41 ) | |
4752 v42 = (signed __int64)(flt_6BE3A8_debug_recmod2 * 42.66666666666666); | |
4753 pMonster->pMonsterInfo.uRecoveryTime += v42; | |
4754 if ( bShowDamage != v41 ) | |
4755 { | |
4756 v50 = (int)pMonster; | |
303 | 4757 pMonsterName = player->pName; // "%s stuns %s" |
4758 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[635], player->pName, pMonster); | |
0 | 4759 ShowStatusBarString(pTmpBuf, 2u); |
4760 } | |
4761 } | |
303 | 4762 if ( hit_will_paralyze != v41 ) |
0 | 4763 { |
4764 if ( pMonster->CanAct() ) | |
4765 { | |
303 | 4766 if ( stru_50C198.GetMagicalResistance(pMonster, 3) ) |
4767 { | |
4768 LOBYTE(v43) = player->GetActualSkillLevel(PLAYER_SKILL_MACE); | |
0 | 4769 v44 = v43; |
4770 v45 = SkillToMastery(v43); | |
303 | 4771 //v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F)); |
4772 v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(7680 * (v44 & 0x3F)) * 0.033333335); | |
0 | 4773 pMonster->pActorBuffs[6].Apply(v46, v45, 0, 0, 0); |
4774 if ( bShowDamage ) | |
4775 { | |
4776 v50 = (int)pMonster; | |
303 | 4777 pMonsterName = player->pName; // "%s paralyzes %s" |
4778 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[636], player->pName, pMonster); | |
0 | 4779 ShowStatusBarString(pTmpBuf, 2u); |
4780 } | |
4781 } | |
4782 } | |
4783 } | |
4784 if ( v59 > 10 ) | |
4785 v59 = 10; | |
4786 if ( !MonsterStats::BelongsToSupertype(pMonster->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
4787 { | |
4788 pVelocity->x = (unsigned __int64)(v59 * (signed __int64)pVelocity->x) >> 16; | |
4789 pVelocity->y = (unsigned __int64)(v59 * (signed __int64)pVelocity->y) >> 16; | |
4790 pVelocity->z = (unsigned __int64)(v59 * (signed __int64)pVelocity->z) >> 16; | |
4791 pMonster->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
4792 pMonster->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
4793 pMonster->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
4794 } | |
187 | 4795 Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster_, 1, v61); |
0 | 4796 } |
4797 // 4D864C: using guessed type char byte_4D864C; | |
4798 | |
4799 //----- (00439FCB) -------------------------------------------------------- | |
4800 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) | |
4801 { | |
4802 signed int v4; // esi@1 | |
4803 unsigned int v5; // ecx@1 | |
4804 Player *v6; // ebx@3 | |
4805 Actor *v7; // esi@3 | |
4806 unsigned int v8; // eax@4 | |
4807 char *v9; // eax@5 | |
4808 signed int v10; // eax@6 | |
4809 int v11; // edx@8 | |
4810 int v12; // edx@9 | |
4811 int v13; // edx@10 | |
4812 int v14; // edx@16 | |
4813 int v15; // edx@17 | |
4814 int v16; // edx@18 | |
4815 enum SoundID v17; // eax@24 | |
4816 int v18; // eax@26 | |
4817 unsigned __int8 v19; // zf@26 | |
4818 unsigned __int8 v20; // sf@26 | |
4819 unsigned __int16 v21; // ax@29 | |
4820 signed int v22; // edi@36 | |
4821 int v23; // eax@38 | |
4822 signed int v24; // eax@44 | |
4823 unsigned __int16 v25; // cx@47 | |
4824 signed int v26; // eax@49 | |
4825 int v27; // eax@54 | |
4826 float v28; // ST18_4@58 | |
4827 double v29; // st7@58 | |
4828 float v30; // ST08_4@58 | |
4829 double v31; // st7@58 | |
4830 float v32; // ST04_4@58 | |
4831 float v33; // ST00_4@58 | |
4832 int v34; // edi@61 | |
4833 int v35; // eax@70 | |
4834 double v36; // st7@70 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4835 SpriteObject *v37; // ebx@77 |
0 | 4836 int v38; // edi@77 |
4837 int v39; // esi@77 | |
4838 int v40; // eax@77 | |
4839 int v41; // eax@77 | |
4840 int v42; // eax@78 | |
42 | 4841 Player *v43; // eax@81 |
0 | 4842 Actor *v44; // esi@82 |
42 | 4843 Player *v45; // edi@84 |
0 | 4844 unsigned __int16 v46; // ax@84 |
4845 int v47; // ebx@105 | |
4846 int v48; // eax@107 | |
4847 unsigned __int16 v49; // ax@116 | |
4848 int v50; // ebx@123 | |
4849 unsigned __int16 v51; // ax@124 | |
4850 char v52; // bl@124 | |
4851 int v53; // eax@128 | |
4852 signed int v54; // eax@134 | |
4853 unsigned __int16 v55; // cx@137 | |
4854 signed int v56; // eax@139 | |
4855 int v57; // eax@144 | |
4856 float v58; // ST18_4@148 | |
4857 double v59; // st7@148 | |
4858 float v60; // ST08_4@148 | |
4859 double v61; // st7@148 | |
4860 float v62; // ST04_4@148 | |
4861 float v63; // ST00_4@148 | |
4862 int v64; // ebx@151 | |
4863 int v65; // eax@161 | |
4864 double v66; // st7@161 | |
4865 signed int v67; // ecx@164 | |
4866 signed int v68; // eax@170 | |
4867 int v69; // ecx@170 | |
4868 int v70; // eax@171 | |
4869 enum SoundID v71; // [sp+20h] [bp-34h]@12 | |
4870 int v72; // [sp+30h] [bp-24h]@164 | |
4871 double v73; // [sp+40h] [bp-14h]@72 | |
4872 signed int v74; // [sp+44h] [bp-10h]@1 | |
4873 unsigned int v75; // [sp+48h] [bp-Ch]@3 | |
4874 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 | |
4875 int v77; // [sp+50h] [bp-4h]@26 | |
4876 signed int a4a; // [sp+60h] [bp+Ch]@162 | |
4877 Player *a4b; // [sp+60h] [bp+Ch]@168 | |
4878 | |
848 | 4879 v4 = PID_ID(uObjID); |
4880 v5 = PID_TYPE(uObjID) - 2; | |
0 | 4881 v74 = a2; |
4882 uActorID = v4; | |
4883 if ( v5 ) | |
4884 { | |
4885 if ( v5 != 1 | |
4886 || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], | |
4887 v75 = v6->sHealth, | |
4888 !stru_50C198.ActorHitOrMiss(v7, v6)) ) | |
4889 return; | |
898 | 4890 v8 = v6->pEquipment.uArmor; |
0 | 4891 if ( !v8 |
4892 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) | |
4893 || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) | |
4894 || v10 > 11 ) | |
4895 { | |
4896 v14 = rand() % 4; | |
4897 if ( !v14 ) | |
4898 { | |
4899 v71 = (SoundID)108; | |
4900 goto LABEL_24; | |
4901 } | |
4902 v15 = v14 - 1; | |
4903 if ( !v15 ) | |
4904 { | |
4905 v71 = (SoundID)109; | |
4906 goto LABEL_24; | |
4907 } | |
4908 v16 = v15 - 1; | |
4909 if ( !v16 ) | |
4910 { | |
4911 v71 = (SoundID)110; | |
4912 goto LABEL_24; | |
4913 } | |
4914 if ( v16 == 1 ) | |
4915 { | |
4916 v71 = (SoundID)44; | |
4917 goto LABEL_24; | |
4918 } | |
4919 } | |
4920 else | |
4921 { | |
4922 v11 = rand() % 4; | |
4923 if ( !v11 ) | |
4924 { | |
4925 v71 = (SoundID)105; | |
4926 goto LABEL_24; | |
4927 } | |
4928 v12 = v11 - 1; | |
4929 if ( !v12 ) | |
4930 { | |
4931 v71 = (SoundID)106; | |
4932 goto LABEL_24; | |
4933 } | |
4934 v13 = v12 - 1; | |
4935 if ( !v13 ) | |
4936 { | |
4937 v71 = (SoundID)107; | |
4938 goto LABEL_24; | |
4939 } | |
4940 if ( v13 == 1 ) | |
4941 { | |
4942 v71 = (SoundID)45; | |
4943 LABEL_24: | |
4944 v17 = v71; | |
4945 goto LABEL_26; | |
4946 } | |
4947 } | |
4948 v17 = (SoundID)a4; | |
4949 LABEL_26: | |
862 | 4950 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); |
0 | 4951 v18 = Actor::_43B3E0_CalcDamage(v7, v74); |
4952 v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; | |
4953 v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; | |
4954 v77 = v18; | |
4955 if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) | |
4956 { | |
4957 v21 = v7->pActorBuffs[3].uPower; | |
4958 if ( v21 ) | |
4959 v77 /= (signed int)v21; | |
4960 } | |
4961 if ( v74 ) | |
4962 { | |
4963 if ( v74 == 1 ) | |
4964 { | |
4965 v22 = v7->pMonsterInfo.uAttack2Type; | |
4966 } | |
4967 else | |
4968 { | |
4969 if ( v74 == 2 ) | |
4970 { | |
4971 v23 = v7->pMonsterInfo.uSpell1ID; | |
4972 } | |
4973 else | |
4974 { | |
4975 if ( v74 != 3 ) | |
4976 { | |
4977 if ( v74 == 4 ) | |
4978 v22 = v7->pMonsterInfo.field_3C_some_special_attack; | |
4979 else | |
4980 v22 = 4; | |
4981 goto LABEL_43; | |
4982 } | |
4983 v23 = v7->pMonsterInfo.uSpell2ID; | |
4984 } | |
4985 v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); | |
4986 } | |
4987 } | |
4988 else | |
4989 { | |
4990 v22 = v7->pMonsterInfo.uAttack1Type; | |
4991 } | |
4992 LABEL_43: | |
4993 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
4994 { | |
1036 | 4995 v24 = v6->ReceiveDamage(v77, (DAMAGE_TYPE)v22); |
0 | 4996 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 |
4997 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) | |
4998 { | |
4999 v25 = v7->uAIState; | |
5000 if ( v25 != 5 ) | |
5001 { | |
5002 if ( v25 != 4 ) | |
5003 { | |
5004 v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); | |
5005 v7->sCurrentHP -= v26; | |
5006 if ( v26 ) | |
5007 { | |
5008 if ( v7->sCurrentHP >= 1 ) | |
5009 { | |
862 | 5010 Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); |
322 | 5011 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 5012 } |
5013 else | |
5014 { | |
5015 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) | |
5016 { | |
5017 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; | |
5018 v74 = v27; | |
5019 if ( pRenderer->pRenderD3D ) | |
5020 { | |
573 | 5021 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) |
0 | 5022 { |
5023 v28 = (double)v74; | |
5024 v74 = v7->vPosition.z; | |
5025 v29 = (double)v74; | |
5026 v74 = v7->vPosition.y; | |
5027 v30 = v29; | |
5028 v31 = (double)v74; | |
5029 v74 = v7->vPosition.x; | |
5030 v32 = v31; | |
5031 v33 = (double)v74; | |
5032 pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0); | |
5033 } | |
5034 } | |
5035 } | |
5036 Actor::Die(uActorID); | |
322 | 5037 Actor::ApplyFineForKillingPeasant(uActorID); |
5038 Actor::AggroSurroundingPeasants(uActorID, 1); | |
0 | 5039 if ( v7->pMonsterInfo.uExp ) |
792 | 5040 GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); |
187 | 5041 v34 = SPEECH_51; |
0 | 5042 if ( rand() % 100 < 20 ) |
5043 v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; | |
187 | 5044 v6->PlaySound((PlayerSpeech)v34, 0); |
0 | 5045 } |
5046 } | |
5047 } | |
5048 } | |
5049 } | |
5050 if ( !(dword_6BE368_debug_settings_2 & 0x10) | |
5051 && v7->pMonsterInfo.uSpecialAttack | |
5052 && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) | |
5053 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); | |
5054 } | |
5055 if ( !pParty->bTurnBasedModeOn ) | |
5056 { | |
5057 v35 = v6->GetActualEndurance(); | |
1036 | 5058 v36 = (double)(20 - v6->GetParameterBonus(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; |
0 | 5059 v6->SetRecoveryTime((signed __int64)v36); |
5060 } | |
5061 if ( v77 ) | |
5062 { | |
5063 v73 = (double)(signed int)v75; | |
5064 if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) | |
5065 { | |
5066 if ( v6->sHealth > 0 ) | |
5067 { | |
5068 if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) | |
187 | 5069 v6->PlaySound(SPEECH_48, 0); |
0 | 5070 } |
5071 } | |
5072 } | |
5073 viewparams->bRedrawGameUI = 1; | |
5074 return; | |
5075 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5076 v37 = &pSpriteObjects[uActorID]; |
848 | 5077 v38 = PID_TYPE(v37->spell_caster_pid); |
5078 v39 = PID_ID(v37->spell_caster_pid); | |
5079 v40 = PID_TYPE(v37->spell_caster_pid); | |
5080 uActorID = PID_ID(v37->spell_caster_pid); | |
0 | 5081 v41 = v40 - 2; |
5082 if ( !v41 ) | |
5083 goto LABEL_80; | |
5084 v42 = v41 - 1; | |
5085 if ( !v42 ) | |
5086 { | |
5087 v44 = &pActors[v39]; | |
5088 if ( a4 == -1 ) | |
5089 a4 = stru_50C198.which_player_would_attack(v44); | |
42 | 5090 v45 = &pParty->pPlayers[a4]; |
0 | 5091 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
|
5092 v46 = v37->uType; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5093 if ( v37->uType == 545 ) |
0 | 5094 { |
42 | 5095 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); |
0 | 5096 v52 = v51; |
5097 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) ) | |
5098 { | |
42 | 5099 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[637], v45->pName); |
0 | 5100 ShowStatusBarString(pTmpBuf, 2u); |
187 | 5101 v45->PlaySound(SPEECH_6, 0); |
0 | 5102 return; |
5103 } | |
5104 } | |
5105 else | |
5106 { | |
5107 if ( v46 != 555 | |
5108 && v46 != 510 | |
5109 && v46 != 500 | |
5110 && v46 != 515 | |
5111 && v46 != 505 | |
5112 && v46 != 530 | |
5113 && v46 != 525 | |
5114 && v46 != 520 | |
5115 && v46 != 535 | |
5116 && v46 != 540 ) | |
5117 goto LABEL_115; | |
5118 } | |
42 | 5119 if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) |
0 | 5120 return; |
42 | 5121 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) |
0 | 5122 v77 >>= 1; |
42 | 5123 if ( v45->HasEnchantedItemEquipped(36) ) |
0 | 5124 v77 >>= 1; |
42 | 5125 if ( v45->HasEnchantedItemEquipped(69) ) |
0 | 5126 v77 >>= 1; |
42 | 5127 if ( v45->HasItemEquipped(EQUIP_ARMOUR) |
898 | 5128 && *(_DWORD *)&v45->pInventoryItems[v45->pEquipment.uArmor-1] == 504 ) |
0 | 5129 v77 >>= 1; |
5130 v75 = 0; | |
42 | 5131 v47 = (int)&v45->pEquipment; |
0 | 5132 do |
5133 { | |
42 | 5134 if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) ) |
0 | 5135 { |
5136 v48 = *(int *)&v45[36 * *(int *)v47 + 496]; | |
5137 if ( v48 == 520 ) | |
5138 v77 >>= 1; | |
5139 if ( v48 == 531 ) | |
5140 v77 >>= 1; | |
816 | 5141 if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 ) |
0 | 5142 v77 >>= 1; |
5143 } | |
5144 ++v75; | |
5145 v47 += 4; | |
5146 } | |
5147 while ( (signed int)v75 <= 1 ); | |
5148 LABEL_115: | |
5149 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) | |
5150 { | |
5151 v49 = v44->pActorBuffs[3].uPower; | |
5152 if ( v49 ) | |
5153 v77 /= (signed int)v49; | |
5154 } | |
5155 if ( !v74 ) | |
5156 { | |
5157 v50 = v44->pMonsterInfo.uAttack1Type; | |
5158 goto LABEL_133; | |
5159 } | |
5160 if ( v74 == 1 ) | |
5161 { | |
5162 v50 = v44->pMonsterInfo.uAttack2Type; | |
5163 goto LABEL_133; | |
5164 } | |
5165 if ( v74 == 2 ) | |
5166 { | |
5167 v53 = v44->pMonsterInfo.uSpell1ID; | |
5168 } | |
5169 else | |
5170 { | |
5171 if ( v74 != 3 ) | |
5172 { | |
5173 if ( v74 == 4 ) | |
5174 v50 = v44->pMonsterInfo.field_3C_some_special_attack; | |
5175 else | |
5176 v50 = 4; | |
5177 LABEL_133: | |
5178 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
5179 { | |
1036 | 5180 v54 = v45->ReceiveDamage(v77, (DAMAGE_TYPE)v50); |
42 | 5181 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) |
5182 { | |
5183 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) | |
0 | 5184 { |
5185 v55 = v44->uAIState; | |
5186 if ( v55 != 5 ) | |
5187 { | |
5188 if ( v55 != 4 ) | |
5189 { | |
5190 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); | |
5191 v44->sCurrentHP -= v56; | |
5192 if ( v56 ) | |
5193 { | |
5194 if ( v44->sCurrentHP >= 1 ) | |
5195 { | |
862 | 5196 Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); |
322 | 5197 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 5198 } |
5199 else | |
5200 { | |
5201 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) | |
5202 { | |
5203 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius; | |
5204 v75 = v57; | |
5205 if ( pRenderer->pRenderD3D ) | |
5206 { | |
573 | 5207 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) |
0 | 5208 { |
5209 v58 = (double)(signed int)v75; | |
5210 v75 = v44->vPosition.z; | |
5211 v59 = (double)(signed int)v75; | |
5212 v75 = v44->vPosition.y; | |
5213 v60 = v59; | |
5214 v61 = (double)(signed int)v75; | |
5215 v75 = v44->vPosition.x; | |
5216 v62 = v61; | |
5217 v63 = (double)(signed int)v75; | |
5218 pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0); | |
5219 } | |
5220 } | |
5221 } | |
5222 Actor::Die(uActorID); | |
322 | 5223 Actor::ApplyFineForKillingPeasant(uActorID); |
5224 Actor::AggroSurroundingPeasants(uActorID, 1); | |
0 | 5225 if ( v44->pMonsterInfo.uExp ) |
792 | 5226 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); |
187 | 5227 v64 = SPEECH_51; |
0 | 5228 if ( rand() % 100 < 20 ) |
5229 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; | |
187 | 5230 v45->PlaySound((PlayerSpeech)v64, 0); |
0 | 5231 } |
5232 } | |
5233 } | |
5234 } | |
5235 } | |
5236 } | |
5237 } | |
5238 if ( !v74 | |
5239 && !(dword_6BE368_debug_settings_2 & 0x10) | |
5240 && v44->pMonsterInfo.uSpecialAttack | |
5241 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) | |
42 | 5242 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); |
0 | 5243 if ( !pParty->bTurnBasedModeOn ) |
5244 { | |
42 | 5245 v65 = v45->GetActualEndurance(); |
1036 | 5246 v66 = (double)(20 - v45->GetParameterBonus(v65)) |
0 | 5247 * flt_6BE3A4_debug_recmod1 |
5248 * 2.133333333333333; | |
42 | 5249 v45->SetRecoveryTime((signed __int64)v66); |
0 | 5250 } |
5251 return; | |
5252 } | |
5253 v53 = v44->pMonsterInfo.uSpell2ID; | |
5254 } | |
5255 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); | |
5256 goto LABEL_133; | |
5257 } | |
5258 if ( v42 != 1 ) | |
5259 return; | |
5260 LABEL_80: | |
5261 if ( a4 != -1 ) | |
5262 { | |
42 | 5263 v43 = &pParty->pPlayers[a4]; |
0 | 5264 LABEL_168: |
42 | 5265 a4b = v43; |
822 | 5266 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) |
0 | 5267 { |
42 | 5268 v70 = v43->GetMaxHealth(); |
822 | 5269 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); |
5270 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); | |
0 | 5271 } |
5272 else | |
5273 { | |
5274 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); | |
5275 v69 = 0; | |
5276 } | |
1036 | 5277 a4b->ReceiveDamage(v68, (DAMAGE_TYPE)v69); |
303 | 5278 if ( v38 == OBJECT_Player && !qword_A750D8 ) |
0 | 5279 { |
5280 qword_A750D8 = 256i64; | |
5281 word_A750E0 = 44; | |
5282 word_A750E2 = uActorID + 1; | |
5283 } | |
5284 return; | |
5285 } | |
5286 v74 = 0; | |
5287 a4a = 1; | |
5288 do | |
5289 { | |
5290 if ( pPlayers[a4a]->CanAct() ) | |
5291 { | |
5292 v67 = v74++; | |
5293 *(&v72 + v67) = a4a; | |
5294 } | |
5295 ++a4a; | |
5296 } | |
5297 while ( a4a <= 4 ); | |
5298 if ( v74 ) | |
5299 { | |
42 | 5300 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; |
0 | 5301 goto LABEL_168; |
5302 } | |
5303 } | |
5304 | |
5305 //----- (0043A97E) -------------------------------------------------------- | |
5306 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) | |
5307 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5308 if ( PID_TYPE(a2) == OBJECT_BLVDoor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5309 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5310 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5311 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5312 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5313 |
0 | 5314 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
|
5315 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
|
5316 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5317 else if (PID_TYPE(a2) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5318 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5319 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5320 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5321 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5322 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5323 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
|
5324 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid)) |
0 | 5325 { |
5326 case OBJECT_Actor: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5327 sub_43B1B0(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61); |
0 | 5328 break; |
5329 case OBJECT_Player: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5330 DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 5331 break; |
5332 case OBJECT_Item: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5333 sub_43B057(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 5334 break; |
5335 } | |
5336 } | |
5337 } | |
5338 | |
5339 //----- (0043AA99) -------------------------------------------------------- | |
5340 void __fastcall Vec3_int_::Rotate(int sDepth, int sRotY, int sRotX, Vec3_int_ v, int *outx, int *outy, int *outz) | |
5341 { | |
147 | 5342 float cosf_x = cosf(3.14159265f * sRotX / 1024.0f), |
1025 | 5343 sinf_x = sinf(3.14159265f * sRotX / 1024.0f), |
147 | 5344 cosf_y = cosf(3.14159265f * sRotY / 1024.0f), |
5345 sinf_y = sinf(3.14159265f * sRotY / 1024.0f); | |
1045 | 5346 |
1025 | 5347 *outx = v.x + ((unsigned __int64)(sinf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16))); |
5348 *outy = v.y + ((unsigned __int64)(cosf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16))); | |
5349 *outz = v.z + ((unsigned __int64)(sinf_x * (signed __int64)sDepth) >> 16); | |
0 | 5350 } |
5351 | |
5352 //----- (0043AB61) -------------------------------------------------------- | |
5353 void Vec3_int_::Normalize(int *x, int *y, int *z) | |
5354 { | |
1025 | 5355 *x *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); |
5356 *y *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); | |
5357 *z *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); | |
0 | 5358 } |
5359 | |
5360 //----- (0043AE12) -------------------------------------------------------- | |
5361 double __fastcall sub_43AE12(signed int a1) | |
5362 { | |
5363 signed int v1; // ST00_4@1 | |
5364 signed int v2; // ecx@1 | |
5365 double v3; // st7@1 | |
5366 double result; // st7@6 | |
5367 | |
5368 v1 = a1; | |
5369 v2 = 0; | |
5370 v3 = (double)v1; | |
5371 do | |
5372 { | |
5373 if ( v3 < flt_4E4A80[v2 + 5] ) | |
5374 break; | |
5375 ++v2; | |
5376 } | |
5377 while ( v2 < 5 ); | |
5378 if ( v2 <= 0 || v2 >= 5 ) | |
5379 { | |
5380 if ( v2 ) | |
5381 result = flt_4E4A80[4]; | |
5382 else | |
5383 result = flt_4E4A80[0]; | |
5384 } | |
5385 else | |
5386 { | |
1033 | 5387 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 | 5388 } |
5389 return result; | |
5390 } | |
5391 | |
5392 //----- (0043AFE3) -------------------------------------------------------- | |
5393 int __fastcall _43AFE3_calc_spell_damage(int a1, int a2, signed int a3, int a4) | |
5394 { | |
5395 int result; // eax@1 | |
5396 unsigned int v5; // [sp-4h] [bp-8h]@9 | |
5397 | |
5398 result = 0; | |
5399 if ( a1 == 7 ) | |
5400 { | |
5401 if ( a3 <= 0 ) | |
5402 return result; | |
5403 if ( a3 <= 2 ) | |
5404 { | |
5405 v5 = 6; | |
5406 } | |
5407 else | |
5408 { | |
5409 if ( a3 == 3 ) | |
5410 { | |
5411 v5 = 8; | |
5412 } | |
5413 else | |
5414 { | |
5415 if ( a3 != 4 ) | |
5416 return result; | |
5417 v5 = 10; | |
5418 } | |
5419 } | |
5420 result = GetDiceResult(a2, v5); | |
5421 } | |
5422 else | |
5423 { | |
5424 if ( a1 == 44 ) | |
5425 result = a4 * (LOBYTE(pSpellDatas[40].field_10) + 2 * a2) / 100; | |
5426 else | |
5427 result = *((char *)&pSpellDatas[0].field_10 + 20 * a1) | |
5428 + GetDiceResult(a2, *((char *)&pSpellDatas[0].field_10 + 20 * a1 + 1)); | |
5429 } | |
5430 return result; | |
5431 } | |
5432 | |
5433 //----- (0043B057) -------------------------------------------------------- | |
5434 void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, Vec3_int_ *pVelocity) | |
5435 { | |
5436 Actor *pActor; // esi@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5437 SpriteObject *v4; // eax@3 |
0 | 5438 int v5; // ecx@3 |
5439 int v6; // eax@4 | |
5440 int v7; // edi@4 | |
5441 unsigned int uActorIDa; // [sp+8h] [bp-8h]@1 | |
5442 unsigned int a2; // [sp+Ch] [bp-4h]@1 | |
5443 int a2a; // [sp+Ch] [bp-4h]@8 | |
5444 | |
5445 uActorIDa = uActorID; | |
5446 pActor = &pActors[uActorID]; | |
5447 a2 = uObjID; | |
303 | 5448 if ( !pActors[uActorID].IsNotAlive() ) |
0 | 5449 { |
848 | 5450 if ( PID_TYPE(a2) == OBJECT_Item) |
5451 { | |
5452 v4 = &pSpriteObjects[PID_ID(a2)]; | |
822 | 5453 v5 = v4->spell_id; |
0 | 5454 if ( v5 ) |
5455 { | |
822 | 5456 v6 = _43AFE3_calc_spell_damage(v5, v4->spell_level, v4->spell_skill, pActor->sCurrentHP); |
0 | 5457 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6); |
5458 pActor->sCurrentHP -= v7; | |
5459 if ( v7 ) | |
5460 { | |
5461 if ( pActor->sCurrentHP > 0 ) | |
861 | 5462 Actor::Stun(uActorIDa, a2, 0); |
0 | 5463 else |
5464 Actor::Die(uActorIDa); | |
5465 a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP; | |
5466 if ( 20 * v7 / (signed int)pActor->pMonsterInfo.uHP > 10 ) | |
5467 a2a = 10; | |
5468 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
5469 { | |
5470 pVelocity->x = (unsigned __int64)(a2a * (signed __int64)pVelocity->x) >> 16; | |
5471 pVelocity->y = (unsigned __int64)(a2a * (signed __int64)pVelocity->y) >> 16; | |
5472 pVelocity->z = (unsigned __int64)(a2a * (signed __int64)pVelocity->z) >> 16; | |
5473 pActor->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
5474 pActor->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
5475 pActor->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
5476 } | |
5477 Actor::AddBloodsplatOnDamageOverlay(uActorIDa, 1, v7); | |
5478 } | |
5479 else | |
5480 { | |
861 | 5481 Actor::Stun(uActorIDa, a2, 0); |
0 | 5482 } |
5483 } | |
5484 } | |
5485 } | |
5486 } | |
5487 | |
5488 //----- (0043B1B0) -------------------------------------------------------- | |
322 | 5489 void sub_43B1B0(signed int a1, unsigned int a2, Vec3_int_ *pVelocity, signed int a4) |
0 | 5490 { |
5491 int v4; // ebx@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5492 SpriteObject *v5; // eax@2 |
0 | 5493 bool v6; // eax@3 |
5494 Actor *v7; // esi@4 | |
5495 Actor *v8; // edi@4 | |
5496 char v9; // zf@5 | |
5497 __int64 v10; // qax@8 | |
5498 signed __int16 v11; // cx@9 | |
5499 signed int v12; // ecx@20 | |
5500 int v13; // ecx@22 | |
5501 int v14; // edi@30 | |
5502 unsigned int uActorID; // [sp+Ch] [bp-8h]@1 | |
5503 signed int v17; // [sp+10h] [bp-4h]@1 | |
5504 int v18; // [sp+20h] [bp+Ch]@34 | |
5505 | |
5506 v4 = 0; | |
5507 uActorID = a2; | |
5508 v17 = a1; | |
848 | 5509 if ( PID_TYPE(a1) == OBJECT_Item) |
5510 { | |
5511 v5 = &pSpriteObjects[PID_ID(a1)]; | |
0 | 5512 v4 = v5->field_60_distance_related_prolly_lod; |
822 | 5513 v17 = v5->spell_caster_pid; |
0 | 5514 } |
848 | 5515 LOWORD(v6) = PID_TYPE(v17); |
303 | 5516 if ( v6 == OBJECT_Actor) |
0 | 5517 { |
5518 v7 = &pActors[a2]; | |
848 | 5519 v8 = &pActors[PID_ID(v17)]; |
303 | 5520 v6 = pActors[a2].IsNotAlive(); |
0 | 5521 if ( !v6 ) |
5522 { | |
5523 v9 = v7->uAIState == 7; | |
5524 v7->uLastCharacterIDToHit = v17; | |
5525 if ( v9 ) | |
5526 BYTE2(v7->uAttributes) |= 2u; | |
5527 v6 = stru_50C198._4273BB(v8, v7, v4, 0); | |
5528 if ( v6 ) | |
5529 { | |
5530 v10 = (unsigned int)Actor::_43B3E0_CalcDamage(v8, a4); | |
5531 if ( (signed __int64)v8->pActorBuffs[3].uExpireTime > 0 ) | |
5532 { | |
5533 v11 = v8->pActorBuffs[3].uPower; | |
5534 if ( v11 ) | |
5535 v10 = (signed int)v10 / (unsigned __int16)v11; | |
5536 } | |
5537 if ( SHIDWORD(v7->pActorBuffs[5].uExpireTime) >= SHIDWORD(v10) | |
5538 && (SHIDWORD(v7->pActorBuffs[5].uExpireTime) > SHIDWORD(v10) | |
5539 || LODWORD(v7->pActorBuffs[5].uExpireTime) > HIDWORD(v10)) ) | |
5540 LODWORD(v10) = 0; | |
5541 if ( a4 != HIDWORD(v10) ) | |
5542 { | |
5543 if ( a4 - HIDWORD(v10) == 1 ) | |
5544 { | |
5545 v12 = v8->pMonsterInfo.uAttack2Type; | |
5546 if ( SHIDWORD(v7->pActorBuffs[15].uExpireTime) >= SHIDWORD(v10) | |
5547 && (SHIDWORD(v7->pActorBuffs[15].uExpireTime) > SHIDWORD(v10) | |
5548 || LODWORD(v7->pActorBuffs[15].uExpireTime) > HIDWORD(v10)) ) | |
5549 LODWORD(v10) = (signed int)v10 >> 1; | |
5550 goto LABEL_30; | |
5551 } | |
5552 if ( a4 - HIDWORD(v10) == 2 ) | |
5553 { | |
5554 v13 = v7->pMonsterInfo.uSpell1ID; | |
5555 } | |
5556 else | |
5557 { | |
5558 if ( a4 - HIDWORD(v10) != 3 ) | |
5559 { | |
5560 if ( a4 - HIDWORD(v10) == 4 ) | |
5561 v12 = v8->pMonsterInfo.field_3C_some_special_attack; | |
5562 else | |
5563 v12 = 4; | |
5564 LABEL_30: | |
5565 v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10); | |
5566 v7->sCurrentHP -= v14; | |
5567 if ( v14 ) | |
5568 { | |
5569 if ( v7->sCurrentHP > 0 ) | |
861 | 5570 Actor::Stun(uActorID, v17, 0); |
0 | 5571 else |
5572 Actor::Die(uActorID); | |
322 | 5573 Actor::AggroSurroundingPeasants(uActorID, 0); |
0 | 5574 v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP; |
5575 if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) | |
5576 v18 = 10; | |
5577 if ( !MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
5578 { | |
5579 pVelocity->x = (unsigned __int64)(v18 * (signed __int64)pVelocity->x) >> 16; | |
5580 pVelocity->y = (unsigned __int64)(v18 * (signed __int64)pVelocity->y) >> 16; | |
5581 pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; | |
5582 v7->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
5583 v7->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
5584 v7->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
5585 } | |
322 | 5586 Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v14); |
0 | 5587 } |
5588 else | |
5589 { | |
861 | 5590 Actor::Stun(uActorID, v17, 0); |
0 | 5591 } |
322 | 5592 return; |
0 | 5593 } |
5594 v13 = v7->pMonsterInfo.uSpell2ID; | |
5595 } | |
5596 v12 = LOBYTE(pSpellStats->pInfos[v13].uSchool); | |
5597 goto LABEL_30; | |
5598 } | |
5599 v12 = v8->pMonsterInfo.uAttack1Type; | |
5600 goto LABEL_30; | |
5601 } | |
5602 } | |
5603 } | |
5604 } | |
5605 | |
5606 //----- (0043C91D) -------------------------------------------------------- | |
899 | 5607 int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder) |
0 | 5608 { |
5609 int result; // eax@2 | |
5610 char v5; // zf@3 | |
5611 const char *v6; // [sp-Ch] [bp-18h]@88 | |
5612 signed int v7; // [sp-8h] [bp-14h]@61 | |
5613 int v8; // [sp-4h] [bp-10h]@61 | |
5614 signed int v9; // [sp-4h] [bp-10h]@69 | |
5615 | |
5616 result = 0; //BUG fn is void | |
899 | 5617 if ( item_id <= 500 ) |
0 | 5618 { |
5619 //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0; | |
899 | 5620 v5 = party_has_equipment[(item_id - 100) + 32 + 2] == 0; |
5621 switch ( item_id ) | |
5622 { | |
5623 case 516: | |
5624 v5 = byte_5111F6[2] == 0; | |
5625 break; | |
5626 case 505: | |
5627 v5 = byte_5111F6[1] == 0; | |
5628 break; | |
5629 case 504: | |
5630 v5 = byte_5111F6[0] == 0; | |
5631 break; | |
5632 case 533: | |
5633 v5 = byte_5111F6[16] == 0; | |
5634 break; | |
5635 case 512: | |
5636 v5 = byte_5111F6[3] == 0; | |
5637 break; | |
5638 case 521: | |
5639 v5 = byte_5111F6[4] == 0; | |
5640 break; | |
5641 case 522: | |
5642 v5 = byte_5111F6[5] == 0; | |
5643 break; | |
5644 case 523: | |
5645 v5 = byte_5111F6[6] == 0; | |
5646 break; | |
5647 case 532: | |
5648 v5 = byte_5111F6[7] == 0; | |
5649 break; | |
5650 case 544: | |
5651 v5 = byte_5111F6[8] == 0; | |
5652 break; | |
5653 case 524: | |
5654 v5 = byte_5111F6[9] == 0; | |
5655 break; | |
5656 case 535: | |
5657 v5 = byte_5111F6[10] == 0; | |
5658 break; | |
5659 case 525: | |
5660 v5 = byte_5111F6[11] == 0; | |
5661 break; | |
5662 case 530: | |
5663 v5 = byte_5111F6[12] == 0; | |
5664 break; | |
5665 case 547: | |
5666 v5 = byte_5111F6[13] == 0; | |
5667 break; | |
5668 case 548: | |
5669 v5 = byte_5111F6[14] == 0; | |
5670 break; | |
5671 case 550: | |
5672 v5 = byte_5111F6[15] == 0; | |
5673 break; | |
5674 default: | |
5675 break; | |
5676 } | |
0 | 5677 if ( v5 ) |
5678 return result; | |
5679 result = 516; | |
899 | 5680 if ( item_id < 66 || item_id > 78 ) |
5681 { | |
5682 if ( item_id == 516 ) | |
5683 { | |
5684 if ( !shoulder ) | |
5685 return sprintf(pOut, "item%3.3dv%d", 234, index); | |
5686 if ( shoulder == 1 ) | |
5687 return sprintf(pOut, "item%3.3dv%da1", 234, index); | |
5688 if ( shoulder == 2 ) | |
5689 return sprintf(pOut, "item%3.3dv%da2", 234, index); | |
5690 } | |
5691 if ( item_id != 504 && item_id != 505 && item_id != 533 ) | |
5692 { | |
5693 if ( (item_id < 100 || item_id > 104) && item_id != 524 && item_id != 535 ) | |
5694 { | |
5695 if ( item_id >= 115 && item_id <= 119 || item_id == 512 ) | |
5696 { | |
5697 if ( item_id == 512 ) | |
5698 item_id = 312; | |
5699 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5700 } | |
5701 if ( (item_id < 89 || item_id > 99) && item_id != 521 && item_id != 522 && item_id != 523 && item_id != 532 && item_id != 544 ) | |
0 | 5702 { |
5703 result = 525; | |
899 | 5704 if ( (item_id < 105 || item_id > 109) && item_id != 525 && item_id != 530 && item_id != 547 && item_id != 548 && item_id != 550 ) |
0 | 5705 return result; |
899 | 5706 switch ( item_id ) |
0 | 5707 { |
5708 case 525: | |
899 | 5709 item_id = 325; |
0 | 5710 break; |
5711 case 530: | |
899 | 5712 item_id = 330; |
0 | 5713 break; |
5714 case 547: | |
899 | 5715 item_id = 347; |
0 | 5716 break; |
5717 case 548: | |
899 | 5718 item_id = 348; |
0 | 5719 break; |
5720 case 550: | |
899 | 5721 item_id = 350; |
0 | 5722 break; |
5723 } | |
899 | 5724 if ( !shoulder ) |
5725 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5726 return sprintf(pOut, "item%3.3dv%da1", item_id, index); | |
5727 } | |
5728 if ( item_id == 521 ) | |
5729 return sprintf(pOut, "item%3.3dv%d", 239, index); | |
5730 if ( item_id == 522 ) | |
5731 return sprintf(pOut, "item%3.3dv%d", 240, index); | |
5732 if ( item_id == 523 ) | |
5733 return sprintf(pOut, "item%3.3dv%d", 241, index); | |
5734 if ( item_id != 532 ) | |
5735 { | |
5736 if ( item_id == 544 ) | |
5737 item_id = 344; | |
5738 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5739 } | |
5740 return sprintf(pOut, "item%3.3dv%d", 93, index); | |
5741 } | |
5742 if ( item_id == 524 ) | |
5743 return sprintf(pOut, "item%3.3dv%d", 324, index); | |
5744 if ( item_id == 535 ) | |
5745 item_id = 104; | |
5746 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5747 } | |
5748 } | |
5749 if ( item_id != 516 ) | |
5750 { | |
5751 switch ( item_id ) | |
0 | 5752 { |
5753 case 504: | |
899 | 5754 item_id = 235; |
0 | 5755 break; |
5756 case 505: | |
899 | 5757 item_id = 236; |
0 | 5758 break; |
5759 case 533: | |
899 | 5760 item_id = 73; |
0 | 5761 break; |
5762 } | |
899 | 5763 if ( !shoulder ) |
5764 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5765 if ( shoulder == 1 ) | |
5766 return sprintf(pOut, "item%3.3dv%da1", item_id, index); | |
5767 if ( shoulder == 2 ) | |
5768 return sprintf(pOut, "item%3.3dv%da2", item_id, index); | |
5769 } | |
5770 if ( !shoulder ) | |
5771 return sprintf(pOut, "item%3.3dv%d", 234, index); | |
5772 if ( shoulder == 1 ) | |
5773 return sprintf(pOut, "item%3.3dv%da1", 234, index); | |
5774 if ( shoulder == 2 ) | |
5775 return sprintf(pOut, "item%3.3dv%da2", 234, index); | |
5776 } | |
5777 result = item_id - 504; | |
0 | 5778 return result; |
5779 } | |
5780 | |
5781 //----- (0043ED6F) -------------------------------------------------------- | |
5782 bool _43ED6F_check_party_races(bool a1) | |
5783 { | |
5784 bool v6; // zf@5 | |
5785 | |
5786 for (uint i = 0; i < 4; ++i) | |
5787 { | |
5788 auto player = pParty->pPlayers + i; | |
5789 auto race = player->GetRace(); | |
5790 | |
5791 if (race != CHARACTER_RACE_HUMAN && | |
5792 race != CHARACTER_RACE_ELF && | |
5793 race != CHARACTER_RACE_GOBLIN) | |
5794 v6 = a1 == 1; | |
5795 else | |
5796 v6 = !a1; | |
5797 | |
5798 if (v6) | |
5799 return true; | |
5800 } | |
5801 return false; | |
5802 } | |
5803 // A750D8: using guessed type __int64 qword_A750D8; | |
5804 | |
5805 //----- (0043EDB9) -------------------------------------------------------- | |
4 | 5806 bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) |
5807 { | |
5808 unsigned int pNum; // ebp@1 | |
5809 Player **pPlayer; // ebx@1 | |
5810 Player *pPlayer2; // esi@2 | |
5811 enum CHARACTER_RACE pRace; // edi@2 | |
5812 bool pSex; // eax@2 | |
0 | 5813 char v6; // zf@7 |
5814 | |
4 | 5815 //pPlayer = &pPlayers[1]; |
5816 /*pNum = a1; | |
5817 | |
0 | 5818 while ( 1 ) |
5819 { | |
4 | 5820 pPlayer2 = *pPlayer; |
5821 pRace = pPlayer2->GetRace(); | |
5822 pSex = pPlayer2->GetSexByVoice(); | |
5823 if ( !pRace ) | |
5824 break; | |
5825 if ( pRace == 1 || pRace == 2 ) | |
0 | 5826 break; |
4 | 5827 if ( !pSex && pNum == 2 )// |
5828 //goto LABEL_15; | |
5829 { | |
5830 pSex = 1; | |
5831 return pSex; | |
5832 } | |
5833 v6 = pNum == 3;// | |
0 | 5834 LABEL_11: |
5835 if ( v6 ) | |
4 | 5836 //goto LABEL_15; |
5837 { | |
5838 pSex = 1; | |
5839 return pSex; | |
5840 } | |
5841 ++pPlayer; | |
5842 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )// | |
5843 { | |
5844 pSex = 0; | |
5845 return pSex; | |
5846 } | |
5847 } | |
5848 if ( pSex || pNum ) | |
5849 { | |
5850 v6 = pNum == 1; | |
0 | 5851 goto LABEL_11; |
5852 } | |
4 | 5853 //LABEL_15: |
5854 pSex = 1; | |
5855 return pSex;*/ | |
871 | 5856 for (uint i = 1; i <= 4; ++i) |
4 | 5857 { |
5858 pRace = pPlayers[i]->GetRace(); | |
5859 pSex = pPlayers[i]->GetSexByVoice(); | |
5860 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 ) | |
5861 return 1; | |
5862 } | |
5863 return 0; | |
0 | 5864 } |
5865 // A750D8: using guessed type __int64 qword_A750D8; | |
5866 | |
5867 //----- (0043EE15) -------------------------------------------------------- | |
899 | 5868 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) |
5869 { | |
0 | 5870 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) |
5871 { | |
899 | 5872 for ( uint i = 0; i < 126; ++i ) |
5873 { | |
5874 if ( pPlayer->pInventoryIndices[i] > 0 ) | |
5875 { | |
5876 if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pInventoryIndices[i] - 1].uItemID == uItemID ) | |
5877 return true; | |
5878 } | |
5879 } | |
5880 for ( uint i = 0; i < 16; ++i ) | |
5881 { | |
5882 if ( pPlayer->pEquipment.pIndices[i] ) | |
5883 { | |
5884 if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) | |
5885 return true; | |
5886 } | |
5887 } | |
5888 } | |
5889 return false; | |
0 | 5890 } |
5891 | |
5892 //----- (0043EE77) -------------------------------------------------------- | |
5893 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1) | |
5894 { | |
5895 bool result; // eax@0 | |
5896 Player *v2; // edx@3 | |
5897 int v3; // ecx@3 | |
5898 Player **pPlayers; // esi@8 | |
5899 unsigned int v5; // ecx@8 | |
5900 Player *v6; // edx@9 | |
5901 | |
5902 if ( a1 < 1 || a1 > 4 ) | |
5903 { | |
5904 if ( !a1 ) | |
5905 { | |
5906 pPlayers = &::pPlayers[1]; | |
5907 v5 = 604; | |
5908 while ( 1 ) | |
5909 { | |
899 | 5910 result = Player_has_item(v5, *pPlayers, 0); |
0 | 5911 if ( !result ) |
5912 break; | |
898 | 5913 result = v6->pEquipment.uArmor; |
0 | 5914 if ( !result ) |
5915 break; | |
5916 result *= 9; | |
5917 if ( *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v5 ) | |
5918 break; | |
5919 ++pPlayers; | |
5920 if ( (signed int)pPlayers >= (signed int)&qword_A750D8 ) | |
5921 goto LABEL_13; | |
5922 } | |
5923 } | |
5924 goto LABEL_6; | |
5925 } | |
899 | 5926 result = Player_has_item(604u, ::pPlayers[a1], 0); |
0 | 5927 if ( !result |
898 | 5928 || (result = v2->pEquipment.uArmor) == 0 |
0 | 5929 || (result *= 9, *(int *)&v2->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v3) ) |
5930 { | |
5931 LABEL_6: | |
5932 LOBYTE(result) = 0; | |
5933 return result; | |
5934 } | |
5935 LABEL_13: | |
5936 LOBYTE(result) = 1; | |
5937 return result; | |
5938 } | |
5939 // A750D8: using guessed type __int64 qword_A750D8; | |
5940 | |
5941 //----- (0043EF2B) -------------------------------------------------------- | |
5942 void __fastcall WetsuitOn(unsigned int uPlayerID) | |
5943 { | |
5944 unsigned int v1; // ebx@1 | |
5945 Player **v2; // esi@2 | |
5946 enum CHARACTER_RACE v3; // edi@2 | |
5947 signed int v4; // eax@2 | |
5948 int v5; // ecx@5 | |
5949 unsigned __int8 v6; // al@7 | |
5950 char pContainer[20]; // [sp+4h] [bp-1Ch]@7 | |
5951 unsigned int v8; // [sp+18h] [bp-8h]@1 | |
5952 int v9; // [sp+1Ch] [bp-4h]@7 | |
5953 | |
5954 v1 = uPlayerID - 1; | |
5955 v8 = uPlayerID; | |
711 | 5956 if ( (uPlayerID - 1) >= 0 ) |
0 | 5957 { |
5958 v2 = &pPlayers[uPlayerID]; | |
5959 v3 = (*v2)->GetRace(); | |
5960 v4 = (*v2)->GetSexByVoice(); | |
5961 if ( v3 && v3 != 1 && v3 != 2 ) | |
5962 v5 = (v4 != 0) + 3; | |
5963 else | |
5964 v5 = (v4 != 0) + 1; | |
5965 v9 = v5; | |
5966 wsprintfA(pContainer, "pc23v%dBod", v5); | |
5967 papredoll_dbods[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
5968 wsprintfA(pContainer, "pc23v%dlad", v9); | |
5969 papredoll_dlads[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
5970 wsprintfA(pContainer, "pc23v%dlau", v9); | |
5971 papredoll_dlaus[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
5972 wsprintfA(pContainer, "pc23v%drh", v9); | |
5973 papredoll_drhs[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
5974 wsprintfA(pContainer, "pc23v%dlh", v9); | |
5975 papredoll_dlhs[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
5976 wsprintfA(pContainer, "pc23v%dlhu", v9); | |
5977 papredoll_dlhus[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
1014 | 5978 v6 = pPlayers[v1 + 1]->uCurrentFace; |
0 | 5979 if ( v6 == 12 || v6 == 13 ) |
1014 | 5980 papredoll_dbrds[pPlayers[v8]->uCurrentFace] = 0; |
5981 papredoll_flying_feet[pPlayers[v8]->uCurrentFace] = 0; | |
0 | 5982 IsPlayerWearingWatersuit[v8] = 1; |
5983 } | |
5984 } | |
5985 | |
5986 //----- (0043F0BD) -------------------------------------------------------- | |
5987 unsigned int __fastcall WetsuitOff(unsigned int uPlayerID) | |
5988 { | |
5989 unsigned int result; // eax@1 | |
5990 Player **v2; // edi@2 | |
5991 unsigned int v3; // ebx@2 | |
5992 int v4; // ebx@2 | |
5993 char v5; // al@2 | |
5994 char pContainer[20]; // [sp+0h] [bp-18h]@4 | |
5995 unsigned int v7; // [sp+14h] [bp-4h]@1 | |
5996 | |
5997 result = uPlayerID - 1; | |
5998 v7 = uPlayerID; | |
5999 if ( ((uPlayerID - 1) & 0x80000000u) == 0 ) | |
6000 { | |
6001 v2 = &pPlayers[uPlayerID]; | |
6002 v3 = uPlayerID - 1; | |
1014 | 6003 papredoll_dbods[v3] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); |
6004 papredoll_dlads[v3] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); | |
6005 papredoll_dlaus[v3] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); | |
6006 papredoll_drhs[v3] = pIcons_LOD->LoadTexture(drh_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); | |
6007 papredoll_dlhs[v3] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); | |
6008 papredoll_dlhus[v3] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); | |
6009 v4 = (int)&(*v2)->uCurrentFace; | |
0 | 6010 v5 = *(char *)v4; |
6011 if ( *(char *)v4 == 12 || v5 == 13 ) | |
6012 { | |
6013 wsprintfA(pContainer, "pc%02dbrd", v5 + 1); | |
1014 | 6014 v4 = (int)&(*v2)->uCurrentFace; |
0 | 6015 papredoll_dbrds[*(char *)v4] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
6016 } | |
6017 wsprintfA(pContainer, "item281pc%02d", *(char *)v4 + 1); | |
1014 | 6018 papredoll_flying_feet[(*v2)->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
0 | 6019 result = v7; |
6020 IsPlayerWearingWatersuit[v7] = 0; | |
6021 } | |
6022 return result; | |
6023 } | |
6024 | |
6025 //----- (0043F333) -------------------------------------------------------- | |
6026 void BspRenderer::MakeVisibleSectorList() | |
6027 { | |
6028 int v6; // ebx@3 | |
6029 | |
6030 uNumVisibleNotEmptySectors = 0; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6031 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
|
6032 { |
0 | 6033 if (!uNumVisibleNotEmptySectors) |
6034 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6035 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6036 continue; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6037 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6038 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6039 v6 = 0; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6040 while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != nodes[i].uSectorID ) |
0 | 6041 { |
6042 ++v6; | |
6043 if ( v6 >= uNumVisibleNotEmptySectors) | |
6044 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6045 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6046 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6047 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6048 |
0 | 6049 } |
6050 } | |
6051 | |
6052 //----- (0043F515) -------------------------------------------------------- | |
657 | 6053 void FindBillboardsLightLevels_BLV() |
0 | 6054 { |
6055 for (uint i = 0; i < uNumBillboardsToDraw; ++i) | |
6056 { | |
6057 auto p = pBillboardRenderList + i; | |
6058 | |
6059 if (p->field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !p->uIndoorSectorID) | |
657 | 6060 p->dimming_level = 0; |
0 | 6061 else |
657 | 6062 p->dimming_level = _43F55F_get_billboard_light_level(p, -1); |
0 | 6063 } |
6064 } | |
6065 | |
6066 //----- (0043F55F) -------------------------------------------------------- | |
6067 int __fastcall _43F55F_get_billboard_light_level(RenderBillboard *a1, int uBaseLightLevel) | |
6068 { | |
6069 signed int v3; // ecx@2 | |
6070 | |
6071 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
6072 { | |
6073 v3 = pIndoor->pSectors[a1->uIndoorSectorID].uMinAmbientLightLevel; | |
6074 } | |
6075 else | |
6076 { | |
6077 if ( uBaseLightLevel == -1 ) | |
657 | 6078 v3 = a1->dimming_level; |
0 | 6079 else |
6080 v3 = uBaseLightLevel; | |
6081 } | |
430 | 6082 return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->world_x, a1->world_y, a1->world_z); |
0 | 6083 } |
6084 | |
6085 //----- (0043F5C8) -------------------------------------------------------- | |
6086 int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z) | |
6087 { | |
6088 int v5; // esi@1 | |
6089 signed int v6; // edi@1 | |
6090 int v8; // eax@6 | |
6091 int v9; // ebx@6 | |
6092 unsigned int v10; // ecx@6 | |
6093 unsigned int v11; // edx@9 | |
6094 unsigned int v12; // edx@11 | |
6095 signed int v13; // ecx@12 | |
6096 BLVLightMM7 *v16; // esi@20 | |
6097 int v17; // ebx@21 | |
6098 int v18; // eax@24 | |
6099 int v19; // ebx@24 | |
6100 unsigned int v20; // ecx@24 | |
6101 int v21; // edx@25 | |
6102 unsigned int v22; // edx@27 | |
6103 unsigned int v23; // edx@29 | |
6104 signed int v24; // ecx@30 | |
6105 int v26; // ebx@35 | |
6106 int v27; // eax@38 | |
6107 int v28; // ebx@38 | |
6108 unsigned int v29; // ecx@38 | |
6109 int v30; // edx@39 | |
6110 unsigned int v31; // edx@41 | |
6111 unsigned int v32; // edx@43 | |
6112 signed int v33; // ecx@44 | |
6113 int v37; // [sp+Ch] [bp-18h]@37 | |
6114 int v38; // [sp+10h] [bp-14h]@5 | |
6115 int v39; // [sp+10h] [bp-14h]@23 | |
6116 int v40; // [sp+10h] [bp-14h]@36 | |
6117 int v42; // [sp+14h] [bp-10h]@22 | |
6118 unsigned int v43; // [sp+18h] [bp-Ch]@12 | |
6119 unsigned int v44; // [sp+18h] [bp-Ch]@30 | |
6120 unsigned int v45; // [sp+18h] [bp-Ch]@44 | |
6121 | |
6122 v6 = uBaseLightLevel; | |
6123 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i) | |
6124 { | |
6125 auto p = pMobileLightsStack->pLights + i; | |
6126 | |
6127 auto distX = abs(p->vPosition.x - x); | |
6128 if ( distX <= p->uRadius) | |
6129 { | |
6130 auto distY = abs(p->vPosition.y - y); | |
6131 if ( distY <= p->uRadius) | |
6132 { | |
6133 auto distZ = abs(p->vPosition.z - z); | |
6134 if ( distZ <= p->uRadius) | |
6135 { | |
6136 v8 = distX; | |
6137 v9 = distY; | |
6138 v10 = distZ; | |
6139 if (distX < distY) | |
6140 { | |
6141 v8 = distY; | |
6142 v9 = distX; | |
6143 } | |
6144 if ( v8 < distZ ) | |
6145 { | |
6146 v11 = v8; | |
6147 v8 = distZ; | |
6148 v10 = v11; | |
6149 } | |
6150 if ( v9 < (signed int)v10 ) | |
6151 { | |
6152 v12 = v10; | |
6153 v10 = v9; | |
6154 v9 = v12; | |
6155 } | |
6156 v43 = ((unsigned int)(11 * v9) / 32) + (v10 / 4) + v8; | |
6157 v13 = p->uRadius; | |
6158 if ( (signed int)v43 < v13 ) | |
6159 v6 += ((unsigned __int64)(30i64 * (signed int)(v43 << 16) / v13) >> 16) - 30; | |
6160 } | |
6161 } | |
6162 } | |
6163 } | |
6164 | |
6165 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6166 { | |
6167 auto pSector = pIndoor->pSectors + uSectorID; | |
6168 | |
6169 for (uint i = 0; i < pSector->uNumLights; ++i) | |
6170 { | |
6171 v16 = pIndoor->pLights + pSector->pLights[i]; | |
6172 if (~v16->uAtributes & 8) | |
6173 { | |
6174 v17 = abs(v16->vPosition.x - x); | |
6175 if ( v17 <= v16->uRadius ) | |
6176 { | |
6177 v42 = abs(v16->vPosition.y - y); | |
6178 if ( v42 <= v16->uRadius ) | |
6179 { | |
6180 v39 = abs(v16->vPosition.z - z); | |
6181 if ( v39 <= v16->uRadius ) | |
6182 { | |
6183 v18 = v17; | |
6184 v19 = v42; | |
6185 v20 = v39; | |
6186 if ( v18 < v42 ) | |
6187 { | |
6188 v21 = v18; | |
6189 v18 = v42; | |
6190 v19 = v21; | |
6191 } | |
6192 if ( v18 < v39 ) | |
6193 { | |
6194 v22 = v18; | |
6195 v18 = v39; | |
6196 v20 = v22; | |
6197 } | |
6198 if ( v19 < (signed int)v20 ) | |
6199 { | |
6200 v23 = v20; | |
6201 v20 = v19; | |
6202 v19 = v23; | |
6203 } | |
6204 v44 = ((unsigned int)(11 * v19) >> 5) + (v20 >> 2) + v18; | |
6205 v24 = v16->uRadius; | |
6206 if ( (signed int)v44 < v24 ) | |
6207 v6 += ((unsigned __int64)(30i64 * (signed int)(v44 << 16) / v24) >> 16) - 30; | |
6208 } | |
6209 } | |
6210 } | |
6211 } | |
6212 } | |
6213 } | |
6214 | |
6215 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i) | |
6216 { | |
6217 auto p = pStationaryLightsStack->pLights + i; | |
6218 v26 = abs(p->vPosition.x - x); | |
6219 if ( v26 <= p->uRadius) | |
6220 { | |
6221 v40 = abs(p->vPosition.y - y); | |
6222 if ( v40 <= p->uRadius) | |
6223 { | |
6224 v37 = abs(p->vPosition.z - z); | |
6225 if ( v37 <= p->uRadius) | |
6226 { | |
6227 v27 = v26; | |
6228 v28 = v40; | |
6229 v29 = v37; | |
6230 if ( v27 < v40 ) | |
6231 { | |
6232 v30 = v27; | |
6233 v27 = v40; | |
6234 v28 = v30; | |
6235 } | |
6236 if ( v27 < v37 ) | |
6237 { | |
6238 v31 = v27; | |
6239 v27 = v37; | |
6240 v29 = v31; | |
6241 } | |
6242 if ( v28 < (signed int)v29 ) | |
6243 { | |
6244 v32 = v29; | |
6245 v29 = v28; | |
6246 v28 = v32; | |
6247 } | |
6248 v45 = ((unsigned int)(11 * v28) >> 5) + (v29 >> 2) + v27; | |
6249 v33 = p->uRadius; | |
6250 if ( (signed int)v45 < v33 ) | |
6251 v6 += ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / v33) >> 16) - 30; | |
6252 } | |
6253 } | |
6254 } | |
6255 } | |
6256 | |
6257 if ( v6 <= 31 ) | |
6258 { | |
6259 if ( v6 < 0 ) | |
6260 v6 = 0; | |
6261 } | |
6262 else | |
6263 { | |
6264 v6 = 31; | |
6265 } | |
6266 return v6; | |
6267 } | |
6268 | |
6269 //----- (00406051) -------------------------------------------------------- | |
6270 __int16 stru262_TurnBased::StartTurn() | |
6271 { | |
6272 stru262_TurnBased *v1; // esi@1 | |
6273 int v2; // ecx@1 | |
6274 int v3; // ebx@1 | |
6275 char *v4; // edi@1 | |
6276 int v5; // eax@4 | |
6277 int v6; // eax@12 | |
6278 char *v7; // eax@15 | |
6279 TurnBased_QueueElem *v8; // edi@17 | |
6280 unsigned int v9; // edx@23 | |
6281 char *v10; // eax@26 | |
6282 int v11; // eax@30 | |
6283 int v12; // ebx@30 | |
6284 char *v13; // edi@31 | |
6285 int v15; // [sp+Ch] [bp-10h]@5 | |
6286 TurnBased_QueueElem *v16; // [sp+10h] [bp-Ch]@3 | |
6287 int v17; // [sp+14h] [bp-8h]@2 | |
6288 int v18; // [sp+14h] [bp-8h]@16 | |
6289 signed int v19; // [sp+18h] [bp-4h]@1 | |
6290 int v20; // [sp+18h] [bp-4h]@14 | |
6291 | |
6292 v1 = this; | |
6293 v2 = 0; | |
6294 v19 = 0; | |
6295 v3 = v1->uActorQueueSize; | |
6296 v1->field_1C = 0; | |
6297 v4 = (char *)&v1->pQueue[v3].field_4; | |
6298 do | |
6299 { | |
6300 v17 = v2; | |
6301 if ( v1->uActorQueueSize <= v2 ) | |
6302 goto LABEL_11; | |
6303 v16 = v1->pQueue; | |
6304 while ( 1 ) | |
6305 { | |
6306 v5 = v16->uPackedID; | |
848 | 6307 if ( PID_TYPE(v16->uPackedID) == OBJECT_Player) |
0 | 6308 break; |
6309 LABEL_8: | |
6310 ++v17; | |
6311 ++v16; | |
6312 if ( v17 >= v1->uActorQueueSize ) | |
6313 goto LABEL_11; | |
6314 } | |
848 | 6315 v15 = PID_ID(v5); |
6316 if ( !pPlayers[(PID_ID(v5)) + 1]->CanAct() || v19 != v15 ) | |
0 | 6317 { |
6318 v2 = 0; | |
6319 goto LABEL_8; | |
6320 } | |
6321 v2 = 0; | |
6322 LABEL_11: | |
6323 if ( v17 == v1->uActorQueueSize ) | |
6324 { | |
6325 *(int *)v4 = 100; | |
6326 v6 = 8 * v19; | |
862 | 6327 LOBYTE(v6) = PID(OBJECT_Player,v19); |
0 | 6328 *((int *)v4 + 2) = v2; |
6329 *((int *)v4 - 1) = v6; | |
6330 *((int *)v4 + 1) = v2; | |
6331 ++v3; | |
6332 v4 += 16; | |
6333 } | |
6334 ++v19; | |
6335 } | |
6336 while ( v19 < 4 ); | |
6337 v1->uActorQueueSize = v3; | |
6338 v20 = v2; | |
6339 if ( ai_arrays_size > v2 ) | |
6340 { | |
6341 v7 = (char *)&v1->pQueue[v3].field_4; | |
6342 do | |
6343 { | |
6344 v18 = v2; | |
6345 if ( v1->uActorQueueSize > v2 ) | |
6346 { | |
6347 v8 = v1->pQueue; | |
6348 do | |
6349 { | |
848 | 6350 if ( PID_TYPE(v8->uPackedID) == OBJECT_Actor && ai_near_actors_ids[v20] == PID_ID(v8->uPackedID) ) |
0 | 6351 break; |
6352 ++v18; | |
6353 ++v8; | |
6354 } | |
6355 while ( v18 < v1->uActorQueueSize ); | |
6356 v2 = 0; | |
6357 } | |
6358 if ( v18 == v1->uActorQueueSize ) | |
6359 { | |
390 | 6360 v9 = ai_near_actors_ids[v20]; |
0 | 6361 *(int *)v7 = 1; |
6362 *((int *)v7 + 2) = v2; | |
862 | 6363 *((int *)v7 - 1) = PID(OBJECT_Actor,v9); |
0 | 6364 *((int *)v7 + 1) = v2; |
6365 ++v3; | |
6366 v7 += 16; | |
6367 } | |
6368 ++v20; | |
6369 } | |
6370 while ( v20 < ai_arrays_size ); | |
6371 } | |
6372 ++v1->field_0; | |
6373 v1->uActorQueueSize = v3; | |
6374 v1->field_10 = 100; | |
6375 if ( v3 > 0 ) | |
6376 { | |
6377 v10 = (char *)&v1->pQueue[0].field_4; | |
6378 do | |
6379 { | |
6380 if ( *(int *)v10 <= 0 ) | |
6381 *(int *)v10 = 100; | |
6382 ++v2; | |
6383 v10 += 16; | |
6384 } | |
6385 while ( v2 < v1->uActorQueueSize ); | |
6386 } | |
6387 LOWORD(v11) = v1->_4063A1(); | |
6388 v12 = 0; | |
6389 if ( v1->uActorQueueSize > 0 ) | |
6390 { | |
6391 v13 = (char *)&v1->pQueue[0].field_4; | |
6392 do | |
6393 { | |
848 | 6394 v11 = PID_TYPE(*((int *)v13 - 1)); |
0 | 6395 if ( (char)v11 == 4 ) |
6396 break; | |
6397 if ( *(int *)v13 > 0 ) | |
6398 break; | |
6399 LOWORD(v11) = v1->_40680F(v12++); | |
6400 v13 += 16; | |
6401 } | |
6402 while ( v12 < v1->uActorQueueSize ); | |
6403 } | |
6404 return v11; | |
6405 } | |
6406 // 4F75D8: using guessed type int ai_arrays_size; | |
6407 | |
6408 //----- (004061CA) -------------------------------------------------------- | |
6409 void stru262_TurnBased::NextTurn() | |
6410 { | |
6411 stru262_TurnBased *v1; // esi@1 | |
6412 TurnBased_QueueElem *v2; // ebp@1 | |
6413 int v3; // ebx@1 | |
6414 int v4; // edi@7 | |
6415 Actor *v5; // eax@9 | |
6416 int v6; // ecx@9 | |
6417 signed int v7; // ebx@17 | |
6418 int v8; // ebp@27 | |
6419 TurnBased_QueueElem *v9; // edi@28 | |
6420 int v10; // ecx@30 | |
6421 unsigned __int16 v11; // ax@30 | |
6422 signed int v12; // edx@35 | |
6423 signed int v13; // [sp+10h] [bp-4h]@7 | |
6424 | |
6425 v1 = this; | |
6426 _404544(); | |
6427 v2 = v1->pQueue; | |
6428 v3 = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6429 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6430 uActiveCharacter = PID_ID(v1->pQueue[0].uPackedID) + 1; |
0 | 6431 else |
6432 uActiveCharacter = 0; | |
6433 viewparams->bRedrawGameUI = 1; | |
6434 if ( v1->field_1C ) | |
6435 { | |
6436 pTurnEngine->field_18 |= 2u; | |
6437 return; | |
6438 } | |
6439 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
6440 if ( v1->pQueue[0].field_4 <= 0 ) | |
6441 return; | |
6442 v4 = 0; | |
6443 v13 = 0; | |
6444 if ( v1->uActorQueueSize <= 0 ) | |
6445 goto LABEL_27; | |
6446 do | |
6447 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6448 if (PID_TYPE(v2->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6449 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6450 v5 = &pActors[PID_ID(v2->uPackedID)]; |
0 | 6451 LOWORD(v6) = v5->uAIState; |
6452 if ( (short)v6 == 4 | |
6453 || (short)v6 == 8 | |
6454 || (short)v6 == 2 | |
6455 || (short)v6 == 3 | |
6456 || (short)v6 == 12 | |
6457 || (short)v6 == 13 | |
6458 || (short)v6 == 18 | |
6459 || (short)v6 == 17 ) | |
6460 { | |
6461 v7 = v5->uCurrentActionLength; | |
6462 v5->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
6463 if ( (signed int)v5->uCurrentActionTime < v7 ) | |
6464 { | |
6465 v13 = 1; | |
6466 LABEL_19: | |
6467 v3 = 0; | |
6468 goto LABEL_20; | |
6469 } | |
6470 v6 = (signed __int16)v6; | |
6471 if ( (signed __int16)v6 == 4 ) | |
6472 { | |
6473 v3 = 0; | |
6474 v5->uAIState = Dead; | |
6475 v5->uCurrentActionTime = 0; | |
6476 v5->uCurrentActionLength = 0; | |
6477 v5->UpdateAnimation(); | |
6478 } | |
6479 else | |
6480 { | |
6481 if ( v6 != 8 ) | |
6482 goto LABEL_19; | |
6483 v3 = 0; | |
848 | 6484 Actor::AI_StandOrBored(PID_ID(v2->uPackedID), ai_near_actors_targets_pid[PID_ID(v2->uPackedID)], 32, 0); |
0 | 6485 } |
6486 } | |
6487 } | |
6488 LABEL_20: | |
6489 ++v4; | |
6490 ++v2; | |
6491 } | |
6492 while ( v4 < v1->uActorQueueSize ); | |
6493 if ( v13 != v3 ) | |
6494 { | |
6495 v1->field_18 |= 1u; | |
6496 return; | |
6497 } | |
6498 LABEL_27: | |
6499 v1->field_18 &= 0xFFFFFFFEu; | |
6500 v8 = 0; | |
6501 if ( v1->uActorQueueSize > v3 ) | |
6502 { | |
6503 v9 = v1->pQueue; | |
6504 do | |
6505 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6506 if (PID_TYPE(v9->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6507 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6508 v10 = PID_ID(v9->uPackedID); |
0 | 6509 v11 = pActors[v10].uAIState; |
6510 if ( v11 != 5 ) | |
6511 { | |
6512 if ( v11 != 4 && v11 != 11 && v11 != 19 ) | |
6513 { | |
6514 if ( v11 != 17 ) | |
6515 { | |
417 | 6516 v12 = ai_near_actors_targets_pid[v10]; |
0 | 6517 v9->uActionLength = v3; |
414 | 6518 Actor::AI_StandOrBored(v10, v12, 32, (AIDirection *)v3); |
0 | 6519 } |
6520 } | |
6521 } | |
6522 } | |
6523 ++v8; | |
6524 ++v9; | |
6525 } | |
6526 while ( v8 < v1->uActorQueueSize ); | |
6527 } | |
6528 v1->field_4 = 3; | |
6529 pParty->uTimePlayed += __PAIR__(v3, 213); | |
6530 _494035_timed_effects__water_walking_damage__etc(); | |
6531 v1->uActionPointsLeft = 130; | |
6532 } | |
6533 | |
6534 //----- (004063A1) -------------------------------------------------------- | |
6535 int stru262_TurnBased::_4063A1() | |
6536 { | |
6537 stru262_TurnBased *v1; // esi@1 | |
6538 int v2; // ebp@1 | |
6539 signed int result; // eax@1 | |
6540 int v4; // edx@1 | |
6541 int v5; // edx@3 | |
6542 int v6; // edi@4 | |
6543 int v7; // ecx@5 | |
6544 Actor *v8; // ecx@11 | |
6545 unsigned __int16 v9; // dx@12 | |
6546 int v10; // edi@16 | |
6547 int v11; // edx@17 | |
6548 char v12; // zf@18 | |
6549 | |
6550 v1 = this; | |
6551 _404544(); | |
6552 v2 = (int)&v1->pQueue[0].field_4; | |
6553 result = 1; | |
6554 viewparams->bRedrawGameUI = 1; | |
6555 v4 = v1->pQueue[0].field_4; | |
6556 if ( v4 ) | |
6557 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6558 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 6559 { |
6560 v5 = v1->uActorQueueSize; | |
6561 while ( 1 ) | |
6562 { | |
6563 v6 = 0; | |
6564 if ( v5 > 0 ) | |
6565 { | |
6566 v7 = (int)&v1->pQueue[0].field_4; | |
6567 do | |
6568 { | |
6569 --*(int *)v7; | |
6570 v5 = v1->uActorQueueSize; | |
6571 ++v6; | |
6572 v7 += 16; | |
6573 } | |
6574 while ( v6 < v5 ); | |
6575 } | |
6576 --v1->field_10; | |
6577 if ( v1->field_10 <= 0 ) | |
6578 break; | |
6579 if ( !*(int *)v2 ) | |
6580 goto LABEL_9; | |
6581 } | |
6582 LABEL_24: | |
6583 result = 1; | |
6584 } | |
6585 else | |
6586 { | |
848 | 6587 v8 = &pActors[PID_ID(v1->pQueue[0].uPackedID)]; |
0 | 6588 if ( v4 > 0 ) |
6589 { | |
6590 do | |
6591 { | |
6592 v9 = v8->uAIState; | |
6593 if ( v9 == 5 ) | |
6594 break; | |
6595 if ( v9 == 4 || v9 == 19 || v9 == 11 ) | |
6596 break; | |
6597 v10 = 0; | |
6598 if ( v1->uActorQueueSize > 0 ) | |
6599 { | |
6600 v11 = (int)&v1->pQueue[0].field_4; | |
6601 do | |
6602 { | |
6603 v12 = (*(int *)v11)-- == 1; | |
6604 if ( v12 ) | |
6605 *(int *)(v11 + 4) = 0; | |
6606 ++v10; | |
6607 v11 += 16; | |
6608 } | |
6609 while ( v10 < v1->uActorQueueSize ); | |
6610 } | |
6611 --v1->field_10; | |
6612 if ( v1->field_10 <= 0 ) | |
6613 goto LABEL_24; | |
6614 } | |
6615 while ( *(int *)v2 > 0 ); | |
6616 } | |
6617 LABEL_9: | |
6618 result = 0; | |
6619 } | |
6620 } | |
6621 return result; | |
6622 } | |
6623 | |
6624 //----- (00406457) -------------------------------------------------------- | |
6625 int stru262_TurnBased::_406457(int a2) | |
6626 { | |
6627 stru262_TurnBased *v2; // esi@1 | |
6628 signed int v3; // eax@1 | |
6629 signed int v4; // ecx@2 | |
6630 char *v5; // edx@2 | |
6631 signed int v6; // eax@2 | |
6632 int result; // eax@11 | |
6633 int v8; // edx@13 | |
6634 int v9; // ecx@14 | |
6635 char v10; // zf@15 | |
6636 | |
6637 v2 = this; | |
6638 v3 = *(&this->field_0 + 4 * (a2 + 2)); | |
848 | 6639 if ( (*((char *)&this->field_0 + 16 * PID_TYPE(a2 + 2))) == OBJECT_Player) |
6640 { | |
6641 v4 = PID_ID(v3); | |
6642 v5 = (char *)&pParty->pTurnBasedPlayerRecoveryTimes[PID_ID(v3)]; | |
0 | 6643 v6 = *(int *)v5; |
6644 if ( *(int *)v5 ) | |
6645 *(int *)v5 = 0; | |
6646 else | |
6647 v6 = pPlayers[v4 + 1]->GetAttackRecoveryTime(0); | |
6648 if ( v6 < 30 ) | |
6649 v6 = 30; | |
6650 } | |
6651 else | |
6652 { | |
848 | 6653 v6 = pMonsterStats->pInfos[pActors[PID_ID(v3)].pMonsterInfo.uID].uRecoveryTime; |
0 | 6654 } |
6655 v2->pQueue[a2].field_4 = v6; | |
6656 v2->_404544(); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6657 if (PID_TYPE(v2->pQueue[0].uPackedID) == OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6658 uActiveCharacter = PID_ID(v2->pQueue[0].uPackedID) + 1; |
0 | 6659 else |
6660 uActiveCharacter = 0; | |
6661 result = (int)&v2->pQueue[0].field_4; | |
6662 viewparams->bRedrawGameUI = 1; | |
6663 while ( *(int *)result > 0 ) | |
6664 { | |
6665 if ( v2->field_10 <= 0 ) | |
6666 break; | |
6667 v8 = 0; | |
6668 if ( v2->uActorQueueSize > 0 ) | |
6669 { | |
6670 v9 = (int)&v2->pQueue[0].field_4; | |
6671 do | |
6672 { | |
6673 v10 = (*(int *)v9)-- == 1; | |
6674 if ( v10 ) | |
6675 *(int *)(v9 + 4) = 0; | |
6676 ++v8; | |
6677 v9 += 16; | |
6678 } | |
6679 while ( v8 < v2->uActorQueueSize ); | |
6680 } | |
6681 --v2->field_10; | |
6682 if ( v2->field_10 <= 0 ) | |
6683 break; | |
6684 } | |
6685 return result; | |
6686 } | |
6687 | |
6688 //----- (0040652A) -------------------------------------------------------- | |
6689 void stru262_TurnBased::_40652A() | |
6690 { | |
848 | 6691 int *v1; // edx@2 |
0 | 6692 Actor *v2; // eax@5 |
6693 unsigned __int16 v3; // si@5 | |
6694 unsigned int v4; // esi@8 | |
6695 int v5; // [sp+Ch] [bp-4h]@1 | |
6696 | |
6697 v5 = 0; | |
6698 if ( this->uActorQueueSize > 0 ) | |
6699 { | |
848 | 6700 v1 = &this->pQueue[0].field_4; |
0 | 6701 do |
6702 { | |
6703 if ( !*(int *)v1 ) | |
6704 { | |
848 | 6705 if ( PID_TYPE(*(v1 - 4)) == OBJECT_Player) |
0 | 6706 return; |
848 | 6707 v2 = &pActors[PID_ID(*(v1 - 1))]; |
0 | 6708 v3 = v2->uAIState; |
141 | 6709 if (v3 == Standing || v3 == Fleeing || v3 == Fidgeting) |
0 | 6710 { |
6711 v4 = pMonsterStats->pInfos[v2->pMonsterInfo.uID].uRecoveryTime; | |
6712 *(int *)v1 = v4; | |
6713 if ( (signed __int64)v2->pActorBuffs[7].uExpireTime > 0 ) | |
6714 *(int *)v1 = 2 * v4; | |
6715 } | |
6716 } | |
6717 ++v5; | |
6718 v1 += 16; | |
6719 } | |
6720 while ( v5 < this->uActorQueueSize ); | |
6721 } | |
6722 } | |
6723 | |
6724 //----- (004065B0) -------------------------------------------------------- | |
322 | 6725 void stru262_TurnBased::_4065B0() |
0 | 6726 { |
6727 stru262_TurnBased *v1; // esi@1 | |
6728 signed int v2; // eax@1 | |
6729 int v3; // ebx@6 | |
6730 int v4; // edi@7 | |
6731 unsigned int v5; // edi@14 | |
6732 | |
6733 v1 = this; | |
6734 LOWORD(v2) = _404544(); | |
6735 if ( v1->pQueue[0].field_4 <= 0 | |
848 | 6736 || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, PID_TYPE(v1->pQueue[0].uPackedID) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (PID_ID(v2)) + 1, uActiveCharacter = v2), |
0 | 6737 viewparams->bRedrawGameUI = 1, |
6738 v1->pQueue[0].field_4 <= 0) ) | |
6739 { | |
6740 v3 = 0; | |
6741 if ( v1->uActorQueueSize > 0 ) | |
6742 { | |
6743 v4 = (int)v1->pQueue; | |
6744 do | |
6745 { | |
6746 v2 = *(int *)v4; | |
848 | 6747 if ( PID_TYPE(*(char *)v4) == OBJECT_Player || *(int *)(v4 + 4) > 0 ) |
0 | 6748 break; |
6749 if ( *(int *)(v4 + 8) <= 0 ) | |
6750 { | |
6751 LOWORD(v2) = v2 & 3; | |
6752 if ( (char)v2 == 3 ) | |
6753 LOWORD(v2) = v1->_40680F(v3); | |
6754 } | |
6755 ++v3; | |
6756 v4 += 16; | |
6757 } | |
6758 while ( v3 < v1->uActorQueueSize ); | |
6759 } | |
6760 } | |
6761 v5 = 0; | |
6762 if ( v1->uActorQueueSize > 0 ) | |
6763 { | |
6764 do | |
322 | 6765 v1->_406648(v5++); |
0 | 6766 while ( (signed int)v5 < v1->uActorQueueSize ); |
6767 } | |
6768 } | |
6769 | |
6770 //----- (00406648) -------------------------------------------------------- | |
322 | 6771 void stru262_TurnBased::_406648(unsigned int a2) |
0 | 6772 { |
6773 TurnBased_QueueElem *v1; // ecx@1 | |
6774 int v3; // eax@1 | |
6775 unsigned int v4; // ebx@2 | |
6776 Actor *v5; // esi@2 | |
6777 signed int v6; // edi@5 | |
6778 int v7; // ecx@6 | |
6779 int v8; // eax@6 | |
6780 int v9; // eax@7 | |
6781 int v10; // eax@8 | |
6782 int v11; // eax@9 | |
6783 int v12; // eax@10 | |
6784 int v13; // eax@11 | |
6785 int v14; // eax@14 | |
6786 unsigned int v15; // ecx@14 | |
6787 unsigned int v16; // edx@14 | |
6788 int v17; // eax@17 | |
6789 int v18; // eax@20 | |
6790 char v19; // al@24 | |
6791 unsigned int v21; // [sp-8h] [bp-50h]@16 | |
6792 int v22; // [sp-8h] [bp-50h]@17 | |
6793 AIDirection *v23; // [sp-4h] [bp-4Ch]@14 | |
6794 unsigned int v24; // [sp-4h] [bp-4Ch]@17 | |
6795 char v25; // [sp-4h] [bp-4Ch]@20 | |
6796 AIDirection a3; // [sp+Ch] [bp-3Ch]@2 | |
6797 AIDirection a4; // [sp+28h] [bp-20h]@2 | |
6798 TurnBased_QueueElem *v28; // [sp+44h] [bp-4h]@1 | |
6799 unsigned int a2a; // [sp+50h] [bp+8h]@2 | |
6800 | |
6801 v1 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); | |
6802 v28 = v1; | |
6803 v3 = v1->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6804 if (PID_TYPE(v1->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6805 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6806 v4 = PID_ID(v3); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6807 a2a = ai_near_actors_targets_pid[PID_ID(v3)]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6808 memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0), sizeof(a3)); |
0 | 6809 memcpy(&a4, &a3, sizeof(a4)); |
848 | 6810 v5 = &pActors[PID_ID(v3)]; |
0 | 6811 LOWORD(v3) = v5->uAIState; |
6812 if ( (short)v3 != Dead ) | |
6813 { | |
6814 if ( (short)v3 != Disabled ) | |
6815 { | |
6816 if ( (short)v3 != Removed ) | |
6817 { | |
6818 v6 = v5->uCurrentActionLength; | |
6819 v5->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
6820 if ( (signed int)v5->uCurrentActionTime >= v6 ) | |
6821 { | |
6822 v7 = (signed __int16)v3; | |
6823 v8 = (signed __int16)v3 - 2; | |
6824 if ( !v8 ) | |
6825 { | |
6826 v19 = stru_50C198.special_ability_use_check(&pActors[v4], v4); | |
6827 stru_50FE08.Add( | |
6828 v28->uPackedID, | |
6829 5120, | |
6830 v5->vPosition.x, | |
6831 v5->vPosition.y, | |
6832 v5->vPosition.z + ((signed int)v5->uActorHeight >> 1), | |
6833 v19, | |
6834 1); | |
6835 goto LABEL_25; | |
6836 } | |
6837 v9 = v8 - 1; | |
6838 if ( v9 ) | |
6839 { | |
6840 v10 = v9 - 1; | |
6841 if ( !v10 ) | |
6842 goto LABEL_21; | |
6843 v11 = v10 - 4; | |
6844 if ( !v11 ) | |
6845 goto LABEL_25; | |
6846 v12 = v11 - 4; | |
6847 if ( v12 ) | |
6848 { | |
6849 v13 = v12 - 1; | |
6850 if ( v13 ) | |
6851 { | |
6852 if ( v13 != Dead ) | |
6853 { | |
6854 if ( v7 != 4 ) | |
6855 { | |
6856 v14 = rand(); | |
6857 v15 = v4; | |
6858 v23 = &a4; | |
6859 v16 = a2a; | |
6860 if ( !(v14 % 2) ) | |
6861 { | |
414 | 6862 Actor::AI_Bored(v4, a2a, &a4); |
322 | 6863 return; |
0 | 6864 } |
6865 v21 = 64; | |
6866 LABEL_26: | |
413 | 6867 Actor::AI_Stand(v15, v16, v21, v23); |
322 | 6868 return; |
0 | 6869 } |
6870 LABEL_21: | |
6871 v5->uCurrentActionTime = 0; | |
6872 v5->uCurrentActionLength = 0; | |
6873 v5->uAIState = Dead; | |
322 | 6874 pActors[v4].UpdateAnimation(); |
6875 return; | |
0 | 6876 } |
6877 v24 = v5->pMonsterInfo.uSpellSkillAndMastery2; | |
6878 v22 = 3; | |
6879 v17 = v5->pMonsterInfo.uSpell2ID; | |
6880 } | |
6881 else | |
6882 { | |
6883 v24 = v5->pMonsterInfo.uSpellSkillAndMastery1; | |
6884 v22 = 2; | |
6885 v17 = v5->pMonsterInfo.uSpell1ID; | |
6886 } | |
860 | 6887 Actor::SpellAttack(v4, &a4, v17, v22, v24); |
0 | 6888 LABEL_25: |
6889 v16 = a2a; | |
6890 v23 = &a4; | |
6891 v21 = 0; | |
6892 v15 = v4; | |
6893 goto LABEL_26; | |
6894 } | |
6895 v18 = v5->pMonsterInfo.uMissleAttack2Type; | |
6896 v25 = 1; | |
6897 } | |
6898 else | |
6899 { | |
6900 v18 = v5->pMonsterInfo.uMissleAttack1Type; | |
6901 v25 = 0; | |
6902 } | |
860 | 6903 Actor::RangedAttack(v4, &a4, v18, v25); |
0 | 6904 goto LABEL_25; |
6905 } | |
6906 } | |
6907 } | |
6908 } | |
6909 } | |
6910 } | |
6911 // 50FE08: using guessed type stru298 stru_50FE08; | |
6912 | |
6913 //----- (0040680F) -------------------------------------------------------- | |
6914 __int16 stru262_TurnBased::_40680F(int a2) | |
6915 { | |
6916 TurnBased_QueueElem *v2; // eax@1 | |
848 | 6917 unsigned int v3; // eax@1 |
6918 unsigned int v4; // edi@2 | |
0 | 6919 Actor *v5; // ebx@2 |
6920 unsigned int *v6; // esi@7 | |
6921 AIDirection *v7; // esi@10 | |
6922 int v8; // eax@10 | |
6923 unsigned int v9; // ecx@10 | |
6924 signed int v10; // eax@13 | |
6925 unsigned __int8 v11; // sf@19 | |
6926 unsigned __int8 v12; // of@19 | |
6927 int v13; // esi@29 | |
6928 bool v14; // eax@29 | |
6929 unsigned __int8 v15; // cl@33 | |
6930 AIDirection a3; // [sp+Ch] [bp-44h]@10 | |
6931 AIDirection v18; // [sp+28h] [bp-28h]@10 | |
6932 int a2a; // [sp+44h] [bp-Ch]@2 | |
6933 unsigned int v20; // [sp+48h] [bp-8h]@10 | |
6934 TurnBased_QueueElem *v21; // [sp+4Ch] [bp-4h]@1 | |
6935 signed int v22; // [sp+58h] [bp+8h]@10 | |
6936 | |
6937 v2 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); | |
6938 v21 = v2; | |
6939 v2->uActionLength = 0; | |
848 | 6940 v3 = v2->uPackedID; |
0 | 6941 if ( (unsigned __int8)v3 & 3 ) |
6942 { | |
848 | 6943 v3 = PID_ID(v3); |
0 | 6944 v4 = v3; |
848 | 6945 a2a = v3; |
6946 v5 = &pActors[v3]; | |
0 | 6947 LOWORD(v3) = v5->uAIState; |
6948 if ( (short)v3 != 5 ) | |
6949 { | |
6950 if ( (short)v3 != 4 && (short)v3 != 11 && (short)v3 != 19 && (short)v3 != 17 ) | |
6951 { | |
417 | 6952 v6 = (unsigned int *)&ai_near_actors_targets_pid[(int)v4]; |
6953 Actor::_SelectTarget((unsigned int)v4, &ai_near_actors_targets_pid[(int)v4], true); | |
0 | 6954 if ( v5->pMonsterInfo.uHostilityType && !*v6 ) |
6955 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
6956 v22 = *v6; | |
862 | 6957 v7 = Actor::GetDirectionInfo(PID(OBJECT_Actor,(int)v4), *v6, &a3, 0); |
0 | 6958 v8 = v5->uActorRadius; |
6959 memcpy(&a3, v7, sizeof(a3)); | |
6960 memcpy(&v18, &a3, sizeof(v18)); | |
6961 v9 = a3.uDistance - v8; | |
6962 v20 = a3.uDistance - v8; | |
6963 if ( ((a3.uDistance - v8) & 0x80000000u) != 0 ) | |
6964 { | |
6965 v9 = 0; | |
6966 v20 = 0; | |
6967 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6968 if (PID_TYPE(v22) == OBJECT_Actor) |
848 | 6969 v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3); |
0 | 6970 else |
6971 v10 = 4; | |
6972 if ( v10 == 1 ) | |
6973 { | |
6974 if ( (double)(signed int)v20 < 307.2 ) | |
6975 goto LABEL_25; | |
6976 } | |
6977 else | |
6978 { | |
6979 if ( v10 == 2 ) | |
6980 { | |
6981 v12 = __OFSUB__(v9, 1024); | |
6982 v11 = ((v9 - 1024) & 0x80000000u) != 0; | |
6983 } | |
6984 else | |
6985 { | |
6986 if ( v10 == 3 ) | |
6987 { | |
6988 v12 = __OFSUB__(v9, 2560); | |
6989 v11 = ((v9 - 2560) & 0x80000000u) != 0; | |
6990 } | |
6991 else | |
6992 { | |
6993 if ( v10 != 4 ) | |
6994 goto LABEL_26; | |
6995 v12 = __OFSUB__(v9, 5120); | |
6996 v11 = ((v9 - 5120) & 0x80000000u) != 0; | |
6997 } | |
6998 } | |
6999 if ( v11 ^ v12 ) | |
7000 { | |
7001 LABEL_25: | |
7002 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
7003 goto LABEL_26; | |
7004 } | |
7005 } | |
7006 LABEL_26: | |
7007 if ( v5->pMonsterInfo.uHostilityType != 4 || !v22 || (signed int)v9 >= 5120 ) | |
7008 { | |
7009 v13 = a2a; | |
7010 goto LABEL_47; | |
7011 } | |
7012 v13 = a2a; | |
7013 v14 = stru_50C198.special_ability_use_check(v5, a2a); | |
7014 if ( v14 == 1 ) | |
7015 { | |
7016 if ( v5->pMonsterInfo.uMissleAttack2Type ) | |
7017 { | |
861 | 7018 Actor::MissileAttack2(v13, v22, &v18); |
0 | 7019 goto LABEL_43; |
7020 } | |
7021 } | |
7022 else | |
7023 { | |
7024 if ( v14 > 1 && v14 <= 3 ) | |
7025 { | |
7026 if ( v14 == 2 ) | |
7027 v15 = v5->pMonsterInfo.uSpell1ID; | |
7028 else | |
7029 v15 = v5->pMonsterInfo.uSpell2ID; | |
7030 if ( v15 ) | |
7031 { | |
7032 if ( v14 == 2 ) | |
861 | 7033 Actor::SpellAttack1(v13, v22, &v18); |
0 | 7034 else |
861 | 7035 Actor::SpellAttack2(v13, v22, &v18); |
0 | 7036 goto LABEL_43; |
7037 } | |
7038 goto LABEL_44; | |
7039 } | |
7040 if ( v5->pMonsterInfo.uMissleAttack1Type ) | |
7041 { | |
861 | 7042 Actor::MissileAttack1(v13, v22, &v18); |
0 | 7043 LABEL_43: |
848 | 7044 //v3 = v21; |
0 | 7045 v21->field_C = 1; |
7046 LABEL_48: | |
848 | 7047 v21->uActionLength = v5->uCurrentActionLength; |
7048 //return (signed __int16)v3; | |
7049 return (signed __int16)&v21; | |
0 | 7050 } |
7051 } | |
7052 LABEL_44: | |
7053 if ( (double)(signed int)v20 < 307.2 ) | |
7054 { | |
861 | 7055 Actor::MeleeAttack(v13, v22, &v18); |
848 | 7056 //v3 = v21; |
0 | 7057 v21->field_C = 3; |
7058 goto LABEL_48; | |
7059 } | |
7060 LABEL_47: | |
413 | 7061 Actor::AI_Stand(v13, v22, 0x40u, &v18); |
848 | 7062 //v3 = v21; |
0 | 7063 v21->field_C = 0; |
7064 goto LABEL_48; | |
7065 } | |
7066 } | |
7067 } | |
7068 return (signed __int16)v3; | |
7069 } | |
7070 | |
7071 //----- (00406A63) -------------------------------------------------------- | |
7072 void stru262_TurnBased::_406A63() | |
7073 { | |
7074 stru262_TurnBased *v1; // ebx@1 | |
7075 int v2; // esi@1 | |
7076 unsigned __int8 v3; // zf@1 | |
7077 unsigned __int8 v4; // sf@1 | |
7078 signed int v5; // ecx@4 | |
7079 AIDirection a3; // [sp+8h] [bp-44h]@5 | |
7080 AIDirection v7; // [sp+24h] [bp-28h]@5 | |
7081 unsigned int v8; // [sp+40h] [bp-Ch]@5 | |
7082 signed int a2; // [sp+44h] [bp-8h]@1 | |
7083 TurnBased_QueueElem *v10; // [sp+48h] [bp-4h]@2 | |
7084 | |
7085 v1 = this; | |
7086 v2 = 0; | |
7087 this->field_8 = 64; | |
7088 dword_50C994 = 0; | |
7089 uActiveCharacter = 0; | |
7090 v3 = this->uActorQueueSize == 0; | |
7091 v4 = this->uActorQueueSize < 0; | |
7092 a2 = 0; | |
7093 if ( !(v4 | v3) ) | |
7094 { | |
7095 v10 = this->pQueue; | |
7096 while ( 1 ) | |
7097 { | |
7098 v5 = v10->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7099 if (PID_TYPE(v10->uPackedID) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7100 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7101 v8 = ai_near_actors_targets_pid[PID_ID(v5)]; |
0 | 7102 memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7)); |
7103 if ( !v1->_406D10(a2) ) | |
848 | 7104 Actor::AI_Stand(PID_ID(v10->uPackedID), v8, 0x20u, &v7); |
0 | 7105 } |
7106 ++a2; | |
7107 ++v10; | |
7108 if ( a2 >= v1->uActorQueueSize ) | |
7109 break; | |
7110 v2 = 0; | |
7111 } | |
7112 } | |
7113 } | |
7114 // 50C994: using guessed type int dword_50C994; | |
7115 | |
7116 //----- (00406AFE) -------------------------------------------------------- | |
7117 void stru262_TurnBased::_406AFE() | |
7118 { | |
7119 stru262_TurnBased *v1; // edi@1 | |
7120 TurnBased_QueueElem *v2; // ebx@2 | |
7121 int v3; // esi@4 | |
7122 int v4; // ecx@5 | |
7123 AIDirection a3; // [sp+4h] [bp-48h]@5 | |
7124 AIDirection v6; // [sp+20h] [bp-2Ch]@5 | |
7125 stru262_TurnBased *v7; // [sp+3Ch] [bp-10h]@1 | |
7126 unsigned int v8; // [sp+40h] [bp-Ch]@4 | |
7127 unsigned int v9; // [sp+44h] [bp-8h]@5 | |
7128 int v10; // [sp+48h] [bp-4h]@1 | |
7129 | |
7130 v10 = 0; | |
7131 v1 = this; | |
7132 v7 = this; | |
7133 if ( this->uActorQueueSize > 0 ) | |
7134 { | |
7135 v2 = this->pQueue; | |
7136 do | |
7137 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7138 if (PID_TYPE(v2->uPackedID) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7139 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7140 v3 = PID_ID(v2->uPackedID); |
0 | 7141 v8 = v3; |
7142 if ( pActors[v3].CanAct() ) | |
7143 { | |
7144 v4 = v2->uPackedID; | |
417 | 7145 v9 = ai_near_actors_targets_pid[v3]; |
0 | 7146 memcpy(&v6, Actor::GetDirectionInfo(v4, v9, &a3, 0), sizeof(v6)); |
413 | 7147 Actor::AI_Stand(v8, v9, 0x20u, &v6); |
0 | 7148 v2->field_C = 0; |
7149 v2->uActionLength = 0; | |
7150 v1 = v7; | |
7151 } | |
7152 } | |
7153 ++v10; | |
7154 ++v2; | |
7155 } | |
7156 while ( v10 < v1->uActorQueueSize ); | |
7157 } | |
7158 v1->field_4 = 2; | |
7159 v1->field_8 = 100; | |
7160 } | |
7161 | |
7162 //----- (00406B9F) -------------------------------------------------------- | |
7163 int stru262_TurnBased::_406B9F() | |
7164 { | |
7165 signed int result; // eax@1 | |
7166 unsigned __int8 v2; // zf@1 | |
7167 unsigned __int8 v3; // sf@1 | |
7168 int v4; // esi@4 | |
7169 unsigned int v5; // esi@5 | |
7170 Actor *v6; // ebx@5 | |
7171 unsigned __int16 v7; // cx@15 | |
7172 AIDirection a3; // [sp+0h] [bp-50h]@15 | |
7173 AIDirection v9; // [sp+1Ch] [bp-34h]@15 | |
7174 signed int a1; // [sp+38h] [bp-18h]@4 | |
7175 stru262_TurnBased *thisa; // [sp+3Ch] [bp-14h]@1 | |
7176 unsigned int v12; // [sp+40h] [bp-10h]@5 | |
7177 unsigned int v13; // [sp+44h] [bp-Ch]@8 | |
7178 TurnBased_QueueElem *v14; // [sp+48h] [bp-8h]@2 | |
7179 signed int a2; // [sp+4Ch] [bp-4h]@1 | |
7180 | |
7181 result = 0; | |
7182 thisa = this; | |
7183 v2 = this->uActorQueueSize == 0; | |
7184 v3 = this->uActorQueueSize < 0; | |
7185 a2 = 0; | |
7186 if ( !(v3 | v2) ) | |
7187 { | |
7188 v14 = this->pQueue; | |
7189 while ( 1 ) | |
7190 { | |
7191 v4 = v14->uPackedID; | |
7192 a1 = v14->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7193 if (PID_TYPE(a1) != OBJECT_Player) |
0 | 7194 { |
848 | 7195 v5 = PID_ID(v4); |
0 | 7196 v12 = v5; |
7197 v6 = &pActors[v5]; | |
7198 if ( SHIDWORD(v6->pActorBuffs[5].uExpireTime) < result | |
7199 || SHIDWORD(v6->pActorBuffs[5].uExpireTime) <= result && LODWORD(v6->pActorBuffs[5].uExpireTime) <= result ) | |
7200 v13 = result; | |
7201 else | |
7202 v13 = 1; | |
7203 if ( SHIDWORD(v6->pActorBuffs[6].uExpireTime) >= result | |
7204 && (SHIDWORD(v6->pActorBuffs[6].uExpireTime) > result || LODWORD(v6->pActorBuffs[6].uExpireTime) > result) ) | |
7205 result = 1; | |
7206 if ( !(v13 | result | v6->uAIState == 5 | v6->uAIState == 11 | v6->uAIState == 19) ) | |
7207 { | |
417 | 7208 v13 = ai_near_actors_targets_pid[v5]; |
0 | 7209 memcpy(&v9, Actor::GetDirectionInfo(a1, v13, &a3, 0), sizeof(v9)); |
7210 v7 = v6->uAIState; | |
7211 if ( v7 == 6 || v7 == 1 ) | |
7212 { | |
7213 if ( (double)(signed int)v9.uDistance < 307.2 ) | |
7214 goto LABEL_26; | |
7215 } | |
7216 v6->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
7217 if ( (signed int)v6->uCurrentActionTime > v6->uCurrentActionLength ) | |
7218 { | |
7219 if ( v7 == 4 ) | |
7220 { | |
7221 v6->uCurrentActionTime = 0; | |
7222 v6->uCurrentActionLength = 0; | |
7223 v6->uAIState = Dead; | |
7224 v6->UpdateAnimation(); | |
7225 } | |
7226 if ( !thisa->_406D10(a2) ) | |
7227 LABEL_26: | |
413 | 7228 Actor::AI_Stand(v12, v13, 0x20u, &v9); |
0 | 7229 } |
7230 } | |
7231 } | |
7232 ++a2; | |
7233 result = (signed int)thisa; | |
7234 ++v14; | |
7235 if ( a2 >= thisa->uActorQueueSize ) | |
7236 break; | |
7237 result = 0; | |
7238 } | |
7239 } | |
7240 return result; | |
7241 } | |
7242 | |
7243 //----- (00406D10) -------------------------------------------------------- | |
7244 bool stru262_TurnBased::_406D10(signed int a2) | |
7245 { | |
7246 int v2; // ecx@1 | |
920 | 7247 //int v3; // ecx@2 |
7248 Actor *actor; // ebx@2 | |
7249 //unsigned __int16 v5; // dx@2 | |
0 | 7250 int *v6; // esi@7 |
7251 TurnBased_QueueElem *v7; // edi@7 | |
7252 int v8; // eax@7 | |
7253 AIDirection *v9; // esi@10 | |
7254 int v10; // eax@10 | |
7255 unsigned int v11; // ecx@10 | |
920 | 7256 unsigned __int8 pHostileType; // al@12 |
0 | 7257 unsigned __int8 v13; // sf@16 |
7258 unsigned __int8 v14; // of@16 | |
7259 unsigned int v15; // edx@22 | |
7260 unsigned int v16; // ecx@23 | |
7261 TurnBased_QueueElem *v17; // eax@25 | |
7262 double v18; // st7@33 | |
7263 double v19; // st6@33 | |
7264 int v21; // [sp-8h] [bp-5Ch]@23 | |
7265 int v22; // [sp-8h] [bp-5Ch]@26 | |
7266 AIDirection *v23; // [sp-4h] [bp-58h]@23 | |
7267 int v24; // [sp-4h] [bp-58h]@26 | |
7268 AIDirection a3; // [sp+Ch] [bp-48h]@10 | |
7269 AIDirection pDir; // [sp+28h] [bp-2Ch]@10 | |
7270 int v27; // [sp+44h] [bp-10h]@33 | |
7271 unsigned int v28; // [sp+48h] [bp-Ch]@10 | |
7272 TurnBased_QueueElem *v29; // [sp+4Ch] [bp-8h]@7 | |
7273 unsigned int uActorID; // [sp+50h] [bp-4h]@2 | |
7274 unsigned int a2a; // [sp+5Ch] [bp+8h]@7 | |
7275 | |
920 | 7276 __debugbreak();// |
0 | 7277 v2 = *(&this->field_0 + 4 * (a2 + 2)); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7278 if (PID_TYPE(v2) == OBJECT_Player) |
0 | 7279 return 0; |
920 | 7280 uActorID = PID_ID(v2); |
7281 //uActorID = v3; | |
7282 actor = &pActors[uActorID]; | |
7283 //v5 = v4->uAIState; | |
7284 if ( actor->uAIState == 5 || actor->uAIState == 4 || actor->uAIState == 11 || actor->uAIState == 19 || actor->uAIState == 17 ) | |
0 | 7285 return 1; |
920 | 7286 v6 = &ai_near_actors_targets_pid[uActorID]; |
0 | 7287 v7 = &pTurnEngine->pQueue[a2]; |
7288 v8 = *v6; | |
7289 v29 = &pTurnEngine->pQueue[a2]; | |
7290 a2a = v8; | |
920 | 7291 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true); |
7292 if ( actor->pMonsterInfo.uHostilityType && !*v6 ) | |
7293 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
0 | 7294 v9 = Actor::GetDirectionInfo(v7->uPackedID, a2a, &a3, 0); |
920 | 7295 v10 = actor->uActorRadius; |
0 | 7296 memcpy(&a3, v9, sizeof(a3)); |
7297 memcpy(&pDir, &a3, sizeof(pDir)); | |
7298 v11 = a3.uDistance - v10; | |
7299 v28 = a3.uDistance - v10; | |
7300 if ( ((a3.uDistance - v10) & 0x80000000u) != 0 ) | |
7301 { | |
7302 v11 = 0; | |
7303 v28 = 0; | |
7304 } | |
920 | 7305 pHostileType = actor->pMonsterInfo.uHostilityType; |
7306 if ( pHostileType == 1 ) | |
0 | 7307 { |
7308 if ( (double)(signed int)v28 >= 307.2 ) | |
7309 goto LABEL_21; | |
920 | 7310 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
0 | 7311 goto LABEL_21; |
7312 } | |
920 | 7313 if ( pHostileType == 2 ) |
0 | 7314 { |
7315 v14 = __OFSUB__(v11, 1024); | |
7316 v13 = ((v11 - 1024) & 0x80000000u) != 0; | |
7317 } | |
7318 else | |
7319 { | |
920 | 7320 if ( pHostileType != 3 ) |
0 | 7321 goto LABEL_21; |
7322 v14 = __OFSUB__(v11, 2560); | |
7323 v13 = ((v11 - 2560) & 0x80000000u) != 0; | |
7324 } | |
7325 if ( v13 ^ v14 ) | |
920 | 7326 { |
7327 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
7328 } | |
0 | 7329 LABEL_21: |
920 | 7330 if ( (signed __int64)actor->pActorBuffs[4].uExpireTime > 0 ) |
7331 { | |
0 | 7332 if ( (signed int)v11 < 10240 ) |
7333 { | |
920 | 7334 Actor::Flee(uActorID, a2a, 0, &pDir); |
7335 v29->field_C = 4; | |
7336 v29->uActionLength = actor->uCurrentActionLength; | |
7337 return 1; | |
7338 } | |
7339 Actor::_4032B2(uActorID, a2a, 1024, 0); | |
7340 v29->field_C = 2; | |
7341 v29->uActionLength = actor->uCurrentActionLength; | |
7342 return 1; | |
7343 } | |
7344 if ( actor->pMonsterInfo.uHostilityType != 4 ) | |
0 | 7345 goto LABEL_46; |
920 | 7346 if ( !(actor->uAttributes & 0x020000) || actor->pMonsterInfo.uAIType == 1 ) |
7347 { | |
7348 if ( actor->pMonsterInfo.uAIType == 1 ) | |
7349 { | |
7350 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
7351 { | |
7352 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7353 v29->field_C = 4; | |
7354 v29->uActionLength = actor->uCurrentActionLength; | |
7355 return 1; | |
7356 } | |
7357 Actor::Flee(uActorID, a2a, 32, 0); | |
7358 v29->field_C = 4; | |
7359 v29->uActionLength = actor->uCurrentActionLength; | |
7360 return 1; | |
7361 } | |
7362 if ( actor->pMonsterInfo.uAIType == 2 ) | |
7363 { | |
7364 v27 = actor->sCurrentHP; | |
0 | 7365 v18 = (double)v27; |
920 | 7366 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.2; |
0 | 7367 if ( v19 > v18 && (signed int)v11 < 10240 ) |
7368 { | |
920 | 7369 if ( actor->pMonsterInfo.uMovementType == 5 ) |
7370 { | |
7371 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7372 v29->field_C = 4; | |
7373 v29->uActionLength = actor->uCurrentActionLength; | |
7374 return 1; | |
7375 } | |
7376 Actor::Flee(uActorID, a2a, 32, 0); | |
0 | 7377 v29->field_C = 4; |
920 | 7378 v29->uActionLength = actor->uCurrentActionLength; |
7379 return 1; | |
7380 } | |
7381 goto LABEL_39; | |
7382 } | |
7383 if ( actor->pMonsterInfo.uAIType == 3 ) | |
7384 { | |
7385 v27 = actor->sCurrentHP; | |
7386 v18 = (double)v27; | |
7387 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.1; | |
7388 if ( v19 > v18 && (signed int)v11 < 10240 ) | |
7389 { | |
7390 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
7391 { | |
7392 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7393 v29->field_C = 4; | |
7394 v29->uActionLength = actor->uCurrentActionLength; | |
7395 return 1; | |
7396 } | |
7397 Actor::Flee(uActorID, a2a, 32, 0); | |
7398 v29->field_C = 4; | |
7399 v29->uActionLength = actor->uCurrentActionLength; | |
0 | 7400 return 1; |
7401 } | |
7402 goto LABEL_39; | |
7403 } | |
7404 } | |
7405 LABEL_39: | |
7406 if ( (double)(signed int)v28 < 307.2 ) | |
7407 return 0; | |
7408 if ( (signed int)v11 < 5120 ) | |
7409 { | |
920 | 7410 if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 ) |
860 | 7411 Actor::Pursue1(uActorID, a2a, uActorID, 32, &pDir); |
0 | 7412 else |
860 | 7413 Actor::Pursue2(uActorID, a2a, 32, &pDir, 307); |
920 | 7414 v29->field_C = 2; |
7415 v29->uActionLength = actor->uCurrentActionLength; | |
7416 return 1; | |
0 | 7417 } |
7418 LABEL_46: | |
920 | 7419 if ( !actor->pMonsterInfo.uMovementType ) |
7420 { | |
7421 Actor::_4032B2(uActorID, a2a, 1024, 32); | |
7422 v29->field_C = 2; | |
7423 v29->uActionLength = actor->uCurrentActionLength; | |
7424 return 1; | |
7425 } | |
7426 if ( actor->pMonsterInfo.uMovementType == 1 ) | |
7427 { | |
7428 Actor::_4032B2(uActorID, a2a, 2560, 32); | |
0 | 7429 v29->field_C = 2; |
920 | 7430 v29->uActionLength = actor->uCurrentActionLength; |
7431 return 1; | |
7432 } | |
7433 if ( actor->pMonsterInfo.uMovementType == 2 ) | |
7434 { | |
7435 Actor::_4032B2(uActorID, a2a, 5120, 32); | |
7436 v29->field_C = 2; | |
7437 v29->uActionLength = actor->uCurrentActionLength; | |
7438 return 1; | |
7439 } | |
7440 if ( actor->pMonsterInfo.uMovementType == 4 ) | |
0 | 7441 { |
7442 Actor::_4032B2(uActorID, a2a, 10240, 32); | |
7443 v29->field_C = 2; | |
920 | 7444 v29->uActionLength = actor->uCurrentActionLength; |
7445 return 1; | |
7446 } | |
7447 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
7448 { | |
7449 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7450 v29->field_C = 2; | |
7451 v29->uActionLength = actor->uCurrentActionLength; | |
7452 return 1; | |
0 | 7453 } |
7454 return 1; | |
7455 } | |
7456 | |
7457 //----- (00406FA8) -------------------------------------------------------- | |
7458 void stru262_TurnBased::_406FA8() | |
7459 { | |
7460 unsigned __int8 v1; // zf@1 | |
7461 unsigned __int8 v2; // sf@1 | |
7462 TurnBased_QueueElem *v3; // edi@2 | |
7463 int v4; // eax@4 | |
7464 Actor *v5; // ebx@4 | |
7465 unsigned __int16 v6; // cx@4 | |
7466 unsigned int *v7; // edx@8 | |
7467 unsigned int v8; // esi@8 | |
7468 unsigned __int8 v9; // of@13 | |
7469 AIDirection a3; // [sp+Ch] [bp-6Ch]@8 | |
7470 AIDirection v11; // [sp+28h] [bp-50h]@8 | |
7471 AIDirection a4; // [sp+44h] [bp-34h]@8 | |
7472 stru262_TurnBased *v13; // [sp+60h] [bp-18h]@1 | |
7473 TurnBased_QueueElem *v14; // [sp+64h] [bp-14h]@2 | |
7474 int uActorID; // [sp+68h] [bp-10h]@4 | |
7475 unsigned int a2; // [sp+6Ch] [bp-Ch]@8 | |
7476 int v17; // [sp+70h] [bp-8h]@1 | |
7477 unsigned int v18; // [sp+74h] [bp-4h]@2 | |
7478 | |
7479 v17 = 0; | |
7480 v1 = this->uActorQueueSize == 0; | |
7481 v2 = this->uActorQueueSize < 0; | |
7482 v13 = this; | |
7483 if ( !(v2 | v1) ) | |
7484 { | |
7485 v3 = this->pQueue; | |
7486 v18 = (char *)&pTurnEngine - (char *)this; | |
7487 v14 = this->pQueue; | |
7488 do | |
7489 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7490 if (PID_TYPE(v3->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7491 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7492 v4 = PID_ID(v3->uPackedID); |
0 | 7493 uActorID = v4; |
7494 v5 = &pActors[v4]; | |
7495 v6 = v5->uAIState; | |
7496 if ( v6 != 5 ) | |
7497 { | |
7498 if ( v6 != 11 ) | |
7499 { | |
7500 if ( v6 != 19 ) | |
7501 { | |
7502 if ( v6 != 17 ) | |
7503 { | |
417 | 7504 v7 = (unsigned int *)&ai_near_actors_targets_pid[v4]; |
0 | 7505 a2 = *v7; |
7506 v8 = a2; | |
417 | 7507 Actor::_SelectTarget(v4, (int *)v7, true); |
0 | 7508 memcpy(&v11, Actor::GetDirectionInfo(*(int *)((char *)&v3->uPackedID + v18), v8, &a3, 0), sizeof(v11)); |
7509 memcpy(&a4, &v11, sizeof(a4)); | |
7510 v5->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
7511 if ( (signed int)v5->uCurrentActionTime >= v5->uCurrentActionLength ) | |
7512 { | |
7513 if (v5->uAIState == Dying) | |
7514 { | |
7515 v5->uCurrentActionTime = 0; | |
7516 v5->uCurrentActionLength = 0; | |
7517 v5->uAIState = Dead; | |
7518 v5->UpdateAnimation(); | |
7519 return; | |
7520 } | |
7521 if ( rand() % 2 ) | |
413 | 7522 Actor::AI_Stand(uActorID, a2, 0x40u, &a4); |
0 | 7523 else |
414 | 7524 Actor::AI_Bored(uActorID, a2, &a4); |
0 | 7525 } |
7526 } | |
7527 } | |
7528 } | |
7529 } | |
7530 } | |
7531 ++v17; | |
7532 v3 = v14 + 1; | |
7533 v9 = __OFSUB__(v17, v13->uActorQueueSize); | |
7534 v2 = v17 - v13->uActorQueueSize < 0; | |
7535 ++v14; | |
7536 } | |
7537 while ( v2 ^ v9 ); | |
7538 } | |
7539 } | |
7540 | |
7541 //----- (004070EF) -------------------------------------------------------- | |
7542 bool __fastcall sub_4070EF_prolly_collide_objects(unsigned int uObjID, unsigned int uObj2ID) | |
7543 { | |
7544 signed int v2; // eax@1 | |
7545 unsigned int v3; // ecx@1 | |
7546 signed int v4; // esi@1 | |
7547 int v5; // ecx@2 | |
7548 signed int v6; // eax@4 | |
7549 int v7; // eax@4 | |
7550 float v8; // ST24_4@5 | |
7551 double v9; // ST18_8@5 | |
7552 signed int v10; // eax@6 | |
7553 int v11; // ecx@6 | |
7554 signed int v12; // eax@7 | |
7555 int v13; // esi@7 | |
7556 int v14; // esi@8 | |
7557 int v15; // esi@9 | |
7558 signed int v16; // eax@11 | |
7559 int v17; // edi@11 | |
7560 int v18; // esi@11 | |
7561 int v19; // eax@13 | |
7562 float v20; // ST24_4@14 | |
7563 double v21; // ST18_8@14 | |
7564 signed int v22; // eax@15 | |
7565 int v23; // ebx@16 | |
7566 signed int v24; // ecx@16 | |
7567 int v25; // eax@18 | |
7568 int v26; // eax@28 | |
7569 BLVSector *v27; // edx@31 | |
7570 int v28; // ecx@31 | |
7571 BLVFace *v29; // ebx@32 | |
7572 Vec3_short_ *v30; // esi@32 | |
7573 int v31; // eax@32 | |
7574 int v32; // ST50_4@44 | |
7575 int v33; // ST54_4@44 | |
7576 int v34; // eax@44 | |
7577 char v35; // zf@44 | |
7578 int v36; // edi@44 | |
7579 int v37; // eax@45 | |
7580 signed int v38; // esi@45 | |
7581 int v39; // ST4C_4@49 | |
7582 signed __int64 v40; // qtt@50 | |
7583 __int16 v42; // bx@58 | |
7584 int v43; // [sp-8h] [bp-70h]@11 | |
7585 int v44; // [sp-4h] [bp-6Ch]@11 | |
7586 int v45; // [sp+Ch] [bp-5Ch]@32 | |
7587 __int16 v46; // [sp+10h] [bp-58h]@32 | |
7588 int v47; // [sp+18h] [bp-50h]@20 | |
7589 int v48; // [sp+1Ch] [bp-4Ch]@20 | |
7590 int v49; // [sp+20h] [bp-48h]@20 | |
7591 int v50; // [sp+24h] [bp-44h]@16 | |
7592 signed int v51; // [sp+24h] [bp-44h]@27 | |
7593 signed int v52; // [sp+28h] [bp-40h]@26 | |
7594 signed int v53; // [sp+2Ch] [bp-3Ch]@23 | |
7595 signed int v54; // [sp+30h] [bp-38h]@22 | |
7596 signed int v55; // [sp+34h] [bp-34h]@21 | |
7597 signed int v56; // [sp+38h] [bp-30h]@20 | |
7598 signed int v57; // [sp+3Ch] [bp-2Ch]@28 | |
7599 int v58; // [sp+44h] [bp-24h]@50 | |
7600 int v59; // [sp+48h] [bp-20h]@44 | |
7601 int v60; // [sp+50h] [bp-18h]@11 | |
7602 signed int v61; // [sp+50h] [bp-18h]@31 | |
7603 int v62; // [sp+54h] [bp-14h]@16 | |
7604 int v63; // [sp+58h] [bp-10h]@4 | |
7605 int v64; // [sp+5Ch] [bp-Ch]@4 | |
7606 int v65; // [sp+60h] [bp-8h]@4 | |
7607 int v66; // [sp+64h] [bp-4h]@7 | |
7608 | |
848 | 7609 v2 = PID_ID(uObjID); |
7610 v3 = PID_TYPE(uObjID) - 2; | |
0 | 7611 v4 = uObj2ID; |
7612 if ( v3 ) | |
7613 { | |
7614 v5 = v3 - 1; | |
7615 if ( v5 ) | |
7616 { | |
7617 if ( v5 != 2 ) | |
7618 return 0; | |
7619 v6 = v2; | |
7620 v63 = pLevelDecorations[v6].vPosition.x; | |
7621 v64 = pLevelDecorations[v6].vPosition.y; | |
7622 v65 = pLevelDecorations[v6].vPosition.z; | |
7623 v7 = pIndoor->GetSector(v63, v64, v65); | |
7624 } | |
7625 else | |
7626 { | |
7627 v63 = pActors[v2].vPosition.x; | |
7628 v64 = pActors[v2].vPosition.y; | |
7629 v8 = (double)pActors[v2].uActorHeight * 0.69999999; | |
7630 v9 = v8 + 6.7553994e15; | |
7631 v65 = LODWORD(v9) + pActors[v2].vPosition.z; | |
7632 v7 = pActors[v2].uSectorID; | |
7633 } | |
7634 } | |
7635 else | |
7636 { | |
7637 v10 = v2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7638 v63 = pSpriteObjects[v10].vPosition.x; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7639 v64 = pSpriteObjects[v10].vPosition.y; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7640 v11 = pSpriteObjects[v10].vPosition.z; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7641 v7 = pSpriteObjects[v10].uSectorID; |
0 | 7642 v65 = v11; |
7643 } | |
7644 v66 = v7; | |
848 | 7645 v12 = PID_ID(v4); |
7646 v13 = PID_TYPE(v4) - 2; | |
0 | 7647 if ( v13 ) |
7648 { | |
7649 v14 = v13 - 1; | |
7650 if ( v14 ) | |
7651 { | |
7652 v15 = v14 - 1; | |
7653 if ( v15 ) | |
7654 { | |
7655 if ( v15 != 1 ) | |
7656 return 0; | |
7657 v16 = v12; | |
7658 v17 = pLevelDecorations[v16].vPosition.z; | |
7659 v18 = pLevelDecorations[v16].vPosition.x; | |
7660 v44 = pLevelDecorations[v16].vPosition.z; | |
7661 v60 = pLevelDecorations[v16].vPosition.y; | |
7662 v43 = pLevelDecorations[v16].vPosition.y; | |
7663 } | |
7664 else | |
7665 { | |
7666 v18 = pParty->vPosition.x; | |
7667 v17 = pParty->sEyelevel + pParty->vPosition.z; | |
7668 v60 = pParty->vPosition.y; | |
7669 v44 = pParty->sEyelevel + pParty->vPosition.z; | |
7670 v43 = pParty->vPosition.y; | |
7671 } | |
7672 v19 = pIndoor->GetSector(v18, v43, v44); | |
7673 } | |
7674 else | |
7675 { | |
7676 v60 = pActors[v12].vPosition.y; | |
7677 v18 = pActors[v12].vPosition.x; | |
7678 v20 = (double)pActors[v12].uActorHeight * 0.69999999; | |
7679 v21 = v20 + 6.7553994e15; | |
7680 v17 = LODWORD(v21) + pActors[v12].vPosition.z; | |
7681 v19 = pActors[v12].uSectorID; | |
7682 } | |
7683 } | |
7684 else | |
7685 { | |
7686 v22 = v12; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7687 v18 = pSpriteObjects[v22].vPosition.x; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7688 v17 = pSpriteObjects[v22].vPosition.z; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7689 v60 = pSpriteObjects[v22].vPosition.y; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7690 v19 = pSpriteObjects[v22].uSectorID; |
0 | 7691 } |
7692 v62 = v19; | |
7693 v23 = v18 - v63; | |
7694 v50 = v17 - v65; | |
295 | 7695 v24 = integer_sqrt(v23 * v23 + (v60 - v64) * (v60 - v64) + v50 * v50); |
0 | 7696 if ( v24 > 5120 ) |
7697 return 0; | |
7698 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
7699 return 1; | |
7700 v25 = 65536; | |
7701 if ( v24 ) | |
7702 v25 = 65536 / v24; | |
7703 v49 = v23 * v25; | |
7704 v47 = v50 * v25; | |
7705 v48 = (v60 - v64) * v25; | |
7706 v56 = v63; | |
7707 if ( v63 < v18 ) | |
7708 { | |
7709 v55 = v18; | |
7710 } | |
7711 else | |
7712 { | |
7713 v56 = v18; | |
7714 v55 = v63; | |
7715 } | |
7716 v54 = v64; | |
7717 if ( v64 < v60 ) | |
7718 { | |
7719 v53 = v60; | |
7720 } | |
7721 else | |
7722 { | |
7723 v54 = v60; | |
7724 v53 = v64; | |
7725 } | |
7726 v52 = v65; | |
7727 if ( v65 < v17 ) | |
7728 { | |
7729 v51 = v17; | |
7730 } | |
7731 else | |
7732 { | |
7733 v52 = v17; | |
7734 v51 = v65; | |
7735 } | |
7736 v57 = 0; | |
7737 v26 = v66; | |
7738 while ( 2 ) | |
7739 { | |
7740 if ( v26 == v62 ) | |
7741 return 1; | |
7742 if ( v57 >= 30 || (v27 = pIndoor->pSectors, v28 = v66, v61 = 0, pIndoor->pSectors[v66].uNumPortals <= 0) ) | |
7743 break; | |
7744 while ( 1 ) | |
7745 { | |
7746 v29 = &pIndoor->pFaces[v27[v28].pPortals[v61]]; | |
7747 v30 = &pIndoor->pVertices[*v29->pVertexIDs]; | |
7748 v45 = *(int *)&v30->x; | |
7749 v46 = v30->z; | |
7750 v31 = v29->pFacePlane_old.vNormal.z * (v46 - v65) | |
7751 + v29->pFacePlane_old.vNormal.y * (SHIWORD(v45) - v64) | |
7752 + v29->pFacePlane_old.vNormal.x * ((signed __int16)v45 - v63); | |
7753 if ( v66 != v29->uSectorID ) | |
7754 v31 = -v31; | |
7755 if ( v31 >= 0 && (signed __int16)v45 != v63 && SHIWORD(v45) != v64 && v46 != v65 | |
7756 || v56 > v29->pBounding.x2 | |
7757 || v55 < v29->pBounding.x1 | |
7758 || v54 > v29->pBounding.y2 | |
7759 || v53 < v29->pBounding.y1 | |
7760 || v52 > v29->pBounding.z2 | |
7761 || v51 < v29->pBounding.z1 ) | |
7762 goto LABEL_54; | |
7763 v32 = (unsigned __int64)(v49 * (signed __int64)v29->pFacePlane_old.vNormal.x) >> 16; | |
7764 v33 = (unsigned __int64)(v47 * (signed __int64)v29->pFacePlane_old.vNormal.z) >> 16; | |
7765 v34 = (unsigned __int64)(v48 * (signed __int64)v29->pFacePlane_old.vNormal.y) >> 16; | |
7766 v35 = v32 + v33 + v34 == 0; | |
7767 v36 = v32 + v33 + v34; | |
7768 v59 = v32 + v33 + v34; | |
7769 if ( v35 ) | |
7770 goto LABEL_53; | |
7771 v37 = v65 * v29->pFacePlane_old.vNormal.z; | |
7772 v38 = -(v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y); | |
7773 if ( v36 <= 0 ) | |
7774 break; | |
7775 if ( v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y <= 0 ) | |
7776 goto LABEL_49; | |
7777 LABEL_53: | |
7778 v27 = pIndoor->pSectors; | |
7779 LABEL_54: | |
7780 ++v61; | |
7781 if ( v61 >= v27[v28].uNumPortals ) | |
7782 goto LABEL_55; | |
7783 } | |
7784 if ( v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y < 0 ) | |
7785 goto LABEL_53; | |
7786 LABEL_49: | |
7787 v39 = abs(-(v29->pFacePlane_old.dist | |
7788 + v37 | |
7789 + v63 * v29->pFacePlane_old.vNormal.x | |
7790 + v64 * v29->pFacePlane_old.vNormal.y)) >> 14; | |
7791 if ( v39 > abs(v36) | |
7792 || (LODWORD(v40) = v38 << 16, HIDWORD(v40) = v38 >> 16, v58 = v40 / v59, (signed int)(v40 / v59) < 0) | |
7793 || !sub_4075DB( | |
7794 v63 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v49) >> 16) + 32768) >> 16), | |
7795 v64 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v48) >> 16) + 32768) >> 16), | |
7796 v65 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v47) >> 16) + 32768) >> 16), | |
7797 v29) ) | |
7798 { | |
7799 v28 = v66; | |
7800 goto LABEL_53; | |
7801 } | |
7802 if ( v29->uSectorID == v66 ) | |
7803 v42 = v29->uBackSectorID; | |
7804 else | |
7805 v42 = v29->uSectorID; | |
7806 v26 = v42; | |
7807 if ( v42 != v66 ) | |
7808 { | |
7809 ++v57; | |
7810 v66 = v42; | |
7811 continue; | |
7812 } | |
7813 break; | |
7814 } | |
7815 LABEL_55: | |
7816 if ( v66 != v62 ) | |
7817 return 0; | |
7818 return 1; | |
7819 } | |
7820 | |
7821 //----- (004075DB) -------------------------------------------------------- | |
7822 bool __fastcall sub_4075DB(int a1, int a2, int a3, BLVFace *a4) | |
7823 { | |
7824 BLVFace *v4; // eax@1 | |
7825 unsigned int v5; // esi@1 | |
7826 signed int v6; // esi@2 | |
7827 char v7; // zf@2 | |
7828 int v8; // edi@2 | |
7829 Vec3_short_ *v9; // ecx@3 | |
7830 int v10; // edx@4 | |
7831 signed int v11; // esi@7 | |
7832 Vec3_short_ *v12; // ecx@8 | |
7833 int v13; // edx@9 | |
7834 signed int v14; // esi@11 | |
7835 Vec3_short_ *v15; // ecx@12 | |
7836 int v16; // edx@13 | |
7837 int v17; // eax@14 | |
7838 bool v18; // esi@14 | |
7839 int v19; // ecx@14 | |
7840 int v20; // ecx@16 | |
7841 int v21; // edx@16 | |
7842 int v22; // eax@17 | |
7843 signed int v23; // ebx@18 | |
7844 int v24; // esi@20 | |
7845 signed int v25; // eax@22 | |
7846 signed __int64 v26; // qtt@22 | |
7847 bool result; // eax@25 | |
7848 int v28; // [sp+8h] [bp-14h]@14 | |
7849 int v29; // [sp+10h] [bp-Ch]@14 | |
7850 signed int a3a; // [sp+24h] [bp+8h]@14 | |
7851 int a4a; // [sp+28h] [bp+Ch]@2 | |
7852 | |
7853 v4 = a4; | |
7854 v5 = a4->uAttributes; | |
7855 if ( v5 & 0x100 ) | |
7856 { | |
7857 v6 = 0; | |
7858 v7 = a4->uNumVertices == 0; | |
7859 a4a = a1; | |
7860 v8 = a2; | |
7861 if ( !v7 ) | |
7862 { | |
7863 v9 = pIndoor->pVertices; | |
7864 do | |
7865 { | |
7866 dword_4F5D98_xs[v6] = v9[v4->pVertexIDs[v6]].x; | |
7867 v10 = v4->pVertexIDs[v6++]; | |
7868 dword_4F5CC4_ys[v6] = v9[v10].y; | |
7869 } | |
7870 while ( v6 < v4->uNumVertices ); | |
7871 } | |
7872 } | |
7873 else | |
7874 { | |
7875 v8 = a3; | |
7876 if ( v5 & 0x200 ) | |
7877 { | |
7878 v11 = 0; | |
7879 v7 = a4->uNumVertices == 0; | |
7880 a4a = a1; | |
7881 if ( !v7 ) | |
7882 { | |
7883 v12 = pIndoor->pVertices; | |
7884 do | |
7885 { | |
7886 dword_4F5D98_xs[v11] = v12[v4->pVertexIDs[v11]].x; | |
7887 v13 = v4->pVertexIDs[v11++]; | |
7888 dword_4F5CC4_ys[v11] = v12[v13].z; | |
7889 } | |
7890 while ( v11 < v4->uNumVertices ); | |
7891 } | |
7892 } | |
7893 else | |
7894 { | |
7895 v14 = 0; | |
7896 v7 = a4->uNumVertices == 0; | |
7897 a4a = a2; | |
7898 if ( !v7 ) | |
7899 { | |
7900 v15 = pIndoor->pVertices; | |
7901 do | |
7902 { | |
7903 dword_4F5D98_xs[v14] = v15[v4->pVertexIDs[v14]].y; | |
7904 v16 = v4->pVertexIDs[v14++]; | |
7905 dword_4F5CC4_ys[v14] = v15[v16].z; | |
7906 } | |
7907 while ( v14 < v4->uNumVertices ); | |
7908 } | |
7909 } | |
7910 } | |
7911 v17 = v4->uNumVertices; | |
7912 a3a = 0; | |
7913 dword_4F5D98_xs[v17] = dword_4F5D98_xs[0]; | |
7914 dword_4F5CC4_ys[v17 + 1] = dword_4F5CC4_ys[1]; | |
7915 v28 = v17; | |
7916 v18 = dword_4F5CC4_ys[1] >= v8; | |
7917 v19 = 0; | |
7918 v29 = 0; | |
7919 if ( v17 <= 0 ) | |
7920 goto LABEL_29; | |
7921 do | |
7922 { | |
7923 if ( a3a >= 2 ) | |
7924 break; | |
7925 v20 = v19; | |
7926 v21 = dword_4F5CC4_ys[v20 + 2]; | |
7927 if ( v18 ^ v21 >= v8 ) | |
7928 { | |
7929 v22 = dword_4F5D98_xs[v20 + 1]; | |
7930 if ( v22 >= a4a ) | |
7931 v23 = 0; | |
7932 else | |
7933 v23 = 2; | |
7934 v24 = v23 | dword_4F5D98_xs[v20] < a4a; | |
7935 if ( v24 != 3 ) | |
7936 { | |
7937 if ( !v24 | |
7938 || (v25 = v22 - dword_4F5D98_xs[v20], | |
7939 LODWORD(v26) = v25 << 16, | |
7940 HIDWORD(v26) = v25 >> 16, | |
7941 dword_4F5D98_xs[v20] | |
7942 + ((signed int)(((unsigned __int64)(v26 | |
7943 / (v21 - dword_4F5CC4_ys[v20 + 1]) | |
7944 * ((v8 - dword_4F5CC4_ys[v20 + 1]) << 16)) >> 16) | |
7945 + 32768) >> 16) >= a4a) ) | |
7946 ++a3a; | |
7947 } | |
7948 } | |
7949 v18 = v21 >= v8; | |
7950 v19 = v29++ + 1; | |
7951 } | |
7952 while ( v29 < v28 ); | |
7953 result = 1; | |
7954 if ( a3a != 1 ) | |
7955 LABEL_29: | |
7956 result = 0; | |
7957 return result; | |
7958 } | |
7959 | |
7960 //----- (004077F1) -------------------------------------------------------- | |
7961 bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *a4, BSPVertexBuffer *a5) | |
7962 { | |
7963 ODMFace *v5; // eax@1 | |
7964 unsigned int v6; // esi@1 | |
7965 signed int v7; // edi@1 | |
7966 char v8; // zf@2 | |
7967 unsigned __int16 *v9; // edx@3 | |
7968 int v10; // ecx@4 | |
7969 unsigned __int16 *v11; // edx@8 | |
7970 int v12; // ecx@9 | |
7971 int v13; // edx@12 | |
7972 int v14; // ecx@13 | |
7973 int v15; // esi@14 | |
7974 bool v16; // edi@14 | |
7975 int v17; // ecx@16 | |
7976 int v18; // edx@16 | |
7977 int v19; // eax@17 | |
7978 signed int v20; // ebx@18 | |
7979 int v21; // edi@20 | |
7980 signed int v22; // eax@22 | |
7981 signed __int64 v23; // qtt@22 | |
7982 bool result; // eax@25 | |
7983 int v25; // [sp+14h] [bp-8h]@14 | |
7984 int a4a; // [sp+28h] [bp+Ch]@2 | |
7985 signed int a5a; // [sp+2Ch] [bp+10h]@14 | |
7986 | |
7987 v5 = a4; | |
7988 v6 = a4->uAttributes; | |
7989 v7 = 0; | |
7990 if ( v6 & 0x100 ) | |
7991 { | |
7992 v8 = a4->uNumVertices == 0; | |
7993 a4a = a1; | |
7994 a3 = a2; | |
7995 if ( !v8 ) | |
7996 { | |
7997 v9 = v5->pVertexIDs; | |
7998 do | |
7999 { | |
8000 ++v7; | |
8001 dword_4F5BF4_xs[v7] = a5->pVertices[*v9].x; | |
8002 v10 = *v9; | |
8003 ++v9; | |
8004 dword_4F5B24_ys[v7] = a5->pVertices[v10].y; | |
8005 } | |
8006 while ( v7 < v5->uNumVertices ); | |
8007 } | |
8008 } | |
8009 else | |
8010 { | |
8011 if ( v6 & 0x200 ) | |
8012 { | |
8013 v8 = a4->uNumVertices == 0; | |
8014 a4a = a1; | |
8015 if ( !v8 ) | |
8016 { | |
8017 v11 = v5->pVertexIDs; | |
8018 do | |
8019 { | |
8020 ++v7; | |
8021 dword_4F5BF4_xs[v7] = a5->pVertices[*v11].x; | |
8022 v12 = *v11; | |
8023 ++v11; | |
8024 dword_4F5B24_ys[v7] = a5->pVertices[v12].z; | |
8025 } | |
8026 while ( v7 < v5->uNumVertices ); | |
8027 } | |
8028 } | |
8029 else | |
8030 { | |
8031 v8 = a4->uNumVertices == 0; | |
8032 a4a = a2; | |
8033 if ( !v8 ) | |
8034 { | |
8035 v13 = (int)v5->pVertexIDs; | |
8036 do | |
8037 { | |
8038 ++v7; | |
8039 dword_4F5BF4_xs[v7] = a5->pVertices[*(short *)v13].y; | |
8040 v14 = *(short *)v13; | |
8041 v13 += 2; | |
8042 dword_4F5B24_ys[v7] = a5->pVertices[v14].z; | |
8043 } | |
8044 while ( v7 < v5->uNumVertices ); | |
8045 } | |
8046 } | |
8047 } | |
8048 v15 = v5->uNumVertices; | |
8049 a5a = 0; | |
8050 dword_4F5BF4_xs[v15 + 1] = dword_4F5BF4_xs[1]; | |
8051 dword_4F5B24_ys[v15 + 1] = dword_4F5B24_ys[1]; | |
8052 v25 = 0; | |
8053 v16 = dword_4F5B24_ys[1] >= a3; | |
8054 if ( v15 <= 0 ) | |
8055 goto LABEL_29; | |
8056 do | |
8057 { | |
8058 if ( a5a >= 2 ) | |
8059 break; | |
8060 v17 = v25; | |
8061 v18 = dword_4F5B24_ys[v25 + 2]; | |
8062 if ( v16 ^ v18 >= a3 ) | |
8063 { | |
8064 v19 = dword_4F5BF4_xs[v17 + 2]; | |
8065 if ( v19 >= a4a ) | |
8066 v20 = 0; | |
8067 else | |
8068 v20 = 2; | |
8069 v21 = v20 | dword_4F5BF4_xs[v17 + 1] < a4a; | |
8070 if ( v21 != 3 ) | |
8071 { | |
8072 if ( !v21 | |
8073 || (v22 = v19 - dword_4F5BF4_xs[v17 + 1], | |
8074 LODWORD(v23) = v22 << 16, | |
8075 HIDWORD(v23) = v22 >> 16, | |
8076 dword_4F5BF4_xs[v17 + 1] | |
8077 + ((signed int)(((unsigned __int64)(v23 | |
8078 / (v18 - dword_4F5B24_ys[v17 + 1]) | |
8079 * ((a3 - dword_4F5B24_ys[v17 + 1]) << 16)) >> 16) | |
8080 + 32768) >> 16) >= a4a) ) | |
8081 ++a5a; | |
8082 } | |
8083 } | |
8084 ++v25; | |
8085 v16 = v18 >= a3; | |
8086 } | |
8087 while ( v25 < v15 ); | |
8088 result = 1; | |
8089 if ( a5a != 1 ) | |
8090 LABEL_29: | |
8091 result = 0; | |
8092 return result; | |
8093 } | |
8094 | |
8095 //----- (00407A1C) -------------------------------------------------------- | |
8096 bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v) | |
8097 { | |
8098 unsigned int v4; // esi@1 | |
8099 Vec3_int_ v5; // ST08_12@2 | |
8100 int v6; // edi@2 | |
8101 int v7; // ebx@2 | |
8102 int v8; // esi@2 | |
8103 signed int v9; // ecx@2 | |
8104 int v10; // eax@2 | |
8105 int v11; // ecx@4 | |
8106 int v12; // eax@4 | |
8107 int v13; // ebx@4 | |
8108 int v14; // edx@6 | |
8109 char *v15; // edi@16 | |
8110 ODMFace *v16; // esi@19 | |
8111 int v17; // ST34_4@25 | |
8112 int v18; // ST38_4@25 | |
8113 int v19; // eax@25 | |
8114 char v20; // zf@25 | |
8115 int v21; // ebx@25 | |
8116 int v22; // eax@26 | |
8117 signed int v23; // edi@26 | |
8118 int v24; // ST34_4@30 | |
8119 signed __int64 v25; // qtt@31 | |
8120 int v26; // eax@31 | |
8121 Vec3_int_ v27; // ST08_12@37 | |
8122 Vec3_int_ v28; // ST08_12@37 | |
8123 int v29; // edi@37 | |
8124 int v30; // ebx@37 | |
8125 int v31; // esi@37 | |
8126 signed int v32; // ecx@37 | |
8127 int v33; // eax@37 | |
8128 int v34; // ecx@39 | |
8129 int v35; // eax@39 | |
8130 int v36; // ebx@39 | |
8131 int v37; // edx@41 | |
8132 char *v38; // edi@51 | |
8133 ODMFace *v39; // esi@54 | |
8134 int v40; // ebx@60 | |
8135 int v41; // eax@61 | |
8136 signed int v42; // edi@61 | |
8137 signed __int64 v43; // qtt@66 | |
8138 int v44; // eax@66 | |
8139 Vec3_int_ v45; // ST08_12@73 | |
8140 int v46; // edi@73 | |
8141 int v47; // ebx@73 | |
8142 int v48; // esi@73 | |
8143 signed int v49; // ecx@73 | |
8144 int v50; // eax@73 | |
8145 int v51; // edx@75 | |
8146 int v52; // ecx@75 | |
8147 int v53; // eax@75 | |
8148 int v54; // ebx@75 | |
8149 int v55; // edi@77 | |
8150 int v56; // ecx@77 | |
8151 int v57; // eax@81 | |
8152 int v58; // esi@81 | |
8153 int v59; // eax@90 | |
8154 BLVSector *v60; // edx@90 | |
8155 int v61; // ecx@90 | |
8156 BLVFace *v62; // esi@91 | |
8157 int v63; // ST34_4@98 | |
8158 int v64; // ST30_4@98 | |
8159 int v65; // eax@98 | |
8160 int v66; // ebx@98 | |
8161 int v67; // eax@99 | |
8162 signed int v68; // edi@99 | |
8163 int v69; // ST2C_4@103 | |
8164 signed __int64 v70; // qtt@104 | |
8165 int v71; // eax@104 | |
8166 Vec3_int_ v72; // ST08_12@111 | |
8167 Vec3_int_ v73; // ST08_12@111 | |
8168 int v74; // edi@111 | |
8169 int v75; // ebx@111 | |
8170 int v76; // esi@111 | |
8171 signed int v77; // ecx@111 | |
8172 int v78; // eax@111 | |
8173 int v79; // edx@113 | |
8174 int v80; // ecx@113 | |
8175 int v81; // eax@113 | |
8176 int v82; // ebx@113 | |
8177 int v83; // edi@115 | |
8178 int v84; // ecx@115 | |
8179 int v85; // eax@119 | |
8180 int v86; // esi@119 | |
8181 int v87; // ecx@128 | |
8182 BLVSector *v88; // eax@128 | |
8183 int v89; // ecx@128 | |
8184 BLVFace *v90; // esi@129 | |
8185 int v91; // ebx@136 | |
8186 int v92; // eax@137 | |
8187 signed int v93; // edi@137 | |
8188 signed __int64 v94; // qtt@142 | |
8189 int v95; // eax@142 | |
8190 Vec3_int_ v97; // [sp-18h] [bp-94h]@1 | |
8191 int v98; // [sp-Ch] [bp-88h]@88 | |
8192 int v99; // [sp-Ch] [bp-88h]@126 | |
8193 int v100; // [sp-8h] [bp-84h]@88 | |
8194 int v101; // [sp-8h] [bp-84h]@126 | |
8195 int v102; // [sp-4h] [bp-80h]@88 | |
8196 int v103; // [sp-4h] [bp-80h]@126 | |
8197 int v104; // [sp+Ch] [bp-70h]@13 | |
8198 int v105; // [sp+Ch] [bp-70h]@48 | |
8199 int v106; // [sp+10h] [bp-6Ch]@18 | |
8200 int v107; // [sp+10h] [bp-6Ch]@98 | |
8201 int v108; // [sp+10h] [bp-6Ch]@104 | |
8202 int v109; // [sp+18h] [bp-64h]@25 | |
8203 int v110; // [sp+18h] [bp-64h]@31 | |
8204 int i; // [sp+18h] [bp-64h]@90 | |
8205 int v112; // [sp+18h] [bp-64h]@128 | |
8206 signed int v113; // [sp+20h] [bp-5Ch]@1 | |
8207 signed int v114; // [sp+24h] [bp-58h]@1 | |
8208 unsigned __int64 a4; // [sp+28h] [bp-54h]@1 | |
8209 unsigned int a4_8; // [sp+30h] [bp-4Ch]@1 | |
8210 int v117; // [sp+34h] [bp-48h]@4 | |
8211 int v118; // [sp+34h] [bp-48h]@39 | |
8212 int v119; // [sp+34h] [bp-48h]@75 | |
8213 int v120; // [sp+34h] [bp-48h]@113 | |
8214 int v121; // [sp+38h] [bp-44h]@4 | |
8215 int v122; // [sp+38h] [bp-44h]@39 | |
8216 int v123; // [sp+38h] [bp-44h]@76 | |
8217 int v124; // [sp+38h] [bp-44h]@114 | |
8218 int v125; // [sp+3Ch] [bp-40h]@4 | |
8219 int v126; // [sp+3Ch] [bp-40h]@39 | |
8220 int v127; // [sp+3Ch] [bp-40h]@77 | |
8221 int v128; // [sp+3Ch] [bp-40h]@115 | |
8222 int v129; // [sp+40h] [bp-3Ch]@11 | |
8223 int v130; // [sp+40h] [bp-3Ch]@46 | |
8224 int v131; // [sp+40h] [bp-3Ch]@78 | |
8225 int v132; // [sp+40h] [bp-3Ch]@116 | |
8226 int v133; // [sp+44h] [bp-38h]@10 | |
8227 int v134; // [sp+44h] [bp-38h]@45 | |
8228 int v135; // [sp+44h] [bp-38h]@81 | |
8229 int v136; // [sp+44h] [bp-38h]@119 | |
8230 int v137; // [sp+48h] [bp-34h]@7 | |
8231 int v138; // [sp+48h] [bp-34h]@42 | |
8232 int v139; // [sp+48h] [bp-34h]@82 | |
8233 int v140; // [sp+48h] [bp-34h]@120 | |
8234 int v141; // [sp+4Ch] [bp-30h]@6 | |
8235 int v142; // [sp+4Ch] [bp-30h]@41 | |
8236 int v143; // [sp+4Ch] [bp-30h]@75 | |
8237 int v144; // [sp+4Ch] [bp-30h]@113 | |
8238 int v145; // [sp+50h] [bp-2Ch]@5 | |
8239 int v146; // [sp+50h] [bp-2Ch]@40 | |
8240 int v147; // [sp+50h] [bp-2Ch]@75 | |
8241 int v148; // [sp+50h] [bp-2Ch]@113 | |
8242 int v149; // [sp+54h] [bp-28h]@4 | |
8243 int v150; // [sp+54h] [bp-28h]@39 | |
8244 int v151; // [sp+54h] [bp-28h]@75 | |
8245 int v152; // [sp+54h] [bp-28h]@113 | |
8246 int sDepth; // [sp+58h] [bp-24h]@17 | |
8247 int sDeptha; // [sp+58h] [bp-24h]@52 | |
8248 int sDepthb; // [sp+58h] [bp-24h]@90 | |
8249 char *a5; // [sp+5Ch] [bp-20h]@16 | |
8250 char *a5a; // [sp+5Ch] [bp-20h]@51 | |
8251 signed int a5b; // [sp+5Ch] [bp-20h]@83 | |
8252 signed int a5c; // [sp+5Ch] [bp-20h]@121 | |
8253 signed int v160; // [sp+60h] [bp-1Ch]@12 | |
8254 signed int v161; // [sp+60h] [bp-1Ch]@47 | |
8255 int v162; // [sp+60h] [bp-1Ch]@128 | |
8256 int v163; // [sp+64h] [bp-18h]@2 | |
8257 int outx; // [sp+68h] [bp-14h]@2 | |
8258 int outy; // [sp+6Ch] [bp-10h]@2 | |
8259 int outz; // [sp+70h] [bp-Ch]@2 | |
8260 Vec3_int_ pOut; // [sp+74h] [bp-8h]@2 | |
8261 int ya; // [sp+84h] [bp+8h]@60 | |
8262 int yb; // [sp+84h] [bp+8h]@136 | |
8263 int ve; // [sp+88h] [bp+Ch]@60 | |
8264 int va; // [sp+88h] [bp+Ch]@60 | |
8265 int vb; // [sp+88h] [bp+Ch]@66 | |
8266 int vf; // [sp+88h] [bp+Ch]@136 | |
8267 int vc; // [sp+88h] [bp+Ch]@136 | |
8268 int vd; // [sp+88h] [bp+Ch]@142 | |
8269 int v_4; // [sp+8Ch] [bp+10h]@60 | |
8270 int v_4a; // [sp+8Ch] [bp+10h]@65 | |
8271 int v_4b; // [sp+8Ch] [bp+10h]@136 | |
8272 int v_4c; // [sp+8Ch] [bp+10h]@141 | |
8273 int v_8; // [sp+90h] [bp+14h]@53 | |
8274 | |
8275 a4 = __PAIR__(z, x); | |
8276 v4 = stru_5C6E00->Atan2(v.x - x, v.y - z); | |
8277 v114 = 0; | |
8278 v97.z = y; | |
8279 v113 = 0; | |
8280 a4_8 = v4; | |
8281 *(_QWORD *)&v97.x = a4; | |
8282 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
8283 { | |
8284 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
8285 v45.z = v.z; | |
8286 *(_QWORD *)&v45.x = *(_QWORD *)&v; | |
8287 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &v163); | |
8288 v46 = outy - pOut.y; | |
8289 v47 = v163 - outz; | |
8290 v48 = outx - pOut.x; | |
295 | 8291 v49 = integer_sqrt(v48 * v48 + v46 * v46 + v47 * v47); |
0 | 8292 v50 = 65536; |
8293 if ( v49 ) | |
8294 v50 = 65536 / v49; | |
8295 v51 = outx; | |
8296 v143 = v48 * v50; | |
8297 v52 = v46 * v50; | |
8298 v53 = v47 * v50; | |
8299 v54 = pOut.x; | |
8300 v147 = v52; | |
8301 v151 = v53; | |
8302 v119 = pOut.x; | |
8303 if ( pOut.x < outx ) | |
8304 { | |
8305 v123 = outx; | |
8306 } | |
8307 else | |
8308 { | |
8309 v119 = outx; | |
8310 v123 = pOut.x; | |
8311 } | |
8312 v55 = pOut.y; | |
8313 v56 = outy; | |
8314 v127 = pOut.y; | |
8315 if ( pOut.y < outy ) | |
8316 { | |
8317 v131 = outy; | |
8318 } | |
8319 else | |
8320 { | |
8321 v127 = outy; | |
8322 v131 = pOut.y; | |
8323 } | |
8324 v57 = v163; | |
8325 v58 = outz; | |
8326 v135 = outz; | |
8327 if ( outz < v163 ) | |
8328 { | |
8329 v139 = v163; | |
8330 } | |
8331 else | |
8332 { | |
8333 v135 = v163; | |
8334 v139 = outz; | |
8335 } | |
8336 a5b = 0; | |
8337 while ( !v114 ) | |
8338 { | |
8339 if ( a5b ) | |
8340 { | |
8341 v102 = v58; | |
8342 v100 = v55; | |
8343 v98 = v54; | |
8344 } | |
8345 else | |
8346 { | |
8347 v102 = v57; | |
8348 v100 = v56; | |
8349 v98 = v51; | |
8350 } | |
8351 v59 = pIndoor->GetSector(v98, v100, v102); | |
8352 v60 = pIndoor->pSectors; | |
8353 v61 = 116 * v59; | |
8354 sDepthb = 0; | |
8355 for ( i = 116 * v59; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
543
diff
changeset
|
8356 sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v61) |
0 | 8357 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61); |
8358 ++sDepthb ) | |
8359 { | |
8360 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
|
8361 if ( v62->Portal() |
0 | 8362 || v119 > v62->pBounding.x2 |
8363 || v123 < v62->pBounding.x1 | |
8364 || v127 > v62->pBounding.y2 | |
8365 || v131 < v62->pBounding.y1 | |
8366 || v135 > v62->pBounding.z2 | |
8367 || v139 < v62->pBounding.z1 | |
8368 || (v63 = (unsigned __int64)(v143 * (signed __int64)v62->pFacePlane_old.vNormal.x) >> 16, | |
8369 v64 = (unsigned __int64)(v151 * (signed __int64)v62->pFacePlane_old.vNormal.z) >> 16, | |
8370 v65 = (unsigned __int64)(v147 * (signed __int64)v62->pFacePlane_old.vNormal.y) >> 16, | |
8371 v20 = v63 + v64 + v65 == 0, | |
8372 v66 = v63 + v64 + v65, | |
8373 v107 = v63 + v64 + v65, | |
8374 v20) ) | |
8375 goto LABEL_107; | |
8376 v67 = outz * v62->pFacePlane_old.vNormal.z; | |
8377 v68 = -(v62->pFacePlane_old.dist | |
8378 + v67 | |
8379 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8380 + pOut.x * v62->pFacePlane_old.vNormal.x); | |
8381 if ( v66 <= 0 ) | |
8382 { | |
8383 if ( v62->pFacePlane_old.dist | |
8384 + v67 | |
8385 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8386 + pOut.x * v62->pFacePlane_old.vNormal.x < 0 ) | |
8387 goto LABEL_107; | |
8388 } | |
8389 else | |
8390 { | |
8391 if ( v62->pFacePlane_old.dist | |
8392 + v67 | |
8393 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8394 + pOut.x * v62->pFacePlane_old.vNormal.x > 0 ) | |
8395 goto LABEL_107; | |
8396 } | |
8397 v69 = abs(-(v62->pFacePlane_old.dist | |
8398 + v67 | |
8399 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8400 + pOut.x * v62->pFacePlane_old.vNormal.x)) >> 14; | |
8401 if ( v69 <= abs(v66) ) | |
8402 { | |
8403 LODWORD(v70) = v68 << 16; | |
8404 HIDWORD(v70) = v68 >> 16; | |
8405 v71 = v70 / v107; | |
8406 v108 = v70 / v107; | |
8407 if ( v71 >= 0 ) | |
8408 { | |
8409 if ( sub_4075DB( | |
8410 pOut.x + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v143) >> 16) + 32768) >> 16), | |
8411 pOut.y + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v147) >> 16) + 32768) >> 16), | |
8412 outz + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v151) >> 16) + 32768) >> 16), | |
8413 v62) ) | |
8414 { | |
8415 v114 = 1; | |
8416 break; | |
8417 } | |
8418 } | |
8419 } | |
8420 v61 = i; | |
8421 LABEL_107: | |
8422 v60 = pIndoor->pSectors; | |
8423 } | |
8424 ++a5b; | |
8425 if ( a5b >= 2 ) | |
8426 break; | |
8427 v57 = v163; | |
8428 v56 = outy; | |
8429 v51 = outx; | |
8430 v58 = outz; | |
8431 v55 = pOut.y; | |
8432 v54 = pOut.x; | |
8433 } | |
8434 v72.z = y; | |
8435 *(_QWORD *)&v72.x = a4; | |
8436 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz); | |
8437 v73.z = v.z; | |
8438 *(_QWORD *)&v73.x = *(_QWORD *)&v; | |
8439 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163); | |
8440 v74 = outy - pOut.y; | |
8441 v75 = v163 - outz; | |
8442 v76 = outx - pOut.x; | |
295 | 8443 v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75); |
0 | 8444 v78 = 65536; |
8445 if ( v77 ) | |
8446 v78 = 65536 / v77; | |
8447 v79 = outx; | |
8448 v144 = v76 * v78; | |
8449 v80 = v74 * v78; | |
8450 v81 = v75 * v78; | |
8451 v82 = pOut.x; | |
8452 v148 = v80; | |
8453 v152 = v81; | |
8454 v120 = pOut.x; | |
8455 if ( pOut.x < outx ) | |
8456 { | |
8457 v124 = outx; | |
8458 } | |
8459 else | |
8460 { | |
8461 v120 = outx; | |
8462 v124 = pOut.x; | |
8463 } | |
8464 v83 = pOut.y; | |
8465 v84 = outy; | |
8466 v128 = pOut.y; | |
8467 if ( pOut.y < outy ) | |
8468 { | |
8469 v132 = outy; | |
8470 } | |
8471 else | |
8472 { | |
8473 v128 = outy; | |
8474 v132 = pOut.y; | |
8475 } | |
8476 v85 = v163; | |
8477 v86 = outz; | |
8478 v136 = outz; | |
8479 if ( outz < v163 ) | |
8480 { | |
8481 v140 = v163; | |
8482 } | |
8483 else | |
8484 { | |
8485 v136 = v163; | |
8486 v140 = outz; | |
8487 } | |
8488 a5c = 0; | |
8489 while ( 1 ) | |
8490 { | |
8491 if ( v113 ) | |
8492 return !v114 || !v113; | |
8493 if ( a5c ) | |
8494 { | |
8495 v103 = v86; | |
8496 v101 = v83; | |
8497 v99 = v82; | |
8498 } | |
8499 else | |
8500 { | |
8501 v103 = v85; | |
8502 v101 = v84; | |
8503 v99 = v79; | |
8504 } | |
8505 v87 = pIndoor->GetSector(v99, v101, v103); | |
8506 v88 = pIndoor->pSectors; | |
8507 v89 = 116 * v87; | |
8508 v162 = 0; | |
8509 v112 = v89; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
543
diff
changeset
|
8510 if ( *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) |
0 | 8511 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 ) |
8512 break; | |
8513 LABEL_148: | |
8514 ++a5c; | |
8515 if ( a5c >= 2 ) | |
8516 return !v114 || !v113; | |
8517 v85 = v163; | |
8518 v84 = outy; | |
8519 v79 = outx; | |
8520 v86 = outz; | |
8521 v83 = pOut.y; | |
8522 v82 = pOut.x; | |
8523 } | |
8524 while ( 1 ) | |
8525 { | |
8526 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
|
8527 if ( v90->Portal() |
0 | 8528 || v120 > v90->pBounding.x2 |
8529 || v124 < v90->pBounding.x1 | |
8530 || v128 > v90->pBounding.y2 | |
8531 || v132 < v90->pBounding.y1 | |
8532 || v136 > v90->pBounding.z2 | |
8533 || v140 < v90->pBounding.z1 | |
8534 || (yb = (unsigned __int64)(v144 * (signed __int64)v90->pFacePlane_old.vNormal.x) >> 16, | |
8535 v_4b = (unsigned __int64)(v148 * (signed __int64)v90->pFacePlane_old.vNormal.y) >> 16, | |
8536 vf = (unsigned __int64)(v152 * (signed __int64)v90->pFacePlane_old.vNormal.z) >> 16, | |
8537 v20 = yb + vf + v_4b == 0, | |
8538 v91 = yb + vf + v_4b, | |
8539 vc = yb + vf + v_4b, | |
8540 v20) ) | |
8541 goto LABEL_145; | |
8542 v92 = outz * v90->pFacePlane_old.vNormal.z; | |
8543 v93 = -(v90->pFacePlane_old.dist | |
8544 + v92 | |
8545 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8546 + pOut.x * v90->pFacePlane_old.vNormal.x); | |
8547 if ( v91 <= 0 ) | |
8548 { | |
8549 if ( v90->pFacePlane_old.dist | |
8550 + v92 | |
8551 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8552 + pOut.x * v90->pFacePlane_old.vNormal.x < 0 ) | |
8553 goto LABEL_145; | |
8554 } | |
8555 else | |
8556 { | |
8557 if ( v90->pFacePlane_old.dist | |
8558 + v92 | |
8559 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8560 + pOut.x * v90->pFacePlane_old.vNormal.x > 0 ) | |
8561 goto LABEL_145; | |
8562 } | |
8563 v_4c = abs(-(v90->pFacePlane_old.dist | |
8564 + v92 | |
8565 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8566 + pOut.x * v90->pFacePlane_old.vNormal.x)) >> 14; | |
8567 if ( v_4c <= abs(v91) ) | |
8568 { | |
8569 LODWORD(v94) = v93 << 16; | |
8570 HIDWORD(v94) = v93 >> 16; | |
8571 v95 = v94 / vc; | |
8572 vd = v94 / vc; | |
8573 if ( v95 >= 0 ) | |
8574 { | |
8575 if ( sub_4075DB( | |
8576 pOut.x + ((signed int)(((unsigned __int64)(vd * (signed __int64)v144) >> 16) + 32768) >> 16), | |
8577 pOut.y + ((signed int)(((unsigned __int64)(vd * (signed __int64)v148) >> 16) + 32768) >> 16), | |
8578 outz + ((signed int)(((unsigned __int64)(vd * (signed __int64)v152) >> 16) + 32768) >> 16), | |
8579 v90) ) | |
8580 { | |
8581 v113 = 1; | |
8582 goto LABEL_148; | |
8583 } | |
8584 } | |
8585 } | |
8586 v89 = v112; | |
8587 LABEL_145: | |
8588 v88 = pIndoor->pSectors; | |
8589 ++v162; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
543
diff
changeset
|
8590 if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) |
0 | 8591 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) ) |
8592 goto LABEL_148; | |
8593 } | |
8594 } | |
8595 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
8596 v5.z = v.z; | |
8597 *(_QWORD *)&v5.x = *(_QWORD *)&v; | |
8598 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v5, &outx, &outy, &v163); | |
8599 v6 = outy - pOut.y; | |
8600 v7 = v163 - outz; | |
8601 v8 = outx - pOut.x; | |
295 | 8602 v9 = integer_sqrt(v8 * v8 + v6 * v6 + v7 * v7); |
0 | 8603 v10 = 65536; |
8604 if ( v9 ) | |
8605 v10 = 65536 / v9; | |
8606 v125 = v8 * v10; | |
8607 v11 = v10; | |
8608 v12 = v7 * v10; | |
8609 v13 = pOut.x; | |
8610 v117 = v12; | |
8611 v121 = v6 * v11; | |
8612 v149 = pOut.x; | |
8613 if ( pOut.x < outx ) | |
8614 { | |
8615 v145 = outx; | |
8616 } | |
8617 else | |
8618 { | |
8619 v149 = outx; | |
8620 v145 = pOut.x; | |
8621 } | |
8622 v14 = outy; | |
8623 v141 = pOut.y; | |
8624 if ( pOut.y < outy ) | |
8625 { | |
8626 v137 = outy; | |
8627 } | |
8628 else | |
8629 { | |
8630 v141 = outy; | |
8631 v137 = pOut.y; | |
8632 } | |
8633 v133 = outz; | |
8634 if ( outz < v163 ) | |
8635 { | |
8636 v129 = v163; | |
8637 } | |
8638 else | |
8639 { | |
8640 v133 = v163; | |
8641 v129 = outz; | |
8642 } | |
8643 v160 = 0; | |
8644 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
8645 { | |
8646 v104 = 0; | |
8647 while ( 1 ) | |
8648 { | |
8649 v15 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
8650 a5 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
8651 if ( sub_4088E9(v13, pOut.y, outx, v14, pOutdoor->pBModels[v104].vPosition.x, pOutdoor->pBModels[v104].vPosition.y) <= pOutdoor->pBModels[v104].sBoundingRadius + 128 ) | |
8652 { | |
8653 sDepth = 0; | |
8654 if ( *((int *)v15 + 2) > 0 ) | |
8655 break; | |
8656 } | |
8657 LABEL_36: | |
8658 ++v160; | |
8659 ++v104; | |
8660 if ( v160 >= (signed int)pOutdoor->uNumBModels ) | |
8661 goto LABEL_37; | |
8662 v14 = outy; | |
8663 v13 = pOut.x; | |
8664 } | |
8665 v106 = 0; | |
8666 while ( 1 ) | |
8667 { | |
8668 v16 = (ODMFace *)(v106 + *((int *)a5 + 4)); | |
8669 if ( v149 > v16->pBoundingBox.x2 | |
8670 || v145 < v16->pBoundingBox.x1 | |
8671 || v141 > v16->pBoundingBox.y2 | |
8672 || v137 < v16->pBoundingBox.y1 | |
8673 || v133 > v16->pBoundingBox.z2 | |
8674 || v129 < v16->pBoundingBox.z1 | |
8675 || (v17 = (unsigned __int64)(v125 * (signed __int64)v16->pFacePlane.vNormal.x) >> 16, | |
8676 v18 = (unsigned __int64)(v121 * (signed __int64)v16->pFacePlane.vNormal.y) >> 16, | |
8677 v19 = (unsigned __int64)(v117 * (signed __int64)v16->pFacePlane.vNormal.z) >> 16, | |
8678 v20 = v17 + v18 + v19 == 0, | |
8679 v21 = v17 + v18 + v19, | |
8680 v109 = v17 + v18 + v19, | |
8681 v20) ) | |
8682 goto LABEL_33; | |
8683 v22 = pOut.y * v16->pFacePlane.vNormal.y; | |
8684 v23 = -(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x); | |
8685 if ( v21 <= 0 ) | |
8686 { | |
8687 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x < 0 ) | |
8688 goto LABEL_33; | |
8689 } | |
8690 else | |
8691 { | |
8692 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x > 0 ) | |
8693 goto LABEL_33; | |
8694 } | |
8695 v24 = abs(-(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x)) >> 14; | |
8696 if ( v24 <= abs(v21) ) | |
8697 { | |
8698 LODWORD(v25) = v23 << 16; | |
8699 HIDWORD(v25) = v23 >> 16; | |
8700 v26 = v25 / v109; | |
8701 v110 = v25 / v109; | |
8702 if ( v26 >= 0 ) | |
8703 { | |
8704 if ( sub_4077F1( | |
8705 pOut.x + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v125) >> 16) + 32768) >> 16), | |
8706 pOut.y + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v121) >> 16) + 32768) >> 16), | |
8707 outz + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v117) >> 16) + 32768) >> 16), | |
8708 v16, | |
8709 (BSPVertexBuffer *)a5) ) | |
8710 { | |
8711 v114 = 1; | |
8712 goto LABEL_36; | |
8713 } | |
8714 } | |
8715 } | |
8716 LABEL_33: | |
8717 ++sDepth; | |
8718 v106 += 308; | |
8719 if ( sDepth >= *((int *)a5 + 2) ) | |
8720 goto LABEL_36; | |
8721 } | |
8722 } | |
8723 LABEL_37: | |
8724 v27.z = y; | |
8725 *(_QWORD *)&v27.x = a4; | |
8726 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz); | |
8727 v28.z = v.z; | |
8728 *(_QWORD *)&v28.x = *(_QWORD *)&v; | |
8729 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163); | |
8730 v29 = outy - pOut.y; | |
8731 v30 = v163 - outz; | |
8732 v31 = outx - pOut.x; | |
295 | 8733 v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30); |
0 | 8734 v33 = 65536; |
8735 if ( v32 ) | |
8736 v33 = 65536 / v32; | |
8737 v126 = v31 * v33; | |
8738 v34 = v33; | |
8739 v35 = v30 * v33; | |
8740 v36 = pOut.x; | |
8741 v118 = v35; | |
8742 v122 = v29 * v34; | |
8743 v150 = pOut.x; | |
8744 if ( pOut.x < outx ) | |
8745 { | |
8746 v146 = outx; | |
8747 } | |
8748 else | |
8749 { | |
8750 v150 = outx; | |
8751 v146 = pOut.x; | |
8752 } | |
8753 v37 = outy; | |
8754 v142 = pOut.y; | |
8755 if ( pOut.y < outy ) | |
8756 { | |
8757 v138 = outy; | |
8758 } | |
8759 else | |
8760 { | |
8761 v142 = outy; | |
8762 v138 = pOut.y; | |
8763 } | |
8764 v134 = outz; | |
8765 if ( outz < v163 ) | |
8766 { | |
8767 v130 = v163; | |
8768 } | |
8769 else | |
8770 { | |
8771 v134 = v163; | |
8772 v130 = outz; | |
8773 } | |
8774 v161 = 0; | |
8775 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
8776 { | |
8777 v105 = 0; | |
8778 while ( 1 ) | |
8779 { | |
8780 v38 = (char *)&pOutdoor->pBModels[v105].pVertices; | |
8781 a5a = (char *)&pOutdoor->pBModels[v105].pVertices; | |
8782 if ( sub_4088E9(v36, pOut.y, outx, v37, pOutdoor->pBModels[v105].vPosition.x, pOutdoor->pBModels[v105].vPosition.y) <= pOutdoor->pBModels[v105].sBoundingRadius + 128 ) | |
8783 { | |
8784 sDeptha = 0; | |
8785 if ( *((int *)v38 + 2) > 0 ) | |
8786 break; | |
8787 } | |
8788 LABEL_71: | |
8789 ++v161; | |
8790 ++v105; | |
8791 if ( v161 >= (signed int)pOutdoor->uNumBModels ) | |
8792 return !v114 || !v113; | |
8793 v37 = outy; | |
8794 v36 = pOut.x; | |
8795 } | |
8796 v_8 = 0; | |
8797 while ( 1 ) | |
8798 { | |
8799 v39 = (ODMFace *)(v_8 + *((int *)a5a + 4)); | |
8800 if ( v150 > v39->pBoundingBox.x2 | |
8801 || v146 < v39->pBoundingBox.x1 | |
8802 || v142 > v39->pBoundingBox.y2 | |
8803 || v138 < v39->pBoundingBox.y1 | |
8804 || v134 > v39->pBoundingBox.z2 | |
8805 || v130 < v39->pBoundingBox.z1 | |
8806 || (ya = (unsigned __int64)(v126 * (signed __int64)v39->pFacePlane.vNormal.x) >> 16, | |
8807 ve = (unsigned __int64)(v122 * (signed __int64)v39->pFacePlane.vNormal.y) >> 16, | |
8808 v_4 = (unsigned __int64)(v118 * (signed __int64)v39->pFacePlane.vNormal.z) >> 16, | |
8809 v20 = ya + ve + v_4 == 0, | |
8810 v40 = ya + ve + v_4, | |
8811 va = ya + ve + v_4, | |
8812 v20) ) | |
8813 goto LABEL_68; | |
8814 v41 = pOut.y * v39->pFacePlane.vNormal.y; | |
8815 v42 = -(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x); | |
8816 if ( v40 <= 0 ) | |
8817 { | |
8818 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x < 0 ) | |
8819 goto LABEL_68; | |
8820 } | |
8821 else | |
8822 { | |
8823 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x > 0 ) | |
8824 goto LABEL_68; | |
8825 } | |
8826 v_4a = abs(-(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x)) >> 14; | |
8827 if ( v_4a <= abs(v40) ) | |
8828 { | |
8829 LODWORD(v43) = v42 << 16; | |
8830 HIDWORD(v43) = v42 >> 16; | |
8831 v44 = v43 / va; | |
8832 vb = v43 / va; | |
8833 if ( v44 >= 0 ) | |
8834 { | |
8835 if ( sub_4077F1( | |
8836 pOut.x + ((signed int)(((unsigned __int64)(vb * (signed __int64)v126) >> 16) + 32768) >> 16), | |
8837 pOut.y + ((signed int)(((unsigned __int64)(vb * (signed __int64)v122) >> 16) + 32768) >> 16), | |
8838 outz + ((signed int)(((unsigned __int64)(vb * (signed __int64)v118) >> 16) + 32768) >> 16), | |
8839 v39, | |
8840 (BSPVertexBuffer *)a5a) ) | |
8841 { | |
8842 v113 = 1; | |
8843 goto LABEL_71; | |
8844 } | |
8845 } | |
8846 } | |
8847 LABEL_68: | |
8848 ++sDeptha; | |
8849 v_8 += 308; | |
8850 if ( sDeptha >= *((int *)a5a + 2) ) | |
8851 goto LABEL_71; | |
8852 } | |
8853 } | |
8854 return !v114 || !v113; | |
8855 } | |
8856 | |
8857 //----- (00408768) -------------------------------------------------------- | |
8858 void InitializeActors() | |
8859 { | |
8860 signed int v5; // [sp+Ch] [bp-10h]@1 | |
8861 signed int v6; // [sp+10h] [bp-Ch]@1 | |
8862 signed int v7; // [sp+14h] [bp-8h]@1 | |
8863 signed int v8; // [sp+18h] [bp-4h]@1 | |
8864 | |
8865 v8 = 0; | |
8866 v6 = 0; | |
8867 v7 = 0; | |
8868 v5 = 0; | |
8869 if ( !_strcmpi(pCurrentMapName, "d25.blv") ) | |
8870 v8 = 1; | |
8871 if ( !_strcmpi(pCurrentMapName, "d26.blv") ) | |
8872 v6 = 1; | |
484 | 8873 if (_449B57_test_bit(pParty->_quest_bits, 99)) |
0 | 8874 v7 = 1; |
484 | 8875 if (_449B57_test_bit(pParty->_quest_bits, 100)) |
0 | 8876 v5 = 1; |
413 | 8877 |
417 | 8878 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 | 8879 for (uint i = 0; i < uNumActors; ++i) |
8880 { | |
8881 auto actor = pActors + i; | |
8882 | |
8883 if (actor->CanAct() || actor->uAIState == Disabled) | |
8884 { | |
8885 actor->vPosition.x = actor->vInitialPosition.x; | |
8886 actor->vPosition.y = actor->vInitialPosition.y; | |
8887 actor->vPosition.z = actor->vInitialPosition.z; | |
8888 actor->sCurrentHP = actor->pMonsterInfo.uHP; | |
8889 if (actor->uAIState != Disabled) | |
413 | 8890 { |
417 | 8891 Actor::AI_Stand(i, ai_near_actors_targets_pid[i], actor->pMonsterInfo.uRecoveryTime, 0); |
413 | 8892 } |
0 | 8893 } |
8894 | |
8895 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
8896 | |
8897 if (!v8 || v7) | |
8898 if (!v6 || v5) | |
322 | 8899 if (actor->IsPeasant()) |
0 | 8900 BYTE2(actor->uAttributes) &= 0xF7u; |
8901 | |
8902 BYTE2(actor->uAttributes) &= 0x7Fu; | |
8903 if (BYTE2(actor->uAttributes) & 0x40) | |
8904 Actor::_4031C1_update_job(i, pParty->uCurrentHour, 1); | |
8905 } | |
8906 } | |
8907 | |
8908 //----- (00408896) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8909 void InitializeSpriteObjects() |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8910 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8911 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
|
8912 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8913 auto item = pSpriteObjects + i; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8914 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8915 if (item->uType && |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8916 (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
|
8917 SpriteObject::OnInteraction(i); |
0 | 8918 } |
8919 | |
8920 for (uint i = 0; i < 100; ++i) | |
8921 array_5118E8.pElements[i].field_C_time_left = 0; | |
8922 } | |
8923 | |
8924 //----- (004088E9) -------------------------------------------------------- | |
8925 signed int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6) | |
8926 { | |
8927 int v6; // esi@1 | |
8928 int v7; // edi@1 | |
8929 int v8; // eax@1 | |
8930 signed int result; // eax@1 | |
8931 int v10; // [sp+Ch] [bp-4h]@1 | |
8932 int v11; // [sp+18h] [bp+8h]@1 | |
8933 | |
8934 v6 = a1; | |
8935 v10 = a2; | |
8936 v7 = a3 - a1; | |
8937 v11 = abs(a3 - a1); | |
8938 v8 = abs(a4 - v10); | |
295 | 8939 result = integer_sqrt(v11 * v11 + v8 * v8); |
0 | 8940 if ( result ) |
8941 result = abs((v7 * (v10 - a6) - (a4 - v10) * (v6 - a5)) / result); | |
8942 return result; | |
8943 } | |
8944 | |
8945 //----- (00408A27) -------------------------------------------------------- | |
8946 unsigned int __thiscall SearchAliveActors(unsigned int *pTotalActors) | |
8947 { | |
8948 unsigned int *v1; // esi@1 | |
8949 int v2; // eax@1 | |
8950 unsigned int v3; // ebp@1 | |
8951 signed int v4; // ebx@1 | |
8952 Actor *v5; // edi@2 | |
8953 unsigned int v6; // eax@3 | |
8954 int v8; // [sp+Ch] [bp-4h]@1 | |
8955 | |
8956 v1 = pTotalActors; | |
8957 v2 = GetAlertStatus(); | |
8958 v3 = 0; | |
8959 v4 = 0; | |
8960 *v1 = 0; | |
8961 v8 = v2; | |
8962 if ( (signed int)uNumActors > 0 ) | |
8963 { | |
8964 v5 = pActors; | |
8965 do | |
8966 { | |
8967 v6 = v5->uAttributes; | |
8968 if ( (v6 & 0x100000) == v8 ) | |
8969 { | |
8970 ++*v1; | |
303 | 8971 if ( v5->IsNotAlive() == 1 ) |
0 | 8972 ++v3; |
8973 } | |
8974 ++v4; | |
8975 ++v5; | |
8976 } | |
8977 while ( v4 < (signed int)uNumActors ); | |
8978 } | |
8979 return v3; | |
8980 } | |
8981 | |
8982 //----- (00408A7E) -------------------------------------------------------- | |
8983 unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID) | |
8984 { | |
8985 unsigned int *v2; // esi@1 | |
8986 signed int v3; // ebx@1 | |
82 | 8987 Actor *v4; // edi@2 |
0 | 8988 int v5; // eax@3 |
8989 int v7; // [sp+8h] [bp-Ch]@1 | |
8990 int v8; // [sp+Ch] [bp-8h]@1 | |
8991 unsigned int v9; // [sp+10h] [bp-4h]@1 | |
8992 | |
8993 v7 = uMonsterID; | |
8994 v2 = pTotalActors; | |
8995 v3 = 0; | |
8996 v8 = GetAlertStatus(); | |
8997 *v2 = 0; | |
8998 v9 = 0; | |
8999 if ( (signed int)uNumActors > 0 ) | |
9000 { | |
82 | 9001 v4 = pActors;//[0].pMonsterInfo.uID; |
0 | 9002 do |
9003 { | |
82 | 9004 v5 = v4->uAttributes; // actor::attributes |
0 | 9005 if ( (v5 & 0x100000) == v8 ) |
9006 { | |
82 | 9007 if ( v4->pMonsterInfo.field_33 == v7 ) |
0 | 9008 { |
9009 ++*v2; | |
303 | 9010 if ( v4->IsNotAlive() == 1 ) |
0 | 9011 ++v9; |
9012 } | |
9013 } | |
9014 ++v3; | |
82 | 9015 ++v4; |
0 | 9016 } |
9017 while ( v3 < (signed int)uNumActors ); | |
9018 } | |
9019 return v9; | |
9020 } | |
9021 | |
9022 //----- (00408AE7) -------------------------------------------------------- | |
9023 unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup) | |
9024 { | |
9025 unsigned int *v2; // esi@1 | |
9026 signed int v3; // ebx@1 | |
82 | 9027 Actor *v4; // edi@2 |
0 | 9028 int v5; // eax@3 |
9029 unsigned int v7; // [sp+8h] [bp-Ch]@1 | |
9030 int v8; // [sp+Ch] [bp-8h]@1 | |
9031 unsigned int v9; // [sp+10h] [bp-4h]@1 | |
9032 | |
9033 v7 = uGroup; | |
9034 v2 = pTotalActors; | |
9035 v3 = 0; | |
9036 v8 = GetAlertStatus(); | |
9037 *v2 = 0; | |
9038 v9 = 0; | |
9039 if ( (signed int)uNumActors > 0 ) | |
9040 { | |
82 | 9041 v4 = pActors;//[0].uGroup; |
0 | 9042 do |
9043 { | |
82 | 9044 v5 = v4->uAttributes; |
0 | 9045 if ( (v5 & 0x100000) == v8 ) |
9046 { | |
82 | 9047 if ( v4->uGroup == v7 ) |
0 | 9048 { |
9049 ++*v2; | |
303 | 9050 if ( v4->IsNotAlive() == 1 ) |
0 | 9051 ++v9; |
9052 } | |
9053 } | |
9054 ++v3; | |
82 | 9055 ++v4; |
0 | 9056 } |
9057 while ( v3 < (signed int)uNumActors ); | |
9058 } | |
9059 return v9; | |
9060 } | |
9061 | |
9062 //----- (00408B54) -------------------------------------------------------- | |
9063 unsigned int __fastcall SearchActorByID(unsigned int *pTotalActors, unsigned int a2) | |
9064 { | |
9065 unsigned int v2; // edi@1 | |
9066 unsigned int *v3; // esi@1 | |
9067 int v4; // eax@1 | |
9068 unsigned int v5; // ebx@1 | |
9069 unsigned int v6; // edx@1 | |
9070 | |
9071 v2 = a2; | |
9072 v3 = pTotalActors; | |
9073 v4 = GetAlertStatus(); | |
9074 v5 = 0; | |
9075 *v3 = 0; | |
9076 v6 = pActors[v2].uAttributes; | |
9077 if ( (v6 & 0x100000) == v4 ) | |
9078 { | |
9079 *v3 = 1; | |
303 | 9080 if ( pActors[v2].IsNotAlive() == 1 ) |
0 | 9081 v5 = 1; |
9082 } | |
9083 return v5; | |
9084 } | |
9085 | |
9086 | |
9087 //----- (0040D75D) -------------------------------------------------------- | |
1006 | 9088 void pPrimaryWindow_draws_text( int a1, const char *pText, int *pXY ) |
9089 { | |
0 | 9090 const char *v3; // ST0C_4@1 |
9091 __int64 v4; // qax@1 | |
9092 | |
9093 v3 = pText; | |
9094 v4 = LOBYTE(pFontComic->uFontHeight) - 3; | |
1006 | 9095 pPrimaryWindow->DrawText( |
0 | 9096 pFontComic, |
9097 *pXY, | |
9098 pXY[1] - (((signed int)v4 - HIDWORD(v4)) >> 1) + 3, | |
9099 0, | |
9100 v3, | |
9101 0, | |
9102 0, | |
9103 0); | |
9104 } | |
9105 | |
9106 //----- (0040DB27) -------------------------------------------------------- | |
9107 void __fastcall DrawRect(Vec4_int_ *pXYZW, unsigned __int16 uColor, char bSolidFill) | |
9108 { | |
9109 Vec4_int_ *v3; // esi@1 | |
9110 unsigned __int16 v4; // bp@1 | |
9111 unsigned int i; // ebx@3 | |
9112 | |
9113 v3 = pXYZW; | |
9114 v4 = uColor; | |
9115 pRenderer->BeginScene(); | |
709 | 9116 pRenderer->SetRasterClipRect(0, 0, 639u, 479u); |
0 | 9117 if ( bSolidFill ) |
9118 { | |
9119 for ( i = v3->y; (signed int)i <= v3->w; ++i ) | |
709 | 9120 pRenderer->RasterLine2D(v3->x, i, v3->z, i, v4); |
0 | 9121 } |
9122 else | |
9123 { | |
709 | 9124 pRenderer->RasterLine2D(v3->x, v3->y, v3->z, v3->y, v4); |
9125 pRenderer->RasterLine2D(v3->z, v3->y, v3->z, v3->w, v4); | |
9126 pRenderer->RasterLine2D(v3->z, v3->w, v3->x, v3->w, v4); | |
9127 pRenderer->RasterLine2D(v3->x, v3->w, v3->x, v3->y, v4); | |
0 | 9128 } |
9129 pRenderer->EndScene(); | |
9130 } | |
9131 | |
9132 //----- (0040DDB1) -------------------------------------------------------- | |
9133 int __fastcall rand_interval(int a, int b) | |
9134 { | |
9135 return a + rand() % (b - a + 1); | |
9136 } | |
9137 | |
9138 //----- (0040DEB4) -------------------------------------------------------- | |
9139 char *__fastcall inv_strcat(const char *Source, char *Dest) | |
9140 { | |
9141 return strcat(Dest, Source); | |
9142 } | |
9143 | |
9144 //----- (0040DEBE) -------------------------------------------------------- | |
9145 char *__fastcall inv_strcpy(const char *Source, char *Dest) | |
9146 { | |
9147 return strcpy(Dest, Source); | |
9148 } | |
9149 | |
9150 //----- (0040DEC8) -------------------------------------------------------- | |
9151 void __fastcall intToString(int val, char *pOut) | |
9152 { | |
9153 sprintf(pOut, "%d", val); | |
9154 } | |
9155 | |
9156 //----- (0040DEDB) -------------------------------------------------------- | |
9157 unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor) | |
9158 { | |
949 | 9159 return TargetColor((unsigned __int8)uColor, BYTE1(uColor), BYTE2(uColor)); |
0 | 9160 } |
9161 | |
9162 //----- (0040DEF3) -------------------------------------------------------- | |
949 | 9163 unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b ) |
983 | 9164 { |
688 | 9165 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) + |
9166 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) + | |
9167 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); | |
0 | 9168 } |
9169 | |
9170 //----- (0040DF3D) -------------------------------------------------------- | |
9171 void __cdecl CallRenderPresent() | |
9172 { | |
9173 pRenderer->Present(); | |
9174 } | |
9175 | |
9176 //----- (0040DFA7) -------------------------------------------------------- | |
9177 int __stdcall retzero_sub_40DFA7(int a1) | |
9178 { | |
9179 return 0; | |
9180 } | |
9181 // 40DFA7: using guessed type int __stdcall retzero_sub_40DFA7(int); | |
9182 | |
9183 //----- (0040DFD1) -------------------------------------------------------- | |
9184 void stru272::_40DFD1() | |
9185 { | |
9186 stru272 *v1; // esi@1 | |
9187 stru272_stru0 *v2; // eax@1 | |
9188 | |
9189 v1 = this; | |
9190 v2 = (stru272_stru0 *)malloc(0x5Cu); | |
9191 v1->ptr_0 = v2; | |
9192 v2->field_0 = 0x67707274u; | |
9193 v1->ptr_0->field_8 = 0; | |
9194 v1->ptr_0->field_30 = 0.0; | |
9195 v1->ptr_0->field_58 = 0; | |
9196 v1->ptr_0->field_59 = 0; | |
9197 } | |
9198 | |
9199 //----- (0040DFFE) -------------------------------------------------------- | |
9200 int stru272_stru0::_40DFFE() | |
9201 { | |
9202 signed int result; // eax@2 | |
9203 | |
9204 if ( this->field_0 == 0x67707274 ) | |
9205 { | |
9206 this->field_0 = 0x78787878u; | |
9207 free(this); | |
9208 result = 0; | |
9209 } | |
9210 else | |
9211 { | |
9212 result = 2; | |
9213 } | |
9214 return result; | |
9215 } | |
9216 | |
9217 //----- (0040E01A) -------------------------------------------------------- | |
9218 int stru272_stru0::_40E01A(int a2) | |
9219 { | |
9220 signed int result; // eax@2 | |
9221 | |
9222 auto a1 = this; | |
9223 if ( a1->field_0 == 0x67707274 ) | |
9224 { | |
9225 a1->field_4 = *(int *)(a2 + 32); | |
9226 a1->field_C = *(int *)a2 << 16; | |
9227 a1->field_10 = *(int *)(a2 + 4) << 16; | |
9228 a1->field_14 = *(int *)(a2 + 8) << 16; | |
9229 a1->field_18 = *(int *)(a2 + 12) << 16; | |
9230 a1->field_1C = *(int *)(a2 + 16); | |
9231 a1->field_20 = *(int *)(a2 + 20); | |
9232 a1->field_24 = *(int *)(a2 + 24); | |
9233 a1->field_28 = *(float *)(a2 + 28) * 65536.0; | |
9234 LODWORD(a1->field_2C) = *(int *)(a2 + 36); | |
9235 a1->field_34 = (signed __int64)(*(float *)(a2 + 40) * 65536.0); | |
9236 a1->field_38 = (signed __int64)(*(float *)(a2 + 44) * 65536.0); | |
9237 a1->field_3C = *(int *)(a2 + 48); | |
9238 a1->field_40 = *(int *)(a2 + 52); | |
9239 a1->field_54 = *(int *)(a2 + 56); | |
9240 a1->field_59 = 1; | |
9241 result = 0; | |
9242 } | |
9243 else | |
9244 { | |
9245 result = 2; | |
9246 } | |
9247 return result; | |
9248 } | |
9249 | |
9250 //----- (0040E0F5) -------------------------------------------------------- | |
9251 int stru272_stru0::_40E0F5(char a2, char a3) | |
9252 { | |
9253 signed int result; // eax@2 | |
9254 int v4; // edx@7 | |
9255 int v5; // eax@7 | |
9256 | |
9257 auto a1 = this; | |
9258 if ( a1->field_0 == 0x67707274 ) | |
9259 { | |
9260 if ( a2 ) | |
9261 { | |
9262 a1->field_8 = 0; | |
9263 a1->field_30 = 0.0; | |
9264 } | |
9265 if ( a1->field_59 && a3 ) | |
9266 { | |
9267 v4 = a1->field_4; | |
9268 v5 = a1->field_54; | |
9269 do | |
9270 { | |
9271 *(int *)v5 = 0; | |
9272 v5 += 28; | |
9273 --v4; | |
9274 } | |
9275 while ( v4 ); | |
9276 a1->field_58 = 0; | |
9277 } | |
9278 result = 0; | |
9279 } | |
9280 else | |
9281 { | |
9282 result = 2; | |
9283 } | |
9284 return result; | |
9285 } | |
9286 | |
9287 //----- (0040E133) -------------------------------------------------------- | |
9288 int stru272_stru0::_40E133() | |
9289 { | |
9290 stru272_stru0 *v1; // edi@1 | |
9291 int v3; // ST18_4@3 | |
9292 double v4; // st7@3 | |
9293 double v5; // st6@4 | |
9294 char v6; // bl@8 | |
9295 int v7; // esi@8 | |
9296 int v8; // ecx@10 | |
9297 signed int v9; // eax@10 | |
9298 int v10; // ecx@10 | |
9299 signed int v11; // eax@10 | |
9300 signed int v12; // edx@12 | |
9301 signed int v13; // edx@12 | |
9302 int v14; // [sp+8h] [bp-10h]@8 | |
9303 int v15; // [sp+Ch] [bp-Ch]@8 | |
9304 float v16; // [sp+14h] [bp-4h]@3 | |
9305 | |
9306 v1 = this; | |
9307 if ( this->field_0 != 0x67707274 ) | |
9308 return 2; | |
9309 v3 = this->field_8; | |
9310 v16 = this->field_30; | |
9311 v4 = (double)v3; | |
9312 if ( v3 > 0 ) | |
9313 { | |
9314 v5 = v16 + this->field_2C; | |
9315 v16 = v5; | |
9316 if ( v5 > v4 ) | |
9317 v16 = v4; | |
9318 } | |
9319 if ( v16 >= 1.0 || this->field_58 ) | |
9320 { | |
9321 v6 = 0; | |
9322 v7 = this->field_54; | |
9323 v14 = (signed __int64)this->field_28; | |
9324 v15 = this->field_4; | |
9325 while ( *(int *)v7 <= 0 ) | |
9326 { | |
9327 if ( v16 >= 1.0 ) | |
9328 { | |
9329 *(int *)v7 = v1->field_3C + rand() % (v1->field_40 - v1->field_3C + 1); | |
9330 *(int *)(v7 + 20) = (rand() % 17 - 8) << 16; | |
9331 *(int *)(v7 + 24) = (rand() % 17 - 8) << 16; | |
9332 v12 = v1->field_C + rand() % (v1->field_14 - 1 - v1->field_C + 1); | |
9333 *(int *)(v7 + 12) = v12; | |
9334 *(int *)(v7 + 4) = v12 >> 16; | |
9335 v16 = v16 - 1.0; | |
9336 v13 = v1->field_10 + rand() % (v1->field_18 - 1 - v1->field_10 + 1); | |
9337 *(int *)(v7 + 16) = v13; | |
9338 *(int *)(v7 + 8) = v13 >> 16; | |
9339 --v1->field_8; | |
9340 goto LABEL_13; | |
9341 } | |
9342 LABEL_14: | |
9343 v7 += 28; | |
9344 --v15; | |
9345 if ( !v15 ) | |
9346 { | |
9347 v1->field_58 = v6; | |
9348 v1->field_30 = v16; | |
9349 return 0; | |
9350 } | |
9351 } | |
9352 v8 = *(int *)(v7 + 20); | |
9353 --*(int *)v7; | |
9354 v9 = v8 + *(int *)(v7 + 12); | |
9355 v10 = v14 + *(int *)(v7 + 24); | |
9356 *(int *)(v7 + 12) = v9; | |
9357 *(int *)(v7 + 4) = v9 >> 16; | |
9358 v11 = v10 + *(int *)(v7 + 16); | |
9359 *(int *)(v7 + 24) = v10; | |
9360 *(int *)(v7 + 16) = v11; | |
9361 *(int *)(v7 + 8) = v11 >> 16; | |
9362 LABEL_13: | |
9363 v6 = 1; | |
9364 goto LABEL_14; | |
9365 } | |
9366 return 0; | |
9367 } | |
9368 | |
9369 //----- (0040E2A7) -------------------------------------------------------- | |
9370 int stru272_stru0::_40E2A7() | |
9371 { | |
9372 int result; // eax@2 | |
9373 | |
9374 if ( this->field_0 == 0x67707274 ) | |
9375 { | |
9376 if ( this->field_8 <= 0 ) | |
9377 result = this->field_58 != 0 ? 2 : 0; | |
9378 else | |
9379 result = 1; | |
9380 } | |
9381 else | |
9382 { | |
9383 result = 3; | |
9384 } | |
9385 return result; | |
9386 } | |
9387 | |
9388 //----- (0040F82D) -------------------------------------------------------- | |
9389 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) | |
9390 { | |
973 | 9391 assert(uTextureId != -1); |
9392 ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue); | |
0 | 9393 } |
9394 | |
9395 //----- (0040F845) -------------------------------------------------------- | |
9396 __int16 __fastcall sub_40F845(int a1, int a2, int a3, int a4, int a5, __int16 a6, int a7) | |
9397 { | |
9398 int v7; // edi@1 | |
9399 int v8; // esi@1 | |
9400 int v9; // ecx@2 | |
9401 int v10; // eax@3 | |
9402 | |
9403 v7 = a1; | |
9404 v8 = a2; | |
9405 do | |
9406 { | |
9407 v9 = a3; | |
9408 do | |
9409 { | |
9410 v10 = *(char *)v8++; | |
9411 if ( (char)v10 ) | |
9412 { | |
9413 if ( (char)v10 == 1 ) | |
9414 { | |
9415 LOWORD(v10) = *(short *)(a5 + 2 * v10); | |
9416 *(short *)v7 = v10; | |
9417 } | |
9418 else | |
9419 { | |
9420 LOWORD(v10) = a6; | |
9421 *(short *)v7 = a6; | |
9422 } | |
9423 } | |
9424 v7 += 2; | |
9425 --v9; | |
9426 } | |
9427 while ( v9 ); | |
9428 v7 = a7 + v7 - a3 - a3; | |
9429 --a4; | |
9430 } | |
9431 while ( a4 ); | |
9432 return v10; | |
9433 } | |
9434 | |
9435 //----- (0040F89C) -------------------------------------------------------- | |
9436 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue) | |
9437 { | |
9438 void *v3; // eax@3 | |
9439 void *v4; // esi@5 | |
9440 int *v5; // edi@5 | |
9441 int v6; // eax@5 | |
9442 int v7; // ecx@6 | |
9443 Texture *v8; // [sp+Ch] [bp-14h]@1 | |
9444 int *v9; // [sp+10h] [bp-10h]@1 | |
9445 int v10; // [sp+14h] [bp-Ch]@1 | |
9446 int v11; // [sp+18h] [bp-8h]@1 | |
9447 void *v12; // [sp+1Ch] [bp-4h]@5 | |
9448 | |
9449 v10 = pTex->uTextureWidth; | |
9450 v8 = pTex; | |
9451 v9 = pZBuffer; | |
9452 v11 = pTex->uTextureHeight; | |
9453 if ( pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize ) | |
9454 v3 = pTex->UnzipPalette(); | |
9455 else | |
710 | 9456 v3 = pTex->pLevelOfDetail0_prolly_alpha_mask; |
0 | 9457 v12 = v3; |
9458 v4 = v3; | |
9459 v5 = v9; | |
9460 v6 = 0; | |
9461 do | |
9462 { | |
9463 v7 = v10; | |
9464 do | |
9465 { | |
9466 LOBYTE(v6) = *(char *)v4; | |
9467 v4 = (char *)v4 + 1; | |
9468 if ( v6 ) | |
9469 *v5 = uZValue; | |
9470 ++v5; | |
9471 --v7; | |
9472 } | |
9473 while ( v7 ); | |
9474 v5 += 640 - v10; | |
9475 --v11; | |
9476 } | |
9477 while ( v11 ); | |
9478 if ( pIcons_LOD->dword_011BA4 ) | |
9479 { | |
9480 if ( v8->uDecompressedSize ) | |
9481 free(v12); | |
9482 } | |
9483 } | |
9484 | |
9485 //----- (0040F92A) -------------------------------------------------------- | |
9486 void __fastcall sub_40F92A(int *pZBuffer, Texture *a2, int a3) | |
9487 { | |
9488 Texture *v3; // esi@1 | |
9489 void *v4; // eax@3 | |
9490 int *v5; // edi@5 | |
9491 int v6; // ecx@6 | |
9492 int *v7; // [sp+Ch] [bp-10h]@1 | |
9493 int v8; // [sp+10h] [bp-Ch]@1 | |
9494 int v9; // [sp+18h] [bp-4h]@1 | |
9495 | |
9496 v3 = a2; | |
9497 v7 = pZBuffer; | |
9498 v8 = a2->uTextureWidth; | |
9499 v9 = a2->uTextureHeight; | |
9500 if ( pIcons_LOD->dword_011BA4 && a2->uDecompressedSize ) | |
9501 v4 = a2->UnzipPalette(); | |
9502 else | |
710 | 9503 v4 = a2->pLevelOfDetail0_prolly_alpha_mask; |
0 | 9504 v5 = v7; |
9505 do | |
9506 { | |
9507 v6 = v8; | |
9508 do | |
9509 { | |
9510 *v5 = a3; | |
9511 ++v5; | |
9512 --v6; | |
9513 } | |
9514 while ( v6 ); | |
9515 v5 += 640 - v8; | |
9516 --v9; | |
9517 } | |
9518 while ( v9 ); | |
9519 if ( pIcons_LOD->dword_011BA4 ) | |
9520 { | |
9521 if ( v3->uDecompressedSize ) | |
9522 free(v4); | |
9523 } | |
9524 } | |
9525 | |
9526 | |
9527 | |
9528 | |
9529 | |
9530 | |
9531 | |
9532 | |
9533 | |
9534 | |
9535 | |
9536 | |
9537 | |
9538 | |
9539 //----- (00410AF5) -------------------------------------------------------- | |
9540 void __cdecl SetMoonPhaseNames() | |
9541 { | |
9542 aMoonPhaseNames[0] = pGlobalTXT_LocalizationStrings[150]; | |
9543 aMoonPhaseNames[1] = pGlobalTXT_LocalizationStrings[171]; | |
9544 aMoonPhaseNames[2] = pGlobalTXT_LocalizationStrings[102]; | |
9545 aMoonPhaseNames[3] = pGlobalTXT_LocalizationStrings[169]; | |
9546 aMoonPhaseNames[4] = pGlobalTXT_LocalizationStrings[92]; | |
9547 } | |
9548 | |
9549 | |
9550 //----- (00410D99) -------------------------------------------------------- | |
9551 signed int __fastcall sub_410D99_get_map_index(int a1) | |
9552 { | |
9553 int v1; // edi@1 | |
9554 signed int v2; // ebp@1 | |
9555 const char **v3; // esi@2 | |
9556 char *v4; // ebx@2 | |
9557 | |
9558 v1 = a1; | |
9559 v2 = 1; | |
9560 if ( _strcmpi(pMapStats->pInfos[1].pFilename, (const char *)&pGames_LOD->pSubIndices[a1]) ) | |
9561 { | |
9562 v3 = (const char **)&pMapStats->pInfos[1].pFilename; | |
9563 v4 = (char *)&pMapStats->pInfos[1].pFilename; | |
9564 do | |
9565 { | |
9566 if ( !*(int *)v4 ) | |
9567 break; | |
9568 v3 += 17; | |
9569 ++v2; | |
9570 v4 = (char *)v3; | |
9571 } | |
9572 while ( _strcmpi(*v3, (const char *)&pGames_LOD->pSubIndices[v1]) ); | |
9573 } | |
9574 return v2; | |
9575 } | |
9576 | |
9577 //----- (00410DEC) -------------------------------------------------------- | |
9578 unsigned int __cdecl DrawLloydBeaconsScreen() | |
9579 { | |
961 | 9580 Player *pPlayer; // esi@1 |
0 | 9581 char *v1; // eax@1 |
9582 unsigned __int16 v2; // ax@6 | |
9583 unsigned int result; // eax@11 | |
9584 unsigned int v4; // esi@13 | |
9585 unsigned int v5; // ecx@13 | |
9586 char v6; // zf@13 | |
9587 LloydBeacon *v7; // esi@14 | |
9588 int v8; // eax@14 | |
9589 unsigned __int64 v9; // kr08_8@14 | |
9590 unsigned int v10; // esi@14 | |
9591 unsigned int v11; // eax@14 | |
9592 char *v12; // eax@19 | |
9593 char *v13; // ecx@22 | |
9594 int v14; // eax@27 | |
9595 Texture *v19; // [sp-4h] [bp-8Ch]@4 | |
961 | 9596 GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1 |
0 | 9597 unsigned int v23; // [sp+64h] [bp-24h]@14 |
9598 __int64 v24; // [sp+68h] [bp-20h]@14 | |
9599 unsigned int v25; // [sp+70h] [bp-18h]@13 | |
9600 char *Str; // [sp+74h] [bp-14h]@14 | |
9601 int v27; // [sp+78h] [bp-10h]@11 | |
9602 LloydBeacon *v28; // [sp+7Ch] [bp-Ch]@12 | |
9603 RGBTexture *v29; // [sp+80h] [bp-8h]@12 | |
9604 int uNumMaxBeacons; // [sp+84h] [bp-4h]@6 | |
9605 | |
961 | 9606 pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid]; |
0 | 9607 pRenderer->DrawTextureIndexed(8u, 8u, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]); |
9608 v1 = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon | |
961 | 9609 pWindow.uFrameX = game_viewport_x; |
9610 pWindow.uFrameY = game_viewport_y; | |
9611 pWindow.uFrameWidth = 428; | |
9612 pWindow.uFrameHeight = game_viewport_height; | |
9613 pWindow.uFrameZ = 435; | |
9614 pWindow.uFrameW = game_viewport_w; | |
0 | 9615 if ( !bRecallingBeacon ) |
9616 v1 = pGlobalTXT_LocalizationStrings[375]; // Set Beacon | |
9617 sprintf(pTmpBuf, "%s", v1); | |
961 | 9618 pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf, 3u); |
0 | 9619 if ( bRecallingBeacon ) |
9620 { | |
9621 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on); | |
9622 v19 = pTex_tab_an_6a__zoom_off; | |
9623 } | |
9624 else | |
9625 { | |
9626 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6a__zoom_off); | |
9627 v19 = pTex_tab_an_6b__zoom_on; | |
9628 } | |
9629 pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19); | |
961 | 9630 v2 = pPlayer->pActiveSkills[14]; |
0 | 9631 uNumMaxBeacons = 1; |
9632 if ( HIBYTE(v2) & 1 || (v2 & 0x80u) != 0 ) | |
9633 { | |
9634 uNumMaxBeacons = 5; | |
9635 } | |
9636 else | |
9637 { | |
9638 if ( v2 & 0x40 ) | |
9639 uNumMaxBeacons = 3; | |
9640 } | |
9641 result = 0; | |
9642 v27 = 0; | |
9643 if ( uNumMaxBeacons > 0 ) | |
9644 { | |
9645 v29 = pSavegameThumbnails; | |
961 | 9646 v28 = pPlayer->pInstalledBeacons; |
0 | 9647 while ( 1 ) |
9648 { | |
961 | 9649 pWindow.uFrameWidth = 92; |
0 | 9650 v4 = result; |
961 | 9651 pWindow.uFrameHeight = 68; |
0 | 9652 v5 = pLloydsBeaconsPreviewXs[result]; |
961 | 9653 pWindow.uFrameY = pLloydsBeaconsPreviewYs[result]; |
9654 v25 = pWindow.uFrameY; | |
9655 pWindow.uFrameX = v5; | |
9656 pWindow.uFrameW = pWindow.uFrameY + 67; | |
0 | 9657 v6 = v29->pPixels == 0; |
961 | 9658 pWindow.uFrameZ = v5 + 91; |
0 | 9659 if ( !v6 ) |
9660 break; | |
9661 if ( !bRecallingBeacon ) | |
9662 { | |
961 | 9663 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook); |
9664 v14 = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0); | |
9665 pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - v14 / 2, 1, pGlobalTXT_LocalizationStrings[19], 3); | |
0 | 9666 } |
9667 LABEL_29: | |
9668 ++v29; | |
9669 ++v28; | |
9670 result = v27++ + 1; | |
9671 if ( v27 >= uNumMaxBeacons ) | |
9672 goto LABEL_30; | |
9673 } | |
961 | 9674 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook); |
0 | 9675 pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[v4], pLloydsBeaconsPreviewYs[v4], v29); |
9676 v7 = v28; | |
9677 Str = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(v28->field_18))].pName; | |
961 | 9678 v8 = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0); |
9679 pWindow.uFrameY += -6 - v8; | |
9680 pWindow.DrawTitleText(pSpellFont, 0, 0, 1u, Str, 3u); | |
0 | 9681 v9 = v7->uBeaconTime - pParty->uTimePlayed; |
9682 LODWORD(v24) = LODWORD(v7->uBeaconTime) - LODWORD(pParty->uTimePlayed); | |
9683 HIDWORD(v24) = HIDWORD(v9); | |
9684 v23 = (unsigned __int64)((signed __int64)((double)v24 * 0.234375) / 60 / 60) >> 32; | |
9685 v10 = (signed __int64)((double)v24 * 0.234375) / 60 / 60; | |
9686 v11 = v10 / 0x18; | |
9687 if ( (unsigned int)((signed __int64)((double)v24 * 0.234375) / 60 / 60) / 0x18 ) | |
9688 { | |
9689 v13 = pGlobalTXT_LocalizationStrings[57]; // Days | |
9690 if ( v11 > 1 ) | |
9691 { | |
961 | 9692 sprintf(pTmpBuf, "%lu %s", v11 + 1, v13); |
9693 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4; | |
9694 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3); | |
0 | 9695 goto LABEL_29; |
9696 } | |
9697 } | |
9698 else | |
9699 { | |
9700 if ( (signed __int64)(__PAIR__(v23, v10) + 1) <= 23 ) | |
9701 { | |
9702 if ( (v23 & 0x80000000u) != 0 || (signed int)v23 <= 0 && v10 <= 1 ) | |
9703 v12 = pGlobalTXT_LocalizationStrings[109];// Hour | |
9704 else | |
9705 v12 = pGlobalTXT_LocalizationStrings[110];// Hours | |
961 | 9706 sprintf(pTmpBuf, "%lu %s", v10 + 1, v12); |
9707 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4; | |
9708 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3); | |
9709 goto LABEL_29; | |
0 | 9710 } |
9711 } | |
9712 v13 = pGlobalTXT_LocalizationStrings[56]; // Day | |
961 | 9713 sprintf(pTmpBuf, "%lu %s", v11 + 1, v13); |
9714 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4; | |
9715 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3); | |
9716 goto LABEL_29; | |
0 | 9717 } |
9718 LABEL_30: | |
9719 if ( byte_506360 ) | |
9720 { | |
437 | 9721 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 9722 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
9723 { | |
961 | 9724 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CloseAfterInstallBeacon; |
0 | 9725 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9726 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
9727 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; | |
9728 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 9729 }*/ |
961 | 9730 pMessageQueue_50CBD0->AddMessage(UIMSG_CloseAfterInstallBeacon, 0, 0); |
0 | 9731 } |
9732 return result; | |
9733 } | |
9734 | |
9735 | |
9736 //----- (00413FF1) -------------------------------------------------------- | |
995 | 9737 void SetMonthNames() |
0 | 9738 { |
9739 aMonthNames[0] = pGlobalTXT_LocalizationStrings[415]; | |
9740 aMonthNames[1] = pGlobalTXT_LocalizationStrings[416]; | |
9741 aMonthNames[2] = pGlobalTXT_LocalizationStrings[417]; | |
9742 aMonthNames[3] = pGlobalTXT_LocalizationStrings[418]; | |
9743 aMonthNames[4] = pGlobalTXT_LocalizationStrings[419]; | |
9744 aMonthNames[5] = pGlobalTXT_LocalizationStrings[420]; | |
9745 aMonthNames[6] = pGlobalTXT_LocalizationStrings[421]; | |
9746 aMonthNames[7] = pGlobalTXT_LocalizationStrings[422]; | |
9747 aMonthNames[8] = pGlobalTXT_LocalizationStrings[423]; | |
9748 aMonthNames[9] = pGlobalTXT_LocalizationStrings[424]; | |
9749 aMonthNames[10] = pGlobalTXT_LocalizationStrings[425]; | |
9750 aMonthNames[11] = pGlobalTXT_LocalizationStrings[426]; | |
9751 } | |
9752 | |
9753 //----- (0041406F) -------------------------------------------------------- | |
995 | 9754 void SetDayNames() |
0 | 9755 { |
9756 aDayNames[0] = pGlobalTXT_LocalizationStrings[145]; | |
9757 aDayNames[1] = pGlobalTXT_LocalizationStrings[230]; | |
9758 aDayNames[2] = pGlobalTXT_LocalizationStrings[243]; | |
9759 aDayNames[3] = pGlobalTXT_LocalizationStrings[227]; | |
9760 aDayNames[4] = pGlobalTXT_LocalizationStrings[91]; | |
9761 aDayNames[5] = pGlobalTXT_LocalizationStrings[188]; | |
9762 aDayNames[6] = pGlobalTXT_LocalizationStrings[222]; | |
9763 } | |
9764 | |
9765 //----- (004140BB) -------------------------------------------------------- | |
995 | 9766 void SetSpellSchoolNames() |
0 | 9767 { |
9768 aSpellSchoolNames[0] = pGlobalTXT_LocalizationStrings[87]; | |
9769 aSpellSchoolNames[1] = pGlobalTXT_LocalizationStrings[6]; | |
9770 aSpellSchoolNames[2] = pGlobalTXT_LocalizationStrings[240]; | |
9771 aSpellSchoolNames[3] = pGlobalTXT_LocalizationStrings[70]; | |
9772 aSpellSchoolNames[4] = pGlobalTXT_LocalizationStrings[214]; | |
9773 aSpellSchoolNames[5] = pGlobalTXT_LocalizationStrings[142]; | |
9774 aSpellSchoolNames[6] = pGlobalTXT_LocalizationStrings[29]; | |
9775 aSpellSchoolNames[7] = pGlobalTXT_LocalizationStrings[133]; | |
9776 aSpellSchoolNames[8] = pGlobalTXT_LocalizationStrings[54]; | |
9777 } | |
9778 | |
9779 //----- (0041411B) -------------------------------------------------------- | |
995 | 9780 void SetAttributeNames() |
0 | 9781 { |
9782 aAttributeNames[0] = pGlobalTXT_LocalizationStrings[144]; | |
9783 aAttributeNames[1] = pGlobalTXT_LocalizationStrings[116]; | |
9784 aAttributeNames[2] = pGlobalTXT_LocalizationStrings[163]; | |
9785 aAttributeNames[3] = pGlobalTXT_LocalizationStrings[75]; | |
9786 aAttributeNames[4] = pGlobalTXT_LocalizationStrings[1]; | |
9787 aAttributeNames[5] = pGlobalTXT_LocalizationStrings[211]; | |
9788 aAttributeNames[6] = pGlobalTXT_LocalizationStrings[136]; | |
9789 } | |
9790 | |
9791 //----- (00414162) -------------------------------------------------------- | |
995 | 9792 void uGameUIFontMain_initialize() |
0 | 9793 { |
949 | 9794 uGameUIFontMain = TargetColor(0xAu, 0, 0); |
0 | 9795 } |
9796 | |
9797 //----- (00414174) -------------------------------------------------------- | |
995 | 9798 void uGameUIFontShadow_initialize() |
0 | 9799 { |
949 | 9800 uGameUIFontShadow = TargetColor(0xE6u, 214u, 193u); |
0 | 9801 } |
9802 | |
9803 | |
9804 | |
9805 | |
9806 //----- (0041420D) -------------------------------------------------------- | |
9807 void __cdecl sub_41420D_press_esc() | |
9808 { | |
9809 GUIWindow v0; // [sp+4h] [bp-54h]@1 | |
9810 | |
9811 sprintf(pTmpBuf2, "%s\n \n%s", ptr_507BDC->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape | |
9812 v0.Hint = pTmpBuf2; | |
9813 v0.uFrameWidth = 400; | |
9814 v0.uFrameHeight = 100; | |
9815 v0.uFrameX = 120; | |
9816 v0.uFrameY = 140; | |
9817 v0.uFrameZ = 519; | |
9818 v0.uFrameW = 239; | |
9819 v0.DrawMessageBox(0); | |
9820 } | |
9821 | |
9822 //----- (0041426F) -------------------------------------------------------- | |
9823 void __cdecl sub_41426F() | |
9824 { | |
9825 GUIWindow *v0; // ecx@1 | |
9826 | |
9827 v0 = ptr_507BDC; | |
437 | 9828 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BDC->ptr_1C, 0, 0); |
1038 | 9829 |
0 | 9830 v0->Release(); |
9831 ptr_507BDC = 0; | |
9832 pCurrentScreen = dword_506F0C[0]; | |
9833 pEventTimer->Resume(); | |
9834 } | |
9835 // 4E28F8: using guessed type int pCurrentScreen; | |
9836 | |
706 | 9837 |
9838 | |
762 | 9839 void LoadFonts_and_DrawCopyrightWindow() |
9840 { | |
9841 MainMenuUI_LoadFontsAndSomeStuff(); | |
9842 DrawCopyrightWindow(); | |
9843 } | |
0 | 9844 |
9845 //----- (00415485) -------------------------------------------------------- | |
573 | 9846 void DrawCopyrightWindow() |
0 | 9847 { |
9848 GUIWindow Dst; // [sp+8h] [bp-54h]@1 | |
9849 | |
9850 memset(&Dst, 0, 0x54u); | |
9851 Dst.uFrameWidth = 624; | |
9852 Dst.uFrameHeight = 256; | |
9853 Dst.uFrameX = 8; | |
9854 Dst.uFrameY = 30; // c 1999 The 3DO Company. | |
9855 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(pGlobalTXT_LocalizationStrings[157], &Dst, 24, 0) | |
9856 + 2 * LOBYTE(pFontSmallnum->uFontHeight) | |
9857 + 24; | |
9858 Dst.uFrameY = 470 - Dst.uFrameHeight; | |
9859 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
9860 Dst.uFrameW = 469; | |
1004 | 9861 //Dst.Hint = "abcagfdsgsg ljsrengvlkjesnfkjwnef"; |
0 | 9862 Dst.DrawMessageBox(0); |
1004 | 9863 |
0 | 9864 Dst.uFrameWidth -= 24; |
9865 Dst.uFrameX += 12; | |
9866 Dst.uFrameY += 12; | |
9867 Dst.uFrameHeight -= 12; | |
9868 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
9869 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
1004 | 9870 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3); |
0 | 9871 } |
9872 | |
9873 | |
9874 | |
9875 //----- (004156F0) -------------------------------------------------------- | |
1031 | 9876 void GUI_UpdateWindows() |
0 | 9877 { |
9878 GUIWindow *pWindow; // esi@4 | |
1033 | 9879 //unsigned int pWindowType; // eax@4 |
0 | 9880 char *pHint; // edx@66 |
9881 GUIButton *pButtonPtr_1C; // ebp@79 | |
4 | 9882 char *pHint1; // edx@80 |
0 | 9883 int v26; // eax@98 |
9884 unsigned int v27; // ebp@106 | |
9885 GUIWindow *pGUIWindow2; // ecx@109 | |
9886 GUIFont *pGUIFont; // ST1C_4@115 | |
9887 int v31; // eax@115 | |
959 | 9888 GUIButton *pButton; // ebp@118 |
0 | 9889 int v39; // eax@129 |
9890 unsigned int pNumMessages; // eax@142 | |
9891 GUIButton *pGUIButton; // ebp@146 | |
973 | 9892 //unsigned int pX; // [sp-1Ch] [bp-124h]@17 |
9893 //unsigned int pY; // [sp-18h] [bp-120h]@17 | |
9894 //Texture *pTexture; // [sp-14h] [bp-11Ch]@17 | |
9895 //Texture *pTexture2; // [sp-14h] [bp-11Ch]@86 | |
0 | 9896 int i; // [sp+0h] [bp-108h]@3 |
9897 ItemGen pItemGen; // [sp+4h] [bp-104h]@98 | |
9898 GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133 | |
9899 ItemGen ItemGen2; // [sp+E4h] [bp-24h]@129 | |
9900 | |
9901 if (GetCurrentMenuID() != MENU_CREATEPARTY) | |
972 | 9902 UI_OnKeyDown(VK_NEXT); |
9903 | |
0 | 9904 for ( i = 1; i <= uNumVisibleWindows; ++i ) |
9905 { | |
9906 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; | |
9907 switch (pWindow->eWindowType) | |
9908 { | |
970 | 9909 case WINDOW_OptionsButtons: |
962 | 9910 { |
973 | 9911 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y, |
9912 pViewport->uViewportTL_X, pIcons_LOD->GetTexture(uTextureID_Options)); | |
962 | 9913 viewparams->bRedrawGameUI = 1; |
9914 continue; | |
9915 } | |
970 | 9916 case WINDOW_CharacterRecord: |
962 | 9917 { |
991 | 9918 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]); |
962 | 9919 continue; |
9920 } | |
970 | 9921 case WINDOW_Options: |
962 | 9922 { |
1031 | 9923 GameMenuUI_Options_Draw(); |
962 | 9924 continue; |
9925 } | |
970 | 9926 case WINDOW_Book: |
962 | 9927 { |
995 | 9928 BookUI_Draw((WindowType)(int)pWindow->ptr_1C); |
962 | 9929 continue; |
9930 } | |
970 | 9931 case WINDOW_Dialogue: |
962 | 9932 { |
1033 | 9933 GameUI_DrawDialogue(); |
962 | 9934 continue; |
9935 } | |
970 | 9936 case WINDOW_QuickReference: |
962 | 9937 { |
991 | 9938 GameUI_QuickRef_Draw(); |
962 | 9939 continue; |
9940 } | |
970 | 9941 case WINDOW_Rest: |
962 | 9942 { |
9943 RestUI_Draw(); | |
9944 continue; | |
9945 } | |
970 | 9946 case WINDOW_ChangeLocation: |
962 | 9947 { |
9948 TravelUI_Draw(); | |
9949 continue; | |
9950 } | |
970 | 9951 case WINDOW_SpellBook: |
962 | 9952 { |
1004 | 9953 DrawSpellBookContent(pPlayers[uActiveCharacter]); |
962 | 9954 continue; |
9955 } | |
970 | 9956 case WINDOW_GreetingNPC: |
962 | 9957 { |
1033 | 9958 GameUI_DrawBranchlessDialogue(); |
962 | 9959 continue; |
9960 } | |
970 | 9961 case WINDOW_Chest: |
962 | 9962 { |
9963 if ( pCurrentScreen == SCREEN_CHEST ) | |
9964 { | |
9965 Chest::DrawChestUI((unsigned int)pWindow->ptr_1C); | |
9966 } | |
987 | 9967 else if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) |
962 | 9968 { |
9969 pRenderer->ClearZBuffer(0, 479); | |
9970 draw_leather(); | |
984 | 9971 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
973 | 9972 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId)); |
962 | 9973 } |
9974 continue; | |
9975 } | |
970 | 9976 case WINDOW_SaveLoadButtons: |
962 | 9977 { |
1033 | 9978 SaveUI_Draw(); |
962 | 9979 continue; |
9980 } | |
970 | 9981 case WINDOW_MainMenu_Load: |
961 | 9982 { |
1033 | 9983 LoadUI_Draw(); |
962 | 9984 continue; |
9985 } | |
970 | 9986 case WINDOW_HouseInterior: |
962 | 9987 { |
9988 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager(); | |
9989 if ( !window_SpeakInHouse ) | |
9990 continue; | |
970 | 9991 if ( (signed int)window_SpeakInHouse->ptr_1C >= 53 ) |
9992 continue; | |
9993 if ( pParty->field_3C._shop_ban_times[(signed int)window_SpeakInHouse->ptr_1C] <=pParty->uTimePlayed ) | |
962 | 9994 { |
970 | 9995 if ( (signed int)window_SpeakInHouse->ptr_1C < 53 ) |
9996 { | |
9997 pParty->field_3C._shop_ban_times[(signed int)window_SpeakInHouse->ptr_1C] = 0; | |
962 | 9998 } |
9999 continue; | |
10000 } | |
10001 pNumMessages = pMessageQueue_50CBD0->uNumMessages; | |
10002 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
10003 continue; | |
10004 } | |
970 | 10005 case WINDOW_Transition: |
962 | 10006 { |
10007 TransitionUI_Draw(); | |
10008 continue; | |
10009 } | |
970 | 10010 case WINDOW_Scroll: |
962 | 10011 { |
10012 CreateScrollWindow(); | |
10013 continue; | |
10014 } | |
970 | 10015 case WINDOW_CastSpell_InInventory: |
962 | 10016 { |
10017 pRenderer->ClearZBuffer(0, 479); | |
10018 draw_leather(); | |
984 | 10019 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
991 | 10020 CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]); |
973 | 10021 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u)); |
962 | 10022 continue; |
10023 } | |
970 | 10024 case WINDOW_FinalWindow: |
962 | 10025 { |
10026 sub_41420D_press_esc(); | |
10027 continue; | |
10028 } | |
970 | 10029 case WINDOW_50: |
962 | 10030 { |
10031 v27 = TargetColor(255, 255, 255); | |
1038 | 10032 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
962 | 10033 { |
10034 ptr_507BD0->DrawMessageBox(0); | |
10035 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
10036 v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); | |
10037 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate); | |
10038 continue; | |
10039 } | |
1038 | 10040 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) |
962 | 10041 { |
1038 | 10042 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
962 | 10043 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); |
10044 pEventTimer->Resume(); | |
10045 ptr_507BD0->Release(); | |
1038 | 10046 pCurrentScreen = SCREEN_GAME; |
10047 viewparams->bRedrawGameUI = true; | |
962 | 10048 continue; |
10049 } | |
1038 | 10050 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) |
962 | 10051 { |
1038 | 10052 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
962 | 10053 pEventTimer->Resume(); |
10054 ptr_507BD0->Release(); | |
10055 continue; | |
10056 } | |
10057 } | |
970 | 10058 case WINDOW_59: |
962 | 10059 { |
10060 pWindow->DrawMessageBox(0); | |
10061 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | |
10062 pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
10063 if ( !pKeyActionMap->field_204 ) | |
10064 { | |
10065 ItemGen2.Reset(); | |
10066 pWindow->Release(); | |
10067 pEventTimer->Resume(); | |
10068 pCurrentScreen = 0; | |
1038 | 10069 viewparams->bRedrawGameUI = true; |
962 | 10070 v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); |
10071 if ( v26 > 0 ) | |
10072 { | |
10073 if ( v26 < 800 ) | |
10074 { | |
10075 ItemGen2.uAttributes |= 1u; | |
10076 ItemGen2.uItemID = v26; | |
10077 if ( pItemsTable->pItems[v26].uEquipType == 12 ) | |
10078 { | |
10079 ItemGen2.uNumCharges = rand() % 6 + pItemsTable->pItems[ItemGen2.uItemID].uDamageMod + 1; | |
10080 ItemGen2.uMaxCharges = LOBYTE(ItemGen2.uNumCharges); | |
10081 } | |
10082 else | |
10083 { | |
10084 if ( v26 >= 221 && v26 < 271 ) | |
10085 ItemGen2.uEnchantmentType = rand() % 10 + 1; | |
10086 } | |
10087 pItemsTable->SetSpecialBonus(&ItemGen2); | |
10088 pParty->SetHoldingItem(&ItemGen2); | |
10089 } | |
10090 } | |
10091 } | |
10092 continue; | |
10093 } | |
970 | 10094 case WINDOW_PressedButton2: |
962 | 10095 { |
10096 if ( pWindow->Hint != (char *)1 ) | |
10097 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
10098 pButton = (GUIButton *)pWindow->ptr_1C; | |
10099 if ( pButton->uX >= 0 && pButton->uX <= 640 ) | |
10100 { | |
10101 if ( pButton->uY >= 0 && pButton->uY <= 480 ) | |
10102 { | |
10103 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
10104 viewparams->bRedrawGameUI = 1; | |
10105 if ( pWindow->Hint ) | |
10106 { | |
970 | 10107 if ( pWindow->Hint != (char *)1 ) |
962 | 10108 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
10109 } | |
10110 pWindow->Release(); | |
10111 continue; | |
10112 } | |
10113 } | |
10114 viewparams->bRedrawGameUI = 1; | |
10115 if ( pWindow->Hint ) | |
10116 { | |
970 | 10117 if ( pWindow->Hint != (char *)1 ) |
962 | 10118 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
10119 } | |
10120 pWindow->Release(); | |
10121 continue; | |
10122 } | |
970 | 10123 case WINDOW_CharactersPressedButton: |
962 | 10124 { |
10125 if ( pWindow->Hint != (char *)1 ) | |
10126 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
10127 pButton = (GUIButton *)pWindow->ptr_1C; | |
10128 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
10129 viewparams->bRedrawGameUI = 1; | |
10130 if ( pWindow->Hint ) | |
10131 { | |
970 | 10132 if ( pWindow->Hint != (char *)1 ) |
962 | 10133 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
10134 } | |
10135 pWindow->Release(); | |
10136 continue; | |
10137 } | |
970 | 10138 case WINDOW_PressedButton: |
962 | 10139 { |
10140 if ( pWindow->Hint != (char *)1 ) | |
10141 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
10142 pButton = (GUIButton *)pWindow->ptr_1C; | |
10143 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
10144 viewparams->bRedrawGameUI = 1; | |
10145 if ( pWindow->Hint ) | |
10146 { | |
970 | 10147 if ( pWindow->Hint != (char *)1 ) |
962 | 10148 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
10149 } | |
10150 pWindow->Release(); | |
10151 continue; | |
10152 } | |
970 | 10153 case WINDOW_5D: |
962 | 10154 { |
10155 if ( pWindow->Hint != (char *)1 ) | |
10156 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
10157 pButton = (GUIButton *)pWindow->ptr_1C; | |
10158 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
10159 viewparams->bRedrawGameUI = 1; | |
10160 pWindow->Release(); | |
10161 continue; | |
10162 } | |
970 | 10163 case WINDOW_SaveLoadBtn: |
961 | 10164 { |
10165 if (pWindow->Hint != (char *)1) | |
10166 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
962 | 10167 pButton = (GUIButton *)pWindow->ptr_1C; |
10168 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
961 | 10169 pHint = pWindow->Hint; |
10170 viewparams->bRedrawGameUI = 1; | |
10171 if ( pHint && pHint != (char *)1 ) | |
962 | 10172 pButton->DrawLabel(pHint, pFontCreate, 0, 0); |
961 | 10173 pWindow->Release(); |
10174 if (pCurrentScreen == SCREEN_SAVEGAME) | |
10175 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0); | |
10176 else | |
10177 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); | |
962 | 10178 continue; |
10179 } | |
970 | 10180 case WINDOW_LoadGame_CancelBtn: |
962 | 10181 { |
10182 if ( pWindow->Hint != (char *)1 ) | |
10183 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
10184 pButton = (GUIButton *)pWindow->ptr_1C; | |
10185 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
10186 viewparams->bRedrawGameUI = 1; | |
10187 if ( pWindow->Hint && pWindow->Hint != (char *)1 ) | |
10188 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
10189 pWindow->Release(); | |
10190 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
10191 continue; | |
10192 } | |
970 | 10193 case WINDOW_CloseRestWindowBtn: |
962 | 10194 { |
10195 if ( pWindow->Hint != (char *)1 ) | |
10196 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
10197 pGUIButton = (GUIButton *)pWindow->ptr_1C; | |
10198 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]); | |
10199 pHint = pWindow->Hint; | |
10200 viewparams->bRedrawGameUI = 1; | |
10201 if ( pHint && pHint != (char *)1 ) | |
10202 pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
10203 pWindow->Release(); | |
10204 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
10205 continue; | |
10206 } | |
970 | 10207 case WINDOW_ExitCharacterWindow: |
962 | 10208 { |
10209 if ( pWindow->Hint != (char *)1 ) | |
10210 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
10211 pButton = (GUIButton *)pWindow->ptr_1C; | |
10212 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
10213 pHint = pWindow->Hint; | |
10214 viewparams->bRedrawGameUI = 1; | |
10215 if ( pHint && pHint != (char *)1 ) | |
10216 pButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
10217 pWindow->Release(); | |
10218 pNumMessages = pMessageQueue_50CBD0->uNumMessages; | |
10219 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
10220 continue; | |
10221 } | |
970 | 10222 case WINDOW_RestWindow: |
962 | 10223 { |
10224 memset(&GUIButton2, 0, 0xBCu); | |
10225 GUIButton2.uZ = 197; | |
10226 GUIButton2.uW = 197; | |
10227 GUIButton2.uX = 27; | |
10228 GUIButton2.uY = 161; | |
10229 GUIButton2.uWidth = 171; | |
10230 GUIButton2.uHeight = 37; | |
10231 GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent; | |
10232 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
10233 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15)); | |
10234 viewparams->bRedrawGameUI = 1; | |
10235 GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);// 8 | |
10236 GUIButton2.pParent = 0; | |
10237 pGUIWindow2 = pWindow; | |
10238 pGUIWindow2->Release(); | |
10239 continue; | |
10240 } | |
970 | 10241 case WINDOW_BooksWindow: |
962 | 10242 { |
10243 pButton = (GUIButton *)pWindow->ptr_1C; | |
973 | 10244 pRenderer->DrawTextureIndexed(pWindow->uFrameY, |
10245 pWindow->uFrameX, pButton->pTextures[0]); | |
1033 | 10246 viewparams->bRedrawGameUI = true; |
962 | 10247 continue; |
10248 } | |
970 | 10249 case WINDOW_CharacterWindow_Inventory: |
962 | 10250 { |
10251 pWindow->DrawMessageBox(0); | |
10252 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | |
10253 pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
10254 if ( !pKeyActionMap->field_204 ) | |
10255 { | |
10256 ItemGen2.Reset(); | |
10257 pWindow->Release(); | |
10258 pEventTimer->Resume(); | |
10259 pCurrentScreen = SCREEN_GAME; | |
10260 viewparams->bRedrawGameUI = 1; | |
10261 v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
10262 if ( v39 > 0 ) | |
10263 { | |
10264 if ( v39 < 800 ) | |
10265 SpawnActor(v39); | |
10266 } | |
10267 } | |
10268 continue; | |
10269 } | |
970 | 10270 case WINDOW_KeyMappingOptions: |
962 | 10271 { |
10272 GameMenuUI_DrawKeyBindings(); | |
10273 continue; | |
10274 } | |
970 | 10275 case WINDOW_VideoOptions: |
962 | 10276 { |
10277 GameMenuUI_DrawVideoOptions(); | |
10278 continue; | |
10279 } | |
10280 default: | |
10281 { | |
10282 continue; | |
10283 } | |
10284 } | |
0 | 10285 } |
10286 if ( GetCurrentMenuID() == -1 ) | |
10287 GameUI_DrawFoodAndGold(); | |
10288 if ( sub_4637E0_is_there_popup_onscreen() ) | |
10289 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0); | |
10290 } | |
10291 | |
10292 //----- (00416196) -------------------------------------------------------- | |
1033 | 10293 void identify_item() |
0 | 10294 { |
10295 Player *v0; // esi@2 | |
10296 POINT *v1; // edi@2 | |
10297 signed int v2; // ecx@5 | |
10298 signed int v3; // eax@5 | |
10299 int v4; // eax@5 | |
10300 char v5; // sf@5 | |
10301 int v6; // eax@5 | |
10302 int v7; // eax@7 | |
10303 unsigned __int16 v8; // ax@10 | |
10304 int v9; // edi@10 | |
10305 int v10; // eax@10 | |
10306 int v11; // edx@13 | |
10307 LONG v12; // edx@23 | |
10308 signed int v13; // edx@23 | |
10309 int v14; // edx@25 | |
10310 unsigned int v15; // edi@25 | |
10311 signed int v16; // edx@27 | |
10312 int v17; // eax@54 | |
10313 unsigned int v18; // edx@57 | |
10314 int v19; // eax@65 | |
10315 int v20; // edi@67 | |
10316 int v21; // eax@72 | |
10317 int v22; // ecx@74 | |
10318 int v23; // edx@78 | |
10319 int v24; // eax@79 | |
10320 int v25; // eax@80 | |
10321 int v26; // eax@84 | |
10322 ItemGen *v27; // esi@98 | |
10323 unsigned int v28; // eax@98 | |
10324 ItemGen *v29; // edi@98 | |
10325 unsigned int v30; // ecx@103 | |
10326 double v31; // st7@112 | |
10327 unsigned __int64 v32; // qax@113 | |
10328 unsigned int v33; // ecx@117 | |
10329 int v34; // eax@126 | |
10330 unsigned int v35; // ecx@127 | |
10331 double v36; // st7@132 | |
10332 signed __int64 v37; // qax@135 | |
10333 unsigned int v38; // eax@138 | |
10334 Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 | |
10335 int *v40; // [sp-Ch] [bp-9Ch]@83 | |
10336 int *v41; // [sp-8h] [bp-98h]@83 | |
10337 int *v42; // [sp-4h] [bp-94h]@83 | |
10338 GUIWindow v43; // [sp+Ch] [bp-84h]@137 | |
10339 unsigned int pY; // [sp+60h] [bp-30h]@2 | |
10340 int v45; // [sp+64h] [bp-2Ch]@10 | |
10341 unsigned int pX; // [sp+68h] [bp-28h]@2 | |
10342 int v47; // [sp+6Ch] [bp-24h]@25 | |
10343 POINT y; // [sp+70h] [bp-20h]@2 | |
10344 POINT a2; // [sp+78h] [bp-18h]@2 | |
10345 Vec3_int_ pOut; // [sp+80h] [bp-10h]@2 | |
10346 unsigned int v51; // [sp+8Ch] [bp-4h]@23 | |
10347 | |
10348 if ( dword_50CDCC ) | |
10349 return; | |
10350 v0 = pPlayers[uActiveCharacter]; | |
10351 v1 = pMouse->GetCursorPos(&a2); | |
10352 pOut.z = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&y)->y]] & 0xFFFF; | |
10353 pMouse->GetClickPos(&pX, &pY); | |
10354 if ( !pOut.z ) | |
10355 { | |
10356 if ( (signed int)pX <= 13 | |
10357 || (signed int)pX >= 462 | |
10358 || (v2 = pX - 14, | |
10359 v3 = pY - 17, | |
10360 pX = v2, | |
10361 pY = v3, | |
10362 v4 = 14 * (v3 >> 5), | |
10363 v2 >>= 5, | |
10364 v5 = v2 + v4 < 0, | |
10365 v6 = v2 + v4, | |
10366 pOut.z = v6, | |
10367 v5) | |
10368 || v6 > 126 | |
10369 || (v7 = v0->GetItemIDAtInventoryIndex(&pOut.z)) == 0 ) | |
10370 return; | |
10371 pOut.z = v7; | |
10372 } | |
10373 if ( !v0->CanAct() ) | |
10374 { | |
10375 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], v0->pName, pGlobalTXT_LocalizationStrings[541]); | |
10376 v43.Hint = pTmpBuf; | |
10377 v43.uFrameWidth = 384; | |
10378 v43.uFrameHeight = 180; | |
10379 v43.uFrameY = 40; | |
10380 if ( pMouse->GetCursorPos(&a2)->x <= 320 ) | |
10381 v38 = pMouse->GetCursorPos(&a2)->x + 30; | |
10382 else | |
10383 v38 = pMouse->GetCursorPos(&a2)->x - 414; | |
10384 v43.uFrameX = v38; | |
10385 v43.DrawMessageBox(0); | |
10386 return; | |
10387 } | |
10388 --pOut.z; | |
10389 LOBYTE(v8) = v0->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY); | |
10390 v9 = v8 & 0x3F; | |
10391 v45 = v8 & 0x3F; | |
10392 pOut.y = SkillToMastery(v8); | |
10393 v10 = pOut.z; | |
10394 if ( pParty->pPickedItem.uItemID == 220 ) | |
10395 { | |
10396 LABEL_116: | |
10397 GameUI_DrawItemInfo(&v0->pInventoryItems[v10]); | |
10398 return; | |
10399 } | |
10400 if ( (signed int)pParty->pPickedItem.uItemID < 200 | |
10401 || (signed int)pParty->pPickedItem.uItemID > 219 | |
10402 || (v11 = (int)((char *)v0 + 36 * pOut.z), *(int *)(v11 + 532) != 220) ) | |
10403 { | |
10404 if ( (signed int)pParty->pPickedItem.uItemID < 221 | |
10405 || (signed int)pParty->pPickedItem.uItemID > 271 | |
10406 || (v12 = (LONG)((char *)v0 + 36 * pOut.z), a2.y = v12, v13 = *(int *)(v12 + 532), v51 = v13, v13 < 221) | |
10407 || v13 > 271 ) | |
10408 { | |
10409 if ( pParty->pPickedItem.uItemID != 236 | |
10410 && ((signed int)pParty->pPickedItem.uItemID < 246 || (signed int)pParty->pPickedItem.uItemID > 250) | |
10411 && pParty->pPickedItem.uItemID != 263 | |
10412 && pParty->pPickedItem.uItemID != 233 ) | |
10413 goto LABEL_116; | |
10414 v27 = &v0->pInventoryItems[pOut.z]; | |
10415 v28 = v27->uItemID; | |
10416 v51 = pItemsTable->pItems[v27->uItemID].uEquipType; | |
570 | 10417 v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEnchantmentType); |
0 | 10418 if ( pParty->pPickedItem.uItemID != 233 ) |
10419 { | |
10420 if ( pParty->pPickedItem.uItemID == 236 ) | |
10421 { | |
10422 v35 = v27->uAttributes; | |
10423 if ( v35 & 2 || (v51 & 0x80000000u) != 0 || (signed int)v51 > 12 || (signed int)v28 >= 500 ) | |
10424 goto LABEL_92; | |
10425 LOWORD(v35) = v35 | 0x210; | |
10426 v27->uAttributes = v35; | |
10427 } | |
10428 else | |
10429 { | |
10430 if ( (signed int)pParty->pPickedItem.uItemID <= 245 ) | |
10431 goto LABEL_92; | |
10432 if ( (signed int)pParty->pPickedItem.uItemID <= 250 ) | |
10433 { | |
10434 v27->UpdateTempBonus(pParty->uTimePlayed); | |
10435 v33 = v27->uItemID; | |
10436 if ( (signed int)v27->uItemID >= 64 && (signed int)v33 <= 65 | |
10437 || (pOut.y = v27->uAttributes, pOut.y & 2) | |
377 | 10438 || v27->uSpecEnchantmentType |
570 | 10439 || v27->uEnchantmentType |
0 | 10440 || v51 && v51 != 1 && v51 != 2 |
10441 || (signed int)v33 >= 500 ) | |
10442 goto LABEL_92; | |
10443 v34 = *(int *)&aSbwb00[4 * pParty->pPickedItem.uItemID + 4]; | |
10444 a2.y = (int)v29 << 7; | |
10445 v31 = (double)(signed int)((int)v29 << 7); | |
377 | 10446 v27->uSpecEnchantmentType = v34; |
0 | 10447 } |
10448 else | |
10449 { | |
10450 if ( pParty->pPickedItem.uItemID != 263 | |
10451 || (v27->UpdateTempBonus(pParty->uTimePlayed), v30 = v27->uItemID, (signed int)v27->uItemID >= 64) | |
10452 && (signed int)v30 <= 65 | |
10453 || (pOut.y = v27->uAttributes, pOut.y & 2) | |
377 | 10454 || v27->uSpecEnchantmentType |
570 | 10455 || v27->uEnchantmentType |
0 | 10456 || v51 && v51 != 1 && v51 != 2 |
10457 || (signed int)v30 >= 500 ) | |
10458 goto LABEL_92; | |
10459 a2.y = (int)v29 << 7; | |
377 | 10460 v27->uSpecEnchantmentType = 40; |
0 | 10461 v31 = (double)a2.y; |
10462 } | |
10463 v32 = pParty->uTimePlayed + (signed int)(signed __int64)(v31 * 0.033333335); | |
10464 LODWORD(v27->uExpireTime) = v32; | |
10465 LODWORD(v32) = pOut.y; | |
10466 LOBYTE(v32) = LOBYTE(pOut.y) | 0x18; | |
10467 HIDWORD(v27->uExpireTime) = HIDWORD(v32); | |
10468 v27->uAttributes = v32; | |
10469 } | |
984 | 10470 _50C9A8_item_enchantment_timer = 256; |
0 | 10471 goto LABEL_92; |
10472 } | |
570 | 10473 v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; |
0 | 10474 if ( v36 < 0.0 ) |
10475 v36 = 0.0; | |
10476 if ( v51 != 12 ) | |
10477 { | |
10478 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
10479 return; | |
10480 } | |
10481 a2.y = v27->uMaxCharges; | |
10482 v37 = (signed __int64)((double)a2.y - v36 * (double)a2.y); | |
10483 v27->uMaxCharges = v37; | |
10484 v27->uNumCharges = (unsigned __int8)v37; | |
10485 goto LABEL_92; | |
10486 } | |
10487 v14 = v13 - 222; | |
10488 v15 = pParty->pPickedItem.uItemID - 222; | |
10489 v47 = v14; | |
10490 y.y = 0; | |
10491 if ( pParty->pPickedItem.uItemID == 221 || v51 == 221 ) | |
10492 { | |
10493 v16 = 5; | |
10494 } | |
10495 else | |
10496 { | |
10497 v16 = *(short *)&pItemsTable->field_EDE0[2 * (v14 + 50 * v15) + 388]; | |
10498 v10 = pOut.z; | |
10499 } | |
10500 v51 = v16; | |
10501 if ( v45 ) | |
10502 { | |
10503 if ( v16 < 225 || v16 > 227 ) | |
10504 { | |
10505 if ( v16 < 228 || v16 > 239 ) | |
10506 { | |
10507 if ( v16 < 240 || v16 > 261 ) | |
10508 { | |
10509 if ( v16 >= 262 && pOut.y != 4 ) | |
10510 { | |
10511 LABEL_53: | |
10512 v51 = 4; | |
10513 goto LABEL_54; | |
10514 } | |
10515 } | |
10516 else | |
10517 { | |
10518 if ( pOut.y <= 2 ) | |
10519 { | |
10520 LABEL_38: | |
10521 v51 = 3; | |
10522 goto LABEL_54; | |
10523 } | |
10524 } | |
10525 } | |
10526 else | |
10527 { | |
10528 if ( pOut.y == 1 ) | |
10529 { | |
10530 LABEL_35: | |
10531 v51 = 2; | |
10532 goto LABEL_54; | |
10533 } | |
10534 } | |
10535 } | |
10536 } | |
10537 else | |
10538 { | |
10539 if ( v16 >= 225 && v16 <= 227 ) | |
10540 { | |
10541 v51 = 1; | |
10542 goto LABEL_54; | |
10543 } | |
10544 if ( v16 >= 228 && v16 <= 239 ) | |
10545 goto LABEL_35; | |
10546 if ( v16 >= 240 && v16 <= 261 ) | |
10547 goto LABEL_38; | |
10548 if ( v16 >= 262 ) | |
10549 goto LABEL_53; | |
10550 } | |
10551 LABEL_54: | |
10552 pOut.y = 0; | |
10553 pOut.x = v10 + 1; | |
10554 v17 = (int)v0->pInventoryIndices; | |
10555 while ( *(int *)v17 != pOut.x ) | |
10556 { | |
10557 ++pOut.y; | |
10558 v17 += 4; | |
10559 if ( pOut.y >= 126 ) | |
10560 { | |
10561 v18 = y.y; | |
10562 goto LABEL_59; | |
10563 } | |
10564 } | |
10565 v18 = pOut.y; | |
10566 LABEL_59: | |
10567 if ( !v51 ) | |
10568 { | |
10569 LABEL_115: | |
10570 v10 = pOut.z; | |
10571 goto LABEL_116; | |
10572 } | |
10573 if ( v51 == 1 ) | |
10574 { | |
10575 v0->RemoveItemAtInventoryIndex(v18); | |
10576 v26 = rand(); | |
1036 | 10577 v0->ReceiveDamage(v26 % 11 + 10, DMGT_FIRE); |
0 | 10578 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); |
437 | 10579 |
10580 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1033 | 10581 |
0 | 10582 v42 = (int *)&a2.y; |
10583 v41 = (int *)&y.y; | |
10584 v40 = (int *)&pOut; | |
10585 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
10586 } | |
10587 else | |
10588 { | |
10589 if ( v51 == 2 ) | |
10590 { | |
10591 v0->RemoveItemAtInventoryIndex(v18); | |
10592 v25 = rand(); | |
1036 | 10593 v0->ReceiveDamage(v25 % 71 + 30, DMGT_FIRE); |
0 | 10594 v23 = 1; |
10595 } | |
10596 else | |
10597 { | |
10598 if ( v51 == 3 ) | |
10599 { | |
10600 v0->RemoveItemAtInventoryIndex(v18); | |
10601 v24 = rand(); | |
1036 | 10602 v0->ReceiveDamage(v24 % 201 + 50, DMGT_FIRE); |
0 | 10603 v23 = 5; |
10604 } | |
10605 else | |
10606 { | |
10607 if ( v51 != 4 ) | |
10608 { | |
10609 if ( v51 != 5 ) | |
10610 { | |
1014 | 10611 v19 = v0->AddItem(-1, 0xDCu); |
0 | 10612 if ( v19 ) |
1019 | 10613 // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; |
10614 v0->pOwnItems[v19-1].uAttributes=ITEM_IDENTIFIED; | |
0 | 10615 v20 = v47 + 50 * v15; |
10616 v0->pInventoryItems[pOut.z].uItemID = v51; | |
570 | 10617 v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType |
10618 + v0->pInventoryItems[pOut.z].uEnchantmentType) | |
0 | 10619 / 2; |
222 | 10620 v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 |
0 | 10621 LABEL_74: |
10622 v22 = (int)((char *)v0 + 36 * pOut.z); | |
222 | 10623 if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) |
0 | 10624 *(int *)(v22 + 552) |= 1u; |
10625 if ( !dword_4E455C ) | |
10626 goto LABEL_92; | |
187 | 10627 v0->PlaySound(SPEECH_16, 0); |
0 | 10628 goto LABEL_91; |
10629 } | |
10630 if ( v45 ) | |
10631 { | |
10632 if ( *(int *)(a2.y + 532) == 221 ) | |
10633 *(int *)(a2.y + 532) = pParty->pPickedItem.uItemID; | |
10634 else | |
570 | 10635 *(int *)(a2.y + 536) = pParty->pPickedItem.uEnchantmentType; |
1014 | 10636 v21 = v0->AddItem(-1, 0xDCu); |
0 | 10637 if ( v21 ) |
1019 | 10638 //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; |
10639 v0->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; | |
0 | 10640 goto LABEL_74; |
10641 } | |
10642 goto LABEL_115; | |
10643 } | |
10644 v0->RemoveItemAtInventoryIndex(v18); | |
10645 v0->SetCondition(0x10u, 0); | |
10646 v23 = 0; | |
10647 } | |
10648 } | |
1012 | 10649 v0->ItemsEnchant(v23); |
0 | 10650 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); |
437 | 10651 |
10652 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1033 | 10653 |
0 | 10654 v42 = (int *)&a2.y; |
10655 v41 = (int *)&y.y; | |
10656 v40 = (int *)&pOut; | |
10657 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
10658 } | |
10659 *(_QWORD *)&v39.x = *(_QWORD *)&pParty->vPosition.x; | |
10660 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, v40, v41, v42); | |
10661 sub_42F7EB_DropItemAt(0x41Bu, pOut.x, y.y, a2.y, 0, 1, 0, 0, 0); | |
10662 if ( dword_4E455C ) | |
10663 { | |
10664 if ( v0->CanAct() ) | |
187 | 10665 v0->PlaySound(SPEECH_17, 0); |
0 | 10666 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); |
10667 LABEL_91: | |
10668 dword_4E455C = 0; | |
10669 } | |
10670 LABEL_92: | |
10671 pMouse->RemoveHoldingItem(); | |
10672 dword_50CDCC = 1; | |
10673 return; | |
10674 } | |
10675 *(int *)(v11 + 536) = v9 + pItemsTable->pItems[pParty->pPickedItem.uItemID].uDamageDice; | |
10676 switch ( pParty->pPickedItem.uItemID ) | |
10677 { | |
10678 case 0xC8u: | |
10679 case 0xC9u: | |
10680 case 0xCAu: | |
10681 case 0xCBu: | |
10682 case 0xCCu: | |
10683 v0->pInventoryItems[pOut.z].uItemID = 222; | |
10684 break; | |
10685 case 0xCDu: | |
10686 case 0xCEu: | |
10687 case 0xCFu: | |
10688 case 0xD0u: | |
10689 case 0xD1u: | |
10690 v0->pInventoryItems[pOut.z].uItemID = 223; | |
10691 break; | |
10692 case 0xD2u: | |
10693 case 0xD3u: | |
10694 case 0xD4u: | |
10695 case 0xD5u: | |
10696 case 0xD6u: | |
10697 v0->pInventoryItems[pOut.z].uItemID = 224; | |
10698 break; | |
10699 case 0xD7u: | |
10700 case 0xD8u: | |
10701 case 0xD9u: | |
10702 case 0xDAu: | |
10703 case 0xDBu: | |
10704 v0->pInventoryItems[pOut.z].uItemID = 221; | |
10705 break; | |
10706 default: | |
10707 break; | |
10708 } | |
10709 pMouse->RemoveHoldingItem(); | |
10710 dword_50CDCC = 1; | |
10711 if ( dword_4E455C ) | |
10712 { | |
187 | 10713 v0->PlaySound(SPEECH_16, 0); |
0 | 10714 dword_4E455C = 0; |
10715 } | |
10716 } | |
10717 | |
10718 | |
10719 | |
706 | 10720 |
0 | 10721 |
10722 //----- (004175C0) -------------------------------------------------------- | |
141 | 10723 void UI_OnMouseLeftClick(int *pXY) |
0 | 10724 { |
10725 int *pXY_; // esi@1 | |
10726 signed int y; // eax@7 | |
10727 signed int x; // ecx@7 | |
10728 unsigned int v4; // eax@11 | |
10729 signed int v5; // eax@17 | |
10730 signed int v6; // esi@19 | |
10731 int v7; // esi@30 | |
10732 GUIWindow *v8; // edx@31 | |
10733 GUIButton *i; // esi@37 | |
10734 signed int v10; // eax@50 | |
10735 int v11; // ecx@52 | |
10736 unsigned int pX; // [sp+14h] [bp-8h]@7 | |
10737 unsigned int pY; // [sp+18h] [bp-4h]@7 | |
10738 | |
10739 pXY_ = pXY; | |
151 | 10740 if ( pCurrentScreen == SCREEN_VIDEO |
0 | 10741 || sub_4637E0_is_there_popup_onscreen() ) |
10742 return; | |
10743 if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 ) | |
10744 { | |
10745 sub_4452BB(); | |
10746 return; | |
10747 } | |
10748 if ( pXY_ ) | |
10749 { | |
10750 x = *pXY_; | |
10751 y = pXY_[1]; | |
10752 pX = *pXY_; | |
10753 pY = y; | |
10754 } | |
10755 else | |
10756 { | |
10757 pMouse->GetClickPos(&pX, &pY); | |
10758 y = pY; | |
10759 x = pX; | |
10760 } | |
271 | 10761 if ( pCurrentScreen != SCREEN_GAME || !dword_507B98_ctrl_pressed ) |
0 | 10762 goto LABEL_30; |
10763 v4 = GetCurrentMenuID(); | |
10764 x = pX; | |
10765 if ( (v4 & 0x80000000u) == 0 | |
693 | 10766 || (signed int)pX < (signed int)pViewport->uViewportTL_X |
10767 || (signed int)pX > (signed int)pViewport->uViewportBR_X ) | |
0 | 10768 { |
10769 y = pY; | |
10770 LABEL_30: | |
10771 v7 = uNumVisibleWindows; | |
10772 if ( uNumVisibleWindows < 0 ) | |
10773 return; | |
10774 while ( 1 ) | |
10775 { | |
10776 //v8 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[v7]]; | |
10777 v8 = &pWindowList[pVisibleWindowsIdxs[v7] - 1]; | |
10778 if ( x >= (signed int)v8->uFrameX ) | |
10779 { | |
10780 if ( x <= (signed int)v8->uFrameZ && y >= (signed int)v8->uFrameY && y <= (signed int)v8->uFrameW ) | |
10781 break; | |
10782 } | |
10783 --v7; | |
10784 if ( v7 < 0 ) | |
10785 return; | |
10786 } | |
10787 for ( i = v8->pControlsHead; ; i = i->pNext ) | |
10788 { | |
10789 if ( !i ) | |
10790 return; | |
10791 if ( i->uButtonType == 1 ) | |
10792 goto LABEL_41; | |
10793 if ( i->uButtonType != 2 ) | |
10794 break; | |
10795 if ( (signed int)(signed __int64)sqrt((double)((x - i->uX) * (x - i->uX) + (y - i->uY) * (y - i->uY))) < (signed int)i->uWidth ) | |
10796 goto LABEL_50; | |
10797 y = pY; | |
10798 x = pX; | |
10799 LABEL_45: | |
10800 ; | |
10801 } | |
10802 if ( i->uButtonType != 3 ) | |
10803 goto LABEL_45; | |
10804 LABEL_41: | |
10805 if ( x >= (signed int)i->uX && x <= (signed int)i->uZ && y >= (signed int)i->uY && y <= (signed int)i->uW ) | |
10806 { | |
10807 LABEL_50: | |
271 | 10808 i->field_2C_is_pushed = 1; |
0 | 10809 v10 = pMessageQueue_50CBD0->uNumMessages; |
10810 if ( pMessageQueue_50CBD0->uNumMessages ) | |
10811 { | |
10812 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
10813 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
10814 } | |
10815 //v11 = i->uControlParam; | |
832 | 10816 pMessageQueue_50CBD0->AddMessage(i->msg, i->msg_param, 0); |
0 | 10817 return; |
10818 } | |
10819 goto LABEL_45; | |
10820 } | |
10821 y = pY; | |
693 | 10822 if ( (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y ) |
0 | 10823 goto LABEL_30; |
10824 if ( pRenderer->pRenderD3D ) | |
10825 v5 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
10826 else | |
10827 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
10828 v6 = (unsigned __int16)v5; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
10829 if (PID_TYPE(v5) == OBJECT_Actor |
0 | 10830 && uActiveCharacter |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
10831 && v5 < 0x2000000 |
0 | 10832 && pPlayers[uActiveCharacter]->CanAct() |
10833 && pPlayers[uActiveCharacter]->CanSteal() ) | |
10834 { | |
437 | 10835 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 10836 { |
990 | 10837 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_1B; |
0 | 10838 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3; |
10839 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
10840 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 10841 }*/ |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
10842 pMessageQueue_50CBD0->AddMessage(UIMSG_1B, PID_ID(v6), 0); |
437 | 10843 |
0 | 10844 if ( pParty->bTurnBasedModeOn == 1 ) |
10845 { | |
10846 if ( pTurnEngine->field_4 == 3 ) | |
10847 pTurnEngine->field_18 |= 8u; | |
10848 } | |
10849 } | |
10850 } | |
10851 | |
10852 | |
10853 | |
10854 //----- (00417871) -------------------------------------------------------- | |
10855 void __thiscall sub_417871(int *pXY) | |
10856 { | |
10857 POINT v1; // [sp+0h] [bp-18h]@5 | |
10858 POINT a2; // [sp+8h] [bp-10h]@5 | |
10859 unsigned int pY; // [sp+10h] [bp-8h]@3 | |
10860 unsigned int pX; // [sp+14h] [bp-4h]@3 | |
10861 | |
10862 if ( !pRenderer->pRenderD3D ) | |
10863 { | |
10864 if ( pXY ) | |
10865 { | |
10866 pX = *pXY; | |
10867 pY = pXY[1]; | |
10868 } | |
10869 else | |
10870 { | |
10871 pMouse->GetClickPos(&pX, &pY); | |
10872 } | |
10873 pMouse->GetCursorPos(&a2); | |
10874 pMouse->GetCursorPos(&v1); | |
10875 } | |
10876 } | |
10877 | |
10878 //----- (004178FE) -------------------------------------------------------- | |
10879 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2) | |
10880 { | |
10881 unsigned __int16 v2; // dx@2 | |
10882 unsigned __int16 v3; // cx@2 | |
10883 int v5; // eax@5 | |
10884 unsigned __int16 v6; // [sp-4h] [bp-8h]@2 | |
10885 | |
10886 if ( a1 <= a2 ) | |
10887 { | |
10888 if ( a1 == a2 ) | |
10889 return 0; | |
10890 v5 = 100 * a1 / a2; | |
10891 v3 = 255; | |
10892 if ( v5 >= 25 ) | |
10893 { | |
10894 v6 = 100; | |
10895 v2 = 255; | |
10896 } | |
10897 else | |
10898 { | |
10899 v6 = 0; | |
10900 v2 = 0; | |
10901 } | |
10902 } | |
10903 else | |
10904 { | |
10905 v6 = 0; | |
10906 v2 = 255; | |
10907 v3 = 0; | |
10908 } | |
949 | 10909 return TargetColor(v3, v2, v6); |
0 | 10910 } |
10911 | |
10912 //----- (00417939) -------------------------------------------------------- | |
10913 signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx) | |
10914 { | |
10915 unsigned int v1; // ebx@1 | |
10916 signed int v2; // edi@1 | |
10917 unsigned int v3; // esi@1 | |
10918 unsigned int v4; // eax@1 | |
10919 unsigned int v6; // [sp+Ch] [bp-4h]@1 | |
10920 | |
10921 v1 = uConditionIdx; | |
10922 v2 = 65535; | |
949 | 10923 v3 = TargetColor(0xE1u, 0xCDu, 0x23u); |
10924 v6 = TargetColor(0xFFu, 0x23u, 0); | |
10925 v4 = TargetColor(0, 0xFFu, 0); | |
0 | 10926 switch ( v1 ) |
10927 { | |
10928 case 0u: | |
10929 case 1u: | |
10930 case 3u: | |
10931 case 4u: | |
10932 case 5u: | |
10933 case 6u: | |
10934 case 7u: | |
10935 v2 = v4; | |
10936 break; | |
10937 case 2u: | |
10938 case 8u: | |
10939 case 9u: | |
10940 case 0xCu: | |
10941 case 0xDu: | |
10942 v2 = v3; | |
10943 break; | |
10944 case 0xAu: | |
10945 case 0xBu: | |
10946 case 0xEu: | |
10947 case 0xFu: | |
10948 case 0x10u: | |
10949 v2 = v6; | |
10950 break; | |
10951 default: | |
10952 return v2; | |
10953 } | |
10954 return v2; | |
10955 } | |
10956 | |
10957 //----- (004179BC) -------------------------------------------------------- | |
1006 | 10958 void __fastcall sub_4179BC_draw_tooltip( const char *a1, const char *a2 ) |
10959 { | |
0 | 10960 const char *v2; // ebx@1 |
10961 const char *v3; // edi@1 | |
10962 unsigned int v4; // eax@1 | |
10963 GUIWindow Dst; // [sp+Ch] [bp-5Ch]@1 | |
10964 POINT v6; // [sp+60h] [bp-8h]@1 | |
10965 | |
10966 v2 = a2; | |
10967 v3 = a1; | |
10968 memset(&Dst, 0, 0x54u); | |
10969 Dst.uFrameWidth = 384; | |
10970 Dst.uFrameHeight = 256; | |
10971 Dst.uFrameX = 128; | |
10972 Dst.uFrameY = pMouse->GetCursorPos(&v6)->y + 30; | |
10973 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(v2, &Dst, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; | |
10974 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
10975 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
10976 Dst.DrawMessageBox(0); | |
10977 Dst.uFrameX += 12; | |
10978 Dst.uFrameWidth -= 24; | |
10979 Dst.uFrameY += 12; | |
10980 Dst.uFrameHeight -= 12; | |
10981 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
10982 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
949 | 10983 v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 10984 sprintf(pTmpBuf, format_4E2D80, v4, v3); |
10985 Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u); | |
1006 | 10986 Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0); |
0 | 10987 } |
10988 | |
10989 //----- (00417AD4) -------------------------------------------------------- | |
983 | 10990 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) |
273 | 10991 { |
0 | 10992 int v8; // eax@10 |
10993 int v12; // eax@14 | |
10994 unsigned int yellow; // [sp+Ch] [bp-Ch]@1 | |
10995 unsigned int red; // [sp+10h] [bp-8h]@1 | |
10996 unsigned int white; // [sp+14h] [bp-4h]@1 | |
10997 | |
949 | 10998 white = TargetColor(0xFFu, 0xFFu, 0xFFu); |
10999 red = TargetColor(0xFFu, 0, 0); | |
11000 yellow = TargetColor(0xFFu, 0xFFu, 0); | |
269 | 11001 if ( !(uPlayerClass % 4) ) |
11002 { | |
273 | 11003 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level ) |
269 | 11004 return white; |
273 | 11005 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level |
11006 && byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level ) | |
269 | 11007 { |
11008 v12 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType]; | |
273 | 11009 if ( v12 < skill_level ) |
269 | 11010 return red; |
0 | 11011 } |
11012 return yellow; | |
11013 } | |
273 | 11014 if ( (uPlayerClass % 4) == 1 ) |
11015 { | |
11016 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level ) | |
269 | 11017 return white; |
273 | 11018 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level ) |
269 | 11019 { |
11020 v8 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType]; | |
273 | 11021 if ( v8 < skill_level) |
11022 return red; | |
0 | 11023 } |
11024 return yellow; | |
11025 } | |
273 | 11026 if ( (uPlayerClass % 4) == 2 || (uPlayerClass % 4) == 3 ) |
11027 { | |
11028 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level ) | |
0 | 11029 return red; |
269 | 11030 } |
11031 return white; | |
0 | 11032 } |
11033 | |
11034 | |
11035 //----- (00419220) -------------------------------------------------------- | |
11036 void __cdecl sub_419220() | |
11037 { | |
11038 GUIButton *i; // eax@2 | |
11039 | |
11040 if ( !dword_507CBC ) | |
11041 { | |
11042 dword_507CBC = 1; | |
11043 for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) | |
11044 { | |
832 | 11045 if ( i->msg == UIMSG_InventoryLeftClick ) |
0 | 11046 { |
11047 dword_50698C = i->uX; | |
11048 dword_506988 = i->uY; | |
11049 dword_506984 = i->uZ; | |
11050 dword_506980 = i->uW; | |
11051 i->uW = 0; | |
11052 i->uZ = 0; | |
11053 i->uY = 0; | |
11054 i->uX = 0; | |
11055 } | |
11056 } | |
973 | 11057 pBtn_Up = pGUIWindow_CurrentMenu->CreateButton(438, 46, |
11058 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureWidth, | |
11059 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureHeight, | |
11060 1, 0, UIMSG_ClickAwardsUpBtn, 0, 0, "", | |
11061 pIcons_LOD->GetTexture(uTextureID_ar_up_up), | |
11062 pIcons_LOD->GetTexture(uTextureID_ar_up_dn), 0); | |
11063 pBtn_Down = pGUIWindow_CurrentMenu->CreateButton(438, 292, | |
11064 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureWidth, | |
11065 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureHeight, | |
11066 1, 0, UIMSG_ClickAwardsDownBtn, 0, 0, "", | |
11067 pIcons_LOD->GetTexture(uTextureID_ar_dn_up), | |
11068 pIcons_LOD->GetTexture(uTextureID_ar_dn_dn), 0); | |
961 | 11069 ptr_507BA4 = pGUIWindow_CurrentMenu->CreateButton(440, 62, 16, 232, 1, 0, UIMSG_C0, 0, 0, "", 0); |
0 | 11070 } |
11071 } | |
11072 | |
11073 | |
11074 | |
11075 //----- (00419379) -------------------------------------------------------- | |
11076 void __cdecl sub_419379() | |
11077 { | |
960 | 11078 GUIButton *pButton; // esi@2 |
0 | 11079 |
11080 if ( dword_507CBC ) | |
11081 { | |
11082 dword_507CBC = 0; | |
697 | 11083 ptr_507BA4->Release(); |
11084 pBtn_Up->Release(); | |
11085 pBtn_Down->Release(); | |
0 | 11086 pBtn_Down = 0; |
11087 pBtn_Up = 0; | |
960 | 11088 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) |
11089 { | |
11090 if ( pButton->msg == UIMSG_InventoryLeftClick ) | |
11091 { | |
11092 pButton->uX = dword_50698C; | |
11093 pButton->uY = dword_506988; | |
11094 pButton->uZ = dword_506984; | |
11095 pButton->uW = dword_506980; | |
972 | 11096 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0); |
11097 } | |
11098 } | |
11099 } | |
11100 } | |
11101 | |
11102 |