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