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