Mercurial > mm7
annotate Events.cpp @ 827:085eb19b7ffd
mr.Malvik
author | Ritor1 |
---|---|
date | Wed, 27 Mar 2013 01:39:54 +0600 |
parents | 5f0029b4bf09 |
children | dfd683c4f538 72f6df90df98 |
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 | |
827 | 200 //int v29; // edx@58 |
201 int pEventID; // eax@58 | |
202 int pNPC_ID; // ecx@58 | |
203 int pIndex; // esi@58 | |
204 NPCData *pNPC; // ecx@58 | |
307 | 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 | |
336 | 341 v4 = 0; |
342 v124 = 0; | |
343 //for (uint i = 0; i < uSomeEVT_NumEvents; ++i) | |
344 // { | |
307 | 345 //v6 = v123; |
346 //v7 = ""; | |
336 | 347 while ( 1 ) |
348 { | |
307 | 349 if ( dword_5B65C4 ) |
350 goto LABEL_301; | |
351 //v8 = v4; | |
336 | 352 if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num ) |
307 | 353 { |
354 //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; | |
355 //v10 = (ByteArray *)&v5[v9]; | |
336 | 356 auto _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[v4].uEventOffsetInEVT); |
307 | 357 |
310 | 358 switch (_evt->_e_type) |
307 | 359 { |
360 case EVENT_CheckSeason: | |
336 | 361 // |
307 | 362 if ( !sub_4465DF_check_season(_evt->v5) ) |
363 { | |
310 | 364 ++curr_seq_num; |
336 | 365 v4 = v124; |
307 | 366 break; |
367 } | |
336 | 368 v124 = -1; |
369 curr_seq_num = _evt->v6 - 1; | |
370 ++curr_seq_num; | |
371 break; | |
307 | 372 case EVENT_ShowMovie: |
373 { | |
374 strcpy(Source, (char *)&_evt->v7); | |
375 v12 = (char *)&item.uExpireTime + strlen(Source) + 7; | |
376 if ( *v12 == 32 ) | |
377 *v12 = 0; | |
378 if ( pVideoPlayer->field_54 ) | |
379 pVideoPlayer->Unload(); | |
380 pVideoPlayer->bStopBeforeSchedule = 0; | |
381 pVideoPlayer->pResetflag = 0; | |
382 if (pAsyncMouse) | |
383 pAsyncMouse->Suspend(); | |
384 v128 = pCurrentScreen; | |
385 //v13 = &pSomeEVT[v9]; | |
386 //v14 = (unsigned __int8)v13[5]; | |
387 //v15 = (unsigned __int8)v13[6]; | |
388 v14 = _evt->v5; | |
389 v15 = _evt->v6; | |
390 strcpy(Str, Source); | |
391 v16 = RemoveQuotes(Str); | |
392 VideoPlayer::MovieLoop(v16, 0, v14, 1); | |
393 if ( !_strcmpi(v16, "arbiter good") ) | |
373 | 394 { |
395 pParty->alignment = PartyAlignment_Good; | |
307 | 396 v18 = 0; |
397 LOBYTE(v17) = 1; | |
373 | 398 SetUserInterface(PartyAlignment_Good, v17); |
307 | 399 if ( !v15 || v128 == 3 ) |
400 { | |
401 pCurrentScreen = v128; | |
402 if ( v128 == 3 ) | |
403 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
404 if ( v128 == 13 ) | |
484 | 405 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); |
307 | 406 } |
407 if (pAsyncMouse) | |
408 pAsyncMouse->Resume(); | |
310 | 409 ++curr_seq_num; |
336 | 410 v4 = v124; |
411 | |
307 | 412 //v6 = v123; |
413 //v7 = ""; | |
414 break; | |
415 } | |
416 if ( !_strcmpi(v16, "arbiter evil") ) | |
417 { | |
418 v18 = 2; | |
373 | 419 pParty->alignment = PartyAlignment_Evil; |
307 | 420 LOBYTE(v17) = 1; |
373 | 421 SetUserInterface(PartyAlignment_Evil, v17); |
307 | 422 if ( !v15 || v128 == 3 ) |
423 { | |
424 pCurrentScreen = v128; | |
425 if ( v128 == 3 ) | |
426 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
427 if ( v128 == 13 ) | |
484 | 428 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); |
307 | 429 } |
430 if (pAsyncMouse) | |
431 pAsyncMouse->Resume(); | |
310 | 432 ++curr_seq_num; |
336 | 433 v4 = v124; |
434 | |
307 | 435 //v6 = v123; |
436 //v7 = ""; | |
437 | |
438 break; | |
439 } | |
440 if ( !_strcmpi(v16, "pcout01") ) // moving to harmondale from emerald isle | |
766 | 441 { |
307 | 442 Rest(0x2760u); |
443 pParty->RestAndHeal(); | |
766 | 444 pParty->days_played_without_rest = 0; |
445 } | |
307 | 446 if ( !v15 || v128 == 3 ) |
447 { | |
448 pCurrentScreen = v128; | |
449 if ( v128 == 3 ) | |
450 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
451 if ( v128 == 13 ) | |
484 | 452 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); |
307 | 453 } |
454 if (pAsyncMouse) | |
455 pAsyncMouse->Resume(); | |
310 | 456 ++curr_seq_num; |
336 | 457 v4 = v124; |
458 | |
307 | 459 //v6 = v123; |
460 //v7 = ""; | |
461 } | |
462 break; | |
463 case EVENT_CheckSkill: | |
464 { | |
465 v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); | |
336 | 466 if ( player_choose < 0 ) |
307 | 467 goto LABEL_47; |
336 | 468 if ( player_choose <= 3 ) |
307 | 469 { |
336 | 470 v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5]; |
307 | 471 } |
472 else | |
473 { | |
336 | 474 if ( player_choose == 4 ) |
307 | 475 { |
476 v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; | |
477 } | |
478 else | |
479 { | |
336 | 480 if ( player_choose == 5 ) |
307 | 481 { |
482 v20 = 0; | |
483 v21 = 3486 * v130 + _evt->v5; | |
484 v136 = 1; | |
485 LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21]; | |
486 v137 = v21 & 0x40; | |
487 v138 = v21 & 0x80; | |
488 v22 = v21 & 0x100; | |
489 v23 = v21 & 0x3F; | |
490 v139 = v22; | |
491 while ( v23 < v19 || !*(&v136 + _evt->v6) ) | |
492 { | |
493 ++v20; | |
494 if ( v20 >= 4 ) | |
495 { | |
310 | 496 ++curr_seq_num; |
336 | 497 v4 = v124; |
498 | |
307 | 499 //v6 = v123; |
500 //v7 = ""; | |
501 break; | |
502 } | |
503 } | |
504 v11 = _evt->v11; | |
505 goto LABEL_130; | |
506 } | |
507 LABEL_47: | |
508 //v10 = (ByteArray *)&v5[v9]; | |
509 v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4]; | |
510 } | |
511 } | |
512 v136 = 1; | |
513 v137 = v24 & 0x40; | |
514 v138 = v24 & 0x80; | |
515 v139 = v24 & 0x100; | |
516 if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) | |
517 { | |
518 v11 = _evt->v11; | |
519 goto LABEL_130; | |
520 } | |
310 | 521 ++curr_seq_num; |
336 | 522 v4 = v124; |
523 | |
307 | 524 //v6 = v123; |
525 //v7 = ""; | |
526 } | |
527 break; | |
528 | |
529 case EVENT_SpeakNPC: | |
469 | 530 if ( canShowMessages ) |
307 | 531 { |
532 //Actor::Actor(&Dst); | |
533 memset(&Dst, 0, 0x344u); | |
469 | 534 dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); |
602 | 535 Dst.sNPC_ID = dword_5B65D0_dialogue_actor_npc_id; |
307 | 536 Dst.InitializeDialogue(0); |
537 } | |
538 else | |
539 { | |
469 | 540 bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); |
307 | 541 } |
310 | 542 ++curr_seq_num; |
336 | 543 v4 = v124; |
544 | |
307 | 545 //v6 = v123; |
546 //v7 = ""; | |
547 break; | |
548 case EVENT_ChangeEvent: | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
549 v25 = EVT_DWORD(_evt->v5); |
307 | 550 if ( v25 ) |
551 { | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
552 stru_5E4C90._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124; |
307 | 553 } |
554 else | |
555 { | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
556 v26 = (LevelDecoration *)activeLevelDecoration; |
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
557 stru_5E4C90._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0; |
525 | 558 v26->field_2 |= 0x0020; |
307 | 559 } |
310 | 560 ++curr_seq_num; |
336 | 561 v4 = v124; |
525 | 562 |
307 | 563 break; |
564 case EVENT_SetNPCGreeting: | |
525 | 565 v27 = EVT_DWORD(_evt->v5); |
307 | 566 pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; |
525 | 567 pNPCStats->pNewNPCData[v27].greet = EVT_DWORD(_evt->v9); |
310 | 568 ++curr_seq_num; |
336 | 569 v4 = v124; |
570 | |
307 | 571 //v6 = v123; |
572 //v7 = ""; | |
573 break; | |
827 | 574 case EVENT_SetNPCTopic: |
575 { | |
576 //v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
577 pEventID = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); | |
578 pNPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
579 pIndex = _evt->v9; | |
580 pNPC = &pNPCStats->pNewNPCData[pNPC_ID]; | |
581 if ( pIndex == 0 ) | |
582 pNPC->evt_A = pEventID; | |
583 if ( pIndex == 1 ) | |
584 pNPC->evt_B = pEventID; | |
585 if ( pIndex == 2 ) | |
586 pNPC->evt_C = pEventID; | |
587 if ( pIndex == 3 ) | |
588 pNPC->evt_D = pEventID; | |
589 if ( pIndex == 4 ) | |
590 pNPC->evt_E = pEventID; | |
591 if ( pIndex == 5 ) | |
592 pNPC->evt_F = pEventID; | |
593 if ( pNPC_ID == 8 ) | |
594 { | |
595 if ( pEventID == 78 ) | |
596 { | |
597 sub_4BD8B5(); | |
598 window_SpeakInHouse->Release(); | |
599 pParty->uFlags &= ~2; | |
600 if ( EnterHouse(HOUSE_DARK_GUILD_PIT) ) | |
601 { | |
602 pAudioPlayer->StopChannels(-1, -1); | |
603 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); | |
604 window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); | |
605 window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); | |
606 window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); | |
607 window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); | |
608 window_SpeakInHouse->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); | |
609 current_npc_text = pNPCTopics[90].pText; | |
610 } | |
611 } | |
612 } | |
613 ++curr_seq_num; | |
614 } | |
615 v4 = v124; | |
616 break; | |
307 | 617 case EVENT_NPCSetItem: |
525 | 618 sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); |
310 | 619 ++curr_seq_num; |
336 | 620 v4 = v124; |
525 | 621 |
307 | 622 break; |
623 case EVENT_SetActorItem: | |
525 | 624 Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); |
310 | 625 ++curr_seq_num; |
336 | 626 v4 = v124; |
307 | 627 break; |
628 case EVENT_SetNPCGroupNews: | |
629 pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); | |
310 | 630 ++curr_seq_num; |
336 | 631 v4 = v124; |
307 | 632 break; |
633 case EVENT_SetActorGroup: | |
634 __debugbreak(); | |
635 *(&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 | 636 ++curr_seq_num; |
336 | 637 v4 = v124; |
307 | 638 break; |
639 case EVENT_ChangeGroup: | |
640 v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
641 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
642 v40 = uNumActors; | |
643 __debugbreak(); | |
644 if ( (signed int)uNumActors > 0 ) | |
645 { | |
646 v41 = pActors;//[0].uGroup; | |
647 do | |
648 { | |
649 if ( v41->uGroup == v38 ) | |
650 v41->uGroup = v39; | |
651 ++v41; | |
652 --v40; | |
653 } | |
654 while ( v40 ); | |
655 } | |
310 | 656 ++curr_seq_num; |
336 | 657 v4 = v124; |
658 | |
307 | 659 //v6 = v123; |
660 //v7 = ""; | |
661 break; | |
662 case EVENT_ChangeGroupAlly: | |
663 v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
664 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
665 v44 = uNumActors; | |
666 __debugbreak(); | |
667 if ( (signed int)uNumActors > 0 ) | |
668 { | |
669 v45 = pActors;//[0].uAlly; | |
670 do | |
671 { | |
672 if ( v45->uGroup == v42 ) | |
673 v45->uAlly = v43; | |
674 ++v45; | |
675 --v44; | |
676 } | |
677 while ( v44 ); | |
678 } | |
310 | 679 ++curr_seq_num; |
336 | 680 v4 = v124; |
681 | |
307 | 682 //v6 = v123; |
683 //v7 = ""; | |
684 break; | |
685 case EVENT_MoveNPC: | |
310 | 686 { |
687 | |
525 | 688 pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9); |
336 | 689 if ( window_SpeakInHouse ) |
307 | 690 { |
525 | 691 |
692 if ( window_SpeakInHouse->par1C == 165 ) | |
307 | 693 { |
694 sub_4BD8B5(); | |
695 pVideoPlayer->Unload(); | |
336 | 696 window_SpeakInHouse->Release(); |
569 | 697 pParty->uFlags &= ~2; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
698 activeLevelDecoration = (LevelDecoration*)1; |
481 | 699 if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) |
307 | 700 { |
701 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); | |
525 | 702 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); |
703 v48 = window_SpeakInHouse->pControlsHead; | |
307 | 704 if ( v48 ) |
705 { | |
706 do | |
707 { | |
708 v49 = v48->pNext; | |
709 pAllocator->FreeChunk(v48); | |
710 v48 = v49; | |
711 } | |
712 while ( v49 ); | |
713 } | |
525 | 714 window_SpeakInHouse->pControlsHead = 0; |
336 | 715 window_SpeakInHouse->pControlsTail = 0; |
716 window_SpeakInHouse->uNumControls = 0; | |
307 | 717 } |
718 } | |
719 else | |
720 { | |
525 | 721 if ( window_SpeakInHouse->par1C == 553 ) |
307 | 722 pVideoPlayer->bLoopPlaying = 0; |
723 } | |
724 } | |
525 | 725 |
310 | 726 } |
525 | 727 ++curr_seq_num; |
336 | 728 v4 = v124; |
525 | 729 |
307 | 730 break; |
731 case EVENT_Jmp: | |
310 | 732 curr_seq_num = _evt->v5 - 1; |
733 ++curr_seq_num; | |
525 | 734 v4 = -1; |
735 | |
307 | 736 break; |
737 case EVENT_ShowFace: | |
336 | 738 if ( _evt->v5 <= 3u ) //someone |
739 pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
740 else if ( _evt->v5 == 4 ) //active | |
741 pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
742 else if ( _evt->v5 == 5 ) //all players | |
307 | 743 { |
336 | 744 for(int i=0; i<4; ++i) |
745 pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
307 | 746 } |
336 | 747 else //random player |
748 pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
310 | 749 ++curr_seq_num; |
336 | 750 v4 = v124; |
525 | 751 |
307 | 752 break; |
753 case EVENT_CharacterAnimation: | |
336 | 754 if ( _evt->v5 <= 3u ) //someone |
755 pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0); | |
756 else if ( _evt->v5 == 4 ) //active | |
757 pParty->pPlayers[uActiveCharacter].PlaySound((PlayerSpeech) _evt->v6, 0); | |
758 else if ( _evt->v5 == 5 ) //all | |
759 for(int i=0; i<4; ++i) | |
760 pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0); | |
761 else //random | |
762 pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0); | |
763 ++curr_seq_num; | |
525 | 764 v4 = v124; |
765 | |
307 | 766 break; |
767 case EVENT_ForPartyMember: | |
336 | 768 player_choose = _evt->v5; |
310 | 769 ++curr_seq_num; |
336 | 770 v4 = v124; |
307 | 771 break; |
772 case EVENT_SummonItem: | |
773 sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), | |
774 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), | |
775 _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), | |
776 _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), | |
777 _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), | |
778 _evt->v25, _evt->v26, 0, 0); | |
310 | 779 ++curr_seq_num; |
336 | 780 v4 = v124; |
781 | |
307 | 782 //v6 = v123; |
783 //v7 = ""; | |
784 break; | |
501 | 785 case EVENT_Compare: |
484 | 786 pValue = EVT_DWORD(_evt->v7); |
787 if ( player_choose <= 3 ) | |
512 | 788 { |
484 | 789 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) |
512 | 790 { |
484 | 791 v124 = -1; |
792 curr_seq_num = _evt->v11 - 1; | |
307 | 793 } |
512 | 794 } |
484 | 795 else if ( player_choose == 4 ) //active |
512 | 796 { |
797 if ( uActiveCharacter ) | |
307 | 798 { |
512 | 799 if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) |
307 | 800 { |
484 | 801 v124 = -1; |
802 curr_seq_num = _evt->v11 - 1; | |
307 | 803 } |
804 } | |
512 | 805 } |
484 | 806 else if ( player_choose == 5 )//all |
512 | 807 { |
484 | 808 v130=0; |
616 | 809 for(int i = 1; i < 5; ++i) |
512 | 810 { |
811 if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
484 | 812 { |
813 v124 = -1; | |
814 curr_seq_num = _evt->v11 - 1; | |
815 break; | |
512 | 816 } |
484 | 817 ++v130; |
307 | 818 } |
512 | 819 } |
484 | 820 else if ( player_choose == 6 ) //random |
512 | 821 { |
484 | 822 if ( pPlayers[rand() % 4]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) |
512 | 823 { |
484 | 824 v124 = -1; |
825 curr_seq_num = _evt->v11 - 1; | |
826 } | |
512 | 827 } |
310 | 828 ++curr_seq_num; |
336 | 829 v4 = v124; |
307 | 830 break; |
831 case EVENT_IsActorAlive: | |
484 | 832 if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) |
833 { | |
834 v124 = -1; | |
835 curr_seq_num = _evt->v11 - 1; | |
836 } | |
837 ++curr_seq_num; | |
838 v4 = v124; | |
839 break; | |
307 | 840 case EVENT_Substract: |
501 | 841 pValue = EVT_DWORD(_evt->v7); |
842 if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands ) | |
843 { | |
545 | 844 if ( pParty->pPickedItem.uItemID == pValue )//In hand |
307 | 845 { |
846 pMouse->RemoveHoldingItem(); | |
310 | 847 ++curr_seq_num; |
336 | 848 v4 = v124; |
307 | 849 break; |
501 | 850 } |
545 | 851 v67 = (int)pPlayers[uActiveCharacter]->pInventoryIndices; |
852 for ( v65 = 0; v65 < 126; ++v65 ) | |
501 | 853 { |
545 | 854 if ( (int)&pPlayers[uActiveCharacter]->pInventoryItems[v67] == pValue ) |
307 | 855 { |
545 | 856 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65); |
310 | 857 ++curr_seq_num; |
336 | 858 v4 = v124; |
307 | 859 break; |
501 | 860 } |
307 | 861 v67 += 4; |
501 | 862 } |
863 while ( (signed int)v65 < 126 ); | |
545 | 864 v69 = (int)&pPlayers[uActiveCharacter]->pEquipment; |
865 for ( v68 = 0; v68 < 16; ++v68 ) | |
866 { | |
867 if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItems[v69] == pValue ) | |
501 | 868 { |
545 | 869 *(&pPlayers[uActiveCharacter]->pEquipment.uOffHand + v68) = 0; |
870 ++curr_seq_num; | |
871 v4 = v124; | |
872 break; | |
873 } | |
874 v69 += 4; | |
875 } | |
876 for (int i = 1; i < 5; i++) | |
877 { | |
878 v72 = (int)pPlayers[i]->pInventoryIndices; | |
879 for ( int v71 = 0; v71 < 126; ++v71 ) | |
880 { | |
881 if ( (int)&pPlayers[i]->pInventoryItems[v72] == pValue ) | |
307 | 882 { |
545 | 883 pPlayers[i]->RemoveItemAtInventoryIndex(v71); |
307 | 884 break; |
501 | 885 } |
545 | 886 v72 += 4; |
501 | 887 } |
545 | 888 v73 = 0; |
889 v74 = (int)&pPlayers[i]->pEquipment; | |
890 while ( !*(int *)v74 || (int)&pPlayer->pInventoryItems[v74] != pValue ) | |
891 { | |
892 ++v73; | |
893 v74 += 4; | |
894 if ( v73 >= 16 ) | |
895 break; | |
896 } | |
897 *(&pPlayers[i]->pEquipment.uOffHand + v73) = 0; | |
307 | 898 } |
545 | 899 } |
501 | 900 if ( player_choose <= 3 ) |
901 { | |
512 | 902 pPlayer = &pParty->pPlayers[player_choose]; |
501 | 903 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
904 } | |
905 else if ( player_choose == 4 ) //active | |
906 { | |
907 if ( uActiveCharacter ) | |
307 | 908 { |
501 | 909 pPlayer = pPlayers[uActiveCharacter]; |
910 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
911 } | |
912 } | |
913 else if ( player_choose == 5 )//all | |
914 { | |
512 | 915 v130 = 0; |
614 | 916 for(int i = 1; i < 5; ++i) |
501 | 917 { |
918 if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
919 break; | |
920 } | |
921 ++v130; | |
922 } | |
923 else if ( player_choose == 6 ) //random | |
924 { | |
512 | 925 player_choose = rand() % 4; |
926 pPlayer = &pParty->pPlayers[player_choose]; | |
501 | 927 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
928 } | |
545 | 929 ++curr_seq_num; |
930 v4 = v124; | |
931 break; | |
512 | 932 case EVENT_Set: |
933 pValue = EVT_DWORD(_evt->v7); | |
934 if ( player_choose <= 3 ) | |
501 | 935 { |
512 | 936 pPlayer = &pParty->pPlayers[player_choose]; |
937 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
501 | 938 } |
512 | 939 else if ( player_choose == 4 ) //active |
501 | 940 { |
512 | 941 if ( uActiveCharacter ) |
307 | 942 { |
512 | 943 pPlayer = pPlayers[uActiveCharacter]; |
944 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
307 | 945 } |
501 | 946 } |
512 | 947 else if ( player_choose == 5 )//all |
948 { | |
525 | 949 //recheck v130 |
512 | 950 for(int i = 1; i < 5; ++i) |
951 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
525 | 952 |
512 | 953 } |
954 else if ( player_choose == 6 ) //random | |
955 { | |
956 player_choose = rand() % 4; | |
957 pPlayer = &pParty->pPlayers[player_choose]; | |
958 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
525 | 959 |
512 | 960 } |
525 | 961 ++curr_seq_num; |
962 v4 = v124; | |
963 break; | |
307 | 964 case EVENT_Add: |
501 | 965 pValue = EVT_DWORD(_evt->v7); |
512 | 966 if ( player_choose <= 3 ) |
967 { | |
968 pPlayer = &pParty->pPlayers[player_choose]; | |
969 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
970 } | |
971 else if ( player_choose == 4 ) //active | |
972 { | |
973 if ( uActiveCharacter ) | |
974 { | |
975 pPlayer = pPlayers[uActiveCharacter]; | |
976 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
977 } | |
978 } | |
979 else if ( player_choose == 5 )//all | |
980 { | |
981 //v130 = 0; | |
982 for(int i = 1; i < 5; ++i) | |
983 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
525 | 984 |
512 | 985 } |
986 else if ( player_choose == 6 ) //random | |
987 { | |
988 player_choose = rand() % 4; | |
989 pPlayer = &pParty->pPlayers[player_choose]; | |
990 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
991 } | |
525 | 992 v83 = EVT_WORD(_evt->v5); |
993 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) | |
994 viewparams->bRedrawGameUI = 1; | |
995 ++curr_seq_num; | |
996 v4 = v124; | |
997 break; | |
307 | 998 case EVENT_InputString: |
336 | 999 if ( !start_event_seq_number ) |
307 | 1000 { |
783 | 1001 strcpy(GameUI_Footer_TimedString, &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]); |
310 | 1002 v105 = curr_seq_num; |
307 | 1003 v121 = 26; |
1004 LABEL_295: | |
1005 sub_4451A8_press_any_key(uEventID, v105, v121); | |
1006 LABEL_301: | |
1007 if ( v133 == 1 ) | |
797 | 1008 OnMapLeave(); |
307 | 1009 return; |
1010 } | |
1011 v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
783 | 1012 if ( !_strcmpi(GameUI_Footer_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) |
1013 || !_strcmpi(GameUI_Footer_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) ) | |
307 | 1014 { |
1015 v11 = _evt->v17; | |
1016 LABEL_130: | |
1017 //v124 = -1; | |
1018 LABEL_131: | |
310 | 1019 curr_seq_num = v11 - 1; |
307 | 1020 } |
310 | 1021 ++curr_seq_num; |
336 | 1022 v4 = v124; |
1023 | |
307 | 1024 //v6 = v123; |
1025 //v7 = ""; | |
1026 break; | |
1027 case EVENT_RandomGoTo: | |
1028 //v124 = -1; | |
1029 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) | |
1030 + (_evt->v10 != 0))); | |
525 | 1031 curr_seq_num = v11 - 1; |
787 | 1032 ++curr_seq_num; |
1033 v4 = v124; | |
1034 break; | |
307 | 1035 case EVENT_ReceiveDamage: |
525 | 1036 v85 = EVT_DWORD(_evt->v7 ); |
307 | 1037 v86 = _evt->v5; |
797 | 1038 if ( (unsigned __int8)v86 <= 3 ) |
307 | 1039 { |
1040 v119 = _evt->v6; | |
525 | 1041 v115 = EVT_DWORD(_evt->v7 ); |
307 | 1042 v89 = (unsigned __int8)v86; |
797 | 1043 v88 = &pParty->pPlayers[v89]; |
1044 v88->ReceiveDamage(v115, v119); | |
1045 ++curr_seq_num; | |
1046 v4 = v124; | |
1047 break; | |
307 | 1048 } |
1049 if ( v86 == 4 ) | |
1050 { | |
1051 if ( !uActiveCharacter ) | |
1052 { | |
310 | 1053 ++curr_seq_num; |
336 | 1054 v4 = v124; |
1055 | |
307 | 1056 //v6 = v123; |
1057 //v7 = ""; | |
1058 break; | |
1059 } | |
1060 v119 = _evt->v6; | |
1061 v88 = pPlayers[uActiveCharacter]; | |
525 | 1062 v115 = EVT_DWORD(_evt->v7 ); |
797 | 1063 v88->ReceiveDamage(v115, v119); |
1064 ++curr_seq_num; | |
1065 v4 = v124; | |
1066 break; | |
307 | 1067 } |
1068 if ( v86 != 5 ) | |
1069 { | |
1070 v119 = _evt->v6; | |
525 | 1071 v115 = EVT_DWORD(_evt->v7 ); |
307 | 1072 v89 = rand() % 4; |
1073 v88 = &pParty->pPlayers[v89]; | |
1074 v88->ReceiveDamage(v115, v119); | |
310 | 1075 ++curr_seq_num; |
336 | 1076 v4 = v124; |
1077 | |
307 | 1078 //v6 = v123; |
1079 //v7 = ""; | |
1080 break; | |
1081 } | |
1082 v87 = pParty->pPlayers; | |
1083 do | |
1084 { | |
1085 v87->ReceiveDamage(v85, _evt->v6); | |
1086 ++v87; | |
1087 } | |
1088 while ( (signed int)v87 < (signed int)pParty->pHirelings ); | |
310 | 1089 ++curr_seq_num; |
336 | 1090 v4 = v124; |
1091 | |
307 | 1092 //v6 = v123; |
1093 //v7 = ""; | |
1094 break; | |
1095 case EVENT_ToggleIndoorLight: | |
525 | 1096 pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9); |
310 | 1097 ++curr_seq_num; |
336 | 1098 v4 = v124; |
1099 | |
307 | 1100 //v6 = v123; |
1101 //v7 = ""; | |
1102 break; | |
1103 case EVENT_SetFacesBit: | |
525 | 1104 sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); |
310 | 1105 ++curr_seq_num; |
336 | 1106 v4 = v124; |
1107 | |
307 | 1108 //v6 = v123; |
1109 //v7 = ""; | |
1110 break; | |
1111 case EVENT_ToggleChestFlag: | |
525 | 1112 Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); |
310 | 1113 ++curr_seq_num; |
336 | 1114 v4 = v124; |
1115 | |
307 | 1116 //v6 = v123; |
1117 //v7 = ""; | |
1118 break; | |
1119 case EVENT_ToggleActorFlag: | |
525 | 1120 Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); |
310 | 1121 ++curr_seq_num; |
336 | 1122 v4 = v124; |
1123 | |
307 | 1124 //v6 = v123; |
1125 //v7 = ""; | |
1126 break; | |
1127 case EVENT_ToggleActorGroupFlag: | |
525 | 1128 ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); |
310 | 1129 ++curr_seq_num; |
336 | 1130 v4 = v124; |
1131 | |
307 | 1132 //v6 = v123; |
1133 //v7 = ""; | |
1134 break; | |
1135 case EVENT_SetSnow: | |
1136 if ( !_evt->v5 ) | |
1137 pWeather->bRenderSnow = _evt->v6 != 0; | |
310 | 1138 ++curr_seq_num; |
336 | 1139 v4 = v124; |
1140 | |
307 | 1141 //v6 = v123; |
1142 //v7 = ""; | |
1143 break; | |
1144 case EVENT_StatusText: | |
525 | 1145 v90 = EVT_DWORD(_evt->v5 ); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
1146 if ( activeLevelDecoration ) |
307 | 1147 { |
525 | 1148 if ( activeLevelDecoration == (LevelDecoration*)1 ) |
307 | 1149 { |
827 | 1150 current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; |
307 | 1151 } |
469 | 1152 if ( canShowMessages == 1 ) |
307 | 1153 { |
1154 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; | |
1155 //LABEL_248: | |
1156 ShowStatusBarString(v91, 2u); | |
1157 } | |
1158 } | |
1159 else | |
1160 { | |
469 | 1161 if ( canShowMessages == 1 ) |
307 | 1162 { |
1163 v91 = &pLevelStr[pLevelStrOffsets[v90]]; | |
1164 ShowStatusBarString(v91, 2u); | |
1165 } | |
1166 } | |
310 | 1167 ++curr_seq_num; |
336 | 1168 v4 = v124; |
1169 | |
307 | 1170 //v6 = v123; |
1171 //v7 = ""; | |
1172 break; | |
1173 case EVENT_ShowMessage: | |
525 | 1174 v92 = EVT_DWORD(_evt->v5 ); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
1175 if ( activeLevelDecoration ) |
307 | 1176 { |
1177 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; | |
1178 byte_5B0938[0] = 0; | |
827 | 1179 current_npc_text = v93; |
307 | 1180 } |
1181 else | |
1182 { | |
1183 strcpy(byte_5B0938, &pLevelStr[pLevelStrOffsets[v92]]); | |
1184 } | |
310 | 1185 ++curr_seq_num; |
336 | 1186 v4 = v124; |
1187 | |
307 | 1188 //v6 = v123; |
1189 //v7 = ""; | |
1190 break; | |
1191 case EVENT_CastSpell: | |
525 | 1192 sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ), |
1193 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), | |
1194 EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 )); | |
310 | 1195 ++curr_seq_num; |
336 | 1196 v4 = v124; |
525 | 1197 |
307 | 1198 break; |
1199 case EVENT_SetTexture: | |
525 | 1200 sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9); |
310 | 1201 ++curr_seq_num; |
336 | 1202 v4 = v124; |
1203 | |
307 | 1204 //v6 = v123; |
1205 //v7 = ""; | |
1206 break; | |
1207 case EVENT_SetSprite: | |
525 | 1208 SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10); |
310 | 1209 ++curr_seq_num; |
336 | 1210 v4 = v124; |
1211 | |
307 | 1212 //v6 = v123; |
1213 //v7 = ""; | |
1214 break; | |
1215 case EVENT_SummonMonsters: | |
525 | 1216 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ), |
1217 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), | |
1218 EVT_DWORD(_evt->v24 )); | |
310 | 1219 ++curr_seq_num; |
336 | 1220 v4 = v124; |
1221 | |
307 | 1222 //v6 = v123; |
1223 //v7 = ""; | |
1224 break; | |
1225 case EVENT_MouseOver: | |
1226 case EVENT_LocationName: | |
310 | 1227 --curr_seq_num; |
1228 ++curr_seq_num; | |
336 | 1229 v4 = v124; |
1230 | |
307 | 1231 //v6 = v123; |
1232 //v7 = ""; | |
1233 break; | |
1234 case EVENT_ChangeDoorState: | |
1235 sub_449A49_door_switch_animation(_evt->v5, _evt->v6); | |
310 | 1236 ++curr_seq_num; |
336 | 1237 v4 = v124; |
1238 | |
307 | 1239 //v6 = v123; |
1240 //v7 = ""; | |
1241 break; | |
1242 case EVENT_OpenChest: | |
1243 if ( !Chest::Open(_evt->v5) ) | |
1244 goto LABEL_301; | |
310 | 1245 ++curr_seq_num; |
336 | 1246 v4 = v124; |
1247 | |
307 | 1248 //v6 = v123; |
1249 //v7 = ""; | |
1250 break; | |
1251 case EVENT_MoveToMap: | |
1252 v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1253 v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1254 v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1255 v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1256 v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8); | |
1257 v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8); | |
1258 v96 = _evt->v25; | |
1259 v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); | |
1260 v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); | |
1261 if ( _evt->v29 || _evt->v30 ) | |
1262 { | |
1263 if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) | |
1264 pRenderer->_49FD3A(); | |
1265 sub_444839_move_map(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); | |
1266 dword_5C3418 = uEventID; | |
310 | 1267 dword_5C341C = curr_seq_num + 1; |
307 | 1268 goto LABEL_301; |
1269 } | |
1270 _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1271 _5B65A8_npcdata_uflags_or_other = v94; | |
1272 _5B65B0_npcdata_rep_or_other = v126; | |
1273 if ( v129 == -1 ) | |
1274 { | |
1275 v98 = _5B65B4_npcdata_loword_house_or_other; | |
1276 } | |
1277 else | |
1278 { | |
1279 v98 = v129 & stru_5C6E00->uDoublePiMask; | |
1280 _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask; | |
1281 } | |
1282 v99 = (char *)&_evt->v31; | |
1283 _5B65B8_npcdata_hiword_house_or_other = v95; | |
1284 dword_5B65BC = v97; | |
1285 v100 = v94 | v132 | v126 | v95 | v97 | v98; | |
1286 dword_5B65C0 = v100; | |
1287 if ( *v99 == 48 ) | |
1288 { | |
1289 if ( v100 ) | |
1290 { | |
1291 pParty->vPosition.x = v135; | |
1292 pParty->vPosition.y = v132; | |
1293 pParty->vPosition.z = v126; | |
1294 pParty->uFallStartY = v126; | |
1295 if ( _5B65B4_npcdata_loword_house_or_other != -1 ) | |
1296 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; | |
1297 _5B65B4_npcdata_loword_house_or_other = -1; | |
1298 v120 = 0; | |
1299 v116 = 0; | |
1300 v111 = 0; | |
1301 v110 = 0; | |
1302 v109 = -1; | |
1303 v108 = 0; | |
1304 v107 = 0; | |
1305 pParty->sRotationX = v95; | |
1306 pParty->uFallSpeed = v134; | |
1307 dword_5B65C0 = 0; | |
1308 dword_5B65BC = 0; | |
1309 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1310 _5B65B0_npcdata_rep_or_other = 0; | |
1311 _5B65AC_npcdata_fame_or_other = 0; | |
1312 _5B65A8_npcdata_uflags_or_other = 0; | |
1313 v106 = 232; | |
1314 LABEL_280: | |
1315 pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); | |
1316 } | |
1317 } | |
1318 else | |
1319 { | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
1320 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((activeLevelDecoration == NULL) + 1); |
783 | 1321 sub_44987B(v99, MapStartPoint_Party); |
307 | 1322 v133 = 1; |
1323 if ( pCurrentScreen == SCREEN_HOUSE ) | |
1324 { | |
1325 if ( uGameState == 2 ) | |
1326 { | |
1327 pAudioPlayer->StopChannels(-1, -1); | |
747 | 1328 dialog_menu_id = HOUSE_DIALOGUE_NULL; |
307 | 1329 while ( sub_4BD8B5() ) |
1330 ; | |
1331 pVideoPlayer->Unload(); | |
336 | 1332 window_SpeakInHouse->Release(); |
1333 window_SpeakInHouse = 0; | |
307 | 1334 if ( pMessageQueue_50CBD0->uNumMessages ) |
1335 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1336 pCurrentScreen = SCREEN_GAME; | |
1337 viewparams->bRedrawGameUI = 1; | |
457 | 1338 pDialogueNPCCount = 0; |
307 | 1339 pDialogueWindow->Release(); |
747 | 1340 dialog_menu_id = HOUSE_DIALOGUE_NULL; |
307 | 1341 pDialogueWindow = 0; |
1342 pIcons_LOD->_40F9C5(); | |
1343 } | |
797 | 1344 OnMapLeave(); |
1345 return; | |
307 | 1346 } |
1347 } | |
310 | 1348 ++curr_seq_num; |
336 | 1349 v4 = v124; |
1350 | |
307 | 1351 //v6 = v123; |
1352 //v7 = ""; | |
1353 break; | |
1354 case EVENT_PlaySound: | |
1355 v120 = 0; | |
1356 v116 = 0; | |
1357 v111 = 0; | |
1358 v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1359 v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1360 v108 = 0; | |
1361 v107 = 0; | |
1362 v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1363 goto LABEL_280; | |
1364 case EVENT_GiveItem: | |
1365 item.Reset(); | |
1366 //v101 = &pSomeEVT[v9]; | |
1367 v102 = _evt->v7 | |
1368 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); | |
1369 pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); | |
1370 if ( v102 ) | |
1371 item.uItemID = v102; | |
1372 pParty->SetHoldingItem(&item); | |
310 | 1373 ++curr_seq_num; |
336 | 1374 v4 = v124; |
307 | 1375 //v6 = v123; |
1376 //v7 = ""; | |
1377 break; | |
336 | 1378 case EVENT_SpeakInHouse: |
496 | 1379 if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5))) |
307 | 1380 { |
1381 if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) | |
1382 pRenderer->_49FD3A(); | |
1383 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); | |
1384 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); | |
1385 v104 = 187; | |
1386 if ( uCurrentHouse_Animation != 167 ) | |
525 | 1387 v104 = EVT_DWORD(_evt->v5); |
336 | 1388 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); |
496 | 1389 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, 0x6Eu, 1, 49, "", 0); |
1390 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, 0x6Eu, 2, 50, "", 0); | |
1391 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, 0x6Eu, 3, 51, "", 0); | |
1392 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, 0x6Eu, 4, 52, "", 0); | |
525 | 1393 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); |
307 | 1394 } |
310 | 1395 ++curr_seq_num; |
336 | 1396 v4 = v124; |
1397 | |
307 | 1398 //v6 = v123; |
1399 //v7 = ""; | |
1400 break; | |
1401 case EVENT_PressAnyKey: | |
1402 v121 = 33; | |
310 | 1403 v105 = curr_seq_num + 1; |
307 | 1404 goto LABEL_295; |
1405 case EVENT_Exit: | |
484 | 1406 if ( v133 == 1 ) |
1407 OnMapLeave(); | |
1408 return; | |
307 | 1409 default: |
310 | 1410 ++curr_seq_num; |
336 | 1411 v4 = v124; |
1412 | |
307 | 1413 //v6 = v123; |
1414 //v7 = ""; | |
1415 break; | |
1416 } | |
1417 } | |
336 | 1418 ++v4; |
1419 v124 = v4; | |
1420 if ( v4 >= uSomeEVT_NumEvents ) | |
1421 goto LABEL_301; | |
307 | 1422 //} |
1423 } | |
1424 } | |
1425 |