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