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