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