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