Mercurial > mm7
annotate mm7_2.cpp @ 1478:251111bac49f
Merge
author | Nomad |
---|---|
date | Wed, 28 Aug 2013 18:43:31 +0200 |
parents | 7ef4b64f6329 |
children | 61451d5980bf 86cb7398d2a8 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1150
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1150
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1150
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1150
diff
changeset
|
4 |
0 | 5 #include <io.h> |
6 #include <direct.h> | |
7 #include <assert.h> | |
1016 | 8 #include <windows.h> |
9 | |
10 | |
1262 | 11 #include "Texture.h" |
12 #include "mm7_data.h" | |
1016 | 13 #include "VideoPlayer.h" |
14 #include "Sprites.h" | |
15 #include "BSPModel.h" | |
16 #include "OutdoorCamera.h" | |
17 | |
18 #include "LightmapBuilder.h" | |
19 #include "DecalBuilder.h" | |
20 #include "ParticleEngine.h" | |
21 #include "Mouse.h" | |
22 #include "Keyboard.h" | |
23 #include "CShow.h" | |
24 #include "GammaControl.h" | |
25 #include "stru6.h" | |
26 | |
27 #include "Vis.h" | |
0 | 28 #include "MapInfo.h" |
29 #include "Game.h" | |
30 #include "GUIWindow.h" | |
31 #include "GUIFont.h" | |
32 #include "Party.h" | |
33 #include "AudioPlayer.h" | |
34 #include "Outdoor.h" | |
35 #include "IndoorCamera.h" | |
36 #include "Overlays.h" | |
37 #include "Arcomage.h" | |
38 #include "LOD.h" | |
39 #include "Actor.h" | |
40 #include "Allocator.h" | |
41 #include "Events.h" | |
42 #include "Viewport.h" | |
43 #include "FrameTableInc.h" | |
44 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
45 #include "SpriteObject.h" |
0 | 46 #include "ObjectList.h" |
47 #include "Chest.h" | |
48 #include "PaletteManager.h" | |
49 #include "DecorationList.h" | |
50 #include "SaveLoad.h" | |
51 #include "stru123.h" | |
522 | 52 #include "stru176.h" |
0 | 53 #include "Time.h" |
54 #include "IconFrameTable.h" | |
55 #include "GUIProgressBar.h" | |
56 #include "Bink_Smacker.h" | |
57 #include "PlayerFrameTable.h" | |
58 #include "TurnEngine.h" | |
59 #include "FactionTable.h" | |
60 #include "StorylineTextTable.h" | |
61 #include "Random.h" | |
924 | 62 #include "CastSpellInfo.h" |
0 | 63 #include "stru298.h" |
64 #include "Events2D.h" | |
65 #include "Log.h" | |
1299 | 66 #include "UI\UIHouses.h" |
189 | 67 #include "texts.h" |
522 | 68 #include "MM7.h" |
1262 | 69 #include "Lights.h" |
0 | 70 |
71 //----- (004BB756) -------------------------------------------------------- | |
1413 | 72 int UseNPCSkill(NPCProf profession) |
0 | 73 { |
1413 | 74 switch (profession) |
75 { | |
76 case Healer: | |
77 { | |
78 for (int i = 0; i < 4; ++i) | |
79 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth(); | |
80 } | |
81 break; | |
82 | |
83 case ExpertHealer: | |
84 { | |
85 for (int i = 0; i < 4; ++i) | |
86 { | |
87 auto player = &pParty->pPlayers[i]; | |
88 player->sHealth = player->GetMaxHealth(); | |
89 | |
90 for (int j = 0; j < 14; ++j) | |
91 player->pConditions[i] = 0; | |
92 player->pConditions[18] = 0; | |
93 } | |
94 } | |
95 break; | |
96 | |
97 case MasterHealer: | |
98 { | |
99 for (int i = 0; i < 4; ++i) | |
100 { | |
101 auto player = &pParty->pPlayers[i]; | |
102 player->sHealth = player->GetMaxHealth(); | |
103 | |
104 auto v5 = LODWORD(player->pConditions[19]);//*((int *)v4 - 32); | |
105 auto v6 = HIDWORD(player->pConditions[19]);//*((int *)v4 - 31); | |
106 memset(player->pConditions, 0, 0xA0u); | |
107 | |
108 __debugbreak(); | |
109 *(int *)&player->pActiveSkills[8] = v5; | |
110 *(int *)&player->pActiveSkills[10] = v6; | |
111 } | |
112 } | |
113 break; | |
114 | |
115 case Cook: | |
116 { | |
117 if (pParty->uNumFoodRations >= 13) | |
118 return 1; | |
119 | |
120 Party::GiveFood(1); | |
121 } | |
122 break; | |
123 | |
124 case Chef: | |
125 { | |
126 if (pParty->uNumFoodRations >= 13) | |
127 return 1; | |
128 | |
129 if (pParty->uNumFoodRations == 13) | |
130 Party::GiveFood(1); | |
131 else | |
132 Party::GiveFood(2); | |
133 } | |
134 break; | |
135 | |
136 case WindMaster: | |
0 | 137 { |
1413 | 138 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
139 { | |
140 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); | |
141 pAudioPlayer->PlaySound(SOUND_203, 0, 0, -1, 0, 0, 0, 0); | |
142 } | |
143 else | |
144 { | |
145 auto v19 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | |
146 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + 60 * (256 * 2), 3, 1, v19, 0); | |
147 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags |= 1u; | |
148 pAudioPlayer->PlaySound(SOUND_11090, 0, 0, -1, 0, 0, 0, 0); | |
149 } | |
150 } | |
151 break; | |
152 | |
153 case WaterMaster: | |
154 { | |
155 auto v20 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | |
156 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + 60 * (256 * (2 + 1)), 3, 0, v20, 0); | |
157 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags |= 1u; | |
158 pAudioPlayer->PlaySound(SOUND_12040, 0, 0, -1, 0, 0, 0, 0); | |
159 } | |
160 break; | |
161 | |
162 case GateMaster: | |
163 { | |
164 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
165 dword_50C9DC = 195; | |
166 ptr_50C9E0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); | |
167 } | |
168 break; | |
169 | |
170 case Acolyte: _42777D_CastSpell_UseWand_ShootArrow(46, 0, 133, 0, 0); break; | |
171 case Piper: _42777D_CastSpell_UseWand_ShootArrow(51, 0, 133, 0, 0); break; | |
172 case FallenWizard: _42777D_CastSpell_UseWand_ShootArrow(86, 0, 133, 0, 0); break; | |
173 | |
174 case Teacher: | |
175 case Instructor: | |
176 case Armsmaster: | |
177 case Weaponsmaster: | |
178 case Apprentice: | |
179 case Mystic: | |
180 case Spellmaster: | |
181 case Trader: | |
182 case Merchant: | |
183 case Scout: | |
184 case Herbalist: | |
185 case Apothecary: | |
186 case Tinker: | |
187 case Locksmith: | |
188 case Fool: | |
189 case ChimneySweep: | |
190 case Porter: | |
191 case QuarterMaster: | |
192 case Factor: | |
193 case Banker: | |
194 case Horseman: | |
195 case Bard: | |
196 case Enchanter: | |
197 case Cartographer: | |
198 case Explorer: | |
199 case Pirate: | |
200 case Squire: | |
201 case Psychic: | |
202 case Gypsy: | |
203 case Diplomat: | |
204 case Duper: | |
205 case Burglar: | |
206 case Acolyte2: | |
207 case Initiate: | |
208 case Prelate: | |
209 case Monk: | |
210 case Sage: | |
211 case Hunter: | |
212 break; | |
213 | |
214 default: | |
215 assert(false && "Invalid enum value"); | |
216 } | |
217 return 0; | |
0 | 218 } |
219 | |
220 //----- (004BBA85) -------------------------------------------------------- | |
221 const char *sub_4BBA85_bounties() | |
222 { | |
223 int v0; // edi@1 | |
224 signed __int64 v1; // qax@2 | |
225 int i; // eax@2 | |
226 int v3; // edx@3 | |
227 int v4; // edi@14 | |
228 __int16 v5; // ax@14 | |
229 char v6; // zf@14 | |
230 Player *v7; // ebx@16 | |
231 const char *result; // eax@19 | |
232 | |
233 uDialogueType = 83; | |
234 pDialogueWindow->Release(); | |
235 pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0); | |
832 | 236 pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" |
945 | 237 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 238 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
239 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, UIMSG_0, 0x53u, 0, "", 0); | |
972 | 240 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 241 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
336 | 242 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); |
0 | 243 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) |
244 { | |
245 pParty->field_75A[v0] = 0; | |
630 | 246 __debugbreak(); // starting year-related constant here; |
0 | 247 v1 = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) |
248 * 0.033333335); | |
249 pParty->field_3C.field_0[2 * v0] = v1; | |
250 pParty->field_3C.field_0[2 * v0 + 1] = HIDWORD(v1); | |
251 for ( i = rand(); ; i = rand() ) | |
252 { | |
253 v3 = i % 258 + 1; | |
254 pParty->field_750[v0] = v3; | |
255 if ( (unsigned __int16)v3 < 0x73u || (unsigned __int16)v3 > 0x84u ) | |
256 { | |
257 if ( ((unsigned __int16)v3 < 0xEBu || (unsigned __int16)v3 > 0xFCu) | |
258 && ((unsigned __int16)v3 < 0x85u || (unsigned __int16)v3 > 0x96u) | |
259 && ((unsigned __int16)v3 < 0x97u || (unsigned __int16)v3 > 0xBAu) | |
260 && ((unsigned __int16)v3 < 0xC4u || (unsigned __int16)v3 > 0xC6u) ) | |
261 break; | |
262 } | |
263 } | |
264 } | |
265 v4 = v0; | |
266 v5 = pParty->field_750[v4]; | |
267 v6 = pParty->field_75A[v4] == 0; | |
268 word_F8B1A0 = pParty->field_750[v4]; | |
269 if ( v6 ) | |
270 { | |
271 v6 = v5 == 0; | |
272 result = pNPCTopics[351].pText; | |
273 if ( v6 ) | |
274 result = pNPCTopics[353].pText; | |
275 } | |
276 else | |
277 { | |
278 if ( v5 ) | |
279 { | |
280 party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v5].uLevel, 0); | |
281 v7 = pParty->pPlayers; | |
282 do | |
283 { | |
284 v7->SetVariable(VAR_Award, 86); | |
285 ++v7; | |
286 } | |
287 while ( (signed int)v7 < (signed int)pParty->pHirelings ); | |
288 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v4]].uLevel; | |
289 pParty->field_750[v4] = 0; | |
290 pParty->field_75A[v4] = 0; | |
291 } | |
292 result = pNPCTopics[352].pText; | |
293 } | |
294 dword_F8B1A4 = (char *)result; | |
295 return result; | |
296 } | |
297 | |
298 //----- (004BBCDD) -------------------------------------------------------- | |
1458 | 299 void sub_4BBCDD() |
0 | 300 { |
301 signed int v0; // ebp@3 | |
90 | 302 Actor *v1; // eax@4 |
0 | 303 __int16 v2; // cx@5 |
304 int v3; // esi@8 | |
305 Player *v4; // esi@14 | |
306 GUIButton *v5; // eax@18 | |
307 GUIButton *v6; // esi@19 | |
308 size_t v7; // [sp+10h] [bp-4h]@4 | |
309 | |
310 if ( pParty->field_7B5_in_arena_quest ) | |
311 { | |
312 if ( pParty->field_7B5_in_arena_quest == -1 ) | |
313 { | |
314 uDialogueType = 92; | |
315 } | |
316 else | |
317 { | |
318 v0 = 0; | |
90 | 319 if ( (signed int)uNumActors > 0 ) |
320 { | |
1202 | 321 v1 = pActors.data();//[0].uAIState; |
90 | 322 v7 = uNumActors; |
323 do | |
324 { | |
325 v2 = v1->uAIState; | |
848 | 326 if ( v1->uAIState == Dead || v2 == Removed || v2 == Disabled || (v3 = v1->uSummonerID) != 0 && PID_TYPE(v3) == OBJECT_Player) |
90 | 327 ++v0; |
328 ++v1; | |
329 --v7; | |
330 } | |
331 while ( v7 ); | |
332 } | |
333 if ( v0 >= (signed int)uNumActors || (signed int)uNumActors <= 0) | |
334 { | |
0 | 335 uDialogueType = 91; |
336 v4 = pParty->pPlayers; | |
337 ++*((char *)&pParty->field_75A[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1); | |
338 do | |
339 { | |
340 v4->SetVariable(VAR_Award, (unsigned __int8)pParty->field_7B5_in_arena_quest + 3); | |
341 ++v4; | |
342 } | |
343 while ( (signed int)v4 < (signed int)pParty->pHirelings ); | |
267 | 344 party_finds_gold(gold_transaction_amount, 0); |
0 | 345 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); |
346 pParty->field_7B5_in_arena_quest = -1; | |
347 } | |
348 else | |
349 { | |
350 uDialogueType = 90; | |
351 pParty->vPosition.x = 3849; | |
352 pParty->vPosition.y = 5770; | |
353 pParty->vPosition.z = 1; | |
354 pParty->uFallStartY = 1; | |
355 pParty->sRotationY = 512; | |
356 pParty->sRotationX = 0; | |
357 pParty->uFallSpeed = 0; | |
358 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); | |
359 } | |
360 } | |
361 } | |
362 else | |
363 { | |
364 uDialogueType = 89; | |
365 v5 = pDialogueWindow->pControlsHead; | |
366 if ( v5 ) | |
367 { | |
368 do | |
369 { | |
370 v6 = v5->pNext; | |
371 pAllocator->FreeChunk(v5); | |
372 v5 = v6; | |
373 } | |
374 while ( v6 ); | |
375 } | |
376 pDialogueWindow->pControlsHead = 0; | |
377 pDialogueWindow->pControlsTail = 0; | |
378 pDialogueWindow->uNumControls = 0; | |
832 | 379 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], |
945 | 380 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 381 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x55u, 0, "", 0); |
382 pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x56u, 0, "", 0); | |
383 pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x57u, 0, "", 0); | |
384 pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x58u, 0, "", 0); | |
972 | 385 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); |
0 | 386 } |
387 } | |
388 | |
389 //----- (004BC109) -------------------------------------------------------- | |
1458 | 390 void ArenaFight() |
0 | 391 { |
392 int v0; // edi@1 | |
393 char *v1; // eax@7 | |
394 Player *v2; // edi@9 | |
395 int v3; // eax@10 | |
396 signed int v4; // esi@10 | |
397 signed __int64 v5; // qax@18 | |
398 signed int v6; // ebx@34 | |
399 char *v7; // edi@34 | |
400 int v8; // eax@37 | |
401 int v9; // esi@43 | |
402 int v10; // eax@44 | |
403 unsigned __int8 v11; // sf@44 | |
404 unsigned __int8 v12; // of@44 | |
405 signed int v13; // eax@49 | |
406 int v14; // esi@49 | |
407 int v15; // edx@50 | |
408 int v16; // eax@51 | |
409 signed int v17; // ecx@51 | |
410 int v18; // edx@53 | |
411 int i; // edi@55 | |
412 int monster_y; // ST18_4@56 | |
413 int v21; // eax@56 | |
414 signed int v22; // [sp-4h] [bp-144h]@51 | |
415 __int16 v23[100]; // [sp+Ch] [bp-134h]@39 | |
416 GUIWindow window; // [sp+D4h] [bp-6Ch]@1 | |
417 __int16 monster_ids[6]; // [sp+128h] [bp-18h]@56 | |
418 int v26; // [sp+134h] [bp-Ch]@1 | |
419 int v27; // [sp+138h] [bp-8h]@23 | |
420 int num_monsters; // [sp+13Ch] [bp-4h]@17 | |
421 | |
422 v26 = 0; | |
423 pParty->field_7B5_in_arena_quest = uDialogueType; | |
424 memcpy(&window, pDialogueWindow, sizeof(window)); | |
819 | 425 window.uFrameWidth = game_viewport_width; |
0 | 426 window.uFrameZ = 452; |
427 v0 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[575], &window, 13, 0) + 7; | |
428 pRenderer->BeginSceneD3D(); | |
429 | |
430 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
431 pIndoor->Draw(); | |
432 else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
433 pOutdoor->Draw(); | |
434 | |
435 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); | |
436 pRenderer->BeginScene(); | |
437 if ( pRenderer->pRenderD3D ) | |
438 pRenderer->FillRectFast( | |
693 | 439 pViewport->uViewportTL_X, |
440 pViewport->uViewportTL_Y, | |
441 pViewport->uViewportBR_X - pViewport->uViewportTL_X, | |
442 pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, | |
0 | 443 pRenderer->uTargetGMask | pRenderer->uTargetBMask); |
444 | |
945 | 445 auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather); |
446 pRenderer->_4A6A68(8, 352 - v0, pTex, pTex->uTextureHeight - v0); | |
0 | 447 |
448 pRenderer->DrawTextureIndexed(8u, 347 - v0, pTexture_591428); | |
449 v1 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[575], pFontArrus, &window, 0xDu, 0); | |
450 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v0, 0, v1, 0, 0, 0); | |
451 pRenderer->EndScene(); | |
452 pRenderer->Present(); | |
453 pParty->vPosition.x = 3849; | |
454 pParty->vPosition.y = 5770; | |
455 pParty->vPosition.z = 1; | |
456 pParty->uFallStartY = 1; | |
457 pParty->sRotationY = 512; | |
458 pParty->sRotationX = 0; | |
459 pParty->uFallSpeed = 0; | |
437 | 460 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 461 { |
990 | 462 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 463 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
464 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
465 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 466 }*/ |
467 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
0 | 468 v2 = pParty->pPlayers; |
469 do | |
470 { | |
471 v3 = v2->GetActualLevel(); | |
472 v4 = v26; | |
473 if ( v3 > v26 ) | |
474 { | |
475 v26 = v2->GetActualLevel(); | |
476 v4 = v26; | |
477 } | |
478 ++v2; | |
479 } | |
480 while ( (signed int)v2 < (signed int)pParty->pHirelings ); | |
481 if ( uDialogueType == 85 ) | |
482 { | |
483 num_monsters = v4; | |
1416 | 484 v4 /= 2; |
485 } | |
486 else if ( uDialogueType == 86 ) | |
0 | 487 { |
488 v5 = (signed __int64)((double)v26 * 1.5); | |
1416 | 489 num_monsters = v5; |
490 v4 /= 2; | |
491 } | |
492 else if ( uDialogueType == 87 ) | |
0 | 493 { |
494 LODWORD(v5) = 2 * v4; | |
495 num_monsters = v5; | |
496 v4 /= 2; | |
1416 | 497 } |
0 | 498 else |
1416 | 499 { |
500 __debugbreak(); // warning C4700: uninitialized local variable 'v27' used | |
501 if ( uDialogueType == 88 ) | |
502 num_monsters = 2 * v4; | |
503 else | |
504 v4 = v27; | |
505 } | |
0 | 506 if ( v4 < 1 ) |
507 v4 = 1; | |
508 if ( v4 > 100 ) | |
509 v4 = 100; | |
510 if ( num_monsters > 100 ) | |
511 num_monsters = 100; | |
512 if ( v4 < 2 ) | |
513 v4 = 2; | |
514 if ( num_monsters < 2 ) | |
515 num_monsters = 2; | |
516 v6 = 0; | |
517 v27 = 1; | |
518 v7 = (char *)&pMonsterStats->pInfos[1].uLevel; | |
519 do | |
520 { | |
521 if ( v7[8] != 1 ) | |
522 { | |
523 if ( !MonsterStats::BelongsToSupertype(*((short *)v7 + 22), MONSTER_SUPERTYPE_8) ) | |
524 { | |
525 v8 = (unsigned __int8)*v7; | |
526 if ( v8 >= v4 ) | |
527 { | |
528 if ( v8 <= num_monsters ) | |
529 v23[v6++] = v27; | |
530 } | |
531 } | |
532 } | |
533 ++v27; | |
534 v7 += 88; | |
535 } | |
536 while ( (signed int)v7 <= (signed int)&pMonsterStats->pInfos[258].uLevel ); | |
537 num_monsters = 6; | |
538 if ( v6 < 6 ) | |
539 num_monsters = v6; | |
540 v9 = 0; | |
541 if ( num_monsters > 0 ) | |
542 { | |
543 do | |
544 { | |
545 v10 = rand(); | |
546 ++v9; | |
547 v12 = __OFSUB__(v9, num_monsters); | |
548 v11 = v9 - num_monsters < 0; | |
549 *((short *)&window.pControlsTail + v9 + 1) = v23[v10 % v6]; | |
550 } | |
551 while ( v11 ^ v12 ); | |
552 } | |
553 if ( uDialogueType == 85 ) | |
554 { | |
555 v16 = rand(); | |
556 v17 = 3; | |
557 v22 = 50; | |
1416 | 558 v18 = v16 % v17; |
559 v13 = v22; | |
560 v14 = v18 + 6; | |
561 } | |
562 else if ( uDialogueType == 86 ) | |
0 | 563 { |
564 v16 = rand(); | |
565 v17 = 7; | |
566 v22 = 100; | |
567 v18 = v16 % v17; | |
568 v13 = v22; | |
569 v14 = v18 + 6; | |
1416 | 570 } |
571 else if ( uDialogueType == 87 ) | |
0 | 572 { |
573 v15 = rand() % 11; | |
574 v13 = 200; | |
575 v14 = v15 + 10; | |
576 } | |
577 else | |
578 { | |
579 if ( uDialogueType == 88 ) | |
580 { | |
581 v13 = 500; | |
582 v14 = 20; | |
583 } | |
584 else | |
585 { | |
586 v14 = v27; | |
267 | 587 v13 = gold_transaction_amount; |
0 | 588 } |
589 } | |
590 i = 0; | |
267 | 591 for ( gold_transaction_amount = v26 * v13; i < v14; ++i ) |
0 | 592 { |
593 monster_y = pMonsterArenaPlacements[i].y; | |
594 v21 = rand(); | |
595 _4BBF61_summon_actor((unsigned __int16)monster_ids[v21 % num_monsters], pMonsterArenaPlacements[i].x, monster_y, 1); | |
596 } | |
597 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); | |
598 } | |
599 | |
600 //----- (004BD8B5) -------------------------------------------------------- | |
1459 | 601 int sub_4BD8B5() |
0 | 602 { |
603 int v0; // eax@4 | |
604 int v1; // eax@29 | |
605 unsigned int v2; // esi@30 | |
735 | 606 //const char *v3; // ebx@31 |
0 | 607 |
608 if ( pMessageQueue_50CBD0->uNumMessages ) | |
609 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1459 | 610 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); |
0 | 611 pKeyActionMap->ResetKeys(); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
612 activeLevelDecoration = NULL; |
827 | 613 current_npc_text = 0; |
459 | 614 if ( pDialogueNPCCount ) |
0 | 615 { |
607 | 616 v0 = dialog_menu_id; |
749 | 617 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD |
618 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_SELL | |
619 && dialog_menu_id != HOUSE_DIALOGUE_97 | |
620 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_REPAIR | |
621 && dialog_menu_id != HOUSE_DIALOGUE_SHOP_IDENTIFY | |
496 | 622 && ShopTexture ) |
623 { | |
624 ShopTexture->Release(); | |
607 | 625 v0 = dialog_menu_id; |
496 | 626 ShopTexture = 0; |
0 | 627 } |
628 if ( v0 && v0 != 1 ) | |
629 { | |
630 if ( v0 == -1 ) | |
631 { | |
459 | 632 _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); |
0 | 633 pVideoPlayer->_4BF5B2(); |
634 return 1; | |
635 } | |
636 if ( v0 != 94 && v0 != 96 && v0 != 101 ) | |
637 { | |
638 if ( v0 == 3 || v0 == 5 || v0 == 4 ) | |
639 { | |
423 | 640 UI_CreateEndConversationButton(); |
747 | 641 dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT; |
1411 | 642 InitializaDialogueOptions_Shops(in_current_building_type); |
0 | 643 } |
644 else | |
645 { | |
646 if ( v0 != 102 && v0 != 103 && v0 != 104 ) | |
647 { | |
648 pVideoPlayer->_4BF5B2(); | |
747 | 649 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
1411 | 650 InitializaDialogueOptions(in_current_building_type); |
0 | 651 return 1; |
652 } | |
653 pVideoPlayer->_4BF5B2(); | |
423 | 654 UI_CreateEndConversationButton(); |
747 | 655 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN; |
1411 | 656 InitializaDialogueOptions_Tavern(in_current_building_type); |
0 | 657 } |
658 return 1; | |
659 } | |
660 pVideoPlayer->_4BF5B2(); | |
423 | 661 UI_CreateEndConversationButton(); |
747 | 662 dialog_menu_id = HOUSE_DIALOGUE_MAIN; |
1411 | 663 InitializaDialogueOptions(in_current_building_type); |
589 | 664 return 1; |
0 | 665 } |
459 | 666 pDialogueNPCCount = 0; |
0 | 667 pDialogueWindow->Release(); |
747 | 668 dialog_menu_id = HOUSE_DIALOGUE_NULL; |
0 | 669 pDialogueWindow = 0; |
1006 | 670 pIcons_LOD->SyncLoadedFilesCount(); |
0 | 671 v1 = uNumDialogueNPCPortraits; |
672 if ( uNumDialogueNPCPortraits != 1 ) | |
673 { | |
674 v2 = 0; | |
336 | 675 pBtn_ExitCancel = window_SpeakInHouse->pControlsHead; |
0 | 676 if ( uNumDialogueNPCPortraits > 0 ) |
677 { | |
735 | 678 //v3 = byte_591180; |
0 | 679 do |
680 { | |
1211 | 681 dword_5913F4[v2] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2], |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
682 0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v2, 0, byte_591180[v2].data(), 0, 0, 0); |
0 | 683 v1 = uNumDialogueNPCPortraits; |
684 ++v2; | |
735 | 685 //v3 += 100; |
0 | 686 } |
687 while ( (signed int)v2 < uNumDialogueNPCPortraits ); | |
688 } | |
589 | 689 pVideoPlayer->_4BF5B2(); |
690 return 1; | |
0 | 691 } |
692 } | |
693 return 0; | |
694 } | |
695 | |
696 //----- (004BF91E) -------------------------------------------------------- | |
1458 | 697 unsigned int GameOverMenu(void *ecx0) |
0 | 698 { |
699 char *v1; // eax@2 | |
700 unsigned int result; // eax@3 | |
89 | 701 Player *v3; // eax@7 |
0 | 702 char *v4; // ST24_4@9 |
703 int v5; // eax@9 | |
704 char *v6; // eax@10 | |
705 char *v7; // edx@10 | |
706 char *v8; // ecx@12 | |
707 char *v9; // eax@14 | |
708 unsigned int v10; // eax@25 | |
709 GUIWindow pWindow; // [sp+34h] [bp-9Ch]@1 | |
710 MSG Msg; // [sp+88h] [bp-48h]@22 | |
711 unsigned int v14; // [sp+A4h] [bp-2Ch]@5 | |
712 void *v15; // [sp+A8h] [bp-28h]@1 | |
713 char *pInString; // [sp+ACh] [bp-24h]@5 | |
714 unsigned int v17; // [sp+B0h] [bp-20h]@5 | |
715 unsigned int v18; // [sp+B4h] [bp-1Ch]@5 | |
716 unsigned int v19; // [sp+B8h] [bp-18h]@5 | |
717 int v20; // [sp+BCh] [bp-14h]@7 | |
89 | 718 Player *i; // [sp+C0h] [bp-10h]@7 |
0 | 719 GUIFont *pFont; // [sp+C4h] [bp-Ch]@1 |
720 unsigned __int64 v23; // [sp+C8h] [bp-8h]@5 | |
721 | |
722 v15 = ecx0; | |
723 | |
724 RGBTexture _this; // [sp+Ch] [bp-C4h]@1 | |
725 //RGBTexture::RGBTexture(&this); | |
726 | |
727 BYTE1(dword_6BE364_game_settings_1) &= 0xBFu; | |
728 bGameoverLoop = 1; | |
729 pVideoPlayer->bStopBeforeSchedule = 0; | |
730 pAudioPlayer->StopChannels(-1, -1); | |
731 pRenderer->BeginScene(); | |
732 pRenderer->ClearBlack(); | |
733 pRenderer->EndScene(); | |
734 pRenderer->Present(); | |
165 | 735 pVideoPlayer->pResetflag = 0; |
484 | 736 _449B57_test_bit(pParty->_quest_bits, 99); |
0 | 737 _this.Load("winbg.pcx", 2); |
738 pRenderer->BeginScene(); | |
739 pRenderer->DrawTextureRGB(0, 0, &_this); | |
740 pRenderer->EndScene(); | |
741 free(_this.pPixels); | |
742 _this.pPixels = 0; | |
336 | 743 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); |
0 | 744 pWindow.uFrameX = 75; |
745 pWindow.uFrameY = 60; | |
746 pWindow.uFrameWidth = 469; | |
747 pWindow.uFrameHeight = 338; | |
748 pWindow.uFrameZ = 543; | |
749 pWindow.uFrameW = 397; | |
180 | 750 pFont = LoadFont("endgame.fnt", "FONTPAL", NULL); |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1330
diff
changeset
|
751 if ( pParty->IsPartyGood() ) |
0 | 752 { |
753 v1 = pGlobalTXT_LocalizationStrings[675]; | |
754 } | |
755 else | |
756 { | |
1359
60cdc3eac407
_449B57_test_bit(pParty->_quest_bits, 99) and _449B57_test_bit(pParty->_quest_bits, 100) changed to Party::IsPartyGood, Party::IsPartyEvil, respectively
Grumpy7
parents:
1330
diff
changeset
|
757 result = pParty->IsPartyEvil(); |
0 | 758 if ( !(short)result ) |
759 return result; | |
760 v1 = pGlobalTXT_LocalizationStrings[676]; | |
761 } | |
762 pInString = v1; | |
763 v23 = pParty->uTimePlayed - 138240; | |
764 v19 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 0x18; | |
765 v14 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 0x18 / 0x1C / 0xC; | |
766 v18 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 0x18 / 0x1C % 0xC; | |
767 v17 = v19 % 0x1C; | |
768 if ( !v19 ) | |
769 v19 = 1; | |
770 pRenderer->BeginScene(); | |
771 pWindow.DrawTitleText(pFont, 1u, 0x23u, 1u, pGlobalTXT_LocalizationStrings[9], 3u); | |
89 | 772 v3 = pParty->pPlayers;//[0].pName; |
0 | 773 v23 = 0i64; |
774 v20 = 0; | |
89 | 775 //for ( i = (int)pParty->pPlayers[0].pName; ; v3 = (char *)i ) |
776 for ( i = pParty->pPlayers; ; v3 = i ) | |
777 { | |
135 | 778 v4 = pClassNames[v3->classType]; |
89 | 779 v5 = v3->GetBaseLevel(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
780 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[129], i->pName, v5, v4); |
0 | 781 pWindow.DrawTitleText( |
782 pFont, | |
783 1u, | |
784 v20 * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46, | |
785 1u, | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
786 pTmpBuf.data(), |
0 | 787 3u); |
89 | 788 v23 += i->uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8)); |
0 | 789 ++v20; |
89 | 790 ++i; |
791 if ( i > &pParty->pPlayers[3] ) | |
0 | 792 break; |
793 } | |
794 v23 = (signed __int64)v23 / v19; | |
795 v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xCu, 0); | |
796 pWindow.DrawTitleText(pFont, 1u, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1u, v6, 0); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
797 strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]); |
0 | 798 v7 = pGlobalTXT_LocalizationStrings[56]; |
799 if ( v17 != 1 ) | |
800 v7 = pGlobalTXT_LocalizationStrings[57]; | |
801 v8 = pGlobalTXT_LocalizationStrings[146]; | |
802 if ( v18 != 1 ) | |
803 v8 = pGlobalTXT_LocalizationStrings[148]; | |
804 v9 = pGlobalTXT_LocalizationStrings[245]; | |
805 if ( v14 != 1 ) | |
806 v9 = pGlobalTXT_LocalizationStrings[132]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
807 sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
808 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
809 pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf.data(), 3u); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
810 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
811 pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight, 1u, pTmpBuf.data(), 3u); |
0 | 812 BYTE1(dword_6BE364_game_settings_1) |= 0x40u; |
813 pRenderer->EndScene(); | |
814 pRenderer->Present(); | |
815 if ( pRenderer->pRenderD3D ) | |
816 pRenderer->pBeforePresentFunction(); | |
817 pRenderer->_49F1BC("MM7_Win.Pcx"); | |
818 pAllocator->FreeChunk(pFont); | |
336 | 819 window_SpeakInHouse->Release(); |
820 window_SpeakInHouse = 0; | |
0 | 821 if ( v15 == (void *)2 ) |
822 { | |
823 result = pMessageQueue_50CBD0->uNumMessages; | |
824 } | |
825 else | |
826 { | |
827 LODWORD(v23) = GetTickCount() + 5000; | |
828 while ( (unsigned int)v23 > GetTickCount() ) | |
829 ; | |
830 while ( 1 ) | |
831 { | |
832 v10 = PeekMessageA(&Msg, 0, 0, 0, 1u); | |
833 if ( !v10 ) | |
834 break; | |
835 if ( Msg.message == 18 ) | |
836 Game_DeinitializeAndTerminate(0); | |
837 TranslateMessage(&Msg); | |
838 DispatchMessageA(&Msg); | |
839 } | |
840 if ( pMessageQueue_50CBD0->uNumMessages ) | |
841 { | |
842 LOBYTE(v10) = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
843 pMessageQueue_50CBD0->uNumMessages = v10; | |
844 } | |
845 pKeyActionMap->ResetKeys(); | |
846 pKeyActionMap->uLastKeyPressed = 0; | |
847 do | |
848 { | |
849 while ( PeekMessageA(&Msg, 0, 0, 0, 1u) ) | |
850 { | |
851 if ( Msg.message == 18 ) | |
852 Game_DeinitializeAndTerminate(0); | |
853 TranslateMessage(&Msg); | |
854 DispatchMessageA(&Msg); | |
855 } | |
856 } | |
857 while ( !pKeyActionMap->uLastKeyPressed ); | |
858 result = pMessageQueue_50CBD0->uNumMessages; | |
859 if ( pMessageQueue_50CBD0->uNumMessages ) | |
860 { | |
861 result = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
862 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
863 } | |
864 } | |
865 if ( v15 ) | |
866 { | |
437 | 867 /*if ( (signed int)result < 40 ) |
868 { | |
869 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit; | |
870 }*/ | |
871 pMessageQueue_50CBD0->AddMessage(UIMSG_Quit, 1, 0); | |
0 | 872 } |
873 else | |
874 { | |
437 | 875 pMessageQueue_50CBD0->AddMessage(UIMSG_ShowFinalWindow, 1, 0); |
876 /*if ( (signed int)result < 40 ) | |
877 { | |
878 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5; | |
0 | 879 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
880 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
881 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; | |
882 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 883 }*/ |
0 | 884 } |
885 bGameoverLoop = 0; | |
886 return result; | |
887 } | |
888 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1359
diff
changeset
|
889 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1359
diff
changeset
|
890 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1359
diff
changeset
|
891 |
0 | 892 |
893 //----- (00451007) -------------------------------------------------------- | |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
894 int stru350::sub_451007_scale_image_bicubic(unsigned short *pSrc, int srcWidth, int srcHeight, int srcPitch, //changing this to some library function might be a good idea |
0 | 895 unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch, |
896 int a10, int a11) | |
897 { | |
898 int result; // eax@1 | |
899 float v17; // ST3C_4@12 | |
900 float v18; // ST38_4@12 | |
901 unsigned int v19; // esi@12 | |
902 int v21; // eax@18 | |
903 unsigned int v22; // ecx@25 | |
904 unsigned int v23; // eax@29 | |
1146
b4ade2580ae3
sub_451007_scale_image_bicubic cleanup - some variable renaming, code shuffling
Grumpy7
parents:
1145
diff
changeset
|
905 unsigned int heightRatioPlusOne; // [sp+Ch] [bp-7Ch]@12 |
b4ade2580ae3
sub_451007_scale_image_bicubic cleanup - some variable renaming, code shuffling
Grumpy7
parents:
1145
diff
changeset
|
906 unsigned int widthRatio; // [sp+Ch] [bp-7Ch]@218 |
b4ade2580ae3
sub_451007_scale_image_bicubic cleanup - some variable renaming, code shuffling
Grumpy7
parents:
1145
diff
changeset
|
907 unsigned int heightRatio; // [sp+14h] [bp-74h]@12 |
b4ade2580ae3
sub_451007_scale_image_bicubic cleanup - some variable renaming, code shuffling
Grumpy7
parents:
1145
diff
changeset
|
908 unsigned int widthRatioPlusOne; // [sp+14h] [bp-74h]@218 |
0 | 909 int v160; // [sp+3Ch] [bp-4Ch]@13 |
910 unsigned __int16 *v175; // [sp+4Ch] [bp-3Ch]@13 | |
911 unsigned __int16 *v193; // [sp+5Ch] [bp-2Ch]@7 | |
912 signed int v231; // [sp+78h] [bp-10h]@7 | |
913 __int64 v240; // [sp+7Ch] [bp-Ch]@12 | |
914 unsigned int v251; // [sp+80h] [bp-8h]@218 | |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
915 unsigned int v252; // [sp+84h] [bp-4h]@218 |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
916 float a6s; // [sp+A0h] [bp+18h]@218 |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
917 float a6t; // [sp+A0h] [bp+18h]@218 |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
918 unsigned int a6b; // [sp+A0h] [bp+18h]@218 |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
919 int field_0_bits; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
920 int field_20_bits; |
1131
71ba92960bc5
banker's rounding template made as fast as before and a bit more safe
Grumpy7
parents:
1130
diff
changeset
|
921 |
1146
b4ade2580ae3
sub_451007_scale_image_bicubic cleanup - some variable renaming, code shuffling
Grumpy7
parents:
1145
diff
changeset
|
922 int field0value = this->field_0.field_C; |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
923 switch(field0value) |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
924 { |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
925 case 8: field_0_bits = 1; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
926 break; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
927 case 16: field_0_bits = 2; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
928 break; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
929 case 32: field_0_bits = 4; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
930 break; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
931 default: |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
932 return field0value; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
933 } |
1144
f544cd6f7168
sub_451007_scale_image_bicubic cleanup - preparations for further condition body extractions
Grumpy7
parents:
1140
diff
changeset
|
934 int field20value = this->field_20.field_C; |
f544cd6f7168
sub_451007_scale_image_bicubic cleanup - preparations for further condition body extractions
Grumpy7
parents:
1140
diff
changeset
|
935 switch(field20value) |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
936 { |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
937 case 8: field_20_bits = 1; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
938 break; |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
939 case 16: field_20_bits = 2; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
940 break; |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
941 case 32: field_20_bits = 4; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
942 break; |
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
943 default: |
1144
f544cd6f7168
sub_451007_scale_image_bicubic cleanup - preparations for further condition body extractions
Grumpy7
parents:
1140
diff
changeset
|
944 return field20value; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
945 } |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
946 |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
947 result = (int)pDst; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
948 v193 = pDst; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
949 v231 = 0; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
950 if ( dstHeight <= 0 ) |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
951 return result; |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
952 do |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
953 { |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
954 for (int counter = 0; counter < dstWidth; counter++) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
955 { |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
956 a6s = (double)counter / (double)dstWidth * (double)srcWidth; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
957 widthRatio = bankersRounding(a6s); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
958 a6t = (double)(counter + 1) / (double)dstWidth * (double)srcWidth; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
959 widthRatioPlusOne = bankersRounding(a6t); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
960 v17 = (double)v231 / (double)dstHeight * (double)srcHeight; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
961 heightRatio = bankersRounding(v17); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
962 v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
963 heightRatioPlusOne = bankersRounding(v18); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
964 v251 = 0; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
965 v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
966 v252 = 0; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
967 a6b = 0; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
968 v240 = 0i64; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
969 |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
970 v175 = (unsigned short*)((char *)pSrc + field_0_bits * (widthRatio + srcPitch * heightRatio)); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
971 for (int heightDiff = 0; heightDiff < heightRatioPlusOne - heightRatio; heightDiff++) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
972 { |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
973 int ratioDiff = widthRatioPlusOne - widthRatio; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
974 for(int i = 0; i < ratioDiff; i++) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
975 { |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
976 if(field0value == 32) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
977 v21 = _450FB1((int)v175[i]); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
978 else if(field0value == 16) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
979 v21 = _450FB1((_WORD)v175[i]); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
980 else |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
981 v21 = _450FB1((unsigned __int8)v175[i]); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
982 v240 += ((unsigned int)v21 >> 24); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
983 a6b += BYTE2(v21); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
984 v252 += BYTE1(v21); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
985 v251 += (unsigned __int8)v21; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
986 } |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
987 if(field0value == 32) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
988 v175 += 2 * srcPitch; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
989 else if(field0value == 16) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
990 v175 += srcPitch; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
991 else |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
992 v175 = (unsigned short*)((char *)v175 + 2 * srcPitch); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
993 } |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
994 v22 = (unsigned int)v240 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
995 if ( v19 ) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
996 { |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
997 a6b /= v19; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
998 v252 /= v19; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
999 v251 /= v19; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
1000 } |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
1001 if ( v22 != 255 ) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
1002 v22 &= 0x7FFFFFFFu; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
1003 v23 = _450F55(v251 | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8)); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
1004 *(_DWORD *)v193 = v23; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
1005 v193 = (unsigned __int16 *)((char *)v193 + field_20_bits); |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
1006 } |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
1007 v193 = (unsigned __int16 *)((char *)v193 + field_20_bits * (dstPitch - dstWidth)); |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
1008 ++v231; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
1009 result = v231; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
1010 } |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
1011 while(v231 < dstHeight); |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
1012 return result; |
0 | 1013 } |
1014 | |
1015 //----- (0044F57C) -------------------------------------------------------- | |
1016 void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5) | |
1017 { | |
1018 //MapInfo *v5; // esi@1 | |
1019 //SpawnPointMM7 *v6; // ebx@1 | |
1020 int v7; // eax@2 | |
1021 char v8; // zf@5 | |
1022 int v9; // edi@9 | |
1023 int v10; // eax@9 | |
1024 int v11; // ecx@9 | |
1025 int v12; // edx@9 | |
1026 int v13; // eax@9 | |
1027 int v14; // eax@14 | |
1028 int v15; // ecx@14 | |
1029 int v16; // eax@19 | |
1030 int v17; // ecx@19 | |
1031 int v18; // esi@31 | |
1032 //int pPosX; // ecx@32 | |
1033 //int v20; // edx@32 | |
1034 //int v21; // eax@32 | |
1035 Actor *pMonster; // esi@35 | |
1036 int v23; // edx@36 | |
1037 signed int v24; // edi@36 | |
1038 int v25; // ecx@36 | |
1039 unsigned __int16 v26; // ax@47 | |
1040 MonsterDesc *v27; // edi@48 | |
1041 signed int v28; // eax@48 | |
1042 __int16 v29; // cx@50 | |
1043 __int16 v30; // ax@50 | |
1044 __int16 v31; // ax@50 | |
1045 int v32; // eax@50 | |
1046 int v33; // edi@50 | |
1047 int v34; // eax@50 | |
1048 int v35; // eax@50 | |
1049 int v36; // eax@50 | |
1050 int v37; // eax@51 | |
1051 int v38; // eax@52 | |
1052 int v39; // edi@52 | |
1053 std::string v40; // [sp-18h] [bp-100h]@60 | |
1054 void *v41; // [sp-14h] [bp-FCh]@50 | |
1055 //void *v42; // [sp-10h] [bp-F8h]@50 | |
1056 //size_t v43; // [sp-Ch] [bp-F4h]@50 | |
1057 const char *v44; // [sp-8h] [bp-F0h]@13 | |
1058 char *pTexture; // [sp-4h] [bp-ECh]@9 | |
1059 char Str[32]; // [sp+Ch] [bp-DCh]@60 | |
1060 char Str2[120]; // [sp+2Ch] [bp-BCh]@29 | |
1061 unsigned int uFaceID; // [sp+A4h] [bp-44h]@52 | |
1062 MonsterInfo *Src; // [sp+A8h] [bp-40h]@50 | |
1063 int v50; // [sp+ACh] [bp-3Ch]@47 | |
1064 char Source[32]; // [sp+B0h] [bp-38h]@20 | |
1065 int v52; // [sp+D0h] [bp-18h]@34 | |
1066 int v53; // [sp+D4h] [bp-14h]@34 | |
1067 int pSector; // [sp+D8h] [bp-10h]@32 | |
1068 int pPosX; // [sp+DCh] [bp-Ch]@32 | |
1069 int v56; // [sp+E0h] [bp-8h]@8 | |
1070 int v57; // [sp+E4h] [bp-4h]@1 | |
1071 | |
1072 //auto a2 = spawn; | |
1073 v57 = 0; | |
1074 //v5 = pMapInfo; | |
1075 //v6 = spawn; | |
1076 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
1077 v7 = pOutdoor->ddm.field_C_alert; | |
1078 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
1079 v7 = pIndoor->dlv.field_C_alert; | |
1080 else | |
1081 v7 = 0; | |
1082 if (v7) | |
1083 v8 = (spawn->uAttributes & 1) == 0; | |
1084 else | |
1085 v8 = (spawn->uAttributes & 1) == 1; | |
1086 if (v8) | |
1087 return; | |
1088 //result = (void *)(spawn->uIndex - 1); | |
1089 v56 = 1; | |
1090 switch (spawn->uIndex - 1) | |
1091 { | |
1092 case 0u: | |
1093 v9 = pMapInfo->uEncounterMonster1AtLeast; | |
1094 v10 = rand(); | |
1095 v11 = pMapInfo->uEncounterMonster1AtMost; | |
1096 pTexture = pMapInfo->pEncounterMonster1Texture; | |
1097 v12 = v10 % (v11 - v9 + 1); | |
237 | 1098 v13 = pMapInfo->Dif_M1; |
1416 | 1099 v57 = v13; |
1100 v56 = v9 + v12; | |
1101 strcpy(Source, pTexture); | |
1102 break; | |
0 | 1103 case 3u: |
1104 pTexture = pMapInfo->pEncounterMonster1Texture; | |
1105 v44 = "%s A"; | |
1416 | 1106 sprintf(Source, v44, pTexture); |
1107 break; | |
0 | 1108 case 4u: |
1109 pTexture = pMapInfo->pEncounterMonster2Texture; | |
1110 v44 = "%s A"; | |
1416 | 1111 sprintf(Source, v44, pTexture); |
1112 break; | |
0 | 1113 case 5u: |
1114 pTexture = pMapInfo->pEncounterMonster3Texture; | |
1115 v44 = "%s A"; | |
1416 | 1116 sprintf(Source, v44, pTexture); |
1117 break; | |
0 | 1118 case 1u: |
1119 v9 = pMapInfo->uEncounterMonster2AtLeast; | |
1120 v14 = rand(); | |
1121 v15 = pMapInfo->uEncounterMonster2AtMost; | |
1122 pTexture = pMapInfo->pEncounterMonster2Texture; | |
1123 v12 = v14 % (v15 - v9 + 1); | |
237 | 1124 v13 = pMapInfo->Dif_M2; |
1416 | 1125 v57 = v13; |
1126 v56 = v9 + v12; | |
1127 strcpy(Source, pTexture); | |
1128 break; | |
0 | 1129 case 6u: |
1130 pTexture = pMapInfo->pEncounterMonster1Texture; | |
1131 v44 = "%s B"; | |
1416 | 1132 sprintf(Source, v44, pTexture); |
1133 break; | |
0 | 1134 case 7u: |
1135 pTexture = pMapInfo->pEncounterMonster2Texture; | |
1136 v44 = "%s B"; | |
1416 | 1137 sprintf(Source, v44, pTexture); |
1138 break; | |
0 | 1139 case 8u: |
1140 pTexture = pMapInfo->pEncounterMonster3Texture; | |
1141 v44 = "%s B"; | |
1416 | 1142 sprintf(Source, v44, pTexture); |
1143 break; | |
0 | 1144 case 2u: |
1145 v9 = pMapInfo->uEncounterMonster3AtLeast; | |
1146 v16 = rand(); | |
1147 v17 = pMapInfo->uEncounterMonster3AtMost; | |
1148 pTexture = pMapInfo->pEncounterMonster3Texture; | |
1149 v12 = v16 % (v17 - v9 + 1); | |
237 | 1150 v13 = pMapInfo->Dif_M3; |
0 | 1151 v57 = v13; |
1152 v56 = v9 + v12; | |
1153 strcpy(Source, pTexture); | |
1416 | 1154 break; |
0 | 1155 case 9u: |
1156 pTexture = pMapInfo->pEncounterMonster1Texture; | |
1157 v44 = "%s C"; | |
1416 | 1158 sprintf(Source, v44, pTexture); |
1159 break; | |
0 | 1160 case 0xAu: |
1161 pTexture = pMapInfo->pEncounterMonster2Texture; | |
1162 v44 = "%s C"; | |
1416 | 1163 sprintf(Source, v44, pTexture); |
1164 break; | |
0 | 1165 case 0xBu: |
1166 pTexture = pMapInfo->pEncounterMonster3Texture; | |
1167 v44 = "%s C"; | |
1168 sprintf(Source, v44, pTexture); | |
1169 break; | |
1170 default: | |
1171 return; | |
1172 } | |
1416 | 1173 if (Source[0] == '0') |
1174 return; | |
1175 v57 += a3; | |
1176 if ( v57 > 4 ) | |
1177 v57 = 4; | |
1178 strcpy(Str2, Source); | |
1179 if ( a4 ) | |
1180 v56 = a4; | |
1181 v18 = v56; | |
1182 if ( (signed int)(v56 + uNumActors) >= 500 ) | |
1183 return; | |
1184 pSector = 0; | |
1185 pPosX = spawn->vPosition.x; | |
1186 a4 = spawn->vPosition.y; | |
1187 a3 = spawn->vPosition.z; | |
1188 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
1189 pSector = pIndoor->GetSector(spawn->vPosition.x, spawn->vPosition.y, spawn->vPosition.z); | |
1190 v53 = 0; | |
1191 v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; | |
1192 if ( v18 <= 0 ) | |
1193 return; | |
0 | 1194 for (uint i = v53; i < v56; ++i) |
1195 { | |
1196 pMonster = &pActors[uNumActors]; | |
1197 pActors[uNumActors].Reset(); | |
1198 if ( v57 ) | |
1199 { | |
1200 v23 = rand() % 100; | |
1201 v24 = 3; | |
1202 v25 = (unsigned __int16)word_4E8152[3 * v57]; | |
1203 if ( v23 >= v25 ) | |
1204 { | |
1205 if ( v23 < v25 + (unsigned __int16)word_4E8152[3 * v57 + 1] ) | |
1206 v24 = 2; | |
1207 } | |
1208 else | |
1209 { | |
1210 v24 = 1; | |
1211 } | |
1212 if ( v24 == 1 ) | |
1213 { | |
1214 pTexture = Source; | |
1215 v44 = "%s A"; | |
1216 } | |
1217 else | |
1218 { | |
1219 if ( v24 == 2 ) | |
1220 { | |
1221 pTexture = Source; | |
1222 v44 = "%s B"; | |
1223 } | |
1224 else | |
1225 { | |
1226 if ( v24 != 3 ) | |
1416 | 1227 continue; |
0 | 1228 pTexture = Source; |
1229 v44 = "%s C"; | |
1230 } | |
1231 } | |
1232 sprintf(Str2, v44, pTexture); | |
1233 } | |
751 | 1234 v50 = pMonsterList->GetMonsterIDByName(Str2); |
0 | 1235 pTexture = Str2; |
751 | 1236 if ( (signed __int16)v50 == -1 ) |
0 | 1237 { |
1238 sprintf(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", pTexture); | |
1239 MessageBoxA(nullptr, Str, nullptr, 0); | |
1240 ExitProcess(0); | |
1241 } | |
751 | 1242 v27 = &pMonsterList->pMonsters[(signed __int16)v50]; |
1243 v28 = pMonsterStats->FindMonsterByTextureName(pTexture); | |
0 | 1244 if ( !v28 ) |
1245 v28 = 1; | |
1246 Src = &pMonsterStats->pInfos[v28]; | |
1247 strcpy(pMonster->pActorName, Src->pName); | |
1248 pMonster->sCurrentHP = Src->uHP; | |
1249 assert(sizeof(MonsterInfo) == 88); | |
1250 memcpy(&pMonster->pMonsterInfo, Src, sizeof(MonsterInfo)); | |
1251 pMonster->word_000086_some_monster_id = v50 + 1; | |
1252 pMonster->uActorRadius = v27->uMonsterRadius; | |
1253 pMonster->uActorHeight = v27->uMonsterHeight; | |
1254 pMonster->uMovementSpeed = v27->uMovementSpeed; | |
1255 pMonster->vInitialPosition.x = spawn->vPosition.x; | |
1256 pMonster->vPosition.x = spawn->vPosition.x; | |
1257 pMonster->uTetherDistance = 256; | |
1258 pMonster->vInitialPosition.y = a4; | |
1259 pMonster->vPosition.y = a4; | |
1260 pTexture = 0; | |
1261 pMonster->vInitialPosition.z = a3; | |
1262 pMonster->vPosition.z = a3; | |
1263 pMonster->uSectorID = pSector; | |
1264 pMonster->uGroup = spawn->uGroup; | |
1265 pMonster->PrepareSprites((char)pTexture); | |
1266 pMonster->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
1267 v32 = rand(); | |
1268 v33 = v32 % 2048; | |
323 | 1269 v34 = stru_5C6E00->Cos(v32 % 2048); |
0 | 1270 a4 = v34; |
1271 a3 = (unsigned __int64)(v34 * (signed __int64)v52) >> 16; | |
1272 pPosX = a3 + spawn->vPosition.x; | |
323 | 1273 v35 = stru_5C6E00->Sin(v33); |
0 | 1274 a4 = v35; |
1275 a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16; | |
1276 a4 = a3 + spawn->vPosition.y; | |
1277 v36 = spawn->vPosition.z; | |
1278 a3 = spawn->vPosition.z; | |
1279 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
1416 | 1280 { |
1281 if ( a5 ) | |
1282 pMonster->uAttributes |= 0x080000; | |
1283 ++uNumActors; | |
1284 continue; | |
1285 } | |
0 | 1286 v37 = pIndoor->GetSector(pPosX, a4, v36); |
1287 if ( v37 == pSector ) | |
1288 { | |
723 | 1289 v38 = BLV_GetFloorLevel(pPosX, a4, a3, v37, &uFaceID); |
0 | 1290 v39 = v38; |
1291 if ( v38 != -30000 ) | |
1292 { | |
1293 if ( abs(v38 - a3) <= 1024 ) | |
1294 { | |
1295 a3 = v39; | |
1296 if ( a5 ) | |
1297 pMonster->uAttributes |= 0x080000; | |
1298 ++uNumActors; | |
1416 | 1299 continue; |
0 | 1300 } |
1301 } | |
1302 } | |
1303 ; | |
1304 //v53 = (char *)v53 + 1; | |
1305 //result = v53; | |
1306 } | |
1307 //while ( (signed int)v53 < v56 ); | |
1308 } | |
1309 | |
1310 //----- (0044FA4C) -------------------------------------------------------- | |
1311 signed int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3) | |
1312 { | |
1313 signed int v3; // ecx@6 | |
90 | 1314 Actor *v4; // edx@7 |
0 | 1315 signed int result; // eax@13 |
1316 Actor *v6; // esi@16 | |
1317 char *v7; // ebx@16 | |
1318 MonsterDesc *v8; // edi@16 | |
1319 unsigned __int16 v9; // ax@16 | |
1320 int v10; // ebx@16 | |
1052 | 1321 //int v11; // edi@16 |
1322 //int v12; // eax@16 | |
1323 //int v13; // ecx@16 | |
1324 //int v14; // ebx@16 | |
0 | 1325 const char *v15; // [sp-4h] [bp-24h]@2 |
1052 | 1326 //unsigned __int16 v16; // [sp+0h] [bp-20h]@1 |
1327 //int v17; // [sp+4h] [bp-1Ch]@1 | |
0 | 1328 unsigned int uFaceID; // [sp+8h] [bp-18h]@16 |
1329 int v19; // [sp+Ch] [bp-14h]@16 | |
1330 size_t v20; // [sp+10h] [bp-10h]@6 | |
1331 int v21; // [sp+14h] [bp-Ch]@14 | |
1052 | 1332 //int v22; // [sp+18h] [bp-8h]@14 |
0 | 1333 unsigned int v23; // [sp+1Ch] [bp-4h]@6 |
1334 | |
1052 | 1335 //v16 = a2; |
1336 //v17 = a1; | |
0 | 1337 if ( a2 == 4 ) |
1338 { | |
1339 v15 = "Elemental Light C"; | |
1340 } | |
1052 | 1341 else if ( a2 == 3 ) |
0 | 1342 v15 = "Elemental Light B"; |
1343 else | |
1344 v15 = "Elemental Light A"; | |
1052 | 1345 |
751 | 1346 v23 = pMonsterList->GetMonsterIDByName(v15); |
0 | 1347 v3 = 0; |
1348 v20 = uNumActors; | |
1349 if ( (signed int)uNumActors > 0 ) | |
1350 { | |
1202 | 1351 v4 = pActors.data();//[0].uAIState; |
90 | 1352 while ( v4->uAIState != Removed ) |
0 | 1353 { |
1052 | 1354 ++v3; |
90 | 1355 ++v4; |
0 | 1356 if ( v3 >= (signed int)uNumActors ) |
90 | 1357 break; |
1358 } | |
1359 if( v3 < (signed int)uNumActors ) | |
1360 v20 = v3; | |
1361 } | |
0 | 1362 if ( v20 != uNumActors || (result = uNumActors + 1, (signed int)(uNumActors + 1) < 500) ) |
1363 { | |
1364 v21 = 0; | |
1052 | 1365 //v22 = pParty->vPosition.z; |
0 | 1366 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
1367 v21 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
1368 v6 = &pActors[v20]; | |
1369 v7 = (char *)&pMonsterStats->pInfos[v23 + 1]; | |
1370 v19 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; | |
1371 v6->Reset(); | |
1372 v8 = &pMonsterList->pMonsters[v23]; | |
1373 strcpy(v6->pActorName, *(const char **)v7); | |
1374 v6->sCurrentHP = *((short *)v7 + 32); | |
1375 memcpy(&v6->pMonsterInfo, v7, 0x58u); | |
1376 v6->word_000086_some_monster_id = v23 + 1; | |
1377 v6->uActorRadius = v8->uMonsterRadius; | |
1378 v6->uActorHeight = v8->uMonsterHeight; | |
1379 v9 = v8->uMovementSpeed; | |
1380 v6->pMonsterInfo.uTreasureDiceRolls = 0; | |
1381 v6->pMonsterInfo.uTreasureType = 0; | |
1382 v6->pMonsterInfo.uExp = 0; | |
1383 v6->uMovementSpeed = v9; | |
1384 v10 = rand() % 2048; | |
1052 | 1385 //v11 = pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v10), v19); |
323 | 1386 uFaceID = stru_5C6E00->Sin(v10); |
1052 | 1387 //v12 = pParty->vPosition.y; |
1388 //v13 = fixpoint_sub0(uFaceID, v19); | |
1389 //v14 = pParty->vPosition.y + fixpoint_sub0(uFaceID, v19); | |
1390 //LOWORD(v12) = v22; | |
1391 v6->vInitialPosition.x = pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v10), v19); | |
1392 v6->vPosition.x = v6->vInitialPosition.x; | |
1393 v6->vInitialPosition.y = pParty->vPosition.y + fixpoint_sub0(uFaceID, v19); | |
1394 v6->vPosition.y = v6->vInitialPosition.y; | |
1395 v6->vInitialPosition.z = pParty->vPosition.z; | |
1396 v6->vPosition.z = v6->vInitialPosition.z; | |
1397 //LOWORD(v12) = v21; | |
0 | 1398 v6->uTetherDistance = 256; |
1052 | 1399 v6->uSectorID = v21; |
0 | 1400 v6->PrepareSprites(0); |
1401 v6->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
1402 v6->uAlly = 9999; | |
1403 v6->uGroup = 0; | |
1404 v6->uCurrentActionTime = 0; | |
1405 v6->uAIState = Summoned; | |
1406 v6->uCurrentActionLength = 256; | |
1407 v6->UpdateAnimation(); | |
1408 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor | |
1052 | 1409 || (result = pIndoor->GetSector(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z), |
0 | 1410 result == v21) |
1052 | 1411 && (result = BLV_GetFloorLevel(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z, result, &uFaceID), result != -30000) |
1412 && (result = abs(result - pParty->vPosition.z), result <= 1024) ) | |
0 | 1413 { |
1414 if ( v20 == uNumActors ) | |
1415 ++uNumActors; | |
1052 | 1416 v6->uSummonerID = PID(OBJECT_Player, a1); |
1417 result = v6->pActorBuffs[2].Apply(pParty->uTimePlayed + (a3 * 128) / 30.0f, | |
1418 a2, | |
1419 a1, | |
0 | 1420 0, |
1421 0); | |
1422 } | |
1423 } | |
1424 return result; | |
1425 } | |
1426 | |
1427 //----- (0044FFD8) -------------------------------------------------------- | |
1428 int MapInfo::SpawnRandomTreasure(SpawnPointMM7 *a2) | |
1429 { | |
472 | 1430 //MapInfo *v2; // ebx@1 |
1431 //SpawnPointMM7 *v3; // esi@1 | |
1432 //int v4; // eax@1 | |
0 | 1433 int v5; // edx@1 |
1434 int v6; // eax@1 | |
1435 int v7; // ecx@1 | |
1436 int v8; // ebx@1 | |
1437 int v9; // eax@1 | |
1438 signed int v10; // ebx@1 | |
1439 signed int result; // eax@1 | |
1440 signed __int64 v12; // qtt@1 | |
1441 int v13; // ebx@1 | |
1442 int v14; // edx@10 | |
1443 signed int v15; // ebx@20 | |
1444 unsigned __int16 v16; // dx@20 | |
1417 | 1445 ObjectDesc *v17; // ecx@21 |
0 | 1446 unsigned __int16 v18; // ax@24 |
1447 int v19; // ST0C_4@27 | |
1448 int v20; // ST08_4@27 | |
1449 int v21; // ST04_4@27 | |
1450 int v22; // eax@27 | |
1451 signed int v23; // ebx@29 | |
1452 unsigned __int16 v24; // dx@29 | |
1417 | 1453 ObjectDesc *v25; // ecx@30 |
0 | 1454 unsigned __int16 v26; // ax@33 |
472 | 1455 //int v27; // ecx@35 |
1456 //int v28; // eax@35 | |
1457 //int v29; // esi@35 | |
1458 //__int16 v30; // ax@35 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
1459 SpriteObject a1a; // [sp+Ch] [bp-7Ch]@1 |
472 | 1460 //int v32; // [sp+7Ch] [bp-Ch]@1 |
1461 //int v33; // [sp+80h] [bp-8h]@1 | |
0 | 1462 int v34; // [sp+84h] [bp-4h]@1 |
1463 | |
472 | 1464 //auto a1 = this; |
1465 //v2 = a1; | |
1466 //v3 = a2; | |
1467 //v4 = rand(); | |
0 | 1468 v34 = 0; |
472 | 1469 v5 = rand() % 100; |
436 | 1470 // v6 = 2 * (v2->Treasure_prob + 7 * v3->uIndex) - 14; |
472 | 1471 v7 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob]; |
1472 v8 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob + 1]; | |
1473 //v32 = v5; | |
1474 //v33 = v7; | |
0 | 1475 v9 = rand(); |
472 | 1476 v10 = v8 - v7 + 1; |
0 | 1477 v12 = v9; |
1478 result = v9 / v10; | |
472 | 1479 v13 = v7 + (unsigned __int64)(v12 % v10); |
0 | 1480 if ( v13 < 7 ) |
1481 { | |
472 | 1482 if ( v5 < 20 ) |
0 | 1483 return result; |
472 | 1484 if ( v5 >= 60 ) |
1485 { | |
1486 v19 = a2->vPosition.z; | |
1487 v20 = a2->vPosition.y; | |
1488 v21 = a2->vPosition.x; | |
0 | 1489 v22 = rand(); |
1490 return sub_450521_ProllyDropItemAt(v13, v22 % 27 + 20, v21, v20, v19, 0); | |
1491 } | |
472 | 1492 if ( a2->uIndex == 1 ) |
0 | 1493 { |
1494 v14 = rand() % 51 + 50; | |
1417 | 1495 a1a.stru_24.uItemID = 197; |
1496 v34 = v14; | |
1497 } | |
1498 else if ( a2->uIndex == 2 ) | |
0 | 1499 { |
1417 | 1500 v14 = rand() % 101 + 100; |
1501 a1a.stru_24.uItemID = 197; | |
1502 v34 = v14; | |
1503 } | |
1504 else if ( a2->uIndex == 3 ) | |
0 | 1505 { |
1506 v14 = rand() % 301 + 200; | |
1417 | 1507 a1a.stru_24.uItemID = 198; |
1508 v34 = v14; | |
0 | 1509 } |
1417 | 1510 else if ( a2->uIndex == 4 ) |
0 | 1511 { |
1417 | 1512 v14 = rand() % 501 + 500; |
1513 a1a.stru_24.uItemID = 198; | |
1514 v34 = v14; | |
1515 } | |
1516 else if ( a2->uIndex == 5 ) | |
1517 { | |
1518 v14 = rand() % 1001 + 1000; | |
0 | 1519 a1a.stru_24.uItemID = 199; |
1520 v34 = v14; | |
1521 } | |
1417 | 1522 else if ( a2->uIndex == 6 ) |
1523 { | |
1524 v14 = rand() % 3001 + 2000; | |
1525 a1a.stru_24.uItemID = 199; | |
1526 v34 = v14; | |
1527 } | |
1528 v15 = 0; | |
1529 v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; | |
1530 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; | |
1531 v18 = 0; | |
1532 for( int i = 0; i < pObjectList->uNumObjects; i++ ) | |
1533 { | |
1534 if ( pObjectList->pObjects[i].uObjectID == v16 ) | |
1535 { | |
1536 v18 = i; | |
1537 break; | |
1538 } | |
1539 } | |
1540 a1a.stru_24.SetIdentified(); | |
1541 a1a.uObjectDescID = v18; | |
1542 a1a.stru_24.uSpecEnchantmentType = v34; | |
0 | 1543 } |
1544 else | |
1545 { | |
1417 | 1546 result = a1a.stru_24.GenerateArtifact(); |
1547 if ( !result ) | |
1548 return result; | |
1549 v23 = 0; | |
1550 v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; | |
1551 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; | |
1552 v26 = 0; | |
1553 for( int i = 0; i < pObjectList->uNumObjects; i++ ) | |
1554 { | |
1555 if( v24 == pObjectList->pObjects[i].uObjectID ) | |
1556 { | |
1557 v26 = i; | |
1558 break; | |
1559 } | |
1560 } | |
1561 a1a.uObjectDescID = v26; | |
1562 a1a.stru_24.Reset(); | |
1563 } | |
472 | 1564 a1a.vPosition.y = a2->vPosition.y; |
0 | 1565 a1a.uAttributes = 0; |
1566 a1a.uSoundID = 0; | |
1567 a1a.uFacing = 0; | |
472 | 1568 a1a.vPosition.z = a2->vPosition.z; |
1569 a1a.vPosition.x = a2->vPosition.x; | |
822 | 1570 a1a.spell_skill = 0; |
1571 a1a.spell_level = 0; | |
1572 a1a.spell_id = 0; | |
823 | 1573 a1a.spell_target_pid = 0; |
822 | 1574 a1a.spell_caster_pid = 0; |
0 | 1575 a1a.uSpriteFrameID = 0; |
472 | 1576 a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);; |
0 | 1577 return a1a.Create(0, 0, 0, 0); |
1578 } | |
1579 | |
1580 //----- (00450521) -------------------------------------------------------- | |
1459 | 1581 int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6) |
0 | 1582 { |
1583 int v6; // edi@1 | |
1584 int v7; // esi@1 | |
1585 signed int v8; // edi@1 | |
1586 unsigned __int16 v9; // cx@1 | |
1587 char *v10; // edx@2 | |
1588 unsigned __int16 v11; // ax@5 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
1589 SpriteObject a1; // [sp+8h] [bp-70h]@1 |
0 | 1590 |
1591 v6 = ecx0; | |
1592 v7 = a2; | |
1593 pItemsTable->GenerateItem(v6, v7, &a1.stru_24); | |
1594 v8 = 0; | |
1595 v9 = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
1596 a1.uType = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; |
1417 | 1597 v11 = 0; |
1598 for( int i = 0; i < pObjectList->uNumObjects; i++ ) | |
1599 { | |
1600 if( v9 == pObjectList->pObjects[i].uObjectID ) | |
1601 { | |
1602 v11 = i; | |
1603 break; | |
1604 } | |
1605 } | |
0 | 1606 a1.uObjectDescID = v11; |
1607 a1.vPosition.y = a4; | |
1608 a1.vPosition.x = a3; | |
1609 a1.vPosition.z = a5; | |
1610 a1.uFacing = a6; | |
1611 a1.uAttributes = 0; | |
1612 a1.uSectorID = pIndoor->GetSector(a3, a4, a5); | |
1613 a1.uSpriteFrameID = 0; | |
1614 return a1.Create(0, 0, 0, 0); | |
1615 } | |
1616 | |
1617 //----- (0045063B) -------------------------------------------------------- | |
1415 | 1618 int __fastcall _45063B_spawn_some_monster(MapInfo *a1, int a2) |
0 | 1619 { |
1620 signed int v2; // edi@1 | |
1621 Actor *v3; // esi@2 | |
1415 | 1622 //signed __int64 v4; // qax@3 |
0 | 1623 int result; // eax@8 |
1624 int v6; // edi@11 | |
1625 int v7; // ebx@11 | |
1626 int v8; // edi@11 | |
1627 int v9; // ebx@12 | |
1628 int v10; // eax@12 | |
1629 char v11; // zf@16 | |
1630 int v12; // edi@20 | |
1631 int v13; // eax@20 | |
1632 int v14; // ebx@20 | |
1633 int v15; // eax@20 | |
1634 int v16; // eax@20 | |
1635 int v17; // eax@20 | |
1636 int v18; // eax@21 | |
1637 SpawnPointMM7 v19; // [sp+Ch] [bp-38h]@1 | |
1638 int v20; // [sp+24h] [bp-20h]@11 | |
1415 | 1639 //MapInfo *v21; // [sp+28h] [bp-1Ch]@1 |
0 | 1640 int v22; // [sp+2Ch] [bp-18h]@3 |
1641 int v23; // [sp+30h] [bp-14h]@11 | |
1415 | 1642 //int v24; // [sp+34h] [bp-10h]@1 |
0 | 1643 unsigned int uFaceID; // [sp+38h] [bp-Ch]@10 |
1644 int v26; // [sp+3Ch] [bp-8h]@11 | |
1645 int v27; // [sp+40h] [bp-4h]@11 | |
1415 | 1646 |
1647 if (!uNumActors) | |
1648 return 0; | |
1649 | |
1650 //v21 = a1; | |
1651 //v24 = a2; | |
0 | 1652 v2 = 0; |
1202 | 1653 v3 = pActors.data(); |
0 | 1654 while ( 1 ) |
1655 { | |
1415 | 1656 if (v3->pMonsterInfo.uID >= 121 && v3->pMonsterInfo.uID <= 123 || // Dwarf FemaleC A-C |
1657 v3->pMonsterInfo.uID >= 124 && v3->pMonsterInfo.uID <= 126 || // Dwarf MaleA A-C | |
1658 v3->pMonsterInfo.uID >= 133 && v3->pMonsterInfo.uID <= 135 || // Peasant Elf FemaleA A-C | |
1659 !v3->CanAct()) | |
0 | 1660 { |
1415 | 1661 ++v2; |
1662 ++v3; | |
1663 | |
1664 if (v2 >= uNumActors) | |
1665 return 0; | |
1666 | |
1667 continue; | |
0 | 1668 } |
1415 | 1669 |
1670 break; | |
1671 //v22 = v3->pMonsterInfo.uID - 1; | |
1672 //v4 = (signed __int64)((double)v22 * 0.3333333333333333); | |
1673 //if ( (int)v4 != 40 ) | |
1674 //{ | |
1675 // if ( (int)v4 != 41 && (int)v4 != 44 && v3->CanAct() ) | |
1676 // break; | |
1677 //} | |
1678 //++v2; | |
1679 //++v3; | |
1680 //if ( v2 >= (signed int)uNumActors ) | |
1681 // goto LABEL_8; | |
0 | 1682 } |
1683 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
1684 { | |
1685 v22 = 0; | |
1686 uFaceID = 0; | |
1687 while ( 1 ) | |
1688 { | |
1689 ++uFaceID; | |
1690 v6 = rand() % 1024 + 512; | |
1691 v7 = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
323 | 1692 v20 = stru_5C6E00->Cos(v7); |
0 | 1693 v23 = (unsigned __int64)(v20 * (signed __int64)v6) >> 16; |
1694 v19.vPosition.x = pParty->vPosition.x + v23; | |
323 | 1695 v20 = stru_5C6E00->Sin(v7); |
0 | 1696 v23 = (unsigned __int64)(v20 * (signed __int64)v6) >> 16; |
1697 v8 = 0; | |
1415 | 1698 v19.uIndex = a2; |
0 | 1699 v19.vPosition.y = v23 + pParty->vPosition.y; |
1700 v19.vPosition.z = pParty->vPosition.z; | |
1701 v26 = 0; | |
1702 v27 = 0; | |
723 | 1703 v19.vPosition.z = ODM_GetFloorLevel( |
0 | 1704 v19.vPosition.x, |
1705 v23 + pParty->vPosition.y, | |
1706 pParty->vPosition.z, | |
1707 0, | |
1708 &v26, | |
1709 &v27, | |
1710 0); | |
1711 v23 = 0; | |
1416 | 1712 for( int i = 0; i < pOutdoor->uNumBModels; i++ ) |
1713 { | |
1714 v9 = abs(v19.vPosition.y - pOutdoor->pBModels[i].vBoundingCenter.y); | |
1715 v10 = abs(v19.vPosition.x - pOutdoor->pBModels[i].vBoundingCenter.x); | |
1716 if ( int_get_vector_length(v10, v9, 0) < pOutdoor->pBModels[i].sBoundingRadius + 256 ) | |
1717 { | |
1718 v22 = 1; | |
1719 break; | |
1720 } | |
1721 } | |
0 | 1722 v11 = uFaceID == 100; |
1723 if ( uFaceID >= 100 ) | |
1724 break; | |
1725 if ( v22 ) | |
1726 { | |
1727 v11 = uFaceID == 100; | |
1728 break; | |
1729 } | |
1730 } | |
1731 } | |
1732 else | |
1733 { | |
1734 v26 = 0; | |
1735 v22 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
1736 do | |
1737 { | |
1738 ++v26; | |
1739 v12 = rand() % 512 + 256; | |
1740 v13 = rand(); | |
1741 v14 = v13 % (signed int)stru_5C6E00->uIntegerDoublePi; | |
323 | 1742 v15 = stru_5C6E00->Cos(v13 % (signed int)stru_5C6E00->uIntegerDoublePi); |
0 | 1743 v20 = v15; |
1744 v23 = (unsigned __int64)(v15 * (signed __int64)v12) >> 16; | |
1745 v19.vPosition.x = pParty->vPosition.x + v23; | |
323 | 1746 v16 = stru_5C6E00->Sin(v13 % (signed int)stru_5C6E00->uIntegerDoublePi); |
0 | 1747 v20 = v16; |
1748 v23 = (unsigned __int64)(v16 * (signed __int64)v12) >> 16; | |
1749 v19.vPosition.y = v23 + pParty->vPosition.y; | |
1750 v19.vPosition.z = pParty->vPosition.z; | |
1415 | 1751 v19.uIndex = a2; |
0 | 1752 v17 = pIndoor->GetSector(v19.vPosition.x, v23 + pParty->vPosition.y, pParty->vPosition.z); |
1753 if ( v17 == v22 ) | |
1754 { | |
723 | 1755 v18 = BLV_GetFloorLevel(v19.vPosition.x, v19.vPosition.y, v19.vPosition.z, v17, &uFaceID); |
0 | 1756 v19.vPosition.z = v18; |
1757 if ( v18 != -30000 ) | |
1758 { | |
1759 if ( abs(v18 - pParty->vPosition.z) <= 1024 ) | |
1760 break; | |
1761 } | |
1762 } | |
1763 } | |
1764 while ( v26 < 100 ); | |
1765 v11 = v26 == 100; | |
1766 } | |
1767 if ( v11 ) | |
1768 { | |
1769 result = 0; | |
1770 } | |
1771 else | |
1772 { | |
1415 | 1773 SpawnEncounter(a1, &v19, 0, 0, 1); |
1774 result = a2; | |
0 | 1775 } |
1776 return result; | |
1777 } | |
1778 | |
1779 //----- (00450929) -------------------------------------------------------- | |
1780 int LevelDecoration::GetGlobalEvent() | |
1781 { | |
1782 LevelDecoration *v1; // esi@1 | |
1783 signed int v2; // eax@1 | |
1784 int v3; // eax@5 | |
1785 int v4; // eax@6 | |
1786 int v5; // eax@7 | |
1787 int v6; // eax@8 | |
1788 int v7; // eax@9 | |
1789 int result; // eax@14 | |
1790 int v9; // eax@18 | |
1791 int v10; // eax@19 | |
1792 int v11; // eax@20 | |
1793 int v12; // eax@21 | |
1794 int v13; // eax@22 | |
1795 | |
1415 | 1796 switch (uDecorationDescID) |
1797 { | |
1798 case 0: case 1: | |
1799 case 2: case 3: | |
1800 return 0; | |
1801 | |
1802 case 4: return 16; // dec01 "Trash Pile" | |
1803 case 5: return 32; // dec02 "Campfire" | |
1804 case 6: return 12 + rand() % 4; // dec03 "Cauldron" | |
1805 case 7: case 8: | |
1806 case 9: case 10: | |
1807 return 0; | |
1808 | |
1809 case 11: return 34; // dec08 "Fruit plate" | |
1810 case 12: | |
1811 return 0; | |
1812 | |
1813 case 13: return 17; // dec10 "Trash Pile" | |
1814 case 14: return 18; // dec11 "Filth" | |
1815 case 15: case 16: case 17: | |
1816 case 18: case 19: case 20: | |
1817 case 21: case 22: case 23: | |
1818 return 0; | |
1819 | |
1820 case 24: return 36; // dec21 "Keg" | |
1821 case 25: case 26: case 27: case 28: case 29: | |
1822 case 30: case 31: case 32: case 33: | |
1823 return 0; | |
1824 | |
1825 case 34: return 4 + rand() % 6; // dec32 "Barrel" | |
1826 case 35: case 36: case 37: case 38: case 39: | |
1827 case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: case 48: case 49: | |
1828 case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: case 59: | |
1829 case 60: case 61: case 62: case 63: case 64: case 65: case 66: case 67: case 68: case 69: | |
1830 case 70: case 71: case 72: case 73: case 74: case 75: case 76: case 77: case 78: case 79: | |
1831 case 80: case 81: case 82: case 83: case 84: case 85: case 86: case 87: case 88: case 89: | |
1832 case 90: case 91: case 92: case 93: case 94: case 95: case 96: case 97: case 98: case 99: | |
1833 case 100: case 101: case 102: case 103: case 104: case 105: case 106: case 107: case 108: case 109: | |
1834 case 110: case 111: case 112: case 113: case 114: case 115: case 116: case 117: case 118: case 119: | |
1835 case 120: case 121: case 122: case 123: case 124: case 125: case 126: case 127: case 128: case 129: | |
1836 case 130: case 131: case 132: case 133: case 134: case 135: case 136: case 137: case 138: case 139: | |
1837 case 140: case 141: case 142: case 143: case 144: case 145: case 146: case 147: case 148: case 149: | |
1838 case 150: case 151: case 152: case 153: case 154: case 155: case 156: case 157: case 158: case 159: | |
1839 case 160: case 161: case 162: case 163: case 164: case 165: case 166: case 167: case 168: case 169: | |
1840 case 170: case 171: case 172: case 173: case 174: case 175: case 176: case 177: case 178: case 179: | |
1841 case 180: case 181: case 182: case 183: | |
1842 | |
1843 case 184: return 33; // dec24 "Campfire" | |
1844 case 185: case 186: | |
1845 return 0; | |
1846 | |
1847 case 187: // dec88 "Mushroom" | |
1848 case 190: // dec91 "Mushroom" | |
1849 return 37; | |
1850 | |
1851 case 188: case 189: | |
1852 case 191: case 192: case 193: case 194: case 195: case 196: | |
1853 case 197: case 198: case 199: case 200: case 201: case 202: | |
1854 case 203: case 204: case 205: | |
1855 return 0; | |
1856 | |
1857 case 206: return 162 + rand() % 7; // dec60 | |
1858 case 207: return 169 + rand() % 7; // dec61 | |
1859 case 208: return 176 + rand() % 7; // dec62 | |
1860 case 209: return 183 + rand() % 7; // dec63 | |
1861 case 210: return 150; // dec64 "Magic Pedistal" | |
1862 case 211: return 151; // dec65 "Magic Pedistal" | |
1863 case 212: return 152; // dec66 "Magic Pedistal" | |
1864 case 213: return 153; // dec67 "Magic Pedistal" | |
1865 case 214: return 154; // dec68 "Magic Pedistal" | |
1866 case 215: return 155; // dec69 "Magic Pedistal" | |
1867 case 216: return 156; // dec70 "Magic Pedistal" | |
1868 case 217: return 157; // dec71 "Magic Pedistal" | |
1869 case 218: return 158; // dec72 "Magic Pedistal" | |
1870 case 219: return 159; // dec73 "Magic Pedistal" | |
1871 case 220: return 160; // dec74 "Magic Pedistal" | |
1872 case 221: return 161; // dec75 "Magic Pedistal" | |
1873 | |
1874 case 222: case 223: case 224: | |
1875 case 225: case 226: case 227: | |
1876 return 0; | |
1877 | |
1878 default: assert(false && "Invalid Decoration"); | |
1879 } | |
0 | 1880 } |
1881 | |
1882 //----- (00450AAA) -------------------------------------------------------- | |
1883 void RespawnGlobalDecorations() | |
1884 { | |
1885 memset(stru_5E4C90._decor_events, 0, 125); | |
1886 | |
1887 uint decorEventIdx = 0; | |
1888 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
1889 { | |
1202 | 1890 auto decor = &pLevelDecorations[i]; |
0 | 1891 |
1892 if (!decor->field_16_event_id) | |
1893 { | |
1894 if (decor->IsInteractive()) | |
1895 { | |
1896 if (decorEventIdx < 124) | |
1897 { | |
1898 decor->_idx_in_stru123 = decorEventIdx + 75; | |
1899 stru_5E4C90._decor_events[decorEventIdx++] = decor->GetGlobalEvent(); | |
1900 } | |
1901 } | |
1902 } | |
1903 } | |
1904 } | |
1905 | |
1906 //----- (00450B0A) -------------------------------------------------------- | |
1907 bool __fastcall SpawnActor(unsigned int uMonsterID) | |
1908 { | |
1909 unsigned int v1; // ebx@1 | |
1910 bool result; // eax@2 | |
1911 MonsterDesc *v3; // esi@5 | |
1912 MonsterInfo *v4; // edi@5 | |
1913 Vec3_int_ v5; // ST08_12@5 | |
1914 unsigned int v6; // ecx@5 | |
1915 Actor *v7; // eax@7 | |
1916 Actor actor; // [sp+4h] [bp-350h]@5 | |
1917 Vec3_int_ pOut; // [sp+348h] [bp-Ch]@5 | |
1918 | |
1919 v1 = uMonsterID; | |
1920 if ( uNumActors == 499 ) | |
1921 { | |
1922 result = 0; | |
1923 } | |
1924 else | |
1925 { | |
1926 if ( (signed int)uMonsterID >= (signed int)pMonsterList->uNumMonsters ) | |
1927 v1 = 0; | |
1928 v3 = &pMonsterList->pMonsters[v1]; | |
1929 v4 = &pMonsterStats->pInfos[v1 + 1]; | |
1930 memset(&actor, 0, 0x344u); | |
1931 strcpy(actor.pActorName, v4->pName); | |
1932 actor.sCurrentHP = LOWORD(v4->uHP); | |
1933 memcpy(&actor.pMonsterInfo, &pMonsterStats->pInfos[v1 + 1], 0x58u); | |
1934 actor.word_000086_some_monster_id = v1 + 1; | |
1935 actor.uActorRadius = v3->uMonsterRadius; | |
1936 actor.uActorHeight = v3->uMonsterHeight; | |
1937 actor.uMovementSpeed = v3->uMovementSpeed; | |
1938 v5 = pParty->vPosition; | |
1939 Vec3_int_::Rotate(200, pParty->sRotationY, 0, v5, &pOut.x, &pOut.z, &pOut.y); | |
1940 actor.vInitialPosition.x = pOut.x; | |
1941 actor.vPosition.x = pOut.x; | |
1942 actor.uTetherDistance = 256; | |
1943 actor.vInitialPosition.y = LOWORD(pOut.z); | |
1944 actor.vPosition.y = LOWORD(pOut.z); | |
1945 actor.vInitialPosition.z = LOWORD(pOut.y); | |
1946 actor.vPosition.z = LOWORD(pOut.y); | |
1947 pSprites_LOD->DeleteSomeSprites(); | |
1948 pPaletteManager->ResetNonTestLocked(); | |
1949 v6 = uNumActors - 1; | |
1950 if ( dword_5C6DF8 == 1 ) | |
1951 { | |
1952 dword_5C6DF8 = 0; | |
1953 v6 = uNumActors++; | |
1954 } | |
1955 v7 = &pActors[v6]; | |
1956 memcpy(v7, &actor, 0x344u); | |
1957 v7->PrepareSprites(1); | |
1958 result = 1; | |
1959 } | |
1960 return result; | |
1961 } | |
1962 // 5C6DF8: using guessed type int dword_5C6DF8; | |
1963 | |
1964 //----- (00450DA3) -------------------------------------------------------- | |
1458 | 1965 int GetAlertStatus() |
0 | 1966 { |
1967 int result; // eax@2 | |
1968 | |
1969 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
1970 result = pOutdoor->ddm.field_C_alert; | |
1971 else | |
1972 result = uCurrentlyLoadedLevelType == LEVEL_Outdoor ? pIndoor->dlv.field_C_alert : 0; | |
1973 return result; | |
1974 } | |
1975 | |
1976 //----- (00450DDE) -------------------------------------------------------- | |
1977 stru350 *stru350::_450DDE() | |
1978 { | |
1979 _450DF1(&stru_4E82A4, &stru_4E82A4); | |
1980 return this; | |
1981 } | |
1982 | |
1983 //----- (00450DF1) -------------------------------------------------------- | |
1984 bool stru350::_450DF1(const stru355 *p1, const stru355 *p2) | |
1985 { | |
1986 //stru350 *v3; // esi@1 | |
1987 //void *result; // eax@1 | |
1988 unsigned int v5; // ecx@2 | |
1989 int v6; // edi@2 | |
1990 int v7; // edx@2 | |
1991 unsigned int v8; // ecx@8 | |
1992 int v9; // edi@8 | |
1993 int v10; // edx@8 | |
1994 int v11; // ecx@12 | |
1995 int v12; // edi@12 | |
1996 unsigned int v13; // ecx@12 | |
1997 int v14; // edx@12 | |
1998 int v15; // ecx@16 | |
1999 unsigned int v16; // edx@16 | |
2000 int v17; // ecx@16 | |
2001 int v18; // edi@16 | |
2002 char v19; // zf@20 | |
2003 unsigned int v20; // ecx@21 | |
2004 int v21; // edi@21 | |
2005 int v22; // edx@21 | |
2006 unsigned int v23; // ecx@27 | |
2007 int v24; // edi@27 | |
2008 int v25; // edx@27 | |
2009 int v26; // ecx@31 | |
2010 int v27; // edi@31 | |
2011 unsigned int v28; // ecx@31 | |
2012 int v29; // edx@31 | |
2013 int v30; // ebx@35 | |
2014 int v31; // ecx@35 | |
2015 int v32; // edi@35 | |
2016 int v33; // edx@35 | |
2017 unsigned int i; // ecx@35 | |
2018 int v35; // ecx@39 | |
2019 unsigned int v36; // edx@39 | |
2020 int v37; // ecx@39 | |
2021 int v38; // ebx@39 | |
2022 | |
2023 //v3 = this; | |
2024 memcpy(&field_0, p1, sizeof(stru355)); | |
2025 memcpy(&field_20, p2, sizeof(stru355)); | |
2026 //result = memcpy(&v3->field_20, p2, 0x20u); | |
2027 //LOBYTE(result) = 1; | |
2028 if (field_0.field_4 & 1) | |
2029 { | |
2030 v5 = field_0.field_1C; | |
2031 v6 = 0; | |
2032 v7 = 0; | |
2033 while ( !(v5 & 1) ) | |
2034 { | |
2035 ++v6; | |
2036 v5 >>= 1; | |
2037 } | |
2038 do | |
2039 { | |
2040 v5 >>= 1; | |
2041 ++v7; | |
2042 } | |
2043 while ( v5 & 1 ); | |
2044 field_40 = 32 - v7 - v6; | |
2045 } | |
2046 else | |
2047 { | |
2048 field_40 = 0; | |
2049 } | |
2050 v8 = field_0.field_10; | |
2051 v9 = 0; | |
2052 v10 = 0; | |
2053 while ( !(v8 & 1) ) | |
2054 { | |
2055 ++v9; | |
2056 v8 >>= 1; | |
2057 } | |
2058 do | |
2059 { | |
2060 v8 >>= 1; | |
2061 ++v10; | |
2062 } | |
2063 while ( v8 & 1 ); | |
2064 v11 = 24 - v10 - v9; | |
2065 v12 = 0; | |
2066 field_48 = v11; | |
2067 v13 = field_0.field_14; | |
2068 v14 = 0; | |
2069 while ( !(v13 & 1) ) | |
2070 { | |
2071 ++v12; | |
2072 v13 >>= 1; | |
2073 } | |
2074 do | |
2075 { | |
2076 v13 >>= 1; | |
2077 ++v14; | |
2078 } | |
2079 while ( v13 & 1 ); | |
2080 v15 = 16 - v14; | |
2081 v16 = field_0.field_18; | |
2082 field_50 = v15 - v12; | |
2083 v17 = 0; | |
2084 v18 = 0; | |
2085 while ( !(v16 & 1) ) | |
2086 { | |
2087 ++v17; | |
2088 v16 >>= 1; | |
2089 } | |
2090 do | |
2091 { | |
2092 v16 >>= 1; | |
2093 ++v18; | |
2094 } | |
2095 while ( v16 & 1 ); | |
2096 v19 = (field_20.field_4 & 1) == 0; | |
2097 field_58 = v17 - v18 + 8; | |
2098 if ( v19 ) | |
2099 { | |
2100 field_44 = 0; | |
2101 } | |
2102 else | |
2103 { | |
2104 v20 = field_20.field_1C; | |
2105 v21 = 0; | |
2106 v22 = 0; | |
2107 while ( !(v20 & 1) ) | |
2108 { | |
2109 ++v21; | |
2110 v20 >>= 1; | |
2111 } | |
2112 do | |
2113 { | |
2114 v20 >>= 1; | |
2115 ++v22; | |
2116 } | |
2117 while ( v20 & 1 ); | |
2118 field_44 = 32 - v22 - v21; | |
2119 } | |
2120 v23 = field_20.field_10; | |
2121 v24 = 0; | |
2122 v25 = 0; | |
2123 while ( !(v23 & 1) ) | |
2124 { | |
2125 ++v24; | |
2126 v23 >>= 1; | |
2127 } | |
2128 do | |
2129 { | |
2130 v23 >>= 1; | |
2131 ++v25; | |
2132 } | |
2133 while ( v23 & 1 ); | |
2134 v26 = 24 - v25 - v24; | |
2135 v27 = 0; | |
2136 field_4C = v26; | |
2137 v28 = field_20.field_14; | |
2138 v29 = 0; | |
2139 while ( !(v28 & 1) ) | |
2140 { | |
2141 ++v27; | |
2142 v28 >>= 1; | |
2143 } | |
2144 do | |
2145 { | |
2146 v28 >>= 1; | |
2147 ++v29; | |
2148 } | |
2149 while ( v28 & 1 ); | |
2150 v30 = 0; | |
2151 v31 = 16 - v29 - v27; | |
2152 v32 = field_20.field_18; | |
2153 field_54 = v31; | |
2154 v33 = 0; | |
2155 for ( i = v32; !(i & 1); i >>= 1 ) | |
2156 ++v30; | |
2157 do | |
2158 { | |
2159 i >>= 1; | |
2160 ++v33; | |
2161 } | |
2162 while ( i & 1 ); | |
2163 v35 = 32 - v33; | |
2164 v36 = v32; | |
2165 field_5C = v35 - v30; | |
2166 v37 = 0; | |
2167 v38 = 0; | |
2168 while ( !(v36 & 1) ) | |
2169 { | |
2170 ++v37; | |
2171 v36 >>= 1; | |
2172 } | |
2173 do | |
2174 { | |
2175 v36 >>= 1; | |
2176 ++v38; | |
2177 } | |
2178 while ( v36 & 1 ); | |
2179 field_5C = v37 - v38 + 8; | |
2180 return true; | |
2181 } | |
2182 | |
2183 //----- (00450F55) -------------------------------------------------------- | |
2184 unsigned int stru350::_450F55(int a2) | |
2185 { | |
2186 int v2 = a2 & stru_4E82A4.field_1C; | |
2187 if (field_20.field_4 & 1) | |
2188 v2 = (unsigned int)v2 >> this->field_44; | |
2189 return v2 & field_20.field_1C | | |
2190 field_20.field_10 & ((a2 & (unsigned int)stru_4E82A4.field_10) >> field_4C) | | |
2191 field_20.field_14 & ((a2 & (unsigned int)stru_4E82A4.field_14) >> field_54) | | |
2192 field_20.field_18 & ((a2 & (unsigned int)stru_4E82A4.field_18) >> field_5C); | |
2193 } | |
2194 | |
2195 //----- (00450FB1) -------------------------------------------------------- | |
2196 int stru350::_450FB1(int a2) | |
2197 { | |
2198 int v2 = 0; | |
2199 int v4 = field_0.field_4 & 1; | |
2200 if ( v4 ) | |
2201 v2 = a2 & field_0.field_1C; | |
2202 if ( v4 ) | |
2203 v2 <<= field_40; | |
2204 return v2 | ((a2 & field_0.field_10) << field_48) | ((a2 & field_0.field_14) << field_50) | ((a2 & field_0.field_18) << field_58); | |
2205 } | |
2206 | |
2207 //----- (00452442) -------------------------------------------------------- | |
2208 unsigned int __fastcall sub_452442(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4) | |
2209 { | |
2210 int v4; // ebx@0 | |
2211 __int16 v5; // ST14_2@1 | |
2212 __int16 v6; // dx@1 | |
2213 int v7; // ecx@1 | |
2214 __int16 v8; // ST10_2@1 | |
2215 int v9; // edi@1 | |
2216 unsigned __int16 v10; // dh@1@1 | |
2217 int v11; // ebx@1 | |
2218 int v12; // ebx@1 | |
2219 __int16 a3a; // [sp+1Ch] [bp+8h]@1 | |
2220 | |
2221 v5 = a2 >> 2; | |
2222 v6 = (unsigned __int16)a4 >> 2; | |
2223 v8 = a1 >> 2; | |
2224 a3a = (unsigned __int16)a3 >> 2; | |
2225 LOWORD(v7) = a3a; | |
2226 v9 = v7; | |
2227 LOWORD(v4) = ((unsigned __int16)a4 >> 2) & 0xE0; | |
2228 LOWORD(v7) = a3a & 0xE0; | |
2229 LOWORD(v9) = v9 & 0x1C00; | |
2230 v11 = v7 + v4; | |
2231 LOWORD(v7) = v5 & 0xE0; | |
2232 v12 = v7 + v11; | |
2233 LOWORD(v7) = v8 & 0xE0; | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1408
diff
changeset
|
2234 __debugbreak(); // warning C4700: uninitialized local variable 'v10' used |
848 | 2235 return (PID_TYPE(v8) + PID_TYPE(v5) + PID_TYPE(a3a) + PID_TYPE(v6)) | (v7 + v12) | ((v8 & 0x1C00) |
0 | 2236 + (v5 & 0x1C00) |
2237 + v9 | |
2238 + (__PAIR__(v10, (unsigned __int16)a4 >> 2) & 0x1C00)); | |
2239 } | |
2240 | |
2241 //----- (0045281E) -------------------------------------------------------- | |
2242 // Calculates atan2(y/x) | |
2243 // return value: angle in integer format (multiplier of Pi/1024) | |
2244 unsigned int stru193_math::Atan2(int x, int y) | |
2245 { | |
2246 signed int quadrant; | |
2247 __int64 dividend; | |
2248 int quotient; | |
2249 int lowIdx; | |
2250 int highIdx; | |
2251 int angle; | |
2252 | |
2253 auto X = x; | |
2254 auto Y = y; | |
2255 | |
2256 if ( abs(X) < 65536 ) | |
2257 { | |
2258 if ( (abs(Y) >> 15) >= abs(X) ) | |
2259 X = 0; | |
2260 } | |
2261 | |
2262 if ( !X ) | |
2263 { | |
2264 if ( Y > 0 ) | |
2265 { | |
2266 return uIntegerHalfPi; //Pi/2 | |
2267 } | |
2268 else | |
2269 { | |
2270 return uIntegerHalfPi + uIntegerPi; //3*(Pi/2) | |
2271 } | |
2272 } | |
2273 | |
2274 if ( Y ) | |
2275 { | |
2276 if ( X < 0 ) | |
2277 { | |
2278 X = -X; | |
2279 if ( Y > 0 ) | |
2280 { | |
2281 quadrant = 4; | |
2282 } | |
2283 else | |
2284 { | |
2285 quadrant = 3; | |
2286 } | |
2287 } | |
2288 else | |
2289 { | |
2290 if ( Y > 0 ) | |
2291 { | |
2292 quadrant = 1; | |
2293 } | |
2294 else | |
2295 { | |
2296 quadrant = 2; | |
2297 } | |
2298 } | |
2299 | |
2300 if ( Y < 0 ) | |
2301 Y = -Y; | |
2302 | |
2303 LODWORD(dividend) = Y << 16; | |
2304 HIDWORD(dividend) = Y >> 16; | |
2305 quotient = dividend / X; | |
2306 | |
2307 //looks like binary search | |
2308 { | |
2309 int i; | |
2310 highIdx = uIntegerHalfPi; | |
2311 lowIdx = 0; | |
2312 | |
2313 for (i = 0; i < 6; ++i) | |
2314 { | |
2315 if (quotient <= pTanTable[(lowIdx + highIdx) / 2]) | |
2316 highIdx = (lowIdx + highIdx) / 2; | |
2317 else | |
2318 lowIdx = (lowIdx + highIdx) / 2; | |
2319 } | |
2320 } | |
2321 | |
2322 angle = lowIdx + 1; | |
2323 while ( angle < (highIdx - 1) && quotient >= pTanTable[angle] ) | |
2324 ++angle; | |
2325 | |
2326 switch (quadrant) | |
2327 { | |
2328 case 1: //X > 0, Y > 0 | |
2329 return angle; | |
2330 | |
2331 case 2: //X > 0, Y < 0 | |
2332 return uIntegerDoublePi - angle; //2*Pi - angle | |
2333 | |
2334 case 3: //X > 0, Y < 0 | |
2335 return uIntegerPi + angle; //Pi + angle | |
2336 | |
2337 case 4: //X < 0, Y > 0 | |
2338 return uIntegerPi - angle; //Pi - angle | |
2339 } | |
2340 | |
2341 //should newer get here | |
2342 return 0; | |
2343 } | |
2344 | |
2345 if ( X < 0 ) //Y == 0, X < 0 | |
2346 return uIntegerPi; | |
2347 | |
2348 return 0; | |
2349 } | |
2350 | |
2351 //----- (00452969) -------------------------------------------------------- | |
2352 stru193_math::stru193_math() | |
2353 { | |
2354 double v3; // ST18_8@2 | |
1214
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2355 |
0 | 2356 this->pTanTable[0] = 0; |
2357 this->pCosTable[0] = 65536; | |
2358 this->pInvCosTable[0] = 65536; | |
1214
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2359 for(int i = 1; i < (signed int)this->uIntegerHalfPi; i++) |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2360 { |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2361 v3 = (double)i * 3.141592653589793 / (double)uIntegerPi; |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2362 pTanTable[i] = (signed __int64)(tan(v3) * (double)this->pCosTable[0] + 0.5); |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2363 pCosTable[i] = (signed __int64)(cos(v3) * (double)this->pCosTable[0] + 0.5); |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2364 pInvCosTable[i] = (signed __int64)(1.0 / cos(v3) * (double)this->pCosTable[0] + 0.5); |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2365 } |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2366 for(int i = this->uIntegerHalfPi; i < 520; i++) |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2367 { |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2368 this->pTanTable[i] = 0xEFFFFFFFu; |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2369 this->pCosTable[i] = 0; |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2370 this->pInvCosTable[i] = 0xEFFFFFFFu; |
0 | 2371 } |
2372 } | |
2373 | |
2374 //----- (00452A9E) -------------------------------------------------------- | |
295 | 2375 int integer_sqrt(int val) |
0 | 2376 { |
2377 signed int result; // eax@2 | |
295 | 2378 unsigned int v2; // edx@3 |
271 | 2379 unsigned int v3; // edi@3 |
2380 //signed int v4; // ebx@3 | |
0 | 2381 int v5; // esi@4 |
2382 | |
295 | 2383 if (val < 1) |
2384 return val; | |
271 | 2385 |
2386 | |
0 | 2387 v2 = 0; |
295 | 2388 v3 = val; |
0 | 2389 result = 0; |
271 | 2390 //v4 = 16; |
2391 for (uint i = 0; i < 16; ++i) | |
2392 { | |
0 | 2393 result *= 2; |
271 | 2394 v2 = (v3 >> 30) | 4 * v2; |
0 | 2395 v5 = 2 * result + 1; |
2396 v3 *= 4; | |
295 | 2397 if ( v2 >= v5 ) |
0 | 2398 { |
2399 ++result; | |
2400 v2 -= v5; | |
2401 } | |
271 | 2402 //--v4; |
2403 } | |
2404 //while ( v4 ); | |
295 | 2405 if ( val - result * result >= (unsigned int)(result - 1) ) |
0 | 2406 ++result; |
295 | 2407 return result; |
0 | 2408 } |
2409 | |
2410 //----- (00452AE2) -------------------------------------------------------- | |
2411 int __fastcall MakeColorMaskFromBitDepth(int a1) | |
2412 { | |
2413 signed __int64 v1; // qax@1 | |
2414 | |
2415 v1 = 4294967296i64; | |
2416 if ( a1 > 0 ) | |
2417 { | |
2418 do | |
2419 { | |
2420 LODWORD(v1) = HIDWORD(v1) + v1; | |
2421 HIDWORD(v1) *= 2; | |
2422 --a1; | |
2423 } | |
2424 while ( a1 ); | |
2425 } | |
2426 return v1; | |
2427 } | |
2428 | |
2429 //----- (00452AF3) -------------------------------------------------------- | |
2430 void __fastcall fill_pixels_fast(unsigned int a1, unsigned __int16 *pPixels, unsigned int uNumPixels) | |
2431 { | |
2432 void *v3; // edi@1 | |
2433 unsigned int v4; // eax@1 | |
2434 unsigned __int16 *v5; // edi@3 | |
2435 unsigned int i; // ecx@3 | |
2436 | |
2437 v3 = pPixels; | |
2438 v4 = a1 | (a1 << 16); | |
2439 if ( (unsigned __int8)pPixels & 2 ) // first 2 pixels | |
2440 { | |
2441 *pPixels = v4; | |
2442 v3 = pPixels + 1; | |
2443 --uNumPixels; | |
2444 } | |
2445 memset32(v3, v4, uNumPixels >> 1); // 4 pixels at once | |
2446 v5 = (unsigned __int16 *)((char *)v3 + 4 * (uNumPixels >> 1)); | |
2447 for ( i = uNumPixels & 1; i; --i ) // leftover pixels | |
2448 { | |
2449 *v5 = v4; | |
2450 ++v5; | |
2451 } | |
2452 } | |
2453 | |
2454 //----- (00452B2E) -------------------------------------------------------- | |
2455 int __fastcall GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides) | |
2456 { | |
2457 signed int v2; // edi@1 | |
2458 int v3; // esi@1 | |
2459 int result; // eax@2 | |
2460 unsigned int v5; // ebx@4 | |
2461 | |
2462 v2 = uDiceSides; | |
2463 v3 = 0; | |
2464 if ( uDiceSides ) | |
2465 { | |
2466 if ( (signed int)uNumDice > 0 ) | |
2467 { | |
2468 v5 = uNumDice; | |
2469 do | |
2470 { | |
2471 --v5; | |
2472 v3 += rand() % v2 + 1; | |
2473 } | |
2474 while ( v5 ); | |
2475 } | |
2476 result = v3; | |
2477 } | |
2478 else | |
2479 { | |
2480 result = 0; | |
2481 } | |
2482 return result; | |
2483 } | |
2484 | |
2485 //----- (00453F62) -------------------------------------------------------- | |
2486 void MapStats::Initialize() | |
2487 { | |
237 | 2488 char work_str[32]; // [sp+Ch] [bp-34h]@3 |
2489 int work_str_pos; | |
2490 int work_str_len; | |
2491 int i; | |
2492 char* test_string; | |
2493 unsigned char c; | |
2494 bool break_loop; | |
2495 unsigned int temp_str_len; | |
2496 char* tmp_pos; | |
2497 int decode_step; | |
2498 int item_counter; | |
2499 | |
0 | 2500 if ( pMapStatsTXT_Raw ) |
2501 pAllocator->FreeChunk(pMapStatsTXT_Raw); | |
237 | 2502 pMapStatsTXT_Raw = NULL; |
0 | 2503 pMapStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("MapStats.txt", 0); |
2504 strtok(pMapStatsTXT_Raw, "\r"); | |
237 | 2505 strtok(NULL, "\r"); |
2506 strtok(NULL, "\r"); | |
2507 | |
2508 for (i=1; i<77; ++i) | |
2509 { | |
2510 test_string = strtok(NULL, "\r") + 1; | |
2511 break_loop = false; | |
2512 decode_step=0; | |
2513 do | |
2514 { | |
2515 c = *(unsigned char*)test_string; | |
2516 temp_str_len = 0; | |
2517 while((c!='\t')&&(c>0)) | |
2518 { | |
2519 ++temp_str_len; | |
2520 c=test_string[temp_str_len]; | |
2521 } | |
2522 tmp_pos=test_string+temp_str_len; | |
2523 if (*tmp_pos == 0) | |
2524 break_loop = true; | |
2525 *tmp_pos = 0; | |
2526 if (temp_str_len) | |
2527 { | |
2528 switch (decode_step) | |
2529 { | |
2530 case 1: | |
2531 pInfos[i].pName = RemoveQuotes(test_string); | |
2532 break; | |
2533 case 2: | |
2534 pInfos[i].pFilename = RemoveQuotes(test_string); | |
2535 break; | |
2536 case 3: | |
2537 pInfos[i].uNumResets = atoi(test_string); | |
2538 break; | |
2539 case 4: | |
2540 pInfos[i].uFirstVisitedAt = atoi(test_string); | |
2541 break; | |
2542 case 5: | |
2543 pInfos[i]._per = atoi(test_string); | |
2544 break; | |
2545 case 6: | |
2546 pInfos[i].uRespawnIntervalDays = atoi(test_string); | |
2547 break; | |
2548 case 7: | |
2549 pInfos[i]._alert_days = atoi(test_string); | |
2550 break; | |
2551 case 8: | |
2552 pInfos[i]._steal_perm = atoi(test_string); | |
2553 break; | |
2554 case 9: | |
2555 pInfos[i].LockX5 = atoi(test_string); | |
2556 break; | |
2557 case 10: | |
2558 pInfos[i].Trap_D20 = atoi(test_string); | |
2559 break; | |
2560 case 11: | |
2561 pInfos[i].Treasure_prob = atoi(test_string); | |
2562 break; | |
2563 case 12: | |
2564 pInfos[i].Encounter_percent = atoi(test_string); | |
2565 break; | |
2566 case 13: | |
2567 pInfos[i].EncM1percent = atoi(test_string); | |
2568 break; | |
2569 case 14: | |
2570 pInfos[i].EncM2percent = atoi(test_string); | |
2571 break; | |
2572 case 15: | |
2573 pInfos[i].EncM3percent = atoi(test_string); | |
2574 break; | |
2575 case 16: | |
2576 pInfos[i].pEncounterMonster1Texture = RemoveQuotes(test_string); | |
2577 break; | |
2578 case 18: | |
2579 pInfos[i].Dif_M1 = atoi(test_string); | |
2580 break; | |
2581 case 19: | |
2582 pInfos[i].uEncounterMonster1AtLeast = 1; | |
2583 pInfos[i].uEncounterMonster1AtMost = 1; | |
2584 strcpy(work_str, test_string); | |
2585 work_str_pos = 0; | |
2586 work_str_len=strlen(work_str); | |
2587 if (work_str_len ) | |
2588 { | |
2589 while (work_str[work_str_pos] != '-' ) | |
2590 { | |
2591 ++work_str_pos; | |
2592 if (work_str_pos >= work_str_len ) | |
2593 break; | |
2594 } | |
2595 work_str[work_str_pos] = 0; | |
2596 pInfos[i].uEncounterMonster1AtLeast = atoi(work_str); | |
2597 if ( work_str_pos < work_str_len ) | |
2598 pInfos[i].uEncounterMonster1AtMost = atoi(&work_str[work_str_pos + 1]); | |
2599 else | |
2600 pInfos[i].uEncounterMonster1AtMost = pInfos[i].uEncounterMonster1AtLeast; | |
2601 } | |
2602 break; | |
2603 case 20: | |
2604 pInfos[i].pEncounterMonster2Texture = RemoveQuotes(test_string); | |
2605 break; | |
2606 case 22: | |
2607 pInfos[i].Dif_M2 = atoi(test_string); | |
2608 break; | |
2609 case 23: | |
2610 pInfos[i].uEncounterMonster2AtLeast = 1; | |
2611 pInfos[i].uEncounterMonster2AtMost = 1; | |
2612 strcpy(work_str, test_string); | |
2613 work_str_pos = 0; | |
2614 work_str_len=strlen(work_str); | |
2615 if (work_str_len ) | |
2616 { | |
2617 while (work_str[work_str_pos] != '-' ) | |
2618 { | |
2619 ++work_str_pos; | |
2620 if (work_str_pos >= work_str_len ) | |
2621 break; | |
2622 } | |
2623 work_str[work_str_pos] = 0; | |
2624 pInfos[i].uEncounterMonster2AtLeast = atoi(work_str); | |
2625 if ( work_str_pos < work_str_len ) | |
2626 pInfos[i].uEncounterMonster2AtMost = atoi(&work_str[work_str_pos + 1]); | |
2627 else | |
2628 pInfos[i].uEncounterMonster2AtMost = pInfos[i].uEncounterMonster2AtLeast; | |
2629 } | |
2630 break; | |
2631 case 24: | |
2632 pInfos[i].pEncounterMonster3Texture = RemoveQuotes(test_string); | |
2633 break; | |
2634 case 26: | |
2635 pInfos[i].Dif_M3 = atoi(test_string); | |
2636 break; | |
2637 case 27: | |
2638 pInfos[i].uEncounterMonster3AtLeast = 1; | |
2639 pInfos[i].uEncounterMonster3AtMost = 1; | |
2640 strcpy(work_str, test_string); | |
2641 work_str_pos = 0; | |
2642 work_str_len=strlen(work_str); | |
2643 if (work_str_len ) | |
2644 { | |
2645 while (work_str[work_str_pos] != '-' ) | |
2646 { | |
2647 ++work_str_pos; | |
2648 if (work_str_pos >= work_str_len ) | |
2649 break; | |
2650 } | |
2651 work_str[work_str_pos] = 0; | |
2652 pInfos[i].uEncounterMonster3AtLeast = atoi(work_str); | |
2653 if ( work_str_pos < work_str_len ) | |
2654 pInfos[i].uEncounterMonster3AtMost = atoi(&work_str[work_str_pos + 1]); | |
2655 else | |
2656 pInfos[i].uEncounterMonster3AtMost = pInfos[i].uEncounterMonster3AtLeast; | |
2657 } | |
2658 break; | |
2659 case 28: | |
2660 pInfos[i].uRedbookTrackID = atoi(test_string); | |
2661 break; | |
2662 case 29: | |
2663 { | |
2664 if ( !strcmp(test_string, "CAVE") ) | |
2665 { | |
2666 pInfos[i].uEAXEnv = 8; | |
2667 break; | |
2668 } | |
2669 if ( !strcmp(test_string, "STONEROOM") ) | |
2670 { | |
2671 pInfos[i].uEAXEnv = 5; | |
2672 break; | |
2673 } | |
2674 if ( !strcmp(test_string, "MOUNTAINS") ) | |
2675 { | |
2676 pInfos[i].uEAXEnv = 17; | |
2677 break; | |
2678 } | |
2679 if ( !strcmp(test_string, "PLAIN") ) | |
2680 { | |
2681 pInfos[i].uEAXEnv = 19; | |
2682 break; | |
2683 } | |
2684 if ( !strcmp(test_string, "FOREST") ) | |
2685 { | |
2686 pInfos[i].uEAXEnv = 15; | |
2687 break; | |
2688 } | |
2689 if ( !strcmp(test_string, "CITY") ) | |
2690 { | |
2691 pInfos[i].uEAXEnv = 16; | |
2692 break; | |
2693 } | |
2694 if ( !strcmp(test_string, "UNDERWATER") ) | |
2695 { | |
2696 pInfos[i].uEAXEnv = 22; | |
2697 break; | |
2698 } | |
2699 if ( !strcmp(test_string, "ARENA") ) | |
2700 { | |
2701 pInfos[i].uEAXEnv = 9; | |
2702 break; | |
2703 } | |
2704 if ( !strcmp(test_string, "GENERIC") ) | |
2705 { | |
2706 pInfos[i].uEAXEnv = 0; | |
2707 break; | |
2708 } | |
2709 if ( !strcmp(test_string, "PADDEDCELL") ) | |
2710 { | |
2711 pInfos[i].uEAXEnv = 1; | |
2712 break; | |
2713 } | |
2714 if ( !strcmp(test_string, "ROOM") ) | |
2715 { | |
2716 pInfos[i].uEAXEnv = 2; | |
2717 break; | |
2718 } | |
2719 if ( !strcmp(test_string, "BATHROOM") ) | |
2720 { | |
2721 pInfos[i].uEAXEnv = 3; | |
2722 break; | |
2723 } | |
2724 if ( !strcmp(test_string, "LIVINGROOM") ) | |
2725 { | |
2726 pInfos[i].uEAXEnv = 4; | |
2727 break; | |
2728 } | |
2729 if ( !strcmp(test_string, "AUDITORIUM") ) | |
2730 { | |
2731 pInfos[i].uEAXEnv = 6; | |
2732 break; | |
2733 } | |
2734 if ( !strcmp(test_string, "CONCERTHALL") ) | |
2735 { | |
2736 pInfos[i].uEAXEnv = 7; | |
2737 break; | |
2738 } | |
2739 if ( !strcmp(test_string, "HANGAR") ) | |
2740 { | |
2741 pInfos[i].uEAXEnv = 10; | |
2742 break; | |
2743 } | |
2744 if ( !strcmp(test_string, "CARPETEDHALLWAY") ) | |
2745 { | |
2746 pInfos[i].uEAXEnv = 11; | |
2747 break; | |
2748 } | |
2749 if ( !strcmp(test_string, "HALLWAY") ) | |
2750 { | |
2751 pInfos[i].uEAXEnv = 12; | |
2752 break; | |
2753 } | |
2754 if ( !strcmp(test_string, "STONECORRIDOR") ) | |
2755 { | |
2756 pInfos[i].uEAXEnv = 13; | |
2757 break; | |
2758 } | |
2759 if ( !strcmp(test_string, "ALLEY") ) | |
2760 { | |
2761 pInfos[i].uEAXEnv = 14; | |
2762 break; | |
2763 } | |
2764 if ( !strcmp(test_string, "QUARRY") ) | |
2765 { | |
2766 pInfos[i].uEAXEnv = 18; | |
2767 break; | |
2768 } | |
2769 if ( !strcmp(test_string, "PARKINGLOT") ) | |
2770 { | |
2771 pInfos[i].uEAXEnv = 20; | |
2772 break; | |
2773 } | |
2774 if ( !strcmp(test_string, "SEWERPIPE") ) | |
2775 { | |
2776 pInfos[i].uEAXEnv = 21; | |
2777 break; | |
2778 } | |
2779 if ( !strcmp(test_string, "DRUGGED") ) | |
2780 { | |
2781 pInfos[i].uEAXEnv = 23; | |
2782 break; | |
2783 } | |
2784 if ( !strcmp(test_string, "DIZZY") ) | |
2785 { | |
2786 pInfos[i].uEAXEnv = 24; | |
2787 break; | |
2788 } | |
2789 if ( !strcmp(test_string, "PSYCHOTIC") ) | |
2790 { | |
2791 pInfos[i].uEAXEnv = 25; | |
2792 break; | |
2793 } | |
2794 pInfos[i].uEAXEnv = 26; | |
2795 | |
2796 } | |
2797 break; | |
2798 } | |
2799 } | |
2800 else | |
2801 { | |
2802 break_loop = true; | |
2803 } | |
2804 ++decode_step; | |
2805 test_string=tmp_pos+1; | |
2806 } while ((decode_step<31)&&!break_loop); | |
2807 } | |
2808 | |
2809 uNumMaps = 77; | |
0 | 2810 } |
2811 // 453F62: using guessed type char Str[32]; | |
2812 | |
2813 //----- (004547A3) -------------------------------------------------------- | |
767 | 2814 MAP_TYPE MapStats::GetMapInfo(const char *Str2) |
2815 { | |
2816 assert(uNumMaps >= 2); | |
2817 | |
2818 for (uint i = 1; i < uNumMaps; ++i) | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1150
diff
changeset
|
2819 if (!_stricmp(pInfos[i].pFilename, Str2)) |
767 | 2820 return (MAP_TYPE)i; |
2821 | |
2822 assert(false && "Map not found!"); | |
0 | 2823 } |
2824 | |
2825 //----- (004547E4) -------------------------------------------------------- | |
2826 void FactionTable::Initialize() | |
2827 { | |
237 | 2828 int i; |
2829 char* test_string; | |
2830 unsigned char c; | |
2831 bool break_loop; | |
2832 unsigned int temp_str_len; | |
2833 char* tmp_pos; | |
2834 int decode_step; | |
2835 int item_counter; | |
2836 | |
0 | 2837 if ( pHostileTXT_Raw ) |
2838 pAllocator->FreeChunk(pHostileTXT_Raw); | |
237 | 2839 pHostileTXT_Raw = NULL; |
0 | 2840 pHostileTXT_Raw = (char *)pEvents_LOD->LoadRaw("hostile.txt", 0); |
2841 strtok(pHostileTXT_Raw, "\r"); | |
237 | 2842 for (i=0; i<89; ++i) |
2843 { | |
2844 test_string = strtok(NULL, "\r") + 1; | |
2845 break_loop = false; | |
2846 decode_step=0; | |
2847 do | |
2848 { | |
2849 c = *(unsigned char*)test_string; | |
2850 temp_str_len = 0; | |
2851 while((c!='\t')&&(c>0)) | |
2852 { | |
2853 ++temp_str_len; | |
2854 c=test_string[temp_str_len]; | |
2855 } | |
2856 tmp_pos=test_string+temp_str_len; | |
2857 if (*tmp_pos == 0) | |
2858 break_loop = true; | |
2859 *tmp_pos = 0; | |
2860 if (temp_str_len) | |
2861 { | |
2862 if ( decode_step >= 1 && decode_step < 90 ) | |
2863 relations[decode_step-1][i] = atoi(test_string); | |
2864 } | |
2865 else | |
2866 { | |
2867 break_loop = true; | |
2868 } | |
2869 ++decode_step; | |
2870 test_string=tmp_pos+1; | |
2871 } while ((decode_step<92)&&!break_loop); | |
2872 } | |
2873 if ( pHostileTXT_Raw) | |
0 | 2874 { |
2875 pAllocator->FreeChunk(pHostileTXT_Raw); | |
237 | 2876 pHostileTXT_Raw = NULL; |
0 | 2877 } |
2878 } | |
2879 | |
2880 //----- (00458244) -------------------------------------------------------- | |
1064 | 2881 int SkillToMastery( unsigned int skill_value ) |
1067 | 2882 { |
1064 | 2883 switch (skill_value & 0x1C0) |
983 | 2884 { |
2885 case 0x100: return 4; // Grandmaster | |
2886 case 0x80: return 3; // Master | |
2887 case 0x40: return 2; // Expert | |
2888 case 0x00: return 1; // Normal | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1408
diff
changeset
|
2889 } |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1408
diff
changeset
|
2890 assert(false); |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1408
diff
changeset
|
2891 return 0; |
0 | 2892 } |
2893 | |
2894 //----- (0045828B) -------------------------------------------------------- | |
2895 unsigned int __fastcall GetSpellColor(signed int a1) | |
2896 { | |
2897 unsigned __int16 v1; // dx@3 | |
2898 unsigned __int16 v2; // cx@6 | |
2899 unsigned __int16 v4; // [sp-4h] [bp-4h]@3 | |
2900 | |
2901 if ( a1 < 1 ) | |
2902 { | |
2903 if ( a1 < 12 ) | |
2904 { | |
2905 if ( a1 < 23 ) | |
2906 { | |
2907 if ( a1 < 34 ) | |
2908 { | |
2909 if ( a1 < 45 ) | |
2910 { | |
2911 if ( a1 < 56 ) | |
2912 { | |
2913 if ( a1 < 67 ) | |
2914 { | |
2915 if ( a1 < 78 ) | |
2916 { | |
2917 if ( a1 < 89 ) | |
1416 | 2918 { |
2919 v4 = 0; | |
2920 v1 = 0; | |
2921 v2 = 0; | |
2922 return TargetColor(v2, v1, v4); | |
2923 } | |
0 | 2924 } |
1416 | 2925 else |
2926 { | |
0 | 2927 LABEL_25: |
1416 | 2928 if ( a1 < 89 ) |
2929 { | |
2930 v4 = 155; | |
2931 v2 = 255; | |
2932 v1 = v2; | |
2933 return TargetColor(v2, v1, v4); | |
2934 } | |
2935 } | |
0 | 2936 if ( a1 < 100 ) |
2937 { | |
2938 v4 = 240; | |
2939 v2 = 192; | |
1416 | 2940 v1 = v2; |
2941 return TargetColor(v2, v1, v4); | |
0 | 2942 } |
2943 v4 = 0; | |
2944 v1 = 0; | |
1416 | 2945 v2 = 0; |
2946 return TargetColor(v2, v1, v4); | |
0 | 2947 } |
2948 LABEL_21: | |
2949 if ( a1 < 78 ) | |
2950 { | |
2951 v4 = 0; | |
2952 v1 = 128; | |
1416 | 2953 v2 = 255; |
2954 return TargetColor(v2, v1, v4); | |
0 | 2955 } |
2956 goto LABEL_25; | |
2957 } | |
2958 LABEL_18: | |
2959 if ( a1 < 67 ) | |
2960 { | |
2961 v4 = 255; | |
2962 v1 = 15; | |
2963 v2 = 235; | |
949 | 2964 return TargetColor(v2, v1, v4); |
0 | 2965 } |
2966 goto LABEL_21; | |
2967 } | |
2968 LABEL_15: | |
2969 if ( a1 < 56 ) | |
2970 { | |
2971 v2 = 225; | |
1416 | 2972 v4 = v2; |
2973 v1 = v2; | |
2974 return TargetColor(v2, v1, v4); | |
0 | 2975 } |
2976 goto LABEL_18; | |
2977 } | |
2978 LABEL_11: | |
2979 if ( a1 < 45 ) | |
2980 { | |
2981 v2 = 128; | |
2982 v4 = v2; | |
2983 v1 = v2; | |
949 | 2984 return TargetColor(v2, v1, v4); |
0 | 2985 } |
2986 goto LABEL_15; | |
2987 } | |
2988 LABEL_8: | |
2989 if ( a1 < 34 ) | |
2990 { | |
2991 v4 = 255; | |
2992 v1 = 128; | |
2993 v2 = 0; | |
949 | 2994 return TargetColor(v2, v1, v4); |
0 | 2995 } |
2996 goto LABEL_11; | |
2997 } | |
2998 } | |
2999 else | |
3000 { | |
3001 if ( a1 < 12 ) | |
3002 { | |
3003 v4 = 0; | |
3004 v1 = 85; | |
3005 v2 = 255; | |
949 | 3006 return TargetColor(v2, v1, v4); |
0 | 3007 } |
3008 } | |
3009 if ( a1 >= 23 ) | |
3010 goto LABEL_8; | |
3011 v4 = 255; | |
3012 v1 = 212; | |
3013 v2 = 150; | |
949 | 3014 return TargetColor(v2, v1, v4); |
0 | 3015 } |
3016 | |
3017 //----- (004610AA) -------------------------------------------------------- | |
3018 void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2) | |
3019 { | |
3020 unsigned int v2; // edi@1 | |
3021 OutdoorCamera *v3; // esi@1 | |
3022 | |
3023 v2 = bLoading; | |
3024 v3 = a2; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3025 pGameLoadingUI_ProgressBar->Reset(27); |
0 | 3026 pSoundList->_4A9D79(0); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3027 uCurrentlyLoadedLevelType = LEVEL_Outdoor; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3028 ODM_LoadAndInitialize(pCurrentMapName, v3); |
0 | 3029 if ( !v2 ) |
3030 TeleportToStartingPoint(uLevel_StartingPointType); | |
3031 viewparams->_443365(); | |
3032 PlayLevelMusic(); | |
3033 } | |
3034 // 6BE35C: using guessed type int uLevel_StartingPointType; | |
3035 | |
3036 //----- (00461103) -------------------------------------------------------- | |
1459 | 3037 void _461103_load_level_sub() |
0 | 3038 { |
3039 //GUIProgressBar *v0; // ebx@1 | |
3040 //signed int v1; // ebp@1 | |
3041 //char *v2; // esi@2 | |
3042 __int16 v3; // cx@3 | |
3043 int v4; // edx@8 | |
3044 //size_t v5; // edi@14 | |
3045 signed int v6; // esi@14 | |
3046 //char *v7; // edx@15 | |
3047 signed int v8; // ecx@16 | |
3048 int v9; // ecx@23 | |
3049 MonsterInfo *v10; // ebx@23 | |
3050 //int *v11; // esi@23 | |
3051 int v12; // esi@25 | |
3052 int v13; // eax@26 | |
3053 __int16 v14; // ax@41 | |
3054 //signed int v15; // [sp+10h] [bp-4Ch]@1 | |
3055 //signed int v16; // [sp+10h] [bp-4Ch]@14 | |
3056 signed int v17; // [sp+14h] [bp-48h]@3 | |
3057 signed int v18; // [sp+14h] [bp-48h]@23 | |
3058 int v19; // [sp+18h] [bp-44h]@1 | |
3059 signed int v20; // [sp+18h] [bp-44h]@14 | |
3060 int v21[16]; // [sp+1Ch] [bp-40h]@17 | |
3061 | |
598 | 3062 GenerateItemsInChest(); |
0 | 3063 //v0 = pGameLoadingUI_ProgressBar; |
3064 pGameLoadingUI_ProgressBar->Progress(); | |
3065 pParty->uFlags |= 2u; | |
3066 pParty->field_7B5_in_arena_quest = 0; | |
3067 //v1 = 0; | |
3068 dword_5C6DF8 = 1; | |
291 | 3069 pNPCStats->uNewlNPCBufPos = 0; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3070 v19 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 3071 |
3072 //v15 = 0; | |
3073 for (uint i = 0; i < uNumActors; ++i) | |
3074 //if ( (signed int)uNumActors > 0 ) | |
3075 { | |
1202 | 3076 auto pActor = &pActors[i]; |
0 | 3077 //v2 = (char *)&pActors[0].uNPC_ID; |
3078 //do | |
3079 //{ | |
3080 v3 = pActor->pMonsterInfo.uID; | |
3081 v17 = 0; | |
3082 if ( v3 >= 115 && v3 <= 186 || v3 >= 232 && v3 <= 249 ) | |
3083 v17 = 1; | |
3084 //v1 = 0; | |
3085 v4 = (v3 - 1) % 3; | |
3086 if ( 2 == v4 ) | |
3087 { | |
602 | 3088 if ( pActor->sNPC_ID && pActor->sNPC_ID < 5000 ) |
0 | 3089 continue; |
3090 } | |
3091 else | |
3092 { | |
3093 if ( v4 != 1 ) | |
3094 { | |
1416 | 3095 if ( v4 == 0 && pActor->sNPC_ID == 0 ) |
3096 pActor->sNPC_ID = 0; | |
3097 continue; | |
0 | 3098 } |
3099 } | |
602 | 3100 if ( pActor->sNPC_ID > 0 && pActor->sNPC_ID < 5000 ) |
0 | 3101 continue; |
3102 if ( v17 ) | |
3103 { | |
291 | 3104 pNPCStats->InitializeAdditionalNPCs(&pNPCStats->pAdditionalNPC[pNPCStats->uNewlNPCBufPos], v3, 0, v19); |
3105 v14 = LOWORD(pNPCStats->uNewlNPCBufPos) + 5000; | |
3106 ++pNPCStats->uNewlNPCBufPos; | |
602 | 3107 pActor->sNPC_ID = v14; |
0 | 3108 continue; |
3109 } | |
602 | 3110 pActor->sNPC_ID = 0; |
0 | 3111 //++v15; |
3112 //v2 += 836; | |
3113 //} | |
3114 //while ( v15 < (signed int)uNumActors ); | |
3115 } | |
3116 | |
3117 pGameLoadingUI_ProgressBar->Progress(); | |
3118 | |
3119 //v5 = uNumActors; | |
3120 v6 = 0; | |
3121 v20 = 0; | |
3122 //v16 = v1; | |
3123 | |
3124 for (uint i = 0; i < uNumActors; ++i) | |
3125 { | |
1202 | 3126 auto pActor = &pActors[i]; |
0 | 3127 //v7 = (char *)&pActors[0].pMonsterInfo; |
3128 //do | |
3129 //{ | |
3130 v8 = 0; | |
3131 if ( v6 > 0 ) | |
3132 { | |
3133 do | |
3134 { | |
3135 if ( v21[v8] == pActor->pMonsterInfo.uID - 1 ) | |
3136 break; | |
3137 ++v8; | |
3138 } | |
3139 while ( v8 < v6 ); | |
3140 } | |
3141 | |
3142 if ( v8 == v6 ) | |
3143 { | |
3144 v21[v6++] = pActor->pMonsterInfo.uID - 1; | |
3145 v20 = v6; | |
3146 if ( v6 == 16 ) | |
3147 break; | |
3148 } | |
3149 //++v16; | |
3150 //v7 += 836; | |
3151 //} | |
3152 //while ( v16 < (signed int)v5 ); | |
3153 } | |
3154 | |
3155 pGameLoadingUI_ProgressBar->Progress(); | |
3156 | |
3157 if ( v6 > 0 ) | |
3158 { | |
3159 int _v0 = 0; | |
3160 do | |
3161 { | |
3162 v9 = v21[_v0]; | |
3163 v18 = 4; | |
3164 v10 = &pMonsterStats->pInfos[v9 + 1]; | |
3165 //v11 = (int *)pMonsterList->pMonsters[v9].pSoundSampleIDs; | |
3166 auto v11 = &pMonsterList->pMonsters[v9]; | |
3167 do | |
3168 { | |
3169 pSoundList->LoadSound(v11->pSoundSampleIDs[4 - v18], 0); | |
3170 //v11 = (int *)((char *)v11 + 2); | |
3171 --v18; | |
3172 } | |
3173 while ( v18 ); | |
3174 v12 = 0; | |
3175 do | |
3176 v13 = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[v10->uSpell1ID], 1); | |
3177 while ( v13 ); | |
3178 ++_v0; | |
3179 } | |
3180 while ( _v0 < v6 ); | |
3181 //v0 = pGameLoadingUI_ProgressBar; | |
3182 //v1 = 0; | |
3183 } | |
3184 | |
3185 pGameLoadingUI_ProgressBar->Progress(); | |
3186 | |
3187 if ( dword_6BE368_debug_settings_2 & 4 ) | |
3188 uNumActors = 0; | |
3189 if ( dword_6BE368_debug_settings_2 & 8 ) | |
3190 uNumLevelDecorations = 0; | |
1459 | 3191 init_event_triggers(); |
0 | 3192 |
3193 pGameLoadingUI_ProgressBar->Progress(); | |
3194 | |
3195 pIndoorCamera->pos.y = 0; | |
3196 pIndoorCamera->pos.x = 0; | |
3197 pIndoorCamera->pos.z = 100; | |
3198 pIndoorCamera->sRotationY = 0; | |
3199 pIndoorCamera->sRotationX = 0; | |
3200 viewparams->bRedrawGameUI = 1; | |
783 | 3201 uLevel_StartingPointType = MapStartPoint_Party; |
0 | 3202 pSprites_LOD->_461397(); |
3203 pPaletteManager->LockTestAll(); | |
3204 if ( pParty->pPickedItem.uItemID != 0 ) | |
3205 pMouse->SetCursorBitmapFromItemID(pParty->pPickedItem.uItemID); | |
3206 } | |
3207 | |
3208 //----- (004613C4) -------------------------------------------------------- | |
1459 | 3209 void init_event_triggers() |
0 | 3210 { |
1459 | 3211 uint id = pDecorationList->GetDecorIdByName("Event Trigger"); |
3212 | |
3213 num_event_triggers = 0; | |
3214 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
3215 if (pLevelDecorations[i].uDecorationDescID == id) | |
3216 event_triggers[num_event_triggers++] = i; | |
0 | 3217 } |
3218 | |
3219 //----- (004621DA) -------------------------------------------------------- | |
1408 | 3220 int int_get_vector_length(signed int x, signed int y, signed int z) |
0 | 3221 { |
3222 signed int v3; // eax@2 | |
1408 | 3223 |
3224 if ( x < y ) | |
3225 { | |
3226 v3 = x; | |
3227 x = y; | |
3228 y = v3; | |
3229 } | |
3230 if ( x < z ) | |
3231 { | |
3232 v3 = x; | |
3233 x = z; | |
3234 z = v3; | |
3235 } | |
3236 if ( y < z ) | |
3237 { | |
3238 v3 = y; | |
3239 y = z; | |
3240 z = v3; | |
3241 } | |
3242 return (11 * y >> 5) + x + (z >> 2); | |
0 | 3243 } |
3244 | |
3245 OPENFILENAMEA ofn; | |
3246 //----- (0046271C) -------------------------------------------------------- | |
1458 | 3247 void CreateDefaultBLVLevel() |
0 | 3248 { |
3249 ofn.lStructSize = 0x4Cu; | |
3250 ofn.hwndOwner = hWnd; | |
3251 ofn.hInstance = 0; | |
3252 ofn.lpstrFilter = "Indoor BLV Files (*.blv)"; | |
3253 ofn.lpstrCustomFilter = 0; | |
3254 ofn.nMaxCustFilter = 0; | |
3255 ofn.nFilterIndex = 0; | |
3256 ofn.lpstrFile = 0; | |
3257 ofn.nMaxFile = 260; | |
3258 ofn.nMaxFileTitle = 512; | |
3259 ofn.lpstrInitialDir = "levels"; | |
3260 ofn.lpstrTitle = "Might and Magic® VII - Load Which Level?"; | |
3261 ofn.Flags = 4; | |
3262 ofn.nFileOffset = 0; | |
3263 ofn.nFileExtension = 0; | |
3264 ofn.lpstrDefExt = "blv"; | |
3265 ofn.lCustData = 0; | |
3266 ofn.lpfnHook = 0; | |
3267 ofn.lpTemplateName = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
3268 ofn.lpstrFileTitle = pTmpBuf.data(); |
0 | 3269 } |
3270 | |
3271 //----- (004627B7) -------------------------------------------------------- | |
762 | 3272 void MainMenu_Loop() |
0 | 3273 { |
3274 GUIButton *pButton; // eax@27 | |
3275 unsigned int pControlParam; // ecx@35 | |
3276 int v10; // ecx@36 | |
3277 int v11; // ecx@37 | |
3278 unsigned int pY; // [sp-18h] [bp-54h]@39 | |
3279 Texture *pTexture; // [sp-14h] [bp-50h]@39 | |
3280 GUIButton *pButton2; // [sp+0h] [bp-3Ch]@27 | |
3281 GUIWindow *pWindow; // [sp+4h] [bp-38h]@11 | |
3282 | |
151 | 3283 pCurrentScreen = SCREEN_GAME; |
1038 | 3284 |
0 | 3285 pGUIWindow2 = 0; |
3286 pAudioPlayer->StopChannels(-1, -1); | |
3287 pMouse->RemoveHoldingItem(); | |
762 | 3288 |
3289 pIcons_LOD->_inlined_sub2(); | |
3290 | |
165 | 3291 pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); |
3292 auto pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); | |
0 | 3293 auto pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); |
3294 auto pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE); | |
3295 auto pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE); | |
948 | 3296 |
3297 pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 'N', "", pNew, 0); | |
3298 pMainMenu_BtnLoad = pWindow_MainMenu->CreateButton(495, 227, pLoad->uTextureWidth, pLoad->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowLoadWindow, 1, 'L', "", pLoad, 0); | |
3299 pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, UIMSG_ShowCredits, 2, 'C', "", pCredits, 0); | |
3300 pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth, pExit->uTextureHeight, 1, 0, UIMSG_ExitToWindows, 3, 0, "", pExit, 0); | |
3301 | |
0 | 3302 pTexture_PCX.Release(); |
3303 pTexture_PCX.Load("title.pcx", 0); | |
3304 SetCurrentMenuID(MENU_MAIN); | |
3305 SetForegroundWindow(hWnd); | |
3306 SendMessageW(hWnd, WM_ACTIVATEAPP, 1, 0); | |
3307 while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD) | |
3308 { | |
3309 POINT pt; | |
3310 pMouse->GetCursorPos(&pt); | |
3311 pWindow = pWindow_MainMenu; | |
165 | 3312 if ( GetCurrentMenuID() == MENU_SAVELOAD) |
0 | 3313 { |
151 | 3314 if ( pCurrentScreen != SCREEN_LOADGAME ) |
0 | 3315 { |
3316 pTexture_PCX.Release(); | |
3317 pTexture_PCX.Load("lsave640.pcx", 0); | |
3318 pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
151 | 3319 pCurrentScreen = SCREEN_LOADGAME; |
1033 | 3320 LoadUI_Load(0); |
0 | 3321 } |
3322 pWindow = pGUIWindow_CurrentMenu; | |
3323 } | |
3324 | |
3325 MSG msg; | |
165 | 3326 while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) ) |
0 | 3327 { |
3328 if (msg.message == WM_QUIT) | |
3329 Game_DeinitializeAndTerminate(0); | |
3330 TranslateMessage(&msg); | |
3331 DispatchMessageA(&msg); | |
3332 } | |
3333 if (dword_6BE364_game_settings_1 & 0x0100) | |
3334 { | |
3335 WaitMessage(); | |
3336 } | |
3337 else | |
3338 { | |
3339 pRenderer->BeginScene(); | |
3340 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); | |
1038 | 3341 |
165 | 3342 GUI_MainMenuMessageProc(); |
0 | 3343 GUI_UpdateWindows(); |
1038 | 3344 |
165 | 3345 if (GetCurrentMenuID() != MENU_MAIN) |
3346 { | |
961 | 3347 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) |
0 | 3348 { |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
3349 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 3350 pGUIWindow_CurrentMenu->Release(); |
3351 pGUIWindow_CurrentMenu = 0; | |
151 | 3352 pCurrentScreen = SCREEN_GAME; |
0 | 3353 viewparams->bRedrawGameUI = 1; |
3354 } | |
3355 } | |
3356 else | |
3357 { | |
1458 | 3358 if ( !pModalWindow )// ??? |
0 | 3359 { |
3360 pButton = pWindow->pControlsHead; | |
3361 for ( pButton = pWindow->pControlsHead; pButton; pButton = pButton->pNext ) | |
3362 { | |
3363 if ( pt.x >= (signed int)pButton->uX && pt.x <= (signed int)pButton->uZ | |
3364 && pt.y >= (signed int)pButton->uY && pt.y <= (signed int)pButton->uW | |
3365 && pWindow == pWindow_MainMenu ) | |
3366 { | |
832 | 3367 pControlParam = pButton->msg_param; |
0 | 3368 switch (pControlParam) // ïîäñâåòêà êíîïîê |
3369 { | |
3370 case 0: | |
3371 pTexture = pNew; | |
3372 pY = 172; | |
3373 break; | |
3374 case 1: | |
3375 pTexture = pLoad; | |
3376 pY = 227; | |
3377 break; | |
3378 case 2: | |
3379 pTexture = pCredits; | |
3380 pY = 282; | |
3381 break; | |
3382 case 3: | |
3383 pTexture = pExit; | |
3384 pY = 337; | |
3385 break; | |
3386 } | |
3387 pRenderer->DrawTextureIndexed(495, pY, pTexture); //ïîäñâåòêà êíîïîê | |
3388 } | |
3389 } | |
3390 } | |
3391 } | |
3392 pRenderer->EndScene(); | |
3393 pRenderer->Present(); | |
3394 } | |
3395 } | |
970 | 3396 GUI_MainMenuMessageProc(); |
0 | 3397 pRenderer->BeginScene(); |
3398 GUI_UpdateWindows(); | |
3399 pRenderer->EndScene(); | |
3400 pRenderer->Present(); | |
961 | 3401 pTexture_PCX.Release(); |
0 | 3402 if ( pGUIWindow2 ) |
3403 { | |
3404 pGUIWindow2->Release(); | |
3405 pGUIWindow2 = 0; | |
3406 } | |
3407 pWindow_MainMenu->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
3408 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 3409 } |
3410 | |
3411 //----- (004637EB) -------------------------------------------------------- | |
3412 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) | |
3413 { | |
3414 HANDLE v6; // eax@32 | |
3415 HDC v10; // edi@50 | |
3416 int v11; // esi@50 | |
3417 signed int v13; // eax@135 | |
3418 char v29; // dl@209 | |
3419 bool v31; // ebx@211 | |
3420 float v33; // ST04_4@246 | |
3421 float v34; // ST04_4@254 | |
3422 struct tagPAINTSTRUCT Paint; // [sp+24h] [bp-48h]@13 | |
3423 int pXY[2]; // [sp+64h] [bp-8h]@261 | |
3424 int a2; // [sp+7Ch] [bp+10h]@50 | |
1467 | 3425 |
0 | 3426 switch (Msg) |
3427 { | |
1458 | 3428 case WM_SIZING: return 1; |
1467 | 3429 case WM_SHOWWINDOW: |
3430 case WM_GETTEXT: | |
0 | 3431 case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam); |
1467 | 3432 |
3433 case WM_WINDOWPOSCHANGED: | |
3434 { | |
3435 if (pVideoPlayer && pVideoPlayer->AnyMovieLoaded() && pVideoPlayer->pBinkBuffer) | |
3436 BinkBufferSetOffset(pVideoPlayer->pBinkBuffer, 0, 0); | |
3437 | |
3438 return DefWindowProcW(hWnd, Msg, wParam, lParam); | |
3439 } | |
3440 | |
832 | 3441 case WM_CHAR: |
3442 { | |
3443 if (!pKeyActionMap->_459F10(wParam) && !viewparams->field_4C) | |
3444 GUI_HandleHotkey(wParam); | |
3445 } | |
3446 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
922 | 3447 |
1458 | 3448 |
3449 case WM_DEVICECHANGE: | |
3450 { | |
3451 if (wParam == 0x8000) // CD or some device has been inserted - notify InsertCD dialog | |
3452 PostMessageA(hInsertCDWindow, WM_USER + 1, 0, 0); | |
3453 return 0; | |
3454 } | |
3455 | |
922 | 3456 case WM_COMMAND: |
3457 { | |
3458 switch (wParam) | |
3459 { | |
947 | 3460 case 103: pRenderer->SavePCXScreenshot(); return 0; |
3461 | |
3462 case 101: // Quit game | |
922 | 3463 case 40001: |
1067 | 3464 SendMessageA(::hWnd, WM_DESTROY, 0, 0); |
922 | 3465 return 0; |
3466 | |
3467 | |
3468 case 104: | |
3469 pRenderer->ChangeBetweenWinFullscreenModes(); | |
3470 if ( pArcomageGame->bGameInProgress ) | |
3471 pArcomageGame->field_F6 = 1; | |
3472 return 0; | |
3473 | |
952 | 3474 //SubMenu "Party" |
947 | 3475 case 40007: pParty->SetGold(pParty->uNumGold + 10000); return 0; |
3476 case 40008: GivePartyExp(20000); return 0; | |
3477 case 40013: pParty->SetGold(0); return 0; | |
922 | 3478 |
3479 case 40059: | |
3480 for (uint i = 0; i < 4; ++i) | |
3481 pParty->pPlayers[i].uSkillPoints = 50; | |
3482 return 0; | |
947 | 3483 |
3484 case 40029: pPlayers[uActiveCharacter]->SetPertified(true); return 0; | |
3485 case 40030: pPlayers[uActiveCharacter]->SetWeak(true); return 0; | |
3486 case 40031: pPlayers[uActiveCharacter]->SetPoison3(true); return 0; | |
3487 case 40032: pPlayers[uActiveCharacter]->SetPoison2(true); return 0; | |
3488 case 40033: pPlayers[uActiveCharacter]->SetPoison1(true); return 0; | |
3489 case 40034: pPlayers[uActiveCharacter]->SetDisease3(true); return 0; | |
3490 case 40035: pPlayers[uActiveCharacter]->SetDisease2(true); return 0; | |
3491 case 40036: pPlayers[uActiveCharacter]->SetDisease1(true); return 0; | |
3492 case 40037: pPlayers[uActiveCharacter]->SetCursed(true); return 0; | |
3493 case 40038: pPlayers[uActiveCharacter]->SetInsane(true); return 0; | |
3494 case 40039: pPlayers[uActiveCharacter]->SetDrunk(true); return 0; | |
3495 case 40040: pPlayers[uActiveCharacter]->SetUnconcious(true); return 0; | |
3496 case 40041: pPlayers[uActiveCharacter]->SetDead(true); return 0; | |
3497 case 40042: pPlayers[uActiveCharacter]->SetEradicated(true); return 0; | |
3498 case 40043: pPlayers[uActiveCharacter]->SetAsleep(true); return 0; | |
3499 case 40044: pPlayers[uActiveCharacter]->SetAfraid(true); return 0; | |
3500 case 40045: pPlayers[uActiveCharacter]->SetParalyzed(true); return 0; | |
3501 case 40073: pPlayers[uActiveCharacter]->SetZombie(true); return 0; | |
952 | 3502 |
3503 case 40006: pParty->SetFood(pParty->uNumFoodRations + 20); return 0; | |
3504 | |
957 | 3505 case 40062: |
3506 pParty->alignment = PartyAlignment_Good; | |
3507 SetUserInterface(pParty->alignment, true); | |
3508 return 0; | |
3509 case 40063: | |
3510 pParty->alignment = PartyAlignment_Neutral; | |
3511 SetUserInterface(pParty->alignment, true); | |
3512 return 0; | |
3513 case 40064: | |
3514 pParty->alignment = PartyAlignment_Evil; | |
3515 SetUserInterface(pParty->alignment, true); | |
3516 return 0; | |
952 | 3517 |
3518 //SubMenu "Time" | |
1031 | 3519 case 40009: pParty->uTimePlayed += Timer::Day; return 0; |
3520 case 40010: pParty->uTimePlayed += Timer::Week; return 0; | |
3521 case 40011: pParty->uTimePlayed += Timer::Month; return 0; | |
3522 case 40012: pParty->uTimePlayed += Timer::Year; return 0; | |
952 | 3523 |
3524 //SubMenu "Items" | |
957 | 3525 case 40015: |
3526 { | |
3527 int pItemID = rand() % 500; | |
3528 for ( uint i = 0; i < 500; ++i ) | |
3529 { | |
3530 if ( pItemID + i > 499 ) | |
3531 pItemID = 0; | |
3532 if ( pItemsTable->pItems[pItemID + i].uItemID_Rep_St == 1 ) | |
3533 { | |
3534 pPlayers[uActiveCharacter]->AddItem(-1, pItemID + i); | |
3535 return 0; | |
3536 } | |
3537 } | |
3538 } | |
3539 return 0; | |
3540 case 40016: | |
3541 { | |
3542 int pItemID = rand() % 500; | |
3543 for ( uint i = 0; i < 500; ++i ) | |
3544 { | |
3545 if ( pItemID + i > 499 ) | |
3546 pItemID = 0; | |
3547 if ( pItemsTable->pItems[pItemID + i].uItemID_Rep_St == 2 ) | |
3548 { | |
3549 pPlayers[uActiveCharacter]->AddItem(-1, pItemID + i); | |
3550 return 0; | |
3551 } | |
3552 } | |
3553 } | |
3554 return 0; | |
3555 case 40017: | |
3556 { | |
3557 int pItemID = rand() % 500; | |
3558 for ( uint i = 0; i < 500; ++i ) | |
3559 { | |
3560 if ( pItemID + i > 499 ) | |
3561 pItemID = 0; | |
3562 if ( pItemsTable->pItems[pItemID + i].uItemID_Rep_St == 3 ) | |
3563 { | |
3564 pPlayers[uActiveCharacter]->AddItem(-1, pItemID + i); | |
3565 return 0; | |
3566 } | |
3567 } | |
3568 } | |
3569 return 0; | |
3570 case 40018: | |
3571 { | |
3572 int pItemID = rand() % 500; | |
3573 for ( uint i = 0; i < 500; ++i ) | |
3574 { | |
3575 if ( pItemID + i > 499 ) | |
3576 pItemID = 0; | |
3577 if ( pItemsTable->pItems[pItemID + i].uItemID_Rep_St == 4 ) | |
3578 { | |
3579 pPlayers[uActiveCharacter]->AddItem(-1, pItemID + i); | |
3580 return 0; | |
3581 } | |
3582 } | |
3583 } | |
3584 return 0; | |
3585 case 40019: | |
3586 { | |
3587 int pItemID = rand() % 500; | |
3588 for ( uint i = 0; i < 500; ++i ) | |
3589 { | |
3590 if ( pItemID + i > 499 ) | |
3591 pItemID = 0; | |
3592 if ( pItemsTable->pItems[pItemID + i].uItemID_Rep_St == 5 ) | |
3593 { | |
3594 pPlayers[uActiveCharacter]->AddItem(-1, pItemID + i); | |
3595 return 0; | |
3596 } | |
3597 } | |
3598 } | |
3599 return 0; | |
3600 case 40020: | |
3601 { | |
3602 int pItemID = rand() % 500; | |
3603 for ( uint i = 0; i < 500; ++i ) | |
3604 { | |
3605 if ( pItemID + i > 499 ) | |
3606 pItemID = 0; | |
3607 if ( pItemsTable->pItems[pItemID + i].uItemID_Rep_St == 6 ) | |
3608 { | |
3609 pPlayers[uActiveCharacter]->AddItem(-1, pItemID + i); | |
3610 return 0; | |
3611 } | |
3612 } | |
3613 } | |
3614 return 0; | |
3615 case 40061: | |
3616 { | |
3617 int pItemID = rand() % 500; | |
3618 for ( uint i = 0; i < 500; ++i ) | |
3619 { | |
3620 if ( pItemID + i > 499 ) | |
3621 pItemID = 0; | |
3622 if ( pItemsTable->pItems[pItemID + i].uItemID_Rep_St > 6 ) | |
3623 { | |
3624 pPlayers[uActiveCharacter]->AddItem(-1, pItemID + i); | |
3625 return 0; | |
3626 } | |
3627 } | |
3628 } | |
3629 return 0; | |
952 | 3630 |
922 | 3631 } |
3632 } | |
3633 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
0 | 3634 }; |
3635 | |
3636 if ( Msg > WM_SYSCOMMAND ) | |
3637 { | |
3638 switch ( Msg ) | |
3639 { | |
3640 case WM_LBUTTONDOWN: | |
3641 if ( pArcomageGame->bGameInProgress ) | |
3642 { | |
3643 pArcomageGame->stru1.field_0 = 7; | |
920 | 3644 ArcomageGame::OnMouseClick(0, 1); |
3645 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
0 | 3646 } |
972 | 3647 goto __handle_mouse_click; |
3648 | |
0 | 3649 case WM_RBUTTONDOWN: |
3650 v31 = 0; | |
3651 if ( !pArcomageGame->bGameInProgress ) | |
920 | 3652 //goto LABEL_240; |
3653 { | |
3654 if ( pVideoPlayer->pVideoFrame.pPixels != (unsigned __int16 *)v31 ) | |
3655 pVideoPlayer->bStopBeforeSchedule = 1; | |
1038 | 3656 |
3657 pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); | |
920 | 3658 if (pGame) |
3659 { | |
3660 v33 = pGame->pIndoorCameraD3D->GetPickDepth(); | |
3661 pGame->PickMouse(v33, (unsigned __int16)lParam, lParam >> 16, v31, &vis_sprite_filter_2, &vis_door_filter); | |
3662 } | |
1038 | 3663 |
920 | 3664 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0); |
3665 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
1038 | 3666 |
3667 } | |
3668 | |
0 | 3669 pArcomageGame->stru1.field_0 = 8; |
920 | 3670 ArcomageGame::OnMouseClick(1, 1); |
3671 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
0 | 3672 case WM_LBUTTONUP: |
3673 if ( !pArcomageGame->bGameInProgress ) | |
920 | 3674 //goto LABEL_218; |
3675 { | |
0 | 3676 back_to_game(); |
832 | 3677 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
0 | 3678 } |
920 | 3679 pArcomageGame->stru1.field_0 = 3; |
3680 ArcomageGame::OnMouseClick(0, 0); | |
3681 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
3682 case WM_RBUTTONUP: | |
3683 if ( !pArcomageGame->bGameInProgress ) | |
3684 { | |
3685 //LABEL_218: | |
1038 | 3686 |
920 | 3687 back_to_game(); |
3688 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
3689 } | |
0 | 3690 pArcomageGame->stru1.field_0 = 4; |
1250
c515e406df4a
aWinProc cleanup - removing unused vars, unnesting conditions, removeing a few DefWindowProcA calls
Grumpy7
parents:
1249
diff
changeset
|
3691 ArcomageGame::OnMouseClick(1, false); |
920 | 3692 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
972 | 3693 |
0 | 3694 case WM_LBUTTONDBLCLK: |
3695 if ( pArcomageGame->bGameInProgress ) | |
3696 { | |
3697 pArcomageGame->stru1.field_0 = 7; | |
832 | 3698 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
0 | 3699 } |
972 | 3700 |
3701 __handle_mouse_click: | |
0 | 3702 if ( pVideoPlayer->pVideoFrame.pPixels ) |
3703 pVideoPlayer->bStopBeforeSchedule = 1; | |
972 | 3704 |
0 | 3705 pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); |
972 | 3706 |
3707 if (GetCurrentMenuID() != MENU_CREATEPARTY) | |
3708 pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); | |
3709 else | |
3710 { | |
3711 UI_OnKeyDown(VK_SELECT); | |
3712 pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); | |
3713 } | |
3714 | |
1038 | 3715 |
972 | 3716 if (pGame) |
3717 pGame->PickMouse(512.0, (unsigned __int16)lParam, lParam >> 16, false, &vis_sprite_filter_3, &vis_door_filter); | |
3718 | |
0 | 3719 UI_OnMouseLeftClick(0); |
1038 | 3720 |
920 | 3721 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
972 | 3722 |
0 | 3723 case WM_RBUTTONDBLCLK: |
3724 v31 = 0; | |
3725 if ( !pArcomageGame->bGameInProgress ) | |
3726 { | |
920 | 3727 //LABEL_240: |
0 | 3728 if ( pVideoPlayer->pVideoFrame.pPixels != (unsigned __int16 *)v31 ) |
3729 pVideoPlayer->bStopBeforeSchedule = 1; | |
1038 | 3730 |
0 | 3731 pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); |
3732 if (pGame) | |
3733 { | |
871 | 3734 v33 = pGame->pIndoorCameraD3D->GetPickDepth(); |
194 | 3735 pGame->PickMouse(v33, (unsigned __int16)lParam, lParam >> 16, v31, &vis_sprite_filter_2, &vis_door_filter); |
0 | 3736 } |
1038 | 3737 |
0 | 3738 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0); |
832 | 3739 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
1038 | 3740 |
3741 } | |
0 | 3742 pArcomageGame->stru1.field_0 = 8; |
832 | 3743 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
0 | 3744 case WM_MBUTTONDOWN: |
3745 if ( pRenderer->pRenderD3D ) | |
3746 { | |
1038 | 3747 if ( pGame ) |
0 | 3748 { |
871 | 3749 v34 = pGame->pIndoorCameraD3D->GetPickDepth(); |
194 | 3750 pGame->PickMouse(v34, (unsigned __int16)lParam, lParam >> 16, 1, &vis_sprite_filter_3, &vis_face_filter); |
832 | 3751 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
0 | 3752 } |
3753 } | |
3754 if ( !pGame ) | |
920 | 3755 //goto _def_wnd_proc; |
3756 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
832 | 3757 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
0 | 3758 case WM_MOUSEMOVE: |
3759 if ( pArcomageGame->bGameInProgress ) | |
3760 { | |
3761 pXY[0] = (unsigned __int16)lParam; | |
3762 pXY[1] = lParam >> 16; | |
3763 ArcomageGame::OnMouseMove((POINT *)pXY); | |
3764 ArcomageGame::OnMouseClick(0, wParam & 1); | |
3765 v29 = (wParam >> 1) & 1; | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1104
diff
changeset
|
3766 ArcomageGame::OnMouseClick(1, v29 != 0); |
0 | 3767 } |
3768 else | |
3769 { | |
3770 pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); | |
3771 } | |
832 | 3772 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
920 | 3773 default: |
3774 //goto _def_wnd_proc; | |
3775 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
0 | 3776 } |
3777 } | |
3778 if ( Msg == WM_SYSCOMMAND ) | |
3779 { | |
3780 if ( wParam == SC_SCREENSAVE || wParam == SC_MONITORPOWER ) | |
3781 return 0; | |
920 | 3782 //goto _def_wnd_proc; |
3783 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
0 | 3784 } |
3785 if ( Msg > WM_ACTIVATEAPP ) | |
3786 { | |
1467 | 3787 if ( Msg != WM_KEYFIRST && Msg != WM_WINDOWPOSCHANGED) |
0 | 3788 { |
1250
c515e406df4a
aWinProc cleanup - removing unused vars, unnesting conditions, removeing a few DefWindowProcA calls
Grumpy7
parents:
1249
diff
changeset
|
3789 if ( Msg == WM_KEYUP && wParam == VK_CONTROL ) |
c515e406df4a
aWinProc cleanup - removing unused vars, unnesting conditions, removeing a few DefWindowProcA calls
Grumpy7
parents:
1249
diff
changeset
|
3790 { |
c515e406df4a
aWinProc cleanup - removing unused vars, unnesting conditions, removeing a few DefWindowProcA calls
Grumpy7
parents:
1249
diff
changeset
|
3791 dword_507B98_ctrl_pressed = 0; |
c515e406df4a
aWinProc cleanup - removing unused vars, unnesting conditions, removeing a few DefWindowProcA calls
Grumpy7
parents:
1249
diff
changeset
|
3792 } |
c515e406df4a
aWinProc cleanup - removing unused vars, unnesting conditions, removeing a few DefWindowProcA calls
Grumpy7
parents:
1249
diff
changeset
|
3793 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
0 | 3794 } |
1031 | 3795 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 ) |
0 | 3796 { |
3797 pKeyActionMap->_459F10(wParam); | |
832 | 3798 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
0 | 3799 } |
3800 if ( !pArcomageGame->bGameInProgress ) | |
3801 { | |
3802 if ( pVideoPlayer->pVideoFrame.pPixels ) | |
3803 pVideoPlayer->bStopBeforeSchedule = 1; | |
1067 | 3804 if ( wParam == VK_RETURN ) |
3805 { | |
3806 if ( !viewparams->field_4C ) | |
3807 UI_OnKeyDown(wParam); | |
3808 return 0; | |
3809 } | |
3810 if ( wParam == VK_CONTROL ) | |
3811 { | |
3812 dword_507B98_ctrl_pressed = 1; | |
3813 return 0; | |
3814 } | |
3815 if ( wParam == VK_ESCAPE ) | |
3816 { | |
3817 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0); | |
3818 return 0; | |
3819 } | |
3820 if ( wParam <= VK_HOME ) | |
3821 return 0; | |
3822 if ( wParam > VK_DOWN ) | |
3823 { | |
3824 if ( wParam != VK_F4 || pVideoPlayer->AnyMovieLoaded() ) | |
0 | 3825 return 0; |
1067 | 3826 SendMessageA(hWnd, WM_COMMAND, 104, 0); |
3827 return 0; | |
3828 } | |
3829 if ( wParam >= VK_LEFT && wParam <= VK_DOWN ) | |
3830 { | |
1458 | 3831 if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW ) |
1067 | 3832 { |
3833 if ( !viewparams->field_4C ) | |
3834 UI_OnKeyDown(wParam); | |
441 | 3835 return 0; |
0 | 3836 } |
1067 | 3837 } |
1458 | 3838 if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW ) |
1067 | 3839 return 0; |
0 | 3840 } |
1248
d3bf0d4fb753
aWinProc cleanup - fixing bad condition, exctracting common code from conditions, part 1
Grumpy7
parents:
1215
diff
changeset
|
3841 |
0 | 3842 pArcomageGame->stru1.field_0 = 1; |
1249
bbde4964e9b7
aWinProc cleanup - extracting conditions to a separate function
Grumpy7
parents:
1248
diff
changeset
|
3843 |
bbde4964e9b7
aWinProc cleanup - extracting conditions to a separate function
Grumpy7
parents:
1248
diff
changeset
|
3844 v13 = (unsigned __int16)MapVirtualKeyA((unsigned __int16)wParam, 2u); |
bbde4964e9b7
aWinProc cleanup - extracting conditions to a separate function
Grumpy7
parents:
1248
diff
changeset
|
3845 set_stru1_field_8_InArcomage(v13); |
920 | 3846 if ( wParam == 27 ) |
3847 { | |
1197 | 3848 pArcomageGame->GameOver = 1; |
920 | 3849 pArcomageGame->field_F4 = 1; |
3850 pArcomageGame->uGameResult = 2; | |
3851 pArcomageGame->field_B0 = -2; | |
3852 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
3853 } | |
3854 if ( wParam != 114 ) | |
3855 { | |
3856 if ( wParam == 115 && !pVideoPlayer->AnyMovieLoaded() ) | |
1249
bbde4964e9b7
aWinProc cleanup - extracting conditions to a separate function
Grumpy7
parents:
1248
diff
changeset
|
3857 SendMessageA(hWnd, 0x111u, 0x68u, 0); |
920 | 3858 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
3859 } | |
1067 | 3860 SendMessageA(hWnd, WM_COMMAND, 103, 0); |
920 | 3861 return 0; |
0 | 3862 } |
3863 if ( Msg == WM_ACTIVATEAPP ) | |
3864 { | |
3865 if ( wParam && (GetForegroundWindow() == hWnd || GetForegroundWindow() == hInsertCDWindow) ) | |
3866 { | |
3867 if ( BYTE1(dword_6BE364_game_settings_1) & 1 ) | |
3868 { | |
3869 dword_4E98BC_bApplicationActive = 1; | |
3870 if ( pRenderer->bWindowMode ) | |
3871 { | |
3872 v10 = GetDC(0); | |
3873 a2 = GetDeviceCaps(v10, BITSPIXEL); | |
3874 v11 = GetDeviceCaps(v10, PLANES); | |
3875 ReleaseDC(0, v10); | |
3876 if ( a2 != 16 || v11 != 1 ) | |
3877 Abortf(pGlobalTXT_LocalizationStrings[62]); | |
3878 } | |
3879 BYTE1(dword_6BE364_game_settings_1) &= 0xFEu; | |
1038 | 3880 |
0 | 3881 if ( pArcomageGame->bGameInProgress ) |
3882 { | |
3883 pArcomageGame->field_F9 = 1; | |
3884 } | |
3885 else | |
3886 { | |
3887 if ( BYTE1(dword_6BE364_game_settings_1) & 2 ) | |
3888 BYTE1(dword_6BE364_game_settings_1) &= 0xFDu; | |
3889 else | |
3890 pEventTimer->Resume(); | |
3891 if ( BYTE1(dword_6BE364_game_settings_1) & 4 ) | |
3892 BYTE1(dword_6BE364_game_settings_1) &= 0xFBu; | |
3893 else | |
3894 pMiscTimer->Resume(); | |
1038 | 3895 |
3896 viewparams->bRedrawGameUI = true; | |
0 | 3897 if ( pVideoPlayer->pSmackerMovie ) |
3898 { | |
3899 pRenderer->RestoreFrontBuffer(); | |
3900 pRenderer->_4A184C(); | |
3901 pVideoPlayer->_4BF5B2(); | |
3902 } | |
3903 } | |
3904 if ( pAudioPlayer->hAILRedbook && !bGameoverLoop && !pVideoPlayer->pSmackerMovie ) | |
3905 AIL_redbook_resume(pAudioPlayer->hAILRedbook); | |
3906 } | |
3907 } | |
3908 else | |
3909 { | |
3910 if ( !(dword_6BE364_game_settings_1 & 0x100) ) | |
3911 { | |
920 | 3912 while(initing); //ADDED spinlock to allow int players ets! Gloval |
3913 dword_4E98BC_bApplicationActive = 0; | |
0 | 3914 if ( (pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) && pVideoPlayer->bPlayingMovie ) |
3915 pVideoPlayer->bStopBeforeSchedule = 1; | |
1038 | 3916 |
0 | 3917 if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) |
3918 SetWindowPos(::hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); | |
3919 ClipCursor(0); | |
3920 dword_6BE364_game_settings_1 |= 0x100u; | |
3921 if ( pEventTimer->bPaused ) | |
3922 BYTE1(dword_6BE364_game_settings_1) |= 2u; | |
3923 else | |
3924 pEventTimer->Pause(); | |
3925 if ( pMiscTimer->bPaused ) | |
3926 BYTE1(dword_6BE364_game_settings_1) |= 4u; | |
3927 else | |
3928 pMiscTimer->Pause(); | |
1038 | 3929 |
0 | 3930 pAudioPlayer->StopChannels(-1, -1); |
3931 if ( pAudioPlayer->hAILRedbook ) | |
3932 AIL_redbook_pause(pAudioPlayer->hAILRedbook); | |
3933 } | |
3934 } | |
3935 return 0; | |
3936 } | |
3937 if (Msg == WM_CREATE) | |
3938 { | |
3939 auto hDC = GetDC(hWnd); | |
3940 { | |
3941 if (GetDeviceCaps(hDC, BITSPIXEL) < 8) | |
3942 { | |
3943 ReleaseDC(hWnd, hDC); | |
3944 Log::Warning(L"You must be running in 256 color mode or higher."); | |
3945 Abortf("You must be running in 256 color mode or higher. You can change the screen depth with the control panel display icon."); | |
3946 } | |
3947 } | |
3948 ReleaseDC(hWnd, hDC); | |
3949 return 0; | |
3950 } | |
3951 if ( Msg == WM_DESTROY ) | |
3952 { | |
3953 v6 = GetCurrentProcess(); | |
3954 SetPriorityClass(v6, 0x20u); | |
3955 if ( pGame ) | |
3956 { | |
1038 | 3957 |
3958 } | |
3959 | |
0 | 3960 PostQuitMessage(0); |
3961 return 0; | |
3962 } | |
3963 if ( Msg == WM_SETFOCUS ) | |
3964 { | |
3965 if ( ::hWnd == (HWND)wParam ) | |
3966 { | |
3967 dword_4E98BC_bApplicationActive = 0; | |
3968 if ( pRenderer->bUserDirect3D && pRenderer->uAcquiredDirect3DDevice == 1 ) | |
3969 SetWindowPos(::hWnd, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); | |
3970 ClipCursor(0); | |
1038 | 3971 |
0 | 3972 } |
920 | 3973 //_def_wnd_proc: |
832 | 3974 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
0 | 3975 } |
3976 if ( Msg != WM_KILLFOCUS ) | |
3977 { | |
3978 if ( Msg == WM_PAINT ) | |
3979 { | |
3980 if ( !GetUpdateRect(hWnd, 0, 0) || !dword_4E98BC_bApplicationActive && !pRenderer->bWindowMode ) | |
3981 return 0; | |
3982 BeginPaint(hWnd, &Paint); | |
3983 if ( pArcomageGame->bGameInProgress ) | |
3984 { | |
3985 pArcomageGame->field_F9 = 1; | |
3986 } | |
3987 else | |
3988 { | |
3989 if ( !pRenderer->pRenderD3D && !pRenderer->UsingDirect3D() || !AreRenderSurfacesOk() ) | |
920 | 3990 { |
3991 EndPaint(hWnd, &Paint); | |
3992 return 0; | |
3993 } | |
0 | 3994 } |
3995 pRenderer->Present(); | |
3996 EndPaint(hWnd, &Paint); | |
3997 return 0; | |
3998 } | |
920 | 3999 //goto _def_wnd_proc; |
4000 return DefWindowProcA(hWnd, Msg, wParam, lParam); | |
0 | 4001 } |
1038 | 4002 if ( ::hWnd != (HWND)wParam || (dword_4E98BC_bApplicationActive = 1, pRenderer->bWindowMode) || true ) |
832 | 4003 return DefWindowProcA(hWnd, Msg, wParam, lParam); |
1038 | 4004 |
0 | 4005 } |
4006 | |
4007 //----- (00464479) -------------------------------------------------------- | |
1458 | 4008 void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows() |
0 | 4009 { |
4010 int v0; // esi@9 | |
4011 | |
4012 if (pMouse) | |
4013 pMouse->SetCursorBitmap("MICON1"); | |
4014 | |
4015 pPaletteManager->ResetNonLocked(); | |
4016 pBitmaps_LOD->ReleaseAll2(); | |
4017 pSprites_LOD->DeleteSomeOtherSprites(); | |
4018 pIcons_LOD->ReleaseAll2(); | |
4019 if (pRenderer->pRenderD3D) | |
4020 { | |
4021 pRenderer->field_1036B8 = 0; | |
4022 pRenderer->_gpu_memory_used = 0; | |
4023 } | |
4024 sub_46080D(); | |
4025 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
4026 pIndoor->Release(); | |
4027 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4028 pOutdoor->Release2(); | |
4029 | |
4030 pAudioPlayer->StopChannels(-1, -1); | |
4031 pSoundList->_4A9D79(0); | |
4032 uCurrentlyLoadedLevelType = LEVEL_null; | |
4033 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
4034 v0 = uNumVisibleWindows; | |
349 | 4035 pParty->armageddon_timer = 0; |
0 | 4036 while ( v0 > 0 ) |
4037 pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release(); | |
4038 } | |
4039 | |
4040 //----- (004646F0) -------------------------------------------------------- | |
1458 | 4041 void PrepareWorld(unsigned int _0_box_loading_1_fullscreen) |
0 | 4042 { |
4043 if ( pRenderer->pRenderD3D ) | |
4044 pGame->pVisInstance->_4C1A02(); | |
4045 pEventTimer->Pause(); | |
4046 pMiscTimer->Pause(); | |
4047 pParty->uFlags = 2; | |
1202 | 4048 pCastSpellInfo.data()->_427D48(1); |
0 | 4049 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); |
1458 | 4050 DoPrepareWorld(0, (_0_box_loading_1_fullscreen == 0) + 1); |
0 | 4051 pMiscTimer->Resume(); |
4052 pEventTimer->Resume(); | |
4053 } | |
4054 | |
4055 //----- (00464761) -------------------------------------------------------- | |
1458 | 4056 void Game_DeinitializeAndTerminate(int exitCode) |
0 | 4057 { |
4058 int v1; // esi@1 | |
4059 HANDLE v2; // eax@1 | |
4060 | |
4061 v1 = exitCode; | |
4062 v2 = GetCurrentProcess(); | |
4063 SetPriorityClass(v2, 0x20u); | |
4064 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); | |
4065 pGame->Deinitialize(); | |
4066 pRenderer->Release2(); | |
4067 if ( !DestroyWindow(hWnd) ) | |
4068 GetLastError(); | |
4069 hWnd = 0; | |
4070 exit(v1); | |
4071 } | |
4072 | |
4073 //----- (004647AB) -------------------------------------------------------- | |
762 | 4074 void FinalInitialization() |
0 | 4075 { |
4076 pViewport->SetScreen(viewparams->uSomeX, viewparams->uSomeY, viewparams->uSomeZ, viewparams->uSomeW); | |
4077 pViewport->_4C02F8((signed __int64)(flt_6BE3A0 * 65536.0)); | |
4078 | |
4079 pIndoorCamera = new IndoorCamera; | |
762 | 4080 pIndoorCamera->Initialize(65, viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1, |
4081 viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1); | |
0 | 4082 |
4083 InitializeTurnBasedAnimations(&stru_50C198); | |
762 | 4084 pBitmaps_LOD->_inlined_sub1(); |
4085 pSprites_LOD->_inlined_sub1(); | |
4086 pIcons_LOD->_inlined_sub1(); | |
0 | 4087 } |
4088 // 6BE3A0: using guessed type float flt_6BE3A0; | |
4089 | |
4090 //----- (00464839) -------------------------------------------------------- | |
1458 | 4091 char Is_out15odm_underwater() |
0 | 4092 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4093 return _stricmp(pCurrentMapName, "out15.odm") == 0; |
0 | 4094 } |
4095 | |
4096 //----- (00464851) -------------------------------------------------------- | |
1458 | 4097 void SetUnderwaterFog() |
0 | 4098 { |
4099 day_fogrange_1 = 50; | |
4100 day_fogrange_2 = 5000; | |
4101 } | |
4102 | |
4103 //----- (00464866) -------------------------------------------------------- | |
1458 | 4104 void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box) |
0 | 4105 { |
1458 | 4106 //int v2; // esi@1 |
0 | 4107 char *v3; // eax@1 |
4108 //char *v4; // eax@1 | |
4109 unsigned int v5; // eax@3 | |
4110 //size_t v6; // ecx@10 | |
4111 //char *v7; // eax@11 | |
4112 char Str1[20]; // [sp+Ch] [bp-18h]@1 | |
4113 unsigned int v9; // [sp+20h] [bp-4h]@1 | |
4114 | |
4115 v9 = bLoading; | |
4116 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); | |
4117 pDecalBuilder->Reset(0); | |
1458 | 4118 pGameLoadingUI_ProgressBar->Initialize(_1_fullscreen_loading_2_box == 1 ? GUIProgressBar::TYPE_Fullscreen : |
4119 GUIProgressBar::TYPE_Box); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4120 strcpy(Str1, pCurrentMapName); |
0 | 4121 v3 = strtok(Str1, "."); |
4122 strcpy(Str1, v3); | |
4123 Level_LoadEvtAndStr(Str1); | |
4124 LoadLevel_InitializeLevelEvt(); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4125 strcpy(Str1, pCurrentMapName); |
0 | 4126 _strrev(Str1); |
4127 strtok(Str1, "."); | |
4128 _strrev(Str1); | |
4129 | |
4130 for (uint i = 0; i < 1000; ++i) | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
4131 pSpriteObjects[i].uObjectDescID = 0; |
0 | 4132 |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4133 v5 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 4134 bUnderwater = 0; |
4135 uLevelMapStatsID = v5; | |
4136 pGame->uFlags2 &= 0xFFFFFFF7u; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4137 if ( !_stricmp(pCurrentMapName, "out15.odm") ) |
0 | 4138 { |
4139 bUnderwater = 1; | |
4140 pGame->uFlags2 |= 8u; | |
4141 } | |
831 | 4142 pParty->floor_face_pid = 0; |
1104 | 4143 if ( _stricmp(Str1, "blv") ) |
0 | 4144 PrepareToLoadODM(v9, 0); |
4145 else | |
4146 PrepareToLoadBLV(v9); | |
4147 pAudioPlayer->SetMapEAX(); | |
1459 | 4148 _461103_load_level_sub(); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4149 if ( !_stricmp(pCurrentMapName, "d11.blv") || !_stricmp(pCurrentMapName, "d10.blv") ) |
0 | 4150 { |
4151 //spawning grounds & good analogue - no loot & exp from monsters | |
4152 | |
4153 for (uint i = 0; i < uNumActors; ++i) | |
4154 { | |
4155 pActors[i].pMonsterInfo.uTreasureType = 0; | |
4156 pActors[i].pMonsterInfo.uTreasureDiceRolls = 0; | |
4157 pActors[i].pMonsterInfo.uExp = 0; | |
4158 } | |
4159 } | |
4160 bDialogueUI_InitializeActor_NPC_ID = 0; | |
4161 OnMapLoad(); | |
4162 pGameLoadingUI_ProgressBar->Progress(); | |
1459 | 4163 memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D)); |
0 | 4164 pGameLoadingUI_ProgressBar->Release(); |
4165 _flushall(); | |
4166 } | |
4167 | |
4168 //----- (004649EF) -------------------------------------------------------- | |
4169 int __fastcall ReadWindowsRegistryInt(const char *pKey, int uDefValue) | |
4170 { | |
4171 int v3; // [sp+4h] [bp-24h]@1 | |
4172 DWORD cbData; // [sp+8h] [bp-20h]@1 | |
4173 LPCSTR lpValueName; // [sp+Ch] [bp-1Ch]@1 | |
4174 DWORD dwDisposition; // [sp+10h] [bp-18h]@2 | |
4175 BYTE Data[4]; // [sp+14h] [bp-14h]@5 | |
4176 HKEY hKey; // [sp+18h] [bp-10h]@1 | |
4177 HKEY phkResult; // [sp+1Ch] [bp-Ch]@1 | |
4178 HKEY v10; // [sp+20h] [bp-8h]@1 | |
4179 HKEY v11; // [sp+24h] [bp-4h]@1 | |
4180 | |
4181 v3 = uDefValue; | |
4182 lpValueName = pKey; | |
4183 v11 = 0; | |
4184 v10 = 0; | |
4185 hKey = 0; | |
4186 phkResult = 0; | |
4187 cbData = 4; | |
27 | 4188 if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hKey) )// for 64 bit |
0 | 4189 { |
4190 if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition) ) | |
4191 { | |
4192 if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v10, &dwDisposition) ) | |
4193 { | |
4194 if ( !RegCreateKeyExA(v10, "1.0", 0, "", 0, 0xF003Fu, 0, &v11, &dwDisposition) ) | |
4195 { | |
4196 if ( RegQueryValueExA(v11, lpValueName, 0, 0, Data, &cbData) ) | |
4197 { | |
4198 *(int *)Data = v3; | |
4199 RegSetValueExA(v11, lpValueName, 0, 4u, Data, 4u); | |
4200 } | |
4201 RegCloseKey(v11); | |
4202 } | |
4203 RegCloseKey(v10); | |
4204 } | |
4205 RegCloseKey(phkResult); | |
4206 } | |
4207 RegCloseKey(hKey); | |
4208 } | |
4209 return *(int *)Data; | |
4210 } | |
4211 | |
4212 //----- (00464B02) -------------------------------------------------------- | |
4213 void __fastcall WriteWindowsRegistryString(const char *pKey, const char *pString) | |
4214 { | |
4215 size_t v2; // eax@5 | |
4216 const char *lpValueName; // [sp+4h] [bp-1Ch]@1 | |
4217 const char *Str; // [sp+8h] [bp-18h]@1 | |
4218 DWORD dwDisposition; // [sp+Ch] [bp-14h]@2 | |
4219 HKEY hKey; // [sp+10h] [bp-10h]@1 | |
4220 HKEY phkResult; // [sp+14h] [bp-Ch]@1 | |
4221 HKEY v8; // [sp+18h] [bp-8h]@1 | |
4222 HKEY v9; // [sp+1Ch] [bp-4h]@1 | |
4223 | |
4224 Str = pString; | |
4225 lpValueName = pKey; | |
4226 v9 = 0; | |
4227 v8 = 0; | |
4228 hKey = 0; | |
4229 phkResult = 0; | |
4230 if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hKey) ) | |
4231 { | |
4232 if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition) ) | |
4233 { | |
4234 if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v8, &dwDisposition) ) | |
4235 { | |
4236 if ( !RegCreateKeyExA(v8, "1.0", 0, "", 0, 0xF003Fu, 0, &v9, &dwDisposition) ) | |
4237 { | |
4238 v2 = strlen(Str); | |
4239 RegSetValueExA(v9, lpValueName, 0, 1u, (const BYTE *)Str, v2 + 1); | |
4240 RegCloseKey(v9); | |
4241 } | |
4242 RegCloseKey(v8); | |
4243 } | |
4244 RegCloseKey(phkResult); | |
4245 } | |
4246 RegCloseKey(hKey); | |
4247 } | |
4248 } | |
4249 | |
4250 //----- (00464BEF) -------------------------------------------------------- | |
4251 void __fastcall ReadWindowsRegistryString(const char *pKeyName, char *pOutString, int uBufLen, const char *pDefaultValue) | |
4252 { | |
4253 LSTATUS (__stdcall *v4)(HKEY); // esi@1 | |
4254 LSTATUS result; // eax@7 | |
4255 DWORD Type; // [sp+Ch] [bp-24h]@5 | |
4256 LPCSTR lpValueName; // [sp+10h] [bp-20h]@1 | |
4257 DWORD cbData; // [sp+14h] [bp-1Ch]@1 | |
4258 LPBYTE Dest; // [sp+18h] [bp-18h]@1 | |
4259 DWORD dwDisposition; // [sp+1Ch] [bp-14h]@2 | |
4260 HKEY phkResult; // [sp+20h] [bp-10h]@1 | |
4261 HKEY hKey; // [sp+24h] [bp-Ch]@1 | |
4262 HKEY v13; // [sp+28h] [bp-8h]@1 | |
4263 HKEY v14; // [sp+2Ch] [bp-4h]@1 | |
4264 | |
4265 cbData = uBufLen; | |
4266 Dest = (LPBYTE)pOutString; | |
4267 lpValueName = pKeyName; | |
4268 v14 = 0; | |
4269 v13 = 0; | |
4270 hKey = 0; | |
4271 phkResult = 0; | |
4272 v4 = RegCloseKey; | |
4273 if ( RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hKey) | |
4274 || RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition) | |
4275 || RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v13, &dwDisposition) | |
4276 || RegCreateKeyExA(v13, "1.0", 0, "", 0, 0xF003Fu, 0, &v14, &dwDisposition) ) | |
1416 | 4277 { |
4278 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen); | |
4279 } | |
4280 else if ( RegQueryValueExA(v14, lpValueName, 0, &Type, Dest, &cbData) ) | |
0 | 4281 { |
4282 RegCloseKey(v14); | |
4283 v14 = 0; | |
4284 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen); | |
1416 | 4285 } |
4286 else | |
4287 { | |
4288 v4 = RegCloseKey; | |
4289 RegCloseKey(v14); | |
4290 v14 = 0; | |
4291 RegCloseKey(v13); | |
4292 v13 = 0; | |
4293 RegCloseKey(phkResult); | |
4294 phkResult = 0; | |
4295 result = RegCloseKey(hKey); | |
4296 hKey = 0; | |
4297 } | |
0 | 4298 if ( v14 ) |
4299 result = v4(v14); | |
4300 if ( v13 ) | |
4301 result = v4(v13); | |
4302 if ( hKey ) | |
4303 result = v4(hKey); | |
4304 if ( phkResult ) | |
4305 result = v4(phkResult); | |
4306 } | |
4307 | |
4308 //----- (00464D32) -------------------------------------------------------- | |
4309 void __fastcall WriteWindowsRegistryInt(const char *pKey, int val) | |
4310 { | |
4311 const char *lpValueName; // [sp+4h] [bp-1Ch]@1 | |
4312 BYTE Data[4]; // [sp+8h] [bp-18h]@1 | |
4313 DWORD dwDisposition; // [sp+Ch] [bp-14h]@2 | |
4314 HKEY hKey; // [sp+10h] [bp-10h]@1 | |
4315 HKEY phkResult; // [sp+14h] [bp-Ch]@1 | |
4316 HKEY v7; // [sp+18h] [bp-8h]@1 | |
4317 HKEY v8; // [sp+1Ch] [bp-4h]@1 | |
4318 | |
4319 *(int *)Data = val; | |
4320 lpValueName = pKey; | |
4321 v8 = 0; | |
4322 v7 = 0; | |
4323 hKey = 0; | |
4324 phkResult = 0; | |
4325 if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hKey) ) | |
4326 { | |
4327 if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition) ) | |
4328 { | |
4329 if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v7, &dwDisposition) ) | |
4330 { | |
4331 if ( !RegCreateKeyExA(v7, "1.0", 0, "", 0, 0xF003Fu, 0, &v8, &dwDisposition) ) | |
4332 { | |
4333 RegSetValueExA(v8, lpValueName, 0, 4u, Data, 4u); | |
4334 RegCloseKey(v8); | |
4335 } | |
4336 RegCloseKey(v7); | |
4337 } | |
4338 RegCloseKey(phkResult); | |
4339 } | |
4340 RegCloseKey(hKey); | |
4341 } | |
4342 } | |
4343 | |
4344 //----- (00464E17) -------------------------------------------------------- | |
4345 bool __fastcall CheckMM7CD(char c) | |
4346 { | |
4347 char DstBuf[256]; // [sp+Ch] [bp-218h]@1 | |
4348 char strCommand[256]; // [sp+10Ch] [bp-118h]@1 | |
4349 char Filename[20]; // [sp+20Ch] [bp-18h]@1 | |
4350 | |
4351 | |
4352 wchar_t pMagicPath[1024]; | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1150
diff
changeset
|
4353 swprintf(pMagicPath, wcslen(L"%C:\\anims\\magic7.vid"), L"%C:\\anims\\magic7.vid", c); |
0 | 4354 if (GetFileAttributesW(pMagicPath) == -1) |
4355 return false; | |
4356 | |
4357 wsprintfA(strCommand, "open %c: type cdaudio alias CD", c); | |
4358 if (!mciSendStringA(strCommand, DstBuf, 0xFFu, 0)) | |
4359 { | |
4360 wsprintfA(strCommand, "info CD UPC wait"); | |
4361 mciSendStringA(strCommand, DstBuf, 0xFFu, 0); | |
4362 wsprintfA(strCommand, "close CD"); | |
4363 mciSendStringA(strCommand, DstBuf, 0xFFu, 0); | |
4364 } | |
4365 | |
4366 memcpy(Filename, "X:\\anims\\magic7.vid", sizeof(Filename)); | |
4367 *Filename = c; | |
4368 | |
4369 auto f = fopen(Filename, "rb"); | |
4370 if (!f) | |
4371 return false; | |
4372 | |
4373 if (!fseek(f, 0, SEEK_END)) | |
4374 { | |
4375 if (!fseek(f, -100, SEEK_CUR)) | |
4376 fread(DstBuf, 1u, 0x64u, f); | |
4377 | |
4378 fclose(f); | |
4379 return true; | |
4380 } | |
4381 fclose(f); | |
4382 return false; | |
4383 } | |
4384 | |
4385 //----- (00464F1B) -------------------------------------------------------- | |
4386 signed int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4) | |
4387 { | |
4388 char v4; // zf@3 | |
4389 int v6; // eax@10 | |
4390 int v7; // eax@11 | |
4391 int v8; // eax@12 | |
4392 int v9; // eax@13 | |
4393 BOOL (__stdcall *v10)(HWND, int, LPCSTR); // edi@15 | |
4394 const CHAR *v11; // [sp-Ch] [bp-Ch]@15 | |
4395 INT_PTR v12; // [sp-4h] [bp-4h]@5 | |
4396 | |
4397 if ( a2 == 272 ) | |
4398 { | |
4399 hInsertCDWindow = hDlg; | |
4400 v6 = (GetUserDefaultLangID() & 0x3FF) - 7; | |
4401 if ( v6 ) | |
4402 { | |
4403 v7 = v6 - 3; | |
4404 if ( v7 ) | |
4405 { | |
4406 v8 = v7 - 2; | |
4407 if ( v8 ) | |
4408 { | |
4409 v9 = v8 - 4; | |
4410 if ( v9 ) | |
4411 { | |
4412 if ( v9 != 5 ) | |
4413 return 0; | |
4414 SetWindowTextA(hDlg, "Wloz CD-ROM numer 2"); | |
4415 v10 = SetDlgItemTextA; | |
4416 SetDlgItemTextA(hDlg, 1010, "Wloz CD-ROM numer 2 Might and Magic® VII."); | |
4417 v11 = "Odwolaj"; | |
4418 } | |
4419 else | |
4420 { | |
4421 SetWindowTextA(hDlg, "Inserire il secondo CD"); | |
4422 v10 = SetDlgItemTextA; | |
4423 SetDlgItemTextA(hDlg, 1010, "Inserire il secondo CD di Might and Magic® VII."); | |
4424 v11 = "Annulla"; | |
4425 } | |
4426 } | |
4427 else | |
4428 { | |
4429 SetWindowTextA(hDlg, "Insérez le CD 2"); | |
4430 v10 = SetDlgItemTextA; | |
4431 SetDlgItemTextA(hDlg, 1010, "Insérez Might & Magic® VII CD 2."); | |
4432 v11 = "Supprimer"; | |
4433 } | |
4434 } | |
4435 else | |
4436 { | |
4437 SetWindowTextA(hDlg, "Por favor, inserte disco 2"); | |
4438 v10 = SetDlgItemTextA; | |
4439 SetDlgItemTextA(hDlg, 1010, "Por favor, inserte disco 2 de Might & Magic® VII."); | |
4440 v11 = "Cancelar"; | |
4441 } | |
4442 } | |
4443 else | |
4444 { | |
4445 SetWindowTextA(hDlg, "Bitte CD 2 einlegen"); | |
4446 v10 = SetDlgItemTextA; | |
4447 SetDlgItemTextA(hDlg, 1010, "Bitte CD 2 von Might and Magic® VII einlegen."); | |
4448 v11 = "Abbrechen"; | |
4449 } | |
4450 v10(hDlg, 2, v11); | |
4451 return 0; | |
4452 } | |
4453 if ( a2 == 273 ) | |
4454 { | |
4455 if ( a3 == 2 ) | |
4456 { | |
4457 v12 = 0; | |
4458 EndDialog(hDlg, v12); | |
4459 return 1; | |
4460 } | |
4461 v4 = a3 == 1; | |
4462 } | |
4463 else | |
4464 { | |
4465 v4 = a2 == 1025; | |
4466 } | |
4467 if ( v4 ) | |
4468 { | |
4469 v12 = 1; | |
1416 | 4470 EndDialog(hDlg, v12); |
4471 return 1; | |
0 | 4472 } |
4473 return 0; | |
4474 } | |
4475 | |
4476 //----- (00465061) -------------------------------------------------------- | |
4477 bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive) | |
4478 { | |
4479 char drive[4] = {'X', ':', '\\', 0}; | |
4480 | |
4481 bool bGotCDFromRegistry = false; | |
4482 | |
4483 HKEY hSoftware = nullptr, | |
4484 hNWC = nullptr, | |
4485 hMM7 = nullptr, | |
4486 hVersion = nullptr; | |
4487 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hSoftware)) | |
4488 { | |
4489 if (!RegOpenKeyExA(hSoftware, "New World Computing", 0, 0x2001Fu, &hNWC)) | |
4490 { | |
4491 if (!RegOpenKeyExA(hNWC, "Might and Magic VII", 0, 0x2001Fu, &hMM7)) | |
4492 { | |
4493 if (!RegOpenKeyExA(hMM7, "1.0", 0, 0x2001Fu, &hVersion)) | |
4494 { | |
4495 DWORD cbData = 3; | |
4496 if (!RegQueryValueExA(hVersion, "CDDrive", 0, 0, (BYTE *)drive, &cbData)) | |
4497 bGotCDFromRegistry = true; | |
4498 } | |
4499 RegCloseKey(hVersion); | |
4500 } | |
4501 RegCloseKey(hMM7); | |
4502 } | |
4503 RegCloseKey(hNWC); | |
4504 } | |
4505 RegCloseKey(hSoftware); | |
4506 | |
4507 if (bGotCDFromRegistry) | |
4508 if (CheckMM7CD(*drive)) | |
4509 { | |
4510 cMM7GameCDDriveLetter = *drive; | |
4511 return true; | |
4512 } | |
4513 | |
4514 while (true) | |
4515 { | |
4516 for (uint i = 0; i < 26; ++i) | |
4517 { | |
4518 drive[0] = 'A' + i; | |
4519 | |
4520 if (GetDriveTypeA(drive) == DRIVE_CDROM) | |
4521 if (CheckMM7CD(*drive)) | |
4522 { | |
4523 cMM7GameCDDriveLetter = *drive; | |
4524 WriteWindowsRegistryString("CDDrive", drive); | |
4525 return true; | |
4526 } | |
4527 } | |
4528 | |
4529 if (DialogBoxParamA(GetModuleHandleW(nullptr), "InsertCD", ::hWnd, (DLGPROC)InsertMM7CDDialogFunc, 0)) | |
4530 continue; | |
4531 return false; | |
4532 } | |
4533 } | |
4534 | |
4535 //----- (004651F4) -------------------------------------------------------- | |
4536 bool MM7_Initialize() | |
4537 { | |
363 | 4538 initing=true; //ADDED Gloval |
0 | 4539 wchar_t pCurrentDir[1024]; |
4540 _wgetcwd(pCurrentDir, 1024); | |
4541 | |
4542 wchar_t pMM6IniFile[1024]; | |
293 | 4543 wsprintfW(pMM6IniFile, L"%s\\mm6.ini", pCurrentDir); |
0 | 4544 |
4545 bCanLoadFromCD = GetPrivateProfileIntW(L"settings", L"use_cd", 1, pMM6IniFile); | |
4546 if (bNoCD) | |
4547 bCanLoadFromCD = false; | |
4548 if (bCanLoadFromCD) | |
4549 { | |
4550 if (!FindMM7CD(hWnd, &cMM7GameCDDriveLetter)) | |
4551 return false; | |
4552 } | |
4553 | |
4554 | |
4555 srand(GetTickCount()); | |
4556 | |
4557 WNDCLASSEXW wcxw; | |
4558 { | |
4559 wcxw.cbSize = sizeof(wcxw); | |
4560 wcxw.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS; | |
4561 wcxw.lpfnWndProc = (WNDPROC)aWinProc; | |
4562 wcxw.cbClsExtra = 0; | |
4563 wcxw.cbWndExtra = 0; | |
4564 wcxw.hInstance = GetModuleHandleW(nullptr); | |
4565 wcxw.hCursor = 0; | |
4566 wcxw.hIcon = wcxw.hIconSm = LoadIconW(wcxw.hInstance, L"MM7_ICON"); | |
4567 wcxw.lpszMenuName = nullptr; | |
4568 wcxw.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); | |
4569 wcxw.lpszClassName = L"M&MTrilogy"; | |
4570 } | |
4571 if (!RegisterClassExW(&wcxw)) | |
4572 { | |
4573 Log::Warning(L"Cannot register window class"); | |
4574 return false; | |
4575 } | |
4576 | |
4577 auto hDesktopDC = GetDC(nullptr); | |
4578 uint uDesktopWidth = GetDeviceCaps(hDesktopDC, HORZRES); | |
4579 uint uDesktopHeight = GetDeviceCaps(hDesktopDC, VERTRES); | |
4580 | |
4581 if (GetDeviceCaps(hDesktopDC, BITSPIXEL) != 16 || | |
4582 GetDeviceCaps(hDesktopDC, PLANES) != 1 ) | |
4583 dword_6BE364_game_settings_1 |= 2; | |
4584 | |
4585 ReleaseDC(nullptr, hDesktopDC); | |
4586 | |
4587 uint uTotalWinWidth = 2 * GetSystemMetrics(SM_CXFRAME) + 640; | |
4588 uint uTotalWinHeight = GetSystemMetrics(SM_CYCAPTION) + 2 * GetSystemMetrics(SM_CYFRAME) + 480; | |
4589 | |
4590 uint uWinCenteredPosX = (uDesktopWidth - uTotalWinWidth) / 2; | |
4591 uint uWinCenteredPosY = (uDesktopHeight - uTotalWinHeight) / 2; | |
4592 | |
4593 uWindowX = ReadWindowsRegistryInt("window X", uWinCenteredPosX); | |
748 | 4594 uWindowX = uDesktopWidth / 2 - 640 / 2; |
0 | 4595 WriteWindowsRegistryInt("window X", uWindowX); |
4596 | |
4597 uWindowY = ReadWindowsRegistryInt("window Y", uWinCenteredPosY); | |
748 | 4598 uWindowY = uDesktopHeight / 2 - 480 / 2; |
0 | 4599 WriteWindowsRegistryInt("window Y", uWindowY); |
4600 | |
4601 hWnd = CreateWindowExW(0, wcxw.lpszClassName, L"Might and Magic® VII", | |
4602 uWindowStyle = WS_SYSMENU | WS_GROUP | WS_DLGFRAME | WS_BORDER, | |
4603 uWindowX, uWindowY, | |
4604 640, 480, | |
4605 nullptr, | |
4606 hOSMenu = nullptr, | |
4607 wcxw.hInstance, | |
4608 nullptr); | |
4609 SetWindowTextW(hWnd, L"Might and Magic® VII"); | |
736 | 4610 |
4611 HMENU menu = CreateMenu(); | |
748 | 4612 { |
4613 HMENU file = CreatePopupMenu(); | |
4614 AppendMenuW(menu, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)file, L"&File"); | |
4615 { | |
4616 AppendMenuW(file, MF_ENABLED | MF_STRING, 40001, L"Exit"); | |
4617 } | |
4618 | |
4619 HMENU debug = CreatePopupMenu(); | |
4620 AppendMenuW(menu, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug, L"&Debug"); | |
4621 { | |
4622 HMENU debug_party = CreatePopupMenu(); | |
4623 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party, L"&Party"); | |
4624 { | |
4625 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40007, L"Give Gold (10 000)"); | |
4626 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40008, L"Give Exp (20 000)"); | |
4627 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40059, L"Give Skills (50 each)"); | |
4628 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40013, L"Remove Gold"); | |
4629 | |
4630 HMENU debug_party_setconditions = CreatePopupMenu(); | |
4631 AppendMenuW(debug_party, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party_setconditions, L"Set Condition"); | |
4632 { | |
4633 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40044, L"Afraid"); | |
4634 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40043, L"Asleep"); | |
4635 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40037, L"Curse"); | |
4636 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40036, L"Disease1"); | |
4637 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40035, L"Disease2"); | |
4638 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40034, L"Disease3"); | |
4639 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40041, L"Dead"); | |
4640 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40039, L"Drunk"); | |
4641 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40042, L"Eradicated"); | |
4642 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40038, L"Insane"); | |
4643 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40045, L"Paralyzed"); | |
4644 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40033, L"Poison1"); | |
4645 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40032, L"Poison2"); | |
4646 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40031, L"Poison3"); | |
4647 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40029, L"&Stone"); | |
4648 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40040, L"Unconscious"); | |
4649 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40030, L"Weak"); | |
4650 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40073, L"Zombie"); | |
4651 } | |
4652 | |
4653 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40006, L"Set Food (20)"); | |
4654 | |
4655 HMENU debug_party_alignment = CreatePopupMenu(); | |
4656 AppendMenuW(debug_party, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party_alignment, L"Alignment"); | |
4657 { | |
4658 AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING, 40062, L"Good"); | |
4659 AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING | MF_CHECKED, 40063, L"Neutral"); | |
4660 AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING, 40064, L"Evil"); | |
4661 } | |
4662 } | |
4663 | |
4664 HMENU debug_time = CreatePopupMenu(); | |
4665 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_time, L"&Time"); | |
4666 { | |
4667 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40009, L"Add 1 Day"); | |
4668 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40010, L"Add 1 Week"); | |
4669 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40011, L"Add 1 Month"); | |
4670 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40012, L"Add 1 Year"); | |
4671 } | |
4672 | |
4673 HMENU debug_items = CreatePopupMenu(); | |
4674 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_items, L"&Items"); | |
4675 { | |
4676 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40015, L"Generate level &1 item"); | |
4677 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40016, L"Generate level &2 item"); | |
4678 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40017, L"Generate level &3 item"); | |
4679 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40018, L"Generate level &4 item"); | |
4680 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40019, L"Generate level &5 item"); | |
4681 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40020, L"Generate level &6 item"); | |
4682 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40061, L"Generate special item"); | |
4683 } | |
4684 | |
4685 HMENU debug_graphics = CreatePopupMenu(); | |
4686 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_graphics, L"&Graphics"); | |
4687 { | |
4688 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40023, L"Lighting Mode"); | |
4689 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40024, L"Lighting Geometry"); | |
4690 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40104, L"Lights Off"); | |
4691 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40105, L"Colored Lights"); | |
4692 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40025, L"Debug Lights"); | |
4693 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40101, L"Debug Decals"); | |
4694 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40027, L"HWID Portals"); | |
4695 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40047, L"SWID Portals"); | |
4696 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40051, L"OD Frustum"); | |
4697 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40054, L"SWOD Constant Redraw"); | |
4698 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40055, L"SWOD Lit Rasterizer"); | |
4699 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40056, L"Party Light off"); | |
4700 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40060, L"SWOD Nice Lighting off"); | |
4701 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40067, L"HWOD Additive Fog Lights"); | |
4702 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40072, L"HWID Nice Lighting"); | |
4703 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40048, L"Wireframe"); | |
4704 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40049, L"Fog"); | |
4705 } | |
4706 | |
4707 HMENU debug_misc = CreatePopupMenu(); | |
4708 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_misc, L"&Misc"); | |
4709 { | |
4710 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40066, L"Object Viewcone Culling"); | |
4711 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40068, L"Red Tint"); | |
4712 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40071, L"Display Secrets"); | |
4713 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40102, L"Massive Bloodsplat"); | |
4714 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40103, L"Underwater Gravity"); | |
4715 } | |
4716 | |
4717 HMENU debug_eax = CreatePopupMenu(); | |
4718 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_eax, L"EAX Environs"); | |
4719 { | |
4720 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40074, L"NONE"); | |
4721 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40075, L"GENERIC"); | |
4722 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40076, L"PADDEDCELL"); | |
4723 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40077, L"ROOM"); | |
4724 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40078, L"BATHROOM"); | |
4725 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40079, L"LIVINGROOM"); | |
4726 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40080, L"STONEROOM"); | |
4727 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40081, L"AUDITORIUM"); | |
4728 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40082, L"CONCERTHALL"); | |
4729 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40083, L"CAVE"); | |
4730 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40084, L"ARENA"); | |
4731 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40085, L"HANGAR"); | |
4732 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40086, L"CARPETEDHALLWAY"); | |
4733 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40087, L"HALLWAY"); | |
4734 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40088, L"STONECORRIDOR"); | |
4735 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40089, L"ALLEY"); | |
4736 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40090, L"FOREST"); | |
4737 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40091, L"CITY"); | |
4738 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40092, L"MOUNTAINS"); | |
4739 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40093, L"QUARRY"); | |
4740 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40094, L"PLAIN"); | |
4741 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40095, L"PARKINGLOT"); | |
4742 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40096, L"SEWERPIPE"); | |
4743 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40097, L"UNDERWATER"); | |
4744 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40098, L"DRUGGED"); | |
4745 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40099, L"DIZZY"); | |
4746 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40100, L"PSICHOTIC"); | |
4747 } | |
4748 } | |
4749 } | |
736 | 4750 SetMenu(hWnd, menu); |
492 | 4751 |
0 | 4752 SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); |
4753 | |
4754 pRenderer = Render::Create(); | |
4755 if (!pRenderer) | |
4756 { | |
4757 Log::Warning(L"Render creation failed"); | |
4758 return false; | |
4759 } | |
4760 else | |
4761 { | |
4762 bool bWindowMode = ReadWindowsRegistryInt("startinwindow", false); | |
4763 uint uDefaultDevice = ReadWindowsRegistryInt("D3D Device", 1); | |
4764 bool bColoredLights = ReadWindowsRegistryInt("Colored Lights", false); | |
4765 uint uLevelOfDetail = ReadWindowsRegistryInt("Detail Level", 1); | |
4766 uint bTinting = ReadWindowsRegistryInt("Tinting", 1) != 0; | |
4767 | |
4768 if (!pRenderer->Initialize(bWindowMode, uDefaultDevice, bColoredLights, uLevelOfDetail, bTinting)) | |
4769 { | |
4770 Log::Warning(L"Render failed to initialize"); | |
4771 return false; | |
4772 } | |
4773 } | |
492 | 4774 |
0 | 4775 pAllocator = Allocator::Create(); |
650
14d13880daa9
Sleeping in tavern crash fixed - memory allocation rised to 48mb
Nomad
parents:
648
diff
changeset
|
4776 if (!pAllocator->Initialize(48 * 1024)) |
0 | 4777 { |
4778 MessageBoxW(nullptr, | |
650
14d13880daa9
Sleeping in tavern crash fixed - memory allocation rised to 48mb
Nomad
parents:
648
diff
changeset
|
4779 L"Unable to Allocate 48Mb of RAM", |
0 | 4780 L"More RAM Memory Required", MB_ICONEXCLAMATION); |
4781 return false; | |
4782 } | |
492 | 4783 |
351 | 4784 game_starting_year = 1168; |
0 | 4785 |
4786 pParty = new Party; | |
147 | 4787 memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings)); |
0 | 4788 pParty->uWalkSpeed = GetPrivateProfileIntW(L"debug", L"walkspeed", 384, pMM6IniFile); |
4789 pParty->uDefaultEyelevel = GetPrivateProfileIntW(L"party", L"eyelevel", 160, pMM6IniFile); | |
4790 pParty->sEyelevel = pParty->uDefaultEyelevel; | |
4791 pParty->uDefaultPartyHeight = GetPrivateProfileIntW(L"party", L"height", 192, pMM6IniFile); | |
4792 pParty->uPartyHeight = pParty->uDefaultPartyHeight; | |
4793 | |
4794 bUseRegistry = GetPrivateProfileIntW(L"settings", L"registry", 1, pMM6IniFile); | |
4795 MM6_Initialize(pMM6IniFile); | |
4796 | |
4797 pKeyActionMap = new KeyboardActionMapping; | |
4798 | |
4799 pEventTimer = Timer::Create(); | |
4800 pEventTimer->Initialize(); | |
4801 | |
4802 OnTimer(1); | |
4803 GameUI_StatusBar_UpdateTimedString(1); | |
4804 pGame = Game::Create(); | |
4805 pMouse = pGame->pMouseInstance; | |
4806 | |
4807 | |
4808 RECT rcWindow; | |
4809 GetWindowRect(hWnd, &rcWindow); | |
4810 | |
4811 RECT rcClient; | |
4812 GetClientRect(hWnd, &rcClient); | |
4813 uWindowWidth = rcClient.left - rcClient.right - rcWindow.left + rcWindow.right + 640; | |
4814 uWindowHeight = rcClient.top - rcClient.bottom - rcWindow.top + rcWindow.bottom + 480; | |
4815 MoveWindow(hWnd, uWindowX, uWindowY, | |
4816 rcClient.left - rcClient.right - rcWindow.left + rcWindow.right + 640, | |
4817 rcClient.top - rcClient.bottom - rcWindow.top + rcWindow.bottom + 480, 0); | |
4818 ShowWindow(hWnd, SW_SHOWNORMAL); | |
4819 | |
4820 pIcons_LOD = new LODFile_IconsBitmaps; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4821 if (!pIcons_LOD->Load("data\\icons.lod", "icons")) |
0 | 4822 { |
4823 MessageBoxW(nullptr, | |
4824 L"Some files are missing\n\nPlease Reinstall.", | |
4825 L"Files Missing", MB_ICONEXCLAMATION); | |
4826 return false; | |
4827 } | |
4828 pIcons_LOD->dword_011BA4 = 0; | |
4829 | |
4830 pEvents_LOD = new LODFile_IconsBitmaps; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4831 if (!pEvents_LOD->Load("data\\events.lod", "icons")) |
0 | 4832 { |
4833 MessageBoxW(nullptr, | |
4834 L"Some files are missing\n\nPlease Reinstall.", | |
4835 L"Files Missing", MB_ICONEXCLAMATION); | |
4836 return false; | |
4837 } | |
4838 | |
4839 InitializeGameText(); | |
4840 | |
4841 pBitmaps_LOD = new LODFile_IconsBitmaps; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4842 if (!pBitmaps_LOD->Load("data\\bitmaps.lod", "bitmaps")) |
0 | 4843 { |
4844 MessageBoxA(nullptr, | |
4845 pGlobalTXT_LocalizationStrings[63], | |
4846 pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION); | |
4847 return false; | |
4848 } | |
4849 | |
4850 if (bUseRegistry) | |
4851 bUseLoResSprites = ReadWindowsRegistryInt("resolution", 0); | |
4852 else | |
4853 bUseLoResSprites = GetPrivateProfileIntW(L"settings", L"resolution", 0, pMM6IniFile); | |
4854 | |
4855 const char *pSpritesFile = nullptr; | |
4856 if (bUseLoResSprites) | |
4857 pSpritesFile = "data\\spriteLO.lod"; | |
4858 else | |
4859 pSpritesFile = "data\\sprites.lod"; | |
4860 | |
4861 pSprites_LOD = new LODFile_Sprites; | |
4862 if (!pSprites_LOD->LoadSprites(pSpritesFile)) | |
4863 { | |
4864 MessageBoxA(nullptr, | |
4865 pGlobalTXT_LocalizationStrings[63], | |
4866 pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION); | |
4867 return false; | |
4868 } | |
4869 | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4870 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4871 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4872 if (_access("../MM_VI/data/icons.lod", 0) == 0) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4873 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4874 pIcons_LOD_mm6 = new LODFile_IconsBitmaps; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4875 if (!pIcons_LOD_mm6->Load("../MM_VI/data/icons.lod", "icons")) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4876 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4877 delete pIcons_LOD_mm6; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4878 pIcons_LOD_mm6 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4879 Log::Warning(L"Unable to load mm6:icons.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4880 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4881 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4882 else |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4883 Log::Warning(L"Unable to find mm6:icons.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4884 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4885 if (_access("../MM_VI/data/bitmaps.lod", 0) == 0) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4886 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4887 pBitmaps_LOD_mm6 = new LODFile_IconsBitmaps; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4888 if (!pBitmaps_LOD_mm6->Load("../MM_VI/data/bitmaps.lod", "bitmaps")) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4889 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4890 delete pBitmaps_LOD_mm6; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4891 pBitmaps_LOD_mm6 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4892 Log::Warning(L"Unable to load mm6:bitmaps.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4893 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4894 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4895 else |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4896 Log::Warning(L"Unable to find mm6:bitmaps.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4897 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4898 auto mm6_sprite_container_name = bUseLoResSprites ? "../MM_VI/data/spriteLO.lod" |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4899 : "../MM_VI/data/sprites.lod"; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4900 if (_access(mm6_sprite_container_name, 0) == 0) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4901 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4902 pSprites_LOD_mm6 = new LODFile_Sprites; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4903 if (!pSprites_LOD_mm6->LoadSprites(mm6_sprite_container_name)) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4904 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4905 delete pSprites_LOD_mm6; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4906 pSprites_LOD_mm6 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4907 Log::Warning(L"Unable to load mm6:sprites.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4908 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4909 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4910 else |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4911 Log::Warning(L"Unable to find mm6:sprites.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4912 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4913 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4914 |
0 | 4915 if (bDebugResouces) |
4916 { | |
4917 pSpriteFrameTable = new SpriteFrameTable; | |
4918 if (!pSpriteFrameTable->FromFileTxt("data\\sft.txt")) | |
4919 Abortf("Unable to open sft.txt"); | |
4920 | |
4921 pDecorationList = new DecorationList; | |
4922 if (!pDecorationList->FromFileTxt("data\\declist.txt")) | |
4923 Abortf("Unable to open declist.txt"); | |
4924 | |
4925 pObjectList = new ObjectList; | |
4926 if (!pObjectList->FromFileTxt("data\\objlist.txt")) | |
4927 Abortf("Unable to open objlist.txt"); | |
4928 | |
4929 pMonsterList = new MonsterList; | |
4930 if (!pMonsterList->FromFileTxt("data\\monlist.txt")) | |
4931 Abortf("Unable to open monlist.txt"); | |
4932 | |
4933 pIconsFrameTable = new IconFrameTable; | |
4934 if (!pIconsFrameTable->FromFileTxt("data\\ift.txt")) | |
4935 Abortf("Unable to open ift.txt"); | |
4936 | |
4937 pTextureFrameTable = new TextureFrameTable; | |
4938 if (!pTextureFrameTable->FromFileTxt("data\\tft.def")) | |
4939 Abortf("Unable to open tft.def"); | |
4940 | |
4941 pTileTable = new TileTable; | |
4942 if (!pTileTable->FromFileTxt("data\\tile.def")) | |
4943 Abortf("Unable to open tile.def"); | |
4944 | |
4945 pPlayerFrameTable = new PlayerFrameTable; | |
4946 if (!pPlayerFrameTable->FromFileTxt("data\\pft.def")) | |
4947 Abortf("Unable to open pft.def"); | |
4948 | |
4949 pChestList = new ChestList; | |
4950 if (!pChestList->FromFileTxt("data\\chest.def")) | |
4951 Abortf("Unable to open chest.def"); | |
4952 | |
4953 pOverlayList = new OverlayList; | |
4954 if (!pOverlayList->FromFileTxt("data\\overlay.def")) | |
4955 Abortf("Unable to open overlay.def"); | |
4956 | |
4957 pSoundList = new SoundList; | |
4958 if (!pSoundList->FromFileTxt("data\\sounds.def")) | |
4959 Abortf("Unable to open sounds.def"); | |
4960 } | |
4961 else | |
4962 { | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4963 void *sft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsft.bin", 1) : nullptr, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4964 *sft_mm8 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4965 auto sft_mm7 = pEvents_LOD->LoadRaw("dsft.bin", 1); |
0 | 4966 pSpriteFrameTable = new SpriteFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4967 pSpriteFrameTable->FromFile(sft_mm6, sft_mm7, sft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4968 free(sft_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4969 free(sft_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4970 free(sft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4971 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4972 void *tft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtft.bin", 1) : nullptr, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4973 *tft_mm8 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4974 auto tft_mm7 = pEvents_LOD->LoadRaw("dtft.bin", 1); |
0 | 4975 pTextureFrameTable = new TextureFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4976 pTextureFrameTable->FromFile(tft_mm6, tft_mm7, tft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4977 free(tft_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4978 free(tft_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4979 free(tft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4980 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4981 void *tiles_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtile.bin", 1) : nullptr, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4982 *tiles_mm8 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4983 auto tiles_mm7 = pEvents_LOD->LoadRaw("dtile.bin", 1); |
0 | 4984 pTileTable = new TileTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4985 pTileTable->FromFile(tiles_mm6, tiles_mm7, tiles_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4986 free(tiles_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4987 free(tiles_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4988 free(tiles_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4989 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4990 void *pft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dpft.bin", 1) : nullptr, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4991 *pft_mm8 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4992 auto pft_mm7 = pEvents_LOD->LoadRaw("dpft.bin", 1); |
0 | 4993 pPlayerFrameTable = new PlayerFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4994 pPlayerFrameTable->FromFile(pft_mm6, pft_mm7, pft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4995 free(pft_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4996 free(pft_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4997 free(pft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4998 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4999 void *ift_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dift.bin", 1) : nullptr, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5000 *ift_mm8 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5001 auto ift_mm7 = pEvents_LOD->LoadRaw("dift.bin", 1); |
0 | 5002 pIconsFrameTable = new IconFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5003 pIconsFrameTable->FromFile(ift_mm6, ift_mm7, ift_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5004 free(ift_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5005 free(ift_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5006 free(ift_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5007 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5008 void *decs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("ddeclist.bin", 1) : nullptr, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5009 *decs_mm8 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5010 auto decs_mm7 = pEvents_LOD->LoadRaw("ddeclist.bin", 1); |
0 | 5011 pDecorationList = new DecorationList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5012 pDecorationList->FromFile(decs_mm6, decs_mm7, decs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5013 free(decs_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5014 free(decs_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5015 free(decs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5016 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5017 void *objs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dobjlist.bin", 1) : nullptr, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5018 *objs_mm8 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5019 auto objs_mm7 = pEvents_LOD->LoadRaw("dobjlist.bin", 1); |
0 | 5020 pObjectList = new ObjectList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5021 pObjectList->FromFile(objs_mm6, objs_mm7, objs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5022 free(objs_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5023 free(objs_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5024 free(objs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5025 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5026 void *mons_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dmonlist.bin", 1) : nullptr, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5027 *mons_mm8 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5028 auto mons_mm7 = pEvents_LOD->LoadRaw("dmonlist.bin", 1); |
0 | 5029 pMonsterList = new MonsterList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5030 pMonsterList->FromFile(mons_mm6, mons_mm7, mons_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5031 free(mons_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5032 free(mons_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5033 free(mons_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5034 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5035 void *chests_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dchest.bin", 1) : nullptr, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5036 *chests_mm8 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5037 auto chests_mm7 = pEvents_LOD->LoadRaw("dchest.bin", 1); |
0 | 5038 pChestList = new ChestList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5039 pChestList->FromFile(chests_mm6, chests_mm7, chests_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5040 free(chests_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5041 free(chests_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5042 free(chests_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5043 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5044 void *overlays_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("doverlay.bin", 1) : nullptr, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5045 *overlays_mm8 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5046 auto overlays_mm7 = pEvents_LOD->LoadRaw("doverlay.bin", 1); |
0 | 5047 pOverlayList = new OverlayList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5048 pOverlayList->FromFile(overlays_mm6, overlays_mm7, overlays_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5049 free(overlays_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5050 free(overlays_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5051 free(overlays_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5052 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5053 void *sounds_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsounds.bin", 1) : nullptr, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5054 *sounds_mm8 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5055 auto sounds_mm7 = pEvents_LOD->LoadRaw("dsounds.bin", 1); |
0 | 5056 pSoundList = new SoundList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5057 pSoundList->FromFile(sounds_mm6, sounds_mm7, sounds_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5058 free(sounds_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5059 free(sounds_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5060 free(sounds_mm8); |
0 | 5061 } |
5062 | |
5063 | |
5064 if (bDebugResouces) | |
5065 { | |
5066 pSpriteFrameTable->ToFile(); | |
5067 pDecorationList->ToFile(); | |
5068 pObjectList->ToFile(); | |
5069 pMonsterList->ToFile(); | |
5070 pIconsFrameTable->ToFile(); | |
5071 pTextureFrameTable->ToFile(); | |
5072 pTileTable->ToFile(); | |
5073 pPlayerFrameTable->ToFile(); | |
5074 pChestList->ToFile(); | |
5075 pOverlayList->ToFile(); | |
5076 pSoundList->ToFile(); | |
5077 } | |
5078 | |
492 | 5079 |
0 | 5080 if (dword_6BE364_game_settings_1 & 2 || !(dword_6BE368_debug_settings_2 & 1))// |
5081 // color depth != 16 | |
5082 // or | |
5083 // not in window | |
5084 { | |
5085 SetMenu(hWnd, 0); | |
5086 SetWindowLongA(hWnd, GWL_EXSTYLE, 0); | |
5087 SetWindowLongA(hWnd, GWL_STYLE, WS_VISIBLE); | |
5088 pRenderer->InitializeFullscreen(hWnd); | |
5089 } | |
5090 else | |
5091 { | |
5092 ClipCursor(nullptr); | |
5093 pRenderer->SwitchToWindow(hWnd); | |
5094 } | |
5095 | |
5096 uSoundVolumeMultiplier = ReadWindowsRegistryInt("soundflag", 9); | |
5097 if (uSoundVolumeMultiplier > 9) | |
5098 uSoundVolumeMultiplier = 9; | |
5099 uMusicVolimeMultiplier = ReadWindowsRegistryInt("musicflag", 9); | |
5100 if (uMusicVolimeMultiplier > 9) | |
5101 uMusicVolimeMultiplier = 9; | |
5102 uVoicesVolumeMultiplier = ReadWindowsRegistryInt("CharVoices", 9); | |
5103 if (uVoicesVolumeMultiplier > 9) | |
5104 uVoicesVolumeMultiplier = 9; | |
5105 bShowDamage = ReadWindowsRegistryInt("ShowDamage", 1) != 0; | |
5106 byte_6BE388_graphicsmode = ReadWindowsRegistryInt("graphicsmode", 1); | |
5107 if (byte_6BE388_graphicsmode < 0 || byte_6BE388_graphicsmode > 2) | |
5108 byte_6BE388_graphicsmode = 0; | |
5109 | |
5110 uGammaPos = ReadWindowsRegistryInt("GammaPos", 4); | |
733 | 5111 if (uGammaPos > 9) |
0 | 5112 uGammaPos = 4; |
5113 pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6); | |
5114 | |
5115 if ( ReadWindowsRegistryInt("Bloodsplats", 1) ) | |
591 | 5116 pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS; |
0 | 5117 else |
733 | 5118 pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS; |
0 | 5119 |
5120 uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0); | |
5121 dword_6BE384_2dacceloff = ReadWindowsRegistryInt("2dacceloff", 0); | |
5122 | |
5123 if (!bNoSound) | |
5124 pAudioPlayer->Initialize(hWnd); | |
5125 | |
1262 | 5126 pVideoPlayer = new VideoPlayer(); |
0 | 5127 pVideoPlayer->Initialize(); |
5128 | |
5129 dword_6BE364_game_settings_1 |= 0x4000; | |
5130 | |
5131 switch ( uTurnSpeed ) | |
5132 { | |
731 | 5133 case 0: // undefined turn option |
1067 | 5134 __debugbreak(); // really shouldn't use this mode |
731 | 5135 uTurnSpeed = (unsigned int)uCPUSpeed < 199 ? 128 : 64; // adjust turn speed to estimated fps |
5136 break; | |
5137 | |
5138 case 1u: // 16x | |
5139 Log::Warning(L"x16 Turn Speed"); // really shouldn't use this mode | |
0 | 5140 uTurnSpeed = 128; |
731 | 5141 break; |
5142 | |
5143 case 2u: // 32x | |
5144 Log::Warning(L"x32 Turn Speed"); // really shouldn't use this mode | |
0 | 5145 uTurnSpeed = 64; |
731 | 5146 break; |
5147 | |
5148 case 3u: // smooth | |
0 | 5149 uTurnSpeed = 0; |
731 | 5150 break; |
5151 } | |
5152 | |
5153 initing = false; //ADDED Gloval | |
0 | 5154 return true; |
5155 } | |
5156 | |
5157 //----- (00465D0B) -------------------------------------------------------- | |
1458 | 5158 void SecondaryInitialization() |
0 | 5159 { |
5160 __int16 v4; // ax@4 | |
5161 signed int v5; // esi@5 | |
5162 int v6; // ecx@6 | |
5163 int v7; // edx@7 | |
5164 ObjectDesc *v8; // eax@7 | |
5165 char pContainer[32]; // [sp+10h] [bp-Ch]@9 | |
5166 | |
5167 pMouse->Initialize(hWnd); | |
5168 | |
5169 pItemsTable = new ItemsTable; | |
5170 pItemsTable->Initialize(); | |
5171 | |
5172 pBitmaps_LOD->dword_011BA8 = 1; | |
5173 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | |
5174 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | |
5175 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | |
762 | 5176 |
5177 pPaletteManager->SetMistColor(128, 128, 128); | |
0 | 5178 pPaletteManager->RecalculateAll(); |
5179 pSprites_LOD->field_ECAC = 1; | |
5180 pObjectList->InitializeSprites(); | |
5181 pOverlayList->InitializeSprites(); | |
5182 if (!bNoSound) | |
5183 pSoundList->Initialize(); | |
5184 | |
5185 static const char *pUIAnimNames[4] = | |
5186 { | |
5187 "glow03", "glow05", | |
5188 "torchA", "wizeyeA" | |
5189 }; | |
5190 static unsigned short _4E98D0[4][4] = | |
5191 { | |
5192 {479, 0, 329, 0}, | |
5193 {585, 0, 332, 0}, | |
5194 {468, 0, 0, 0}, | |
5195 {606, 0, 0, 0} | |
5196 }; | |
5197 | |
5198 | |
5199 for (uint i = 0; i < 4; ++i) | |
5200 { | |
5201 pUIAnims[i]->uIconID = pIconsFrameTable->FindIcon(pUIAnimNames[i]); | |
5202 pIconsFrameTable->InitializeAnimation(pUIAnims[i]->uIconID); | |
5203 | |
5204 pUIAnims[i]->uAnimLength = 0; | |
5205 pUIAnims[i]->uAnimTime = 0; | |
5206 pUIAnims[i]->x = _4E98D0[i][0]; | |
5207 pUIAnims[i]->y = _4E98D0[i][2]; | |
5208 } | |
5209 | |
5210 v5 = 0; | |
5211 if ( (signed int)pObjectList->uNumObjects > 0 ) | |
5212 { | |
5213 v6 = 0; | |
5214 do | |
5215 { | |
5216 BYTE3(v7) = 0; | |
5217 v8 = &pObjectList->pObjects[v6]; | |
5218 ++v6; | |
5219 *(short *)((char *)&v7 + 1) = v8->uParticleTrailColorR; | |
5220 LOBYTE(v7) = v8->uParticleTrailColorG; | |
5221 ++v5; | |
5222 v8->uParticleTrailColor = v8->uParticleTrailColorB | (v7 << 8); | |
5223 } | |
5224 while ( v5 < (signed int)pObjectList->uNumObjects ); | |
5225 } | |
5226 flt_6BE3A0 = 0.55000001f; | |
5227 MainMenuUI_Create(); | |
5228 pGame->pStru6Instance->LoadAnimations(); | |
5229 | |
5230 for (uint i = 0; i < 7; ++i) | |
5231 { | |
5232 sprintf(pContainer, "HDWTR%03u", i); | |
5233 pRenderer->pHDWaterBitmapIDs[i] = pBitmaps_LOD->LoadTexture(pContainer); | |
5234 } | |
5235 | |
5236 pNPCStats = new NPCStats; | |
110 | 5237 memset(pNPCStats->pNPCData, 0, 0x94BCu); |
0 | 5238 pNPCStats->Initialize(); |
5239 | |
5240 Initialize_GlobalEVT(); | |
762 | 5241 pBitmaps_LOD->_inlined_sub0(); |
5242 pSprites_LOD->_inlined_sub0(); | |
0 | 5243 pPaletteManager->LockAll(); |
5244 | |
5245 _mkdir("Saves"); | |
5246 for (uint i = 0; i < 5; ++i) | |
5247 for (uint j = 0; j < 6; ++j) | |
5248 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
5249 sprintf(pTmpBuf.data(), "data\\lloyd%d%d.pcx", i, j); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
5250 remove(pTmpBuf.data()); |
0 | 5251 } |
5252 | |
5253 Initialize_GamesLOD_NewLOD(); | |
1051 | 5254 _576E2C_current_minimap_zoom = 512; |
0 | 5255 dword_576E28 = 9; |
5256 } | |
5257 | |
522 | 5258 void IntegrityTest() |
5259 { | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5260 assert(sizeof(SoundDesc_mm6) == 112); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5261 assert(sizeof(SoundDesc) == 120); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5262 assert(sizeof(OverlayDesc) == 8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5263 assert(sizeof(ChestDesc) == 36); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5264 assert(sizeof(ObjectDesc_mm6) == 52); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5265 assert(sizeof(ObjectDesc) == 56); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5266 assert(sizeof(DecorationDesc) == 84); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5267 assert(sizeof(IconFrame) == 32); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5268 assert(sizeof(PlayerFrame) == 10); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5269 assert(sizeof(TextureFrame) == 20); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5270 assert(sizeof(SpriteFrame) == 60); |
522 | 5271 assert(sizeof(RenderVertexSoft) == 0x30); |
5272 assert(sizeof(RenderBillboard) == 0x34); | |
5273 assert(sizeof(Texture) == 0x48); | |
5274 assert(sizeof(RGBTexture) == 0x28); | |
5275 assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4); // + virtual dtor ptr | |
5276 assert(sizeof(AudioPlayer) == 0xC84); | |
5277 assert(sizeof(SoundDesc) == 0x78); | |
5278 assert(sizeof(stru339_spell_sound) == 0xAFD8); | |
5279 assert(sizeof(VideoPlayer) == 0x108 + 4); | |
5280 assert(sizeof(MovieHeader) == 0x2C); | |
5281 assert(sizeof(DecorationDesc) == 0x54); | |
5282 assert(sizeof(ObjectDesc) == 0x38); | |
5283 assert(sizeof(OverlayDesc) == 0x8); | |
5284 assert(sizeof(ChestDesc) == 0x24); | |
5285 assert(sizeof(TileDesc) == 0x1A); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5286 assert(sizeof(MonsterDesc_mm6) == 148); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5287 assert(sizeof(MonsterDesc) == 152); |
522 | 5288 assert(sizeof(Timer) == 0x28); |
5289 assert(sizeof(OtherOverlay) == 0x14); | |
5290 assert(sizeof(ItemGen) == 0x24); | |
5291 assert(sizeof(SpriteObject) == 0x70); | |
5292 assert(sizeof(ItemDesc) == 0x30); | |
5293 assert(sizeof(ItemsTable) == 0x117A0); | |
5294 assert(sizeof(Chest) == 0x14CC); | |
5295 assert(sizeof(MapInfo) == 0x44); | |
5296 assert(sizeof(SpellInfo) == 0x24); | |
5297 assert(sizeof(SpellData) == 0x14); | |
5298 assert(sizeof(SpellBuff) == 0x10); | |
5299 assert(sizeof(AIDirection) == 0x1C); | |
5300 assert(sizeof(ActorJob) == 0xC); | |
5301 assert(sizeof(Actor) == 0x344); | |
5302 assert(sizeof(LevelDecoration) == 0x20); | |
5303 assert(sizeof(KeyboardActionMapping) == 0x20C); | |
5304 assert(sizeof(UIAnimation) == 0xD); | |
5305 assert(sizeof(SpawnPointMM7) == 0x18); | |
5306 assert(sizeof(ODMFace) == 0x134); | |
5307 assert(sizeof(BSPNode) == 0x8); | |
5308 assert(sizeof(BSPModel) == 0xBC); | |
5309 assert(sizeof(OutdoorLocation) == 0x1C28C); | |
5310 assert(sizeof(BLVFace) == 0x60); | |
5311 assert(sizeof(BLVFaceExtra) == 0x24); | |
5312 assert(sizeof(BLVSector) == 0x74); | |
5313 assert(sizeof(BLVLightMM7) == 0x10); | |
5314 assert(sizeof(BLVDoor) == 0x50); | |
5315 assert(sizeof(IndoorLocation) == 0x690); | |
5316 assert(sizeof(OutdoorCamera) == 0x74); | |
5317 assert(sizeof(Mouse) == 0x114); | |
619 | 5318 assert(sizeof(Particle_sw) == 0x68); |
522 | 5319 assert(sizeof(Particle) == 0x68); |
5320 assert(sizeof(ParticleEngine) == 0xE430); | |
5321 assert(sizeof(Lightmap) == 0xC1C); | |
5322 assert(sizeof(LightmapBuilder) == 0x3CBC38); | |
5323 assert(sizeof(Vis_SelectionList) == 0x2008); | |
5324 assert(sizeof(Vis) == 0x20D0); | |
5325 assert(sizeof(PlayerBuffAnim) == 0x10); | |
5326 assert(sizeof(ProjectileAnim) == 0x1C); | |
5327 assert(sizeof(stru6) == 0x5F8); | |
5328 assert(sizeof(IndoorCameraD3D_Vec3) == 0x10); | |
5329 assert(sizeof(IndoorCameraD3D_Vec4) == 0x18); //should be 14 (10 vec3 + 4 vdtor) but 18 coz of his +4 from own vdtor, but it is odd since vdtor already present from vec3 | |
5330 assert(sizeof(IndoorCameraD3D) == 0x1A1384); | |
5331 assert(sizeof(StationaryLight) == 0xC); | |
5332 assert(sizeof(LightsStack_StationaryLight_) == 0x12C8); | |
5333 assert(sizeof(MobileLight) == 0x12); | |
5334 assert(sizeof(LightsStack_MobileLight_) == 0x1C28); | |
5335 assert(sizeof(Game) == 0xE78); | |
5336 assert(sizeof(stru141) == 0xA8); | |
5337 assert(sizeof(ActionQueue) == 0x7C); | |
5338 assert(sizeof(NPCData) == 0x4C); | |
5339 assert(sizeof(NPCStats) == 0x17FFC); | |
5340 assert(sizeof(BspRenderer) == 0x53740); | |
5341 assert(sizeof(PaletteManager) == 0x267AF0); | |
5342 assert(sizeof(ViewingParams) == 0x26C); | |
5343 assert(sizeof(IndoorCamera) == 0x50); | |
5344 assert(sizeof(Bloodsplat) == 0x28); | |
5345 assert(sizeof(BloodsplatContainer) == 0xA0C); | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
5346 assert(sizeof(TrailParticle) == 0x18); |
522 | 5347 assert(sizeof(EventIndex) == 0xC); |
5348 assert(sizeof(_2devent) == 0x34); | |
5349 assert(sizeof(stru176) == 0x20); | |
5350 assert(sizeof(SavegameHeader) == 0x64); | |
5351 assert(sizeof(SavegameList) == 0x3138); | |
571 | 5352 assert(sizeof(StorylineText) == 0x160); |
522 | 5353 assert(sizeof(FactionTable) == 0x1EF1); |
5354 assert(sizeof(Decal) == 0xC20); | |
5355 assert(sizeof(DecalBuilder) == 0x30C038); | |
5356 assert(sizeof(MonsterInfo) == 0x58); | |
5357 assert(sizeof(MonsterStats) == 0x5BA0); | |
5358 assert(sizeof(RenderD3D) == 0x148); | |
5359 assert(sizeof(Render) == 0x129844); | |
5360 assert(sizeof(Player) == 0x1B3C); | |
5361 assert(sizeof(Party_stru0) == 0x678); | |
5362 assert(sizeof(Party) == 0x16238); | |
5363 assert(sizeof(GUIButton) == 0xBC); | |
5364 assert(sizeof(GUIWindow) == 0x54); | |
5365 assert(sizeof(GUIProgressBar) == 0x1B8); | |
5366 assert(sizeof(GUIFont) == 0x1020); | |
1330 | 5367 // assert(sizeof(stru262_TurnBased) == 0x40); |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
548
diff
changeset
|
5368 assert(sizeof(ArcomageGame) == 0xFB); |
924 | 5369 assert(sizeof(CastSpellInfo) == 0x14); |
522 | 5370 assert(sizeof(ArcomageCard) == 0x6C); |
5371 assert(sizeof(stru320) == 0x3FC); | |
5372 assert(sizeof(TravelInfo) == 0x20); | |
5373 assert(sizeof(stru336) == 0x798); | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5374 assert(sizeof(Vec3_short_) == 6); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5375 assert(sizeof(BLVFace) == 96); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5376 assert(sizeof(BLVFaceExtra) == 36); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5377 assert(sizeof(BLVSector) == 116); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5378 assert(sizeof(LevelDecoration) == 32); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5379 assert(sizeof(BLVLightMM7) == 16); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5380 assert(sizeof(BSPNode) == 8); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5381 assert(sizeof(SpawnPointMM7) == 24); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5382 assert(sizeof(DDM_DLV_Header) == 40); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5383 assert(sizeof(Actor) == 836); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5384 assert(sizeof(SpriteObject) == 112); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5385 assert(sizeof(Chest) == 5324); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5386 assert(sizeof(stru123) == 0xC8); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
668
diff
changeset
|
5387 assert(sizeof(BLVMapOutline) == 12); |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
698
diff
changeset
|
5388 assert(sizeof(LODSprite) == 0x28); |
522 | 5389 } |
5390 | |
168 | 5391 bool new_sky = false; |
670 | 5392 bool change_seasons = false; |
894 | 5393 bool all_magic = true; |
0 | 5394 |
5395 //----- (00462C94) -------------------------------------------------------- | |
5396 bool MM_Main(const wchar_t *pCmdLine) | |
5397 { | |
5398 HWND hPrevWnd; // eax@1 | |
5399 HWND hPrevWnd_; // esi@1 | |
5400 HWND v6; // eax@4 | |
5401 int v8; // eax@15 | |
5402 //bool v9; // edx@16 | |
5403 //OtherOverlay *v10; // esi@44 | |
5404 //signed int v11; // edi@44 | |
982 | 5405 //unsigned int v12; // ecx@56 |
0 | 5406 HANDLE v13; // eax@68 |
5407 unsigned int startms; // [sp+8h] [bp-24h]@55 | |
5408 RECT Rect; // [sp+Ch] [bp-20h]@15 | |
5409 int a2[4]; // [sp+1Ch] [bp-10h]@15 | |
522 | 5410 |
5411 IntegrityTest(); | |
246 | 5412 char test[1024]; |
522 | 5413 sprintfex(test, "^Pi[%s]: çíàõàð^R[ü;êà;]", "Çîëòàí"); |
5414 | |
1052 | 5415 bool bNoMargareth = false; |
0 | 5416 if (pCmdLine && *pCmdLine) |
5417 { | |
5418 if (wcsstr(pCmdLine, L"-usedefs")) | |
5419 bDebugResouces = 1; | |
5420 if (wcsstr(pCmdLine, L"-window")) | |
5421 dword_6BE368_debug_settings_2 |= 1u; | |
5422 | |
5423 if (wcsstr(pCmdLine, L"-nointro")) | |
5424 bNoIntro = true;//dword_6BE364_game_settings_1 |= 4; | |
5425 if (wcsstr(pCmdLine, L"-nologo")) | |
5426 bNoLogo = true;//dword_6BE364_game_settings_1 |= 8; | |
5427 if (wcsstr(pCmdLine, L"-nosound")) | |
5428 bNoSound = true; //dword_6BE364_game_settings_1 |= 0x10; | |
5429 | |
5430 bWalkSound = ReadWindowsRegistryInt("WalkSound", 1) != 0; | |
5431 if (wcsstr(pCmdLine, L"-nowalksound")) | |
5432 bWalkSound = false;//dword_6BE364_game_settings_1 |= 0x20; | |
256 | 5433 if (wcsstr(pCmdLine, L"-novideo")) |
0 | 5434 { |
5435 dword_6BE364_game_settings_1 |= 0x40; | |
5436 bNoVideo = true; | |
5437 } | |
5438 if (wcsstr(pCmdLine, L"-nocd")) | |
5439 bNoCD = true; | |
168 | 5440 if (wcsstr(pCmdLine, L"-new_sky")) |
5441 new_sky = true; | |
1052 | 5442 if (wcsstr(pCmdLine, L"-nomarg")) |
5443 bNoMargareth = true; | |
0 | 5444 } |
5445 | |
5446 | |
731 | 5447 /*v8 = _4AC1C9_get_cpu_speed(0, (Vec4_int_ *)a2); |
0 | 5448 Rect.left = *(int *)v8; |
5449 Rect.top = *(int *)(v8 + 4); | |
5450 Rect.right = *(int *)(v8 + 8); | |
5451 Rect.bottom = *(int *)(v8 + 12); | |
731 | 5452 uCPUSpeed = Rect.bottom;*/ |
5453 uCPUSpeed = 2048; // about 2GHz | |
4 | 5454 |
5455 | |
734 | 5456 if (!MM7_Initialize()) |
5457 { | |
5458 Log::Warning(L"MM init: failed"); | |
5459 pGame->Deinitialize(); | |
5460 return 1; | |
5461 } | |
5462 Log::Warning(L"MM init: ok"); | |
0 | 5463 |
5464 pEventTimer->Pause(); | |
1397 | 5465 |
373 | 5466 SetUserInterface(PartyAlignment_Neutral, false); |
0 | 5467 ShowIntroVideo_and_LoadingScreen(); |
5468 WriteWindowsRegistryInt("Ran once", 1); | |
5469 dword_6BE364_game_settings_1 |= 0x4000; | |
5470 pGame->InitializeGammaController(); | |
5471 SecondaryInitialization(); | |
709 | 5472 pRenderer->SetRasterClipRect(0, 0, 639u, 479u); |
0 | 5473 FinalInitialization(); |
5474 | |
5475 Log::Warning(L"MM: entering main loop"); | |
5476 while ( 1 ) | |
5477 { | |
165 | 5478 MainMenu_Loop(); |
982 | 5479 uGameState = GAME_STATE_PLAYING; |
0 | 5480 while ( 1 ) |
5481 { | |
982 | 5482 if (uGameState == GAME_FINISHED || |
5483 GetCurrentMenuID() == MENU_EXIT_GAME) | |
5484 { | |
5485 pGame->Deinitialize(); | |
5486 return true; | |
5487 } | |
5488 | |
165 | 5489 if (GetCurrentMenuID() == MENU_NEWGAME) |
0 | 5490 { |
5491 if ( pAudioPlayer->hAILRedbook ) | |
165 | 5492 AIL_redbook_stop(pAudioPlayer->hAILRedbook); |
5493 pParty->Reset(); | |
783 | 5494 pOtherOverlayList->Reset(); |
5495 | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5496 strcpy(pCurrentMapName, pStartingMapName); |
165 | 5497 pParty->CreateDefaultParty(0); |
0 | 5498 PlayerCreationUI_Initialize(); |
165 | 5499 if ( PlayerCreationUI_Loop() ) |
0 | 5500 { |
5501 DeleteCCharFont(); | |
165 | 5502 break; |
0 | 5503 } |
5504 DeleteCCharFont(); | |
5505 bFlashQuestBook = true; | |
1397 | 5506 PlayFullscreenMovie(MOVIE_Emerald); |
5507 //pGame->pCShow->PlayMovie(MOVIE_Emerald, 0); | |
837 | 5508 SaveNewGame(); |
1052 | 5509 |
5510 if (bNoMargareth) | |
5511 _449B7E_toggle_bit(pParty->_quest_bits, PARTY_QUEST_EMERALD_MARGARETH_OFF, 1); | |
165 | 5512 pGame->Loop(); |
982 | 5513 |
5514 if (uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU) | |
165 | 5515 { |
5516 SetCurrentMenuID(MENU_NEWGAME); | |
982 | 5517 uGameState = GAME_STATE_PLAYING; |
165 | 5518 continue; |
5519 } | |
982 | 5520 else if (uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU) |
5521 break; | |
5522 | |
5523 assert(false && "Invalid game state"); | |
165 | 5524 } |
5525 if (GetCurrentMenuID() == MENU_CREDITS) | |
0 | 5526 { |
5527 if ( pAudioPlayer->hAILRedbook ) | |
165 | 5528 AIL_redbook_stop(pAudioPlayer->hAILRedbook); |
1033 | 5529 MainMenuUI_Credits_Loop(); |
0 | 5530 break; |
5531 } | |
961 | 5532 if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu) |
2 | 5533 { |
982 | 5534 uGameState = GAME_STATE_PLAYING; |
1416 | 5535 pGame->Loop(); |
2 | 5536 } |
4 | 5537 else |
961 | 5538 { |
1458 | 5539 if (GetCurrentMenuID() == MENU_DebugBLVLevel) |
1416 | 5540 { |
5541 pMouse->Activate(0); | |
5542 | |
5543 pParty->Reset(); | |
5544 pParty->CreateDefaultParty(1); | |
1458 | 5545 |
5546 extern void CreateDefaultBLVLevel(); | |
5547 CreateDefaultBLVLevel(); | |
5548 | |
1416 | 5549 extern OPENFILENAMEA ofn; |
5550 if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) | |
5551 { | |
5552 pMouse->Activate(1); | |
5553 break; | |
5554 } | |
5555 _chdir("..\\"); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5556 strcpy(pCurrentMapName, ofn.lpstrFileTitle); |
1416 | 5557 pMouse->Activate(1); |
5558 pGame->Loop(); | |
5559 } | |
492 | 5560 } |
1214
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
5561 if ( uGameState == GAME_STATE_LOADING_GAME ) |
961 | 5562 { |
982 | 5563 SetCurrentMenuID(MENU_5); |
5564 uGameState = GAME_STATE_PLAYING; | |
0 | 5565 continue; |
961 | 5566 } |
165 | 5567 if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU ) |
101 | 5568 { |
5569 SetCurrentMenuID(MENU_NEWGAME); | |
982 | 5570 uGameState = GAME_STATE_PLAYING; |
0 | 5571 continue; |
101 | 5572 } |
907 | 5573 if ( uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU)// from the loaded game |
5574 { | |
0 | 5575 pAudioPlayer->StopChannels(-1, -1); |
982 | 5576 uGameState = GAME_STATE_PLAYING; |
0 | 5577 break; |
907 | 5578 } |
0 | 5579 } |
5580 if (!bNoSound && pAudioPlayer->hAILRedbook) | |
5581 { | |
328 | 5582 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); |
0 | 5583 AIL_redbook_stop(pAudioPlayer->hAILRedbook); |
5584 unsigned int end_ms; | |
5585 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xE, &startms, &end_ms); | |
5586 AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms); | |
5587 } | |
5588 } | |
734 | 5589 |
0 | 5590 pGame->Deinitialize(); |
734 | 5591 return 1; |
0 | 5592 } |
5593 | |
5594 //----- (004637E0) -------------------------------------------------------- | |
1458 | 5595 char sub_4637E0_is_there_popup_onscreen() |
0 | 5596 { |
5597 return dword_507BF0_is_there_popup_onscreen == 1; | |
5598 } | |
5599 // 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen; | |
5600 | |
5601 //----- (00466082) -------------------------------------------------------- | |
5602 void MM6_Initialize(const wchar_t *pIniFilename) | |
5603 { | |
5604 //int v0; // eax@1 | |
5605 UINT v1; // eax@18 | |
5606 size_t v2; // eax@31 | |
5607 size_t v3; // ebx@32 | |
5608 size_t v4; // edi@36 | |
5609 //char v5[120]; // [sp+Ch] [bp-17Ch]@1 | |
5610 //char String[120]; // [sp+84h] [bp-104h]@32 | |
5611 char pDefaultGroundTexture[16]; // [sp+FCh] [bp-8Ch]@32 | |
5612 //char pIniFilename[120]; // [sp+10Ch] [bp-7Ch]@1 | |
5613 unsigned int v9; // [sp+184h] [bp-4h]@28 | |
5614 | |
5615 //_getcwd(v5, 120); | |
5616 //sprintfex(pIniFilename, "%s\\mm6.ini", v5); | |
5617 viewparams = new ViewingParams; | |
819 | 5618 game_viewport_x = viewparams->uScreen_topL_X = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename); |
5619 game_viewport_y = viewparams->uScreen_topL_Y = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename); | |
5620 game_viewport_z = viewparams->uScreen_BttmR_X = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename); | |
5621 game_viewport_w = viewparams->uScreen_BttmR_Y = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename); | |
5622 game_viewport_width = game_viewport_z - game_viewport_x; | |
5623 game_viewport_height = game_viewport_w - game_viewport_y + 1; | |
0 | 5624 |
5625 | |
5626 pAudioPlayer = new AudioPlayer; | |
5627 pAudioPlayer->uMixerChannels = GetPrivateProfileIntW(L"settings", L"mixerchannels", 16, pIniFilename); | |
5628 if ( pAudioPlayer->uMixerChannels > 16 ) | |
5629 pAudioPlayer->uMixerChannels = 16; | |
5630 | |
5631 | |
5632 if (GetPrivateProfileIntW(L"debug", L"nomonster", 0, pIniFilename)) | |
5633 dword_6BE368_debug_settings_2 |= 4; | |
5634 if (bUseRegistry) | |
5635 v1 = ReadWindowsRegistryInt("startinwindow", 0); | |
5636 else | |
5637 v1 = GetPrivateProfileIntW(L"debug", L"startinwindow", 0, pIniFilename); | |
5638 if (v1) | |
5639 dword_6BE368_debug_settings_2 |= 1; | |
5640 if (GetPrivateProfileIntW(L"debug", L"showFR", 0, pIniFilename)) | |
5641 dword_6BE368_debug_settings_2 |= 2; | |
5642 if (GetPrivateProfileIntW(L"debug", L"nodamage", 0, pIniFilename)) | |
5643 dword_6BE368_debug_settings_2 |= 0x10; | |
5644 if (GetPrivateProfileIntW(L"debug", L"nodecoration", 0, pIniFilename)) | |
5645 dword_6BE368_debug_settings_2 |= 8; | |
5646 | |
5647 wchar_t pStartingMapNameW[1024]; | |
5648 GetPrivateProfileStringW(L"file", L"startmap", L"out01.odm", pStartingMapNameW, 0x20u, pIniFilename); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5649 sprintf(pStartingMapName, "%S", pStartingMapNameW); |
0 | 5650 |
5651 v9 = 0; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5652 if ( strlen(pStartingMapName) ) |
0 | 5653 { |
5654 do | |
5655 { | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5656 if ( pStartingMapName[v9] == ' ' ) |
0 | 5657 pStartingMapName[v9] = 0; |
5658 ++v9; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
5659 v2 = strlen(pStartingMapName); |
0 | 5660 } |
5661 while ( v9 < v2 ); | |
5662 } | |
5663 | |
5664 pOutdoorCamera = new OutdoorCamera; | |
5665 outdoor_day_top_r = GetPrivateProfileIntW(L"outdoor", L"RGBDayTop.r", 81, pIniFilename); | |
5666 outdoor_day_top_g = GetPrivateProfileIntW(L"outdoor", L"RGBDayTop.g", 121, pIniFilename); | |
5667 outdoor_day_top_b = GetPrivateProfileIntW(L"outdoor", L"RGBDayTop.b", 236, pIniFilename); | |
5668 outdoor_day_bottom_r = GetPrivateProfileIntW(L"outdoor", L"RGBDayBottom.r", 153, pIniFilename); | |
5669 outdoor_day_bottom_g = GetPrivateProfileIntW(L"outdoor", L"RGBDayBottom.g", 193, pIniFilename); | |
5670 outdoor_day_bottom_b = GetPrivateProfileIntW(L"outdoor", L"RGBDayBottom.b", 237, pIniFilename); | |
5671 outdoor_night_top_r = GetPrivateProfileIntW(L"outdoor", L"RGBNightTop.r", 0, pIniFilename); | |
5672 outdoor_night_top_g = GetPrivateProfileIntW(L"outdoor", L"RGBNightTop.g", 0, pIniFilename); | |
5673 outdoor_night_top_b = GetPrivateProfileIntW(L"outdoor", L"RGBNightTop.b", 0, pIniFilename); | |
5674 outdoor_night_bottom_r = GetPrivateProfileIntW(L"outdoor", L"RGBNightBottom.r", 11, pIniFilename); | |
5675 outdoor_night_bottom_g = GetPrivateProfileIntW(L"outdoor", L"RGBNightBottom.g", 41, pIniFilename); | |
5676 outdoor_night_bottom_b = GetPrivateProfileIntW(L"outdoor", L"RGBNightBottom.b", 129, pIniFilename); | |
5677 pOutdoorCamera->outdoor_no_mist = GetPrivateProfileIntW(L"debug", L"noMist", 0, pIniFilename); | |
5678 pOutdoorCamera->bNoSky = GetPrivateProfileIntW(L"outdoor", L"nosky", 0, pIniFilename); | |
5679 pOutdoorCamera->bDoNotRenderDecorations = GetPrivateProfileIntW(L"render", L"nodecorations", 0, pIniFilename); | |
5680 pOutdoorCamera->outdoor_no_wavy_water = GetPrivateProfileIntW(L"outdoor", L"nowavywater", 0, pIniFilename); | |
5681 outdoor_grid_band_1 = GetPrivateProfileIntW(L"outdoor", L"gridband1", 10, pIniFilename); | |
5682 outdoor_grid_band_2 = GetPrivateProfileIntW(L"outdoor", L"gridband2", 15, pIniFilename); | |
5683 outdoor_grid_band_3 = GetPrivateProfileIntW(L"outdoor", L"gridband3", 25, pIniFilename); | |
5684 pOutdoorCamera->terrain_gamma = GetPrivateProfileIntW(L"outdoor", L"ter_gamma", 0, pIniFilename); | |
5685 pOutdoorCamera->building_gamme = GetPrivateProfileIntW(L"outdoor", L"bld_gamma", 0, pIniFilename); | |
5686 mipmapping_terrain_mm1 = GetPrivateProfileIntW(L"mipmapping", L"ter_mm1", 2048, pIniFilename); | |
5687 mipmapping_terrain_mm2 = GetPrivateProfileIntW(L"mipmapping", L"ter_mm2", 4096, pIniFilename); | |
5688 mipmapping_terrain_mm3 = GetPrivateProfileIntW(L"mipmapping", L"ter_mm3", 8192, pIniFilename); | |
5689 mipmapping_building_mm1 = GetPrivateProfileIntW(L"mipmapping", L"bld_mm1", 1024, pIniFilename); | |
5690 mipmapping_building_mm2 = GetPrivateProfileIntW(L"mipmapping", L"bld_mm2", 2048, pIniFilename); | |
5691 mipmapping_building_mm3 = GetPrivateProfileIntW(L"mipmapping", L"bld_mm3", 4096, pIniFilename); | |
5692 pOutdoorCamera->shading_dist_shade = GetPrivateProfileIntW(L"shading", L"dist_shade", 2048, pIniFilename); | |
5693 pOutdoorCamera->shading_dist_shademist = GetPrivateProfileIntW(L"shading", L"dist_shademist", 4096, pIniFilename); | |
5694 pOutdoorCamera->shading_dist_mist = GetPrivateProfileIntW(L"shading", L"dist_mist", 8192, pIniFilename); | |
5695 | |
5696 wchar_t pDefaultSkyTextureW[1024]; | |
5697 GetPrivateProfileStringW(L"textures", L"sky", L"plansky1", pDefaultSkyTextureW, 0x10u, pIniFilename); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
5698 sprintf(pDefaultSkyTexture.data(), "%S", pDefaultSkyTextureW); |
0 | 5699 |
5700 wchar_t pDefaultGroundTextureW[1024]; | |
5701 GetPrivateProfileStringW(L"textures", L"default", L"dirt", pDefaultGroundTextureW, 0x10u, pIniFilename); | |
5702 sprintf(pDefaultGroundTexture, "%S", pDefaultGroundTextureW); | |
5703 | |
5704 wchar_t pFloat[1024]; | |
5705 GetPrivateProfileStringW(L"debug", L"recmod1", L"1.0", pFloat, 0x10u, pIniFilename); | |
5706 swscanf(pFloat, L"%f", &flt_6BE3A4_debug_recmod1); | |
5707 | |
5708 GetPrivateProfileStringW(L"debug", L"recmod2", L"1.0", pFloat, 0x10u, pIniFilename); | |
5709 swscanf(pFloat, L"%f", &flt_6BE3A8_debug_recmod2); | |
5710 | |
5711 flt_6BE3AC_debug_recmod1_x_1_6 = flt_6BE3A4_debug_recmod1 * 1.666666666666667; | |
5712 | |
5713 v3 = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
5714 if ( strlen(pDefaultSkyTexture.data()) ) |
0 | 5715 { |
5716 do | |
5717 { | |
5718 if ( pDefaultSkyTexture[v3] == ' ' ) | |
5719 pDefaultSkyTexture[v3] = 0; | |
5720 ++v3; | |
5721 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
5722 while ( v3 < strlen(pDefaultSkyTexture.data()) ); |
0 | 5723 } |
5724 v4 = 0; | |
5725 if ( strlen(pDefaultGroundTexture) ) | |
5726 { | |
5727 do | |
5728 { | |
5729 if ( pDefaultGroundTexture[v4] == ' ' ) | |
5730 pDefaultGroundTexture[v4] = 0; | |
5731 ++v4; | |
5732 } | |
5733 while ( v4 < strlen(pDefaultGroundTexture) ); | |
5734 } | |
5735 | |
5736 texmapping_terrain_subdivsize = GetPrivateProfileIntW(L"texmapping", L"terrain_subdivsize", 16, pIniFilename); | |
5737 texmapping_terrain_subdivpow2 = GetPrivateProfileIntW(L"texmapping", L"terrain_subdivpow2", 4, pIniFilename); | |
5738 texmapping_building_subdivsize = GetPrivateProfileIntW(L"texmapping", L"building_subdivsize", 32, pIniFilename); | |
5739 texmapping_building_subdivpow2 = GetPrivateProfileIntW(L"texmapping", L"building_subdivpow2", 5, pIniFilename); | |
5740 | |
5741 MM7Initialization(); | |
5742 } | |
5743 | |
5744 //----- (004666D5) -------------------------------------------------------- | |
1458 | 5745 void MM7Initialization() |
0 | 5746 { |
5747 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
5748 { | |
5749 if ( !byte_6BE388_graphicsmode ) | |
5750 { | |
5751 outdoor_grid_band_1 = 10; | |
5752 outdoor_grid_band_2 = 15; | |
5753 outdoor_grid_band_3 = 20; | |
5754 pOutdoorCamera->shading_dist_mist = 8192; | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
5755 pOutdoorCamera->bNoSky = false; |
0 | 5756 LOBYTE(viewparams->field_20) = 0; |
5757 } | |
5758 mipmapping_terrain_mm1 = 1024; | |
5759 mipmapping_terrain_mm2 = 2048; | |
5760 mipmapping_building_mm1 = 1024; | |
5761 mipmapping_building_mm2 = 2048; | |
5762 pOutdoorCamera->shading_dist_shade = 2048; | |
5763 pOutdoorCamera->terrain_gamma = 0; | |
5764 pOutdoorCamera->building_gamme = 0; | |
5765 mipmapping_terrain_mm3 = 4096; | |
5766 mipmapping_building_mm3 = 4096; | |
5767 pOutdoorCamera->shading_dist_shademist = 4096; | |
5768 pOutdoorCamera->outdoor_no_wavy_water = 0; | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
5769 //_47F4D3_initialize_terrain_bezier_stuff(outdoor_grid_band_1, outdoor_grid_band_2, outdoor_grid_band_3); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
5770 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
5771 pOutdoorCamera->outdoor_grid_band_3 = outdoor_grid_band_3; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
5772 pOutdoorCamera->uPickDepth = outdoor_grid_band_3 * 512; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
5773 } |
0 | 5774 } |
5775 else | |
5776 { | |
5777 LOBYTE(viewparams->field_20) = 0; | |
5778 } | |
5779 pParty->uFlags |= 2u; | |
692 | 5780 viewparams->uSomeY = viewparams->uScreen_topL_Y; |
5781 viewparams->uSomeX = viewparams->uScreen_topL_X; | |
5782 viewparams->uSomeZ = viewparams->uScreen_BttmR_X; | |
5783 viewparams->uSomeW = viewparams->uScreen_BttmR_Y; | |
5784 | |
5785 pViewport->SetScreen(viewparams->uScreen_topL_X, viewparams->uScreen_topL_Y, viewparams->uScreen_BttmR_X, viewparams->uScreen_BttmR_Y); | |
0 | 5786 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
5787 pOutdoorCamera->_485F64(); | |
5788 } | |
5789 | |
5790 //----- (00466B8C) -------------------------------------------------------- | |
1458 | 5791 int AbortWithError() |
0 | 5792 { |
5793 if ( !aborting_app ) | |
5794 { | |
5795 ClipCursor(0); | |
5796 aborting_app = 1; | |
5797 if ( !pRenderer->bWindowMode ) | |
5798 pRenderer->ChangeBetweenWinFullscreenModes(); | |
5799 if ( MessageBoxA(0, pGlobalTXT_LocalizationStrings[176], pGlobalTXT_LocalizationStrings[59], 0x34u) == 6 ) | |
5800 SaveGame(1, 0); // "Internal Error" | |
5801 // "Might and Magic VII has detected an internal error and will be forced to close. Would you like us to autosave your game before closing?" | |
5802 Game_DeinitializeAndTerminate(1); | |
5803 } | |
5804 return 0; | |
5805 } | |
5806 // 720018: using guessed type int aborting_app; | |
5807 | |
5808 //----- (00466BE5) -------------------------------------------------------- | |
5809 void Abortf(const char *Format, ...) | |
5810 { | |
5811 va_list va; // [sp+8h] [bp+8h]@1 | |
5812 | |
5813 va_start(va, Format); | |
5814 if ( !pRenderer->bWindowMode ) | |
5815 pRenderer->ChangeBetweenWinFullscreenModes(); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
5816 vsprintf(pTmpBuf.data(), Format, va); |
0 | 5817 if ( pMouse ) |
5818 pMouse->Activate(0); | |
5819 ClipCursor(0); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
5820 MessageBoxA(0, pTmpBuf.data(), "Error", 0x30u); |
0 | 5821 Game_DeinitializeAndTerminate(1); |
5822 } | |
5823 | |
5824 //----- (00466C40) -------------------------------------------------------- | |
5825 const wchar_t *MENU_STATE_to_string(MENU_STATE m) | |
5826 { | |
5827 switch (m) | |
5828 { | |
982 | 5829 case -1: return L"-1"; |
5830 case MENU_MAIN: return L"MENU_MAIN"; | |
5831 case MENU_NEWGAME: return L"MENU_NEWGAME"; | |
5832 case MENU_CREDITS: return L"MENU_CREDITS"; | |
5833 case MENU_SAVELOAD: return L"MENU_SAVELOAD"; | |
5834 case MENU_EXIT_GAME: return L"MENU_EXIT_GAME"; | |
5835 case MENU_5: return L"MENU_5"; | |
5836 case MENU_CREATEPARTY: return L"MENU_CREATEPARTY"; | |
165 | 5837 case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC"; |
982 | 5838 case MENU_CREDITSPROC: return L"MENU_CREDITSPROC"; |
961 | 5839 case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu"; |
1458 | 5840 case MENU_DebugBLVLevel: return L"MENU_DebugBLVLevel"; |
165 | 5841 case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE"; |
982 | 5842 default: return L"unk"; |
0 | 5843 }; |
5844 }; | |
5845 void SetCurrentMenuID(MENU_STATE uMenu) | |
5846 { | |
5847 uCurrentMenuID = uMenu; | |
5848 | |
5849 Log::Warning(L"CurrentMenu = %s", MENU_STATE_to_string(uMenu)); | |
5850 } | |
5851 | |
5852 //----- (00466CA0) -------------------------------------------------------- | |
5853 MENU_STATE GetCurrentMenuID() | |
5854 { | |
5855 return uCurrentMenuID; | |
5856 } | |
5857 | |
5858 | |
5859 //----- (0046A6AC) -------------------------------------------------------- | |
1459 | 5860 int __fastcall _46A6AC_spell_render(int a1, int a2, int a3) |
0 | 5861 { |
5862 int result; // eax@2 | |
5863 unsigned int v4; // edx@3 | |
5864 int *v5; // esi@6 | |
5865 unsigned int v6; // ebx@6 | |
5866 signed int v7; // edi@9 | |
5867 unsigned __int16 v8; // ax@9 | |
5868 int i; // eax@14 | |
5869 int v10; // ecx@19 | |
5870 int v11; // [sp+0h] [bp-18h]@1 | |
5871 unsigned int v12; // [sp+4h] [bp-14h]@3 | |
5872 unsigned int v13; // [sp+8h] [bp-10h]@4 | |
5873 int v14; // [sp+Ch] [bp-Ch]@1 | |
5874 int *v15; // [sp+10h] [bp-8h]@4 | |
5875 int v16; // [sp+14h] [bp-4h]@3 | |
5876 | |
5877 v11 = a2; | |
5878 v14 = a1; | |
5879 if ( pRenderer->pRenderD3D ) | |
5880 { | |
1459 | 5881 result = _46A6AC_spell_render_d3d(a1, a2, a3); |
0 | 5882 } |
5883 else | |
5884 { | |
1459 | 5885 __debugbreak(); // SW render never called |
0 | 5886 v16 = 0; |
692 | 5887 v4 = viewparams->uScreen_topL_X; |
5888 v12 = viewparams->uScreen_BttmR_X; | |
5889 if ( (signed int)viewparams->uScreen_topL_Y < (signed int)viewparams->uScreen_BttmR_Y ) | |
5890 { | |
5891 v15 = &pRenderer->pActiveZBuffer[viewparams->uScreen_topL_X + 640 * viewparams->uScreen_topL_Y]; | |
5892 v13 = ((viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y - 1) >> 1) + 1; | |
0 | 5893 do |
5894 { | |
5895 if ( (signed int)v4 < (signed int)v12 ) | |
5896 { | |
5897 v5 = v15; | |
5898 v6 = ((v12 - v4 - 1) >> 1) + 1; | |
5899 do | |
5900 { | |
848 | 5901 if ( PID_TYPE(*(char *)v5) == OBJECT_Actor) |
0 | 5902 { |
5903 if ( *v5 <= a3 << 16 ) | |
5904 { | |
848 | 5905 v7 = PID_ID((signed int)(unsigned __int16)*v5); |
0 | 5906 v8 = pActors[v7].uAIState; |
5907 if ( v8 != 5 ) | |
5908 { | |
5909 if ( v8 != 4 && v8 != 11 && v8 != 17 && v8 != 19 ) | |
5910 { | |
5911 for ( i = 0; i < v16; ++i ) | |
5912 { | |
5913 if ( *(int *)(v14 + 4 * i) == v7 ) | |
5914 break; | |
5915 } | |
5916 if ( i == v16 ) | |
5917 { | |
5918 if ( i < v11 - 1 ) | |
5919 { | |
5920 v10 = v16++; | |
5921 *(int *)(v14 + 4 * v10) = v7; | |
5922 } | |
5923 } | |
5924 } | |
5925 } | |
5926 } | |
5927 } | |
5928 v5 += 2; | |
5929 --v6; | |
5930 } | |
5931 while ( v6 ); | |
5932 } | |
5933 v15 += 1280; | |
5934 --v13; | |
5935 } | |
5936 while ( v13 ); | |
5937 } | |
5938 result = v16; | |
5939 } | |
5940 return result; | |
5941 } | |
5942 | |
5943 //----- (0046A7C8) -------------------------------------------------------- | |
1459 | 5944 int __fastcall _46A6AC_spell_render_d3d(int a1, int a2, int a3) |
0 | 5945 { |
5946 unsigned int v3; // eax@2 | |
5947 int v4; // ecx@2 | |
5948 unsigned int v5; // eax@2 | |
5949 unsigned int v6; // eax@4 | |
5950 unsigned int v7; // edi@4 | |
5951 unsigned __int16 v8; // ax@4 | |
5952 float v9; // ST00_4@9 | |
5953 int v10; // ecx@11 | |
5954 unsigned int v12; // [sp+10h] [bp-14h]@1 | |
5955 int v13; // [sp+14h] [bp-10h]@1 | |
5956 int v14; // [sp+18h] [bp-Ch]@1 | |
5957 int v15; // [sp+1Ch] [bp-8h]@1 | |
5958 unsigned int a1a; // [sp+20h] [bp-4h]@1 | |
5959 | |
5960 v13 = a1; | |
5961 v14 = a2; | |
5962 v15 = 0; | |
5963 a1a = 0; | |
5964 v12 = pRenderer->GetBillboardDrawListSize(); | |
5965 if ( (signed int)v12 > 0 ) | |
5966 { | |
5967 do | |
5968 { | |
5969 v3 = pRenderer->GetParentBillboardID(a1a); | |
5970 v4 = pBillboardRenderList[v3].sZValue; | |
194 | 5971 v5 = (unsigned __int16)pBillboardRenderList[v3].object_pid; |
848 | 5972 if ( PID_TYPE(v5) == OBJECT_Actor) |
0 | 5973 { |
5974 if ( v4 <= (unsigned int)(a3 << 16) ) | |
5975 { | |
848 | 5976 v6 = PID_ID(v5); |
0 | 5977 v7 = v6; |
5978 v8 = pActors[v6].uAIState; | |
1038 | 5979 if ( v8 != Dead ) |
5980 { | |
5981 if ( v8 != Dying ) | |
5982 { | |
5983 if ( v8 != Removed ) | |
0 | 5984 { |
1038 | 5985 if ( v8 != Disabled ) |
0 | 5986 { |
1038 | 5987 if ( v8 != Summoned ) |
0 | 5988 { |
5989 v9 = (double)a3; | |
5990 if ( pGame->pVisInstance->DoesRayIntersectBillboard(v9, a1a) ) | |
5991 { | |
5992 if ( v15 < v14 - 1 ) | |
5993 { | |
5994 v10 = v15++; | |
5995 *(int *)(v13 + 4 * v10) = v7; | |
5996 } | |
5997 } | |
5998 } | |
5999 } | |
6000 } | |
6001 } | |
6002 } | |
6003 } | |
6004 } | |
6005 ++a1a; | |
6006 } | |
6007 while ( (signed int)a1a < (signed int)v12 ); | |
6008 } | |
6009 return v15; | |
6010 } | |
6011 | |
6012 //----- (0046A89E) -------------------------------------------------------- | |
1459 | 6013 int __fastcall _46A89E_immolation_effect(int a1, int a2, int a3) |
0 | 6014 { |
6015 signed int v3; // edi@1 | |
90 | 6016 Actor *v4; // esi@2 |
0 | 6017 int v5; // ebx@3 |
6018 int v6; // eax@3 | |
6019 int v7; // ebx@3 | |
6020 unsigned int v8; // ecx@3 | |
6021 int v9; // edx@4 | |
6022 unsigned int v10; // edx@6 | |
6023 unsigned int v11; // edx@8 | |
6024 __int16 v12; // ax@10 | |
6025 int v13; // ecx@15 | |
6026 int v15; // [sp+4h] [bp-18h]@1 | |
6027 int v16; // [sp+8h] [bp-14h]@1 | |
6028 int v17; // [sp+Ch] [bp-10h]@3 | |
6029 int v18; // [sp+10h] [bp-Ch]@3 | |
6030 int v19; // [sp+18h] [bp-4h]@1 | |
6031 | |
6032 v3 = 0; | |
6033 v15 = a2; | |
6034 v16 = a1; | |
6035 v19 = 0; | |
6036 if ( (signed int)uNumActors > 0 ) | |
6037 { | |
1202 | 6038 v4 = pActors.data();//[0].uAIState; |
0 | 6039 do |
6040 { | |
90 | 6041 v5 = abs(v4->vPosition.x - pParty->vPosition.x); |
6042 v17 = abs(v4->vPosition.y - pParty->vPosition.y); | |
6043 v18 = abs(v4->vPosition.z - pParty->vPosition.z); | |
0 | 6044 v6 = v5; |
6045 v7 = v17; | |
6046 v8 = v18; | |
6047 if ( v6 < v17 ) | |
6048 { | |
6049 v9 = v6; | |
6050 v6 = v17; | |
6051 v7 = v9; | |
6052 } | |
6053 if ( v6 < v18 ) | |
6054 { | |
6055 v10 = v6; | |
6056 v6 = v18; | |
6057 v8 = v10; | |
6058 } | |
6059 if ( v7 < (signed int)v8 ) | |
6060 { | |
6061 v11 = v8; | |
6062 v8 = v7; | |
6063 v7 = v11; | |
6064 } | |
6065 if ( (signed int)(((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6) <= a3 ) | |
6066 { | |
90 | 6067 v12 = v4->uAIState; |
6068 if ( v4->uAIState != 5 ) | |
0 | 6069 { |
6070 if ( v12 != 4 ) | |
6071 { | |
6072 if ( v12 != 11 ) | |
6073 { | |
6074 if ( v12 != 19 ) | |
6075 { | |
6076 if ( v12 != 17 ) | |
6077 { | |
6078 v13 = v19++; | |
6079 *(int *)(v16 + 4 * v13) = v3; | |
6080 if ( v19 >= v15 - 1 ) | |
6081 break; | |
6082 } | |
6083 } | |
6084 } | |
6085 } | |
6086 } | |
6087 } | |
6088 ++v3; | |
90 | 6089 ++v4; |
0 | 6090 } |
6091 while ( v3 < (signed int)uNumActors ); | |
6092 } | |
6093 return v19; | |
6094 } | |
6095 | |
6096 //----- (0046A99B) -------------------------------------------------------- | |
1458 | 6097 int sub_46A99B() |
0 | 6098 { |
6099 int v0; // ebx@1 | |
6100 signed int v1; // ecx@1 | |
6101 signed int v2; // esi@1 | |
6102 int v3; // edx@1 | |
6103 signed int v4; // eax@1 | |
6104 int v5; // ecx@2 | |
6105 int *v6; // eax@3 | |
6106 int v7; // ecx@3 | |
6107 int v8; // edx@5 | |
6108 int v9; // edi@6 | |
6109 unsigned __int8 v10; // zf@14 | |
6110 char v11; // sf@14 | |
6111 char v12; // of@14 | |
6112 int *v14; // esi@19 | |
6113 signed int v15; // ebx@19 | |
6114 int i; // edi@20 | |
6115 int v17; // ecx@21 | |
6116 int v18; // edi@26 | |
6117 int v19; // esi@27 | |
6118 unsigned int v20; // ecx@27 | |
6119 BLVFace *v21; // eax@32 | |
6120 unsigned int v22; // ecx@33 | |
6121 const char *v23; // eax@35 | |
6122 const char *v24; // ecx@36 | |
6123 LevelDecoration *v25; // ecx@43 | |
6124 LevelDecoration *v26; // edi@43 | |
6125 __int16 v27; // ax@43 | |
6126 int v28; // [sp+Ch] [bp-18h]@1 | |
6127 int v29; // [sp+14h] [bp-10h]@2 | |
6128 int v30; // [sp+18h] [bp-Ch]@1 | |
6129 signed int v31; // [sp+1Ch] [bp-8h]@3 | |
6130 int v32; // [sp+20h] [bp-4h]@1 | |
6131 | |
6132 v0 = 0; | |
692 | 6133 v1 = (signed int)(viewparams->uScreen_BttmR_Y + viewparams->uScreen_topL_Y) >> 1; |
6134 v2 = (signed int)(viewparams->uScreen_topL_X + viewparams->uScreen_BttmR_X) >> 1; | |
0 | 6135 v3 = v1 - 50; |
6136 v32 = 0; | |
6137 v4 = 100; | |
6138 v30 = v1 - 50; | |
6139 v28 = v1 + 50; | |
6140 if ( v1 - 50 >= v1 + 50 ) | |
6141 return 0; | |
6142 v5 = 640 * v3; | |
6143 v29 = 640 * v3; | |
6144 while ( 2 ) | |
6145 { | |
1416 | 6146 v6 = &pRenderer->pActiveZBuffer[v2 + v5 - v4 / 2]-1; |
0 | 6147 v7 = v0; |
1416 | 6148 //while ( 1 ) |
6149 for( int i = 0; i < 100; i++) | |
6150 { | |
6151 ++v6; | |
0 | 6152 v8 = *v6; |
6153 if ( (unsigned int)*v6 <= 0x2000000 ) | |
6154 { | |
6155 v9 = 0; | |
6156 if ( v7 > 0 ) | |
6157 { | |
6158 do | |
6159 { | |
6160 if ( dword_7201B0_zvalues[v9] == (unsigned __int16)v8 ) | |
6161 break; | |
6162 ++v9; | |
6163 } | |
6164 while ( v9 < v0 ); | |
6165 } | |
6166 if ( v9 == v0 ) | |
6167 { | |
6168 if ( v8 & 7 ) | |
6169 { | |
6170 dword_720020_zvalues[v7] = v8; | |
6171 dword_7201B0_zvalues[v7] = (unsigned __int16)v8; | |
6172 ++v7; | |
6173 ++v0; | |
6174 v32 = v0; | |
6175 if ( v7 == 99 ) | |
6176 { | |
6177 v12 = 0; | |
6178 v10 = v0 == 0; | |
6179 v11 = v0 < 0; | |
6180 goto LABEL_18; | |
6181 } | |
6182 } | |
6183 } | |
6184 } | |
1416 | 6185 } |
0 | 6186 v4 = -1; |
6187 ++v30; | |
6188 v5 = v29 + 640; | |
6189 v29 += 640; | |
1416 | 6190 if ( v30 >= v28 ) |
6191 break; | |
0 | 6192 } |
6193 v12 = 0; | |
6194 v10 = v0 == 0; | |
6195 v11 = v0 < 0; | |
6196 if ( !v0 ) | |
6197 return 0; | |
6198 LABEL_18: | |
6199 if ( !((unsigned __int8)(v11 ^ v12) | v10) ) | |
6200 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
6201 v14 = dword_720020_zvalues.data(); |
0 | 6202 v15 = 1; |
6203 do | |
6204 { | |
6205 for ( i = v15; i < v32; ++i ) | |
6206 { | |
6207 v17 = dword_720020_zvalues[i]; | |
6208 if ( v17 < *v14 ) | |
6209 { | |
6210 dword_720020_zvalues[i] = *v14; | |
6211 *v14 = v17; | |
6212 } | |
6213 } | |
6214 ++v15; | |
6215 ++v14; | |
6216 } | |
6217 while ( v15 - 1 < v32 ); | |
6218 v0 = v32; | |
6219 } | |
6220 v18 = 0; | |
6221 if ( v0 <= 0 ) | |
6222 return 0; | |
6223 while ( 1 ) | |
6224 { | |
6225 v19 = dword_720020_zvalues[v18] & 0xFFFF; | |
848 | 6226 v20 = PID_ID(dword_720020_zvalues[v18]); |
6227 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Item) | |
0 | 6228 { |
6229 if ( v20 >= 0x3E8 ) | |
6230 return 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
6231 if ( !(pSpriteObjects[v20].uAttributes & 0x10) ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
6232 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
6233 v23 = pSpriteObjects[v20].stru_24.GetDisplayName(); |
0 | 6234 v24 = v23; |
1416 | 6235 GameUI_SetFooterString(v24); |
6236 return v19; | |
0 | 6237 } |
6238 } | |
1416 | 6239 else |
6240 { | |
6241 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Actor) | |
6242 { | |
6243 if ( v20 >= 0xBB8 ) | |
6244 return 0; | |
6245 v24 = (const char *)&pActors[v20]; | |
6246 GameUI_SetFooterString(v24); | |
6247 return v19; | |
6248 } | |
6249 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Decoration) | |
6250 break; | |
6251 if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_BModel) | |
6252 { | |
6253 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
6254 { | |
6255 v21 = &pIndoor->pFaces[v20]; | |
6256 if ( BYTE3(v21->uAttributes) & 2 ) | |
6257 v22 = pIndoor->pFaceExtras[v21->uFaceExtraID].uEventID; | |
6258 } | |
6259 else | |
6260 { | |
6261 if ( (dword_720020_zvalues[v18] & 0xFFFFu) >> 9 < pOutdoor->uNumBModels ) | |
6262 { | |
6263 v22 = pOutdoor->pBModels[(dword_720020_zvalues[v18] & 0xFFFFu) >> 9].pFaces[v20 & 0x3F].sCogTriggeredID; | |
6264 if ( v22 ) | |
6265 { | |
6266 v23 = GetEventHintString(v22); | |
6267 if ( v23 ) | |
6268 { | |
6269 v24 = v23; | |
6270 GameUI_SetFooterString(v24); | |
6271 return v19; | |
6272 } | |
6273 } | |
6274 } | |
6275 } | |
6276 } | |
6277 } | |
6278 ++v18; | |
0 | 6279 if ( v18 >= v0 ) |
6280 return 0; | |
6281 } | |
6282 v25 = &pLevelDecorations[v20]; | |
6283 v26 = v25; | |
6284 v27 = v25->field_16_event_id; | |
6285 if ( v27 ) | |
6286 { | |
428 | 6287 v23 = GetEventHintString(v27); |
0 | 6288 if ( !v23 ) |
6289 return v19; | |
1416 | 6290 v24 = v23; |
6291 GameUI_SetFooterString(v24); | |
6292 return v19; | |
0 | 6293 } |
6294 if ( v25->IsInteractive() ) | |
6295 v24 = pNPCTopics[stru_5E4C90._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic; | |
6296 else | |
6297 v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20; | |
994 | 6298 GameUI_SetFooterString(v24); |
0 | 6299 return v19; |
6300 } | |
6301 | |
6302 //----- (0046BDA8) -------------------------------------------------------- | |
1458 | 6303 unsigned int GetGravityStrength() |
0 | 6304 { |
6305 int v0; // eax@1 | |
6306 | |
6307 v0 = ~LOBYTE(pGame->uFlags2) & 8; | |
6308 LOBYTE(v0) = v0 | 2; | |
6309 return (unsigned int)v0 >> 1; | |
6310 } | |
6311 | |
6312 //----- (0046BDC0) -------------------------------------------------------- | |
1458 | 6313 void UpdateUserInput_and_MapSpecificStuff() |
0 | 6314 { |
6315 if ( dword_6BE364_game_settings_1 & 0x80 ) | |
6316 { | |
6317 LOBYTE(dword_6BE364_game_settings_1) = dword_6BE364_game_settings_1 & 0x7F; | |
6318 } | |
6319 else | |
6320 { | |
630 | 6321 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
0 | 6322 BLV_UpdateUserInputAndOther(); |
630 | 6323 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
0 | 6324 ODM_UpdateUserInputAndOther(); |
630 | 6325 |
783 | 6326 area_of_effect__damage_evaluate(); |
0 | 6327 } |
6328 } | |
6329 | |
6330 //----- (0046BFFA) -------------------------------------------------------- | |
6331 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) | |
6332 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6333 //SpriteObject *v2; // esi@1 |
0 | 6334 ObjectDesc *v3; // ebx@1 |
6335 unsigned __int16 v5; // cx@9 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6336 //unsigned __int16 v6; // cx@14 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6337 //signed int v7; // edx@14 |
0 | 6338 unsigned int v8; // eax@19 |
6339 unsigned int v9; // edi@19 | |
6340 signed int v10; // ebx@19 | |
6341 char *v11; // edx@20 | |
6342 unsigned __int16 v12; // ax@23 | |
6343 int v13; // eax@27 | |
6344 unsigned int v14; // ebx@33 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6345 //unsigned __int16 v15; // ax@35 |
0 | 6346 int v16; // eax@36 |
6347 unsigned int v17; // eax@37 | |
6348 __int16 v18; // di@37 | |
6349 signed int v19; // edx@37 | |
6350 unsigned __int8 v20; // sf@37 | |
6351 char *v21; // ecx@38 | |
6352 unsigned __int16 v22; // ax@41 | |
6353 unsigned int v23; // eax@46 | |
6354 signed int v24; // ebx@46 | |
6355 char *v25; // edx@47 | |
6356 int v26; // edx@54 | |
6357 int v27; // edx@55 | |
6358 int v28; // edx@56 | |
6359 int v29; // edx@57 | |
6360 unsigned __int16 v30; // ax@60 | |
6361 unsigned int v31; // ecx@60 | |
6362 int v32; // edi@60 | |
6363 unsigned int v33; // eax@65 | |
6364 signed int v34; // edx@65 | |
6365 char *v35; // ecx@66 | |
6366 unsigned __int16 v36; // ax@69 | |
6367 int v37; // ST14_4@72 | |
6368 int v38; // eax@72 | |
6369 int v39; // ST10_4@72 | |
6370 int v40; // ST0C_4@72 | |
6371 int v41; // edx@76 | |
6372 int v42; // edx@77 | |
6373 int v43; // edx@78 | |
6374 unsigned __int8 v44; // zf@79 | |
6375 int v45; // edx@79 | |
6376 unsigned __int16 v46; // ax@80 | |
6377 int v47; // eax@81 | |
6378 int v48; // edx@87 | |
6379 int v49; // edx@88 | |
6380 int v50; // edx@89 | |
6381 unsigned int v51; // eax@93 | |
6382 signed int v52; // ebx@93 | |
6383 char *v53; // edx@94 | |
6384 unsigned __int16 v54; // ax@98 | |
6385 unsigned int v55; // ecx@98 | |
6386 signed int v56; // ebx@98 | |
6387 char *v57; // edx@99 | |
6388 unsigned __int16 v58; // ax@102 | |
6389 unsigned __int16 v59; // ax@107 | |
6390 unsigned int v60; // ecx@107 | |
6391 signed int v61; // ebx@107 | |
6392 char *v62; // edx@108 | |
6393 unsigned __int16 v63; // ax@111 | |
6394 int v64; // ebx@114 | |
6395 signed int v65; // eax@114 | |
6396 unsigned int v66; // edi@123 | |
6397 unsigned __int16 v67; // ax@124 | |
6398 unsigned int v68; // ecx@124 | |
6399 signed int v69; // ebx@124 | |
6400 char *v70; // edx@125 | |
6401 unsigned __int16 v71; // ax@128 | |
6402 unsigned int v72; // ebx@131 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6403 //int v73; // ST14_4@132 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6404 //int v74; // ST10_4@132 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6405 //int v75; // ebx@132 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6406 //int v76; // ST0C_4@132 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6407 //unsigned __int16 v77; // ax@132 |
0 | 6408 int v78; // eax@133 |
6409 char v79; // zf@139 | |
6410 unsigned int v80; // eax@140 | |
6411 signed int v81; // edx@140 | |
6412 char *v82; // ecx@141 | |
6413 unsigned __int16 v83; // ax@144 | |
6414 unsigned __int16 v84; // ax@151 | |
6415 unsigned int v85; // ecx@151 | |
6416 signed int v86; // ebx@151 | |
6417 char *v87; // edx@152 | |
6418 unsigned __int16 v88; // ax@155 | |
6419 unsigned int v89; // eax@158 | |
6420 int v90; // ST34_4@159 | |
6421 int v91; // eax@159 | |
6422 unsigned int v92; // eax@163 | |
6423 unsigned int v93; // eax@177 | |
6424 char *v94; // ecx@178 | |
6425 unsigned __int16 v95; // ax@181 | |
6426 unsigned __int16 v96; // ax@184 | |
6427 int v97; // eax@185 | |
6428 unsigned __int16 v98; // ax@191 | |
6429 unsigned int v99; // ecx@191 | |
6430 char v100; // ST18_1@198 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6431 //int v101; // ST14_4@198 |
0 | 6432 int v102; // eax@198 |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6433 //int v103; // ST10_4@198 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6434 //int v104; // ST0C_4@198 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6435 //unsigned __int16 v105; // ax@200 |
0 | 6436 signed int v106; // eax@208 |
6437 unsigned int v107; // edx@220 | |
6438 signed int v108; // ebx@225 | |
6439 unsigned int v109; // eax@234 | |
6440 signed int v110; // ebx@234 | |
6441 char *v111; // ecx@235 | |
6442 unsigned __int16 v112; // ax@238 | |
6443 unsigned __int16 v113; // si@241 | |
6444 int v114; // eax@242 | |
6445 int v115; // eax@245 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6446 //signed int v116; // eax@245 |
0 | 6447 unsigned __int16 v117; // ax@251 |
6448 unsigned int v118; // ecx@251 | |
6449 signed int v119; // ebx@251 | |
6450 char *v120; // edx@252 | |
6451 unsigned __int16 v121; // ax@255 | |
6452 unsigned int v122; // eax@260 | |
6453 char *v123; // edx@261 | |
6454 int v124; // eax@267 | |
6455 int v125; // [sp-20h] [bp-4Ch]@28 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6456 //signed int v126; // [sp-1Ch] [bp-48h]@27 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6457 //unsigned int v127; // [sp-18h] [bp-44h]@27 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6458 //signed int v128; // [sp-14h] [bp-40h]@27 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6459 //signed int v129; // [sp-10h] [bp-3Ch]@27 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6460 //int v130; // [sp-Ch] [bp-38h]@27 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6461 //unsigned int v131; // [sp-8h] [bp-34h]@27 |
0 | 6462 char v132; // [sp-8h] [bp-34h]@131 |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6463 //int v133; // [sp-4h] [bp-30h]@27 |
0 | 6464 char v134; // [sp-4h] [bp-30h]@131 |
6465 signed int v135; // [sp-4h] [bp-30h]@217 | |
6466 int v136; // [sp+Ch] [bp-20h]@208 | |
6467 int v137; // [sp+10h] [bp-1Ch]@208 | |
6468 signed int v138; // [sp+14h] [bp-18h]@207 | |
6469 signed int v139; // [sp+18h] [bp-14h]@208 | |
6470 char *v140; // [sp+1Ch] [bp-10h]@61 | |
6471 signed int v141; // [sp+1Ch] [bp-10h]@117 | |
6472 unsigned int v142; // [sp+1Ch] [bp-10h]@158 | |
6473 signed int v143; // [sp+1Ch] [bp-10h]@172 | |
6474 char *v144; // [sp+1Ch] [bp-10h]@192 | |
6475 signed int v145; // [sp+20h] [bp-Ch]@1 | |
6476 signed int v146; // [sp+20h] [bp-Ch]@60 | |
6477 int v147; // [sp+20h] [bp-Ch]@72 | |
6478 signed int v148; // [sp+20h] [bp-Ch]@158 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6479 //int v149; // [sp+20h] [bp-Ch]@198 |
0 | 6480 unsigned __int16 v150; // [sp+20h] [bp-Ch]@208 |
6481 int v151; // [sp+24h] [bp-8h]@1 | |
6482 signed int v152; // [sp+24h] [bp-8h]@208 | |
6483 unsigned int v153; // [sp+28h] [bp-4h]@1 | |
6484 | |
6485 v153 = uLayingItemID; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6486 //v2 = &pSpriteObjects[uLayingItemID]; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6487 v3 = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID]; |
0 | 6488 v145 = a2; |
848 | 6489 v151 = PID_TYPE(a2); |
6490 if ( PID_TYPE(a2) == OBJECT_Actor) | |
6491 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6492 if ( PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6493 && !pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) ) |
0 | 6494 return 1; |
6495 } | |
6496 else | |
6497 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6498 if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Player) |
0 | 6499 return 1; |
6500 } | |
6501 if ( pParty->bTurnBasedModeOn == 1 ) | |
6502 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6503 v5 = pSpriteObjects[uLayingItemID].uAttributes; |
0 | 6504 if ( v5 & 4 ) |
6505 { | |
1450 | 6506 --pTurnEngine->pending_actions; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6507 pSpriteObjects[uLayingItemID].uAttributes = v5 & 0xFFFB; |
0 | 6508 } |
6509 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6510 if ( v151 == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player) |
1280 | 6511 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6512 if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) //bugfix PID_ID(v2->spell_caster_pid)==1000 |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6513 BYTE2(pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes) |= 4; |
1280 | 6514 } |
6515 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6516 //v6 = v2->uType; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6517 //v7 = v2->uType; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6518 if ( pSpriteObjects[uLayingItemID].uType > 3060 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6519 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6520 if ( pSpriteObjects[uLayingItemID].uType > 6090 ) |
0 | 6521 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6522 if ( pSpriteObjects[uLayingItemID].uType > 8090 ) |
0 | 6523 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6524 if ( pSpriteObjects[uLayingItemID].uType == 9010 ) |
0 | 6525 goto LABEL_247; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6526 if ( pSpriteObjects[uLayingItemID].uType != 9030 ) |
0 | 6527 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6528 if ( pSpriteObjects[uLayingItemID].uType != 9040 ) |
0 | 6529 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6530 if ( pSpriteObjects[uLayingItemID].uType != 9080 ) |
0 | 6531 return 0; |
6532 LABEL_191: | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6533 v98 = pSpriteObjects[uLayingItemID].uType + 1; |
0 | 6534 v99 = pObjectList->uNumObjects; |
6535 v32 = 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6536 pSpriteObjects[uLayingItemID].uType = v98; |
0 | 6537 v146 = 0; |
6538 if ( (signed int)v99 > 0 ) | |
6539 { | |
6540 v144 = (char *)&pObjectList->pObjects->uObjectID; | |
6541 while ( v98 != *(short *)v144 ) | |
6542 { | |
6543 ++v146; | |
6544 v144 += 56; | |
6545 if ( v146 >= (signed int)v99 ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6546 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6547 pSpriteObjects[uLayingItemID].uObjectDescID = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6548 if ( !v32 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6549 SpriteObject::OnInteraction(v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6550 v100 = pSpriteObjects[uLayingItemID].field_61; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6551 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6552 v102 = 8 * v153; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6553 LOBYTE(v102) = PID(OBJECT_Item,v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6554 pSpriteObjects[uLayingItemID].vVelocity.x = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6555 pSpriteObjects[uLayingItemID].vVelocity.y = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6556 pSpriteObjects[uLayingItemID].vVelocity.z = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6557 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6558 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6559 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6560 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6561 v47 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6562 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6563 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6564 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6565 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6566 return 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6567 } |
0 | 6568 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6569 pSpriteObjects[uLayingItemID].uObjectDescID = v146; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6570 if ( v146 == (short)v32 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6571 SpriteObject::OnInteraction(v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6572 v100 = pSpriteObjects[uLayingItemID].field_61; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6573 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6574 v102 = 8 * v153; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6575 LOBYTE(v102) = PID(OBJECT_Item,v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6576 pSpriteObjects[uLayingItemID].vVelocity.x = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6577 pSpriteObjects[uLayingItemID].vVelocity.y = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6578 pSpriteObjects[uLayingItemID].vVelocity.z = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6579 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6580 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6581 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6582 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6583 v47 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6584 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6585 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6586 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6587 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6588 return 0; |
0 | 6589 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6590 pSpriteObjects[uLayingItemID].uObjectDescID = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6591 if ( !v32 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6592 SpriteObject::OnInteraction(v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6593 v100 = pSpriteObjects[uLayingItemID].field_61; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6594 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6595 v102 = 8 * v153; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6596 LOBYTE(v102) = PID(OBJECT_Item,v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6597 pSpriteObjects[uLayingItemID].vVelocity.x = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6598 pSpriteObjects[uLayingItemID].vVelocity.y = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6599 pSpriteObjects[uLayingItemID].vVelocity.z = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6600 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6601 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6602 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6603 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6604 v47 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6605 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6606 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6607 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6608 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6609 return 0; |
0 | 6610 } |
6611 goto LABEL_93; | |
6612 } | |
6613 LABEL_172: | |
6614 v143 = 17030; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6615 switch ( pSpriteObjects[uLayingItemID].uType ) |
0 | 6616 { |
6617 case 0x1798u: | |
6618 v143 = 15040; | |
6619 break; | |
6620 case 0xFAAu: | |
6621 v143 = 13010; | |
6622 break; | |
6623 case 0x2346u: | |
6624 v143 = 18030; | |
6625 break; | |
6626 } | |
6627 v138 = 1; | |
141 | 6628 if ( v151 != OBJECT_Actor) |
0 | 6629 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6630 if ( pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4 ) |
1416 | 6631 { |
6632 SpriteObject::OnInteraction(v153); | |
6633 return 0; | |
6634 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6635 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); |
0 | 6636 LABEL_233: |
6637 if ( !v138 ) | |
6638 { | |
6639 v109 = pObjectList->uNumObjects; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6640 ++pSpriteObjects[uLayingItemID].uType; |
0 | 6641 v110 = 0; |
6642 if ( (signed int)v109 <= 0 ) | |
6643 { | |
6644 LABEL_238: | |
6645 v112 = 0; | |
6646 } | |
6647 else | |
6648 { | |
6649 v111 = (char *)&pObjectList->pObjects->uObjectID; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6650 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v111 ) |
0 | 6651 { |
6652 ++v110; | |
6653 v111 += 56; | |
6654 if ( v110 >= (signed int)v109 ) | |
6655 goto LABEL_238; | |
6656 } | |
6657 v112 = v110; | |
6658 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6659 pSpriteObjects[uLayingItemID].uObjectDescID = v112; |
0 | 6660 if ( !v112 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
6661 SpriteObject::OnInteraction(v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6662 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6663 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6664 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6665 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6666 v113 = pSpriteObjects[uLayingItemID].uSoundID; |
0 | 6667 if ( v113 ) |
6668 v114 = (signed __int16)v113 + 4; | |
6669 else | |
6670 v114 = 0; | |
6671 v115 = 8 * v153; | |
862 | 6672 LOBYTE(v115) = PID(OBJECT_Item,v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6673 v125 = v143 + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6674 pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6675 return 0; |
0 | 6676 } |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
6677 SpriteObject::OnInteraction(v153); |
0 | 6678 return 0; |
6679 } | |
6680 v106 = v145; | |
6681 v150 = 0; | |
848 | 6682 v139 = PID_ID(v106); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6683 v137 = pSpriteObjects[uLayingItemID].spell_level; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6684 v152 = pSpriteObjects[uLayingItemID].spell_skill; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6685 v136 = pSpriteObjects[uLayingItemID].spell_id; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6686 if ( pSpriteObjects[uLayingItemID].uType == 9030 ) |
0 | 6687 { |
6688 v150 = 2; | |
6689 if ( v152 == 2 ) | |
6690 { | |
6691 v150 = 3; | |
6692 } | |
6693 else | |
6694 { | |
6695 if ( v152 >= 3 ) | |
6696 v150 = 4; | |
6697 } | |
6698 BYTE2(pActors[v139].uAttributes) |= 8u; | |
6699 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6700 if ( pSpriteObjects[uLayingItemID].uType == 6040 ) |
0 | 6701 { |
6702 v135 = 7; | |
6703 } | |
6704 else | |
6705 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6706 if ( pSpriteObjects[uLayingItemID].uType == 8030 ) |
0 | 6707 { |
6708 v135 = 9; | |
6709 } | |
6710 else | |
6711 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6712 if ( pSpriteObjects[uLayingItemID].uType != 9030 ) |
0 | 6713 { |
6714 v107 = v136; | |
6715 LABEL_222: | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6716 if ( pSpriteObjects[uLayingItemID].uType != 9030 || v152 != 4 ) |
0 | 6717 { |
6718 v108 = v139; | |
6719 if ( stru_50C198.GetMagicalResistance(&pActors[v139], v107) ) | |
6720 { | |
6721 v138 = 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6722 if ( pSpriteObjects[uLayingItemID].uType == 8030 ) |
0 | 6723 { |
6724 pActors[v108].uAIState = Standing; | |
6725 pActors[v108].UpdateAnimation(); | |
6726 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6727 pActors[v108].pActorBuffs[v136].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v137 << 7) * 0.033333335), |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6728 v152, v150, 0, 0); |
0 | 6729 } |
6730 } | |
6731 else | |
6732 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6733 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); |
0 | 6734 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6735 pSpriteObjects[uLayingItemID].spell_level = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6736 pSpriteObjects[uLayingItemID].spell_skill = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6737 pSpriteObjects[uLayingItemID].spell_id = 0; |
0 | 6738 goto LABEL_233; |
6739 } | |
6740 v135 = 10; | |
6741 } | |
6742 } | |
6743 v107 = v135; | |
6744 goto LABEL_222; | |
6745 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6746 if ( pSpriteObjects[uLayingItemID].uType == 8090 || pSpriteObjects[uLayingItemID].uType == 7030 || pSpriteObjects[uLayingItemID].uType == 7090 || pSpriteObjects[uLayingItemID].uType == 8000 ) |
0 | 6747 goto LABEL_93; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6748 if ( pSpriteObjects[uLayingItemID].uType == 8010 ) |
0 | 6749 { |
6750 if ( v151 == 3 | |
848 | 6751 && MonsterStats::BelongsToSupertype(pActors[PID_ID(v145)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) |
0 | 6752 sub_43A97E(v153, v145); |
6753 v93 = pObjectList->uNumObjects; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6754 ++pSpriteObjects[uLayingItemID].uType; |
0 | 6755 v9 = 0; |
6756 v52 = 0; | |
6757 if ( (signed int)v93 > 0 ) | |
6758 { | |
6759 v94 = (char *)&pObjectList->pObjects->uObjectID; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6760 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v94 ) |
0 | 6761 { |
6762 ++v52; | |
6763 v94 += 56; | |
6764 if ( v52 >= (signed int)v93 ) | |
6765 goto LABEL_181; | |
6766 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6767 v95 = v52; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6768 pSpriteObjects[uLayingItemID].uObjectDescID = v95; |
1416 | 6769 if ( v95 == (short)v9 ) |
6770 SpriteObject::OnInteraction(v153); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6771 v96 = pSpriteObjects[uLayingItemID].uSoundID; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6772 pSpriteObjects[uLayingItemID].vVelocity.z = v9; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6773 pSpriteObjects[uLayingItemID].vVelocity.y = v9; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6774 pSpriteObjects[uLayingItemID].vVelocity.x = v9; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6775 pSpriteObjects[uLayingItemID].uSpriteFrameID = v9; |
1416 | 6776 if ( v96 == (short)v9 ) |
6777 v97 = 0; | |
6778 else | |
6779 v97 = (signed __int16)v96 + 4; | |
6780 v92 = v153; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6781 v124 = 8 * v92; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6782 LOBYTE(v124) = v124 | 2; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6783 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6784 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6785 return 0; |
0 | 6786 } |
6787 goto LABEL_181; | |
6788 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6789 v79 = pSpriteObjects[uLayingItemID].uType == 8030; |
0 | 6790 } |
6791 else | |
6792 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6793 if ( pSpriteObjects[uLayingItemID].uType == 6090 ) |
0 | 6794 goto LABEL_93; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6795 if ( pSpriteObjects[uLayingItemID].uType <= 4070 ) |
0 | 6796 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6797 if ( pSpriteObjects[uLayingItemID].uType != 4070 ) |
0 | 6798 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6799 v48 = pSpriteObjects[uLayingItemID].uType - 3090; |
0 | 6800 if ( v48 ) |
6801 { | |
6802 v49 = v48 - 2; | |
6803 if ( v49 ) | |
6804 { | |
6805 v50 = v49 - 908; | |
6806 if ( !v50 ) | |
6807 goto LABEL_93; | |
6808 v45 = v50 - 30; | |
6809 v44 = v45 == 0; | |
6810 goto LABEL_91; | |
6811 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6812 v54 = pSpriteObjects[uLayingItemID].uType - 1; |
0 | 6813 v55 = pObjectList->uNumObjects; |
6814 v9 = 0; | |
6815 v56 = 0; | |
6816 v44 = pObjectList->uNumObjects == 0; | |
6817 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6818 pSpriteObjects[uLayingItemID].uType = v54; |
0 | 6819 if ( v20 | v44 ) |
6820 { | |
6821 LABEL_102: | |
6822 v58 = 0; | |
6823 } | |
6824 else | |
6825 { | |
6826 v57 = (char *)&pObjectList->pObjects->uObjectID; | |
6827 while ( v54 != *(short *)v57 ) | |
6828 { | |
6829 ++v56; | |
6830 v57 += 56; | |
6831 if ( v56 >= (signed int)v55 ) | |
6832 goto LABEL_102; | |
6833 } | |
6834 v58 = v56; | |
6835 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6836 pSpriteObjects[uLayingItemID].uObjectDescID = v58; |
0 | 6837 if ( !v58 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
6838 SpriteObject::OnInteraction(v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6839 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6840 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6841 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6842 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
0 | 6843 sub_43A97E(v153, v145); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6844 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) |
0 | 6845 v16 = 0; |
6846 else | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6847 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6848 v124 = 8 * v153; |
0 | 6849 LOBYTE(v124) = v124 | 2; |
1456 | 6850 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6851 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6852 return 0; |
0 | 6853 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6854 v59 = pSpriteObjects[uLayingItemID].uType + 2; |
0 | 6855 v60 = pObjectList->uNumObjects; |
6856 v9 = 0; | |
6857 v61 = 0; | |
6858 v44 = pObjectList->uNumObjects == 0; | |
6859 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6860 pSpriteObjects[uLayingItemID].uType = v59; |
0 | 6861 if ( v20 | v44 ) |
6862 { | |
6863 LABEL_111: | |
6864 v63 = 0; | |
6865 } | |
6866 else | |
6867 { | |
6868 v62 = (char *)&pObjectList->pObjects->uObjectID; | |
6869 while ( v59 != *(short *)v62 ) | |
6870 { | |
6871 ++v61; | |
6872 v62 += 56; | |
6873 if ( v61 >= (signed int)v60 ) | |
6874 goto LABEL_111; | |
6875 } | |
6876 v63 = v61; | |
6877 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6878 pSpriteObjects[uLayingItemID].uObjectDescID = v63; |
0 | 6879 if ( !v63 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
6880 SpriteObject::OnInteraction(v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6881 v64 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6882 v44 = pSpriteObjects[uLayingItemID].spell_skill == 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6883 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6884 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6885 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
0 | 6886 v65 = 7; |
6887 if ( v44 ) | |
6888 v65 = 9; | |
6889 if ( v65 > 0 ) | |
6890 { | |
6891 v141 = v65; | |
6892 do | |
6893 { | |
6894 v64 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6895 pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0); |
0 | 6896 --v141; |
6897 } | |
6898 while ( v141 ); | |
6899 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6900 SpriteObject::OnInteraction(v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6901 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6902 v16 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6903 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6904 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6905 v124 = 8 * v153; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6906 LOBYTE(v124) = v124 | 2; |
1456 | 6907 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6908 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6909 return 0; |
0 | 6910 } |
6911 if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) ) | |
6912 return 1; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6913 v67 = pSpriteObjects[uLayingItemID].uType + 1; |
0 | 6914 v68 = pObjectList->uNumObjects; |
6915 v69 = 0; | |
6916 v44 = pObjectList->uNumObjects == 0; | |
6917 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6918 pSpriteObjects[uLayingItemID].uType = v67; |
0 | 6919 if ( v20 | v44 ) |
6920 { | |
6921 LABEL_128: | |
6922 v71 = 0; | |
6923 } | |
6924 else | |
6925 { | |
6926 v70 = (char *)&pObjectList->pObjects->uObjectID; | |
6927 while ( v67 != *(short *)v70 ) | |
6928 { | |
6929 ++v69; | |
6930 v70 += 56; | |
6931 if ( v69 >= (signed int)v68 ) | |
6932 goto LABEL_128; | |
6933 } | |
6934 v71 = v69; | |
6935 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6936 pSpriteObjects[uLayingItemID].uObjectDescID = v71; |
0 | 6937 if ( !v71 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
6938 SpriteObject::OnInteraction(v153); |
0 | 6939 v134 = 0; |
6940 v72 = v153; | |
6941 v132 = 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6942 pSpriteObjects[uLayingItemID].vVelocity.z = v66; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6943 pSpriteObjects[uLayingItemID].vVelocity.y = v66; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6944 pSpriteObjects[uLayingItemID].vVelocity.x = v66; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6945 pSpriteObjects[uLayingItemID].uSpriteFrameID = v66; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6946 stru_50FE08.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6947 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 ) |
0 | 6948 v78 = 0; |
6949 else | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6950 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6951 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6952 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, v66, -1, v66, v78, v66, v66); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6953 return 0; |
0 | 6954 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6955 if ( pSpriteObjects[uLayingItemID].uType == 4090 ) |
0 | 6956 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6957 v84 = pSpriteObjects[uLayingItemID].uType + 2; |
0 | 6958 v85 = pObjectList->uNumObjects; |
6959 v9 = 0; | |
6960 v86 = 0; | |
6961 v44 = pObjectList->uNumObjects == 0; | |
6962 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6963 pSpriteObjects[uLayingItemID].uType = v84; |
0 | 6964 if ( v20 | v44 ) |
6965 { | |
6966 LABEL_155: | |
6967 v88 = 0; | |
6968 } | |
6969 else | |
6970 { | |
6971 v87 = (char *)&pObjectList->pObjects->uObjectID; | |
6972 while ( v84 != *(short *)v87 ) | |
6973 { | |
6974 ++v86; | |
6975 v87 += 56; | |
6976 if ( v86 >= (signed int)v85 ) | |
6977 goto LABEL_155; | |
6978 } | |
6979 v88 = v86; | |
6980 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6981 pSpriteObjects[uLayingItemID].uObjectDescID = v88; |
0 | 6982 if ( !v88 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
6983 SpriteObject::OnInteraction(v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6984 v89 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6985 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6986 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6987 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
0 | 6988 v142 = v89; |
6989 v148 = 7; | |
6990 do | |
6991 { | |
6992 pRnd->SetRange(-128, 128); | |
6993 v90 = pRnd->GetInRange(); | |
6994 pRnd->SetRange(5, 500); | |
6995 v91 = pRnd->GetInRange(); | |
6996 v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
6997 pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0); |
0 | 6998 --v148; |
6999 } | |
7000 while ( v148 ); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7001 SpriteObject::OnInteraction(v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7002 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7003 v16 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7004 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7005 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7006 v124 = 8 * v153; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7007 LOBYTE(v124) = v124 | 2; |
1456 | 7008 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id-1] + 1; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7009 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7010 return 0; |
0 | 7011 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7012 if ( pSpriteObjects[uLayingItemID].uType == 4092 ) |
0 | 7013 { |
7014 v80 = pObjectList->uNumObjects; | |
7015 v66 = 0; | |
7016 v81 = 0; | |
7017 v44 = pObjectList->uNumObjects == 0; | |
7018 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7019 pSpriteObjects[uLayingItemID].uType = 4091; |
0 | 7020 if ( v20 | v44 ) |
7021 { | |
7022 LABEL_144: | |
7023 v83 = 0; | |
7024 } | |
7025 else | |
7026 { | |
7027 v82 = (char *)&pObjectList->pObjects->uObjectID; | |
7028 while ( *(short *)v82 != 4091 ) | |
7029 { | |
7030 ++v81; | |
7031 v82 += 56; | |
7032 if ( v81 >= (signed int)v80 ) | |
7033 goto LABEL_144; | |
7034 } | |
7035 v83 = v81; | |
7036 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7037 pSpriteObjects[uLayingItemID].uObjectDescID = v83; |
0 | 7038 if ( !v83 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
7039 SpriteObject::OnInteraction(v153); |
0 | 7040 v134 = 0; |
7041 v72 = v153; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7042 v132 = pSpriteObjects[uLayingItemID].field_61; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7043 pSpriteObjects[uLayingItemID].vVelocity.z = v66; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7044 pSpriteObjects[uLayingItemID].vVelocity.y = v66; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7045 pSpriteObjects[uLayingItemID].vVelocity.x = v66; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7046 pSpriteObjects[uLayingItemID].uSpriteFrameID = v66; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7047 stru_50FE08.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7048 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7049 v78 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7050 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7051 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7052 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7053 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, v66, -1, v66, v78, v66, v66); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7054 return 0; |
0 | 7055 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7056 if ( pSpriteObjects[uLayingItemID].uType == 4100 || pSpriteObjects[uLayingItemID].uType == 6010 ) |
0 | 7057 goto LABEL_93; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7058 v79 = pSpriteObjects[uLayingItemID].uType == 6040; |
0 | 7059 } |
7060 if ( !v79 ) | |
7061 return 0; | |
7062 goto LABEL_172; | |
7063 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7064 if ( pSpriteObjects[uLayingItemID].uType == 3060 ) |
0 | 7065 goto LABEL_93; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7066 if ( pSpriteObjects[uLayingItemID].uType <= 555 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7067 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7068 if ( pSpriteObjects[uLayingItemID].uType == 555 ) |
0 | 7069 { |
7070 sub_43A97E(v153, v145); | |
7071 v23 = pObjectList->uNumObjects; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7072 ++pSpriteObjects[uLayingItemID].uType; |
0 | 7073 v18 = 0; |
7074 v24 = 0; | |
7075 if ( (signed int)v23 <= 0 ) | |
7076 { | |
7077 LABEL_41: | |
7078 v22 = 0; | |
7079 } | |
7080 else | |
7081 { | |
7082 v25 = (char *)&pObjectList->pObjects->uObjectID; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7083 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v25 ) |
0 | 7084 { |
7085 ++v24; | |
7086 v25 += 56; | |
7087 if ( v24 >= (signed int)v23 ) | |
7088 goto LABEL_41; | |
7089 } | |
7090 v22 = v24; | |
7091 } | |
7092 LABEL_42: | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7093 pSpriteObjects[uLayingItemID].uObjectDescID = v22; |
0 | 7094 if ( v22 == v18 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
7095 SpriteObject::OnInteraction(v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7096 pSpriteObjects[uLayingItemID].vVelocity.z = v18; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7097 pSpriteObjects[uLayingItemID].vVelocity.y = v18; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7098 pSpriteObjects[uLayingItemID].vVelocity.x = v18; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7099 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; |
0 | 7100 } |
7101 else | |
7102 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7103 switch ( pSpriteObjects[uLayingItemID].uType ) |
0 | 7104 { |
7105 case 500: | |
7106 case 505: | |
7107 case 510: | |
7108 case 515: | |
7109 case 520: | |
7110 case 525: | |
7111 case 530: | |
7112 case 535: | |
7113 case 540: | |
7114 sub_43A97E(v153, v145); | |
7115 v8 = pObjectList->uNumObjects; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7116 ++pSpriteObjects[uLayingItemID].uType; |
0 | 7117 v9 = 0; |
7118 v10 = 0; | |
7119 if ( (signed int)v8 <= 0 ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7120 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7121 v12 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7122 goto LABEL_24; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7123 } |
0 | 7124 v11 = (char *)&pObjectList->pObjects->uObjectID; |
7125 break; | |
7126 case 545: | |
7127 case 550: | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7128 if ( pSpriteObjects[uLayingItemID].stru_24.uItemID != 405 && pSpriteObjects[uLayingItemID].stru_24.uSpecEnchantmentType != 3 ) |
0 | 7129 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7130 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7131 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7132 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7133 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
0 | 7134 sub_43A97E(v153, v145); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7135 SpriteObject::OnInteraction(v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7136 if ( pSpriteObjects[uLayingItemID].uSoundID == 0 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7137 v16 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7138 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7139 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7140 v124 = 8 * v153; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7141 LOBYTE(v124) = v124 | 2; |
1456 | 7142 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7143 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7144 return 0; |
0 | 7145 } |
7146 v17 = pObjectList->uNumObjects; | |
7147 v18 = 0; | |
7148 v19 = 0; | |
7149 v44 = pObjectList->uNumObjects == 0; | |
7150 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7151 pSpriteObjects[uLayingItemID].uType = 600; |
0 | 7152 if ( v20 | v44 ) |
7153 goto LABEL_41; | |
7154 v21 = (char *)&pObjectList->pObjects->uObjectID; | |
7155 while ( *(short *)v21 != 600 ) | |
7156 { | |
7157 ++v19; | |
7158 v21 += 56; | |
7159 if ( v19 >= (signed int)v17 ) | |
7160 goto LABEL_41; | |
7161 } | |
7162 v22 = v19; | |
7163 goto LABEL_42; | |
7164 default: | |
7165 return 0; | |
7166 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7167 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v11 ) |
0 | 7168 { |
7169 ++v10; | |
7170 v11 += 56; | |
7171 if ( v10 >= (signed int)v8 ) | |
7172 { | |
7173 v12 = 0; | |
7174 goto LABEL_24; | |
7175 } | |
7176 } | |
7177 v12 = v10; | |
7178 LABEL_24: | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7179 pSpriteObjects[uLayingItemID].uObjectDescID = v12; |
0 | 7180 if ( !v12 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
7181 SpriteObject::OnInteraction(v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7182 v44 = pSpriteObjects[uLayingItemID].uType == 555; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7183 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7184 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7185 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7186 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
0 | 7187 if ( !v44 ) |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7188 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7189 v13 = 8 * v153; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7190 LOBYTE(v13) = PID(OBJECT_Item,v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7191 pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7192 return 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7193 } |
0 | 7194 } |
7195 return 0; | |
7196 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7197 if ( pSpriteObjects[uLayingItemID].uType > 1100 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7198 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7199 v41 = pSpriteObjects[uLayingItemID].uType - 2030; |
0 | 7200 if ( !v41 ) |
7201 goto LABEL_247; | |
7202 v42 = v41 - 30; | |
7203 if ( v42 ) | |
7204 { | |
7205 v43 = v42 - 40; | |
7206 if ( !v43 ) | |
7207 goto LABEL_59; | |
7208 v45 = v43 - 910; | |
7209 v44 = v45 == 0; | |
7210 LABEL_91: | |
7211 if ( !v44 && v45 != 20 ) | |
7212 return 0; | |
7213 } | |
7214 LABEL_93: | |
7215 sub_43A97E(v153, v145); | |
7216 v51 = pObjectList->uNumObjects; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7217 ++pSpriteObjects[uLayingItemID].uType; |
0 | 7218 v9 = 0; |
7219 v52 = 0; | |
7220 if ( (signed int)v51 > 0 ) | |
7221 { | |
7222 v53 = (char *)&pObjectList->pObjects->uObjectID; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7223 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v53 ) |
0 | 7224 { |
7225 ++v52; | |
7226 v53 += 56; | |
7227 if ( v52 >= (signed int)v51 ) | |
7228 goto LABEL_181; | |
7229 } | |
1416 | 7230 v95 = v52; |
0 | 7231 } |
1416 | 7232 else |
7233 { | |
0 | 7234 LABEL_181: |
7235 v95 = 0; | |
1416 | 7236 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7237 pSpriteObjects[uLayingItemID].uObjectDescID = v95; |
0 | 7238 if ( v95 == (short)v9 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
7239 SpriteObject::OnInteraction(v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7240 v96 = pSpriteObjects[uLayingItemID].uSoundID; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7241 pSpriteObjects[uLayingItemID].vVelocity.z = v9; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7242 pSpriteObjects[uLayingItemID].vVelocity.y = v9; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7243 pSpriteObjects[uLayingItemID].vVelocity.x = v9; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7244 pSpriteObjects[uLayingItemID].uSpriteFrameID = v9; |
0 | 7245 if ( v96 == (short)v9 ) |
7246 v97 = 0; | |
7247 else | |
7248 v97 = (signed __int16)v96 + 4; | |
7249 v92 = v153; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7250 v124 = 8 * v92; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7251 LOBYTE(v124) = v124 | 2; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7252 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7253 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7254 return 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7255 } |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7256 if ( pSpriteObjects[uLayingItemID].uType == 1100 ) |
0 | 7257 goto LABEL_93; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7258 v26 = pSpriteObjects[uLayingItemID].uType - 600; |
0 | 7259 if ( !v26 ) |
7260 { | |
7261 v33 = pObjectList->uNumObjects; | |
7262 v34 = 0; | |
7263 v44 = pObjectList->uNumObjects == 0; | |
7264 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7265 pSpriteObjects[uLayingItemID].uType = 601; |
0 | 7266 if ( v20 | v44 ) |
7267 { | |
7268 LABEL_69: | |
7269 v36 = 0; | |
7270 } | |
7271 else | |
7272 { | |
7273 v35 = (char *)&pObjectList->pObjects->uObjectID; | |
7274 while ( *(short *)v35 != 601 ) | |
7275 { | |
7276 ++v34; | |
7277 v35 += 56; | |
7278 if ( v34 >= (signed int)v33 ) | |
7279 goto LABEL_69; | |
7280 } | |
7281 v36 = v34; | |
7282 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7283 pSpriteObjects[uLayingItemID].uObjectDescID = v36; |
0 | 7284 if ( !v36 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
7285 SpriteObject::OnInteraction(v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7286 v37 = pSpriteObjects[uLayingItemID].vPosition.z; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7287 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
0 | 7288 v38 = 8 * v153; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7289 v39 = pSpriteObjects[uLayingItemID].vPosition.y; |
862 | 7290 LOBYTE(v38) = PID(OBJECT_Item,v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7291 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7292 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7293 v40 = pSpriteObjects[uLayingItemID].vPosition.x; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7294 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
0 | 7295 v147 = v38; |
7296 stru_50FE08.Add(v38, 512, v40, v39, v37, 0, 0); | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
7297 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7298 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7299 pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7300 return 0; |
0 | 7301 } |
7302 v27 = v26 - 410; | |
7303 if ( !v27 ) | |
7304 goto LABEL_93; | |
7305 v28 = v27 - 40; | |
7306 if ( !v28 ) | |
7307 goto LABEL_191; | |
7308 v29 = v28 - 10; | |
7309 if ( v29 ) | |
7310 { | |
7311 if ( v29 != 20 ) | |
7312 return 0; | |
7313 LABEL_59: | |
7314 if ( v151 != 3 ) | |
7315 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7316 v30 = pSpriteObjects[uLayingItemID].uType + 1; |
0 | 7317 v31 = pObjectList->uNumObjects; |
7318 v32 = 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7319 pSpriteObjects[uLayingItemID].uType = v30; |
0 | 7320 v146 = 0; |
7321 if ( (signed int)v31 > 0 ) | |
7322 { | |
7323 v140 = (char *)&pObjectList->pObjects->uObjectID; | |
7324 while ( v30 != *(short *)v140 ) | |
7325 { | |
7326 ++v146; | |
7327 v140 += 56; | |
7328 if ( v146 >= (signed int)v31 ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7329 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7330 v46 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7331 pSpriteObjects[uLayingItemID].uObjectDescID = v46; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7332 if ( v46 == (short)v32 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7333 SpriteObject::OnInteraction(v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7334 v100 = pSpriteObjects[uLayingItemID].field_61; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7335 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7336 v102 = 8 * v153; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7337 LOBYTE(v102) = PID(OBJECT_Item,v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7338 pSpriteObjects[uLayingItemID].vVelocity.x = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7339 pSpriteObjects[uLayingItemID].vVelocity.y = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7340 pSpriteObjects[uLayingItemID].vVelocity.z = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7341 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7342 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7343 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7344 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7345 v47 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7346 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7347 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7348 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7349 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7350 return 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7351 } |
0 | 7352 } |
7353 v46 = v146; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7354 pSpriteObjects[uLayingItemID].uObjectDescID = v46; |
0 | 7355 if ( v46 == (short)v32 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
7356 SpriteObject::OnInteraction(v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7357 v100 = pSpriteObjects[uLayingItemID].field_61; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7358 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; |
0 | 7359 v102 = 8 * v153; |
862 | 7360 LOBYTE(v102) = PID(OBJECT_Item,v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7361 pSpriteObjects[uLayingItemID].vVelocity.x = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7362 pSpriteObjects[uLayingItemID].vVelocity.y = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7363 pSpriteObjects[uLayingItemID].vVelocity.z = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7364 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
7365 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7366 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7367 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) |
0 | 7368 v47 = 0; |
7369 else | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7370 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7371 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7372 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7373 return 0; |
0 | 7374 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7375 v46 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7376 pSpriteObjects[uLayingItemID].uObjectDescID = v46; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7377 if ( v46 == (short)v32 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7378 SpriteObject::OnInteraction(v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7379 v100 = pSpriteObjects[uLayingItemID].field_61; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7380 pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7381 v102 = 8 * v153; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7382 LOBYTE(v102) = PID(OBJECT_Item,v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7383 pSpriteObjects[uLayingItemID].vVelocity.x = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7384 pSpriteObjects[uLayingItemID].vVelocity.y = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7385 pSpriteObjects[uLayingItemID].vVelocity.z = v32; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7386 stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7387 if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7388 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7389 if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7390 v47 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7391 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7392 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7393 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7394 pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7395 return 0; |
0 | 7396 } |
7397 return 1; | |
7398 } | |
7399 LABEL_247: | |
7400 if ( v151 == 6 || v151 == 5 || (v9 = 0, !v151) ) | |
7401 return 1; | |
7402 if ( v151 != 2 ) | |
7403 { | |
7404 sub_43A97E(v153, v145); | |
7405 v122 = pObjectList->uNumObjects; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7406 ++pSpriteObjects[uLayingItemID].uType; |
0 | 7407 v52 = 0; |
7408 if ( (signed int)v122 > 0 ) | |
7409 { | |
7410 v123 = (char *)&pObjectList->pObjects->uObjectID; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7411 while ( pSpriteObjects[uLayingItemID].uType != *(short *)v123 ) |
0 | 7412 { |
7413 ++v52; | |
7414 v123 += 56; | |
7415 if ( v52 >= (signed int)v122 ) | |
7416 goto LABEL_181; | |
7417 } | |
7418 v95 = v52; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7419 pSpriteObjects[uLayingItemID].uObjectDescID = v95; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7420 if ( v95 == (short)v9 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7421 SpriteObject::OnInteraction(v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7422 v96 = pSpriteObjects[uLayingItemID].uSoundID; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7423 pSpriteObjects[uLayingItemID].vVelocity.z = v9; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7424 pSpriteObjects[uLayingItemID].vVelocity.y = v9; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7425 pSpriteObjects[uLayingItemID].vVelocity.x = v9; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7426 pSpriteObjects[uLayingItemID].uSpriteFrameID = v9; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7427 if ( v96 == (short)v9 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7428 v97 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7429 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7430 v97 = (signed __int16)v96 + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7431 v92 = v153; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7432 v124 = 8 * v92; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7433 LOBYTE(v124) = v124 | 2; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7434 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7435 pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7436 return 0; |
0 | 7437 } |
7438 goto LABEL_181; | |
7439 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7440 v117 = pSpriteObjects[uLayingItemID].uType + 1; |
0 | 7441 v118 = pObjectList->uNumObjects; |
7442 v119 = 0; | |
7443 v44 = pObjectList->uNumObjects == 0; | |
7444 v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7445 pSpriteObjects[uLayingItemID].uType = v117; |
0 | 7446 if ( v20 | v44 ) |
7447 { | |
7448 v121 = 0; | |
7449 } | |
7450 else | |
7451 { | |
7452 v120 = (char *)&pObjectList->pObjects->uObjectID; | |
7453 while ( v117 != *(short *)v120 ) | |
7454 { | |
7455 ++v119; | |
7456 v120 += 56; | |
7457 if ( v119 >= (signed int)v118 ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7458 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7459 v121 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7460 pSpriteObjects[uLayingItemID].uObjectDescID = v121; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7461 if ( !v121 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7462 SpriteObject::OnInteraction(v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7463 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7464 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7465 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7466 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7467 v13 = 8 * v153; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7468 LOBYTE(v13) = PID(OBJECT_Item,v153); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7469 pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7470 return 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7471 } |
0 | 7472 } |
7473 v121 = v119; | |
7474 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7475 pSpriteObjects[uLayingItemID].uObjectDescID = v121; |
0 | 7476 if ( !v121 ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
7477 SpriteObject::OnInteraction(v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7478 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7479 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7480 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7481 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
0 | 7482 v13 = 8 * v153; |
862 | 7483 LOBYTE(v13) = PID(OBJECT_Item,v153); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
7484 pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9); |
0 | 7485 return 0; |
7486 } |