Mercurial > mm7
annotate Events.cpp @ 2254:2e02c384c62b
Merge
author | Grumpy7 |
---|---|
date | Wed, 26 Feb 2014 23:35:46 +0100 |
parents | aff7a7b072b7 |
children | 01489aec3cb0 |
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 //char *v5; // eax@8 | |
286 Player *v6; // ecx@8 | |
287 //char *v7; // ebp@8 | |
288 //signed int v8; // edx@10 | |
289 //int v9; // edi@12 | |
290 //ByteArray *v10; // esi@12 | |
291 int v11; // eax@14 | |
292 char *v12; // eax@15 | |
293 //char *v13; // edi@21 | |
294 int v14; // ebp@21 | |
295 int v15; // edi@21 | |
296 const char *v16; // esi@21 | |
297 bool v17; // edx@21 | |
298 int v18; // ecx@22 | |
299 int v19; // ebp@36 | |
300 signed int v20; // ecx@40 | |
301 int v21; // eax@40 | |
302 int v22; // edx@40 | |
303 int v23; // eax@40 | |
304 unsigned __int16 v24; // ax@45 | |
305 int v25; // eax@54 | |
306 LevelDecoration *v26; // eax@55 | |
307 int v27; // eax@57 | |
308 int v28; // ecx@57 | |
309 //int v29; // edx@58 | |
310 int pEventID; // eax@58 | |
311 int pNPC_ID; // ecx@58 | |
312 int pIndex; // esi@58 | |
313 NPCData *pNPC; // ecx@58 | |
314 int v34; // esi@59 | |
315 int v35; // esi@60 | |
316 int v36; // esi@61 | |
317 int v37; // esi@62 | |
318 int v38; // eax@78 | |
319 int v39; // ecx@78 | |
320 size_t v40; // edx@78 | |
321 Actor *v41; // esi@79 | |
322 int v42; // eax@84 | |
323 int v43; // ecx@84 | |
324 size_t v44; // edx@84 | |
325 Actor *v45; // esi@85 | |
326 void *v46; // eax@91 | |
327 GUIWindow *v47; // eax@93 | |
328 GUIButton *v48; // ecx@93 | |
329 GUIButton *v49; // esi@94 | |
330 char v50; // al@100 | |
331 Player *v51; // esi@103 | |
332 Player *v52; // ecx@106 | |
333 int v53; // ecx@107 | |
334 char v54; // al@111 | |
335 Player *v55; // esi@114 | |
336 Player *v56; // ecx@117 | |
337 int v57; // ecx@118 | |
338 signed int pValue; // ebp@124 | |
339 Player *pPlayer; // esi@125 | |
340 int v60; // eax@126 | |
341 int v61; // edx@133 | |
342 int v62; // eax@139 | |
343 int v63; // ebp@145 | |
344 signed int v64; // edi@146 | |
345 unsigned int v65; // edx@148 | |
346 Player *v66; // ecx@148 | |
347 int v67; // esi@148 | |
348 signed int v68; // eax@151 | |
349 int v69; // esi@151 | |
350 Player *v70; // ecx@158 | |
351 unsigned int v71; // eax@159 | |
352 int v72; // esi@159 | |
353 signed int v73; // eax@162 | |
354 int v74; // esi@162 | |
355 int v75; // edx@172 | |
356 Player *v76; // esi@173 | |
357 signed int v77; // ebp@186 | |
358 int v78; // edx@186 | |
359 Player *v79; // esi@187 | |
360 //signed int v80; // ebp@200 | |
361 //int v81; // edx@200 | |
362 Player *v82; // esi@201 | |
363 int v83; // eax@212 | |
364 int v84; // ebp@220 | |
365 signed int v85; // ebp@224 | |
366 char v86; // al@224 | |
367 Player *v87; // esi@227 | |
368 Player *v88; // ecx@231 | |
369 int v89; // ecx@232 | |
370 int v90; // eax@243 | |
371 const char *v91; // ecx@247 | |
372 int v92; // eax@251 | |
373 char *v93; // eax@252 | |
374 int v94; // ecx@262 | |
375 int v95; // ebp@262 | |
376 int v96; // edx@262 | |
377 int v97; // eax@262 | |
378 unsigned int v98; // edx@265 | |
379 const char *v99; // esi@267 | |
380 int v100; // edx@267 | |
381 //char *v101; // edi@281 | |
382 unsigned int v102; // esi@281 | |
383 int v103; // edi@284 | |
384 int v104; // eax@288 | |
385 int v105; // edx@294 | |
386 int v106; // [sp-20h] [bp-4C8h]@278 | |
387 signed int v107; // [sp-1Ch] [bp-4C4h]@278 | |
388 unsigned int v108; // [sp-18h] [bp-4C0h]@278 | |
389 signed int v109; // [sp-14h] [bp-4BCh]@278 | |
390 signed int v110; // [sp-10h] [bp-4B8h]@278 | |
391 int v111; // [sp-Ch] [bp-4B4h]@278 | |
392 // Event *v112; // [sp-8h] [bp-4B0h]@5 | |
393 int v113; // [sp-8h] [bp-4B0h]@106 | |
394 int v114; // [sp-8h] [bp-4B0h]@117 | |
395 signed int v115; // [sp-8h] [bp-4B0h]@231 | |
396 unsigned int v116; // [sp-8h] [bp-4B0h]@278 | |
397 int v117; // [sp-4h] [bp-4ACh]@106 | |
398 int v118; // [sp-4h] [bp-4ACh]@117 | |
399 int v119; // [sp-4h] [bp-4ACh]@231 | |
400 int v120; // [sp-4h] [bp-4ACh]@278 | |
401 int v121; // [sp-4h] [bp-4ACh]@294 | |
402 int curr_seq_num; // [sp+10h] [bp-498h]@4 | |
403 //char *v123; // [sp+14h] [bp-494h]@0 | |
404 signed int v124; // [sp+18h] [bp-490h]@7 | |
405 //signed int v125; // [sp+1Ch] [bp-48Ch]@155 | |
406 int v126; // [sp+1Ch] [bp-48Ch]@262 | |
407 int player_choose; // [sp+20h] [bp-488h]@4 | |
408 int v128; // [sp+24h] [bp-484h]@21 | |
409 int v129; // [sp+24h] [bp-484h]@262 | |
410 signed int v130; // [sp+28h] [bp-480h]@0 | |
411 //int v131; // [sp+2Ch] [bp-47Ch]@1 | |
412 int v132; // [sp+30h] [bp-478h]@262 | |
413 signed int v133; // [sp+34h] [bp-474h]@1 | |
414 int v134; // [sp+38h] [bp-470h]@262 | |
415 int v135; // [sp+3Ch] [bp-46Ch]@262 | |
416 int v136; // [sp+40h] [bp-468h]@40 | |
417 int v137; // [sp+44h] [bp-464h]@40 | |
418 int v138; // [sp+48h] [bp-460h]@40 | |
419 int v139; // [sp+4Ch] [bp-45Ch]@40 | |
420 ItemGen item; // [sp+50h] [bp-458h]@15 | |
421 char Source[120]; // [sp+74h] [bp-434h]@15 | |
422 char Str[120]; // [sp+ECh] [bp-3BCh]@21 | |
423 Actor Dst; // [sp+164h] [bp-344h]@53 | |
307 | 424 |
1490 | 425 //v131 = uEventID; |
426 v133 = 0; | |
427 EvtTargetObj = targetObj; | |
1825
23deb6b09c8c
cancelEventProcessing to dword_5B65C4_cancelEventProcessing
Grumpy7
parents:
1821
diff
changeset
|
428 dword_5B65C4_cancelEventProcessing = 0; |
2144 | 429 /*if ( uEventID == 114 )//÷òîáû ïðîâåðèòü ñêðèïò |
2050 | 430 { |
2052 | 431 if (!lua->DoFile("out01.lua")) |
2050 | 432 Log::Warning(L"Error opening out01.lua\n"); |
2068 | 433 Log::Warning(L"being tested that well\n"); |
2066 | 434 return; |
2144 | 435 } */ |
1490 | 436 if ( !uEventID ) |
437 { | |
438 if ( !GameUI_Footer_TimeLeft ) | |
439 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here | |
440 return; | |
441 } | |
442 player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 | |
443 curr_seq_num = entry_line; | |
1052 | 444 |
1490 | 445 if ( activeLevelDecoration ) |
446 { | |
447 uSomeEVT_NumEvents = uGlobalEVT_NumEvents; | |
448 pSomeEVT = pGlobalEVT.data(); | |
449 memcpy(pSomeEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400); //4400 evts | |
450 } | |
451 else | |
452 { | |
453 uSomeEVT_NumEvents = uLevelEVT_NumEvents; | |
454 pSomeEVT = pLevelEVT.data(); | |
455 memcpy(pSomeEVT_Events.data(), pLevelEVT_Index.data(), sizeof(EventIndex)*4400); | |
456 } | |
307 | 457 |
1490 | 458 v4 = 0; |
459 v124 = 0; | |
460 //for (uint i = 0; i < uSomeEVT_NumEvents; ++i) | |
461 // { | |
462 //v6 = v123; | |
463 //v7 = ""; | |
464 while ( 1 ) | |
465 { | |
1825
23deb6b09c8c
cancelEventProcessing to dword_5B65C4_cancelEventProcessing
Grumpy7
parents:
1821
diff
changeset
|
466 if ( dword_5B65C4_cancelEventProcessing ) |
1490 | 467 goto LABEL_301; |
468 //v8 = v4; | |
469 if ( pSomeEVT_Events[v4].uEventID == uEventID && pSomeEVT_Events[v4].event_sequence_num == curr_seq_num ) | |
470 { | |
471 //v9 = pSomeEVT_Events[v8].uEventOffsetInEVT; | |
472 //v10 = (ByteArray *)&v5[v9]; | |
1980 | 473 _evt_raw * _evt = (_evt_raw *)(pSomeEVT + pSomeEVT_Events[v4].uEventOffsetInEVT); |
307 | 474 |
1490 | 475 switch (_evt->_e_type) |
476 { | |
477 case EVENT_CheckSeason: | |
478 // | |
479 if ( !sub_4465DF_check_season(_evt->v5) ) | |
1052 | 480 { |
1490 | 481 ++curr_seq_num; |
482 v4 = v124; | |
483 break; | |
1052 | 484 } |
1490 | 485 v124 = -1; |
486 curr_seq_num = _evt->v6 - 1; | |
487 ++curr_seq_num; | |
488 break; | |
489 case EVENT_ShowMovie: | |
490 { | |
491 strcpy(Source, (char *)&_evt->v7); | |
492 v12 = (char *)&item.uExpireTime + strlen(Source) + 7; | |
493 if ( *v12 == 32 ) | |
494 *v12 = 0; | |
2137
d24ee391fd1f
libavcodec playing movies and houses, loops not working yet
zipi
parents:
2124
diff
changeset
|
495 if (pVideoPlayer->bBufferLoaded) |
1490 | 496 pVideoPlayer->Unload(); |
497 pVideoPlayer->bStopBeforeSchedule = 0; | |
498 pVideoPlayer->pResetflag = 0; | |
1038 | 499 |
1490 | 500 v128 = pCurrentScreen; |
501 //v13 = &pSomeEVT[v9]; | |
502 //v14 = (unsigned __int8)v13[5]; | |
503 //v15 = (unsigned __int8)v13[6]; | |
504 v14 = _evt->v5; | |
505 v15 = _evt->v6; | |
506 strcpy(Str, Source); | |
507 v16 = RemoveQuotes(Str); | |
2142
ca548138d6aa
some code cleaning in video playing, loops play but there is a memory leak
zipi
parents:
2137
diff
changeset
|
508 pVideoPlayer->MovieLoop(v16, 0, v14, 1); |
1490 | 509 if ( !_stricmp(v16, "arbiter good") ) |
373 | 510 { |
511 pParty->alignment = PartyAlignment_Good; | |
1490 | 512 v18 = 0; |
513 LOBYTE(v17) = 1; | |
514 SetUserInterface(PartyAlignment_Good, v17); | |
515 if ( !v15 || v128 == 3 ) | |
516 { | |
517 pCurrentScreen = v128; | |
518 if ( v128 == 3 ) | |
519 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
520 if ( v128 == 13 ) | |
521 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
522 } | |
523 | |
524 ++curr_seq_num; | |
525 v4 = v124; | |
1038 | 526 |
1490 | 527 //v6 = v123; |
528 //v7 = ""; | |
529 break; | |
530 } | |
531 if ( !_stricmp(v16, "arbiter evil") ) | |
532 { | |
533 v18 = 2; | |
534 pParty->alignment = PartyAlignment_Evil; | |
535 LOBYTE(v17) = 1; | |
536 SetUserInterface(PartyAlignment_Evil, v17); | |
537 if ( !v15 || v128 == 3 ) | |
538 { | |
539 pCurrentScreen = v128; | |
540 if ( v128 == 3 ) | |
541 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
542 if ( v128 == 13 ) | |
543 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
544 } | |
545 ++curr_seq_num; | |
546 v4 = v124; | |
307 | 547 |
1490 | 548 //v6 = v123; |
549 //v7 = ""; | |
550 | |
551 break; | |
552 } | |
553 if ( !_stricmp(v16, "pcout01") ) // moving to harmondale from emerald isle | |
766 | 554 { |
1490 | 555 Rest(0x2760u); |
556 pParty->RestAndHeal(); | |
557 pParty->days_played_without_rest = 0; | |
766 | 558 } |
1490 | 559 if ( !v15 || v128 == 3 ) |
560 { | |
561 pCurrentScreen = v128; | |
562 if ( v128 == 3 ) | |
563 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
564 if ( v128 == 13 ) | |
565 pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); | |
566 } | |
567 ++curr_seq_num; | |
568 v4 = v124; | |
569 | |
570 //v6 = v123; | |
571 //v7 = ""; | |
572 } | |
573 break; | |
574 case EVENT_CheckSkill: | |
575 { | |
576 v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); | |
577 if ( player_choose < 0 ) | |
578 goto LABEL_47; | |
579 if ( player_choose <= 3 ) | |
580 { | |
581 v24 = pParty->pPlayers[0].pActiveSkills[3486 * player_choose + _evt->v5]; | |
582 } | |
583 else | |
584 { | |
585 if ( player_choose == 4 ) | |
586 { | |
587 v24 = pPlayers[uActiveCharacter]->pActiveSkills[_evt->v5]; | |
588 } | |
589 else | |
590 { | |
591 if ( player_choose == 5 ) | |
592 { | |
593 v20 = 0; | |
594 v21 = 3486 * v130 + _evt->v5; | |
595 v136 = 1; | |
596 LOWORD(v21) = pParty->pPlayers[0].pActiveSkills[v21]; | |
597 v137 = v21 & 0x40; | |
598 v138 = v21 & 0x80; | |
599 v22 = v21 & 0x100; | |
600 v23 = v21 & 0x3F; | |
601 v139 = v22; | |
602 while ( v23 < v19 || !*(&v136 + _evt->v6) ) | |
603 { | |
604 ++v20; | |
605 if ( v20 >= 4 ) | |
606 { | |
607 ++curr_seq_num; | |
608 v4 = v124; | |
609 | |
610 //v6 = v123; | |
611 //v7 = ""; | |
612 break; | |
613 } | |
614 } | |
615 v11 = _evt->v11; | |
616 goto LABEL_130; | |
617 } | |
307 | 618 LABEL_47: |
1490 | 619 //v10 = (ByteArray *)&v5[v9]; |
620 v24 = pParty->pPlayers[0].pActiveSkills[_evt->v5 + 3486 * rand() % 4]; | |
621 } | |
622 } | |
623 v136 = 1; | |
624 v137 = v24 & 0x40; | |
625 v138 = v24 & 0x80; | |
626 v139 = v24 & 0x100; | |
627 if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) | |
628 { | |
629 v11 = _evt->v11; | |
630 goto LABEL_130; | |
631 } | |
632 ++curr_seq_num; | |
633 v4 = v124; | |
634 | |
635 //v6 = v123; | |
636 //v7 = ""; | |
637 } | |
638 break; | |
307 | 639 |
1490 | 640 case EVENT_SpeakNPC: |
641 if ( canShowMessages ) | |
642 { | |
643 //Actor::Actor(&Dst); | |
644 memset(&Dst, 0, 0x344u); | |
645 dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); | |
646 Dst.sNPC_ID = dword_5B65D0_dialogue_actor_npc_id; | |
647 GameUI_InitializeDialogue(&Dst, false); | |
648 } | |
649 else | |
650 { | |
651 bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); | |
652 } | |
653 ++curr_seq_num; | |
654 v4 = v124; | |
655 | |
656 //v6 = v123; | |
657 //v7 = ""; | |
658 break; | |
659 case EVENT_ChangeEvent: | |
660 v25 = EVT_DWORD(_evt->v5); | |
661 if ( v25 ) | |
662 { | |
1736
c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents:
1583
diff
changeset
|
663 stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124; |
1490 | 664 } |
665 else | |
666 { | |
667 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
|
668 stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0; |
1489 | 669 v26->uFlags |= LEVEL_DECORATION_INVISIBLE; |
1490 | 670 } |
671 ++curr_seq_num; | |
672 v4 = v124; | |
525 | 673 |
1490 | 674 break; |
675 case EVENT_SetNPCGreeting: | |
676 v27 = EVT_DWORD(_evt->v5); | |
677 pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; | |
678 pNPCStats->pNewNPCData[v27].greet = EVT_DWORD(_evt->v9); | |
679 ++curr_seq_num; | |
680 v4 = v124; | |
681 | |
682 //v6 = v123; | |
683 //v7 = ""; | |
684 break; | |
827 | 685 case EVENT_SetNPCTopic: |
686 { | |
687 //v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
688 pEventID = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); | |
689 pNPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
690 pIndex = _evt->v9; | |
691 pNPC = &pNPCStats->pNewNPCData[pNPC_ID]; | |
692 if ( pIndex == 0 ) | |
693 pNPC->evt_A = pEventID; | |
694 if ( pIndex == 1 ) | |
695 pNPC->evt_B = pEventID; | |
696 if ( pIndex == 2 ) | |
697 pNPC->evt_C = pEventID; | |
698 if ( pIndex == 3 ) | |
699 pNPC->evt_D = pEventID; | |
700 if ( pIndex == 4 ) | |
701 pNPC->evt_E = pEventID; | |
702 if ( pIndex == 5 ) | |
703 pNPC->evt_F = pEventID; | |
704 if ( pNPC_ID == 8 ) | |
705 { | |
706 if ( pEventID == 78 ) | |
707 { | |
1919 | 708 HouseDialogPressCloseBtn(); |
827 | 709 window_SpeakInHouse->Release(); |
710 pParty->uFlags &= ~2; | |
711 if ( EnterHouse(HOUSE_DARK_GUILD_PIT) ) | |
712 { | |
713 pAudioPlayer->StopChannels(-1, -1); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2153
diff
changeset
|
714 window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_HouseInterior, 170, 0); |
948 | 715 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); |
716 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
717 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
718 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
719 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); | |
827 | 720 current_npc_text = pNPCTopics[90].pText; |
721 } | |
722 } | |
723 } | |
724 ++curr_seq_num; | |
725 } | |
726 v4 = v124; | |
727 break; | |
1490 | 728 case EVENT_NPCSetItem: |
729 sub_448518_npc_set_item(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); | |
730 ++curr_seq_num; | |
731 v4 = v124; | |
525 | 732 |
1490 | 733 break; |
734 case EVENT_SetActorItem: | |
735 Actor::GiveItem(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); | |
736 ++curr_seq_num; | |
737 v4 = v124; | |
738 break; | |
739 case EVENT_SetNPCGroupNews: | |
740 pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); | |
741 ++curr_seq_num; | |
742 v4 = v124; | |
743 break; | |
744 case EVENT_SetActorGroup: | |
745 __debugbreak(); | |
746 *(&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); | |
747 ++curr_seq_num; | |
748 v4 = v124; | |
749 break; | |
750 case EVENT_ChangeGroup: | |
751 v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
752 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
753 v40 = uNumActors; | |
754 __debugbreak(); | |
755 if ( (signed int)uNumActors > 0 ) | |
756 { | |
757 v41 = pActors.data();//[0].uGroup; | |
758 do | |
759 { | |
760 if ( v41->uGroup == v38 ) | |
761 v41->uGroup = v39; | |
762 ++v41; | |
763 --v40; | |
764 } | |
765 while ( v40 ); | |
766 } | |
767 ++curr_seq_num; | |
768 v4 = v124; | |
769 | |
770 //v6 = v123; | |
771 //v7 = ""; | |
772 break; | |
773 case EVENT_ChangeGroupAlly: | |
774 v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
775 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
776 v44 = uNumActors; | |
777 __debugbreak(); | |
778 if ( (signed int)uNumActors > 0 ) | |
779 { | |
780 v45 = pActors.data();//[0].uAlly; | |
781 do | |
782 { | |
783 if ( v45->uGroup == v42 ) | |
784 v45->uAlly = v43; | |
785 ++v45; | |
786 --v44; | |
787 } | |
788 while ( v44 ); | |
789 } | |
790 ++curr_seq_num; | |
791 v4 = v124; | |
792 | |
793 //v6 = v123; | |
794 //v7 = ""; | |
795 break; | |
796 case EVENT_MoveNPC: | |
797 { | |
798 | |
799 pNPCStats->pNewNPCData[EVT_DWORD(_evt->v5)].Location2D =EVT_DWORD(_evt->v9); | |
800 if ( window_SpeakInHouse ) | |
801 { | |
310 | 802 |
1490 | 803 if ( window_SpeakInHouse->par1C == 165 ) |
804 { | |
1919 | 805 HouseDialogPressCloseBtn(); |
1490 | 806 pVideoPlayer->Unload(); |
807 window_SpeakInHouse->Release(); | |
808 pParty->uFlags &= ~2; | |
809 activeLevelDecoration = (LevelDecoration*)1; | |
810 if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) | |
811 { | |
812 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
|
813 window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_HouseInterior, 165, 0); |
1490 | 814 v48 = window_SpeakInHouse->pControlsHead; |
815 if ( v48 ) | |
816 { | |
817 do | |
818 { | |
819 v49 = v48->pNext; | |
1583 | 820 free(v48); |
1490 | 821 v48 = v49; |
822 } | |
823 while ( v49 ); | |
824 } | |
825 window_SpeakInHouse->pControlsHead = 0; | |
826 window_SpeakInHouse->pControlsTail = 0; | |
827 window_SpeakInHouse->uNumControls = 0; | |
828 } | |
829 } | |
830 else | |
831 { | |
832 if ( window_SpeakInHouse->par1C == 553 ) | |
833 pVideoPlayer->bLoopPlaying = 0; | |
834 } | |
835 } | |
836 | |
837 } | |
525 | 838 ++curr_seq_num; |
1490 | 839 v4 = v124; |
840 | |
841 break; | |
842 case EVENT_Jmp: | |
843 curr_seq_num = _evt->v5 - 1; | |
844 ++curr_seq_num; | |
845 v4 = -1; | |
525 | 846 |
1490 | 847 break; |
848 case EVENT_ShowFace: | |
849 if ( _evt->v5 <= 3u ) //someone | |
850 pParty->pPlayers[_evt->v5].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
851 else if ( _evt->v5 == 4 ) //active | |
852 pParty->pPlayers[uActiveCharacter].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
853 else if ( _evt->v5 == 5 ) //all players | |
854 { | |
855 for(int i=0; i<4; ++i) | |
856 pParty->pPlayers[i].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
857 } | |
858 else //random player | |
859 pParty->pPlayers[rand() % 4].PlayEmotion((CHARACTER_EXPRESSION_ID)_evt->v6, 0); | |
860 ++curr_seq_num; | |
861 v4 = v124; | |
525 | 862 |
1490 | 863 break; |
864 case EVENT_CharacterAnimation: | |
865 if ( _evt->v5 <= 3u ) //someone | |
866 pParty->pPlayers[_evt->v5].PlaySound((PlayerSpeech) _evt->v6, 0); | |
867 else if ( _evt->v5 == 4 ) //active | |
868 pParty->pPlayers[uActiveCharacter].PlaySound((PlayerSpeech) _evt->v6, 0); | |
869 else if ( _evt->v5 == 5 ) //all | |
870 for(int i=0; i<4; ++i) | |
871 pParty->pPlayers[i].PlaySound((PlayerSpeech) _evt->v6, 0); | |
872 else //random | |
873 pParty->pPlayers[rand() % 4].PlaySound((PlayerSpeech) _evt->v6, 0); | |
874 ++curr_seq_num; | |
875 v4 = v124; | |
525 | 876 |
1490 | 877 break; |
878 case EVENT_ForPartyMember: | |
879 player_choose = _evt->v5; | |
880 ++curr_seq_num; | |
881 v4 = v124; | |
882 break; | |
883 case EVENT_SummonItem: | |
884 sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), | |
885 _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), | |
886 _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), | |
887 _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), | |
888 _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), | |
889 _evt->v25, _evt->v26, 0, 0); | |
890 ++curr_seq_num; | |
891 v4 = v124; | |
525 | 892 |
1490 | 893 //v6 = v123; |
894 //v7 = ""; | |
895 break; | |
896 case EVENT_Compare: | |
897 pValue = EVT_DWORD(_evt->v7); | |
898 if ( player_choose <= 3 ) | |
899 { | |
900 if ( pPlayers[player_choose]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
901 { | |
902 v124 = -1; | |
903 curr_seq_num = _evt->v11 - 1; | |
904 } | |
905 } | |
906 else if ( player_choose == 4 ) //active | |
907 { | |
908 if ( uActiveCharacter ) | |
909 { | |
910 if ( pPlayers[uActiveCharacter]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
911 { | |
912 v124 = -1; | |
913 curr_seq_num = _evt->v11 - 1; | |
914 } | |
915 } | |
916 } | |
917 else if ( player_choose == 5 )//all | |
918 { | |
919 v130=0; | |
920 for(int i = 1; i < 5; ++i) | |
921 { | |
922 if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) | |
923 { | |
924 v124 = -1; | |
925 curr_seq_num = _evt->v11 - 1; | |
926 break; | |
927 } | |
928 ++v130; | |
929 } | |
930 } | |
931 else if ( player_choose == 6 ) //random | |
932 { | |
1817
0f1543750bf8
Changing itemlist accesses to helper functions + getting rid of some pPlayers array accesses
Grumpy7
parents:
1736
diff
changeset
|
933 if ( pPlayers[rand() % 4 + 1]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) |
1490 | 934 { |
935 v124 = -1; | |
936 curr_seq_num = _evt->v11 - 1; | |
937 } | |
938 } | |
939 ++curr_seq_num; | |
940 v4 = v124; | |
941 break; | |
942 case EVENT_IsActorAlive: | |
943 if (IsActorAlive(EVT_BYTE(_evt->v5), EVT_DWORD(_evt->v6), EVT_BYTE(_evt->v10))) | |
944 { | |
945 v124 = -1; | |
946 curr_seq_num = _evt->v11 - 1; | |
947 } | |
948 ++curr_seq_num; | |
949 v4 = v124; | |
950 break; | |
951 case EVENT_Substract: | |
952 pValue = EVT_DWORD(_evt->v7); | |
2025 | 953 /*if ( EVT_WORD(_evt->v5) == VAR_PlayerItemInHands ) |
1490 | 954 { |
955 if ( pParty->pPickedItem.uItemID == pValue )//In hand | |
956 { | |
957 pMouse->RemoveHoldingItem(); | |
958 ++curr_seq_num; | |
959 v4 = v124; | |
960 break; | |
961 } | |
2024 | 962 //v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix.data(); |
1490 | 963 for ( v65 = 0; v65 < 126; ++v65 ) |
964 { | |
2025 | 965 v67 = &pPlayers[uActiveCharacter]->pInventoryMatrix[v65]; |
966 if ( v67 > 0 ) | |
1490 | 967 { |
2025 | 968 if ( pPlayers[uActiveCharacter]->pInventoryItemList[v67 - 1].uItemID == pValue ) |
969 { | |
970 pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65); | |
971 //++curr_seq_num; | |
972 //v4 = v124; | |
973 goto substract; | |
974 } | |
1490 | 975 } |
2024 | 976 //v67 += 4; |
1490 | 977 } |
2024 | 978 //while ( (signed int)v65 < 126 ); |
2025 | 979 //v69 = (int)&pPlayers[uActiveCharacter]->pEquipment.pIndices; |
1490 | 980 for ( v68 = 0; v68 < 16; ++v68 ) |
981 { | |
2025 | 982 if ( pPlayers[uActiveCharacter]->pInventoryItemList[pPlayers[uActiveCharacter]->pEquipment.pIndices[v68]].uItemID == pValue ) |
1490 | 983 { |
2025 | 984 pPlayers[uActiveCharacter]->pEquipment.pIndices[v68] = 0; |
985 //++curr_seq_num; | |
986 //v4 = v124; | |
987 goto substract; | |
1490 | 988 } |
2025 | 989 //v69 += 4; |
1490 | 990 } |
991 for (int i = 1; i < 5; i++) | |
992 { | |
2024 | 993 //v72 = (int)pPlayers[i]->pInventoryMatrix.data(); |
1490 | 994 for ( int v71 = 0; v71 < 126; ++v71 ) |
995 { | |
2025 | 996 v72 = &pPlayers[i]->pInventoryMatrix[v71]; |
997 if ( v72 > 0 ) | |
1490 | 998 { |
2025 | 999 if ( pPlayers[i]->pInventoryItemList[v72 - 1].uItemID == pValue ) |
1000 { | |
1001 pPlayers[i]->RemoveItemAtInventoryIndex(v71); | |
1002 goto substract; | |
1003 } | |
1490 | 1004 } |
2024 | 1005 //v72 += 4; |
1490 | 1006 } |
2025 | 1007 for ( v73 = 0; v73 < 16; ++v73 ) |
1490 | 1008 { |
2025 | 1009 //v74 = (int)&pPlayers[i]->pEquipment; |
1010 if (pPlayers[i]->pEquipment.pIndices[v73]) | |
1011 { | |
1012 if (pPlayers[i]->pInventoryItemList[pPlayers[i]->pEquipment.pIndices[v73] - 1].uItemID == pValue ) | |
1013 { | |
1014 pPlayers[i]->pEquipment.pIndices[v73] = 0; | |
1015 //v74 += 4; | |
1016 goto substract; | |
1017 } | |
1018 } | |
1490 | 1019 } |
1020 } | |
2025 | 1021 }*/ |
1490 | 1022 if ( player_choose <= 3 ) |
2025 | 1023 pParty->pPlayers[player_choose].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1024 else if ( player_choose == 4 ) //active |
1025 { | |
1026 if ( uActiveCharacter ) | |
2025 | 1027 pPlayers[uActiveCharacter]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1028 } |
1029 else if ( player_choose == 5 )//all | |
1030 { | |
1031 for(int i = 1; i < 5; ++i) | |
1032 { | |
1820
af7f08135ffb
Player::SubtractVariable changing return val to void, finishing cleanup
Grumpy7
parents:
1817
diff
changeset
|
1033 pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1034 } |
1035 } | |
1036 else if ( player_choose == 6 ) //random | |
1037 { | |
1038 player_choose = rand() % 4; | |
2025 | 1039 pParty->pPlayers[player_choose].SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1040 } |
2025 | 1041 //substract: |
1490 | 1042 ++curr_seq_num; |
1043 v4 = v124; | |
1044 break; | |
1045 case EVENT_Set: | |
1046 pValue = EVT_DWORD(_evt->v7); | |
1047 if ( player_choose <= 3 ) | |
2025 | 1048 pParty->pPlayers[player_choose].SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1049 else if ( player_choose == 4 ) //active |
1050 { | |
1051 if ( uActiveCharacter ) | |
2025 | 1052 pPlayers[uActiveCharacter]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1053 } |
1054 else if ( player_choose == 5 )//all | |
1055 { | |
525 | 1056 //recheck v130 |
2025 | 1057 for ( int i = 1; i < 5; ++i ) |
1490 | 1058 pPlayers[i]->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1059 } | |
1060 else if ( player_choose == 6 ) //random | |
1061 { | |
1062 player_choose = rand() % 4; | |
1063 pPlayer = &pParty->pPlayers[player_choose]; | |
1064 pPlayer->SetVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1065 } | |
2025 | 1066 ++curr_seq_num; |
1067 v4 = v124; | |
1068 break; | |
1490 | 1069 case EVENT_Add: |
1070 pValue = EVT_DWORD(_evt->v7); | |
1071 if ( player_choose <= 3 ) | |
1072 { | |
1073 pPlayer = &pParty->pPlayers[player_choose]; | |
1074 pPlayer->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1075 } | |
1076 else if ( player_choose == 4 ) //active | |
1077 { | |
1078 if ( uActiveCharacter ) | |
2025 | 1079 pPlayers[uActiveCharacter]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1080 } |
1081 else if ( player_choose == 5 )//all | |
1082 { | |
1083 for(int i = 1; i < 5; ++i) | |
1084 pPlayers[i]->AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); | |
1085 } | |
1086 else if ( player_choose == 6 ) //random | |
1087 { | |
1088 player_choose = rand() % 4; | |
2025 | 1089 pParty->pPlayers[player_choose].AddVariable((enum VariableType)EVT_WORD(_evt->v5), pValue); |
1490 | 1090 } |
2025 | 1091 v83 = EVT_WORD(_evt->v5); |
1092 if (v83 == 21 || // gold well on emerald isle | |
1093 v83 == 22 || v83 == 23 || v83 == 24 ) | |
1094 { | |
1095 //__debugbreak(); // bonfire | |
1096 viewparams->bRedrawGameUI = true; | |
1097 } | |
1098 ++curr_seq_num; | |
1099 v4 = v124; | |
1100 break; | |
1490 | 1101 case EVENT_InputString: |
1102 if ( !entry_line ) | |
1103 { | |
1104 strcpy(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[EVT_DWORD(_evt->v5 )]]); | |
1105 v105 = curr_seq_num; | |
1106 v121 = 26; | |
307 | 1107 LABEL_295: |
1490 | 1108 sub_4451A8_press_any_key(uEventID, v105, v121); |
307 | 1109 LABEL_301: |
1490 | 1110 if ( v133 == 1 ) |
1111 OnMapLeave(); | |
1112 return; | |
1113 } | |
1114 v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1115 if ( !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) | |
1116 || !_stricmp(GameUI_Footer_TimedString.data(), &pLevelStr[pLevelStrOffsets[v84]]) ) | |
1117 { | |
1118 v11 = _evt->v17; | |
307 | 1119 LABEL_130: |
1490 | 1120 //v124 = -1; |
307 | 1121 LABEL_131: |
1490 | 1122 curr_seq_num = v11 - 1; |
1123 } | |
1124 ++curr_seq_num; | |
1125 v4 = v124; | |
1126 | |
1127 //v6 = v123; | |
1128 //v7 = ""; | |
1129 break; | |
1130 case EVENT_RandomGoTo: | |
1131 //v124 = -1; | |
1132 v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) | |
1133 + (_evt->v10 != 0))); | |
525 | 1134 curr_seq_num = v11 - 1; |
787 | 1135 ++curr_seq_num; |
1136 v4 = v124; | |
1137 break; | |
1490 | 1138 case EVENT_ReceiveDamage: |
1139 v85 = EVT_DWORD(_evt->v7 ); | |
1140 v86 = _evt->v5; | |
1141 if ( (unsigned __int8)v86 <= 3 ) | |
1142 { | |
1143 v119 = _evt->v6; | |
1144 v115 = EVT_DWORD(_evt->v7 ); | |
1145 v89 = (unsigned __int8)v86; | |
1146 v88 = &pParty->pPlayers[v89]; | |
1147 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); | |
1148 ++curr_seq_num; | |
1149 v4 = v124; | |
1150 break; | |
1151 } | |
1152 if ( v86 == 4 ) | |
1153 { | |
1154 if ( !uActiveCharacter ) | |
1155 { | |
1156 ++curr_seq_num; | |
1157 v4 = v124; | |
1158 | |
1159 //v6 = v123; | |
1160 //v7 = ""; | |
1161 break; | |
1162 } | |
1163 v119 = _evt->v6; | |
1164 v88 = pPlayers[uActiveCharacter]; | |
1165 v115 = EVT_DWORD(_evt->v7 ); | |
1166 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); | |
1167 ++curr_seq_num; | |
1168 v4 = v124; | |
1169 break; | |
1170 } | |
1171 if ( v86 != 5 ) | |
1172 { | |
1173 v119 = _evt->v6; | |
1174 v115 = EVT_DWORD(_evt->v7 ); | |
1175 v89 = rand() % 4; | |
1176 v88 = &pParty->pPlayers[v89]; | |
1177 v88->ReceiveDamage(v115, (DAMAGE_TYPE)v119); | |
1178 ++curr_seq_num; | |
1179 v4 = v124; | |
1180 | |
1181 //v6 = v123; | |
1182 //v7 = ""; | |
1183 break; | |
1184 } | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1828
diff
changeset
|
1185 v87 = pParty->pPlayers.data(); |
1490 | 1186 do |
1187 { | |
1188 v87->ReceiveDamage(v85, (DAMAGE_TYPE)_evt->v6); | |
1189 ++v87; | |
1190 } | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1828
diff
changeset
|
1191 while ( (signed int)v87 < (signed int)pParty->pHirelings.data() ); |
1490 | 1192 ++curr_seq_num; |
1193 v4 = v124; | |
1194 | |
1195 //v6 = v123; | |
1196 //v7 = ""; | |
1197 break; | |
1198 case EVENT_ToggleIndoorLight: | |
1199 pIndoor->ToggleLight(EVT_DWORD(_evt->v5 ), _evt->v9); | |
1200 ++curr_seq_num; | |
1201 v4 = v124; | |
1202 | |
1203 //v6 = v123; | |
1204 //v7 = ""; | |
1205 break; | |
1206 case EVENT_SetFacesBit: | |
1207 sub_44892E_set_faces_bit(EVT_DWORD(_evt->v5),EVT_DWORD(_evt->v9), _evt->v13); | |
1208 ++curr_seq_num; | |
1209 v4 = v124; | |
1210 | |
1211 //v6 = v123; | |
1212 //v7 = ""; | |
1213 break; | |
1214 case EVENT_ToggleChestFlag: | |
1215 Chest::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); | |
1216 ++curr_seq_num; | |
1217 v4 = v124; | |
1218 | |
1219 //v6 = v123; | |
1220 //v7 = ""; | |
1221 break; | |
1222 case EVENT_ToggleActorFlag: | |
1223 Actor::ToggleFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); | |
1224 ++curr_seq_num; | |
1225 v4 = v124; | |
1226 | |
1227 //v6 = v123; | |
1228 //v7 = ""; | |
1229 break; | |
1230 case EVENT_ToggleActorGroupFlag: | |
1231 ToggleActorGroupFlag(EVT_DWORD(_evt->v5 ), EVT_DWORD(_evt->v9 ), _evt->v13); | |
1232 ++curr_seq_num; | |
1233 v4 = v124; | |
1234 | |
1235 //v6 = v123; | |
1236 //v7 = ""; | |
1237 break; | |
1238 case EVENT_SetSnow: | |
1239 if ( !_evt->v5 ) | |
1240 pWeather->bRenderSnow = _evt->v6 != 0; | |
1241 ++curr_seq_num; | |
1242 v4 = v124; | |
1243 | |
1244 //v6 = v123; | |
1245 //v7 = ""; | |
1246 break; | |
1247 case EVENT_StatusText: | |
1248 v90 = EVT_DWORD(_evt->v5 ); | |
1249 if ( activeLevelDecoration ) | |
1250 { | |
1251 if ( activeLevelDecoration == (LevelDecoration*)1 ) | |
1252 { | |
1253 current_npc_text = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; | |
1254 } | |
1255 if ( canShowMessages == 1 ) | |
1256 { | |
1257 v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; | |
1258 //LABEL_248: | |
1259 ShowStatusBarString(v91, 2u); | |
1260 } | |
1261 } | |
1262 else | |
1263 { | |
1264 if ( canShowMessages == 1 ) | |
1265 { | |
1266 v91 = &pLevelStr[pLevelStrOffsets[v90]]; | |
1267 ShowStatusBarString(v91, 2u); | |
1268 } | |
1269 } | |
1270 ++curr_seq_num; | |
1271 v4 = v124; | |
1272 | |
1273 //v6 = v123; | |
1274 //v7 = ""; | |
1275 break; | |
1276 case EVENT_ShowMessage: | |
1277 v92 = EVT_DWORD(_evt->v5 ); | |
1278 if ( activeLevelDecoration ) | |
1279 { | |
1280 v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; | |
1281 byte_5B0938[0] = 0; | |
1282 current_npc_text = v93; | |
1283 } | |
1284 else | |
1285 { | |
1286 strcpy(byte_5B0938.data(), &pLevelStr[pLevelStrOffsets[v92]]); | |
1287 } | |
1288 ++curr_seq_num; | |
1289 v4 = v124; | |
1290 | |
1291 //v6 = v123; | |
1292 //v7 = ""; | |
1293 break; | |
1294 case EVENT_CastSpell: | |
835 | 1295 EventCastSpell(_evt->v5, _evt->v6, _evt->v7, EVT_DWORD(_evt->v8 ), |
525 | 1296 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), |
1297 EVT_DWORD(_evt->v24 ), EVT_DWORD(_evt->v28 )); | |
835 | 1298 ++curr_seq_num; |
1299 v4 = v124; | |
1300 break; | |
1490 | 1301 case EVENT_SetTexture: |
1302 sub_44861E_set_texture(EVT_DWORD(_evt->v5 ), (char *)&_evt->v9); | |
1303 ++curr_seq_num; | |
1304 v4 = v124; | |
1305 | |
1306 //v6 = v123; | |
1307 //v7 = ""; | |
1308 break; | |
1309 case EVENT_SetSprite: | |
1310 SetDecorationSprite(EVT_DWORD(_evt->v5 ), _evt->v9, (char *)&_evt->v10); | |
1311 ++curr_seq_num; | |
1312 v4 = v124; | |
1313 | |
1314 //v6 = v123; | |
1315 //v7 = ""; | |
1316 break; | |
1317 case EVENT_SummonMonsters: | |
1318 sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7,EVT_DWORD(_evt->v8 ), | |
525 | 1319 EVT_DWORD(_evt->v12 ), EVT_DWORD(_evt->v16 ), EVT_DWORD(_evt->v20 ), |
1320 EVT_DWORD(_evt->v24 )); | |
1490 | 1321 ++curr_seq_num; |
1322 v4 = v124; | |
1323 | |
1324 //v6 = v123; | |
1325 //v7 = ""; | |
1326 break; | |
1327 case EVENT_MouseOver: | |
1328 case EVENT_LocationName: | |
1329 --curr_seq_num; | |
1330 ++curr_seq_num; | |
1331 v4 = v124; | |
1332 | |
1333 //v6 = v123; | |
1334 //v7 = ""; | |
1335 break; | |
1336 case EVENT_ChangeDoorState: | |
2085 | 1337 Door_switch_animation(_evt->v5, _evt->v6); |
1490 | 1338 ++curr_seq_num; |
1339 v4 = v124; | |
1340 break; | |
1341 case EVENT_OpenChest: | |
1342 if ( !Chest::Open(_evt->v5) ) | |
1343 goto LABEL_301; | |
1344 ++curr_seq_num; | |
1345 v4 = v124; | |
1346 | |
1347 //v6 = v123; | |
1348 //v7 = ""; | |
1349 break; | |
1350 case EVENT_MoveToMap: | |
1351 v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1352 v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1353 v132 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1354 v126 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1355 v129 = _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8); | |
1356 v95 = _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8); | |
1357 v96 = _evt->v25; | |
1358 v97 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); | |
1359 v134 = v96 + ((_evt->v26 + ((_evt->v27 + ((uint)_evt->v28 << 8)) << 8)) << 8); | |
1360 if ( _evt->v29 || _evt->v30 ) | |
1361 { | |
2153 | 1362 pRenderer->Sub01(); |
1490 | 1363 TransitionUI_Load(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); |
1364 dword_5C3418 = uEventID; | |
1365 dword_5C341C = curr_seq_num + 1; | |
1366 goto LABEL_301; | |
1367 } | |
1368 _5B65AC_npcdata_fame_or_other = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1369 _5B65A8_npcdata_uflags_or_other = v94; | |
1370 _5B65B0_npcdata_rep_or_other = v126; | |
1371 if ( v129 == -1 ) | |
1372 { | |
1373 v98 = _5B65B4_npcdata_loword_house_or_other; | |
1374 } | |
1375 else | |
1376 { | |
1377 v98 = v129 & stru_5C6E00->uDoublePiMask; | |
1378 _5B65B4_npcdata_loword_house_or_other = v129 & stru_5C6E00->uDoublePiMask; | |
1379 } | |
1380 v99 = (char *)&_evt->v31; | |
1381 _5B65B8_npcdata_hiword_house_or_other = v95; | |
1382 dword_5B65BC = v97; | |
1383 v100 = v94 | v132 | v126 | v95 | v97 | v98; | |
1384 dword_5B65C0 = v100; | |
1385 if ( *v99 == 48 ) | |
1386 { | |
1387 if ( v100 ) | |
1388 { | |
1389 pParty->vPosition.x = v135; | |
1390 pParty->vPosition.y = v132; | |
1391 pParty->vPosition.z = v126; | |
1392 pParty->uFallStartY = v126; | |
1393 if ( _5B65B4_npcdata_loword_house_or_other != -1 ) | |
1394 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; | |
1395 _5B65B4_npcdata_loword_house_or_other = -1; | |
1396 v120 = 0; | |
1397 v116 = 0; | |
1398 v111 = 0; | |
1399 v110 = 0; | |
1400 v109 = -1; | |
1401 v108 = 0; | |
1402 v107 = 0; | |
1403 pParty->sRotationX = v95; | |
1404 pParty->uFallSpeed = v134; | |
1405 dword_5B65C0 = 0; | |
1406 dword_5B65BC = 0; | |
1407 _5B65B8_npcdata_hiword_house_or_other = 0; | |
1408 _5B65B0_npcdata_rep_or_other = 0; | |
1409 _5B65AC_npcdata_fame_or_other = 0; | |
1410 _5B65A8_npcdata_uflags_or_other = 0; | |
1411 v106 = 232; | |
307 | 1412 LABEL_280: |
1490 | 1413 pAudioPlayer->PlaySound((SoundID)v106, v107, v108, v109, v110, v111, v116, v120); |
1414 } | |
1415 } | |
1416 else | |
1417 { | |
1418 pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((activeLevelDecoration == NULL) + 1); | |
2101 | 1419 Transition_StopSound_Autosave(v99, MapStartPoint_Party); |
1490 | 1420 v133 = 1; |
1421 if ( pCurrentScreen == SCREEN_HOUSE ) | |
1422 { | |
2124 | 1423 if ( uGameState == GAME_STATE_CHANGE_LOCATION ) |
1490 | 1424 { |
1425 pAudioPlayer->StopChannels(-1, -1); | |
1426 dialog_menu_id = HOUSE_DIALOGUE_NULL; | |
1919 | 1427 while ( HouseDialogPressCloseBtn() ) |
1490 | 1428 ; |
1429 pVideoPlayer->Unload(); | |
1430 window_SpeakInHouse->Release(); | |
1431 window_SpeakInHouse = 0; | |
1432 if ( pMessageQueue_50CBD0->uNumMessages ) | |
1433 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1434 pCurrentScreen = SCREEN_GAME; | |
1435 viewparams->bRedrawGameUI = 1; | |
1436 pDialogueNPCCount = 0; | |
1437 pDialogueWindow->Release(); | |
1438 dialog_menu_id = HOUSE_DIALOGUE_NULL; | |
1439 pDialogueWindow = 0; | |
1440 pIcons_LOD->SyncLoadedFilesCount(); | |
1441 } | |
1442 OnMapLeave(); | |
1443 return; | |
1444 } | |
1445 } | |
1446 ++curr_seq_num; | |
1447 v4 = v124; | |
1448 | |
1449 //v6 = v123; | |
1450 //v7 = ""; | |
1451 break; | |
1452 case EVENT_PlaySound: | |
1453 v120 = 0; | |
1454 v116 = 0; | |
1455 v111 = 0; | |
1456 v110 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); | |
1457 v109 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | |
1458 v108 = 0; | |
1459 v107 = 0; | |
1460 v106 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); | |
1461 goto LABEL_280; | |
1462 case EVENT_GiveItem: | |
1463 item.Reset(); | |
1464 //v101 = &pSomeEVT[v9]; | |
1465 v102 = _evt->v7 | |
1466 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); | |
1467 pItemsTable->GenerateItem(_evt->v5, _evt->v6, &item); | |
1468 if ( v102 ) | |
1469 item.uItemID = v102; | |
1470 pParty->SetHoldingItem(&item); | |
1471 ++curr_seq_num; | |
1472 v4 = v124; | |
1473 //v6 = v123; | |
1474 //v7 = ""; | |
1475 break; | |
1476 case EVENT_SpeakInHouse: | |
1477 if ( EnterHouse((enum HOUSE_ID)EVT_DWORD(_evt->v5))) | |
1478 { | |
2153 | 1479 pRenderer->Sub01(); |
1490 | 1480 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); |
1481 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); | |
1482 v104 = 187; | |
1483 if ( uCurrentHouse_Animation != 167 ) | |
1484 v104 = EVT_DWORD(_evt->v5); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2153
diff
changeset
|
1485 window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_HouseInterior, v104, 0); |
1490 | 1486 window_SpeakInHouse->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); |
1487 window_SpeakInHouse->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
1488 window_SpeakInHouse->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
1489 window_SpeakInHouse->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
1490 window_SpeakInHouse->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); | |
1491 } | |
1492 ++curr_seq_num; | |
1493 v4 = v124; | |
1494 | |
1495 //v6 = v123; | |
1496 //v7 = ""; | |
1497 break; | |
1498 case EVENT_PressAnyKey: | |
1499 v121 = 33; | |
1500 v105 = curr_seq_num + 1; | |
1501 goto LABEL_295; | |
1502 case EVENT_Exit: | |
1503 if ( v133 == 1 ) | |
1504 OnMapLeave(); | |
1505 return; | |
1506 default: | |
1507 ++curr_seq_num; | |
1508 v4 = v124; | |
1509 | |
1510 //v6 = v123; | |
1511 //v7 = ""; | |
1512 break; | |
1513 } | |
1514 } | |
1515 ++v4; | |
1516 v124 = v4; | |
1517 if ( v4 >= uSomeEVT_NumEvents ) | |
1518 goto LABEL_301; | |
1519 //} | |
1520 } | |
1521 } | |
307 | 1522 |
1295 | 1523 //----- (00444732) -------------------------------------------------------- |
1524 char *GetEventHintString(unsigned int uEventID) | |
1525 { | |
1526 signed int event_index; // edx@1 | |
1527 int event_pos; // esi@4 | |
1528 char *result; // eax@6 | |
1529 unsigned int str_index; // eax@9 | |
1530 int i; // esi@11 | |
1531 _evt_raw* test_evt; | |
1532 _evt_raw* last_evt; | |
1533 | |
1534 event_index = 0; | |
1535 if ( uLevelEVT_NumEvents <= 0 ) | |
1536 return NULL; | |
1490 | 1537 |
1295 | 1538 //v2 = (char *)&pLevelEVT_Index[0].uEventOffsetInEVT; |
1539 while ( 1 ) | |
1540 { | |
1541 if ( pLevelEVT_Index[event_index].uEventID == uEventID ) | |
1542 { | |
1490 | 1543 test_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; |
1544 last_evt=test_evt; | |
1295 | 1545 event_pos = pLevelEVT_Index[event_index+1].uEventOffsetInEVT; |
1546 if ( test_evt->_e_type == EVENT_MouseOver ) | |
1547 break; | |
1548 } | |
1549 ++event_index; | |
1550 if ( event_index >= uLevelEVT_NumEvents ) | |
1551 return NULL; | |
1552 } | |
1490 | 1553 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; |
1295 | 1554 if ( test_evt->_e_type== EVENT_SpeakInHouse ) |
1555 { | |
1556 str_index = EVT_DWORD(test_evt->v5); | |
1557 result = (char *)p2DEvents[str_index - 1].pName; | |
1558 } | |
1559 else | |
1560 { | |
1561 for ( i = event_index+1; pLevelEVT_Index[i].uEventID == uEventID; ++i ) | |
1562 { | |
1563 event_pos = pLevelEVT_Index[i].uEventOffsetInEVT; | |
1490 | 1564 test_evt=(_evt_raw*)&pLevelEVT[event_pos]; |
1295 | 1565 if ( test_evt->_e_type == EVENT_SpeakInHouse ) |
1566 { | |
1567 str_index = EVT_DWORD(test_evt->v5); | |
1568 if ( str_index < 600 ) | |
1569 return (char *)p2DEvents[str_index - 1].pName; | |
1570 } | |
1571 } | |
1572 result = &pLevelStr[pLevelStrOffsets[EVT_BYTE(last_evt->v5)]]; | |
1573 } | |
1490 | 1574 |
1295 | 1575 return result; |
1576 } |