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