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