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