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