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