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