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