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