Mercurial > mm7
annotate mm7_5.cpp @ 1038:39f42990698f
Cleanings
author | Nomad |
---|---|
date | Thu, 23 May 2013 03:29:29 +0200 |
parents | 306ec23b37df |
children | 682ba1c83fd3 |
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 { | |
336 | 1641 start_event_seq_number = dword_5C341C; |
978 | 1642 EventProcessor(dword_5C3418, 0, 1); |
0 | 1643 } |
336 | 1644 start_event_seq_number = 0; |
0 | 1645 if ( !_strcmpi(byte_6BE3B0, "d05.blv") ) |
1646 pParty->uTimePlayed += 1474560i64; | |
4 | 1647 continue; |
960 | 1648 case UIMSG_TransitionWindowCloseBtn: |
11 | 1649 CloseWindowBackground(); |
0 | 1650 pVideoPlayer->Unload(); |
960 | 1651 DialogueEnding(); |
336 | 1652 start_event_seq_number = 0; |
1035 | 1653 viewparams->bRedrawGameUI = true; |
910 | 1654 continue; |
0 | 1655 case UIMSG_CycleCharacters: |
1656 v39 = GetAsyncKeyState(VK_SHIFT); | |
910 | 1657 uActiveCharacter = CycleCharacter(v39); |
1035 | 1658 viewparams->bRedrawGameUI = true; |
910 | 1659 continue; |
783 | 1660 case UIMSG_OnTravelByFoot: |
0 | 1661 if ( pMessageQueue_50CBD0->uNumMessages ) |
1662 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
978 | 1663 dword_50CDC8 = 1; |
0 | 1664 sub_42FBDD(); |
1665 pNPCData4 = (NPCData *)GetTravelTime(); | |
1666 strcpy(pOutdoor->pLevelFilename, pCurrentMapName); | |
1667 if ( bUnderwater != 1 && pParty->bFlying | |
978 | 1668 || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 ) |
1669 { | |
1670 viewparams->bRedrawGameUI = 1; | |
11 | 1671 CloseWindowBackground(); |
0 | 1672 if ( pParty->vPosition.x < -22528 ) |
1673 pParty->vPosition.x = -22528; | |
1674 if ( pParty->vPosition.x > 22528 ) | |
1675 pParty->vPosition.x = 22528; | |
1676 if ( pParty->vPosition.y < -22528 ) | |
1677 pParty->vPosition.y = -22528; | |
1678 if ( pParty->vPosition.y > 22528 ) | |
1679 pParty->vPosition.y = 22528; | |
960 | 1680 DialogueEnding(); |
151 | 1681 pCurrentScreen = SCREEN_GAME; |
0 | 1682 } |
1683 else | |
1684 { | |
1685 pParty->field_6E4 = 0; | |
1686 pParty->field_6E0 = 0; | |
978 | 1687 pCastSpellInfo->_427D48(1); |
960 | 1688 DialogueEnding(); |
0 | 1689 pEventTimer->Pause(); |
434 | 1690 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); |
0 | 1691 ++pGameLoadingUI_ProgressBar->uProgressMax; |
978 | 1692 SaveGame(1, 0); |
0 | 1693 pGameLoadingUI_ProgressBar->Progress(); |
1694 RestAndHeal(1440 * (signed int)pNPCData4); | |
1695 if ( pParty->uNumFoodRations ) | |
1696 { | |
1697 pParty->RestAndHeal(); | |
1698 if ( ((pParty->uNumFoodRations - (signed int)pNPCData4) & 0x80000000u) != 0 ) | |
1699 { | |
1700 pPlayer7 = pParty->pPlayers; | |
1701 do | |
1702 { | |
978 | 1703 pPlayer7->SetCondition(1, 0); |
0 | 1704 ++pPlayer7; |
1705 } | |
1706 while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings ); | |
766 | 1707 ++pParty->days_played_without_rest; |
0 | 1708 } |
1709 Party::TakeFood((unsigned int)pNPCData4); | |
1710 } | |
1711 else | |
1712 { | |
1713 pPlayer8 = pParty->pPlayers; | |
1714 do | |
1715 { | |
978 | 1716 pPlayer8->SetCondition(1, 0); |
0 | 1717 ++pPlayer8; |
1718 } | |
1719 while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings ); | |
766 | 1720 ++pParty->days_played_without_rest; |
0 | 1721 } |
1722 pPaletteManager->ResetNonLocked(); | |
1723 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
783 | 1724 strcpy(pCurrentMapName, pOut); |
1725 strcpy(pLevelName, pCurrentMapName); | |
1726 v41 = strtok(pLevelName, "."); | |
1727 strcpy(pLevelName, v41); | |
1728 Level_LoadEvtAndStr(pLevelName); | |
1729 pDecalBuilder->Reset(0); | |
0 | 1730 LoadLevel_InitializeLevelEvt(); |
1731 uLevelMapStatsID = pMapStats->GetMapInfo(pCurrentMapName); | |
1732 bUnderwater = 0; | |
1733 bNoNPCHiring = 0; | |
1734 pGame->uFlags2 &= 0xFFFFFFF7u; | |
1735 if ( Is_out15odm_underwater() ) | |
1736 { | |
1737 bUnderwater = 1; | |
1738 pGame->uFlags2 |= 8u; | |
1739 } | |
1740 if ( !_strcmpi(pCurrentMapName, "out15.odm") || !_strcmpi(pCurrentMapName, "d47.blv") ) | |
1741 bNoNPCHiring = 1; | |
1742 PrepareToLoadODM(1u, (OutdoorCamera *)1); | |
1743 pAudioPlayer->SetMapEAX(); | |
1744 bDialogueUI_InitializeActor_NPC_ID = 0; | |
1745 OnMapLoad(); | |
1746 pOutdoor->SetFog(); | |
1747 TeleportToStartingPoint(uLevel_StartingPointType); | |
783 | 1748 pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v213, 0); |
0 | 1749 pParty->uFallStartY = pParty->vPosition.z; |
1750 sub_461103(); | |
1751 pEventTimer->Resume(); | |
1752 viewparams->bRedrawGameUI = 1; | |
151 | 1753 pCurrentScreen = SCREEN_GAME; |
0 | 1754 pGameLoadingUI_ProgressBar->Release(); |
1755 } | |
978 | 1756 viewparams->bRedrawGameUI = 1; |
910 | 1757 continue; |
987 | 1758 case UIMSG_CHANGE_LOCATION_ClickCencelBtn: |
1759 CloseWindowBackground(); | |
1760 if ( pParty->vPosition.x < -22528 ) | |
1761 pParty->vPosition.x = -22528; | |
1762 if ( pParty->vPosition.x > 22528 ) | |
1763 pParty->vPosition.x = 22528; | |
1764 if ( pParty->vPosition.y < -22528 ) | |
1765 pParty->vPosition.y = -22528; | |
1766 if ( pParty->vPosition.y > 22528 ) | |
1767 pParty->vPosition.y = 22528; | |
1768 DialogueEnding(); | |
1769 pCurrentScreen = SCREEN_GAME; | |
1770 viewparams->bRedrawGameUI = 1; | |
1771 continue; | |
1772 case UIMSG_CastSpell_BE://??? | |
1773 __debugbreak(); | |
0 | 1774 if ( pRenderer->pRenderD3D ) |
1775 { | |
1776 LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
1777 } | |
1778 else | |
1779 { | |
1780 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v210); | |
1781 pPoint = pMouse->GetCursorPos(&v208); | |
1782 v42 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint->y]]; | |
1783 } | |
1784 v44 = (unsigned __int16)v42; | |
848 | 1785 v45 = PID_TYPE(v44); |
0 | 1786 uNumSeconds = v44; |
848 | 1787 v46 = PID_ID(v44); |
0 | 1788 if ( v45 == 3 ) |
1789 { | |
1790 v47 = pActors[v46].uAIState == Dead; | |
11 | 1791 if ( !v47 ) |
1792 continue; | |
1000 | 1793 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1794 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1795 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1796 pSpellInfo->spell_target_pid = v44; | |
1797 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1798 pGUIWindow_Settings->Release(); | |
11 | 1799 pGUIWindow_Settings = 0; |
1800 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1801 GameUI_Footer_TimeLeft = 0; |
11 | 1802 unk_50C9A0 = 0; |
1803 back_to_game(); | |
1804 continue; | |
0 | 1805 } |
1806 if ( v45 == 2 ) | |
1807 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
1808 v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0; |
0 | 1809 if ( !v47 ) |
4 | 1810 continue; |
1000 | 1811 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1812 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1813 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1814 pSpellInfo->spell_target_pid = v44; | |
1815 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1816 pGUIWindow_Settings->Release(); | |
11 | 1817 pGUIWindow_Settings = 0; |
1818 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1819 GameUI_Footer_TimeLeft = 0; |
11 | 1820 unk_50C9A0 = 0; |
1821 back_to_game(); | |
1822 continue; | |
0 | 1823 } |
1824 if ( v45 == 5 ) | |
1825 { | |
1826 v48 = pLevelDecorations[v46].field_16_event_id == 0; | |
1827 } | |
1828 else | |
1829 { | |
1830 if ( v45 != 6 ) | |
4 | 1831 continue; |
978 | 1832 if ( uCurrentlyLoadedLevelType != 1 ) |
0 | 1833 { |
1834 pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F]; | |
1835 if ( !(pODMFace->uAttributes & 0x02000000) || !pODMFace->sCogTriggeredID ) | |
4 | 1836 continue; |
0 | 1837 v44 = uNumSeconds; |
1000 | 1838 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1839 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1840 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1841 pSpellInfo->spell_target_pid = v44; | |
1842 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1843 pGUIWindow_Settings->Release(); | |
11 | 1844 pGUIWindow_Settings = 0; |
1845 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1846 GameUI_Footer_TimeLeft = 0; |
11 | 1847 unk_50C9A0 = 0; |
1848 back_to_game(); | |
1849 continue; | |
0 | 1850 } |
1851 pBLVFace = &pIndoor->pFaces[v46]; | |
1852 if ( !(BYTE3(pBLVFace->uAttributes) & 2) ) | |
4 | 1853 continue; |
0 | 1854 v48 = pIndoor->pFaceExtras[pBLVFace->uFaceExtraID].uEventID == 0; |
1855 } | |
1856 if ( v48 ) | |
4 | 1857 continue; |
1000 | 1858 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
1859 LOBYTE(pSpellInfo->field_8) &= 0xBFu; | |
1860 pSpellInfo->uPlayerID_2 = uMessageParam; | |
1861 pSpellInfo->spell_target_pid = v44; | |
1862 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
1863 pGUIWindow_Settings->Release(); | |
0 | 1864 pGUIWindow_Settings = 0; |
1865 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1866 GameUI_Footer_TimeLeft = 0; |
0 | 1867 unk_50C9A0 = 0; |
1868 back_to_game(); | |
4 | 1869 continue; |
1000 | 1870 case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade) |
1871 case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure | |
1872 case UIMSG_HiredNPC_CastSpell: | |
0 | 1873 if ( pMessageQueue_50CBD0->uNumMessages ) |
1874 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1875 if ( unk_50C9A0 ) | |
1876 { | |
910 | 1877 uActiveCharacter = uMessageParam; |
978 | 1878 viewparams->bRedrawGameUI = 1; |
0 | 1879 } |
1880 else | |
1881 { | |
1882 if ( pGUIWindow_Settings ) | |
1883 { | |
1000 | 1884 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
0 | 1885 switch ( uMessage ) |
1886 { | |
1000 | 1887 case UIMSG_CastSpell_Character_Big_Improvement: |
1888 LOBYTE(pSpellInfo->field_8) &= 0xFDu; | |
0 | 1889 break; |
1000 | 1890 case UIMSG_CastSpell_Character_Small_Improvement: |
1891 HIBYTE(pSpellInfo->field_8) &= 0xFEu; | |
0 | 1892 break; |
1000 | 1893 case UIMSG_HiredNPC_CastSpell: |
1894 HIBYTE(pSpellInfo->field_8) &= 0xFDu; | |
0 | 1895 break; |
1896 } | |
1000 | 1897 pSpellInfo->uPlayerID_2 = uMessageParam; |
1898 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
0 | 1899 pGUIWindow_Settings->Release(); |
1900 pGUIWindow_Settings = 0; | |
1901 pEventTimer->Resume(); | |
1902 pMouse->SetCursorBitmap("MICON1"); | |
783 | 1903 GameUI_Footer_TimeLeft = 0; |
0 | 1904 unk_50C9A0 = 0; |
1905 } | |
1906 } | |
4 | 1907 continue; |
0 | 1908 case UIMSG_BF: |
987 | 1909 __debugbreak(); |
978 | 1910 dword_50CDC8 = 1; |
0 | 1911 sub_42FBDD(); |
978 | 1912 SaveGame(1, 0); |
0 | 1913 strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename); |
978 | 1914 dword_6BE364_game_settings_1 |= 1; |
1915 uGameState = GAME_STATE_2; | |
11 | 1916 //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; |
336 | 1917 v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; |
4 | 1918 if ( v53 < 0 ) |
0 | 1919 { |
1920 v54 = abs(v53) - 1; | |
1921 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1922 dword_5B65BC = 0; | |
1923 v55 = dword_4E4560[v54]; | |
1924 _5B65AC_npcdata_fame_or_other = dword_4E4578[v54]; | |
1925 v56 = dword_4E4590[v54]; | |
1926 v57 = dword_4E45A8[v54]; | |
1927 _5B65A8_npcdata_uflags_or_other = v55; | |
1928 _5B65B4_npcdata_loword_house_or_other = v57; | |
1929 _5B65B0_npcdata_rep_or_other = v56; | |
1930 dword_5B65C0 = v55 | _5B65AC_npcdata_fame_or_other | v56 | v57; | |
1931 } | |
1932 sub_4BD8B5(); | |
11 | 1933 //goto LABEL_434; |
437 | 1934 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
11 | 1935 { |
990 | 1936 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 1937 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
1938 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
1939 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 1940 }*/ |
978 | 1941 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
11 | 1942 continue; |
710 | 1943 |
1944 case UIMSG_OnCastTownPortal: | |
0 | 1945 pAudioPlayer->StopChannels(-1, -1); |
710 | 1946 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_TownPortal, uMessageParam); |
1947 continue; | |
1948 | |
961 | 1949 case UIMSG_OnCastLloydsBeacon: |
0 | 1950 pAudioPlayer->StopChannels(-1, -1); |
961 | 1951 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Book, WINDOW_LloydsBeacon, 0); |
710 | 1952 continue; |
1953 | |
961 | 1954 case UIMSG_LloydsBeacon_FlippingBtn: |
0 | 1955 bRecallingBeacon = uMessageParam; |
1956 v127 = uMessageParam + 204; | |
916 | 1957 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
1958 continue; | |
961 | 1959 case UIMSG_HintBeaconSlot: |
0 | 1960 if ( !pGUIWindow_CurrentMenu ) |
4 | 1961 continue; |
0 | 1962 pPlayer = pPlayers[_506348_current_lloyd_playerid + 1]; |
1963 uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam]; | |
1964 if ( bRecallingBeacon ) | |
1965 { | |
1966 if ( !*((int *)&pSavegameThumbnails->pPixels + 10 * uMessageParam) ) | |
4 | 1967 continue; |
0 | 1968 v173 = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(pPlayer->pInstalledBeacons[uMessageParam].field_18))].pName; |
916 | 1969 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s" |
994 | 1970 GameUI_SetFooterString(pTmpBuf); |
916 | 1971 continue; |
0 | 1972 } |
1973 v59 = pMapStats->GetMapInfo(pCurrentMapName); | |
1974 thise = "Not in Map Stats"; | |
1975 if ( v59 ) | |
1976 thise = pMapStats->pInfos[v59].pName; | |
1977 if ( !*((int *)&pSavegameThumbnails->pPixels + 10 * uMessageParam) || !v59 ) | |
1978 { | |
916 | 1979 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[476], thise);// "Set to %s" |
994 | 1980 GameUI_SetFooterString(pTmpBuf); |
916 | 1981 continue; |
0 | 1982 } |
1983 v174 = pMapStats->pInfos[sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName; | |
1984 v158 = (unsigned int)thise; | |
916 | 1985 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s" |
994 | 1986 GameUI_SetFooterString(pTmpBuf); |
11 | 1987 continue; |
961 | 1988 case UIMSG_CloseAfterInstallBeacon: |
978 | 1989 dword_50CDC8 = 1; |
437 | 1990 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); |
1991 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) | |
11 | 1992 continue; |
990 | 1993 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 1994 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
1995 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 1996 ++pMessageQueue_50CBD0->uNumMessages;*/ |
11 | 1997 continue; |
961 | 1998 case UIMSG_InstallBeacon: |
0 | 1999 pPlayer9 = pPlayers[_506348_current_lloyd_playerid + 1]; |
2000 pNPCData4 = (NPCData *)&pPlayer9->pInstalledBeacons[uMessageParam]; | |
2001 if ( !*(_QWORD *)&pNPCData4->pName && bRecallingBeacon ) | |
4 | 2002 continue; |
0 | 2003 byte_506360 = 1; |
2004 pPlayer9->CanCastSpell(uRequiredMana); | |
2005 if ( pParty->bTurnBasedModeOn ) | |
2006 { | |
2007 v60 = sRecoveryTime; | |
2008 pParty->pTurnBasedPlayerRecoveryTimes[_506348_current_lloyd_playerid] = sRecoveryTime; | |
2009 pPlayer9->SetRecoveryTime(v60); | |
2010 pTurnEngine->_40471C(); | |
2011 } | |
2012 else | |
2013 { | |
2014 pPlayer9->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)sRecoveryTime * 2.133333333333333)); | |
2015 } | |
2016 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[dword_506338], 0, 0, -1, 0, dword_50633C, 0, 0); | |
2017 if ( bRecallingBeacon ) | |
2018 { | |
2019 if ( _strcmpi(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]) ) | |
2020 { | |
978 | 2021 SaveGame(1, 0); |
0 | 2022 OnMapLeave(); |
2023 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]); | |
978 | 2024 dword_6BE364_game_settings_1 |= 1; |
2025 uGameState = GAME_STATE_2; | |
0 | 2026 _5B65A8_npcdata_uflags_or_other = pNPCData4->uFlags; |
2027 _5B65AC_npcdata_fame_or_other = pNPCData4->fame; | |
2028 _5B65B0_npcdata_rep_or_other = pNPCData4->rep; | |
291 | 2029 _5B65B4_npcdata_loword_house_or_other = LOWORD(pNPCData4->Location2D); |
2030 _5B65B8_npcdata_hiword_house_or_other = HIWORD(pNPCData4->Location2D); | |
978 | 2031 dword_5B65C0 = 1; |
0 | 2032 } |
2033 else | |
2034 { | |
2035 pParty->vPosition.x = pNPCData4->uFlags; | |
2036 pParty->vPosition.y = pNPCData4->fame; | |
2037 pParty->vPosition.z = pNPCData4->rep; | |
2038 pParty->uFallStartY = pParty->vPosition.z; | |
291 | 2039 pParty->sRotationY = LOWORD(pNPCData4->Location2D); |
2040 pParty->sRotationX = HIWORD(pNPCData4->Location2D); | |
0 | 2041 } |
978 | 2042 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
437 | 2043 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2044 { |
305 | 2045 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2046 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
2047 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2048 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2049 }*/ |
0 | 2050 //crt_deconstruct_ptr_6A0118(); |
2051 pBooksWindow->Release(); | |
2052 pGUIWindow_CurrentMenu->Release(); | |
2053 pBooksWindow = 0; | |
2054 pGUIWindow_CurrentMenu = 0; | |
2055 } | |
2056 else | |
2057 { | |
2058 sprintf(a1, "data\\lloyd%d%d.pcx", _506348_current_lloyd_playerid + 1, uMessageParam + 1); | |
2059 SaveScreenshot(a1); | |
2060 LoadThumbnailLloydTexture(uMessageParam, _506348_current_lloyd_playerid + 1); | |
2061 v212 = qword_506350 << 7; | |
2062 pNPCData2 = pNPCData4; | |
2063 thisg = 0; | |
2064 v62 = pParty->uTimePlayed + (signed __int64)((double)(qword_506350 << 7) * 0.033333335); | |
2065 pNPCData4->pName = (char *)v62; | |
2066 pNPCData2->uPortraitID = HIDWORD(v62); | |
2067 pNPCData2->uFlags = pParty->vPosition.x; | |
2068 pNPCData2->fame = pParty->vPosition.y; | |
2069 pNPCData2->rep = pParty->vPosition.z; | |
291 | 2070 LOWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationY); |
2071 HIWORD(pNPCData2->Location2D) = LOWORD(pParty->sRotationX); | |
837 | 2072 if ( (signed int)pGames_LOD->uNumSubDirs / 2 <= 0 ) |
4 | 2073 continue; |
0 | 2074 uAction = 0; |
2075 while ( _strcmpi((const char *)pGames_LOD->pSubIndices + uAction, pCurrentMapName) ) | |
2076 { | |
2077 ++thisg; | |
2078 uAction += 32; | |
837 | 2079 if ( thisg >= (signed int)pGames_LOD->uNumSubDirs / 2 ) |
4 | 2080 continue; |
0 | 2081 } |
2082 HIWORD(pNPCData4->uProfession) = thisg; | |
2083 } | |
4 | 2084 continue; |
961 | 2085 case UIMSG_ClickTownInTP: |
0 | 2086 if ( uMessageParam ) |
2087 { | |
2088 switch ( uMessageParam ) | |
2089 { | |
2090 case 1: | |
2091 v63 = 208; | |
2092 break; | |
2093 case 2: | |
2094 v63 = 207; | |
2095 break; | |
2096 case 3: | |
2097 v63 = 211; | |
2098 break; | |
2099 case 4: | |
2100 v63 = 209; | |
2101 break; | |
2102 default: | |
2103 if ( uMessageParam != 5 ) | |
2104 { | |
2105 LABEL_486: | |
978 | 2106 SaveGame(1, 0); |
0 | 2107 v64 = pMapStats->GetMapInfo(pCurrentMapName); |
2108 v65 = uMessageParam; | |
839 | 2109 if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) |
0 | 2110 { |
839 | 2111 pParty->vPosition.x = TownPortalList[v65].pos.x; |
2112 pParty->vPosition.y = TownPortalList[v65].pos.y; | |
2113 pParty->vPosition.z = TownPortalList[v65].pos.z; | |
0 | 2114 pParty->uFallStartY = pParty->vPosition.z; |
839 | 2115 pParty->sRotationY = TownPortalList[v65].rot_y; |
2116 pParty->sRotationX = TownPortalList[v65].rot_x; | |
0 | 2117 } |
2118 else | |
2119 { | |
978 | 2120 SaveGame(1, 0); |
0 | 2121 OnMapLeave(); |
978 | 2122 dword_6BE364_game_settings_1 |= 1; |
2123 uGameState = GAME_STATE_2; | |
839 | 2124 strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); |
978 | 2125 dword_5B65C0 = 1; |
839 | 2126 _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; |
2127 _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; | |
2128 _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; | |
2129 v66 = TownPortalList[uMessageParam].rot_x; | |
2130 _5B65B4_npcdata_loword_house_or_other = TownPortalList[uMessageParam].rot_y; | |
0 | 2131 _5B65B8_npcdata_hiword_house_or_other = v66; |
2132 InitializeActors(); | |
2133 } | |
2134 v67 = pGUIWindow_CurrentMenu->Hint; | |
2135 if ( v67 ) | |
978 | 2136 *((int *)v67 + 17) = 1; |
0 | 2137 else |
710 | 2138 pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u); |
437 | 2139 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2140 { |
990 | 2141 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2142 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; |
2143 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2144 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2145 }*/ |
978 | 2146 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); |
4 | 2147 continue; |
0 | 2148 } |
2149 v63 = 210; | |
2150 break; | |
2151 } | |
2152 } | |
2153 else | |
2154 { | |
2155 v63 = 206; | |
2156 } | |
484 | 2157 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v63) ) |
0 | 2158 return; |
2159 goto LABEL_486; | |
961 | 2160 case UIMSG_HintTownPortal: |
0 | 2161 if ( uMessageParam ) |
2162 { | |
2163 switch ( uMessageParam ) | |
2164 { | |
2165 case 1: | |
2166 v68 = 208; | |
2167 break; | |
2168 case 2: | |
2169 v68 = 207; | |
2170 break; | |
2171 case 3: | |
2172 v68 = 211; | |
2173 break; | |
2174 case 4: | |
2175 v68 = 209; | |
2176 break; | |
2177 default: | |
2178 if ( uMessageParam != 5 ) | |
11 | 2179 //goto LABEL_506; |
2180 { | |
2181 if ( uMessageParam ) | |
2182 { | |
2183 switch ( uMessageParam ) | |
2184 { | |
2185 case 1: | |
2186 v69 = pMapStats->pInfos[4].pName; | |
2187 break; | |
2188 case 2: | |
2189 v69 = pMapStats->pInfos[3].pName; | |
2190 break; | |
2191 case 3: | |
2192 v69 = pMapStats->pInfos[10].pName; | |
2193 break; | |
2194 case 4: | |
2195 v69 = pMapStats->pInfos[7].pName; | |
2196 break; | |
2197 default: | |
2198 if ( uMessageParam != 5 ) | |
2199 { | |
916 | 2200 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v200); |
994 | 2201 GameUI_SetFooterString(pTmpBuf); |
916 | 2202 continue; |
11 | 2203 } |
2204 v69 = pMapStats->pInfos[8].pName; | |
2205 break; | |
2206 } | |
2207 } | |
2208 else | |
2209 { | |
2210 v69 = pMapStats->pInfos[21].pName; | |
2211 } | |
916 | 2212 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v69); |
994 | 2213 GameUI_SetFooterString(pTmpBuf); |
916 | 2214 continue; |
11 | 2215 } |
2216 v68 = 210; | |
2217 break; | |
0 | 2218 } |
2219 } | |
2220 else | |
2221 { | |
2222 v68 = 206; | |
2223 } | |
484 | 2224 if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, v68) ) |
0 | 2225 { |
2226 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); | |
4 | 2227 continue; |
0 | 2228 } |
11 | 2229 //LABEL_506: |
0 | 2230 if ( uMessageParam ) |
2231 { | |
2232 switch ( uMessageParam ) | |
2233 { | |
2234 case 1: | |
2235 v69 = pMapStats->pInfos[4].pName; | |
2236 break; | |
2237 case 2: | |
2238 v69 = pMapStats->pInfos[3].pName; | |
2239 break; | |
2240 case 3: | |
2241 v69 = pMapStats->pInfos[10].pName; | |
2242 break; | |
2243 case 4: | |
2244 v69 = pMapStats->pInfos[7].pName; | |
2245 break; | |
2246 default: | |
2247 if ( uMessageParam != 5 ) | |
2248 //goto LABEL_519; | |
4 | 2249 { |
916 | 2250 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v200); |
994 | 2251 GameUI_SetFooterString(pTmpBuf); |
916 | 2252 continue; |
4 | 2253 } |
0 | 2254 v69 = pMapStats->pInfos[8].pName; |
2255 break; | |
2256 } | |
2257 } | |
2258 else | |
2259 { | |
2260 v69 = pMapStats->pInfos[21].pName; | |
2261 } | |
916 | 2262 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v69); |
994 | 2263 GameUI_SetFooterString(pTmpBuf); |
916 | 2264 continue; |
0 | 2265 case UIMSG_ShowFinalWindow: |
2266 sprintf(pFinalMessage, "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." | |
2267 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." | |
2268 pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team." | |
2269 ModalWindow(pFinalMessage, 196); | |
2270 uGameState = GAME_STATE_FINAL_WINDOW; | |
4 | 2271 continue; |
0 | 2272 case UIMSG_C4: |
987 | 2273 __debugbreak(); |
982 | 2274 uGameState = GAME_STATE_PLAYING; |
0 | 2275 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); |
151 | 2276 case UIMSG_DD: |
990 | 2277 __debugbreak(); |
0 | 2278 sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer); |
703 | 2279 memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); |
701 | 2280 if ( v216.uPropCount == 1 ) |
0 | 2281 { |
837 | 2282 pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2); |
0 | 2283 v70 = atoi(v216.pProperties[0]); |
2284 if ( v70 <= 0 || v70 >= 77 ) | |
4 | 2285 continue; |
0 | 2286 v71 = v70; |
2287 strcpy(Str2, pMapStats->pInfos[v70].pFilename); | |
2288 pNPCData3 = 0; | |
2289 if ( (signed int)pNPCData4 > 0 ) | |
2290 { | |
2291 thish = 0; | |
2292 do | |
2293 { | |
2294 if ( !_strcmpi((const char *)&pGames_LOD->pSubIndices[thish], Str2) ) | |
2295 break; | |
2296 ++thish; | |
2297 pNPCData3 = (NPCData *)((char *)pNPCData3 + 1); | |
2298 } | |
2299 while ( (signed int)pNPCData3 < (signed int)pNPCData4 ); | |
2300 if ( (signed int)pNPCData3 < (signed int)pNPCData4 ) | |
2301 { | |
2302 strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); | |
2303 dword_6BE364_game_settings_1 |= 1u; | |
978 | 2304 uGameState = GAME_STATE_2; |
0 | 2305 OnMapLeave(); |
4 | 2306 continue; |
0 | 2307 } |
2308 } | |
2309 sprintf(Str2, "No map found for %s", pMapStats->pInfos[v71].pName); | |
2310 v73 = Str2; | |
2311 } | |
2312 else | |
2313 { | |
701 | 2314 if ( v216.uPropCount != 3 ) |
11 | 2315 continue; |
0 | 2316 v74 = atoi(v216.pProperties[0]); |
2317 thisi = atoi(v216.pProperties[1]); | |
2318 v75 = atoi(v216.pProperties[2]); | |
2319 v76 = v75; | |
2320 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
2321 { | |
2322 if ( pIndoor->GetSector(v74, thisi, v75) ) | |
2323 { | |
2324 v77 = thisi; | |
2325 pParty->vPosition.x = v74; | |
2326 pParty->vPosition.y = v77; | |
2327 pParty->vPosition.z = v76; | |
2328 pParty->uFallStartY = v76; | |
11 | 2329 continue; |
0 | 2330 } |
2331 } | |
2332 else | |
2333 { | |
2334 if ( v74 > -32768 ) | |
2335 { | |
2336 if ( v74 < 32768 ) | |
2337 { | |
2338 v77 = thisi; | |
2339 if ( thisi > -32768 ) | |
2340 { | |
2341 if ( thisi < 32768 && v76 >= 0 && v76 < 10000 ) | |
11 | 2342 { |
2343 pParty->vPosition.x = v74; | |
2344 pParty->vPosition.y = v77; | |
2345 pParty->vPosition.z = v76; | |
2346 pParty->uFallStartY = v76; | |
2347 continue; | |
2348 } | |
0 | 2349 } |
2350 } | |
2351 } | |
2352 } | |
2353 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
2354 v73 = "Can't jump to that location!"; | |
2355 } | |
2356 ShowStatusBarString(v73, 6u); | |
4 | 2357 continue; |
961 | 2358 case UIMSG_CastQuickSpell: |
0 | 2359 if ( bUnderwater == 1 ) |
362 | 2360 { |
2361 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" | |
2362 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); | |
2363 continue; | |
2364 } | |
0 | 2365 if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) ) |
11 | 2366 continue; |
362 | 2367 _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); |
11 | 2368 continue; |
1000 | 2369 case UIMSG_CastSpell_Monster_Improvement: |
2370 case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, | |
0 | 2371 if ( pRenderer->pRenderD3D ) |
2372 { | |
2373 v81 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
2374 } | |
2375 else | |
2376 { | |
2377 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v206); | |
2378 pPoint2 = pMouse->GetCursorPos(&v201); | |
2379 v81 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint2->y]]; | |
2380 } | |
2381 v83 = v81; | |
2382 v44 = (unsigned __int16)v81; | |
2383 v84 = v83 >> 16; | |
848 | 2384 if ( PID_TYPE(v44) != 3 || v84 >= 5120 ) |
4 | 2385 continue; |
1000 | 2386 pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; |
2387 if ( uMessage == UIMSG_CastSpell_Shoot_Monster ) | |
2388 { | |
2389 LOBYTE(pSpellInfo->field_8) &= 0xF7; | |
0 | 2390 } |
2391 else | |
2392 { | |
1000 | 2393 if ( uMessage == UIMSG_CastSpell_Monster_Improvement ) |
2394 HIBYTE(pSpellInfo->field_8) &= 0xFEu; | |
0 | 2395 else |
1000 | 2396 HIBYTE(pSpellInfo->field_8) &= 0xFDu; |
2397 } | |
2398 pSpellInfo->uPlayerID_2 = uMessageParam; | |
2399 pSpellInfo->spell_target_pid = v44; | |
2400 pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); | |
2401 pGUIWindow_Settings->Release(); | |
11 | 2402 pGUIWindow_Settings = 0; |
2403 pMouse->SetCursorBitmap("MICON1"); | |
783 | 2404 GameUI_Footer_TimeLeft = 0; |
11 | 2405 unk_50C9A0 = 0; |
2406 back_to_game(); | |
2407 continue; | |
151 | 2408 case UIMSG_1C: |
987 | 2409 __debugbreak(); |
0 | 2410 if ( !uActiveCharacter || pCurrentScreen ) |
4 | 2411 continue; |
710 | 2412 ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0); |
151 | 2413 pCurrentScreen = SCREEN_19; |
0 | 2414 pEventTimer->Pause(); |
4 | 2415 continue; |
151 | 2416 case UIMSG_1B: |
987 | 2417 __debugbreak(); |
0 | 2418 if ( !uActiveCharacter ) |
4 | 2419 continue; |
978 | 2420 if ( pParty->bTurnBasedModeOn != 1 ) |
11 | 2421 { |
2422 if ( pActors[uMessageParam].uAIState == 5 ) | |
2423 stru_50C198.LootActor(&pActors[uMessageParam]); | |
2424 else | |
2425 Actor::StealFrom(uMessageParam); | |
2426 continue; | |
2427 } | |
978 | 2428 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) |
4 | 2429 continue; |
0 | 2430 if ( !(pTurnEngine->field_18 & 2) ) |
2431 { | |
2432 if ( pActors[uMessageParam].uAIState == 5 ) | |
2433 stru_50C198.LootActor(&pActors[uMessageParam]); | |
2434 else | |
2435 Actor::StealFrom(uMessageParam); | |
2436 } | |
4 | 2437 continue; |
271 | 2438 |
2439 case UIMSG_Attack: | |
0 | 2440 if ( !uActiveCharacter ) |
4 | 2441 continue; |
978 | 2442 if ( pParty->bTurnBasedModeOn != 1 ) |
11 | 2443 { |
2444 _42ECB5_PlayerAttacksActor(); | |
2445 continue; | |
2446 } | |
978 | 2447 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) |
4 | 2448 continue; |
0 | 2449 if ( !(pTurnEngine->field_18 & 2) ) |
2450 _42ECB5_PlayerAttacksActor(); | |
4 | 2451 continue; |
151 | 2452 case UIMSG_ExitRest: |
962 | 2453 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 | 2454 continue; |
151 | 2455 case UIMSG_Wait5Minutes: |
0 | 2456 if ( dword_506F14 == 2 ) |
916 | 2457 { |
2458 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2459 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2460 continue; | |
11 | 2461 } |
962 | 2462 GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2, |
0 | 2463 (int)pButton_RestUI_Wait5Minutes, (int)pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" |
978 | 2464 dword_506F14 = 1; |
0 | 2465 _506F18_num_hours_to_sleep = 5; |
4 | 2466 continue; |
151 | 2467 case UIMSG_Wait1Hour: |
0 | 2468 if ( dword_506F14 == 2 ) |
916 | 2469 { |
2470 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2471 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2472 continue; | |
11 | 2473 } |
962 | 2474 GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2, |
0 | 2475 (int)pButton_RestUI_Wait1Hour, (int)pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" |
978 | 2476 dword_506F14 = 1; |
0 | 2477 _506F18_num_hours_to_sleep = 60; |
4 | 2478 continue; |
907 | 2479 case UIMSG_RentRoom: |
0 | 2480 dword_506F14 = 2; |
1033 | 2481 RestUI_Load(); |
758 | 2482 v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; |
0 | 2483 _506F18_num_hours_to_sleep = v86; |
2484 if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 ) | |
2485 _506F18_num_hours_to_sleep = v86 + 720; | |
11 | 2486 dword_506F14 = 2; |
2487 pParty->RestAndHeal(); | |
766 | 2488 pParty->days_played_without_rest = 0; |
2489 pParty->pPlayers[3].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2490 pParty->pPlayers[2].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2491 pParty->pPlayers[1].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2492 pParty->pPlayers[0].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
11 | 2493 continue; |
907 | 2494 case UIMSG_RestWindow: |
0 | 2495 if ( pMessageQueue_50CBD0->uNumMessages ) |
2496 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2497 if ( pCurrentScreen ) | |
4 | 2498 continue; |
0 | 2499 if ( sub_42F4DA() ) |
11 | 2500 { |
978 | 2501 if ( pParty->bTurnBasedModeOn == 1 ) |
11 | 2502 { |
916 | 2503 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" |
11 | 2504 continue; |
2505 } | |
2506 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2507 if ( pParty->uFlags & 0x88 ) | |
2508 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
916 | 2509 ShowStatusBarString(v88, 2); |
11 | 2510 if ( !uActiveCharacter ) |
2511 continue; | |
916 | 2512 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); |
2513 continue; | |
11 | 2514 } |
978 | 2515 if ( pParty->bTurnBasedModeOn == 1 ) |
916 | 2516 { |
2517 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" | |
11 | 2518 continue; |
2519 } | |
0 | 2520 if ( !(pParty->uFlags & 0x88) ) |
2521 { | |
1033 | 2522 RestUI_Load(); |
4 | 2523 continue; |
0 | 2524 } |
978 | 2525 if ( pParty->bTurnBasedModeOn == 1 ) |
0 | 2526 { |
916 | 2527 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" |
11 | 2528 continue; |
0 | 2529 } |
2530 v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!" | |
2531 if ( pParty->uFlags & 0x88 ) | |
2532 v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!" | |
2533 ShowStatusBarString(v88, 2u); | |
2534 if ( !uActiveCharacter ) | |
4 | 2535 continue; |
916 | 2536 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); |
2537 continue; | |
907 | 2538 case UIMSG_Rest8Hour: |
0 | 2539 if ( dword_506F14 ) |
916 | 2540 { |
2541 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" | |
362 | 2542 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2543 continue; | |
11 | 2544 } |
0 | 2545 if ( pParty->uNumFoodRations < uRestUI_FoodRequiredToRest ) |
2546 { | |
2547 ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2u);// "You don't have enough food to rest" | |
2548 if ( uActiveCharacter && pPlayers[uActiveCharacter]->CanAct() ) | |
916 | 2549 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_108, 0); |
0 | 2550 } |
2551 else | |
2552 { | |
2553 pParty->pPlayers[3].pConditions[2] = pParty->uTimePlayed; | |
2554 pParty->pPlayers[2].pConditions[2] = pParty->uTimePlayed; | |
2555 pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed; | |
2556 pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed; | |
2557 v90 = pMapStats->GetMapInfo(pCurrentMapName); | |
2558 if ( !v90 ) | |
2559 v90 = rand() % (signed int)pMapStats->uNumMaps + 1; | |
2560 pMapInfo = &pMapStats->pInfos[v90]; | |
237 | 2561 if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent ) |
0 | 2562 { |
2563 v91 = rand() % 100; | |
237 | 2564 v92 = pMapInfo->EncM1percent; |
0 | 2565 v93 = v91 + 1; |
2566 if ( v93 > v92 ) | |
237 | 2567 pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); |
0 | 2568 else |
978 | 2569 pNPCData4 = (NPCData *)1; |
0 | 2570 if ( !sub_45063B(pMapInfo, (int)pNPCData4) ) |
2571 pNPCData4 = 0; | |
2572 if ( pNPCData4 ) | |
2573 { | |
2574 pPlayerNum = rand() % 4; | |
2575 LODWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
2576 HIDWORD(pParty->pPlayers[pPlayerNum].pConditions[2]) = 0; | |
2577 v95 = rand(); | |
2578 Rest(v95 % 6 + 60); | |
2579 _506F18_num_hours_to_sleep = 0; | |
2580 dword_506F14 = 0; | |
437 | 2581 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 2582 { |
990 | 2583 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 2584 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
2585 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
2586 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 2587 }*/ |
2588 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
916 | 2589 ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!" |
2590 pAudioPlayer->PlaySound((SoundID)227, 0, 0, -1, 0, 0, 0, 0); | |
2591 continue; | |
0 | 2592 } |
2593 } | |
2594 Party::TakeFood(uRestUI_FoodRequiredToRest); | |
2595 _506F18_num_hours_to_sleep = 480; | |
2596 dword_506F14 = 2; | |
2597 pParty->RestAndHeal(); | |
766 | 2598 pParty->days_played_without_rest = 0; |
2599 pParty->pPlayers[3].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2600 pParty->pPlayers[2].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2601 pParty->pPlayers[1].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
2602 pParty->pPlayers[0].pConditions[Player::Condition_Sleep] = pParty->uTimePlayed; | |
0 | 2603 } |
4 | 2604 continue; |
151 | 2605 case UIMSG_AlreadyResting: |
0 | 2606 if ( dword_506F14 == 2 ) |
2607 { | |
916 | 2608 ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!" |
362 | 2609 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
2610 continue; | |
0 | 2611 } |
962 | 2612 GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2, |
0 | 2613 (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" |
758 | 2614 v97 = _494820_training_time(pParty->uCurrentHour); |
978 | 2615 dword_506F14 = 1; |
0 | 2616 _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute; |
4 | 2617 continue; |
960 | 2618 case UIMSG_HintSelectRemoveQuickSpellBtn: |
688 | 2619 if ( quick_spell_at_page && byte_506550 ) |
2620 { | |
2621 v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName; | |
916 | 2622 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[483], v173); |
0 | 2623 } |
2624 else | |
2625 { | |
2626 if ( pPlayers[uActiveCharacter]->uQuickSpell ) | |
2627 v177 = pGlobalTXT_LocalizationStrings[584];// "Click here to remove your Quick Spell" | |
2628 else | |
2629 v177 = pGlobalTXT_LocalizationStrings[484];// "Select a spell then click here to set a QuickSpell" | |
2630 strcpy(pTmpBuf, v177); | |
2631 } | |
994 | 2632 GameUI_SetFooterString(pTmpBuf); |
4 | 2633 continue; |
370 | 2634 case UIMSG_SPellbook_ShowHightlightedSpellInfo: |
4 | 2635 if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter], |
0 | 2636 !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402)) ) |
4 | 2637 continue; |
0 | 2638 if ( sub_4637E0_is_there_popup_onscreen() ) |
2639 dword_507B00_spell_info_to_draw_in_popup = uMessageParam + 1; | |
2640 v98 = *(char *)(uNumSeconds + 6734); | |
688 | 2641 if ( quick_spell_at_page - 1 == uMessageParam ) |
0 | 2642 { |
2643 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2644 v161 = pGlobalTXT_LocalizationStrings[485]; | |
2645 } | |
2646 else | |
2647 { | |
2648 v178 = pSpellStats->pInfos[uMessageParam + 11 * v98 + 1].pName; | |
2649 v161 = pGlobalTXT_LocalizationStrings[486]; | |
2650 } | |
809 | 2651 sprintfex(pTmpBuf, v161, v178); |
994 | 2652 GameUI_SetFooterString(pTmpBuf); |
11 | 2653 continue; |
960 | 2654 case UIMSG_ClickInstallRemoveQuickSpellBtn: |
962 | 2655 GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0); |
0 | 2656 if ( !uActiveCharacter ) |
4 | 2657 continue; |
0 | 2658 pPlayer10 = pPlayers[uActiveCharacter]; |
688 | 2659 if ( !byte_506550 || !quick_spell_at_page ) |
0 | 2660 { |
2661 pPlayer10->uQuickSpell = 0; | |
688 | 2662 quick_spell_at_page = 0; |
916 | 2663 pAudioPlayer->PlaySound((SoundID)203, 0, 0, -1, 0, 0, 0, 0); |
2664 continue; | |
0 | 2665 } |
688 | 2666 v99 = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage; |
0 | 2667 pPlayers[uActiveCharacter]->uQuickSpell = v99; |
2668 stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter); | |
2669 if ( uActiveCharacter ) | |
187 | 2670 pPlayer10->PlaySound(SPEECH_12, 0); |
0 | 2671 byte_506550 = 0; |
4 | 2672 continue; |
151 | 2673 case UIMSG_33: |
987 | 2674 __debugbreak(); |
0 | 2675 if ( !uActiveCharacter ) |
4 | 2676 continue; |
0 | 2677 pPlayer3 = pPlayers[uActiveCharacter]; |
2678 pNPCData4 = 0; | |
2679 uAction = 0; | |
2680 v101 = 0; | |
2681 thisl = (int)&pPlayer3->pActiveSkills[12]; | |
2682 do | |
2683 { | |
2684 if ( *(short *)thisl ) | |
2685 { | |
198 | 2686 if ( pPlayer3->lastOpenedSpellbookPage == v101 ) |
0 | 2687 uAction = (int)pNPCData4; |
2688 v102 = (int)pNPCData4; | |
2689 pNPCData4 = (NPCData *)((char *)pNPCData4 + 1); | |
2690 v217[v102] = v101; | |
2691 } | |
2692 thisl += 2; | |
2693 ++v101; | |
2694 } | |
2695 while ( v101 < 9 ); | |
2696 if ( !pNPCData4 ) | |
11 | 2697 { |
2698 v127 = rand() % 2 + 204; | |
916 | 2699 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2700 continue; | |
11 | 2701 } |
0 | 2702 if ( GetAsyncKeyState(16) ) |
2703 { | |
2704 --uAction; | |
2705 if ( uAction < 0 ) | |
2706 uAction = (int)((char *)pNPCData4 - 1); | |
2707 } | |
2708 else | |
2709 { | |
2710 ++uAction; | |
2711 if ( uAction >= (signed int)pNPCData4 ) | |
2712 uAction = 0; | |
2713 } | |
2714 sub_41140B(); | |
198 | 2715 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); |
11 | 2716 pGUIWindow_CurrentMenu->OpenSpellBook(); |
2717 v127 = rand() % 2 + 204; | |
916 | 2718 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2719 continue; | |
832 | 2720 case UIMSG_OpenSpellbookPage: |
198 | 2721 if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage ) |
4 | 2722 continue; |
0 | 2723 sub_41140B(); |
198 | 2724 pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; |
11 | 2725 pGUIWindow_CurrentMenu->OpenSpellBook(); |
0 | 2726 v127 = rand() % 2 + 204; |
916 | 2727 pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0); |
2728 continue; | |
437 | 2729 case UIMSG_SelectSpell: |
2730 { | |
2731 if (pTurnEngine->field_4 == 3) | |
2732 continue; | |
2733 if (!uActiveCharacter) | |
2734 continue; | |
2735 | |
2736 // uNumSeconds = (unsigned int)pPlayers[uActiveCharacter]; | |
2737 auto player = pPlayers[uActiveCharacter]; | |
2738 if (player->spellbook.pChapters[player->lastOpenedSpellbookPage].bIsSpellAvailable[uMessageParam]) | |
2739 //if ( *(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + &lastOpenedSpellbookPage) + uMessageParam + 402) ) | |
2740 { | |
688 | 2741 if ( quick_spell_at_page - 1 == uMessageParam ) |
0 | 2742 { |
2743 pGUIWindow_CurrentMenu->Release(); | |
2744 pEventTimer->Resume(); | |
978 | 2745 viewparams->bRedrawGameUI = 1; |
151 | 2746 pCurrentScreen = SCREEN_GAME; |
0 | 2747 pIcons_LOD->_4114F2(); |
688 | 2748 v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; |
1000 | 2749 /*if ( dword_50C9E8 < 40 ) |
0 | 2750 { |
437 | 2751 dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook; |
2752 dword_50C9EC[3 * dword_50C9E8 + 1] = v103; | |
2753 dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1; | |
0 | 2754 ++dword_50C9E8; |
1000 | 2755 }*/ |
1012 | 2756 pMessageQueue_50C9E8->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); |
2757 // pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); | |
0 | 2758 } |
2759 else | |
2760 { | |
2761 byte_506550 = 1; | |
688 | 2762 quick_spell_at_page = uMessageParam + 1; |
0 | 2763 } |
437 | 2764 } |
2765 } | |
2766 continue; | |
370 | 2767 |
2768 case UIMSG_CastSpellFromBook: | |
2769 if ( pTurnEngine->field_4 != 3 ) | |
2770 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0); | |
2771 continue; | |
2772 | |
1019 | 2773 case UIMSG_SpellScrollUse: |
987 | 2774 __debugbreak(); |
0 | 2775 if ( pTurnEngine->field_4 != 3 ) |
978 | 2776 _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0); |
4 | 2777 continue; |
907 | 2778 case UIMSG_SpellBookWindow: |
0 | 2779 if ( pTurnEngine->field_4 == 3 ) |
4 | 2780 continue; |
0 | 2781 if ( bUnderwater == 1 ) |
2782 { | |
362 | 2783 ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!" |
916 | 2784 pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0); |
0 | 2785 } |
2786 else | |
2787 { | |
2788 if ( pMessageQueue_50CBD0->uNumMessages ) | |
2789 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2790 if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery ) | |
2791 { | |
2792 if ( !pCurrentScreen ) | |
2793 { | |
962 | 2794 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); |
151 | 2795 pCurrentScreen = SCREEN_SPELL_BOOK; |
0 | 2796 pEventTimer->Pause(); |
710 | 2797 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); |
0 | 2798 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); |
978 | 2799 viewparams->field_48 = 1; |
4 | 2800 continue; |
0 | 2801 } |
151 | 2802 if ( pCurrentScreen != SCREEN_REST |
2803 && pCurrentScreen != SCREEN_CHARACTERS | |
2804 && (pCurrentScreen <= SCREEN_63 | |
2805 || pCurrentScreen > SCREEN_67) ) | |
11 | 2806 { |
2807 pGUIWindow_CurrentMenu->Release(); | |
962 | 2808 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); |
151 | 2809 pCurrentScreen = SCREEN_SPELL_BOOK; |
11 | 2810 pEventTimer->Pause(); |
710 | 2811 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); |
11 | 2812 pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); |
978 | 2813 viewparams->field_48 = 1; |
11 | 2814 continue; |
2815 } | |
2816 } | |
2817 } | |
2818 continue; | |
2819 case UIMSG_QuickReference: | |
0 | 2820 if ( pMessageQueue_50CBD0->uNumMessages ) |
2821 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
2822 if ( pCurrentScreen ) | |
2823 pGUIWindow_CurrentMenu->Release(); | |
2824 ++pIcons_LOD->uTexturePacksCount; | |
2825 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
2826 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
962 | 2827 GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0); |
978 | 2828 viewparams->bRedrawGameUI = 1; |
0 | 2829 pEventTimer->Pause(); |
2830 pAudioPlayer->StopChannels(-1, -1); | |
151 | 2831 pCurrentScreen = SCREEN_QUICK_REFERENCE; |
710 | 2832 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0); |
0 | 2833 papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); |
978 | 2834 pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, |
0 | 2835 pGlobalTXT_LocalizationStrings[79],// "Exit" |
973 | 2836 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179); |
4 | 2837 continue; |
358 | 2838 case UIMSG_GameMenuButton: |
0 | 2839 if ( pCurrentScreen ) |
2840 { | |
2841 pGUIWindow_CurrentMenu->Release(); | |
2842 pEventTimer->Resume(); | |
151 | 2843 pCurrentScreen = SCREEN_GAME; |
978 | 2844 viewparams->bRedrawGameUI = 1; |
0 | 2845 } |
2846 stru_506E40.Release(); | |
2847 uNumSeconds = (unsigned int)MakeScreenshot(155, 117); | |
2848 pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); | |
2849 free((void *)uNumSeconds); | |
2850 stru_506E40._40E55E("gamma.pcx", 0); | |
962 | 2851 GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton, (int)pBtn_GameSettings, 0); |
11 | 2852 //LABEL_453: |
437 | 2853 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
4 | 2854 continue; |
990 | 2855 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
11 | 2856 //goto LABEL_770; |
2857 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
2858 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 2859 ++pMessageQueue_50CBD0->uNumMessages;*/ |
2860 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
11 | 2861 continue; |
0 | 2862 case UIMSG_C0: |
987 | 2863 __debugbreak(); |
978 | 2864 dword_50651C = 1; |
0 | 2865 if ( pMouse->GetCursorPos(&v211)->y > 178 ) |
2866 dword_50651C = -1; | |
4 | 2867 continue; |
961 | 2868 case UIMSG_ClickAwardsUpBtn: |
962 | 2869 GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0); |
990 | 2870 BtnUp_flag = 1; |
4 | 2871 continue; |
961 | 2872 case UIMSG_ClickAwardsDownBtn: |
962 | 2873 GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0); |
990 | 2874 BtnDown_flag = 1; |
4 | 2875 continue; |
910 | 2876 case UIMSG_ChangeDetaliz: |
978 | 2877 bRingsShownInCharScreen ^= 1; |
910 | 2878 pCharacterScreen_DetalizBtn->Release(); |
697 | 2879 pCharacterScreen_DollBtn->Release(); |
0 | 2880 if ( bRingsShownInCharScreen ) |
2881 { | |
973 | 2882 v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight; |
2883 v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth; | |
0 | 2884 v123 = 445; |
2885 v121 = 470; | |
2886 } | |
2887 else | |
2888 { | |
2889 v128 = 30; | |
2890 v125 = 30; | |
2891 v123 = 300; | |
2892 v121 = 600; | |
2893 } | |
978 | 2894 pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0, |
0 | 2895 pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" |
2896 0); | |
1025 | 2897 pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); |
978 | 2898 viewparams->bRedrawGameUI = 1; |
910 | 2899 continue; |
2900 case UIMSG_ClickPaperdoll: | |
0 | 2901 OnPaperdollLeftClick(); |
4 | 2902 continue; |
960 | 2903 case UIMSG_ClickStatsBtn: |
0 | 2904 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; |
991 | 2905 CharacterUI_ReleaseButtons(); |
0 | 2906 sub_419379(); |
962 | 2907 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0); |
960 | 2908 continue; |
2909 case UIMSG_ClickSkillsBtn: | |
0 | 2910 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; |
991 | 2911 CharacterUI_ReleaseButtons(); |
0 | 2912 sub_419379(); |
991 | 2913 CharacterUI_SkillsTab_CreateButtons(); |
962 | 2914 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0); |
11 | 2915 continue; |
0 | 2916 case UIMSG_SkillUp: |
2917 pPlayer4 = pPlayers[uActiveCharacter]; | |
2918 v105 = (int)&pPlayer4->pActiveSkills[uMessageParam]; | |
2919 LOWORD(v2) = *(short *)v105; | |
2920 uNumSeconds = v2; | |
2921 if ( pPlayer4->uSkillPoints < (v2 & 0x3F) + 1 ) | |
2922 { | |
2923 v87 = pGlobalTXT_LocalizationStrings[488];// "You don't have enough skill points!" | |
2924 } | |
2925 else | |
2926 { | |
2927 if ( (uNumSeconds & 0x3F) < 0x3C ) | |
2928 { | |
2929 *(short *)v105 = uNumSeconds + 1; | |
2930 pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F; | |
187 | 2931 pPlayer4->PlaySound(SPEECH_14, 0); |
916 | 2932 pAudioPlayer->PlaySound((SoundID)20001, 0, 0, -1, 0, 0, 0, 0); |
2933 continue; | |
0 | 2934 } |
2935 v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!" | |
2936 } | |
916 | 2937 ShowStatusBarString(v87, 2); |
4 | 2938 continue; |
960 | 2939 case UIMSG_ClickInventoryBtn: |
0 | 2940 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; |
2941 sub_419379(); | |
991 | 2942 CharacterUI_ReleaseButtons(); |
962 | 2943 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0); |
960 | 2944 continue; |
2945 case UIMSG_ClickExitCharacterWindowBtn: | |
2946 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0); | |
2947 continue; | |
2948 case UIMSG_ClickAwardsBtn: | |
0 | 2949 sub_419379(); |
991 | 2950 CharacterUI_ReleaseButtons(); |
0 | 2951 sub_419220(); |
2952 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; | |
962 | 2953 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0); |
521 | 2954 FillAwardsData(); |
4 | 2955 continue; |
1000 | 2956 case UIMSG_ClickBooksBtn: |
0 | 2957 switch ( uMessageParam ) |
2958 { | |
990 | 2959 case 11://Page UP |
2960 BtnUp_flag = 1; | |
2961 pButton = pBtn_Book_2; | |
2962 break; | |
2963 case 10://Page DOWN | |
2964 BtnDown_flag = 1; | |
2965 pButton = pBtn_Book_1; | |
2966 break; | |
1000 | 2967 case 0://Zoom plus |
0 | 2968 pButton = pBtn_Book_1; |
990 | 2969 BtnDown_flag = 1; |
0 | 2970 break; |
1000 | 2971 case 1://Zoom minus |
2972 pButton = pBtn_Book_2; | |
990 | 2973 BtnUp_flag = 1; |
0 | 2974 break; |
990 | 2975 case 2://Potions |
2976 Book_PageBtn3_flag = 1; | |
0 | 2977 if ( dword_506364 ) |
4 | 2978 continue; |
0 | 2979 pButton = pBtn_Book_3; |
2980 break; | |
990 | 2981 case 3://fountains |
2982 Book_PageBtn4_flag = 1; | |
0 | 2983 if ( dword_506364 ) |
4 | 2984 continue; |
0 | 2985 pButton = pBtn_Book_4; |
2986 break; | |
990 | 2987 case 4://obelisks |
2988 Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag | |
0 | 2989 if ( dword_506364 ) |
4 | 2990 continue; |
0 | 2991 pButton = pBtn_Book_5; |
2992 break; | |
990 | 2993 case 5://seer |
2994 Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag | |
0 | 2995 if ( dword_506364 ) |
4 | 2996 continue; |
0 | 2997 pButton = pBtn_Book_6; |
2998 break; | |
990 | 2999 case 6://misc |
0 | 3000 pButton = pBtn_Autonotes_Misc; |
990 | 3001 Autonotes_Misc_page_flag = 1; |
0 | 3002 break; |
990 | 3003 case 7://Instructors |
0 | 3004 pButton = pBtn_Autonotes_Instructors; |
990 | 3005 Autonotes_Instructors_page_flag = 1; |
0 | 3006 break; |
990 | 3007 default: |
3008 continue; | |
0 | 3009 } |
978 | 3010 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); |
11 | 3011 continue; |
0 | 3012 case UIMSG_SelectCharacter: |
3013 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3014 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3015 GameUI_OnPlayerPortraitLeftClick(uMessageParam); | |
4 | 3016 continue; |
0 | 3017 case UIMSG_ShowStatus_Funds: |
3018 v174 = (char *)pParty->uNumGoldInBank; | |
3019 v158 = pParty->uNumGold + pParty->uNumGoldInBank; | |
916 | 3020 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[489], v158, v174);// "You have %d total gold, %d in the Bank" |
994 | 3021 GameUI_SetFooterString(pTmpBuf); |
11 | 3022 continue; |
0 | 3023 case UIMSG_ShowStatus_DateTime: |
3024 pNPCData4 = (NPCData *)pParty->uCurrentHour; | |
3025 if ( (signed int)pParty->uCurrentHour <= 12 ) | |
3026 { | |
3027 if ( !pNPCData4 ) | |
3028 pNPCData4 = (NPCData *)12; | |
3029 } | |
3030 else | |
3031 { | |
3032 pNPCData4 = (NPCData *)((char *)pNPCData4 - 12); | |
3033 } | |
978 | 3034 if ( pParty->uCurrentHour < 0xC || (uNumSeconds = 1, pParty->uCurrentHour >= 0x18) ) |
0 | 3035 uNumSeconds = 0; |
3036 sprintf(pTmpBuf, "%d:%02d%s %s %d %s %d", pNPCData4, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7], | |
3037 7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear); | |
994 | 3038 GameUI_SetFooterString(pTmpBuf); |
11 | 3039 continue; |
0 | 3040 case UIMSG_ShowStatus_Food: |
306 | 3041 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food" |
994 | 3042 GameUI_SetFooterString(pTmpBuf); |
306 | 3043 continue; |
0 | 3044 case UIMSG_ShowStatus_Player: |
3045 pPlayer5 = pPlayers[uMessageParam]; | |
264 | 3046 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pPlayer5->pName, pClassNames[pPlayer5->classType]);// "%s the %s" |
0 | 3047 strcat(pTmpBuf, ": "); |
3048 v107 = pPlayer5->GetMajorConditionIdx(); | |
3049 strcat(pTmpBuf, aCharacterConditionNames[v107]); | |
994 | 3050 GameUI_SetFooterString(pTmpBuf); |
0 | 3051 v108 = 8 * uMessageParam - 8; |
3052 LOBYTE(v108) = v108 | 4; | |
888 | 3053 pMouse->uPointingObjectID = PID(OBJECT_Player,v108); |
4 | 3054 continue; |
0 | 3055 case UIMSG_ShowStatus_ManaHP: |
1000 | 3056 sprintf(pTmpBuf, "%d / %d %s %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(), |
3057 pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(), | |
3058 pGlobalTXT_LocalizationStrings[212]); | |
994 | 3059 GameUI_SetFooterString(pTmpBuf); |
11 | 3060 continue; |
987 | 3061 case UIMSG_CHEST_ClickItem: |
3062 if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) | |
3063 { | |
3064 OnInventoryLeftClick(); | |
11 | 3065 continue; |
3066 } | |
987 | 3067 OnChestLeftClick(); |
4 | 3068 continue; |
151 | 3069 case UIMSG_InventoryLeftClick: |
987 | 3070 OnInventoryLeftClick(); |
4 | 3071 continue; |
960 | 3072 case UIMSG_MouseLeftClickInGame: |
0 | 3073 if ( !pRenderer->pRenderD3D ) |
11 | 3074 { |
3075 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3076 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3077 OnGameViewportClick(); | |
3078 continue; | |
3079 } | |
0 | 3080 v115 = pMessageQueue_50CBD0->uNumMessages; |
3081 if ( !pMessageQueue_50CBD0->uNumMessages ) | |
11 | 3082 { |
990 | 3083 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3084 /*if ( (signed int)v115 < 40 ) |
11 | 3085 //goto LABEL_769; |
3086 { | |
990 | 3087 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
11 | 3088 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
3089 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3090 ++pMessageQueue_50CBD0->uNumMessages; | |
3091 continue; | |
437 | 3092 }*/ |
11 | 3093 continue; |
3094 } | |
0 | 3095 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) |
3096 { | |
978 | 3097 pMessageQueue_50CBD0->uNumMessages = 1; |
990 | 3098 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3099 /*v115 = v0; |
0 | 3100 pMessageQueue_50CBD0->uNumMessages = v0; |
990 | 3101 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
0 | 3102 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
11 | 3103 //goto LABEL_771; |
3104 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
437 | 3105 ++pMessageQueue_50CBD0->uNumMessages;*/ |
11 | 3106 continue; |
0 | 3107 } |
3108 v115 = 0; | |
3109 pMessageQueue_50CBD0->uNumMessages = 0; | |
990 | 3110 pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); |
437 | 3111 /*if ( (signed int)v115 < 40 ) |
11 | 3112 //goto LABEL_769; |
3113 { | |
990 | 3114 pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; |
11 | 3115 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
3116 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3117 ++pMessageQueue_50CBD0->uNumMessages; | |
3118 continue; | |
437 | 3119 }*/ |
4 | 3120 continue; |
990 | 3121 case UIMSG_MouseLeftClickInScreen://ñðàáàòûâàåò ïðè íàæàòèè íà ïðàâóþ êíîïêó ìûøè ïîñëå UIMSG_MouseLeftClickInGame |
0 | 3122 if ( pMessageQueue_50CBD0->uNumMessages ) |
3123 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3124 OnGameViewportClick(); | |
4 | 3125 continue; |
151 | 3126 case UIMSG_F: |
987 | 3127 __debugbreak(); |
0 | 3128 if ( pRenderer->pRenderD3D ) |
3129 { | |
3130 LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
3131 } | |
3132 else | |
3133 { | |
3134 uNumSeconds = (unsigned int)pMouse->GetCursorPos(&v209); | |
3135 pPoint3 = pMouse->GetCursorPos(&v204); | |
3136 v116 = pRenderer->pActiveZBuffer[*(int *)uNumSeconds + pSRZBufferLineOffsets[pPoint3->y]]; | |
3137 } | |
3138 pButton2 = (GUIButton *)(unsigned __int16)v116; | |
960 | 3139 GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0); |
11 | 3140 continue; |
151 | 3141 case UIMSG_54: |
987 | 3142 __debugbreak(); |
0 | 3143 pButton2 = (GUIButton *)uMessageParam; |
990 | 3144 GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0); |
4 | 3145 continue; |
201 | 3146 case UIMSG_Game_Action: |
0 | 3147 if ( pMessageQueue_50CBD0->uNumMessages ) |
3148 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
3149 OnPressSpace(); | |
4 | 3150 continue; |
960 | 3151 case UIMSG_ClickZoomOutBtn: |
0 | 3152 if ( pCurrentScreen ) |
4 | 3153 continue; |
0 | 3154 pParty->uFlags |= 2u; |
1000 | 3155 GUIWindow::Create(519, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomOut, 0); |
0 | 3156 uNumSeconds = 131072; |
3157 v118 = 2 * viewparams->uMinimapZoom; | |
3158 ++viewparams->field_28; | |
3159 viewparams->uMinimapZoom *= 2; | |
3160 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
3161 { | |
3162 if ( (signed int)v118 > 4096 ) | |
3163 { | |
3164 viewparams->uMinimapZoom = 4096; | |
3165 viewparams->field_28 = 12; | |
3166 } | |
4 | 3167 continue; |
0 | 3168 } |
3169 v119 = 2048; | |
3170 if ( (signed int)v118 <= 2048 ) | |
960 | 3171 { |
3172 dword_576E2C = v118; | |
3173 dword_576E28 = viewparams->field_28; | |
3174 break; | |
3175 } | |
0 | 3176 viewparams->field_28 = 11; |
960 | 3177 viewparams->uMinimapZoom = v119; |
3178 dword_576E2C = v119; | |
3179 dword_576E28 = viewparams->field_28; | |
3180 break; | |
3181 case UIMSG_ClickZoomInBtn: | |
0 | 3182 if ( pCurrentScreen ) |
4 | 3183 continue; |
0 | 3184 pParty->uFlags |= 2u; |
1000 | 3185 GUIWindow::Create(574, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomIn, 0); |
0 | 3186 uNumSeconds = 32768; |
3187 v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
3188 --viewparams->field_28; | |
3189 viewparams->uMinimapZoom = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; | |
3190 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3191 { | |
3192 v119 = 512; | |
3193 if ( (signed int)v118 < 512 ) | |
3194 { | |
3195 viewparams->field_28 = 9; | |
3196 v118 = v119; | |
3197 viewparams->uMinimapZoom = v119; | |
3198 } | |
3199 dword_576E2C = v118; | |
3200 dword_576E28 = viewparams->field_28; | |
3201 } | |
3202 else | |
3203 { | |
3204 if ( (signed int)v118 < 256 ) | |
3205 { | |
3206 viewparams->uMinimapZoom = 256; | |
3207 viewparams->field_28 = 8; | |
3208 } | |
3209 } | |
4 | 3210 default: |
3211 continue; | |
0 | 3212 } |
3213 } | |
3214 } | |
1012 | 3215 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8; |
3216 memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages); | |
3217 //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8); | |
3218 //dword_50C9E8 = 0; | |
3219 | |
3220 | |
3221 pMessageQueue_50C9E8->uNumMessages=0; | |
0 | 3222 if ( dword_50C9DC ) |
3223 { | |
437 | 3224 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 3225 { |
3226 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9DC; | |
3227 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = (int)ptr_50C9E0; | |
3228 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3229 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 3230 }*/ |
3231 pMessageQueue_50CBD0->AddMessage((UIMessageType)dword_50C9DC, (int)ptr_50C9E0, 0); | |
0 | 3232 dword_50C9DC = 0; |
3233 } | |
3234 else | |
3235 { | |
3236 if ( dword_50C9D0 > 0 ) | |
3237 { | |
3238 dword_50C9D8 -= pEventTimer->uTimeElapsed; | |
3239 if ( dword_50C9D8 <= 0 ) | |
3240 { | |
437 | 3241 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 3242 { |
3243 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)dword_50C9D0; | |
3244 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = dword_50C9D4; | |
3245 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
3246 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 3247 }*/ |
3248 pMessageQueue_50CBD0->AddMessage((UIMessageType)dword_50C9D0, dword_50C9D4, 0); | |
0 | 3249 dword_50C9D0 = 0; |
3250 dword_50C9D4 = 0; | |
3251 dword_50C9D8 = 0; | |
3252 } | |
3253 } | |
3254 } | |
924 | 3255 pCastSpellInfo->_427E01_cast_spell(); |
0 | 3256 } |
3257 | |
3258 //----- (004356FF) -------------------------------------------------------- | |
3259 void __cdecl back_to_game() | |
3260 { | |
3261 dword_507BF0_is_there_popup_onscreen = 0; | |
3262 dword_4E455C = 1; | |
3263 dword_50CDCC = 0; | |
3264 if ( pGUIWindow_ScrollWindow ) | |
3265 free_book_subwindow(); | |
3266 if ( !pCurrentScreen && !pGUIWindow_Settings ) | |
3267 pEventTimer->Resume(); | |
3268 viewparams->bRedrawGameUI = 1; | |
3269 } | |
782 | 3270 |
0 | 3271 //----- (00435748) -------------------------------------------------------- |
3272 void __cdecl GUI_MainMenuMessageProc() | |
3273 { | |
967 | 3274 Player *pPlayer; // ebx@2 |
0 | 3275 void *v3; // edi@21 |
3276 signed int v4; // eax@29 | |
3277 int v5; // ecx@29 | |
821 | 3278 PLAYER_SKILL_TYPE v6; // edi@37 |
0 | 3279 GUIWindow *pWindow; // eax@56 |
3280 GUIButton *pButton; // eax@59 | |
3281 int v15; // edi@70 | |
3282 char v20; // dl@116 | |
3283 unsigned int v21; // eax@116 | |
3284 unsigned int v25; // eax@120 | |
3285 unsigned int v26; // ecx@127 | |
3286 SoundID pSoundID; // [sp-2Ch] [bp-3Ch]@36 | |
3287 signed int v41; // [sp-10h] [bp-20h]@29 | |
971 | 3288 int pParam; // [sp+4h] [bp-Ch]@3 |
0 | 3289 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3 |
967 | 3290 int pSex; // [sp+Ch] [bp-4h]@3 |
0 | 3291 |
3292 if ( pMessageQueue_50CBD0->uNumMessages ) | |
3293 { | |
2 | 3294 pPlayer = pParty->pPlayers; |
0 | 3295 do |
3296 { | |
187 | 3297 int param2; |
971 | 3298 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, ¶m2); |
3299 auto player = &pParty->pPlayers[pParam]; | |
187 | 3300 |
3 | 3301 switch (pUIMessageType) // For buttons of window MainMenu |
2 | 3302 { |
165 | 3303 case UIMSG_MainMenu_ShowPartyCreationWnd: |
962 | 3304 GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); |
0 | 3305 SetCurrentMenuID(MENU_NEWGAME); |
960 | 3306 break; |
165 | 3307 case UIMSG_MainMenu_ShowLoadWindow: |
962 | 3308 GUIWindow::Create(495, 227, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnLoad, 0); |
0 | 3309 SetCurrentMenuID(MENU_SAVELOAD); |
960 | 3310 break; |
165 | 3311 case UIMSG_ShowCredits: |
962 | 3312 GUIWindow::Create(495, 282, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnCredits, 0); |
0 | 3313 SetCurrentMenuID(MENU_CREDITS); |
960 | 3314 break; |
165 | 3315 case UIMSG_ExitToWindows: |
962 | 3316 GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); |
982 | 3317 SetCurrentMenuID(MENU_EXIT_GAME); |
960 | 3318 break; |
187 | 3319 case UIMSG_PlayerCreation_SelectAttribute: |
960 | 3320 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3321 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
3322 uPlayerCreationUI_SelectedCharacter = pParam; | |
960 | 3323 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3324 break; | |
187 | 3325 case UIMSG_PlayerCreation_VoicePrev: |
967 | 3326 pSex = player->GetSexByVoice(); |
960 | 3327 do |
3328 { | |
3329 if (player->uVoiceID == 0) | |
3330 player->uVoiceID = 19; | |
3331 else --player->uVoiceID; | |
3332 } | |
967 | 3333 while (player->GetSexByVoice() != pSex); |
971 | 3334 pButton = pCreationUI_BtnPressLeft2[pParam]; |
962 | 3335 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); |
960 | 3336 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3337 player->PlaySound(SPEECH_PickMe, 0); | |
3338 break; | |
187 | 3339 case UIMSG_PlayerCreation_VoiceNext: |
967 | 3340 pSex = player->GetSexByVoice(); |
3341 do | |
3342 { | |
3343 player->uVoiceID = (player->uVoiceID + 1) % 20; | |
3344 } | |
3345 while (player->GetSexByVoice() != pSex); | |
971 | 3346 pButton = pCreationUI_BtnPressRight2[pParam]; |
967 | 3347 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); |
3348 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); | |
3349 player->PlaySound(SPEECH_PickMe, 0); | |
3350 break; | |
187 | 3351 case UIMSG_PlayerCreation_FacePrev: |
971 | 3352 pPlayer = &pParty->pPlayers[pParam]; |
1014 | 3353 if (!pPlayer->uCurrentFace) |
3354 pPlayer->uCurrentFace = 19; | |
960 | 3355 else |
1014 | 3356 pPlayer->uCurrentFace -= 1; |
3357 pPlayer->uVoiceID = pPlayer->uCurrentFace; | |
960 | 3358 pPlayer->SetInitialStats(); |
3359 pPlayer->SetSexByVoice(); | |
3360 pPlayer->RandomizeName(); | |
971 | 3361 v25 = pParam; |
960 | 3362 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3363 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3364 uPlayerCreationUI_SelectedCharacter = v25; |
962 | 3365 GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], 1); |
960 | 3366 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0.0, 0); |
3367 pPlayer->PlaySound(SPEECH_PickMe, 0); | |
3368 break; | |
187 | 3369 case UIMSG_PlayerCreation_FaceNext: |
971 | 3370 pPlayer = &pParty->pPlayers[pParam]; |
1014 | 3371 v20 = (char)((int)pPlayer->uCurrentFace + 1) % 20; |
3372 pPlayer->uCurrentFace = v20; | |
960 | 3373 pPlayer->uVoiceID = v20; |
3374 pPlayer->SetInitialStats(); | |
3375 pPlayer->SetSexByVoice(); | |
3376 pPlayer->RandomizeName(); | |
971 | 3377 v21 = pParam; |
960 | 3378 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
971 | 3379 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3380 uPlayerCreationUI_SelectedCharacter = v21; |
962 | 3381 GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], 1); |
960 | 3382 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3383 pPlayer->PlaySound(SPEECH_PickMe, 0); | |
3384 break; | |
3385 case UIMSG_PlayerCreationClickPlus: | |
962 | 3386 GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, 1); |
960 | 3387 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
3388 pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); | |
3389 break; | |
3390 case UIMSG_PlayerCreationClickMinus: | |
962 | 3391 GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, 1); |
960 | 3392 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
3393 pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); | |
3394 break; | |
3395 case UIMSG_PlayerCreationSelectActiveSkill: | |
967 | 3396 pPlayer = &pPlayer[uPlayerCreationUI_SelectedCharacter]; |
971 | 3397 v6 = pPlayer->GetSkillIdxByOrder(pParam + 4); |
967 | 3398 if ( pPlayer->GetSkillIdxByOrder(3) == 37 ) |
3399 pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1; | |
3400 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); | |
3401 break; | |
960 | 3402 case UIMSG_PlayerCreationSelectClass: |
971 | 3403 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam); |
960 | 3404 pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); |
3405 break; | |
3406 case UIMSG_PlayerCreationClickOK: | |
962 | 3407 GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0); |
960 | 3408 if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() ) |
3409 GameUI_Footer_TimeLeft = GetTickCount() + 4000; | |
3410 else | |
982 | 3411 uGameState = GAME_STATE_STARTING_NEW_GAME; |
960 | 3412 break; |
3413 case UIMSG_PlayerCreationClickReset: | |
962 | 3414 GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0); |
960 | 3415 pParty->Reset(); |
3416 break; | |
3417 case UIMSG_PlayerCreationRemoveUpSkill: | |
971 | 3418 uPlayerCreationUI_SelectedCharacter = pParam; |
960 | 3419 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; |
3420 //int pSex = pGUIWindow_CurrentMenu->pStartingPosActiveItem; | |
3421 v41 = 2; | |
971 | 3422 v5 = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
960 | 3423 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; |
3424 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) | |
3425 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; | |
3426 break; | |
3427 case UIMSG_PlayerCreationChangeName: | |
3428 pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); | |
971 | 3429 v3 = (void *)pParam; |
3430 uPlayerCreationUI_SelectedCharacter = pParam; | |
960 | 3431 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu); |
3432 pGUIWindow_CurrentMenu->ptr_1C = v3; | |
3433 break; | |
3434 case UIMSG_ChangeGameState: | |
978 | 3435 uGameState = GAME_FINISHED; |
960 | 3436 break; |
3437 case UIMSG_11: | |
3438 pMouse->SetCursorBitmap("MICON2"); | |
3439 break; | |
3440 case UIMSG_3A: | |
3441 SetCurrentMenuID(MENU_10); | |
3442 break; | |
165 | 3443 case UIMSG_LoadGame: |
0 | 3444 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) |
960 | 3445 break; |
961 | 3446 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
960 | 3447 break; |
165 | 3448 case UIMSG_SelectLoadSlot: |
0 | 3449 //main menu save/load wnd clicking on savegame lines |
1038 | 3450 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
3451 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
971 | 3452 if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition ) |
0 | 3453 { |
3454 //load clicked line | |
971 | 3455 v26 = pParam + pSaveListPosition; |
3456 if ( dword_6BE138 == pParam + pSaveListPosition ) | |
0 | 3457 { |
961 | 3458 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveLoadBtn, 0, 0); |
437 | 3459 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); |
0 | 3460 } |
3461 uLoadGameUI_SelectedSlot = v26; | |
3462 dword_6BE138 = v26; | |
3463 } | |
3464 else | |
3465 { | |
3466 //typing in the line | |
3 | 3467 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); |
0 | 3468 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); |
3469 pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); | |
3470 } | |
960 | 3471 break; |
961 | 3472 case UIMSG_SaveLoadBtn: |
3473 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); | |
960 | 3474 break; |
165 | 3475 case UIMSG_DownArrow: |
3 | 3476 ++pSaveListPosition; |
971 | 3477 if ( pSaveListPosition >= pParam ) |
3478 pSaveListPosition = pParam - 1; | |
3 | 3479 if ( pSaveListPosition < 1 ) |
3480 pSaveListPosition = 0; | |
3481 pWindow = pGUIWindow_CurrentMenu; | |
962 | 3482 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_PressedButton2, (int)pBtnDownArrow, 0); |
960 | 3483 break; |
165 | 3484 case UIMSG_Cancel: |
960 | 3485 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0); |
3486 break; | |
165 | 3487 case UIMSG_ArrowUp: |
3 | 3488 --pSaveListPosition; |
3489 if ( pSaveListPosition < 0 ) | |
3490 pSaveListPosition = 0; | |
3491 pWindow = pGUIWindow_CurrentMenu; | |
962 | 3492 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_PressedButton2, (int)pBtnArrowUp, 0); |
960 | 3493 break; |
3494 case UIMSG_AD: | |
962 | 3495 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); |
961 | 3496 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
960 | 3497 break; |
3498 case UIMSG_AE: | |
962 | 3499 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); |
165 | 3500 SetCurrentMenuID(MENU_10); |
960 | 3501 break; |
3502 case UIMSG_Escape: | |
0 | 3503 if ( ptr_507BDC ) |
3504 { | |
3505 sub_41426F(); | |
960 | 3506 break; |
0 | 3507 } |
3508 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) ) | |
960 | 3509 break; |
0 | 3510 v15 = 1; |
3511 pVideoPlayer->bStopBeforeSchedule = 1; | |
3512 viewparams->bRedrawGameUI = 1; | |
3513 viewparams->field_48 = 1; | |
165 | 3514 if ( !GetCurrentMenuID() || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC ) |
3515 { | |
3516 if ( pCurrentScreen == SCREEN_VIDEO ) | |
3517 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
3518 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
3519 { | |
3520 SetCurrentMenuID(MENU_CREATEPARTY); | |
960 | 3521 break; |
0 | 3522 } |
165 | 3523 if (GetCurrentMenuID() == MENU_CREDITSPROC) |
3524 { | |
3525 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
960 | 3526 break; |
0 | 3527 } |
437 | 3528 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); |
960 | 3529 break; |
0 | 3530 } |
971 | 3531 if ( GetCurrentMenuID() == MENU_CREDITSPROC && !pCurrentScreen ) |
3532 { | |
3533 if ( pCurrentScreen == SCREEN_VIDEO ) | |
3534 pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
3535 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
3536 { | |
3537 SetCurrentMenuID(MENU_CREATEPARTY); | |
3538 break; | |
3539 } | |
3540 if (GetCurrentMenuID() == MENU_CREDITSPROC) | |
3541 { | |
3542 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
3543 break; | |
3544 } | |
3545 pMessageQueue_50CBD0->AddMessage(UIMSG_ChangeGameState, 0, 0); | |
3546 break; | |
3547 } | |
151 | 3548 if ( pCurrentScreen == SCREEN_LOADGAME ) |
0 | 3549 { |
3550 pIcons_LOD->_4114F2(); | |
3551 //crt_deconstruct_ptr_6A0118(); | |
3552 pTexture_PCX.Release(); | |
3553 pTexture_PCX.Load("title.pcx", 0); | |
3554 SetCurrentMenuID(MENU_MAIN); | |
3555 v15 = 1; | |
3556 pGUIWindow_CurrentMenu->Release(); | |
3557 pGUIWindow2->Release(); | |
3558 pGUIWindow2 = 0; | |
3559 pEventTimer->Resume(); | |
151 | 3560 pCurrentScreen = SCREEN_GAME; |
0 | 3561 viewparams->bRedrawGameUI = v15; |
960 | 3562 break; |
0 | 3563 } |
151 | 3564 if ( pCurrentScreen == SCREEN_VIDEO ) |
0 | 3565 { |
3566 pVideoPlayer->Unload(); | |
3567 } | |
3568 else | |
3569 { | |
151 | 3570 if ( pCurrentScreen != SCREEN_1B ) |
2 | 3571 { |
3572 pGUIWindow_CurrentMenu->Release(); | |
3573 pGUIWindow2->Release(); | |
3574 pGUIWindow2 = 0; | |
3575 pEventTimer->Resume(); | |
151 | 3576 pCurrentScreen = SCREEN_GAME; |
2 | 3577 viewparams->bRedrawGameUI = v15; |
960 | 3578 break; |
2 | 3579 } |
0 | 3580 //VideoPlayer::dtor(); |
3581 } | |
960 | 3582 break; |
3583 case UIMSG_PlayerCreationRemoveDownSkill: | |
971 | 3584 uPlayerCreationUI_SelectedCharacter = pParam; |
165 | 3585 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 |
971 | 3586 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
165 | 3587 pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3) |
0 | 3588 + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; |
960 | 3589 break; |
3590 default: | |
3591 break; | |
0 | 3592 } |
3593 } | |
3594 while ( pMessageQueue_50CBD0->uNumMessages ); | |
3595 } | |
3596 } | |
3597 | |
3598 //----- (00436427) -------------------------------------------------------- | |
3599 double __cdecl get_shading_dist_mist() | |
3600 { | |
3601 double result; // st7@2 | |
3602 | |
3603 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3604 result = (double)pOutdoorCamera->shading_dist_mist; | |
3605 else | |
3606 result = 16192.0; | |
3607 return result; | |
3608 } | |
3609 | |
3610 //----- (0043648F) -------------------------------------------------------- | |
3611 void Vec3_short__to_RenderVertexSoft(RenderVertexSoft *_this, Vec3_short_ *a2) | |
3612 { | |
3613 _this->flt_2C = 0.0; | |
3614 | |
3615 _this->vWorldPosition.x = a2->x; | |
3616 _this->vWorldPosition.y = a2->y; | |
3617 _this->vWorldPosition.z = a2->z; | |
3618 } | |
3619 | |
3620 //----- (004369DB) -------------------------------------------------------- | |
3621 void Vec3_float_::Normalize() | |
3622 { | |
1025 | 3623 this->x = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->x; |
3624 this->y = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->y; | |
3625 this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z; | |
0 | 3626 } |
3627 | |
3628 //----- (004385B5) -------------------------------------------------------- | |
3629 void stru11::CheckCPU() | |
3630 { | |
3631 LOG_DECOMPILATION_WARNING(); | |
3632 /* | |
3633 int v5; // [sp-4h] [bp-10h]@0 | |
3634 signed int v6; // [sp+4h] [bp-8h]@1 | |
3635 signed int v7; // [sp+8h] [bp-4h]@1 | |
3636 | |
3637 _CF = 0; | |
3638 _OF = 0; | |
3639 _ZF = 1; | |
3640 _SF = 0; | |
3641 v7 = 0; | |
3642 __asm { pushf } | |
3643 v6 = 3; | |
3644 if ( v5 != (v5 ^ 0x40000) ) | |
3645 { | |
3646 __asm { popf } | |
3647 v6 = 4; | |
3648 __asm { pushf } | |
3649 if ( v5 != (v5 ^ 0x200000) ) | |
3650 { | |
3651 v7 = 1; | |
3652 v6 = 0; | |
3653 } | |
3654 } | |
3655 if ( v6 == 3 ) | |
3656 { | |
3657 this->field_AC = 1; | |
3658 } | |
3659 else | |
3660 { | |
3661 if ( v6 == 4 ) | |
3662 { | |
3663 this->field_AC = 2; | |
3664 } | |
3665 else | |
3666 { | |
3667 if ( v7 ) | |
3668 { | |
3669 this->field_AC = 2; | |
3670 RunCPUID(); | |
3671 } | |
3672 else | |
3673 { | |
3674 this->field_AC = 0; | |
3675 } | |
3676 } | |
3677 }*/ | |
3678 } | |
3679 | |
3680 //----- (00438659) -------------------------------------------------------- | |
3681 void stru11::RunCPUID() | |
3682 { | |
3683 __debugbreak(); | |
3684 /*stru11 *v6; // esi@1 | |
3685 unsigned int uNumOps; // edi@1 | |
3686 int uNumExtOps; // edi@16 | |
3687 char pCyrixString[16]; // [sp+Ch] [bp-60h]@1 | |
3688 char pCentaurString[16]; // [sp+1Ch] [bp-50h]@1 | |
3689 char pAMDString[16]; // [sp+2Ch] [bp-40h]@1 | |
3690 char pIntelString[16]; // [sp+3Ch] [bp-30h]@1 | |
3691 char pCPUString[16]; // [sp+4Ch] [bp-20h]@1 | |
3692 stru11 *thisa; // [sp+5Ch] [bp-10h]@1 | |
3693 char *v35; // [sp+60h] [bp-Ch]@1 | |
3694 int v36; // [sp+64h] [bp-8h]@1 | |
3695 int v37; // [sp+68h] [bp-4h]@1 | |
3696 | |
3697 thisa = this; | |
3698 *(int *)pIntelString = *(int *)"GenuineIntel"; | |
3699 *(int *)&pIntelString[4] = *(int *)"ineIntel"; | |
3700 *(int *)&pIntelString[8] = *(int *)"ntel"; | |
3701 pIntelString[12] = aGenuineintel[12]; | |
3702 *(int *)pAMDString = *(int *)"AuthenticAMD"; | |
3703 *(int *)&pAMDString[4] = *(int *)"enticAMD"; | |
3704 *(int *)&pAMDString[8] = *(int *)"cAMD"; | |
3705 pAMDString[12] = aAuthenticamd[12]; | |
3706 *(int *)pCyrixString = *(int *)"CyrixInstead"; | |
3707 *(int *)&pCyrixString[4] = *(int *)"xInstead"; | |
3708 *(int *)&pCyrixString[8] = *(int *)"tead"; | |
3709 pCyrixString[12] = aCyrixinstead[12]; | |
3710 *(int *)pCentaurString = *(int *)"CentaurHauls"; | |
3711 *(int *)&pCentaurString[4] = *(int *)"aurHauls"; | |
3712 *(int *)&pCentaurString[8] = *(int *)"auls"; | |
3713 v37 = 0; | |
3714 v36 = 0; | |
3715 pCentaurString[12] = aCentaurhauls[12]; | |
3716 v35 = pCPUString; | |
3717 pCPUString[12] = 0; | |
3718 _EAX = 0; | |
3719 __asm { cpuid } | |
3720 v37 = _EAX; | |
3721 *(int *)pCPUString = _EBX; | |
3722 *(int *)&pCPUString[4] = _EDX; | |
3723 *(int *)&pCPUString[8] = _ECX; | |
3724 v6 = thisa; | |
3725 uNumOps = _EAX; | |
3726 thisa->cpuid_00000000_ebx_vendorstr1 = _EBX; | |
3727 v6->cpuid_00000000_edx_vendorstr2 = *(int *)&pCPUString[4]; | |
3728 v6->cpuid_00000000_ecx_vendorstr3 = *(int *)&pCPUString[8]; | |
3729 v6->cpuid_00000000_eax_numops = _EAX; | |
3730 strcpy(v6->pCPUString, pCPUString); | |
3731 if ( strcmp(pIntelString, pCPUString) ) | |
3732 { | |
3733 if ( strcmp(pAMDString, pCPUString) ) | |
3734 { | |
3735 if ( strcmp(pCyrixString, pCPUString) ) | |
3736 { | |
3737 if ( strcmp(pCentaurString, pCPUString) ) | |
3738 v6->uProcessorManufacturer = 0; | |
3739 else | |
3740 v6->uProcessorManufacturer = 4; | |
3741 } | |
3742 else | |
3743 { | |
3744 v6->uProcessorManufacturer = 3; | |
3745 } | |
3746 } | |
3747 else | |
3748 { | |
3749 v6->uProcessorManufacturer = 2; | |
3750 } | |
3751 } | |
3752 else | |
3753 { | |
3754 v6->uProcessorManufacturer = 1; | |
3755 } | |
3756 if ( uNumOps >= 1 ) | |
3757 RunCPUID_op1(); | |
3758 if ( uNumOps >= 2 ) | |
3759 RunCPUID_op2(); | |
3760 _EAX = 0x80000000u; | |
3761 __asm { cpuid } | |
3762 if ( !(_EAX & 0x80000000) ) | |
3763 _EAX = 0x80000000u; | |
3764 v36 = _EAX; | |
3765 v6->cpuid_80000000_edx = _EAX; | |
3766 uNumExtOps = _EAX ^ 0x80000000; | |
3767 if ( (_EAX ^ 0x80000000u) >= 1 ) | |
3768 { | |
3769 _EAX = 0x80000001u; | |
3770 __asm { cpuid } | |
3771 thisa = (stru11 *)_EAX; | |
3772 v35 = (char *)_EDX; | |
3773 v6->cpuid_80000001_eax = _EAX; | |
3774 v6->cpuid_80000001_edx = (int)v35; | |
3775 } | |
3776 if ( (unsigned int)uNumExtOps >= 4 ) | |
3777 RunCPUID_ext2_3_4(); | |
3778 if ( (unsigned int)uNumExtOps >= 5 ) | |
3779 { | |
3780 _EAX = 0x80000005u; | |
3781 __asm { cpuid } | |
3782 thisa = (stru11 *)_EBX; | |
3783 v35 = (char *)_ECX; | |
3784 v36 = _EDX; | |
3785 v6->cpuid_80000005_ebx = _EBX; | |
3786 v6->cpuid_80000005_ecx = (int)v35; | |
3787 v6->cpuid_80000005_edx = v36; | |
3788 } | |
3789 if ( (unsigned int)uNumExtOps >= 6 ) | |
3790 { | |
3791 _EAX = 0x80000006u; | |
3792 __asm { cpuid } | |
3793 v6->cpuid_80000006_ecx = _ECX; | |
3794 }*/ | |
3795 } | |
3796 | |
3797 //----- (00438821) -------------------------------------------------------- | |
3798 void stru11::RunCPUID_op1() | |
3799 { | |
3800 __debugbreak(); | |
3801 /*stru11 *v1; // esi@1 | |
3802 unsigned int v7; // ecx@1 | |
3803 int v8; // eax@3 | |
3804 int v9; // eax@10 | |
3805 signed int v10; // eax@11 | |
3806 int v11; // ecx@11 | |
3807 int v12; // eax@15 | |
3808 signed int v13; // eax@19 | |
3809 int v14; // ecx@19 | |
3810 signed int v15; // eax@25 | |
3811 int v16; // ecx@25 | |
3812 signed int v17; // eax@34 | |
3813 int v18; // ecx@34 | |
3814 | |
3815 v1 = this; | |
3816 _EAX = 1; | |
3817 __asm { cpuid } | |
3818 v7 = _EAX; | |
3819 v1->cpuid_00000001_edx = _EDX; | |
3820 v1->cpuid_00000001_eax = _EAX; | |
3821 if ( (_EAX & 0x3000) == 8192 ) | |
3822 { | |
3823 LOBYTE(v1->cpuid_80000002_registers2[0]) = 1; | |
3824 v7 = 0; | |
3825 } | |
3826 v8 = (v7 >> 8) & 0xF; | |
3827 switch ( v8 ) | |
3828 { | |
3829 case 4: | |
3830 v1->field_AC = 2; | |
3831 break; | |
3832 case 5: | |
3833 v1->field_AC = 15; | |
3834 break; | |
3835 case 6: | |
3836 v1->field_AC = 36; | |
3837 break; | |
3838 default: | |
3839 v1->field_AC = 49; | |
3840 break; | |
3841 } | |
3842 v9 = v1->uProcessorManufacturer; | |
3843 if ( v9 == 1 ) | |
3844 { | |
3845 v10 = 0; | |
3846 v11 = v7 & 0x3FF0; | |
3847 while ( v11 != dword_4E4948[2 * v10] ) | |
3848 { | |
3849 ++v10; | |
3850 if ( v10 >= 17 ) | |
3851 return; | |
3852 } | |
3853 v12 = dword_4E494C[2 * v10]; | |
3854 goto LABEL_39; | |
3855 } | |
3856 if ( v9 == 2 ) | |
3857 { | |
3858 if ( (v7 & 0xF00) == dword_4E49D0[0] ) | |
3859 { | |
3860 v12 = dword_4E49D4[0]; | |
3861 } | |
3862 else | |
3863 { | |
3864 v13 = 1; | |
3865 v14 = v7 & 0x3FF0; | |
3866 while ( v14 != dword_4E49D0[2 * v13] ) | |
3867 { | |
3868 ++v13; | |
3869 if ( v13 >= 9 ) | |
3870 return; | |
3871 } | |
3872 v12 = dword_4E49D4[2 * v13]; | |
3873 } | |
3874 goto LABEL_39; | |
3875 } | |
3876 if ( v9 != 3 ) | |
3877 { | |
3878 if ( v9 != 4 ) | |
3879 return; | |
3880 v17 = 0; | |
3881 v18 = v7 & 0x3FF0; | |
3882 while ( v18 != dword_4E4A40[2 * v17] ) | |
3883 { | |
3884 ++v17; | |
3885 if ( v17 >= 2 ) | |
3886 return; | |
3887 } | |
3888 v12 = dword_4E4A44[2 * v17]; | |
3889 goto LABEL_39; | |
3890 } | |
3891 v15 = 1; | |
3892 v16 = v7 & 0x3FF0; | |
3893 while ( v16 != dword_4E4A18[2 * v15] ) | |
3894 { | |
3895 ++v15; | |
3896 if ( v15 >= 5 ) | |
3897 goto LABEL_30; | |
3898 } | |
3899 v1->field_AC = dword_4E4A1C[2 * v15]; | |
3900 LABEL_30: | |
3901 v12 = 24; | |
3902 if ( v1->field_AC == 24 ) | |
3903 { | |
3904 if ( _EDX != 1 ) | |
3905 v12 = (((_EDX != 261) - 1) & 0xA) + 15; | |
3906 LABEL_39: | |
3907 v1->field_AC = v12; | |
3908 }*/ | |
3909 } | |
3910 | |
3911 //----- (00438992) -------------------------------------------------------- | |
3912 void stru11::RunCPUID_op2() | |
3913 { | |
3914 __debugbreak(); | |
3915 /* | |
3916 stru11 *v1; // edi@1 | |
3917 int v7; // eax@1 | |
3918 signed int v8; // ecx@2 | |
3919 unsigned __int8 v9; // al@3 | |
3920 signed int v10; // ecx@14 | |
3921 unsigned __int8 v11; // al@15 | |
3922 int v12; // [sp+Ch] [bp-14h]@1 | |
3923 int v13; // [sp+10h] [bp-10h]@1 | |
3924 int v14; // [sp+14h] [bp-Ch]@1 | |
3925 int v15; // [sp+18h] [bp-8h]@1 | |
3926 int *v16; // [sp+1Ch] [bp-4h]@1 | |
3927 | |
3928 v1 = this; | |
3929 v16 = &v12; | |
3930 _EAX = 2; | |
3931 __asm { cpuid } | |
3932 v12 = _EAX; | |
3933 v13 = _EBX; | |
3934 v14 = _ECX; | |
3935 v15 = _EDX; | |
3936 v1->cpuid_00000002_eax = _EAX; | |
3937 v1->cpuid_00000002_ebx = v13; | |
3938 v1->cpuid_00000002_ecx = v14; | |
3939 v1->cpuid_00000002_edx = v15; | |
3940 v7 = v1->field_AC; | |
3941 if ( v7 == 40 ) | |
3942 { | |
3943 v8 = 0; | |
3944 while ( 1 ) | |
3945 { | |
3946 v9 = *((char *)&v12 + v8); | |
3947 if ( v9 == 64 ) | |
3948 { | |
3949 v1->field_AC = 43; | |
3950 return; | |
3951 } | |
3952 if ( v9 >= 0x41u && v9 <= 0x43u ) | |
3953 { | |
3954 v1->field_AC = 41; | |
3955 return; | |
3956 } | |
3957 if ( v9 >= 0x44u && v9 <= 0x45u ) | |
3958 break; | |
3959 ++v8; | |
3960 if ( v8 >= 16 ) | |
3961 return; | |
3962 } | |
3963 v1->field_AC = 42; | |
3964 } | |
3965 else | |
3966 { | |
3967 if ( v7 == 45 ) | |
3968 { | |
3969 v10 = 0; | |
3970 while ( 1 ) | |
3971 { | |
3972 v11 = *((char *)&v12 + v10); | |
3973 if ( v11 >= 0x40u && v11 <= 0x43u ) | |
3974 { | |
3975 v1->field_AC = 46; | |
3976 return; | |
3977 } | |
3978 if ( v11 >= 0x44u && v11 <= 0x45u ) | |
3979 break; | |
3980 ++v10; | |
3981 if ( v10 >= 16 ) | |
3982 return; | |
3983 } | |
3984 v1->field_AC = 47; | |
3985 } | |
3986 }*/ | |
3987 } | |
3988 | |
3989 //----- (00438A67) -------------------------------------------------------- | |
3990 void stru11::RunCPUID_ext2_3_4() | |
3991 { | |
3992 __debugbreak(); | |
3993 /*stru11 *v1; // edi@1 | |
3994 stru11 *v17; // eax@1 | |
3995 int v18[3][4]; // [sp+Ch] [bp-38h]@1 | |
3996 stru11 *v19; // [sp+3Ch] [bp-8h]@1 | |
3997 | |
3998 v1 = this; | |
3999 v19 = this; | |
4000 _EAX = 0x80000002u; | |
4001 __asm { cpuid } | |
4002 v18[0][0] = _EAX; | |
4003 *(_QWORD *)&v18[0][1] = __PAIR__(_ECX, _EBX); | |
4004 v18[0][3] = _EDX; | |
4005 _EAX = 0x80000003u; | |
4006 __asm { cpuid } | |
4007 v18[1][0] = _EAX; | |
4008 *(_QWORD *)&v18[1][1] = __PAIR__(_ECX, _EBX); | |
4009 v18[1][3] = _EDX; | |
4010 _EAX = 0x80000004u; | |
4011 __asm { cpuid } | |
4012 v18[2][0] = _EAX; | |
4013 *(_QWORD *)&v18[2][1] = __PAIR__(_ECX, _EBX); | |
4014 v18[2][3] = _EDX; | |
4015 v17 = v19; | |
4016 memcpy(v1->cpuid_80000002_registers, v18, 0x30u); | |
4017 memcpy((char *)&v17->cpuid_80000002_registers2[0] + 1, v18, 0x30u);*/ | |
4018 } | |
4019 | |
4020 //----- (00438BDF) -------------------------------------------------------- | |
4021 bool MonsterStats::BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype) | |
4022 { | |
4023 unsigned __int8 v2; // zf@15 | |
4024 char v3; // sf@15 | |
4025 unsigned __int8 v4; // of@15 | |
4026 bool result; // eax@33 | |
4027 | |
4028 switch ( eSupertype ) | |
4029 { | |
4030 case MONSTER_SUPERTYPE_UNDEAD: | |
4031 if ( (signed int)uMonsterInfoID >= MONSTER_GHOST_1 && (signed int)uMonsterInfoID <= MONSTER_GHOST_3 | |
4032 || (signed int)uMonsterInfoID >= MONSTER_LICH_1 && (signed int)uMonsterInfoID <= MONSTER_LICH_3 | |
4033 || (signed int)uMonsterInfoID >= MONSTER_SKELETON_1 && (signed int)uMonsterInfoID <= MONSTER_SKELETON_3 | |
4034 || (signed int)uMonsterInfoID >= MONSTER_VAMPIRE_1 && (signed int)uMonsterInfoID <= MONSTER_VAMPIRE_3 | |
4035 || (signed int)uMonsterInfoID >= MONSTER_WIGHT_1 && (signed int)uMonsterInfoID <= MONSTER_WIGHT_3 | |
4036 || (signed int)uMonsterInfoID >= MONSTER_ZOMBIE_1 && (signed int)uMonsterInfoID <= MONSTER_ZOMBIE_3 ) | |
4037 goto ret_true; | |
4038 if ( (signed int)uMonsterInfoID < MONSTER_GHOUL_1 ) | |
4039 goto ret_false; | |
4040 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_GHOUL_3); | |
4041 v2 = uMonsterInfoID == MONSTER_GHOUL_3; | |
4042 v3 = ((uMonsterInfoID - MONSTER_GHOUL_3) & 0x80000000u) != 0; | |
4043 goto false_if_outside; | |
4044 case MONSTER_SUPERTYPE_KREEGAN: | |
4045 if ( (signed int)uMonsterInfoID < MONSTER_DEVIL_1 ) | |
4046 goto ret_false; | |
4047 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DEVIL_3); | |
4048 v2 = uMonsterInfoID == MONSTER_DEVIL_3; | |
4049 v3 = ((uMonsterInfoID - MONSTER_DEVIL_3) & 0x80000000u) != 0; | |
4050 goto false_if_outside; | |
4051 case MONSTER_SUPERTYPE_ELF: | |
4052 if ( (signed int)uMonsterInfoID >= MONSTER_PEASANT_ELF_FEMALE_1_1 | |
4053 && (signed int)uMonsterInfoID <= MONSTER_PEASANT_ELF_MALE_3_3 | |
4054 || (signed int)uMonsterInfoID >= MONSTER_ELF_ARCHER_1 && (signed int)uMonsterInfoID <= MONSTER_ELF_ARCHER_3 ) | |
4055 goto ret_true; | |
4056 if ( (signed int)uMonsterInfoID < MONSTER_ELF_SPEARMAN_1 ) | |
4057 goto ret_false; | |
4058 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELF_SPEARMAN_3); | |
4059 v2 = uMonsterInfoID == MONSTER_ELF_SPEARMAN_3; | |
4060 v3 = ((uMonsterInfoID - MONSTER_ELF_SPEARMAN_3) & 0x80000000u) != 0; | |
4061 goto false_if_outside; | |
4062 case MONSTER_SUPERTYPE_DRAGON: | |
4063 if ( (signed int)uMonsterInfoID < MONSTER_DRAGON_1 ) | |
4064 goto ret_false; | |
4065 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_DRAGON_3); | |
4066 v2 = uMonsterInfoID == MONSTER_DRAGON_3; | |
4067 v3 = ((uMonsterInfoID - MONSTER_DRAGON_3) & 0x80000000u) != 0; | |
4068 goto false_if_outside; | |
4069 case MONSTER_SUPERTYPE_WATER_ELEMENTAL: | |
4070 if ( (signed int)uMonsterInfoID < MONSTER_ELEMENTAL_WATER_1 ) | |
4071 goto ret_false; | |
4072 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_ELEMENTAL_WATER_3); | |
4073 v2 = uMonsterInfoID == MONSTER_ELEMENTAL_WATER_3; | |
4074 v3 = ((uMonsterInfoID - MONSTER_ELEMENTAL_WATER_3) & 0x80000000u) != 0; | |
4075 goto false_if_outside; | |
4076 case MONSTER_SUPERTYPE_TREANT: | |
4077 if ( (signed int)uMonsterInfoID < MONSTER_TREANT_1 ) | |
4078 goto ret_false; | |
4079 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TREANT_3); | |
4080 v2 = uMonsterInfoID == MONSTER_TREANT_3; | |
4081 v3 = ((uMonsterInfoID - MONSTER_TREANT_3) & 0x80000000u) != 0; | |
4082 goto false_if_outside; | |
4083 case MONSTER_SUPERTYPE_TITAN: | |
4084 if ( (signed int)uMonsterInfoID < MONSTER_TITAN_1 ) | |
4085 goto ret_false; | |
4086 v4 = __OFSUB__(uMonsterInfoID, (int)MONSTER_TITAN_3); | |
4087 v2 = uMonsterInfoID == MONSTER_TITAN_3; | |
4088 v3 = ((uMonsterInfoID - MONSTER_TITAN_3) & 0x80000000u) != 0; | |
4089 false_if_outside: | |
4090 if ( !((unsigned __int8)(v3 ^ v4) | v2) ) | |
4091 goto ret_false; | |
4092 ret_true: | |
4093 result = 1; | |
4094 break; | |
4095 default: | |
4096 ret_false: | |
4097 result = 0; | |
4098 break; | |
4099 } | |
4100 return result; | |
4101 } | |
4102 | |
4103 //----- (00438F8F) -------------------------------------------------------- | |
783 | 4104 void __cdecl area_of_effect__damage_evaluate() |
0 | 4105 { |
4106 int v0; // edx@1 | |
4107 char *v1; // esi@2 | |
4108 int v2; // ecx@3 | |
4109 signed int v3; // eax@3 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4110 SpriteObject *v4; // eax@4 |
0 | 4111 signed int v5; // eax@4 |
4112 signed int v6; // eax@6 | |
4113 unsigned int v7; // edi@6 | |
4114 int v8; // eax@6 | |
4115 __int16 v9; // bx@8 | |
4116 int v10; // edi@8 | |
4117 Vec3_int_ v11; // ST04_12@9 | |
4118 int v12; // ST0C_4@10 | |
4119 Actor *v13; // edi@11 | |
4120 int v14; // edx@15 | |
4121 int v15; // edx@15 | |
4122 int v16; // ebx@15 | |
4123 signed int v17; // eax@15 | |
4124 int v18; // edi@15 | |
4125 int v19; // edi@15 | |
4126 Vec3_int_ v20; // ST04_12@16 | |
4127 Vec3_int_ *v21; // eax@17 | |
4128 unsigned int v22; // edx@17 | |
4129 int v23; // edx@18 | |
4130 int v24; // eax@18 | |
4131 Vec3_int_ v25; // ST04_12@19 | |
4132 unsigned int v26; // ebx@20 | |
89 | 4133 Player *v27; // edi@20 |
90 | 4134 Actor *v28; // edi@27 |
0 | 4135 int v29; // ebx@29 |
4136 int v30; // eax@29 | |
4137 int v31; // edx@29 | |
4138 int v32; // eax@29 | |
4139 int v33; // ST24_4@29 | |
4140 Vec3_int_ v34; // ST04_12@30 | |
4141 Vec3_int_ *v35; // eax@31 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4142 SpriteObject *v36; // [sp+0h] [bp-28h]@0 |
0 | 4143 signed int v37; // [sp+4h] [bp-24h]@5 |
4144 int v38; // [sp+4h] [bp-24h]@15 | |
4145 signed int v39; // [sp+8h] [bp-20h]@3 | |
4146 int v40; // [sp+8h] [bp-20h]@15 | |
4147 int v41; // [sp+Ch] [bp-1Ch]@5 | |
4148 int v42; // [sp+Ch] [bp-1Ch]@15 | |
4149 int v43; // [sp+10h] [bp-18h]@1 | |
4150 int v44; // [sp+14h] [bp-14h]@15 | |
4151 unsigned int uActorID; // [sp+18h] [bp-10h]@6 | |
4152 Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 | |
4153 int a1; // [sp+20h] [bp-8h]@8 | |
4154 int v48; // [sp+24h] [bp-4h]@8 | |
4155 | |
4156 v0 = 0; | |
4157 v43 = 0; | |
4158 if ( stru_50FE08.count > 0 ) | |
4159 { | |
4160 pVelocity = &stru_50FE08.vec_4B4; | |
4161 v1 = (char *)stru_50FE08.pZs; | |
4162 do | |
4163 { | |
848 | 4164 v2 = PID_TYPE(*((short *)v1 - 300)); |
4165 v3 = PID_ID((signed int)*((short *)v1 - 300)); | |
4166 v39 = PID_ID((signed int)*((short *)v1 - 300)); | |
0 | 4167 if ( v2 == 2 ) |
4168 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4169 v4 = &pSpriteObjects[v3]; |
0 | 4170 v36 = v4; |
822 | 4171 v5 = v4->spell_caster_pid; |
848 | 4172 v2 = PID_TYPE(v5); |
4173 v3 = PID_ID(v5); | |
0 | 4174 } |
4175 v41 = v2; | |
4176 v37 = v3; | |
4177 if ( stru_50FE08.field_3EC[v0] & 1 ) | |
4178 { | |
417 | 4179 v6 = ai_near_actors_targets_pid[v3]; |
848 | 4180 v7 = PID_ID(v6); |
4181 v8 = PID_TYPE(v6) - 3; | |
0 | 4182 uActorID = v7; |
4183 if ( v8 ) | |
4184 { | |
4185 if ( v8 == 1 ) | |
4186 { | |
4187 v9 = *(short *)v1; | |
4188 v10 = pParty->vPosition.y - *((short *)v1 - 100); | |
4189 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
4190 v48 = v10; | |
4191 if ( a1 * a1 | |
4192 + v10 * v10 | |
4193 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) | |
4194 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
4195 { | |
4196 v11.z = *(short *)v1; | |
4197 v11.y = *((short *)v1 - 100); | |
4198 v11.x = *((short *)v1 - 200); | |
4199 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v11) ) | |
4200 { | |
4201 v12 = stru_50C198.which_player_would_attack(&pActors[v39]); | |
4202 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v12); | |
4203 } | |
4204 } | |
4205 } | |
4206 } | |
4207 else | |
4208 { | |
4209 v13 = &pActors[v7]; | |
4210 if ( SHIDWORD(v13->pActorBuffs[6].uExpireTime) > 0 | |
4211 || SHIDWORD(v13->pActorBuffs[6].uExpireTime) >= 0 && LODWORD(v13->pActorBuffs[6].uExpireTime) | |
4212 || v13->CanAct() ) | |
4213 { | |
4214 v14 = v13->vPosition.y; | |
4215 v40 = v13->vPosition.x; | |
4216 v38 = v14; | |
4217 v15 = v14 - *((short *)v1 - 100); | |
4218 v16 = *(short *)v1; | |
4219 v42 = v13->vPosition.z; | |
4220 a1 = v40 - *((short *)v1 - 200); | |
4221 v17 = v13->uActorHeight; | |
4222 v18 = v13->uActorRadius; | |
4223 v44 = v42; | |
4224 v19 = *((short *)v1 + 100) + v18; | |
4225 v48 = v15; | |
4226 if ( a1 * a1 + v15 * v15 + (v42 + (v17 >> 1) - v16) * (v42 + (v17 >> 1) - v16) < (unsigned int)(v19 * v19) ) | |
4227 { | |
4228 v20.z = *(short *)v1; | |
4229 v20.y = *((short *)v1 - 100); | |
4230 v20.x = *((short *)v1 - 200); | |
4231 if ( sub_407A1C(v40, v38, v42 + 50, v20) ) | |
4232 { | |
4233 Vec3_int_::Normalize(&a1, &v48, &v44); | |
4234 v21 = pVelocity; | |
4235 v22 = uActorID; | |
4236 pVelocity->x = a1; | |
4237 v21->y = v48; | |
4238 v21->z = v44; | |
4239 sub_43B1B0(*((short *)v1 - 300), v22, v21, stru_50FE08.field_450[v43]); | |
4240 } | |
4241 } | |
4242 } | |
4243 } | |
4244 } | |
4245 else | |
4246 { | |
4247 v23 = pParty->vPosition.y - *((short *)v1 - 100); | |
4248 v24 = ((signed int)pParty->uPartyHeight >> 1) - *(short *)v1; | |
4249 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
4250 v48 = v23; | |
4251 if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
4252 { | |
4253 v25.z = *(short *)v1; | |
4254 v25.y = *((short *)v1 - 100); | |
4255 v25.x = *((short *)v1 - 200); | |
4256 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v25) ) | |
4257 { | |
4258 v26 = 0; | |
89 | 4259 v27 = pParty->pPlayers;//[0].pConditions[15]; |
0 | 4260 do |
4261 { | |
89 | 4262 if ( !(HIDWORD(v27->pConditions[14]) | LODWORD(v27->pConditions[14])) && !v27->pConditions[15] && !v27->pConditions[16] ) |
0 | 4263 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v26); |
89 | 4264 ++v27; |
0 | 4265 ++v26; |
4266 } | |
89 | 4267 while ( v27 <= &pParty->pPlayers[3] ); |
0 | 4268 } |
4269 } | |
4270 uActorID = 0; | |
4271 if ( (signed int)uNumActors > 0 ) | |
4272 { | |
90 | 4273 v28 = pActors;//[0].vPosition.z; |
0 | 4274 do |
4275 { | |
91 | 4276 if ( v28->CanAct() ) |
0 | 4277 { |
4278 v29 = *(short *)v1; | |
91 | 4279 v30 = v28->vPosition.y - *((short *)v1 - 100); |
4280 a1 = v28->vPosition.x - *((short *)v1 - 200); | |
90 | 4281 v31 = v28->vPosition.z; |
0 | 4282 v48 = v30; |
4283 v44 = v31; | |
90 | 4284 v32 = (v28->uActorHeight >> 1) - v29; |
91 | 4285 v33 = v28->uActorRadius + *((short *)v1 + 100); |
0 | 4286 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) |
4287 { | |
4288 v34.z = *(short *)v1; | |
4289 v34.y = *((short *)v1 - 100); | |
4290 v34.x = *((short *)v1 - 200); | |
90 | 4291 if ( sub_407A1C(v28->vPosition.x, v28->vPosition.y, v28->vPosition.z + 50, v34) ) |
0 | 4292 { |
4293 Vec3_int_::Normalize(&a1, &v48, &v44); | |
4294 v35 = pVelocity; | |
4295 pVelocity->x = a1; | |
4296 v35->y = v48; | |
4297 v35->z = v44; | |
4298 switch ( v41 ) | |
4299 { | |
303 | 4300 case OBJECT_Player: |
0 | 4301 DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); |
4302 break; | |
303 | 4303 case OBJECT_Actor: |
90 | 4304 if ( v36 && pActors[v37].GetActorsRelation(v28) ) |
0 | 4305 sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); |
4306 break; | |
303 | 4307 case OBJECT_Item: |
0 | 4308 sub_43B057(*((short *)v1 - 300), uActorID, v35); |
4309 break; | |
4310 } | |
4311 } | |
4312 } | |
4313 } | |
4314 ++uActorID; | |
90 | 4315 ++v28; |
0 | 4316 } |
4317 while ( (signed int)uActorID < (signed int)uNumActors ); | |
4318 } | |
4319 } | |
4320 ++pVelocity; | |
4321 v0 = v43 + 1; | |
4322 v1 += 2; | |
4323 ++v43; | |
4324 } | |
4325 while ( v43 < stru_50FE08.count ); | |
4326 } | |
4327 stru_50FE08.count = 0; | |
4328 } | |
4329 // 50FE08: using guessed type stru298 stru_50FE08; | |
4330 | |
4331 //----- (00439474) -------------------------------------------------------- | |
187 | 4332 void DamageMonsterFromParty(signed int a1, unsigned int uActorID_Monster, Vec3_int_ *pVelocity) |
0 | 4333 { |
303 | 4334 //signed int v3; // eax@1 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4335 SpriteObject *v4; // ebx@1 |
303 | 4336 //int v5; // edx@3 |
4337 //bool uPlayerID; // eax@3 | |
4338 //Player *pPlayer; // edi@4 | |
0 | 4339 Actor *pMonster; // esi@7 |
921 | 4340 //SpriteObject *v9; // ebx@12 |
0 | 4341 int v10; // eax@12 |
4342 int v11; // ebx@12 | |
4343 unsigned int v12; // ecx@12 | |
4344 int v13; // edx@15 | |
4345 int v14; // edx@17 | |
4346 int v15; // eax@24 | |
4347 unsigned __int16 v16; // cx@25 | |
4348 int v17; // eax@29 | |
4349 int v18; // eax@38 | |
4350 unsigned __int8 v19; // zf@38 | |
4351 unsigned __int8 v20; // sf@38 | |
4352 int v21; // edx@44 | |
4353 int v22; // eax@44 | |
4354 unsigned __int8 v23; // zf@44 | |
4355 unsigned __int8 v24; // sf@44 | |
4356 int v25; // edx@51 | |
4357 int v26; // ecx@51 | |
303 | 4358 //signed int v27; // eax@51 |
4359 //int v28; // eax@53 | |
0 | 4360 signed int v29; // eax@76 |
4361 signed int v30; // eax@84 | |
4362 signed int v31; // eax@92 | |
4363 int v32; // eax@94 | |
4364 int v33; // eax@100 | |
4365 int v34; // eax@104 | |
4366 signed int v35; // eax@104 | |
4367 double v36; // st7@104 | |
4368 float v37; // ST08_4@104 | |
4369 float v38; // ST04_4@104 | |
4370 float v39; // ST00_4@104 | |
4371 int v40; // ebx@107 | |
4372 unsigned int v41; // ebx@109 | |
4373 signed __int64 v42; // qax@125 | |
4374 unsigned __int16 v43; // ax@132 | |
4375 char v44; // bl@132 | |
4376 unsigned __int16 v45; // ax@132 | |
4377 unsigned __int64 v46; // [sp+Ch] [bp-60h]@6 | |
4378 const char *v47; // [sp+14h] [bp-58h]@104 | |
4379 char *pPlayerName; // [sp+18h] [bp-54h]@12 | |
4380 char *pMonsterName; // [sp+1Ch] [bp-50h]@6 | |
4381 int v50; // [sp+20h] [bp-4Ch]@6 | |
303 | 4382 //unsigned __int64 *v51; // [sp+30h] [bp-3Ch]@6 |
0 | 4383 int v52; // [sp+34h] [bp-38h]@12 |
303 | 4384 //int v53; // [sp+38h] [bp-34h]@10 |
4385 //int v54; // [sp+3Ch] [bp-30h]@1 | |
4386 //int v55; // [sp+40h] [bp-2Ch]@12 | |
0 | 4387 signed int a4; // [sp+44h] [bp-28h]@1 |
4388 PlayerEquipment *v57; // [sp+48h] [bp-24h]@10 | |
303 | 4389 //int v58; // [sp+4Ch] [bp-20h]@10 |
0 | 4390 int v59; // [sp+50h] [bp-1Ch]@1 |
4391 unsigned int uActorID_Monster_; // [sp+54h] [bp-18h]@1 | |
4392 int v61; // [sp+58h] [bp-14h]@1 | |
387 | 4393 bool v62; // [sp+5Ch] [bp-10h]@1 |
0 | 4394 int uDamageAmount; // [sp+60h] [bp-Ch]@1 |
4395 int a2; // [sp+64h] [bp-8h]@27 | |
4396 int a3; // [sp+6Bh] [bp-1h]@6 | |
4397 | |
303 | 4398 //v3 = a1; |
0 | 4399 v4 = 0; |
4400 uActorID_Monster_ = uActorID_Monster; | |
303 | 4401 //v54 = a1; |
0 | 4402 uDamageAmount = 0; |
4403 a4 = 0; | |
4404 v61 = 0; | |
4405 v59 = 0; | |
4406 v62 = 0; | |
848 | 4407 if ( PID_TYPE(a1) == OBJECT_Item) |
4408 { | |
4409 v4 = &pSpriteObjects[PID_ID(a1)]; | |
303 | 4410 //uDamageAmount = (int)v4; |
0 | 4411 v61 = v4->field_60_distance_related_prolly_lod; |
822 | 4412 a1 = v4->spell_caster_pid; |
303 | 4413 //v54 = v4->field_58_pid; |
4414 } | |
4415 //v5 = a1 & 7; | |
4416 //uPlayerID = a1 >> 3; | |
848 | 4417 if (PID_TYPE(a1) != OBJECT_Player) |
187 | 4418 return; |
303 | 4419 |
848 | 4420 assert(PID_ID(abs(a1)) < 4); |
4421 auto player = &pParty->pPlayers[PID_ID(a1)]; | |
0 | 4422 pMonster = &pActors[uActorID_Monster_]; |
303 | 4423 //uPlayerID = pMonster->IsAlive(); |
4424 if (pMonster->IsNotAlive()) | |
187 | 4425 return; |
303 | 4426 |
0 | 4427 BYTE1(pMonster->uAttributes) |= 0xC0u; |
4428 if ( pMonster->uAIState == Fleeing ) | |
4429 pMonster->uAttributes |= 0x20000u; | |
303 | 4430 //v57 = 0; |
4431 //v53 = 0; | |
4432 //v58 = 0; | |
4433 bool hit_will_stun = false, | |
4434 hit_will_paralyze = false; | |
0 | 4435 if ( !v4 ) |
4436 { | |
303 | 4437 //v51 = (unsigned __int64 *)player->pEquipment.uMainHand; |
4438 int main_hand_idx = player->pEquipment.uMainHand; | |
0 | 4439 v59 = 1; |
816 | 4440 if ( player->HasItemEquipped(EQUIP_MAIN_HAND) ) |
303 | 4441 { |
4442 auto main_hand_skill = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; | |
4443 //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; | |
4444 //v28 = SkillToMastery(player->pActiveSkills[v55]); | |
4445 auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]); | |
4446 //uDamageAmount = v28; | |
4447 switch (main_hand_skill) | |
4448 { | |
4449 case PLAYER_SKILL_STAFF: | |
4450 if (main_hand_mastery >= 3) | |
4451 { | |
4452 if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_STAFF) & 0x3F) // stun chance when mastery >= 3 | |
4453 hit_will_stun = true; | |
4454 } | |
4455 break; | |
4456 | |
4457 case PLAYER_SKILL_MACE: | |
4458 if (main_hand_mastery >= 3) | |
4459 { | |
4460 if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F) | |
4461 hit_will_stun = true; | |
4462 } | |
4463 if (main_hand_mastery >= 4) | |
4464 { | |
4465 if (rand() % 100 < player->GetActualSkillLevel(PLAYER_SKILL_MACE) & 0x3F) | |
4466 hit_will_paralyze = true; | |
4467 } | |
4468 break; | |
0 | 4469 } |
4470 } | |
4471 v50 = pMonster->pMonsterInfo.uID; | |
4472 a2 = 4; | |
303 | 4473 //v27 = player->CalculateMeleeDamageTo(0, 0, v50); |
4474 uDamageAmount = player->CalculateMeleeDamageTo(0, 0, v50); | |
4475 //if ( !v57 ) | |
4476 goto LABEL_67; | |
4477 //goto LABEL_69; | |
4478 } | |
4479 | |
4480 | |
822 | 4481 v19 = v4->spell_id == SPELL_DARK_SOULDRINKER; |
0 | 4482 v61 = v4->field_60_distance_related_prolly_lod; |
4483 if ( !v19 ) | |
4484 { | |
921 | 4485 //v9 = (SpriteObject *)uDamageAmount; |
4486 v50 = pParty->vPosition.x - v4->vPosition.x; | |
303 | 4487 //v55 = abs(v50); |
921 | 4488 pMonsterName = (char *)(pParty->vPosition.y - v4->vPosition.y); |
303 | 4489 //v51 = (unsigned __int64 *)abs((int)pMonsterName); |
921 | 4490 pPlayerName = (char *)(pParty->vPosition.z - v4->vPosition.z); |
0 | 4491 v52 = abs((int)pPlayerName); |
303 | 4492 v61 = abs(v50); |
4493 v10 = abs(v50); | |
4494 v11 = (int)abs((int)pMonsterName); | |
0 | 4495 v12 = v52; |
303 | 4496 if ( v10 < v11) |
4497 { | |
4498 v10 = (int)v11; | |
4499 v11 = v10; | |
0 | 4500 } |
4501 if ( v10 < v52 ) | |
4502 { | |
4503 v13 = v10; | |
4504 v10 = v52; | |
4505 v12 = v13; | |
4506 } | |
4507 if ( v11 < (signed int)v12 ) | |
4508 { | |
4509 v14 = v12; | |
4510 v12 = v11; | |
4511 v11 = v14; | |
4512 } | |
303 | 4513 //uPlayerID = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; |
4514 v61 = ((unsigned int)(11 * v11) >> 5) + (v12 >> 2) + v10; | |
4515 if ( v61 >= 2560 ) | |
0 | 4516 { |
4517 if ( v61 >= 5120 && !(BYTE1(pMonster->uAttributes) & 4) ) | |
187 | 4518 return; |
0 | 4519 v61 = 2; |
4520 } | |
4521 else | |
4522 { | |
4523 v61 = 1; | |
4524 } | |
921 | 4525 //v4 = (SpriteObject *)uDamageAmount; |
0 | 4526 } |
303 | 4527 |
822 | 4528 v15 = v4->spell_id; |
4529 if ( v15 == SPELL_LASER_PROJECTILE ) | |
0 | 4530 { |
303 | 4531 v16 = player->pActiveSkills[7]; |
0 | 4532 v61 = 1; |
4533 if ( (signed int)SkillToMastery(v16) >= 3 ) | |
303 | 4534 a4 = player->pActiveSkills[7] & 0x3F; |
0 | 4535 a2 = 4; |
303 | 4536 uDamageAmount = player->CalculateMeleeDamageTo(1, 1, 0); |
0 | 4537 goto LABEL_67; |
4538 } | |
822 | 4539 if ( v15 != SPELL_BOW_ARROW ) |
4540 { | |
4541 if ( v15 == SPELL_101 ) | |
0 | 4542 { |
4543 a2 = 0; | |
303 | 4544 v18 = player->CalculateRangedDamageTo(0); |
0 | 4545 v19 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; |
4546 v20 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; | |
4547 uDamageAmount = v18; | |
4548 if ( !v20 && (!(v20 | v19) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4549 uDamageAmount >>= 1; | |
4550 v59 = 1; | |
4551 goto LABEL_67; | |
4552 } | |
822 | 4553 if ( v15 == SPELL_EARTH_BLADES ) |
4554 { | |
4555 a4 = 5 * v4->spell_level; | |
303 | 4556 a2 = player->GetSpellSchool(0x27u); |
822 | 4557 v21 = v4->spell_level; |
0 | 4558 v50 = pMonster->sCurrentHP; |
822 | 4559 pMonsterName = (char *)v4->spell_skill; |
4560 v22 = _43AFE3_calc_spell_damage(39, v21, v4->spell_skill, v50); | |
0 | 4561 v23 = HIDWORD(pMonster->pActorBuffs[15].uExpireTime) == 0; |
4562 v24 = SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) < 0; | |
4563 uDamageAmount = v22; | |
4564 if ( !v24 && (!(v24 | v23) || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4565 uDamageAmount >>= 1; | |
4566 v59 = 0; | |
4567 LABEL_67: | |
303 | 4568 if ( !stru_50C198.PlayerHitOrMiss(player, pMonster, v61, a4) ) |
4569 { | |
4570 //LABEL_68: | |
4571 player->PlaySound(SPEECH_52, 0); | |
187 | 4572 return; |
0 | 4573 } |
4574 goto LABEL_69; | |
4575 } | |
822 | 4576 if ( v15 == SPELL_EARTH_STUN ) |
0 | 4577 { |
4578 uDamageAmount = 0; | |
4579 a2 = 4; | |
303 | 4580 hit_will_stun = 1; |
0 | 4581 goto LABEL_67; |
4582 } | |
822 | 4583 a2 = player->GetSpellSchool(v4->spell_id); |
4584 v25 = v4->spell_level; | |
4585 v26 = v4->spell_id; | |
0 | 4586 v50 = pMonster->sCurrentHP; |
822 | 4587 pMonsterName = (char *)v4->spell_skill; |
303 | 4588 //v27 = _43AFE3_calc_spell_damage(v26, v25, (signed int)pMonsterName, v50); |
0 | 4589 v59 = 0; |
303 | 4590 //v57 = (PlayerEquipment *)1; |
4591 //LABEL_65: | |
822 | 4592 uDamageAmount = _43AFE3_calc_spell_damage(v26, v25, v4->spell_skill, v50); |
303 | 4593 //if ( !v57 ) |
4594 // goto LABEL_67; | |
4595 goto LABEL_69; | |
0 | 4596 } |
4597 v50 = pMonster->word_000086_some_monster_id; | |
4598 a2 = 4; | |
303 | 4599 v17 = player->CalculateRangedDamageTo(v50); |
0 | 4600 v19 = v4->stru_24.uItemID == 0; |
4601 uDamageAmount = v17; | |
303 | 4602 v57 = 0; |
377 | 4603 if ( !v19 && v4->stru_24.uSpecEnchantmentType == 3 ) |
0 | 4604 { |
4605 a2 = 0; | |
4606 v57 = (PlayerEquipment *)1; | |
4607 } | |
4608 if ( SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) >= 0 | |
4609 && (SHIDWORD(pMonster->pActorBuffs[15].uExpireTime) > 0 || LODWORD(pMonster->pActorBuffs[15].uExpireTime)) ) | |
4610 uDamageAmount >>= 1; | |
4611 v59 = 1; | |
303 | 4612 //LABEL_66: |
0 | 4613 if ( !v57 ) |
4614 goto LABEL_67; | |
4615 LABEL_69: | |
303 | 4616 if (player->Weak()) |
4617 uDamageAmount /= 1; | |
0 | 4618 if ( (signed __int64)pMonster->pActorBuffs[5].uExpireTime > 0 ) |
4619 uDamageAmount = 0; | |
4620 v61 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, uDamageAmount); | |
303 | 4621 if ( !v4 && player->IsUnarmed() && (signed __int64)player->pPlayerBuffs[6].uExpireTime > 0 ) |
4622 { | |
4623 v50 = player->pPlayerBuffs[6].uPower; | |
0 | 4624 v29 = stru_50C198.CalcMagicalDamageToActor(pMonster, 8, v50); |
4625 v61 += v29; | |
4626 } | |
4627 uDamageAmount = v61; | |
4628 if ( v59 ) | |
4629 { | |
4630 if ( v4 ) | |
4631 { | |
4632 a4 = v4->stru_24._439DF3_get_additional_damage(&a2, &v62); | |
4633 if ( v62 && pMonster->sCurrentHP > 0 ) | |
4634 { | |
303 | 4635 player->sHealth += v61 / 5; |
4636 if ( player->sHealth > player->GetMaxHealth() ) | |
4637 player->sHealth = player->GetMaxHealth(); | |
0 | 4638 v62 = 0; |
4639 } | |
4640 v30 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); | |
4641 uDamageAmount = v61 + v30; | |
4642 } | |
4643 else | |
4644 { | |
4645 v59 = 0; | |
303 | 4646 v57 = &player->pEquipment; |
0 | 4647 do |
4648 { | |
303 | 4649 if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) |
4650 { | |
898 | 4651 auto _s = (ItemGen *)&player->pInventoryItems[v57->uShield - 1]; |
0 | 4652 a4 = _s->_439DF3_get_additional_damage(&a2, &v62); |
4653 if ( v62 && pMonster->sCurrentHP > 0 ) | |
4654 { | |
303 | 4655 player->sHealth += v61 / 5; |
4656 if ( player->sHealth > player->GetMaxHealth() ) | |
4657 player->sHealth = player->GetMaxHealth(); | |
0 | 4658 v62 = 0; |
4659 } | |
4660 v31 = stru_50C198.CalcMagicalDamageToActor(pMonster, a2, a4); | |
4661 uDamageAmount += v31; | |
4662 } | |
4663 ++v59; | |
4664 v57 = (PlayerEquipment *)((char *)v57 + 4); | |
4665 } | |
4666 while ( v59 <= 1 ); | |
4667 } | |
4668 } | |
4669 v32 = uDamageAmount; | |
4670 pMonster->sCurrentHP -= uDamageAmount; | |
303 | 4671 if ( !v32 && !hit_will_stun ) |
4672 { | |
4673 player->PlaySound(SPEECH_52, 0); | |
4674 return; | |
4675 } | |
0 | 4676 if ( pMonster->sCurrentHP > 0 ) |
4677 { | |
861 | 4678 Actor::Stun(uActorID_Monster_, a1, 0); |
322 | 4679 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); |
0 | 4680 if ( bShowDamage ) |
4681 { | |
4682 v50 = uDamageAmount; | |
4683 pMonsterName = (char *)pMonster; | |
303 | 4684 pPlayerName = player->pName; |
0 | 4685 if ( v4 ) |
4686 v47 = pGlobalTXT_LocalizationStrings[189];// "%s shoots %s for %lu points" | |
4687 else | |
4688 v47 = pGlobalTXT_LocalizationStrings[164];// "%s hits %s for %lu damage" | |
303 | 4689 sprintfex(pTmpBuf, v47, pPlayerName, pMonsterName, v50); |
0 | 4690 ShowStatusBarString(pTmpBuf, 2u); |
4691 } | |
4692 v41 = 0; | |
4693 } | |
4694 else | |
4695 { | |
4696 if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 ) | |
4697 { | |
4698 v33 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius; | |
303 | 4699 //v55 = v33; |
0 | 4700 if ( pRenderer->pRenderD3D ) |
4701 { | |
573 | 4702 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) |
0 | 4703 { |
4704 v50 = 0; | |
4705 pMonsterName = 0; | |
4706 v34 = pMonster->vPosition.z; | |
303 | 4707 *(float *)&pPlayerName = (double)v33; |
4708 //v51 = (unsigned __int64 *)v34; | |
0 | 4709 *(float *)&v47 = 0.0; |
4710 v35 = pMonster->vPosition.y; | |
4711 *((float *)&v46 + 1) = 0.0; | |
4712 *(float *)&v46 = 1.0; | |
303 | 4713 v36 = (double)(signed int)pMonster->vPosition.z; |
4714 //v51 = (unsigned __int64 *)v35; | |
0 | 4715 v37 = v36; |
303 | 4716 //v51 = (unsigned __int64 *)pMonster->vPosition.x; |
0 | 4717 v38 = (double)v35; |
303 | 4718 v39 = (double)(signed int)pMonster->vPosition.x; |
0 | 4719 pDecalBuilder->AddBloodsplat(v39, v38, v37, 1.0, 0.0, 0.0, *(float *)&pPlayerName, 0, 0); |
4720 } | |
4721 } | |
4722 } | |
4723 Actor::Die(uActorID_Monster_); | |
322 | 4724 Actor::ApplyFineForKillingPeasant(uActorID_Monster_); |
4725 Actor::AggroSurroundingPeasants(uActorID_Monster_, 1); | |
0 | 4726 if ( pMonster->pMonsterInfo.uExp ) |
792 | 4727 GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp); |
187 | 4728 v40 = SPEECH_51; |
0 | 4729 if ( rand() % 100 < 20 ) |
4730 v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1; | |
303 | 4731 player->PlaySound((PlayerSpeech)v40, 0); |
0 | 4732 v41 = 0; |
4733 if ( bShowDamage ) | |
4734 { | |
4735 v50 = (int)pMonster; | |
4736 pMonsterName = (char *)uDamageAmount; | |
303 | 4737 pPlayerName = player->pName; // "%s inflicts %lu points killing %s" |
809 | 4738 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[175], player->pName, uDamageAmount, pMonster); |
0 | 4739 ShowStatusBarString(pTmpBuf, 2u); |
4740 } | |
4741 } | |
4742 if ( SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) >= (signed int)v41 | |
4743 && (SHIDWORD(pMonster->pActorBuffs[20].uExpireTime) > (signed int)v41 | |
4744 || LODWORD(pMonster->pActorBuffs[20].uExpireTime) > v41) | |
4745 && uDamageAmount != v41 ) | |
303 | 4746 player->ReceiveDamage(uDamageAmount, a2); |
0 | 4747 v50 = 24; |
4748 v59 = 20 * v61 / (signed int)pMonster->pMonsterInfo.uHP; | |
303 | 4749 if ( (player->_48EA46_calc_special_bonus_by_items(24) || hit_will_stun != v41) |
0 | 4750 && stru_50C198.GetMagicalResistance(pMonster, 3u) ) |
4751 { | |
4752 LODWORD(v42) = 20; | |
4753 v59 = 10; | |
4754 if ( pParty->bTurnBasedModeOn == v41 ) | |
4755 v42 = (signed __int64)(flt_6BE3A8_debug_recmod2 * 42.66666666666666); | |
4756 pMonster->pMonsterInfo.uRecoveryTime += v42; | |
4757 if ( bShowDamage != v41 ) | |
4758 { | |
4759 v50 = (int)pMonster; | |
303 | 4760 pMonsterName = player->pName; // "%s stuns %s" |
4761 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[635], player->pName, pMonster); | |
0 | 4762 ShowStatusBarString(pTmpBuf, 2u); |
4763 } | |
4764 } | |
303 | 4765 if ( hit_will_paralyze != v41 ) |
0 | 4766 { |
4767 if ( pMonster->CanAct() ) | |
4768 { | |
303 | 4769 if ( stru_50C198.GetMagicalResistance(pMonster, 3) ) |
4770 { | |
4771 LOBYTE(v43) = player->GetActualSkillLevel(PLAYER_SKILL_MACE); | |
0 | 4772 v44 = v43; |
4773 v45 = SkillToMastery(v43); | |
303 | 4774 //v51 = (unsigned __int64 *)(7680 * (v44 & 0x3F)); |
4775 v46 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(7680 * (v44 & 0x3F)) * 0.033333335); | |
0 | 4776 pMonster->pActorBuffs[6].Apply(v46, v45, 0, 0, 0); |
4777 if ( bShowDamage ) | |
4778 { | |
4779 v50 = (int)pMonster; | |
303 | 4780 pMonsterName = player->pName; // "%s paralyzes %s" |
4781 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[636], player->pName, pMonster); | |
0 | 4782 ShowStatusBarString(pTmpBuf, 2u); |
4783 } | |
4784 } | |
4785 } | |
4786 } | |
4787 if ( v59 > 10 ) | |
4788 v59 = 10; | |
4789 if ( !MonsterStats::BelongsToSupertype(pMonster->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
4790 { | |
4791 pVelocity->x = (unsigned __int64)(v59 * (signed __int64)pVelocity->x) >> 16; | |
4792 pVelocity->y = (unsigned __int64)(v59 * (signed __int64)pVelocity->y) >> 16; | |
4793 pVelocity->z = (unsigned __int64)(v59 * (signed __int64)pVelocity->z) >> 16; | |
4794 pMonster->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
4795 pMonster->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
4796 pMonster->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
4797 } | |
187 | 4798 Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster_, 1, v61); |
0 | 4799 } |
4800 // 4D864C: using guessed type char byte_4D864C; | |
4801 | |
4802 //----- (00439FCB) -------------------------------------------------------- | |
4803 void __fastcall DamagePlayerFromMonster(unsigned int uObjID, int a2, Vec3_int_ *pPos, unsigned int a4) | |
4804 { | |
4805 signed int v4; // esi@1 | |
4806 unsigned int v5; // ecx@1 | |
4807 Player *v6; // ebx@3 | |
4808 Actor *v7; // esi@3 | |
4809 unsigned int v8; // eax@4 | |
4810 char *v9; // eax@5 | |
4811 signed int v10; // eax@6 | |
4812 int v11; // edx@8 | |
4813 int v12; // edx@9 | |
4814 int v13; // edx@10 | |
4815 int v14; // edx@16 | |
4816 int v15; // edx@17 | |
4817 int v16; // edx@18 | |
4818 enum SoundID v17; // eax@24 | |
4819 int v18; // eax@26 | |
4820 unsigned __int8 v19; // zf@26 | |
4821 unsigned __int8 v20; // sf@26 | |
4822 unsigned __int16 v21; // ax@29 | |
4823 signed int v22; // edi@36 | |
4824 int v23; // eax@38 | |
4825 signed int v24; // eax@44 | |
4826 unsigned __int16 v25; // cx@47 | |
4827 signed int v26; // eax@49 | |
4828 int v27; // eax@54 | |
4829 float v28; // ST18_4@58 | |
4830 double v29; // st7@58 | |
4831 float v30; // ST08_4@58 | |
4832 double v31; // st7@58 | |
4833 float v32; // ST04_4@58 | |
4834 float v33; // ST00_4@58 | |
4835 int v34; // edi@61 | |
4836 int v35; // eax@70 | |
4837 double v36; // st7@70 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
4838 SpriteObject *v37; // ebx@77 |
0 | 4839 int v38; // edi@77 |
4840 int v39; // esi@77 | |
4841 int v40; // eax@77 | |
4842 int v41; // eax@77 | |
4843 int v42; // eax@78 | |
42 | 4844 Player *v43; // eax@81 |
0 | 4845 Actor *v44; // esi@82 |
42 | 4846 Player *v45; // edi@84 |
0 | 4847 unsigned __int16 v46; // ax@84 |
4848 int v47; // ebx@105 | |
4849 int v48; // eax@107 | |
4850 unsigned __int16 v49; // ax@116 | |
4851 int v50; // ebx@123 | |
4852 unsigned __int16 v51; // ax@124 | |
4853 char v52; // bl@124 | |
4854 int v53; // eax@128 | |
4855 signed int v54; // eax@134 | |
4856 unsigned __int16 v55; // cx@137 | |
4857 signed int v56; // eax@139 | |
4858 int v57; // eax@144 | |
4859 float v58; // ST18_4@148 | |
4860 double v59; // st7@148 | |
4861 float v60; // ST08_4@148 | |
4862 double v61; // st7@148 | |
4863 float v62; // ST04_4@148 | |
4864 float v63; // ST00_4@148 | |
4865 int v64; // ebx@151 | |
4866 int v65; // eax@161 | |
4867 double v66; // st7@161 | |
4868 signed int v67; // ecx@164 | |
4869 signed int v68; // eax@170 | |
4870 int v69; // ecx@170 | |
4871 int v70; // eax@171 | |
4872 enum SoundID v71; // [sp+20h] [bp-34h]@12 | |
4873 int v72; // [sp+30h] [bp-24h]@164 | |
4874 double v73; // [sp+40h] [bp-14h]@72 | |
4875 signed int v74; // [sp+44h] [bp-10h]@1 | |
4876 unsigned int v75; // [sp+48h] [bp-Ch]@3 | |
4877 unsigned int uActorID; // [sp+4Ch] [bp-8h]@1 | |
4878 int v77; // [sp+50h] [bp-4h]@26 | |
4879 signed int a4a; // [sp+60h] [bp+Ch]@162 | |
4880 Player *a4b; // [sp+60h] [bp+Ch]@168 | |
4881 | |
848 | 4882 v4 = PID_ID(uObjID); |
4883 v5 = PID_TYPE(uObjID) - 2; | |
0 | 4884 v74 = a2; |
4885 uActorID = v4; | |
4886 if ( v5 ) | |
4887 { | |
4888 if ( v5 != 1 | |
4889 || (v6 = &pParty->pPlayers[a4], v7 = &pActors[v4], | |
4890 v75 = v6->sHealth, | |
4891 !stru_50C198.ActorHitOrMiss(v7, v6)) ) | |
4892 return; | |
898 | 4893 v8 = v6->pEquipment.uArmor; |
0 | 4894 if ( !v8 |
4895 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) | |
4896 || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) | |
4897 || v10 > 11 ) | |
4898 { | |
4899 v14 = rand() % 4; | |
4900 if ( !v14 ) | |
4901 { | |
4902 v71 = (SoundID)108; | |
4903 goto LABEL_24; | |
4904 } | |
4905 v15 = v14 - 1; | |
4906 if ( !v15 ) | |
4907 { | |
4908 v71 = (SoundID)109; | |
4909 goto LABEL_24; | |
4910 } | |
4911 v16 = v15 - 1; | |
4912 if ( !v16 ) | |
4913 { | |
4914 v71 = (SoundID)110; | |
4915 goto LABEL_24; | |
4916 } | |
4917 if ( v16 == 1 ) | |
4918 { | |
4919 v71 = (SoundID)44; | |
4920 goto LABEL_24; | |
4921 } | |
4922 } | |
4923 else | |
4924 { | |
4925 v11 = rand() % 4; | |
4926 if ( !v11 ) | |
4927 { | |
4928 v71 = (SoundID)105; | |
4929 goto LABEL_24; | |
4930 } | |
4931 v12 = v11 - 1; | |
4932 if ( !v12 ) | |
4933 { | |
4934 v71 = (SoundID)106; | |
4935 goto LABEL_24; | |
4936 } | |
4937 v13 = v12 - 1; | |
4938 if ( !v13 ) | |
4939 { | |
4940 v71 = (SoundID)107; | |
4941 goto LABEL_24; | |
4942 } | |
4943 if ( v13 == 1 ) | |
4944 { | |
4945 v71 = (SoundID)45; | |
4946 LABEL_24: | |
4947 v17 = v71; | |
4948 goto LABEL_26; | |
4949 } | |
4950 } | |
4951 v17 = (SoundID)a4; | |
4952 LABEL_26: | |
862 | 4953 pAudioPlayer->PlaySound(v17, PID(OBJECT_Player,a4 + 80), 0, -1, 0, 0, 0, 0); |
0 | 4954 v18 = Actor::_43B3E0_CalcDamage(v7, v74); |
4955 v19 = HIDWORD(v7->pActorBuffs[3].uExpireTime) == 0; | |
4956 v20 = SHIDWORD(v7->pActorBuffs[3].uExpireTime) < 0; | |
4957 v77 = v18; | |
4958 if ( !v20 && (!(v20 | v19) || LODWORD(v7->pActorBuffs[3].uExpireTime) > 0) ) | |
4959 { | |
4960 v21 = v7->pActorBuffs[3].uPower; | |
4961 if ( v21 ) | |
4962 v77 /= (signed int)v21; | |
4963 } | |
4964 if ( v74 ) | |
4965 { | |
4966 if ( v74 == 1 ) | |
4967 { | |
4968 v22 = v7->pMonsterInfo.uAttack2Type; | |
4969 } | |
4970 else | |
4971 { | |
4972 if ( v74 == 2 ) | |
4973 { | |
4974 v23 = v7->pMonsterInfo.uSpell1ID; | |
4975 } | |
4976 else | |
4977 { | |
4978 if ( v74 != 3 ) | |
4979 { | |
4980 if ( v74 == 4 ) | |
4981 v22 = v7->pMonsterInfo.field_3C_some_special_attack; | |
4982 else | |
4983 v22 = 4; | |
4984 goto LABEL_43; | |
4985 } | |
4986 v23 = v7->pMonsterInfo.uSpell2ID; | |
4987 } | |
4988 v22 = LOBYTE(pSpellStats->pInfos[v23].uSchool); | |
4989 } | |
4990 } | |
4991 else | |
4992 { | |
4993 v22 = v7->pMonsterInfo.uAttack1Type; | |
4994 } | |
4995 LABEL_43: | |
4996 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
4997 { | |
4998 v24 = v6->ReceiveDamage(v77, v22); | |
4999 if ( SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) >= 0 | |
5000 && (SHIDWORD(v6->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v6->pPlayerBuffs[10].uExpireTime)) ) | |
5001 { | |
5002 v25 = v7->uAIState; | |
5003 if ( v25 != 5 ) | |
5004 { | |
5005 if ( v25 != 4 ) | |
5006 { | |
5007 v26 = stru_50C198.CalcMagicalDamageToActor(v7, v22, v24); | |
5008 v7->sCurrentHP -= v26; | |
5009 if ( v26 ) | |
5010 { | |
5011 if ( v7->sCurrentHP >= 1 ) | |
5012 { | |
862 | 5013 Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); |
322 | 5014 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 5015 } |
5016 else | |
5017 { | |
5018 if ( pMonsterStats->pInfos[v7->pMonsterInfo.uID].bQuestMonster & 1 ) | |
5019 { | |
5020 v27 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v7->uActorRadius : v7->uActorRadius; | |
5021 v74 = v27; | |
5022 if ( pRenderer->pRenderD3D ) | |
5023 { | |
573 | 5024 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) |
0 | 5025 { |
5026 v28 = (double)v74; | |
5027 v74 = v7->vPosition.z; | |
5028 v29 = (double)v74; | |
5029 v74 = v7->vPosition.y; | |
5030 v30 = v29; | |
5031 v31 = (double)v74; | |
5032 v74 = v7->vPosition.x; | |
5033 v32 = v31; | |
5034 v33 = (double)v74; | |
5035 pDecalBuilder->AddBloodsplat(v33, v32, v30, 1.0, 0.0, 0.0, v28, 0, 0); | |
5036 } | |
5037 } | |
5038 } | |
5039 Actor::Die(uActorID); | |
322 | 5040 Actor::ApplyFineForKillingPeasant(uActorID); |
5041 Actor::AggroSurroundingPeasants(uActorID, 1); | |
0 | 5042 if ( v7->pMonsterInfo.uExp ) |
792 | 5043 GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp); |
187 | 5044 v34 = SPEECH_51; |
0 | 5045 if ( rand() % 100 < 20 ) |
5046 v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1; | |
187 | 5047 v6->PlaySound((PlayerSpeech)v34, 0); |
0 | 5048 } |
5049 } | |
5050 } | |
5051 } | |
5052 } | |
5053 if ( !(dword_6BE368_debug_settings_2 & 0x10) | |
5054 && v7->pMonsterInfo.uSpecialAttack | |
5055 && rand() % 100 < v7->pMonsterInfo.uLevel * v7->pMonsterInfo.uSpecialAttackType ) | |
5056 v6->_48DCF6(v7->pMonsterInfo.uSpecialAttack, v7); | |
5057 } | |
5058 if ( !pParty->bTurnBasedModeOn ) | |
5059 { | |
5060 v35 = v6->GetActualEndurance(); | |
5061 v36 = (double)(20 - v6->_48EA1B_get_static_effect(v35)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
5062 v6->SetRecoveryTime((signed __int64)v36); | |
5063 } | |
5064 if ( v77 ) | |
5065 { | |
5066 v73 = (double)(signed int)v75; | |
5067 if ( (double)v6->GetMaxHealth() * 0.25 < v73 ) | |
5068 { | |
5069 if ( v6->sHealth > 0 ) | |
5070 { | |
5071 if ( (double)v6->GetMaxHealth() * 0.25 >= (double)v6->sHealth ) | |
187 | 5072 v6->PlaySound(SPEECH_48, 0); |
0 | 5073 } |
5074 } | |
5075 } | |
5076 viewparams->bRedrawGameUI = 1; | |
5077 return; | |
5078 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5079 v37 = &pSpriteObjects[uActorID]; |
848 | 5080 v38 = PID_TYPE(v37->spell_caster_pid); |
5081 v39 = PID_ID(v37->spell_caster_pid); | |
5082 v40 = PID_TYPE(v37->spell_caster_pid); | |
5083 uActorID = PID_ID(v37->spell_caster_pid); | |
0 | 5084 v41 = v40 - 2; |
5085 if ( !v41 ) | |
5086 goto LABEL_80; | |
5087 v42 = v41 - 1; | |
5088 if ( !v42 ) | |
5089 { | |
5090 v44 = &pActors[v39]; | |
5091 if ( a4 == -1 ) | |
5092 a4 = stru_50C198.which_player_would_attack(v44); | |
42 | 5093 v45 = &pParty->pPlayers[a4]; |
0 | 5094 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
|
5095 v46 = v37->uType; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5096 if ( v37->uType == 545 ) |
0 | 5097 { |
42 | 5098 LOBYTE(v51) = v45->GetActualSkillLevel(PLAYER_SKILL_UNARMED); |
0 | 5099 v52 = v51; |
5100 if ( (signed int)SkillToMastery(v51) >= 4 && rand() % 100 < (v52 & 0x3F) ) | |
5101 { | |
42 | 5102 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[637], v45->pName); |
0 | 5103 ShowStatusBarString(pTmpBuf, 2u); |
187 | 5104 v45->PlaySound(SPEECH_6, 0); |
0 | 5105 return; |
5106 } | |
5107 } | |
5108 else | |
5109 { | |
5110 if ( v46 != 555 | |
5111 && v46 != 510 | |
5112 && v46 != 500 | |
5113 && v46 != 515 | |
5114 && v46 != 505 | |
5115 && v46 != 530 | |
5116 && v46 != 525 | |
5117 && v46 != 520 | |
5118 && v46 != 535 | |
5119 && v46 != 540 ) | |
5120 goto LABEL_115; | |
5121 } | |
42 | 5122 if ( !stru_50C198.ActorHitOrMiss(v44, v45) ) |
0 | 5123 return; |
42 | 5124 if ( (signed __int64)v45->pPlayerBuffs[13].uExpireTime > 0 ) |
0 | 5125 v77 >>= 1; |
42 | 5126 if ( v45->HasEnchantedItemEquipped(36) ) |
0 | 5127 v77 >>= 1; |
42 | 5128 if ( v45->HasEnchantedItemEquipped(69) ) |
0 | 5129 v77 >>= 1; |
42 | 5130 if ( v45->HasItemEquipped(EQUIP_ARMOUR) |
898 | 5131 && *(_DWORD *)&v45->pInventoryItems[v45->pEquipment.uArmor-1] == 504 ) |
0 | 5132 v77 >>= 1; |
5133 v75 = 0; | |
42 | 5134 v47 = (int)&v45->pEquipment; |
0 | 5135 do |
5136 { | |
42 | 5137 if ( v45->HasItemEquipped((ITEM_EQUIP_TYPE)v75) ) |
0 | 5138 { |
5139 v48 = *(int *)&v45[36 * *(int *)v47 + 496]; | |
5140 if ( v48 == 520 ) | |
5141 v77 >>= 1; | |
5142 if ( v48 == 531 ) | |
5143 v77 >>= 1; | |
816 | 5144 if ( v45->GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v75) == EQUIP_SHIELD && SkillToMastery(v45->pActiveSkills[PLAYER_SKILL_SHIELD]) == 4 ) |
0 | 5145 v77 >>= 1; |
5146 } | |
5147 ++v75; | |
5148 v47 += 4; | |
5149 } | |
5150 while ( (signed int)v75 <= 1 ); | |
5151 LABEL_115: | |
5152 if ( (signed __int64)v44->pActorBuffs[3].uExpireTime > 0 ) | |
5153 { | |
5154 v49 = v44->pActorBuffs[3].uPower; | |
5155 if ( v49 ) | |
5156 v77 /= (signed int)v49; | |
5157 } | |
5158 if ( !v74 ) | |
5159 { | |
5160 v50 = v44->pMonsterInfo.uAttack1Type; | |
5161 goto LABEL_133; | |
5162 } | |
5163 if ( v74 == 1 ) | |
5164 { | |
5165 v50 = v44->pMonsterInfo.uAttack2Type; | |
5166 goto LABEL_133; | |
5167 } | |
5168 if ( v74 == 2 ) | |
5169 { | |
5170 v53 = v44->pMonsterInfo.uSpell1ID; | |
5171 } | |
5172 else | |
5173 { | |
5174 if ( v74 != 3 ) | |
5175 { | |
5176 if ( v74 == 4 ) | |
5177 v50 = v44->pMonsterInfo.field_3C_some_special_attack; | |
5178 else | |
5179 v50 = 4; | |
5180 LABEL_133: | |
5181 if ( !(dword_6BE368_debug_settings_2 & 0x10) ) | |
5182 { | |
42 | 5183 v54 = v45->ReceiveDamage(v77, v50); |
5184 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) >= 0 ) | |
5185 { | |
5186 if ( SHIDWORD(v45->pPlayerBuffs[10].uExpireTime) > 0 || LODWORD(v45->pPlayerBuffs[10].uExpireTime) ) | |
0 | 5187 { |
5188 v55 = v44->uAIState; | |
5189 if ( v55 != 5 ) | |
5190 { | |
5191 if ( v55 != 4 ) | |
5192 { | |
5193 v56 = stru_50C198.CalcMagicalDamageToActor(v44, v50, v54); | |
5194 v44->sCurrentHP -= v56; | |
5195 if ( v56 ) | |
5196 { | |
5197 if ( v44->sCurrentHP >= 1 ) | |
5198 { | |
862 | 5199 Actor::Stun(uActorID, PID(OBJECT_Player,a4), 0); |
322 | 5200 Actor::AggroSurroundingPeasants(uActorID, 1); |
0 | 5201 } |
5202 else | |
5203 { | |
5204 if ( pMonsterStats->pInfos[v44->pMonsterInfo.uID].bQuestMonster & 1 ) | |
5205 { | |
5206 v57 = byte_4D864C && BYTE2(pGame->uFlags) & 8 ? 10 * v44->uActorRadius : v44->uActorRadius; | |
5207 v75 = v57; | |
5208 if ( pRenderer->pRenderD3D ) | |
5209 { | |
573 | 5210 if ( pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS ) |
0 | 5211 { |
5212 v58 = (double)(signed int)v75; | |
5213 v75 = v44->vPosition.z; | |
5214 v59 = (double)(signed int)v75; | |
5215 v75 = v44->vPosition.y; | |
5216 v60 = v59; | |
5217 v61 = (double)(signed int)v75; | |
5218 v75 = v44->vPosition.x; | |
5219 v62 = v61; | |
5220 v63 = (double)(signed int)v75; | |
5221 pDecalBuilder->AddBloodsplat(v63, v62, v60, 1.0, 0.0, 0.0, v58, 0, 0); | |
5222 } | |
5223 } | |
5224 } | |
5225 Actor::Die(uActorID); | |
322 | 5226 Actor::ApplyFineForKillingPeasant(uActorID); |
5227 Actor::AggroSurroundingPeasants(uActorID, 1); | |
0 | 5228 if ( v44->pMonsterInfo.uExp ) |
792 | 5229 GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp); |
187 | 5230 v64 = SPEECH_51; |
0 | 5231 if ( rand() % 100 < 20 ) |
5232 v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1; | |
187 | 5233 v45->PlaySound((PlayerSpeech)v64, 0); |
0 | 5234 } |
5235 } | |
5236 } | |
5237 } | |
5238 } | |
5239 } | |
5240 } | |
5241 if ( !v74 | |
5242 && !(dword_6BE368_debug_settings_2 & 0x10) | |
5243 && v44->pMonsterInfo.uSpecialAttack | |
5244 && rand() % 100 < v44->pMonsterInfo.uLevel * v44->pMonsterInfo.uSpecialAttackType ) | |
42 | 5245 v45->_48DCF6(v44->pMonsterInfo.uSpecialAttack, v44); |
0 | 5246 if ( !pParty->bTurnBasedModeOn ) |
5247 { | |
42 | 5248 v65 = v45->GetActualEndurance(); |
5249 v66 = (double)(20 - v45->_48EA1B_get_static_effect(v65)) | |
0 | 5250 * flt_6BE3A4_debug_recmod1 |
5251 * 2.133333333333333; | |
42 | 5252 v45->SetRecoveryTime((signed __int64)v66); |
0 | 5253 } |
5254 return; | |
5255 } | |
5256 v53 = v44->pMonsterInfo.uSpell2ID; | |
5257 } | |
5258 v50 = LOBYTE(pSpellStats->pInfos[v53].uSchool); | |
5259 goto LABEL_133; | |
5260 } | |
5261 if ( v42 != 1 ) | |
5262 return; | |
5263 LABEL_80: | |
5264 if ( a4 != -1 ) | |
5265 { | |
42 | 5266 v43 = &pParty->pPlayers[a4]; |
0 | 5267 LABEL_168: |
42 | 5268 a4b = v43; |
822 | 5269 if ( v38 != OBJECT_Player || v37->spell_id != SPELL_BOW_ARROW) |
0 | 5270 { |
42 | 5271 v70 = v43->GetMaxHealth(); |
822 | 5272 v68 = _43AFE3_calc_spell_damage(v37->spell_id, v37->spell_level, v37->spell_skill, v70); |
5273 v69 = LOBYTE(pSpellStats->pInfos[v37->spell_id].uSchool); | |
0 | 5274 } |
5275 else | |
5276 { | |
5277 v68 = pParty->pPlayers[uActorID].CalculateRangedDamageTo(0); | |
5278 v69 = 0; | |
5279 } | |
5280 a4b->ReceiveDamage(v68, v69); | |
303 | 5281 if ( v38 == OBJECT_Player && !qword_A750D8 ) |
0 | 5282 { |
5283 qword_A750D8 = 256i64; | |
5284 word_A750E0 = 44; | |
5285 word_A750E2 = uActorID + 1; | |
5286 } | |
5287 return; | |
5288 } | |
5289 v74 = 0; | |
5290 a4a = 1; | |
5291 do | |
5292 { | |
5293 if ( pPlayers[a4a]->CanAct() ) | |
5294 { | |
5295 v67 = v74++; | |
5296 *(&v72 + v67) = a4a; | |
5297 } | |
5298 ++a4a; | |
5299 } | |
5300 while ( a4a <= 4 ); | |
5301 if ( v74 ) | |
5302 { | |
42 | 5303 v43 = &pParty->pPlayers[*(&v72+rand()%v74)-1];//&stru_AA1058[3].pSounds[6972 * *(&v72 + rand() % v74) + 40552]; |
0 | 5304 goto LABEL_168; |
5305 } | |
5306 } | |
5307 | |
5308 //----- (0043A97E) -------------------------------------------------------- | |
5309 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) | |
5310 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5311 if ( PID_TYPE(a2) == OBJECT_BLVDoor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5312 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5313 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5314 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5315 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5316 |
0 | 5317 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
|
5318 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
|
5319 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5320 else if (PID_TYPE(a2) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5321 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5322 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5323 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5324 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5325 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5326 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
|
5327 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid)) |
0 | 5328 { |
5329 case OBJECT_Actor: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5330 sub_43B1B0(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61); |
0 | 5331 break; |
5332 case OBJECT_Player: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5333 DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 5334 break; |
5335 case OBJECT_Item: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
5336 sub_43B057(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 5337 break; |
5338 } | |
5339 } | |
5340 } | |
5341 | |
5342 //----- (0043AA99) -------------------------------------------------------- | |
5343 void __fastcall Vec3_int_::Rotate(int sDepth, int sRotY, int sRotX, Vec3_int_ v, int *outx, int *outy, int *outz) | |
5344 { | |
147 | 5345 /* int v7; // ebx@1 |
0 | 5346 int v8; // ST14_4@1 |
5347 int v9; // edi@1 | |
5348 int anglea; // [sp+20h] [bp+8h]@1 | |
1025 | 5349 |
0 | 5350 v7 = sRotX; |
5351 v8 = sDepth; | |
5352 v9 = sRotY; | |
5353 anglea = (unsigned __int64)(stru_5C6E00->SinCos(sRotX) * (signed __int64)sDepth) >> 16; | |
1025 | 5354 *outx = v.x + ((unsigned __int64)(stru_5C6E00->SinCos(sRotY) * (signed __int64)anglea) >> 16); |
5355 *outy = v.y + ((unsigned __int64)(stru_5C6E00->SinCos(sRotY - stru_5C6E00->uIntegerHalfPi) * (signed __int64)anglea) >> 16); | |
5356 *outz = v.z + ((unsigned __int64)(stru_5C6E00->SinCos(sRotX - stru_5C6E00->uIntegerHalfPi) * (signed __int64)sDepth) >> 16);*/ | |
147 | 5357 |
5358 float cosf_x = cosf(3.14159265f * sRotX / 1024.0f), | |
1025 | 5359 sinf_x = sinf(3.14159265f * sRotX / 1024.0f), |
147 | 5360 cosf_y = cosf(3.14159265f * sRotY / 1024.0f), |
5361 sinf_y = sinf(3.14159265f * sRotY / 1024.0f); | |
1029 | 5362 //sDepth = 14000000; |
1025 | 5363 *outx = v.x + ((unsigned __int64)(sinf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16))); |
5364 *outy = v.y + ((unsigned __int64)(cosf_y * (signed __int64)((unsigned __int64)(cosf_x * (signed __int64)sDepth)>> 16))); | |
5365 *outz = v.z + ((unsigned __int64)(sinf_x * (signed __int64)sDepth) >> 16); | |
147 | 5366 |
0 | 5367 } |
5368 | |
5369 //----- (0043AB61) -------------------------------------------------------- | |
5370 void Vec3_int_::Normalize(int *x, int *y, int *z) | |
5371 { | |
1025 | 5372 *x *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); |
5373 *y *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); | |
5374 *z *= 65536 / (integer_sqrt(*y * *y + *z * *z + *x * *x) | 1); | |
0 | 5375 } |
5376 | |
5377 //----- (0043AE12) -------------------------------------------------------- | |
5378 double __fastcall sub_43AE12(signed int a1) | |
5379 { | |
5380 signed int v1; // ST00_4@1 | |
5381 signed int v2; // ecx@1 | |
5382 double v3; // st7@1 | |
5383 double result; // st7@6 | |
5384 | |
5385 v1 = a1; | |
5386 v2 = 0; | |
5387 v3 = (double)v1; | |
5388 do | |
5389 { | |
5390 if ( v3 < flt_4E4A80[v2 + 5] ) | |
5391 break; | |
5392 ++v2; | |
5393 } | |
5394 while ( v2 < 5 ); | |
5395 if ( v2 <= 0 || v2 >= 5 ) | |
5396 { | |
5397 if ( v2 ) | |
5398 result = flt_4E4A80[4]; | |
5399 else | |
5400 result = flt_4E4A80[0]; | |
5401 } | |
5402 else | |
5403 { | |
1033 | 5404 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 | 5405 } |
5406 return result; | |
5407 } | |
5408 | |
5409 //----- (0043AFE3) -------------------------------------------------------- | |
5410 int __fastcall _43AFE3_calc_spell_damage(int a1, int a2, signed int a3, int a4) | |
5411 { | |
5412 int result; // eax@1 | |
5413 unsigned int v5; // [sp-4h] [bp-8h]@9 | |
5414 | |
5415 result = 0; | |
5416 if ( a1 == 7 ) | |
5417 { | |
5418 if ( a3 <= 0 ) | |
5419 return result; | |
5420 if ( a3 <= 2 ) | |
5421 { | |
5422 v5 = 6; | |
5423 } | |
5424 else | |
5425 { | |
5426 if ( a3 == 3 ) | |
5427 { | |
5428 v5 = 8; | |
5429 } | |
5430 else | |
5431 { | |
5432 if ( a3 != 4 ) | |
5433 return result; | |
5434 v5 = 10; | |
5435 } | |
5436 } | |
5437 result = GetDiceResult(a2, v5); | |
5438 } | |
5439 else | |
5440 { | |
5441 if ( a1 == 44 ) | |
5442 result = a4 * (LOBYTE(pSpellDatas[40].field_10) + 2 * a2) / 100; | |
5443 else | |
5444 result = *((char *)&pSpellDatas[0].field_10 + 20 * a1) | |
5445 + GetDiceResult(a2, *((char *)&pSpellDatas[0].field_10 + 20 * a1 + 1)); | |
5446 } | |
5447 return result; | |
5448 } | |
5449 | |
5450 //----- (0043B057) -------------------------------------------------------- | |
5451 void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, Vec3_int_ *pVelocity) | |
5452 { | |
5453 Actor *pActor; // esi@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5454 SpriteObject *v4; // eax@3 |
0 | 5455 int v5; // ecx@3 |
5456 int v6; // eax@4 | |
5457 int v7; // edi@4 | |
5458 unsigned int uActorIDa; // [sp+8h] [bp-8h]@1 | |
5459 unsigned int a2; // [sp+Ch] [bp-4h]@1 | |
5460 int a2a; // [sp+Ch] [bp-4h]@8 | |
5461 | |
5462 uActorIDa = uActorID; | |
5463 pActor = &pActors[uActorID]; | |
5464 a2 = uObjID; | |
303 | 5465 if ( !pActors[uActorID].IsNotAlive() ) |
0 | 5466 { |
848 | 5467 if ( PID_TYPE(a2) == OBJECT_Item) |
5468 { | |
5469 v4 = &pSpriteObjects[PID_ID(a2)]; | |
822 | 5470 v5 = v4->spell_id; |
0 | 5471 if ( v5 ) |
5472 { | |
822 | 5473 v6 = _43AFE3_calc_spell_damage(v5, v4->spell_level, v4->spell_skill, pActor->sCurrentHP); |
0 | 5474 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6); |
5475 pActor->sCurrentHP -= v7; | |
5476 if ( v7 ) | |
5477 { | |
5478 if ( pActor->sCurrentHP > 0 ) | |
861 | 5479 Actor::Stun(uActorIDa, a2, 0); |
0 | 5480 else |
5481 Actor::Die(uActorIDa); | |
5482 a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP; | |
5483 if ( 20 * v7 / (signed int)pActor->pMonsterInfo.uHP > 10 ) | |
5484 a2a = 10; | |
5485 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
5486 { | |
5487 pVelocity->x = (unsigned __int64)(a2a * (signed __int64)pVelocity->x) >> 16; | |
5488 pVelocity->y = (unsigned __int64)(a2a * (signed __int64)pVelocity->y) >> 16; | |
5489 pVelocity->z = (unsigned __int64)(a2a * (signed __int64)pVelocity->z) >> 16; | |
5490 pActor->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
5491 pActor->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
5492 pActor->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
5493 } | |
5494 Actor::AddBloodsplatOnDamageOverlay(uActorIDa, 1, v7); | |
5495 } | |
5496 else | |
5497 { | |
861 | 5498 Actor::Stun(uActorIDa, a2, 0); |
0 | 5499 } |
5500 } | |
5501 } | |
5502 } | |
5503 } | |
5504 | |
5505 //----- (0043B1B0) -------------------------------------------------------- | |
322 | 5506 void sub_43B1B0(signed int a1, unsigned int a2, Vec3_int_ *pVelocity, signed int a4) |
0 | 5507 { |
5508 int v4; // ebx@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
5509 SpriteObject *v5; // eax@2 |
0 | 5510 bool v6; // eax@3 |
5511 Actor *v7; // esi@4 | |
5512 Actor *v8; // edi@4 | |
5513 char v9; // zf@5 | |
5514 __int64 v10; // qax@8 | |
5515 signed __int16 v11; // cx@9 | |
5516 signed int v12; // ecx@20 | |
5517 int v13; // ecx@22 | |
5518 int v14; // edi@30 | |
5519 unsigned int uActorID; // [sp+Ch] [bp-8h]@1 | |
5520 signed int v17; // [sp+10h] [bp-4h]@1 | |
5521 int v18; // [sp+20h] [bp+Ch]@34 | |
5522 | |
5523 v4 = 0; | |
5524 uActorID = a2; | |
5525 v17 = a1; | |
848 | 5526 if ( PID_TYPE(a1) == OBJECT_Item) |
5527 { | |
5528 v5 = &pSpriteObjects[PID_ID(a1)]; | |
0 | 5529 v4 = v5->field_60_distance_related_prolly_lod; |
822 | 5530 v17 = v5->spell_caster_pid; |
0 | 5531 } |
848 | 5532 LOWORD(v6) = PID_TYPE(v17); |
303 | 5533 if ( v6 == OBJECT_Actor) |
0 | 5534 { |
5535 v7 = &pActors[a2]; | |
848 | 5536 v8 = &pActors[PID_ID(v17)]; |
303 | 5537 v6 = pActors[a2].IsNotAlive(); |
0 | 5538 if ( !v6 ) |
5539 { | |
5540 v9 = v7->uAIState == 7; | |
5541 v7->uLastCharacterIDToHit = v17; | |
5542 if ( v9 ) | |
5543 BYTE2(v7->uAttributes) |= 2u; | |
5544 v6 = stru_50C198._4273BB(v8, v7, v4, 0); | |
5545 if ( v6 ) | |
5546 { | |
5547 v10 = (unsigned int)Actor::_43B3E0_CalcDamage(v8, a4); | |
5548 if ( (signed __int64)v8->pActorBuffs[3].uExpireTime > 0 ) | |
5549 { | |
5550 v11 = v8->pActorBuffs[3].uPower; | |
5551 if ( v11 ) | |
5552 v10 = (signed int)v10 / (unsigned __int16)v11; | |
5553 } | |
5554 if ( SHIDWORD(v7->pActorBuffs[5].uExpireTime) >= SHIDWORD(v10) | |
5555 && (SHIDWORD(v7->pActorBuffs[5].uExpireTime) > SHIDWORD(v10) | |
5556 || LODWORD(v7->pActorBuffs[5].uExpireTime) > HIDWORD(v10)) ) | |
5557 LODWORD(v10) = 0; | |
5558 if ( a4 != HIDWORD(v10) ) | |
5559 { | |
5560 if ( a4 - HIDWORD(v10) == 1 ) | |
5561 { | |
5562 v12 = v8->pMonsterInfo.uAttack2Type; | |
5563 if ( SHIDWORD(v7->pActorBuffs[15].uExpireTime) >= SHIDWORD(v10) | |
5564 && (SHIDWORD(v7->pActorBuffs[15].uExpireTime) > SHIDWORD(v10) | |
5565 || LODWORD(v7->pActorBuffs[15].uExpireTime) > HIDWORD(v10)) ) | |
5566 LODWORD(v10) = (signed int)v10 >> 1; | |
5567 goto LABEL_30; | |
5568 } | |
5569 if ( a4 - HIDWORD(v10) == 2 ) | |
5570 { | |
5571 v13 = v7->pMonsterInfo.uSpell1ID; | |
5572 } | |
5573 else | |
5574 { | |
5575 if ( a4 - HIDWORD(v10) != 3 ) | |
5576 { | |
5577 if ( a4 - HIDWORD(v10) == 4 ) | |
5578 v12 = v8->pMonsterInfo.field_3C_some_special_attack; | |
5579 else | |
5580 v12 = 4; | |
5581 LABEL_30: | |
5582 v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10); | |
5583 v7->sCurrentHP -= v14; | |
5584 if ( v14 ) | |
5585 { | |
5586 if ( v7->sCurrentHP > 0 ) | |
861 | 5587 Actor::Stun(uActorID, v17, 0); |
0 | 5588 else |
5589 Actor::Die(uActorID); | |
322 | 5590 Actor::AggroSurroundingPeasants(uActorID, 0); |
0 | 5591 v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP; |
5592 if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) | |
5593 v18 = 10; | |
5594 if ( !MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
5595 { | |
5596 pVelocity->x = (unsigned __int64)(v18 * (signed __int64)pVelocity->x) >> 16; | |
5597 pVelocity->y = (unsigned __int64)(v18 * (signed __int64)pVelocity->y) >> 16; | |
5598 pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; | |
5599 v7->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
5600 v7->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
5601 v7->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
5602 } | |
322 | 5603 Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v14); |
0 | 5604 } |
5605 else | |
5606 { | |
861 | 5607 Actor::Stun(uActorID, v17, 0); |
0 | 5608 } |
322 | 5609 return; |
0 | 5610 } |
5611 v13 = v7->pMonsterInfo.uSpell2ID; | |
5612 } | |
5613 v12 = LOBYTE(pSpellStats->pInfos[v13].uSchool); | |
5614 goto LABEL_30; | |
5615 } | |
5616 v12 = v8->pMonsterInfo.uAttack1Type; | |
5617 goto LABEL_30; | |
5618 } | |
5619 } | |
5620 } | |
5621 } | |
5622 | |
5623 //----- (0043C91D) -------------------------------------------------------- | |
899 | 5624 int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder) |
0 | 5625 { |
5626 int result; // eax@2 | |
5627 char v5; // zf@3 | |
5628 const char *v6; // [sp-Ch] [bp-18h]@88 | |
5629 signed int v7; // [sp-8h] [bp-14h]@61 | |
5630 int v8; // [sp-4h] [bp-10h]@61 | |
5631 signed int v9; // [sp-4h] [bp-10h]@69 | |
5632 | |
5633 result = 0; //BUG fn is void | |
899 | 5634 if ( item_id <= 500 ) |
0 | 5635 { |
5636 //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0; | |
899 | 5637 v5 = party_has_equipment[(item_id - 100) + 32 + 2] == 0; |
5638 switch ( item_id ) | |
5639 { | |
5640 case 516: | |
5641 v5 = byte_5111F6[2] == 0; | |
5642 break; | |
5643 case 505: | |
5644 v5 = byte_5111F6[1] == 0; | |
5645 break; | |
5646 case 504: | |
5647 v5 = byte_5111F6[0] == 0; | |
5648 break; | |
5649 case 533: | |
5650 v5 = byte_5111F6[16] == 0; | |
5651 break; | |
5652 case 512: | |
5653 v5 = byte_5111F6[3] == 0; | |
5654 break; | |
5655 case 521: | |
5656 v5 = byte_5111F6[4] == 0; | |
5657 break; | |
5658 case 522: | |
5659 v5 = byte_5111F6[5] == 0; | |
5660 break; | |
5661 case 523: | |
5662 v5 = byte_5111F6[6] == 0; | |
5663 break; | |
5664 case 532: | |
5665 v5 = byte_5111F6[7] == 0; | |
5666 break; | |
5667 case 544: | |
5668 v5 = byte_5111F6[8] == 0; | |
5669 break; | |
5670 case 524: | |
5671 v5 = byte_5111F6[9] == 0; | |
5672 break; | |
5673 case 535: | |
5674 v5 = byte_5111F6[10] == 0; | |
5675 break; | |
5676 case 525: | |
5677 v5 = byte_5111F6[11] == 0; | |
5678 break; | |
5679 case 530: | |
5680 v5 = byte_5111F6[12] == 0; | |
5681 break; | |
5682 case 547: | |
5683 v5 = byte_5111F6[13] == 0; | |
5684 break; | |
5685 case 548: | |
5686 v5 = byte_5111F6[14] == 0; | |
5687 break; | |
5688 case 550: | |
5689 v5 = byte_5111F6[15] == 0; | |
5690 break; | |
5691 default: | |
5692 break; | |
5693 } | |
0 | 5694 if ( v5 ) |
5695 return result; | |
5696 result = 516; | |
899 | 5697 if ( item_id < 66 || item_id > 78 ) |
5698 { | |
5699 if ( item_id == 516 ) | |
5700 { | |
5701 if ( !shoulder ) | |
5702 return sprintf(pOut, "item%3.3dv%d", 234, index); | |
5703 if ( shoulder == 1 ) | |
5704 return sprintf(pOut, "item%3.3dv%da1", 234, index); | |
5705 if ( shoulder == 2 ) | |
5706 return sprintf(pOut, "item%3.3dv%da2", 234, index); | |
5707 } | |
5708 if ( item_id != 504 && item_id != 505 && item_id != 533 ) | |
5709 { | |
5710 if ( (item_id < 100 || item_id > 104) && item_id != 524 && item_id != 535 ) | |
5711 { | |
5712 if ( item_id >= 115 && item_id <= 119 || item_id == 512 ) | |
5713 { | |
5714 if ( item_id == 512 ) | |
5715 item_id = 312; | |
5716 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5717 } | |
5718 if ( (item_id < 89 || item_id > 99) && item_id != 521 && item_id != 522 && item_id != 523 && item_id != 532 && item_id != 544 ) | |
0 | 5719 { |
5720 result = 525; | |
899 | 5721 if ( (item_id < 105 || item_id > 109) && item_id != 525 && item_id != 530 && item_id != 547 && item_id != 548 && item_id != 550 ) |
0 | 5722 return result; |
899 | 5723 switch ( item_id ) |
0 | 5724 { |
5725 case 525: | |
899 | 5726 item_id = 325; |
0 | 5727 break; |
5728 case 530: | |
899 | 5729 item_id = 330; |
0 | 5730 break; |
5731 case 547: | |
899 | 5732 item_id = 347; |
0 | 5733 break; |
5734 case 548: | |
899 | 5735 item_id = 348; |
0 | 5736 break; |
5737 case 550: | |
899 | 5738 item_id = 350; |
0 | 5739 break; |
5740 } | |
899 | 5741 if ( !shoulder ) |
5742 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5743 return sprintf(pOut, "item%3.3dv%da1", item_id, index); | |
5744 } | |
5745 if ( item_id == 521 ) | |
5746 return sprintf(pOut, "item%3.3dv%d", 239, index); | |
5747 if ( item_id == 522 ) | |
5748 return sprintf(pOut, "item%3.3dv%d", 240, index); | |
5749 if ( item_id == 523 ) | |
5750 return sprintf(pOut, "item%3.3dv%d", 241, index); | |
5751 if ( item_id != 532 ) | |
5752 { | |
5753 if ( item_id == 544 ) | |
5754 item_id = 344; | |
5755 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5756 } | |
5757 return sprintf(pOut, "item%3.3dv%d", 93, index); | |
5758 } | |
5759 if ( item_id == 524 ) | |
5760 return sprintf(pOut, "item%3.3dv%d", 324, index); | |
5761 if ( item_id == 535 ) | |
5762 item_id = 104; | |
5763 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5764 } | |
5765 } | |
5766 if ( item_id != 516 ) | |
5767 { | |
5768 switch ( item_id ) | |
0 | 5769 { |
5770 case 504: | |
899 | 5771 item_id = 235; |
0 | 5772 break; |
5773 case 505: | |
899 | 5774 item_id = 236; |
0 | 5775 break; |
5776 case 533: | |
899 | 5777 item_id = 73; |
0 | 5778 break; |
5779 } | |
899 | 5780 if ( !shoulder ) |
5781 return sprintf(pOut, "item%3.3dv%d", item_id, index); | |
5782 if ( shoulder == 1 ) | |
5783 return sprintf(pOut, "item%3.3dv%da1", item_id, index); | |
5784 if ( shoulder == 2 ) | |
5785 return sprintf(pOut, "item%3.3dv%da2", item_id, index); | |
5786 } | |
5787 if ( !shoulder ) | |
5788 return sprintf(pOut, "item%3.3dv%d", 234, index); | |
5789 if ( shoulder == 1 ) | |
5790 return sprintf(pOut, "item%3.3dv%da1", 234, index); | |
5791 if ( shoulder == 2 ) | |
5792 return sprintf(pOut, "item%3.3dv%da2", 234, index); | |
5793 } | |
5794 result = item_id - 504; | |
0 | 5795 return result; |
5796 } | |
5797 | |
5798 //----- (0043ED6F) -------------------------------------------------------- | |
5799 bool _43ED6F_check_party_races(bool a1) | |
5800 { | |
5801 bool v6; // zf@5 | |
5802 | |
5803 for (uint i = 0; i < 4; ++i) | |
5804 { | |
5805 auto player = pParty->pPlayers + i; | |
5806 auto race = player->GetRace(); | |
5807 | |
5808 if (race != CHARACTER_RACE_HUMAN && | |
5809 race != CHARACTER_RACE_ELF && | |
5810 race != CHARACTER_RACE_GOBLIN) | |
5811 v6 = a1 == 1; | |
5812 else | |
5813 v6 = !a1; | |
5814 | |
5815 if (v6) | |
5816 return true; | |
5817 } | |
5818 return false; | |
5819 } | |
5820 // A750D8: using guessed type __int64 qword_A750D8; | |
5821 | |
5822 //----- (0043EDB9) -------------------------------------------------------- | |
4 | 5823 bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int a1) |
5824 { | |
5825 unsigned int pNum; // ebp@1 | |
5826 Player **pPlayer; // ebx@1 | |
5827 Player *pPlayer2; // esi@2 | |
5828 enum CHARACTER_RACE pRace; // edi@2 | |
5829 bool pSex; // eax@2 | |
0 | 5830 char v6; // zf@7 |
5831 | |
4 | 5832 //pPlayer = &pPlayers[1]; |
5833 /*pNum = a1; | |
5834 | |
0 | 5835 while ( 1 ) |
5836 { | |
4 | 5837 pPlayer2 = *pPlayer; |
5838 pRace = pPlayer2->GetRace(); | |
5839 pSex = pPlayer2->GetSexByVoice(); | |
5840 if ( !pRace ) | |
5841 break; | |
5842 if ( pRace == 1 || pRace == 2 ) | |
0 | 5843 break; |
4 | 5844 if ( !pSex && pNum == 2 )// |
5845 //goto LABEL_15; | |
5846 { | |
5847 pSex = 1; | |
5848 return pSex; | |
5849 } | |
5850 v6 = pNum == 3;// | |
0 | 5851 LABEL_11: |
5852 if ( v6 ) | |
4 | 5853 //goto LABEL_15; |
5854 { | |
5855 pSex = 1; | |
5856 return pSex; | |
5857 } | |
5858 ++pPlayer; | |
5859 if ( (signed int)pPlayer >= (signed int)&qword_A750D8 )// | |
5860 { | |
5861 pSex = 0; | |
5862 return pSex; | |
5863 } | |
5864 } | |
5865 if ( pSex || pNum ) | |
5866 { | |
5867 v6 = pNum == 1; | |
0 | 5868 goto LABEL_11; |
5869 } | |
4 | 5870 //LABEL_15: |
5871 pSex = 1; | |
5872 return pSex;*/ | |
871 | 5873 for (uint i = 1; i <= 4; ++i) |
4 | 5874 { |
5875 pRace = pPlayers[i]->GetRace(); | |
5876 pSex = pPlayers[i]->GetSexByVoice(); | |
5877 if (pRace == 0 || pRace == 1 || pRace == 2 || pSex == 0 ) | |
5878 return 1; | |
5879 } | |
5880 return 0; | |
0 | 5881 } |
5882 // A750D8: using guessed type __int64 qword_A750D8; | |
5883 | |
5884 //----- (0043EE15) -------------------------------------------------------- | |
899 | 5885 bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) |
5886 { | |
0 | 5887 if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) |
5888 { | |
899 | 5889 for ( uint i = 0; i < 126; ++i ) |
5890 { | |
5891 if ( pPlayer->pInventoryIndices[i] > 0 ) | |
5892 { | |
5893 if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pInventoryIndices[i] - 1].uItemID == uItemID ) | |
5894 return true; | |
5895 } | |
5896 } | |
5897 for ( uint i = 0; i < 16; ++i ) | |
5898 { | |
5899 if ( pPlayer->pEquipment.pIndices[i] ) | |
5900 { | |
5901 if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) | |
5902 return true; | |
5903 } | |
5904 } | |
5905 } | |
5906 return false; | |
0 | 5907 } |
5908 | |
5909 //----- (0043EE77) -------------------------------------------------------- | |
5910 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1) | |
5911 { | |
5912 bool result; // eax@0 | |
5913 Player *v2; // edx@3 | |
5914 int v3; // ecx@3 | |
5915 Player **pPlayers; // esi@8 | |
5916 unsigned int v5; // ecx@8 | |
5917 Player *v6; // edx@9 | |
5918 | |
5919 if ( a1 < 1 || a1 > 4 ) | |
5920 { | |
5921 if ( !a1 ) | |
5922 { | |
5923 pPlayers = &::pPlayers[1]; | |
5924 v5 = 604; | |
5925 while ( 1 ) | |
5926 { | |
899 | 5927 result = Player_has_item(v5, *pPlayers, 0); |
0 | 5928 if ( !result ) |
5929 break; | |
898 | 5930 result = v6->pEquipment.uArmor; |
0 | 5931 if ( !result ) |
5932 break; | |
5933 result *= 9; | |
5934 if ( *(int *)&v6->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v5 ) | |
5935 break; | |
5936 ++pPlayers; | |
5937 if ( (signed int)pPlayers >= (signed int)&qword_A750D8 ) | |
5938 goto LABEL_13; | |
5939 } | |
5940 } | |
5941 goto LABEL_6; | |
5942 } | |
899 | 5943 result = Player_has_item(604u, ::pPlayers[a1], 0); |
0 | 5944 if ( !result |
898 | 5945 || (result = v2->pEquipment.uArmor) == 0 |
0 | 5946 || (result *= 9, *(int *)&v2->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v3) ) |
5947 { | |
5948 LABEL_6: | |
5949 LOBYTE(result) = 0; | |
5950 return result; | |
5951 } | |
5952 LABEL_13: | |
5953 LOBYTE(result) = 1; | |
5954 return result; | |
5955 } | |
5956 // A750D8: using guessed type __int64 qword_A750D8; | |
5957 | |
5958 //----- (0043EF2B) -------------------------------------------------------- | |
5959 void __fastcall WetsuitOn(unsigned int uPlayerID) | |
5960 { | |
5961 unsigned int v1; // ebx@1 | |
5962 Player **v2; // esi@2 | |
5963 enum CHARACTER_RACE v3; // edi@2 | |
5964 signed int v4; // eax@2 | |
5965 int v5; // ecx@5 | |
5966 unsigned __int8 v6; // al@7 | |
5967 char pContainer[20]; // [sp+4h] [bp-1Ch]@7 | |
5968 unsigned int v8; // [sp+18h] [bp-8h]@1 | |
5969 int v9; // [sp+1Ch] [bp-4h]@7 | |
5970 | |
5971 v1 = uPlayerID - 1; | |
5972 v8 = uPlayerID; | |
711 | 5973 if ( (uPlayerID - 1) >= 0 ) |
0 | 5974 { |
5975 v2 = &pPlayers[uPlayerID]; | |
5976 v3 = (*v2)->GetRace(); | |
5977 v4 = (*v2)->GetSexByVoice(); | |
5978 if ( v3 && v3 != 1 && v3 != 2 ) | |
5979 v5 = (v4 != 0) + 3; | |
5980 else | |
5981 v5 = (v4 != 0) + 1; | |
5982 v9 = v5; | |
5983 wsprintfA(pContainer, "pc23v%dBod", v5); | |
5984 papredoll_dbods[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
5985 wsprintfA(pContainer, "pc23v%dlad", v9); | |
5986 papredoll_dlads[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
5987 wsprintfA(pContainer, "pc23v%dlau", v9); | |
5988 papredoll_dlaus[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
5989 wsprintfA(pContainer, "pc23v%drh", v9); | |
5990 papredoll_drhs[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
5991 wsprintfA(pContainer, "pc23v%dlh", v9); | |
5992 papredoll_dlhs[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
5993 wsprintfA(pContainer, "pc23v%dlhu", v9); | |
5994 papredoll_dlhus[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
1014 | 5995 v6 = pPlayers[v1 + 1]->uCurrentFace; |
0 | 5996 if ( v6 == 12 || v6 == 13 ) |
1014 | 5997 papredoll_dbrds[pPlayers[v8]->uCurrentFace] = 0; |
5998 papredoll_flying_feet[pPlayers[v8]->uCurrentFace] = 0; | |
0 | 5999 IsPlayerWearingWatersuit[v8] = 1; |
6000 } | |
6001 } | |
6002 | |
6003 //----- (0043F0BD) -------------------------------------------------------- | |
6004 unsigned int __fastcall WetsuitOff(unsigned int uPlayerID) | |
6005 { | |
6006 unsigned int result; // eax@1 | |
6007 Player **v2; // edi@2 | |
6008 unsigned int v3; // ebx@2 | |
6009 int v4; // ebx@2 | |
6010 char v5; // al@2 | |
6011 char pContainer[20]; // [sp+0h] [bp-18h]@4 | |
6012 unsigned int v7; // [sp+14h] [bp-4h]@1 | |
6013 | |
6014 result = uPlayerID - 1; | |
6015 v7 = uPlayerID; | |
6016 if ( ((uPlayerID - 1) & 0x80000000u) == 0 ) | |
6017 { | |
6018 v2 = &pPlayers[uPlayerID]; | |
6019 v3 = uPlayerID - 1; | |
1014 | 6020 papredoll_dbods[v3] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); |
6021 papredoll_dlads[v3] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); | |
6022 papredoll_dlaus[v3] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); | |
6023 papredoll_drhs[v3] = pIcons_LOD->LoadTexture(drh_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); | |
6024 papredoll_dlhs[v3] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); | |
6025 papredoll_dlhus[v3] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE); | |
6026 v4 = (int)&(*v2)->uCurrentFace; | |
0 | 6027 v5 = *(char *)v4; |
6028 if ( *(char *)v4 == 12 || v5 == 13 ) | |
6029 { | |
6030 wsprintfA(pContainer, "pc%02dbrd", v5 + 1); | |
1014 | 6031 v4 = (int)&(*v2)->uCurrentFace; |
0 | 6032 papredoll_dbrds[*(char *)v4] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
6033 } | |
6034 wsprintfA(pContainer, "item281pc%02d", *(char *)v4 + 1); | |
1014 | 6035 papredoll_flying_feet[(*v2)->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); |
0 | 6036 result = v7; |
6037 IsPlayerWearingWatersuit[v7] = 0; | |
6038 } | |
6039 return result; | |
6040 } | |
6041 | |
6042 //----- (0043F333) -------------------------------------------------------- | |
6043 void BspRenderer::MakeVisibleSectorList() | |
6044 { | |
6045 int v6; // ebx@3 | |
6046 | |
6047 uNumVisibleNotEmptySectors = 0; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6048 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
|
6049 { |
0 | 6050 if (!uNumVisibleNotEmptySectors) |
6051 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6052 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6053 continue; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6054 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6055 |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6056 v6 = 0; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6057 while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != nodes[i].uSectorID ) |
0 | 6058 { |
6059 ++v6; | |
6060 if ( v6 >= uNumVisibleNotEmptySectors) | |
6061 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6062 pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = nodes[i].uSectorID; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6063 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6064 } |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
666
diff
changeset
|
6065 |
0 | 6066 } |
6067 } | |
6068 | |
6069 //----- (0043F515) -------------------------------------------------------- | |
657 | 6070 void FindBillboardsLightLevels_BLV() |
0 | 6071 { |
6072 for (uint i = 0; i < uNumBillboardsToDraw; ++i) | |
6073 { | |
6074 auto p = pBillboardRenderList + i; | |
6075 | |
6076 if (p->field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !p->uIndoorSectorID) | |
657 | 6077 p->dimming_level = 0; |
0 | 6078 else |
657 | 6079 p->dimming_level = _43F55F_get_billboard_light_level(p, -1); |
0 | 6080 } |
6081 } | |
6082 | |
6083 //----- (0043F55F) -------------------------------------------------------- | |
6084 int __fastcall _43F55F_get_billboard_light_level(RenderBillboard *a1, int uBaseLightLevel) | |
6085 { | |
6086 signed int v3; // ecx@2 | |
6087 | |
6088 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
6089 { | |
6090 v3 = pIndoor->pSectors[a1->uIndoorSectorID].uMinAmbientLightLevel; | |
6091 } | |
6092 else | |
6093 { | |
6094 if ( uBaseLightLevel == -1 ) | |
657 | 6095 v3 = a1->dimming_level; |
0 | 6096 else |
6097 v3 = uBaseLightLevel; | |
6098 } | |
430 | 6099 return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->world_x, a1->world_y, a1->world_z); |
0 | 6100 } |
6101 | |
6102 //----- (0043F5C8) -------------------------------------------------------- | |
6103 int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z) | |
6104 { | |
6105 int v5; // esi@1 | |
6106 signed int v6; // edi@1 | |
6107 int v8; // eax@6 | |
6108 int v9; // ebx@6 | |
6109 unsigned int v10; // ecx@6 | |
6110 unsigned int v11; // edx@9 | |
6111 unsigned int v12; // edx@11 | |
6112 signed int v13; // ecx@12 | |
6113 BLVLightMM7 *v16; // esi@20 | |
6114 int v17; // ebx@21 | |
6115 int v18; // eax@24 | |
6116 int v19; // ebx@24 | |
6117 unsigned int v20; // ecx@24 | |
6118 int v21; // edx@25 | |
6119 unsigned int v22; // edx@27 | |
6120 unsigned int v23; // edx@29 | |
6121 signed int v24; // ecx@30 | |
6122 int v26; // ebx@35 | |
6123 int v27; // eax@38 | |
6124 int v28; // ebx@38 | |
6125 unsigned int v29; // ecx@38 | |
6126 int v30; // edx@39 | |
6127 unsigned int v31; // edx@41 | |
6128 unsigned int v32; // edx@43 | |
6129 signed int v33; // ecx@44 | |
6130 int v37; // [sp+Ch] [bp-18h]@37 | |
6131 int v38; // [sp+10h] [bp-14h]@5 | |
6132 int v39; // [sp+10h] [bp-14h]@23 | |
6133 int v40; // [sp+10h] [bp-14h]@36 | |
6134 int v42; // [sp+14h] [bp-10h]@22 | |
6135 unsigned int v43; // [sp+18h] [bp-Ch]@12 | |
6136 unsigned int v44; // [sp+18h] [bp-Ch]@30 | |
6137 unsigned int v45; // [sp+18h] [bp-Ch]@44 | |
6138 | |
6139 v6 = uBaseLightLevel; | |
6140 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i) | |
6141 { | |
6142 auto p = pMobileLightsStack->pLights + i; | |
6143 | |
6144 auto distX = abs(p->vPosition.x - x); | |
6145 if ( distX <= p->uRadius) | |
6146 { | |
6147 auto distY = abs(p->vPosition.y - y); | |
6148 if ( distY <= p->uRadius) | |
6149 { | |
6150 auto distZ = abs(p->vPosition.z - z); | |
6151 if ( distZ <= p->uRadius) | |
6152 { | |
6153 v8 = distX; | |
6154 v9 = distY; | |
6155 v10 = distZ; | |
6156 if (distX < distY) | |
6157 { | |
6158 v8 = distY; | |
6159 v9 = distX; | |
6160 } | |
6161 if ( v8 < distZ ) | |
6162 { | |
6163 v11 = v8; | |
6164 v8 = distZ; | |
6165 v10 = v11; | |
6166 } | |
6167 if ( v9 < (signed int)v10 ) | |
6168 { | |
6169 v12 = v10; | |
6170 v10 = v9; | |
6171 v9 = v12; | |
6172 } | |
6173 v43 = ((unsigned int)(11 * v9) / 32) + (v10 / 4) + v8; | |
6174 v13 = p->uRadius; | |
6175 if ( (signed int)v43 < v13 ) | |
6176 v6 += ((unsigned __int64)(30i64 * (signed int)(v43 << 16) / v13) >> 16) - 30; | |
6177 } | |
6178 } | |
6179 } | |
6180 } | |
6181 | |
6182 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6183 { | |
6184 auto pSector = pIndoor->pSectors + uSectorID; | |
6185 | |
6186 for (uint i = 0; i < pSector->uNumLights; ++i) | |
6187 { | |
6188 v16 = pIndoor->pLights + pSector->pLights[i]; | |
6189 if (~v16->uAtributes & 8) | |
6190 { | |
6191 v17 = abs(v16->vPosition.x - x); | |
6192 if ( v17 <= v16->uRadius ) | |
6193 { | |
6194 v42 = abs(v16->vPosition.y - y); | |
6195 if ( v42 <= v16->uRadius ) | |
6196 { | |
6197 v39 = abs(v16->vPosition.z - z); | |
6198 if ( v39 <= v16->uRadius ) | |
6199 { | |
6200 v18 = v17; | |
6201 v19 = v42; | |
6202 v20 = v39; | |
6203 if ( v18 < v42 ) | |
6204 { | |
6205 v21 = v18; | |
6206 v18 = v42; | |
6207 v19 = v21; | |
6208 } | |
6209 if ( v18 < v39 ) | |
6210 { | |
6211 v22 = v18; | |
6212 v18 = v39; | |
6213 v20 = v22; | |
6214 } | |
6215 if ( v19 < (signed int)v20 ) | |
6216 { | |
6217 v23 = v20; | |
6218 v20 = v19; | |
6219 v19 = v23; | |
6220 } | |
6221 v44 = ((unsigned int)(11 * v19) >> 5) + (v20 >> 2) + v18; | |
6222 v24 = v16->uRadius; | |
6223 if ( (signed int)v44 < v24 ) | |
6224 v6 += ((unsigned __int64)(30i64 * (signed int)(v44 << 16) / v24) >> 16) - 30; | |
6225 } | |
6226 } | |
6227 } | |
6228 } | |
6229 } | |
6230 } | |
6231 | |
6232 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i) | |
6233 { | |
6234 auto p = pStationaryLightsStack->pLights + i; | |
6235 v26 = abs(p->vPosition.x - x); | |
6236 if ( v26 <= p->uRadius) | |
6237 { | |
6238 v40 = abs(p->vPosition.y - y); | |
6239 if ( v40 <= p->uRadius) | |
6240 { | |
6241 v37 = abs(p->vPosition.z - z); | |
6242 if ( v37 <= p->uRadius) | |
6243 { | |
6244 v27 = v26; | |
6245 v28 = v40; | |
6246 v29 = v37; | |
6247 if ( v27 < v40 ) | |
6248 { | |
6249 v30 = v27; | |
6250 v27 = v40; | |
6251 v28 = v30; | |
6252 } | |
6253 if ( v27 < v37 ) | |
6254 { | |
6255 v31 = v27; | |
6256 v27 = v37; | |
6257 v29 = v31; | |
6258 } | |
6259 if ( v28 < (signed int)v29 ) | |
6260 { | |
6261 v32 = v29; | |
6262 v29 = v28; | |
6263 v28 = v32; | |
6264 } | |
6265 v45 = ((unsigned int)(11 * v28) >> 5) + (v29 >> 2) + v27; | |
6266 v33 = p->uRadius; | |
6267 if ( (signed int)v45 < v33 ) | |
6268 v6 += ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / v33) >> 16) - 30; | |
6269 } | |
6270 } | |
6271 } | |
6272 } | |
6273 | |
6274 if ( v6 <= 31 ) | |
6275 { | |
6276 if ( v6 < 0 ) | |
6277 v6 = 0; | |
6278 } | |
6279 else | |
6280 { | |
6281 v6 = 31; | |
6282 } | |
6283 return v6; | |
6284 } | |
6285 | |
6286 //----- (00406051) -------------------------------------------------------- | |
6287 __int16 stru262_TurnBased::StartTurn() | |
6288 { | |
6289 stru262_TurnBased *v1; // esi@1 | |
6290 int v2; // ecx@1 | |
6291 int v3; // ebx@1 | |
6292 char *v4; // edi@1 | |
6293 int v5; // eax@4 | |
6294 int v6; // eax@12 | |
6295 char *v7; // eax@15 | |
6296 TurnBased_QueueElem *v8; // edi@17 | |
6297 unsigned int v9; // edx@23 | |
6298 char *v10; // eax@26 | |
6299 int v11; // eax@30 | |
6300 int v12; // ebx@30 | |
6301 char *v13; // edi@31 | |
6302 int v15; // [sp+Ch] [bp-10h]@5 | |
6303 TurnBased_QueueElem *v16; // [sp+10h] [bp-Ch]@3 | |
6304 int v17; // [sp+14h] [bp-8h]@2 | |
6305 int v18; // [sp+14h] [bp-8h]@16 | |
6306 signed int v19; // [sp+18h] [bp-4h]@1 | |
6307 int v20; // [sp+18h] [bp-4h]@14 | |
6308 | |
6309 v1 = this; | |
6310 v2 = 0; | |
6311 v19 = 0; | |
6312 v3 = v1->uActorQueueSize; | |
6313 v1->field_1C = 0; | |
6314 v4 = (char *)&v1->pQueue[v3].field_4; | |
6315 do | |
6316 { | |
6317 v17 = v2; | |
6318 if ( v1->uActorQueueSize <= v2 ) | |
6319 goto LABEL_11; | |
6320 v16 = v1->pQueue; | |
6321 while ( 1 ) | |
6322 { | |
6323 v5 = v16->uPackedID; | |
848 | 6324 if ( PID_TYPE(v16->uPackedID) == OBJECT_Player) |
0 | 6325 break; |
6326 LABEL_8: | |
6327 ++v17; | |
6328 ++v16; | |
6329 if ( v17 >= v1->uActorQueueSize ) | |
6330 goto LABEL_11; | |
6331 } | |
848 | 6332 v15 = PID_ID(v5); |
6333 if ( !pPlayers[(PID_ID(v5)) + 1]->CanAct() || v19 != v15 ) | |
0 | 6334 { |
6335 v2 = 0; | |
6336 goto LABEL_8; | |
6337 } | |
6338 v2 = 0; | |
6339 LABEL_11: | |
6340 if ( v17 == v1->uActorQueueSize ) | |
6341 { | |
6342 *(int *)v4 = 100; | |
6343 v6 = 8 * v19; | |
862 | 6344 LOBYTE(v6) = PID(OBJECT_Player,v19); |
0 | 6345 *((int *)v4 + 2) = v2; |
6346 *((int *)v4 - 1) = v6; | |
6347 *((int *)v4 + 1) = v2; | |
6348 ++v3; | |
6349 v4 += 16; | |
6350 } | |
6351 ++v19; | |
6352 } | |
6353 while ( v19 < 4 ); | |
6354 v1->uActorQueueSize = v3; | |
6355 v20 = v2; | |
6356 if ( ai_arrays_size > v2 ) | |
6357 { | |
6358 v7 = (char *)&v1->pQueue[v3].field_4; | |
6359 do | |
6360 { | |
6361 v18 = v2; | |
6362 if ( v1->uActorQueueSize > v2 ) | |
6363 { | |
6364 v8 = v1->pQueue; | |
6365 do | |
6366 { | |
848 | 6367 if ( PID_TYPE(v8->uPackedID) == OBJECT_Actor && ai_near_actors_ids[v20] == PID_ID(v8->uPackedID) ) |
0 | 6368 break; |
6369 ++v18; | |
6370 ++v8; | |
6371 } | |
6372 while ( v18 < v1->uActorQueueSize ); | |
6373 v2 = 0; | |
6374 } | |
6375 if ( v18 == v1->uActorQueueSize ) | |
6376 { | |
390 | 6377 v9 = ai_near_actors_ids[v20]; |
0 | 6378 *(int *)v7 = 1; |
6379 *((int *)v7 + 2) = v2; | |
862 | 6380 *((int *)v7 - 1) = PID(OBJECT_Actor,v9); |
0 | 6381 *((int *)v7 + 1) = v2; |
6382 ++v3; | |
6383 v7 += 16; | |
6384 } | |
6385 ++v20; | |
6386 } | |
6387 while ( v20 < ai_arrays_size ); | |
6388 } | |
6389 ++v1->field_0; | |
6390 v1->uActorQueueSize = v3; | |
6391 v1->field_10 = 100; | |
6392 if ( v3 > 0 ) | |
6393 { | |
6394 v10 = (char *)&v1->pQueue[0].field_4; | |
6395 do | |
6396 { | |
6397 if ( *(int *)v10 <= 0 ) | |
6398 *(int *)v10 = 100; | |
6399 ++v2; | |
6400 v10 += 16; | |
6401 } | |
6402 while ( v2 < v1->uActorQueueSize ); | |
6403 } | |
6404 LOWORD(v11) = v1->_4063A1(); | |
6405 v12 = 0; | |
6406 if ( v1->uActorQueueSize > 0 ) | |
6407 { | |
6408 v13 = (char *)&v1->pQueue[0].field_4; | |
6409 do | |
6410 { | |
848 | 6411 v11 = PID_TYPE(*((int *)v13 - 1)); |
0 | 6412 if ( (char)v11 == 4 ) |
6413 break; | |
6414 if ( *(int *)v13 > 0 ) | |
6415 break; | |
6416 LOWORD(v11) = v1->_40680F(v12++); | |
6417 v13 += 16; | |
6418 } | |
6419 while ( v12 < v1->uActorQueueSize ); | |
6420 } | |
6421 return v11; | |
6422 } | |
6423 // 4F75D8: using guessed type int ai_arrays_size; | |
6424 | |
6425 //----- (004061CA) -------------------------------------------------------- | |
6426 void stru262_TurnBased::NextTurn() | |
6427 { | |
6428 stru262_TurnBased *v1; // esi@1 | |
6429 TurnBased_QueueElem *v2; // ebp@1 | |
6430 int v3; // ebx@1 | |
6431 int v4; // edi@7 | |
6432 Actor *v5; // eax@9 | |
6433 int v6; // ecx@9 | |
6434 signed int v7; // ebx@17 | |
6435 int v8; // ebp@27 | |
6436 TurnBased_QueueElem *v9; // edi@28 | |
6437 int v10; // ecx@30 | |
6438 unsigned __int16 v11; // ax@30 | |
6439 signed int v12; // edx@35 | |
6440 signed int v13; // [sp+10h] [bp-4h]@7 | |
6441 | |
6442 v1 = this; | |
6443 _404544(); | |
6444 v2 = v1->pQueue; | |
6445 v3 = 0; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6446 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6447 uActiveCharacter = PID_ID(v1->pQueue[0].uPackedID) + 1; |
0 | 6448 else |
6449 uActiveCharacter = 0; | |
6450 viewparams->bRedrawGameUI = 1; | |
6451 if ( v1->field_1C ) | |
6452 { | |
6453 pTurnEngine->field_18 |= 2u; | |
6454 return; | |
6455 } | |
6456 pTurnEngine->field_18 &= 0xFFFFFFFDu; | |
6457 if ( v1->pQueue[0].field_4 <= 0 ) | |
6458 return; | |
6459 v4 = 0; | |
6460 v13 = 0; | |
6461 if ( v1->uActorQueueSize <= 0 ) | |
6462 goto LABEL_27; | |
6463 do | |
6464 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6465 if (PID_TYPE(v2->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6466 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6467 v5 = &pActors[PID_ID(v2->uPackedID)]; |
0 | 6468 LOWORD(v6) = v5->uAIState; |
6469 if ( (short)v6 == 4 | |
6470 || (short)v6 == 8 | |
6471 || (short)v6 == 2 | |
6472 || (short)v6 == 3 | |
6473 || (short)v6 == 12 | |
6474 || (short)v6 == 13 | |
6475 || (short)v6 == 18 | |
6476 || (short)v6 == 17 ) | |
6477 { | |
6478 v7 = v5->uCurrentActionLength; | |
6479 v5->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
6480 if ( (signed int)v5->uCurrentActionTime < v7 ) | |
6481 { | |
6482 v13 = 1; | |
6483 LABEL_19: | |
6484 v3 = 0; | |
6485 goto LABEL_20; | |
6486 } | |
6487 v6 = (signed __int16)v6; | |
6488 if ( (signed __int16)v6 == 4 ) | |
6489 { | |
6490 v3 = 0; | |
6491 v5->uAIState = Dead; | |
6492 v5->uCurrentActionTime = 0; | |
6493 v5->uCurrentActionLength = 0; | |
6494 v5->UpdateAnimation(); | |
6495 } | |
6496 else | |
6497 { | |
6498 if ( v6 != 8 ) | |
6499 goto LABEL_19; | |
6500 v3 = 0; | |
848 | 6501 Actor::AI_StandOrBored(PID_ID(v2->uPackedID), ai_near_actors_targets_pid[PID_ID(v2->uPackedID)], 32, 0); |
0 | 6502 } |
6503 } | |
6504 } | |
6505 LABEL_20: | |
6506 ++v4; | |
6507 ++v2; | |
6508 } | |
6509 while ( v4 < v1->uActorQueueSize ); | |
6510 if ( v13 != v3 ) | |
6511 { | |
6512 v1->field_18 |= 1u; | |
6513 return; | |
6514 } | |
6515 LABEL_27: | |
6516 v1->field_18 &= 0xFFFFFFFEu; | |
6517 v8 = 0; | |
6518 if ( v1->uActorQueueSize > v3 ) | |
6519 { | |
6520 v9 = v1->pQueue; | |
6521 do | |
6522 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6523 if (PID_TYPE(v9->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6524 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6525 v10 = PID_ID(v9->uPackedID); |
0 | 6526 v11 = pActors[v10].uAIState; |
6527 if ( v11 != 5 ) | |
6528 { | |
6529 if ( v11 != 4 && v11 != 11 && v11 != 19 ) | |
6530 { | |
6531 if ( v11 != 17 ) | |
6532 { | |
417 | 6533 v12 = ai_near_actors_targets_pid[v10]; |
0 | 6534 v9->uActionLength = v3; |
414 | 6535 Actor::AI_StandOrBored(v10, v12, 32, (AIDirection *)v3); |
0 | 6536 } |
6537 } | |
6538 } | |
6539 } | |
6540 ++v8; | |
6541 ++v9; | |
6542 } | |
6543 while ( v8 < v1->uActorQueueSize ); | |
6544 } | |
6545 v1->field_4 = 3; | |
6546 pParty->uTimePlayed += __PAIR__(v3, 213); | |
6547 _494035_timed_effects__water_walking_damage__etc(); | |
6548 v1->uActionPointsLeft = 130; | |
6549 } | |
6550 | |
6551 //----- (004063A1) -------------------------------------------------------- | |
6552 int stru262_TurnBased::_4063A1() | |
6553 { | |
6554 stru262_TurnBased *v1; // esi@1 | |
6555 int v2; // ebp@1 | |
6556 signed int result; // eax@1 | |
6557 int v4; // edx@1 | |
6558 int v5; // edx@3 | |
6559 int v6; // edi@4 | |
6560 int v7; // ecx@5 | |
6561 Actor *v8; // ecx@11 | |
6562 unsigned __int16 v9; // dx@12 | |
6563 int v10; // edi@16 | |
6564 int v11; // edx@17 | |
6565 char v12; // zf@18 | |
6566 | |
6567 v1 = this; | |
6568 _404544(); | |
6569 v2 = (int)&v1->pQueue[0].field_4; | |
6570 result = 1; | |
6571 viewparams->bRedrawGameUI = 1; | |
6572 v4 = v1->pQueue[0].field_4; | |
6573 if ( v4 ) | |
6574 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6575 if (PID_TYPE(v1->pQueue[0].uPackedID) == OBJECT_Player) |
0 | 6576 { |
6577 v5 = v1->uActorQueueSize; | |
6578 while ( 1 ) | |
6579 { | |
6580 v6 = 0; | |
6581 if ( v5 > 0 ) | |
6582 { | |
6583 v7 = (int)&v1->pQueue[0].field_4; | |
6584 do | |
6585 { | |
6586 --*(int *)v7; | |
6587 v5 = v1->uActorQueueSize; | |
6588 ++v6; | |
6589 v7 += 16; | |
6590 } | |
6591 while ( v6 < v5 ); | |
6592 } | |
6593 --v1->field_10; | |
6594 if ( v1->field_10 <= 0 ) | |
6595 break; | |
6596 if ( !*(int *)v2 ) | |
6597 goto LABEL_9; | |
6598 } | |
6599 LABEL_24: | |
6600 result = 1; | |
6601 } | |
6602 else | |
6603 { | |
848 | 6604 v8 = &pActors[PID_ID(v1->pQueue[0].uPackedID)]; |
0 | 6605 if ( v4 > 0 ) |
6606 { | |
6607 do | |
6608 { | |
6609 v9 = v8->uAIState; | |
6610 if ( v9 == 5 ) | |
6611 break; | |
6612 if ( v9 == 4 || v9 == 19 || v9 == 11 ) | |
6613 break; | |
6614 v10 = 0; | |
6615 if ( v1->uActorQueueSize > 0 ) | |
6616 { | |
6617 v11 = (int)&v1->pQueue[0].field_4; | |
6618 do | |
6619 { | |
6620 v12 = (*(int *)v11)-- == 1; | |
6621 if ( v12 ) | |
6622 *(int *)(v11 + 4) = 0; | |
6623 ++v10; | |
6624 v11 += 16; | |
6625 } | |
6626 while ( v10 < v1->uActorQueueSize ); | |
6627 } | |
6628 --v1->field_10; | |
6629 if ( v1->field_10 <= 0 ) | |
6630 goto LABEL_24; | |
6631 } | |
6632 while ( *(int *)v2 > 0 ); | |
6633 } | |
6634 LABEL_9: | |
6635 result = 0; | |
6636 } | |
6637 } | |
6638 return result; | |
6639 } | |
6640 | |
6641 //----- (00406457) -------------------------------------------------------- | |
6642 int stru262_TurnBased::_406457(int a2) | |
6643 { | |
6644 stru262_TurnBased *v2; // esi@1 | |
6645 signed int v3; // eax@1 | |
6646 signed int v4; // ecx@2 | |
6647 char *v5; // edx@2 | |
6648 signed int v6; // eax@2 | |
6649 int result; // eax@11 | |
6650 int v8; // edx@13 | |
6651 int v9; // ecx@14 | |
6652 char v10; // zf@15 | |
6653 | |
6654 v2 = this; | |
6655 v3 = *(&this->field_0 + 4 * (a2 + 2)); | |
848 | 6656 if ( (*((char *)&this->field_0 + 16 * PID_TYPE(a2 + 2))) == OBJECT_Player) |
6657 { | |
6658 v4 = PID_ID(v3); | |
6659 v5 = (char *)&pParty->pTurnBasedPlayerRecoveryTimes[PID_ID(v3)]; | |
0 | 6660 v6 = *(int *)v5; |
6661 if ( *(int *)v5 ) | |
6662 *(int *)v5 = 0; | |
6663 else | |
6664 v6 = pPlayers[v4 + 1]->GetAttackRecoveryTime(0); | |
6665 if ( v6 < 30 ) | |
6666 v6 = 30; | |
6667 } | |
6668 else | |
6669 { | |
848 | 6670 v6 = pMonsterStats->pInfos[pActors[PID_ID(v3)].pMonsterInfo.uID].uRecoveryTime; |
0 | 6671 } |
6672 v2->pQueue[a2].field_4 = v6; | |
6673 v2->_404544(); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6674 if (PID_TYPE(v2->pQueue[0].uPackedID) == OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6675 uActiveCharacter = PID_ID(v2->pQueue[0].uPackedID) + 1; |
0 | 6676 else |
6677 uActiveCharacter = 0; | |
6678 result = (int)&v2->pQueue[0].field_4; | |
6679 viewparams->bRedrawGameUI = 1; | |
6680 while ( *(int *)result > 0 ) | |
6681 { | |
6682 if ( v2->field_10 <= 0 ) | |
6683 break; | |
6684 v8 = 0; | |
6685 if ( v2->uActorQueueSize > 0 ) | |
6686 { | |
6687 v9 = (int)&v2->pQueue[0].field_4; | |
6688 do | |
6689 { | |
6690 v10 = (*(int *)v9)-- == 1; | |
6691 if ( v10 ) | |
6692 *(int *)(v9 + 4) = 0; | |
6693 ++v8; | |
6694 v9 += 16; | |
6695 } | |
6696 while ( v8 < v2->uActorQueueSize ); | |
6697 } | |
6698 --v2->field_10; | |
6699 if ( v2->field_10 <= 0 ) | |
6700 break; | |
6701 } | |
6702 return result; | |
6703 } | |
6704 | |
6705 //----- (0040652A) -------------------------------------------------------- | |
6706 void stru262_TurnBased::_40652A() | |
6707 { | |
848 | 6708 int *v1; // edx@2 |
0 | 6709 Actor *v2; // eax@5 |
6710 unsigned __int16 v3; // si@5 | |
6711 unsigned int v4; // esi@8 | |
6712 int v5; // [sp+Ch] [bp-4h]@1 | |
6713 | |
6714 v5 = 0; | |
6715 if ( this->uActorQueueSize > 0 ) | |
6716 { | |
848 | 6717 v1 = &this->pQueue[0].field_4; |
0 | 6718 do |
6719 { | |
6720 if ( !*(int *)v1 ) | |
6721 { | |
848 | 6722 if ( PID_TYPE(*(v1 - 4)) == OBJECT_Player) |
0 | 6723 return; |
848 | 6724 v2 = &pActors[PID_ID(*(v1 - 1))]; |
0 | 6725 v3 = v2->uAIState; |
141 | 6726 if (v3 == Standing || v3 == Fleeing || v3 == Fidgeting) |
0 | 6727 { |
6728 v4 = pMonsterStats->pInfos[v2->pMonsterInfo.uID].uRecoveryTime; | |
6729 *(int *)v1 = v4; | |
6730 if ( (signed __int64)v2->pActorBuffs[7].uExpireTime > 0 ) | |
6731 *(int *)v1 = 2 * v4; | |
6732 } | |
6733 } | |
6734 ++v5; | |
6735 v1 += 16; | |
6736 } | |
6737 while ( v5 < this->uActorQueueSize ); | |
6738 } | |
6739 } | |
6740 | |
6741 //----- (004065B0) -------------------------------------------------------- | |
322 | 6742 void stru262_TurnBased::_4065B0() |
0 | 6743 { |
6744 stru262_TurnBased *v1; // esi@1 | |
6745 signed int v2; // eax@1 | |
6746 int v3; // ebx@6 | |
6747 int v4; // edi@7 | |
6748 unsigned int v5; // edi@14 | |
6749 | |
6750 v1 = this; | |
6751 LOWORD(v2) = _404544(); | |
6752 if ( v1->pQueue[0].field_4 <= 0 | |
848 | 6753 || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, PID_TYPE(v1->pQueue[0].uPackedID) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (PID_ID(v2)) + 1, uActiveCharacter = v2), |
0 | 6754 viewparams->bRedrawGameUI = 1, |
6755 v1->pQueue[0].field_4 <= 0) ) | |
6756 { | |
6757 v3 = 0; | |
6758 if ( v1->uActorQueueSize > 0 ) | |
6759 { | |
6760 v4 = (int)v1->pQueue; | |
6761 do | |
6762 { | |
6763 v2 = *(int *)v4; | |
848 | 6764 if ( PID_TYPE(*(char *)v4) == OBJECT_Player || *(int *)(v4 + 4) > 0 ) |
0 | 6765 break; |
6766 if ( *(int *)(v4 + 8) <= 0 ) | |
6767 { | |
6768 LOWORD(v2) = v2 & 3; | |
6769 if ( (char)v2 == 3 ) | |
6770 LOWORD(v2) = v1->_40680F(v3); | |
6771 } | |
6772 ++v3; | |
6773 v4 += 16; | |
6774 } | |
6775 while ( v3 < v1->uActorQueueSize ); | |
6776 } | |
6777 } | |
6778 v5 = 0; | |
6779 if ( v1->uActorQueueSize > 0 ) | |
6780 { | |
6781 do | |
322 | 6782 v1->_406648(v5++); |
0 | 6783 while ( (signed int)v5 < v1->uActorQueueSize ); |
6784 } | |
6785 } | |
6786 | |
6787 //----- (00406648) -------------------------------------------------------- | |
322 | 6788 void stru262_TurnBased::_406648(unsigned int a2) |
0 | 6789 { |
6790 TurnBased_QueueElem *v1; // ecx@1 | |
6791 int v3; // eax@1 | |
6792 unsigned int v4; // ebx@2 | |
6793 Actor *v5; // esi@2 | |
6794 signed int v6; // edi@5 | |
6795 int v7; // ecx@6 | |
6796 int v8; // eax@6 | |
6797 int v9; // eax@7 | |
6798 int v10; // eax@8 | |
6799 int v11; // eax@9 | |
6800 int v12; // eax@10 | |
6801 int v13; // eax@11 | |
6802 int v14; // eax@14 | |
6803 unsigned int v15; // ecx@14 | |
6804 unsigned int v16; // edx@14 | |
6805 int v17; // eax@17 | |
6806 int v18; // eax@20 | |
6807 char v19; // al@24 | |
6808 unsigned int v21; // [sp-8h] [bp-50h]@16 | |
6809 int v22; // [sp-8h] [bp-50h]@17 | |
6810 AIDirection *v23; // [sp-4h] [bp-4Ch]@14 | |
6811 unsigned int v24; // [sp-4h] [bp-4Ch]@17 | |
6812 char v25; // [sp-4h] [bp-4Ch]@20 | |
6813 AIDirection a3; // [sp+Ch] [bp-3Ch]@2 | |
6814 AIDirection a4; // [sp+28h] [bp-20h]@2 | |
6815 TurnBased_QueueElem *v28; // [sp+44h] [bp-4h]@1 | |
6816 unsigned int a2a; // [sp+50h] [bp+8h]@2 | |
6817 | |
6818 v1 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); | |
6819 v28 = v1; | |
6820 v3 = v1->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6821 if (PID_TYPE(v1->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6822 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6823 v4 = PID_ID(v3); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6824 a2a = ai_near_actors_targets_pid[PID_ID(v3)]; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6825 memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[PID_ID(v3)], &a3, 0), sizeof(a3)); |
0 | 6826 memcpy(&a4, &a3, sizeof(a4)); |
848 | 6827 v5 = &pActors[PID_ID(v3)]; |
0 | 6828 LOWORD(v3) = v5->uAIState; |
6829 if ( (short)v3 != Dead ) | |
6830 { | |
6831 if ( (short)v3 != Disabled ) | |
6832 { | |
6833 if ( (short)v3 != Removed ) | |
6834 { | |
6835 v6 = v5->uCurrentActionLength; | |
6836 v5->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
6837 if ( (signed int)v5->uCurrentActionTime >= v6 ) | |
6838 { | |
6839 v7 = (signed __int16)v3; | |
6840 v8 = (signed __int16)v3 - 2; | |
6841 if ( !v8 ) | |
6842 { | |
6843 v19 = stru_50C198.special_ability_use_check(&pActors[v4], v4); | |
6844 stru_50FE08.Add( | |
6845 v28->uPackedID, | |
6846 5120, | |
6847 v5->vPosition.x, | |
6848 v5->vPosition.y, | |
6849 v5->vPosition.z + ((signed int)v5->uActorHeight >> 1), | |
6850 v19, | |
6851 1); | |
6852 goto LABEL_25; | |
6853 } | |
6854 v9 = v8 - 1; | |
6855 if ( v9 ) | |
6856 { | |
6857 v10 = v9 - 1; | |
6858 if ( !v10 ) | |
6859 goto LABEL_21; | |
6860 v11 = v10 - 4; | |
6861 if ( !v11 ) | |
6862 goto LABEL_25; | |
6863 v12 = v11 - 4; | |
6864 if ( v12 ) | |
6865 { | |
6866 v13 = v12 - 1; | |
6867 if ( v13 ) | |
6868 { | |
6869 if ( v13 != Dead ) | |
6870 { | |
6871 if ( v7 != 4 ) | |
6872 { | |
6873 v14 = rand(); | |
6874 v15 = v4; | |
6875 v23 = &a4; | |
6876 v16 = a2a; | |
6877 if ( !(v14 % 2) ) | |
6878 { | |
414 | 6879 Actor::AI_Bored(v4, a2a, &a4); |
322 | 6880 return; |
0 | 6881 } |
6882 v21 = 64; | |
6883 LABEL_26: | |
413 | 6884 Actor::AI_Stand(v15, v16, v21, v23); |
322 | 6885 return; |
0 | 6886 } |
6887 LABEL_21: | |
6888 v5->uCurrentActionTime = 0; | |
6889 v5->uCurrentActionLength = 0; | |
6890 v5->uAIState = Dead; | |
322 | 6891 pActors[v4].UpdateAnimation(); |
6892 return; | |
0 | 6893 } |
6894 v24 = v5->pMonsterInfo.uSpellSkillAndMastery2; | |
6895 v22 = 3; | |
6896 v17 = v5->pMonsterInfo.uSpell2ID; | |
6897 } | |
6898 else | |
6899 { | |
6900 v24 = v5->pMonsterInfo.uSpellSkillAndMastery1; | |
6901 v22 = 2; | |
6902 v17 = v5->pMonsterInfo.uSpell1ID; | |
6903 } | |
860 | 6904 Actor::SpellAttack(v4, &a4, v17, v22, v24); |
0 | 6905 LABEL_25: |
6906 v16 = a2a; | |
6907 v23 = &a4; | |
6908 v21 = 0; | |
6909 v15 = v4; | |
6910 goto LABEL_26; | |
6911 } | |
6912 v18 = v5->pMonsterInfo.uMissleAttack2Type; | |
6913 v25 = 1; | |
6914 } | |
6915 else | |
6916 { | |
6917 v18 = v5->pMonsterInfo.uMissleAttack1Type; | |
6918 v25 = 0; | |
6919 } | |
860 | 6920 Actor::RangedAttack(v4, &a4, v18, v25); |
0 | 6921 goto LABEL_25; |
6922 } | |
6923 } | |
6924 } | |
6925 } | |
6926 } | |
6927 } | |
6928 // 50FE08: using guessed type stru298 stru_50FE08; | |
6929 | |
6930 //----- (0040680F) -------------------------------------------------------- | |
6931 __int16 stru262_TurnBased::_40680F(int a2) | |
6932 { | |
6933 TurnBased_QueueElem *v2; // eax@1 | |
848 | 6934 unsigned int v3; // eax@1 |
6935 unsigned int v4; // edi@2 | |
0 | 6936 Actor *v5; // ebx@2 |
6937 unsigned int *v6; // esi@7 | |
6938 AIDirection *v7; // esi@10 | |
6939 int v8; // eax@10 | |
6940 unsigned int v9; // ecx@10 | |
6941 signed int v10; // eax@13 | |
6942 unsigned __int8 v11; // sf@19 | |
6943 unsigned __int8 v12; // of@19 | |
6944 int v13; // esi@29 | |
6945 bool v14; // eax@29 | |
6946 unsigned __int8 v15; // cl@33 | |
6947 AIDirection a3; // [sp+Ch] [bp-44h]@10 | |
6948 AIDirection v18; // [sp+28h] [bp-28h]@10 | |
6949 int a2a; // [sp+44h] [bp-Ch]@2 | |
6950 unsigned int v20; // [sp+48h] [bp-8h]@10 | |
6951 TurnBased_QueueElem *v21; // [sp+4Ch] [bp-4h]@1 | |
6952 signed int v22; // [sp+58h] [bp+8h]@10 | |
6953 | |
6954 v2 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2)); | |
6955 v21 = v2; | |
6956 v2->uActionLength = 0; | |
848 | 6957 v3 = v2->uPackedID; |
0 | 6958 if ( (unsigned __int8)v3 & 3 ) |
6959 { | |
848 | 6960 v3 = PID_ID(v3); |
0 | 6961 v4 = v3; |
848 | 6962 a2a = v3; |
6963 v5 = &pActors[v3]; | |
0 | 6964 LOWORD(v3) = v5->uAIState; |
6965 if ( (short)v3 != 5 ) | |
6966 { | |
6967 if ( (short)v3 != 4 && (short)v3 != 11 && (short)v3 != 19 && (short)v3 != 17 ) | |
6968 { | |
417 | 6969 v6 = (unsigned int *)&ai_near_actors_targets_pid[(int)v4]; |
6970 Actor::_SelectTarget((unsigned int)v4, &ai_near_actors_targets_pid[(int)v4], true); | |
0 | 6971 if ( v5->pMonsterInfo.uHostilityType && !*v6 ) |
6972 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
6973 v22 = *v6; | |
862 | 6974 v7 = Actor::GetDirectionInfo(PID(OBJECT_Actor,(int)v4), *v6, &a3, 0); |
0 | 6975 v8 = v5->uActorRadius; |
6976 memcpy(&a3, v7, sizeof(a3)); | |
6977 memcpy(&v18, &a3, sizeof(v18)); | |
6978 v9 = a3.uDistance - v8; | |
6979 v20 = a3.uDistance - v8; | |
6980 if ( ((a3.uDistance - v8) & 0x80000000u) != 0 ) | |
6981 { | |
6982 v9 = 0; | |
6983 v20 = 0; | |
6984 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
6985 if (PID_TYPE(v22) == OBJECT_Actor) |
848 | 6986 v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3); |
0 | 6987 else |
6988 v10 = 4; | |
6989 if ( v10 == 1 ) | |
6990 { | |
6991 if ( (double)(signed int)v20 < 307.2 ) | |
6992 goto LABEL_25; | |
6993 } | |
6994 else | |
6995 { | |
6996 if ( v10 == 2 ) | |
6997 { | |
6998 v12 = __OFSUB__(v9, 1024); | |
6999 v11 = ((v9 - 1024) & 0x80000000u) != 0; | |
7000 } | |
7001 else | |
7002 { | |
7003 if ( v10 == 3 ) | |
7004 { | |
7005 v12 = __OFSUB__(v9, 2560); | |
7006 v11 = ((v9 - 2560) & 0x80000000u) != 0; | |
7007 } | |
7008 else | |
7009 { | |
7010 if ( v10 != 4 ) | |
7011 goto LABEL_26; | |
7012 v12 = __OFSUB__(v9, 5120); | |
7013 v11 = ((v9 - 5120) & 0x80000000u) != 0; | |
7014 } | |
7015 } | |
7016 if ( v11 ^ v12 ) | |
7017 { | |
7018 LABEL_25: | |
7019 v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
7020 goto LABEL_26; | |
7021 } | |
7022 } | |
7023 LABEL_26: | |
7024 if ( v5->pMonsterInfo.uHostilityType != 4 || !v22 || (signed int)v9 >= 5120 ) | |
7025 { | |
7026 v13 = a2a; | |
7027 goto LABEL_47; | |
7028 } | |
7029 v13 = a2a; | |
7030 v14 = stru_50C198.special_ability_use_check(v5, a2a); | |
7031 if ( v14 == 1 ) | |
7032 { | |
7033 if ( v5->pMonsterInfo.uMissleAttack2Type ) | |
7034 { | |
861 | 7035 Actor::MissileAttack2(v13, v22, &v18); |
0 | 7036 goto LABEL_43; |
7037 } | |
7038 } | |
7039 else | |
7040 { | |
7041 if ( v14 > 1 && v14 <= 3 ) | |
7042 { | |
7043 if ( v14 == 2 ) | |
7044 v15 = v5->pMonsterInfo.uSpell1ID; | |
7045 else | |
7046 v15 = v5->pMonsterInfo.uSpell2ID; | |
7047 if ( v15 ) | |
7048 { | |
7049 if ( v14 == 2 ) | |
861 | 7050 Actor::SpellAttack1(v13, v22, &v18); |
0 | 7051 else |
861 | 7052 Actor::SpellAttack2(v13, v22, &v18); |
0 | 7053 goto LABEL_43; |
7054 } | |
7055 goto LABEL_44; | |
7056 } | |
7057 if ( v5->pMonsterInfo.uMissleAttack1Type ) | |
7058 { | |
861 | 7059 Actor::MissileAttack1(v13, v22, &v18); |
0 | 7060 LABEL_43: |
848 | 7061 //v3 = v21; |
0 | 7062 v21->field_C = 1; |
7063 LABEL_48: | |
848 | 7064 v21->uActionLength = v5->uCurrentActionLength; |
7065 //return (signed __int16)v3; | |
7066 return (signed __int16)&v21; | |
0 | 7067 } |
7068 } | |
7069 LABEL_44: | |
7070 if ( (double)(signed int)v20 < 307.2 ) | |
7071 { | |
861 | 7072 Actor::MeleeAttack(v13, v22, &v18); |
848 | 7073 //v3 = v21; |
0 | 7074 v21->field_C = 3; |
7075 goto LABEL_48; | |
7076 } | |
7077 LABEL_47: | |
413 | 7078 Actor::AI_Stand(v13, v22, 0x40u, &v18); |
848 | 7079 //v3 = v21; |
0 | 7080 v21->field_C = 0; |
7081 goto LABEL_48; | |
7082 } | |
7083 } | |
7084 } | |
7085 return (signed __int16)v3; | |
7086 } | |
7087 | |
7088 //----- (00406A63) -------------------------------------------------------- | |
7089 void stru262_TurnBased::_406A63() | |
7090 { | |
7091 stru262_TurnBased *v1; // ebx@1 | |
7092 int v2; // esi@1 | |
7093 unsigned __int8 v3; // zf@1 | |
7094 unsigned __int8 v4; // sf@1 | |
7095 signed int v5; // ecx@4 | |
7096 AIDirection a3; // [sp+8h] [bp-44h]@5 | |
7097 AIDirection v7; // [sp+24h] [bp-28h]@5 | |
7098 unsigned int v8; // [sp+40h] [bp-Ch]@5 | |
7099 signed int a2; // [sp+44h] [bp-8h]@1 | |
7100 TurnBased_QueueElem *v10; // [sp+48h] [bp-4h]@2 | |
7101 | |
7102 v1 = this; | |
7103 v2 = 0; | |
7104 this->field_8 = 64; | |
7105 dword_50C994 = 0; | |
7106 uActiveCharacter = 0; | |
7107 v3 = this->uActorQueueSize == 0; | |
7108 v4 = this->uActorQueueSize < 0; | |
7109 a2 = 0; | |
7110 if ( !(v4 | v3) ) | |
7111 { | |
7112 v10 = this->pQueue; | |
7113 while ( 1 ) | |
7114 { | |
7115 v5 = v10->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7116 if (PID_TYPE(v10->uPackedID) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7117 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7118 v8 = ai_near_actors_targets_pid[PID_ID(v5)]; |
0 | 7119 memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7)); |
7120 if ( !v1->_406D10(a2) ) | |
848 | 7121 Actor::AI_Stand(PID_ID(v10->uPackedID), v8, 0x20u, &v7); |
0 | 7122 } |
7123 ++a2; | |
7124 ++v10; | |
7125 if ( a2 >= v1->uActorQueueSize ) | |
7126 break; | |
7127 v2 = 0; | |
7128 } | |
7129 } | |
7130 } | |
7131 // 50C994: using guessed type int dword_50C994; | |
7132 | |
7133 //----- (00406AFE) -------------------------------------------------------- | |
7134 void stru262_TurnBased::_406AFE() | |
7135 { | |
7136 stru262_TurnBased *v1; // edi@1 | |
7137 TurnBased_QueueElem *v2; // ebx@2 | |
7138 int v3; // esi@4 | |
7139 int v4; // ecx@5 | |
7140 AIDirection a3; // [sp+4h] [bp-48h]@5 | |
7141 AIDirection v6; // [sp+20h] [bp-2Ch]@5 | |
7142 stru262_TurnBased *v7; // [sp+3Ch] [bp-10h]@1 | |
7143 unsigned int v8; // [sp+40h] [bp-Ch]@4 | |
7144 unsigned int v9; // [sp+44h] [bp-8h]@5 | |
7145 int v10; // [sp+48h] [bp-4h]@1 | |
7146 | |
7147 v10 = 0; | |
7148 v1 = this; | |
7149 v7 = this; | |
7150 if ( this->uActorQueueSize > 0 ) | |
7151 { | |
7152 v2 = this->pQueue; | |
7153 do | |
7154 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7155 if (PID_TYPE(v2->uPackedID) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7156 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7157 v3 = PID_ID(v2->uPackedID); |
0 | 7158 v8 = v3; |
7159 if ( pActors[v3].CanAct() ) | |
7160 { | |
7161 v4 = v2->uPackedID; | |
417 | 7162 v9 = ai_near_actors_targets_pid[v3]; |
0 | 7163 memcpy(&v6, Actor::GetDirectionInfo(v4, v9, &a3, 0), sizeof(v6)); |
413 | 7164 Actor::AI_Stand(v8, v9, 0x20u, &v6); |
0 | 7165 v2->field_C = 0; |
7166 v2->uActionLength = 0; | |
7167 v1 = v7; | |
7168 } | |
7169 } | |
7170 ++v10; | |
7171 ++v2; | |
7172 } | |
7173 while ( v10 < v1->uActorQueueSize ); | |
7174 } | |
7175 v1->field_4 = 2; | |
7176 v1->field_8 = 100; | |
7177 } | |
7178 | |
7179 //----- (00406B9F) -------------------------------------------------------- | |
7180 int stru262_TurnBased::_406B9F() | |
7181 { | |
7182 signed int result; // eax@1 | |
7183 unsigned __int8 v2; // zf@1 | |
7184 unsigned __int8 v3; // sf@1 | |
7185 int v4; // esi@4 | |
7186 unsigned int v5; // esi@5 | |
7187 Actor *v6; // ebx@5 | |
7188 unsigned __int16 v7; // cx@15 | |
7189 AIDirection a3; // [sp+0h] [bp-50h]@15 | |
7190 AIDirection v9; // [sp+1Ch] [bp-34h]@15 | |
7191 signed int a1; // [sp+38h] [bp-18h]@4 | |
7192 stru262_TurnBased *thisa; // [sp+3Ch] [bp-14h]@1 | |
7193 unsigned int v12; // [sp+40h] [bp-10h]@5 | |
7194 unsigned int v13; // [sp+44h] [bp-Ch]@8 | |
7195 TurnBased_QueueElem *v14; // [sp+48h] [bp-8h]@2 | |
7196 signed int a2; // [sp+4Ch] [bp-4h]@1 | |
7197 | |
7198 result = 0; | |
7199 thisa = this; | |
7200 v2 = this->uActorQueueSize == 0; | |
7201 v3 = this->uActorQueueSize < 0; | |
7202 a2 = 0; | |
7203 if ( !(v3 | v2) ) | |
7204 { | |
7205 v14 = this->pQueue; | |
7206 while ( 1 ) | |
7207 { | |
7208 v4 = v14->uPackedID; | |
7209 a1 = v14->uPackedID; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7210 if (PID_TYPE(a1) != OBJECT_Player) |
0 | 7211 { |
848 | 7212 v5 = PID_ID(v4); |
0 | 7213 v12 = v5; |
7214 v6 = &pActors[v5]; | |
7215 if ( SHIDWORD(v6->pActorBuffs[5].uExpireTime) < result | |
7216 || SHIDWORD(v6->pActorBuffs[5].uExpireTime) <= result && LODWORD(v6->pActorBuffs[5].uExpireTime) <= result ) | |
7217 v13 = result; | |
7218 else | |
7219 v13 = 1; | |
7220 if ( SHIDWORD(v6->pActorBuffs[6].uExpireTime) >= result | |
7221 && (SHIDWORD(v6->pActorBuffs[6].uExpireTime) > result || LODWORD(v6->pActorBuffs[6].uExpireTime) > result) ) | |
7222 result = 1; | |
7223 if ( !(v13 | result | v6->uAIState == 5 | v6->uAIState == 11 | v6->uAIState == 19) ) | |
7224 { | |
417 | 7225 v13 = ai_near_actors_targets_pid[v5]; |
0 | 7226 memcpy(&v9, Actor::GetDirectionInfo(a1, v13, &a3, 0), sizeof(v9)); |
7227 v7 = v6->uAIState; | |
7228 if ( v7 == 6 || v7 == 1 ) | |
7229 { | |
7230 if ( (double)(signed int)v9.uDistance < 307.2 ) | |
7231 goto LABEL_26; | |
7232 } | |
7233 v6->uCurrentActionTime += pEventTimer->uTimeElapsed; | |
7234 if ( (signed int)v6->uCurrentActionTime > v6->uCurrentActionLength ) | |
7235 { | |
7236 if ( v7 == 4 ) | |
7237 { | |
7238 v6->uCurrentActionTime = 0; | |
7239 v6->uCurrentActionLength = 0; | |
7240 v6->uAIState = Dead; | |
7241 v6->UpdateAnimation(); | |
7242 } | |
7243 if ( !thisa->_406D10(a2) ) | |
7244 LABEL_26: | |
413 | 7245 Actor::AI_Stand(v12, v13, 0x20u, &v9); |
0 | 7246 } |
7247 } | |
7248 } | |
7249 ++a2; | |
7250 result = (signed int)thisa; | |
7251 ++v14; | |
7252 if ( a2 >= thisa->uActorQueueSize ) | |
7253 break; | |
7254 result = 0; | |
7255 } | |
7256 } | |
7257 return result; | |
7258 } | |
7259 | |
7260 //----- (00406D10) -------------------------------------------------------- | |
7261 bool stru262_TurnBased::_406D10(signed int a2) | |
7262 { | |
7263 int v2; // ecx@1 | |
920 | 7264 //int v3; // ecx@2 |
7265 Actor *actor; // ebx@2 | |
7266 //unsigned __int16 v5; // dx@2 | |
0 | 7267 int *v6; // esi@7 |
7268 TurnBased_QueueElem *v7; // edi@7 | |
7269 int v8; // eax@7 | |
7270 AIDirection *v9; // esi@10 | |
7271 int v10; // eax@10 | |
7272 unsigned int v11; // ecx@10 | |
920 | 7273 unsigned __int8 pHostileType; // al@12 |
0 | 7274 unsigned __int8 v13; // sf@16 |
7275 unsigned __int8 v14; // of@16 | |
7276 unsigned int v15; // edx@22 | |
7277 unsigned int v16; // ecx@23 | |
7278 TurnBased_QueueElem *v17; // eax@25 | |
7279 double v18; // st7@33 | |
7280 double v19; // st6@33 | |
7281 int v21; // [sp-8h] [bp-5Ch]@23 | |
7282 int v22; // [sp-8h] [bp-5Ch]@26 | |
7283 AIDirection *v23; // [sp-4h] [bp-58h]@23 | |
7284 int v24; // [sp-4h] [bp-58h]@26 | |
7285 AIDirection a3; // [sp+Ch] [bp-48h]@10 | |
7286 AIDirection pDir; // [sp+28h] [bp-2Ch]@10 | |
7287 int v27; // [sp+44h] [bp-10h]@33 | |
7288 unsigned int v28; // [sp+48h] [bp-Ch]@10 | |
7289 TurnBased_QueueElem *v29; // [sp+4Ch] [bp-8h]@7 | |
7290 unsigned int uActorID; // [sp+50h] [bp-4h]@2 | |
7291 unsigned int a2a; // [sp+5Ch] [bp+8h]@7 | |
7292 | |
920 | 7293 __debugbreak();//ñðàáàòûâàåò ïðè ïîøàãîâîì ðåæèìå ïîñëå ïÿòè øàãîâ |
0 | 7294 v2 = *(&this->field_0 + 4 * (a2 + 2)); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7295 if (PID_TYPE(v2) == OBJECT_Player) |
0 | 7296 return 0; |
920 | 7297 uActorID = PID_ID(v2); |
7298 //uActorID = v3; | |
7299 actor = &pActors[uActorID]; | |
7300 //v5 = v4->uAIState; | |
7301 if ( actor->uAIState == 5 || actor->uAIState == 4 || actor->uAIState == 11 || actor->uAIState == 19 || actor->uAIState == 17 ) | |
0 | 7302 return 1; |
920 | 7303 v6 = &ai_near_actors_targets_pid[uActorID]; |
0 | 7304 v7 = &pTurnEngine->pQueue[a2]; |
7305 v8 = *v6; | |
7306 v29 = &pTurnEngine->pQueue[a2]; | |
7307 a2a = v8; | |
920 | 7308 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true); |
7309 if ( actor->pMonsterInfo.uHostilityType && !*v6 ) | |
7310 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
0 | 7311 v9 = Actor::GetDirectionInfo(v7->uPackedID, a2a, &a3, 0); |
920 | 7312 v10 = actor->uActorRadius; |
0 | 7313 memcpy(&a3, v9, sizeof(a3)); |
7314 memcpy(&pDir, &a3, sizeof(pDir)); | |
7315 v11 = a3.uDistance - v10; | |
7316 v28 = a3.uDistance - v10; | |
7317 if ( ((a3.uDistance - v10) & 0x80000000u) != 0 ) | |
7318 { | |
7319 v11 = 0; | |
7320 v28 = 0; | |
7321 } | |
920 | 7322 pHostileType = actor->pMonsterInfo.uHostilityType; |
7323 if ( pHostileType == 1 ) | |
0 | 7324 { |
7325 if ( (double)(signed int)v28 >= 307.2 ) | |
7326 goto LABEL_21; | |
920 | 7327 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
0 | 7328 goto LABEL_21; |
7329 } | |
920 | 7330 if ( pHostileType == 2 ) |
0 | 7331 { |
7332 v14 = __OFSUB__(v11, 1024); | |
7333 v13 = ((v11 - 1024) & 0x80000000u) != 0; | |
7334 } | |
7335 else | |
7336 { | |
920 | 7337 if ( pHostileType != 3 ) |
0 | 7338 goto LABEL_21; |
7339 v14 = __OFSUB__(v11, 2560); | |
7340 v13 = ((v11 - 2560) & 0x80000000u) != 0; | |
7341 } | |
7342 if ( v13 ^ v14 ) | |
920 | 7343 { |
7344 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
7345 } | |
0 | 7346 LABEL_21: |
920 | 7347 if ( (signed __int64)actor->pActorBuffs[4].uExpireTime > 0 ) |
7348 { | |
0 | 7349 if ( (signed int)v11 < 10240 ) |
7350 { | |
920 | 7351 Actor::Flee(uActorID, a2a, 0, &pDir); |
7352 v29->field_C = 4; | |
7353 v29->uActionLength = actor->uCurrentActionLength; | |
7354 return 1; | |
7355 } | |
7356 Actor::_4032B2(uActorID, a2a, 1024, 0); | |
7357 v29->field_C = 2; | |
7358 v29->uActionLength = actor->uCurrentActionLength; | |
7359 return 1; | |
7360 } | |
7361 if ( actor->pMonsterInfo.uHostilityType != 4 ) | |
0 | 7362 goto LABEL_46; |
920 | 7363 if ( !(actor->uAttributes & 0x020000) || actor->pMonsterInfo.uAIType == 1 ) |
7364 { | |
7365 if ( actor->pMonsterInfo.uAIType == 1 ) | |
7366 { | |
7367 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
7368 { | |
7369 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7370 v29->field_C = 4; | |
7371 v29->uActionLength = actor->uCurrentActionLength; | |
7372 return 1; | |
7373 } | |
7374 Actor::Flee(uActorID, a2a, 32, 0); | |
7375 v29->field_C = 4; | |
7376 v29->uActionLength = actor->uCurrentActionLength; | |
7377 return 1; | |
7378 } | |
7379 if ( actor->pMonsterInfo.uAIType == 2 ) | |
7380 { | |
7381 v27 = actor->sCurrentHP; | |
0 | 7382 v18 = (double)v27; |
920 | 7383 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.2; |
0 | 7384 if ( v19 > v18 && (signed int)v11 < 10240 ) |
7385 { | |
920 | 7386 if ( actor->pMonsterInfo.uMovementType == 5 ) |
7387 { | |
7388 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7389 v29->field_C = 4; | |
7390 v29->uActionLength = actor->uCurrentActionLength; | |
7391 return 1; | |
7392 } | |
7393 Actor::Flee(uActorID, a2a, 32, 0); | |
0 | 7394 v29->field_C = 4; |
920 | 7395 v29->uActionLength = actor->uCurrentActionLength; |
7396 return 1; | |
7397 } | |
7398 goto LABEL_39; | |
7399 } | |
7400 if ( actor->pMonsterInfo.uAIType == 3 ) | |
7401 { | |
7402 v27 = actor->sCurrentHP; | |
7403 v18 = (double)v27; | |
7404 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.1; | |
7405 if ( v19 > v18 && (signed int)v11 < 10240 ) | |
7406 { | |
7407 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
7408 { | |
7409 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7410 v29->field_C = 4; | |
7411 v29->uActionLength = actor->uCurrentActionLength; | |
7412 return 1; | |
7413 } | |
7414 Actor::Flee(uActorID, a2a, 32, 0); | |
7415 v29->field_C = 4; | |
7416 v29->uActionLength = actor->uCurrentActionLength; | |
0 | 7417 return 1; |
7418 } | |
7419 goto LABEL_39; | |
7420 } | |
7421 } | |
7422 LABEL_39: | |
7423 if ( (double)(signed int)v28 < 307.2 ) | |
7424 return 0; | |
7425 if ( (signed int)v11 < 5120 ) | |
7426 { | |
920 | 7427 if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 ) |
860 | 7428 Actor::Pursue1(uActorID, a2a, uActorID, 32, &pDir); |
0 | 7429 else |
860 | 7430 Actor::Pursue2(uActorID, a2a, 32, &pDir, 307); |
920 | 7431 v29->field_C = 2; |
7432 v29->uActionLength = actor->uCurrentActionLength; | |
7433 return 1; | |
0 | 7434 } |
7435 LABEL_46: | |
920 | 7436 if ( !actor->pMonsterInfo.uMovementType ) |
7437 { | |
7438 Actor::_4032B2(uActorID, a2a, 1024, 32); | |
7439 v29->field_C = 2; | |
7440 v29->uActionLength = actor->uCurrentActionLength; | |
7441 return 1; | |
7442 } | |
7443 if ( actor->pMonsterInfo.uMovementType == 1 ) | |
7444 { | |
7445 Actor::_4032B2(uActorID, a2a, 2560, 32); | |
0 | 7446 v29->field_C = 2; |
920 | 7447 v29->uActionLength = actor->uCurrentActionLength; |
7448 return 1; | |
7449 } | |
7450 if ( actor->pMonsterInfo.uMovementType == 2 ) | |
7451 { | |
7452 Actor::_4032B2(uActorID, a2a, 5120, 32); | |
7453 v29->field_C = 2; | |
7454 v29->uActionLength = actor->uCurrentActionLength; | |
7455 return 1; | |
7456 } | |
7457 if ( actor->pMonsterInfo.uMovementType == 4 ) | |
0 | 7458 { |
7459 Actor::_4032B2(uActorID, a2a, 10240, 32); | |
7460 v29->field_C = 2; | |
920 | 7461 v29->uActionLength = actor->uCurrentActionLength; |
7462 return 1; | |
7463 } | |
7464 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
7465 { | |
7466 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7467 v29->field_C = 2; | |
7468 v29->uActionLength = actor->uCurrentActionLength; | |
7469 return 1; | |
0 | 7470 } |
7471 return 1; | |
7472 } | |
7473 | |
7474 //----- (00406FA8) -------------------------------------------------------- | |
7475 void stru262_TurnBased::_406FA8() | |
7476 { | |
7477 unsigned __int8 v1; // zf@1 | |
7478 unsigned __int8 v2; // sf@1 | |
7479 TurnBased_QueueElem *v3; // edi@2 | |
7480 int v4; // eax@4 | |
7481 Actor *v5; // ebx@4 | |
7482 unsigned __int16 v6; // cx@4 | |
7483 unsigned int *v7; // edx@8 | |
7484 unsigned int v8; // esi@8 | |
7485 unsigned __int8 v9; // of@13 | |
7486 AIDirection a3; // [sp+Ch] [bp-6Ch]@8 | |
7487 AIDirection v11; // [sp+28h] [bp-50h]@8 | |
7488 AIDirection a4; // [sp+44h] [bp-34h]@8 | |
7489 stru262_TurnBased *v13; // [sp+60h] [bp-18h]@1 | |
7490 TurnBased_QueueElem *v14; // [sp+64h] [bp-14h]@2 | |
7491 int uActorID; // [sp+68h] [bp-10h]@4 | |
7492 unsigned int a2; // [sp+6Ch] [bp-Ch]@8 | |
7493 int v17; // [sp+70h] [bp-8h]@1 | |
7494 unsigned int v18; // [sp+74h] [bp-4h]@2 | |
7495 | |
7496 v17 = 0; | |
7497 v1 = this->uActorQueueSize == 0; | |
7498 v2 = this->uActorQueueSize < 0; | |
7499 v13 = this; | |
7500 if ( !(v2 | v1) ) | |
7501 { | |
7502 v3 = this->pQueue; | |
7503 v18 = (char *)&pTurnEngine - (char *)this; | |
7504 v14 = this->pQueue; | |
7505 do | |
7506 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7507 if (PID_TYPE(v3->uPackedID) != OBJECT_Player) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7508 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7509 v4 = PID_ID(v3->uPackedID); |
0 | 7510 uActorID = v4; |
7511 v5 = &pActors[v4]; | |
7512 v6 = v5->uAIState; | |
7513 if ( v6 != 5 ) | |
7514 { | |
7515 if ( v6 != 11 ) | |
7516 { | |
7517 if ( v6 != 19 ) | |
7518 { | |
7519 if ( v6 != 17 ) | |
7520 { | |
417 | 7521 v7 = (unsigned int *)&ai_near_actors_targets_pid[v4]; |
0 | 7522 a2 = *v7; |
7523 v8 = a2; | |
417 | 7524 Actor::_SelectTarget(v4, (int *)v7, true); |
0 | 7525 memcpy(&v11, Actor::GetDirectionInfo(*(int *)((char *)&v3->uPackedID + v18), v8, &a3, 0), sizeof(v11)); |
7526 memcpy(&a4, &v11, sizeof(a4)); | |
7527 v5->uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
7528 if ( (signed int)v5->uCurrentActionTime >= v5->uCurrentActionLength ) | |
7529 { | |
7530 if (v5->uAIState == Dying) | |
7531 { | |
7532 v5->uCurrentActionTime = 0; | |
7533 v5->uCurrentActionLength = 0; | |
7534 v5->uAIState = Dead; | |
7535 v5->UpdateAnimation(); | |
7536 return; | |
7537 } | |
7538 if ( rand() % 2 ) | |
413 | 7539 Actor::AI_Stand(uActorID, a2, 0x40u, &a4); |
0 | 7540 else |
414 | 7541 Actor::AI_Bored(uActorID, a2, &a4); |
0 | 7542 } |
7543 } | |
7544 } | |
7545 } | |
7546 } | |
7547 } | |
7548 ++v17; | |
7549 v3 = v14 + 1; | |
7550 v9 = __OFSUB__(v17, v13->uActorQueueSize); | |
7551 v2 = v17 - v13->uActorQueueSize < 0; | |
7552 ++v14; | |
7553 } | |
7554 while ( v2 ^ v9 ); | |
7555 } | |
7556 } | |
7557 | |
7558 //----- (004070EF) -------------------------------------------------------- | |
7559 bool __fastcall sub_4070EF_prolly_collide_objects(unsigned int uObjID, unsigned int uObj2ID) | |
7560 { | |
7561 signed int v2; // eax@1 | |
7562 unsigned int v3; // ecx@1 | |
7563 signed int v4; // esi@1 | |
7564 int v5; // ecx@2 | |
7565 signed int v6; // eax@4 | |
7566 int v7; // eax@4 | |
7567 float v8; // ST24_4@5 | |
7568 double v9; // ST18_8@5 | |
7569 signed int v10; // eax@6 | |
7570 int v11; // ecx@6 | |
7571 signed int v12; // eax@7 | |
7572 int v13; // esi@7 | |
7573 int v14; // esi@8 | |
7574 int v15; // esi@9 | |
7575 signed int v16; // eax@11 | |
7576 int v17; // edi@11 | |
7577 int v18; // esi@11 | |
7578 int v19; // eax@13 | |
7579 float v20; // ST24_4@14 | |
7580 double v21; // ST18_8@14 | |
7581 signed int v22; // eax@15 | |
7582 int v23; // ebx@16 | |
7583 signed int v24; // ecx@16 | |
7584 int v25; // eax@18 | |
7585 int v26; // eax@28 | |
7586 BLVSector *v27; // edx@31 | |
7587 int v28; // ecx@31 | |
7588 BLVFace *v29; // ebx@32 | |
7589 Vec3_short_ *v30; // esi@32 | |
7590 int v31; // eax@32 | |
7591 int v32; // ST50_4@44 | |
7592 int v33; // ST54_4@44 | |
7593 int v34; // eax@44 | |
7594 char v35; // zf@44 | |
7595 int v36; // edi@44 | |
7596 int v37; // eax@45 | |
7597 signed int v38; // esi@45 | |
7598 int v39; // ST4C_4@49 | |
7599 signed __int64 v40; // qtt@50 | |
7600 __int16 v42; // bx@58 | |
7601 int v43; // [sp-8h] [bp-70h]@11 | |
7602 int v44; // [sp-4h] [bp-6Ch]@11 | |
7603 int v45; // [sp+Ch] [bp-5Ch]@32 | |
7604 __int16 v46; // [sp+10h] [bp-58h]@32 | |
7605 int v47; // [sp+18h] [bp-50h]@20 | |
7606 int v48; // [sp+1Ch] [bp-4Ch]@20 | |
7607 int v49; // [sp+20h] [bp-48h]@20 | |
7608 int v50; // [sp+24h] [bp-44h]@16 | |
7609 signed int v51; // [sp+24h] [bp-44h]@27 | |
7610 signed int v52; // [sp+28h] [bp-40h]@26 | |
7611 signed int v53; // [sp+2Ch] [bp-3Ch]@23 | |
7612 signed int v54; // [sp+30h] [bp-38h]@22 | |
7613 signed int v55; // [sp+34h] [bp-34h]@21 | |
7614 signed int v56; // [sp+38h] [bp-30h]@20 | |
7615 signed int v57; // [sp+3Ch] [bp-2Ch]@28 | |
7616 int v58; // [sp+44h] [bp-24h]@50 | |
7617 int v59; // [sp+48h] [bp-20h]@44 | |
7618 int v60; // [sp+50h] [bp-18h]@11 | |
7619 signed int v61; // [sp+50h] [bp-18h]@31 | |
7620 int v62; // [sp+54h] [bp-14h]@16 | |
7621 int v63; // [sp+58h] [bp-10h]@4 | |
7622 int v64; // [sp+5Ch] [bp-Ch]@4 | |
7623 int v65; // [sp+60h] [bp-8h]@4 | |
7624 int v66; // [sp+64h] [bp-4h]@7 | |
7625 | |
848 | 7626 v2 = PID_ID(uObjID); |
7627 v3 = PID_TYPE(uObjID) - 2; | |
0 | 7628 v4 = uObj2ID; |
7629 if ( v3 ) | |
7630 { | |
7631 v5 = v3 - 1; | |
7632 if ( v5 ) | |
7633 { | |
7634 if ( v5 != 2 ) | |
7635 return 0; | |
7636 v6 = v2; | |
7637 v63 = pLevelDecorations[v6].vPosition.x; | |
7638 v64 = pLevelDecorations[v6].vPosition.y; | |
7639 v65 = pLevelDecorations[v6].vPosition.z; | |
7640 v7 = pIndoor->GetSector(v63, v64, v65); | |
7641 } | |
7642 else | |
7643 { | |
7644 v63 = pActors[v2].vPosition.x; | |
7645 v64 = pActors[v2].vPosition.y; | |
7646 v8 = (double)pActors[v2].uActorHeight * 0.69999999; | |
7647 v9 = v8 + 6.7553994e15; | |
7648 v65 = LODWORD(v9) + pActors[v2].vPosition.z; | |
7649 v7 = pActors[v2].uSectorID; | |
7650 } | |
7651 } | |
7652 else | |
7653 { | |
7654 v10 = v2; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7655 v63 = pSpriteObjects[v10].vPosition.x; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7656 v64 = pSpriteObjects[v10].vPosition.y; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7657 v11 = pSpriteObjects[v10].vPosition.z; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7658 v7 = pSpriteObjects[v10].uSectorID; |
0 | 7659 v65 = v11; |
7660 } | |
7661 v66 = v7; | |
848 | 7662 v12 = PID_ID(v4); |
7663 v13 = PID_TYPE(v4) - 2; | |
0 | 7664 if ( v13 ) |
7665 { | |
7666 v14 = v13 - 1; | |
7667 if ( v14 ) | |
7668 { | |
7669 v15 = v14 - 1; | |
7670 if ( v15 ) | |
7671 { | |
7672 if ( v15 != 1 ) | |
7673 return 0; | |
7674 v16 = v12; | |
7675 v17 = pLevelDecorations[v16].vPosition.z; | |
7676 v18 = pLevelDecorations[v16].vPosition.x; | |
7677 v44 = pLevelDecorations[v16].vPosition.z; | |
7678 v60 = pLevelDecorations[v16].vPosition.y; | |
7679 v43 = pLevelDecorations[v16].vPosition.y; | |
7680 } | |
7681 else | |
7682 { | |
7683 v18 = pParty->vPosition.x; | |
7684 v17 = pParty->sEyelevel + pParty->vPosition.z; | |
7685 v60 = pParty->vPosition.y; | |
7686 v44 = pParty->sEyelevel + pParty->vPosition.z; | |
7687 v43 = pParty->vPosition.y; | |
7688 } | |
7689 v19 = pIndoor->GetSector(v18, v43, v44); | |
7690 } | |
7691 else | |
7692 { | |
7693 v60 = pActors[v12].vPosition.y; | |
7694 v18 = pActors[v12].vPosition.x; | |
7695 v20 = (double)pActors[v12].uActorHeight * 0.69999999; | |
7696 v21 = v20 + 6.7553994e15; | |
7697 v17 = LODWORD(v21) + pActors[v12].vPosition.z; | |
7698 v19 = pActors[v12].uSectorID; | |
7699 } | |
7700 } | |
7701 else | |
7702 { | |
7703 v22 = v12; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7704 v18 = pSpriteObjects[v22].vPosition.x; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7705 v17 = pSpriteObjects[v22].vPosition.z; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7706 v60 = pSpriteObjects[v22].vPosition.y; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
7707 v19 = pSpriteObjects[v22].uSectorID; |
0 | 7708 } |
7709 v62 = v19; | |
7710 v23 = v18 - v63; | |
7711 v50 = v17 - v65; | |
295 | 7712 v24 = integer_sqrt(v23 * v23 + (v60 - v64) * (v60 - v64) + v50 * v50); |
0 | 7713 if ( v24 > 5120 ) |
7714 return 0; | |
7715 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
7716 return 1; | |
7717 v25 = 65536; | |
7718 if ( v24 ) | |
7719 v25 = 65536 / v24; | |
7720 v49 = v23 * v25; | |
7721 v47 = v50 * v25; | |
7722 v48 = (v60 - v64) * v25; | |
7723 v56 = v63; | |
7724 if ( v63 < v18 ) | |
7725 { | |
7726 v55 = v18; | |
7727 } | |
7728 else | |
7729 { | |
7730 v56 = v18; | |
7731 v55 = v63; | |
7732 } | |
7733 v54 = v64; | |
7734 if ( v64 < v60 ) | |
7735 { | |
7736 v53 = v60; | |
7737 } | |
7738 else | |
7739 { | |
7740 v54 = v60; | |
7741 v53 = v64; | |
7742 } | |
7743 v52 = v65; | |
7744 if ( v65 < v17 ) | |
7745 { | |
7746 v51 = v17; | |
7747 } | |
7748 else | |
7749 { | |
7750 v52 = v17; | |
7751 v51 = v65; | |
7752 } | |
7753 v57 = 0; | |
7754 v26 = v66; | |
7755 while ( 2 ) | |
7756 { | |
7757 if ( v26 == v62 ) | |
7758 return 1; | |
7759 if ( v57 >= 30 || (v27 = pIndoor->pSectors, v28 = v66, v61 = 0, pIndoor->pSectors[v66].uNumPortals <= 0) ) | |
7760 break; | |
7761 while ( 1 ) | |
7762 { | |
7763 v29 = &pIndoor->pFaces[v27[v28].pPortals[v61]]; | |
7764 v30 = &pIndoor->pVertices[*v29->pVertexIDs]; | |
7765 v45 = *(int *)&v30->x; | |
7766 v46 = v30->z; | |
7767 v31 = v29->pFacePlane_old.vNormal.z * (v46 - v65) | |
7768 + v29->pFacePlane_old.vNormal.y * (SHIWORD(v45) - v64) | |
7769 + v29->pFacePlane_old.vNormal.x * ((signed __int16)v45 - v63); | |
7770 if ( v66 != v29->uSectorID ) | |
7771 v31 = -v31; | |
7772 if ( v31 >= 0 && (signed __int16)v45 != v63 && SHIWORD(v45) != v64 && v46 != v65 | |
7773 || v56 > v29->pBounding.x2 | |
7774 || v55 < v29->pBounding.x1 | |
7775 || v54 > v29->pBounding.y2 | |
7776 || v53 < v29->pBounding.y1 | |
7777 || v52 > v29->pBounding.z2 | |
7778 || v51 < v29->pBounding.z1 ) | |
7779 goto LABEL_54; | |
7780 v32 = (unsigned __int64)(v49 * (signed __int64)v29->pFacePlane_old.vNormal.x) >> 16; | |
7781 v33 = (unsigned __int64)(v47 * (signed __int64)v29->pFacePlane_old.vNormal.z) >> 16; | |
7782 v34 = (unsigned __int64)(v48 * (signed __int64)v29->pFacePlane_old.vNormal.y) >> 16; | |
7783 v35 = v32 + v33 + v34 == 0; | |
7784 v36 = v32 + v33 + v34; | |
7785 v59 = v32 + v33 + v34; | |
7786 if ( v35 ) | |
7787 goto LABEL_53; | |
7788 v37 = v65 * v29->pFacePlane_old.vNormal.z; | |
7789 v38 = -(v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y); | |
7790 if ( v36 <= 0 ) | |
7791 break; | |
7792 if ( v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y <= 0 ) | |
7793 goto LABEL_49; | |
7794 LABEL_53: | |
7795 v27 = pIndoor->pSectors; | |
7796 LABEL_54: | |
7797 ++v61; | |
7798 if ( v61 >= v27[v28].uNumPortals ) | |
7799 goto LABEL_55; | |
7800 } | |
7801 if ( v29->pFacePlane_old.dist + v37 + v63 * v29->pFacePlane_old.vNormal.x + v64 * v29->pFacePlane_old.vNormal.y < 0 ) | |
7802 goto LABEL_53; | |
7803 LABEL_49: | |
7804 v39 = abs(-(v29->pFacePlane_old.dist | |
7805 + v37 | |
7806 + v63 * v29->pFacePlane_old.vNormal.x | |
7807 + v64 * v29->pFacePlane_old.vNormal.y)) >> 14; | |
7808 if ( v39 > abs(v36) | |
7809 || (LODWORD(v40) = v38 << 16, HIDWORD(v40) = v38 >> 16, v58 = v40 / v59, (signed int)(v40 / v59) < 0) | |
7810 || !sub_4075DB( | |
7811 v63 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v49) >> 16) + 32768) >> 16), | |
7812 v64 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v48) >> 16) + 32768) >> 16), | |
7813 v65 + ((signed int)(((unsigned __int64)(v58 * (signed __int64)v47) >> 16) + 32768) >> 16), | |
7814 v29) ) | |
7815 { | |
7816 v28 = v66; | |
7817 goto LABEL_53; | |
7818 } | |
7819 if ( v29->uSectorID == v66 ) | |
7820 v42 = v29->uBackSectorID; | |
7821 else | |
7822 v42 = v29->uSectorID; | |
7823 v26 = v42; | |
7824 if ( v42 != v66 ) | |
7825 { | |
7826 ++v57; | |
7827 v66 = v42; | |
7828 continue; | |
7829 } | |
7830 break; | |
7831 } | |
7832 LABEL_55: | |
7833 if ( v66 != v62 ) | |
7834 return 0; | |
7835 return 1; | |
7836 } | |
7837 | |
7838 //----- (004075DB) -------------------------------------------------------- | |
7839 bool __fastcall sub_4075DB(int a1, int a2, int a3, BLVFace *a4) | |
7840 { | |
7841 BLVFace *v4; // eax@1 | |
7842 unsigned int v5; // esi@1 | |
7843 signed int v6; // esi@2 | |
7844 char v7; // zf@2 | |
7845 int v8; // edi@2 | |
7846 Vec3_short_ *v9; // ecx@3 | |
7847 int v10; // edx@4 | |
7848 signed int v11; // esi@7 | |
7849 Vec3_short_ *v12; // ecx@8 | |
7850 int v13; // edx@9 | |
7851 signed int v14; // esi@11 | |
7852 Vec3_short_ *v15; // ecx@12 | |
7853 int v16; // edx@13 | |
7854 int v17; // eax@14 | |
7855 bool v18; // esi@14 | |
7856 int v19; // ecx@14 | |
7857 int v20; // ecx@16 | |
7858 int v21; // edx@16 | |
7859 int v22; // eax@17 | |
7860 signed int v23; // ebx@18 | |
7861 int v24; // esi@20 | |
7862 signed int v25; // eax@22 | |
7863 signed __int64 v26; // qtt@22 | |
7864 bool result; // eax@25 | |
7865 int v28; // [sp+8h] [bp-14h]@14 | |
7866 int v29; // [sp+10h] [bp-Ch]@14 | |
7867 signed int a3a; // [sp+24h] [bp+8h]@14 | |
7868 int a4a; // [sp+28h] [bp+Ch]@2 | |
7869 | |
7870 v4 = a4; | |
7871 v5 = a4->uAttributes; | |
7872 if ( v5 & 0x100 ) | |
7873 { | |
7874 v6 = 0; | |
7875 v7 = a4->uNumVertices == 0; | |
7876 a4a = a1; | |
7877 v8 = a2; | |
7878 if ( !v7 ) | |
7879 { | |
7880 v9 = pIndoor->pVertices; | |
7881 do | |
7882 { | |
7883 dword_4F5D98_xs[v6] = v9[v4->pVertexIDs[v6]].x; | |
7884 v10 = v4->pVertexIDs[v6++]; | |
7885 dword_4F5CC4_ys[v6] = v9[v10].y; | |
7886 } | |
7887 while ( v6 < v4->uNumVertices ); | |
7888 } | |
7889 } | |
7890 else | |
7891 { | |
7892 v8 = a3; | |
7893 if ( v5 & 0x200 ) | |
7894 { | |
7895 v11 = 0; | |
7896 v7 = a4->uNumVertices == 0; | |
7897 a4a = a1; | |
7898 if ( !v7 ) | |
7899 { | |
7900 v12 = pIndoor->pVertices; | |
7901 do | |
7902 { | |
7903 dword_4F5D98_xs[v11] = v12[v4->pVertexIDs[v11]].x; | |
7904 v13 = v4->pVertexIDs[v11++]; | |
7905 dword_4F5CC4_ys[v11] = v12[v13].z; | |
7906 } | |
7907 while ( v11 < v4->uNumVertices ); | |
7908 } | |
7909 } | |
7910 else | |
7911 { | |
7912 v14 = 0; | |
7913 v7 = a4->uNumVertices == 0; | |
7914 a4a = a2; | |
7915 if ( !v7 ) | |
7916 { | |
7917 v15 = pIndoor->pVertices; | |
7918 do | |
7919 { | |
7920 dword_4F5D98_xs[v14] = v15[v4->pVertexIDs[v14]].y; | |
7921 v16 = v4->pVertexIDs[v14++]; | |
7922 dword_4F5CC4_ys[v14] = v15[v16].z; | |
7923 } | |
7924 while ( v14 < v4->uNumVertices ); | |
7925 } | |
7926 } | |
7927 } | |
7928 v17 = v4->uNumVertices; | |
7929 a3a = 0; | |
7930 dword_4F5D98_xs[v17] = dword_4F5D98_xs[0]; | |
7931 dword_4F5CC4_ys[v17 + 1] = dword_4F5CC4_ys[1]; | |
7932 v28 = v17; | |
7933 v18 = dword_4F5CC4_ys[1] >= v8; | |
7934 v19 = 0; | |
7935 v29 = 0; | |
7936 if ( v17 <= 0 ) | |
7937 goto LABEL_29; | |
7938 do | |
7939 { | |
7940 if ( a3a >= 2 ) | |
7941 break; | |
7942 v20 = v19; | |
7943 v21 = dword_4F5CC4_ys[v20 + 2]; | |
7944 if ( v18 ^ v21 >= v8 ) | |
7945 { | |
7946 v22 = dword_4F5D98_xs[v20 + 1]; | |
7947 if ( v22 >= a4a ) | |
7948 v23 = 0; | |
7949 else | |
7950 v23 = 2; | |
7951 v24 = v23 | dword_4F5D98_xs[v20] < a4a; | |
7952 if ( v24 != 3 ) | |
7953 { | |
7954 if ( !v24 | |
7955 || (v25 = v22 - dword_4F5D98_xs[v20], | |
7956 LODWORD(v26) = v25 << 16, | |
7957 HIDWORD(v26) = v25 >> 16, | |
7958 dword_4F5D98_xs[v20] | |
7959 + ((signed int)(((unsigned __int64)(v26 | |
7960 / (v21 - dword_4F5CC4_ys[v20 + 1]) | |
7961 * ((v8 - dword_4F5CC4_ys[v20 + 1]) << 16)) >> 16) | |
7962 + 32768) >> 16) >= a4a) ) | |
7963 ++a3a; | |
7964 } | |
7965 } | |
7966 v18 = v21 >= v8; | |
7967 v19 = v29++ + 1; | |
7968 } | |
7969 while ( v29 < v28 ); | |
7970 result = 1; | |
7971 if ( a3a != 1 ) | |
7972 LABEL_29: | |
7973 result = 0; | |
7974 return result; | |
7975 } | |
7976 | |
7977 //----- (004077F1) -------------------------------------------------------- | |
7978 bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *a4, BSPVertexBuffer *a5) | |
7979 { | |
7980 ODMFace *v5; // eax@1 | |
7981 unsigned int v6; // esi@1 | |
7982 signed int v7; // edi@1 | |
7983 char v8; // zf@2 | |
7984 unsigned __int16 *v9; // edx@3 | |
7985 int v10; // ecx@4 | |
7986 unsigned __int16 *v11; // edx@8 | |
7987 int v12; // ecx@9 | |
7988 int v13; // edx@12 | |
7989 int v14; // ecx@13 | |
7990 int v15; // esi@14 | |
7991 bool v16; // edi@14 | |
7992 int v17; // ecx@16 | |
7993 int v18; // edx@16 | |
7994 int v19; // eax@17 | |
7995 signed int v20; // ebx@18 | |
7996 int v21; // edi@20 | |
7997 signed int v22; // eax@22 | |
7998 signed __int64 v23; // qtt@22 | |
7999 bool result; // eax@25 | |
8000 int v25; // [sp+14h] [bp-8h]@14 | |
8001 int a4a; // [sp+28h] [bp+Ch]@2 | |
8002 signed int a5a; // [sp+2Ch] [bp+10h]@14 | |
8003 | |
8004 v5 = a4; | |
8005 v6 = a4->uAttributes; | |
8006 v7 = 0; | |
8007 if ( v6 & 0x100 ) | |
8008 { | |
8009 v8 = a4->uNumVertices == 0; | |
8010 a4a = a1; | |
8011 a3 = a2; | |
8012 if ( !v8 ) | |
8013 { | |
8014 v9 = v5->pVertexIDs; | |
8015 do | |
8016 { | |
8017 ++v7; | |
8018 dword_4F5BF4_xs[v7] = a5->pVertices[*v9].x; | |
8019 v10 = *v9; | |
8020 ++v9; | |
8021 dword_4F5B24_ys[v7] = a5->pVertices[v10].y; | |
8022 } | |
8023 while ( v7 < v5->uNumVertices ); | |
8024 } | |
8025 } | |
8026 else | |
8027 { | |
8028 if ( v6 & 0x200 ) | |
8029 { | |
8030 v8 = a4->uNumVertices == 0; | |
8031 a4a = a1; | |
8032 if ( !v8 ) | |
8033 { | |
8034 v11 = v5->pVertexIDs; | |
8035 do | |
8036 { | |
8037 ++v7; | |
8038 dword_4F5BF4_xs[v7] = a5->pVertices[*v11].x; | |
8039 v12 = *v11; | |
8040 ++v11; | |
8041 dword_4F5B24_ys[v7] = a5->pVertices[v12].z; | |
8042 } | |
8043 while ( v7 < v5->uNumVertices ); | |
8044 } | |
8045 } | |
8046 else | |
8047 { | |
8048 v8 = a4->uNumVertices == 0; | |
8049 a4a = a2; | |
8050 if ( !v8 ) | |
8051 { | |
8052 v13 = (int)v5->pVertexIDs; | |
8053 do | |
8054 { | |
8055 ++v7; | |
8056 dword_4F5BF4_xs[v7] = a5->pVertices[*(short *)v13].y; | |
8057 v14 = *(short *)v13; | |
8058 v13 += 2; | |
8059 dword_4F5B24_ys[v7] = a5->pVertices[v14].z; | |
8060 } | |
8061 while ( v7 < v5->uNumVertices ); | |
8062 } | |
8063 } | |
8064 } | |
8065 v15 = v5->uNumVertices; | |
8066 a5a = 0; | |
8067 dword_4F5BF4_xs[v15 + 1] = dword_4F5BF4_xs[1]; | |
8068 dword_4F5B24_ys[v15 + 1] = dword_4F5B24_ys[1]; | |
8069 v25 = 0; | |
8070 v16 = dword_4F5B24_ys[1] >= a3; | |
8071 if ( v15 <= 0 ) | |
8072 goto LABEL_29; | |
8073 do | |
8074 { | |
8075 if ( a5a >= 2 ) | |
8076 break; | |
8077 v17 = v25; | |
8078 v18 = dword_4F5B24_ys[v25 + 2]; | |
8079 if ( v16 ^ v18 >= a3 ) | |
8080 { | |
8081 v19 = dword_4F5BF4_xs[v17 + 2]; | |
8082 if ( v19 >= a4a ) | |
8083 v20 = 0; | |
8084 else | |
8085 v20 = 2; | |
8086 v21 = v20 | dword_4F5BF4_xs[v17 + 1] < a4a; | |
8087 if ( v21 != 3 ) | |
8088 { | |
8089 if ( !v21 | |
8090 || (v22 = v19 - dword_4F5BF4_xs[v17 + 1], | |
8091 LODWORD(v23) = v22 << 16, | |
8092 HIDWORD(v23) = v22 >> 16, | |
8093 dword_4F5BF4_xs[v17 + 1] | |
8094 + ((signed int)(((unsigned __int64)(v23 | |
8095 / (v18 - dword_4F5B24_ys[v17 + 1]) | |
8096 * ((a3 - dword_4F5B24_ys[v17 + 1]) << 16)) >> 16) | |
8097 + 32768) >> 16) >= a4a) ) | |
8098 ++a5a; | |
8099 } | |
8100 } | |
8101 ++v25; | |
8102 v16 = v18 >= a3; | |
8103 } | |
8104 while ( v25 < v15 ); | |
8105 result = 1; | |
8106 if ( a5a != 1 ) | |
8107 LABEL_29: | |
8108 result = 0; | |
8109 return result; | |
8110 } | |
8111 | |
8112 //----- (00407A1C) -------------------------------------------------------- | |
8113 bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v) | |
8114 { | |
8115 unsigned int v4; // esi@1 | |
8116 Vec3_int_ v5; // ST08_12@2 | |
8117 int v6; // edi@2 | |
8118 int v7; // ebx@2 | |
8119 int v8; // esi@2 | |
8120 signed int v9; // ecx@2 | |
8121 int v10; // eax@2 | |
8122 int v11; // ecx@4 | |
8123 int v12; // eax@4 | |
8124 int v13; // ebx@4 | |
8125 int v14; // edx@6 | |
8126 char *v15; // edi@16 | |
8127 ODMFace *v16; // esi@19 | |
8128 int v17; // ST34_4@25 | |
8129 int v18; // ST38_4@25 | |
8130 int v19; // eax@25 | |
8131 char v20; // zf@25 | |
8132 int v21; // ebx@25 | |
8133 int v22; // eax@26 | |
8134 signed int v23; // edi@26 | |
8135 int v24; // ST34_4@30 | |
8136 signed __int64 v25; // qtt@31 | |
8137 int v26; // eax@31 | |
8138 Vec3_int_ v27; // ST08_12@37 | |
8139 Vec3_int_ v28; // ST08_12@37 | |
8140 int v29; // edi@37 | |
8141 int v30; // ebx@37 | |
8142 int v31; // esi@37 | |
8143 signed int v32; // ecx@37 | |
8144 int v33; // eax@37 | |
8145 int v34; // ecx@39 | |
8146 int v35; // eax@39 | |
8147 int v36; // ebx@39 | |
8148 int v37; // edx@41 | |
8149 char *v38; // edi@51 | |
8150 ODMFace *v39; // esi@54 | |
8151 int v40; // ebx@60 | |
8152 int v41; // eax@61 | |
8153 signed int v42; // edi@61 | |
8154 signed __int64 v43; // qtt@66 | |
8155 int v44; // eax@66 | |
8156 Vec3_int_ v45; // ST08_12@73 | |
8157 int v46; // edi@73 | |
8158 int v47; // ebx@73 | |
8159 int v48; // esi@73 | |
8160 signed int v49; // ecx@73 | |
8161 int v50; // eax@73 | |
8162 int v51; // edx@75 | |
8163 int v52; // ecx@75 | |
8164 int v53; // eax@75 | |
8165 int v54; // ebx@75 | |
8166 int v55; // edi@77 | |
8167 int v56; // ecx@77 | |
8168 int v57; // eax@81 | |
8169 int v58; // esi@81 | |
8170 int v59; // eax@90 | |
8171 BLVSector *v60; // edx@90 | |
8172 int v61; // ecx@90 | |
8173 BLVFace *v62; // esi@91 | |
8174 int v63; // ST34_4@98 | |
8175 int v64; // ST30_4@98 | |
8176 int v65; // eax@98 | |
8177 int v66; // ebx@98 | |
8178 int v67; // eax@99 | |
8179 signed int v68; // edi@99 | |
8180 int v69; // ST2C_4@103 | |
8181 signed __int64 v70; // qtt@104 | |
8182 int v71; // eax@104 | |
8183 Vec3_int_ v72; // ST08_12@111 | |
8184 Vec3_int_ v73; // ST08_12@111 | |
8185 int v74; // edi@111 | |
8186 int v75; // ebx@111 | |
8187 int v76; // esi@111 | |
8188 signed int v77; // ecx@111 | |
8189 int v78; // eax@111 | |
8190 int v79; // edx@113 | |
8191 int v80; // ecx@113 | |
8192 int v81; // eax@113 | |
8193 int v82; // ebx@113 | |
8194 int v83; // edi@115 | |
8195 int v84; // ecx@115 | |
8196 int v85; // eax@119 | |
8197 int v86; // esi@119 | |
8198 int v87; // ecx@128 | |
8199 BLVSector *v88; // eax@128 | |
8200 int v89; // ecx@128 | |
8201 BLVFace *v90; // esi@129 | |
8202 int v91; // ebx@136 | |
8203 int v92; // eax@137 | |
8204 signed int v93; // edi@137 | |
8205 signed __int64 v94; // qtt@142 | |
8206 int v95; // eax@142 | |
8207 Vec3_int_ v97; // [sp-18h] [bp-94h]@1 | |
8208 int v98; // [sp-Ch] [bp-88h]@88 | |
8209 int v99; // [sp-Ch] [bp-88h]@126 | |
8210 int v100; // [sp-8h] [bp-84h]@88 | |
8211 int v101; // [sp-8h] [bp-84h]@126 | |
8212 int v102; // [sp-4h] [bp-80h]@88 | |
8213 int v103; // [sp-4h] [bp-80h]@126 | |
8214 int v104; // [sp+Ch] [bp-70h]@13 | |
8215 int v105; // [sp+Ch] [bp-70h]@48 | |
8216 int v106; // [sp+10h] [bp-6Ch]@18 | |
8217 int v107; // [sp+10h] [bp-6Ch]@98 | |
8218 int v108; // [sp+10h] [bp-6Ch]@104 | |
8219 int v109; // [sp+18h] [bp-64h]@25 | |
8220 int v110; // [sp+18h] [bp-64h]@31 | |
8221 int i; // [sp+18h] [bp-64h]@90 | |
8222 int v112; // [sp+18h] [bp-64h]@128 | |
8223 signed int v113; // [sp+20h] [bp-5Ch]@1 | |
8224 signed int v114; // [sp+24h] [bp-58h]@1 | |
8225 unsigned __int64 a4; // [sp+28h] [bp-54h]@1 | |
8226 unsigned int a4_8; // [sp+30h] [bp-4Ch]@1 | |
8227 int v117; // [sp+34h] [bp-48h]@4 | |
8228 int v118; // [sp+34h] [bp-48h]@39 | |
8229 int v119; // [sp+34h] [bp-48h]@75 | |
8230 int v120; // [sp+34h] [bp-48h]@113 | |
8231 int v121; // [sp+38h] [bp-44h]@4 | |
8232 int v122; // [sp+38h] [bp-44h]@39 | |
8233 int v123; // [sp+38h] [bp-44h]@76 | |
8234 int v124; // [sp+38h] [bp-44h]@114 | |
8235 int v125; // [sp+3Ch] [bp-40h]@4 | |
8236 int v126; // [sp+3Ch] [bp-40h]@39 | |
8237 int v127; // [sp+3Ch] [bp-40h]@77 | |
8238 int v128; // [sp+3Ch] [bp-40h]@115 | |
8239 int v129; // [sp+40h] [bp-3Ch]@11 | |
8240 int v130; // [sp+40h] [bp-3Ch]@46 | |
8241 int v131; // [sp+40h] [bp-3Ch]@78 | |
8242 int v132; // [sp+40h] [bp-3Ch]@116 | |
8243 int v133; // [sp+44h] [bp-38h]@10 | |
8244 int v134; // [sp+44h] [bp-38h]@45 | |
8245 int v135; // [sp+44h] [bp-38h]@81 | |
8246 int v136; // [sp+44h] [bp-38h]@119 | |
8247 int v137; // [sp+48h] [bp-34h]@7 | |
8248 int v138; // [sp+48h] [bp-34h]@42 | |
8249 int v139; // [sp+48h] [bp-34h]@82 | |
8250 int v140; // [sp+48h] [bp-34h]@120 | |
8251 int v141; // [sp+4Ch] [bp-30h]@6 | |
8252 int v142; // [sp+4Ch] [bp-30h]@41 | |
8253 int v143; // [sp+4Ch] [bp-30h]@75 | |
8254 int v144; // [sp+4Ch] [bp-30h]@113 | |
8255 int v145; // [sp+50h] [bp-2Ch]@5 | |
8256 int v146; // [sp+50h] [bp-2Ch]@40 | |
8257 int v147; // [sp+50h] [bp-2Ch]@75 | |
8258 int v148; // [sp+50h] [bp-2Ch]@113 | |
8259 int v149; // [sp+54h] [bp-28h]@4 | |
8260 int v150; // [sp+54h] [bp-28h]@39 | |
8261 int v151; // [sp+54h] [bp-28h]@75 | |
8262 int v152; // [sp+54h] [bp-28h]@113 | |
8263 int sDepth; // [sp+58h] [bp-24h]@17 | |
8264 int sDeptha; // [sp+58h] [bp-24h]@52 | |
8265 int sDepthb; // [sp+58h] [bp-24h]@90 | |
8266 char *a5; // [sp+5Ch] [bp-20h]@16 | |
8267 char *a5a; // [sp+5Ch] [bp-20h]@51 | |
8268 signed int a5b; // [sp+5Ch] [bp-20h]@83 | |
8269 signed int a5c; // [sp+5Ch] [bp-20h]@121 | |
8270 signed int v160; // [sp+60h] [bp-1Ch]@12 | |
8271 signed int v161; // [sp+60h] [bp-1Ch]@47 | |
8272 int v162; // [sp+60h] [bp-1Ch]@128 | |
8273 int v163; // [sp+64h] [bp-18h]@2 | |
8274 int outx; // [sp+68h] [bp-14h]@2 | |
8275 int outy; // [sp+6Ch] [bp-10h]@2 | |
8276 int outz; // [sp+70h] [bp-Ch]@2 | |
8277 Vec3_int_ pOut; // [sp+74h] [bp-8h]@2 | |
8278 int ya; // [sp+84h] [bp+8h]@60 | |
8279 int yb; // [sp+84h] [bp+8h]@136 | |
8280 int ve; // [sp+88h] [bp+Ch]@60 | |
8281 int va; // [sp+88h] [bp+Ch]@60 | |
8282 int vb; // [sp+88h] [bp+Ch]@66 | |
8283 int vf; // [sp+88h] [bp+Ch]@136 | |
8284 int vc; // [sp+88h] [bp+Ch]@136 | |
8285 int vd; // [sp+88h] [bp+Ch]@142 | |
8286 int v_4; // [sp+8Ch] [bp+10h]@60 | |
8287 int v_4a; // [sp+8Ch] [bp+10h]@65 | |
8288 int v_4b; // [sp+8Ch] [bp+10h]@136 | |
8289 int v_4c; // [sp+8Ch] [bp+10h]@141 | |
8290 int v_8; // [sp+90h] [bp+14h]@53 | |
8291 | |
8292 a4 = __PAIR__(z, x); | |
8293 v4 = stru_5C6E00->Atan2(v.x - x, v.y - z); | |
8294 v114 = 0; | |
8295 v97.z = y; | |
8296 v113 = 0; | |
8297 a4_8 = v4; | |
8298 *(_QWORD *)&v97.x = a4; | |
8299 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) | |
8300 { | |
8301 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
8302 v45.z = v.z; | |
8303 *(_QWORD *)&v45.x = *(_QWORD *)&v; | |
8304 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &v163); | |
8305 v46 = outy - pOut.y; | |
8306 v47 = v163 - outz; | |
8307 v48 = outx - pOut.x; | |
295 | 8308 v49 = integer_sqrt(v48 * v48 + v46 * v46 + v47 * v47); |
0 | 8309 v50 = 65536; |
8310 if ( v49 ) | |
8311 v50 = 65536 / v49; | |
8312 v51 = outx; | |
8313 v143 = v48 * v50; | |
8314 v52 = v46 * v50; | |
8315 v53 = v47 * v50; | |
8316 v54 = pOut.x; | |
8317 v147 = v52; | |
8318 v151 = v53; | |
8319 v119 = pOut.x; | |
8320 if ( pOut.x < outx ) | |
8321 { | |
8322 v123 = outx; | |
8323 } | |
8324 else | |
8325 { | |
8326 v119 = outx; | |
8327 v123 = pOut.x; | |
8328 } | |
8329 v55 = pOut.y; | |
8330 v56 = outy; | |
8331 v127 = pOut.y; | |
8332 if ( pOut.y < outy ) | |
8333 { | |
8334 v131 = outy; | |
8335 } | |
8336 else | |
8337 { | |
8338 v127 = outy; | |
8339 v131 = pOut.y; | |
8340 } | |
8341 v57 = v163; | |
8342 v58 = outz; | |
8343 v135 = outz; | |
8344 if ( outz < v163 ) | |
8345 { | |
8346 v139 = v163; | |
8347 } | |
8348 else | |
8349 { | |
8350 v135 = v163; | |
8351 v139 = outz; | |
8352 } | |
8353 a5b = 0; | |
8354 while ( !v114 ) | |
8355 { | |
8356 if ( a5b ) | |
8357 { | |
8358 v102 = v58; | |
8359 v100 = v55; | |
8360 v98 = v54; | |
8361 } | |
8362 else | |
8363 { | |
8364 v102 = v57; | |
8365 v100 = v56; | |
8366 v98 = v51; | |
8367 } | |
8368 v59 = pIndoor->GetSector(v98, v100, v102); | |
8369 v60 = pIndoor->pSectors; | |
8370 v61 = 116 * v59; | |
8371 sDepthb = 0; | |
8372 for ( i = 116 * v59; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
543
diff
changeset
|
8373 sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v61) |
0 | 8374 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61); |
8375 ++sDepthb ) | |
8376 { | |
8377 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
|
8378 if ( v62->Portal() |
0 | 8379 || v119 > v62->pBounding.x2 |
8380 || v123 < v62->pBounding.x1 | |
8381 || v127 > v62->pBounding.y2 | |
8382 || v131 < v62->pBounding.y1 | |
8383 || v135 > v62->pBounding.z2 | |
8384 || v139 < v62->pBounding.z1 | |
8385 || (v63 = (unsigned __int64)(v143 * (signed __int64)v62->pFacePlane_old.vNormal.x) >> 16, | |
8386 v64 = (unsigned __int64)(v151 * (signed __int64)v62->pFacePlane_old.vNormal.z) >> 16, | |
8387 v65 = (unsigned __int64)(v147 * (signed __int64)v62->pFacePlane_old.vNormal.y) >> 16, | |
8388 v20 = v63 + v64 + v65 == 0, | |
8389 v66 = v63 + v64 + v65, | |
8390 v107 = v63 + v64 + v65, | |
8391 v20) ) | |
8392 goto LABEL_107; | |
8393 v67 = outz * v62->pFacePlane_old.vNormal.z; | |
8394 v68 = -(v62->pFacePlane_old.dist | |
8395 + v67 | |
8396 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8397 + pOut.x * v62->pFacePlane_old.vNormal.x); | |
8398 if ( v66 <= 0 ) | |
8399 { | |
8400 if ( v62->pFacePlane_old.dist | |
8401 + v67 | |
8402 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8403 + pOut.x * v62->pFacePlane_old.vNormal.x < 0 ) | |
8404 goto LABEL_107; | |
8405 } | |
8406 else | |
8407 { | |
8408 if ( v62->pFacePlane_old.dist | |
8409 + v67 | |
8410 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8411 + pOut.x * v62->pFacePlane_old.vNormal.x > 0 ) | |
8412 goto LABEL_107; | |
8413 } | |
8414 v69 = abs(-(v62->pFacePlane_old.dist | |
8415 + v67 | |
8416 + pOut.y * v62->pFacePlane_old.vNormal.y | |
8417 + pOut.x * v62->pFacePlane_old.vNormal.x)) >> 14; | |
8418 if ( v69 <= abs(v66) ) | |
8419 { | |
8420 LODWORD(v70) = v68 << 16; | |
8421 HIDWORD(v70) = v68 >> 16; | |
8422 v71 = v70 / v107; | |
8423 v108 = v70 / v107; | |
8424 if ( v71 >= 0 ) | |
8425 { | |
8426 if ( sub_4075DB( | |
8427 pOut.x + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v143) >> 16) + 32768) >> 16), | |
8428 pOut.y + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v147) >> 16) + 32768) >> 16), | |
8429 outz + ((signed int)(((unsigned __int64)(v108 * (signed __int64)v151) >> 16) + 32768) >> 16), | |
8430 v62) ) | |
8431 { | |
8432 v114 = 1; | |
8433 break; | |
8434 } | |
8435 } | |
8436 } | |
8437 v61 = i; | |
8438 LABEL_107: | |
8439 v60 = pIndoor->pSectors; | |
8440 } | |
8441 ++a5b; | |
8442 if ( a5b >= 2 ) | |
8443 break; | |
8444 v57 = v163; | |
8445 v56 = outy; | |
8446 v51 = outx; | |
8447 v58 = outz; | |
8448 v55 = pOut.y; | |
8449 v54 = pOut.x; | |
8450 } | |
8451 v72.z = y; | |
8452 *(_QWORD *)&v72.x = a4; | |
8453 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz); | |
8454 v73.z = v.z; | |
8455 *(_QWORD *)&v73.x = *(_QWORD *)&v; | |
8456 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163); | |
8457 v74 = outy - pOut.y; | |
8458 v75 = v163 - outz; | |
8459 v76 = outx - pOut.x; | |
295 | 8460 v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75); |
0 | 8461 v78 = 65536; |
8462 if ( v77 ) | |
8463 v78 = 65536 / v77; | |
8464 v79 = outx; | |
8465 v144 = v76 * v78; | |
8466 v80 = v74 * v78; | |
8467 v81 = v75 * v78; | |
8468 v82 = pOut.x; | |
8469 v148 = v80; | |
8470 v152 = v81; | |
8471 v120 = pOut.x; | |
8472 if ( pOut.x < outx ) | |
8473 { | |
8474 v124 = outx; | |
8475 } | |
8476 else | |
8477 { | |
8478 v120 = outx; | |
8479 v124 = pOut.x; | |
8480 } | |
8481 v83 = pOut.y; | |
8482 v84 = outy; | |
8483 v128 = pOut.y; | |
8484 if ( pOut.y < outy ) | |
8485 { | |
8486 v132 = outy; | |
8487 } | |
8488 else | |
8489 { | |
8490 v128 = outy; | |
8491 v132 = pOut.y; | |
8492 } | |
8493 v85 = v163; | |
8494 v86 = outz; | |
8495 v136 = outz; | |
8496 if ( outz < v163 ) | |
8497 { | |
8498 v140 = v163; | |
8499 } | |
8500 else | |
8501 { | |
8502 v136 = v163; | |
8503 v140 = outz; | |
8504 } | |
8505 a5c = 0; | |
8506 while ( 1 ) | |
8507 { | |
8508 if ( v113 ) | |
8509 return !v114 || !v113; | |
8510 if ( a5c ) | |
8511 { | |
8512 v103 = v86; | |
8513 v101 = v83; | |
8514 v99 = v82; | |
8515 } | |
8516 else | |
8517 { | |
8518 v103 = v85; | |
8519 v101 = v84; | |
8520 v99 = v79; | |
8521 } | |
8522 v87 = pIndoor->GetSector(v99, v101, v103); | |
8523 v88 = pIndoor->pSectors; | |
8524 v89 = 116 * v87; | |
8525 v162 = 0; | |
8526 v112 = v89; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
543
diff
changeset
|
8527 if ( *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) |
0 | 8528 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 ) |
8529 break; | |
8530 LABEL_148: | |
8531 ++a5c; | |
8532 if ( a5c >= 2 ) | |
8533 return !v114 || !v113; | |
8534 v85 = v163; | |
8535 v84 = outy; | |
8536 v79 = outx; | |
8537 v86 = outz; | |
8538 v83 = pOut.y; | |
8539 v82 = pOut.x; | |
8540 } | |
8541 while ( 1 ) | |
8542 { | |
8543 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
|
8544 if ( v90->Portal() |
0 | 8545 || v120 > v90->pBounding.x2 |
8546 || v124 < v90->pBounding.x1 | |
8547 || v128 > v90->pBounding.y2 | |
8548 || v132 < v90->pBounding.y1 | |
8549 || v136 > v90->pBounding.z2 | |
8550 || v140 < v90->pBounding.z1 | |
8551 || (yb = (unsigned __int64)(v144 * (signed __int64)v90->pFacePlane_old.vNormal.x) >> 16, | |
8552 v_4b = (unsigned __int64)(v148 * (signed __int64)v90->pFacePlane_old.vNormal.y) >> 16, | |
8553 vf = (unsigned __int64)(v152 * (signed __int64)v90->pFacePlane_old.vNormal.z) >> 16, | |
8554 v20 = yb + vf + v_4b == 0, | |
8555 v91 = yb + vf + v_4b, | |
8556 vc = yb + vf + v_4b, | |
8557 v20) ) | |
8558 goto LABEL_145; | |
8559 v92 = outz * v90->pFacePlane_old.vNormal.z; | |
8560 v93 = -(v90->pFacePlane_old.dist | |
8561 + v92 | |
8562 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8563 + pOut.x * v90->pFacePlane_old.vNormal.x); | |
8564 if ( v91 <= 0 ) | |
8565 { | |
8566 if ( v90->pFacePlane_old.dist | |
8567 + v92 | |
8568 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8569 + pOut.x * v90->pFacePlane_old.vNormal.x < 0 ) | |
8570 goto LABEL_145; | |
8571 } | |
8572 else | |
8573 { | |
8574 if ( v90->pFacePlane_old.dist | |
8575 + v92 | |
8576 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8577 + pOut.x * v90->pFacePlane_old.vNormal.x > 0 ) | |
8578 goto LABEL_145; | |
8579 } | |
8580 v_4c = abs(-(v90->pFacePlane_old.dist | |
8581 + v92 | |
8582 + pOut.y * v90->pFacePlane_old.vNormal.y | |
8583 + pOut.x * v90->pFacePlane_old.vNormal.x)) >> 14; | |
8584 if ( v_4c <= abs(v91) ) | |
8585 { | |
8586 LODWORD(v94) = v93 << 16; | |
8587 HIDWORD(v94) = v93 >> 16; | |
8588 v95 = v94 / vc; | |
8589 vd = v94 / vc; | |
8590 if ( v95 >= 0 ) | |
8591 { | |
8592 if ( sub_4075DB( | |
8593 pOut.x + ((signed int)(((unsigned __int64)(vd * (signed __int64)v144) >> 16) + 32768) >> 16), | |
8594 pOut.y + ((signed int)(((unsigned __int64)(vd * (signed __int64)v148) >> 16) + 32768) >> 16), | |
8595 outz + ((signed int)(((unsigned __int64)(vd * (signed __int64)v152) >> 16) + 32768) >> 16), | |
8596 v90) ) | |
8597 { | |
8598 v113 = 1; | |
8599 goto LABEL_148; | |
8600 } | |
8601 } | |
8602 } | |
8603 v89 = v112; | |
8604 LABEL_145: | |
8605 v88 = pIndoor->pSectors; | |
8606 ++v162; | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
543
diff
changeset
|
8607 if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89) |
0 | 8608 + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) ) |
8609 goto LABEL_148; | |
8610 } | |
8611 } | |
8612 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz); | |
8613 v5.z = v.z; | |
8614 *(_QWORD *)&v5.x = *(_QWORD *)&v; | |
8615 Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v5, &outx, &outy, &v163); | |
8616 v6 = outy - pOut.y; | |
8617 v7 = v163 - outz; | |
8618 v8 = outx - pOut.x; | |
295 | 8619 v9 = integer_sqrt(v8 * v8 + v6 * v6 + v7 * v7); |
0 | 8620 v10 = 65536; |
8621 if ( v9 ) | |
8622 v10 = 65536 / v9; | |
8623 v125 = v8 * v10; | |
8624 v11 = v10; | |
8625 v12 = v7 * v10; | |
8626 v13 = pOut.x; | |
8627 v117 = v12; | |
8628 v121 = v6 * v11; | |
8629 v149 = pOut.x; | |
8630 if ( pOut.x < outx ) | |
8631 { | |
8632 v145 = outx; | |
8633 } | |
8634 else | |
8635 { | |
8636 v149 = outx; | |
8637 v145 = pOut.x; | |
8638 } | |
8639 v14 = outy; | |
8640 v141 = pOut.y; | |
8641 if ( pOut.y < outy ) | |
8642 { | |
8643 v137 = outy; | |
8644 } | |
8645 else | |
8646 { | |
8647 v141 = outy; | |
8648 v137 = pOut.y; | |
8649 } | |
8650 v133 = outz; | |
8651 if ( outz < v163 ) | |
8652 { | |
8653 v129 = v163; | |
8654 } | |
8655 else | |
8656 { | |
8657 v133 = v163; | |
8658 v129 = outz; | |
8659 } | |
8660 v160 = 0; | |
8661 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
8662 { | |
8663 v104 = 0; | |
8664 while ( 1 ) | |
8665 { | |
8666 v15 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
8667 a5 = (char *)&pOutdoor->pBModels[v104].pVertices; | |
8668 if ( sub_4088E9(v13, pOut.y, outx, v14, pOutdoor->pBModels[v104].vPosition.x, pOutdoor->pBModels[v104].vPosition.y) <= pOutdoor->pBModels[v104].sBoundingRadius + 128 ) | |
8669 { | |
8670 sDepth = 0; | |
8671 if ( *((int *)v15 + 2) > 0 ) | |
8672 break; | |
8673 } | |
8674 LABEL_36: | |
8675 ++v160; | |
8676 ++v104; | |
8677 if ( v160 >= (signed int)pOutdoor->uNumBModels ) | |
8678 goto LABEL_37; | |
8679 v14 = outy; | |
8680 v13 = pOut.x; | |
8681 } | |
8682 v106 = 0; | |
8683 while ( 1 ) | |
8684 { | |
8685 v16 = (ODMFace *)(v106 + *((int *)a5 + 4)); | |
8686 if ( v149 > v16->pBoundingBox.x2 | |
8687 || v145 < v16->pBoundingBox.x1 | |
8688 || v141 > v16->pBoundingBox.y2 | |
8689 || v137 < v16->pBoundingBox.y1 | |
8690 || v133 > v16->pBoundingBox.z2 | |
8691 || v129 < v16->pBoundingBox.z1 | |
8692 || (v17 = (unsigned __int64)(v125 * (signed __int64)v16->pFacePlane.vNormal.x) >> 16, | |
8693 v18 = (unsigned __int64)(v121 * (signed __int64)v16->pFacePlane.vNormal.y) >> 16, | |
8694 v19 = (unsigned __int64)(v117 * (signed __int64)v16->pFacePlane.vNormal.z) >> 16, | |
8695 v20 = v17 + v18 + v19 == 0, | |
8696 v21 = v17 + v18 + v19, | |
8697 v109 = v17 + v18 + v19, | |
8698 v20) ) | |
8699 goto LABEL_33; | |
8700 v22 = pOut.y * v16->pFacePlane.vNormal.y; | |
8701 v23 = -(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x); | |
8702 if ( v21 <= 0 ) | |
8703 { | |
8704 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x < 0 ) | |
8705 goto LABEL_33; | |
8706 } | |
8707 else | |
8708 { | |
8709 if ( v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x > 0 ) | |
8710 goto LABEL_33; | |
8711 } | |
8712 v24 = abs(-(v16->pFacePlane.dist + v22 + outz * v16->pFacePlane.vNormal.z + pOut.x * v16->pFacePlane.vNormal.x)) >> 14; | |
8713 if ( v24 <= abs(v21) ) | |
8714 { | |
8715 LODWORD(v25) = v23 << 16; | |
8716 HIDWORD(v25) = v23 >> 16; | |
8717 v26 = v25 / v109; | |
8718 v110 = v25 / v109; | |
8719 if ( v26 >= 0 ) | |
8720 { | |
8721 if ( sub_4077F1( | |
8722 pOut.x + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v125) >> 16) + 32768) >> 16), | |
8723 pOut.y + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v121) >> 16) + 32768) >> 16), | |
8724 outz + ((signed int)(((unsigned __int64)(v110 * (signed __int64)v117) >> 16) + 32768) >> 16), | |
8725 v16, | |
8726 (BSPVertexBuffer *)a5) ) | |
8727 { | |
8728 v114 = 1; | |
8729 goto LABEL_36; | |
8730 } | |
8731 } | |
8732 } | |
8733 LABEL_33: | |
8734 ++sDepth; | |
8735 v106 += 308; | |
8736 if ( sDepth >= *((int *)a5 + 2) ) | |
8737 goto LABEL_36; | |
8738 } | |
8739 } | |
8740 LABEL_37: | |
8741 v27.z = y; | |
8742 *(_QWORD *)&v27.x = a4; | |
8743 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz); | |
8744 v28.z = v.z; | |
8745 *(_QWORD *)&v28.x = *(_QWORD *)&v; | |
8746 Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163); | |
8747 v29 = outy - pOut.y; | |
8748 v30 = v163 - outz; | |
8749 v31 = outx - pOut.x; | |
295 | 8750 v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30); |
0 | 8751 v33 = 65536; |
8752 if ( v32 ) | |
8753 v33 = 65536 / v32; | |
8754 v126 = v31 * v33; | |
8755 v34 = v33; | |
8756 v35 = v30 * v33; | |
8757 v36 = pOut.x; | |
8758 v118 = v35; | |
8759 v122 = v29 * v34; | |
8760 v150 = pOut.x; | |
8761 if ( pOut.x < outx ) | |
8762 { | |
8763 v146 = outx; | |
8764 } | |
8765 else | |
8766 { | |
8767 v150 = outx; | |
8768 v146 = pOut.x; | |
8769 } | |
8770 v37 = outy; | |
8771 v142 = pOut.y; | |
8772 if ( pOut.y < outy ) | |
8773 { | |
8774 v138 = outy; | |
8775 } | |
8776 else | |
8777 { | |
8778 v142 = outy; | |
8779 v138 = pOut.y; | |
8780 } | |
8781 v134 = outz; | |
8782 if ( outz < v163 ) | |
8783 { | |
8784 v130 = v163; | |
8785 } | |
8786 else | |
8787 { | |
8788 v134 = v163; | |
8789 v130 = outz; | |
8790 } | |
8791 v161 = 0; | |
8792 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
8793 { | |
8794 v105 = 0; | |
8795 while ( 1 ) | |
8796 { | |
8797 v38 = (char *)&pOutdoor->pBModels[v105].pVertices; | |
8798 a5a = (char *)&pOutdoor->pBModels[v105].pVertices; | |
8799 if ( sub_4088E9(v36, pOut.y, outx, v37, pOutdoor->pBModels[v105].vPosition.x, pOutdoor->pBModels[v105].vPosition.y) <= pOutdoor->pBModels[v105].sBoundingRadius + 128 ) | |
8800 { | |
8801 sDeptha = 0; | |
8802 if ( *((int *)v38 + 2) > 0 ) | |
8803 break; | |
8804 } | |
8805 LABEL_71: | |
8806 ++v161; | |
8807 ++v105; | |
8808 if ( v161 >= (signed int)pOutdoor->uNumBModels ) | |
8809 return !v114 || !v113; | |
8810 v37 = outy; | |
8811 v36 = pOut.x; | |
8812 } | |
8813 v_8 = 0; | |
8814 while ( 1 ) | |
8815 { | |
8816 v39 = (ODMFace *)(v_8 + *((int *)a5a + 4)); | |
8817 if ( v150 > v39->pBoundingBox.x2 | |
8818 || v146 < v39->pBoundingBox.x1 | |
8819 || v142 > v39->pBoundingBox.y2 | |
8820 || v138 < v39->pBoundingBox.y1 | |
8821 || v134 > v39->pBoundingBox.z2 | |
8822 || v130 < v39->pBoundingBox.z1 | |
8823 || (ya = (unsigned __int64)(v126 * (signed __int64)v39->pFacePlane.vNormal.x) >> 16, | |
8824 ve = (unsigned __int64)(v122 * (signed __int64)v39->pFacePlane.vNormal.y) >> 16, | |
8825 v_4 = (unsigned __int64)(v118 * (signed __int64)v39->pFacePlane.vNormal.z) >> 16, | |
8826 v20 = ya + ve + v_4 == 0, | |
8827 v40 = ya + ve + v_4, | |
8828 va = ya + ve + v_4, | |
8829 v20) ) | |
8830 goto LABEL_68; | |
8831 v41 = pOut.y * v39->pFacePlane.vNormal.y; | |
8832 v42 = -(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x); | |
8833 if ( v40 <= 0 ) | |
8834 { | |
8835 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x < 0 ) | |
8836 goto LABEL_68; | |
8837 } | |
8838 else | |
8839 { | |
8840 if ( v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x > 0 ) | |
8841 goto LABEL_68; | |
8842 } | |
8843 v_4a = abs(-(v39->pFacePlane.dist + v41 + outz * v39->pFacePlane.vNormal.z + pOut.x * v39->pFacePlane.vNormal.x)) >> 14; | |
8844 if ( v_4a <= abs(v40) ) | |
8845 { | |
8846 LODWORD(v43) = v42 << 16; | |
8847 HIDWORD(v43) = v42 >> 16; | |
8848 v44 = v43 / va; | |
8849 vb = v43 / va; | |
8850 if ( v44 >= 0 ) | |
8851 { | |
8852 if ( sub_4077F1( | |
8853 pOut.x + ((signed int)(((unsigned __int64)(vb * (signed __int64)v126) >> 16) + 32768) >> 16), | |
8854 pOut.y + ((signed int)(((unsigned __int64)(vb * (signed __int64)v122) >> 16) + 32768) >> 16), | |
8855 outz + ((signed int)(((unsigned __int64)(vb * (signed __int64)v118) >> 16) + 32768) >> 16), | |
8856 v39, | |
8857 (BSPVertexBuffer *)a5a) ) | |
8858 { | |
8859 v113 = 1; | |
8860 goto LABEL_71; | |
8861 } | |
8862 } | |
8863 } | |
8864 LABEL_68: | |
8865 ++sDeptha; | |
8866 v_8 += 308; | |
8867 if ( sDeptha >= *((int *)a5a + 2) ) | |
8868 goto LABEL_71; | |
8869 } | |
8870 } | |
8871 return !v114 || !v113; | |
8872 } | |
8873 | |
8874 //----- (00408768) -------------------------------------------------------- | |
8875 void InitializeActors() | |
8876 { | |
8877 signed int v5; // [sp+Ch] [bp-10h]@1 | |
8878 signed int v6; // [sp+10h] [bp-Ch]@1 | |
8879 signed int v7; // [sp+14h] [bp-8h]@1 | |
8880 signed int v8; // [sp+18h] [bp-4h]@1 | |
8881 | |
8882 v8 = 0; | |
8883 v6 = 0; | |
8884 v7 = 0; | |
8885 v5 = 0; | |
8886 if ( !_strcmpi(pCurrentMapName, "d25.blv") ) | |
8887 v8 = 1; | |
8888 if ( !_strcmpi(pCurrentMapName, "d26.blv") ) | |
8889 v6 = 1; | |
484 | 8890 if (_449B57_test_bit(pParty->_quest_bits, 99)) |
0 | 8891 v7 = 1; |
484 | 8892 if (_449B57_test_bit(pParty->_quest_bits, 100)) |
0 | 8893 v5 = 1; |
413 | 8894 |
417 | 8895 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 | 8896 for (uint i = 0; i < uNumActors; ++i) |
8897 { | |
8898 auto actor = pActors + i; | |
8899 | |
8900 if (actor->CanAct() || actor->uAIState == Disabled) | |
8901 { | |
8902 actor->vPosition.x = actor->vInitialPosition.x; | |
8903 actor->vPosition.y = actor->vInitialPosition.y; | |
8904 actor->vPosition.z = actor->vInitialPosition.z; | |
8905 actor->sCurrentHP = actor->pMonsterInfo.uHP; | |
8906 if (actor->uAIState != Disabled) | |
413 | 8907 { |
417 | 8908 Actor::AI_Stand(i, ai_near_actors_targets_pid[i], actor->pMonsterInfo.uRecoveryTime, 0); |
413 | 8909 } |
0 | 8910 } |
8911 | |
8912 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
8913 | |
8914 if (!v8 || v7) | |
8915 if (!v6 || v5) | |
322 | 8916 if (actor->IsPeasant()) |
0 | 8917 BYTE2(actor->uAttributes) &= 0xF7u; |
8918 | |
8919 BYTE2(actor->uAttributes) &= 0x7Fu; | |
8920 if (BYTE2(actor->uAttributes) & 0x40) | |
8921 Actor::_4031C1_update_job(i, pParty->uCurrentHour, 1); | |
8922 } | |
8923 } | |
8924 | |
8925 //----- (00408896) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8926 void InitializeSpriteObjects() |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8927 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8928 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
|
8929 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8930 auto item = pSpriteObjects + i; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8931 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8932 if (item->uType && |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
8933 (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
|
8934 SpriteObject::OnInteraction(i); |
0 | 8935 } |
8936 | |
8937 for (uint i = 0; i < 100; ++i) | |
8938 array_5118E8.pElements[i].field_C_time_left = 0; | |
8939 } | |
8940 | |
8941 //----- (004088E9) -------------------------------------------------------- | |
8942 signed int __fastcall sub_4088E9(int a1, int a2, int a3, int a4, int a5, int a6) | |
8943 { | |
8944 int v6; // esi@1 | |
8945 int v7; // edi@1 | |
8946 int v8; // eax@1 | |
8947 signed int result; // eax@1 | |
8948 int v10; // [sp+Ch] [bp-4h]@1 | |
8949 int v11; // [sp+18h] [bp+8h]@1 | |
8950 | |
8951 v6 = a1; | |
8952 v10 = a2; | |
8953 v7 = a3 - a1; | |
8954 v11 = abs(a3 - a1); | |
8955 v8 = abs(a4 - v10); | |
295 | 8956 result = integer_sqrt(v11 * v11 + v8 * v8); |
0 | 8957 if ( result ) |
8958 result = abs((v7 * (v10 - a6) - (a4 - v10) * (v6 - a5)) / result); | |
8959 return result; | |
8960 } | |
8961 | |
8962 //----- (00408A27) -------------------------------------------------------- | |
8963 unsigned int __thiscall SearchAliveActors(unsigned int *pTotalActors) | |
8964 { | |
8965 unsigned int *v1; // esi@1 | |
8966 int v2; // eax@1 | |
8967 unsigned int v3; // ebp@1 | |
8968 signed int v4; // ebx@1 | |
8969 Actor *v5; // edi@2 | |
8970 unsigned int v6; // eax@3 | |
8971 int v8; // [sp+Ch] [bp-4h]@1 | |
8972 | |
8973 v1 = pTotalActors; | |
8974 v2 = GetAlertStatus(); | |
8975 v3 = 0; | |
8976 v4 = 0; | |
8977 *v1 = 0; | |
8978 v8 = v2; | |
8979 if ( (signed int)uNumActors > 0 ) | |
8980 { | |
8981 v5 = pActors; | |
8982 do | |
8983 { | |
8984 v6 = v5->uAttributes; | |
8985 if ( (v6 & 0x100000) == v8 ) | |
8986 { | |
8987 ++*v1; | |
303 | 8988 if ( v5->IsNotAlive() == 1 ) |
0 | 8989 ++v3; |
8990 } | |
8991 ++v4; | |
8992 ++v5; | |
8993 } | |
8994 while ( v4 < (signed int)uNumActors ); | |
8995 } | |
8996 return v3; | |
8997 } | |
8998 | |
8999 //----- (00408A7E) -------------------------------------------------------- | |
9000 unsigned int __fastcall SearchActorByMonsterID(unsigned int *pTotalActors, int uMonsterID) | |
9001 { | |
9002 unsigned int *v2; // esi@1 | |
9003 signed int v3; // ebx@1 | |
82 | 9004 Actor *v4; // edi@2 |
0 | 9005 int v5; // eax@3 |
9006 int v7; // [sp+8h] [bp-Ch]@1 | |
9007 int v8; // [sp+Ch] [bp-8h]@1 | |
9008 unsigned int v9; // [sp+10h] [bp-4h]@1 | |
9009 | |
9010 v7 = uMonsterID; | |
9011 v2 = pTotalActors; | |
9012 v3 = 0; | |
9013 v8 = GetAlertStatus(); | |
9014 *v2 = 0; | |
9015 v9 = 0; | |
9016 if ( (signed int)uNumActors > 0 ) | |
9017 { | |
82 | 9018 v4 = pActors;//[0].pMonsterInfo.uID; |
0 | 9019 do |
9020 { | |
82 | 9021 v5 = v4->uAttributes; // actor::attributes |
0 | 9022 if ( (v5 & 0x100000) == v8 ) |
9023 { | |
82 | 9024 if ( v4->pMonsterInfo.field_33 == v7 ) |
0 | 9025 { |
9026 ++*v2; | |
303 | 9027 if ( v4->IsNotAlive() == 1 ) |
0 | 9028 ++v9; |
9029 } | |
9030 } | |
9031 ++v3; | |
82 | 9032 ++v4; |
0 | 9033 } |
9034 while ( v3 < (signed int)uNumActors ); | |
9035 } | |
9036 return v9; | |
9037 } | |
9038 | |
9039 //----- (00408AE7) -------------------------------------------------------- | |
9040 unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup) | |
9041 { | |
9042 unsigned int *v2; // esi@1 | |
9043 signed int v3; // ebx@1 | |
82 | 9044 Actor *v4; // edi@2 |
0 | 9045 int v5; // eax@3 |
9046 unsigned int v7; // [sp+8h] [bp-Ch]@1 | |
9047 int v8; // [sp+Ch] [bp-8h]@1 | |
9048 unsigned int v9; // [sp+10h] [bp-4h]@1 | |
9049 | |
9050 v7 = uGroup; | |
9051 v2 = pTotalActors; | |
9052 v3 = 0; | |
9053 v8 = GetAlertStatus(); | |
9054 *v2 = 0; | |
9055 v9 = 0; | |
9056 if ( (signed int)uNumActors > 0 ) | |
9057 { | |
82 | 9058 v4 = pActors;//[0].uGroup; |
0 | 9059 do |
9060 { | |
82 | 9061 v5 = v4->uAttributes; |
0 | 9062 if ( (v5 & 0x100000) == v8 ) |
9063 { | |
82 | 9064 if ( v4->uGroup == v7 ) |
0 | 9065 { |
9066 ++*v2; | |
303 | 9067 if ( v4->IsNotAlive() == 1 ) |
0 | 9068 ++v9; |
9069 } | |
9070 } | |
9071 ++v3; | |
82 | 9072 ++v4; |
0 | 9073 } |
9074 while ( v3 < (signed int)uNumActors ); | |
9075 } | |
9076 return v9; | |
9077 } | |
9078 | |
9079 //----- (00408B54) -------------------------------------------------------- | |
9080 unsigned int __fastcall SearchActorByID(unsigned int *pTotalActors, unsigned int a2) | |
9081 { | |
9082 unsigned int v2; // edi@1 | |
9083 unsigned int *v3; // esi@1 | |
9084 int v4; // eax@1 | |
9085 unsigned int v5; // ebx@1 | |
9086 unsigned int v6; // edx@1 | |
9087 | |
9088 v2 = a2; | |
9089 v3 = pTotalActors; | |
9090 v4 = GetAlertStatus(); | |
9091 v5 = 0; | |
9092 *v3 = 0; | |
9093 v6 = pActors[v2].uAttributes; | |
9094 if ( (v6 & 0x100000) == v4 ) | |
9095 { | |
9096 *v3 = 1; | |
303 | 9097 if ( pActors[v2].IsNotAlive() == 1 ) |
0 | 9098 v5 = 1; |
9099 } | |
9100 return v5; | |
9101 } | |
9102 | |
9103 | |
9104 //----- (0040D75D) -------------------------------------------------------- | |
1006 | 9105 void pPrimaryWindow_draws_text( int a1, const char *pText, int *pXY ) |
9106 { | |
0 | 9107 const char *v3; // ST0C_4@1 |
9108 __int64 v4; // qax@1 | |
9109 | |
9110 v3 = pText; | |
9111 v4 = LOBYTE(pFontComic->uFontHeight) - 3; | |
1006 | 9112 pPrimaryWindow->DrawText( |
0 | 9113 pFontComic, |
9114 *pXY, | |
9115 pXY[1] - (((signed int)v4 - HIDWORD(v4)) >> 1) + 3, | |
9116 0, | |
9117 v3, | |
9118 0, | |
9119 0, | |
9120 0); | |
9121 } | |
9122 | |
9123 //----- (0040DB27) -------------------------------------------------------- | |
9124 void __fastcall DrawRect(Vec4_int_ *pXYZW, unsigned __int16 uColor, char bSolidFill) | |
9125 { | |
9126 Vec4_int_ *v3; // esi@1 | |
9127 unsigned __int16 v4; // bp@1 | |
9128 unsigned int i; // ebx@3 | |
9129 | |
9130 v3 = pXYZW; | |
9131 v4 = uColor; | |
9132 pRenderer->BeginScene(); | |
709 | 9133 pRenderer->SetRasterClipRect(0, 0, 639u, 479u); |
0 | 9134 if ( bSolidFill ) |
9135 { | |
9136 for ( i = v3->y; (signed int)i <= v3->w; ++i ) | |
709 | 9137 pRenderer->RasterLine2D(v3->x, i, v3->z, i, v4); |
0 | 9138 } |
9139 else | |
9140 { | |
709 | 9141 pRenderer->RasterLine2D(v3->x, v3->y, v3->z, v3->y, v4); |
9142 pRenderer->RasterLine2D(v3->z, v3->y, v3->z, v3->w, v4); | |
9143 pRenderer->RasterLine2D(v3->z, v3->w, v3->x, v3->w, v4); | |
9144 pRenderer->RasterLine2D(v3->x, v3->w, v3->x, v3->y, v4); | |
0 | 9145 } |
9146 pRenderer->EndScene(); | |
9147 } | |
9148 | |
9149 //----- (0040DDB1) -------------------------------------------------------- | |
9150 int __fastcall rand_interval(int a, int b) | |
9151 { | |
9152 return a + rand() % (b - a + 1); | |
9153 } | |
9154 | |
9155 //----- (0040DEB4) -------------------------------------------------------- | |
9156 char *__fastcall inv_strcat(const char *Source, char *Dest) | |
9157 { | |
9158 return strcat(Dest, Source); | |
9159 } | |
9160 | |
9161 //----- (0040DEBE) -------------------------------------------------------- | |
9162 char *__fastcall inv_strcpy(const char *Source, char *Dest) | |
9163 { | |
9164 return strcpy(Dest, Source); | |
9165 } | |
9166 | |
9167 //----- (0040DEC8) -------------------------------------------------------- | |
9168 void __fastcall intToString(int val, char *pOut) | |
9169 { | |
9170 sprintf(pOut, "%d", val); | |
9171 } | |
9172 | |
9173 //----- (0040DEDB) -------------------------------------------------------- | |
9174 unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor) | |
9175 { | |
949 | 9176 return TargetColor((unsigned __int8)uColor, BYTE1(uColor), BYTE2(uColor)); |
0 | 9177 } |
9178 | |
9179 //----- (0040DEF3) -------------------------------------------------------- | |
949 | 9180 unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b ) |
983 | 9181 { |
688 | 9182 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) + |
9183 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) + | |
9184 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); | |
0 | 9185 } |
9186 | |
9187 //----- (0040DF3D) -------------------------------------------------------- | |
9188 void __cdecl CallRenderPresent() | |
9189 { | |
9190 pRenderer->Present(); | |
9191 } | |
9192 | |
9193 //----- (0040DFA7) -------------------------------------------------------- | |
9194 int __stdcall retzero_sub_40DFA7(int a1) | |
9195 { | |
9196 return 0; | |
9197 } | |
9198 // 40DFA7: using guessed type int __stdcall retzero_sub_40DFA7(int); | |
9199 | |
9200 //----- (0040DFD1) -------------------------------------------------------- | |
9201 void stru272::_40DFD1() | |
9202 { | |
9203 stru272 *v1; // esi@1 | |
9204 stru272_stru0 *v2; // eax@1 | |
9205 | |
9206 v1 = this; | |
9207 v2 = (stru272_stru0 *)malloc(0x5Cu); | |
9208 v1->ptr_0 = v2; | |
9209 v2->field_0 = 0x67707274u; | |
9210 v1->ptr_0->field_8 = 0; | |
9211 v1->ptr_0->field_30 = 0.0; | |
9212 v1->ptr_0->field_58 = 0; | |
9213 v1->ptr_0->field_59 = 0; | |
9214 } | |
9215 | |
9216 //----- (0040DFFE) -------------------------------------------------------- | |
9217 int stru272_stru0::_40DFFE() | |
9218 { | |
9219 signed int result; // eax@2 | |
9220 | |
9221 if ( this->field_0 == 0x67707274 ) | |
9222 { | |
9223 this->field_0 = 0x78787878u; | |
9224 free(this); | |
9225 result = 0; | |
9226 } | |
9227 else | |
9228 { | |
9229 result = 2; | |
9230 } | |
9231 return result; | |
9232 } | |
9233 | |
9234 //----- (0040E01A) -------------------------------------------------------- | |
9235 int stru272_stru0::_40E01A(int a2) | |
9236 { | |
9237 signed int result; // eax@2 | |
9238 | |
9239 auto a1 = this; | |
9240 if ( a1->field_0 == 0x67707274 ) | |
9241 { | |
9242 a1->field_4 = *(int *)(a2 + 32); | |
9243 a1->field_C = *(int *)a2 << 16; | |
9244 a1->field_10 = *(int *)(a2 + 4) << 16; | |
9245 a1->field_14 = *(int *)(a2 + 8) << 16; | |
9246 a1->field_18 = *(int *)(a2 + 12) << 16; | |
9247 a1->field_1C = *(int *)(a2 + 16); | |
9248 a1->field_20 = *(int *)(a2 + 20); | |
9249 a1->field_24 = *(int *)(a2 + 24); | |
9250 a1->field_28 = *(float *)(a2 + 28) * 65536.0; | |
9251 LODWORD(a1->field_2C) = *(int *)(a2 + 36); | |
9252 a1->field_34 = (signed __int64)(*(float *)(a2 + 40) * 65536.0); | |
9253 a1->field_38 = (signed __int64)(*(float *)(a2 + 44) * 65536.0); | |
9254 a1->field_3C = *(int *)(a2 + 48); | |
9255 a1->field_40 = *(int *)(a2 + 52); | |
9256 a1->field_54 = *(int *)(a2 + 56); | |
9257 a1->field_59 = 1; | |
9258 result = 0; | |
9259 } | |
9260 else | |
9261 { | |
9262 result = 2; | |
9263 } | |
9264 return result; | |
9265 } | |
9266 | |
9267 //----- (0040E0F5) -------------------------------------------------------- | |
9268 int stru272_stru0::_40E0F5(char a2, char a3) | |
9269 { | |
9270 signed int result; // eax@2 | |
9271 int v4; // edx@7 | |
9272 int v5; // eax@7 | |
9273 | |
9274 auto a1 = this; | |
9275 if ( a1->field_0 == 0x67707274 ) | |
9276 { | |
9277 if ( a2 ) | |
9278 { | |
9279 a1->field_8 = 0; | |
9280 a1->field_30 = 0.0; | |
9281 } | |
9282 if ( a1->field_59 && a3 ) | |
9283 { | |
9284 v4 = a1->field_4; | |
9285 v5 = a1->field_54; | |
9286 do | |
9287 { | |
9288 *(int *)v5 = 0; | |
9289 v5 += 28; | |
9290 --v4; | |
9291 } | |
9292 while ( v4 ); | |
9293 a1->field_58 = 0; | |
9294 } | |
9295 result = 0; | |
9296 } | |
9297 else | |
9298 { | |
9299 result = 2; | |
9300 } | |
9301 return result; | |
9302 } | |
9303 | |
9304 //----- (0040E133) -------------------------------------------------------- | |
9305 int stru272_stru0::_40E133() | |
9306 { | |
9307 stru272_stru0 *v1; // edi@1 | |
9308 int v3; // ST18_4@3 | |
9309 double v4; // st7@3 | |
9310 double v5; // st6@4 | |
9311 char v6; // bl@8 | |
9312 int v7; // esi@8 | |
9313 int v8; // ecx@10 | |
9314 signed int v9; // eax@10 | |
9315 int v10; // ecx@10 | |
9316 signed int v11; // eax@10 | |
9317 signed int v12; // edx@12 | |
9318 signed int v13; // edx@12 | |
9319 int v14; // [sp+8h] [bp-10h]@8 | |
9320 int v15; // [sp+Ch] [bp-Ch]@8 | |
9321 float v16; // [sp+14h] [bp-4h]@3 | |
9322 | |
9323 v1 = this; | |
9324 if ( this->field_0 != 0x67707274 ) | |
9325 return 2; | |
9326 v3 = this->field_8; | |
9327 v16 = this->field_30; | |
9328 v4 = (double)v3; | |
9329 if ( v3 > 0 ) | |
9330 { | |
9331 v5 = v16 + this->field_2C; | |
9332 v16 = v5; | |
9333 if ( v5 > v4 ) | |
9334 v16 = v4; | |
9335 } | |
9336 if ( v16 >= 1.0 || this->field_58 ) | |
9337 { | |
9338 v6 = 0; | |
9339 v7 = this->field_54; | |
9340 v14 = (signed __int64)this->field_28; | |
9341 v15 = this->field_4; | |
9342 while ( *(int *)v7 <= 0 ) | |
9343 { | |
9344 if ( v16 >= 1.0 ) | |
9345 { | |
9346 *(int *)v7 = v1->field_3C + rand() % (v1->field_40 - v1->field_3C + 1); | |
9347 *(int *)(v7 + 20) = (rand() % 17 - 8) << 16; | |
9348 *(int *)(v7 + 24) = (rand() % 17 - 8) << 16; | |
9349 v12 = v1->field_C + rand() % (v1->field_14 - 1 - v1->field_C + 1); | |
9350 *(int *)(v7 + 12) = v12; | |
9351 *(int *)(v7 + 4) = v12 >> 16; | |
9352 v16 = v16 - 1.0; | |
9353 v13 = v1->field_10 + rand() % (v1->field_18 - 1 - v1->field_10 + 1); | |
9354 *(int *)(v7 + 16) = v13; | |
9355 *(int *)(v7 + 8) = v13 >> 16; | |
9356 --v1->field_8; | |
9357 goto LABEL_13; | |
9358 } | |
9359 LABEL_14: | |
9360 v7 += 28; | |
9361 --v15; | |
9362 if ( !v15 ) | |
9363 { | |
9364 v1->field_58 = v6; | |
9365 v1->field_30 = v16; | |
9366 return 0; | |
9367 } | |
9368 } | |
9369 v8 = *(int *)(v7 + 20); | |
9370 --*(int *)v7; | |
9371 v9 = v8 + *(int *)(v7 + 12); | |
9372 v10 = v14 + *(int *)(v7 + 24); | |
9373 *(int *)(v7 + 12) = v9; | |
9374 *(int *)(v7 + 4) = v9 >> 16; | |
9375 v11 = v10 + *(int *)(v7 + 16); | |
9376 *(int *)(v7 + 24) = v10; | |
9377 *(int *)(v7 + 16) = v11; | |
9378 *(int *)(v7 + 8) = v11 >> 16; | |
9379 LABEL_13: | |
9380 v6 = 1; | |
9381 goto LABEL_14; | |
9382 } | |
9383 return 0; | |
9384 } | |
9385 | |
9386 //----- (0040E2A7) -------------------------------------------------------- | |
9387 int stru272_stru0::_40E2A7() | |
9388 { | |
9389 int result; // eax@2 | |
9390 | |
9391 if ( this->field_0 == 0x67707274 ) | |
9392 { | |
9393 if ( this->field_8 <= 0 ) | |
9394 result = this->field_58 != 0 ? 2 : 0; | |
9395 else | |
9396 result = 1; | |
9397 } | |
9398 else | |
9399 { | |
9400 result = 3; | |
9401 } | |
9402 return result; | |
9403 } | |
9404 | |
9405 //----- (0040F82D) -------------------------------------------------------- | |
9406 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) | |
9407 { | |
973 | 9408 assert(uTextureId != -1); |
9409 ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue); | |
0 | 9410 } |
9411 | |
9412 //----- (0040F845) -------------------------------------------------------- | |
9413 __int16 __fastcall sub_40F845(int a1, int a2, int a3, int a4, int a5, __int16 a6, int a7) | |
9414 { | |
9415 int v7; // edi@1 | |
9416 int v8; // esi@1 | |
9417 int v9; // ecx@2 | |
9418 int v10; // eax@3 | |
9419 | |
9420 v7 = a1; | |
9421 v8 = a2; | |
9422 do | |
9423 { | |
9424 v9 = a3; | |
9425 do | |
9426 { | |
9427 v10 = *(char *)v8++; | |
9428 if ( (char)v10 ) | |
9429 { | |
9430 if ( (char)v10 == 1 ) | |
9431 { | |
9432 LOWORD(v10) = *(short *)(a5 + 2 * v10); | |
9433 *(short *)v7 = v10; | |
9434 } | |
9435 else | |
9436 { | |
9437 LOWORD(v10) = a6; | |
9438 *(short *)v7 = a6; | |
9439 } | |
9440 } | |
9441 v7 += 2; | |
9442 --v9; | |
9443 } | |
9444 while ( v9 ); | |
9445 v7 = a7 + v7 - a3 - a3; | |
9446 --a4; | |
9447 } | |
9448 while ( a4 ); | |
9449 return v10; | |
9450 } | |
9451 | |
9452 //----- (0040F89C) -------------------------------------------------------- | |
9453 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue) | |
9454 { | |
9455 void *v3; // eax@3 | |
9456 void *v4; // esi@5 | |
9457 int *v5; // edi@5 | |
9458 int v6; // eax@5 | |
9459 int v7; // ecx@6 | |
9460 Texture *v8; // [sp+Ch] [bp-14h]@1 | |
9461 int *v9; // [sp+10h] [bp-10h]@1 | |
9462 int v10; // [sp+14h] [bp-Ch]@1 | |
9463 int v11; // [sp+18h] [bp-8h]@1 | |
9464 void *v12; // [sp+1Ch] [bp-4h]@5 | |
9465 | |
9466 v10 = pTex->uTextureWidth; | |
9467 v8 = pTex; | |
9468 v9 = pZBuffer; | |
9469 v11 = pTex->uTextureHeight; | |
9470 if ( pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize ) | |
9471 v3 = pTex->UnzipPalette(); | |
9472 else | |
710 | 9473 v3 = pTex->pLevelOfDetail0_prolly_alpha_mask; |
0 | 9474 v12 = v3; |
9475 v4 = v3; | |
9476 v5 = v9; | |
9477 v6 = 0; | |
9478 do | |
9479 { | |
9480 v7 = v10; | |
9481 do | |
9482 { | |
9483 LOBYTE(v6) = *(char *)v4; | |
9484 v4 = (char *)v4 + 1; | |
9485 if ( v6 ) | |
9486 *v5 = uZValue; | |
9487 ++v5; | |
9488 --v7; | |
9489 } | |
9490 while ( v7 ); | |
9491 v5 += 640 - v10; | |
9492 --v11; | |
9493 } | |
9494 while ( v11 ); | |
9495 if ( pIcons_LOD->dword_011BA4 ) | |
9496 { | |
9497 if ( v8->uDecompressedSize ) | |
9498 free(v12); | |
9499 } | |
9500 } | |
9501 | |
9502 //----- (0040F92A) -------------------------------------------------------- | |
9503 void __fastcall sub_40F92A(int *pZBuffer, Texture *a2, int a3) | |
9504 { | |
9505 Texture *v3; // esi@1 | |
9506 void *v4; // eax@3 | |
9507 int *v5; // edi@5 | |
9508 int v6; // ecx@6 | |
9509 int *v7; // [sp+Ch] [bp-10h]@1 | |
9510 int v8; // [sp+10h] [bp-Ch]@1 | |
9511 int v9; // [sp+18h] [bp-4h]@1 | |
9512 | |
9513 v3 = a2; | |
9514 v7 = pZBuffer; | |
9515 v8 = a2->uTextureWidth; | |
9516 v9 = a2->uTextureHeight; | |
9517 if ( pIcons_LOD->dword_011BA4 && a2->uDecompressedSize ) | |
9518 v4 = a2->UnzipPalette(); | |
9519 else | |
710 | 9520 v4 = a2->pLevelOfDetail0_prolly_alpha_mask; |
0 | 9521 v5 = v7; |
9522 do | |
9523 { | |
9524 v6 = v8; | |
9525 do | |
9526 { | |
9527 *v5 = a3; | |
9528 ++v5; | |
9529 --v6; | |
9530 } | |
9531 while ( v6 ); | |
9532 v5 += 640 - v8; | |
9533 --v9; | |
9534 } | |
9535 while ( v9 ); | |
9536 if ( pIcons_LOD->dword_011BA4 ) | |
9537 { | |
9538 if ( v3->uDecompressedSize ) | |
9539 free(v4); | |
9540 } | |
9541 } | |
9542 | |
9543 | |
9544 | |
9545 | |
9546 | |
9547 | |
9548 | |
9549 | |
9550 | |
9551 | |
9552 | |
9553 | |
9554 | |
9555 | |
9556 //----- (00410AF5) -------------------------------------------------------- | |
9557 void __cdecl SetMoonPhaseNames() | |
9558 { | |
9559 aMoonPhaseNames[0] = pGlobalTXT_LocalizationStrings[150]; | |
9560 aMoonPhaseNames[1] = pGlobalTXT_LocalizationStrings[171]; | |
9561 aMoonPhaseNames[2] = pGlobalTXT_LocalizationStrings[102]; | |
9562 aMoonPhaseNames[3] = pGlobalTXT_LocalizationStrings[169]; | |
9563 aMoonPhaseNames[4] = pGlobalTXT_LocalizationStrings[92]; | |
9564 } | |
9565 | |
9566 | |
9567 //----- (00410D99) -------------------------------------------------------- | |
9568 signed int __fastcall sub_410D99_get_map_index(int a1) | |
9569 { | |
9570 int v1; // edi@1 | |
9571 signed int v2; // ebp@1 | |
9572 const char **v3; // esi@2 | |
9573 char *v4; // ebx@2 | |
9574 | |
9575 v1 = a1; | |
9576 v2 = 1; | |
9577 if ( _strcmpi(pMapStats->pInfos[1].pFilename, (const char *)&pGames_LOD->pSubIndices[a1]) ) | |
9578 { | |
9579 v3 = (const char **)&pMapStats->pInfos[1].pFilename; | |
9580 v4 = (char *)&pMapStats->pInfos[1].pFilename; | |
9581 do | |
9582 { | |
9583 if ( !*(int *)v4 ) | |
9584 break; | |
9585 v3 += 17; | |
9586 ++v2; | |
9587 v4 = (char *)v3; | |
9588 } | |
9589 while ( _strcmpi(*v3, (const char *)&pGames_LOD->pSubIndices[v1]) ); | |
9590 } | |
9591 return v2; | |
9592 } | |
9593 | |
9594 //----- (00410DEC) -------------------------------------------------------- | |
9595 unsigned int __cdecl DrawLloydBeaconsScreen() | |
9596 { | |
961 | 9597 Player *pPlayer; // esi@1 |
0 | 9598 char *v1; // eax@1 |
9599 unsigned __int16 v2; // ax@6 | |
9600 unsigned int result; // eax@11 | |
9601 unsigned int v4; // esi@13 | |
9602 unsigned int v5; // ecx@13 | |
9603 char v6; // zf@13 | |
9604 LloydBeacon *v7; // esi@14 | |
9605 int v8; // eax@14 | |
9606 unsigned __int64 v9; // kr08_8@14 | |
9607 unsigned int v10; // esi@14 | |
9608 unsigned int v11; // eax@14 | |
9609 char *v12; // eax@19 | |
9610 char *v13; // ecx@22 | |
9611 int v14; // eax@27 | |
9612 Texture *v19; // [sp-4h] [bp-8Ch]@4 | |
961 | 9613 GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1 |
0 | 9614 unsigned int v23; // [sp+64h] [bp-24h]@14 |
9615 __int64 v24; // [sp+68h] [bp-20h]@14 | |
9616 unsigned int v25; // [sp+70h] [bp-18h]@13 | |
9617 char *Str; // [sp+74h] [bp-14h]@14 | |
9618 int v27; // [sp+78h] [bp-10h]@11 | |
9619 LloydBeacon *v28; // [sp+7Ch] [bp-Ch]@12 | |
9620 RGBTexture *v29; // [sp+80h] [bp-8h]@12 | |
9621 int uNumMaxBeacons; // [sp+84h] [bp-4h]@6 | |
9622 | |
961 | 9623 pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid]; |
0 | 9624 pRenderer->DrawTextureIndexed(8u, 8u, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]); |
9625 v1 = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon | |
961 | 9626 pWindow.uFrameX = game_viewport_x; |
9627 pWindow.uFrameY = game_viewport_y; | |
9628 pWindow.uFrameWidth = 428; | |
9629 pWindow.uFrameHeight = game_viewport_height; | |
9630 pWindow.uFrameZ = 435; | |
9631 pWindow.uFrameW = game_viewport_w; | |
0 | 9632 if ( !bRecallingBeacon ) |
9633 v1 = pGlobalTXT_LocalizationStrings[375]; // Set Beacon | |
9634 sprintf(pTmpBuf, "%s", v1); | |
961 | 9635 pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf, 3u); |
0 | 9636 if ( bRecallingBeacon ) |
9637 { | |
9638 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on); | |
9639 v19 = pTex_tab_an_6a__zoom_off; | |
9640 } | |
9641 else | |
9642 { | |
9643 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6a__zoom_off); | |
9644 v19 = pTex_tab_an_6b__zoom_on; | |
9645 } | |
9646 pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19); | |
961 | 9647 v2 = pPlayer->pActiveSkills[14]; |
0 | 9648 uNumMaxBeacons = 1; |
9649 if ( HIBYTE(v2) & 1 || (v2 & 0x80u) != 0 ) | |
9650 { | |
9651 uNumMaxBeacons = 5; | |
9652 } | |
9653 else | |
9654 { | |
9655 if ( v2 & 0x40 ) | |
9656 uNumMaxBeacons = 3; | |
9657 } | |
9658 result = 0; | |
9659 v27 = 0; | |
9660 if ( uNumMaxBeacons > 0 ) | |
9661 { | |
9662 v29 = pSavegameThumbnails; | |
961 | 9663 v28 = pPlayer->pInstalledBeacons; |
0 | 9664 while ( 1 ) |
9665 { | |
961 | 9666 pWindow.uFrameWidth = 92; |
0 | 9667 v4 = result; |
961 | 9668 pWindow.uFrameHeight = 68; |
0 | 9669 v5 = pLloydsBeaconsPreviewXs[result]; |
961 | 9670 pWindow.uFrameY = pLloydsBeaconsPreviewYs[result]; |
9671 v25 = pWindow.uFrameY; | |
9672 pWindow.uFrameX = v5; | |
9673 pWindow.uFrameW = pWindow.uFrameY + 67; | |
0 | 9674 v6 = v29->pPixels == 0; |
961 | 9675 pWindow.uFrameZ = v5 + 91; |
0 | 9676 if ( !v6 ) |
9677 break; | |
9678 if ( !bRecallingBeacon ) | |
9679 { | |
961 | 9680 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook); |
9681 v14 = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0); | |
9682 pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - v14 / 2, 1, pGlobalTXT_LocalizationStrings[19], 3); | |
0 | 9683 } |
9684 LABEL_29: | |
9685 ++v29; | |
9686 ++v28; | |
9687 result = v27++ + 1; | |
9688 if ( v27 >= uNumMaxBeacons ) | |
9689 goto LABEL_30; | |
9690 } | |
961 | 9691 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook); |
0 | 9692 pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[v4], pLloydsBeaconsPreviewYs[v4], v29); |
9693 v7 = v28; | |
9694 Str = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(v28->field_18))].pName; | |
961 | 9695 v8 = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0); |
9696 pWindow.uFrameY += -6 - v8; | |
9697 pWindow.DrawTitleText(pSpellFont, 0, 0, 1u, Str, 3u); | |
0 | 9698 v9 = v7->uBeaconTime - pParty->uTimePlayed; |
9699 LODWORD(v24) = LODWORD(v7->uBeaconTime) - LODWORD(pParty->uTimePlayed); | |
9700 HIDWORD(v24) = HIDWORD(v9); | |
9701 v23 = (unsigned __int64)((signed __int64)((double)v24 * 0.234375) / 60 / 60) >> 32; | |
9702 v10 = (signed __int64)((double)v24 * 0.234375) / 60 / 60; | |
9703 v11 = v10 / 0x18; | |
9704 if ( (unsigned int)((signed __int64)((double)v24 * 0.234375) / 60 / 60) / 0x18 ) | |
9705 { | |
9706 v13 = pGlobalTXT_LocalizationStrings[57]; // Days | |
9707 if ( v11 > 1 ) | |
9708 { | |
961 | 9709 sprintf(pTmpBuf, "%lu %s", v11 + 1, v13); |
9710 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4; | |
9711 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3); | |
0 | 9712 goto LABEL_29; |
9713 } | |
9714 } | |
9715 else | |
9716 { | |
9717 if ( (signed __int64)(__PAIR__(v23, v10) + 1) <= 23 ) | |
9718 { | |
9719 if ( (v23 & 0x80000000u) != 0 || (signed int)v23 <= 0 && v10 <= 1 ) | |
9720 v12 = pGlobalTXT_LocalizationStrings[109];// Hour | |
9721 else | |
9722 v12 = pGlobalTXT_LocalizationStrings[110];// Hours | |
961 | 9723 sprintf(pTmpBuf, "%lu %s", v10 + 1, v12); |
9724 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4; | |
9725 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3); | |
9726 goto LABEL_29; | |
0 | 9727 } |
9728 } | |
9729 v13 = pGlobalTXT_LocalizationStrings[56]; // Day | |
961 | 9730 sprintf(pTmpBuf, "%lu %s", v11 + 1, v13); |
9731 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4; | |
9732 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf, 3); | |
9733 goto LABEL_29; | |
0 | 9734 } |
9735 LABEL_30: | |
9736 if ( byte_506360 ) | |
9737 { | |
437 | 9738 /*result = pMessageQueue_50CBD0->uNumMessages; |
0 | 9739 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
9740 { | |
961 | 9741 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CloseAfterInstallBeacon; |
0 | 9742 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; |
9743 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
9744 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; | |
9745 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 9746 }*/ |
961 | 9747 pMessageQueue_50CBD0->AddMessage(UIMSG_CloseAfterInstallBeacon, 0, 0); |
0 | 9748 } |
9749 return result; | |
9750 } | |
9751 | |
9752 | |
9753 //----- (00413FF1) -------------------------------------------------------- | |
995 | 9754 void SetMonthNames() |
0 | 9755 { |
9756 aMonthNames[0] = pGlobalTXT_LocalizationStrings[415]; | |
9757 aMonthNames[1] = pGlobalTXT_LocalizationStrings[416]; | |
9758 aMonthNames[2] = pGlobalTXT_LocalizationStrings[417]; | |
9759 aMonthNames[3] = pGlobalTXT_LocalizationStrings[418]; | |
9760 aMonthNames[4] = pGlobalTXT_LocalizationStrings[419]; | |
9761 aMonthNames[5] = pGlobalTXT_LocalizationStrings[420]; | |
9762 aMonthNames[6] = pGlobalTXT_LocalizationStrings[421]; | |
9763 aMonthNames[7] = pGlobalTXT_LocalizationStrings[422]; | |
9764 aMonthNames[8] = pGlobalTXT_LocalizationStrings[423]; | |
9765 aMonthNames[9] = pGlobalTXT_LocalizationStrings[424]; | |
9766 aMonthNames[10] = pGlobalTXT_LocalizationStrings[425]; | |
9767 aMonthNames[11] = pGlobalTXT_LocalizationStrings[426]; | |
9768 } | |
9769 | |
9770 //----- (0041406F) -------------------------------------------------------- | |
995 | 9771 void SetDayNames() |
0 | 9772 { |
9773 aDayNames[0] = pGlobalTXT_LocalizationStrings[145]; | |
9774 aDayNames[1] = pGlobalTXT_LocalizationStrings[230]; | |
9775 aDayNames[2] = pGlobalTXT_LocalizationStrings[243]; | |
9776 aDayNames[3] = pGlobalTXT_LocalizationStrings[227]; | |
9777 aDayNames[4] = pGlobalTXT_LocalizationStrings[91]; | |
9778 aDayNames[5] = pGlobalTXT_LocalizationStrings[188]; | |
9779 aDayNames[6] = pGlobalTXT_LocalizationStrings[222]; | |
9780 } | |
9781 | |
9782 //----- (004140BB) -------------------------------------------------------- | |
995 | 9783 void SetSpellSchoolNames() |
0 | 9784 { |
9785 aSpellSchoolNames[0] = pGlobalTXT_LocalizationStrings[87]; | |
9786 aSpellSchoolNames[1] = pGlobalTXT_LocalizationStrings[6]; | |
9787 aSpellSchoolNames[2] = pGlobalTXT_LocalizationStrings[240]; | |
9788 aSpellSchoolNames[3] = pGlobalTXT_LocalizationStrings[70]; | |
9789 aSpellSchoolNames[4] = pGlobalTXT_LocalizationStrings[214]; | |
9790 aSpellSchoolNames[5] = pGlobalTXT_LocalizationStrings[142]; | |
9791 aSpellSchoolNames[6] = pGlobalTXT_LocalizationStrings[29]; | |
9792 aSpellSchoolNames[7] = pGlobalTXT_LocalizationStrings[133]; | |
9793 aSpellSchoolNames[8] = pGlobalTXT_LocalizationStrings[54]; | |
9794 } | |
9795 | |
9796 //----- (0041411B) -------------------------------------------------------- | |
995 | 9797 void SetAttributeNames() |
0 | 9798 { |
9799 aAttributeNames[0] = pGlobalTXT_LocalizationStrings[144]; | |
9800 aAttributeNames[1] = pGlobalTXT_LocalizationStrings[116]; | |
9801 aAttributeNames[2] = pGlobalTXT_LocalizationStrings[163]; | |
9802 aAttributeNames[3] = pGlobalTXT_LocalizationStrings[75]; | |
9803 aAttributeNames[4] = pGlobalTXT_LocalizationStrings[1]; | |
9804 aAttributeNames[5] = pGlobalTXT_LocalizationStrings[211]; | |
9805 aAttributeNames[6] = pGlobalTXT_LocalizationStrings[136]; | |
9806 } | |
9807 | |
9808 //----- (00414162) -------------------------------------------------------- | |
995 | 9809 void uGameUIFontMain_initialize() |
0 | 9810 { |
949 | 9811 uGameUIFontMain = TargetColor(0xAu, 0, 0); |
0 | 9812 } |
9813 | |
9814 //----- (00414174) -------------------------------------------------------- | |
995 | 9815 void uGameUIFontShadow_initialize() |
0 | 9816 { |
949 | 9817 uGameUIFontShadow = TargetColor(0xE6u, 214u, 193u); |
0 | 9818 } |
9819 | |
9820 | |
9821 | |
9822 | |
9823 //----- (0041420D) -------------------------------------------------------- | |
9824 void __cdecl sub_41420D_press_esc() | |
9825 { | |
9826 GUIWindow v0; // [sp+4h] [bp-54h]@1 | |
9827 | |
9828 sprintf(pTmpBuf2, "%s\n \n%s", ptr_507BDC->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape | |
9829 v0.Hint = pTmpBuf2; | |
9830 v0.uFrameWidth = 400; | |
9831 v0.uFrameHeight = 100; | |
9832 v0.uFrameX = 120; | |
9833 v0.uFrameY = 140; | |
9834 v0.uFrameZ = 519; | |
9835 v0.uFrameW = 239; | |
9836 v0.DrawMessageBox(0); | |
9837 } | |
9838 | |
9839 //----- (0041426F) -------------------------------------------------------- | |
9840 void __cdecl sub_41426F() | |
9841 { | |
9842 GUIWindow *v0; // ecx@1 | |
9843 | |
9844 v0 = ptr_507BDC; | |
437 | 9845 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BDC->ptr_1C, 0, 0); |
1038 | 9846 |
0 | 9847 v0->Release(); |
9848 ptr_507BDC = 0; | |
9849 pCurrentScreen = dword_506F0C[0]; | |
9850 pEventTimer->Resume(); | |
9851 } | |
9852 // 4E28F8: using guessed type int pCurrentScreen; | |
9853 | |
706 | 9854 |
9855 | |
762 | 9856 void LoadFonts_and_DrawCopyrightWindow() |
9857 { | |
9858 MainMenuUI_LoadFontsAndSomeStuff(); | |
9859 DrawCopyrightWindow(); | |
9860 } | |
0 | 9861 |
9862 //----- (00415485) -------------------------------------------------------- | |
573 | 9863 void DrawCopyrightWindow() |
0 | 9864 { |
9865 GUIWindow Dst; // [sp+8h] [bp-54h]@1 | |
9866 | |
9867 memset(&Dst, 0, 0x54u); | |
9868 Dst.uFrameWidth = 624; | |
9869 Dst.uFrameHeight = 256; | |
9870 Dst.uFrameX = 8; | |
9871 Dst.uFrameY = 30; // c 1999 The 3DO Company. | |
9872 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(pGlobalTXT_LocalizationStrings[157], &Dst, 24, 0) | |
9873 + 2 * LOBYTE(pFontSmallnum->uFontHeight) | |
9874 + 24; | |
9875 Dst.uFrameY = 470 - Dst.uFrameHeight; | |
9876 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
9877 Dst.uFrameW = 469; | |
1004 | 9878 //Dst.Hint = "abcagfdsgsg ljsrengvlkjesnfkjwnef"; |
0 | 9879 Dst.DrawMessageBox(0); |
1004 | 9880 |
0 | 9881 Dst.uFrameWidth -= 24; |
9882 Dst.uFrameX += 12; | |
9883 Dst.uFrameY += 12; | |
9884 Dst.uFrameHeight -= 12; | |
9885 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
9886 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
1004 | 9887 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3); |
0 | 9888 } |
9889 | |
9890 | |
9891 | |
9892 //----- (004156F0) -------------------------------------------------------- | |
1031 | 9893 void GUI_UpdateWindows() |
0 | 9894 { |
9895 GUIWindow *pWindow; // esi@4 | |
1033 | 9896 //unsigned int pWindowType; // eax@4 |
0 | 9897 char *pHint; // edx@66 |
9898 GUIButton *pButtonPtr_1C; // ebp@79 | |
4 | 9899 char *pHint1; // edx@80 |
0 | 9900 int v26; // eax@98 |
9901 unsigned int v27; // ebp@106 | |
9902 GUIWindow *pGUIWindow2; // ecx@109 | |
9903 GUIFont *pGUIFont; // ST1C_4@115 | |
9904 int v31; // eax@115 | |
959 | 9905 GUIButton *pButton; // ebp@118 |
0 | 9906 int v39; // eax@129 |
9907 unsigned int pNumMessages; // eax@142 | |
9908 GUIButton *pGUIButton; // ebp@146 | |
973 | 9909 //unsigned int pX; // [sp-1Ch] [bp-124h]@17 |
9910 //unsigned int pY; // [sp-18h] [bp-120h]@17 | |
9911 //Texture *pTexture; // [sp-14h] [bp-11Ch]@17 | |
9912 //Texture *pTexture2; // [sp-14h] [bp-11Ch]@86 | |
0 | 9913 int i; // [sp+0h] [bp-108h]@3 |
9914 ItemGen pItemGen; // [sp+4h] [bp-104h]@98 | |
9915 GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133 | |
9916 ItemGen ItemGen2; // [sp+E4h] [bp-24h]@129 | |
9917 | |
9918 if (GetCurrentMenuID() != MENU_CREATEPARTY) | |
972 | 9919 UI_OnKeyDown(VK_NEXT); |
9920 | |
0 | 9921 for ( i = 1; i <= uNumVisibleWindows; ++i ) |
9922 { | |
9923 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; | |
9924 switch (pWindow->eWindowType) | |
9925 { | |
970 | 9926 case WINDOW_OptionsButtons: |
962 | 9927 { |
973 | 9928 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y, |
9929 pViewport->uViewportTL_X, pIcons_LOD->GetTexture(uTextureID_Options)); | |
962 | 9930 viewparams->bRedrawGameUI = 1; |
9931 continue; | |
9932 } | |
970 | 9933 case WINDOW_CharacterRecord: |
962 | 9934 { |
991 | 9935 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]); |
962 | 9936 continue; |
9937 } | |
970 | 9938 case WINDOW_Options: |
962 | 9939 { |
1031 | 9940 GameMenuUI_Options_Draw(); |
962 | 9941 continue; |
9942 } | |
970 | 9943 case WINDOW_Book: |
962 | 9944 { |
995 | 9945 BookUI_Draw((WindowType)(int)pWindow->ptr_1C); |
962 | 9946 continue; |
9947 } | |
970 | 9948 case WINDOW_Dialogue: |
962 | 9949 { |
1033 | 9950 GameUI_DrawDialogue(); |
962 | 9951 continue; |
9952 } | |
970 | 9953 case WINDOW_QuickReference: |
962 | 9954 { |
991 | 9955 GameUI_QuickRef_Draw(); |
962 | 9956 continue; |
9957 } | |
970 | 9958 case WINDOW_Rest: |
962 | 9959 { |
9960 RestUI_Draw(); | |
9961 continue; | |
9962 } | |
970 | 9963 case WINDOW_ChangeLocation: |
962 | 9964 { |
9965 TravelUI_Draw(); | |
9966 continue; | |
9967 } | |
970 | 9968 case WINDOW_SpellBook: |
962 | 9969 { |
1004 | 9970 DrawSpellBookContent(pPlayers[uActiveCharacter]); |
962 | 9971 continue; |
9972 } | |
970 | 9973 case WINDOW_GreetingNPC: |
962 | 9974 { |
1033 | 9975 GameUI_DrawBranchlessDialogue(); |
962 | 9976 continue; |
9977 } | |
970 | 9978 case WINDOW_Chest: |
962 | 9979 { |
9980 if ( pCurrentScreen == SCREEN_CHEST ) | |
9981 { | |
9982 Chest::DrawChestUI((unsigned int)pWindow->ptr_1C); | |
9983 } | |
987 | 9984 else if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) |
962 | 9985 { |
9986 pRenderer->ClearZBuffer(0, 479); | |
9987 draw_leather(); | |
984 | 9988 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
973 | 9989 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId)); |
962 | 9990 } |
9991 continue; | |
9992 } | |
970 | 9993 case WINDOW_SaveLoadButtons: |
962 | 9994 { |
1033 | 9995 SaveUI_Draw(); |
962 | 9996 continue; |
9997 } | |
970 | 9998 case WINDOW_MainMenu_Load: |
961 | 9999 { |
1033 | 10000 LoadUI_Draw(); |
962 | 10001 continue; |
10002 } | |
970 | 10003 case WINDOW_HouseInterior: |
962 | 10004 { |
10005 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager(); | |
10006 if ( !window_SpeakInHouse ) | |
10007 continue; | |
970 | 10008 if ( (signed int)window_SpeakInHouse->ptr_1C >= 53 ) |
10009 continue; | |
10010 if ( pParty->field_3C._shop_ban_times[(signed int)window_SpeakInHouse->ptr_1C] <=pParty->uTimePlayed ) | |
962 | 10011 { |
970 | 10012 if ( (signed int)window_SpeakInHouse->ptr_1C < 53 ) |
10013 { | |
10014 pParty->field_3C._shop_ban_times[(signed int)window_SpeakInHouse->ptr_1C] = 0; | |
962 | 10015 } |
10016 continue; | |
10017 } | |
10018 pNumMessages = pMessageQueue_50CBD0->uNumMessages; | |
10019 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
10020 continue; | |
10021 } | |
970 | 10022 case WINDOW_Transition: |
962 | 10023 { |
10024 TransitionUI_Draw(); | |
10025 continue; | |
10026 } | |
970 | 10027 case WINDOW_Scroll: |
962 | 10028 { |
10029 CreateScrollWindow(); | |
10030 continue; | |
10031 } | |
970 | 10032 case WINDOW_CastSpell_InInventory: |
962 | 10033 { |
10034 pRenderer->ClearZBuffer(0, 479); | |
10035 draw_leather(); | |
984 | 10036 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
991 | 10037 CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]); |
973 | 10038 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u)); |
962 | 10039 continue; |
10040 } | |
970 | 10041 case WINDOW_FinalWindow: |
962 | 10042 { |
10043 sub_41420D_press_esc(); | |
10044 continue; | |
10045 } | |
970 | 10046 case WINDOW_50: |
962 | 10047 { |
10048 v27 = TargetColor(255, 255, 255); | |
1038 | 10049 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
962 | 10050 { |
10051 ptr_507BD0->DrawMessageBox(0); | |
10052 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
10053 v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); | |
10054 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate); | |
10055 continue; | |
10056 } | |
1038 | 10057 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) |
962 | 10058 { |
1038 | 10059 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
962 | 10060 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); |
10061 pEventTimer->Resume(); | |
10062 ptr_507BD0->Release(); | |
1038 | 10063 pCurrentScreen = SCREEN_GAME; |
10064 viewparams->bRedrawGameUI = true; | |
962 | 10065 continue; |
10066 } | |
1038 | 10067 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) |
962 | 10068 { |
1038 | 10069 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
962 | 10070 pEventTimer->Resume(); |
10071 ptr_507BD0->Release(); | |
10072 continue; | |
10073 } | |
10074 } | |
970 | 10075 case WINDOW_59: |
962 | 10076 { |
10077 pWindow->DrawMessageBox(0); | |
10078 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | |
10079 pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
10080 if ( !pKeyActionMap->field_204 ) | |
10081 { | |
10082 ItemGen2.Reset(); | |
10083 pWindow->Release(); | |
10084 pEventTimer->Resume(); | |
10085 pCurrentScreen = 0; | |
1038 | 10086 viewparams->bRedrawGameUI = true; |
962 | 10087 v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); |
10088 if ( v26 > 0 ) | |
10089 { | |
10090 if ( v26 < 800 ) | |
10091 { | |
10092 ItemGen2.uAttributes |= 1u; | |
10093 ItemGen2.uItemID = v26; | |
10094 if ( pItemsTable->pItems[v26].uEquipType == 12 ) | |
10095 { | |
10096 ItemGen2.uNumCharges = rand() % 6 + pItemsTable->pItems[ItemGen2.uItemID].uDamageMod + 1; | |
10097 ItemGen2.uMaxCharges = LOBYTE(ItemGen2.uNumCharges); | |
10098 } | |
10099 else | |
10100 { | |
10101 if ( v26 >= 221 && v26 < 271 ) | |
10102 ItemGen2.uEnchantmentType = rand() % 10 + 1; | |
10103 } | |
10104 pItemsTable->SetSpecialBonus(&ItemGen2); | |
10105 pParty->SetHoldingItem(&ItemGen2); | |
10106 } | |
10107 } | |
10108 } | |
10109 continue; | |
10110 } | |
970 | 10111 case WINDOW_PressedButton2: |
962 | 10112 { |
10113 if ( pWindow->Hint != (char *)1 ) | |
10114 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
10115 pButton = (GUIButton *)pWindow->ptr_1C; | |
10116 if ( pButton->uX >= 0 && pButton->uX <= 640 ) | |
10117 { | |
10118 if ( pButton->uY >= 0 && pButton->uY <= 480 ) | |
10119 { | |
10120 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
10121 viewparams->bRedrawGameUI = 1; | |
10122 if ( pWindow->Hint ) | |
10123 { | |
970 | 10124 if ( pWindow->Hint != (char *)1 ) |
962 | 10125 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
10126 } | |
10127 pWindow->Release(); | |
10128 continue; | |
10129 } | |
10130 } | |
10131 viewparams->bRedrawGameUI = 1; | |
10132 if ( pWindow->Hint ) | |
10133 { | |
970 | 10134 if ( pWindow->Hint != (char *)1 ) |
962 | 10135 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
10136 } | |
10137 pWindow->Release(); | |
10138 continue; | |
10139 } | |
970 | 10140 case WINDOW_CharactersPressedButton: |
962 | 10141 { |
10142 if ( pWindow->Hint != (char *)1 ) | |
10143 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
10144 pButton = (GUIButton *)pWindow->ptr_1C; | |
10145 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
10146 viewparams->bRedrawGameUI = 1; | |
10147 if ( pWindow->Hint ) | |
10148 { | |
970 | 10149 if ( pWindow->Hint != (char *)1 ) |
962 | 10150 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
10151 } | |
10152 pWindow->Release(); | |
10153 continue; | |
10154 } | |
970 | 10155 case WINDOW_PressedButton: |
962 | 10156 { |
10157 if ( pWindow->Hint != (char *)1 ) | |
10158 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
10159 pButton = (GUIButton *)pWindow->ptr_1C; | |
10160 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
10161 viewparams->bRedrawGameUI = 1; | |
10162 if ( pWindow->Hint ) | |
10163 { | |
970 | 10164 if ( pWindow->Hint != (char *)1 ) |
962 | 10165 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); |
10166 } | |
10167 pWindow->Release(); | |
10168 continue; | |
10169 } | |
970 | 10170 case WINDOW_5D: |
962 | 10171 { |
10172 if ( pWindow->Hint != (char *)1 ) | |
10173 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
10174 pButton = (GUIButton *)pWindow->ptr_1C; | |
10175 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
10176 viewparams->bRedrawGameUI = 1; | |
10177 pWindow->Release(); | |
10178 continue; | |
10179 } | |
970 | 10180 case WINDOW_SaveLoadBtn: |
961 | 10181 { |
10182 if (pWindow->Hint != (char *)1) | |
10183 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
962 | 10184 pButton = (GUIButton *)pWindow->ptr_1C; |
10185 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
961 | 10186 pHint = pWindow->Hint; |
10187 viewparams->bRedrawGameUI = 1; | |
10188 if ( pHint && pHint != (char *)1 ) | |
962 | 10189 pButton->DrawLabel(pHint, pFontCreate, 0, 0); |
961 | 10190 pWindow->Release(); |
10191 if (pCurrentScreen == SCREEN_SAVEGAME) | |
10192 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0); | |
10193 else | |
10194 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); | |
962 | 10195 continue; |
10196 } | |
970 | 10197 case WINDOW_LoadGame_CancelBtn: |
962 | 10198 { |
10199 if ( pWindow->Hint != (char *)1 ) | |
10200 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
10201 pButton = (GUIButton *)pWindow->ptr_1C; | |
10202 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
10203 viewparams->bRedrawGameUI = 1; | |
10204 if ( pWindow->Hint && pWindow->Hint != (char *)1 ) | |
10205 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
10206 pWindow->Release(); | |
10207 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
10208 continue; | |
10209 } | |
970 | 10210 case WINDOW_CloseRestWindowBtn: |
962 | 10211 { |
10212 if ( pWindow->Hint != (char *)1 ) | |
10213 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
10214 pGUIButton = (GUIButton *)pWindow->ptr_1C; | |
10215 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]); | |
10216 pHint = pWindow->Hint; | |
10217 viewparams->bRedrawGameUI = 1; | |
10218 if ( pHint && pHint != (char *)1 ) | |
10219 pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
10220 pWindow->Release(); | |
10221 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
10222 continue; | |
10223 } | |
970 | 10224 case WINDOW_ExitCharacterWindow: |
962 | 10225 { |
10226 if ( pWindow->Hint != (char *)1 ) | |
10227 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
10228 pButton = (GUIButton *)pWindow->ptr_1C; | |
10229 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
10230 pHint = pWindow->Hint; | |
10231 viewparams->bRedrawGameUI = 1; | |
10232 if ( pHint && pHint != (char *)1 ) | |
10233 pButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
10234 pWindow->Release(); | |
10235 pNumMessages = pMessageQueue_50CBD0->uNumMessages; | |
10236 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
10237 continue; | |
10238 } | |
970 | 10239 case WINDOW_RestWindow: |
962 | 10240 { |
10241 memset(&GUIButton2, 0, 0xBCu); | |
10242 GUIButton2.uZ = 197; | |
10243 GUIButton2.uW = 197; | |
10244 GUIButton2.uX = 27; | |
10245 GUIButton2.uY = 161; | |
10246 GUIButton2.uWidth = 171; | |
10247 GUIButton2.uHeight = 37; | |
10248 GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent; | |
10249 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
10250 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15)); | |
10251 viewparams->bRedrawGameUI = 1; | |
10252 GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);//Îòäûõ è ëå÷åíèå 8 ÷àñîâ | |
10253 GUIButton2.pParent = 0; | |
10254 pGUIWindow2 = pWindow; | |
10255 pGUIWindow2->Release(); | |
10256 continue; | |
10257 } | |
970 | 10258 case WINDOW_BooksWindow: |
962 | 10259 { |
10260 pButton = (GUIButton *)pWindow->ptr_1C; | |
973 | 10261 pRenderer->DrawTextureIndexed(pWindow->uFrameY, |
10262 pWindow->uFrameX, pButton->pTextures[0]); | |
1033 | 10263 viewparams->bRedrawGameUI = true; |
962 | 10264 continue; |
10265 } | |
970 | 10266 case WINDOW_CharacterWindow_Inventory: |
962 | 10267 { |
10268 pWindow->DrawMessageBox(0); | |
10269 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | |
10270 pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
10271 if ( !pKeyActionMap->field_204 ) | |
10272 { | |
10273 ItemGen2.Reset(); | |
10274 pWindow->Release(); | |
10275 pEventTimer->Resume(); | |
10276 pCurrentScreen = SCREEN_GAME; | |
10277 viewparams->bRedrawGameUI = 1; | |
10278 v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
10279 if ( v39 > 0 ) | |
10280 { | |
10281 if ( v39 < 800 ) | |
10282 SpawnActor(v39); | |
10283 } | |
10284 } | |
10285 continue; | |
10286 } | |
970 | 10287 case WINDOW_KeyMappingOptions: |
962 | 10288 { |
10289 GameMenuUI_DrawKeyBindings(); | |
10290 continue; | |
10291 } | |
970 | 10292 case WINDOW_VideoOptions: |
962 | 10293 { |
10294 GameMenuUI_DrawVideoOptions(); | |
10295 continue; | |
10296 } | |
10297 default: | |
10298 { | |
10299 continue; | |
10300 } | |
10301 } | |
0 | 10302 } |
10303 if ( GetCurrentMenuID() == -1 ) | |
10304 GameUI_DrawFoodAndGold(); | |
10305 if ( sub_4637E0_is_there_popup_onscreen() ) | |
10306 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0); | |
10307 } | |
10308 | |
10309 //----- (00416196) -------------------------------------------------------- | |
1033 | 10310 void identify_item() |
0 | 10311 { |
10312 Player *v0; // esi@2 | |
10313 POINT *v1; // edi@2 | |
10314 signed int v2; // ecx@5 | |
10315 signed int v3; // eax@5 | |
10316 int v4; // eax@5 | |
10317 char v5; // sf@5 | |
10318 int v6; // eax@5 | |
10319 int v7; // eax@7 | |
10320 unsigned __int16 v8; // ax@10 | |
10321 int v9; // edi@10 | |
10322 int v10; // eax@10 | |
10323 int v11; // edx@13 | |
10324 LONG v12; // edx@23 | |
10325 signed int v13; // edx@23 | |
10326 int v14; // edx@25 | |
10327 unsigned int v15; // edi@25 | |
10328 signed int v16; // edx@27 | |
10329 int v17; // eax@54 | |
10330 unsigned int v18; // edx@57 | |
10331 int v19; // eax@65 | |
10332 int v20; // edi@67 | |
10333 int v21; // eax@72 | |
10334 int v22; // ecx@74 | |
10335 int v23; // edx@78 | |
10336 int v24; // eax@79 | |
10337 int v25; // eax@80 | |
10338 int v26; // eax@84 | |
10339 ItemGen *v27; // esi@98 | |
10340 unsigned int v28; // eax@98 | |
10341 ItemGen *v29; // edi@98 | |
10342 unsigned int v30; // ecx@103 | |
10343 double v31; // st7@112 | |
10344 unsigned __int64 v32; // qax@113 | |
10345 unsigned int v33; // ecx@117 | |
10346 int v34; // eax@126 | |
10347 unsigned int v35; // ecx@127 | |
10348 double v36; // st7@132 | |
10349 signed __int64 v37; // qax@135 | |
10350 unsigned int v38; // eax@138 | |
10351 Vec3_int_ v39; // [sp-18h] [bp-A8h]@83 | |
10352 int *v40; // [sp-Ch] [bp-9Ch]@83 | |
10353 int *v41; // [sp-8h] [bp-98h]@83 | |
10354 int *v42; // [sp-4h] [bp-94h]@83 | |
10355 GUIWindow v43; // [sp+Ch] [bp-84h]@137 | |
10356 unsigned int pY; // [sp+60h] [bp-30h]@2 | |
10357 int v45; // [sp+64h] [bp-2Ch]@10 | |
10358 unsigned int pX; // [sp+68h] [bp-28h]@2 | |
10359 int v47; // [sp+6Ch] [bp-24h]@25 | |
10360 POINT y; // [sp+70h] [bp-20h]@2 | |
10361 POINT a2; // [sp+78h] [bp-18h]@2 | |
10362 Vec3_int_ pOut; // [sp+80h] [bp-10h]@2 | |
10363 unsigned int v51; // [sp+8Ch] [bp-4h]@23 | |
10364 | |
10365 if ( dword_50CDCC ) | |
10366 return; | |
10367 v0 = pPlayers[uActiveCharacter]; | |
10368 v1 = pMouse->GetCursorPos(&a2); | |
10369 pOut.z = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&y)->y]] & 0xFFFF; | |
10370 pMouse->GetClickPos(&pX, &pY); | |
10371 if ( !pOut.z ) | |
10372 { | |
10373 if ( (signed int)pX <= 13 | |
10374 || (signed int)pX >= 462 | |
10375 || (v2 = pX - 14, | |
10376 v3 = pY - 17, | |
10377 pX = v2, | |
10378 pY = v3, | |
10379 v4 = 14 * (v3 >> 5), | |
10380 v2 >>= 5, | |
10381 v5 = v2 + v4 < 0, | |
10382 v6 = v2 + v4, | |
10383 pOut.z = v6, | |
10384 v5) | |
10385 || v6 > 126 | |
10386 || (v7 = v0->GetItemIDAtInventoryIndex(&pOut.z)) == 0 ) | |
10387 return; | |
10388 pOut.z = v7; | |
10389 } | |
10390 if ( !v0->CanAct() ) | |
10391 { | |
10392 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[427], v0->pName, pGlobalTXT_LocalizationStrings[541]); | |
10393 v43.Hint = pTmpBuf; | |
10394 v43.uFrameWidth = 384; | |
10395 v43.uFrameHeight = 180; | |
10396 v43.uFrameY = 40; | |
10397 if ( pMouse->GetCursorPos(&a2)->x <= 320 ) | |
10398 v38 = pMouse->GetCursorPos(&a2)->x + 30; | |
10399 else | |
10400 v38 = pMouse->GetCursorPos(&a2)->x - 414; | |
10401 v43.uFrameX = v38; | |
10402 v43.DrawMessageBox(0); | |
10403 return; | |
10404 } | |
10405 --pOut.z; | |
10406 LOBYTE(v8) = v0->GetActualSkillLevel(PLAYER_SKILL_ALCHEMY); | |
10407 v9 = v8 & 0x3F; | |
10408 v45 = v8 & 0x3F; | |
10409 pOut.y = SkillToMastery(v8); | |
10410 v10 = pOut.z; | |
10411 if ( pParty->pPickedItem.uItemID == 220 ) | |
10412 { | |
10413 LABEL_116: | |
10414 GameUI_DrawItemInfo(&v0->pInventoryItems[v10]); | |
10415 return; | |
10416 } | |
10417 if ( (signed int)pParty->pPickedItem.uItemID < 200 | |
10418 || (signed int)pParty->pPickedItem.uItemID > 219 | |
10419 || (v11 = (int)((char *)v0 + 36 * pOut.z), *(int *)(v11 + 532) != 220) ) | |
10420 { | |
10421 if ( (signed int)pParty->pPickedItem.uItemID < 221 | |
10422 || (signed int)pParty->pPickedItem.uItemID > 271 | |
10423 || (v12 = (LONG)((char *)v0 + 36 * pOut.z), a2.y = v12, v13 = *(int *)(v12 + 532), v51 = v13, v13 < 221) | |
10424 || v13 > 271 ) | |
10425 { | |
10426 if ( pParty->pPickedItem.uItemID != 236 | |
10427 && ((signed int)pParty->pPickedItem.uItemID < 246 || (signed int)pParty->pPickedItem.uItemID > 250) | |
10428 && pParty->pPickedItem.uItemID != 263 | |
10429 && pParty->pPickedItem.uItemID != 233 ) | |
10430 goto LABEL_116; | |
10431 v27 = &v0->pInventoryItems[pOut.z]; | |
10432 v28 = v27->uItemID; | |
10433 v51 = pItemsTable->pItems[v27->uItemID].uEquipType; | |
570 | 10434 v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEnchantmentType); |
0 | 10435 if ( pParty->pPickedItem.uItemID != 233 ) |
10436 { | |
10437 if ( pParty->pPickedItem.uItemID == 236 ) | |
10438 { | |
10439 v35 = v27->uAttributes; | |
10440 if ( v35 & 2 || (v51 & 0x80000000u) != 0 || (signed int)v51 > 12 || (signed int)v28 >= 500 ) | |
10441 goto LABEL_92; | |
10442 LOWORD(v35) = v35 | 0x210; | |
10443 v27->uAttributes = v35; | |
10444 } | |
10445 else | |
10446 { | |
10447 if ( (signed int)pParty->pPickedItem.uItemID <= 245 ) | |
10448 goto LABEL_92; | |
10449 if ( (signed int)pParty->pPickedItem.uItemID <= 250 ) | |
10450 { | |
10451 v27->UpdateTempBonus(pParty->uTimePlayed); | |
10452 v33 = v27->uItemID; | |
10453 if ( (signed int)v27->uItemID >= 64 && (signed int)v33 <= 65 | |
10454 || (pOut.y = v27->uAttributes, pOut.y & 2) | |
377 | 10455 || v27->uSpecEnchantmentType |
570 | 10456 || v27->uEnchantmentType |
0 | 10457 || v51 && v51 != 1 && v51 != 2 |
10458 || (signed int)v33 >= 500 ) | |
10459 goto LABEL_92; | |
10460 v34 = *(int *)&aSbwb00[4 * pParty->pPickedItem.uItemID + 4]; | |
10461 a2.y = (int)v29 << 7; | |
10462 v31 = (double)(signed int)((int)v29 << 7); | |
377 | 10463 v27->uSpecEnchantmentType = v34; |
0 | 10464 } |
10465 else | |
10466 { | |
10467 if ( pParty->pPickedItem.uItemID != 263 | |
10468 || (v27->UpdateTempBonus(pParty->uTimePlayed), v30 = v27->uItemID, (signed int)v27->uItemID >= 64) | |
10469 && (signed int)v30 <= 65 | |
10470 || (pOut.y = v27->uAttributes, pOut.y & 2) | |
377 | 10471 || v27->uSpecEnchantmentType |
570 | 10472 || v27->uEnchantmentType |
0 | 10473 || v51 && v51 != 1 && v51 != 2 |
10474 || (signed int)v30 >= 500 ) | |
10475 goto LABEL_92; | |
10476 a2.y = (int)v29 << 7; | |
377 | 10477 v27->uSpecEnchantmentType = 40; |
0 | 10478 v31 = (double)a2.y; |
10479 } | |
10480 v32 = pParty->uTimePlayed + (signed int)(signed __int64)(v31 * 0.033333335); | |
10481 LODWORD(v27->uExpireTime) = v32; | |
10482 LODWORD(v32) = pOut.y; | |
10483 LOBYTE(v32) = LOBYTE(pOut.y) | 0x18; | |
10484 HIDWORD(v27->uExpireTime) = HIDWORD(v32); | |
10485 v27->uAttributes = v32; | |
10486 } | |
984 | 10487 _50C9A8_item_enchantment_timer = 256; |
0 | 10488 goto LABEL_92; |
10489 } | |
570 | 10490 v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; |
0 | 10491 if ( v36 < 0.0 ) |
10492 v36 = 0.0; | |
10493 if ( v51 != 12 ) | |
10494 { | |
10495 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); | |
10496 return; | |
10497 } | |
10498 a2.y = v27->uMaxCharges; | |
10499 v37 = (signed __int64)((double)a2.y - v36 * (double)a2.y); | |
10500 v27->uMaxCharges = v37; | |
10501 v27->uNumCharges = (unsigned __int8)v37; | |
10502 goto LABEL_92; | |
10503 } | |
10504 v14 = v13 - 222; | |
10505 v15 = pParty->pPickedItem.uItemID - 222; | |
10506 v47 = v14; | |
10507 y.y = 0; | |
10508 if ( pParty->pPickedItem.uItemID == 221 || v51 == 221 ) | |
10509 { | |
10510 v16 = 5; | |
10511 } | |
10512 else | |
10513 { | |
10514 v16 = *(short *)&pItemsTable->field_EDE0[2 * (v14 + 50 * v15) + 388]; | |
10515 v10 = pOut.z; | |
10516 } | |
10517 v51 = v16; | |
10518 if ( v45 ) | |
10519 { | |
10520 if ( v16 < 225 || v16 > 227 ) | |
10521 { | |
10522 if ( v16 < 228 || v16 > 239 ) | |
10523 { | |
10524 if ( v16 < 240 || v16 > 261 ) | |
10525 { | |
10526 if ( v16 >= 262 && pOut.y != 4 ) | |
10527 { | |
10528 LABEL_53: | |
10529 v51 = 4; | |
10530 goto LABEL_54; | |
10531 } | |
10532 } | |
10533 else | |
10534 { | |
10535 if ( pOut.y <= 2 ) | |
10536 { | |
10537 LABEL_38: | |
10538 v51 = 3; | |
10539 goto LABEL_54; | |
10540 } | |
10541 } | |
10542 } | |
10543 else | |
10544 { | |
10545 if ( pOut.y == 1 ) | |
10546 { | |
10547 LABEL_35: | |
10548 v51 = 2; | |
10549 goto LABEL_54; | |
10550 } | |
10551 } | |
10552 } | |
10553 } | |
10554 else | |
10555 { | |
10556 if ( v16 >= 225 && v16 <= 227 ) | |
10557 { | |
10558 v51 = 1; | |
10559 goto LABEL_54; | |
10560 } | |
10561 if ( v16 >= 228 && v16 <= 239 ) | |
10562 goto LABEL_35; | |
10563 if ( v16 >= 240 && v16 <= 261 ) | |
10564 goto LABEL_38; | |
10565 if ( v16 >= 262 ) | |
10566 goto LABEL_53; | |
10567 } | |
10568 LABEL_54: | |
10569 pOut.y = 0; | |
10570 pOut.x = v10 + 1; | |
10571 v17 = (int)v0->pInventoryIndices; | |
10572 while ( *(int *)v17 != pOut.x ) | |
10573 { | |
10574 ++pOut.y; | |
10575 v17 += 4; | |
10576 if ( pOut.y >= 126 ) | |
10577 { | |
10578 v18 = y.y; | |
10579 goto LABEL_59; | |
10580 } | |
10581 } | |
10582 v18 = pOut.y; | |
10583 LABEL_59: | |
10584 if ( !v51 ) | |
10585 { | |
10586 LABEL_115: | |
10587 v10 = pOut.z; | |
10588 goto LABEL_116; | |
10589 } | |
10590 if ( v51 == 1 ) | |
10591 { | |
10592 v0->RemoveItemAtInventoryIndex(v18); | |
10593 v26 = rand(); | |
10594 v0->ReceiveDamage(v26 % 11 + 10, 0); | |
10595 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); | |
437 | 10596 |
10597 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1033 | 10598 |
0 | 10599 v42 = (int *)&a2.y; |
10600 v41 = (int *)&y.y; | |
10601 v40 = (int *)&pOut; | |
10602 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
10603 } | |
10604 else | |
10605 { | |
10606 if ( v51 == 2 ) | |
10607 { | |
10608 v0->RemoveItemAtInventoryIndex(v18); | |
10609 v25 = rand(); | |
10610 v0->ReceiveDamage(v25 % 71 + 30, 0); | |
10611 v23 = 1; | |
10612 } | |
10613 else | |
10614 { | |
10615 if ( v51 == 3 ) | |
10616 { | |
10617 v0->RemoveItemAtInventoryIndex(v18); | |
10618 v24 = rand(); | |
10619 v0->ReceiveDamage(v24 % 201 + 50, 0); | |
10620 v23 = 5; | |
10621 } | |
10622 else | |
10623 { | |
10624 if ( v51 != 4 ) | |
10625 { | |
10626 if ( v51 != 5 ) | |
10627 { | |
1014 | 10628 v19 = v0->AddItem(-1, 0xDCu); |
0 | 10629 if ( v19 ) |
1019 | 10630 // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; |
10631 v0->pOwnItems[v19-1].uAttributes=ITEM_IDENTIFIED; | |
0 | 10632 v20 = v47 + 50 * v15; |
10633 v0->pInventoryItems[pOut.z].uItemID = v51; | |
570 | 10634 v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType |
10635 + v0->pInventoryItems[pOut.z].uEnchantmentType) | |
0 | 10636 / 2; |
222 | 10637 v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 |
0 | 10638 LABEL_74: |
10639 v22 = (int)((char *)v0 + 36 * pOut.z); | |
222 | 10640 if ( !(pItemsTable->pItems[*(int *)(v22 + 532) ].uItemID_Rep_St) ) |
0 | 10641 *(int *)(v22 + 552) |= 1u; |
10642 if ( !dword_4E455C ) | |
10643 goto LABEL_92; | |
187 | 10644 v0->PlaySound(SPEECH_16, 0); |
0 | 10645 goto LABEL_91; |
10646 } | |
10647 if ( v45 ) | |
10648 { | |
10649 if ( *(int *)(a2.y + 532) == 221 ) | |
10650 *(int *)(a2.y + 532) = pParty->pPickedItem.uItemID; | |
10651 else | |
570 | 10652 *(int *)(a2.y + 536) = pParty->pPickedItem.uEnchantmentType; |
1014 | 10653 v21 = v0->AddItem(-1, 0xDCu); |
0 | 10654 if ( v21 ) |
1019 | 10655 //*(int *)&v0->field_1F5[36 * v21 + 15] = 1; |
10656 v0->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED; | |
0 | 10657 goto LABEL_74; |
10658 } | |
10659 goto LABEL_115; | |
10660 } | |
10661 v0->RemoveItemAtInventoryIndex(v18); | |
10662 v0->SetCondition(0x10u, 0); | |
10663 v23 = 0; | |
10664 } | |
10665 } | |
1012 | 10666 v0->ItemsEnchant(v23); |
0 | 10667 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); |
437 | 10668 |
10669 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
1033 | 10670 |
0 | 10671 v42 = (int *)&a2.y; |
10672 v41 = (int *)&y.y; | |
10673 v40 = (int *)&pOut; | |
10674 v39.z = pParty->vPosition.z + pParty->sEyelevel; | |
10675 } | |
10676 *(_QWORD *)&v39.x = *(_QWORD *)&pParty->vPosition.x; | |
10677 Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, v40, v41, v42); | |
10678 sub_42F7EB_DropItemAt(0x41Bu, pOut.x, y.y, a2.y, 0, 1, 0, 0, 0); | |
10679 if ( dword_4E455C ) | |
10680 { | |
10681 if ( v0->CanAct() ) | |
187 | 10682 v0->PlaySound(SPEECH_17, 0); |
0 | 10683 ShowStatusBarString(pGlobalTXT_LocalizationStrings[444], 2u); |
10684 LABEL_91: | |
10685 dword_4E455C = 0; | |
10686 } | |
10687 LABEL_92: | |
10688 pMouse->RemoveHoldingItem(); | |
10689 dword_50CDCC = 1; | |
10690 return; | |
10691 } | |
10692 *(int *)(v11 + 536) = v9 + pItemsTable->pItems[pParty->pPickedItem.uItemID].uDamageDice; | |
10693 switch ( pParty->pPickedItem.uItemID ) | |
10694 { | |
10695 case 0xC8u: | |
10696 case 0xC9u: | |
10697 case 0xCAu: | |
10698 case 0xCBu: | |
10699 case 0xCCu: | |
10700 v0->pInventoryItems[pOut.z].uItemID = 222; | |
10701 break; | |
10702 case 0xCDu: | |
10703 case 0xCEu: | |
10704 case 0xCFu: | |
10705 case 0xD0u: | |
10706 case 0xD1u: | |
10707 v0->pInventoryItems[pOut.z].uItemID = 223; | |
10708 break; | |
10709 case 0xD2u: | |
10710 case 0xD3u: | |
10711 case 0xD4u: | |
10712 case 0xD5u: | |
10713 case 0xD6u: | |
10714 v0->pInventoryItems[pOut.z].uItemID = 224; | |
10715 break; | |
10716 case 0xD7u: | |
10717 case 0xD8u: | |
10718 case 0xD9u: | |
10719 case 0xDAu: | |
10720 case 0xDBu: | |
10721 v0->pInventoryItems[pOut.z].uItemID = 221; | |
10722 break; | |
10723 default: | |
10724 break; | |
10725 } | |
10726 pMouse->RemoveHoldingItem(); | |
10727 dword_50CDCC = 1; | |
10728 if ( dword_4E455C ) | |
10729 { | |
187 | 10730 v0->PlaySound(SPEECH_16, 0); |
0 | 10731 dword_4E455C = 0; |
10732 } | |
10733 } | |
10734 | |
10735 | |
10736 | |
706 | 10737 |
0 | 10738 |
10739 //----- (004175C0) -------------------------------------------------------- | |
141 | 10740 void UI_OnMouseLeftClick(int *pXY) |
0 | 10741 { |
10742 int *pXY_; // esi@1 | |
10743 signed int y; // eax@7 | |
10744 signed int x; // ecx@7 | |
10745 unsigned int v4; // eax@11 | |
10746 signed int v5; // eax@17 | |
10747 signed int v6; // esi@19 | |
10748 int v7; // esi@30 | |
10749 GUIWindow *v8; // edx@31 | |
10750 GUIButton *i; // esi@37 | |
10751 signed int v10; // eax@50 | |
10752 int v11; // ecx@52 | |
10753 unsigned int pX; // [sp+14h] [bp-8h]@7 | |
10754 unsigned int pY; // [sp+18h] [bp-4h]@7 | |
10755 | |
10756 pXY_ = pXY; | |
151 | 10757 if ( pCurrentScreen == SCREEN_VIDEO |
0 | 10758 || sub_4637E0_is_there_popup_onscreen() ) |
10759 return; | |
10760 if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 ) | |
10761 { | |
10762 sub_4452BB(); | |
10763 return; | |
10764 } | |
10765 if ( pXY_ ) | |
10766 { | |
10767 x = *pXY_; | |
10768 y = pXY_[1]; | |
10769 pX = *pXY_; | |
10770 pY = y; | |
10771 } | |
10772 else | |
10773 { | |
10774 pMouse->GetClickPos(&pX, &pY); | |
10775 y = pY; | |
10776 x = pX; | |
10777 } | |
271 | 10778 if ( pCurrentScreen != SCREEN_GAME || !dword_507B98_ctrl_pressed ) |
0 | 10779 goto LABEL_30; |
10780 v4 = GetCurrentMenuID(); | |
10781 x = pX; | |
10782 if ( (v4 & 0x80000000u) == 0 | |
693 | 10783 || (signed int)pX < (signed int)pViewport->uViewportTL_X |
10784 || (signed int)pX > (signed int)pViewport->uViewportBR_X ) | |
0 | 10785 { |
10786 y = pY; | |
10787 LABEL_30: | |
10788 v7 = uNumVisibleWindows; | |
10789 if ( uNumVisibleWindows < 0 ) | |
10790 return; | |
10791 while ( 1 ) | |
10792 { | |
10793 //v8 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[v7]]; | |
10794 v8 = &pWindowList[pVisibleWindowsIdxs[v7] - 1]; | |
10795 if ( x >= (signed int)v8->uFrameX ) | |
10796 { | |
10797 if ( x <= (signed int)v8->uFrameZ && y >= (signed int)v8->uFrameY && y <= (signed int)v8->uFrameW ) | |
10798 break; | |
10799 } | |
10800 --v7; | |
10801 if ( v7 < 0 ) | |
10802 return; | |
10803 } | |
10804 for ( i = v8->pControlsHead; ; i = i->pNext ) | |
10805 { | |
10806 if ( !i ) | |
10807 return; | |
10808 if ( i->uButtonType == 1 ) | |
10809 goto LABEL_41; | |
10810 if ( i->uButtonType != 2 ) | |
10811 break; | |
10812 if ( (signed int)(signed __int64)sqrt((double)((x - i->uX) * (x - i->uX) + (y - i->uY) * (y - i->uY))) < (signed int)i->uWidth ) | |
10813 goto LABEL_50; | |
10814 y = pY; | |
10815 x = pX; | |
10816 LABEL_45: | |
10817 ; | |
10818 } | |
10819 if ( i->uButtonType != 3 ) | |
10820 goto LABEL_45; | |
10821 LABEL_41: | |
10822 if ( x >= (signed int)i->uX && x <= (signed int)i->uZ && y >= (signed int)i->uY && y <= (signed int)i->uW ) | |
10823 { | |
10824 LABEL_50: | |
271 | 10825 i->field_2C_is_pushed = 1; |
0 | 10826 v10 = pMessageQueue_50CBD0->uNumMessages; |
10827 if ( pMessageQueue_50CBD0->uNumMessages ) | |
10828 { | |
10829 v10 = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
10830 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
10831 } | |
10832 //v11 = i->uControlParam; | |
832 | 10833 pMessageQueue_50CBD0->AddMessage(i->msg, i->msg_param, 0); |
0 | 10834 return; |
10835 } | |
10836 goto LABEL_45; | |
10837 } | |
10838 y = pY; | |
693 | 10839 if ( (signed int)pY < (signed int)pViewport->uViewportTL_Y || (signed int)pY > (signed int)pViewport->uViewportBR_Y ) |
0 | 10840 goto LABEL_30; |
10841 if ( pRenderer->pRenderD3D ) | |
10842 v5 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
10843 else | |
10844 v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
10845 v6 = (unsigned __int16)v5; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
10846 if (PID_TYPE(v5) == OBJECT_Actor |
0 | 10847 && uActiveCharacter |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
10848 && v5 < 0x2000000 |
0 | 10849 && pPlayers[uActiveCharacter]->CanAct() |
10850 && pPlayers[uActiveCharacter]->CanSteal() ) | |
10851 { | |
437 | 10852 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 10853 { |
990 | 10854 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_1B; |
0 | 10855 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3; |
10856 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
10857 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 10858 }*/ |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
10859 pMessageQueue_50CBD0->AddMessage(UIMSG_1B, PID_ID(v6), 0); |
437 | 10860 |
0 | 10861 if ( pParty->bTurnBasedModeOn == 1 ) |
10862 { | |
10863 if ( pTurnEngine->field_4 == 3 ) | |
10864 pTurnEngine->field_18 |= 8u; | |
10865 } | |
10866 } | |
10867 } | |
10868 | |
10869 | |
10870 | |
10871 //----- (00417871) -------------------------------------------------------- | |
10872 void __thiscall sub_417871(int *pXY) | |
10873 { | |
10874 POINT v1; // [sp+0h] [bp-18h]@5 | |
10875 POINT a2; // [sp+8h] [bp-10h]@5 | |
10876 unsigned int pY; // [sp+10h] [bp-8h]@3 | |
10877 unsigned int pX; // [sp+14h] [bp-4h]@3 | |
10878 | |
10879 if ( !pRenderer->pRenderD3D ) | |
10880 { | |
10881 if ( pXY ) | |
10882 { | |
10883 pX = *pXY; | |
10884 pY = pXY[1]; | |
10885 } | |
10886 else | |
10887 { | |
10888 pMouse->GetClickPos(&pX, &pY); | |
10889 } | |
10890 pMouse->GetCursorPos(&a2); | |
10891 pMouse->GetCursorPos(&v1); | |
10892 } | |
10893 } | |
10894 | |
10895 //----- (004178FE) -------------------------------------------------------- | |
10896 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2) | |
10897 { | |
10898 unsigned __int16 v2; // dx@2 | |
10899 unsigned __int16 v3; // cx@2 | |
10900 int v5; // eax@5 | |
10901 unsigned __int16 v6; // [sp-4h] [bp-8h]@2 | |
10902 | |
10903 if ( a1 <= a2 ) | |
10904 { | |
10905 if ( a1 == a2 ) | |
10906 return 0; | |
10907 v5 = 100 * a1 / a2; | |
10908 v3 = 255; | |
10909 if ( v5 >= 25 ) | |
10910 { | |
10911 v6 = 100; | |
10912 v2 = 255; | |
10913 } | |
10914 else | |
10915 { | |
10916 v6 = 0; | |
10917 v2 = 0; | |
10918 } | |
10919 } | |
10920 else | |
10921 { | |
10922 v6 = 0; | |
10923 v2 = 255; | |
10924 v3 = 0; | |
10925 } | |
949 | 10926 return TargetColor(v3, v2, v6); |
0 | 10927 } |
10928 | |
10929 //----- (00417939) -------------------------------------------------------- | |
10930 signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx) | |
10931 { | |
10932 unsigned int v1; // ebx@1 | |
10933 signed int v2; // edi@1 | |
10934 unsigned int v3; // esi@1 | |
10935 unsigned int v4; // eax@1 | |
10936 unsigned int v6; // [sp+Ch] [bp-4h]@1 | |
10937 | |
10938 v1 = uConditionIdx; | |
10939 v2 = 65535; | |
949 | 10940 v3 = TargetColor(0xE1u, 0xCDu, 0x23u); |
10941 v6 = TargetColor(0xFFu, 0x23u, 0); | |
10942 v4 = TargetColor(0, 0xFFu, 0); | |
0 | 10943 switch ( v1 ) |
10944 { | |
10945 case 0u: | |
10946 case 1u: | |
10947 case 3u: | |
10948 case 4u: | |
10949 case 5u: | |
10950 case 6u: | |
10951 case 7u: | |
10952 v2 = v4; | |
10953 break; | |
10954 case 2u: | |
10955 case 8u: | |
10956 case 9u: | |
10957 case 0xCu: | |
10958 case 0xDu: | |
10959 v2 = v3; | |
10960 break; | |
10961 case 0xAu: | |
10962 case 0xBu: | |
10963 case 0xEu: | |
10964 case 0xFu: | |
10965 case 0x10u: | |
10966 v2 = v6; | |
10967 break; | |
10968 default: | |
10969 return v2; | |
10970 } | |
10971 return v2; | |
10972 } | |
10973 | |
10974 //----- (004179BC) -------------------------------------------------------- | |
1006 | 10975 void __fastcall sub_4179BC_draw_tooltip( const char *a1, const char *a2 ) |
10976 { | |
0 | 10977 const char *v2; // ebx@1 |
10978 const char *v3; // edi@1 | |
10979 unsigned int v4; // eax@1 | |
10980 GUIWindow Dst; // [sp+Ch] [bp-5Ch]@1 | |
10981 POINT v6; // [sp+60h] [bp-8h]@1 | |
10982 | |
10983 v2 = a2; | |
10984 v3 = a1; | |
10985 memset(&Dst, 0, 0x54u); | |
10986 Dst.uFrameWidth = 384; | |
10987 Dst.uFrameHeight = 256; | |
10988 Dst.uFrameX = 128; | |
10989 Dst.uFrameY = pMouse->GetCursorPos(&v6)->y + 30; | |
10990 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(v2, &Dst, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; | |
10991 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
10992 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
10993 Dst.DrawMessageBox(0); | |
10994 Dst.uFrameX += 12; | |
10995 Dst.uFrameWidth -= 24; | |
10996 Dst.uFrameY += 12; | |
10997 Dst.uFrameHeight -= 12; | |
10998 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
10999 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
949 | 11000 v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 11001 sprintf(pTmpBuf, format_4E2D80, v4, v3); |
11002 Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u); | |
1006 | 11003 Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0); |
0 | 11004 } |
11005 | |
11006 //----- (00417AD4) -------------------------------------------------------- | |
983 | 11007 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) |
273 | 11008 { |
0 | 11009 int v8; // eax@10 |
11010 int v12; // eax@14 | |
11011 unsigned int yellow; // [sp+Ch] [bp-Ch]@1 | |
11012 unsigned int red; // [sp+10h] [bp-8h]@1 | |
11013 unsigned int white; // [sp+14h] [bp-4h]@1 | |
11014 | |
949 | 11015 white = TargetColor(0xFFu, 0xFFu, 0xFFu); |
11016 red = TargetColor(0xFFu, 0, 0); | |
11017 yellow = TargetColor(0xFFu, 0xFFu, 0); | |
269 | 11018 if ( !(uPlayerClass % 4) ) |
11019 { | |
273 | 11020 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level ) |
269 | 11021 return white; |
273 | 11022 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level |
11023 && byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level ) | |
269 | 11024 { |
11025 v12 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType]; | |
273 | 11026 if ( v12 < skill_level ) |
269 | 11027 return red; |
0 | 11028 } |
11029 return yellow; | |
11030 } | |
273 | 11031 if ( (uPlayerClass % 4) == 1 ) |
11032 { | |
11033 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level ) | |
269 | 11034 return white; |
273 | 11035 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level ) |
269 | 11036 { |
11037 v8 = byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType]; | |
273 | 11038 if ( v8 < skill_level) |
11039 return red; | |
0 | 11040 } |
11041 return yellow; | |
11042 } | |
273 | 11043 if ( (uPlayerClass % 4) == 2 || (uPlayerClass % 4) == 3 ) |
11044 { | |
11045 if ( byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level ) | |
0 | 11046 return red; |
269 | 11047 } |
11048 return white; | |
0 | 11049 } |
11050 | |
11051 | |
11052 //----- (00419220) -------------------------------------------------------- | |
11053 void __cdecl sub_419220() | |
11054 { | |
11055 GUIButton *i; // eax@2 | |
11056 | |
11057 if ( !dword_507CBC ) | |
11058 { | |
11059 dword_507CBC = 1; | |
11060 for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) | |
11061 { | |
832 | 11062 if ( i->msg == UIMSG_InventoryLeftClick ) |
0 | 11063 { |
11064 dword_50698C = i->uX; | |
11065 dword_506988 = i->uY; | |
11066 dword_506984 = i->uZ; | |
11067 dword_506980 = i->uW; | |
11068 i->uW = 0; | |
11069 i->uZ = 0; | |
11070 i->uY = 0; | |
11071 i->uX = 0; | |
11072 } | |
11073 } | |
973 | 11074 pBtn_Up = pGUIWindow_CurrentMenu->CreateButton(438, 46, |
11075 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureWidth, | |
11076 pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureHeight, | |
11077 1, 0, UIMSG_ClickAwardsUpBtn, 0, 0, "", | |
11078 pIcons_LOD->GetTexture(uTextureID_ar_up_up), | |
11079 pIcons_LOD->GetTexture(uTextureID_ar_up_dn), 0); | |
11080 pBtn_Down = pGUIWindow_CurrentMenu->CreateButton(438, 292, | |
11081 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureWidth, | |
11082 pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureHeight, | |
11083 1, 0, UIMSG_ClickAwardsDownBtn, 0, 0, "", | |
11084 pIcons_LOD->GetTexture(uTextureID_ar_dn_up), | |
11085 pIcons_LOD->GetTexture(uTextureID_ar_dn_dn), 0); | |
961 | 11086 ptr_507BA4 = pGUIWindow_CurrentMenu->CreateButton(440, 62, 16, 232, 1, 0, UIMSG_C0, 0, 0, "", 0); |
0 | 11087 } |
11088 } | |
11089 | |
11090 | |
11091 | |
11092 //----- (00419379) -------------------------------------------------------- | |
11093 void __cdecl sub_419379() | |
11094 { | |
960 | 11095 GUIButton *pButton; // esi@2 |
0 | 11096 |
11097 if ( dword_507CBC ) | |
11098 { | |
11099 dword_507CBC = 0; | |
697 | 11100 ptr_507BA4->Release(); |
11101 pBtn_Up->Release(); | |
11102 pBtn_Down->Release(); | |
0 | 11103 pBtn_Down = 0; |
11104 pBtn_Up = 0; | |
960 | 11105 for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) |
11106 { | |
11107 if ( pButton->msg == UIMSG_InventoryLeftClick ) | |
11108 { | |
11109 pButton->uX = dword_50698C; | |
11110 pButton->uY = dword_506988; | |
11111 pButton->uZ = dword_506984; | |
11112 pButton->uW = dword_506980; | |
972 | 11113 pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0); |
11114 } | |
11115 } | |
11116 } | |
11117 } | |
11118 | |
11119 |