Mercurial > mm7
annotate Events.cpp @ 2137:d24ee391fd1f
libavcodec playing movies and houses, loops not working yet
author | zipi |
---|---|
date | Wed, 01 Jan 2014 13:43:09 +0000 |
parents | 7f403ebf619f |
children | ca548138d6aa cfe04d858766 |
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" |
2052 | 36 #include "LuaVM.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 { | |
2052 | 434 if (!lua->DoFile("out01.lua")) |
2050 | 435 Log::Warning(L"Error opening out01.lua\n"); |
2068 | 436 Log::Warning(L"being tested that well\n"); |
2066 | 437 return; |
2050 | 438 } |
1490 | 439 if ( !uEventID ) |
440 { | |
441 if ( !GameUI_Footer_TimeLeft ) | |
442 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here | |
443 return; | |
444 } | |
445 player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 | |
446 curr_seq_num = entry_line; | |
1052 | 447 |
1490 | 448 if ( activeLevelDecoration ) |
449 { | |
450 uSomeEVT_NumEvents = uGlobalEVT_NumEvents; | |
451 pSomeEVT = pGlobalEVT.data(); | |
452 memcpy(pSomeEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400); //4400 evts | |
453 } | |
454 else | |
455 { | |
456 uSomeEVT_NumEvents = uLevelEVT_NumEvents; | |
457 pSomeEVT = pLevelEVT.data(); | |
458 memcpy(pSomeEVT_Events.data(), pLevelEVT_Index.data(), sizeof(EventIndex)*4400); | |
459 } | |
307 | 460 |
1490 | 461 v4 = 0; |
462 v124 = 0; | |
463 //for (uint i = 0; i < uSomeEVT_NumEvents; ++i) | |
464 // { | |
465 //v6 = v123; | |
466 //v7 = ""; | |
467 while ( 1 ) | |
468 { | |
1825
23deb6b09c8c
cancelEventProcessing to dword_5B65C4_cancelEventProcessing
Grumpy7
parents:
1821
diff
changeset
|
469 if ( dword_5B65C4_cancelEventProcessing ) |
1490 | 470 goto LABEL_301; |
471 //v8 = v4; | |
472 if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num ) | |
473 { | |
474 //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; | |
475 //v10 = (ByteArray *)&v5[v9]; | |
1980 | 476 _evt_raw * _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[v4].uEventOffsetInEVT); |
307 | 477 |
1490 | 478 switch (_evt->_e_type) |
479 { | |
480 case EVENT_CheckSeason: | |
481 // | |
482 if ( !sub_4465DF_check_season(_evt->v5) ) | |
1052 | 483 { |
1490 | 484 ++curr_seq_num; |
485 v4 = v124; | |
486 break; | |
1052 | 487 } |
1490 | 488 v124 = -1; |
489 curr_seq_num = _evt->v6 - 1; | |
490 ++curr_seq_num; | |
491 break; | |
492 case EVENT_ShowMovie: | |
493 { | |
494 strcpy(Source, (char *)&_evt->v7); | |
495 v12 = (char *)&item.uExpireTime + strlen(Source) + 7; | |
496 if ( *v12 == 32 ) | |
497 *v12 = 0; | |
2137
d24ee391fd1f
libavcodec playing movies and houses, loops not working yet
zipi
parents:
2124
diff
changeset
|
498 if (pVideoPlayer->bBufferLoaded) |
1490 | 499 pVideoPlayer->Unload(); |
500 pVideoPlayer->bStopBeforeSchedule = 0; | |
501 pVideoPlayer->pResetflag = 0; | |
1038 | 502 |
1490 | 503 v128 = pCurrentScreen; |
504 //v13 = &pSomeEVT[v9]; | |
505 //v14 = (unsigned __int8)v13[5]; | |
506 //v15 = (unsigned __int8)v13[6]; | |
507 v14 = _evt->v5; | |
508 v15 = _evt->v6; | |
509 strcpy(Str, Source); | |
510 v16 = RemoveQuotes(Str); | |
511 VideoPlayer::MovieLoop(v16, 0, v14, 1); | |
512 if ( !_stricmp(v16, "arbiter good") ) | |
373 | 513 { |
514 pParty->alignment = PartyAlignment_Good; | |
1490 | 515 v18 = 0; |
516 LOBYTE(v17) = 1; | |
517 SetUserInterface(PartyAlignment_Good, v17); | |
518 if ( !v15 || v128 == 3 ) | |
519 { | |
520 pCurrentScreen = v128; | |
521 if ( v128 == 3 ) | |
522 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
523 if ( v128 == 13 ) | |
524 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
525 } | |
526 | |
527 ++curr_seq_num; | |
528 v4 = v124; | |
1038 | 529 |
1490 | 530 //v6 = v123; |
531 //v7 = ""; | |
532 break; | |
533 } | |
534 if ( !_stricmp(v16, "arbiter evil") ) | |
535 { | |
536 v18 = 2; | |
537 pParty->alignment = PartyAlignment_Evil; | |
538 LOBYTE(v17) = 1; | |
539 SetUserInterface(PartyAlignment_Evil, v17); | |
540 if ( !v15 || v128 == 3 ) | |
541 { | |
542 pCurrentScreen = v128; | |
543 if ( v128 == 3 ) | |
544 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
545 if ( v128 == 13 ) | |
546 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
547 } | |
548 ++curr_seq_num; | |
549 v4 = v124; | |
307 | 550 |
1490 | 551 //v6 = v123; |
552 //v7 = ""; | |
553 | |
554 break; | |
555 } | |
556 if ( !_stricmp(v16, "pcout01") ) // moving to harmondale from emerald isle | |
766 | 557 { |
1490 | 558 Rest(0x2760u); |
559 pParty->RestAndHeal(); | |
560 pParty->days_played_without_rest = 0; | |
766 | 561 } |
1490 | 562 if ( !v15 || v128 == 3 ) |
563 { | |
564 pCurrentScreen = v128; | |
565 if ( v128 == 3 ) | |
566 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
567 if ( v128 == 13 ) | |
568 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
569 } | |
570 ++curr_seq_num; | |
571 v4 = v124; | |
572 | |
573 //v6 = v123; | |
574 //v7 = ""; | |
575 } | |
576 break; | |
577 case EVENT_CheckSkill: | |
578 { | |
579 v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); | |
580 if ( player_choose < 0 ) | |
581 goto LABEL_47; | |
582 if ( player_choose <= 3 ) | |
583 { | |
584 v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5]; | |
585 } | |
586 else | |
587 { | |
588 if ( player_choose == 4 ) | |
589 { | |
590 v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; | |
591 } | |
592 else | |
593 { | |
594 if ( player_choose == 5 ) | |
595 { | |
596 v20 = 0; | |
597 v21 = 3486 * v130 + _evt->v5; | |
598 v136 = 1; | |
599 LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21]; | |
600 v137 = v21 & 0x40; | |
601 v138 = v21 & 0x80; | |
602 v22 = v21 & 0x100; | |
603 v23 = v21 & 0x3F; | |
604 v139 = v22; | |
605 while ( v23 < v19 || !*(&v136 + _evt->v6) ) | |
606 { | |
607 ++v20; | |
608 if ( v20 >= 4 ) | |
609 { | |
610 ++curr_seq_num; | |
611 v4 = v124; | |
612 | |
613 //v6 = v123; | |
614 //v7 = ""; | |
615 break; | |
616 } | |
617 } | |
618 v11 = _evt->v11; | |
619 goto LABEL_130; | |
620 } | |
307 | 621 LABEL_47: |
1490 | 622 //v10 = (ByteArray *)&v5[v9]; |
623 v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4]; | |
624 } | |
625 } | |
626 v136 = 1; | |
627 v137 = v24 & 0x40; | |
628 v138 = v24 & 0x80; | |
629 v139 = v24 & 0x100; | |
630 if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) | |
631 { | |
632 v11 = _evt->v11; | |
633 goto LABEL_130; | |
634 } | |
635 ++curr_seq_num; | |
636 v4 = v124; | |
637 | |
638 //v6 = v123; | |
639 //v7 = ""; | |
640 } | |
641 break; | |
307 | 642 |
1490 | 643 case EVENT_SpeakNPC: |
644 if ( canShowMessages ) | |
645 { | |
646 //Actor::Actor(&Dst); | |
647 memset(&Dst, 0, 0x344u); | |
648 dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); | |
649 Dst.sNPC_ID = dword_5B65D0_dialogue_actor_npc_id; | |
650 GameUI_InitializeDialogue(&Dst, false); | |
651 } | |
652 else | |
653 { | |
654 bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); | |
655 } | |
656 ++curr_seq_num; | |
657 v4 = v124; | |
658 | |
659 //v6 = v123; | |
660 //v7 = ""; | |
661 break; | |
662 case EVENT_ChangeEvent: | |
663 v25 = EVT_DWORD(_evt->v5); | |
664 if ( v25 ) | |
665 { | |
1736
c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents:
1583
diff
changeset
|
666 stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124; |
1490 | 667 } |
668 else | |
669 { | |
670 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
|
671 stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0; |
1489 | 672 v26->uFlags |= LEVEL_DECORATION_INVISIBLE; |
1490 | 673 } |
674 ++curr_seq_num; | |
675 v4 = v124; | |
525 | 676 |
1490 | 677 break; |
678 case EVENT_SetNPCGreeting: | |
679 v27 = EVT_DWORD(_evt->v5); | |
680 pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; | |
681 pNPCStats->pNewNPCData[v27].greet = EVT_DWORD(_evt->v9); | |
682 ++curr_seq_num; | |
683 v4 = v124; | |
684 | |
685 //v6 = v123; | |
686 //v7 = ""; | |
687 break; | |
827 | 688 case EVENT_SetNPCTopic: |
689 { | |
690 //v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
691 pEventID = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); | |
692 pNPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
693 pIndex = _evt->v9; | |
694 pNPC = &pNPCStats->pNewNPCData[pNPC_ID]; | |
695 if ( pIndex == 0 ) | |
696 pNPC->evt_A = pEventID; | |
697 if ( pIndex == 1 ) | |
698 pNPC->evt_B = pEventID; | |
699 if ( pIndex == 2 ) | |
700 pNPC->evt_C = pEventID; | |
701 if ( pIndex == 3 ) | |
702 pNPC->evt_D = pEventID; | |
703 if ( pIndex == 4 ) | |
704 pNPC->evt_E = pEventID; | |
705 if ( pIndex == 5 ) | |
706 pNPC->evt_F = pEventID; | |
707 if ( pNPC_ID == 8 ) | |
708 { | |
709 if ( pEventID == 78 ) | |
710 { | |
1919 | 711 HouseDialogPressCloseBtn(); |
827 | 712 window_SpeakInHouse->Release(); |
713 pParty->uFlags &= ~2; | |
714 if ( EnterHouse(HOUSE_DARK_GUILD_PIT) ) | |
715 { | |
716 pAudioPlayer->StopChannels(-1, -1); | |
717 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); | |
948 | 718 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); |
719 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
720 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
721 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
722 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); | |
827 | 723 current_npc_text = pNPCTopics[90].pText; |
724 } | |
725 } | |
726 } | |
727 ++curr_seq_num; | |
728 } | |
729 v4 = v124; | |
730 break; | |
1490 | 731 case EVENT_NPCSetItem: |
732 sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); | |
733 ++curr_seq_num; | |
734 v4 = v124; | |
525 | 735 |
1490 | 736 break; |
737 case EVENT_SetActorItem: | |
738 Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); | |
739 ++curr_seq_num; | |
740 v4 = v124; | |
741 break; | |
742 case EVENT_SetNPCGroupNews: | |
743 pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); | |
744 ++curr_seq_num; | |
745 v4 = v124; | |
746 break; | |
747 case EVENT_SetActorGroup: | |
748 __debugbreak(); | |
749 *(&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); | |
750 ++curr_seq_num; | |
751 v4 = v124; | |
752 break; | |
753 case EVENT_ChangeGroup: | |
754 v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
755 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
756 v40 = uNumActors; | |
757 __debugbreak(); | |
758 if ( (signed int)uNumActors > 0 ) | |
759 { | |
760 v41 = pActors.data();//[0].uGroup; | |
761 do | |
762 { | |
763 if ( v41->uGroup == v38 ) | |
764 v41->uGroup = v39; | |
765 ++v41; | |
766 --v40; | |
767 } | |
768 while ( v40 ); | |
769 } | |
770 ++curr_seq_num; | |
771 v4 = v124; | |
772 | |
773 //v6 = v123; | |
774 //v7 = ""; | |
775 break; | |
776 case EVENT_ChangeGroupAlly: | |
777 v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
778 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
779 v44 = uNumActors; | |
780 __debugbreak(); | |
781 if ( (signed int)uNumActors > 0 ) | |
782 { | |
783 v45 = pActors.data();//[0].uAlly; | |
784 do | |
785 { | |
786 if ( v45->uGroup == v42 ) | |
787 v45->uAlly = v43; | |
788 ++v45; | |
789 --v44; | |
790 } | |
791 while ( v44 ); | |
792 } | |
793 ++curr_seq_num; | |
794 v4 = v124; | |
795 | |
796 //v6 = v123; | |
797 //v7 = ""; | |
798 break; | |
799 case EVENT_MoveNPC: | |
800 { | |
801 | |
802 pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9); | |
803 if ( window_SpeakInHouse ) | |
804 { | |
310 | 805 |
1490 | 806 if ( window_SpeakInHouse->par1C == 165 ) |
807 { | |
1919 | 808 HouseDialogPressCloseBtn(); |
1490 | 809 pVideoPlayer->Unload(); |
810 window_SpeakInHouse->Release(); | |
811 pParty->uFlags &= ~2; | |
812 activeLevelDecoration = (LevelDecoration*)1; | |
813 if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) | |
814 { | |
815 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); | |
816 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); | |
817 v48 = window_SpeakInHouse->pControlsHead; | |
818 if ( v48 ) | |
819 { | |
820 do | |
821 { | |
822 v49 = v48->pNext; | |
1583 | 823 free(v48); |
1490 | 824 v48 = v49; |
825 } | |
826 while ( v49 ); | |
827 } | |
828 window_SpeakInHouse->pControlsHead = 0; | |
829 window_SpeakInHouse->pControlsTail = 0; | |
830 window_SpeakInHouse->uNumControls = 0; | |
831 } | |
832 } | |
833 else | |
834 { | |
835 if ( window_SpeakInHouse->par1C == 553 ) | |
836 pVideoPlayer->bLoopPlaying = 0; | |
837 } | |
838 } | |
839 | |
840 } | |
525 | 841 ++curr_seq_num; |
1490 | 842 v4 = v124; |
843 | |
844 break; | |
845 case EVENT_Jmp: | |
846 curr_seq_num = _evt->v5 - 1; | |
847 ++curr_seq_num; | |
848 v4 = -1; | |
525 | 849 |
1490 | 850 break; |
851 case EVENT_ShowFace: | |
852 if ( _evt->v5 <= 3u ) //someone | |
853 pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
854 else if ( _evt->v5 == 4 ) //active | |
855 pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
856 else if ( _evt->v5 == 5 ) //all players | |
857 { | |
858 for(int i=0; i<4; ++i) | |
859 pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
860 } | |
861 else //random player | |
862 pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
863 ++curr_seq_num; | |
864 v4 = v124; | |
525 | 865 |
1490 | 866 break; |
867 case EVENT_CharacterAnimation: | |
868 if ( _evt->v5 <= 3u ) //someone | |
869 pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0); | |
870 else if ( _evt->v5 == 4 ) //active | |
871 pParty->pPlayers[uActiveCharacter].PlaySound((PlayerSpeech) _evt->v6, 0); | |
872 else if ( _evt->v5 == 5 ) //all | |
873 for(int i=0; i<4; ++i) | |
874 pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0); | |
875 else //random | |
876 pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0); | |
877 ++curr_seq_num; | |
878 v4 = v124; | |
525 | 879 |
1490 | 880 break; |
881 case EVENT_ForPartyMember: | |
882 player_choose = _evt->v5; | |
883 ++curr_seq_num; | |
884 v4 = v124; | |
885 break; | |
886 case EVENT_SummonItem: | |
887 sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), | |
888 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), | |
889 _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), | |
890 _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), | |
891 _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), | |
892 _evt->v25, _evt->v26, 0, 0); | |
893 ++curr_seq_num; | |
894 v4 = v124; | |
525 | 895 |
1490 | 896 //v6 = v123; |
897 //v7 = ""; | |
898 break; | |
899 case EVENT_Compare: | |
900 pValue = EVT_DWORD(_evt->v7); | |
901 if ( player_choose <= 3 ) | |
902 { | |
903 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
904 { | |
905 v124 = -1; | |
906 curr_seq_num = _evt->v11 - 1; | |
907 } | |
908 } | |
909 else if ( player_choose == 4 ) //active | |
910 { | |
911 if ( uActiveCharacter ) | |
912 { | |
913 if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
914 { | |
915 v124 = -1; | |
916 curr_seq_num = _evt->v11 - 1; | |
917 } | |
918 } | |
919 } | |
920 else if ( player_choose == 5 )//all | |
921 { | |
922 v130=0; | |
923 for(int i = 1; i < 5; ++i) | |
924 { | |
925 if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
926 { | |
927 v124 = -1; | |
928 curr_seq_num = _evt->v11 - 1; | |
929 break; | |
930 } | |
931 ++v130; | |
932 } | |
933 } | |
934 else if ( player_choose == 6 ) //random | |
935 { | |
1817
0f1543750bf8
Changing itemlist accesses to helper functions + getting rid of some pPlayers array accesses
Grumpy7
parents:
1736
diff
changeset
|
936 if ( pPlayers[rand() % 4 + 1]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) |
1490 | 937 { |
938 v124 = -1; | |
939 curr_seq_num = _evt->v11 - 1; | |
940 } | |
941 } | |
942 ++curr_seq_num; | |
943 v4 = v124; | |
944 break; | |
945 case EVENT_IsActorAlive: | |
946 if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) | |
947 { | |
948 v124 = -1; | |
949 curr_seq_num = _evt->v11 - 1; | |
950 } | |
951 ++curr_seq_num; | |
952 v4 = v124; | |
953 break; | |
954 case EVENT_Substract: | |
955 pValue = EVT_DWORD(_evt->v7); | |
2025 | 956 /*if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands ) |
1490 | 957 { |
958 if ( pParty->pPickedItem.uItemID == pValue )//In hand | |
959 { | |
960 pMouse->RemoveHoldingItem(); | |
961 ++curr_seq_num; | |
962 v4 = v124; | |
963 break; | |
964 } | |
2024 | 965 //v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix.data(); |
1490 | 966 for ( v65 = 0; v65 < 126; ++v65 ) |
967 { | |
2025 | 968 v67 = &pPlayers[uActiveCharacter]->pInventoryMatrix[v65]; |
969 if ( v67 > 0 ) | |
1490 | 970 { |
2025 | 971 if ( pPlayers[uActiveCharacter]->pInventoryItemList[v67 - 1].uItemID == pValue ) |
972 { | |
973 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65); | |
974 //++curr_seq_num; | |
975 //v4 = v124; | |
976 goto substract; | |
977 } | |
1490 | 978 } |
2024 | 979 //v67 += 4; |
1490 | 980 } |
2024 | 981 //while ( (signed int)v65 < 126 ); |
2025 | 982 //v69 = (int)&pPlayers[uActiveCharacter]->pEquipment.pIndices; |
1490 | 983 for ( v68 = 0; v68 < 16; ++v68 ) |
984 { | |
2025 | 985 if ( pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->pEquipment.pIndices[v68]].uItemID == pValue ) |
1490 | 986 { |
2025 | 987 pPlayers[uActiveCharacter]->pEquipment.pIndices[v68] = 0; |
988 //++curr_seq_num; | |
989 //v4 = v124; | |
990 goto substract; | |
1490 | 991 } |
2025 | 992 //v69 += 4; |
1490 | 993 } |
994 for (int i = 1; i < 5; i++) | |
995 { | |
2024 | 996 //v72 = (int)pPlayers[i]->pInventoryMatrix.data(); |
1490 | 997 for ( int v71 = 0; v71 < 126; ++v71 ) |
998 { | |
2025 | 999 v72 = &pPlayers[i]->pInventoryMatrix[v71]; |
1000 if ( v72 > 0 ) | |
1490 | 1001 { |
2025 | 1002 if ( pPlayers[i]->pInventoryItemList[v72 - 1].uItemID == pValue ) |
1003 { | |
1004 pPlayers[i]->RemoveItemAtInventoryIndex(v71); | |
1005 goto substract; | |
1006 } | |
1490 | 1007 } |
2024 | 1008 //v72 += 4; |
1490 | 1009 } |
2025 | 1010 for ( v73 = 0; v73 < 16; ++v73 ) |
1490 | 1011 { |
2025 | 1012 //v74 = (int)&pPlayers[i]->pEquipment; |
1013 if (pPlayers[i]->pEquipment.pIndices[v73]) | |
1014 { | |
1015 if (pPlayers[i]->pInventoryItemList[pPlayers[i]->pEquipment.pIndices[v73] - 1].uItemID == pValue ) | |
1016 { | |
1017 pPlayers[i]->pEquipment.pIndices[v73] = 0; | |
1018 //v74 += 4; | |
1019 goto substract; | |
1020 } | |
1021 } | |
1490 | 1022 } |
1023 } | |
2025 | 1024 }*/ |
1490 | 1025 if ( player_choose <= 3 ) |
2025 | 1026 pParty->pPlayers[player_choose].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1027 else if ( player_choose == 4 ) //active |
1028 { | |
1029 if ( uActiveCharacter ) | |
2025 | 1030 pPlayers[uActiveCharacter]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1031 } |
1032 else if ( player_choose == 5 )//all | |
1033 { | |
1034 for(int i = 1; i < 5; ++i) | |
1035 { | |
1820
af7f08135ffb
Player::SubtractVariable changing return val to void, finishing cleanup
Grumpy7
parents:
1817
diff
changeset
|
1036 pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1037 } |
1038 } | |
1039 else if ( player_choose == 6 ) //random | |
1040 { | |
1041 player_choose = rand() % 4; | |
2025 | 1042 pParty->pPlayers[player_choose].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1043 } |
2025 | 1044 //substract: |
1490 | 1045 ++curr_seq_num; |
1046 v4 = v124; | |
1047 break; | |
1048 case EVENT_Set: | |
1049 pValue = EVT_DWORD(_evt->v7); | |
1050 if ( player_choose <= 3 ) | |
2025 | 1051 pParty->pPlayers[player_choose].SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1052 else if ( player_choose == 4 ) //active |
1053 { | |
1054 if ( uActiveCharacter ) | |
2025 | 1055 pPlayers[uActiveCharacter]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1056 } |
1057 else if ( player_choose == 5 )//all | |
1058 { | |
525 | 1059 //recheck v130 |
2025 | 1060 for ( int i = 1; i < 5; ++i ) |
1490 | 1061 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1062 } | |
1063 else if ( player_choose == 6 ) //random | |
1064 { | |
1065 player_choose = rand() % 4; | |
1066 pPlayer = &pParty->pPlayers[player_choose]; | |
1067 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1068 } | |
2025 | 1069 ++curr_seq_num; |
1070 v4 = v124; | |
1071 break; | |
1490 | 1072 case EVENT_Add: |
1073 pValue = EVT_DWORD(_evt->v7); | |
1074 if ( player_choose <= 3 ) | |
1075 { | |
1076 pPlayer = &pParty->pPlayers[player_choose]; | |
1077 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1078 } | |
1079 else if ( player_choose == 4 ) //active | |
1080 { | |
1081 if ( uActiveCharacter ) | |
2025 | 1082 pPlayers[uActiveCharacter]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1083 } |
1084 else if ( player_choose == 5 )//all | |
1085 { | |
1086 for(int i = 1; i < 5; ++i) | |
1087 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1088 } | |
1089 else if ( player_choose == 6 ) //random | |
1090 { | |
1091 player_choose = rand() % 4; | |
2025 | 1092 pParty->pPlayers[player_choose].AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1093 } |
2025 | 1094 v83 = EVT_WORD(_evt->v5); |
1095 if (v83 == 21 || // gold well on emerald isle | |
1096 v83 == 22 || v83 == 23 || v83 == 24 ) | |
1097 { | |
1098 //__debugbreak(); // bonfire | |
1099 viewparams->bRedrawGameUI = true; | |
1100 } | |
1101 ++curr_seq_num; | |
1102 v4 = v124; | |
1103 break; | |
1490 | 1104 case EVENT_InputString: |
1105 if ( !entry_line ) | |
1106 { | |
1107 strcpy(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]); | |
1108 v105 = curr_seq_num; | |
1109 v121 = 26; | |
307 | 1110 LABEL_295: |
1490 | 1111 sub_4451A8_press_any_key(uEventID, v105, v121); |
307 | 1112 LABEL_301: |
1490 | 1113 if ( v133 == 1 ) |
1114 OnMapLeave(); | |
1115 return; | |
1116 } | |
1117 v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1118 if ( !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) | |
1119 || !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[v84]]) ) | |
1120 { | |
1121 v11 = _evt->v17; | |
307 | 1122 LABEL_130: |
1490 | 1123 //v124 = -1; |
307 | 1124 LABEL_131: |
1490 | 1125 curr_seq_num = v11 - 1; |
1126 } | |
1127 ++curr_seq_num; | |
1128 v4 = v124; | |
1129 | |
1130 //v6 = v123; | |
1131 //v7 = ""; | |
1132 break; | |
1133 case EVENT_RandomGoTo: | |
1134 //v124 = -1; | |
1135 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) | |
1136 + (_evt->v10 != 0))); | |
525 | 1137 curr_seq_num = v11 - 1; |
787 | 1138 ++curr_seq_num; |
1139 v4 = v124; | |
1140 break; | |
1490 | 1141 case EVENT_ReceiveDamage: |
1142 v85 = EVT_DWORD(_evt->v7 ); | |
1143 v86 = _evt->v5; | |
1144 if ( (unsigned __int8)v86 <= 3 ) | |
1145 { | |
1146 v119 = _evt->v6; | |
1147 v115 = EVT_DWORD(_evt->v7 ); | |
1148 v89 = (unsigned __int8)v86; | |
1149 v88 = &pParty->pPlayers[v89]; | |
1150 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); | |
1151 ++curr_seq_num; | |
1152 v4 = v124; | |
1153 break; | |
1154 } | |
1155 if ( v86 == 4 ) | |
1156 { | |
1157 if ( !uActiveCharacter ) | |
1158 { | |
1159 ++curr_seq_num; | |
1160 v4 = v124; | |
1161 | |
1162 //v6 = v123; | |
1163 //v7 = ""; | |
1164 break; | |
1165 } | |
1166 v119 = _evt->v6; | |
1167 v88 = pPlayers[uActiveCharacter]; | |
1168 v115 = EVT_DWORD(_evt->v7 ); | |
1169 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); | |
1170 ++curr_seq_num; | |
1171 v4 = v124; | |
1172 break; | |
1173 } | |
1174 if ( v86 != 5 ) | |
1175 { | |
1176 v119 = _evt->v6; | |
1177 v115 = EVT_DWORD(_evt->v7 ); | |
1178 v89 = rand() % 4; | |
1179 v88 = &pParty->pPlayers[v89]; | |
1180 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); | |
1181 ++curr_seq_num; | |
1182 v4 = v124; | |
1183 | |
1184 //v6 = v123; | |
1185 //v7 = ""; | |
1186 break; | |
1187 } | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1828
diff
changeset
|
1188 v87 = pParty->pPlayers.data(); |
1490 | 1189 do |
1190 { | |
1191 v87->ReceiveDamage(v85, (DAMAGE_TYPE)_evt->v6); | |
1192 ++v87; | |
1193 } | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1828
diff
changeset
|
1194 while ( (signed int)v87 < (signed int)pParty->pHirelings.data() ); |
1490 | 1195 ++curr_seq_num; |
1196 v4 = v124; | |
1197 | |
1198 //v6 = v123; | |
1199 //v7 = ""; | |
1200 break; | |
1201 case EVENT_ToggleIndoorLight: | |
1202 pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9); | |
1203 ++curr_seq_num; | |
1204 v4 = v124; | |
1205 | |
1206 //v6 = v123; | |
1207 //v7 = ""; | |
1208 break; | |
1209 case EVENT_SetFacesBit: | |
1210 sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); | |
1211 ++curr_seq_num; | |
1212 v4 = v124; | |
1213 | |
1214 //v6 = v123; | |
1215 //v7 = ""; | |
1216 break; | |
1217 case EVENT_ToggleChestFlag: | |
1218 Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); | |
1219 ++curr_seq_num; | |
1220 v4 = v124; | |
1221 | |
1222 //v6 = v123; | |
1223 //v7 = ""; | |
1224 break; | |
1225 case EVENT_ToggleActorFlag: | |
1226 Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); | |
1227 ++curr_seq_num; | |
1228 v4 = v124; | |
1229 | |
1230 //v6 = v123; | |
1231 //v7 = ""; | |
1232 break; | |
1233 case EVENT_ToggleActorGroupFlag: | |
1234 ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); | |
1235 ++curr_seq_num; | |
1236 v4 = v124; | |
1237 | |
1238 //v6 = v123; | |
1239 //v7 = ""; | |
1240 break; | |
1241 case EVENT_SetSnow: | |
1242 if ( !_evt->v5 ) | |
1243 pWeather->bRenderSnow = _evt->v6 != 0; | |
1244 ++curr_seq_num; | |
1245 v4 = v124; | |
1246 | |
1247 //v6 = v123; | |
1248 //v7 = ""; | |
1249 break; | |
1250 case EVENT_StatusText: | |
1251 v90 = EVT_DWORD(_evt->v5 ); | |
1252 if ( activeLevelDecoration ) | |
1253 { | |
1254 if ( activeLevelDecoration == (LevelDecoration*)1 ) | |
1255 { | |
1256 current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; | |
1257 } | |
1258 if ( canShowMessages == 1 ) | |
1259 { | |
1260 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; | |
1261 //LABEL_248: | |
1262 ShowStatusBarString(v91, 2u); | |
1263 } | |
1264 } | |
1265 else | |
1266 { | |
1267 if ( canShowMessages == 1 ) | |
1268 { | |
1269 v91 = &pLevelStr[pLevelStrOffsets[v90]]; | |
1270 ShowStatusBarString(v91, 2u); | |
1271 } | |
1272 } | |
1273 ++curr_seq_num; | |
1274 v4 = v124; | |
1275 | |
1276 //v6 = v123; | |
1277 //v7 = ""; | |
1278 break; | |
1279 case EVENT_ShowMessage: | |
1280 v92 = EVT_DWORD(_evt->v5 ); | |
1281 if ( activeLevelDecoration ) | |
1282 { | |
1283 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; | |
1284 byte_5B0938[0] = 0; | |
1285 current_npc_text = v93; | |
1286 } | |
1287 else | |
1288 { | |
1289 strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[v92]]); | |
1290 } | |
1291 ++curr_seq_num; | |
1292 v4 = v124; | |
1293 | |
1294 //v6 = v123; | |
1295 //v7 = ""; | |
1296 break; | |
1297 case EVENT_CastSpell: | |
835 | 1298 EventCastSpell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ), |
525 | 1299 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), |
1300 EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 )); | |
835 | 1301 ++curr_seq_num; |
1302 v4 = v124; | |
1303 break; | |
1490 | 1304 case EVENT_SetTexture: |
1305 sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9); | |
1306 ++curr_seq_num; | |
1307 v4 = v124; | |
1308 | |
1309 //v6 = v123; | |
1310 //v7 = ""; | |
1311 break; | |
1312 case EVENT_SetSprite: | |
1313 SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10); | |
1314 ++curr_seq_num; | |
1315 v4 = v124; | |
1316 | |
1317 //v6 = v123; | |
1318 //v7 = ""; | |
1319 break; | |
1320 case EVENT_SummonMonsters: | |
1321 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ), | |
525 | 1322 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), |
1323 EVT_DWORD(_evt->v24 )); | |
1490 | 1324 ++curr_seq_num; |
1325 v4 = v124; | |
1326 | |
1327 //v6 = v123; | |
1328 //v7 = ""; | |
1329 break; | |
1330 case EVENT_MouseOver: | |
1331 case EVENT_LocationName: | |
1332 --curr_seq_num; | |
1333 ++curr_seq_num; | |
1334 v4 = v124; | |
1335 | |
1336 //v6 = v123; | |
1337 //v7 = ""; | |
1338 break; | |
1339 case EVENT_ChangeDoorState: | |
2085 | 1340 Door_switch_animation(_evt->v5, _evt->v6); |
1490 | 1341 ++curr_seq_num; |
1342 v4 = v124; | |
1343 break; | |
1344 case EVENT_OpenChest: | |
1345 if ( !Chest::Open(_evt->v5) ) | |
1346 goto LABEL_301; | |
1347 ++curr_seq_num; | |
1348 v4 = v124; | |
1349 | |
1350 //v6 = v123; | |
1351 //v7 = ""; | |
1352 break; | |
1353 case EVENT_MoveToMap: | |
1354 v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1355 v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1356 v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1357 v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1358 v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8); | |
1359 v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8); | |
1360 v96 = _evt->v25; | |
1361 v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); | |
1362 v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); | |
1363 if ( _evt->v29 || _evt->v30 ) | |
1364 { | |
1365 if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) | |
1366 pRenderer->_49FD3A(); | |
1367 TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); | |
1368 dword_5C3418 = uEventID; | |
1369 dword_5C341C = curr_seq_num + 1; | |
1370 goto LABEL_301; | |
1371 } | |
1372 _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1373 _5B65A8_npcdata_uflags_or_other = v94; | |
1374 _5B65B0_npcdata_rep_or_other = v126; | |
1375 if ( v129 == -1 ) | |
1376 { | |
1377 v98 = _5B65B4_npcdata_loword_house_or_other; | |
1378 } | |
1379 else | |
1380 { | |
1381 v98 = v129 & stru_5C6E00->uDoublePiMask; | |
1382 _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask; | |
1383 } | |
1384 v99 = (char *)&_evt->v31; | |
1385 _5B65B8_npcdata_hiword_house_or_other = v95; | |
1386 dword_5B65BC = v97; | |
1387 v100 = v94 | v132 | v126 | v95 | v97 | v98; | |
1388 dword_5B65C0 = v100; | |
1389 if ( *v99 == 48 ) | |
1390 { | |
1391 if ( v100 ) | |
1392 { | |
1393 pParty->vPosition.x = v135; | |
1394 pParty->vPosition.y = v132; | |
1395 pParty->vPosition.z = v126; | |
1396 pParty->uFallStartY = v126; | |
1397 if ( _5B65B4_npcdata_loword_house_or_other != -1 ) | |
1398 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; | |
1399 _5B65B4_npcdata_loword_house_or_other = -1; | |
1400 v120 = 0; | |
1401 v116 = 0; | |
1402 v111 = 0; | |
1403 v110 = 0; | |
1404 v109 = -1; | |
1405 v108 = 0; | |
1406 v107 = 0; | |
1407 pParty->sRotationX = v95; | |
1408 pParty->uFallSpeed = v134; | |
1409 dword_5B65C0 = 0; | |
1410 dword_5B65BC = 0; | |
1411 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1412 _5B65B0_npcdata_rep_or_other = 0; | |
1413 _5B65AC_npcdata_fame_or_other = 0; | |
1414 _5B65A8_npcdata_uflags_or_other = 0; | |
1415 v106 = 232; | |
307 | 1416 LABEL_280: |
1490 | 1417 pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); |
1418 } | |
1419 } | |
1420 else | |
1421 { | |
1422 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((activeLevelDecoration == NULL) + 1); | |
2101 | 1423 Transition_StopSound_Autosave(v99, MapStartPoint_Party); |
1490 | 1424 v133 = 1; |
1425 if ( pCurrentScreen == SCREEN_HOUSE ) | |
1426 { | |
2124 | 1427 if ( uGameState == GAME_STATE_CHANGE_LOCATION ) |
1490 | 1428 { |
1429 pAudioPlayer->StopChannels(-1, -1); | |
1430 dialog_menu_id = HOUSE_DIALOGUE_NULL; | |
1919 | 1431 while ( HouseDialogPressCloseBtn() ) |
1490 | 1432 ; |
1433 pVideoPlayer->Unload(); | |
1434 window_SpeakInHouse->Release(); | |
1435 window_SpeakInHouse = 0; | |
1436 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1437 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1438 pCurrentScreen = SCREEN_GAME; | |
1439 viewparams->bRedrawGameUI = 1; | |
1440 pDialogueNPCCount = 0; | |
1441 pDialogueWindow->Release(); | |
1442 dialog_menu_id = HOUSE_DIALOGUE_NULL; | |
1443 pDialogueWindow = 0; | |
1444 pIcons_LOD->SyncLoadedFilesCount(); | |
1445 } | |
1446 OnMapLeave(); | |
1447 return; | |
1448 } | |
1449 } | |
1450 ++curr_seq_num; | |
1451 v4 = v124; | |
1452 | |
1453 //v6 = v123; | |
1454 //v7 = ""; | |
1455 break; | |
1456 case EVENT_PlaySound: | |
1457 v120 = 0; | |
1458 v116 = 0; | |
1459 v111 = 0; | |
1460 v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1461 v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1462 v108 = 0; | |
1463 v107 = 0; | |
1464 v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1465 goto LABEL_280; | |
1466 case EVENT_GiveItem: | |
1467 item.Reset(); | |
1468 //v101 = &pSomeEVT[v9]; | |
1469 v102 = _evt->v7 | |
1470 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); | |
1471 pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); | |
1472 if ( v102 ) | |
1473 item.uItemID = v102; | |
1474 pParty->SetHoldingItem(&item); | |
1475 ++curr_seq_num; | |
1476 v4 = v124; | |
1477 //v6 = v123; | |
1478 //v7 = ""; | |
1479 break; | |
1480 case EVENT_SpeakInHouse: | |
1481 if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5))) | |
1482 { | |
1483 if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) | |
1484 pRenderer->_49FD3A(); | |
1485 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); | |
1486 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); | |
1487 v104 = 187; | |
1488 if ( uCurrentHouse_Animation != 167 ) | |
1489 v104 = EVT_DWORD(_evt->v5); | |
1490 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); | |
1491 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); | |
1492 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
1493 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
1494 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
1495 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); | |
1496 } | |
1497 ++curr_seq_num; | |
1498 v4 = v124; | |
1499 | |
1500 //v6 = v123; | |
1501 //v7 = ""; | |
1502 break; | |
1503 case EVENT_PressAnyKey: | |
1504 v121 = 33; | |
1505 v105 = curr_seq_num + 1; | |
1506 goto LABEL_295; | |
1507 case EVENT_Exit: | |
1508 if ( v133 == 1 ) | |
1509 OnMapLeave(); | |
1510 return; | |
1511 default: | |
1512 ++curr_seq_num; | |
1513 v4 = v124; | |
1514 | |
1515 //v6 = v123; | |
1516 //v7 = ""; | |
1517 break; | |
1518 } | |
1519 } | |
1520 ++v4; | |
1521 v124 = v4; | |
1522 if ( v4 >= uSomeEVT_NumEvents ) | |
1523 goto LABEL_301; | |
1524 //} | |
1525 } | |
1526 } | |
307 | 1527 |
1295 | 1528 //----- (00444732) -------------------------------------------------------- |
1529 char *GetEventHintString(unsigned int uEventID) | |
1530 { | |
1531 signed int event_index; // edx@1 | |
1532 int event_pos; // esi@4 | |
1533 char *result; // eax@6 | |
1534 unsigned int str_index; // eax@9 | |
1535 int i; // esi@11 | |
1536 _evt_raw* test_evt; | |
1537 _evt_raw* last_evt; | |
1538 | |
1539 event_index = 0; | |
1540 if ( uLevelEVT_NumEvents <= 0 ) | |
1541 return NULL; | |
1490 | 1542 |
1295 | 1543 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; |
1544 while ( 1 ) | |
1545 { | |
1546 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) | |
1547 { | |
1490 | 1548 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; |
1549 last_evt=test_evt; | |
1295 | 1550 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; |
1551 if ( test_evt->_e_type == EVENT_MouseOver ) | |
1552 break; | |
1553 } | |
1554 ++event_index; | |
1555 if ( event_index >= uLevelEVT_NumEvents ) | |
1556 return NULL; | |
1557 } | |
1490 | 1558 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; |
1295 | 1559 if ( test_evt->_e_type== EVENT_SpeakInHouse ) |
1560 { | |
1561 str_index = EVT_DWORD(test_evt->v5); | |
1562 result = (char *)p2DEvents[str_index - 1].pName; | |
1563 } | |
1564 else | |
1565 { | |
1566 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) | |
1567 { | |
1568 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
1490 | 1569 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; |
1295 | 1570 if ( test_evt->_e_type == EVENT_SpeakInHouse ) |
1571 { | |
1572 str_index = EVT_DWORD(test_evt->v5); | |
1573 if ( str_index < 600 ) | |
1574 return (char *)p2DEvents[str_index - 1].pName; | |
1575 } | |
1576 } | |
1577 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
1578 } | |
1490 | 1579 |
1295 | 1580 return result; |
1581 } |