Mercurial > mm7
annotate Events.cpp @ 801:5f0029b4bf09
m
author | Ritor1 |
---|---|
date | Mon, 25 Mar 2013 14:29:01 +0600 |
parents | 977407dfa4c5 |
children | 085eb19b7ffd |
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 | |
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; | |
574 case EVENT_SetNPCTopic: | |
310 | 575 { |
576 | |
307 | 577 v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); |
578 v30 = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); | |
579 v31 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
580 v32 = _evt->v9; | |
581 v33 = &pNPCStats->pNewNPCData[v31]; | |
582 if ( v32 ) | |
583 { | |
584 v34 = v32 - 1; | |
585 if ( v34 ) | |
586 { | |
587 v35 = v34 - 1; | |
588 if ( v35 ) | |
589 { | |
590 v36 = v35 - 1; | |
591 if ( v36 ) | |
592 { | |
593 v37 = v36 - 1; | |
594 if ( v37 ) | |
595 { | |
596 if ( v37 == 1 ) | |
597 v33->evt_F = v30; | |
598 } | |
599 else | |
600 { | |
601 v33->evt_E = v30; | |
602 } | |
603 } | |
604 else | |
605 { | |
606 v33->evt_D = v30; | |
607 } | |
608 } | |
609 else | |
610 { | |
611 v33->evt_C = v30; | |
612 } | |
613 } | |
614 else | |
615 { | |
616 v33->evt_B = v30; | |
617 } | |
618 } | |
619 else | |
620 { | |
621 v33->evt_A = v30; | |
622 } | |
623 if ( v29 == 8 ) | |
624 { | |
625 if ( v30 == 78 ) | |
626 { | |
627 sub_4BD8B5(); | |
336 | 628 window_SpeakInHouse->Release(); |
569 | 629 pParty->uFlags &= ~2; |
481 | 630 if ( EnterHouse(HOUSE_DARK_GUILD_PIT) ) |
307 | 631 { |
632 pAudioPlayer->StopChannels(-1, -1); | |
336 | 633 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); |
634 window_SpeakInHouse->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); | |
635 window_SpeakInHouse->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); | |
636 window_SpeakInHouse->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); | |
637 window_SpeakInHouse->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); | |
638 window_SpeakInHouse->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); | |
307 | 639 ptr_F8B1E8 = pNPCTopics[90].pText; |
640 } | |
641 } | |
642 } | |
310 | 643 ++curr_seq_num; |
644 } | |
336 | 645 v4 = v124; |
646 | |
307 | 647 //v6 = v123; |
648 //v7 = ""; | |
649 break; | |
650 case EVENT_NPCSetItem: | |
525 | 651 sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); |
310 | 652 ++curr_seq_num; |
336 | 653 v4 = v124; |
525 | 654 |
307 | 655 break; |
656 case EVENT_SetActorItem: | |
525 | 657 Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); |
310 | 658 ++curr_seq_num; |
336 | 659 v4 = v124; |
307 | 660 break; |
661 case EVENT_SetNPCGroupNews: | |
662 pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); | |
310 | 663 ++curr_seq_num; |
336 | 664 v4 = v124; |
307 | 665 break; |
666 case EVENT_SetActorGroup: | |
667 __debugbreak(); | |
668 *(&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 | 669 ++curr_seq_num; |
336 | 670 v4 = v124; |
307 | 671 break; |
672 case EVENT_ChangeGroup: | |
673 v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
674 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
675 v40 = uNumActors; | |
676 __debugbreak(); | |
677 if ( (signed int)uNumActors > 0 ) | |
678 { | |
679 v41 = pActors;//[0].uGroup; | |
680 do | |
681 { | |
682 if ( v41->uGroup == v38 ) | |
683 v41->uGroup = v39; | |
684 ++v41; | |
685 --v40; | |
686 } | |
687 while ( v40 ); | |
688 } | |
310 | 689 ++curr_seq_num; |
336 | 690 v4 = v124; |
691 | |
307 | 692 //v6 = v123; |
693 //v7 = ""; | |
694 break; | |
695 case EVENT_ChangeGroupAlly: | |
696 v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
697 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
698 v44 = uNumActors; | |
699 __debugbreak(); | |
700 if ( (signed int)uNumActors > 0 ) | |
701 { | |
702 v45 = pActors;//[0].uAlly; | |
703 do | |
704 { | |
705 if ( v45->uGroup == v42 ) | |
706 v45->uAlly = v43; | |
707 ++v45; | |
708 --v44; | |
709 } | |
710 while ( v44 ); | |
711 } | |
310 | 712 ++curr_seq_num; |
336 | 713 v4 = v124; |
714 | |
307 | 715 //v6 = v123; |
716 //v7 = ""; | |
717 break; | |
718 case EVENT_MoveNPC: | |
310 | 719 { |
720 | |
525 | 721 pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9); |
336 | 722 if ( window_SpeakInHouse ) |
307 | 723 { |
525 | 724 |
725 if ( window_SpeakInHouse->par1C == 165 ) | |
307 | 726 { |
727 sub_4BD8B5(); | |
728 pVideoPlayer->Unload(); | |
336 | 729 window_SpeakInHouse->Release(); |
569 | 730 pParty->uFlags &= ~2; |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
731 activeLevelDecoration = (LevelDecoration*)1; |
481 | 732 if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) |
307 | 733 { |
734 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); | |
525 | 735 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); |
736 v48 = window_SpeakInHouse->pControlsHead; | |
307 | 737 if ( v48 ) |
738 { | |
739 do | |
740 { | |
741 v49 = v48->pNext; | |
742 pAllocator->FreeChunk(v48); | |
743 v48 = v49; | |
744 } | |
745 while ( v49 ); | |
746 } | |
525 | 747 window_SpeakInHouse->pControlsHead = 0; |
336 | 748 window_SpeakInHouse->pControlsTail = 0; |
749 window_SpeakInHouse->uNumControls = 0; | |
307 | 750 } |
751 } | |
752 else | |
753 { | |
525 | 754 if ( window_SpeakInHouse->par1C == 553 ) |
307 | 755 pVideoPlayer->bLoopPlaying = 0; |
756 } | |
757 } | |
525 | 758 |
310 | 759 } |
525 | 760 ++curr_seq_num; |
336 | 761 v4 = v124; |
525 | 762 |
307 | 763 break; |
764 case EVENT_Jmp: | |
310 | 765 curr_seq_num = _evt->v5 - 1; |
766 ++curr_seq_num; | |
525 | 767 v4 = -1; |
768 | |
307 | 769 break; |
770 case EVENT_ShowFace: | |
336 | 771 if ( _evt->v5 <= 3u ) //someone |
772 pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
773 else if ( _evt->v5 == 4 ) //active | |
774 pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
775 else if ( _evt->v5 == 5 ) //all players | |
307 | 776 { |
336 | 777 for(int i=0; i<4; ++i) |
778 pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
307 | 779 } |
336 | 780 else //random player |
781 pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
310 | 782 ++curr_seq_num; |
336 | 783 v4 = v124; |
525 | 784 |
307 | 785 break; |
786 case EVENT_CharacterAnimation: | |
336 | 787 if ( _evt->v5 <= 3u ) //someone |
788 pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0); | |
789 else if ( _evt->v5 == 4 ) //active | |
790 pParty->pPlayers[uActiveCharacter].PlaySound((PlayerSpeech) _evt->v6, 0); | |
791 else if ( _evt->v5 == 5 ) //all | |
792 for(int i=0; i<4; ++i) | |
793 pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0); | |
794 else //random | |
795 pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0); | |
796 ++curr_seq_num; | |
525 | 797 v4 = v124; |
798 | |
307 | 799 break; |
800 case EVENT_ForPartyMember: | |
336 | 801 player_choose = _evt->v5; |
310 | 802 ++curr_seq_num; |
336 | 803 v4 = v124; |
307 | 804 break; |
805 case EVENT_SummonItem: | |
806 sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), | |
807 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), | |
808 _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), | |
809 _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), | |
810 _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), | |
811 _evt->v25, _evt->v26, 0, 0); | |
310 | 812 ++curr_seq_num; |
336 | 813 v4 = v124; |
814 | |
307 | 815 //v6 = v123; |
816 //v7 = ""; | |
817 break; | |
501 | 818 case EVENT_Compare: |
484 | 819 pValue = EVT_DWORD(_evt->v7); |
820 if ( player_choose <= 3 ) | |
512 | 821 { |
484 | 822 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) |
512 | 823 { |
484 | 824 v124 = -1; |
825 curr_seq_num = _evt->v11 - 1; | |
307 | 826 } |
512 | 827 } |
484 | 828 else if ( player_choose == 4 ) //active |
512 | 829 { |
830 if ( uActiveCharacter ) | |
307 | 831 { |
512 | 832 if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) |
307 | 833 { |
484 | 834 v124 = -1; |
835 curr_seq_num = _evt->v11 - 1; | |
307 | 836 } |
837 } | |
512 | 838 } |
484 | 839 else if ( player_choose == 5 )//all |
512 | 840 { |
484 | 841 v130=0; |
616 | 842 for(int i = 1; i < 5; ++i) |
512 | 843 { |
844 if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
484 | 845 { |
846 v124 = -1; | |
847 curr_seq_num = _evt->v11 - 1; | |
848 break; | |
512 | 849 } |
484 | 850 ++v130; |
307 | 851 } |
512 | 852 } |
484 | 853 else if ( player_choose == 6 ) //random |
512 | 854 { |
484 | 855 if ( pPlayers[rand() % 4]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) |
512 | 856 { |
484 | 857 v124 = -1; |
858 curr_seq_num = _evt->v11 - 1; | |
859 } | |
512 | 860 } |
310 | 861 ++curr_seq_num; |
336 | 862 v4 = v124; |
307 | 863 break; |
864 case EVENT_IsActorAlive: | |
484 | 865 if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) |
866 { | |
867 v124 = -1; | |
868 curr_seq_num = _evt->v11 - 1; | |
869 } | |
870 ++curr_seq_num; | |
871 v4 = v124; | |
872 break; | |
307 | 873 case EVENT_Substract: |
501 | 874 pValue = EVT_DWORD(_evt->v7); |
875 if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands ) | |
876 { | |
545 | 877 if ( pParty->pPickedItem.uItemID == pValue )//In hand |
307 | 878 { |
879 pMouse->RemoveHoldingItem(); | |
310 | 880 ++curr_seq_num; |
336 | 881 v4 = v124; |
307 | 882 break; |
501 | 883 } |
545 | 884 v67 = (int)pPlayers[uActiveCharacter]->pInventoryIndices; |
885 for ( v65 = 0; v65 < 126; ++v65 ) | |
501 | 886 { |
545 | 887 if ( (int)&pPlayers[uActiveCharacter]->pInventoryItems[v67] == pValue ) |
307 | 888 { |
545 | 889 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65); |
310 | 890 ++curr_seq_num; |
336 | 891 v4 = v124; |
307 | 892 break; |
501 | 893 } |
307 | 894 v67 += 4; |
501 | 895 } |
896 while ( (signed int)v65 < 126 ); | |
545 | 897 v69 = (int)&pPlayers[uActiveCharacter]->pEquipment; |
898 for ( v68 = 0; v68 < 16; ++v68 ) | |
899 { | |
900 if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItems[v69] == pValue ) | |
501 | 901 { |
545 | 902 *(&pPlayers[uActiveCharacter]->pEquipment.uOffHand + v68) = 0; |
903 ++curr_seq_num; | |
904 v4 = v124; | |
905 break; | |
906 } | |
907 v69 += 4; | |
908 } | |
909 for (int i = 1; i < 5; i++) | |
910 { | |
911 v72 = (int)pPlayers[i]->pInventoryIndices; | |
912 for ( int v71 = 0; v71 < 126; ++v71 ) | |
913 { | |
914 if ( (int)&pPlayers[i]->pInventoryItems[v72] == pValue ) | |
307 | 915 { |
545 | 916 pPlayers[i]->RemoveItemAtInventoryIndex(v71); |
307 | 917 break; |
501 | 918 } |
545 | 919 v72 += 4; |
501 | 920 } |
545 | 921 v73 = 0; |
922 v74 = (int)&pPlayers[i]->pEquipment; | |
923 while ( !*(int *)v74 || (int)&pPlayer->pInventoryItems[v74] != pValue ) | |
924 { | |
925 ++v73; | |
926 v74 += 4; | |
927 if ( v73 >= 16 ) | |
928 break; | |
929 } | |
930 *(&pPlayers[i]->pEquipment.uOffHand + v73) = 0; | |
307 | 931 } |
545 | 932 } |
501 | 933 if ( player_choose <= 3 ) |
934 { | |
512 | 935 pPlayer = &pParty->pPlayers[player_choose]; |
501 | 936 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
937 } | |
938 else if ( player_choose == 4 ) //active | |
939 { | |
940 if ( uActiveCharacter ) | |
307 | 941 { |
501 | 942 pPlayer = pPlayers[uActiveCharacter]; |
943 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
944 } | |
945 } | |
946 else if ( player_choose == 5 )//all | |
947 { | |
512 | 948 v130 = 0; |
614 | 949 for(int i = 1; i < 5; ++i) |
501 | 950 { |
951 if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
952 break; | |
953 } | |
954 ++v130; | |
955 } | |
956 else if ( player_choose == 6 ) //random | |
957 { | |
512 | 958 player_choose = rand() % 4; |
959 pPlayer = &pParty->pPlayers[player_choose]; | |
501 | 960 pPlayer->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
961 } | |
545 | 962 ++curr_seq_num; |
963 v4 = v124; | |
964 break; | |
512 | 965 case EVENT_Set: |
966 pValue = EVT_DWORD(_evt->v7); | |
967 if ( player_choose <= 3 ) | |
501 | 968 { |
512 | 969 pPlayer = &pParty->pPlayers[player_choose]; |
970 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
501 | 971 } |
512 | 972 else if ( player_choose == 4 ) //active |
501 | 973 { |
512 | 974 if ( uActiveCharacter ) |
307 | 975 { |
512 | 976 pPlayer = pPlayers[uActiveCharacter]; |
977 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
307 | 978 } |
501 | 979 } |
512 | 980 else if ( player_choose == 5 )//all |
981 { | |
525 | 982 //recheck v130 |
512 | 983 for(int i = 1; i < 5; ++i) |
984 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
525 | 985 |
512 | 986 } |
987 else if ( player_choose == 6 ) //random | |
988 { | |
989 player_choose = rand() % 4; | |
990 pPlayer = &pParty->pPlayers[player_choose]; | |
991 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
525 | 992 |
512 | 993 } |
525 | 994 ++curr_seq_num; |
995 v4 = v124; | |
996 break; | |
307 | 997 case EVENT_Add: |
501 | 998 pValue = EVT_DWORD(_evt->v7); |
512 | 999 if ( player_choose <= 3 ) |
1000 { | |
1001 pPlayer = &pParty->pPlayers[player_choose]; | |
1002 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1003 } | |
1004 else if ( player_choose == 4 ) //active | |
1005 { | |
1006 if ( uActiveCharacter ) | |
1007 { | |
1008 pPlayer = pPlayers[uActiveCharacter]; | |
1009 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1010 } | |
1011 } | |
1012 else if ( player_choose == 5 )//all | |
1013 { | |
1014 //v130 = 0; | |
1015 for(int i = 1; i < 5; ++i) | |
1016 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
525 | 1017 |
512 | 1018 } |
1019 else if ( player_choose == 6 ) //random | |
1020 { | |
1021 player_choose = rand() % 4; | |
1022 pPlayer = &pParty->pPlayers[player_choose]; | |
1023 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1024 } | |
525 | 1025 v83 = EVT_WORD(_evt->v5); |
1026 if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) | |
1027 viewparams->bRedrawGameUI = 1; | |
1028 ++curr_seq_num; | |
1029 v4 = v124; | |
1030 break; | |
307 | 1031 case EVENT_InputString: |
336 | 1032 if ( !start_event_seq_number ) |
307 | 1033 { |
783 | 1034 strcpy(GameUI_Footer_TimedString, &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]); |
310 | 1035 v105 = curr_seq_num; |
307 | 1036 v121 = 26; |
1037 LABEL_295: | |
1038 sub_4451A8_press_any_key(uEventID, v105, v121); | |
1039 LABEL_301: | |
1040 if ( v133 == 1 ) | |
797 | 1041 OnMapLeave(); |
307 | 1042 return; |
1043 } | |
1044 v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
783 | 1045 if ( !_strcmpi(GameUI_Footer_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) |
1046 || !_strcmpi(GameUI_Footer_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) ) | |
307 | 1047 { |
1048 v11 = _evt->v17; | |
1049 LABEL_130: | |
1050 //v124 = -1; | |
1051 LABEL_131: | |
310 | 1052 curr_seq_num = v11 - 1; |
307 | 1053 } |
310 | 1054 ++curr_seq_num; |
336 | 1055 v4 = v124; |
1056 | |
307 | 1057 //v6 = v123; |
1058 //v7 = ""; | |
1059 break; | |
1060 case EVENT_RandomGoTo: | |
1061 //v124 = -1; | |
1062 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) | |
1063 + (_evt->v10 != 0))); | |
525 | 1064 curr_seq_num = v11 - 1; |
787 | 1065 ++curr_seq_num; |
1066 v4 = v124; | |
1067 break; | |
307 | 1068 case EVENT_ReceiveDamage: |
525 | 1069 v85 = EVT_DWORD(_evt->v7 ); |
307 | 1070 v86 = _evt->v5; |
797 | 1071 if ( (unsigned __int8)v86 <= 3 ) |
307 | 1072 { |
1073 v119 = _evt->v6; | |
525 | 1074 v115 = EVT_DWORD(_evt->v7 ); |
307 | 1075 v89 = (unsigned __int8)v86; |
797 | 1076 v88 = &pParty->pPlayers[v89]; |
1077 v88->ReceiveDamage(v115, v119); | |
1078 ++curr_seq_num; | |
1079 v4 = v124; | |
1080 break; | |
307 | 1081 } |
1082 if ( v86 == 4 ) | |
1083 { | |
1084 if ( !uActiveCharacter ) | |
1085 { | |
310 | 1086 ++curr_seq_num; |
336 | 1087 v4 = v124; |
1088 | |
307 | 1089 //v6 = v123; |
1090 //v7 = ""; | |
1091 break; | |
1092 } | |
1093 v119 = _evt->v6; | |
1094 v88 = pPlayers[uActiveCharacter]; | |
525 | 1095 v115 = EVT_DWORD(_evt->v7 ); |
797 | 1096 v88->ReceiveDamage(v115, v119); |
1097 ++curr_seq_num; | |
1098 v4 = v124; | |
1099 break; | |
307 | 1100 } |
1101 if ( v86 != 5 ) | |
1102 { | |
1103 v119 = _evt->v6; | |
525 | 1104 v115 = EVT_DWORD(_evt->v7 ); |
307 | 1105 v89 = rand() % 4; |
1106 v88 = &pParty->pPlayers[v89]; | |
1107 v88->ReceiveDamage(v115, v119); | |
310 | 1108 ++curr_seq_num; |
336 | 1109 v4 = v124; |
1110 | |
307 | 1111 //v6 = v123; |
1112 //v7 = ""; | |
1113 break; | |
1114 } | |
1115 v87 = pParty->pPlayers; | |
1116 do | |
1117 { | |
1118 v87->ReceiveDamage(v85, _evt->v6); | |
1119 ++v87; | |
1120 } | |
1121 while ( (signed int)v87 < (signed int)pParty->pHirelings ); | |
310 | 1122 ++curr_seq_num; |
336 | 1123 v4 = v124; |
1124 | |
307 | 1125 //v6 = v123; |
1126 //v7 = ""; | |
1127 break; | |
1128 case EVENT_ToggleIndoorLight: | |
525 | 1129 pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9); |
310 | 1130 ++curr_seq_num; |
336 | 1131 v4 = v124; |
1132 | |
307 | 1133 //v6 = v123; |
1134 //v7 = ""; | |
1135 break; | |
1136 case EVENT_SetFacesBit: | |
525 | 1137 sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); |
310 | 1138 ++curr_seq_num; |
336 | 1139 v4 = v124; |
1140 | |
307 | 1141 //v6 = v123; |
1142 //v7 = ""; | |
1143 break; | |
1144 case EVENT_ToggleChestFlag: | |
525 | 1145 Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); |
310 | 1146 ++curr_seq_num; |
336 | 1147 v4 = v124; |
1148 | |
307 | 1149 //v6 = v123; |
1150 //v7 = ""; | |
1151 break; | |
1152 case EVENT_ToggleActorFlag: | |
525 | 1153 Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); |
310 | 1154 ++curr_seq_num; |
336 | 1155 v4 = v124; |
1156 | |
307 | 1157 //v6 = v123; |
1158 //v7 = ""; | |
1159 break; | |
1160 case EVENT_ToggleActorGroupFlag: | |
525 | 1161 ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); |
310 | 1162 ++curr_seq_num; |
336 | 1163 v4 = v124; |
1164 | |
307 | 1165 //v6 = v123; |
1166 //v7 = ""; | |
1167 break; | |
1168 case EVENT_SetSnow: | |
1169 if ( !_evt->v5 ) | |
1170 pWeather->bRenderSnow = _evt->v6 != 0; | |
310 | 1171 ++curr_seq_num; |
336 | 1172 v4 = v124; |
1173 | |
307 | 1174 //v6 = v123; |
1175 //v7 = ""; | |
1176 break; | |
1177 case EVENT_StatusText: | |
525 | 1178 v90 = EVT_DWORD(_evt->v5 ); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
1179 if ( activeLevelDecoration ) |
307 | 1180 { |
525 | 1181 if ( activeLevelDecoration == (LevelDecoration*)1 ) |
307 | 1182 { |
1183 ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; | |
1184 } | |
469 | 1185 if ( canShowMessages == 1 ) |
307 | 1186 { |
1187 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; | |
1188 //LABEL_248: | |
1189 ShowStatusBarString(v91, 2u); | |
1190 } | |
1191 } | |
1192 else | |
1193 { | |
469 | 1194 if ( canShowMessages == 1 ) |
307 | 1195 { |
1196 v91 = &pLevelStr[pLevelStrOffsets[v90]]; | |
1197 ShowStatusBarString(v91, 2u); | |
1198 } | |
1199 } | |
310 | 1200 ++curr_seq_num; |
336 | 1201 v4 = v124; |
1202 | |
307 | 1203 //v6 = v123; |
1204 //v7 = ""; | |
1205 break; | |
1206 case EVENT_ShowMessage: | |
525 | 1207 v92 = EVT_DWORD(_evt->v5 ); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
1208 if ( activeLevelDecoration ) |
307 | 1209 { |
1210 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; | |
1211 byte_5B0938[0] = 0; | |
1212 ptr_F8B1E8 = v93; | |
1213 } | |
1214 else | |
1215 { | |
1216 strcpy(byte_5B0938, &pLevelStr[pLevelStrOffsets[v92]]); | |
1217 } | |
310 | 1218 ++curr_seq_num; |
336 | 1219 v4 = v124; |
1220 | |
307 | 1221 //v6 = v123; |
1222 //v7 = ""; | |
1223 break; | |
1224 case EVENT_CastSpell: | |
525 | 1225 sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ), |
1226 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), | |
1227 EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 )); | |
310 | 1228 ++curr_seq_num; |
336 | 1229 v4 = v124; |
525 | 1230 |
307 | 1231 break; |
1232 case EVENT_SetTexture: | |
525 | 1233 sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9); |
310 | 1234 ++curr_seq_num; |
336 | 1235 v4 = v124; |
1236 | |
307 | 1237 //v6 = v123; |
1238 //v7 = ""; | |
1239 break; | |
1240 case EVENT_SetSprite: | |
525 | 1241 SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10); |
310 | 1242 ++curr_seq_num; |
336 | 1243 v4 = v124; |
1244 | |
307 | 1245 //v6 = v123; |
1246 //v7 = ""; | |
1247 break; | |
1248 case EVENT_SummonMonsters: | |
525 | 1249 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ), |
1250 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), | |
1251 EVT_DWORD(_evt->v24 )); | |
310 | 1252 ++curr_seq_num; |
336 | 1253 v4 = v124; |
1254 | |
307 | 1255 //v6 = v123; |
1256 //v7 = ""; | |
1257 break; | |
1258 case EVENT_MouseOver: | |
1259 case EVENT_LocationName: | |
310 | 1260 --curr_seq_num; |
1261 ++curr_seq_num; | |
336 | 1262 v4 = v124; |
1263 | |
307 | 1264 //v6 = v123; |
1265 //v7 = ""; | |
1266 break; | |
1267 case EVENT_ChangeDoorState: | |
1268 sub_449A49_door_switch_animation(_evt->v5, _evt->v6); | |
310 | 1269 ++curr_seq_num; |
336 | 1270 v4 = v124; |
1271 | |
307 | 1272 //v6 = v123; |
1273 //v7 = ""; | |
1274 break; | |
1275 case EVENT_OpenChest: | |
1276 if ( !Chest::Open(_evt->v5) ) | |
1277 goto LABEL_301; | |
310 | 1278 ++curr_seq_num; |
336 | 1279 v4 = v124; |
1280 | |
307 | 1281 //v6 = v123; |
1282 //v7 = ""; | |
1283 break; | |
1284 case EVENT_MoveToMap: | |
1285 v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1286 v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1287 v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1288 v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1289 v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8); | |
1290 v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8); | |
1291 v96 = _evt->v25; | |
1292 v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); | |
1293 v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); | |
1294 if ( _evt->v29 || _evt->v30 ) | |
1295 { | |
1296 if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) | |
1297 pRenderer->_49FD3A(); | |
1298 sub_444839_move_map(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); | |
1299 dword_5C3418 = uEventID; | |
310 | 1300 dword_5C341C = curr_seq_num + 1; |
307 | 1301 goto LABEL_301; |
1302 } | |
1303 _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1304 _5B65A8_npcdata_uflags_or_other = v94; | |
1305 _5B65B0_npcdata_rep_or_other = v126; | |
1306 if ( v129 == -1 ) | |
1307 { | |
1308 v98 = _5B65B4_npcdata_loword_house_or_other; | |
1309 } | |
1310 else | |
1311 { | |
1312 v98 = v129 & stru_5C6E00->uDoublePiMask; | |
1313 _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask; | |
1314 } | |
1315 v99 = (char *)&_evt->v31; | |
1316 _5B65B8_npcdata_hiword_house_or_other = v95; | |
1317 dword_5B65BC = v97; | |
1318 v100 = v94 | v132 | v126 | v95 | v97 | v98; | |
1319 dword_5B65C0 = v100; | |
1320 if ( *v99 == 48 ) | |
1321 { | |
1322 if ( v100 ) | |
1323 { | |
1324 pParty->vPosition.x = v135; | |
1325 pParty->vPosition.y = v132; | |
1326 pParty->vPosition.z = v126; | |
1327 pParty->uFallStartY = v126; | |
1328 if ( _5B65B4_npcdata_loword_house_or_other != -1 ) | |
1329 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; | |
1330 _5B65B4_npcdata_loword_house_or_other = -1; | |
1331 v120 = 0; | |
1332 v116 = 0; | |
1333 v111 = 0; | |
1334 v110 = 0; | |
1335 v109 = -1; | |
1336 v108 = 0; | |
1337 v107 = 0; | |
1338 pParty->sRotationX = v95; | |
1339 pParty->uFallSpeed = v134; | |
1340 dword_5B65C0 = 0; | |
1341 dword_5B65BC = 0; | |
1342 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1343 _5B65B0_npcdata_rep_or_other = 0; | |
1344 _5B65AC_npcdata_fame_or_other = 0; | |
1345 _5B65A8_npcdata_uflags_or_other = 0; | |
1346 v106 = 232; | |
1347 LABEL_280: | |
1348 pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); | |
1349 } | |
1350 } | |
1351 else | |
1352 { | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
512
diff
changeset
|
1353 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((activeLevelDecoration == NULL) + 1); |
783 | 1354 sub_44987B(v99, MapStartPoint_Party); |
307 | 1355 v133 = 1; |
1356 if ( pCurrentScreen == SCREEN_HOUSE ) | |
1357 { | |
1358 if ( uGameState == 2 ) | |
1359 { | |
1360 pAudioPlayer->StopChannels(-1, -1); | |
747 | 1361 dialog_menu_id = HOUSE_DIALOGUE_NULL; |
307 | 1362 while ( sub_4BD8B5() ) |
1363 ; | |
1364 pVideoPlayer->Unload(); | |
336 | 1365 window_SpeakInHouse->Release(); |
1366 window_SpeakInHouse = 0; | |
307 | 1367 if ( pMessageQueue_50CBD0->uNumMessages ) |
1368 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1369 pCurrentScreen = SCREEN_GAME; | |
1370 viewparams->bRedrawGameUI = 1; | |
457 | 1371 pDialogueNPCCount = 0; |
307 | 1372 pDialogueWindow->Release(); |
747 | 1373 dialog_menu_id = HOUSE_DIALOGUE_NULL; |
307 | 1374 pDialogueWindow = 0; |
1375 pIcons_LOD->_40F9C5(); | |
1376 } | |
797 | 1377 OnMapLeave(); |
1378 return; | |
307 | 1379 } |
1380 } | |
310 | 1381 ++curr_seq_num; |
336 | 1382 v4 = v124; |
1383 | |
307 | 1384 //v6 = v123; |
1385 //v7 = ""; | |
1386 break; | |
1387 case EVENT_PlaySound: | |
1388 v120 = 0; | |
1389 v116 = 0; | |
1390 v111 = 0; | |
1391 v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1392 v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1393 v108 = 0; | |
1394 v107 = 0; | |
1395 v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1396 goto LABEL_280; | |
1397 case EVENT_GiveItem: | |
1398 item.Reset(); | |
1399 //v101 = &pSomeEVT[v9]; | |
1400 v102 = _evt->v7 | |
1401 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); | |
1402 pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); | |
1403 if ( v102 ) | |
1404 item.uItemID = v102; | |
1405 pParty->SetHoldingItem(&item); | |
310 | 1406 ++curr_seq_num; |
336 | 1407 v4 = v124; |
307 | 1408 //v6 = v123; |
1409 //v7 = ""; | |
1410 break; | |
336 | 1411 case EVENT_SpeakInHouse: |
496 | 1412 if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5))) |
307 | 1413 { |
1414 if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) | |
1415 pRenderer->_49FD3A(); | |
1416 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); | |
1417 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); | |
1418 v104 = 187; | |
1419 if ( uCurrentHouse_Animation != 167 ) | |
525 | 1420 v104 = EVT_DWORD(_evt->v5); |
336 | 1421 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0); |
496 | 1422 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, 0x6Eu, 1, 49, "", 0); |
1423 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, 0x6Eu, 2, 50, "", 0); | |
1424 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, 0x6Eu, 3, 51, "", 0); | |
1425 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, 0x6Eu, 4, 52, "", 0); | |
525 | 1426 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); |
307 | 1427 } |
310 | 1428 ++curr_seq_num; |
336 | 1429 v4 = v124; |
1430 | |
307 | 1431 //v6 = v123; |
1432 //v7 = ""; | |
1433 break; | |
1434 case EVENT_PressAnyKey: | |
1435 v121 = 33; | |
310 | 1436 v105 = curr_seq_num + 1; |
307 | 1437 goto LABEL_295; |
1438 case EVENT_Exit: | |
484 | 1439 if ( v133 == 1 ) |
1440 OnMapLeave(); | |
1441 return; | |
307 | 1442 default: |
310 | 1443 ++curr_seq_num; |
336 | 1444 v4 = v124; |
1445 | |
307 | 1446 //v6 = v123; |
1447 //v7 = ""; | |
1448 break; | |
1449 } | |
1450 } | |
336 | 1451 ++v4; |
1452 v124 = v4; | |
1453 if ( v4 >= uSomeEVT_NumEvents ) | |
1454 goto LABEL_301; | |
307 | 1455 //} |
1456 } | |
1457 } | |
1458 |