Mercurial > mm7
annotate Events.cpp @ 2153:d28d3c006077
Some Render decoupling.
author | Nomad |
---|---|
date | Thu, 09 Jan 2014 02:34:20 +0200 |
parents | ad71de147333 |
children | e9625ad08541 |
rev | line source |
---|---|
307 | 1 #include <stdlib.h> |
2 | |
1323 | 3 #include "Weather.h" |
1262 | 4 #include "Texture.h" |
5 #include "mm7_data.h" | |
1016 | 6 #include "VideoPlayer.h" |
7 #include "Mouse.h" | |
8 | |
307 | 9 #include "MapInfo.h" |
10 #include "Game.h" | |
1254 | 11 #include "Render.h" |
307 | 12 #include "GUIWindow.h" |
13 #include "GUIProgressBar.h" | |
14 #include "Chest.h" | |
15 #include "stru176.h" | |
16 #include "LOD.h" | |
17 #include "Actor.h" | |
18 #include "Party.h" | |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2025
diff
changeset
|
19 #include "OurMath.h" |
307 | 20 #include "AudioPlayer.h" |
21 #include "Indoor.h" | |
22 #include "Viewport.h" | |
23 #include "texts.h" | |
24 #include "stru123.h" | |
25 #include "stru159.h" | |
0 | 26 #include "Events.h" |
27 #include "Events2D.h" | |
1299 | 28 #include "UI\UIHouses.h" |
1052 | 29 #include "Log.h" |
481 | 30 #include "MM7.h" |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1826
diff
changeset
|
31 #include "Level/Decoration.h" |
2052 | 32 #include "LuaVM.h" |
0 | 33 |
34 | |
35 | |
1202 | 36 std::array<EventIndex, 4400> pSomeOtherEVT_Events; |
423 | 37 signed int uSomeOtherEVT_NumEvents; |
0 | 38 char *pSomeOtherEVT; |
1202 | 39 std::array<EventIndex, 4400> pSomeEVT_Events; |
428 | 40 signed int uSomeEVT_NumEvents; |
0 | 41 char *pSomeEVT; |
42 | |
43 unsigned int uGlobalEVT_NumEvents; | |
44 unsigned int uGlobalEVT_Size; | |
1202 | 45 std::array<char, 46080> pGlobalEVT; |
46 std::array<EventIndex, 4400> pGlobalEVT_Index; | |
0 | 47 |
1202 | 48 std::array<unsigned int, 500> pLevelStrOffsets; |
0 | 49 unsigned int uLevelStrNumStrings; |
50 unsigned int uLevelStrFileSize; | |
428 | 51 signed int uLevelEVT_NumEvents; |
0 | 52 unsigned int uLevelEVT_Size; |
1202 | 53 std::array<char, 9216> pLevelStr; |
54 std::array<char, 9216> pLevelEVT; | |
55 std::array<EventIndex, 4400> pLevelEVT_Index; | |
0 | 56 |
1289 | 57 _2devent p2DEvents[525]; |
307 | 58 |
59 | |
60 | |
61 //----- (00443CE1) -------------------------------------------------------- | |
62 unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize) | |
1052 | 63 { |
1490 | 64 FILE *pLodFile; // eax@1 |
65 unsigned int uTextureSize; // esi@3 | |
1545 | 66 //char Args[60]; // [sp+8h] [bp-B4h]@6 |
1490 | 67 void *ptr; // [sp+B8h] [bp-4h]@1 |
68 Texture DstBuf; // [sp+6Ch] [bp-50h]@1 | |
307 | 69 |
1490 | 70 ptr = pEvents_LOD->LoadRaw(pContainerName, 0); |
71 pLodFile = pEvents_LOD->FindContainer(pContainerName, 0); | |
72 if ( !pLodFile ) | |
1545 | 73 Error("Unable to load %s", pContainerName); |
74 | |
1490 | 75 fread(&DstBuf, 1, 48, pLodFile); |
76 uTextureSize = DstBuf.uDecompressedSize; | |
77 if ( !DstBuf.uDecompressedSize ) | |
78 uTextureSize = DstBuf.uTextureSize; | |
79 memset(&DstBuf, 0, 72); | |
80 if ( uTextureSize >= (signed int)uBufferSize ) | |
1545 | 81 Error("File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize); |
82 | |
1490 | 83 memcpy(pBuffer, ptr, uTextureSize); |
1583 | 84 free(ptr); |
1490 | 85 return uTextureSize; |
86 } | |
307 | 87 |
88 //----- (00443DA1) -------------------------------------------------------- | |
1458 | 89 void Initialize_GlobalEVT() |
762 | 90 { |
1490 | 91 struct raw_event_header |
92 { | |
93 unsigned char evt_size; | |
94 unsigned char evt_id_l; | |
95 unsigned char evt_id_h; | |
96 unsigned char evt_sequence_num; | |
97 } ; | |
98 uint events_count; | |
99 unsigned int offset_in; | |
100 raw_event_header *current_hdr; | |
101 uGlobalEVT_NumEvents = 0; | |
102 uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT.data(), 46080); | |
103 if ( !uGlobalEVT_Size ) | |
104 return; | |
105 memset(pGlobalEVT_Index.data(), 0x80, sizeof(pGlobalEVT_Index));//52800 | |
106 events_count = uGlobalEVT_NumEvents; | |
107 current_hdr=(raw_event_header *)pGlobalEVT.data(); | |
108 offset_in=0; | |
109 for (events_count = 0, offset_in = 0; offset_in < uGlobalEVT_Size; ++events_count) | |
110 { | |
111 pGlobalEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); | |
112 pGlobalEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; | |
113 pGlobalEVT_Index[events_count].uEventOffsetInEVT=offset_in; | |
114 offset_in+=current_hdr->evt_size+1; | |
1052 | 115 |
1490 | 116 current_hdr=(raw_event_header *)&pGlobalEVT[offset_in]; |
117 } | |
118 uGlobalEVT_NumEvents = events_count; | |
307 | 119 |
762 | 120 assert(uGlobalEVT_NumEvents < 4400); |
121 } | |
307 | 122 |
123 | |
1052 | 124 |
307 | 125 //----- (00443EF8) -------------------------------------------------------- |
126 void LoadLevel_InitializeLevelEvt() | |
1490 | 127 { |
601 | 128 struct raw_event_header |
1490 | 129 { |
601 | 130 unsigned char evt_size; |
131 unsigned char evt_id_l; | |
132 unsigned char evt_id_h; | |
133 unsigned char evt_sequence_num; | |
134 } ; | |
135 uint events_count; | |
1490 | 136 unsigned int offset_in; |
137 raw_event_header *current_hdr; | |
601 | 138 |
1490 | 139 if (!uLevelEVT_Size) |
140 return; | |
307 | 141 |
1490 | 142 memset(array_5B5928_timers, 0, 3200); |
143 memset(pLevelEVT_Index.data(), 80, sizeof(EventIndex)*4400); | |
307 | 144 |
1490 | 145 uLevelEVT_NumEvents = 0; |
146 dword_5B65C8_timers_count = 0; | |
307 | 147 |
1202 | 148 current_hdr=(raw_event_header *)pLevelEVT.data(); |
601 | 149 offset_in=0; |
150 for (events_count = 0, offset_in = 0; offset_in < uLevelEVT_Size; ++events_count) | |
151 { | |
152 pLevelEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); | |
153 pLevelEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; | |
1490 | 154 pLevelEVT_Index[events_count].uEventOffsetInEVT=offset_in; |
601 | 155 offset_in+=current_hdr->evt_size+1; |
1052 | 156 |
601 | 157 current_hdr=(raw_event_header *)&pLevelEVT[offset_in]; |
158 } | |
159 uLevelEVT_NumEvents = events_count; | |
160 | |
161 /* | |
1052 | 162 EmeraldIsle::Variables: |
163 [0] ??? | |
164 [1] ??? | |
165 [2] Luck Fountain uses left | |
166 [3] Gold Fountain used this week | |
167 [4] Gold Fountain total uses | |
168 | |
1053 | 169 |
170 Emerald Isle #110 // Fire Resistance fountain | |
1490 | 171 0 LocationName |
172 0 if (Player.FireResistance < 50) | |
173 { | |
174 1 Set(Player.FireResistance, 50) | |
175 2 SetFooterString(22) // +50 Fire Resistance (temporarily) | |
176 3 Add(Party.Autonotes, 2) | |
177 4 goto return | |
178 } | |
179 5 SetFooterString(11) // Refreshing! | |
180 6 return | |
1053 | 181 |
182 | |
183 | |
1052 | 184 Emerald Isle #111 // ??? |
1490 | 185 Initialize |
186 Set(Map.Variables[0], 30) | |
187 Set(Map.Variables[1], 30) | |
1052 | 188 |
189 | |
190 Emerald Isle #114 // month timer - manage luck fountain | |
1490 | 191 0 LocationName |
192 0 if (Player.BaseLuck >= 15) | |
193 { | |
194 2 SetFooterString(11) // Refreshing! | |
195 3 return | |
196 } | |
197 else | |
198 { | |
199 1 if (Map.Variables[2] >= 1) | |
200 { | |
201 4 Sub(Map.Variables[2], 1) | |
202 5 Add(Player.BaseLuck, 2) | |
203 6 SetFooterString(25) // +2 Luck (Permament) | |
204 7 return | |
205 } | |
206 else | |
207 { | |
208 2 SetFooterString(11) // Refreshing! | |
209 3 return | |
210 } | |
211 } | |
1052 | 212 |
1490 | 213 8 Initialize |
214 9 Set Map.Variables[2], 8 | |
1052 | 215 |
216 | |
217 | |
218 Emerald Isle #115 // week timer - gold fountain in the center of town | |
1490 | 219 0 LocationName |
220 0 if (Map.Variables[4] < 3) | |
221 { | |
222 1 if (Map.Variables[3] == 0) | |
223 { | |
224 2 if (Party.Gold < 201) | |
225 { | |
226 3 if (Player.BaseLuck >= 15) | |
227 { | |
228 5 Add(Map.Variables[3], 1) | |
229 6 Add(Party.Gold, 1000) | |
230 7 Add(Map.Variables[4], 1) | |
231 8 goto return | |
232 } | |
233 else | |
234 { | |
235 4 goto 9 | |
236 } | |
237 } | |
238 } | |
239 } | |
240 9 SetFooterString(11) // Refreshing! | |
241 10 return | |
1052 | 242 |
1490 | 243 11 Initialize |
244 12 Set(Map.Variables[3], 0) | |
1052 | 245 |
246 | |
247 | |
248 | |
249 | |
1490 | 250 Emerald Isle #220 // day timer - monster spawner |
251 0 LocationName | |
252 0 Initialize | |
253 1 if (NumAliveActors(group=20) != 0) | |
254 2 return | |
255 3 SpawnMonsters(1, level=1, count=10, x=-336, y=14512, z=0, group=20) | |
256 4 SpawnMonsters(1, level=2, count=5, x=16, y=16352, z=90, group=20) | |
257 5 SpawnMonsters(1, level=1, count=10, x=480, y=18288, z=6, group=20) | |
1052 | 258 |
259 | |
260 | |
1490 | 261 Emerald Isle #200 // margareth dock tip |
262 0 if (!QBits.QuestDone[17]) | |
263 { | |
264 1 InitiateNPCDialogue(npc=19) | |
265 } | |
266 2 return | |
1052 | 267 |
268 | |
1490 | 269 Emerald Isle #201 // margareth armoury tip |
270 0 if (!QBits.QuestDone[17]) | |
271 { | |
272 1 InitiateNPCDialogue(npc=20) | |
273 } | |
274 2 return | |
1052 | 275 */ |
1490 | 276 } |
307 | 277 |
278 | |
279 //----- (0044684A) -------------------------------------------------------- | |
1052 | 280 void EventProcessor(int uEventID, int targetObj, int canShowMessages, int entry_line) |
281 { | |
1490 | 282 unsigned int v3; // eax@5 |
283 signed int v4; // esi@7 | |
284 //char *v5; // eax@8 | |
285 Player *v6; // ecx@8 | |
286 //char *v7; // ebp@8 | |
287 //signed int v8; // edx@10 | |
288 //int v9; // edi@12 | |
289 //ByteArray *v10; // esi@12 | |
290 int v11; // eax@14 | |
291 char *v12; // eax@15 | |
292 //char *v13; // edi@21 | |
293 int v14; // ebp@21 | |
294 int v15; // edi@21 | |
295 const char *v16; // esi@21 | |
296 bool v17; // edx@21 | |
297 int v18; // ecx@22 | |
298 int v19; // ebp@36 | |
299 signed int v20; // ecx@40 | |
300 int v21; // eax@40 | |
301 int v22; // edx@40 | |
302 int v23; // eax@40 | |
303 unsigned __int16 v24; // ax@45 | |
304 int v25; // eax@54 | |
305 LevelDecoration *v26; // eax@55 | |
306 int v27; // eax@57 | |
307 int v28; // ecx@57 | |
308 //int v29; // edx@58 | |
309 int pEventID; // eax@58 | |
310 int pNPC_ID; // ecx@58 | |
311 int pIndex; // esi@58 | |
312 NPCData *pNPC; // ecx@58 | |
313 int v34; // esi@59 | |
314 int v35; // esi@60 | |
315 int v36; // esi@61 | |
316 int v37; // esi@62 | |
317 int v38; // eax@78 | |
318 int v39; // ecx@78 | |
319 size_t v40; // edx@78 | |
320 Actor *v41; // esi@79 | |
321 int v42; // eax@84 | |
322 int v43; // ecx@84 | |
323 size_t v44; // edx@84 | |
324 Actor *v45; // esi@85 | |
325 void *v46; // eax@91 | |
326 GUIWindow *v47; // eax@93 | |
327 GUIButton *v48; // ecx@93 | |
328 GUIButton *v49; // esi@94 | |
329 char v50; // al@100 | |
330 Player *v51; // esi@103 | |
331 Player *v52; // ecx@106 | |
332 int v53; // ecx@107 | |
333 char v54; // al@111 | |
334 Player *v55; // esi@114 | |
335 Player *v56; // ecx@117 | |
336 int v57; // ecx@118 | |
337 signed int pValue; // ebp@124 | |
338 Player *pPlayer; // esi@125 | |
339 int v60; // eax@126 | |
340 int v61; // edx@133 | |
341 int v62; // eax@139 | |
342 int v63; // ebp@145 | |
343 signed int v64; // edi@146 | |
344 unsigned int v65; // edx@148 | |
345 Player *v66; // ecx@148 | |
346 int v67; // esi@148 | |
347 signed int v68; // eax@151 | |
348 int v69; // esi@151 | |
349 Player *v70; // ecx@158 | |
350 unsigned int v71; // eax@159 | |
351 int v72; // esi@159 | |
352 signed int v73; // eax@162 | |
353 int v74; // esi@162 | |
354 int v75; // edx@172 | |
355 Player *v76; // esi@173 | |
356 signed int v77; // ebp@186 | |
357 int v78; // edx@186 | |
358 Player *v79; // esi@187 | |
359 //signed int v80; // ebp@200 | |
360 //int v81; // edx@200 | |
361 Player *v82; // esi@201 | |
362 int v83; // eax@212 | |
363 int v84; // ebp@220 | |
364 signed int v85; // ebp@224 | |
365 char v86; // al@224 | |
366 Player *v87; // esi@227 | |
367 Player *v88; // ecx@231 | |
368 int v89; // ecx@232 | |
369 int v90; // eax@243 | |
370 const char *v91; // ecx@247 | |
371 int v92; // eax@251 | |
372 char *v93; // eax@252 | |
373 int v94; // ecx@262 | |
374 int v95; // ebp@262 | |
375 int v96; // edx@262 | |
376 int v97; // eax@262 | |
377 unsigned int v98; // edx@265 | |
378 const char *v99; // esi@267 | |
379 int v100; // edx@267 | |
380 //char *v101; // edi@281 | |
381 unsigned int v102; // esi@281 | |
382 int v103; // edi@284 | |
383 int v104; // eax@288 | |
384 int v105; // edx@294 | |
385 int v106; // [sp-20h] [bp-4C8h]@278 | |
386 signed int v107; // [sp-1Ch] [bp-4C4h]@278 | |
387 unsigned int v108; // [sp-18h] [bp-4C0h]@278 | |
388 signed int v109; // [sp-14h] [bp-4BCh]@278 | |
389 signed int v110; // [sp-10h] [bp-4B8h]@278 | |
390 int v111; // [sp-Ch] [bp-4B4h]@278 | |
391 // Event *v112; // [sp-8h] [bp-4B0h]@5 | |
392 int v113; // [sp-8h] [bp-4B0h]@106 | |
393 int v114; // [sp-8h] [bp-4B0h]@117 | |
394 signed int v115; // [sp-8h] [bp-4B0h]@231 | |
395 unsigned int v116; // [sp-8h] [bp-4B0h]@278 | |
396 int v117; // [sp-4h] [bp-4ACh]@106 | |
397 int v118; // [sp-4h] [bp-4ACh]@117 | |
398 int v119; // [sp-4h] [bp-4ACh]@231 | |
399 int v120; // [sp-4h] [bp-4ACh]@278 | |
400 int v121; // [sp-4h] [bp-4ACh]@294 | |
401 int curr_seq_num; // [sp+10h] [bp-498h]@4 | |
402 //char *v123; // [sp+14h] [bp-494h]@0 | |
403 signed int v124; // [sp+18h] [bp-490h]@7 | |
404 //signed int v125; // [sp+1Ch] [bp-48Ch]@155 | |
405 int v126; // [sp+1Ch] [bp-48Ch]@262 | |
406 int player_choose; // [sp+20h] [bp-488h]@4 | |
407 int v128; // [sp+24h] [bp-484h]@21 | |
408 int v129; // [sp+24h] [bp-484h]@262 | |
409 signed int v130; // [sp+28h] [bp-480h]@0 | |
410 //int v131; // [sp+2Ch] [bp-47Ch]@1 | |
411 int v132; // [sp+30h] [bp-478h]@262 | |
412 signed int v133; // [sp+34h] [bp-474h]@1 | |
413 int v134; // [sp+38h] [bp-470h]@262 | |
414 int v135; // [sp+3Ch] [bp-46Ch]@262 | |
415 int v136; // [sp+40h] [bp-468h]@40 | |
416 int v137; // [sp+44h] [bp-464h]@40 | |
417 int v138; // [sp+48h] [bp-460h]@40 | |
418 int v139; // [sp+4Ch] [bp-45Ch]@40 | |
419 ItemGen item; // [sp+50h] [bp-458h]@15 | |
420 char Source[120]; // [sp+74h] [bp-434h]@15 | |
421 char Str[120]; // [sp+ECh] [bp-3BCh]@21 | |
422 Actor Dst; // [sp+164h] [bp-344h]@53 | |
307 | 423 |
1490 | 424 //v131 = uEventID; |
425 v133 = 0; | |
426 EvtTargetObj = targetObj; | |
1825
23deb6b09c8c
cancelEventProcessing to dword_5B65C4_cancelEventProcessing
Grumpy7
parents:
1821
diff
changeset
|
427 dword_5B65C4_cancelEventProcessing = 0; |
2144 | 428 /*if ( uEventID == 114 )//÷òîáû ïðîâåðèòü ñêðèïò |
2050 | 429 { |
2052 | 430 if (!lua->DoFile("out01.lua")) |
2050 | 431 Log::Warning(L"Error opening out01.lua\n"); |
2068 | 432 Log::Warning(L"being tested that well\n"); |
2066 | 433 return; |
2144 | 434 } */ |
1490 | 435 if ( !uEventID ) |
436 { | |
437 if ( !GameUI_Footer_TimeLeft ) | |
438 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here | |
439 return; | |
440 } | |
441 player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 | |
442 curr_seq_num = entry_line; | |
1052 | 443 |
1490 | 444 if ( activeLevelDecoration ) |
445 { | |
446 uSomeEVT_NumEvents = uGlobalEVT_NumEvents; | |
447 pSomeEVT = pGlobalEVT.data(); | |
448 memcpy(pSomeEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400); //4400 evts | |
449 } | |
450 else | |
451 { | |
452 uSomeEVT_NumEvents = uLevelEVT_NumEvents; | |
453 pSomeEVT = pLevelEVT.data(); | |
454 memcpy(pSomeEVT_Events.data(), pLevelEVT_Index.data(), sizeof(EventIndex)*4400); | |
455 } | |
307 | 456 |
1490 | 457 v4 = 0; |
458 v124 = 0; | |
459 //for (uint i = 0; i < uSomeEVT_NumEvents; ++i) | |
460 // { | |
461 //v6 = v123; | |
462 //v7 = ""; | |
463 while ( 1 ) | |
464 { | |
1825
23deb6b09c8c
cancelEventProcessing to dword_5B65C4_cancelEventProcessing
Grumpy7
parents:
1821
diff
changeset
|
465 if ( dword_5B65C4_cancelEventProcessing ) |
1490 | 466 goto LABEL_301; |
467 //v8 = v4; | |
468 if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num ) | |
469 { | |
470 //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; | |
471 //v10 = (ByteArray *)&v5[v9]; | |
1980 | 472 _evt_raw * _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[v4].uEventOffsetInEVT); |
307 | 473 |
1490 | 474 switch (_evt->_e_type) |
475 { | |
476 case EVENT_CheckSeason: | |
477 // | |
478 if ( !sub_4465DF_check_season(_evt->v5) ) | |
1052 | 479 { |
1490 | 480 ++curr_seq_num; |
481 v4 = v124; | |
482 break; | |
1052 | 483 } |
1490 | 484 v124 = -1; |
485 curr_seq_num = _evt->v6 - 1; | |
486 ++curr_seq_num; | |
487 break; | |
488 case EVENT_ShowMovie: | |
489 { | |
490 strcpy(Source, (char *)&_evt->v7); | |
491 v12 = (char *)&item.uExpireTime + strlen(Source) + 7; | |
492 if ( *v12 == 32 ) | |
493 *v12 = 0; | |
2137
d24ee391fd1f
libavcodec playing movies and houses, loops not working yet
zipi
parents:
2124
diff
changeset
|
494 if (pVideoPlayer->bBufferLoaded) |
1490 | 495 pVideoPlayer->Unload(); |
496 pVideoPlayer->bStopBeforeSchedule = 0; | |
497 pVideoPlayer->pResetflag = 0; | |
1038 | 498 |
1490 | 499 v128 = pCurrentScreen; |
500 //v13 = &pSomeEVT[v9]; | |
501 //v14 = (unsigned __int8)v13[5]; | |
502 //v15 = (unsigned __int8)v13[6]; | |
503 v14 = _evt->v5; | |
504 v15 = _evt->v6; | |
505 strcpy(Str, Source); | |
506 v16 = RemoveQuotes(Str); | |
2142
ca548138d6aa
some code cleaning in video playing, loops play but there is a memory leak
zipi
parents:
2137
diff
changeset
|
507 pVideoPlayer->MovieLoop(v16, 0, v14, 1); |
1490 | 508 if ( !_stricmp(v16, "arbiter good") ) |
373 | 509 { |
510 pParty->alignment = PartyAlignment_Good; | |
1490 | 511 v18 = 0; |
512 LOBYTE(v17) = 1; | |
513 SetUserInterface(PartyAlignment_Good, v17); | |
514 if ( !v15 || v128 == 3 ) | |
515 { | |
516 pCurrentScreen = v128; | |
517 if ( v128 == 3 ) | |
518 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
519 if ( v128 == 13 ) | |
520 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
521 } | |
522 | |
523 ++curr_seq_num; | |
524 v4 = v124; | |
1038 | 525 |
1490 | 526 //v6 = v123; |
527 //v7 = ""; | |
528 break; | |
529 } | |
530 if ( !_stricmp(v16, "arbiter evil") ) | |
531 { | |
532 v18 = 2; | |
533 pParty->alignment = PartyAlignment_Evil; | |
534 LOBYTE(v17) = 1; | |
535 SetUserInterface(PartyAlignment_Evil, v17); | |
536 if ( !v15 || v128 == 3 ) | |
537 { | |
538 pCurrentScreen = v128; | |
539 if ( v128 == 3 ) | |
540 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
541 if ( v128 == 13 ) | |
542 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
543 } | |
544 ++curr_seq_num; | |
545 v4 = v124; | |
307 | 546 |
1490 | 547 //v6 = v123; |
548 //v7 = ""; | |
549 | |
550 break; | |
551 } | |
552 if ( !_stricmp(v16, "pcout01") ) // moving to harmondale from emerald isle | |
766 | 553 { |
1490 | 554 Rest(0x2760u); |
555 pParty->RestAndHeal(); | |
556 pParty->days_played_without_rest = 0; | |
766 | 557 } |
1490 | 558 if ( !v15 || v128 == 3 ) |
559 { | |
560 pCurrentScreen = v128; | |
561 if ( v128 == 3 ) | |
562 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
563 if ( v128 == 13 ) | |
564 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
565 } | |
566 ++curr_seq_num; | |
567 v4 = v124; | |
568 | |
569 //v6 = v123; | |
570 //v7 = ""; | |
571 } | |
572 break; | |
573 case EVENT_CheckSkill: | |
574 { | |
575 v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); | |
576 if ( player_choose < 0 ) | |
577 goto LABEL_47; | |
578 if ( player_choose <= 3 ) | |
579 { | |
580 v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5]; | |
581 } | |
582 else | |
583 { | |
584 if ( player_choose == 4 ) | |
585 { | |
586 v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; | |
587 } | |
588 else | |
589 { | |
590 if ( player_choose == 5 ) | |
591 { | |
592 v20 = 0; | |
593 v21 = 3486 * v130 + _evt->v5; | |
594 v136 = 1; | |
595 LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21]; | |
596 v137 = v21 & 0x40; | |
597 v138 = v21 & 0x80; | |
598 v22 = v21 & 0x100; | |
599 v23 = v21 & 0x3F; | |
600 v139 = v22; | |
601 while ( v23 < v19 || !*(&v136 + _evt->v6) ) | |
602 { | |
603 ++v20; | |
604 if ( v20 >= 4 ) | |
605 { | |
606 ++curr_seq_num; | |
607 v4 = v124; | |
608 | |
609 //v6 = v123; | |
610 //v7 = ""; | |
611 break; | |
612 } | |
613 } | |
614 v11 = _evt->v11; | |
615 goto LABEL_130; | |
616 } | |
307 | 617 LABEL_47: |
1490 | 618 //v10 = (ByteArray *)&v5[v9]; |
619 v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4]; | |
620 } | |
621 } | |
622 v136 = 1; | |
623 v137 = v24 & 0x40; | |
624 v138 = v24 & 0x80; | |
625 v139 = v24 & 0x100; | |
626 if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) | |
627 { | |
628 v11 = _evt->v11; | |
629 goto LABEL_130; | |
630 } | |
631 ++curr_seq_num; | |
632 v4 = v124; | |
633 | |
634 //v6 = v123; | |
635 //v7 = ""; | |
636 } | |
637 break; | |
307 | 638 |
1490 | 639 case EVENT_SpeakNPC: |
640 if ( canShowMessages ) | |
641 { | |
642 //Actor::Actor(&Dst); | |
643 memset(&Dst, 0, 0x344u); | |
644 dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); | |
645 Dst.sNPC_ID = dword_5B65D0_dialogue_actor_npc_id; | |
646 GameUI_InitializeDialogue(&Dst, false); | |
647 } | |
648 else | |
649 { | |
650 bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); | |
651 } | |
652 ++curr_seq_num; | |
653 v4 = v124; | |
654 | |
655 //v6 = v123; | |
656 //v7 = ""; | |
657 break; | |
658 case EVENT_ChangeEvent: | |
659 v25 = EVT_DWORD(_evt->v5); | |
660 if ( v25 ) | |
661 { | |
1736
c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents:
1583
diff
changeset
|
662 stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124; |
1490 | 663 } |
664 else | |
665 { | |
666 v26 = (LevelDecoration *)activeLevelDecoration; | |
1736
c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents:
1583
diff
changeset
|
667 stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0; |
1489 | 668 v26->uFlags |= LEVEL_DECORATION_INVISIBLE; |
1490 | 669 } |
670 ++curr_seq_num; | |
671 v4 = v124; | |
525 | 672 |
1490 | 673 break; |
674 case EVENT_SetNPCGreeting: | |
675 v27 = EVT_DWORD(_evt->v5); | |
676 pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; | |
677 pNPCStats->pNewNPCData[v27].greet = EVT_DWORD(_evt->v9); | |
678 ++curr_seq_num; | |
679 v4 = v124; | |
680 | |
681 //v6 = v123; | |
682 //v7 = ""; | |
683 break; | |
827 | 684 case EVENT_SetNPCTopic: |
685 { | |
686 //v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
687 pEventID = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); | |
688 pNPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
689 pIndex = _evt->v9; | |
690 pNPC = &pNPCStats->pNewNPCData[pNPC_ID]; | |
691 if ( pIndex == 0 ) | |
692 pNPC->evt_A = pEventID; | |
693 if ( pIndex == 1 ) | |
694 pNPC->evt_B = pEventID; | |
695 if ( pIndex == 2 ) | |
696 pNPC->evt_C = pEventID; | |
697 if ( pIndex == 3 ) | |
698 pNPC->evt_D = pEventID; | |
699 if ( pIndex == 4 ) | |
700 pNPC->evt_E = pEventID; | |
701 if ( pIndex == 5 ) | |
702 pNPC->evt_F = pEventID; | |
703 if ( pNPC_ID == 8 ) | |
704 { | |
705 if ( pEventID == 78 ) | |
706 { | |
1919 | 707 HouseDialogPressCloseBtn(); |
827 | 708 window_SpeakInHouse->Release(); |
709 pParty->uFlags &= ~2; | |
710 if ( EnterHouse(HOUSE_DARK_GUILD_PIT) ) | |
711 { | |
712 pAudioPlayer->StopChannels(-1, -1); | |
713 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); | |
948 | 714 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); |
715 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
716 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
717 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
718 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); | |
827 | 719 current_npc_text = pNPCTopics[90].pText; |
720 } | |
721 } | |
722 } | |
723 ++curr_seq_num; | |
724 } | |
725 v4 = v124; | |
726 break; | |
1490 | 727 case EVENT_NPCSetItem: |
728 sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); | |
729 ++curr_seq_num; | |
730 v4 = v124; | |
525 | 731 |
1490 | 732 break; |
733 case EVENT_SetActorItem: | |
734 Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); | |
735 ++curr_seq_num; | |
736 v4 = v124; | |
737 break; | |
738 case EVENT_SetNPCGroupNews: | |
739 pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); | |
740 ++curr_seq_num; | |
741 v4 = v124; | |
742 break; | |
743 case EVENT_SetActorGroup: | |
744 __debugbreak(); | |
745 *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
746 ++curr_seq_num; | |
747 v4 = v124; | |
748 break; | |
749 case EVENT_ChangeGroup: | |
750 v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
751 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
752 v40 = uNumActors; | |
753 __debugbreak(); | |
754 if ( (signed int)uNumActors > 0 ) | |
755 { | |
756 v41 = pActors.data();//[0].uGroup; | |
757 do | |
758 { | |
759 if ( v41->uGroup == v38 ) | |
760 v41->uGroup = v39; | |
761 ++v41; | |
762 --v40; | |
763 } | |
764 while ( v40 ); | |
765 } | |
766 ++curr_seq_num; | |
767 v4 = v124; | |
768 | |
769 //v6 = v123; | |
770 //v7 = ""; | |
771 break; | |
772 case EVENT_ChangeGroupAlly: | |
773 v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
774 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
775 v44 = uNumActors; | |
776 __debugbreak(); | |
777 if ( (signed int)uNumActors > 0 ) | |
778 { | |
779 v45 = pActors.data();//[0].uAlly; | |
780 do | |
781 { | |
782 if ( v45->uGroup == v42 ) | |
783 v45->uAlly = v43; | |
784 ++v45; | |
785 --v44; | |
786 } | |
787 while ( v44 ); | |
788 } | |
789 ++curr_seq_num; | |
790 v4 = v124; | |
791 | |
792 //v6 = v123; | |
793 //v7 = ""; | |
794 break; | |
795 case EVENT_MoveNPC: | |
796 { | |
797 | |
798 pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9); | |
799 if ( window_SpeakInHouse ) | |
800 { | |
310 | 801 |
1490 | 802 if ( window_SpeakInHouse->par1C == 165 ) |
803 { | |
1919 | 804 HouseDialogPressCloseBtn(); |
1490 | 805 pVideoPlayer->Unload(); |
806 window_SpeakInHouse->Release(); | |
807 pParty->uFlags &= ~2; | |
808 activeLevelDecoration = (LevelDecoration*)1; | |
809 if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) | |
810 { | |
811 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); | |
812 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); | |
813 v48 = window_SpeakInHouse->pControlsHead; | |
814 if ( v48 ) | |
815 { | |
816 do | |
817 { | |
818 v49 = v48->pNext; | |
1583 | 819 free(v48); |
1490 | 820 v48 = v49; |
821 } | |
822 while ( v49 ); | |
823 } | |
824 window_SpeakInHouse->pControlsHead = 0; | |
825 window_SpeakInHouse->pControlsTail = 0; | |
826 window_SpeakInHouse->uNumControls = 0; | |
827 } | |
828 } | |
829 else | |
830 { | |
831 if ( window_SpeakInHouse->par1C == 553 ) | |
832 pVideoPlayer->bLoopPlaying = 0; | |
833 } | |
834 } | |
835 | |
836 } | |
525 | 837 ++curr_seq_num; |
1490 | 838 v4 = v124; |
839 | |
840 break; | |
841 case EVENT_Jmp: | |
842 curr_seq_num = _evt->v5 - 1; | |
843 ++curr_seq_num; | |
844 v4 = -1; | |
525 | 845 |
1490 | 846 break; |
847 case EVENT_ShowFace: | |
848 if ( _evt->v5 <= 3u ) //someone | |
849 pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
850 else if ( _evt->v5 == 4 ) //active | |
851 pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
852 else if ( _evt->v5 == 5 ) //all players | |
853 { | |
854 for(int i=0; i<4; ++i) | |
855 pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
856 } | |
857 else //random player | |
858 pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
859 ++curr_seq_num; | |
860 v4 = v124; | |
525 | 861 |
1490 | 862 break; |
863 case EVENT_CharacterAnimation: | |
864 if ( _evt->v5 <= 3u ) //someone | |
865 pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0); | |
866 else if ( _evt->v5 == 4 ) //active | |
867 pParty->pPlayers[uActiveCharacter].PlaySound((PlayerSpeech) _evt->v6, 0); | |
868 else if ( _evt->v5 == 5 ) //all | |
869 for(int i=0; i<4; ++i) | |
870 pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0); | |
871 else //random | |
872 pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0); | |
873 ++curr_seq_num; | |
874 v4 = v124; | |
525 | 875 |
1490 | 876 break; |
877 case EVENT_ForPartyMember: | |
878 player_choose = _evt->v5; | |
879 ++curr_seq_num; | |
880 v4 = v124; | |
881 break; | |
882 case EVENT_SummonItem: | |
883 sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), | |
884 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), | |
885 _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), | |
886 _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), | |
887 _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), | |
888 _evt->v25, _evt->v26, 0, 0); | |
889 ++curr_seq_num; | |
890 v4 = v124; | |
525 | 891 |
1490 | 892 //v6 = v123; |
893 //v7 = ""; | |
894 break; | |
895 case EVENT_Compare: | |
896 pValue = EVT_DWORD(_evt->v7); | |
897 if ( player_choose <= 3 ) | |
898 { | |
899 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
900 { | |
901 v124 = -1; | |
902 curr_seq_num = _evt->v11 - 1; | |
903 } | |
904 } | |
905 else if ( player_choose == 4 ) //active | |
906 { | |
907 if ( uActiveCharacter ) | |
908 { | |
909 if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
910 { | |
911 v124 = -1; | |
912 curr_seq_num = _evt->v11 - 1; | |
913 } | |
914 } | |
915 } | |
916 else if ( player_choose == 5 )//all | |
917 { | |
918 v130=0; | |
919 for(int i = 1; i < 5; ++i) | |
920 { | |
921 if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
922 { | |
923 v124 = -1; | |
924 curr_seq_num = _evt->v11 - 1; | |
925 break; | |
926 } | |
927 ++v130; | |
928 } | |
929 } | |
930 else if ( player_choose == 6 ) //random | |
931 { | |
1817
0f1543750bf8
Changing itemlist accesses to helper functions + getting rid of some pPlayers array accesses
Grumpy7
parents:
1736
diff
changeset
|
932 if ( pPlayers[rand() % 4 + 1]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) |
1490 | 933 { |
934 v124 = -1; | |
935 curr_seq_num = _evt->v11 - 1; | |
936 } | |
937 } | |
938 ++curr_seq_num; | |
939 v4 = v124; | |
940 break; | |
941 case EVENT_IsActorAlive: | |
942 if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) | |
943 { | |
944 v124 = -1; | |
945 curr_seq_num = _evt->v11 - 1; | |
946 } | |
947 ++curr_seq_num; | |
948 v4 = v124; | |
949 break; | |
950 case EVENT_Substract: | |
951 pValue = EVT_DWORD(_evt->v7); | |
2025 | 952 /*if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands ) |
1490 | 953 { |
954 if ( pParty->pPickedItem.uItemID == pValue )//In hand | |
955 { | |
956 pMouse->RemoveHoldingItem(); | |
957 ++curr_seq_num; | |
958 v4 = v124; | |
959 break; | |
960 } | |
2024 | 961 //v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix.data(); |
1490 | 962 for ( v65 = 0; v65 < 126; ++v65 ) |
963 { | |
2025 | 964 v67 = &pPlayers[uActiveCharacter]->pInventoryMatrix[v65]; |
965 if ( v67 > 0 ) | |
1490 | 966 { |
2025 | 967 if ( pPlayers[uActiveCharacter]->pInventoryItemList[v67 - 1].uItemID == pValue ) |
968 { | |
969 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65); | |
970 //++curr_seq_num; | |
971 //v4 = v124; | |
972 goto substract; | |
973 } | |
1490 | 974 } |
2024 | 975 //v67 += 4; |
1490 | 976 } |
2024 | 977 //while ( (signed int)v65 < 126 ); |
2025 | 978 //v69 = (int)&pPlayers[uActiveCharacter]->pEquipment.pIndices; |
1490 | 979 for ( v68 = 0; v68 < 16; ++v68 ) |
980 { | |
2025 | 981 if ( pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->pEquipment.pIndices[v68]].uItemID == pValue ) |
1490 | 982 { |
2025 | 983 pPlayers[uActiveCharacter]->pEquipment.pIndices[v68] = 0; |
984 //++curr_seq_num; | |
985 //v4 = v124; | |
986 goto substract; | |
1490 | 987 } |
2025 | 988 //v69 += 4; |
1490 | 989 } |
990 for (int i = 1; i < 5; i++) | |
991 { | |
2024 | 992 //v72 = (int)pPlayers[i]->pInventoryMatrix.data(); |
1490 | 993 for ( int v71 = 0; v71 < 126; ++v71 ) |
994 { | |
2025 | 995 v72 = &pPlayers[i]->pInventoryMatrix[v71]; |
996 if ( v72 > 0 ) | |
1490 | 997 { |
2025 | 998 if ( pPlayers[i]->pInventoryItemList[v72 - 1].uItemID == pValue ) |
999 { | |
1000 pPlayers[i]->RemoveItemAtInventoryIndex(v71); | |
1001 goto substract; | |
1002 } | |
1490 | 1003 } |
2024 | 1004 //v72 += 4; |
1490 | 1005 } |
2025 | 1006 for ( v73 = 0; v73 < 16; ++v73 ) |
1490 | 1007 { |
2025 | 1008 //v74 = (int)&pPlayers[i]->pEquipment; |
1009 if (pPlayers[i]->pEquipment.pIndices[v73]) | |
1010 { | |
1011 if (pPlayers[i]->pInventoryItemList[pPlayers[i]->pEquipment.pIndices[v73] - 1].uItemID == pValue ) | |
1012 { | |
1013 pPlayers[i]->pEquipment.pIndices[v73] = 0; | |
1014 //v74 += 4; | |
1015 goto substract; | |
1016 } | |
1017 } | |
1490 | 1018 } |
1019 } | |
2025 | 1020 }*/ |
1490 | 1021 if ( player_choose <= 3 ) |
2025 | 1022 pParty->pPlayers[player_choose].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1023 else if ( player_choose == 4 ) //active |
1024 { | |
1025 if ( uActiveCharacter ) | |
2025 | 1026 pPlayers[uActiveCharacter]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1027 } |
1028 else if ( player_choose == 5 )//all | |
1029 { | |
1030 for(int i = 1; i < 5; ++i) | |
1031 { | |
1820
af7f08135ffb
Player::SubtractVariable changing return val to void, finishing cleanup
Grumpy7
parents:
1817
diff
changeset
|
1032 pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1033 } |
1034 } | |
1035 else if ( player_choose == 6 ) //random | |
1036 { | |
1037 player_choose = rand() % 4; | |
2025 | 1038 pParty->pPlayers[player_choose].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1039 } |
2025 | 1040 //substract: |
1490 | 1041 ++curr_seq_num; |
1042 v4 = v124; | |
1043 break; | |
1044 case EVENT_Set: | |
1045 pValue = EVT_DWORD(_evt->v7); | |
1046 if ( player_choose <= 3 ) | |
2025 | 1047 pParty->pPlayers[player_choose].SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1048 else if ( player_choose == 4 ) //active |
1049 { | |
1050 if ( uActiveCharacter ) | |
2025 | 1051 pPlayers[uActiveCharacter]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1052 } |
1053 else if ( player_choose == 5 )//all | |
1054 { | |
525 | 1055 //recheck v130 |
2025 | 1056 for ( int i = 1; i < 5; ++i ) |
1490 | 1057 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1058 } | |
1059 else if ( player_choose == 6 ) //random | |
1060 { | |
1061 player_choose = rand() % 4; | |
1062 pPlayer = &pParty->pPlayers[player_choose]; | |
1063 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1064 } | |
2025 | 1065 ++curr_seq_num; |
1066 v4 = v124; | |
1067 break; | |
1490 | 1068 case EVENT_Add: |
1069 pValue = EVT_DWORD(_evt->v7); | |
1070 if ( player_choose <= 3 ) | |
1071 { | |
1072 pPlayer = &pParty->pPlayers[player_choose]; | |
1073 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1074 } | |
1075 else if ( player_choose == 4 ) //active | |
1076 { | |
1077 if ( uActiveCharacter ) | |
2025 | 1078 pPlayers[uActiveCharacter]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1079 } |
1080 else if ( player_choose == 5 )//all | |
1081 { | |
1082 for(int i = 1; i < 5; ++i) | |
1083 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1084 } | |
1085 else if ( player_choose == 6 ) //random | |
1086 { | |
1087 player_choose = rand() % 4; | |
2025 | 1088 pParty->pPlayers[player_choose].AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1089 } |
2025 | 1090 v83 = EVT_WORD(_evt->v5); |
1091 if (v83 == 21 || // gold well on emerald isle | |
1092 v83 == 22 || v83 == 23 || v83 == 24 ) | |
1093 { | |
1094 //__debugbreak(); // bonfire | |
1095 viewparams->bRedrawGameUI = true; | |
1096 } | |
1097 ++curr_seq_num; | |
1098 v4 = v124; | |
1099 break; | |
1490 | 1100 case EVENT_InputString: |
1101 if ( !entry_line ) | |
1102 { | |
1103 strcpy(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]); | |
1104 v105 = curr_seq_num; | |
1105 v121 = 26; | |
307 | 1106 LABEL_295: |
1490 | 1107 sub_4451A8_press_any_key(uEventID, v105, v121); |
307 | 1108 LABEL_301: |
1490 | 1109 if ( v133 == 1 ) |
1110 OnMapLeave(); | |
1111 return; | |
1112 } | |
1113 v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1114 if ( !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) | |
1115 || !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[v84]]) ) | |
1116 { | |
1117 v11 = _evt->v17; | |
307 | 1118 LABEL_130: |
1490 | 1119 //v124 = -1; |
307 | 1120 LABEL_131: |
1490 | 1121 curr_seq_num = v11 - 1; |
1122 } | |
1123 ++curr_seq_num; | |
1124 v4 = v124; | |
1125 | |
1126 //v6 = v123; | |
1127 //v7 = ""; | |
1128 break; | |
1129 case EVENT_RandomGoTo: | |
1130 //v124 = -1; | |
1131 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) | |
1132 + (_evt->v10 != 0))); | |
525 | 1133 curr_seq_num = v11 - 1; |
787 | 1134 ++curr_seq_num; |
1135 v4 = v124; | |
1136 break; | |
1490 | 1137 case EVENT_ReceiveDamage: |
1138 v85 = EVT_DWORD(_evt->v7 ); | |
1139 v86 = _evt->v5; | |
1140 if ( (unsigned __int8)v86 <= 3 ) | |
1141 { | |
1142 v119 = _evt->v6; | |
1143 v115 = EVT_DWORD(_evt->v7 ); | |
1144 v89 = (unsigned __int8)v86; | |
1145 v88 = &pParty->pPlayers[v89]; | |
1146 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); | |
1147 ++curr_seq_num; | |
1148 v4 = v124; | |
1149 break; | |
1150 } | |
1151 if ( v86 == 4 ) | |
1152 { | |
1153 if ( !uActiveCharacter ) | |
1154 { | |
1155 ++curr_seq_num; | |
1156 v4 = v124; | |
1157 | |
1158 //v6 = v123; | |
1159 //v7 = ""; | |
1160 break; | |
1161 } | |
1162 v119 = _evt->v6; | |
1163 v88 = pPlayers[uActiveCharacter]; | |
1164 v115 = EVT_DWORD(_evt->v7 ); | |
1165 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); | |
1166 ++curr_seq_num; | |
1167 v4 = v124; | |
1168 break; | |
1169 } | |
1170 if ( v86 != 5 ) | |
1171 { | |
1172 v119 = _evt->v6; | |
1173 v115 = EVT_DWORD(_evt->v7 ); | |
1174 v89 = rand() % 4; | |
1175 v88 = &pParty->pPlayers[v89]; | |
1176 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); | |
1177 ++curr_seq_num; | |
1178 v4 = v124; | |
1179 | |
1180 //v6 = v123; | |
1181 //v7 = ""; | |
1182 break; | |
1183 } | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1828
diff
changeset
|
1184 v87 = pParty->pPlayers.data(); |
1490 | 1185 do |
1186 { | |
1187 v87->ReceiveDamage(v85, (DAMAGE_TYPE)_evt->v6); | |
1188 ++v87; | |
1189 } | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1828
diff
changeset
|
1190 while ( (signed int)v87 < (signed int)pParty->pHirelings.data() ); |
1490 | 1191 ++curr_seq_num; |
1192 v4 = v124; | |
1193 | |
1194 //v6 = v123; | |
1195 //v7 = ""; | |
1196 break; | |
1197 case EVENT_ToggleIndoorLight: | |
1198 pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9); | |
1199 ++curr_seq_num; | |
1200 v4 = v124; | |
1201 | |
1202 //v6 = v123; | |
1203 //v7 = ""; | |
1204 break; | |
1205 case EVENT_SetFacesBit: | |
1206 sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); | |
1207 ++curr_seq_num; | |
1208 v4 = v124; | |
1209 | |
1210 //v6 = v123; | |
1211 //v7 = ""; | |
1212 break; | |
1213 case EVENT_ToggleChestFlag: | |
1214 Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); | |
1215 ++curr_seq_num; | |
1216 v4 = v124; | |
1217 | |
1218 //v6 = v123; | |
1219 //v7 = ""; | |
1220 break; | |
1221 case EVENT_ToggleActorFlag: | |
1222 Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); | |
1223 ++curr_seq_num; | |
1224 v4 = v124; | |
1225 | |
1226 //v6 = v123; | |
1227 //v7 = ""; | |
1228 break; | |
1229 case EVENT_ToggleActorGroupFlag: | |
1230 ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); | |
1231 ++curr_seq_num; | |
1232 v4 = v124; | |
1233 | |
1234 //v6 = v123; | |
1235 //v7 = ""; | |
1236 break; | |
1237 case EVENT_SetSnow: | |
1238 if ( !_evt->v5 ) | |
1239 pWeather->bRenderSnow = _evt->v6 != 0; | |
1240 ++curr_seq_num; | |
1241 v4 = v124; | |
1242 | |
1243 //v6 = v123; | |
1244 //v7 = ""; | |
1245 break; | |
1246 case EVENT_StatusText: | |
1247 v90 = EVT_DWORD(_evt->v5 ); | |
1248 if ( activeLevelDecoration ) | |
1249 { | |
1250 if ( activeLevelDecoration == (LevelDecoration*)1 ) | |
1251 { | |
1252 current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; | |
1253 } | |
1254 if ( canShowMessages == 1 ) | |
1255 { | |
1256 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; | |
1257 //LABEL_248: | |
1258 ShowStatusBarString(v91, 2u); | |
1259 } | |
1260 } | |
1261 else | |
1262 { | |
1263 if ( canShowMessages == 1 ) | |
1264 { | |
1265 v91 = &pLevelStr[pLevelStrOffsets[v90]]; | |
1266 ShowStatusBarString(v91, 2u); | |
1267 } | |
1268 } | |
1269 ++curr_seq_num; | |
1270 v4 = v124; | |
1271 | |
1272 //v6 = v123; | |
1273 //v7 = ""; | |
1274 break; | |
1275 case EVENT_ShowMessage: | |
1276 v92 = EVT_DWORD(_evt->v5 ); | |
1277 if ( activeLevelDecoration ) | |
1278 { | |
1279 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; | |
1280 byte_5B0938[0] = 0; | |
1281 current_npc_text = v93; | |
1282 } | |
1283 else | |
1284 { | |
1285 strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[v92]]); | |
1286 } | |
1287 ++curr_seq_num; | |
1288 v4 = v124; | |
1289 | |
1290 //v6 = v123; | |
1291 //v7 = ""; | |
1292 break; | |
1293 case EVENT_CastSpell: | |
835 | 1294 EventCastSpell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ), |
525 | 1295 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), |
1296 EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 )); | |
835 | 1297 ++curr_seq_num; |
1298 v4 = v124; | |
1299 break; | |
1490 | 1300 case EVENT_SetTexture: |
1301 sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9); | |
1302 ++curr_seq_num; | |
1303 v4 = v124; | |
1304 | |
1305 //v6 = v123; | |
1306 //v7 = ""; | |
1307 break; | |
1308 case EVENT_SetSprite: | |
1309 SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10); | |
1310 ++curr_seq_num; | |
1311 v4 = v124; | |
1312 | |
1313 //v6 = v123; | |
1314 //v7 = ""; | |
1315 break; | |
1316 case EVENT_SummonMonsters: | |
1317 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ), | |
525 | 1318 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), |
1319 EVT_DWORD(_evt->v24 )); | |
1490 | 1320 ++curr_seq_num; |
1321 v4 = v124; | |
1322 | |
1323 //v6 = v123; | |
1324 //v7 = ""; | |
1325 break; | |
1326 case EVENT_MouseOver: | |
1327 case EVENT_LocationName: | |
1328 --curr_seq_num; | |
1329 ++curr_seq_num; | |
1330 v4 = v124; | |
1331 | |
1332 //v6 = v123; | |
1333 //v7 = ""; | |
1334 break; | |
1335 case EVENT_ChangeDoorState: | |
2085 | 1336 Door_switch_animation(_evt->v5, _evt->v6); |
1490 | 1337 ++curr_seq_num; |
1338 v4 = v124; | |
1339 break; | |
1340 case EVENT_OpenChest: | |
1341 if ( !Chest::Open(_evt->v5) ) | |
1342 goto LABEL_301; | |
1343 ++curr_seq_num; | |
1344 v4 = v124; | |
1345 | |
1346 //v6 = v123; | |
1347 //v7 = ""; | |
1348 break; | |
1349 case EVENT_MoveToMap: | |
1350 v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1351 v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1352 v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1353 v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1354 v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8); | |
1355 v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8); | |
1356 v96 = _evt->v25; | |
1357 v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); | |
1358 v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); | |
1359 if ( _evt->v29 || _evt->v30 ) | |
1360 { | |
2153 | 1361 pRenderer->Sub01(); |
1490 | 1362 TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); |
1363 dword_5C3418 = uEventID; | |
1364 dword_5C341C = curr_seq_num + 1; | |
1365 goto LABEL_301; | |
1366 } | |
1367 _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1368 _5B65A8_npcdata_uflags_or_other = v94; | |
1369 _5B65B0_npcdata_rep_or_other = v126; | |
1370 if ( v129 == -1 ) | |
1371 { | |
1372 v98 = _5B65B4_npcdata_loword_house_or_other; | |
1373 } | |
1374 else | |
1375 { | |
1376 v98 = v129 & stru_5C6E00->uDoublePiMask; | |
1377 _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask; | |
1378 } | |
1379 v99 = (char *)&_evt->v31; | |
1380 _5B65B8_npcdata_hiword_house_or_other = v95; | |
1381 dword_5B65BC = v97; | |
1382 v100 = v94 | v132 | v126 | v95 | v97 | v98; | |
1383 dword_5B65C0 = v100; | |
1384 if ( *v99 == 48 ) | |
1385 { | |
1386 if ( v100 ) | |
1387 { | |
1388 pParty->vPosition.x = v135; | |
1389 pParty->vPosition.y = v132; | |
1390 pParty->vPosition.z = v126; | |
1391 pParty->uFallStartY = v126; | |
1392 if ( _5B65B4_npcdata_loword_house_or_other != -1 ) | |
1393 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; | |
1394 _5B65B4_npcdata_loword_house_or_other = -1; | |
1395 v120 = 0; | |
1396 v116 = 0; | |
1397 v111 = 0; | |
1398 v110 = 0; | |
1399 v109 = -1; | |
1400 v108 = 0; | |
1401 v107 = 0; | |
1402 pParty->sRotationX = v95; | |
1403 pParty->uFallSpeed = v134; | |
1404 dword_5B65C0 = 0; | |
1405 dword_5B65BC = 0; | |
1406 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1407 _5B65B0_npcdata_rep_or_other = 0; | |
1408 _5B65AC_npcdata_fame_or_other = 0; | |
1409 _5B65A8_npcdata_uflags_or_other = 0; | |
1410 v106 = 232; | |
307 | 1411 LABEL_280: |
1490 | 1412 pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); |
1413 } | |
1414 } | |
1415 else | |
1416 { | |
1417 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((activeLevelDecoration == NULL) + 1); | |
2101 | 1418 Transition_StopSound_Autosave(v99, MapStartPoint_Party); |
1490 | 1419 v133 = 1; |
1420 if ( pCurrentScreen == SCREEN_HOUSE ) | |
1421 { | |
2124 | 1422 if ( uGameState == GAME_STATE_CHANGE_LOCATION ) |
1490 | 1423 { |
1424 pAudioPlayer->StopChannels(-1, -1); | |
1425 dialog_menu_id = HOUSE_DIALOGUE_NULL; | |
1919 | 1426 while ( HouseDialogPressCloseBtn() ) |
1490 | 1427 ; |
1428 pVideoPlayer->Unload(); | |
1429 window_SpeakInHouse->Release(); | |
1430 window_SpeakInHouse = 0; | |
1431 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1432 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1433 pCurrentScreen = SCREEN_GAME; | |
1434 viewparams->bRedrawGameUI = 1; | |
1435 pDialogueNPCCount = 0; | |
1436 pDialogueWindow->Release(); | |
1437 dialog_menu_id = HOUSE_DIALOGUE_NULL; | |
1438 pDialogueWindow = 0; | |
1439 pIcons_LOD->SyncLoadedFilesCount(); | |
1440 } | |
1441 OnMapLeave(); | |
1442 return; | |
1443 } | |
1444 } | |
1445 ++curr_seq_num; | |
1446 v4 = v124; | |
1447 | |
1448 //v6 = v123; | |
1449 //v7 = ""; | |
1450 break; | |
1451 case EVENT_PlaySound: | |
1452 v120 = 0; | |
1453 v116 = 0; | |
1454 v111 = 0; | |
1455 v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1456 v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1457 v108 = 0; | |
1458 v107 = 0; | |
1459 v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1460 goto LABEL_280; | |
1461 case EVENT_GiveItem: | |
1462 item.Reset(); | |
1463 //v101 = &pSomeEVT[v9]; | |
1464 v102 = _evt->v7 | |
1465 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); | |
1466 pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); | |
1467 if ( v102 ) | |
1468 item.uItemID = v102; | |
1469 pParty->SetHoldingItem(&item); | |
1470 ++curr_seq_num; | |
1471 v4 = v124; | |
1472 //v6 = v123; | |
1473 //v7 = ""; | |
1474 break; | |
1475 case EVENT_SpeakInHouse: | |
1476 if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5))) | |
1477 { | |
2153 | 1478 pRenderer->Sub01(); |
1490 | 1479 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); |
1480 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); | |
1481 v104 = 187; | |
1482 if ( uCurrentHouse_Animation != 167 ) | |
1483 v104 = EVT_DWORD(_evt->v5); | |
1484 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); | |
1485 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); | |
1486 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
1487 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
1488 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
1489 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); | |
1490 } | |
1491 ++curr_seq_num; | |
1492 v4 = v124; | |
1493 | |
1494 //v6 = v123; | |
1495 //v7 = ""; | |
1496 break; | |
1497 case EVENT_PressAnyKey: | |
1498 v121 = 33; | |
1499 v105 = curr_seq_num + 1; | |
1500 goto LABEL_295; | |
1501 case EVENT_Exit: | |
1502 if ( v133 == 1 ) | |
1503 OnMapLeave(); | |
1504 return; | |
1505 default: | |
1506 ++curr_seq_num; | |
1507 v4 = v124; | |
1508 | |
1509 //v6 = v123; | |
1510 //v7 = ""; | |
1511 break; | |
1512 } | |
1513 } | |
1514 ++v4; | |
1515 v124 = v4; | |
1516 if ( v4 >= uSomeEVT_NumEvents ) | |
1517 goto LABEL_301; | |
1518 //} | |
1519 } | |
1520 } | |
307 | 1521 |
1295 | 1522 //----- (00444732) -------------------------------------------------------- |
1523 char *GetEventHintString(unsigned int uEventID) | |
1524 { | |
1525 signed int event_index; // edx@1 | |
1526 int event_pos; // esi@4 | |
1527 char *result; // eax@6 | |
1528 unsigned int str_index; // eax@9 | |
1529 int i; // esi@11 | |
1530 _evt_raw* test_evt; | |
1531 _evt_raw* last_evt; | |
1532 | |
1533 event_index = 0; | |
1534 if ( uLevelEVT_NumEvents <= 0 ) | |
1535 return NULL; | |
1490 | 1536 |
1295 | 1537 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; |
1538 while ( 1 ) | |
1539 { | |
1540 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) | |
1541 { | |
1490 | 1542 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; |
1543 last_evt=test_evt; | |
1295 | 1544 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; |
1545 if ( test_evt->_e_type == EVENT_MouseOver ) | |
1546 break; | |
1547 } | |
1548 ++event_index; | |
1549 if ( event_index >= uLevelEVT_NumEvents ) | |
1550 return NULL; | |
1551 } | |
1490 | 1552 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; |
1295 | 1553 if ( test_evt->_e_type== EVENT_SpeakInHouse ) |
1554 { | |
1555 str_index = EVT_DWORD(test_evt->v5); | |
1556 result = (char *)p2DEvents[str_index - 1].pName; | |
1557 } | |
1558 else | |
1559 { | |
1560 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) | |
1561 { | |
1562 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
1490 | 1563 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; |
1295 | 1564 if ( test_evt->_e_type == EVENT_SpeakInHouse ) |
1565 { | |
1566 str_index = EVT_DWORD(test_evt->v5); | |
1567 if ( str_index < 600 ) | |
1568 return (char *)p2DEvents[str_index - 1].pName; | |
1569 } | |
1570 } | |
1571 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
1572 } | |
1490 | 1573 |
1295 | 1574 return result; |
1575 } |