Mercurial > mm7
annotate mm7_2.cpp @ 2186:7a517c9a1d5b
CastSpell continue
author | Ritor1 |
---|---|
date | Mon, 27 Jan 2014 17:33:34 +0600 |
parents | 385040580292 |
children | 48a28fe1f32f |
rev | line source |
---|---|
0 | 1 #include <io.h> |
2 #include <direct.h> | |
1545 | 3 |
4 #include "OSAPI.h" | |
1016 | 5 |
1262 | 6 #include "Texture.h" |
7 #include "mm7_data.h" | |
2152 | 8 #include "mm7_unsorted_subs.h" |
1016 | 9 #include "VideoPlayer.h" |
10 #include "Sprites.h" | |
11 #include "BSPModel.h" | |
12 | |
13 #include "LightmapBuilder.h" | |
14 #include "DecalBuilder.h" | |
15 #include "ParticleEngine.h" | |
16 #include "Mouse.h" | |
17 #include "Keyboard.h" | |
18 #include "CShow.h" | |
19 #include "GammaControl.h" | |
20 #include "stru6.h" | |
21 | |
1935 | 22 #include "Actor.h" |
1016 | 23 #include "Vis.h" |
0 | 24 #include "MapInfo.h" |
25 #include "Game.h" | |
26 #include "GUIWindow.h" | |
27 #include "GUIFont.h" | |
28 #include "Party.h" | |
29 #include "AudioPlayer.h" | |
30 #include "Outdoor.h" | |
1637 | 31 #include "Outdoor_stuff.h" |
0 | 32 #include "Overlays.h" |
33 #include "Arcomage.h" | |
34 #include "LOD.h" | |
35 #include "Actor.h" | |
36 #include "Events.h" | |
37 #include "Viewport.h" | |
38 #include "FrameTableInc.h" | |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2035
diff
changeset
|
39 #include "OurMath.h" |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
40 #include "SpriteObject.h" |
0 | 41 #include "ObjectList.h" |
42 #include "Chest.h" | |
43 #include "PaletteManager.h" | |
44 #include "DecorationList.h" | |
45 #include "SaveLoad.h" | |
46 #include "stru123.h" | |
522 | 47 #include "stru176.h" |
2044 | 48 #include "Timer.h" |
0 | 49 #include "IconFrameTable.h" |
50 #include "GUIProgressBar.h" | |
51 #include "Bink_Smacker.h" | |
52 #include "PlayerFrameTable.h" | |
53 #include "TurnEngine.h" | |
54 #include "FactionTable.h" | |
55 #include "StorylineTextTable.h" | |
56 #include "Random.h" | |
924 | 57 #include "CastSpellInfo.h" |
0 | 58 #include "stru298.h" |
59 #include "Events2D.h" | |
60 #include "Log.h" | |
1299 | 61 #include "UI\UIHouses.h" |
189 | 62 #include "texts.h" |
522 | 63 #include "MM7.h" |
1262 | 64 #include "Lights.h" |
1815 | 65 #include "NewUI/MainMenu.h" |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1826
diff
changeset
|
66 #include "Level/Decoration.h" |
2052 | 67 #include "LuaVM.h" |
68 | |
69 //#include "lib/lua/lua.h" | |
2033 | 70 |
1913 | 71 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam); |
72 int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4); | |
73 bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive); | |
74 bool __fastcall Initialize(HINSTANCE hInst, char *pCmdLine); | |
75 | |
76 //----- (004A1780) mm6_chinese--------------------------------------------- | |
77 __int64 fixpoint_div(int a1, int a2) | |
78 { | |
79 return ((__int64)a1 << 16) / a2; | |
80 } | |
81 | |
82 __int64 fixpoint_sub_unknown(int a1, int a2) | |
83 { | |
84 return (((__int64)a1 << 16) * a2) >> 16; | |
85 } | |
86 | |
87 //----- (0042EBBE) -------------------------------------------------------- | |
88 //----- (004453C0) mm6----------------------------------------------------- | |
89 //----- (004A1760) mm6_chinese--------------------------------------------- | |
90 __int64 fixpoint_mul(int a1, int a2) | |
91 { | |
92 return ((__int64)a1 * (__int64)a2) >> 16; | |
93 } | |
94 | |
95 __int64 fixpoint_dot(int x1, int x2, int y1, int y2, int z1, int z2) | |
96 { | |
97 return fixpoint_mul(x1, x2) + | |
98 fixpoint_mul(y1, y2) + | |
99 fixpoint_mul(z1, z2); | |
100 } | |
101 | |
0 | 102 //----- (004BB756) -------------------------------------------------------- |
1413 | 103 int UseNPCSkill(NPCProf profession) |
0 | 104 { |
1413 | 105 switch (profession) |
106 { | |
107 case Healer: | |
108 { | |
109 for (int i = 0; i < 4; ++i) | |
110 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].GetMaxHealth(); | |
111 } | |
112 break; | |
113 | |
114 case ExpertHealer: | |
115 { | |
116 for (int i = 0; i < 4; ++i) | |
117 { | |
1980 | 118 Player* player = &pParty->pPlayers[i]; |
1413 | 119 player->sHealth = player->GetMaxHealth(); |
120 | |
121 for (int j = 0; j < 14; ++j) | |
122 player->pConditions[i] = 0; | |
123 player->pConditions[18] = 0; | |
124 } | |
125 } | |
126 break; | |
127 | |
128 case MasterHealer: | |
129 { | |
130 for (int i = 0; i < 4; ++i) | |
131 { | |
1980 | 132 Player* player = &pParty->pPlayers[i]; |
1413 | 133 player->sHealth = player->GetMaxHealth(); |
134 | |
1980 | 135 int v5 = LODWORD(player->pConditions[19]);//*((int *)v4 - 32); |
136 int v6 = HIDWORD(player->pConditions[19]);//*((int *)v4 - 31); | |
1826 | 137 memset(player->pConditions.data(), 0, 0xA0u); |
1413 | 138 |
139 __debugbreak(); | |
140 *(int *)&player->pActiveSkills[8] = v5; | |
141 *(int *)&player->pActiveSkills[10] = v6; | |
142 } | |
143 } | |
144 break; | |
145 | |
146 case Cook: | |
147 { | |
148 if (pParty->uNumFoodRations >= 13) | |
149 return 1; | |
150 | |
151 Party::GiveFood(1); | |
152 } | |
153 break; | |
154 | |
155 case Chef: | |
156 { | |
157 if (pParty->uNumFoodRations >= 13) | |
158 return 1; | |
159 | |
160 if (pParty->uNumFoodRations == 13) | |
161 Party::GiveFood(1); | |
162 else | |
163 Party::GiveFood(2); | |
164 } | |
165 break; | |
166 | |
167 case WindMaster: | |
0 | 168 { |
1413 | 169 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
170 { | |
171 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); | |
172 pAudioPlayer->PlaySound(SOUND_203, 0, 0, -1, 0, 0, 0, 0); | |
173 } | |
174 else | |
175 { | |
1980 | 176 int v19 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); |
1413 | 177 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + 60 * (256 * 2), 3, 1, v19, 0); |
178 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags |= 1u; | |
179 pAudioPlayer->PlaySound(SOUND_11090, 0, 0, -1, 0, 0, 0, 0); | |
180 } | |
181 } | |
182 break; | |
183 | |
184 case WaterMaster: | |
185 { | |
1980 | 186 int v20 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); |
1413 | 187 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + 60 * (256 * (2 + 1)), 3, 0, v20, 0); |
188 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags |= 1u; | |
189 pAudioPlayer->PlaySound(SOUND_12040, 0, 0, -1, 0, 0, 0, 0); | |
190 } | |
191 break; | |
192 | |
193 case GateMaster: | |
194 { | |
195 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
196 dword_50C9DC = 195; | |
197 ptr_50C9E0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); | |
198 } | |
199 break; | |
200 | |
201 case Acolyte: _42777D_CastSpell_UseWand_ShootArrow(46, 0, 133, 0, 0); break; | |
202 case Piper: _42777D_CastSpell_UseWand_ShootArrow(51, 0, 133, 0, 0); break; | |
203 case FallenWizard: _42777D_CastSpell_UseWand_ShootArrow(86, 0, 133, 0, 0); break; | |
204 | |
205 case Teacher: | |
206 case Instructor: | |
207 case Armsmaster: | |
208 case Weaponsmaster: | |
209 case Apprentice: | |
210 case Mystic: | |
211 case Spellmaster: | |
212 case Trader: | |
213 case Merchant: | |
214 case Scout: | |
215 case Herbalist: | |
216 case Apothecary: | |
217 case Tinker: | |
218 case Locksmith: | |
219 case Fool: | |
220 case ChimneySweep: | |
221 case Porter: | |
222 case QuarterMaster: | |
223 case Factor: | |
224 case Banker: | |
225 case Horseman: | |
226 case Bard: | |
227 case Enchanter: | |
228 case Cartographer: | |
229 case Explorer: | |
230 case Pirate: | |
231 case Squire: | |
232 case Psychic: | |
233 case Gypsy: | |
234 case Diplomat: | |
235 case Duper: | |
236 case Burglar: | |
237 case Acolyte2: | |
238 case Initiate: | |
239 case Prelate: | |
240 case Monk: | |
241 case Sage: | |
242 case Hunter: | |
243 break; | |
244 | |
245 default: | |
246 assert(false && "Invalid enum value"); | |
247 } | |
248 return 0; | |
0 | 249 } |
250 | |
251 //----- (004BBA85) -------------------------------------------------------- | |
1529 | 252 void CheckBountyRespawnAndAward() |
0 | 253 { |
254 int i; // eax@2 | |
1529 | 255 int rand_monster_id; // edx@3 |
0 | 256 |
257 uDialogueType = 83; | |
258 pDialogueWindow->Release(); | |
259 pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0); | |
1529 | 260 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" |
945 | 261 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 262 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
1529 | 263 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_0, 83, 0, "", 0); |
972 | 264 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 265 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
1529 | 266 //get new monster for hunting |
1747
cecb080929c4
Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents:
1736
diff
changeset
|
267 if ( pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed ) |
1529 | 268 { |
269 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; | |
1747
cecb080929c4
Party_stru0 renamed to PartyTimeStruct, fixed its members, renamed Party::field_3C to Party::PartyTimes, started Player::SetVariable refactoring start
Grumpy7
parents:
1736
diff
changeset
|
270 pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); |
0 | 271 for ( i = rand(); ; i = rand() ) |
272 { | |
1529 | 273 rand_monster_id = i % 258 + 1; |
274 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand_monster_id; | |
275 if ( (unsigned __int16)rand_monster_id < 0x73u || (unsigned __int16)rand_monster_id > 0x84u ) | |
0 | 276 { |
1529 | 277 if ( ((unsigned __int16)rand_monster_id < 0xEBu || (unsigned __int16)rand_monster_id > 0xFCu) |
278 && ((unsigned __int16)rand_monster_id < 0x85u || (unsigned __int16)rand_monster_id > 0x96u) | |
279 && ((unsigned __int16)rand_monster_id < 0x97u || (unsigned __int16)rand_monster_id > 0xBAu) | |
280 && ((unsigned __int16)rand_monster_id < 0xC4u || (unsigned __int16)rand_monster_id > 0xC6u) ) | |
0 | 281 break; |
282 } | |
283 } | |
284 } | |
1529 | 285 bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
286 if ( !pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) | |
287 { | |
288 bountyHunting_text = pNPCTopics[351].pText; | |
289 if ( !pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) | |
290 bountyHunting_text = pNPCTopics[353].pText; | |
291 } | |
292 else//get prize | |
293 { | |
294 if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) | |
0 | 295 { |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1826
diff
changeset
|
296 pParty->PartyFindsGold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); |
1529 | 297 for ( uint i = 0; i < 4; ++i ) |
298 pParty->pPlayers[i].SetVariable(VAR_Award, 86); | |
299 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel; | |
300 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0; | |
301 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; | |
0 | 302 } |
1529 | 303 bountyHunting_text = pNPCTopics[352].pText; |
304 } | |
0 | 305 } |
306 | |
307 //----- (004BBCDD) -------------------------------------------------------- | |
1914 | 308 void Arena_SelectionFightLevel() |
0 | 309 { |
310 signed int v0; // ebp@3 | |
90 | 311 Actor *v1; // eax@4 |
0 | 312 __int16 v2; // cx@5 |
313 int v3; // esi@8 | |
314 Player *v4; // esi@14 | |
315 GUIButton *v5; // eax@18 | |
316 GUIButton *v6; // esi@19 | |
317 size_t v7; // [sp+10h] [bp-4h]@4 | |
318 | |
319 if ( pParty->field_7B5_in_arena_quest ) | |
320 { | |
321 if ( pParty->field_7B5_in_arena_quest == -1 ) | |
322 { | |
323 uDialogueType = 92; | |
324 } | |
325 else | |
326 { | |
327 v0 = 0; | |
90 | 328 if ( (signed int)uNumActors > 0 ) |
329 { | |
1202 | 330 v1 = pActors.data();//[0].uAIState; |
90 | 331 v7 = uNumActors; |
332 do | |
333 { | |
334 v2 = v1->uAIState; | |
848 | 335 if ( v1->uAIState == Dead || v2 == Removed || v2 == Disabled || (v3 = v1->uSummonerID) != 0 && PID_TYPE(v3) == OBJECT_Player) |
90 | 336 ++v0; |
337 ++v1; | |
338 --v7; | |
339 } | |
340 while ( v7 ); | |
341 } | |
342 if ( v0 >= (signed int)uNumActors || (signed int)uNumActors <= 0) | |
343 { | |
0 | 344 uDialogueType = 91; |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1842
diff
changeset
|
345 v4 = pParty->pPlayers.data(); |
1529 | 346 ++*((char *)&pParty->monster_for_hunting_killed[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1); |
0 | 347 do |
348 { | |
349 v4->SetVariable(VAR_Award, (unsigned __int8)pParty->field_7B5_in_arena_quest + 3); | |
350 ++v4; | |
351 } | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1842
diff
changeset
|
352 while ( (signed int)v4 < (signed int)pParty->pHirelings.data() ); |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1826
diff
changeset
|
353 pParty->PartyFindsGold(gold_transaction_amount, 0); |
0 | 354 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); |
355 pParty->field_7B5_in_arena_quest = -1; | |
356 } | |
357 else | |
358 { | |
359 uDialogueType = 90; | |
360 pParty->vPosition.x = 3849; | |
361 pParty->vPosition.y = 5770; | |
362 pParty->vPosition.z = 1; | |
363 pParty->uFallStartY = 1; | |
364 pParty->sRotationY = 512; | |
365 pParty->sRotationX = 0; | |
366 pParty->uFallSpeed = 0; | |
367 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); | |
368 } | |
369 } | |
370 } | |
371 else | |
372 { | |
373 uDialogueType = 89; | |
374 v5 = pDialogueWindow->pControlsHead; | |
375 if ( v5 ) | |
376 { | |
377 do | |
378 { | |
379 v6 = v5->pNext; | |
1583 | 380 free(v5); |
0 | 381 v5 = v6; |
382 } | |
383 while ( v6 ); | |
384 } | |
385 pDialogueWindow->pControlsHead = 0; | |
386 pDialogueWindow->pControlsTail = 0; | |
387 pDialogueWindow->uNumControls = 0; | |
832 | 388 pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], |
945 | 389 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 390 pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x55u, 0, "", 0); |
391 pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x56u, 0, "", 0); | |
392 pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x57u, 0, "", 0); | |
393 pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x58u, 0, "", 0); | |
972 | 394 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); |
0 | 395 } |
396 } | |
397 | |
398 //----- (004BC109) -------------------------------------------------------- | |
2154 | 399 void ArenaFight() |
0 | 400 { |
401 int v0; // edi@1 | |
402 char *v1; // eax@7 | |
403 Player *v2; // edi@9 | |
404 int v3; // eax@10 | |
405 signed int v4; // esi@10 | |
2135 | 406 //signed __int64 v5; // qax@18 |
0 | 407 signed int v6; // ebx@34 |
2135 | 408 //char *v7; // edi@34 |
0 | 409 int v8; // eax@37 |
2135 | 410 //int v9; // esi@43 |
411 //int v10; // eax@44 | |
0 | 412 unsigned __int8 v11; // sf@44 |
413 unsigned __int8 v12; // of@44 | |
414 signed int v13; // eax@49 | |
415 int v14; // esi@49 | |
416 int v15; // edx@50 | |
417 int v16; // eax@51 | |
418 signed int v17; // ecx@51 | |
419 int v18; // edx@53 | |
420 int i; // edi@55 | |
421 int monster_y; // ST18_4@56 | |
422 int v21; // eax@56 | |
423 signed int v22; // [sp-4h] [bp-144h]@51 | |
424 __int16 v23[100]; // [sp+Ch] [bp-134h]@39 | |
425 GUIWindow window; // [sp+D4h] [bp-6Ch]@1 | |
426 __int16 monster_ids[6]; // [sp+128h] [bp-18h]@56 | |
427 int v26; // [sp+134h] [bp-Ch]@1 | |
2135 | 428 //int v27; // [sp+138h] [bp-8h]@23 |
0 | 429 int num_monsters; // [sp+13Ch] [bp-4h]@17 |
430 | |
431 v26 = 0; | |
432 pParty->field_7B5_in_arena_quest = uDialogueType; | |
433 memcpy(&window, pDialogueWindow, sizeof(window)); | |
819 | 434 window.uFrameWidth = game_viewport_width; |
0 | 435 window.uFrameZ = 452; |
436 v0 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[575], &window, 13, 0) + 7; | |
437 pRenderer->BeginSceneD3D(); | |
438 | |
439 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
440 pIndoor->Draw(); | |
441 else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
2135 | 442 pOutdoor->Draw(); |
0 | 443 |
444 pRenderer->DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene(); | |
445 pRenderer->BeginScene(); | |
2154 | 446 //if ( pRenderer->pRenderD3D ) |
447 pRenderer->FillRectFast(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, | |
448 pViewport->uViewportBR_X - pViewport->uViewportTL_X, | |
449 pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1, | |
2155 | 450 0x7FF); |
0 | 451 |
1980 | 452 Texture* pTex = pIcons_LOD->GetTexture(uTextureID_Leather); |
1496 | 453 pRenderer->GetLeather(8, 352 - v0, pTex, pTex->uTextureHeight - v0); |
0 | 454 |
2135 | 455 pRenderer->DrawTextureIndexed(8, 347 - v0, pTexture_591428); |
456 v1 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[575], pFontArrus, &window, 0xDu, 0);//Ïîæàëóéñòà, ïîäîæäèòå ïîêà ÿ âûçûâàþ ñóùåñòâ. Óäà÷è. | |
0 | 457 pDialogueWindow->DrawText(pFontArrus, 13, 354 - v0, 0, v1, 0, 0, 0); |
458 pRenderer->EndScene(); | |
459 pRenderer->Present(); | |
460 pParty->vPosition.x = 3849; | |
461 pParty->vPosition.y = 5770; | |
462 pParty->vPosition.z = 1; | |
463 pParty->uFallStartY = 1; | |
464 pParty->sRotationY = 512; | |
465 pParty->sRotationX = 0; | |
466 pParty->uFallSpeed = 0; | |
437 | 467 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 468 { |
990 | 469 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; |
0 | 470 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
471 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
472 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 473 }*/ |
474 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); | |
2135 | 475 //v2 = pParty->pPlayers.data(); |
476 for ( uint i = 0; i < 4; i++ ) | |
0 | 477 { |
2135 | 478 v3 = pParty->pPlayers[i].GetActualLevel(); |
0 | 479 v4 = v26; |
480 if ( v3 > v26 ) | |
481 { | |
2135 | 482 v26 = pParty->pPlayers[i].GetActualLevel(); |
483 v4 = pParty->pPlayers[i].GetActualLevel(); | |
0 | 484 } |
2135 | 485 //++v2; |
0 | 486 } |
2135 | 487 //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() ); |
488 if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) | |
0 | 489 { |
490 num_monsters = v4; | |
1416 | 491 v4 /= 2; |
492 } | |
2135 | 493 else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) |
0 | 494 { |
2135 | 495 //v5 = (signed __int64)((double)v26 * 1.5); |
496 num_monsters = (int)((double)v26 * 1.5); | |
1416 | 497 v4 /= 2; |
498 } | |
2135 | 499 else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) |
0 | 500 { |
2135 | 501 //LODWORD(v5) = 2 * v4; |
502 num_monsters = 2 * v4; | |
0 | 503 v4 /= 2; |
1416 | 504 } |
2135 | 505 else if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) |
1416 | 506 { |
2135 | 507 num_monsters = 2 * v4; |
508 v4 /= 2; | |
1416 | 509 } |
0 | 510 if ( v4 < 1 ) |
511 v4 = 1; | |
512 if ( v4 > 100 ) | |
513 v4 = 100; | |
514 if ( num_monsters > 100 ) | |
515 num_monsters = 100; | |
516 if ( v4 < 2 ) | |
517 v4 = 2; | |
518 if ( num_monsters < 2 ) | |
519 num_monsters = 2; | |
520 v6 = 0; | |
2135 | 521 //v27 = 1; |
522 //v7 = (char *)&pMonsterStats->pInfos[1].uLevel; | |
523 for ( uint i = 1; i <= 258; i++ ) | |
0 | 524 { |
2135 | 525 if ( pMonsterStats->pInfos[i].uAIType != 1 )//if ( v7[8] != 1 ) |
0 | 526 { |
2135 | 527 if ( !MonsterStats::BelongsToSupertype(pMonsterStats->pInfos[i].uID, MONSTER_SUPERTYPE_8) ) //!MonsterStats::BelongsToSupertype(*((short *)v7 + 22), MONSTER_SUPERTYPE_8) |
0 | 528 { |
2135 | 529 //v8 = (unsigned __int8)pMonsterStats->pInfos[i].uLevel; |
530 if ( pMonsterStats->pInfos[i].uLevel >= v4 ) | |
0 | 531 { |
2135 | 532 if ( pMonsterStats->pInfos[i].uLevel <= num_monsters ) |
533 v23[v6++] = i; | |
0 | 534 } |
535 } | |
536 } | |
2135 | 537 // ++v27; |
538 //v7 += 88; | |
0 | 539 } |
2135 | 540 //while ( (signed int)v7 <= (signed int)&pMonsterStats->pInfos[258].uLevel ); |
0 | 541 num_monsters = 6; |
542 if ( v6 < 6 ) | |
543 num_monsters = v6; | |
2135 | 544 //v9 = 0; |
0 | 545 if ( num_monsters > 0 ) |
546 { | |
2135 | 547 for ( uint i = 0; i < num_monsters; i++ ) |
0 | 548 { |
2135 | 549 //v10 = rand(); |
550 //++v9; | |
551 //v12 = __OFSUB__(v9, num_monsters); | |
552 //v11 = v9 - num_monsters < 0; | |
553 //*((short *)&window.pControlsTail + v9 + 1) = v23[rand() % v6]; | |
554 monster_ids[i] = v23[rand() % v6]; | |
0 | 555 } |
2135 | 556 //while ( v11 ^ v12 ); |
0 | 557 } |
2135 | 558 if ( uDialogueType == DIALOGUE_ARENA_SELECT_PAGE ) |
0 | 559 { |
560 v16 = rand(); | |
561 v17 = 3; | |
562 v22 = 50; | |
1416 | 563 v18 = v16 % v17; |
564 v13 = v22; | |
565 v14 = v18 + 6; | |
566 } | |
2135 | 567 else if ( uDialogueType == DIALOGUE_ARENA_SELECT_SQUIRE ) |
0 | 568 { |
569 v16 = rand(); | |
570 v17 = 7; | |
571 v22 = 100; | |
572 v18 = v16 % v17; | |
573 v13 = v22; | |
574 v14 = v18 + 6; | |
1416 | 575 } |
2135 | 576 else if ( uDialogueType == DIALOGUE_ARENA_SELECT_KNIGHT ) |
0 | 577 { |
578 v15 = rand() % 11; | |
579 v13 = 200; | |
580 v14 = v15 + 10; | |
581 } | |
582 else | |
583 { | |
2135 | 584 if ( uDialogueType == DIALOGUE_ARENA_SELECT_CHAMPION ) |
0 | 585 { |
586 v13 = 500; | |
587 v14 = 20; | |
588 } | |
2135 | 589 //else |
590 //{ | |
591 //v14 = v27; | |
592 //v13 = gold_transaction_amount; | |
593 //} | |
0 | 594 } |
2135 | 595 gold_transaction_amount = v26 * v13; |
596 for ( i = 0; i < v14; ++i ) | |
2169 | 597 Actor::Arena_summon_actor(monster_ids[rand() % num_monsters], pMonsterArenaPlacements[i].x, pMonsterArenaPlacements[i].y, 1); |
0 | 598 pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); |
599 } | |
600 | |
601 //----- (004BD8B5) -------------------------------------------------------- | |
1919 | 602 int HouseDialogPressCloseBtn() |
0 | 603 { |
604 if ( pMessageQueue_50CBD0->uNumMessages ) | |
605 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
1459 | 606 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); |
0 | 607 pKeyActionMap->ResetKeys(); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
519
diff
changeset
|
608 activeLevelDecoration = NULL; |
827 | 609 current_npc_text = 0; |
1917 | 610 if ( pDialogueNPCCount == 0) |
1919 | 611 return 0; |
612 | |
613 if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL && ShopTexture ) | |
0 | 614 { |
1919 | 615 ShopTexture->Release(); |
1917 | 616 ShopTexture = 0; |
617 } | |
618 | |
1919 | 619 switch(dialog_menu_id) |
1917 | 620 { |
1919 | 621 case -1: |
622 _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); | |
623 pVideoPlayer->_4BF5B2(); | |
624 break; | |
625 | |
626 case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: | |
627 case HOUSE_DIALOGUE_LEARN_SKILLS: | |
628 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: | |
629 pVideoPlayer->_4BF5B2(); | |
630 UI_CreateEndConversationButton(); | |
631 dialog_menu_id = HOUSE_DIALOGUE_MAIN; | |
632 InitializaDialogueOptions(in_current_building_type); | |
633 break; | |
634 | |
635 case HOUSE_DIALOGUE_SHOP_SELL: | |
636 case HOUSE_DIALOGUE_SHOP_IDENTIFY: | |
637 case HOUSE_DIALOGUE_SHOP_REPAIR: | |
638 UI_CreateEndConversationButton(); | |
639 dialog_menu_id = HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT; | |
640 InitializaDialogueOptions_Shops(in_current_building_type); | |
641 break; | |
642 | |
643 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: | |
644 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: | |
645 case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: | |
646 pVideoPlayer->_4BF5B2(); | |
647 UI_CreateEndConversationButton(); | |
648 dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN; | |
649 InitializaDialogueOptions_Tavern(in_current_building_type); | |
650 break; | |
651 | |
652 case HOUSE_DIALOGUE_NULL: | |
653 case HOUSE_DIALOGUE_MAIN: | |
654 pDialogueNPCCount = 0; | |
655 pDialogueWindow->Release(); | |
656 dialog_menu_id = HOUSE_DIALOGUE_NULL; | |
657 pDialogueWindow = 0; | |
658 pIcons_LOD->SyncLoadedFilesCount(); | |
659 | |
660 if ( uNumDialogueNPCPortraits == 1 ) | |
661 return 0; | |
662 | |
663 pBtn_ExitCancel = window_SpeakInHouse->pControlsHead; | |
664 if ( uNumDialogueNPCPortraits > 0 ) | |
665 { | |
666 for ( uint i = 0; i < (unsigned int)uNumDialogueNPCPortraits; ++i ) | |
667 { | |
668 HouseNPCPortraitsButtonsList[i] = window_SpeakInHouse->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][i], | |
669 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][i], | |
670 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, i, 0, byte_591180[i].data(), 0, 0, 0); | |
671 } | |
672 } | |
673 | |
674 pVideoPlayer->_4BF5B2(); | |
675 break; | |
676 | |
677 default: | |
678 pVideoPlayer->_4BF5B2(); | |
679 dialog_menu_id = HOUSE_DIALOGUE_MAIN; | |
680 InitializaDialogueOptions(in_current_building_type); | |
681 break; | |
0 | 682 } |
1917 | 683 return 1; |
0 | 684 } |
685 | |
686 //----- (004BF91E) -------------------------------------------------------- | |
2061 | 687 unsigned int GameOverMenu(void *ecx0) |
0 | 688 { |
1838 | 689 const char *v1; // eax@2 |
0 | 690 unsigned int result; // eax@3 |
89 | 691 Player *v3; // eax@7 |
1838 | 692 const char *v4; // ST24_4@9 |
0 | 693 int v5; // eax@9 |
1838 | 694 const char *v6; // eax@10 |
695 const char *v7; // edx@10 | |
696 const char *v8; // ecx@12 | |
697 const char *v9; // eax@14 | |
0 | 698 unsigned int v10; // eax@25 |
699 GUIWindow pWindow; // [sp+34h] [bp-9Ch]@1 | |
1532 | 700 //MSG Msg; // [sp+88h] [bp-48h]@22 |
0 | 701 unsigned int v14; // [sp+A4h] [bp-2Ch]@5 |
702 void *v15; // [sp+A8h] [bp-28h]@1 | |
1838 | 703 const char *pInString; // [sp+ACh] [bp-24h]@5 |
0 | 704 unsigned int v17; // [sp+B0h] [bp-20h]@5 |
705 unsigned int v18; // [sp+B4h] [bp-1Ch]@5 | |
706 unsigned int v19; // [sp+B8h] [bp-18h]@5 | |
707 int v20; // [sp+BCh] [bp-14h]@7 | |
89 | 708 Player *i; // [sp+C0h] [bp-10h]@7 |
0 | 709 GUIFont *pFont; // [sp+C4h] [bp-Ch]@1 |
710 unsigned __int64 v23; // [sp+C8h] [bp-8h]@5 | |
711 | |
712 v15 = ecx0; | |
713 | |
714 RGBTexture _this; // [sp+Ch] [bp-C4h]@1 | |
715 //RGBTexture::RGBTexture(&this); | |
716 | |
2061 | 717 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_4000; |
0 | 718 bGameoverLoop = 1; |
719 pVideoPlayer->bStopBeforeSchedule = 0; | |
720 pAudioPlayer->StopChannels(-1, -1); | |
721 pRenderer->BeginScene(); | |
722 pRenderer->ClearBlack(); | |
723 pRenderer->EndScene(); | |
724 pRenderer->Present(); | |
165 | 725 pVideoPlayer->pResetflag = 0; |
484 | 726 _449B57_test_bit(pParty->_quest_bits, 99); |
0 | 727 _this.Load("winbg.pcx", 2); |
728 pRenderer->BeginScene(); | |
729 pRenderer->DrawTextureRGB(0, 0, &_this); | |
730 pRenderer->EndScene(); | |
731 free(_this.pPixels); | |
732 _this.pPixels = 0; | |
336 | 733 window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); |
0 | 734 pWindow.uFrameX = 75; |
735 pWindow.uFrameY = 60; | |
736 pWindow.uFrameWidth = 469; | |
737 pWindow.uFrameHeight = 338; | |
738 pWindow.uFrameZ = 543; | |
739 pWindow.uFrameW = 397; | |
180 | 740 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
|
741 if ( pParty->IsPartyGood() ) |
2133 | 742 v1 = pGlobalTXT_LocalizationStrings[675];//"Splendid job! With the activation of the Gate, a thousand worlds lie at your feet. Perhaps on one of them you will find the Ancients themselves, and return with the fruits their great civilization has to offer your world and your kingdom." |
0 | 743 else |
744 { | |
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
|
745 result = pParty->IsPartyEvil(); |
0 | 746 if ( !(short)result ) |
747 return result; | |
2133 | 748 v1 = pGlobalTXT_LocalizationStrings[676];//"Brilliant! The completion of the Heavenly Forge has provided enough Ancient weapons to crush all resistance to your plans. Soon the world will bow to your every whim! Still, you can't help but wonder what was beyond the Gate the other side was trying so hard to build." |
0 | 749 } |
750 pInString = v1; | |
751 v23 = pParty->uTimePlayed - 138240; | |
752 v19 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 0x18; | |
753 v14 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 0x18 / 0x1C / 0xC; | |
754 v18 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 0x18 / 0x1C % 0xC; | |
755 v17 = v19 % 0x1C; | |
756 if ( !v19 ) | |
757 v19 = 1; | |
758 pRenderer->BeginScene(); | |
2133 | 759 pWindow.DrawTitleText(pFont, 1, 0x23, 1, pGlobalTXT_LocalizationStrings[9], 3);//Congratulations! |
0 | 760 v23 = 0i64; |
761 v20 = 0; | |
2133 | 762 for ( uint i = 0; i < 4; i++ ) |
89 | 763 { |
2133 | 764 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[129], pParty->pPlayers[i].pName, pParty->pPlayers[i].GetBaseLevel(), pClassNames[pParty->pPlayers[i].classType]);//%s the Level %u %s |
765 pWindow.DrawTitleText(pFont, 1, i * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46, 1, pTmpBuf.data(), 3); | |
766 v23 += pParty->pPlayers[i].uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8)); | |
0 | 767 } |
768 v23 = (signed __int64)v23 / v19; | |
2133 | 769 v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xC, 0); |
770 pWindow.DrawTitleText(pFont, 1, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1, v6, 0); | |
771 strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]);//Total Time: | |
0 | 772 v7 = pGlobalTXT_LocalizationStrings[56]; |
773 if ( v17 != 1 ) | |
774 v7 = pGlobalTXT_LocalizationStrings[57]; | |
775 v8 = pGlobalTXT_LocalizationStrings[146]; | |
776 if ( v18 != 1 ) | |
777 v8 = pGlobalTXT_LocalizationStrings[148]; | |
778 v9 = pGlobalTXT_LocalizationStrings[245]; | |
779 if ( v14 != 1 ) | |
780 v9 = pGlobalTXT_LocalizationStrings[132]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
781 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
|
782 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
783 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
|
784 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23); |
2133 | 785 pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1u, pTmpBuf.data(), 3); |
2061 | 786 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000; |
0 | 787 pRenderer->EndScene(); |
788 pRenderer->Present(); | |
2153 | 789 //if ( pRenderer->pRenderD3D ) |
0 | 790 pRenderer->pBeforePresentFunction(); |
2069 | 791 pRenderer->SaveWinnersCertificate("MM7_Win.Pcx"); |
1583 | 792 free(pFont); |
336 | 793 window_SpeakInHouse->Release(); |
794 window_SpeakInHouse = 0; | |
0 | 795 if ( v15 == (void *)2 ) |
796 { | |
797 result = pMessageQueue_50CBD0->uNumMessages; | |
798 } | |
799 else | |
800 { | |
801 LODWORD(v23) = GetTickCount() + 5000; | |
802 while ( (unsigned int)v23 > GetTickCount() ) | |
803 ; | |
1532 | 804 for (MSG msg; PeekMessage(&msg, 0, 0, 0, PM_REMOVE);) |
0 | 805 { |
1532 | 806 if (msg.message == WM_QUIT) |
0 | 807 Game_DeinitializeAndTerminate(0); |
1532 | 808 TranslateMessage(&msg); |
809 DispatchMessage(&msg); | |
0 | 810 } |
811 if ( pMessageQueue_50CBD0->uNumMessages ) | |
812 { | |
813 LOBYTE(v10) = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
814 pMessageQueue_50CBD0->uNumMessages = v10; | |
815 } | |
816 pKeyActionMap->ResetKeys(); | |
817 pKeyActionMap->uLastKeyPressed = 0; | |
818 do | |
819 { | |
1532 | 820 for (MSG msg; PeekMessage(&msg, 0, 0, 0, PM_REMOVE);) |
0 | 821 { |
1532 | 822 if (msg.message == WM_QUIT) |
0 | 823 Game_DeinitializeAndTerminate(0); |
1532 | 824 TranslateMessage(&msg); |
825 DispatchMessage(&msg); | |
0 | 826 } |
827 } | |
828 while ( !pKeyActionMap->uLastKeyPressed ); | |
829 result = pMessageQueue_50CBD0->uNumMessages; | |
830 if ( pMessageQueue_50CBD0->uNumMessages ) | |
831 { | |
832 result = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
833 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
834 } | |
835 } | |
836 if ( v15 ) | |
837 { | |
437 | 838 /*if ( (signed int)result < 40 ) |
839 { | |
840 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit; | |
841 }*/ | |
842 pMessageQueue_50CBD0->AddMessage(UIMSG_Quit, 1, 0); | |
0 | 843 } |
844 else | |
845 { | |
437 | 846 pMessageQueue_50CBD0->AddMessage(UIMSG_ShowFinalWindow, 1, 0); |
847 /*if ( (signed int)result < 40 ) | |
848 { | |
849 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5; | |
0 | 850 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
851 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
852 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; | |
853 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 854 }*/ |
0 | 855 } |
856 bGameoverLoop = 0; | |
857 return result; | |
858 } | |
859 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1359
diff
changeset
|
860 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1359
diff
changeset
|
861 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1359
diff
changeset
|
862 |
0 | 863 //----- (00451007) -------------------------------------------------------- |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
864 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 | 865 unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch, |
866 int a10, int a11) | |
867 { | |
868 int result; // eax@1 | |
869 float v17; // ST3C_4@12 | |
870 float v18; // ST38_4@12 | |
871 unsigned int v19; // esi@12 | |
872 int v21; // eax@18 | |
873 unsigned int v22; // ecx@25 | |
874 unsigned int v23; // eax@29 | |
1146
b4ade2580ae3
sub_451007_scale_image_bicubic cleanup - some variable renaming, code shuffling
Grumpy7
parents:
1145
diff
changeset
|
875 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
|
876 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
|
877 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
|
878 unsigned int widthRatioPlusOne; // [sp+14h] [bp-74h]@218 |
0 | 879 int v160; // [sp+3Ch] [bp-4Ch]@13 |
880 unsigned __int16 *v175; // [sp+4Ch] [bp-3Ch]@13 | |
881 unsigned __int16 *v193; // [sp+5Ch] [bp-2Ch]@7 | |
882 signed int v231; // [sp+78h] [bp-10h]@7 | |
883 __int64 v240; // [sp+7Ch] [bp-Ch]@12 | |
884 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
|
885 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
|
886 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
|
887 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
|
888 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
|
889 int field_0_bits; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
890 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
|
891 |
1146
b4ade2580ae3
sub_451007_scale_image_bicubic cleanup - some variable renaming, code shuffling
Grumpy7
parents:
1145
diff
changeset
|
892 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
|
893 switch(field0value) |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
894 { |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
895 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
|
896 break; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
897 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
|
898 break; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
899 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
|
900 break; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
901 default: |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
902 return field0value; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
903 } |
1144
f544cd6f7168
sub_451007_scale_image_bicubic cleanup - preparations for further condition body extractions
Grumpy7
parents:
1140
diff
changeset
|
904 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
|
905 switch(field20value) |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
906 { |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
907 case 8: field_20_bits = 1; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
908 break; |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
909 case 16: field_20_bits = 2; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
910 break; |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
911 case 32: field_20_bits = 4; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
912 break; |
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
913 default: |
1144
f544cd6f7168
sub_451007_scale_image_bicubic cleanup - preparations for further condition body extractions
Grumpy7
parents:
1140
diff
changeset
|
914 return field20value; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
915 } |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
916 |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
917 result = (int)pDst; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
918 v193 = pDst; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
919 v231 = 0; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
920 if ( dstHeight <= 0 ) |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
921 return result; |
1600
0016b08ab621
stru350::sub_451007_scale_image_bicubic - fixing a memory access bug
Grumpy7
parents:
1546
diff
changeset
|
922 |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
923 do |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
924 { |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
925 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
|
926 { |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
927 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
|
928 widthRatio = bankersRounding(a6s); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
929 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
|
930 widthRatioPlusOne = bankersRounding(a6t); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
931 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
|
932 heightRatio = bankersRounding(v17); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
933 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
|
934 heightRatioPlusOne = bankersRounding(v18); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
935 v251 = 0; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
936 v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
937 v252 = 0; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
938 a6b = 0; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
939 v240 = 0i64; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
940 |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
941 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
|
942 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
|
943 { |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
944 int ratioDiff = widthRatioPlusOne - widthRatio; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
945 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
|
946 { |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
947 if(field0value == 32) |
1600
0016b08ab621
stru350::sub_451007_scale_image_bicubic - fixing a memory access bug
Grumpy7
parents:
1546
diff
changeset
|
948 v21 = _450FB1(((int*)v175)[i]); |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
949 else if(field0value == 16) |
1600
0016b08ab621
stru350::sub_451007_scale_image_bicubic - fixing a memory access bug
Grumpy7
parents:
1546
diff
changeset
|
950 v21 = _450FB1(((_WORD*)v175)[i]); |
1901 | 951 else if (field0value == 8) |
1600
0016b08ab621
stru350::sub_451007_scale_image_bicubic - fixing a memory access bug
Grumpy7
parents:
1546
diff
changeset
|
952 v21 = _450FB1(((unsigned __int8*)v175)[i]); |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
953 v240 += ((unsigned int)v21 >> 24); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
954 a6b += BYTE2(v21); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
955 v252 += BYTE1(v21); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
956 v251 += (unsigned __int8)v21; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
957 } |
1901 | 958 if (field0value == 32) |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
959 v175 += 2 * srcPitch; |
1901 | 960 else if (field0value == 16) |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
961 v175 += srcPitch; |
1901 | 962 else if (field0value == 8) |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
963 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
|
964 } |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
965 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
|
966 if ( v19 ) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
967 { |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
968 a6b /= v19; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
969 v252 /= v19; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
970 v251 /= v19; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
971 } |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
972 if ( v22 != 255 ) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
973 v22 &= 0x7FFFFFFFu; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
974 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
|
975 *(_DWORD *)v193 = v23; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
976 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
|
977 } |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
978 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
|
979 ++v231; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
980 result = v231; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
981 } |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
982 while(v231 < dstHeight); |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
983 return result; |
0 | 984 } |
985 | |
986 //----- (0044F57C) -------------------------------------------------------- | |
987 void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5) | |
988 { | |
989 //MapInfo *v5; // esi@1 | |
990 //SpawnPointMM7 *v6; // ebx@1 | |
991 int v7; // eax@2 | |
992 char v8; // zf@5 | |
993 int v9; // edi@9 | |
994 int v10; // eax@9 | |
995 int v11; // ecx@9 | |
996 int v12; // edx@9 | |
997 int v13; // eax@9 | |
998 int v14; // eax@14 | |
999 int v15; // ecx@14 | |
1000 int v16; // eax@19 | |
1001 int v17; // ecx@19 | |
1002 int v18; // esi@31 | |
1003 //int pPosX; // ecx@32 | |
1004 //int v20; // edx@32 | |
1005 //int v21; // eax@32 | |
1006 Actor *pMonster; // esi@35 | |
1007 int v23; // edx@36 | |
1008 signed int v24; // edi@36 | |
1009 int v25; // ecx@36 | |
1010 unsigned __int16 v26; // ax@47 | |
1011 MonsterDesc *v27; // edi@48 | |
1012 signed int v28; // eax@48 | |
1013 __int16 v29; // cx@50 | |
1014 __int16 v30; // ax@50 | |
1015 __int16 v31; // ax@50 | |
1016 int v32; // eax@50 | |
1017 int v33; // edi@50 | |
1018 int v34; // eax@50 | |
1019 int v35; // eax@50 | |
1020 int v36; // eax@50 | |
1021 int v37; // eax@51 | |
1022 int v38; // eax@52 | |
1023 int v39; // edi@52 | |
1024 std::string v40; // [sp-18h] [bp-100h]@60 | |
1025 void *v41; // [sp-14h] [bp-FCh]@50 | |
1026 //void *v42; // [sp-10h] [bp-F8h]@50 | |
1027 //size_t v43; // [sp-Ch] [bp-F4h]@50 | |
1028 const char *v44; // [sp-8h] [bp-F0h]@13 | |
1029 char *pTexture; // [sp-4h] [bp-ECh]@9 | |
1030 char Str[32]; // [sp+Ch] [bp-DCh]@60 | |
1031 char Str2[120]; // [sp+2Ch] [bp-BCh]@29 | |
1032 unsigned int uFaceID; // [sp+A4h] [bp-44h]@52 | |
1033 MonsterInfo *Src; // [sp+A8h] [bp-40h]@50 | |
1034 int v50; // [sp+ACh] [bp-3Ch]@47 | |
1035 char Source[32]; // [sp+B0h] [bp-38h]@20 | |
1036 int v52; // [sp+D0h] [bp-18h]@34 | |
1037 int v53; // [sp+D4h] [bp-14h]@34 | |
1038 int pSector; // [sp+D8h] [bp-10h]@32 | |
1039 int pPosX; // [sp+DCh] [bp-Ch]@32 | |
1040 int v56; // [sp+E0h] [bp-8h]@8 | |
1041 int v57; // [sp+E4h] [bp-4h]@1 | |
1042 | |
1043 //auto a2 = spawn; | |
1044 v57 = 0; | |
1045 //v5 = pMapInfo; | |
1046 //v6 = spawn; | |
1047 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
1048 v7 = pOutdoor->ddm.field_C_alert; | |
1049 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
1050 v7 = pIndoor->dlv.field_C_alert; | |
1051 else | |
1052 v7 = 0; | |
1053 if (v7) | |
1054 v8 = (spawn->uAttributes & 1) == 0; | |
1055 else | |
1056 v8 = (spawn->uAttributes & 1) == 1; | |
1057 if (v8) | |
1058 return; | |
1059 //result = (void *)(spawn->uIndex - 1); | |
1060 v56 = 1; | |
1061 switch (spawn->uIndex - 1) | |
1062 { | |
2173 | 1063 case 0: |
1064 //v9 = pMapInfo->uEncounterMonster1AtLeast; | |
1065 //v10 = rand(); | |
1066 //v11 = pMapInfo->uEncounterMonster1AtMost; | |
1067 //pTexture = pMapInfo->pEncounterMonster1Texture; | |
1068 v12 = rand() % (pMapInfo->uEncounterMonster1AtMost - pMapInfo->uEncounterMonster1AtLeast + 1); | |
1069 //v13 = pMapInfo->Dif_M1; | |
1070 v57 = pMapInfo->Dif_M1; | |
1071 v56 = pMapInfo->uEncounterMonster1AtLeast + v12; | |
1072 strcpy(Source, pMapInfo->pEncounterMonster1Texture); | |
1416 | 1073 break; |
2173 | 1074 case 3: |
1075 //pTexture = pMapInfo->pEncounterMonster1Texture; | |
1076 //v44 = "%s A"; | |
1077 sprintf(Source, "%s A", pMapInfo->pEncounterMonster1Texture); | |
1416 | 1078 break; |
2173 | 1079 case 4: |
1080 //pTexture = pMapInfo->pEncounterMonster2Texture; | |
1081 //v44 = "%s A"; | |
1082 sprintf(Source, "%s A", pMapInfo->pEncounterMonster2Texture); | |
1416 | 1083 break; |
2173 | 1084 case 5: |
1085 //pTexture = pMapInfo->pEncounterMonster3Texture; | |
1086 //v44 = "%s A"; | |
1087 sprintf(Source, "%s A", pMapInfo->pEncounterMonster3Texture); | |
1416 | 1088 break; |
2173 | 1089 case 1: |
1090 //v9 = pMapInfo->uEncounterMonster2AtLeast; | |
1091 //v14 = rand(); | |
1092 //v15 = pMapInfo->uEncounterMonster2AtMost; | |
1093 //pTexture = pMapInfo->pEncounterMonster2Texture; | |
1094 v12 = rand() % (pMapInfo->uEncounterMonster2AtMost - pMapInfo->uEncounterMonster2AtLeast + 1); | |
1095 //v13 = pMapInfo->Dif_M2; | |
1096 v57 = pMapInfo->Dif_M2; | |
1097 v56 = pMapInfo->uEncounterMonster2AtLeast + v12; | |
1098 strcpy(Source, pMapInfo->pEncounterMonster2Texture); | |
1416 | 1099 break; |
2173 | 1100 case 6: |
1101 //pTexture = pMapInfo->pEncounterMonster1Texture; | |
1102 //v44 = "%s B"; | |
1103 sprintf(Source, "%s B", pMapInfo->pEncounterMonster1Texture); | |
1416 | 1104 break; |
2173 | 1105 case 7: |
1106 //pTexture = pMapInfo->pEncounterMonster2Texture; | |
1107 //v44 = "%s B"; | |
1108 sprintf(Source, "%s B", pMapInfo->pEncounterMonster2Texture); | |
1416 | 1109 break; |
2173 | 1110 case 8: |
1111 //pTexture = pMapInfo->pEncounterMonster3Texture; | |
1112 //v44 = "%s B"; | |
1113 sprintf(Source, "%s B", pMapInfo->pEncounterMonster3Texture); | |
1416 | 1114 break; |
2173 | 1115 case 2: |
1116 //v9 = pMapInfo->uEncounterMonster3AtLeast; | |
1117 //v16 = rand(); | |
1118 //v17 = pMapInfo->uEncounterMonster3AtMost; | |
1119 //pTexture = pMapInfo->pEncounterMonster3Texture; | |
1120 v12 = rand() % (pMapInfo->uEncounterMonster3AtMost - pMapInfo->uEncounterMonster3AtLeast + 1); | |
1121 //v13 = pMapInfo->Dif_M3; | |
1122 v57 = pMapInfo->Dif_M3; | |
1123 v56 = pMapInfo->uEncounterMonster3AtLeast + v12; | |
1124 strcpy(Source, pMapInfo->pEncounterMonster3Texture); | |
1416 | 1125 break; |
2173 | 1126 case 9: |
1127 //pTexture = pMapInfo->pEncounterMonster1Texture; | |
1128 //v44 = "%s C"; | |
1129 sprintf(Source, "%s C", pMapInfo->pEncounterMonster1Texture); | |
1416 | 1130 break; |
2173 | 1131 case 10: |
1132 //pTexture = pMapInfo->pEncounterMonster2Texture; | |
1133 //v44 = "%s C"; | |
1134 sprintf(Source, "%s C", pMapInfo->pEncounterMonster2Texture); | |
1416 | 1135 break; |
2173 | 1136 case 11: |
1137 //pTexture = pMapInfo->pEncounterMonster3Texture; | |
1138 //v44 = "%s C"; | |
1139 sprintf(Source, "%s C", pMapInfo->pEncounterMonster3Texture); | |
0 | 1140 break; |
2173 | 1141 default: |
0 | 1142 return; |
1143 } | |
2173 | 1144 if (Source[0] == '0') |
1145 return; | |
1146 v57 += a3; | |
1147 if ( v57 > 4 ) | |
1148 v57 = 4; | |
1149 strcpy(Str2, Source); | |
1150 if ( a4 ) | |
1151 v56 = a4; | |
1152 v18 = v56; | |
1153 if ( (signed int)(v56 + uNumActors) >= 500 ) | |
1154 return; | |
1155 pSector = 0; | |
1156 pPosX = spawn->vPosition.x; | |
1157 a4 = spawn->vPosition.y; | |
1158 a3 = spawn->vPosition.z; | |
1159 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
1160 pSector = pIndoor->GetSector(spawn->vPosition.x, spawn->vPosition.y, spawn->vPosition.z); | |
1161 v53 = 0; | |
1162 v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; | |
1163 if ( v18 <= 0 ) | |
1164 return; | |
0 | 1165 for (uint i = v53; i < v56; ++i) |
1166 { | |
1167 pMonster = &pActors[uNumActors]; | |
1168 pActors[uNumActors].Reset(); | |
1169 if ( v57 ) | |
1170 { | |
1171 v23 = rand() % 100; | |
1172 v24 = 3; | |
1173 v25 = (unsigned __int16)word_4E8152[3 * v57]; | |
1174 if ( v23 >= v25 ) | |
1175 { | |
1176 if ( v23 < v25 + (unsigned __int16)word_4E8152[3 * v57 + 1] ) | |
1177 v24 = 2; | |
1178 } | |
1179 else | |
1180 { | |
1181 v24 = 1; | |
1182 } | |
1183 if ( v24 == 1 ) | |
1184 { | |
1185 pTexture = Source; | |
1186 v44 = "%s A"; | |
1187 } | |
1188 else | |
1189 { | |
1190 if ( v24 == 2 ) | |
1191 { | |
1192 pTexture = Source; | |
1193 v44 = "%s B"; | |
1194 } | |
1195 else | |
1196 { | |
1197 if ( v24 != 3 ) | |
1416 | 1198 continue; |
0 | 1199 pTexture = Source; |
1200 v44 = "%s C"; | |
1201 } | |
1202 } | |
1203 sprintf(Str2, v44, pTexture); | |
1204 } | |
751 | 1205 v50 = pMonsterList->GetMonsterIDByName(Str2); |
0 | 1206 pTexture = Str2; |
751 | 1207 if ( (signed __int16)v50 == -1 ) |
0 | 1208 { |
1209 sprintf(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", pTexture); | |
1210 MessageBoxA(nullptr, Str, nullptr, 0); | |
1211 ExitProcess(0); | |
1212 } | |
751 | 1213 v27 = &pMonsterList->pMonsters[(signed __int16)v50]; |
1214 v28 = pMonsterStats->FindMonsterByTextureName(pTexture); | |
0 | 1215 if ( !v28 ) |
1216 v28 = 1; | |
1217 Src = &pMonsterStats->pInfos[v28]; | |
1218 strcpy(pMonster->pActorName, Src->pName); | |
1219 pMonster->sCurrentHP = Src->uHP; | |
1220 assert(sizeof(MonsterInfo) == 88); | |
1221 memcpy(&pMonster->pMonsterInfo, Src, sizeof(MonsterInfo)); | |
1222 pMonster->word_000086_some_monster_id = v50 + 1; | |
1223 pMonster->uActorRadius = v27->uMonsterRadius; | |
1224 pMonster->uActorHeight = v27->uMonsterHeight; | |
1225 pMonster->uMovementSpeed = v27->uMovementSpeed; | |
1226 pMonster->vInitialPosition.x = spawn->vPosition.x; | |
1227 pMonster->vPosition.x = spawn->vPosition.x; | |
1228 pMonster->uTetherDistance = 256; | |
1229 pMonster->vInitialPosition.y = a4; | |
1230 pMonster->vPosition.y = a4; | |
1231 pTexture = 0; | |
1232 pMonster->vInitialPosition.z = a3; | |
1233 pMonster->vPosition.z = a3; | |
1234 pMonster->uSectorID = pSector; | |
1235 pMonster->uGroup = spawn->uGroup; | |
1236 pMonster->PrepareSprites((char)pTexture); | |
1237 pMonster->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
1238 v32 = rand(); | |
2173 | 1239 a3 = fixpoint_mul(stru_5C6E00->Cos(v32 % 2048), v52); |
0 | 1240 pPosX = a3 + spawn->vPosition.x; |
2173 | 1241 a3 = fixpoint_mul(stru_5C6E00->Sin(v32 % 2048), v52); |
0 | 1242 a4 = a3 + spawn->vPosition.y; |
1243 a3 = spawn->vPosition.z; | |
1244 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
1416 | 1245 { |
1246 if ( a5 ) | |
1247 pMonster->uAttributes |= 0x080000; | |
1248 ++uNumActors; | |
1249 continue; | |
1250 } | |
2173 | 1251 v37 = pIndoor->GetSector(pPosX, a4, spawn->vPosition.z); |
0 | 1252 if ( v37 == pSector ) |
1253 { | |
723 | 1254 v38 = BLV_GetFloorLevel(pPosX, a4, a3, v37, &uFaceID); |
0 | 1255 v39 = v38; |
1256 if ( v38 != -30000 ) | |
1257 { | |
1258 if ( abs(v38 - a3) <= 1024 ) | |
1259 { | |
1260 a3 = v39; | |
1261 if ( a5 ) | |
1262 pMonster->uAttributes |= 0x080000; | |
1263 ++uNumActors; | |
1416 | 1264 continue; |
0 | 1265 } |
1266 } | |
1267 } | |
1268 ; | |
1269 //v53 = (char *)v53 + 1; | |
1270 //result = v53; | |
1271 } | |
1272 //while ( (signed int)v53 < v56 ); | |
1273 } | |
1274 | |
1275 //----- (0044FA4C) -------------------------------------------------------- | |
1276 signed int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3) | |
1277 { | |
1278 signed int v3; // ecx@6 | |
90 | 1279 Actor *v4; // edx@7 |
0 | 1280 signed int result; // eax@13 |
1281 Actor *v6; // esi@16 | |
1282 char *v7; // ebx@16 | |
1283 MonsterDesc *v8; // edi@16 | |
1284 unsigned __int16 v9; // ax@16 | |
1285 int v10; // ebx@16 | |
1052 | 1286 //int v11; // edi@16 |
1287 //int v12; // eax@16 | |
1288 //int v13; // ecx@16 | |
1289 //int v14; // ebx@16 | |
0 | 1290 const char *v15; // [sp-4h] [bp-24h]@2 |
1052 | 1291 //unsigned __int16 v16; // [sp+0h] [bp-20h]@1 |
1292 //int v17; // [sp+4h] [bp-1Ch]@1 | |
0 | 1293 unsigned int uFaceID; // [sp+8h] [bp-18h]@16 |
1294 int v19; // [sp+Ch] [bp-14h]@16 | |
1295 size_t v20; // [sp+10h] [bp-10h]@6 | |
1296 int v21; // [sp+14h] [bp-Ch]@14 | |
1052 | 1297 //int v22; // [sp+18h] [bp-8h]@14 |
0 | 1298 unsigned int v23; // [sp+1Ch] [bp-4h]@6 |
1299 | |
1052 | 1300 //v16 = a2; |
1301 //v17 = a1; | |
0 | 1302 if ( a2 == 4 ) |
1303 { | |
1304 v15 = "Elemental Light C"; | |
1305 } | |
1052 | 1306 else if ( a2 == 3 ) |
0 | 1307 v15 = "Elemental Light B"; |
1308 else | |
1309 v15 = "Elemental Light A"; | |
1052 | 1310 |
751 | 1311 v23 = pMonsterList->GetMonsterIDByName(v15); |
0 | 1312 v3 = 0; |
1313 v20 = uNumActors; | |
1314 if ( (signed int)uNumActors > 0 ) | |
1315 { | |
1202 | 1316 v4 = pActors.data();//[0].uAIState; |
90 | 1317 while ( v4->uAIState != Removed ) |
0 | 1318 { |
1052 | 1319 ++v3; |
90 | 1320 ++v4; |
0 | 1321 if ( v3 >= (signed int)uNumActors ) |
90 | 1322 break; |
1323 } | |
1324 if( v3 < (signed int)uNumActors ) | |
1325 v20 = v3; | |
1326 } | |
0 | 1327 if ( v20 != uNumActors || (result = uNumActors + 1, (signed int)(uNumActors + 1) < 500) ) |
1328 { | |
1329 v21 = 0; | |
1052 | 1330 //v22 = pParty->vPosition.z; |
0 | 1331 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
1332 v21 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
1333 v6 = &pActors[v20]; | |
1334 v7 = (char *)&pMonsterStats->pInfos[v23 + 1]; | |
1335 v19 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; | |
1336 v6->Reset(); | |
1337 v8 = &pMonsterList->pMonsters[v23]; | |
1338 strcpy(v6->pActorName, *(const char **)v7); | |
1339 v6->sCurrentHP = *((short *)v7 + 32); | |
1340 memcpy(&v6->pMonsterInfo, v7, 0x58u); | |
1341 v6->word_000086_some_monster_id = v23 + 1; | |
1342 v6->uActorRadius = v8->uMonsterRadius; | |
1343 v6->uActorHeight = v8->uMonsterHeight; | |
1344 v9 = v8->uMovementSpeed; | |
1345 v6->pMonsterInfo.uTreasureDiceRolls = 0; | |
1346 v6->pMonsterInfo.uTreasureType = 0; | |
1347 v6->pMonsterInfo.uExp = 0; | |
1348 v6->uMovementSpeed = v9; | |
1349 v10 = rand() % 2048; | |
1643 | 1350 //v11 = pParty->vPosition.x + fixpoint_mul(stru_5C6E00->Cos(v10), v19); |
323 | 1351 uFaceID = stru_5C6E00->Sin(v10); |
1052 | 1352 //v12 = pParty->vPosition.y; |
1643 | 1353 //v13 = fixpoint_mul(uFaceID, v19); |
1354 //v14 = pParty->vPosition.y + fixpoint_mul(uFaceID, v19); | |
1052 | 1355 //LOWORD(v12) = v22; |
1643 | 1356 v6->vInitialPosition.x = pParty->vPosition.x + fixpoint_mul(stru_5C6E00->Cos(v10), v19); |
1052 | 1357 v6->vPosition.x = v6->vInitialPosition.x; |
1643 | 1358 v6->vInitialPosition.y = pParty->vPosition.y + fixpoint_mul(uFaceID, v19); |
1052 | 1359 v6->vPosition.y = v6->vInitialPosition.y; |
1360 v6->vInitialPosition.z = pParty->vPosition.z; | |
1361 v6->vPosition.z = v6->vInitialPosition.z; | |
1362 //LOWORD(v12) = v21; | |
0 | 1363 v6->uTetherDistance = 256; |
1052 | 1364 v6->uSectorID = v21; |
0 | 1365 v6->PrepareSprites(0); |
1366 v6->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
1367 v6->uAlly = 9999; | |
1368 v6->uGroup = 0; | |
1369 v6->uCurrentActionTime = 0; | |
1370 v6->uAIState = Summoned; | |
1371 v6->uCurrentActionLength = 256; | |
1372 v6->UpdateAnimation(); | |
1373 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor | |
1052 | 1374 || (result = pIndoor->GetSector(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z), |
0 | 1375 result == v21) |
1052 | 1376 && (result = BLV_GetFloorLevel(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z, result, &uFaceID), result != -30000) |
1377 && (result = abs(result - pParty->vPosition.z), result <= 1024) ) | |
0 | 1378 { |
1379 if ( v20 == uNumActors ) | |
1380 ++uNumActors; | |
1052 | 1381 v6->uSummonerID = PID(OBJECT_Player, a1); |
1948
7fd4bfa175fd
pActorBuffs[2] to pActorBuffs[ACTOR_BUFF_SUMMONED]
Grumpy7
parents:
1935
diff
changeset
|
1382 result = v6->pActorBuffs[ACTOR_BUFF_SUMMONED].Apply(pParty->uTimePlayed + (a3 * 128) / 30.0f, |
1052 | 1383 a2, |
1384 a1, | |
0 | 1385 0, |
1386 0); | |
1387 } | |
1388 } | |
1389 return result; | |
1390 } | |
1391 | |
1392 //----- (0044FFD8) -------------------------------------------------------- | |
1393 int MapInfo::SpawnRandomTreasure(SpawnPointMM7 *a2) | |
1394 { | |
472 | 1395 //MapInfo *v2; // ebx@1 |
1396 //SpawnPointMM7 *v3; // esi@1 | |
1397 //int v4; // eax@1 | |
0 | 1398 int v5; // edx@1 |
1399 int v6; // eax@1 | |
1400 int v7; // ecx@1 | |
1401 int v8; // ebx@1 | |
1402 int v9; // eax@1 | |
1403 signed int v10; // ebx@1 | |
1404 signed int result; // eax@1 | |
1405 signed __int64 v12; // qtt@1 | |
1406 int v13; // ebx@1 | |
1407 int v14; // edx@10 | |
1408 signed int v15; // ebx@20 | |
1409 unsigned __int16 v16; // dx@20 | |
1417 | 1410 ObjectDesc *v17; // ecx@21 |
0 | 1411 unsigned __int16 v18; // ax@24 |
1412 int v19; // ST0C_4@27 | |
1413 int v20; // ST08_4@27 | |
1414 int v21; // ST04_4@27 | |
1415 int v22; // eax@27 | |
1416 signed int v23; // ebx@29 | |
1417 unsigned __int16 v24; // dx@29 | |
1417 | 1418 ObjectDesc *v25; // ecx@30 |
0 | 1419 unsigned __int16 v26; // ax@33 |
472 | 1420 //int v27; // ecx@35 |
1421 //int v28; // eax@35 | |
1422 //int v29; // esi@35 | |
1423 //__int16 v30; // ax@35 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
1424 SpriteObject a1a; // [sp+Ch] [bp-7Ch]@1 |
472 | 1425 //int v32; // [sp+7Ch] [bp-Ch]@1 |
1426 //int v33; // [sp+80h] [bp-8h]@1 | |
0 | 1427 int v34; // [sp+84h] [bp-4h]@1 |
1428 | |
472 | 1429 //auto a1 = this; |
1430 //v2 = a1; | |
1431 //v3 = a2; | |
1432 //v4 = rand(); | |
0 | 1433 v34 = 0; |
472 | 1434 v5 = rand() % 100; |
436 | 1435 // v6 = 2 * (v2->Treasure_prob + 7 * v3->uIndex) - 14; |
472 | 1436 v7 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob]; |
1437 v8 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob + 1]; | |
1438 //v32 = v5; | |
1439 //v33 = v7; | |
0 | 1440 v9 = rand(); |
472 | 1441 v10 = v8 - v7 + 1; |
0 | 1442 v12 = v9; |
1443 result = v9 / v10; | |
472 | 1444 v13 = v7 + (unsigned __int64)(v12 % v10); |
0 | 1445 if ( v13 < 7 ) |
1446 { | |
472 | 1447 if ( v5 < 20 ) |
0 | 1448 return result; |
472 | 1449 if ( v5 >= 60 ) |
1450 { | |
1451 v19 = a2->vPosition.z; | |
1452 v20 = a2->vPosition.y; | |
1453 v21 = a2->vPosition.x; | |
0 | 1454 v22 = rand(); |
1455 return sub_450521_ProllyDropItemAt(v13, v22 % 27 + 20, v21, v20, v19, 0); | |
1456 } | |
472 | 1457 if ( a2->uIndex == 1 ) |
0 | 1458 { |
1459 v14 = rand() % 51 + 50; | |
1417 | 1460 a1a.stru_24.uItemID = 197; |
1461 v34 = v14; | |
1462 } | |
1463 else if ( a2->uIndex == 2 ) | |
0 | 1464 { |
1417 | 1465 v14 = rand() % 101 + 100; |
1466 a1a.stru_24.uItemID = 197; | |
1467 v34 = v14; | |
1468 } | |
1469 else if ( a2->uIndex == 3 ) | |
0 | 1470 { |
1471 v14 = rand() % 301 + 200; | |
1417 | 1472 a1a.stru_24.uItemID = 198; |
1473 v34 = v14; | |
0 | 1474 } |
1417 | 1475 else if ( a2->uIndex == 4 ) |
0 | 1476 { |
1417 | 1477 v14 = rand() % 501 + 500; |
1478 a1a.stru_24.uItemID = 198; | |
1479 v34 = v14; | |
1480 } | |
1481 else if ( a2->uIndex == 5 ) | |
1482 { | |
1483 v14 = rand() % 1001 + 1000; | |
0 | 1484 a1a.stru_24.uItemID = 199; |
1485 v34 = v14; | |
1486 } | |
1417 | 1487 else if ( a2->uIndex == 6 ) |
1488 { | |
1489 v14 = rand() % 3001 + 2000; | |
1490 a1a.stru_24.uItemID = 199; | |
1491 v34 = v14; | |
1492 } | |
1493 v15 = 0; | |
1494 v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; | |
1495 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; | |
1496 v18 = 0; | |
1497 for( int i = 0; i < pObjectList->uNumObjects; i++ ) | |
1498 { | |
1499 if ( pObjectList->pObjects[i].uObjectID == v16 ) | |
1500 { | |
1501 v18 = i; | |
1502 break; | |
1503 } | |
1504 } | |
1505 a1a.stru_24.SetIdentified(); | |
1506 a1a.uObjectDescID = v18; | |
1507 a1a.stru_24.uSpecEnchantmentType = v34; | |
0 | 1508 } |
1509 else | |
1510 { | |
1417 | 1511 result = a1a.stru_24.GenerateArtifact(); |
1512 if ( !result ) | |
1513 return result; | |
1514 v23 = 0; | |
1515 v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; | |
1516 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; | |
1517 v26 = 0; | |
1518 for( int i = 0; i < pObjectList->uNumObjects; i++ ) | |
1519 { | |
1520 if( v24 == pObjectList->pObjects[i].uObjectID ) | |
1521 { | |
1522 v26 = i; | |
1523 break; | |
1524 } | |
1525 } | |
1526 a1a.uObjectDescID = v26; | |
1527 a1a.stru_24.Reset(); | |
1528 } | |
472 | 1529 a1a.vPosition.y = a2->vPosition.y; |
0 | 1530 a1a.uAttributes = 0; |
1531 a1a.uSoundID = 0; | |
1532 a1a.uFacing = 0; | |
472 | 1533 a1a.vPosition.z = a2->vPosition.z; |
1534 a1a.vPosition.x = a2->vPosition.x; | |
822 | 1535 a1a.spell_skill = 0; |
1536 a1a.spell_level = 0; | |
1537 a1a.spell_id = 0; | |
823 | 1538 a1a.spell_target_pid = 0; |
822 | 1539 a1a.spell_caster_pid = 0; |
0 | 1540 a1a.uSpriteFrameID = 0; |
472 | 1541 a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);; |
0 | 1542 return a1a.Create(0, 0, 0, 0); |
1543 } | |
1544 | |
1545 //----- (00450521) -------------------------------------------------------- | |
1459 | 1546 int __fastcall sub_450521_ProllyDropItemAt(int ecx0, signed int a2, int a3, int a4, int a5, unsigned __int16 a6) |
0 | 1547 { |
1548 int v6; // edi@1 | |
1549 int v7; // esi@1 | |
1550 signed int v8; // edi@1 | |
1551 unsigned __int16 v9; // cx@1 | |
1552 char *v10; // edx@2 | |
1553 unsigned __int16 v11; // ax@5 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
1554 SpriteObject a1; // [sp+8h] [bp-70h]@1 |
0 | 1555 |
1556 v6 = ecx0; | |
1557 v7 = a2; | |
1558 pItemsTable->GenerateItem(v6, v7, &a1.stru_24); | |
1559 v8 = 0; | |
1560 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
|
1561 a1.uType = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; |
1417 | 1562 v11 = 0; |
1563 for( int i = 0; i < pObjectList->uNumObjects; i++ ) | |
1564 { | |
1565 if( v9 == pObjectList->pObjects[i].uObjectID ) | |
1566 { | |
1567 v11 = i; | |
1568 break; | |
1569 } | |
1570 } | |
0 | 1571 a1.uObjectDescID = v11; |
1572 a1.vPosition.y = a4; | |
1573 a1.vPosition.x = a3; | |
1574 a1.vPosition.z = a5; | |
1575 a1.uFacing = a6; | |
1576 a1.uAttributes = 0; | |
1577 a1.uSectorID = pIndoor->GetSector(a3, a4, a5); | |
1578 a1.uSpriteFrameID = 0; | |
1579 return a1.Create(0, 0, 0, 0); | |
1580 } | |
1581 | |
1582 //----- (0045063B) -------------------------------------------------------- | |
1415 | 1583 int __fastcall _45063B_spawn_some_monster(MapInfo *a1, int a2) |
0 | 1584 { |
1585 signed int v2; // edi@1 | |
1586 Actor *v3; // esi@2 | |
1415 | 1587 //signed __int64 v4; // qax@3 |
0 | 1588 int result; // eax@8 |
1589 int v6; // edi@11 | |
1590 int v7; // ebx@11 | |
1591 int v8; // edi@11 | |
1592 int v9; // ebx@12 | |
1593 int v10; // eax@12 | |
1594 char v11; // zf@16 | |
1595 int v12; // edi@20 | |
1596 int v13; // eax@20 | |
1597 int v14; // ebx@20 | |
1598 int v15; // eax@20 | |
1599 int v16; // eax@20 | |
1600 int v17; // eax@20 | |
1601 int v18; // eax@21 | |
1602 SpawnPointMM7 v19; // [sp+Ch] [bp-38h]@1 | |
1603 int v20; // [sp+24h] [bp-20h]@11 | |
1415 | 1604 //MapInfo *v21; // [sp+28h] [bp-1Ch]@1 |
0 | 1605 int v22; // [sp+2Ch] [bp-18h]@3 |
1606 int v23; // [sp+30h] [bp-14h]@11 | |
1415 | 1607 //int v24; // [sp+34h] [bp-10h]@1 |
0 | 1608 unsigned int uFaceID; // [sp+38h] [bp-Ch]@10 |
1609 int v26; // [sp+3Ch] [bp-8h]@11 | |
1610 int v27; // [sp+40h] [bp-4h]@11 | |
1415 | 1611 |
1612 if (!uNumActors) | |
1613 return 0; | |
1614 | |
1615 //v21 = a1; | |
1616 //v24 = a2; | |
0 | 1617 v2 = 0; |
1202 | 1618 v3 = pActors.data(); |
0 | 1619 while ( 1 ) |
1620 { | |
1415 | 1621 if (v3->pMonsterInfo.uID >= 121 && v3->pMonsterInfo.uID <= 123 || // Dwarf FemaleC A-C |
1622 v3->pMonsterInfo.uID >= 124 && v3->pMonsterInfo.uID <= 126 || // Dwarf MaleA A-C | |
1623 v3->pMonsterInfo.uID >= 133 && v3->pMonsterInfo.uID <= 135 || // Peasant Elf FemaleA A-C | |
1624 !v3->CanAct()) | |
0 | 1625 { |
1415 | 1626 ++v2; |
1627 ++v3; | |
1628 | |
1629 if (v2 >= uNumActors) | |
1630 return 0; | |
1631 | |
1632 continue; | |
0 | 1633 } |
1415 | 1634 |
1635 break; | |
1636 //v22 = v3->pMonsterInfo.uID - 1; | |
1637 //v4 = (signed __int64)((double)v22 * 0.3333333333333333); | |
1638 //if ( (int)v4 != 40 ) | |
1639 //{ | |
1640 // if ( (int)v4 != 41 && (int)v4 != 44 && v3->CanAct() ) | |
1641 // break; | |
1642 //} | |
1643 //++v2; | |
1644 //++v3; | |
1645 //if ( v2 >= (signed int)uNumActors ) | |
1646 // goto LABEL_8; | |
0 | 1647 } |
1648 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
1649 { | |
1650 v22 = 0; | |
1651 uFaceID = 0; | |
1652 while ( 1 ) | |
1653 { | |
1654 ++uFaceID; | |
1655 v6 = rand() % 1024 + 512; | |
1656 v7 = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | |
323 | 1657 v20 = stru_5C6E00->Cos(v7); |
0 | 1658 v23 = (unsigned __int64)(v20 * (signed __int64)v6) >> 16; |
1659 v19.vPosition.x = pParty->vPosition.x + v23; | |
323 | 1660 v20 = stru_5C6E00->Sin(v7); |
0 | 1661 v23 = (unsigned __int64)(v20 * (signed __int64)v6) >> 16; |
1662 v8 = 0; | |
1415 | 1663 v19.uIndex = a2; |
0 | 1664 v19.vPosition.y = v23 + pParty->vPosition.y; |
1665 v19.vPosition.z = pParty->vPosition.z; | |
1666 v26 = 0; | |
1667 v27 = 0; | |
723 | 1668 v19.vPosition.z = ODM_GetFloorLevel( |
0 | 1669 v19.vPosition.x, |
1670 v23 + pParty->vPosition.y, | |
1671 pParty->vPosition.z, | |
1672 0, | |
1673 &v26, | |
1674 &v27, | |
1675 0); | |
1676 v23 = 0; | |
1416 | 1677 for( int i = 0; i < pOutdoor->uNumBModels; i++ ) |
1678 { | |
1679 v9 = abs(v19.vPosition.y - pOutdoor->pBModels[i].vBoundingCenter.y); | |
1680 v10 = abs(v19.vPosition.x - pOutdoor->pBModels[i].vBoundingCenter.x); | |
1681 if ( int_get_vector_length(v10, v9, 0) < pOutdoor->pBModels[i].sBoundingRadius + 256 ) | |
1682 { | |
1683 v22 = 1; | |
1684 break; | |
1685 } | |
1686 } | |
0 | 1687 v11 = uFaceID == 100; |
1688 if ( uFaceID >= 100 ) | |
1689 break; | |
1690 if ( v22 ) | |
1691 { | |
1692 v11 = uFaceID == 100; | |
1693 break; | |
1694 } | |
1695 } | |
1696 } | |
1697 else | |
1698 { | |
1699 v26 = 0; | |
1700 v22 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
1701 do | |
1702 { | |
1703 ++v26; | |
1704 v12 = rand() % 512 + 256; | |
1705 v13 = rand(); | |
1706 v14 = v13 % (signed int)stru_5C6E00->uIntegerDoublePi; | |
323 | 1707 v15 = stru_5C6E00->Cos(v13 % (signed int)stru_5C6E00->uIntegerDoublePi); |
0 | 1708 v20 = v15; |
1709 v23 = (unsigned __int64)(v15 * (signed __int64)v12) >> 16; | |
1710 v19.vPosition.x = pParty->vPosition.x + v23; | |
323 | 1711 v16 = stru_5C6E00->Sin(v13 % (signed int)stru_5C6E00->uIntegerDoublePi); |
0 | 1712 v20 = v16; |
1713 v23 = (unsigned __int64)(v16 * (signed __int64)v12) >> 16; | |
1714 v19.vPosition.y = v23 + pParty->vPosition.y; | |
1715 v19.vPosition.z = pParty->vPosition.z; | |
1415 | 1716 v19.uIndex = a2; |
0 | 1717 v17 = pIndoor->GetSector(v19.vPosition.x, v23 + pParty->vPosition.y, pParty->vPosition.z); |
1718 if ( v17 == v22 ) | |
1719 { | |
723 | 1720 v18 = BLV_GetFloorLevel(v19.vPosition.x, v19.vPosition.y, v19.vPosition.z, v17, &uFaceID); |
0 | 1721 v19.vPosition.z = v18; |
1722 if ( v18 != -30000 ) | |
1723 { | |
1724 if ( abs(v18 - pParty->vPosition.z) <= 1024 ) | |
1725 break; | |
1726 } | |
1727 } | |
1728 } | |
1729 while ( v26 < 100 ); | |
1730 v11 = v26 == 100; | |
1731 } | |
1732 if ( v11 ) | |
1733 { | |
1734 result = 0; | |
1735 } | |
1736 else | |
1737 { | |
1415 | 1738 SpawnEncounter(a1, &v19, 0, 0, 1); |
1739 result = a2; | |
0 | 1740 } |
1741 return result; | |
1742 } | |
1743 | |
1744 //----- (00450AAA) -------------------------------------------------------- | |
1745 void RespawnGlobalDecorations() | |
1746 { | |
1822 | 1747 memset(stru_5E4C90_MapPersistVars._decor_events.data(), 0, 125); |
0 | 1748 |
1749 uint decorEventIdx = 0; | |
1750 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
1751 { | |
1980 | 1752 LevelDecoration* decor = &pLevelDecorations[i]; |
0 | 1753 |
1514
965af46e8793
Rename LevelDecoration::field_16_event_id to LevelDecoration::uEventID.
yoctozepto
parents:
1513
diff
changeset
|
1754 if (!decor->uEventID) |
0 | 1755 { |
1756 if (decor->IsInteractive()) | |
1757 { | |
1758 if (decorEventIdx < 124) | |
1759 { | |
1760 decor->_idx_in_stru123 = decorEventIdx + 75; | |
1736
c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents:
1706
diff
changeset
|
1761 stru_5E4C90_MapPersistVars._decor_events[decorEventIdx++] = decor->GetGlobalEvent(); |
0 | 1762 } |
1763 } | |
1764 } | |
1765 } | |
1766 } | |
1767 | |
1768 //----- (00450B0A) -------------------------------------------------------- | |
1769 bool __fastcall SpawnActor(unsigned int uMonsterID) | |
1770 { | |
1771 unsigned int v1; // ebx@1 | |
1772 bool result; // eax@2 | |
1773 MonsterDesc *v3; // esi@5 | |
1774 MonsterInfo *v4; // edi@5 | |
1775 Vec3_int_ v5; // ST08_12@5 | |
1776 unsigned int v6; // ecx@5 | |
1777 Actor *v7; // eax@7 | |
1778 Actor actor; // [sp+4h] [bp-350h]@5 | |
1779 Vec3_int_ pOut; // [sp+348h] [bp-Ch]@5 | |
1780 | |
1781 v1 = uMonsterID; | |
1782 if ( uNumActors == 499 ) | |
1783 { | |
1784 result = 0; | |
1785 } | |
1786 else | |
1787 { | |
1788 if ( (signed int)uMonsterID >= (signed int)pMonsterList->uNumMonsters ) | |
1789 v1 = 0; | |
1790 v3 = &pMonsterList->pMonsters[v1]; | |
1791 v4 = &pMonsterStats->pInfos[v1 + 1]; | |
1792 memset(&actor, 0, 0x344u); | |
1793 strcpy(actor.pActorName, v4->pName); | |
1794 actor.sCurrentHP = LOWORD(v4->uHP); | |
1795 memcpy(&actor.pMonsterInfo, &pMonsterStats->pInfos[v1 + 1], 0x58u); | |
1796 actor.word_000086_some_monster_id = v1 + 1; | |
1797 actor.uActorRadius = v3->uMonsterRadius; | |
1798 actor.uActorHeight = v3->uMonsterHeight; | |
1799 actor.uMovementSpeed = v3->uMovementSpeed; | |
1800 v5 = pParty->vPosition; | |
1801 Vec3_int_::Rotate(200, pParty->sRotationY, 0, v5, &pOut.x, &pOut.z, &pOut.y); | |
1802 actor.vInitialPosition.x = pOut.x; | |
1803 actor.vPosition.x = pOut.x; | |
1804 actor.uTetherDistance = 256; | |
1805 actor.vInitialPosition.y = LOWORD(pOut.z); | |
1806 actor.vPosition.y = LOWORD(pOut.z); | |
1807 actor.vInitialPosition.z = LOWORD(pOut.y); | |
1808 actor.vPosition.z = LOWORD(pOut.y); | |
1809 pSprites_LOD->DeleteSomeSprites(); | |
1810 pPaletteManager->ResetNonTestLocked(); | |
1811 v6 = uNumActors - 1; | |
1812 if ( dword_5C6DF8 == 1 ) | |
1813 { | |
1814 dword_5C6DF8 = 0; | |
1815 v6 = uNumActors++; | |
1816 } | |
1817 v7 = &pActors[v6]; | |
1818 memcpy(v7, &actor, 0x344u); | |
1819 v7->PrepareSprites(1); | |
1820 result = 1; | |
1821 } | |
1822 return result; | |
1823 } | |
1824 // 5C6DF8: using guessed type int dword_5C6DF8; | |
1825 | |
1826 //----- (00450DA3) -------------------------------------------------------- | |
1458 | 1827 int GetAlertStatus() |
0 | 1828 { |
1829 int result; // eax@2 | |
1830 | |
1831 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
1832 result = pOutdoor->ddm.field_C_alert; | |
1833 else | |
1834 result = uCurrentlyLoadedLevelType == LEVEL_Outdoor ? pIndoor->dlv.field_C_alert : 0; | |
1835 return result; | |
1836 } | |
1837 | |
1838 //----- (00450DDE) -------------------------------------------------------- | |
1839 stru350 *stru350::_450DDE() | |
1840 { | |
1841 _450DF1(&stru_4E82A4, &stru_4E82A4); | |
1842 return this; | |
1843 } | |
1844 | |
1845 //----- (00450DF1) -------------------------------------------------------- | |
1846 bool stru350::_450DF1(const stru355 *p1, const stru355 *p2) | |
1847 { | |
1848 //stru350 *v3; // esi@1 | |
1849 //void *result; // eax@1 | |
1850 unsigned int v5; // ecx@2 | |
1851 int v6; // edi@2 | |
1852 int v7; // edx@2 | |
1853 unsigned int v8; // ecx@8 | |
1854 int v9; // edi@8 | |
1855 int v10; // edx@8 | |
1856 int v11; // ecx@12 | |
1857 int v12; // edi@12 | |
1858 unsigned int v13; // ecx@12 | |
1859 int v14; // edx@12 | |
1860 int v15; // ecx@16 | |
1861 unsigned int v16; // edx@16 | |
1862 int v17; // ecx@16 | |
1863 int v18; // edi@16 | |
1864 char v19; // zf@20 | |
1865 unsigned int v20; // ecx@21 | |
1866 int v21; // edi@21 | |
1867 int v22; // edx@21 | |
1868 unsigned int v23; // ecx@27 | |
1869 int v24; // edi@27 | |
1870 int v25; // edx@27 | |
1871 int v26; // ecx@31 | |
1872 int v27; // edi@31 | |
1873 unsigned int v28; // ecx@31 | |
1874 int v29; // edx@31 | |
1875 int v30; // ebx@35 | |
1876 int v31; // ecx@35 | |
1877 int v32; // edi@35 | |
1878 int v33; // edx@35 | |
1879 unsigned int i; // ecx@35 | |
1880 int v35; // ecx@39 | |
1881 unsigned int v36; // edx@39 | |
1882 int v37; // ecx@39 | |
1883 int v38; // ebx@39 | |
1884 | |
1885 //v3 = this; | |
1886 memcpy(&field_0, p1, sizeof(stru355)); | |
1887 memcpy(&field_20, p2, sizeof(stru355)); | |
1888 //result = memcpy(&v3->field_20, p2, 0x20u); | |
1889 //LOBYTE(result) = 1; | |
1890 if (field_0.field_4 & 1) | |
1891 { | |
1892 v5 = field_0.field_1C; | |
1893 v6 = 0; | |
1894 v7 = 0; | |
1895 while ( !(v5 & 1) ) | |
1896 { | |
1897 ++v6; | |
1898 v5 >>= 1; | |
1899 } | |
1900 do | |
1901 { | |
1902 v5 >>= 1; | |
1903 ++v7; | |
1904 } | |
1905 while ( v5 & 1 ); | |
1906 field_40 = 32 - v7 - v6; | |
1907 } | |
1908 else | |
1909 { | |
1910 field_40 = 0; | |
1911 } | |
1912 v8 = field_0.field_10; | |
1913 v9 = 0; | |
1914 v10 = 0; | |
1915 while ( !(v8 & 1) ) | |
1916 { | |
1917 ++v9; | |
1918 v8 >>= 1; | |
1919 } | |
1920 do | |
1921 { | |
1922 v8 >>= 1; | |
1923 ++v10; | |
1924 } | |
1925 while ( v8 & 1 ); | |
1926 v11 = 24 - v10 - v9; | |
1927 v12 = 0; | |
1928 field_48 = v11; | |
1929 v13 = field_0.field_14; | |
1930 v14 = 0; | |
1931 while ( !(v13 & 1) ) | |
1932 { | |
1933 ++v12; | |
1934 v13 >>= 1; | |
1935 } | |
1936 do | |
1937 { | |
1938 v13 >>= 1; | |
1939 ++v14; | |
1940 } | |
1941 while ( v13 & 1 ); | |
1942 v15 = 16 - v14; | |
1943 v16 = field_0.field_18; | |
1944 field_50 = v15 - v12; | |
1945 v17 = 0; | |
1946 v18 = 0; | |
1947 while ( !(v16 & 1) ) | |
1948 { | |
1949 ++v17; | |
1950 v16 >>= 1; | |
1951 } | |
1952 do | |
1953 { | |
1954 v16 >>= 1; | |
1955 ++v18; | |
1956 } | |
1957 while ( v16 & 1 ); | |
1958 v19 = (field_20.field_4 & 1) == 0; | |
1959 field_58 = v17 - v18 + 8; | |
1960 if ( v19 ) | |
1961 { | |
1962 field_44 = 0; | |
1963 } | |
1964 else | |
1965 { | |
1966 v20 = field_20.field_1C; | |
1967 v21 = 0; | |
1968 v22 = 0; | |
1969 while ( !(v20 & 1) ) | |
1970 { | |
1971 ++v21; | |
1972 v20 >>= 1; | |
1973 } | |
1974 do | |
1975 { | |
1976 v20 >>= 1; | |
1977 ++v22; | |
1978 } | |
1979 while ( v20 & 1 ); | |
1980 field_44 = 32 - v22 - v21; | |
1981 } | |
1982 v23 = field_20.field_10; | |
1983 v24 = 0; | |
1984 v25 = 0; | |
1985 while ( !(v23 & 1) ) | |
1986 { | |
1987 ++v24; | |
1988 v23 >>= 1; | |
1989 } | |
1990 do | |
1991 { | |
1992 v23 >>= 1; | |
1993 ++v25; | |
1994 } | |
1995 while ( v23 & 1 ); | |
1996 v26 = 24 - v25 - v24; | |
1997 v27 = 0; | |
1998 field_4C = v26; | |
1999 v28 = field_20.field_14; | |
2000 v29 = 0; | |
2001 while ( !(v28 & 1) ) | |
2002 { | |
2003 ++v27; | |
2004 v28 >>= 1; | |
2005 } | |
2006 do | |
2007 { | |
2008 v28 >>= 1; | |
2009 ++v29; | |
2010 } | |
2011 while ( v28 & 1 ); | |
2012 v30 = 0; | |
2013 v31 = 16 - v29 - v27; | |
2014 v32 = field_20.field_18; | |
2015 field_54 = v31; | |
2016 v33 = 0; | |
2017 for ( i = v32; !(i & 1); i >>= 1 ) | |
2018 ++v30; | |
2019 do | |
2020 { | |
2021 i >>= 1; | |
2022 ++v33; | |
2023 } | |
2024 while ( i & 1 ); | |
2025 v35 = 32 - v33; | |
2026 v36 = v32; | |
2027 field_5C = v35 - v30; | |
2028 v37 = 0; | |
2029 v38 = 0; | |
2030 while ( !(v36 & 1) ) | |
2031 { | |
2032 ++v37; | |
2033 v36 >>= 1; | |
2034 } | |
2035 do | |
2036 { | |
2037 v36 >>= 1; | |
2038 ++v38; | |
2039 } | |
2040 while ( v36 & 1 ); | |
2041 field_5C = v37 - v38 + 8; | |
2042 return true; | |
2043 } | |
2044 | |
2045 //----- (00450F55) -------------------------------------------------------- | |
2046 unsigned int stru350::_450F55(int a2) | |
2047 { | |
2048 int v2 = a2 & stru_4E82A4.field_1C; | |
2049 if (field_20.field_4 & 1) | |
2050 v2 = (unsigned int)v2 >> this->field_44; | |
2051 return v2 & field_20.field_1C | | |
2052 field_20.field_10 & ((a2 & (unsigned int)stru_4E82A4.field_10) >> field_4C) | | |
2053 field_20.field_14 & ((a2 & (unsigned int)stru_4E82A4.field_14) >> field_54) | | |
2054 field_20.field_18 & ((a2 & (unsigned int)stru_4E82A4.field_18) >> field_5C); | |
2055 } | |
2056 | |
2057 //----- (00450FB1) -------------------------------------------------------- | |
2058 int stru350::_450FB1(int a2) | |
2059 { | |
2060 int v2 = 0; | |
2061 int v4 = field_0.field_4 & 1; | |
2062 if ( v4 ) | |
2063 v2 = a2 & field_0.field_1C; | |
2064 if ( v4 ) | |
2065 v2 <<= field_40; | |
2066 return v2 | ((a2 & field_0.field_10) << field_48) | ((a2 & field_0.field_14) << field_50) | ((a2 & field_0.field_18) << field_58); | |
2067 } | |
2068 | |
2069 //----- (00452442) -------------------------------------------------------- | |
1583 | 2070 unsigned int __fastcall _452442_color_cvt(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4) |
0 | 2071 { |
2072 int v4; // ebx@0 | |
2073 __int16 v5; // ST14_2@1 | |
2074 __int16 v6; // dx@1 | |
2075 int v7; // ecx@1 | |
2076 __int16 v8; // ST10_2@1 | |
2077 int v9; // edi@1 | |
2078 unsigned __int16 v10; // dh@1@1 | |
2079 int v11; // ebx@1 | |
2080 int v12; // ebx@1 | |
2081 __int16 a3a; // [sp+1Ch] [bp+8h]@1 | |
2082 | |
2083 v5 = a2 >> 2; | |
2084 v6 = (unsigned __int16)a4 >> 2; | |
2085 v8 = a1 >> 2; | |
2086 a3a = (unsigned __int16)a3 >> 2; | |
2087 LOWORD(v7) = a3a; | |
2088 v9 = v7; | |
2089 LOWORD(v4) = ((unsigned __int16)a4 >> 2) & 0xE0; | |
2090 LOWORD(v7) = a3a & 0xE0; | |
2091 LOWORD(v9) = v9 & 0x1C00; | |
2092 v11 = v7 + v4; | |
2093 LOWORD(v7) = v5 & 0xE0; | |
2094 v12 = v7 + v11; | |
2095 LOWORD(v7) = v8 & 0xE0; | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1408
diff
changeset
|
2096 __debugbreak(); // warning C4700: uninitialized local variable 'v10' used |
848 | 2097 return (PID_TYPE(v8) + PID_TYPE(v5) + PID_TYPE(a3a) + PID_TYPE(v6)) | (v7 + v12) | ((v8 & 0x1C00) |
0 | 2098 + (v5 & 0x1C00) |
2099 + v9 | |
2100 + (__PAIR__(v10, (unsigned __int16)a4 >> 2) & 0x1C00)); | |
2101 } | |
2102 | |
2103 //----- (0045281E) -------------------------------------------------------- | |
2104 // Calculates atan2(y/x) | |
2105 // return value: angle in integer format (multiplier of Pi/1024) | |
2106 unsigned int stru193_math::Atan2(int x, int y) | |
2107 { | |
2108 signed int quadrant; | |
2109 __int64 dividend; | |
2110 int quotient; | |
2111 int lowIdx; | |
2112 int highIdx; | |
2113 int angle; | |
2114 | |
1980 | 2115 int X = x; |
2116 int Y = y; | |
0 | 2117 |
2118 if ( abs(X) < 65536 ) | |
2119 { | |
2120 if ( (abs(Y) >> 15) >= abs(X) ) | |
2121 X = 0; | |
2122 } | |
2123 | |
2124 if ( !X ) | |
2125 { | |
2126 if ( Y > 0 ) | |
2127 { | |
2128 return uIntegerHalfPi; //Pi/2 | |
2129 } | |
2130 else | |
2131 { | |
2132 return uIntegerHalfPi + uIntegerPi; //3*(Pi/2) | |
2133 } | |
2134 } | |
2135 | |
2136 if ( Y ) | |
2137 { | |
2138 if ( X < 0 ) | |
2139 { | |
2140 X = -X; | |
2141 if ( Y > 0 ) | |
2142 { | |
2143 quadrant = 4; | |
2144 } | |
2145 else | |
2146 { | |
2147 quadrant = 3; | |
2148 } | |
2149 } | |
2150 else | |
2151 { | |
2152 if ( Y > 0 ) | |
2153 { | |
2154 quadrant = 1; | |
2155 } | |
2156 else | |
2157 { | |
2158 quadrant = 2; | |
2159 } | |
2160 } | |
2161 | |
2162 if ( Y < 0 ) | |
2163 Y = -Y; | |
2164 | |
2165 LODWORD(dividend) = Y << 16; | |
2166 HIDWORD(dividend) = Y >> 16; | |
2167 quotient = dividend / X; | |
2168 | |
2169 //looks like binary search | |
2170 { | |
2171 int i; | |
2172 highIdx = uIntegerHalfPi; | |
2173 lowIdx = 0; | |
2174 | |
2175 for (i = 0; i < 6; ++i) | |
2176 { | |
2177 if (quotient <= pTanTable[(lowIdx + highIdx) / 2]) | |
2178 highIdx = (lowIdx + highIdx) / 2; | |
2179 else | |
2180 lowIdx = (lowIdx + highIdx) / 2; | |
2181 } | |
2182 } | |
2183 | |
2184 angle = lowIdx + 1; | |
2185 while ( angle < (highIdx - 1) && quotient >= pTanTable[angle] ) | |
2186 ++angle; | |
2187 | |
2188 switch (quadrant) | |
2189 { | |
2190 case 1: //X > 0, Y > 0 | |
2191 return angle; | |
2192 | |
2193 case 2: //X > 0, Y < 0 | |
2194 return uIntegerDoublePi - angle; //2*Pi - angle | |
2195 | |
2196 case 3: //X > 0, Y < 0 | |
2197 return uIntegerPi + angle; //Pi + angle | |
2198 | |
2199 case 4: //X < 0, Y > 0 | |
2200 return uIntegerPi - angle; //Pi - angle | |
2201 } | |
2202 | |
2203 //should newer get here | |
2204 return 0; | |
2205 } | |
2206 | |
2207 if ( X < 0 ) //Y == 0, X < 0 | |
2208 return uIntegerPi; | |
2209 | |
2210 return 0; | |
2211 } | |
2212 | |
2213 //----- (00452969) -------------------------------------------------------- | |
2214 stru193_math::stru193_math() | |
2215 { | |
2216 double v3; // ST18_8@2 | |
1214
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2217 |
0 | 2218 this->pTanTable[0] = 0; |
2219 this->pCosTable[0] = 65536; | |
2220 this->pInvCosTable[0] = 65536; | |
1214
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2221 for(int i = 1; i < (signed int)this->uIntegerHalfPi; i++) |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2222 { |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2223 v3 = (double)i * 3.141592653589793 / (double)uIntegerPi; |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2224 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
|
2225 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
|
2226 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
|
2227 } |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2228 for(int i = this->uIntegerHalfPi; i < 520; i++) |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2229 { |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2230 this->pTanTable[i] = 0xEFFFFFFFu; |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2231 this->pCosTable[i] = 0; |
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
2232 this->pInvCosTable[i] = 0xEFFFFFFFu; |
0 | 2233 } |
2234 } | |
2235 | |
2236 //----- (00452A9E) -------------------------------------------------------- | |
295 | 2237 int integer_sqrt(int val) |
0 | 2238 { |
2239 signed int result; // eax@2 | |
295 | 2240 unsigned int v2; // edx@3 |
271 | 2241 unsigned int v3; // edi@3 |
2242 //signed int v4; // ebx@3 | |
0 | 2243 int v5; // esi@4 |
2244 | |
295 | 2245 if (val < 1) |
2246 return val; | |
271 | 2247 |
0 | 2248 v2 = 0; |
295 | 2249 v3 = val; |
0 | 2250 result = 0; |
271 | 2251 //v4 = 16; |
2252 for (uint i = 0; i < 16; ++i) | |
2253 { | |
0 | 2254 result *= 2; |
271 | 2255 v2 = (v3 >> 30) | 4 * v2; |
0 | 2256 v5 = 2 * result + 1; |
2257 v3 *= 4; | |
295 | 2258 if ( v2 >= v5 ) |
0 | 2259 { |
2260 ++result; | |
2261 v2 -= v5; | |
2262 } | |
271 | 2263 //--v4; |
2264 } | |
2265 //while ( v4 ); | |
295 | 2266 if ( val - result * result >= (unsigned int)(result - 1) ) |
0 | 2267 ++result; |
295 | 2268 return result; |
0 | 2269 } |
2270 | |
2152 | 2271 |
0 | 2272 |
2273 //----- (00452B2E) -------------------------------------------------------- | |
2274 int __fastcall GetDiceResult(unsigned int uNumDice, unsigned int uDiceSides) | |
2275 { | |
2276 int v3; // esi@1 | |
2101 | 2277 |
0 | 2278 v3 = 0; |
2279 if ( uDiceSides ) | |
2280 { | |
2101 | 2281 for ( uint i = 0; i < uNumDice; ++i) |
2282 v3 += rand() % uDiceSides + 1; | |
2283 return v3; | |
0 | 2284 } |
2101 | 2285 return 0; |
0 | 2286 } |
2287 | |
2288 //----- (00453F62) -------------------------------------------------------- | |
2289 void MapStats::Initialize() | |
2290 { | |
237 | 2291 char work_str[32]; // [sp+Ch] [bp-34h]@3 |
2292 int work_str_pos; | |
2293 int work_str_len; | |
2294 int i; | |
2295 char* test_string; | |
2296 unsigned char c; | |
2297 bool break_loop; | |
2298 unsigned int temp_str_len; | |
2299 char* tmp_pos; | |
2300 int decode_step; | |
2301 int item_counter; | |
2302 | |
0 | 2303 if ( pMapStatsTXT_Raw ) |
1583 | 2304 free(pMapStatsTXT_Raw); |
237 | 2305 pMapStatsTXT_Raw = NULL; |
0 | 2306 pMapStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("MapStats.txt", 0); |
2307 strtok(pMapStatsTXT_Raw, "\r"); | |
237 | 2308 strtok(NULL, "\r"); |
2309 strtok(NULL, "\r"); | |
2310 | |
2311 for (i=1; i<77; ++i) | |
2312 { | |
2313 test_string = strtok(NULL, "\r") + 1; | |
2314 break_loop = false; | |
2315 decode_step=0; | |
2316 do | |
2317 { | |
2318 c = *(unsigned char*)test_string; | |
2319 temp_str_len = 0; | |
2320 while((c!='\t')&&(c>0)) | |
2321 { | |
2322 ++temp_str_len; | |
2323 c=test_string[temp_str_len]; | |
2324 } | |
2325 tmp_pos=test_string+temp_str_len; | |
2326 if (*tmp_pos == 0) | |
2327 break_loop = true; | |
2328 *tmp_pos = 0; | |
2329 if (temp_str_len) | |
2330 { | |
2331 switch (decode_step) | |
2332 { | |
2333 case 1: | |
2334 pInfos[i].pName = RemoveQuotes(test_string); | |
2335 break; | |
2336 case 2: | |
2337 pInfos[i].pFilename = RemoveQuotes(test_string); | |
2338 break; | |
2339 case 3: | |
2340 pInfos[i].uNumResets = atoi(test_string); | |
2341 break; | |
2342 case 4: | |
2343 pInfos[i].uFirstVisitedAt = atoi(test_string); | |
2344 break; | |
2345 case 5: | |
2346 pInfos[i]._per = atoi(test_string); | |
2347 break; | |
2348 case 6: | |
2349 pInfos[i].uRespawnIntervalDays = atoi(test_string); | |
2350 break; | |
2351 case 7: | |
2352 pInfos[i]._alert_days = atoi(test_string); | |
2353 break; | |
2354 case 8: | |
2355 pInfos[i]._steal_perm = atoi(test_string); | |
2356 break; | |
2357 case 9: | |
2358 pInfos[i].LockX5 = atoi(test_string); | |
2359 break; | |
2360 case 10: | |
2361 pInfos[i].Trap_D20 = atoi(test_string); | |
2362 break; | |
2363 case 11: | |
2364 pInfos[i].Treasure_prob = atoi(test_string); | |
2365 break; | |
2366 case 12: | |
2367 pInfos[i].Encounter_percent = atoi(test_string); | |
2368 break; | |
2369 case 13: | |
2370 pInfos[i].EncM1percent = atoi(test_string); | |
2371 break; | |
2372 case 14: | |
2373 pInfos[i].EncM2percent = atoi(test_string); | |
2374 break; | |
2375 case 15: | |
2376 pInfos[i].EncM3percent = atoi(test_string); | |
2377 break; | |
2378 case 16: | |
2379 pInfos[i].pEncounterMonster1Texture = RemoveQuotes(test_string); | |
2380 break; | |
2381 case 18: | |
2382 pInfos[i].Dif_M1 = atoi(test_string); | |
2383 break; | |
2384 case 19: | |
2385 pInfos[i].uEncounterMonster1AtLeast = 1; | |
2386 pInfos[i].uEncounterMonster1AtMost = 1; | |
2387 strcpy(work_str, test_string); | |
2388 work_str_pos = 0; | |
2389 work_str_len=strlen(work_str); | |
2390 if (work_str_len ) | |
2391 { | |
2392 while (work_str[work_str_pos] != '-' ) | |
2393 { | |
2394 ++work_str_pos; | |
2395 if (work_str_pos >= work_str_len ) | |
2396 break; | |
2397 } | |
2398 work_str[work_str_pos] = 0; | |
2399 pInfos[i].uEncounterMonster1AtLeast = atoi(work_str); | |
2400 if ( work_str_pos < work_str_len ) | |
2401 pInfos[i].uEncounterMonster1AtMost = atoi(&work_str[work_str_pos + 1]); | |
2402 else | |
2403 pInfos[i].uEncounterMonster1AtMost = pInfos[i].uEncounterMonster1AtLeast; | |
2404 } | |
2405 break; | |
2406 case 20: | |
2407 pInfos[i].pEncounterMonster2Texture = RemoveQuotes(test_string); | |
2408 break; | |
2409 case 22: | |
2410 pInfos[i].Dif_M2 = atoi(test_string); | |
2411 break; | |
2412 case 23: | |
2413 pInfos[i].uEncounterMonster2AtLeast = 1; | |
2414 pInfos[i].uEncounterMonster2AtMost = 1; | |
2415 strcpy(work_str, test_string); | |
2416 work_str_pos = 0; | |
2417 work_str_len=strlen(work_str); | |
2418 if (work_str_len ) | |
2419 { | |
2420 while (work_str[work_str_pos] != '-' ) | |
2421 { | |
2422 ++work_str_pos; | |
2423 if (work_str_pos >= work_str_len ) | |
2424 break; | |
2425 } | |
2426 work_str[work_str_pos] = 0; | |
2427 pInfos[i].uEncounterMonster2AtLeast = atoi(work_str); | |
2428 if ( work_str_pos < work_str_len ) | |
2429 pInfos[i].uEncounterMonster2AtMost = atoi(&work_str[work_str_pos + 1]); | |
2430 else | |
2431 pInfos[i].uEncounterMonster2AtMost = pInfos[i].uEncounterMonster2AtLeast; | |
2432 } | |
2433 break; | |
2434 case 24: | |
2435 pInfos[i].pEncounterMonster3Texture = RemoveQuotes(test_string); | |
2436 break; | |
2437 case 26: | |
2438 pInfos[i].Dif_M3 = atoi(test_string); | |
2439 break; | |
2440 case 27: | |
2441 pInfos[i].uEncounterMonster3AtLeast = 1; | |
2442 pInfos[i].uEncounterMonster3AtMost = 1; | |
2443 strcpy(work_str, test_string); | |
2444 work_str_pos = 0; | |
2445 work_str_len=strlen(work_str); | |
2446 if (work_str_len ) | |
2447 { | |
2448 while (work_str[work_str_pos] != '-' ) | |
2449 { | |
2450 ++work_str_pos; | |
2451 if (work_str_pos >= work_str_len ) | |
2452 break; | |
2453 } | |
2454 work_str[work_str_pos] = 0; | |
2455 pInfos[i].uEncounterMonster3AtLeast = atoi(work_str); | |
2456 if ( work_str_pos < work_str_len ) | |
2457 pInfos[i].uEncounterMonster3AtMost = atoi(&work_str[work_str_pos + 1]); | |
2458 else | |
2459 pInfos[i].uEncounterMonster3AtMost = pInfos[i].uEncounterMonster3AtLeast; | |
2460 } | |
2461 break; | |
2462 case 28: | |
2463 pInfos[i].uRedbookTrackID = atoi(test_string); | |
2464 break; | |
2465 case 29: | |
2466 { | |
2467 if ( !strcmp(test_string, "CAVE") ) | |
2468 { | |
2469 pInfos[i].uEAXEnv = 8; | |
2470 break; | |
2471 } | |
2472 if ( !strcmp(test_string, "STONEROOM") ) | |
2473 { | |
2474 pInfos[i].uEAXEnv = 5; | |
2475 break; | |
2476 } | |
2477 if ( !strcmp(test_string, "MOUNTAINS") ) | |
2478 { | |
2479 pInfos[i].uEAXEnv = 17; | |
2480 break; | |
2481 } | |
2482 if ( !strcmp(test_string, "PLAIN") ) | |
2483 { | |
2484 pInfos[i].uEAXEnv = 19; | |
2485 break; | |
2486 } | |
2487 if ( !strcmp(test_string, "FOREST") ) | |
2488 { | |
2489 pInfos[i].uEAXEnv = 15; | |
2490 break; | |
2491 } | |
2492 if ( !strcmp(test_string, "CITY") ) | |
2493 { | |
2494 pInfos[i].uEAXEnv = 16; | |
2495 break; | |
2496 } | |
2497 if ( !strcmp(test_string, "UNDERWATER") ) | |
2498 { | |
2499 pInfos[i].uEAXEnv = 22; | |
2500 break; | |
2501 } | |
2502 if ( !strcmp(test_string, "ARENA") ) | |
2503 { | |
2504 pInfos[i].uEAXEnv = 9; | |
2505 break; | |
2506 } | |
2507 if ( !strcmp(test_string, "GENERIC") ) | |
2508 { | |
2509 pInfos[i].uEAXEnv = 0; | |
2510 break; | |
2511 } | |
2512 if ( !strcmp(test_string, "PADDEDCELL") ) | |
2513 { | |
2514 pInfos[i].uEAXEnv = 1; | |
2515 break; | |
2516 } | |
2517 if ( !strcmp(test_string, "ROOM") ) | |
2518 { | |
2519 pInfos[i].uEAXEnv = 2; | |
2520 break; | |
2521 } | |
2522 if ( !strcmp(test_string, "BATHROOM") ) | |
2523 { | |
2524 pInfos[i].uEAXEnv = 3; | |
2525 break; | |
2526 } | |
2527 if ( !strcmp(test_string, "LIVINGROOM") ) | |
2528 { | |
2529 pInfos[i].uEAXEnv = 4; | |
2530 break; | |
2531 } | |
2532 if ( !strcmp(test_string, "AUDITORIUM") ) | |
2533 { | |
2534 pInfos[i].uEAXEnv = 6; | |
2535 break; | |
2536 } | |
2537 if ( !strcmp(test_string, "CONCERTHALL") ) | |
2538 { | |
2539 pInfos[i].uEAXEnv = 7; | |
2540 break; | |
2541 } | |
2542 if ( !strcmp(test_string, "HANGAR") ) | |
2543 { | |
2544 pInfos[i].uEAXEnv = 10; | |
2545 break; | |
2546 } | |
2547 if ( !strcmp(test_string, "CARPETEDHALLWAY") ) | |
2548 { | |
2549 pInfos[i].uEAXEnv = 11; | |
2550 break; | |
2551 } | |
2552 if ( !strcmp(test_string, "HALLWAY") ) | |
2553 { | |
2554 pInfos[i].uEAXEnv = 12; | |
2555 break; | |
2556 } | |
2557 if ( !strcmp(test_string, "STONECORRIDOR") ) | |
2558 { | |
2559 pInfos[i].uEAXEnv = 13; | |
2560 break; | |
2561 } | |
2562 if ( !strcmp(test_string, "ALLEY") ) | |
2563 { | |
2564 pInfos[i].uEAXEnv = 14; | |
2565 break; | |
2566 } | |
2567 if ( !strcmp(test_string, "QUARRY") ) | |
2568 { | |
2569 pInfos[i].uEAXEnv = 18; | |
2570 break; | |
2571 } | |
2572 if ( !strcmp(test_string, "PARKINGLOT") ) | |
2573 { | |
2574 pInfos[i].uEAXEnv = 20; | |
2575 break; | |
2576 } | |
2577 if ( !strcmp(test_string, "SEWERPIPE") ) | |
2578 { | |
2579 pInfos[i].uEAXEnv = 21; | |
2580 break; | |
2581 } | |
2582 if ( !strcmp(test_string, "DRUGGED") ) | |
2583 { | |
2584 pInfos[i].uEAXEnv = 23; | |
2585 break; | |
2586 } | |
2587 if ( !strcmp(test_string, "DIZZY") ) | |
2588 { | |
2589 pInfos[i].uEAXEnv = 24; | |
2590 break; | |
2591 } | |
2592 if ( !strcmp(test_string, "PSYCHOTIC") ) | |
2593 { | |
2594 pInfos[i].uEAXEnv = 25; | |
2595 break; | |
2596 } | |
2597 pInfos[i].uEAXEnv = 26; | |
2598 | |
2599 } | |
2600 break; | |
2601 } | |
2602 } | |
2603 else | |
2604 { | |
2605 break_loop = true; | |
2606 } | |
2607 ++decode_step; | |
2608 test_string=tmp_pos+1; | |
2609 } while ((decode_step<31)&&!break_loop); | |
2610 } | |
2611 | |
2612 uNumMaps = 77; | |
0 | 2613 } |
2614 // 453F62: using guessed type char Str[32]; | |
2615 | |
2616 //----- (004547A3) -------------------------------------------------------- | |
767 | 2617 MAP_TYPE MapStats::GetMapInfo(const char *Str2) |
2618 { | |
2619 assert(uNumMaps >= 2); | |
2620 | |
2621 for (uint i = 1; i < uNumMaps; ++i) | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1150
diff
changeset
|
2622 if (!_stricmp(pInfos[i].pFilename, Str2)) |
767 | 2623 return (MAP_TYPE)i; |
2624 | |
2625 assert(false && "Map not found!"); | |
0 | 2626 } |
2627 | |
2628 //----- (004547E4) -------------------------------------------------------- | |
2629 void FactionTable::Initialize() | |
2630 { | |
237 | 2631 int i; |
2632 char* test_string; | |
2633 unsigned char c; | |
2634 bool break_loop; | |
2635 unsigned int temp_str_len; | |
2636 char* tmp_pos; | |
2637 int decode_step; | |
2638 int item_counter; | |
2639 | |
0 | 2640 if ( pHostileTXT_Raw ) |
1583 | 2641 free(pHostileTXT_Raw); |
237 | 2642 pHostileTXT_Raw = NULL; |
0 | 2643 pHostileTXT_Raw = (char *)pEvents_LOD->LoadRaw("hostile.txt", 0); |
2644 strtok(pHostileTXT_Raw, "\r"); | |
2101 | 2645 for ( i=0; i < 89; ++i ) |
2646 { | |
2647 test_string = strtok(NULL, "\r") + 1; | |
2648 break_loop = false; | |
2649 decode_step=0; | |
2650 do | |
2651 { | |
2652 c = *(unsigned char*)test_string; | |
2653 temp_str_len = 0; | |
2654 while((c!='\t') && (c > 0)) | |
2655 { | |
2656 ++temp_str_len; | |
2657 c = test_string[temp_str_len]; | |
2658 } | |
2659 tmp_pos=test_string+temp_str_len; | |
2660 if (*tmp_pos == 0) | |
2661 break_loop = true; | |
2662 *tmp_pos = 0; | |
2663 if (temp_str_len) | |
2664 { | |
2665 if ( decode_step >= 1 && decode_step < 90 ) | |
2666 relations[decode_step-1][i] = atoi(test_string); | |
2667 } | |
2668 else | |
2669 break_loop = true; | |
2670 ++decode_step; | |
2671 test_string=tmp_pos+1; | |
2672 } | |
2673 while ((decode_step < 92) && !break_loop ); | |
2674 } | |
237 | 2675 if ( pHostileTXT_Raw) |
0 | 2676 { |
1583 | 2677 free(pHostileTXT_Raw); |
237 | 2678 pHostileTXT_Raw = NULL; |
0 | 2679 } |
2680 } | |
2681 | |
2682 //----- (00458244) -------------------------------------------------------- | |
1783 | 2683 unsigned int SkillToMastery( unsigned int skill_value ) |
1067 | 2684 { |
1064 | 2685 switch (skill_value & 0x1C0) |
983 | 2686 { |
2687 case 0x100: return 4; // Grandmaster | |
2688 case 0x80: return 3; // Master | |
2689 case 0x40: return 2; // Expert | |
2690 case 0x00: return 1; // Normal | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1408
diff
changeset
|
2691 } |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1408
diff
changeset
|
2692 assert(false); |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1408
diff
changeset
|
2693 return 0; |
0 | 2694 } |
2695 | |
2696 //----- (0045828B) -------------------------------------------------------- | |
2697 unsigned int __fastcall GetSpellColor(signed int a1) | |
2698 { | |
1799 | 2699 if ( a1 == 0 ) |
2069 | 2700 return Color16(0, 0, 0); |
1799 | 2701 if ( a1 < 12 ) |
2069 | 2702 return Color16(255, 85, 0); |
1799 | 2703 if ( a1 < 23 ) |
2069 | 2704 return Color16(150, 212, 255); |
1799 | 2705 if ( a1 < 34 ) |
2069 | 2706 return Color16(0, 128, 255); |
1799 | 2707 if ( a1 < 45 ) |
2069 | 2708 return Color16(128, 128, 128); |
1799 | 2709 if ( a1 < 56 ) |
2069 | 2710 return Color16(225, 225, 225); |
1799 | 2711 if ( a1 < 67 ) |
2069 | 2712 return Color16(235, 15, 255); |
1799 | 2713 if ( a1 < 78 ) |
2069 | 2714 return Color16(255, 128, 0); |
1799 | 2715 if ( a1 < 89 ) |
2069 | 2716 return Color16(255, 255, 155); |
1799 | 2717 if ( a1 < 100 ) |
2069 | 2718 return Color16(192, 192, 240); |
0 | 2719 } |
2720 | |
2721 //----- (004610AA) -------------------------------------------------------- | |
1637 | 2722 void __fastcall PrepareToLoadODM(unsigned int bLoading, ODMRenderParams *a2) |
0 | 2723 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
2724 pGameLoadingUI_ProgressBar->Reset(27); |
0 | 2725 pSoundList->_4A9D79(0); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
2726 uCurrentlyLoadedLevelType = LEVEL_Outdoor; |
2099 | 2727 ODM_LoadAndInitialize(pCurrentMapName, a2); |
2728 if ( !bLoading ) | |
0 | 2729 TeleportToStartingPoint(uLevel_StartingPointType); |
2730 viewparams->_443365(); | |
2731 PlayLevelMusic(); | |
2732 } | |
2733 // 6BE35C: using guessed type int uLevel_StartingPointType; | |
2734 | |
2735 //----- (00461103) -------------------------------------------------------- | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2736 void _461103_load_level_sub() |
0 | 2737 { |
2738 //GUIProgressBar *v0; // ebx@1 | |
2739 //signed int v1; // ebp@1 | |
2740 //char *v2; // esi@2 | |
2101 | 2741 //__int16 v3; // cx@3 |
0 | 2742 int v4; // edx@8 |
2743 //size_t v5; // edi@14 | |
2744 signed int v6; // esi@14 | |
2745 //char *v7; // edx@15 | |
2746 signed int v8; // ecx@16 | |
2747 int v9; // ecx@23 | |
2748 MonsterInfo *v10; // ebx@23 | |
2749 //int *v11; // esi@23 | |
2750 int v12; // esi@25 | |
2751 int v13; // eax@26 | |
2752 __int16 v14; // ax@41 | |
2753 //signed int v15; // [sp+10h] [bp-4Ch]@1 | |
2754 //signed int v16; // [sp+10h] [bp-4Ch]@14 | |
2755 signed int v17; // [sp+14h] [bp-48h]@3 | |
2756 signed int v18; // [sp+14h] [bp-48h]@23 | |
2757 int v19; // [sp+18h] [bp-44h]@1 | |
2758 signed int v20; // [sp+18h] [bp-44h]@14 | |
2759 int v21[16]; // [sp+1Ch] [bp-40h]@17 | |
2760 | |
598 | 2761 GenerateItemsInChest(); |
0 | 2762 pGameLoadingUI_ProgressBar->Progress(); |
2101 | 2763 pParty->uFlags |= 2; |
0 | 2764 pParty->field_7B5_in_arena_quest = 0; |
2765 dword_5C6DF8 = 1; | |
291 | 2766 pNPCStats->uNewlNPCBufPos = 0; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
2767 v19 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 2768 |
2769 //v15 = 0; | |
2770 for (uint i = 0; i < uNumActors; ++i) | |
2771 //if ( (signed int)uNumActors > 0 ) | |
2772 { | |
2099 | 2773 //Actor* pActor = &pActors[i]; |
0 | 2774 //v2 = (char *)&pActors[0].uNPC_ID; |
2775 //do | |
2776 //{ | |
2101 | 2777 //v3 = pActors[i].pMonsterInfo.uID; |
0 | 2778 v17 = 0; |
2099 | 2779 if ( pActors[i].pMonsterInfo.uID >= 115 && pActors[i].pMonsterInfo.uID <= 186 |
2780 || pActors[i].pMonsterInfo.uID >= 232 && pActors[i].pMonsterInfo.uID <= 249 ) | |
0 | 2781 v17 = 1; |
2782 //v1 = 0; | |
2101 | 2783 v4 = (pActors[i].pMonsterInfo.uID - 1) % 3; |
0 | 2784 if ( 2 == v4 ) |
2785 { | |
2099 | 2786 if ( pActors[i].sNPC_ID && pActors[i].sNPC_ID < 5000 ) |
0 | 2787 continue; |
2788 } | |
2789 else | |
2790 { | |
2791 if ( v4 != 1 ) | |
2792 { | |
2099 | 2793 if ( v4 == 0 && pActors[i].sNPC_ID == 0 ) |
2101 | 2794 pActors[i].sNPC_ID = 0; |
2795 continue; | |
0 | 2796 } |
2797 } | |
2099 | 2798 if ( pActors[i].sNPC_ID > 0 && pActors[i].sNPC_ID < 5000 ) |
0 | 2799 continue; |
2800 if ( v17 ) | |
2801 { | |
2101 | 2802 pNPCStats->InitializeAdditionalNPCs(&pNPCStats->pAdditionalNPC[pNPCStats->uNewlNPCBufPos], pActors[i].pMonsterInfo.uID, 0, v19); |
291 | 2803 v14 = LOWORD(pNPCStats->uNewlNPCBufPos) + 5000; |
2804 ++pNPCStats->uNewlNPCBufPos; | |
2099 | 2805 pActors[i].sNPC_ID = v14; |
0 | 2806 continue; |
2807 } | |
2099 | 2808 pActors[i].sNPC_ID = 0; |
0 | 2809 //++v15; |
2810 //v2 += 836; | |
2811 //} | |
2812 //while ( v15 < (signed int)uNumActors ); | |
2813 } | |
2814 | |
2815 pGameLoadingUI_ProgressBar->Progress(); | |
2816 | |
2817 //v5 = uNumActors; | |
2818 v6 = 0; | |
2819 v20 = 0; | |
2820 //v16 = v1; | |
2821 | |
2822 for (uint i = 0; i < uNumActors; ++i) | |
2823 { | |
2824 //v7 = (char *)&pActors[0].pMonsterInfo; | |
2825 //do | |
2826 //{ | |
2101 | 2827 for ( v8 = 0; v8 < v6; ++v8 ) |
2828 { | |
2829 if ( v21[v8] == pActors[i].pMonsterInfo.uID - 1 ) | |
2830 break; | |
2831 } | |
2832 | |
2833 if ( v8 == v6 ) | |
2834 { | |
2835 v21[v6++] = pActors[i].pMonsterInfo.uID - 1; | |
2836 v20 = v6; | |
2837 if ( v6 == 16 ) | |
2838 break; | |
2839 } | |
2840 //++v16; | |
2841 //v7 += 836; | |
0 | 2842 //} |
2843 //while ( v16 < (signed int)v5 ); | |
2844 } | |
2845 | |
2846 pGameLoadingUI_ProgressBar->Progress(); | |
2847 | |
2101 | 2848 for ( int _v0 = 0; _v0 < v6; ++_v0 ) |
0 | 2849 { |
2101 | 2850 for ( v18 = 4; v18; --v18 ) |
2851 pSoundList->LoadSound(pMonsterList->pMonsters[v21[_v0]].pSoundSampleIDs[4 - v18], 0); | |
0 | 2852 v12 = 0; |
2853 do | |
2101 | 2854 v13 = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[pMonsterStats->pInfos[v21[_v0] + 1].uSpell1ID], 1); |
0 | 2855 while ( v13 ); |
2856 } | |
2857 //v0 = pGameLoadingUI_ProgressBar; | |
2858 //v1 = 0; | |
2859 | |
2860 pGameLoadingUI_ProgressBar->Progress(); | |
2861 | |
2061 | 2862 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_ACTORS) |
0 | 2863 uNumActors = 0; |
2061 | 2864 if ( dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DECORATIONS) |
0 | 2865 uNumLevelDecorations = 0; |
1459 | 2866 init_event_triggers(); |
0 | 2867 |
2868 pGameLoadingUI_ProgressBar->Progress(); | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2869 |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2870 pGame->pIndoorCameraD3D->vPartyPos.x = 0; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2871 pGame->pIndoorCameraD3D->vPartyPos.y = 0; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2872 pGame->pIndoorCameraD3D->vPartyPos.z = 100; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2873 pGame->pIndoorCameraD3D->sRotationX = 0; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2874 pGame->pIndoorCameraD3D->sRotationY = 0; |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2875 viewparams->bRedrawGameUI = true; |
783 | 2876 uLevel_StartingPointType = MapStartPoint_Party; |
0 | 2877 pSprites_LOD->_461397(); |
2878 pPaletteManager->LockTestAll(); | |
2879 if ( pParty->pPickedItem.uItemID != 0 ) | |
2880 pMouse->SetCursorBitmapFromItemID(pParty->pPickedItem.uItemID); | |
2881 } | |
2882 | |
2883 //----- (004613C4) -------------------------------------------------------- | |
1459 | 2884 void init_event_triggers() |
0 | 2885 { |
1459 | 2886 uint id = pDecorationList->GetDecorIdByName("Event Trigger"); |
2887 | |
2888 num_event_triggers = 0; | |
2889 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
2890 if (pLevelDecorations[i].uDecorationDescID == id) | |
2891 event_triggers[num_event_triggers++] = i; | |
0 | 2892 } |
2893 | |
2894 //----- (004627B7) -------------------------------------------------------- | |
762 | 2895 void MainMenu_Loop() |
0 | 2896 { |
2897 GUIButton *pButton; // eax@27 | |
2898 unsigned int pControlParam; // ecx@35 | |
2899 int v10; // ecx@36 | |
2900 int v11; // ecx@37 | |
2901 unsigned int pY; // [sp-18h] [bp-54h]@39 | |
2902 Texture *pTexture; // [sp-14h] [bp-50h]@39 | |
2903 GUIButton *pButton2; // [sp+0h] [bp-3Ch]@27 | |
2904 GUIWindow *pWindow; // [sp+4h] [bp-38h]@11 | |
2905 | |
151 | 2906 pCurrentScreen = SCREEN_GAME; |
1038 | 2907 |
0 | 2908 pGUIWindow2 = 0; |
2909 pAudioPlayer->StopChannels(-1, -1); | |
2910 pMouse->RemoveHoldingItem(); | |
762 | 2911 |
2912 pIcons_LOD->_inlined_sub2(); | |
2913 | |
165 | 2914 pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); |
1980 | 2915 Texture* pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); |
2916 Texture* pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); | |
2917 Texture* pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE); | |
2918 Texture* pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE); | |
948 | 2919 |
2920 pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 'N', "", pNew, 0); | |
2921 pMainMenu_BtnLoad = pWindow_MainMenu->CreateButton(495, 227, pLoad->uTextureWidth, pLoad->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowLoadWindow, 1, 'L', "", pLoad, 0); | |
2922 pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, UIMSG_ShowCredits, 2, 'C', "", pCredits, 0); | |
2923 pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth, pExit->uTextureHeight, 1, 0, UIMSG_ExitToWindows, 3, 0, "", pExit, 0); | |
2924 | |
0 | 2925 pTexture_PCX.Release(); |
2926 pTexture_PCX.Load("title.pcx", 0); | |
2927 SetCurrentMenuID(MENU_MAIN); | |
1984 | 2928 SetForegroundWindow(window->GetApiHandle()); |
2929 SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0); | |
0 | 2930 while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD) |
2931 { | |
2932 POINT pt; | |
2933 pMouse->GetCursorPos(&pt); | |
2934 pWindow = pWindow_MainMenu; | |
165 | 2935 if ( GetCurrentMenuID() == MENU_SAVELOAD) |
0 | 2936 { |
151 | 2937 if ( pCurrentScreen != SCREEN_LOADGAME ) |
0 | 2938 { |
2939 pTexture_PCX.Release(); | |
2940 pTexture_PCX.Load("lsave640.pcx", 0); | |
2941 pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
151 | 2942 pCurrentScreen = SCREEN_LOADGAME; |
1033 | 2943 LoadUI_Load(0); |
0 | 2944 } |
2945 pWindow = pGUIWindow_CurrentMenu; | |
2946 } | |
2947 | |
2061 | 2948 for (MSG msg; PeekMessageW(&msg, 0, 0, 0, PM_REMOVE);) |
0 | 2949 { |
2950 if (msg.message == WM_QUIT) | |
2951 Game_DeinitializeAndTerminate(0); | |
2952 TranslateMessage(&msg); | |
2061 | 2953 DispatchMessageW(&msg); |
0 | 2954 } |
2061 | 2955 |
2956 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) | |
0 | 2957 { |
2958 WaitMessage(); | |
2061 | 2959 continue; |
0 | 2960 } |
2061 | 2961 |
0 | 2962 pRenderer->BeginScene(); |
2963 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); | |
1038 | 2964 |
165 | 2965 GUI_MainMenuMessageProc(); |
0 | 2966 GUI_UpdateWindows(); |
1038 | 2967 |
165 | 2968 if (GetCurrentMenuID() != MENU_MAIN) |
2969 { | |
961 | 2970 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) |
0 | 2971 { |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
2972 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 2973 pGUIWindow_CurrentMenu->Release(); |
2974 pGUIWindow_CurrentMenu = 0; | |
151 | 2975 pCurrentScreen = SCREEN_GAME; |
0 | 2976 viewparams->bRedrawGameUI = 1; |
2977 } | |
2978 } | |
2979 else | |
2980 { | |
1458 | 2981 if ( !pModalWindow )// ??? |
0 | 2982 { |
2983 pButton = pWindow->pControlsHead; | |
2984 for ( pButton = pWindow->pControlsHead; pButton; pButton = pButton->pNext ) | |
2985 { | |
2986 if ( pt.x >= (signed int)pButton->uX && pt.x <= (signed int)pButton->uZ | |
2987 && pt.y >= (signed int)pButton->uY && pt.y <= (signed int)pButton->uW | |
2988 && pWindow == pWindow_MainMenu ) | |
2989 { | |
832 | 2990 pControlParam = pButton->msg_param; |
0 | 2991 switch (pControlParam) // ïîäñâåòêà êíîïîê |
2992 { | |
2993 case 0: | |
2994 pTexture = pNew; | |
2995 pY = 172; | |
2996 break; | |
2997 case 1: | |
2998 pTexture = pLoad; | |
2999 pY = 227; | |
3000 break; | |
3001 case 2: | |
3002 pTexture = pCredits; | |
3003 pY = 282; | |
3004 break; | |
3005 case 3: | |
3006 pTexture = pExit; | |
3007 pY = 337; | |
3008 break; | |
3009 } | |
3010 pRenderer->DrawTextureIndexed(495, pY, pTexture); //ïîäñâåòêà êíîïîê | |
3011 } | |
3012 } | |
3013 } | |
3014 } | |
3015 pRenderer->EndScene(); | |
3016 pRenderer->Present(); | |
3017 } | |
970 | 3018 GUI_MainMenuMessageProc(); |
0 | 3019 pRenderer->BeginScene(); |
3020 GUI_UpdateWindows(); | |
3021 pRenderer->EndScene(); | |
3022 pRenderer->Present(); | |
961 | 3023 pTexture_PCX.Release(); |
0 | 3024 if ( pGUIWindow2 ) |
3025 { | |
3026 pGUIWindow2->Release(); | |
3027 pGUIWindow2 = 0; | |
3028 } | |
3029 pWindow_MainMenu->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
3030 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 3031 } |
3032 | |
3033 | |
3034 //----- (00464479) -------------------------------------------------------- | |
1583 | 3035 void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows() |
0 | 3036 { |
3037 int v0; // esi@9 | |
3038 | |
3039 if (pMouse) | |
3040 pMouse->SetCursorBitmap("MICON1"); | |
3041 | |
3042 pPaletteManager->ResetNonLocked(); | |
3043 pBitmaps_LOD->ReleaseAll2(); | |
3044 pSprites_LOD->DeleteSomeOtherSprites(); | |
3045 pIcons_LOD->ReleaseAll2(); | |
2152 | 3046 |
0 | 3047 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
3048 pIndoor->Release(); | |
3049 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
1583 | 3050 pOutdoor->Release(); |
0 | 3051 |
3052 pAudioPlayer->StopChannels(-1, -1); | |
3053 pSoundList->_4A9D79(0); | |
3054 uCurrentlyLoadedLevelType = LEVEL_null; | |
3055 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
3056 v0 = uNumVisibleWindows; | |
349 | 3057 pParty->armageddon_timer = 0; |
0 | 3058 while ( v0 > 0 ) |
3059 pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release(); | |
3060 } | |
3061 | |
3062 //----- (004646F0) -------------------------------------------------------- | |
1458 | 3063 void PrepareWorld(unsigned int _0_box_loading_1_fullscreen) |
0 | 3064 { |
2154 | 3065 //if ( pRenderer->pRenderD3D ) |
0 | 3066 pGame->pVisInstance->_4C1A02(); |
3067 pEventTimer->Pause(); | |
3068 pMiscTimer->Pause(); | |
3069 pParty->uFlags = 2; | |
1517 | 3070 CastSpellInfoHelpers::_427D48(); |
0 | 3071 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); |
1458 | 3072 DoPrepareWorld(0, (_0_box_loading_1_fullscreen == 0) + 1); |
0 | 3073 pMiscTimer->Resume(); |
3074 pEventTimer->Resume(); | |
3075 } | |
3076 | |
3077 //----- (00464761) -------------------------------------------------------- | |
1583 | 3078 void Game_DeinitializeAndTerminate(int exitCode) |
0 | 3079 { |
1586 | 3080 SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); |
0 | 3081 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); |
3082 pGame->Deinitialize(); | |
2155 | 3083 pRenderer->Release(); |
1802 | 3084 delete window; |
3085 //if ( !DestroyWindow(hWnd) ) | |
3086 // GetLastError(); | |
1583 | 3087 exit(exitCode); |
0 | 3088 } |
3089 | |
3090 //----- (004647AB) -------------------------------------------------------- | |
762 | 3091 void FinalInitialization() |
0 | 3092 { |
3093 pViewport->SetScreen(viewparams->uSomeX, viewparams->uSomeY, viewparams->uSomeZ, viewparams->uSomeW); | |
2151 | 3094 pViewport->SetFOV(flt_6BE3A0 * 65536.0f); |
0 | 3095 |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3096 //pIndoorCamera = new IndoorCamera; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3097 //pIndoorCamera->Initialize(65, viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1, |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3098 // viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1); |
0 | 3099 |
3100 InitializeTurnBasedAnimations(&stru_50C198); | |
762 | 3101 pBitmaps_LOD->_inlined_sub1(); |
3102 pSprites_LOD->_inlined_sub1(); | |
3103 pIcons_LOD->_inlined_sub1(); | |
0 | 3104 } |
3105 // 6BE3A0: using guessed type float flt_6BE3A0; | |
3106 | |
3107 //----- (00464839) -------------------------------------------------------- | |
1583 | 3108 char Is_out15odm_underwater() |
0 | 3109 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3110 return _stricmp(pCurrentMapName, "out15.odm") == 0; |
0 | 3111 } |
3112 | |
3113 //----- (00464851) -------------------------------------------------------- | |
1583 | 3114 void SetUnderwaterFog() |
0 | 3115 { |
3116 day_fogrange_1 = 50; | |
3117 day_fogrange_2 = 5000; | |
3118 } | |
3119 | |
3120 //----- (00464866) -------------------------------------------------------- | |
1458 | 3121 void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box) |
0 | 3122 { |
1458 | 3123 //int v2; // esi@1 |
0 | 3124 char *v3; // eax@1 |
3125 //char *v4; // eax@1 | |
3126 unsigned int v5; // eax@3 | |
3127 //size_t v6; // ecx@10 | |
3128 //char *v7; // eax@11 | |
3129 char Str1[20]; // [sp+Ch] [bp-18h]@1 | |
3130 unsigned int v9; // [sp+20h] [bp-4h]@1 | |
3131 | |
3132 v9 = bLoading; | |
3133 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); | |
3134 pDecalBuilder->Reset(0); | |
1458 | 3135 pGameLoadingUI_ProgressBar->Initialize(_1_fullscreen_loading_2_box == 1 ? GUIProgressBar::TYPE_Fullscreen : |
3136 GUIProgressBar::TYPE_Box); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3137 strcpy(Str1, pCurrentMapName); |
0 | 3138 v3 = strtok(Str1, "."); |
3139 strcpy(Str1, v3); | |
3140 Level_LoadEvtAndStr(Str1); | |
3141 LoadLevel_InitializeLevelEvt(); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3142 strcpy(Str1, pCurrentMapName); |
0 | 3143 _strrev(Str1); |
3144 strtok(Str1, "."); | |
3145 _strrev(Str1); | |
3146 | |
3147 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
|
3148 pSpriteObjects[i].uObjectDescID = 0; |
0 | 3149 |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3150 v5 = pMapStats->GetMapInfo(pCurrentMapName); |
1541 | 3151 bUnderwater = false; |
0 | 3152 uLevelMapStatsID = v5; |
3153 pGame->uFlags2 &= 0xFFFFFFF7u; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3154 if ( !_stricmp(pCurrentMapName, "out15.odm") ) |
0 | 3155 { |
1541 | 3156 bUnderwater = true; |
1583 | 3157 pGame->uFlags2 |= GAME_FLAGS_2_ALTER_GRAVITY; |
0 | 3158 } |
831 | 3159 pParty->floor_face_pid = 0; |
1104 | 3160 if ( _stricmp(Str1, "blv") ) |
0 | 3161 PrepareToLoadODM(v9, 0); |
3162 else | |
3163 PrepareToLoadBLV(v9); | |
3164 pAudioPlayer->SetMapEAX(); | |
1459 | 3165 _461103_load_level_sub(); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3166 if ( !_stricmp(pCurrentMapName, "d11.blv") || !_stricmp(pCurrentMapName, "d10.blv") ) |
0 | 3167 { |
1583 | 3168 //spawning grounds & walls of mist - no loot & exp from monsters |
0 | 3169 |
3170 for (uint i = 0; i < uNumActors; ++i) | |
3171 { | |
3172 pActors[i].pMonsterInfo.uTreasureType = 0; | |
3173 pActors[i].pMonsterInfo.uTreasureDiceRolls = 0; | |
3174 pActors[i].pMonsterInfo.uExp = 0; | |
3175 } | |
3176 } | |
3177 bDialogueUI_InitializeActor_NPC_ID = 0; | |
3178 OnMapLoad(); | |
3179 pGameLoadingUI_ProgressBar->Progress(); | |
1459 | 3180 memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D)); |
0 | 3181 pGameLoadingUI_ProgressBar->Release(); |
3182 _flushall(); | |
3183 } | |
3184 | |
3185 //----- (004649EF) -------------------------------------------------------- | |
3186 int __fastcall ReadWindowsRegistryInt(const char *pKey, int uDefValue) | |
3187 { | |
3188 int v3; // [sp+4h] [bp-24h]@1 | |
3189 DWORD cbData; // [sp+8h] [bp-20h]@1 | |
3190 LPCSTR lpValueName; // [sp+Ch] [bp-1Ch]@1 | |
3191 DWORD dwDisposition; // [sp+10h] [bp-18h]@2 | |
3192 BYTE Data[4]; // [sp+14h] [bp-14h]@5 | |
3193 HKEY hKey; // [sp+18h] [bp-10h]@1 | |
3194 HKEY phkResult; // [sp+1Ch] [bp-Ch]@1 | |
3195 HKEY v10; // [sp+20h] [bp-8h]@1 | |
3196 HKEY v11; // [sp+24h] [bp-4h]@1 | |
3197 | |
3198 v3 = uDefValue; | |
3199 lpValueName = pKey; | |
3200 v11 = 0; | |
3201 v10 = 0; | |
3202 hKey = 0; | |
3203 phkResult = 0; | |
3204 cbData = 4; | |
27 | 3205 if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, KEY_READ|KEY_WOW64_32KEY, &hKey) )// for 64 bit |
0 | 3206 { |
3207 if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition) ) | |
3208 { | |
3209 if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v10, &dwDisposition) ) | |
3210 { | |
3211 if ( !RegCreateKeyExA(v10, "1.0", 0, "", 0, 0xF003Fu, 0, &v11, &dwDisposition) ) | |
3212 { | |
3213 if ( RegQueryValueExA(v11, lpValueName, 0, 0, Data, &cbData) ) | |
3214 { | |
3215 *(int *)Data = v3; | |
3216 RegSetValueExA(v11, lpValueName, 0, 4u, Data, 4u); | |
3217 } | |
3218 RegCloseKey(v11); | |
3219 } | |
3220 RegCloseKey(v10); | |
3221 } | |
3222 RegCloseKey(phkResult); | |
3223 } | |
3224 RegCloseKey(hKey); | |
3225 } | |
3226 return *(int *)Data; | |
3227 } | |
3228 | |
3229 //----- (00464B02) -------------------------------------------------------- | |
3230 void __fastcall WriteWindowsRegistryString(const char *pKey, const char *pString) | |
3231 { | |
3232 size_t v2; // eax@5 | |
3233 const char *lpValueName; // [sp+4h] [bp-1Ch]@1 | |
3234 const char *Str; // [sp+8h] [bp-18h]@1 | |
3235 DWORD dwDisposition; // [sp+Ch] [bp-14h]@2 | |
3236 HKEY hKey; // [sp+10h] [bp-10h]@1 | |
3237 HKEY phkResult; // [sp+14h] [bp-Ch]@1 | |
3238 HKEY v8; // [sp+18h] [bp-8h]@1 | |
3239 HKEY v9; // [sp+1Ch] [bp-4h]@1 | |
3240 | |
3241 Str = pString; | |
3242 lpValueName = pKey; | |
3243 v9 = 0; | |
3244 v8 = 0; | |
3245 hKey = 0; | |
3246 phkResult = 0; | |
3247 if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hKey) ) | |
3248 { | |
3249 if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition) ) | |
3250 { | |
3251 if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v8, &dwDisposition) ) | |
3252 { | |
3253 if ( !RegCreateKeyExA(v8, "1.0", 0, "", 0, 0xF003Fu, 0, &v9, &dwDisposition) ) | |
3254 { | |
3255 v2 = strlen(Str); | |
3256 RegSetValueExA(v9, lpValueName, 0, 1u, (const BYTE *)Str, v2 + 1); | |
3257 RegCloseKey(v9); | |
3258 } | |
3259 RegCloseKey(v8); | |
3260 } | |
3261 RegCloseKey(phkResult); | |
3262 } | |
3263 RegCloseKey(hKey); | |
3264 } | |
3265 } | |
3266 | |
3267 //----- (00464BEF) -------------------------------------------------------- | |
3268 void __fastcall ReadWindowsRegistryString(const char *pKeyName, char *pOutString, int uBufLen, const char *pDefaultValue) | |
3269 { | |
3270 LSTATUS (__stdcall *v4)(HKEY); // esi@1 | |
3271 LSTATUS result; // eax@7 | |
3272 DWORD Type; // [sp+Ch] [bp-24h]@5 | |
3273 LPCSTR lpValueName; // [sp+10h] [bp-20h]@1 | |
3274 DWORD cbData; // [sp+14h] [bp-1Ch]@1 | |
3275 LPBYTE Dest; // [sp+18h] [bp-18h]@1 | |
3276 DWORD dwDisposition; // [sp+1Ch] [bp-14h]@2 | |
3277 HKEY phkResult; // [sp+20h] [bp-10h]@1 | |
3278 HKEY hKey; // [sp+24h] [bp-Ch]@1 | |
3279 HKEY v13; // [sp+28h] [bp-8h]@1 | |
3280 HKEY v14; // [sp+2Ch] [bp-4h]@1 | |
3281 | |
3282 cbData = uBufLen; | |
3283 Dest = (LPBYTE)pOutString; | |
3284 lpValueName = pKeyName; | |
3285 v14 = 0; | |
3286 v13 = 0; | |
3287 hKey = 0; | |
3288 phkResult = 0; | |
3289 v4 = RegCloseKey; | |
3290 if ( RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hKey) | |
3291 || RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition) | |
3292 || RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v13, &dwDisposition) | |
3293 || RegCreateKeyExA(v13, "1.0", 0, "", 0, 0xF003Fu, 0, &v14, &dwDisposition) ) | |
1416 | 3294 { |
3295 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen); | |
3296 } | |
3297 else if ( RegQueryValueExA(v14, lpValueName, 0, &Type, Dest, &cbData) ) | |
0 | 3298 { |
3299 RegCloseKey(v14); | |
3300 v14 = 0; | |
3301 result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen); | |
1416 | 3302 } |
3303 else | |
3304 { | |
3305 v4 = RegCloseKey; | |
3306 RegCloseKey(v14); | |
3307 v14 = 0; | |
3308 RegCloseKey(v13); | |
3309 v13 = 0; | |
3310 RegCloseKey(phkResult); | |
3311 phkResult = 0; | |
3312 result = RegCloseKey(hKey); | |
3313 hKey = 0; | |
3314 } | |
0 | 3315 if ( v14 ) |
3316 result = v4(v14); | |
3317 if ( v13 ) | |
3318 result = v4(v13); | |
3319 if ( hKey ) | |
3320 result = v4(hKey); | |
3321 if ( phkResult ) | |
3322 result = v4(phkResult); | |
3323 } | |
3324 | |
3325 //----- (00464D32) -------------------------------------------------------- | |
3326 void __fastcall WriteWindowsRegistryInt(const char *pKey, int val) | |
3327 { | |
3328 const char *lpValueName; // [sp+4h] [bp-1Ch]@1 | |
3329 BYTE Data[4]; // [sp+8h] [bp-18h]@1 | |
3330 DWORD dwDisposition; // [sp+Ch] [bp-14h]@2 | |
3331 HKEY hKey; // [sp+10h] [bp-10h]@1 | |
3332 HKEY phkResult; // [sp+14h] [bp-Ch]@1 | |
3333 HKEY v7; // [sp+18h] [bp-8h]@1 | |
3334 HKEY v8; // [sp+1Ch] [bp-4h]@1 | |
3335 | |
3336 *(int *)Data = val; | |
3337 lpValueName = pKey; | |
3338 v8 = 0; | |
3339 v7 = 0; | |
3340 hKey = 0; | |
3341 phkResult = 0; | |
3342 if ( !RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hKey) ) | |
3343 { | |
3344 if ( !RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition) ) | |
3345 { | |
3346 if ( !RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v7, &dwDisposition) ) | |
3347 { | |
3348 if ( !RegCreateKeyExA(v7, "1.0", 0, "", 0, 0xF003Fu, 0, &v8, &dwDisposition) ) | |
3349 { | |
2101 | 3350 RegSetValueExA(v8, lpValueName, 0, 4, Data, 4); |
0 | 3351 RegCloseKey(v8); |
3352 } | |
3353 RegCloseKey(v7); | |
3354 } | |
3355 RegCloseKey(phkResult); | |
3356 } | |
3357 RegCloseKey(hKey); | |
3358 } | |
3359 } | |
3360 | |
3361 //----- (00464E17) -------------------------------------------------------- | |
3362 bool __fastcall CheckMM7CD(char c) | |
3363 { | |
3364 char DstBuf[256]; // [sp+Ch] [bp-218h]@1 | |
3365 char strCommand[256]; // [sp+10Ch] [bp-118h]@1 | |
3366 char Filename[20]; // [sp+20Ch] [bp-18h]@1 | |
3367 | |
3368 | |
3369 wchar_t pMagicPath[1024]; | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1150
diff
changeset
|
3370 swprintf(pMagicPath, wcslen(L"%C:\\anims\\magic7.vid"), L"%C:\\anims\\magic7.vid", c); |
0 | 3371 if (GetFileAttributesW(pMagicPath) == -1) |
3372 return false; | |
3373 | |
3374 wsprintfA(strCommand, "open %c: type cdaudio alias CD", c); | |
3375 if (!mciSendStringA(strCommand, DstBuf, 0xFFu, 0)) | |
3376 { | |
3377 wsprintfA(strCommand, "info CD UPC wait"); | |
3378 mciSendStringA(strCommand, DstBuf, 0xFFu, 0); | |
3379 wsprintfA(strCommand, "close CD"); | |
3380 mciSendStringA(strCommand, DstBuf, 0xFFu, 0); | |
3381 } | |
3382 | |
3383 memcpy(Filename, "X:\\anims\\magic7.vid", sizeof(Filename)); | |
3384 *Filename = c; | |
3385 | |
1980 | 3386 FILE* f = fopen(Filename, "rb"); |
0 | 3387 if (!f) |
3388 return false; | |
3389 | |
3390 if (!fseek(f, 0, SEEK_END)) | |
3391 { | |
3392 if (!fseek(f, -100, SEEK_CUR)) | |
3393 fread(DstBuf, 1u, 0x64u, f); | |
3394 | |
3395 fclose(f); | |
3396 return true; | |
3397 } | |
3398 fclose(f); | |
3399 return false; | |
3400 } | |
3401 | |
3402 //----- (00464F1B) -------------------------------------------------------- | |
3403 signed int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4) | |
3404 { | |
3405 char v4; // zf@3 | |
3406 int v6; // eax@10 | |
3407 int v7; // eax@11 | |
3408 int v8; // eax@12 | |
3409 int v9; // eax@13 | |
3410 BOOL (__stdcall *v10)(HWND, int, LPCSTR); // edi@15 | |
3411 const CHAR *v11; // [sp-Ch] [bp-Ch]@15 | |
3412 INT_PTR v12; // [sp-4h] [bp-4h]@5 | |
3413 | |
3414 if ( a2 == 272 ) | |
3415 { | |
3416 hInsertCDWindow = hDlg; | |
3417 v6 = (GetUserDefaultLangID() & 0x3FF) - 7; | |
3418 if ( v6 ) | |
3419 { | |
3420 v7 = v6 - 3; | |
3421 if ( v7 ) | |
3422 { | |
3423 v8 = v7 - 2; | |
3424 if ( v8 ) | |
3425 { | |
3426 v9 = v8 - 4; | |
3427 if ( v9 ) | |
3428 { | |
3429 if ( v9 != 5 ) | |
3430 return 0; | |
3431 SetWindowTextA(hDlg, "Wloz CD-ROM numer 2"); | |
3432 v10 = SetDlgItemTextA; | |
3433 SetDlgItemTextA(hDlg, 1010, "Wloz CD-ROM numer 2 Might and Magic® VII."); | |
3434 v11 = "Odwolaj"; | |
3435 } | |
3436 else | |
3437 { | |
3438 SetWindowTextA(hDlg, "Inserire il secondo CD"); | |
3439 v10 = SetDlgItemTextA; | |
3440 SetDlgItemTextA(hDlg, 1010, "Inserire il secondo CD di Might and Magic® VII."); | |
3441 v11 = "Annulla"; | |
3442 } | |
3443 } | |
3444 else | |
3445 { | |
3446 SetWindowTextA(hDlg, "Insérez le CD 2"); | |
3447 v10 = SetDlgItemTextA; | |
3448 SetDlgItemTextA(hDlg, 1010, "Insérez Might & Magic® VII CD 2."); | |
3449 v11 = "Supprimer"; | |
3450 } | |
3451 } | |
3452 else | |
3453 { | |
3454 SetWindowTextA(hDlg, "Por favor, inserte disco 2"); | |
3455 v10 = SetDlgItemTextA; | |
3456 SetDlgItemTextA(hDlg, 1010, "Por favor, inserte disco 2 de Might & Magic® VII."); | |
3457 v11 = "Cancelar"; | |
3458 } | |
3459 } | |
3460 else | |
3461 { | |
3462 SetWindowTextA(hDlg, "Bitte CD 2 einlegen"); | |
3463 v10 = SetDlgItemTextA; | |
3464 SetDlgItemTextA(hDlg, 1010, "Bitte CD 2 von Might and Magic® VII einlegen."); | |
3465 v11 = "Abbrechen"; | |
3466 } | |
3467 v10(hDlg, 2, v11); | |
3468 return 0; | |
3469 } | |
3470 if ( a2 == 273 ) | |
3471 { | |
3472 if ( a3 == 2 ) | |
3473 { | |
3474 v12 = 0; | |
3475 EndDialog(hDlg, v12); | |
3476 return 1; | |
3477 } | |
3478 v4 = a3 == 1; | |
3479 } | |
3480 else | |
3481 { | |
3482 v4 = a2 == 1025; | |
3483 } | |
3484 if ( v4 ) | |
3485 { | |
3486 v12 = 1; | |
1416 | 3487 EndDialog(hDlg, v12); |
3488 return 1; | |
0 | 3489 } |
3490 return 0; | |
3491 } | |
3492 | |
3493 //----- (00465061) -------------------------------------------------------- | |
3494 bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive) | |
3495 { | |
3496 char drive[4] = {'X', ':', '\\', 0}; | |
3497 | |
3498 bool bGotCDFromRegistry = false; | |
3499 | |
3500 HKEY hSoftware = nullptr, | |
3501 hNWC = nullptr, | |
3502 hMM7 = nullptr, | |
3503 hVersion = nullptr; | |
3504 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hSoftware)) | |
3505 { | |
3506 if (!RegOpenKeyExA(hSoftware, "New World Computing", 0, 0x2001Fu, &hNWC)) | |
3507 { | |
3508 if (!RegOpenKeyExA(hNWC, "Might and Magic VII", 0, 0x2001Fu, &hMM7)) | |
3509 { | |
3510 if (!RegOpenKeyExA(hMM7, "1.0", 0, 0x2001Fu, &hVersion)) | |
3511 { | |
3512 DWORD cbData = 3; | |
3513 if (!RegQueryValueExA(hVersion, "CDDrive", 0, 0, (BYTE *)drive, &cbData)) | |
3514 bGotCDFromRegistry = true; | |
3515 } | |
3516 RegCloseKey(hVersion); | |
3517 } | |
3518 RegCloseKey(hMM7); | |
3519 } | |
3520 RegCloseKey(hNWC); | |
3521 } | |
3522 RegCloseKey(hSoftware); | |
3523 | |
3524 if (bGotCDFromRegistry) | |
3525 if (CheckMM7CD(*drive)) | |
3526 { | |
3527 cMM7GameCDDriveLetter = *drive; | |
3528 return true; | |
3529 } | |
3530 | |
3531 while (true) | |
3532 { | |
3533 for (uint i = 0; i < 26; ++i) | |
3534 { | |
3535 drive[0] = 'A' + i; | |
3536 | |
3537 if (GetDriveTypeA(drive) == DRIVE_CDROM) | |
3538 if (CheckMM7CD(*drive)) | |
3539 { | |
3540 cMM7GameCDDriveLetter = *drive; | |
3541 WriteWindowsRegistryString("CDDrive", drive); | |
3542 return true; | |
3543 } | |
3544 } | |
3545 | |
1802 | 3546 if (DialogBoxParamA(GetModuleHandleW(nullptr), "InsertCD", hWnd, (DLGPROC)InsertMM7CDDialogFunc, 0)) |
0 | 3547 continue; |
3548 return false; | |
3549 } | |
3550 } | |
3551 | |
1655 | 3552 |
3553 | |
0 | 3554 //----- (004651F4) -------------------------------------------------------- |
1655 | 3555 bool MM7_Initialize(int game_width, int game_height) |
0 | 3556 { |
3557 wchar_t pCurrentDir[1024]; | |
3558 _wgetcwd(pCurrentDir, 1024); | |
3559 | |
3560 wchar_t pMM6IniFile[1024]; | |
293 | 3561 wsprintfW(pMM6IniFile, L"%s\\mm6.ini", pCurrentDir); |
0 | 3562 |
3563 bCanLoadFromCD = GetPrivateProfileIntW(L"settings", L"use_cd", 1, pMM6IniFile); | |
3564 if (bNoCD) | |
3565 bCanLoadFromCD = false; | |
3566 if (bCanLoadFromCD) | |
3567 { | |
2151 | 3568 Log::Warning(L"Checking for CD..."); |
1802 | 3569 if (!FindMM7CD(nullptr, &cMM7GameCDDriveLetter)) |
0 | 3570 return false; |
2151 | 3571 Log::Warning(L"...done."); |
0 | 3572 } |
3573 | |
3574 | |
3575 srand(GetTickCount()); | |
1802 | 3576 |
3577 window = OSWindow::Create(L"Might and Magic® Trilogy", game_width, game_height); | |
0 | 3578 |
3579 pRenderer = Render::Create(); | |
3580 if (!pRenderer) | |
3581 { | |
3582 Log::Warning(L"Render creation failed"); | |
3583 return false; | |
3584 } | |
3585 else | |
3586 { | |
2069 | 3587 //bool bWindowMode = ReadWindowsRegistryInt("startinwindow", false); |
1802 | 3588 //uint uDefaultDevice = ReadWindowsRegistryInt("D3D Device", 1); |
0 | 3589 bool bColoredLights = ReadWindowsRegistryInt("Colored Lights", false); |
3590 uint uLevelOfDetail = ReadWindowsRegistryInt("Detail Level", 1); | |
3591 uint bTinting = ReadWindowsRegistryInt("Tinting", 1) != 0; | |
3592 | |
2069 | 3593 if (!pRenderer->Initialize(window, bColoredLights, uLevelOfDetail, bTinting)) |
0 | 3594 { |
3595 Log::Warning(L"Render failed to initialize"); | |
3596 return false; | |
3597 } | |
3598 } | |
492 | 3599 |
351 | 3600 game_starting_year = 1168; |
0 | 3601 |
3602 pParty = new Party; | |
147 | 3603 memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings)); |
0 | 3604 pParty->uWalkSpeed = GetPrivateProfileIntW(L"debug", L"walkspeed", 384, pMM6IniFile); |
3605 pParty->uDefaultEyelevel = GetPrivateProfileIntW(L"party", L"eyelevel", 160, pMM6IniFile); | |
3606 pParty->sEyelevel = pParty->uDefaultEyelevel; | |
3607 pParty->uDefaultPartyHeight = GetPrivateProfileIntW(L"party", L"height", 192, pMM6IniFile); | |
3608 pParty->uPartyHeight = pParty->uDefaultPartyHeight; | |
2151 | 3609 |
0 | 3610 MM6_Initialize(pMM6IniFile); |
3611 | |
3612 pKeyActionMap = new KeyboardActionMapping; | |
3613 | |
3614 pEventTimer = Timer::Create(); | |
3615 pEventTimer->Initialize(); | |
3616 | |
3617 OnTimer(1); | |
3618 GameUI_StatusBar_UpdateTimedString(1); | |
3619 pGame = Game::Create(); | |
3620 pMouse = pGame->pMouseInstance; | |
1655 | 3621 |
0 | 3622 |
3623 pIcons_LOD = new LODFile_IconsBitmaps; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3624 if (!pIcons_LOD->Load("data\\icons.lod", "icons")) |
0 | 3625 { |
2151 | 3626 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.", |
3627 L"Files Missing", MB_ICONEXCLAMATION); | |
0 | 3628 return false; |
3629 } | |
3630 pIcons_LOD->dword_011BA4 = 0; | |
3631 | |
3632 pEvents_LOD = new LODFile_IconsBitmaps; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3633 if (!pEvents_LOD->Load("data\\events.lod", "icons")) |
0 | 3634 { |
2151 | 3635 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.", |
3636 L"Files Missing", MB_ICONEXCLAMATION); | |
0 | 3637 return false; |
3638 } | |
3639 | |
3640 InitializeGameText(); | |
3641 | |
3642 pBitmaps_LOD = new LODFile_IconsBitmaps; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3643 if (!pBitmaps_LOD->Load("data\\bitmaps.lod", "bitmaps")) |
0 | 3644 { |
2151 | 3645 MessageBoxA(nullptr, pGlobalTXT_LocalizationStrings[63], |
3646 pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION); | |
0 | 3647 return false; |
3648 } | |
3649 | |
3650 pSprites_LOD = new LODFile_Sprites; | |
2151 | 3651 if (!pSprites_LOD->LoadSprites("data\\sprites.lod")) |
0 | 3652 { |
3653 MessageBoxA(nullptr, | |
3654 pGlobalTXT_LocalizationStrings[63], | |
3655 pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION); | |
3656 return false; | |
3657 } | |
3658 | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3659 |
1543 | 3660 #if 0 |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3661 if (_access("../MM_VI/data/icons.lod", 0) == 0) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3662 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3663 pIcons_LOD_mm6 = new LODFile_IconsBitmaps; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3664 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
|
3665 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3666 delete pIcons_LOD_mm6; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3667 pIcons_LOD_mm6 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3668 Log::Warning(L"Unable to load mm6:icons.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3669 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3670 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3671 else |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3672 Log::Warning(L"Unable to find mm6:icons.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3673 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3674 if (_access("../MM_VI/data/bitmaps.lod", 0) == 0) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3675 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3676 pBitmaps_LOD_mm6 = new LODFile_IconsBitmaps; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3677 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
|
3678 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3679 delete pBitmaps_LOD_mm6; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3680 pBitmaps_LOD_mm6 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3681 Log::Warning(L"Unable to load mm6:bitmaps.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3682 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3683 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3684 else |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3685 Log::Warning(L"Unable to find mm6:bitmaps.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3686 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3687 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
|
3688 : "../MM_VI/data/sprites.lod"; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3689 if (_access(mm6_sprite_container_name, 0) == 0) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3690 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3691 pSprites_LOD_mm6 = new LODFile_Sprites; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3692 if (!pSprites_LOD_mm6->LoadSprites(mm6_sprite_container_name)) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3693 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3694 delete pSprites_LOD_mm6; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3695 pSprites_LOD_mm6 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3696 Log::Warning(L"Unable to load mm6:sprites.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3697 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3698 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3699 else |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3700 Log::Warning(L"Unable to find mm6:sprites.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3701 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3702 |
1541 | 3703 if (_access("../mm8/data/icons.lod", 0) == 0) |
3704 { | |
3705 pIcons_LOD_mm8 = new LODFile_IconsBitmaps; | |
3706 if (!pIcons_LOD_mm8->Load("../mm8/data/icons.lod", "icons")) | |
3707 { | |
3708 delete pIcons_LOD_mm8; | |
3709 pIcons_LOD_mm8 = nullptr; | |
3710 Log::Warning(L"Unable to load mm8:icons.lod"); | |
3711 } | |
0 | 3712 } |
3713 else | |
1541 | 3714 Log::Warning(L"Unable to find mm8:icons.lod"); |
3715 | |
3716 | |
3717 if (_access("../mm8/data/bitmaps.lod", 0) == 0) | |
3718 { | |
3719 pBitmaps_LOD_mm8 = new LODFile_IconsBitmaps; | |
3720 if (!pBitmaps_LOD_mm8->Load("../mm8/data/bitmaps.lod", "bitmaps")) | |
3721 { | |
3722 delete pBitmaps_LOD_mm8; | |
3723 pBitmaps_LOD_mm8 = nullptr; | |
3724 Log::Warning(L"Unable to load mm8:bitmaps.lod"); | |
3725 } | |
3726 } | |
3727 else | |
3728 Log::Warning(L"Unable to find mm8:bitmaps.lod"); | |
3729 | |
3730 | |
3731 if (_access("../mm8/data/sprites.lod", 0) == 0) | |
3732 { | |
3733 pSprites_LOD_mm8 = new LODFile_Sprites; | |
3734 if (!pSprites_LOD_mm8->LoadSprites("../mm8/data/sprites.lod")) | |
3735 { | |
3736 delete pSprites_LOD_mm8; | |
3737 pSprites_LOD_mm8 = nullptr; | |
3738 Log::Warning(L"Unable to load mm8:sprites.lod"); | |
3739 } | |
3740 } | |
3741 else | |
3742 Log::Warning(L"Unable to find mm8:sprites.lod"); | |
1543 | 3743 #endif |
1541 | 3744 |
0 | 3745 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3746 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
|
3747 *sft_mm8 = nullptr; |
2151 | 3748 void *sft_mm7 = pEvents_LOD->LoadRaw("dsft.bin", 1); |
0 | 3749 pSpriteFrameTable = new SpriteFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3750 pSpriteFrameTable->FromFile(sft_mm6, sft_mm7, sft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3751 free(sft_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3752 free(sft_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3753 free(sft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3754 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3755 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
|
3756 *tft_mm8 = nullptr; |
2151 | 3757 void *tft_mm7 = pEvents_LOD->LoadRaw("dtft.bin", 1); |
0 | 3758 pTextureFrameTable = new TextureFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3759 pTextureFrameTable->FromFile(tft_mm6, tft_mm7, tft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3760 free(tft_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3761 free(tft_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3762 free(tft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3763 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3764 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
|
3765 *tiles_mm8 = nullptr; |
2151 | 3766 void *tiles_mm7 = pEvents_LOD->LoadRaw("dtile.bin", 1); |
0 | 3767 pTileTable = new TileTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3768 pTileTable->FromFile(tiles_mm6, tiles_mm7, tiles_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3769 free(tiles_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3770 free(tiles_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3771 free(tiles_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3772 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3773 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
|
3774 *pft_mm8 = nullptr; |
2151 | 3775 void *pft_mm7 = pEvents_LOD->LoadRaw("dpft.bin", 1); |
0 | 3776 pPlayerFrameTable = new PlayerFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3777 pPlayerFrameTable->FromFile(pft_mm6, pft_mm7, pft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3778 free(pft_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3779 free(pft_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3780 free(pft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3781 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3782 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
|
3783 *ift_mm8 = nullptr; |
2151 | 3784 void *ift_mm7 = pEvents_LOD->LoadRaw("dift.bin", 1); |
0 | 3785 pIconsFrameTable = new IconFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3786 pIconsFrameTable->FromFile(ift_mm6, ift_mm7, ift_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3787 free(ift_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3788 free(ift_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3789 free(ift_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3790 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3791 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
|
3792 *decs_mm8 = nullptr; |
2151 | 3793 void *decs_mm7 = pEvents_LOD->LoadRaw("ddeclist.bin", 1); |
0 | 3794 pDecorationList = new DecorationList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3795 pDecorationList->FromFile(decs_mm6, decs_mm7, decs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3796 free(decs_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3797 free(decs_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3798 free(decs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3799 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3800 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
|
3801 *objs_mm8 = nullptr; |
2151 | 3802 void *objs_mm7 = pEvents_LOD->LoadRaw("dobjlist.bin", 1); |
0 | 3803 pObjectList = new ObjectList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3804 pObjectList->FromFile(objs_mm6, objs_mm7, objs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3805 free(objs_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3806 free(objs_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3807 free(objs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3808 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3809 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
|
3810 *mons_mm8 = nullptr; |
2151 | 3811 void *mons_mm7 = pEvents_LOD->LoadRaw("dmonlist.bin", 1); |
0 | 3812 pMonsterList = new MonsterList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3813 pMonsterList->FromFile(mons_mm6, mons_mm7, mons_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3814 free(mons_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3815 free(mons_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3816 free(mons_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3817 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3818 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
|
3819 *chests_mm8 = nullptr; |
2151 | 3820 void *chests_mm7 = pEvents_LOD->LoadRaw("dchest.bin", 1); |
0 | 3821 pChestList = new ChestList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3822 pChestList->FromFile(chests_mm6, chests_mm7, chests_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3823 free(chests_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3824 free(chests_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3825 free(chests_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3826 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3827 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
|
3828 *overlays_mm8 = nullptr; |
2151 | 3829 void *overlays_mm7 = pEvents_LOD->LoadRaw("doverlay.bin", 1); |
0 | 3830 pOverlayList = new OverlayList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3831 pOverlayList->FromFile(overlays_mm6, overlays_mm7, overlays_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3832 free(overlays_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3833 free(overlays_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3834 free(overlays_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3835 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3836 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
|
3837 *sounds_mm8 = nullptr; |
2151 | 3838 void *sounds_mm7 = pEvents_LOD->LoadRaw("dsounds.bin", 1); |
0 | 3839 pSoundList = new SoundList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3840 pSoundList->FromFile(sounds_mm6, sounds_mm7, sounds_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3841 free(sounds_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3842 free(sounds_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
3843 free(sounds_mm8); |
0 | 3844 } |
3845 | |
3846 | |
3847 | |
492 | 3848 |
2069 | 3849 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_RUN_IN_WIDOW) |
0 | 3850 { |
2069 | 3851 //window->SetWindowedMode(game_width, game_height); |
3852 pRenderer->SwitchToWindow(); | |
0 | 3853 } |
3854 else | |
3855 { | |
2069 | 3856 __debugbreak(); // Nomad |
3857 window->SetFullscreenMode(); | |
3858 pRenderer->InitializeFullscreen(); | |
0 | 3859 } |
2151 | 3860 |
3861 uSoundVolumeMultiplier = min(9, ReadWindowsRegistryInt("soundflag", 9)); | |
3862 uMusicVolimeMultiplier = min(9, ReadWindowsRegistryInt("musicflag", 9)); | |
3863 uVoicesVolumeMultiplier = min(9, ReadWindowsRegistryInt("CharVoices", 9)); | |
0 | 3864 bShowDamage = ReadWindowsRegistryInt("ShowDamage", 1) != 0; |
2151 | 3865 |
3866 uGammaPos = min(4, ReadWindowsRegistryInt("GammaPos", 4)); | |
0 | 3867 pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6); |
3868 | |
3869 if ( ReadWindowsRegistryInt("Bloodsplats", 1) ) | |
591 | 3870 pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS; |
0 | 3871 else |
733 | 3872 pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS; |
0 | 3873 |
3874 uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0); | |
3875 | |
3876 if (!bNoSound) | |
1802 | 3877 pAudioPlayer->Initialize(); |
0 | 3878 |
1262 | 3879 pVideoPlayer = new VideoPlayer(); |
1802 | 3880 pVideoPlayer->Initialize(window); |
0 | 3881 |
2061 | 3882 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000; |
0 | 3883 |
3884 switch ( uTurnSpeed ) | |
3885 { | |
731 | 3886 case 0: // undefined turn option |
1067 | 3887 __debugbreak(); // really shouldn't use this mode |
731 | 3888 uTurnSpeed = (unsigned int)uCPUSpeed < 199 ? 128 : 64; // adjust turn speed to estimated fps |
3889 break; | |
3890 | |
3891 case 1u: // 16x | |
3892 Log::Warning(L"x16 Turn Speed"); // really shouldn't use this mode | |
0 | 3893 uTurnSpeed = 128; |
731 | 3894 break; |
3895 | |
3896 case 2u: // 32x | |
3897 Log::Warning(L"x32 Turn Speed"); // really shouldn't use this mode | |
0 | 3898 uTurnSpeed = 64; |
731 | 3899 break; |
3900 | |
3901 case 3u: // smooth | |
0 | 3902 uTurnSpeed = 0; |
731 | 3903 break; |
3904 } | |
3905 | |
0 | 3906 return true; |
3907 } | |
3908 | |
3909 //----- (00465D0B) -------------------------------------------------------- | |
1802 | 3910 void SecondaryInitialization() |
0 | 3911 { |
2151 | 3912 //__int16 v4; // ax@4 |
3913 //signed int v5; // esi@5 | |
3914 //int v6; // ecx@6 | |
3915 //int v7; // edx@7 | |
3916 //ObjectDesc *v8; // eax@7 | |
3917 //char pContainer[32]; // [sp+10h] [bp-Ch]@9 | |
0 | 3918 |
1802 | 3919 pMouse->Initialize(window); |
0 | 3920 |
3921 pItemsTable = new ItemsTable; | |
3922 pItemsTable->Initialize(); | |
3923 | |
2154 | 3924 //pBitmaps_LOD->can_load_hardware_sprites = 1; |
2069 | 3925 //pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
3926 pBitmaps_LOD->SetupPalettes(5, 6, 5); | |
3927 //pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | |
3928 pIcons_LOD->SetupPalettes(5, 6, 5); | |
3929 //pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | |
3930 pPaletteManager->SetColorChannelInfo(5, 6, 5); | |
762 | 3931 |
3932 pPaletteManager->SetMistColor(128, 128, 128); | |
0 | 3933 pPaletteManager->RecalculateAll(); |
2154 | 3934 //pSprites_LOD->can_load_hardware_sprites = 1; |
0 | 3935 pObjectList->InitializeSprites(); |
3936 pOverlayList->InitializeSprites(); | |
3937 if (!bNoSound) | |
3938 pSoundList->Initialize(); | |
3939 | |
3940 | |
3941 for (uint i = 0; i < 4; ++i) | |
3942 { | |
2151 | 3943 static const char *pUIAnimNames[4] = |
3944 { | |
3945 "glow03", "glow05", | |
3946 "torchA", "wizeyeA" | |
3947 }; | |
3948 static unsigned short _4E98D0[4][4] = | |
3949 { | |
3950 {479, 0, 329, 0}, | |
3951 {585, 0, 332, 0}, | |
3952 {468, 0, 0, 0}, | |
3953 {606, 0, 0, 0} | |
3954 }; | |
3955 | |
0 | 3956 pUIAnims[i]->uIconID = pIconsFrameTable->FindIcon(pUIAnimNames[i]); |
3957 pIconsFrameTable->InitializeAnimation(pUIAnims[i]->uIconID); | |
3958 | |
3959 pUIAnims[i]->uAnimLength = 0; | |
3960 pUIAnims[i]->uAnimTime = 0; | |
3961 pUIAnims[i]->x = _4E98D0[i][0]; | |
3962 pUIAnims[i]->y = _4E98D0[i][2]; | |
3963 } | |
3964 | |
2151 | 3965 for (unsigned int i = 0; i < pObjectList->uNumObjects; ++i) |
0 | 3966 { |
2151 | 3967 pObjectList->pObjects[i].uParticleTrailColor = pObjectList->pObjects[i].uParticleTrailColorB | |
3968 ((unsigned int)pObjectList->pObjects[i].uParticleTrailColorG << 8) | | |
3969 ((unsigned int)pObjectList->pObjects[i].uParticleTrailColorR << 16); | |
0 | 3970 } |
2151 | 3971 |
0 | 3972 MainMenuUI_Create(); |
3973 pGame->pStru6Instance->LoadAnimations(); | |
3974 | |
3975 for (uint i = 0; i < 7; ++i) | |
3976 { | |
2151 | 3977 char container_name[64]; |
3978 sprintf(container_name, "HDWTR%03u", i); | |
3979 pRenderer->pHDWaterBitmapIDs[i] = pBitmaps_LOD->LoadTexture(container_name); | |
0 | 3980 } |
3981 | |
3982 pNPCStats = new NPCStats; | |
110 | 3983 memset(pNPCStats->pNPCData, 0, 0x94BCu); |
0 | 3984 pNPCStats->Initialize(); |
3985 | |
3986 Initialize_GlobalEVT(); | |
762 | 3987 pBitmaps_LOD->_inlined_sub0(); |
3988 pSprites_LOD->_inlined_sub0(); | |
0 | 3989 pPaletteManager->LockAll(); |
3990 | |
3991 _mkdir("Saves"); | |
3992 for (uint i = 0; i < 5; ++i) | |
3993 for (uint j = 0; j < 6; ++j) | |
3994 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
3995 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
|
3996 remove(pTmpBuf.data()); |
0 | 3997 } |
3998 | |
3999 Initialize_GamesLOD_NewLOD(); | |
1051 | 4000 _576E2C_current_minimap_zoom = 512; |
0 | 4001 dword_576E28 = 9; |
4002 } | |
4003 | |
522 | 4004 void IntegrityTest() |
4005 { | |
1869
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4006 static_assert(sizeof(MovieHeader) == 44, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4007 static_assert(sizeof(SoundDesc_mm6) == 112, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4008 static_assert(sizeof(SoundDesc) == 120, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4009 static_assert(sizeof(OverlayDesc) == 8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4010 static_assert(sizeof(ChestDesc) == 36, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4011 static_assert(sizeof(ObjectDesc_mm6) == 52, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4012 static_assert(sizeof(ObjectDesc) == 56, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4013 static_assert(sizeof(DecorationDesc) == 84, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4014 static_assert(sizeof(IconFrame) == 32, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4015 static_assert(sizeof(PlayerFrame) == 10, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4016 static_assert(sizeof(TextureFrame) == 20, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4017 static_assert(sizeof(SpriteFrame) == 60, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4018 static_assert(sizeof(RenderVertexSoft) == 0x30, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4019 static_assert(sizeof(RenderBillboard) == 0x34, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4020 static_assert(sizeof(Texture) == 0x48, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4021 static_assert(sizeof(RGBTexture) == 0x28, "Wrong type size"); |
2154 | 4022 //static_assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4, "Wrong type size"); // + virtual dtor ptr |
1869
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4023 static_assert(sizeof(AudioPlayer) == 0xC84, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4024 static_assert(sizeof(SoundDesc) == 0x78, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4025 static_assert(sizeof(stru339_spell_sound) == 0xAFD8, "Wrong type size"); |
2137
d24ee391fd1f
libavcodec playing movies and houses, loops not working yet
zipi
parents:
2135
diff
changeset
|
4026 //static_assert(sizeof(VideoPlayer) == 0x108 + 4, "Wrong type size"); |
1869
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4027 static_assert(sizeof(MovieHeader) == 0x2C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4028 static_assert(sizeof(DecorationDesc) == 0x54, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4029 static_assert(sizeof(ObjectDesc) == 0x38, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4030 static_assert(sizeof(OverlayDesc) == 0x8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4031 static_assert(sizeof(ChestDesc) == 0x24, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4032 static_assert(sizeof(TileDesc) == 0x1A, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4033 static_assert(sizeof(MonsterDesc_mm6) == 148, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4034 static_assert(sizeof(MonsterDesc) == 152, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4035 static_assert(sizeof(Timer) == 0x28, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4036 static_assert(sizeof(OtherOverlay) == 0x14, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4037 static_assert(sizeof(ItemGen) == 0x24, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4038 static_assert(sizeof(SpriteObject) == 0x70, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4039 static_assert(sizeof(ItemDesc) == 0x30, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4040 static_assert(sizeof(ItemsTable) == 0x117A0, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4041 static_assert(sizeof(Chest) == 0x14CC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4042 static_assert(sizeof(MapInfo) == 0x44, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4043 static_assert(sizeof(SpellInfo) == 0x24, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4044 static_assert(sizeof(SpellData) == 0x14, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4045 static_assert(sizeof(SpellBuff) == 0x10, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4046 static_assert(sizeof(AIDirection) == 0x1C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4047 static_assert(sizeof(ActorJob) == 0xC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4048 static_assert(sizeof(Actor) == 0x344, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4049 static_assert(sizeof(LevelDecoration) == 0x20, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4050 static_assert(sizeof(KeyboardActionMapping) == 0x20C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4051 static_assert(sizeof(UIAnimation) == 0xD, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4052 static_assert(sizeof(SpawnPointMM7) == 0x18, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4053 static_assert(sizeof(ODMFace) == 0x134, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4054 static_assert(sizeof(BSPNode) == 0x8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4055 static_assert(sizeof(BSPModel) == 0xBC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4056 static_assert(sizeof(OutdoorLocation) == 0x1C28C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4057 static_assert(sizeof(BLVFace) == 0x60, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4058 static_assert(sizeof(BLVFaceExtra) == 0x24, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4059 static_assert(sizeof(BLVSector) == 0x74, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4060 static_assert(sizeof(BLVLightMM7) == 0x10, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4061 static_assert(sizeof(BLVDoor) == 0x50, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4062 static_assert(sizeof(IndoorLocation) == 0x690, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4063 //static_assert(sizeof(ODMRenderParams) == 0x74, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4064 static_assert(sizeof(Mouse) == 0x114, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4065 static_assert(sizeof(Particle_sw) == 0x68, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4066 static_assert(sizeof(Particle) == 0x68, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4067 static_assert(sizeof(ParticleEngine) == 0xE430, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4068 static_assert(sizeof(Lightmap) == 0xC1C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4069 static_assert(sizeof(LightmapBuilder) == 0x3CBC38, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4070 static_assert(sizeof(Vis_SelectionList) == 0x2008, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4071 static_assert(sizeof(Vis) == 0x20D0, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4072 static_assert(sizeof(PlayerBuffAnim) == 0x10, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4073 static_assert(sizeof(ProjectileAnim) == 0x1C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4074 static_assert(sizeof(stru6) == 0x5F8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4075 static_assert(sizeof(IndoorCameraD3D_Vec3) == 0x10, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4076 static_assert(sizeof(IndoorCameraD3D_Vec4) == 0x18, "Wrong type size"); //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 |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4077 //static_assert(sizeof(IndoorCameraD3D) == 0x1A1384, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4078 static_assert(sizeof(StationaryLight) == 0xC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4079 static_assert(sizeof(LightsStack_StationaryLight_) == 0x12C8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4080 static_assert(sizeof(MobileLight) == 0x12, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4081 static_assert(sizeof(LightsStack_MobileLight_) == 0x1C28, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4082 static_assert(sizeof(Game) == 0xE78, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4083 static_assert(sizeof(stru141_actor_collision_object) == 0xA8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4084 static_assert(sizeof(ActionQueue) == 0x7C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4085 static_assert(sizeof(NPCData) == 0x4C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4086 static_assert(sizeof(NPCStats) == 0x17FFC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4087 static_assert(sizeof(BspRenderer) == 0x53740, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4088 static_assert(sizeof(PaletteManager) == 0x267AF0, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4089 static_assert(sizeof(ViewingParams) == 0x26C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4090 //static_assert(sizeof(IndoorCamera) == 0x50, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4091 static_assert(sizeof(Bloodsplat) == 0x28, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4092 static_assert(sizeof(BloodsplatContainer) == 0xA0C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4093 static_assert(sizeof(TrailParticle) == 0x18, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4094 static_assert(sizeof(EventIndex) == 0xC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4095 static_assert(sizeof(_2devent) == 0x34, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4096 static_assert(sizeof(stru176) == 0x20, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4097 static_assert(sizeof(SavegameHeader) == 0x64, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4098 static_assert(sizeof(SavegameList) == 0x3138, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4099 static_assert(sizeof(StorylineText) == 0x160, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4100 static_assert(sizeof(FactionTable) == 0x1EF1, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4101 static_assert(sizeof(Decal) == 0xC20, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4102 static_assert(sizeof(DecalBuilder) == 0x30C038, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4103 static_assert(sizeof(MonsterInfo) == 0x58, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4104 static_assert(sizeof(MonsterStats) == 0x5BA0, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4105 static_assert(sizeof(RenderD3D) == 0x148, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4106 // static_assert(sizeof(Render) == 0x129844, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4107 static_assert(sizeof(Player) == 0x1B3C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4108 static_assert(sizeof(PartyTimeStruct) == 0x678, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4109 static_assert(sizeof(Party) == 0x16238, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4110 static_assert(sizeof(GUIButton) == 0xBC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4111 static_assert(sizeof(GUIWindow) == 0x54, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4112 static_assert(sizeof(GUIProgressBar) == 0x1B8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4113 static_assert(sizeof(GUIFont) == 0x1020, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4114 // static_assert(sizeof(stru262_TurnBased) == 0x40, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4115 static_assert(sizeof(ArcomageGame) == 0xFB, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4116 static_assert(sizeof(CastSpellInfo) == 0x14, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4117 static_assert(sizeof(ArcomageCard) == 0x6C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4118 static_assert(sizeof(stru320) == 0x3FC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4119 static_assert(sizeof(TravelInfo) == 0x20, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4120 static_assert(sizeof(stru336) == 0x798, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4121 static_assert(sizeof(Vec3_short_) == 6, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4122 static_assert(sizeof(BLVFace) == 96, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4123 static_assert(sizeof(BLVFaceExtra) == 36, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4124 static_assert(sizeof(BLVSector) == 116, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4125 static_assert(sizeof(LevelDecoration) == 32, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4126 static_assert(sizeof(BLVLightMM7) == 16, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4127 static_assert(sizeof(BSPNode) == 8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4128 static_assert(sizeof(SpawnPointMM7) == 24, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4129 static_assert(sizeof(DDM_DLV_Header) == 40, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4130 static_assert(sizeof(Actor) == 836, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4131 static_assert(sizeof(SpriteObject) == 112, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4132 static_assert(sizeof(Chest) == 5324, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4133 static_assert(sizeof(stru123) == 0xC8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4134 static_assert(sizeof(BLVMapOutline) == 12, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
4135 static_assert(sizeof(LODSprite) == 0x28, "Wrong type size"); |
522 | 4136 } |
4137 | |
168 | 4138 bool new_sky = false; |
1765 | 4139 bool new_draw_object_dist = true; |
2128 | 4140 bool change_seasons = false; |
894 | 4141 bool all_magic = true; |
1511 | 4142 bool wizard_eye = false; |
1837 | 4143 bool debug_information = false; |
4144 bool show_picked_face = false; | |
1507 | 4145 bool draw_debug_line = false; |
2173 | 4146 bool new_speed = true; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2042
diff
changeset
|
4147 int max_flight_height = 4000; |
2034 | 4148 |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2035
diff
changeset
|
4149 |
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2035
diff
changeset
|
4150 |
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2035
diff
changeset
|
4151 |
0 | 4152 //----- (00462C94) -------------------------------------------------------- |
4153 bool MM_Main(const wchar_t *pCmdLine) | |
4154 { | |
522 | 4155 IntegrityTest(); |
1706 | 4156 |
246 | 4157 char test[1024]; |
522 | 4158 sprintfex(test, "^Pi[%s]: çíàõàð^R[ü;êà;]", "Çîëòàí"); |
4159 | |
2052 | 4160 lua = new LuaVM; |
4161 lua->Initialize(); | |
2031 | 4162 |
1052 | 4163 bool bNoMargareth = false; |
0 | 4164 if (pCmdLine && *pCmdLine) |
4165 { | |
2061 | 4166 //if (wcsstr(pCmdLine, L"-usedefs")) |
4167 // bDebugResouces = 1; | |
0 | 4168 if (wcsstr(pCmdLine, L"-window")) |
2061 | 4169 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW; |
0 | 4170 |
4171 if (wcsstr(pCmdLine, L"-nointro")) | |
4172 bNoIntro = true;//dword_6BE364_game_settings_1 |= 4; | |
4173 if (wcsstr(pCmdLine, L"-nologo")) | |
4174 bNoLogo = true;//dword_6BE364_game_settings_1 |= 8; | |
4175 if (wcsstr(pCmdLine, L"-nosound")) | |
4176 bNoSound = true; //dword_6BE364_game_settings_1 |= 0x10; | |
4177 | |
4178 bWalkSound = ReadWindowsRegistryInt("WalkSound", 1) != 0; | |
4179 if (wcsstr(pCmdLine, L"-nowalksound")) | |
4180 bWalkSound = false;//dword_6BE364_game_settings_1 |= 0x20; | |
256 | 4181 if (wcsstr(pCmdLine, L"-novideo")) |
0 | 4182 { |
2061 | 4183 dword_6BE364_game_settings_1 |= GAME_SETTINGS_NO_HOUSE_ANIM; |
0 | 4184 bNoVideo = true; |
4185 } | |
4186 if (wcsstr(pCmdLine, L"-nocd")) | |
4187 bNoCD = true; | |
168 | 4188 if (wcsstr(pCmdLine, L"-new_sky")) |
4189 new_sky = true; | |
1052 | 4190 if (wcsstr(pCmdLine, L"-nomarg")) |
4191 bNoMargareth = true; | |
0 | 4192 } |
4193 | |
4194 | |
731 | 4195 /*v8 = _4AC1C9_get_cpu_speed(0, (Vec4_int_ *)a2); |
0 | 4196 Rect.left = *(int *)v8; |
4197 Rect.top = *(int *)(v8 + 4); | |
4198 Rect.right = *(int *)(v8 + 8); | |
4199 Rect.bottom = *(int *)(v8 + 12); | |
731 | 4200 uCPUSpeed = Rect.bottom;*/ |
4201 uCPUSpeed = 2048; // about 2GHz | |
4 | 4202 |
2035 | 4203 //constructors(); |
4 | 4204 |
1655 | 4205 if (!MM7_Initialize(640, 480)) |
734 | 4206 { |
4207 Log::Warning(L"MM init: failed"); | |
4208 pGame->Deinitialize(); | |
4209 return 1; | |
4210 } | |
0 | 4211 |
4212 pEventTimer->Pause(); | |
1397 | 4213 |
373 | 4214 SetUserInterface(PartyAlignment_Neutral, false); |
0 | 4215 ShowIntroVideo_and_LoadingScreen(); |
4216 WriteWindowsRegistryInt("Ran once", 1); | |
2061 | 4217 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000; |
0 | 4218 pGame->InitializeGammaController(); |
4219 SecondaryInitialization(); | |
1541 | 4220 pRenderer->SetRasterClipRect(0, 0, 639, 479); |
0 | 4221 FinalInitialization(); |
4222 | |
4223 Log::Warning(L"MM: entering main loop"); | |
4224 while ( 1 ) | |
4225 { | |
1980 | 4226 MainMenuWindow* main_menu_window = MainMenuWindow::Create(); |
1815 | 4227 window->AddControl(main_menu_window); |
4228 | |
165 | 4229 MainMenu_Loop(); |
982 | 4230 uGameState = GAME_STATE_PLAYING; |
0 | 4231 while ( 1 ) |
4232 { | |
2098 | 4233 if (uGameState == GAME_FINISHED || GetCurrentMenuID() == MENU_EXIT_GAME) |
982 | 4234 { |
4235 pGame->Deinitialize(); | |
4236 return true; | |
4237 } | |
4238 | |
165 | 4239 if (GetCurrentMenuID() == MENU_NEWGAME) |
0 | 4240 { |
4241 if ( pAudioPlayer->hAILRedbook ) | |
165 | 4242 AIL_redbook_stop(pAudioPlayer->hAILRedbook); |
4243 pParty->Reset(); | |
783 | 4244 pOtherOverlayList->Reset(); |
4245 | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4246 strcpy(pCurrentMapName, pStartingMapName); |
165 | 4247 pParty->CreateDefaultParty(0); |
0 | 4248 PlayerCreationUI_Initialize(); |
165 | 4249 if ( PlayerCreationUI_Loop() ) |
0 | 4250 { |
4251 DeleteCCharFont(); | |
165 | 4252 break; |
0 | 4253 } |
4254 DeleteCCharFont(); | |
4255 bFlashQuestBook = true; | |
1397 | 4256 PlayFullscreenMovie(MOVIE_Emerald); |
4257 //pGame->pCShow->PlayMovie(MOVIE_Emerald, 0); | |
837 | 4258 SaveNewGame(); |
1052 | 4259 |
4260 if (bNoMargareth) | |
4261 _449B7E_toggle_bit(pParty->_quest_bits, PARTY_QUEST_EMERALD_MARGARETH_OFF, 1); | |
165 | 4262 pGame->Loop(); |
982 | 4263 |
4264 if (uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU) | |
165 | 4265 { |
4266 SetCurrentMenuID(MENU_NEWGAME); | |
982 | 4267 uGameState = GAME_STATE_PLAYING; |
165 | 4268 continue; |
4269 } | |
982 | 4270 else if (uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU) |
4271 break; | |
4272 | |
4273 assert(false && "Invalid game state"); | |
165 | 4274 } |
4275 if (GetCurrentMenuID() == MENU_CREDITS) | |
0 | 4276 { |
4277 if ( pAudioPlayer->hAILRedbook ) | |
165 | 4278 AIL_redbook_stop(pAudioPlayer->hAILRedbook); |
1033 | 4279 MainMenuUI_Credits_Loop(); |
0 | 4280 break; |
4281 } | |
961 | 4282 if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu) |
2 | 4283 { |
982 | 4284 uGameState = GAME_STATE_PLAYING; |
1416 | 4285 pGame->Loop(); |
2 | 4286 } |
4 | 4287 else |
961 | 4288 { |
1458 | 4289 if (GetCurrentMenuID() == MENU_DebugBLVLevel) |
1416 | 4290 { |
4291 pMouse->Activate(0); | |
4292 | |
4293 pParty->Reset(); | |
4294 pParty->CreateDefaultParty(1); | |
1545 | 4295 |
4296 __debugbreak(); | |
4297 /*extern void CreateDefaultBLVLevel(); | |
1458 | 4298 CreateDefaultBLVLevel(); |
4299 | |
1545 | 4300 OPENFILENAMEA ofn; |
1416 | 4301 if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) |
4302 { | |
4303 pMouse->Activate(1); | |
4304 break; | |
4305 } | |
4306 _chdir("..\\"); | |
1545 | 4307 strcpy(pCurrentMapName, ofn.lpstrFileTitle);*/ |
1416 | 4308 pMouse->Activate(1); |
4309 pGame->Loop(); | |
4310 } | |
492 | 4311 } |
1214
0d6c7ff3cddd
simplified stru193_math constructor and class definition
Grumpy7
parents:
1205
diff
changeset
|
4312 if ( uGameState == GAME_STATE_LOADING_GAME ) |
961 | 4313 { |
982 | 4314 SetCurrentMenuID(MENU_5); |
4315 uGameState = GAME_STATE_PLAYING; | |
0 | 4316 continue; |
961 | 4317 } |
165 | 4318 if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU ) |
101 | 4319 { |
4320 SetCurrentMenuID(MENU_NEWGAME); | |
982 | 4321 uGameState = GAME_STATE_PLAYING; |
0 | 4322 continue; |
101 | 4323 } |
907 | 4324 if ( uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU)// from the loaded game |
4325 { | |
0 | 4326 pAudioPlayer->StopChannels(-1, -1); |
982 | 4327 uGameState = GAME_STATE_PLAYING; |
0 | 4328 break; |
907 | 4329 } |
0 | 4330 } |
4331 if (!bNoSound && pAudioPlayer->hAILRedbook) | |
4332 { | |
328 | 4333 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); |
0 | 4334 AIL_redbook_stop(pAudioPlayer->hAILRedbook); |
1541 | 4335 unsigned int startms, end_ms; |
0 | 4336 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 0xE, &startms, &end_ms); |
4337 AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms); | |
4338 } | |
4339 } | |
2050 | 4340 //lua_close(L); |
0 | 4341 pGame->Deinitialize(); |
734 | 4342 return 1; |
0 | 4343 } |
4344 | |
4345 //----- (004637E0) -------------------------------------------------------- | |
1458 | 4346 char sub_4637E0_is_there_popup_onscreen() |
0 | 4347 { |
4348 return dword_507BF0_is_there_popup_onscreen == 1; | |
4349 } | |
4350 // 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen; | |
4351 | |
4352 //----- (00466082) -------------------------------------------------------- | |
4353 void MM6_Initialize(const wchar_t *pIniFilename) | |
4354 { | |
4355 //int v0; // eax@1 | |
2151 | 4356 //UINT v1; // eax@18 |
0 | 4357 size_t v2; // eax@31 |
4358 size_t v3; // ebx@32 | |
4359 size_t v4; // edi@36 | |
4360 //char v5[120]; // [sp+Ch] [bp-17Ch]@1 | |
4361 //char String[120]; // [sp+84h] [bp-104h]@32 | |
4362 char pDefaultGroundTexture[16]; // [sp+FCh] [bp-8Ch]@32 | |
4363 //char pIniFilename[120]; // [sp+10Ch] [bp-7Ch]@1 | |
4364 unsigned int v9; // [sp+184h] [bp-4h]@28 | |
4365 | |
4366 //_getcwd(v5, 120); | |
4367 //sprintfex(pIniFilename, "%s\\mm6.ini", v5); | |
4368 viewparams = new ViewingParams; | |
819 | 4369 game_viewport_x = viewparams->uScreen_topL_X = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename); |
4370 game_viewport_y = viewparams->uScreen_topL_Y = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename); | |
4371 game_viewport_z = viewparams->uScreen_BttmR_X = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename); | |
4372 game_viewport_w = viewparams->uScreen_BttmR_Y = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename); | |
4373 game_viewport_width = game_viewport_z - game_viewport_x; | |
4374 game_viewport_height = game_viewport_w - game_viewport_y + 1; | |
0 | 4375 |
4376 | |
4377 pAudioPlayer = new AudioPlayer; | |
4378 pAudioPlayer->uMixerChannels = GetPrivateProfileIntW(L"settings", L"mixerchannels", 16, pIniFilename); | |
4379 if ( pAudioPlayer->uMixerChannels > 16 ) | |
4380 pAudioPlayer->uMixerChannels = 16; | |
4381 | |
4382 | |
4383 if (GetPrivateProfileIntW(L"debug", L"nomonster", 0, pIniFilename)) | |
2061 | 4384 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_ACTORS; |
2151 | 4385 if (ReadWindowsRegistryInt("startinwindow", 0)) |
2061 | 4386 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW; |
0 | 4387 if (GetPrivateProfileIntW(L"debug", L"showFR", 0, pIniFilename)) |
2061 | 4388 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_0002_SHOW_FR; |
0 | 4389 if (GetPrivateProfileIntW(L"debug", L"nodamage", 0, pIniFilename)) |
2061 | 4390 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_DAMAGE; |
0 | 4391 if (GetPrivateProfileIntW(L"debug", L"nodecoration", 0, pIniFilename)) |
2061 | 4392 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_DECORATIONS; |
0 | 4393 |
4394 wchar_t pStartingMapNameW[1024]; | |
4395 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
|
4396 sprintf(pStartingMapName, "%S", pStartingMapNameW); |
0 | 4397 |
4398 v9 = 0; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4399 if ( strlen(pStartingMapName) ) |
0 | 4400 { |
4401 do | |
4402 { | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4403 if ( pStartingMapName[v9] == ' ' ) |
0 | 4404 pStartingMapName[v9] = 0; |
4405 ++v9; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
4406 v2 = strlen(pStartingMapName); |
0 | 4407 } |
4408 while ( v9 < v2 ); | |
4409 } | |
4410 | |
1637 | 4411 pODMRenderParams = new ODMRenderParams; |
4412 pODMRenderParams->outdoor_no_mist = GetPrivateProfileIntW(L"debug", L"noMist", 0, pIniFilename); | |
4413 pODMRenderParams->bNoSky = GetPrivateProfileIntW(L"outdoor", L"nosky", 0, pIniFilename); | |
4414 pODMRenderParams->bDoNotRenderDecorations = GetPrivateProfileIntW(L"render", L"nodecorations", 0, pIniFilename); | |
4415 pODMRenderParams->outdoor_no_wavy_water = GetPrivateProfileIntW(L"outdoor", L"nowavywater", 0, pIniFilename); | |
0 | 4416 outdoor_grid_band_1 = GetPrivateProfileIntW(L"outdoor", L"gridband1", 10, pIniFilename); |
4417 outdoor_grid_band_2 = GetPrivateProfileIntW(L"outdoor", L"gridband2", 15, pIniFilename); | |
4418 outdoor_grid_band_3 = GetPrivateProfileIntW(L"outdoor", L"gridband3", 25, pIniFilename); | |
1637 | 4419 pODMRenderParams->terrain_gamma = GetPrivateProfileIntW(L"outdoor", L"ter_gamma", 0, pIniFilename); |
4420 pODMRenderParams->building_gamme = GetPrivateProfileIntW(L"outdoor", L"bld_gamma", 0, pIniFilename); | |
4421 pODMRenderParams->shading_dist_shade = GetPrivateProfileIntW(L"shading", L"dist_shade", 2048, pIniFilename); | |
4422 pODMRenderParams->shading_dist_shademist = GetPrivateProfileIntW(L"shading", L"dist_shademist", 4096, pIniFilename); | |
1765 | 4423 |
4424 int dist = 0x2000; | |
4425 extern bool new_draw_object_dist; | |
4426 if ( new_draw_object_dist ) | |
4427 dist = 0x6000; | |
4428 pODMRenderParams->shading_dist_mist = GetPrivateProfileIntW(L"shading", L"dist_mist", dist, pIniFilename); | |
0 | 4429 |
4430 wchar_t pDefaultSkyTextureW[1024]; | |
4431 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
|
4432 sprintf(pDefaultSkyTexture.data(), "%S", pDefaultSkyTextureW); |
0 | 4433 |
4434 wchar_t pDefaultGroundTextureW[1024]; | |
4435 GetPrivateProfileStringW(L"textures", L"default", L"dirt", pDefaultGroundTextureW, 0x10u, pIniFilename); | |
4436 sprintf(pDefaultGroundTexture, "%S", pDefaultGroundTextureW); | |
4437 | |
4438 wchar_t pFloat[1024]; | |
4439 GetPrivateProfileStringW(L"debug", L"recmod1", L"1.0", pFloat, 0x10u, pIniFilename); | |
4440 swscanf(pFloat, L"%f", &flt_6BE3A4_debug_recmod1); | |
4441 | |
4442 GetPrivateProfileStringW(L"debug", L"recmod2", L"1.0", pFloat, 0x10u, pIniFilename); | |
4443 swscanf(pFloat, L"%f", &flt_6BE3A8_debug_recmod2); | |
4444 | |
4445 flt_6BE3AC_debug_recmod1_x_1_6 = flt_6BE3A4_debug_recmod1 * 1.666666666666667; | |
4446 | |
4447 v3 = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
4448 if ( strlen(pDefaultSkyTexture.data()) ) |
0 | 4449 { |
4450 do | |
4451 { | |
4452 if ( pDefaultSkyTexture[v3] == ' ' ) | |
4453 pDefaultSkyTexture[v3] = 0; | |
4454 ++v3; | |
4455 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
4456 while ( v3 < strlen(pDefaultSkyTexture.data()) ); |
0 | 4457 } |
4458 v4 = 0; | |
4459 if ( strlen(pDefaultGroundTexture) ) | |
4460 { | |
4461 do | |
4462 { | |
4463 if ( pDefaultGroundTexture[v4] == ' ' ) | |
4464 pDefaultGroundTexture[v4] = 0; | |
4465 ++v4; | |
4466 } | |
4467 while ( v4 < strlen(pDefaultGroundTexture) ); | |
4468 } | |
4469 | |
4470 MM7Initialization(); | |
4471 } | |
4472 | |
4473 //----- (004666D5) -------------------------------------------------------- | |
2151 | 4474 void MM7Initialization() |
0 | 4475 { |
4476 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
4477 { | |
2151 | 4478 /*if (byte_6BE388_graphicsmode == 0) |
0 | 4479 { |
4480 outdoor_grid_band_1 = 10; | |
4481 outdoor_grid_band_2 = 15; | |
4482 outdoor_grid_band_3 = 20; | |
1637 | 4483 pODMRenderParams->shading_dist_mist = 8192; |
4484 pODMRenderParams->bNoSky = false; | |
0 | 4485 LOBYTE(viewparams->field_20) = 0; |
2151 | 4486 }*/ |
1637 | 4487 pODMRenderParams->shading_dist_shade = 2048; |
4488 pODMRenderParams->terrain_gamma = 0; | |
4489 pODMRenderParams->building_gamme = 0; | |
4490 pODMRenderParams->shading_dist_shademist = 4096; | |
4491 pODMRenderParams->outdoor_no_wavy_water = 0; | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
4492 //_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
|
4493 { |
1637 | 4494 pODMRenderParams->outdoor_grid_band_3 = outdoor_grid_band_3; |
4495 pODMRenderParams->uPickDepth = outdoor_grid_band_3 * 512; | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
4496 } |
0 | 4497 } |
4498 else | |
4499 { | |
4500 LOBYTE(viewparams->field_20) = 0; | |
4501 } | |
2101 | 4502 pParty->uFlags |= 2; |
692 | 4503 viewparams->uSomeY = viewparams->uScreen_topL_Y; |
4504 viewparams->uSomeX = viewparams->uScreen_topL_X; | |
4505 viewparams->uSomeZ = viewparams->uScreen_BttmR_X; | |
4506 viewparams->uSomeW = viewparams->uScreen_BttmR_Y; | |
4507 | |
4508 pViewport->SetScreen(viewparams->uScreen_topL_X, viewparams->uScreen_topL_Y, viewparams->uScreen_BttmR_X, viewparams->uScreen_BttmR_Y); | |
0 | 4509 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
1637 | 4510 pODMRenderParams->Initialize(); |
0 | 4511 } |
4512 | |
4513 //----- (00466C40) -------------------------------------------------------- | |
4514 const wchar_t *MENU_STATE_to_string(MENU_STATE m) | |
4515 { | |
4516 switch (m) | |
4517 { | |
982 | 4518 case -1: return L"-1"; |
4519 case MENU_MAIN: return L"MENU_MAIN"; | |
4520 case MENU_NEWGAME: return L"MENU_NEWGAME"; | |
4521 case MENU_CREDITS: return L"MENU_CREDITS"; | |
4522 case MENU_SAVELOAD: return L"MENU_SAVELOAD"; | |
4523 case MENU_EXIT_GAME: return L"MENU_EXIT_GAME"; | |
4524 case MENU_5: return L"MENU_5"; | |
4525 case MENU_CREATEPARTY: return L"MENU_CREATEPARTY"; | |
165 | 4526 case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC"; |
982 | 4527 case MENU_CREDITSPROC: return L"MENU_CREDITSPROC"; |
961 | 4528 case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu"; |
1458 | 4529 case MENU_DebugBLVLevel: return L"MENU_DebugBLVLevel"; |
165 | 4530 case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE"; |
982 | 4531 default: return L"unk"; |
0 | 4532 }; |
4533 }; | |
4534 void SetCurrentMenuID(MENU_STATE uMenu) | |
4535 { | |
2006 | 4536 sCurrentMenuID = uMenu; |
0 | 4537 |
4538 Log::Warning(L"CurrentMenu = %s", MENU_STATE_to_string(uMenu)); | |
4539 } | |
4540 | |
4541 //----- (00466CA0) -------------------------------------------------------- | |
4542 MENU_STATE GetCurrentMenuID() | |
4543 { | |
2006 | 4544 return sCurrentMenuID; |
0 | 4545 } |
4546 | |
4547 | |
4548 //----- (0046A89E) -------------------------------------------------------- | |
1459 | 4549 int __fastcall _46A89E_immolation_effect(int a1, int a2, int a3) |
0 | 4550 { |
4551 int v5; // ebx@3 | |
4552 int v6; // eax@3 | |
4553 int v7; // ebx@3 | |
4554 unsigned int v8; // ecx@3 | |
4555 int v9; // edx@4 | |
4556 unsigned int v10; // edx@6 | |
4557 unsigned int v11; // edx@8 | |
4558 int v13; // ecx@15 | |
4559 int v17; // [sp+Ch] [bp-10h]@3 | |
4560 int v18; // [sp+10h] [bp-Ch]@3 | |
4561 int v19; // [sp+18h] [bp-4h]@1 | |
4562 | |
4563 v19 = 0; | |
2101 | 4564 for ( uint i = 0; i < (signed int)uNumActors; ++i ) |
0 | 4565 { |
2101 | 4566 v5 = abs(pActors[i].vPosition.x - pParty->vPosition.x); |
4567 v17 = abs(pActors[i].vPosition.y - pParty->vPosition.y); | |
4568 v18 = abs(pActors[i].vPosition.z - pParty->vPosition.z); | |
4569 v6 = v5; | |
4570 v7 = v17; | |
4571 v8 = v18; | |
4572 if ( v6 < v17 ) | |
0 | 4573 { |
2101 | 4574 v9 = v6; |
4575 v6 = v17; | |
4576 v7 = v9; | |
4577 } | |
4578 if ( v6 < v18 ) | |
4579 { | |
4580 v10 = v6; | |
4581 v6 = v18; | |
4582 v8 = v10; | |
4583 } | |
4584 if ( v7 < (signed int)v8 ) | |
4585 { | |
4586 v11 = v8; | |
4587 v8 = v7; | |
4588 v7 = v11; | |
4589 } | |
4590 if ( (signed int)(((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6) <= a3 ) | |
4591 { | |
4592 if ( pActors[i].uAIState != Dead && pActors[i].uAIState != Dying && pActors[i].uAIState != Removed | |
4593 && pActors[i].uAIState != Disabled && pActors[i].uAIState != Summoned ) | |
0 | 4594 { |
2101 | 4595 __debugbreak();// *(int *)(a1 + 4 * v13) = i; ÷òî ýòî òàêîå? |
4596 v13 = v19++; | |
4597 *(int *)(a1 + 4 * v13) = i; | |
4598 if ( v19 >= a2 - 1 ) | |
4599 break; | |
0 | 4600 } |
4601 } | |
4602 } | |
4603 return v19; | |
4604 } | |
4605 | |
4606 //----- (0046BDA8) -------------------------------------------------------- | |
1458 | 4607 unsigned int GetGravityStrength() |
0 | 4608 { |
4609 int v0; // eax@1 | |
4610 | |
4611 v0 = ~LOBYTE(pGame->uFlags2) & 8; | |
4612 LOBYTE(v0) = v0 | 2; | |
4613 return (unsigned int)v0 >> 1; | |
4614 } | |
4615 | |
4616 //----- (0046BDC0) -------------------------------------------------------- | |
1458 | 4617 void UpdateUserInput_and_MapSpecificStuff() |
0 | 4618 { |
2061 | 4619 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME) |
0 | 4620 { |
2061 | 4621 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME; |
4622 return; | |
0 | 4623 } |
2061 | 4624 |
630 | 4625 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
0 | 4626 BLV_UpdateUserInputAndOther(); |
630 | 4627 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
0 | 4628 ODM_UpdateUserInputAndOther(); |
630 | 4629 |
783 | 4630 area_of_effect__damage_evaluate(); |
0 | 4631 } |
4632 | |
4633 //----- (0046BFFA) -------------------------------------------------------- | |
4634 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) | |
4635 { | |
2101 | 4636 ObjectDesc *object; // ebx@1 |
0 | 4637 unsigned int v8; // eax@19 |
4638 signed int v10; // ebx@19 | |
4639 char *v11; // edx@20 | |
4640 unsigned __int16 v12; // ax@23 | |
4641 int v13; // eax@27 | |
4642 unsigned int v14; // ebx@33 | |
4643 int v16; // eax@36 | |
4644 unsigned int v17; // eax@37 | |
4645 __int16 v18; // di@37 | |
4646 signed int v19; // edx@37 | |
4647 unsigned __int8 v20; // sf@37 | |
4648 char *v21; // ecx@38 | |
4649 unsigned __int16 v22; // ax@41 | |
4650 unsigned int v23; // eax@46 | |
4651 signed int v24; // ebx@46 | |
4652 char *v25; // edx@47 | |
4653 int v26; // edx@54 | |
4654 int v27; // edx@55 | |
4655 int v28; // edx@56 | |
4656 int v29; // edx@57 | |
4657 unsigned __int16 v30; // ax@60 | |
4658 unsigned int v31; // ecx@60 | |
4659 int v32; // edi@60 | |
4660 unsigned int v33; // eax@65 | |
4661 signed int v34; // edx@65 | |
4662 char *v35; // ecx@66 | |
4663 unsigned __int16 v36; // ax@69 | |
4664 int v37; // ST14_4@72 | |
4665 int v38; // eax@72 | |
4666 int v39; // ST10_4@72 | |
4667 int v40; // ST0C_4@72 | |
4668 int v41; // edx@76 | |
4669 int v42; // edx@77 | |
4670 int v43; // edx@78 | |
4671 unsigned __int8 v44; // zf@79 | |
4672 int v45; // edx@79 | |
4673 unsigned __int16 v46; // ax@80 | |
4674 int v47; // eax@81 | |
4675 int v48; // edx@87 | |
4676 int v49; // edx@88 | |
4677 int v50; // edx@89 | |
4678 signed int v52; // ebx@93 | |
4679 char *v53; // edx@94 | |
4680 unsigned __int16 v54; // ax@98 | |
4681 unsigned int v55; // ecx@98 | |
4682 signed int v56; // ebx@98 | |
4683 char *v57; // edx@99 | |
4684 unsigned __int16 v58; // ax@102 | |
4685 unsigned __int16 v59; // ax@107 | |
4686 unsigned int v60; // ecx@107 | |
4687 signed int v61; // ebx@107 | |
4688 char *v62; // edx@108 | |
4689 unsigned __int16 v63; // ax@111 | |
4690 int v64; // ebx@114 | |
4691 signed int v65; // eax@114 | |
4692 unsigned int v66; // edi@123 | |
4693 unsigned __int16 v67; // ax@124 | |
4694 unsigned int v68; // ecx@124 | |
4695 signed int v69; // ebx@124 | |
4696 char *v70; // edx@125 | |
4697 unsigned __int16 v71; // ax@128 | |
4698 unsigned int v72; // ebx@131 | |
4699 int v78; // eax@133 | |
4700 char v79; // zf@139 | |
4701 unsigned int v80; // eax@140 | |
4702 signed int v81; // edx@140 | |
4703 char *v82; // ecx@141 | |
4704 unsigned __int16 v83; // ax@144 | |
4705 unsigned __int16 v84; // ax@151 | |
4706 unsigned int v85; // ecx@151 | |
4707 signed int v86; // ebx@151 | |
4708 char *v87; // edx@152 | |
4709 unsigned __int16 v88; // ax@155 | |
4710 unsigned int v89; // eax@158 | |
4711 int v90; // ST34_4@159 | |
4712 int v91; // eax@159 | |
4713 unsigned int v92; // eax@163 | |
4714 unsigned int v93; // eax@177 | |
4715 char *v94; // ecx@178 | |
4716 unsigned __int16 v95; // ax@181 | |
4717 unsigned __int16 v96; // ax@184 | |
4718 int v97; // eax@185 | |
4719 unsigned __int16 v98; // ax@191 | |
4720 char v100; // ST18_1@198 | |
4721 int v102; // eax@198 | |
4722 signed int v106; // eax@208 | |
4723 unsigned int v107; // edx@220 | |
4724 signed int v108; // ebx@225 | |
4725 unsigned int v109; // eax@234 | |
4726 signed int v110; // ebx@234 | |
4727 char *v111; // ecx@235 | |
4728 unsigned __int16 v112; // ax@238 | |
4729 unsigned __int16 v113; // si@241 | |
4730 int v114; // eax@242 | |
4731 int v115; // eax@245 | |
4732 unsigned __int16 v117; // ax@251 | |
4733 unsigned int v118; // ecx@251 | |
4734 signed int v119; // ebx@251 | |
4735 char *v120; // edx@252 | |
4736 unsigned __int16 v121; // ax@255 | |
4737 unsigned int v122; // eax@260 | |
4738 char *v123; // edx@261 | |
4739 int v124; // eax@267 | |
4740 int v125; // [sp-20h] [bp-4Ch]@28 | |
4741 char v132; // [sp-8h] [bp-34h]@131 | |
4742 char v134; // [sp-4h] [bp-30h]@131 | |
4743 signed int v135; // [sp-4h] [bp-30h]@217 | |
4744 int v136; // [sp+Ch] [bp-20h]@208 | |
4745 int v137; // [sp+10h] [bp-1Ch]@208 | |
4746 signed int v138; // [sp+14h] [bp-18h]@207 | |
4747 signed int v139; // [sp+18h] [bp-14h]@208 | |
4748 char *v140; // [sp+1Ch] [bp-10h]@61 | |
4749 signed int v141; // [sp+1Ch] [bp-10h]@117 | |
4750 unsigned int v142; // [sp+1Ch] [bp-10h]@158 | |
4751 signed int v143; // [sp+1Ch] [bp-10h]@172 | |
4752 char *v144; // [sp+1Ch] [bp-10h]@192 | |
4753 signed int v146; // [sp+20h] [bp-Ch]@60 | |
4754 int v147; // [sp+20h] [bp-Ch]@72 | |
4755 signed int v148; // [sp+20h] [bp-Ch]@158 | |
4756 unsigned __int16 v150; // [sp+20h] [bp-Ch]@208 | |
4757 signed int v152; // [sp+24h] [bp-8h]@208 | |
2101 | 4758 |
4759 //ïðèìåíåíèå: ôàåðáîëò â õðàìå ëóíû | |
4760 object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID]; | |
4761 //v151 = PID_TYPE(a2); | |
848 | 4762 if ( PID_TYPE(a2) == OBJECT_Actor) |
4763 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4764 if ( PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4765 && !pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) ) |
0 | 4766 return 1; |
4767 } | |
4768 else | |
4769 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4770 if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Player) |
0 | 4771 return 1; |
4772 } | |
4773 if ( pParty->bTurnBasedModeOn == 1 ) | |
4774 { | |
2101 | 4775 if ( pSpriteObjects[uLayingItemID].uAttributes & 4 ) |
0 | 4776 { |
1450 | 4777 --pTurnEngine->pending_actions; |
2101 | 4778 pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB; |
0 | 4779 } |
4780 } | |
2101 | 4781 if ( PID_TYPE(a2) == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player) |
1280 | 4782 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4783 if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) //bugfix PID_ID(v2->spell_caster_pid)==1000 |
2166 | 4784 pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes |= 0x40000; |
1280 | 4785 } |
4786 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4787 //v6 = v2->uType; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4788 //v7 = v2->uType; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4789 if ( pSpriteObjects[uLayingItemID].uType > 3060 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4790 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4791 if ( pSpriteObjects[uLayingItemID].uType > 6090 ) |
0 | 4792 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4793 if ( pSpriteObjects[uLayingItemID].uType > 8090 ) |
0 | 4794 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4795 if ( pSpriteObjects[uLayingItemID].uType == 9010 ) |
0 | 4796 goto LABEL_247; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4797 if ( pSpriteObjects[uLayingItemID].uType != 9030 ) |
0 | 4798 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4799 if ( pSpriteObjects[uLayingItemID].uType != 9040 ) |
0 | 4800 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4801 if ( pSpriteObjects[uLayingItemID].uType != 9080 ) |
0 | 4802 return 0; |
2101 | 4803 v95 = 0; |
4804 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; | |
4805 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) | |
0 | 4806 { |
2101 | 4807 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) |
4808 v95 = v146; | |
0 | 4809 } |
2101 | 4810 pSpriteObjects[uLayingItemID].uObjectDescID = v95; |
4811 if ( !v95 ) | |
4812 SpriteObject::OnInteraction(uLayingItemID); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4813 v100 = pSpriteObjects[uLayingItemID].field_61; |
2101 | 4814 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
4815 v102 = 8 * uLayingItemID; | |
4816 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); | |
4817 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
4818 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
4819 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
4820 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); | |
4821 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) | |
4822 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); | |
4823 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4824 v47 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4825 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4826 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4827 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2101 | 4828 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4829 return 0; |
0 | 4830 } |
2101 | 4831 sub_43A97E(uLayingItemID, a2); |
4832 ++pSpriteObjects[uLayingItemID].uType; | |
4833 v95 = 0; | |
4834 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
4835 { | |
4836 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
4837 v95 = v52; | |
4838 } | |
4839 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
4840 if ( !v95 ) | |
4841 SpriteObject::OnInteraction(uLayingItemID); | |
4842 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
4843 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
4844 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
4845 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
4846 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
4847 if ( !v96 ) | |
4848 v97 = 0; | |
4849 else | |
4850 v97 = (signed __int16)v96 + 4; | |
4851 v124 = 8 * uLayingItemID; | |
4852 LOBYTE(v124) = v124 | 2; | |
4853 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
4854 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
4855 return 0; | |
0 | 4856 } |
4857 LABEL_172: | |
4858 v143 = 17030; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4859 switch ( pSpriteObjects[uLayingItemID].uType ) |
0 | 4860 { |
4861 case 0x1798u: | |
4862 v143 = 15040; | |
4863 break; | |
4864 case 0xFAAu: | |
4865 v143 = 13010; | |
4866 break; | |
4867 case 0x2346u: | |
4868 v143 = 18030; | |
4869 break; | |
4870 } | |
4871 v138 = 1; | |
2101 | 4872 if ( PID_TYPE(a2) != OBJECT_Actor) |
0 | 4873 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4874 if ( pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4 ) |
2101 | 4875 { |
4876 SpriteObject::OnInteraction(uLayingItemID); | |
4877 return 0; | |
4878 } | |
4879 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); | |
0 | 4880 LABEL_233: |
4881 if ( !v138 ) | |
4882 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4883 ++pSpriteObjects[uLayingItemID].uType; |
2101 | 4884 v112 = 0; |
4885 for ( v110 = 0; v110 < (signed int)pObjectList->uNumObjects; ++v110 ) | |
0 | 4886 { |
2101 | 4887 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v110].uObjectID ) |
4888 v112 = v110; | |
0 | 4889 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4890 pSpriteObjects[uLayingItemID].uObjectDescID = v112; |
0 | 4891 if ( !v112 ) |
2101 | 4892 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4893 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4894 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4895 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4896 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4897 v113 = pSpriteObjects[uLayingItemID].uSoundID; |
0 | 4898 if ( v113 ) |
4899 v114 = (signed __int16)v113 + 4; | |
4900 else | |
4901 v114 = 0; | |
2101 | 4902 v115 = 8 * uLayingItemID; |
4903 LOBYTE(v115) = PID(OBJECT_Item, uLayingItemID); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4904 v125 = v143 + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4905 pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4906 return 0; |
0 | 4907 } |
2101 | 4908 SpriteObject::OnInteraction(uLayingItemID); |
0 | 4909 return 0; |
4910 } | |
2101 | 4911 v106 = a2; |
0 | 4912 v150 = 0; |
848 | 4913 v139 = PID_ID(v106); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4914 v137 = pSpriteObjects[uLayingItemID].spell_level; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4915 v152 = pSpriteObjects[uLayingItemID].spell_skill; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4916 v136 = pSpriteObjects[uLayingItemID].spell_id; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4917 if ( pSpriteObjects[uLayingItemID].uType == 9030 ) |
0 | 4918 { |
4919 v150 = 2; | |
4920 if ( v152 == 2 ) | |
4921 { | |
4922 v150 = 3; | |
4923 } | |
4924 else | |
4925 { | |
4926 if ( v152 >= 3 ) | |
4927 v150 = 4; | |
4928 } | |
2166 | 4929 pActors[v139].uAttributes |= 0x80000; |
0 | 4930 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4931 if ( pSpriteObjects[uLayingItemID].uType == 6040 ) |
0 | 4932 { |
4933 v135 = 7; | |
4934 } | |
4935 else | |
4936 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4937 if ( pSpriteObjects[uLayingItemID].uType == 8030 ) |
0 | 4938 { |
4939 v135 = 9; | |
4940 } | |
4941 else | |
4942 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4943 if ( pSpriteObjects[uLayingItemID].uType != 9030 ) |
0 | 4944 { |
4945 v107 = v136; | |
4946 LABEL_222: | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4947 if ( pSpriteObjects[uLayingItemID].uType != 9030 || v152 != 4 ) |
0 | 4948 { |
4949 v108 = v139; | |
4950 if ( stru_50C198.GetMagicalResistance(&pActors[v139], v107) ) | |
4951 { | |
4952 v138 = 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4953 if ( pSpriteObjects[uLayingItemID].uType == 8030 ) |
0 | 4954 { |
4955 pActors[v108].uAIState = Standing; | |
4956 pActors[v108].UpdateAnimation(); | |
4957 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4958 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
|
4959 v152, v150, 0, 0); |
0 | 4960 } |
4961 } | |
4962 else | |
4963 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4964 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); |
0 | 4965 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4966 pSpriteObjects[uLayingItemID].spell_level = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4967 pSpriteObjects[uLayingItemID].spell_skill = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
4968 pSpriteObjects[uLayingItemID].spell_id = 0; |
0 | 4969 goto LABEL_233; |
4970 } | |
4971 v135 = 10; | |
4972 } | |
4973 } | |
4974 v107 = v135; | |
4975 goto LABEL_222; | |
4976 } | |
2101 | 4977 if ( pSpriteObjects[uLayingItemID].uType == 8090 |
4978 || pSpriteObjects[uLayingItemID].uType == 7030 | |
4979 || pSpriteObjects[uLayingItemID].uType == 7090 || pSpriteObjects[uLayingItemID].uType == 8000 ) | |
4980 { | |
4981 sub_43A97E(uLayingItemID, a2); | |
4982 ++pSpriteObjects[uLayingItemID].uType; | |
4983 v95 = 0; | |
4984 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
4985 { | |
4986 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
4987 v95 = v52; | |
4988 } | |
4989 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
4990 if ( !v95 ) | |
4991 SpriteObject::OnInteraction(uLayingItemID); | |
4992 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
4993 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
4994 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
4995 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
4996 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
4997 if ( !v96 ) | |
4998 v97 = 0; | |
4999 else | |
5000 v97 = (signed __int16)v96 + 4; | |
5001 v124 = 8 * uLayingItemID; | |
5002 LOBYTE(v124) = v124 | 2; | |
5003 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
5004 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
5005 return 0; | |
5006 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5007 if ( pSpriteObjects[uLayingItemID].uType == 8010 ) |
0 | 5008 { |
2101 | 5009 if ( PID_TYPE(a2) == 3 |
5010 && MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
5011 sub_43A97E(uLayingItemID, a2); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5012 ++pSpriteObjects[uLayingItemID].uType; |
2101 | 5013 //v9 = 0; |
5014 v95 = 0; | |
5015 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
0 | 5016 { |
2101 | 5017 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) |
5018 v95 = v52; | |
0 | 5019 } |
2101 | 5020 pSpriteObjects[uLayingItemID].uObjectDescID = v95; |
5021 if ( !v95 ) | |
5022 SpriteObject::OnInteraction(uLayingItemID); | |
5023 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
5024 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5025 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5026 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5027 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5028 if ( !v96 ) | |
5029 v97 = 0; | |
5030 else | |
5031 v97 = (signed __int16)v96 + 4; | |
5032 v92 = uLayingItemID; | |
5033 v124 = 8 * v92; | |
5034 LOBYTE(v124) = v124 | 2; | |
5035 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
5036 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
5037 return 0; | |
0 | 5038 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5039 v79 = pSpriteObjects[uLayingItemID].uType == 8030; |
0 | 5040 } |
5041 else | |
5042 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5043 if ( pSpriteObjects[uLayingItemID].uType == 6090 ) |
2101 | 5044 { |
5045 sub_43A97E(uLayingItemID, a2); | |
5046 ++pSpriteObjects[uLayingItemID].uType; | |
5047 v95 = 0; | |
5048 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
5049 { | |
5050 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
5051 v95 = v52; | |
5052 } | |
5053 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
5054 if ( !v95 ) | |
5055 SpriteObject::OnInteraction(uLayingItemID); | |
5056 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
5057 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5058 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5059 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5060 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5061 if ( !v96 ) | |
5062 v97 = 0; | |
5063 else | |
5064 v97 = (signed __int16)v96 + 4; | |
5065 v124 = 8 * uLayingItemID; | |
5066 LOBYTE(v124) = v124 | 2; | |
5067 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
5068 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
5069 return 0; | |
5070 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5071 if ( pSpriteObjects[uLayingItemID].uType <= 4070 ) |
0 | 5072 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5073 if ( pSpriteObjects[uLayingItemID].uType != 4070 ) |
0 | 5074 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5075 v48 = pSpriteObjects[uLayingItemID].uType - 3090; |
0 | 5076 if ( v48 ) |
5077 { | |
5078 v49 = v48 - 2; | |
5079 if ( v49 ) | |
5080 { | |
5081 v50 = v49 - 908; | |
2101 | 5082 if ( v49 == 908 ) |
5083 { | |
5084 sub_43A97E(uLayingItemID, a2); | |
5085 ++pSpriteObjects[uLayingItemID].uType; | |
5086 v95 = 0; | |
5087 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
5088 { | |
5089 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
5090 v95 = v52; | |
5091 } | |
5092 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
5093 if ( !v95 ) | |
5094 SpriteObject::OnInteraction(uLayingItemID); | |
5095 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
5096 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5097 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5098 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5099 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5100 if ( !v96 ) | |
5101 v97 = 0; | |
5102 else | |
5103 v97 = (signed __int16)v96 + 4; | |
5104 v124 = 8 * uLayingItemID; | |
5105 LOBYTE(v124) = v124 | 2; | |
5106 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
5107 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
5108 return 0; | |
5109 } | |
0 | 5110 v45 = v50 - 30; |
5111 v44 = v45 == 0; | |
5112 goto LABEL_91; | |
5113 } | |
2101 | 5114 //v9 = 0; |
5115 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType - 1; | |
5116 v58 = 0; | |
5117 for ( v56 = 0; v56 < (signed int)pObjectList->uNumObjects; ++v56 ) | |
0 | 5118 { |
2101 | 5119 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v56].uObjectID ) |
5120 v58 = v56; | |
0 | 5121 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5122 pSpriteObjects[uLayingItemID].uObjectDescID = v58; |
0 | 5123 if ( !v58 ) |
2101 | 5124 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5125 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5126 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5127 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5128 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
2101 | 5129 sub_43A97E(uLayingItemID, a2); |
5130 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
0 | 5131 v16 = 0; |
5132 else | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5133 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
2101 | 5134 v124 = 8 * uLayingItemID; |
0 | 5135 LOBYTE(v124) = v124 | 2; |
1456 | 5136 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2101 | 5137 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5138 return 0; |
0 | 5139 } |
2101 | 5140 //v9 = 0; |
5141 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2; | |
5142 v63 = 0; | |
5143 for ( v61 = 0; v61 < (signed int)pObjectList->uNumObjects; ++v61 ) | |
0 | 5144 { |
2101 | 5145 if ( v59 == pObjectList->pObjects[v61].uObjectID ) |
5146 v63 = v61; | |
0 | 5147 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5148 pSpriteObjects[uLayingItemID].uObjectDescID = v63; |
0 | 5149 if ( !v63 ) |
2101 | 5150 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5151 v64 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5152 v44 = pSpriteObjects[uLayingItemID].spell_skill == 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5153 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5154 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5155 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
0 | 5156 v65 = 7; |
5157 if ( v44 ) | |
5158 v65 = 9; | |
5159 if ( v65 > 0 ) | |
5160 { | |
5161 v141 = v65; | |
5162 do | |
5163 { | |
2101 | 5164 v64 += (signed int)stru_5C6E00->uIntegerHalfPi / 2; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5165 pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0); |
0 | 5166 --v141; |
5167 } | |
5168 while ( v141 ); | |
5169 } | |
2101 | 5170 SpriteObject::OnInteraction(uLayingItemID); |
5171 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5172 v16 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5173 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5174 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
2101 | 5175 v124 = 8 * uLayingItemID; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5176 LOBYTE(v124) = v124 | 2; |
1456 | 5177 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2101 | 5178 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5179 return 0; |
0 | 5180 } |
2101 | 5181 //v66 = 0; |
5182 if ( PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2) ) | |
0 | 5183 return 1; |
2101 | 5184 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; |
5185 v71 = 0; | |
5186 for ( v69 = 0; v69 < (signed int)pObjectList->uNumObjects; ++v69 ) | |
0 | 5187 { |
2101 | 5188 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v69].uObjectID ) |
5189 v71 = v69; | |
0 | 5190 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5191 pSpriteObjects[uLayingItemID].uObjectDescID = v71; |
0 | 5192 if ( !v71 ) |
2101 | 5193 SpriteObject::OnInteraction(uLayingItemID); |
0 | 5194 v134 = 0; |
2101 | 5195 v72 = uLayingItemID; |
0 | 5196 v132 = 0; |
2101 | 5197 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
5198 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5199 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5200 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
2059 | 5201 AttackerInfo.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); |
2101 | 5202 if ( !pSpriteObjects[uLayingItemID].uSoundID ) |
0 | 5203 v78 = 0; |
5204 else | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5205 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5206 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2185 | 5207 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, 0, -1, 0, v78, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5208 return 0; |
0 | 5209 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5210 if ( pSpriteObjects[uLayingItemID].uType == 4090 ) |
0 | 5211 { |
2101 | 5212 //v9 = 0; |
5213 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2; | |
5214 v88 = 0; | |
5215 for ( v86 = 0; v86 < (signed int)pObjectList->uNumObjects; ++v86 ) | |
0 | 5216 { |
2101 | 5217 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v86].uObjectID ) |
5218 v88 = v86; | |
0 | 5219 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5220 pSpriteObjects[uLayingItemID].uObjectDescID = v88; |
0 | 5221 if ( !v88 ) |
2101 | 5222 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5223 v89 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5224 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5225 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5226 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
0 | 5227 v142 = v89; |
5228 v148 = 7; | |
5229 do | |
5230 { | |
5231 pRnd->SetRange(-128, 128); | |
5232 v90 = pRnd->GetInRange(); | |
5233 pRnd->SetRange(5, 500); | |
5234 v91 = pRnd->GetInRange(); | |
5235 v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5236 pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0); |
0 | 5237 --v148; |
5238 } | |
5239 while ( v148 ); | |
2101 | 5240 SpriteObject::OnInteraction(uLayingItemID); |
5241 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5242 v16 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5243 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5244 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
2101 | 5245 v124 = 8 * uLayingItemID; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5246 LOBYTE(v124) = v124 | 2; |
1456 | 5247 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id-1] + 1; |
2101 | 5248 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5249 return 0; |
0 | 5250 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5251 if ( pSpriteObjects[uLayingItemID].uType == 4092 ) |
0 | 5252 { |
2101 | 5253 //v66 = 0; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5254 pSpriteObjects[uLayingItemID].uType = 4091; |
2101 | 5255 v83 = 0; |
5256 for ( v81 = 0; v81 < (signed int)pObjectList->uNumObjects; ++v81 ) | |
0 | 5257 { |
2101 | 5258 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v81].uObjectID ) |
5259 v83 = v81; | |
0 | 5260 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5261 pSpriteObjects[uLayingItemID].uObjectDescID = v83; |
0 | 5262 if ( !v83 ) |
2101 | 5263 SpriteObject::OnInteraction(uLayingItemID); |
0 | 5264 v134 = 0; |
2102 | 5265 //v72 = uLayingItemID; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5266 v132 = pSpriteObjects[uLayingItemID].field_61; |
2101 | 5267 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
5268 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5269 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5270 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
2102 | 5271 AttackerInfo.Add(PID(OBJECT_Item, uLayingItemID), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); |
2101 | 5272 if ( !pSpriteObjects[uLayingItemID].uSoundID ) |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5273 v78 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5274 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5275 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5276 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2102 | 5277 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, 0, -1, 0, v78, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5278 return 0; |
0 | 5279 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5280 if ( pSpriteObjects[uLayingItemID].uType == 4100 || pSpriteObjects[uLayingItemID].uType == 6010 ) |
2101 | 5281 { |
5282 sub_43A97E(uLayingItemID, a2); | |
5283 ++pSpriteObjects[uLayingItemID].uType; | |
5284 v95 = 0; | |
5285 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
5286 { | |
5287 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
5288 v95 = v52; | |
5289 } | |
5290 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
5291 if ( !v95 ) | |
5292 SpriteObject::OnInteraction(uLayingItemID); | |
5293 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
5294 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5295 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5296 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5297 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5298 if ( !v96 ) | |
5299 v97 = 0; | |
5300 else | |
5301 v97 = (signed __int16)v96 + 4; | |
5302 v124 = 8 * uLayingItemID; | |
5303 LOBYTE(v124) = v124 | 2; | |
5304 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
5305 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
5306 return 0; | |
5307 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5308 v79 = pSpriteObjects[uLayingItemID].uType == 6040; |
0 | 5309 } |
5310 if ( !v79 ) | |
5311 return 0; | |
5312 goto LABEL_172; | |
5313 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5314 if ( pSpriteObjects[uLayingItemID].uType == 3060 ) |
2101 | 5315 { |
5316 sub_43A97E(uLayingItemID, a2); | |
5317 ++pSpriteObjects[uLayingItemID].uType; | |
5318 v95 = 0; | |
5319 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
5320 { | |
5321 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
5322 v95 = v52; | |
5323 } | |
5324 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
5325 if ( !v95 ) | |
5326 SpriteObject::OnInteraction(uLayingItemID); | |
5327 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
5328 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5329 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5330 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5331 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5332 if ( !v96 ) | |
5333 v97 = 0; | |
5334 else | |
5335 v97 = (signed __int16)v96 + 4; | |
5336 v124 = 8 * uLayingItemID; | |
5337 LOBYTE(v124) = v124 | 2; | |
5338 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
5339 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
5340 return 0; | |
5341 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5342 if ( pSpriteObjects[uLayingItemID].uType <= 555 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5343 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5344 if ( pSpriteObjects[uLayingItemID].uType == 555 ) |
0 | 5345 { |
2101 | 5346 sub_43A97E(uLayingItemID, a2); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5347 ++pSpriteObjects[uLayingItemID].uType; |
0 | 5348 v18 = 0; |
2101 | 5349 v22 = 0; |
5350 v25 = (char *)&pObjectList->pObjects->uObjectID; | |
5351 for ( v24 = 0; v24 < (signed int)pObjectList->uNumObjects; ++v24 ) | |
0 | 5352 { |
2101 | 5353 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v24].uObjectID ) |
5354 v22 = v24; | |
0 | 5355 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5356 pSpriteObjects[uLayingItemID].uObjectDescID = v22; |
0 | 5357 if ( v22 == v18 ) |
2101 | 5358 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5359 pSpriteObjects[uLayingItemID].vVelocity.z = v18; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5360 pSpriteObjects[uLayingItemID].vVelocity.y = v18; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5361 pSpriteObjects[uLayingItemID].vVelocity.x = v18; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5362 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; |
0 | 5363 } |
5364 else | |
5365 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5366 switch ( pSpriteObjects[uLayingItemID].uType ) |
0 | 5367 { |
5368 case 500: | |
5369 case 505: | |
5370 case 510: | |
5371 case 515: | |
5372 case 520: | |
5373 case 525: | |
5374 case 530: | |
5375 case 535: | |
5376 case 540: | |
2101 | 5377 sub_43A97E(uLayingItemID, a2); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5378 ++pSpriteObjects[uLayingItemID].uType; |
2101 | 5379 v12 = 0; |
5380 for ( v10 = 0; v10 < (signed int)pObjectList->uNumObjects; ++v10 ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5381 { |
2101 | 5382 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v10].uObjectID ) |
5383 v12 = v10; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5384 } |
2101 | 5385 pSpriteObjects[uLayingItemID].uObjectDescID = v12; |
5386 if ( !v12 ) | |
5387 SpriteObject::OnInteraction(uLayingItemID); | |
5388 v44 = pSpriteObjects[uLayingItemID].uType == 555; | |
5389 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5390 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5391 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5392 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5393 if ( !v44 ) | |
5394 { | |
5395 v13 = 8 * uLayingItemID; | |
5396 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); | |
5397 pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); | |
5398 } | |
5399 return 0; | |
0 | 5400 case 545: |
5401 case 550: | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5402 if ( pSpriteObjects[uLayingItemID].stru_24.uItemID != 405 && pSpriteObjects[uLayingItemID].stru_24.uSpecEnchantmentType != 3 ) |
0 | 5403 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5404 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5405 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5406 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5407 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
2101 | 5408 sub_43A97E(uLayingItemID, a2); |
5409 SpriteObject::OnInteraction(uLayingItemID); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5410 if ( pSpriteObjects[uLayingItemID].uSoundID == 0 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5411 v16 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5412 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5413 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
2101 | 5414 v124 = 8 * uLayingItemID; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5415 LOBYTE(v124) = v124 | 2; |
1996 | 5416 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5417 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5418 return 0; |
0 | 5419 } |
5420 v18 = 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5421 pSpriteObjects[uLayingItemID].uType = 600; |
2101 | 5422 v22 = 0; |
5423 for ( v19 = 0; v19 < (signed int)pObjectList->uNumObjects; ++v19 ) | |
0 | 5424 { |
2101 | 5425 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v19].uObjectID ) |
5426 v22 = v19; | |
0 | 5427 } |
2101 | 5428 pSpriteObjects[uLayingItemID].uObjectDescID = v22; |
5429 if ( !v22 ) | |
5430 SpriteObject::OnInteraction(uLayingItemID); | |
5431 pSpriteObjects[uLayingItemID].vVelocity.z = v18; | |
5432 pSpriteObjects[uLayingItemID].vVelocity.y = v18; | |
5433 pSpriteObjects[uLayingItemID].vVelocity.x = v18; | |
5434 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; | |
0 | 5435 default: |
5436 return 0; | |
5437 } | |
2101 | 5438 v12 = 0; |
5439 for ( v10; v10 < (signed int)v8; ++v10 ) | |
0 | 5440 { |
5441 v11 += 56; | |
2101 | 5442 if ( pSpriteObjects[uLayingItemID].uType != *(short *)v11 ) |
5443 v12 = v10; | |
0 | 5444 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5445 pSpriteObjects[uLayingItemID].uObjectDescID = v12; |
0 | 5446 if ( !v12 ) |
2101 | 5447 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5448 v44 = pSpriteObjects[uLayingItemID].uType == 555; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5449 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5450 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5451 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5452 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
0 | 5453 if ( !v44 ) |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5454 { |
2101 | 5455 v13 = 8 * uLayingItemID; |
5456 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); | |
5457 pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5458 return 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5459 } |
0 | 5460 } |
5461 return 0; | |
5462 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5463 if ( pSpriteObjects[uLayingItemID].uType > 1100 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5464 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5465 v41 = pSpriteObjects[uLayingItemID].uType - 2030; |
0 | 5466 if ( !v41 ) |
5467 goto LABEL_247; | |
5468 v42 = v41 - 30; | |
5469 if ( v42 ) | |
5470 { | |
5471 v43 = v42 - 40; | |
2101 | 5472 if ( v42 == 40 ) |
5473 { | |
5474 if ( PID_TYPE(a2) != 3 ) | |
5475 { | |
5476 //v32 = 0; | |
5477 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; | |
5478 v46 = 0; | |
5479 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) | |
5480 { | |
5481 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) | |
5482 v46 = v146; | |
5483 } | |
5484 pSpriteObjects[uLayingItemID].uObjectDescID = v46; | |
5485 if ( !v46 ) | |
5486 SpriteObject::OnInteraction(uLayingItemID); | |
5487 v100 = pSpriteObjects[uLayingItemID].field_61; | |
5488 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5489 v102 = 8 * uLayingItemID; | |
5490 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); | |
5491 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5492 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5493 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5494 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); | |
5495 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) | |
5496 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); | |
5497 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
5498 v47 = 0; | |
5499 else | |
5500 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; | |
5501 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
5502 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0); | |
5503 return 0; | |
5504 } | |
5505 return 1; | |
5506 } | |
0 | 5507 v45 = v43 - 910; |
5508 v44 = v45 == 0; | |
5509 LABEL_91: | |
5510 if ( !v44 && v45 != 20 ) | |
5511 return 0; | |
5512 } | |
2101 | 5513 sub_43A97E(uLayingItemID, a2); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5514 ++pSpriteObjects[uLayingItemID].uType; |
2101 | 5515 v95 = 0; |
5516 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
0 | 5517 { |
2101 | 5518 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) |
5519 v95 = v52; | |
0 | 5520 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5521 pSpriteObjects[uLayingItemID].uObjectDescID = v95; |
2101 | 5522 if ( !v95 ) |
5523 SpriteObject::OnInteraction(uLayingItemID); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5524 v96 = pSpriteObjects[uLayingItemID].uSoundID; |
2101 | 5525 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
5526 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5527 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5528 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5529 if ( !v96 ) | |
0 | 5530 v97 = 0; |
5531 else | |
5532 v97 = (signed __int16)v96 + 4; | |
2101 | 5533 v124 = 8 * uLayingItemID; |
5534 LOBYTE(v124) = v124 | 2; | |
5535 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
5536 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
5537 return 0; | |
5538 } | |
5539 if ( pSpriteObjects[uLayingItemID].uType == 1100 ) | |
5540 { | |
5541 sub_43A97E(uLayingItemID, a2); | |
5542 ++pSpriteObjects[uLayingItemID].uType; | |
5543 v95 = 0; | |
5544 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
5545 { | |
5546 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
5547 v95 = v52; | |
5548 } | |
5549 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
5550 if ( !v95 ) | |
5551 SpriteObject::OnInteraction(uLayingItemID); | |
5552 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
5553 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5554 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5555 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5556 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5557 if ( !v96 ) | |
5558 v97 = 0; | |
5559 else | |
5560 v97 = (signed __int16)v96 + 4; | |
5561 v92 = uLayingItemID; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5562 v124 = 8 * v92; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5563 LOBYTE(v124) = v124 | 2; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5564 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2101 | 5565 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5566 return 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5567 } |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5568 v26 = pSpriteObjects[uLayingItemID].uType - 600; |
2101 | 5569 if ( pSpriteObjects[uLayingItemID].uType == 600 ) |
0 | 5570 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5571 pSpriteObjects[uLayingItemID].uType = 601; |
2101 | 5572 v36 = 0; |
5573 for ( v34 = 0; v34 < (signed int)pObjectList->uNumObjects; ++v34 ) | |
0 | 5574 { |
2101 | 5575 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v34].uObjectID ) |
5576 v36 = v34; | |
0 | 5577 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5578 pSpriteObjects[uLayingItemID].uObjectDescID = v36; |
0 | 5579 if ( !v36 ) |
2101 | 5580 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5581 v37 = pSpriteObjects[uLayingItemID].vPosition.z; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5582 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
2101 | 5583 v38 = 8 * uLayingItemID; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5584 v39 = pSpriteObjects[uLayingItemID].vPosition.y; |
2101 | 5585 LOBYTE(v38) = PID(OBJECT_Item, uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5586 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5587 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5588 v40 = pSpriteObjects[uLayingItemID].vPosition.x; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5589 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
0 | 5590 v147 = v38; |
2059 | 5591 AttackerInfo.Add(v38, 512, v40, v39, v37, 0, 0); |
2101 | 5592 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) |
5593 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5594 pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5595 return 0; |
0 | 5596 } |
5597 v27 = v26 - 410; | |
2101 | 5598 if ( v26 == 410 ) |
5599 { | |
5600 sub_43A97E(uLayingItemID, a2); | |
5601 ++pSpriteObjects[uLayingItemID].uType; | |
5602 v95 = 0; | |
5603 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
5604 { | |
5605 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
5606 v95 = v52; | |
5607 } | |
5608 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
5609 if ( !v95 ) | |
5610 SpriteObject::OnInteraction(uLayingItemID); | |
5611 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
5612 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5613 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5614 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5615 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5616 if ( !v96 ) | |
5617 v97 = 0; | |
5618 else | |
5619 v97 = (signed __int16)v96 + 4; | |
5620 v124 = 8 * uLayingItemID; | |
5621 LOBYTE(v124) = v124 | 2; | |
5622 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
5623 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
5624 return 0; | |
5625 } | |
0 | 5626 v28 = v27 - 40; |
5627 if ( !v28 ) | |
2101 | 5628 { |
5629 v95 = 0; | |
5630 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; | |
5631 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) | |
5632 { | |
5633 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) | |
5634 v95 = v146; | |
5635 } | |
5636 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
5637 if ( !v95 ) | |
5638 SpriteObject::OnInteraction(uLayingItemID); | |
5639 v100 = pSpriteObjects[uLayingItemID].field_61; | |
5640 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5641 v102 = 8 * uLayingItemID; | |
5642 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); | |
5643 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5644 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5645 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5646 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); | |
5647 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) | |
5648 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); | |
5649 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
5650 v47 = 0; | |
5651 else | |
5652 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; | |
5653 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
5654 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0); | |
5655 return 0; | |
5656 } | |
0 | 5657 v29 = v28 - 10; |
5658 if ( v29 ) | |
5659 { | |
5660 if ( v29 != 20 ) | |
5661 return 0; | |
2101 | 5662 if ( PID_TYPE(a2) != 3 ) |
0 | 5663 { |
2101 | 5664 //v32 = 0; |
5665 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; | |
5666 v46 = 0; | |
5667 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) | |
0 | 5668 { |
2101 | 5669 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) |
5670 v46 = v146; | |
0 | 5671 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5672 pSpriteObjects[uLayingItemID].uObjectDescID = v46; |
2101 | 5673 if ( !v46 ) |
5674 SpriteObject::OnInteraction(uLayingItemID); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5675 v100 = pSpriteObjects[uLayingItemID].field_61; |
2101 | 5676 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
5677 v102 = 8 * uLayingItemID; | |
5678 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); | |
5679 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5680 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5681 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5682 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); | |
5683 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) | |
5684 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); | |
5685 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5686 v47 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5687 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5688 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5689 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2101 | 5690 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5691 return 0; |
0 | 5692 } |
5693 return 1; | |
5694 } | |
5695 LABEL_247: | |
2101 | 5696 //v9 = 0; |
5697 if ( PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2) ) | |
0 | 5698 return 1; |
2101 | 5699 if ( PID_TYPE(a2) != 2 ) |
0 | 5700 { |
2101 | 5701 sub_43A97E(uLayingItemID, a2); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5702 ++pSpriteObjects[uLayingItemID].uType; |
2101 | 5703 v95 = 0; |
5704 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
0 | 5705 { |
2101 | 5706 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) |
5707 v95 = v52; | |
0 | 5708 } |
2101 | 5709 pSpriteObjects[uLayingItemID].uObjectDescID = v95; |
5710 if ( !v95 ) | |
5711 SpriteObject::OnInteraction(uLayingItemID); | |
5712 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
5713 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
5714 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
5715 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
5716 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
5717 v97 = 0; | |
5718 else | |
5719 v97 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; | |
5720 v124 = 8 * uLayingItemID; | |
5721 LOBYTE(v124) = v124 | 2; | |
5722 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
5723 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
5724 return 0; | |
0 | 5725 } |
2101 | 5726 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; |
5727 v121 = 0; | |
5728 for ( v119 = 0; v119 < (signed int)pObjectList->uNumObjects; ++v119 ) | |
0 | 5729 { |
2101 | 5730 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v119].uObjectID ) |
5731 v121 = v119; | |
0 | 5732 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5733 pSpriteObjects[uLayingItemID].uObjectDescID = v121; |
0 | 5734 if ( !v121 ) |
2101 | 5735 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5736 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5737 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5738 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
5739 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
2101 | 5740 v13 = 8 * uLayingItemID; |
5741 LOBYTE(v13) = PID(OBJECT_Item,uLayingItemID); | |
5742 pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); | |
0 | 5743 return 0; |
5744 } |