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