Mercurial > mm7
annotate mm7_2.cpp @ 2383:342b73a61a60
sub_407A1C - refactoring min-max
author | zipi |
---|---|
date | Sun, 22 Jun 2014 14:39:50 +0100 |
parents | 802460e60eee |
children | 41c36ecc9f32 |
rev | line source |
---|---|
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2235
diff
changeset
|
1 #define _CRT_SECURE_NO_WARNINGS |
0 | 2 #include <io.h> |
3 #include <direct.h> | |
2336 | 4 #include "mm7_unsorted_subs.h" |
2350
7c10dfb6d802
Finishing moving all known UI functions to their appropriate headers
Grumpy7
parents:
2341
diff
changeset
|
5 #include "UI\UIPartyCreation.h" |
7c10dfb6d802
Finishing moving all known UI functions to their appropriate headers
Grumpy7
parents:
2341
diff
changeset
|
6 #include "GUIButton.h" |
2336 | 7 |
8 | |
1262 | 9 #include "mm7_data.h" |
1016 | 10 #include "Sprites.h" |
11 | |
12 #include "LightmapBuilder.h" | |
13 #include "DecalBuilder.h" | |
14 #include "ParticleEngine.h" | |
15 #include "Mouse.h" | |
16 #include "Keyboard.h" | |
17 #include "CShow.h" | |
18 #include "GammaControl.h" | |
19 #include "stru6.h" | |
20 | |
21 #include "Vis.h" | |
0 | 22 #include "MapInfo.h" |
23 #include "Game.h" | |
24 #include "GUIWindow.h" | |
25 #include "GUIFont.h" | |
26 #include "Party.h" | |
27 #include "AudioPlayer.h" | |
28 #include "Outdoor.h" | |
1637 | 29 #include "Outdoor_stuff.h" |
0 | 30 #include "Overlays.h" |
31 #include "Arcomage.h" | |
32 #include "LOD.h" | |
2337
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2336
diff
changeset
|
33 #include "Log.h" |
0 | 34 #include "Actor.h" |
35 #include "Events.h" | |
36 #include "Viewport.h" | |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2035
diff
changeset
|
37 #include "OurMath.h" |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
496
diff
changeset
|
38 #include "SpriteObject.h" |
0 | 39 #include "ObjectList.h" |
40 #include "Chest.h" | |
41 #include "PaletteManager.h" | |
42 #include "DecorationList.h" | |
43 #include "SaveLoad.h" | |
44 #include "stru123.h" | |
522 | 45 #include "stru176.h" |
2044 | 46 #include "Timer.h" |
0 | 47 #include "IconFrameTable.h" |
48 #include "GUIProgressBar.h" | |
49 #include "Bink_Smacker.h" | |
50 #include "PlayerFrameTable.h" | |
51 #include "TurnEngine.h" | |
52 #include "FactionTable.h" | |
53 #include "StorylineTextTable.h" | |
54 #include "Random.h" | |
924 | 55 #include "CastSpellInfo.h" |
0 | 56 #include "stru298.h" |
1299 | 57 #include "UI\UIHouses.h" |
189 | 58 #include "texts.h" |
522 | 59 #include "MM7.h" |
1262 | 60 #include "Lights.h" |
1815 | 61 #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
|
62 #include "Level/Decoration.h" |
2052 | 63 #include "LuaVM.h" |
2290 | 64 #include "MMT.h" |
2341 | 65 #include "Registry.h" |
2052 | 66 |
67 //#include "lib/lua/lua.h" | |
2033 | 68 |
1913 | 69 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam); |
70 int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4); | |
71 bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive); | |
72 bool __fastcall Initialize(HINSTANCE hInst, char *pCmdLine); | |
73 | |
74 | |
0 | 75 //----- (004BBA85) -------------------------------------------------------- |
1529 | 76 void CheckBountyRespawnAndAward() |
0 | 77 { |
78 int i; // eax@2 | |
1529 | 79 int rand_monster_id; // edx@3 |
0 | 80 |
81 uDialogueType = 83; | |
82 pDialogueWindow->Release(); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2212
diff
changeset
|
83 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, 0, 0); |
1529 | 84 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" |
945 | 85 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
832 | 86 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
1529 | 87 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_0, 83, 0, "", 0); |
972 | 88 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
747 | 89 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
1529 | 90 //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
|
91 if ( pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed ) |
1529 | 92 { |
93 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
|
94 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 | 95 for ( i = rand(); ; i = rand() ) |
96 { | |
1529 | 97 rand_monster_id = i % 258 + 1; |
98 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand_monster_id; | |
99 if ( (unsigned __int16)rand_monster_id < 0x73u || (unsigned __int16)rand_monster_id > 0x84u ) | |
0 | 100 { |
1529 | 101 if ( ((unsigned __int16)rand_monster_id < 0xEBu || (unsigned __int16)rand_monster_id > 0xFCu) |
102 && ((unsigned __int16)rand_monster_id < 0x85u || (unsigned __int16)rand_monster_id > 0x96u) | |
103 && ((unsigned __int16)rand_monster_id < 0x97u || (unsigned __int16)rand_monster_id > 0xBAu) | |
104 && ((unsigned __int16)rand_monster_id < 0xC4u || (unsigned __int16)rand_monster_id > 0xC6u) ) | |
0 | 105 break; |
106 } | |
107 } | |
108 } | |
1529 | 109 bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]; |
110 if ( !pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) | |
111 { | |
112 bountyHunting_text = pNPCTopics[351].pText; | |
113 if ( !pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) | |
114 bountyHunting_text = pNPCTopics[353].pText; | |
115 } | |
116 else//get prize | |
117 { | |
118 if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) | |
0 | 119 { |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1826
diff
changeset
|
120 pParty->PartyFindsGold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); |
1529 | 121 for ( uint i = 0; i < 4; ++i ) |
122 pParty->pPlayers[i].SetVariable(VAR_Award, 86); | |
123 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel; | |
124 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0; | |
125 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false; | |
0 | 126 } |
1529 | 127 bountyHunting_text = pNPCTopics[352].pText; |
128 } | |
0 | 129 } |
130 | |
131 //----- (004BF91E) -------------------------------------------------------- | |
2061 | 132 unsigned int GameOverMenu(void *ecx0) |
0 | 133 { |
1838 | 134 const char *v1; // eax@2 |
0 | 135 unsigned int result; // eax@3 |
1838 | 136 const char *v6; // eax@10 |
137 const char *v7; // edx@10 | |
138 const char *v8; // ecx@12 | |
139 const char *v9; // eax@14 | |
0 | 140 unsigned int v10; // eax@25 |
141 GUIWindow pWindow; // [sp+34h] [bp-9Ch]@1 | |
142 unsigned int v14; // [sp+A4h] [bp-2Ch]@5 | |
143 void *v15; // [sp+A8h] [bp-28h]@1 | |
1838 | 144 const char *pInString; // [sp+ACh] [bp-24h]@5 |
0 | 145 unsigned int v17; // [sp+B0h] [bp-20h]@5 |
146 unsigned int v18; // [sp+B4h] [bp-1Ch]@5 | |
147 unsigned int v19; // [sp+B8h] [bp-18h]@5 | |
148 int v20; // [sp+BCh] [bp-14h]@7 | |
149 GUIFont *pFont; // [sp+C4h] [bp-Ch]@1 | |
150 unsigned __int64 v23; // [sp+C8h] [bp-8h]@5 | |
151 | |
152 v15 = ecx0; | |
153 | |
154 RGBTexture _this; // [sp+Ch] [bp-C4h]@1 | |
155 //RGBTexture::RGBTexture(&this); | |
156 | |
2061 | 157 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_4000; |
0 | 158 bGameoverLoop = 1; |
159 pVideoPlayer->bStopBeforeSchedule = 0; | |
160 pAudioPlayer->StopChannels(-1, -1); | |
161 pRenderer->BeginScene(); | |
162 pRenderer->ClearBlack(); | |
163 pRenderer->EndScene(); | |
164 pRenderer->Present(); | |
165 | 165 pVideoPlayer->pResetflag = 0; |
484 | 166 _449B57_test_bit(pParty->_quest_bits, 99); |
0 | 167 _this.Load("winbg.pcx", 2); |
168 pRenderer->BeginScene(); | |
169 pRenderer->DrawTextureRGB(0, 0, &_this); | |
170 pRenderer->EndScene(); | |
171 free(_this.pPixels); | |
172 _this.pPixels = 0; | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2212
diff
changeset
|
173 window_SpeakInHouse = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0); |
0 | 174 pWindow.uFrameX = 75; |
175 pWindow.uFrameY = 60; | |
176 pWindow.uFrameWidth = 469; | |
177 pWindow.uFrameHeight = 338; | |
178 pWindow.uFrameZ = 543; | |
179 pWindow.uFrameW = 397; | |
180 | 180 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
|
181 if ( pParty->IsPartyGood() ) |
2133 | 182 v1 = pGlobalTXT_LocalizationStrings[675];//"Splendid job! With the activation of the Gate, a thousand worlds lie at your feet. Perhaps on one of them you will find the Ancients themselves, and return with the fruits their great civilization has to offer your world and your kingdom." |
0 | 183 else |
184 { | |
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
|
185 result = pParty->IsPartyEvil(); |
0 | 186 if ( !(short)result ) |
187 return result; | |
2133 | 188 v1 = pGlobalTXT_LocalizationStrings[676];//"Brilliant! The completion of the Heavenly Forge has provided enough Ancient weapons to crush all resistance to your plans. Soon the world will bow to your every whim! Still, you can't help but wonder what was beyond the Gate the other side was trying so hard to build." |
0 | 189 } |
190 pInString = v1; | |
191 v23 = pParty->uTimePlayed - 138240; | |
2373 | 192 v19 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24; |
193 v14 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C / 0xC; | |
194 v18 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C % 0xC; | |
0 | 195 v17 = v19 % 0x1C; |
196 if ( !v19 ) | |
197 v19 = 1; | |
198 pRenderer->BeginScene(); | |
2133 | 199 pWindow.DrawTitleText(pFont, 1, 0x23, 1, pGlobalTXT_LocalizationStrings[9], 3);//Congratulations! |
0 | 200 v23 = 0i64; |
201 v20 = 0; | |
2133 | 202 for ( uint i = 0; i < 4; i++ ) |
89 | 203 { |
2133 | 204 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[129], pParty->pPlayers[i].pName, pParty->pPlayers[i].GetBaseLevel(), pClassNames[pParty->pPlayers[i].classType]);//%s the Level %u %s |
205 pWindow.DrawTitleText(pFont, 1, i * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46, 1, pTmpBuf.data(), 3); | |
206 v23 += pParty->pPlayers[i].uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8)); | |
0 | 207 } |
208 v23 = (signed __int64)v23 / v19; | |
2133 | 209 v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xC, 0); |
210 pWindow.DrawTitleText(pFont, 1, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1, v6, 0); | |
211 strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]);//Total Time: | |
2373 | 212 |
0 | 213 v7 = pGlobalTXT_LocalizationStrings[56]; |
214 if ( v17 != 1 ) | |
215 v7 = pGlobalTXT_LocalizationStrings[57]; | |
2373 | 216 |
217 v8 = pGlobalTXT_LocalizationStrings[146];//Month, Ìåñÿö | |
0 | 218 if ( v18 != 1 ) |
2373 | 219 v8 = pGlobalTXT_LocalizationStrings[148];//Months,Ìåñÿöåâ |
220 | |
0 | 221 v9 = pGlobalTXT_LocalizationStrings[245]; |
222 if ( v14 != 1 ) | |
223 v9 = pGlobalTXT_LocalizationStrings[132]; | |
2373 | 224 |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
225 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
|
226 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
227 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
|
228 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23); |
2133 | 229 pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1u, pTmpBuf.data(), 3); |
2061 | 230 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000; |
0 | 231 pRenderer->EndScene(); |
232 pRenderer->Present(); | |
2153 | 233 //if ( pRenderer->pRenderD3D ) |
0 | 234 pRenderer->pBeforePresentFunction(); |
2069 | 235 pRenderer->SaveWinnersCertificate("MM7_Win.Pcx"); |
1583 | 236 free(pFont); |
336 | 237 window_SpeakInHouse->Release(); |
238 window_SpeakInHouse = 0; | |
0 | 239 if ( v15 == (void *)2 ) |
240 { | |
241 result = pMessageQueue_50CBD0->uNumMessages; | |
242 } | |
243 else | |
244 { | |
245 LODWORD(v23) = GetTickCount() + 5000; | |
246 while ( (unsigned int)v23 > GetTickCount() ) | |
247 ; | |
1532 | 248 for (MSG msg; PeekMessage(&msg, 0, 0, 0, PM_REMOVE);) |
0 | 249 { |
1532 | 250 if (msg.message == WM_QUIT) |
0 | 251 Game_DeinitializeAndTerminate(0); |
1532 | 252 TranslateMessage(&msg); |
253 DispatchMessage(&msg); | |
0 | 254 } |
255 if ( pMessageQueue_50CBD0->uNumMessages ) | |
256 { | |
257 LOBYTE(v10) = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
258 pMessageQueue_50CBD0->uNumMessages = v10; | |
259 } | |
260 pKeyActionMap->ResetKeys(); | |
261 pKeyActionMap->uLastKeyPressed = 0; | |
262 do | |
263 { | |
1532 | 264 for (MSG msg; PeekMessage(&msg, 0, 0, 0, PM_REMOVE);) |
0 | 265 { |
1532 | 266 if (msg.message == WM_QUIT) |
0 | 267 Game_DeinitializeAndTerminate(0); |
1532 | 268 TranslateMessage(&msg); |
269 DispatchMessage(&msg); | |
0 | 270 } |
271 } | |
272 while ( !pKeyActionMap->uLastKeyPressed ); | |
273 result = pMessageQueue_50CBD0->uNumMessages; | |
274 if ( pMessageQueue_50CBD0->uNumMessages ) | |
275 { | |
276 result = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
277 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
278 } | |
279 } | |
280 if ( v15 ) | |
281 { | |
437 | 282 /*if ( (signed int)result < 40 ) |
283 { | |
284 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit; | |
285 }*/ | |
286 pMessageQueue_50CBD0->AddMessage(UIMSG_Quit, 1, 0); | |
0 | 287 } |
288 else | |
289 { | |
437 | 290 pMessageQueue_50CBD0->AddMessage(UIMSG_ShowFinalWindow, 1, 0); |
291 /*if ( (signed int)result < 40 ) | |
292 { | |
293 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5; | |
0 | 294 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; |
295 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
296 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; | |
297 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 298 }*/ |
0 | 299 } |
300 bGameoverLoop = 0; | |
301 return result; | |
302 } | |
303 | |
304 //----- (00451007) -------------------------------------------------------- | |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
305 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 | 306 unsigned short *pDst, int dstWidth, int dstHeight, int dstPitch, |
307 int a10, int a11) | |
308 { | |
309 int result; // eax@1 | |
310 float v17; // ST3C_4@12 | |
311 float v18; // ST38_4@12 | |
312 unsigned int v19; // esi@12 | |
313 int v21; // eax@18 | |
314 unsigned int v22; // ecx@25 | |
315 unsigned int v23; // eax@29 | |
1146
b4ade2580ae3
sub_451007_scale_image_bicubic cleanup - some variable renaming, code shuffling
Grumpy7
parents:
1145
diff
changeset
|
316 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
|
317 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
|
318 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
|
319 unsigned int widthRatioPlusOne; // [sp+14h] [bp-74h]@218 |
2334 | 320 // int v160; // [sp+3Ch] [bp-4Ch]@13 |
0 | 321 unsigned __int16 *v175; // [sp+4Ch] [bp-3Ch]@13 |
322 unsigned __int16 *v193; // [sp+5Ch] [bp-2Ch]@7 | |
2314 | 323 //signed int v231; // [sp+78h] [bp-10h]@7 |
0 | 324 __int64 v240; // [sp+7Ch] [bp-Ch]@12 |
325 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
|
326 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
|
327 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
|
328 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
|
329 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
|
330 int field_0_bits; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
331 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
|
332 |
1146
b4ade2580ae3
sub_451007_scale_image_bicubic cleanup - some variable renaming, code shuffling
Grumpy7
parents:
1145
diff
changeset
|
333 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
|
334 switch(field0value) |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
335 { |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
336 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
|
337 break; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
338 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
|
339 break; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
340 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
|
341 break; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
342 default: |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
343 return field0value; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
344 } |
1144
f544cd6f7168
sub_451007_scale_image_bicubic cleanup - preparations for further condition body extractions
Grumpy7
parents:
1140
diff
changeset
|
345 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
|
346 switch(field20value) |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
347 { |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
348 case 8: field_20_bits = 1; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
349 break; |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
350 case 16: field_20_bits = 2; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
351 break; |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
352 case 32: field_20_bits = 4; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
353 break; |
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
354 default: |
1144
f544cd6f7168
sub_451007_scale_image_bicubic cleanup - preparations for further condition body extractions
Grumpy7
parents:
1140
diff
changeset
|
355 return field20value; |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
356 } |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
357 |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
358 result = (int)pDst; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
359 v193 = pDst; |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
360 if ( dstHeight <= 0 ) |
1129
9362028fccd1
sub_451007_scale_image_bicubic cleanup - extracting common bodies from conditions
Grumpy7
parents:
1128
diff
changeset
|
361 return result; |
1600
0016b08ab621
stru350::sub_451007_scale_image_bicubic - fixing a memory access bug
Grumpy7
parents:
1546
diff
changeset
|
362 |
2212 | 363 //do |
2314 | 364 for ( int height = 0; height < dstHeight; height++ ) |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
365 { |
2314 | 366 for (int width = 0; width < dstWidth; width++) |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
367 { |
2314 | 368 a6s = (double)width / (double)dstWidth * (double)srcWidth; |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
369 widthRatio = bankersRounding(a6s); |
2314 | 370 a6t = (double)(width + 1) / (double)dstWidth * (double)srcWidth; |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
371 widthRatioPlusOne = bankersRounding(a6t); |
2314 | 372 |
373 v17 = (double)height / (double)dstHeight * (double)srcHeight; | |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
374 heightRatio = bankersRounding(v17); |
2314 | 375 v18 = (double)(height + 1) / (double)dstHeight * (double)srcHeight; |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
376 heightRatioPlusOne = bankersRounding(v18); |
2314 | 377 |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
378 v251 = 0; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
379 v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
380 v252 = 0; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
381 a6b = 0; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
382 v240 = 0i64; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
383 |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
384 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
|
385 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
|
386 { |
2314 | 387 //int ratioDiff = widthRatioPlusOne - widthRatio; |
388 for(int ratioDiff = 0; ratioDiff < widthRatioPlusOne - widthRatio; ratioDiff++) | |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
389 { |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
390 if(field0value == 32) |
2314 | 391 v21 = _450FB1(((int*)v175)[ratioDiff]); |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
392 else if(field0value == 16) |
2314 | 393 v21 = _450FB1(((_WORD*)v175)[ratioDiff]); |
1901 | 394 else if (field0value == 8) |
2314 | 395 v21 = _450FB1(((unsigned __int8*)v175)[ratioDiff]); |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
396 v240 += ((unsigned int)v21 >> 24); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
397 a6b += BYTE2(v21); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
398 v252 += BYTE1(v21); |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
399 v251 += (unsigned __int8)v21; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
400 } |
1901 | 401 if (field0value == 32) |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
402 v175 += 2 * srcPitch; |
1901 | 403 else if (field0value == 16) |
2314 | 404 v175 += srcPitch; |
1901 | 405 else if (field0value == 8) |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
406 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
|
407 } |
2314 | 408 |
1149
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
409 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
|
410 if ( v19 ) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
411 { |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
412 a6b /= v19; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
413 v252 /= v19; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
414 v251 /= v19; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
415 } |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
416 if ( v22 != 255 ) |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
417 v22 &= 0x7FFFFFFFu; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
418 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
|
419 *(_DWORD *)v193 = v23; |
05b30ed00d7c
sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for
Grumpy7
parents:
1148
diff
changeset
|
420 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
|
421 } |
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
422 v193 = (unsigned __int16 *)((char *)v193 + field_20_bits * (dstPitch - dstWidth)); |
2212 | 423 //++v231; |
2314 | 424 result = height; |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
425 } |
2212 | 426 //while(v231 < dstHeight); |
1148
ee6bccef32e8
sub_451007_scale_image_bicubic cleanup - final condition collapsing, remaining labels removed, etc
Grumpy7
parents:
1147
diff
changeset
|
427 return result; |
0 | 428 } |
429 | |
430 | |
431 //----- (00450DDE) -------------------------------------------------------- | |
432 stru350 *stru350::_450DDE() | |
433 { | |
434 _450DF1(&stru_4E82A4, &stru_4E82A4); | |
435 return this; | |
436 } | |
437 | |
438 //----- (00450DF1) -------------------------------------------------------- | |
439 bool stru350::_450DF1(const stru355 *p1, const stru355 *p2) | |
440 { | |
441 //stru350 *v3; // esi@1 | |
442 //void *result; // eax@1 | |
443 unsigned int v5; // ecx@2 | |
444 int v6; // edi@2 | |
445 int v7; // edx@2 | |
446 unsigned int v8; // ecx@8 | |
447 int v9; // edi@8 | |
448 int v10; // edx@8 | |
449 int v11; // ecx@12 | |
450 int v12; // edi@12 | |
451 unsigned int v13; // ecx@12 | |
452 int v14; // edx@12 | |
453 int v15; // ecx@16 | |
454 unsigned int v16; // edx@16 | |
455 int v17; // ecx@16 | |
456 int v18; // edi@16 | |
457 char v19; // zf@20 | |
458 unsigned int v20; // ecx@21 | |
459 int v21; // edi@21 | |
460 int v22; // edx@21 | |
461 unsigned int v23; // ecx@27 | |
462 int v24; // edi@27 | |
463 int v25; // edx@27 | |
464 int v26; // ecx@31 | |
465 int v27; // edi@31 | |
466 unsigned int v28; // ecx@31 | |
467 int v29; // edx@31 | |
468 int v30; // ebx@35 | |
469 int v31; // ecx@35 | |
470 int v32; // edi@35 | |
471 int v33; // edx@35 | |
472 unsigned int i; // ecx@35 | |
473 int v35; // ecx@39 | |
474 unsigned int v36; // edx@39 | |
475 int v37; // ecx@39 | |
476 int v38; // ebx@39 | |
477 | |
478 //v3 = this; | |
479 memcpy(&field_0, p1, sizeof(stru355)); | |
480 memcpy(&field_20, p2, sizeof(stru355)); | |
481 //result = memcpy(&v3->field_20, p2, 0x20u); | |
482 //LOBYTE(result) = 1; | |
483 if (field_0.field_4 & 1) | |
484 { | |
485 v5 = field_0.field_1C; | |
486 v6 = 0; | |
487 v7 = 0; | |
488 while ( !(v5 & 1) ) | |
489 { | |
490 ++v6; | |
491 v5 >>= 1; | |
492 } | |
493 do | |
494 { | |
495 v5 >>= 1; | |
496 ++v7; | |
497 } | |
498 while ( v5 & 1 ); | |
499 field_40 = 32 - v7 - v6; | |
500 } | |
501 else | |
502 { | |
503 field_40 = 0; | |
504 } | |
505 v8 = field_0.field_10; | |
506 v9 = 0; | |
507 v10 = 0; | |
508 while ( !(v8 & 1) ) | |
509 { | |
510 ++v9; | |
511 v8 >>= 1; | |
512 } | |
513 do | |
514 { | |
515 v8 >>= 1; | |
516 ++v10; | |
517 } | |
518 while ( v8 & 1 ); | |
519 v11 = 24 - v10 - v9; | |
520 v12 = 0; | |
521 field_48 = v11; | |
522 v13 = field_0.field_14; | |
523 v14 = 0; | |
524 while ( !(v13 & 1) ) | |
525 { | |
526 ++v12; | |
527 v13 >>= 1; | |
528 } | |
529 do | |
530 { | |
531 v13 >>= 1; | |
532 ++v14; | |
533 } | |
534 while ( v13 & 1 ); | |
535 v15 = 16 - v14; | |
536 v16 = field_0.field_18; | |
537 field_50 = v15 - v12; | |
538 v17 = 0; | |
539 v18 = 0; | |
540 while ( !(v16 & 1) ) | |
541 { | |
542 ++v17; | |
543 v16 >>= 1; | |
544 } | |
545 do | |
546 { | |
547 v16 >>= 1; | |
548 ++v18; | |
549 } | |
550 while ( v16 & 1 ); | |
551 v19 = (field_20.field_4 & 1) == 0; | |
552 field_58 = v17 - v18 + 8; | |
553 if ( v19 ) | |
554 { | |
555 field_44 = 0; | |
556 } | |
557 else | |
558 { | |
559 v20 = field_20.field_1C; | |
560 v21 = 0; | |
561 v22 = 0; | |
562 while ( !(v20 & 1) ) | |
563 { | |
564 ++v21; | |
565 v20 >>= 1; | |
566 } | |
567 do | |
568 { | |
569 v20 >>= 1; | |
570 ++v22; | |
571 } | |
572 while ( v20 & 1 ); | |
573 field_44 = 32 - v22 - v21; | |
574 } | |
575 v23 = field_20.field_10; | |
576 v24 = 0; | |
577 v25 = 0; | |
578 while ( !(v23 & 1) ) | |
579 { | |
580 ++v24; | |
581 v23 >>= 1; | |
582 } | |
583 do | |
584 { | |
585 v23 >>= 1; | |
586 ++v25; | |
587 } | |
588 while ( v23 & 1 ); | |
589 v26 = 24 - v25 - v24; | |
590 v27 = 0; | |
591 field_4C = v26; | |
592 v28 = field_20.field_14; | |
593 v29 = 0; | |
594 while ( !(v28 & 1) ) | |
595 { | |
596 ++v27; | |
597 v28 >>= 1; | |
598 } | |
599 do | |
600 { | |
601 v28 >>= 1; | |
602 ++v29; | |
603 } | |
604 while ( v28 & 1 ); | |
605 v30 = 0; | |
606 v31 = 16 - v29 - v27; | |
607 v32 = field_20.field_18; | |
608 field_54 = v31; | |
609 v33 = 0; | |
610 for ( i = v32; !(i & 1); i >>= 1 ) | |
611 ++v30; | |
612 do | |
613 { | |
614 i >>= 1; | |
615 ++v33; | |
616 } | |
617 while ( i & 1 ); | |
618 v35 = 32 - v33; | |
619 v36 = v32; | |
620 field_5C = v35 - v30; | |
621 v37 = 0; | |
622 v38 = 0; | |
623 while ( !(v36 & 1) ) | |
624 { | |
625 ++v37; | |
626 v36 >>= 1; | |
627 } | |
628 do | |
629 { | |
630 v36 >>= 1; | |
631 ++v38; | |
632 } | |
633 while ( v36 & 1 ); | |
634 field_5C = v37 - v38 + 8; | |
635 return true; | |
636 } | |
637 | |
638 //----- (00450F55) -------------------------------------------------------- | |
639 unsigned int stru350::_450F55(int a2) | |
640 { | |
641 int v2 = a2 & stru_4E82A4.field_1C; | |
642 if (field_20.field_4 & 1) | |
643 v2 = (unsigned int)v2 >> this->field_44; | |
644 return v2 & field_20.field_1C | | |
645 field_20.field_10 & ((a2 & (unsigned int)stru_4E82A4.field_10) >> field_4C) | | |
646 field_20.field_14 & ((a2 & (unsigned int)stru_4E82A4.field_14) >> field_54) | | |
647 field_20.field_18 & ((a2 & (unsigned int)stru_4E82A4.field_18) >> field_5C); | |
648 } | |
649 | |
650 //----- (00450FB1) -------------------------------------------------------- | |
651 int stru350::_450FB1(int a2) | |
652 { | |
653 int v2 = 0; | |
654 int v4 = field_0.field_4 & 1; | |
655 if ( v4 ) | |
656 v2 = a2 & field_0.field_1C; | |
657 if ( v4 ) | |
658 v2 <<= field_40; | |
659 return v2 | ((a2 & field_0.field_10) << field_48) | ((a2 & field_0.field_14) << field_50) | ((a2 & field_0.field_18) << field_58); | |
660 } | |
661 | |
662 //----- (00452442) -------------------------------------------------------- | |
1583 | 663 unsigned int __fastcall _452442_color_cvt(unsigned __int16 a1, unsigned __int16 a2, int a3, int a4) |
0 | 664 { |
665 int v4; // ebx@0 | |
666 __int16 v5; // ST14_2@1 | |
667 __int16 v6; // dx@1 | |
668 int v7; // ecx@1 | |
669 __int16 v8; // ST10_2@1 | |
670 int v9; // edi@1 | |
671 unsigned __int16 v10; // dh@1@1 | |
672 int v11; // ebx@1 | |
673 int v12; // ebx@1 | |
674 __int16 a3a; // [sp+1Ch] [bp+8h]@1 | |
675 | |
676 v5 = a2 >> 2; | |
677 v6 = (unsigned __int16)a4 >> 2; | |
678 v8 = a1 >> 2; | |
679 a3a = (unsigned __int16)a3 >> 2; | |
680 LOWORD(v7) = a3a; | |
681 v9 = v7; | |
682 LOWORD(v4) = ((unsigned __int16)a4 >> 2) & 0xE0; | |
683 LOWORD(v7) = a3a & 0xE0; | |
684 LOWORD(v9) = v9 & 0x1C00; | |
685 v11 = v7 + v4; | |
686 LOWORD(v7) = v5 & 0xE0; | |
687 v12 = v7 + v11; | |
688 LOWORD(v7) = v8 & 0xE0; | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1408
diff
changeset
|
689 __debugbreak(); // warning C4700: uninitialized local variable 'v10' used |
848 | 690 return (PID_TYPE(v8) + PID_TYPE(v5) + PID_TYPE(a3a) + PID_TYPE(v6)) | (v7 + v12) | ((v8 & 0x1C00) |
0 | 691 + (v5 & 0x1C00) |
692 + v9 | |
693 + (__PAIR__(v10, (unsigned __int16)a4 >> 2) & 0x1C00)); | |
694 } | |
695 | |
696 //----- (004547E4) -------------------------------------------------------- | |
697 void FactionTable::Initialize() | |
698 { | |
237 | 699 int i; |
700 char* test_string; | |
701 unsigned char c; | |
702 bool break_loop; | |
703 unsigned int temp_str_len; | |
704 char* tmp_pos; | |
705 int decode_step; | |
2334 | 706 // int item_counter; |
237 | 707 |
2369
bddcaf5d5db2
removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
Grumpy7
parents:
2362
diff
changeset
|
708 free(pHostileTXT_Raw); |
0 | 709 pHostileTXT_Raw = (char *)pEvents_LOD->LoadRaw("hostile.txt", 0); |
710 strtok(pHostileTXT_Raw, "\r"); | |
2101 | 711 for ( i=0; i < 89; ++i ) |
712 { | |
713 test_string = strtok(NULL, "\r") + 1; | |
714 break_loop = false; | |
715 decode_step=0; | |
716 do | |
717 { | |
718 c = *(unsigned char*)test_string; | |
719 temp_str_len = 0; | |
720 while((c!='\t') && (c > 0)) | |
721 { | |
722 ++temp_str_len; | |
723 c = test_string[temp_str_len]; | |
724 } | |
725 tmp_pos=test_string+temp_str_len; | |
726 if (*tmp_pos == 0) | |
727 break_loop = true; | |
728 *tmp_pos = 0; | |
729 if (temp_str_len) | |
730 { | |
731 if ( decode_step >= 1 && decode_step < 90 ) | |
732 relations[decode_step-1][i] = atoi(test_string); | |
733 } | |
734 else | |
735 break_loop = true; | |
736 ++decode_step; | |
737 test_string=tmp_pos+1; | |
738 } | |
739 while ((decode_step < 92) && !break_loop ); | |
740 } | |
2369
bddcaf5d5db2
removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
Grumpy7
parents:
2362
diff
changeset
|
741 free(pHostileTXT_Raw); |
bddcaf5d5db2
removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
Grumpy7
parents:
2362
diff
changeset
|
742 pHostileTXT_Raw = nullptr; |
0 | 743 } |
744 | |
745 //----- (004610AA) -------------------------------------------------------- | |
1637 | 746 void __fastcall PrepareToLoadODM(unsigned int bLoading, ODMRenderParams *a2) |
0 | 747 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
748 pGameLoadingUI_ProgressBar->Reset(27); |
0 | 749 pSoundList->_4A9D79(0); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
750 uCurrentlyLoadedLevelType = LEVEL_Outdoor; |
2099 | 751 ODM_LoadAndInitialize(pCurrentMapName, a2); |
752 if ( !bLoading ) | |
0 | 753 TeleportToStartingPoint(uLevel_StartingPointType); |
754 viewparams->_443365(); | |
755 PlayLevelMusic(); | |
756 } | |
757 // 6BE35C: using guessed type int uLevel_StartingPointType; | |
758 | |
759 //----- (00461103) -------------------------------------------------------- | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
760 void _461103_load_level_sub() |
0 | 761 { |
762 int v4; // edx@8 | |
763 signed int v6; // esi@14 | |
764 signed int v8; // ecx@16 | |
765 int v12; // esi@25 | |
766 int v13; // eax@26 | |
767 __int16 v14; // ax@41 | |
768 signed int v17; // [sp+14h] [bp-48h]@3 | |
769 signed int v18; // [sp+14h] [bp-48h]@23 | |
770 int v19; // [sp+18h] [bp-44h]@1 | |
771 signed int v20; // [sp+18h] [bp-44h]@14 | |
772 int v21[16]; // [sp+1Ch] [bp-40h]@17 | |
773 | |
598 | 774 GenerateItemsInChest(); |
0 | 775 pGameLoadingUI_ProgressBar->Progress(); |
2101 | 776 pParty->uFlags |= 2; |
0 | 777 pParty->field_7B5_in_arena_quest = 0; |
778 dword_5C6DF8 = 1; | |
291 | 779 pNPCStats->uNewlNPCBufPos = 0; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
780 v19 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 781 |
782 //v15 = 0; | |
783 for (uint i = 0; i < uNumActors; ++i) | |
784 //if ( (signed int)uNumActors > 0 ) | |
785 { | |
2099 | 786 //Actor* pActor = &pActors[i]; |
0 | 787 //v2 = (char *)&pActors[0].uNPC_ID; |
788 //do | |
789 //{ | |
2101 | 790 //v3 = pActors[i].pMonsterInfo.uID; |
0 | 791 v17 = 0; |
2099 | 792 if ( pActors[i].pMonsterInfo.uID >= 115 && pActors[i].pMonsterInfo.uID <= 186 |
793 || pActors[i].pMonsterInfo.uID >= 232 && pActors[i].pMonsterInfo.uID <= 249 ) | |
0 | 794 v17 = 1; |
795 //v1 = 0; | |
2101 | 796 v4 = (pActors[i].pMonsterInfo.uID - 1) % 3; |
0 | 797 if ( 2 == v4 ) |
798 { | |
2099 | 799 if ( pActors[i].sNPC_ID && pActors[i].sNPC_ID < 5000 ) |
0 | 800 continue; |
801 } | |
802 else | |
803 { | |
804 if ( v4 != 1 ) | |
805 { | |
2099 | 806 if ( v4 == 0 && pActors[i].sNPC_ID == 0 ) |
2101 | 807 pActors[i].sNPC_ID = 0; |
808 continue; | |
0 | 809 } |
810 } | |
2099 | 811 if ( pActors[i].sNPC_ID > 0 && pActors[i].sNPC_ID < 5000 ) |
0 | 812 continue; |
813 if ( v17 ) | |
814 { | |
2101 | 815 pNPCStats->InitializeAdditionalNPCs(&pNPCStats->pAdditionalNPC[pNPCStats->uNewlNPCBufPos], pActors[i].pMonsterInfo.uID, 0, v19); |
291 | 816 v14 = LOWORD(pNPCStats->uNewlNPCBufPos) + 5000; |
817 ++pNPCStats->uNewlNPCBufPos; | |
2099 | 818 pActors[i].sNPC_ID = v14; |
0 | 819 continue; |
820 } | |
2099 | 821 pActors[i].sNPC_ID = 0; |
0 | 822 //++v15; |
823 //v2 += 836; | |
824 //} | |
825 //while ( v15 < (signed int)uNumActors ); | |
826 } | |
827 | |
828 pGameLoadingUI_ProgressBar->Progress(); | |
829 | |
830 //v5 = uNumActors; | |
831 v6 = 0; | |
832 v20 = 0; | |
833 //v16 = v1; | |
834 | |
835 for (uint i = 0; i < uNumActors; ++i) | |
836 { | |
837 //v7 = (char *)&pActors[0].pMonsterInfo; | |
838 //do | |
839 //{ | |
2101 | 840 for ( v8 = 0; v8 < v6; ++v8 ) |
841 { | |
842 if ( v21[v8] == pActors[i].pMonsterInfo.uID - 1 ) | |
843 break; | |
844 } | |
845 | |
846 if ( v8 == v6 ) | |
847 { | |
848 v21[v6++] = pActors[i].pMonsterInfo.uID - 1; | |
849 v20 = v6; | |
850 if ( v6 == 16 ) | |
851 break; | |
852 } | |
853 //++v16; | |
854 //v7 += 836; | |
0 | 855 //} |
856 //while ( v16 < (signed int)v5 ); | |
857 } | |
858 | |
859 pGameLoadingUI_ProgressBar->Progress(); | |
860 | |
2101 | 861 for ( int _v0 = 0; _v0 < v6; ++_v0 ) |
0 | 862 { |
2101 | 863 for ( v18 = 4; v18; --v18 ) |
864 pSoundList->LoadSound(pMonsterList->pMonsters[v21[_v0]].pSoundSampleIDs[4 - v18], 0); | |
0 | 865 v12 = 0; |
866 do | |
2101 | 867 v13 = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[pMonsterStats->pInfos[v21[_v0] + 1].uSpell1ID], 1); |
0 | 868 while ( v13 ); |
869 } | |
870 //v0 = pGameLoadingUI_ProgressBar; | |
871 //v1 = 0; | |
872 | |
873 pGameLoadingUI_ProgressBar->Progress(); | |
874 | |
2061 | 875 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_ACTORS) |
0 | 876 uNumActors = 0; |
2061 | 877 if ( dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_NO_DECORATIONS) |
0 | 878 uNumLevelDecorations = 0; |
1459 | 879 init_event_triggers(); |
0 | 880 |
881 pGameLoadingUI_ProgressBar->Progress(); | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
882 |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
883 pGame->pIndoorCameraD3D->vPartyPos.x = 0; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
884 pGame->pIndoorCameraD3D->vPartyPos.y = 0; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
885 pGame->pIndoorCameraD3D->vPartyPos.z = 100; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
886 pGame->pIndoorCameraD3D->sRotationX = 0; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
887 pGame->pIndoorCameraD3D->sRotationY = 0; |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
888 viewparams->bRedrawGameUI = true; |
783 | 889 uLevel_StartingPointType = MapStartPoint_Party; |
0 | 890 pSprites_LOD->_461397(); |
891 pPaletteManager->LockTestAll(); | |
892 if ( pParty->pPickedItem.uItemID != 0 ) | |
893 pMouse->SetCursorBitmapFromItemID(pParty->pPickedItem.uItemID); | |
894 } | |
895 | |
896 //----- (004613C4) -------------------------------------------------------- | |
1459 | 897 void init_event_triggers() |
0 | 898 { |
1459 | 899 uint id = pDecorationList->GetDecorIdByName("Event Trigger"); |
900 | |
901 num_event_triggers = 0; | |
902 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
903 if (pLevelDecorations[i].uDecorationDescID == id) | |
904 event_triggers[num_event_triggers++] = i; | |
0 | 905 } |
906 | |
907 //----- (004627B7) -------------------------------------------------------- | |
762 | 908 void MainMenu_Loop() |
0 | 909 { |
910 GUIButton *pButton; // eax@27 | |
911 unsigned int pControlParam; // ecx@35 | |
2334 | 912 // int v10; // ecx@36 |
913 // int v11; // ecx@37 | |
0 | 914 unsigned int pY; // [sp-18h] [bp-54h]@39 |
915 Texture *pTexture; // [sp-14h] [bp-50h]@39 | |
2334 | 916 // GUIButton *pButton2; // [sp+0h] [bp-3Ch]@27 |
0 | 917 GUIWindow *pWindow; // [sp+4h] [bp-38h]@11 |
918 | |
151 | 919 pCurrentScreen = SCREEN_GAME; |
1038 | 920 |
0 | 921 pGUIWindow2 = 0; |
2216 | 922 pAudioPlayer->StopChannels(-1, -1);//îñòàíîâèòü/ïîäãîòîâèòü êàíàë |
2219 | 923 pMouse->RemoveHoldingItem();//èçáàâèòü êóðñîð îò âåùè |
762 | 924 |
925 pIcons_LOD->_inlined_sub2(); | |
926 | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2212
diff
changeset
|
927 pWindow_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0); |
1980 | 928 Texture* pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); |
929 Texture* pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); | |
930 Texture* pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE); | |
931 Texture* pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE); | |
948 | 932 |
933 pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 'N', "", pNew, 0); | |
934 pMainMenu_BtnLoad = pWindow_MainMenu->CreateButton(495, 227, pLoad->uTextureWidth, pLoad->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowLoadWindow, 1, 'L', "", pLoad, 0); | |
935 pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, UIMSG_ShowCredits, 2, 'C', "", pCredits, 0); | |
936 pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth, pExit->uTextureHeight, 1, 0, UIMSG_ExitToWindows, 3, 0, "", pExit, 0); | |
937 | |
0 | 938 pTexture_PCX.Release(); |
939 pTexture_PCX.Load("title.pcx", 0); | |
940 SetCurrentMenuID(MENU_MAIN); | |
1984 | 941 SetForegroundWindow(window->GetApiHandle()); |
942 SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0); | |
0 | 943 while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD) |
944 { | |
945 POINT pt; | |
946 pMouse->GetCursorPos(&pt); | |
947 pWindow = pWindow_MainMenu; | |
165 | 948 if ( GetCurrentMenuID() == MENU_SAVELOAD) |
0 | 949 { |
151 | 950 if ( pCurrentScreen != SCREEN_LOADGAME ) |
0 | 951 { |
952 pTexture_PCX.Release(); | |
953 pTexture_PCX.Load("lsave640.pcx", 0); | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2212
diff
changeset
|
954 pGUIWindow2 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0); |
151 | 955 pCurrentScreen = SCREEN_LOADGAME; |
1033 | 956 LoadUI_Load(0); |
0 | 957 } |
958 pWindow = pGUIWindow_CurrentMenu; | |
959 } | |
960 | |
2061 | 961 for (MSG msg; PeekMessageW(&msg, 0, 0, 0, PM_REMOVE);) |
0 | 962 { |
963 if (msg.message == WM_QUIT) | |
964 Game_DeinitializeAndTerminate(0); | |
965 TranslateMessage(&msg); | |
2061 | 966 DispatchMessageW(&msg); |
0 | 967 } |
2061 | 968 |
969 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) | |
0 | 970 { |
971 WaitMessage(); | |
2061 | 972 continue; |
0 | 973 } |
2061 | 974 |
0 | 975 pRenderer->BeginScene(); |
976 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); | |
1038 | 977 |
165 | 978 GUI_MainMenuMessageProc(); |
0 | 979 GUI_UpdateWindows(); |
1038 | 980 |
165 | 981 if (GetCurrentMenuID() != MENU_MAIN) |
982 { | |
961 | 983 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) |
0 | 984 { |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
985 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 986 pGUIWindow_CurrentMenu->Release(); |
987 pGUIWindow_CurrentMenu = 0; | |
151 | 988 pCurrentScreen = SCREEN_GAME; |
0 | 989 viewparams->bRedrawGameUI = 1; |
990 } | |
991 } | |
992 else | |
993 { | |
1458 | 994 if ( !pModalWindow )// ??? |
0 | 995 { |
996 pButton = pWindow->pControlsHead; | |
997 for ( pButton = pWindow->pControlsHead; pButton; pButton = pButton->pNext ) | |
998 { | |
999 if ( pt.x >= (signed int)pButton->uX && pt.x <= (signed int)pButton->uZ | |
1000 && pt.y >= (signed int)pButton->uY && pt.y <= (signed int)pButton->uW | |
1001 && pWindow == pWindow_MainMenu ) | |
1002 { | |
832 | 1003 pControlParam = pButton->msg_param; |
0 | 1004 switch (pControlParam) // ïîäñâåòêà êíîïîê |
1005 { | |
1006 case 0: | |
1007 pTexture = pNew; | |
1008 pY = 172; | |
1009 break; | |
1010 case 1: | |
1011 pTexture = pLoad; | |
1012 pY = 227; | |
1013 break; | |
1014 case 2: | |
1015 pTexture = pCredits; | |
1016 pY = 282; | |
1017 break; | |
1018 case 3: | |
1019 pTexture = pExit; | |
1020 pY = 337; | |
1021 break; | |
1022 } | |
1023 pRenderer->DrawTextureIndexed(495, pY, pTexture); //ïîäñâåòêà êíîïîê | |
1024 } | |
1025 } | |
1026 } | |
1027 } | |
1028 pRenderer->EndScene(); | |
1029 pRenderer->Present(); | |
1030 } | |
970 | 1031 GUI_MainMenuMessageProc(); |
0 | 1032 pRenderer->BeginScene(); |
1033 GUI_UpdateWindows(); | |
1034 pRenderer->EndScene(); | |
1035 pRenderer->Present(); | |
961 | 1036 pTexture_PCX.Release(); |
0 | 1037 if ( pGUIWindow2 ) |
1038 { | |
1039 pGUIWindow2->Release(); | |
1040 pGUIWindow2 = 0; | |
1041 } | |
1042 pWindow_MainMenu->Release(); | |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
1043 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
0 | 1044 } |
1045 | |
1046 //----- (00464479) -------------------------------------------------------- | |
1583 | 1047 void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows() |
0 | 1048 { |
1049 int v0; // esi@9 | |
1050 | |
1051 if (pMouse) | |
1052 pMouse->SetCursorBitmap("MICON1"); | |
1053 | |
1054 pPaletteManager->ResetNonLocked(); | |
1055 pBitmaps_LOD->ReleaseAll2(); | |
1056 pSprites_LOD->DeleteSomeOtherSprites(); | |
1057 pIcons_LOD->ReleaseAll2(); | |
2152 | 1058 |
0 | 1059 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
1060 pIndoor->Release(); | |
1061 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
1583 | 1062 pOutdoor->Release(); |
0 | 1063 |
1064 pAudioPlayer->StopChannels(-1, -1); | |
1065 pSoundList->_4A9D79(0); | |
1066 uCurrentlyLoadedLevelType = LEVEL_null; | |
1067 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
1068 v0 = uNumVisibleWindows; | |
349 | 1069 pParty->armageddon_timer = 0; |
0 | 1070 while ( v0 > 0 ) |
1071 pWindowList[pVisibleWindowsIdxs[v0--] - 1].Release(); | |
1072 } | |
1073 | |
1074 //----- (004646F0) -------------------------------------------------------- | |
1458 | 1075 void PrepareWorld(unsigned int _0_box_loading_1_fullscreen) |
0 | 1076 { |
2154 | 1077 //if ( pRenderer->pRenderD3D ) |
0 | 1078 pGame->pVisInstance->_4C1A02(); |
1079 pEventTimer->Pause(); | |
1080 pMiscTimer->Pause(); | |
1081 pParty->uFlags = 2; | |
1517 | 1082 CastSpellInfoHelpers::_427D48(); |
0 | 1083 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); |
1458 | 1084 DoPrepareWorld(0, (_0_box_loading_1_fullscreen == 0) + 1); |
0 | 1085 pMiscTimer->Resume(); |
1086 pEventTimer->Resume(); | |
1087 } | |
1088 | |
1089 //----- (00464761) -------------------------------------------------------- | |
1583 | 1090 void Game_DeinitializeAndTerminate(int exitCode) |
0 | 1091 { |
1586 | 1092 SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); |
0 | 1093 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); |
1094 pGame->Deinitialize(); | |
2155 | 1095 pRenderer->Release(); |
1802 | 1096 delete window; |
1097 //if ( !DestroyWindow(hWnd) ) | |
1098 // GetLastError(); | |
1583 | 1099 exit(exitCode); |
0 | 1100 } |
1101 | |
1102 //----- (004647AB) -------------------------------------------------------- | |
762 | 1103 void FinalInitialization() |
0 | 1104 { |
1105 pViewport->SetScreen(viewparams->uSomeX, viewparams->uSomeY, viewparams->uSomeZ, viewparams->uSomeW); | |
2151 | 1106 pViewport->SetFOV(flt_6BE3A0 * 65536.0f); |
0 | 1107 |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
1108 //pIndoorCamera = new IndoorCamera; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
1109 //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
|
1110 // viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1); |
0 | 1111 |
1112 InitializeTurnBasedAnimations(&stru_50C198); | |
762 | 1113 pBitmaps_LOD->_inlined_sub1(); |
1114 pSprites_LOD->_inlined_sub1(); | |
1115 pIcons_LOD->_inlined_sub1(); | |
0 | 1116 } |
1117 // 6BE3A0: using guessed type float flt_6BE3A0; | |
1118 | |
2331
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1119 |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1120 //----- (0042F3D6) -------------------------------------------------------- |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1121 void InitializeTurnBasedAnimations(void *_this) |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1122 { |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1123 for (unsigned int i = 0; i < pIconIDs_Turn.size(); ++i) |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1124 { |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1125 char icon_name[32]; |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1126 sprintf(icon_name, "turn%u", i); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1127 pIconIDs_Turn[i] = pIconsFrameTable->FindIcon(icon_name); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1128 pIconsFrameTable->InitializeAnimation(pIconIDs_Turn[i]); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1129 } |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1130 |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1131 uIconID_TurnStop = pIconsFrameTable->FindIcon("turnstop"); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1132 uIconID_TurnHour = pIconsFrameTable->FindIcon("turnhour"); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1133 uIconID_TurnStart = pIconsFrameTable->FindIcon("turnstart"); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1134 uIconID_CharacterFrame = pIconsFrameTable->FindIcon("aframe1"); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1135 uSpriteID_Spell11 = pSpriteFrameTable->FastFindSprite("spell11"); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1136 |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1137 pIconsFrameTable->InitializeAnimation(uIconID_TurnHour); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1138 pIconsFrameTable->InitializeAnimation(uIconID_TurnStop); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1139 pIconsFrameTable->InitializeAnimation(uIconID_TurnStart); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1140 pIconsFrameTable->InitializeAnimation(uIconID_CharacterFrame); |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1141 } |
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2314
diff
changeset
|
1142 |
0 | 1143 //----- (00464866) -------------------------------------------------------- |
1458 | 1144 void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box) |
0 | 1145 { |
1458 | 1146 //int v2; // esi@1 |
0 | 1147 char *v3; // eax@1 |
1148 //char *v4; // eax@1 | |
1149 unsigned int v5; // eax@3 | |
1150 //size_t v6; // ecx@10 | |
1151 //char *v7; // eax@11 | |
1152 char Str1[20]; // [sp+Ch] [bp-18h]@1 | |
1153 unsigned int v9; // [sp+20h] [bp-4h]@1 | |
1154 | |
1155 v9 = bLoading; | |
1156 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); | |
1157 pDecalBuilder->Reset(0); | |
1458 | 1158 pGameLoadingUI_ProgressBar->Initialize(_1_fullscreen_loading_2_box == 1 ? GUIProgressBar::TYPE_Fullscreen : |
1159 GUIProgressBar::TYPE_Box); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1160 strcpy(Str1, pCurrentMapName); |
0 | 1161 v3 = strtok(Str1, "."); |
1162 strcpy(Str1, v3); | |
1163 Level_LoadEvtAndStr(Str1); | |
1164 LoadLevel_InitializeLevelEvt(); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1165 strcpy(Str1, pCurrentMapName); |
0 | 1166 _strrev(Str1); |
1167 strtok(Str1, "."); | |
1168 _strrev(Str1); | |
1169 | |
1170 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
|
1171 pSpriteObjects[i].uObjectDescID = 0; |
0 | 1172 |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1173 v5 = pMapStats->GetMapInfo(pCurrentMapName); |
1541 | 1174 bUnderwater = false; |
0 | 1175 uLevelMapStatsID = v5; |
1176 pGame->uFlags2 &= 0xFFFFFFF7u; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1177 if ( !_stricmp(pCurrentMapName, "out15.odm") ) |
0 | 1178 { |
1541 | 1179 bUnderwater = true; |
1583 | 1180 pGame->uFlags2 |= GAME_FLAGS_2_ALTER_GRAVITY; |
0 | 1181 } |
831 | 1182 pParty->floor_face_pid = 0; |
1104 | 1183 if ( _stricmp(Str1, "blv") ) |
0 | 1184 PrepareToLoadODM(v9, 0); |
1185 else | |
1186 PrepareToLoadBLV(v9); | |
1187 pAudioPlayer->SetMapEAX(); | |
1459 | 1188 _461103_load_level_sub(); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1189 if ( !_stricmp(pCurrentMapName, "d11.blv") || !_stricmp(pCurrentMapName, "d10.blv") ) |
0 | 1190 { |
1583 | 1191 //spawning grounds & walls of mist - no loot & exp from monsters |
0 | 1192 |
1193 for (uint i = 0; i < uNumActors; ++i) | |
1194 { | |
1195 pActors[i].pMonsterInfo.uTreasureType = 0; | |
1196 pActors[i].pMonsterInfo.uTreasureDiceRolls = 0; | |
1197 pActors[i].pMonsterInfo.uExp = 0; | |
1198 } | |
1199 } | |
1200 bDialogueUI_InitializeActor_NPC_ID = 0; | |
1201 OnMapLoad(); | |
1202 pGameLoadingUI_ProgressBar->Progress(); | |
1459 | 1203 memset(&pRenderer->pBillboardRenderListD3D, 0, sizeof(pRenderer->pBillboardRenderListD3D)); |
0 | 1204 pGameLoadingUI_ProgressBar->Release(); |
1205 _flushall(); | |
1206 } | |
1207 | |
1208 | |
1209 //----- (00464E17) -------------------------------------------------------- | |
1210 bool __fastcall CheckMM7CD(char c) | |
1211 { | |
1212 char DstBuf[256]; // [sp+Ch] [bp-218h]@1 | |
1213 char strCommand[256]; // [sp+10Ch] [bp-118h]@1 | |
1214 char Filename[20]; // [sp+20Ch] [bp-18h]@1 | |
1215 | |
1216 | |
1217 wchar_t pMagicPath[1024]; | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1150
diff
changeset
|
1218 swprintf(pMagicPath, wcslen(L"%C:\\anims\\magic7.vid"), L"%C:\\anims\\magic7.vid", c); |
0 | 1219 if (GetFileAttributesW(pMagicPath) == -1) |
1220 return false; | |
1221 | |
1222 wsprintfA(strCommand, "open %c: type cdaudio alias CD", c); | |
1223 if (!mciSendStringA(strCommand, DstBuf, 0xFFu, 0)) | |
1224 { | |
1225 wsprintfA(strCommand, "info CD UPC wait"); | |
1226 mciSendStringA(strCommand, DstBuf, 0xFFu, 0); | |
1227 wsprintfA(strCommand, "close CD"); | |
1228 mciSendStringA(strCommand, DstBuf, 0xFFu, 0); | |
1229 } | |
1230 | |
1231 memcpy(Filename, "X:\\anims\\magic7.vid", sizeof(Filename)); | |
1232 *Filename = c; | |
1233 | |
1980 | 1234 FILE* f = fopen(Filename, "rb"); |
0 | 1235 if (!f) |
1236 return false; | |
1237 | |
1238 if (!fseek(f, 0, SEEK_END)) | |
1239 { | |
1240 if (!fseek(f, -100, SEEK_CUR)) | |
1241 fread(DstBuf, 1u, 0x64u, f); | |
1242 | |
1243 fclose(f); | |
1244 return true; | |
1245 } | |
1246 fclose(f); | |
1247 return false; | |
1248 } | |
1249 | |
1250 //----- (00464F1B) -------------------------------------------------------- | |
1251 signed int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4) | |
1252 { | |
1253 char v4; // zf@3 | |
1254 int v6; // eax@10 | |
1255 int v7; // eax@11 | |
1256 int v8; // eax@12 | |
1257 int v9; // eax@13 | |
1258 BOOL (__stdcall *v10)(HWND, int, LPCSTR); // edi@15 | |
1259 const CHAR *v11; // [sp-Ch] [bp-Ch]@15 | |
1260 INT_PTR v12; // [sp-4h] [bp-4h]@5 | |
1261 | |
1262 if ( a2 == 272 ) | |
1263 { | |
1264 hInsertCDWindow = hDlg; | |
1265 v6 = (GetUserDefaultLangID() & 0x3FF) - 7; | |
1266 if ( v6 ) | |
1267 { | |
1268 v7 = v6 - 3; | |
1269 if ( v7 ) | |
1270 { | |
1271 v8 = v7 - 2; | |
1272 if ( v8 ) | |
1273 { | |
1274 v9 = v8 - 4; | |
1275 if ( v9 ) | |
1276 { | |
1277 if ( v9 != 5 ) | |
1278 return 0; | |
1279 SetWindowTextA(hDlg, "Wloz CD-ROM numer 2"); | |
1280 v10 = SetDlgItemTextA; | |
1281 SetDlgItemTextA(hDlg, 1010, "Wloz CD-ROM numer 2 Might and Magic® VII."); | |
1282 v11 = "Odwolaj"; | |
1283 } | |
1284 else | |
1285 { | |
1286 SetWindowTextA(hDlg, "Inserire il secondo CD"); | |
1287 v10 = SetDlgItemTextA; | |
1288 SetDlgItemTextA(hDlg, 1010, "Inserire il secondo CD di Might and Magic® VII."); | |
1289 v11 = "Annulla"; | |
1290 } | |
1291 } | |
1292 else | |
1293 { | |
1294 SetWindowTextA(hDlg, "Insérez le CD 2"); | |
1295 v10 = SetDlgItemTextA; | |
1296 SetDlgItemTextA(hDlg, 1010, "Insérez Might & Magic® VII CD 2."); | |
1297 v11 = "Supprimer"; | |
1298 } | |
1299 } | |
1300 else | |
1301 { | |
1302 SetWindowTextA(hDlg, "Por favor, inserte disco 2"); | |
1303 v10 = SetDlgItemTextA; | |
1304 SetDlgItemTextA(hDlg, 1010, "Por favor, inserte disco 2 de Might & Magic® VII."); | |
1305 v11 = "Cancelar"; | |
1306 } | |
1307 } | |
1308 else | |
1309 { | |
1310 SetWindowTextA(hDlg, "Bitte CD 2 einlegen"); | |
1311 v10 = SetDlgItemTextA; | |
1312 SetDlgItemTextA(hDlg, 1010, "Bitte CD 2 von Might and Magic® VII einlegen."); | |
1313 v11 = "Abbrechen"; | |
1314 } | |
1315 v10(hDlg, 2, v11); | |
1316 return 0; | |
1317 } | |
1318 if ( a2 == 273 ) | |
1319 { | |
1320 if ( a3 == 2 ) | |
1321 { | |
1322 v12 = 0; | |
1323 EndDialog(hDlg, v12); | |
1324 return 1; | |
1325 } | |
1326 v4 = a3 == 1; | |
1327 } | |
1328 else | |
1329 { | |
1330 v4 = a2 == 1025; | |
1331 } | |
1332 if ( v4 ) | |
1333 { | |
1334 v12 = 1; | |
1416 | 1335 EndDialog(hDlg, v12); |
1336 return 1; | |
0 | 1337 } |
1338 return 0; | |
1339 } | |
1340 | |
1341 //----- (00465061) -------------------------------------------------------- | |
1342 bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive) | |
1343 { | |
1344 char drive[4] = {'X', ':', '\\', 0}; | |
1345 | |
1346 bool bGotCDFromRegistry = false; | |
1347 | |
1348 HKEY hSoftware = nullptr, | |
1349 hNWC = nullptr, | |
1350 hMM7 = nullptr, | |
1351 hVersion = nullptr; | |
1352 if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE", 0, 0x2001Fu, &hSoftware)) | |
1353 { | |
1354 if (!RegOpenKeyExA(hSoftware, "New World Computing", 0, 0x2001Fu, &hNWC)) | |
1355 { | |
1356 if (!RegOpenKeyExA(hNWC, "Might and Magic VII", 0, 0x2001Fu, &hMM7)) | |
1357 { | |
1358 if (!RegOpenKeyExA(hMM7, "1.0", 0, 0x2001Fu, &hVersion)) | |
1359 { | |
1360 DWORD cbData = 3; | |
1361 if (!RegQueryValueExA(hVersion, "CDDrive", 0, 0, (BYTE *)drive, &cbData)) | |
1362 bGotCDFromRegistry = true; | |
1363 } | |
1364 RegCloseKey(hVersion); | |
1365 } | |
1366 RegCloseKey(hMM7); | |
1367 } | |
1368 RegCloseKey(hNWC); | |
1369 } | |
1370 RegCloseKey(hSoftware); | |
1371 | |
1372 if (bGotCDFromRegistry) | |
1373 if (CheckMM7CD(*drive)) | |
1374 { | |
1375 cMM7GameCDDriveLetter = *drive; | |
1376 return true; | |
1377 } | |
1378 | |
1379 while (true) | |
1380 { | |
1381 for (uint i = 0; i < 26; ++i) | |
1382 { | |
1383 drive[0] = 'A' + i; | |
1384 | |
1385 if (GetDriveTypeA(drive) == DRIVE_CDROM) | |
1386 if (CheckMM7CD(*drive)) | |
1387 { | |
1388 cMM7GameCDDriveLetter = *drive; | |
1389 WriteWindowsRegistryString("CDDrive", drive); | |
1390 return true; | |
1391 } | |
1392 } | |
1393 | |
1802 | 1394 if (DialogBoxParamA(GetModuleHandleW(nullptr), "InsertCD", hWnd, (DLGPROC)InsertMM7CDDialogFunc, 0)) |
0 | 1395 continue; |
1396 return false; | |
1397 } | |
1398 } | |
1399 | |
1400 //----- (004651F4) -------------------------------------------------------- | |
1655 | 1401 bool MM7_Initialize(int game_width, int game_height) |
0 | 1402 { |
1403 wchar_t pCurrentDir[1024]; | |
1404 _wgetcwd(pCurrentDir, 1024); | |
1405 | |
1406 wchar_t pMM6IniFile[1024]; | |
293 | 1407 wsprintfW(pMM6IniFile, L"%s\\mm6.ini", pCurrentDir); |
0 | 1408 |
1409 bCanLoadFromCD = GetPrivateProfileIntW(L"settings", L"use_cd", 1, pMM6IniFile); | |
1410 if (bNoCD) | |
1411 bCanLoadFromCD = false; | |
1412 if (bCanLoadFromCD) | |
1413 { | |
2151 | 1414 Log::Warning(L"Checking for CD..."); |
1802 | 1415 if (!FindMM7CD(nullptr, &cMM7GameCDDriveLetter)) |
0 | 1416 return false; |
2151 | 1417 Log::Warning(L"...done."); |
0 | 1418 } |
1419 | |
1420 | |
1421 srand(GetTickCount()); | |
1802 | 1422 |
1423 window = OSWindow::Create(L"Might and Magic® Trilogy", game_width, game_height); | |
0 | 1424 |
1425 pRenderer = Render::Create(); | |
1426 if (!pRenderer) | |
1427 { | |
1428 Log::Warning(L"Render creation failed"); | |
1429 return false; | |
1430 } | |
1431 else | |
1432 { | |
2069 | 1433 //bool bWindowMode = ReadWindowsRegistryInt("startinwindow", false); |
1802 | 1434 //uint uDefaultDevice = ReadWindowsRegistryInt("D3D Device", 1); |
0 | 1435 bool bColoredLights = ReadWindowsRegistryInt("Colored Lights", false); |
1436 uint uLevelOfDetail = ReadWindowsRegistryInt("Detail Level", 1); | |
1437 uint bTinting = ReadWindowsRegistryInt("Tinting", 1) != 0; | |
1438 | |
2069 | 1439 if (!pRenderer->Initialize(window, bColoredLights, uLevelOfDetail, bTinting)) |
0 | 1440 { |
1441 Log::Warning(L"Render failed to initialize"); | |
1442 return false; | |
1443 } | |
1444 } | |
492 | 1445 |
351 | 1446 game_starting_year = 1168; |
0 | 1447 |
1448 pParty = new Party; | |
147 | 1449 memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings)); |
0 | 1450 pParty->uWalkSpeed = GetPrivateProfileIntW(L"debug", L"walkspeed", 384, pMM6IniFile); |
1451 pParty->uDefaultEyelevel = GetPrivateProfileIntW(L"party", L"eyelevel", 160, pMM6IniFile); | |
1452 pParty->sEyelevel = pParty->uDefaultEyelevel; | |
1453 pParty->uDefaultPartyHeight = GetPrivateProfileIntW(L"party", L"height", 192, pMM6IniFile); | |
1454 pParty->uPartyHeight = pParty->uDefaultPartyHeight; | |
2151 | 1455 |
0 | 1456 MM6_Initialize(pMM6IniFile); |
1457 | |
1458 pKeyActionMap = new KeyboardActionMapping; | |
1459 | |
1460 pEventTimer = Timer::Create(); | |
1461 pEventTimer->Initialize(); | |
1462 | |
1463 OnTimer(1); | |
1464 GameUI_StatusBar_UpdateTimedString(1); | |
1465 pGame = Game::Create(); | |
1466 pMouse = pGame->pMouseInstance; | |
1655 | 1467 |
0 | 1468 |
1469 pIcons_LOD = new LODFile_IconsBitmaps; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1470 if (!pIcons_LOD->Load("data\\icons.lod", "icons")) |
0 | 1471 { |
2151 | 1472 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.", |
1473 L"Files Missing", MB_ICONEXCLAMATION); | |
0 | 1474 return false; |
1475 } | |
1476 pIcons_LOD->dword_011BA4 = 0; | |
1477 | |
1478 pEvents_LOD = new LODFile_IconsBitmaps; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1479 if (!pEvents_LOD->Load("data\\events.lod", "icons")) |
0 | 1480 { |
2151 | 1481 MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.", |
1482 L"Files Missing", MB_ICONEXCLAMATION); | |
0 | 1483 return false; |
1484 } | |
1485 | |
1486 InitializeGameText(); | |
1487 | |
1488 pBitmaps_LOD = new LODFile_IconsBitmaps; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1489 if (!pBitmaps_LOD->Load("data\\bitmaps.lod", "bitmaps")) |
0 | 1490 { |
2151 | 1491 MessageBoxA(nullptr, pGlobalTXT_LocalizationStrings[63], |
1492 pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION); | |
0 | 1493 return false; |
1494 } | |
1495 | |
1496 pSprites_LOD = new LODFile_Sprites; | |
2151 | 1497 if (!pSprites_LOD->LoadSprites("data\\sprites.lod")) |
0 | 1498 { |
1499 MessageBoxA(nullptr, | |
1500 pGlobalTXT_LocalizationStrings[63], | |
1501 pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION); | |
1502 return false; | |
1503 } | |
1504 | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1505 |
1543 | 1506 #if 0 |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1507 if (_access("../MM_VI/data/icons.lod", 0) == 0) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1508 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1509 pIcons_LOD_mm6 = new LODFile_IconsBitmaps; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1510 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
|
1511 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1512 delete pIcons_LOD_mm6; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1513 pIcons_LOD_mm6 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1514 Log::Warning(L"Unable to load mm6:icons.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1515 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1516 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1517 else |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1518 Log::Warning(L"Unable to find mm6:icons.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1519 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1520 if (_access("../MM_VI/data/bitmaps.lod", 0) == 0) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1521 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1522 pBitmaps_LOD_mm6 = new LODFile_IconsBitmaps; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1523 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
|
1524 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1525 delete pBitmaps_LOD_mm6; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1526 pBitmaps_LOD_mm6 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1527 Log::Warning(L"Unable to load mm6:bitmaps.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1528 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1529 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1530 else |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1531 Log::Warning(L"Unable to find mm6:bitmaps.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1532 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1533 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
|
1534 : "../MM_VI/data/sprites.lod"; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1535 if (_access(mm6_sprite_container_name, 0) == 0) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1536 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1537 pSprites_LOD_mm6 = new LODFile_Sprites; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1538 if (!pSprites_LOD_mm6->LoadSprites(mm6_sprite_container_name)) |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1539 { |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1540 delete pSprites_LOD_mm6; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1541 pSprites_LOD_mm6 = nullptr; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1542 Log::Warning(L"Unable to load mm6:sprites.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1543 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1544 } |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1545 else |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1546 Log::Warning(L"Unable to find mm6:sprites.lod"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1547 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1548 |
1541 | 1549 if (_access("../mm8/data/icons.lod", 0) == 0) |
1550 { | |
1551 pIcons_LOD_mm8 = new LODFile_IconsBitmaps; | |
1552 if (!pIcons_LOD_mm8->Load("../mm8/data/icons.lod", "icons")) | |
1553 { | |
1554 delete pIcons_LOD_mm8; | |
1555 pIcons_LOD_mm8 = nullptr; | |
1556 Log::Warning(L"Unable to load mm8:icons.lod"); | |
1557 } | |
0 | 1558 } |
1559 else | |
1541 | 1560 Log::Warning(L"Unable to find mm8:icons.lod"); |
1561 | |
1562 | |
1563 if (_access("../mm8/data/bitmaps.lod", 0) == 0) | |
1564 { | |
1565 pBitmaps_LOD_mm8 = new LODFile_IconsBitmaps; | |
1566 if (!pBitmaps_LOD_mm8->Load("../mm8/data/bitmaps.lod", "bitmaps")) | |
1567 { | |
1568 delete pBitmaps_LOD_mm8; | |
1569 pBitmaps_LOD_mm8 = nullptr; | |
1570 Log::Warning(L"Unable to load mm8:bitmaps.lod"); | |
1571 } | |
1572 } | |
1573 else | |
1574 Log::Warning(L"Unable to find mm8:bitmaps.lod"); | |
1575 | |
1576 | |
1577 if (_access("../mm8/data/sprites.lod", 0) == 0) | |
1578 { | |
1579 pSprites_LOD_mm8 = new LODFile_Sprites; | |
1580 if (!pSprites_LOD_mm8->LoadSprites("../mm8/data/sprites.lod")) | |
1581 { | |
1582 delete pSprites_LOD_mm8; | |
1583 pSprites_LOD_mm8 = nullptr; | |
1584 Log::Warning(L"Unable to load mm8:sprites.lod"); | |
1585 } | |
1586 } | |
1587 else | |
1588 Log::Warning(L"Unable to find mm8:sprites.lod"); | |
1543 | 1589 #endif |
1541 | 1590 |
0 | 1591 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1592 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
|
1593 *sft_mm8 = nullptr; |
2151 | 1594 void *sft_mm7 = pEvents_LOD->LoadRaw("dsft.bin", 1); |
0 | 1595 pSpriteFrameTable = new SpriteFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1596 pSpriteFrameTable->FromFile(sft_mm6, sft_mm7, sft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1597 free(sft_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1598 free(sft_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1599 free(sft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1600 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1601 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
|
1602 *tft_mm8 = nullptr; |
2151 | 1603 void *tft_mm7 = pEvents_LOD->LoadRaw("dtft.bin", 1); |
0 | 1604 pTextureFrameTable = new TextureFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1605 pTextureFrameTable->FromFile(tft_mm6, tft_mm7, tft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1606 free(tft_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1607 free(tft_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1608 free(tft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1609 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1610 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
|
1611 *tiles_mm8 = nullptr; |
2151 | 1612 void *tiles_mm7 = pEvents_LOD->LoadRaw("dtile.bin", 1); |
0 | 1613 pTileTable = new TileTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1614 pTileTable->FromFile(tiles_mm6, tiles_mm7, tiles_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1615 free(tiles_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1616 free(tiles_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1617 free(tiles_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1618 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1619 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
|
1620 *pft_mm8 = nullptr; |
2151 | 1621 void *pft_mm7 = pEvents_LOD->LoadRaw("dpft.bin", 1); |
0 | 1622 pPlayerFrameTable = new PlayerFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1623 pPlayerFrameTable->FromFile(pft_mm6, pft_mm7, pft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1624 free(pft_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1625 free(pft_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1626 free(pft_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1627 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1628 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
|
1629 *ift_mm8 = nullptr; |
2151 | 1630 void *ift_mm7 = pEvents_LOD->LoadRaw("dift.bin", 1); |
0 | 1631 pIconsFrameTable = new IconFrameTable; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1632 pIconsFrameTable->FromFile(ift_mm6, ift_mm7, ift_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1633 free(ift_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1634 free(ift_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1635 free(ift_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1636 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1637 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
|
1638 *decs_mm8 = nullptr; |
2151 | 1639 void *decs_mm7 = pEvents_LOD->LoadRaw("ddeclist.bin", 1); |
0 | 1640 pDecorationList = new DecorationList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1641 pDecorationList->FromFile(decs_mm6, decs_mm7, decs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1642 free(decs_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1643 free(decs_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1644 free(decs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1645 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1646 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
|
1647 *objs_mm8 = nullptr; |
2151 | 1648 void *objs_mm7 = pEvents_LOD->LoadRaw("dobjlist.bin", 1); |
0 | 1649 pObjectList = new ObjectList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1650 pObjectList->FromFile(objs_mm6, objs_mm7, objs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1651 free(objs_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1652 free(objs_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1653 free(objs_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1654 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1655 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
|
1656 *mons_mm8 = nullptr; |
2151 | 1657 void *mons_mm7 = pEvents_LOD->LoadRaw("dmonlist.bin", 1); |
0 | 1658 pMonsterList = new MonsterList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1659 pMonsterList->FromFile(mons_mm6, mons_mm7, mons_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1660 free(mons_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1661 free(mons_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1662 free(mons_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1663 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1664 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
|
1665 *chests_mm8 = nullptr; |
2151 | 1666 void *chests_mm7 = pEvents_LOD->LoadRaw("dchest.bin", 1); |
0 | 1667 pChestList = new ChestList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1668 pChestList->FromFile(chests_mm6, chests_mm7, chests_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1669 free(chests_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1670 free(chests_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1671 free(chests_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1672 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1673 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
|
1674 *overlays_mm8 = nullptr; |
2151 | 1675 void *overlays_mm7 = pEvents_LOD->LoadRaw("doverlay.bin", 1); |
0 | 1676 pOverlayList = new OverlayList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1677 pOverlayList->FromFile(overlays_mm6, overlays_mm7, overlays_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1678 free(overlays_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1679 free(overlays_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1680 free(overlays_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1681 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1682 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
|
1683 *sounds_mm8 = nullptr; |
2151 | 1684 void *sounds_mm7 = pEvents_LOD->LoadRaw("dsounds.bin", 1); |
0 | 1685 pSoundList = new SoundList; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1686 pSoundList->FromFile(sounds_mm6, sounds_mm7, sounds_mm8); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1687 free(sounds_mm6); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1688 free(sounds_mm7); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
1689 free(sounds_mm8); |
0 | 1690 } |
1691 | |
1692 | |
1693 | |
492 | 1694 |
2069 | 1695 if (dword_6BE368_debug_settings_2 & DEBUG_SETTINGS_RUN_IN_WIDOW) |
0 | 1696 { |
2069 | 1697 //window->SetWindowedMode(game_width, game_height); |
1698 pRenderer->SwitchToWindow(); | |
0 | 1699 } |
1700 else | |
1701 { | |
2069 | 1702 __debugbreak(); // Nomad |
1703 window->SetFullscreenMode(); | |
1704 pRenderer->InitializeFullscreen(); | |
0 | 1705 } |
2151 | 1706 |
1707 uSoundVolumeMultiplier = min(9, ReadWindowsRegistryInt("soundflag", 9)); | |
1708 uMusicVolimeMultiplier = min(9, ReadWindowsRegistryInt("musicflag", 9)); | |
1709 uVoicesVolumeMultiplier = min(9, ReadWindowsRegistryInt("CharVoices", 9)); | |
0 | 1710 bShowDamage = ReadWindowsRegistryInt("ShowDamage", 1) != 0; |
2151 | 1711 |
1712 uGammaPos = min(4, ReadWindowsRegistryInt("GammaPos", 4)); | |
0 | 1713 pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6); |
1714 | |
1715 if ( ReadWindowsRegistryInt("Bloodsplats", 1) ) | |
591 | 1716 pGame->uFlags2 |= GAME_FLAGS_2_DRAW_BLOODSPLATS; |
0 | 1717 else |
733 | 1718 pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS; |
0 | 1719 |
1720 uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0); | |
1721 | |
1722 if (!bNoSound) | |
1802 | 1723 pAudioPlayer->Initialize(); |
0 | 1724 |
1262 | 1725 pVideoPlayer = new VideoPlayer(); |
1802 | 1726 pVideoPlayer->Initialize(window); |
0 | 1727 |
2061 | 1728 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000; |
0 | 1729 |
1730 switch ( uTurnSpeed ) | |
1731 { | |
731 | 1732 case 0: // undefined turn option |
1067 | 1733 __debugbreak(); // really shouldn't use this mode |
731 | 1734 uTurnSpeed = (unsigned int)uCPUSpeed < 199 ? 128 : 64; // adjust turn speed to estimated fps |
1735 break; | |
1736 | |
1737 case 1u: // 16x | |
1738 Log::Warning(L"x16 Turn Speed"); // really shouldn't use this mode | |
0 | 1739 uTurnSpeed = 128; |
731 | 1740 break; |
1741 | |
1742 case 2u: // 32x | |
1743 Log::Warning(L"x32 Turn Speed"); // really shouldn't use this mode | |
0 | 1744 uTurnSpeed = 64; |
731 | 1745 break; |
1746 | |
1747 case 3u: // smooth | |
0 | 1748 uTurnSpeed = 0; |
731 | 1749 break; |
1750 } | |
1751 | |
0 | 1752 return true; |
1753 } | |
1754 | |
1755 //----- (00465D0B) -------------------------------------------------------- | |
1802 | 1756 void SecondaryInitialization() |
0 | 1757 { |
2151 | 1758 //__int16 v4; // ax@4 |
1759 //signed int v5; // esi@5 | |
1760 //int v6; // ecx@6 | |
1761 //int v7; // edx@7 | |
1762 //ObjectDesc *v8; // eax@7 | |
1763 //char pContainer[32]; // [sp+10h] [bp-Ch]@9 | |
0 | 1764 |
1802 | 1765 pMouse->Initialize(window); |
0 | 1766 |
1767 pItemsTable = new ItemsTable; | |
1768 pItemsTable->Initialize(); | |
1769 | |
2154 | 1770 //pBitmaps_LOD->can_load_hardware_sprites = 1; |
2069 | 1771 //pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
1772 pBitmaps_LOD->SetupPalettes(5, 6, 5); | |
1773 //pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | |
1774 pIcons_LOD->SetupPalettes(5, 6, 5); | |
1775 //pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | |
1776 pPaletteManager->SetColorChannelInfo(5, 6, 5); | |
762 | 1777 |
1778 pPaletteManager->SetMistColor(128, 128, 128); | |
0 | 1779 pPaletteManager->RecalculateAll(); |
2154 | 1780 //pSprites_LOD->can_load_hardware_sprites = 1; |
0 | 1781 pObjectList->InitializeSprites(); |
1782 pOverlayList->InitializeSprites(); | |
1783 if (!bNoSound) | |
1784 pSoundList->Initialize(); | |
1785 | |
1786 | |
1787 for (uint i = 0; i < 4; ++i) | |
1788 { | |
2151 | 1789 static const char *pUIAnimNames[4] = |
1790 { | |
1791 "glow03", "glow05", | |
1792 "torchA", "wizeyeA" | |
1793 }; | |
1794 static unsigned short _4E98D0[4][4] = | |
1795 { | |
1796 {479, 0, 329, 0}, | |
1797 {585, 0, 332, 0}, | |
1798 {468, 0, 0, 0}, | |
1799 {606, 0, 0, 0} | |
1800 }; | |
1801 | |
0 | 1802 pUIAnims[i]->uIconID = pIconsFrameTable->FindIcon(pUIAnimNames[i]); |
1803 pIconsFrameTable->InitializeAnimation(pUIAnims[i]->uIconID); | |
1804 | |
1805 pUIAnims[i]->uAnimLength = 0; | |
1806 pUIAnims[i]->uAnimTime = 0; | |
1807 pUIAnims[i]->x = _4E98D0[i][0]; | |
1808 pUIAnims[i]->y = _4E98D0[i][2]; | |
1809 } | |
1810 | |
2151 | 1811 for (unsigned int i = 0; i < pObjectList->uNumObjects; ++i) |
0 | 1812 { |
2151 | 1813 pObjectList->pObjects[i].uParticleTrailColor = pObjectList->pObjects[i].uParticleTrailColorB | |
1814 ((unsigned int)pObjectList->pObjects[i].uParticleTrailColorG << 8) | | |
1815 ((unsigned int)pObjectList->pObjects[i].uParticleTrailColorR << 16); | |
0 | 1816 } |
2151 | 1817 |
0 | 1818 MainMenuUI_Create(); |
1819 pGame->pStru6Instance->LoadAnimations(); | |
1820 | |
1821 for (uint i = 0; i < 7; ++i) | |
1822 { | |
2151 | 1823 char container_name[64]; |
1824 sprintf(container_name, "HDWTR%03u", i); | |
1825 pRenderer->pHDWaterBitmapIDs[i] = pBitmaps_LOD->LoadTexture(container_name); | |
0 | 1826 } |
1827 | |
1828 pNPCStats = new NPCStats; | |
110 | 1829 memset(pNPCStats->pNPCData, 0, 0x94BCu); |
0 | 1830 pNPCStats->Initialize(); |
1831 | |
1832 Initialize_GlobalEVT(); | |
762 | 1833 pBitmaps_LOD->_inlined_sub0(); |
1834 pSprites_LOD->_inlined_sub0(); | |
0 | 1835 pPaletteManager->LockAll(); |
1836 | |
1837 _mkdir("Saves"); | |
1838 for (uint i = 0; i < 5; ++i) | |
1839 for (uint j = 0; j < 6; ++j) | |
1840 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
1841 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
|
1842 remove(pTmpBuf.data()); |
0 | 1843 } |
1844 | |
1845 Initialize_GamesLOD_NewLOD(); | |
1051 | 1846 _576E2C_current_minimap_zoom = 512; |
0 | 1847 dword_576E28 = 9; |
1848 } | |
1849 | |
522 | 1850 void IntegrityTest() |
1851 { | |
1869
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1852 static_assert(sizeof(MovieHeader) == 44, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1853 static_assert(sizeof(SoundDesc_mm6) == 112, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1854 static_assert(sizeof(SoundDesc) == 120, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1855 static_assert(sizeof(OverlayDesc) == 8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1856 static_assert(sizeof(ChestDesc) == 36, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1857 static_assert(sizeof(ObjectDesc_mm6) == 52, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1858 static_assert(sizeof(ObjectDesc) == 56, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1859 static_assert(sizeof(DecorationDesc) == 84, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1860 static_assert(sizeof(IconFrame) == 32, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1861 static_assert(sizeof(PlayerFrame) == 10, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1862 static_assert(sizeof(TextureFrame) == 20, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1863 static_assert(sizeof(SpriteFrame) == 60, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1864 static_assert(sizeof(RenderVertexSoft) == 0x30, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1865 static_assert(sizeof(RenderBillboard) == 0x34, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1866 static_assert(sizeof(Texture) == 0x48, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1867 static_assert(sizeof(RGBTexture) == 0x28, "Wrong type size"); |
2154 | 1868 //static_assert(sizeof(LODFile_IconsBitmaps) == 0x11BB8 + 4, "Wrong type size"); // + virtual dtor ptr |
1869
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1869 static_assert(sizeof(AudioPlayer) == 0xC84, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1870 static_assert(sizeof(SoundDesc) == 0x78, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1871 static_assert(sizeof(stru339_spell_sound) == 0xAFD8, "Wrong type size"); |
2137
d24ee391fd1f
libavcodec playing movies and houses, loops not working yet
zipi
parents:
2135
diff
changeset
|
1872 //static_assert(sizeof(VideoPlayer) == 0x108 + 4, "Wrong type size"); |
1869
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1873 static_assert(sizeof(MovieHeader) == 0x2C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1874 static_assert(sizeof(DecorationDesc) == 0x54, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1875 static_assert(sizeof(ObjectDesc) == 0x38, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1876 static_assert(sizeof(OverlayDesc) == 0x8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1877 static_assert(sizeof(ChestDesc) == 0x24, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1878 static_assert(sizeof(TileDesc) == 0x1A, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1879 static_assert(sizeof(MonsterDesc_mm6) == 148, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1880 static_assert(sizeof(MonsterDesc) == 152, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1881 static_assert(sizeof(Timer) == 0x28, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1882 static_assert(sizeof(OtherOverlay) == 0x14, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1883 static_assert(sizeof(ItemGen) == 0x24, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1884 static_assert(sizeof(SpriteObject) == 0x70, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1885 static_assert(sizeof(ItemDesc) == 0x30, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1886 static_assert(sizeof(ItemsTable) == 0x117A0, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1887 static_assert(sizeof(Chest) == 0x14CC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1888 static_assert(sizeof(MapInfo) == 0x44, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1889 static_assert(sizeof(SpellInfo) == 0x24, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1890 static_assert(sizeof(SpellData) == 0x14, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1891 static_assert(sizeof(SpellBuff) == 0x10, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1892 static_assert(sizeof(AIDirection) == 0x1C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1893 static_assert(sizeof(ActorJob) == 0xC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1894 static_assert(sizeof(Actor) == 0x344, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1895 static_assert(sizeof(LevelDecoration) == 0x20, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1896 static_assert(sizeof(KeyboardActionMapping) == 0x20C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1897 static_assert(sizeof(UIAnimation) == 0xD, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1898 static_assert(sizeof(SpawnPointMM7) == 0x18, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1899 static_assert(sizeof(ODMFace) == 0x134, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1900 static_assert(sizeof(BSPNode) == 0x8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1901 static_assert(sizeof(BSPModel) == 0xBC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1902 static_assert(sizeof(OutdoorLocation) == 0x1C28C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1903 static_assert(sizeof(BLVFace) == 0x60, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1904 static_assert(sizeof(BLVFaceExtra) == 0x24, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1905 static_assert(sizeof(BLVSector) == 0x74, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1906 static_assert(sizeof(BLVLightMM7) == 0x10, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1907 static_assert(sizeof(BLVDoor) == 0x50, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1908 static_assert(sizeof(IndoorLocation) == 0x690, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1909 //static_assert(sizeof(ODMRenderParams) == 0x74, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1910 static_assert(sizeof(Mouse) == 0x114, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1911 static_assert(sizeof(Particle_sw) == 0x68, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1912 static_assert(sizeof(Particle) == 0x68, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1913 static_assert(sizeof(ParticleEngine) == 0xE430, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1914 static_assert(sizeof(Lightmap) == 0xC1C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1915 static_assert(sizeof(LightmapBuilder) == 0x3CBC38, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1916 static_assert(sizeof(Vis_SelectionList) == 0x2008, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1917 static_assert(sizeof(Vis) == 0x20D0, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1918 static_assert(sizeof(PlayerBuffAnim) == 0x10, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1919 static_assert(sizeof(ProjectileAnim) == 0x1C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1920 static_assert(sizeof(stru6) == 0x5F8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1921 static_assert(sizeof(IndoorCameraD3D_Vec3) == 0x10, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1922 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
|
1923 //static_assert(sizeof(IndoorCameraD3D) == 0x1A1384, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1924 static_assert(sizeof(StationaryLight) == 0xC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1925 static_assert(sizeof(LightsStack_StationaryLight_) == 0x12C8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1926 static_assert(sizeof(MobileLight) == 0x12, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1927 static_assert(sizeof(LightsStack_MobileLight_) == 0x1C28, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1928 static_assert(sizeof(Game) == 0xE78, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1929 static_assert(sizeof(stru141_actor_collision_object) == 0xA8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1930 static_assert(sizeof(ActionQueue) == 0x7C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1931 static_assert(sizeof(NPCData) == 0x4C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1932 static_assert(sizeof(NPCStats) == 0x17FFC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1933 static_assert(sizeof(BspRenderer) == 0x53740, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1934 static_assert(sizeof(PaletteManager) == 0x267AF0, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1935 static_assert(sizeof(ViewingParams) == 0x26C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1936 //static_assert(sizeof(IndoorCamera) == 0x50, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1937 static_assert(sizeof(Bloodsplat) == 0x28, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1938 static_assert(sizeof(BloodsplatContainer) == 0xA0C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1939 static_assert(sizeof(TrailParticle) == 0x18, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1940 static_assert(sizeof(EventIndex) == 0xC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1941 static_assert(sizeof(_2devent) == 0x34, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1942 static_assert(sizeof(stru176) == 0x20, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1943 static_assert(sizeof(SavegameHeader) == 0x64, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1944 static_assert(sizeof(SavegameList) == 0x3138, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1945 static_assert(sizeof(StorylineText) == 0x160, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1946 static_assert(sizeof(FactionTable) == 0x1EF1, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1947 static_assert(sizeof(Decal) == 0xC20, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1948 static_assert(sizeof(DecalBuilder) == 0x30C038, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1949 static_assert(sizeof(MonsterInfo) == 0x58, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1950 static_assert(sizeof(MonsterStats) == 0x5BA0, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1951 static_assert(sizeof(RenderD3D) == 0x148, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1952 // static_assert(sizeof(Render) == 0x129844, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1953 static_assert(sizeof(Player) == 0x1B3C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1954 static_assert(sizeof(PartyTimeStruct) == 0x678, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1955 static_assert(sizeof(Party) == 0x16238, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1956 static_assert(sizeof(GUIButton) == 0xBC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1957 static_assert(sizeof(GUIWindow) == 0x54, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1958 static_assert(sizeof(GUIProgressBar) == 0x1B8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1959 static_assert(sizeof(GUIFont) == 0x1020, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1960 // static_assert(sizeof(stru262_TurnBased) == 0x40, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1961 static_assert(sizeof(ArcomageGame) == 0xFB, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1962 static_assert(sizeof(CastSpellInfo) == 0x14, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1963 static_assert(sizeof(ArcomageCard) == 0x6C, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1964 static_assert(sizeof(stru320) == 0x3FC, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1965 static_assert(sizeof(TravelInfo) == 0x20, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1966 static_assert(sizeof(stru336) == 0x798, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1967 static_assert(sizeof(Vec3_short_) == 6, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1968 static_assert(sizeof(BLVFace) == 96, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1969 static_assert(sizeof(BLVFaceExtra) == 36, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1970 static_assert(sizeof(BLVSector) == 116, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1971 static_assert(sizeof(LevelDecoration) == 32, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1972 static_assert(sizeof(BLVLightMM7) == 16, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1973 static_assert(sizeof(BSPNode) == 8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1974 static_assert(sizeof(SpawnPointMM7) == 24, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1975 static_assert(sizeof(DDM_DLV_Header) == 40, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1976 static_assert(sizeof(Actor) == 836, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1977 static_assert(sizeof(SpriteObject) == 112, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1978 static_assert(sizeof(Chest) == 5324, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1979 static_assert(sizeof(stru123) == 0xC8, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1980 static_assert(sizeof(BLVMapOutline) == 12, "Wrong type size"); |
bc7a6ee34316
IntegrityTest size tests changed to static_asserts
Grumpy7
parents:
1861
diff
changeset
|
1981 static_assert(sizeof(LODSprite) == 0x28, "Wrong type size"); |
522 | 1982 } |
1983 | |
2277 | 1984 bool new_sky = false; //íîâîå íåáî(òðåáóþòñÿ òåêñòóðêè) |
1985 int max_flight_height = 4000; //ìàêñèìàëüíàÿ âûñîòà ïîë¸òà | |
2034 | 1986 |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2035
diff
changeset
|
1987 |
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2035
diff
changeset
|
1988 |
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2035
diff
changeset
|
1989 |
0 | 1990 //----- (00462C94) -------------------------------------------------------- |
1991 bool MM_Main(const wchar_t *pCmdLine) | |
1992 { | |
522 | 1993 IntegrityTest(); |
1706 | 1994 |
246 | 1995 char test[1024]; |
522 | 1996 sprintfex(test, "^Pi[%s]: çíàõàð^R[ü;êà;]", "Çîëòàí"); |
1997 | |
2052 | 1998 lua = new LuaVM; |
1999 lua->Initialize(); | |
2031 | 2000 |
1052 | 2001 bool bNoMargareth = false; |
0 | 2002 if (pCmdLine && *pCmdLine) |
2003 { | |
2061 | 2004 //if (wcsstr(pCmdLine, L"-usedefs")) |
2005 // bDebugResouces = 1; | |
0 | 2006 if (wcsstr(pCmdLine, L"-window")) |
2061 | 2007 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW; |
0 | 2008 |
2009 if (wcsstr(pCmdLine, L"-nointro")) | |
2010 bNoIntro = true;//dword_6BE364_game_settings_1 |= 4; | |
2011 if (wcsstr(pCmdLine, L"-nologo")) | |
2012 bNoLogo = true;//dword_6BE364_game_settings_1 |= 8; | |
2013 if (wcsstr(pCmdLine, L"-nosound")) | |
2014 bNoSound = true; //dword_6BE364_game_settings_1 |= 0x10; | |
2015 | |
2016 bWalkSound = ReadWindowsRegistryInt("WalkSound", 1) != 0; | |
2017 if (wcsstr(pCmdLine, L"-nowalksound")) | |
2018 bWalkSound = false;//dword_6BE364_game_settings_1 |= 0x20; | |
256 | 2019 if (wcsstr(pCmdLine, L"-novideo")) |
0 | 2020 { |
2061 | 2021 dword_6BE364_game_settings_1 |= GAME_SETTINGS_NO_HOUSE_ANIM; |
0 | 2022 bNoVideo = true; |
2023 } | |
2024 if (wcsstr(pCmdLine, L"-nocd")) | |
2025 bNoCD = true; | |
168 | 2026 if (wcsstr(pCmdLine, L"-new_sky")) |
2027 new_sky = true; | |
1052 | 2028 if (wcsstr(pCmdLine, L"-nomarg")) |
2029 bNoMargareth = true; | |
0 | 2030 } |
2031 | |
731 | 2032 /*v8 = _4AC1C9_get_cpu_speed(0, (Vec4_int_ *)a2); |
0 | 2033 Rect.left = *(int *)v8; |
2034 Rect.top = *(int *)(v8 + 4); | |
2035 Rect.right = *(int *)(v8 + 8); | |
2036 Rect.bottom = *(int *)(v8 + 12); | |
731 | 2037 uCPUSpeed = Rect.bottom;*/ |
2038 uCPUSpeed = 2048; // about 2GHz | |
4 | 2039 |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2212
diff
changeset
|
2040 if (!MM7_Initialize(640, 480))//çàäà¸òñÿ ðàçìåð îêíà |
734 | 2041 { |
2042 Log::Warning(L"MM init: failed"); | |
2043 pGame->Deinitialize(); | |
2044 return 1; | |
2045 } | |
0 | 2046 |
2216 | 2047 pEventTimer->Pause(); |
2048 | |
2049 SetUserInterface(PartyAlignment_Neutral, false); | |
2290 | 2050 ShowLogoVideo(); |
2051 //ShowIntroVideo_and_LoadingScreen(); | |
2216 | 2052 WriteWindowsRegistryInt("Ran once", 1); |
2053 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000; | |
2054 pGame->InitializeGammaController(); | |
2055 SecondaryInitialization(); | |
2056 pRenderer->SetRasterClipRect(0, 0, window->GetWidth() - 1, window->GetHeight() - 1); | |
2057 FinalInitialization(); | |
2279 | 2058 |
2059 //Ritor1: include | |
2278 | 2060 MMT_MainMenu_Loop(); |
2279 | 2061 |
2216 | 2062 Log::Warning(L"MM: entering main loop"); |
2063 while ( 1 ) | |
2064 { | |
2065 MainMenuWindow* main_menu_window = MainMenuWindow::Create(); | |
2066 window->AddControl(main_menu_window); | |
2067 MainMenu_Loop(); | |
2068 uGameState = GAME_STATE_PLAYING; | |
0 | 2069 while ( 1 ) |
2070 { | |
2216 | 2071 if (uGameState == GAME_FINISHED || GetCurrentMenuID() == MENU_EXIT_GAME) |
2072 { | |
2073 pGame->Deinitialize(); | |
2074 return true; | |
2075 } | |
2076 | |
2077 if (GetCurrentMenuID() == MENU_NEWGAME) | |
0 | 2078 { |
2216 | 2079 if ( pAudioPlayer->hAILRedbook ) |
2080 AIL_redbook_stop(pAudioPlayer->hAILRedbook); | |
2081 pParty->Reset(); | |
2082 pOtherOverlayList->Reset(); | |
2083 strcpy(pCurrentMapName, pStartingMapName); | |
2084 pParty->CreateDefaultParty(0); | |
2085 PlayerCreationUI_Initialize(); | |
2086 if ( PlayerCreationUI_Loop() ) | |
982 | 2087 { |
0 | 2088 DeleteCCharFont(); |
2216 | 2089 break; |
2 | 2090 } |
2216 | 2091 DeleteCCharFont(); |
2092 bFlashQuestBook = true; | |
2093 PlayFullscreenMovie(MOVIE_Emerald); | |
2094 //pGame->pCShow->PlayMovie(MOVIE_Emerald, 0); | |
2095 SaveNewGame(); | |
2096 if (bNoMargareth) | |
2097 _449B7E_toggle_bit(pParty->_quest_bits, PARTY_QUEST_EMERALD_MARGARETH_OFF, 1); | |
2098 pGame->Loop(); | |
2099 if (uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU) | |
101 | 2100 { |
2101 SetCurrentMenuID(MENU_NEWGAME); | |
982 | 2102 uGameState = GAME_STATE_PLAYING; |
0 | 2103 continue; |
101 | 2104 } |
2216 | 2105 else if (uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU) |
2106 break; | |
2107 assert(false && "Invalid game state"); | |
2108 } | |
2109 if (GetCurrentMenuID() == MENU_CREDITS) | |
2110 { | |
2111 if ( pAudioPlayer->hAILRedbook ) | |
2112 AIL_redbook_stop(pAudioPlayer->hAILRedbook); | |
2113 MainMenuUI_Credits_Loop(); | |
2114 break; | |
2115 } | |
2116 if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu) | |
2117 { | |
2118 uGameState = GAME_STATE_PLAYING; | |
2119 pGame->Loop(); | |
2120 } | |
2121 else | |
2122 { | |
2123 if (GetCurrentMenuID() == MENU_DebugBLVLevel) | |
907 | 2124 { |
2216 | 2125 pMouse->ChangeActivation(0); |
2126 pParty->Reset(); | |
2127 pParty->CreateDefaultParty(1); | |
2128 | |
2129 __debugbreak(); | |
2130 /*extern void CreateDefaultBLVLevel(); | |
2131 CreateDefaultBLVLevel(); | |
2132 | |
2133 OPENFILENAMEA ofn; | |
2134 if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) | |
2135 { | |
2136 pMouse->ChangeActivation(1); | |
2137 break; | |
2138 } | |
2139 _chdir("..\\"); | |
2140 strcpy(pCurrentMapName, ofn.lpstrFileTitle);*/ | |
2141 pMouse->ChangeActivation(1); | |
2142 pGame->Loop(); | |
907 | 2143 } |
0 | 2144 } |
2216 | 2145 if ( uGameState == GAME_STATE_LOADING_GAME ) |
2146 { | |
2147 SetCurrentMenuID(MENU_5); | |
2148 uGameState = GAME_STATE_PLAYING; | |
2149 continue; | |
2150 } | |
2151 if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU ) | |
0 | 2152 { |
2216 | 2153 SetCurrentMenuID(MENU_NEWGAME); |
2154 uGameState = GAME_STATE_PLAYING; | |
2155 continue; | |
2156 } | |
2157 if ( uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU)// from the loaded game | |
2158 { | |
2159 pAudioPlayer->StopChannels(-1, -1); | |
2160 uGameState = GAME_STATE_PLAYING; | |
2161 break; | |
0 | 2162 } |
2163 } | |
2216 | 2164 if (!bNoSound && pAudioPlayer->hAILRedbook) |
2165 { | |
2166 pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0f); | |
2167 AIL_redbook_stop(pAudioPlayer->hAILRedbook); | |
2168 unsigned int startms, end_ms; | |
2169 AIL_redbook_track_info(pAudioPlayer->hAILRedbook, 14, &startms, &end_ms); | |
2170 AIL_redbook_play(pAudioPlayer->hAILRedbook, startms + 1, end_ms); | |
2171 } | |
2172 } | |
2050 | 2173 //lua_close(L); |
0 | 2174 pGame->Deinitialize(); |
734 | 2175 return 1; |
0 | 2176 } |
2177 | |
2178 | |
2179 //----- (00466082) -------------------------------------------------------- | |
2180 void MM6_Initialize(const wchar_t *pIniFilename) | |
2181 { | |
2182 //int v0; // eax@1 | |
2151 | 2183 //UINT v1; // eax@18 |
0 | 2184 size_t v2; // eax@31 |
2185 size_t v3; // ebx@32 | |
2186 size_t v4; // edi@36 | |
2187 //char v5[120]; // [sp+Ch] [bp-17Ch]@1 | |
2188 //char String[120]; // [sp+84h] [bp-104h]@32 | |
2189 char pDefaultGroundTexture[16]; // [sp+FCh] [bp-8Ch]@32 | |
2190 //char pIniFilename[120]; // [sp+10Ch] [bp-7Ch]@1 | |
2191 unsigned int v9; // [sp+184h] [bp-4h]@28 | |
2192 | |
2193 //_getcwd(v5, 120); | |
2194 //sprintfex(pIniFilename, "%s\\mm6.ini", v5); | |
2195 viewparams = new ViewingParams; | |
819 | 2196 game_viewport_x = viewparams->uScreen_topL_X = GetPrivateProfileIntW(L"screen", L"vx1", 8, pIniFilename); |
2197 game_viewport_y = viewparams->uScreen_topL_Y = GetPrivateProfileIntW(L"screen", L"vy1", 8, pIniFilename); | |
2198 game_viewport_z = viewparams->uScreen_BttmR_X = GetPrivateProfileIntW(L"screen", L"vx2", 468, pIniFilename); | |
2199 game_viewport_w = viewparams->uScreen_BttmR_Y = GetPrivateProfileIntW(L"screen", L"vy2", 351, pIniFilename); | |
2200 game_viewport_width = game_viewport_z - game_viewport_x; | |
2201 game_viewport_height = game_viewport_w - game_viewport_y + 1; | |
0 | 2202 |
2203 | |
2204 pAudioPlayer = new AudioPlayer; | |
2205 pAudioPlayer->uMixerChannels = GetPrivateProfileIntW(L"settings", L"mixerchannels", 16, pIniFilename); | |
2206 if ( pAudioPlayer->uMixerChannels > 16 ) | |
2207 pAudioPlayer->uMixerChannels = 16; | |
2208 | |
2209 | |
2210 if (GetPrivateProfileIntW(L"debug", L"nomonster", 0, pIniFilename)) | |
2061 | 2211 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_ACTORS; |
2151 | 2212 if (ReadWindowsRegistryInt("startinwindow", 0)) |
2061 | 2213 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW; |
0 | 2214 if (GetPrivateProfileIntW(L"debug", L"showFR", 0, pIniFilename)) |
2061 | 2215 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_0002_SHOW_FR; |
0 | 2216 if (GetPrivateProfileIntW(L"debug", L"nodamage", 0, pIniFilename)) |
2061 | 2217 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_DAMAGE; |
0 | 2218 if (GetPrivateProfileIntW(L"debug", L"nodecoration", 0, pIniFilename)) |
2061 | 2219 dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_DECORATIONS; |
0 | 2220 |
2221 wchar_t pStartingMapNameW[1024]; | |
2222 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
|
2223 sprintf(pStartingMapName, "%S", pStartingMapNameW); |
0 | 2224 |
2225 v9 = 0; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
2226 if ( strlen(pStartingMapName) ) |
0 | 2227 { |
2228 do | |
2229 { | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
2230 if ( pStartingMapName[v9] == ' ' ) |
0 | 2231 pStartingMapName[v9] = 0; |
2232 ++v9; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1467
diff
changeset
|
2233 v2 = strlen(pStartingMapName); |
0 | 2234 } |
2235 while ( v9 < v2 ); | |
2236 } | |
2237 | |
1637 | 2238 pODMRenderParams = new ODMRenderParams; |
2239 pODMRenderParams->outdoor_no_mist = GetPrivateProfileIntW(L"debug", L"noMist", 0, pIniFilename); | |
2240 pODMRenderParams->bNoSky = GetPrivateProfileIntW(L"outdoor", L"nosky", 0, pIniFilename); | |
2241 pODMRenderParams->bDoNotRenderDecorations = GetPrivateProfileIntW(L"render", L"nodecorations", 0, pIniFilename); | |
2242 pODMRenderParams->outdoor_no_wavy_water = GetPrivateProfileIntW(L"outdoor", L"nowavywater", 0, pIniFilename); | |
0 | 2243 outdoor_grid_band_1 = GetPrivateProfileIntW(L"outdoor", L"gridband1", 10, pIniFilename); |
2244 outdoor_grid_band_2 = GetPrivateProfileIntW(L"outdoor", L"gridband2", 15, pIniFilename); | |
2245 outdoor_grid_band_3 = GetPrivateProfileIntW(L"outdoor", L"gridband3", 25, pIniFilename); | |
1637 | 2246 pODMRenderParams->terrain_gamma = GetPrivateProfileIntW(L"outdoor", L"ter_gamma", 0, pIniFilename); |
2247 pODMRenderParams->building_gamme = GetPrivateProfileIntW(L"outdoor", L"bld_gamma", 0, pIniFilename); | |
2248 pODMRenderParams->shading_dist_shade = GetPrivateProfileIntW(L"shading", L"dist_shade", 2048, pIniFilename); | |
2249 pODMRenderParams->shading_dist_shademist = GetPrivateProfileIntW(L"shading", L"dist_shademist", 4096, pIniFilename); | |
1765 | 2250 |
2277 | 2251 //int dist = 0x2000; |
2252 | |
2253 //if ( new_draw_object_dist ) | |
2254 //dist = 0x6000; | |
2255 pODMRenderParams->shading_dist_mist = GetPrivateProfileIntW(L"shading", L"dist_mist", 0x2000, pIniFilename);//äàëüíîñòü îòðèñîâêè 0x2000 | |
0 | 2256 |
2257 wchar_t pDefaultSkyTextureW[1024]; | |
2258 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
|
2259 sprintf(pDefaultSkyTexture.data(), "%S", pDefaultSkyTextureW); |
0 | 2260 |
2261 wchar_t pDefaultGroundTextureW[1024]; | |
2262 GetPrivateProfileStringW(L"textures", L"default", L"dirt", pDefaultGroundTextureW, 0x10u, pIniFilename); | |
2263 sprintf(pDefaultGroundTexture, "%S", pDefaultGroundTextureW); | |
2264 | |
2265 wchar_t pFloat[1024]; | |
2266 GetPrivateProfileStringW(L"debug", L"recmod1", L"1.0", pFloat, 0x10u, pIniFilename); | |
2267 swscanf(pFloat, L"%f", &flt_6BE3A4_debug_recmod1); | |
2268 | |
2269 GetPrivateProfileStringW(L"debug", L"recmod2", L"1.0", pFloat, 0x10u, pIniFilename); | |
2270 swscanf(pFloat, L"%f", &flt_6BE3A8_debug_recmod2); | |
2271 | |
2272 flt_6BE3AC_debug_recmod1_x_1_6 = flt_6BE3A4_debug_recmod1 * 1.666666666666667; | |
2273 | |
2274 v3 = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
2275 if ( strlen(pDefaultSkyTexture.data()) ) |
0 | 2276 { |
2277 do | |
2278 { | |
2279 if ( pDefaultSkyTexture[v3] == ' ' ) | |
2280 pDefaultSkyTexture[v3] = 0; | |
2281 ++v3; | |
2282 } | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1203
diff
changeset
|
2283 while ( v3 < strlen(pDefaultSkyTexture.data()) ); |
0 | 2284 } |
2285 v4 = 0; | |
2286 if ( strlen(pDefaultGroundTexture) ) | |
2287 { | |
2288 do | |
2289 { | |
2290 if ( pDefaultGroundTexture[v4] == ' ' ) | |
2291 pDefaultGroundTexture[v4] = 0; | |
2292 ++v4; | |
2293 } | |
2294 while ( v4 < strlen(pDefaultGroundTexture) ); | |
2295 } | |
2296 | |
2297 MM7Initialization(); | |
2298 } | |
2299 | |
2300 //----- (004666D5) -------------------------------------------------------- | |
2151 | 2301 void MM7Initialization() |
0 | 2302 { |
2303 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | |
2304 { | |
2151 | 2305 /*if (byte_6BE388_graphicsmode == 0) |
0 | 2306 { |
2307 outdoor_grid_band_1 = 10; | |
2308 outdoor_grid_band_2 = 15; | |
2309 outdoor_grid_band_3 = 20; | |
1637 | 2310 pODMRenderParams->shading_dist_mist = 8192; |
2311 pODMRenderParams->bNoSky = false; | |
0 | 2312 LOBYTE(viewparams->field_20) = 0; |
2151 | 2313 }*/ |
1637 | 2314 pODMRenderParams->shading_dist_shade = 2048; |
2315 pODMRenderParams->terrain_gamma = 0; | |
2316 pODMRenderParams->building_gamme = 0; | |
2317 pODMRenderParams->shading_dist_shademist = 4096; | |
2318 pODMRenderParams->outdoor_no_wavy_water = 0; | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
2319 //_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
|
2320 { |
1637 | 2321 pODMRenderParams->outdoor_grid_band_3 = outdoor_grid_band_3; |
2322 pODMRenderParams->uPickDepth = outdoor_grid_band_3 * 512; | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
2323 } |
0 | 2324 } |
2325 else | |
2326 LOBYTE(viewparams->field_20) = 0; | |
2101 | 2327 pParty->uFlags |= 2; |
692 | 2328 viewparams->uSomeY = viewparams->uScreen_topL_Y; |
2329 viewparams->uSomeX = viewparams->uScreen_topL_X; | |
2330 viewparams->uSomeZ = viewparams->uScreen_BttmR_X; | |
2331 viewparams->uSomeW = viewparams->uScreen_BttmR_Y; | |
2332 | |
2333 pViewport->SetScreen(viewparams->uScreen_topL_X, viewparams->uScreen_topL_Y, viewparams->uScreen_BttmR_X, viewparams->uScreen_BttmR_Y); | |
0 | 2334 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
1637 | 2335 pODMRenderParams->Initialize(); |
0 | 2336 } |
2337 | |
2338 //----- (00466C40) -------------------------------------------------------- | |
2339 const wchar_t *MENU_STATE_to_string(MENU_STATE m) | |
2340 { | |
2341 switch (m) | |
2342 { | |
982 | 2343 case -1: return L"-1"; |
2344 case MENU_MAIN: return L"MENU_MAIN"; | |
2345 case MENU_NEWGAME: return L"MENU_NEWGAME"; | |
2346 case MENU_CREDITS: return L"MENU_CREDITS"; | |
2347 case MENU_SAVELOAD: return L"MENU_SAVELOAD"; | |
2348 case MENU_EXIT_GAME: return L"MENU_EXIT_GAME"; | |
2349 case MENU_5: return L"MENU_5"; | |
2350 case MENU_CREATEPARTY: return L"MENU_CREATEPARTY"; | |
165 | 2351 case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC"; |
982 | 2352 case MENU_CREDITSPROC: return L"MENU_CREDITSPROC"; |
961 | 2353 case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu"; |
1458 | 2354 case MENU_DebugBLVLevel: return L"MENU_DebugBLVLevel"; |
165 | 2355 case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE"; |
2278 | 2356 case MENU_MMT_MAIN_MENU: return L"MENU_MMT_MAIN_MENU"; |
982 | 2357 default: return L"unk"; |
0 | 2358 }; |
2359 }; | |
2360 void SetCurrentMenuID(MENU_STATE uMenu) | |
2361 { | |
2006 | 2362 sCurrentMenuID = uMenu; |
0 | 2363 |
2364 Log::Warning(L"CurrentMenu = %s", MENU_STATE_to_string(uMenu)); | |
2365 } | |
2366 | |
2367 //----- (00466CA0) -------------------------------------------------------- | |
2368 MENU_STATE GetCurrentMenuID() | |
2369 { | |
2006 | 2370 return sCurrentMenuID; |
0 | 2371 } |
2372 | |
2373 | |
2374 //----- (0046BDA8) -------------------------------------------------------- | |
1458 | 2375 unsigned int GetGravityStrength() |
0 | 2376 { |
2377 int v0; // eax@1 | |
2378 | |
2379 v0 = ~LOBYTE(pGame->uFlags2) & 8; | |
2380 LOBYTE(v0) = v0 | 2; | |
2381 return (unsigned int)v0 >> 1; | |
2382 } | |
2383 | |
2384 //----- (0046BDC0) -------------------------------------------------------- | |
1458 | 2385 void UpdateUserInput_and_MapSpecificStuff() |
0 | 2386 { |
2061 | 2387 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME) |
0 | 2388 { |
2061 | 2389 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0080_SKIP_USER_INPUT_THIS_FRAME; |
2390 return; | |
0 | 2391 } |
2061 | 2392 |
630 | 2393 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
0 | 2394 BLV_UpdateUserInputAndOther(); |
630 | 2395 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
0 | 2396 ODM_UpdateUserInputAndOther(); |
630 | 2397 |
783 | 2398 area_of_effect__damage_evaluate(); |
0 | 2399 } |
2400 | |
2401 //----- (0046BFFA) -------------------------------------------------------- | |
2402 bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) | |
2403 { | |
2101 | 2404 ObjectDesc *object; // ebx@1 |
0 | 2405 unsigned int v8; // eax@19 |
2406 signed int v10; // ebx@19 | |
2407 char *v11; // edx@20 | |
2408 unsigned __int16 v12; // ax@23 | |
2409 int v13; // eax@27 | |
2334 | 2410 // unsigned int v14; // ebx@33 |
0 | 2411 int v16; // eax@36 |
2334 | 2412 // unsigned int v17; // eax@37 |
0 | 2413 __int16 v18; // di@37 |
2414 signed int v19; // edx@37 | |
2334 | 2415 // unsigned __int8 v20; // sf@37 |
2416 // char *v21; // ecx@38 | |
0 | 2417 unsigned __int16 v22; // ax@41 |
2334 | 2418 // unsigned int v23; // eax@46 |
0 | 2419 signed int v24; // ebx@46 |
2420 char *v25; // edx@47 | |
2421 int v26; // edx@54 | |
2422 int v27; // edx@55 | |
2423 int v28; // edx@56 | |
2424 int v29; // edx@57 | |
2334 | 2425 // unsigned __int16 v30; // ax@60 |
2426 // unsigned int v31; // ecx@60 | |
2427 // int v32; // edi@60 | |
2428 // unsigned int v33; // eax@65 | |
0 | 2429 signed int v34; // edx@65 |
2334 | 2430 // char *v35; // ecx@66 |
0 | 2431 unsigned __int16 v36; // ax@69 |
2432 int v37; // ST14_4@72 | |
2433 int v38; // eax@72 | |
2434 int v39; // ST10_4@72 | |
2435 int v40; // ST0C_4@72 | |
2436 int v41; // edx@76 | |
2437 int v42; // edx@77 | |
2438 int v43; // edx@78 | |
2439 unsigned __int8 v44; // zf@79 | |
2440 int v45; // edx@79 | |
2441 unsigned __int16 v46; // ax@80 | |
2442 int v47; // eax@81 | |
2443 int v48; // edx@87 | |
2444 int v49; // edx@88 | |
2445 int v50; // edx@89 | |
2446 signed int v52; // ebx@93 | |
2334 | 2447 // char *v53; // edx@94 |
2448 // unsigned __int16 v54; // ax@98 | |
2449 // unsigned int v55; // ecx@98 | |
0 | 2450 signed int v56; // ebx@98 |
2334 | 2451 // char *v57; // edx@99 |
0 | 2452 unsigned __int16 v58; // ax@102 |
2453 unsigned __int16 v59; // ax@107 | |
2334 | 2454 // unsigned int v60; // ecx@107 |
0 | 2455 signed int v61; // ebx@107 |
2334 | 2456 // char *v62; // edx@108 |
0 | 2457 unsigned __int16 v63; // ax@111 |
2458 int v64; // ebx@114 | |
2459 signed int v65; // eax@114 | |
2334 | 2460 // unsigned int v66; // edi@123 |
2461 // unsigned __int16 v67; // ax@124 | |
2462 // unsigned int v68; // ecx@124 | |
0 | 2463 signed int v69; // ebx@124 |
2334 | 2464 // char *v70; // edx@125 |
0 | 2465 unsigned __int16 v71; // ax@128 |
2466 unsigned int v72; // ebx@131 | |
2467 int v78; // eax@133 | |
2468 char v79; // zf@139 | |
2334 | 2469 // unsigned int v80; // eax@140 |
0 | 2470 signed int v81; // edx@140 |
2334 | 2471 // char *v82; // ecx@141 |
0 | 2472 unsigned __int16 v83; // ax@144 |
2334 | 2473 // unsigned __int16 v84; // ax@151 |
2474 // unsigned int v85; // ecx@151 | |
0 | 2475 signed int v86; // ebx@151 |
2334 | 2476 // char *v87; // edx@152 |
0 | 2477 unsigned __int16 v88; // ax@155 |
2478 unsigned int v89; // eax@158 | |
2479 int v90; // ST34_4@159 | |
2480 int v91; // eax@159 | |
2481 unsigned int v92; // eax@163 | |
2334 | 2482 // unsigned int v93; // eax@177 |
2483 // char *v94; // ecx@178 | |
0 | 2484 unsigned __int16 v95; // ax@181 |
2485 unsigned __int16 v96; // ax@184 | |
2486 int v97; // eax@185 | |
2334 | 2487 // unsigned __int16 v98; // ax@191 |
0 | 2488 char v100; // ST18_1@198 |
2489 int v102; // eax@198 | |
2490 signed int v106; // eax@208 | |
2491 unsigned int v107; // edx@220 | |
2492 signed int v108; // ebx@225 | |
2334 | 2493 // unsigned int v109; // eax@234 |
0 | 2494 signed int v110; // ebx@234 |
2334 | 2495 // char *v111; // ecx@235 |
0 | 2496 unsigned __int16 v112; // ax@238 |
2497 unsigned __int16 v113; // si@241 | |
2498 int v114; // eax@242 | |
2499 int v115; // eax@245 | |
2334 | 2500 // unsigned __int16 v117; // ax@251 |
2501 // unsigned int v118; // ecx@251 | |
0 | 2502 signed int v119; // ebx@251 |
2334 | 2503 // char *v120; // edx@252 |
0 | 2504 unsigned __int16 v121; // ax@255 |
2334 | 2505 // unsigned int v122; // eax@260 |
2506 // char *v123; // edx@261 | |
0 | 2507 int v124; // eax@267 |
2508 int v125; // [sp-20h] [bp-4Ch]@28 | |
2509 char v132; // [sp-8h] [bp-34h]@131 | |
2510 char v134; // [sp-4h] [bp-30h]@131 | |
2511 signed int v135; // [sp-4h] [bp-30h]@217 | |
2512 int v136; // [sp+Ch] [bp-20h]@208 | |
2513 int v137; // [sp+10h] [bp-1Ch]@208 | |
2514 signed int v138; // [sp+14h] [bp-18h]@207 | |
2515 signed int v139; // [sp+18h] [bp-14h]@208 | |
2334 | 2516 // char *v140; // [sp+1Ch] [bp-10h]@61 |
0 | 2517 signed int v141; // [sp+1Ch] [bp-10h]@117 |
2518 unsigned int v142; // [sp+1Ch] [bp-10h]@158 | |
2519 signed int v143; // [sp+1Ch] [bp-10h]@172 | |
2334 | 2520 // char *v144; // [sp+1Ch] [bp-10h]@192 |
0 | 2521 signed int v146; // [sp+20h] [bp-Ch]@60 |
2522 int v147; // [sp+20h] [bp-Ch]@72 | |
2523 signed int v148; // [sp+20h] [bp-Ch]@158 | |
2524 unsigned __int16 v150; // [sp+20h] [bp-Ch]@208 | |
2525 signed int v152; // [sp+24h] [bp-8h]@208 | |
2101 | 2526 |
2527 //ïðèìåíåíèå: ôàåðáîëò â õðàìå ëóíû | |
2528 object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID]; | |
2529 //v151 = PID_TYPE(a2); | |
848 | 2530 if ( PID_TYPE(a2) == OBJECT_Actor) |
2531 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2532 if ( PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2533 && !pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) ) |
0 | 2534 return 1; |
2535 } | |
2536 else | |
2537 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2538 if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Player) |
0 | 2539 return 1; |
2540 } | |
2541 if ( pParty->bTurnBasedModeOn == 1 ) | |
2542 { | |
2101 | 2543 if ( pSpriteObjects[uLayingItemID].uAttributes & 4 ) |
0 | 2544 { |
1450 | 2545 --pTurnEngine->pending_actions; |
2101 | 2546 pSpriteObjects[uLayingItemID].uAttributes &= 0xFFFB; |
0 | 2547 } |
2548 } | |
2101 | 2549 if ( PID_TYPE(a2) == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player) |
1280 | 2550 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2551 if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) //bugfix PID_ID(v2->spell_caster_pid)==1000 |
2166 | 2552 pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes |= 0x40000; |
1280 | 2553 } |
2554 | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2555 //v6 = v2->uType; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2556 //v7 = v2->uType; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2557 if ( pSpriteObjects[uLayingItemID].uType > 3060 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2558 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2559 if ( pSpriteObjects[uLayingItemID].uType > 6090 ) |
0 | 2560 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2561 if ( pSpriteObjects[uLayingItemID].uType > 8090 ) |
0 | 2562 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2563 if ( pSpriteObjects[uLayingItemID].uType == 9010 ) |
0 | 2564 goto LABEL_247; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2565 if ( pSpriteObjects[uLayingItemID].uType != 9030 ) |
0 | 2566 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2567 if ( pSpriteObjects[uLayingItemID].uType != 9040 ) |
0 | 2568 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2569 if ( pSpriteObjects[uLayingItemID].uType != 9080 ) |
0 | 2570 return 0; |
2101 | 2571 v95 = 0; |
2572 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; | |
2573 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) | |
0 | 2574 { |
2101 | 2575 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) |
2576 v95 = v146; | |
0 | 2577 } |
2101 | 2578 pSpriteObjects[uLayingItemID].uObjectDescID = v95; |
2579 if ( !v95 ) | |
2580 SpriteObject::OnInteraction(uLayingItemID); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2581 v100 = pSpriteObjects[uLayingItemID].field_61; |
2101 | 2582 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
2583 v102 = 8 * uLayingItemID; | |
2584 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); | |
2585 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
2586 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
2587 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
2588 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); | |
2589 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) | |
2590 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); | |
2591 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2592 v47 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2593 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2594 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2595 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2101 | 2596 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2597 return 0; |
0 | 2598 } |
2101 | 2599 sub_43A97E(uLayingItemID, a2); |
2600 ++pSpriteObjects[uLayingItemID].uType; | |
2601 v95 = 0; | |
2602 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
2603 { | |
2604 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
2605 v95 = v52; | |
2606 } | |
2607 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
2608 if ( !v95 ) | |
2609 SpriteObject::OnInteraction(uLayingItemID); | |
2610 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
2611 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
2612 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
2613 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
2614 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
2615 if ( !v96 ) | |
2616 v97 = 0; | |
2617 else | |
2618 v97 = (signed __int16)v96 + 4; | |
2619 v124 = 8 * uLayingItemID; | |
2620 LOBYTE(v124) = v124 | 2; | |
2621 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
2622 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
2623 return 0; | |
0 | 2624 } |
2625 LABEL_172: | |
2626 v143 = 17030; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2627 switch ( pSpriteObjects[uLayingItemID].uType ) |
0 | 2628 { |
2629 case 0x1798u: | |
2630 v143 = 15040; | |
2631 break; | |
2632 case 0xFAAu: | |
2633 v143 = 13010; | |
2634 break; | |
2635 case 0x2346u: | |
2636 v143 = 18030; | |
2637 break; | |
2638 } | |
2639 v138 = 1; | |
2101 | 2640 if ( PID_TYPE(a2) != OBJECT_Actor) |
0 | 2641 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2642 if ( pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4 ) |
2101 | 2643 { |
2644 SpriteObject::OnInteraction(uLayingItemID); | |
2645 return 0; | |
2646 } | |
2647 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); | |
0 | 2648 LABEL_233: |
2649 if ( !v138 ) | |
2650 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2651 ++pSpriteObjects[uLayingItemID].uType; |
2101 | 2652 v112 = 0; |
2653 for ( v110 = 0; v110 < (signed int)pObjectList->uNumObjects; ++v110 ) | |
0 | 2654 { |
2101 | 2655 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v110].uObjectID ) |
2656 v112 = v110; | |
0 | 2657 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2658 pSpriteObjects[uLayingItemID].uObjectDescID = v112; |
0 | 2659 if ( !v112 ) |
2101 | 2660 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2661 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2662 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2663 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2664 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2665 v113 = pSpriteObjects[uLayingItemID].uSoundID; |
0 | 2666 if ( v113 ) |
2667 v114 = (signed __int16)v113 + 4; | |
2668 else | |
2669 v114 = 0; | |
2101 | 2670 v115 = 8 * uLayingItemID; |
2671 LOBYTE(v115) = PID(OBJECT_Item, uLayingItemID); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2672 v125 = v143 + 1; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2673 pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2674 return 0; |
0 | 2675 } |
2101 | 2676 SpriteObject::OnInteraction(uLayingItemID); |
0 | 2677 return 0; |
2678 } | |
2101 | 2679 v106 = a2; |
0 | 2680 v150 = 0; |
848 | 2681 v139 = PID_ID(v106); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2682 v137 = pSpriteObjects[uLayingItemID].spell_level; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2683 v152 = pSpriteObjects[uLayingItemID].spell_skill; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2684 v136 = pSpriteObjects[uLayingItemID].spell_id; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2685 if ( pSpriteObjects[uLayingItemID].uType == 9030 ) |
0 | 2686 { |
2687 v150 = 2; | |
2688 if ( v152 == 2 ) | |
2689 { | |
2690 v150 = 3; | |
2691 } | |
2692 else | |
2693 { | |
2694 if ( v152 >= 3 ) | |
2695 v150 = 4; | |
2696 } | |
2166 | 2697 pActors[v139].uAttributes |= 0x80000; |
0 | 2698 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2699 if ( pSpriteObjects[uLayingItemID].uType == 6040 ) |
0 | 2700 { |
2701 v135 = 7; | |
2702 } | |
2703 else | |
2704 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2705 if ( pSpriteObjects[uLayingItemID].uType == 8030 ) |
0 | 2706 { |
2707 v135 = 9; | |
2708 } | |
2709 else | |
2710 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2711 if ( pSpriteObjects[uLayingItemID].uType != 9030 ) |
0 | 2712 { |
2713 v107 = v136; | |
2714 LABEL_222: | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2715 if ( pSpriteObjects[uLayingItemID].uType != 9030 || v152 != 4 ) |
0 | 2716 { |
2717 v108 = v139; | |
2301 | 2718 if ( pActors[v139].DoesDmgTypeDoDamage((DAMAGE_TYPE)v107) ) |
0 | 2719 { |
2720 v138 = 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2721 if ( pSpriteObjects[uLayingItemID].uType == 8030 ) |
0 | 2722 { |
2723 pActors[v108].uAIState = Standing; | |
2724 pActors[v108].UpdateAnimation(); | |
2725 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2726 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
|
2727 v152, v150, 0, 0); |
0 | 2728 } |
2729 } | |
2730 else | |
2731 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2732 pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); |
0 | 2733 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2734 pSpriteObjects[uLayingItemID].spell_level = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2735 pSpriteObjects[uLayingItemID].spell_skill = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2736 pSpriteObjects[uLayingItemID].spell_id = 0; |
0 | 2737 goto LABEL_233; |
2738 } | |
2739 v135 = 10; | |
2740 } | |
2741 } | |
2742 v107 = v135; | |
2743 goto LABEL_222; | |
2744 } | |
2101 | 2745 if ( pSpriteObjects[uLayingItemID].uType == 8090 |
2746 || pSpriteObjects[uLayingItemID].uType == 7030 | |
2747 || pSpriteObjects[uLayingItemID].uType == 7090 || pSpriteObjects[uLayingItemID].uType == 8000 ) | |
2748 { | |
2749 sub_43A97E(uLayingItemID, a2); | |
2750 ++pSpriteObjects[uLayingItemID].uType; | |
2751 v95 = 0; | |
2752 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
2753 { | |
2754 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
2755 v95 = v52; | |
2756 } | |
2757 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
2758 if ( !v95 ) | |
2759 SpriteObject::OnInteraction(uLayingItemID); | |
2760 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
2761 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
2762 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
2763 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
2764 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
2765 if ( !v96 ) | |
2766 v97 = 0; | |
2767 else | |
2768 v97 = (signed __int16)v96 + 4; | |
2769 v124 = 8 * uLayingItemID; | |
2770 LOBYTE(v124) = v124 | 2; | |
2771 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
2772 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
2773 return 0; | |
2774 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2775 if ( pSpriteObjects[uLayingItemID].uType == 8010 ) |
0 | 2776 { |
2101 | 2777 if ( PID_TYPE(a2) == 3 |
2778 && MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | |
2779 sub_43A97E(uLayingItemID, a2); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2780 ++pSpriteObjects[uLayingItemID].uType; |
2101 | 2781 //v9 = 0; |
2782 v95 = 0; | |
2783 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
0 | 2784 { |
2101 | 2785 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) |
2786 v95 = v52; | |
0 | 2787 } |
2101 | 2788 pSpriteObjects[uLayingItemID].uObjectDescID = v95; |
2789 if ( !v95 ) | |
2790 SpriteObject::OnInteraction(uLayingItemID); | |
2791 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
2792 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
2793 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
2794 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
2795 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
2796 if ( !v96 ) | |
2797 v97 = 0; | |
2798 else | |
2799 v97 = (signed __int16)v96 + 4; | |
2800 v92 = uLayingItemID; | |
2801 v124 = 8 * v92; | |
2802 LOBYTE(v124) = v124 | 2; | |
2803 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
2804 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
2805 return 0; | |
0 | 2806 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2807 v79 = pSpriteObjects[uLayingItemID].uType == 8030; |
0 | 2808 } |
2809 else | |
2810 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2811 if ( pSpriteObjects[uLayingItemID].uType == 6090 ) |
2101 | 2812 { |
2813 sub_43A97E(uLayingItemID, a2); | |
2814 ++pSpriteObjects[uLayingItemID].uType; | |
2815 v95 = 0; | |
2816 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
2817 { | |
2818 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
2819 v95 = v52; | |
2820 } | |
2821 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
2822 if ( !v95 ) | |
2823 SpriteObject::OnInteraction(uLayingItemID); | |
2824 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
2825 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
2826 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
2827 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
2828 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
2829 if ( !v96 ) | |
2830 v97 = 0; | |
2831 else | |
2832 v97 = (signed __int16)v96 + 4; | |
2833 v124 = 8 * uLayingItemID; | |
2834 LOBYTE(v124) = v124 | 2; | |
2835 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
2836 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
2837 return 0; | |
2838 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2839 if ( pSpriteObjects[uLayingItemID].uType <= 4070 ) |
0 | 2840 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2841 if ( pSpriteObjects[uLayingItemID].uType != 4070 ) |
0 | 2842 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2843 v48 = pSpriteObjects[uLayingItemID].uType - 3090; |
0 | 2844 if ( v48 ) |
2845 { | |
2846 v49 = v48 - 2; | |
2847 if ( v49 ) | |
2848 { | |
2849 v50 = v49 - 908; | |
2101 | 2850 if ( v49 == 908 ) |
2851 { | |
2852 sub_43A97E(uLayingItemID, a2); | |
2853 ++pSpriteObjects[uLayingItemID].uType; | |
2854 v95 = 0; | |
2855 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
2856 { | |
2857 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
2858 v95 = v52; | |
2859 } | |
2860 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
2861 if ( !v95 ) | |
2862 SpriteObject::OnInteraction(uLayingItemID); | |
2863 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
2864 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
2865 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
2866 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
2867 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
2868 if ( !v96 ) | |
2869 v97 = 0; | |
2870 else | |
2871 v97 = (signed __int16)v96 + 4; | |
2872 v124 = 8 * uLayingItemID; | |
2873 LOBYTE(v124) = v124 | 2; | |
2874 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
2875 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
2876 return 0; | |
2877 } | |
0 | 2878 v45 = v50 - 30; |
2879 v44 = v45 == 0; | |
2880 goto LABEL_91; | |
2881 } | |
2101 | 2882 //v9 = 0; |
2883 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType - 1; | |
2884 v58 = 0; | |
2885 for ( v56 = 0; v56 < (signed int)pObjectList->uNumObjects; ++v56 ) | |
0 | 2886 { |
2101 | 2887 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v56].uObjectID ) |
2888 v58 = v56; | |
0 | 2889 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2890 pSpriteObjects[uLayingItemID].uObjectDescID = v58; |
0 | 2891 if ( !v58 ) |
2101 | 2892 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2893 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2894 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2895 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2896 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
2101 | 2897 sub_43A97E(uLayingItemID, a2); |
2898 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
0 | 2899 v16 = 0; |
2900 else | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2901 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
2101 | 2902 v124 = 8 * uLayingItemID; |
0 | 2903 LOBYTE(v124) = v124 | 2; |
1456 | 2904 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2101 | 2905 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2906 return 0; |
0 | 2907 } |
2101 | 2908 //v9 = 0; |
2909 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2; | |
2910 v63 = 0; | |
2911 for ( v61 = 0; v61 < (signed int)pObjectList->uNumObjects; ++v61 ) | |
0 | 2912 { |
2101 | 2913 if ( v59 == pObjectList->pObjects[v61].uObjectID ) |
2914 v63 = v61; | |
0 | 2915 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2916 pSpriteObjects[uLayingItemID].uObjectDescID = v63; |
0 | 2917 if ( !v63 ) |
2101 | 2918 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2919 v64 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2920 v44 = pSpriteObjects[uLayingItemID].spell_skill == 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2921 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2922 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2923 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
0 | 2924 v65 = 7; |
2925 if ( v44 ) | |
2926 v65 = 9; | |
2927 if ( v65 > 0 ) | |
2928 { | |
2929 v141 = v65; | |
2930 do | |
2931 { | |
2101 | 2932 v64 += (signed int)stru_5C6E00->uIntegerHalfPi / 2; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2933 pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0); |
0 | 2934 --v141; |
2935 } | |
2936 while ( v141 ); | |
2937 } | |
2101 | 2938 SpriteObject::OnInteraction(uLayingItemID); |
2939 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2940 v16 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2941 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2942 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
2101 | 2943 v124 = 8 * uLayingItemID; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2944 LOBYTE(v124) = v124 | 2; |
1456 | 2945 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2101 | 2946 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2947 return 0; |
0 | 2948 } |
2101 | 2949 //v66 = 0; |
2950 if ( PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2) ) | |
0 | 2951 return 1; |
2101 | 2952 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; |
2953 v71 = 0; | |
2954 for ( v69 = 0; v69 < (signed int)pObjectList->uNumObjects; ++v69 ) | |
0 | 2955 { |
2101 | 2956 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v69].uObjectID ) |
2957 v71 = v69; | |
0 | 2958 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2959 pSpriteObjects[uLayingItemID].uObjectDescID = v71; |
0 | 2960 if ( !v71 ) |
2101 | 2961 SpriteObject::OnInteraction(uLayingItemID); |
0 | 2962 v134 = 0; |
2101 | 2963 v72 = uLayingItemID; |
0 | 2964 v132 = 0; |
2101 | 2965 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
2966 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
2967 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
2968 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
2059 | 2969 AttackerInfo.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); |
2101 | 2970 if ( !pSpriteObjects[uLayingItemID].uSoundID ) |
0 | 2971 v78 = 0; |
2972 else | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2973 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2974 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2185 | 2975 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, 0, -1, 0, v78, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2976 return 0; |
0 | 2977 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2978 if ( pSpriteObjects[uLayingItemID].uType == 4090 ) |
0 | 2979 { |
2101 | 2980 //v9 = 0; |
2981 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2; | |
2982 v88 = 0; | |
2983 for ( v86 = 0; v86 < (signed int)pObjectList->uNumObjects; ++v86 ) | |
0 | 2984 { |
2101 | 2985 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v86].uObjectID ) |
2986 v88 = v86; | |
0 | 2987 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2988 pSpriteObjects[uLayingItemID].uObjectDescID = v88; |
0 | 2989 if ( !v88 ) |
2101 | 2990 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2991 v89 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2992 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2993 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
2994 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
0 | 2995 v142 = v89; |
2996 v148 = 7; | |
2997 do | |
2998 { | |
2999 pRnd->SetRange(-128, 128); | |
3000 v90 = pRnd->GetInRange(); | |
3001 pRnd->SetRange(5, 500); | |
3002 v91 = pRnd->GetInRange(); | |
3003 v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3004 pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0); |
0 | 3005 --v148; |
3006 } | |
3007 while ( v148 ); | |
2101 | 3008 SpriteObject::OnInteraction(uLayingItemID); |
3009 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3010 v16 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3011 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3012 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
2101 | 3013 v124 = 8 * uLayingItemID; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3014 LOBYTE(v124) = v124 | 2; |
1456 | 3015 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id-1] + 1; |
2101 | 3016 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3017 return 0; |
0 | 3018 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3019 if ( pSpriteObjects[uLayingItemID].uType == 4092 ) |
0 | 3020 { |
2101 | 3021 //v66 = 0; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3022 pSpriteObjects[uLayingItemID].uType = 4091; |
2101 | 3023 v83 = 0; |
3024 for ( v81 = 0; v81 < (signed int)pObjectList->uNumObjects; ++v81 ) | |
0 | 3025 { |
2101 | 3026 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v81].uObjectID ) |
3027 v83 = v81; | |
0 | 3028 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3029 pSpriteObjects[uLayingItemID].uObjectDescID = v83; |
0 | 3030 if ( !v83 ) |
2101 | 3031 SpriteObject::OnInteraction(uLayingItemID); |
0 | 3032 v134 = 0; |
2102 | 3033 //v72 = uLayingItemID; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3034 v132 = pSpriteObjects[uLayingItemID].field_61; |
2101 | 3035 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
3036 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
3037 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
3038 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
2102 | 3039 AttackerInfo.Add(PID(OBJECT_Item, uLayingItemID), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); |
2101 | 3040 if ( !pSpriteObjects[uLayingItemID].uSoundID ) |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3041 v78 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3042 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3043 v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3044 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2102 | 3045 pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, 0, -1, 0, v78, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3046 return 0; |
0 | 3047 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3048 if ( pSpriteObjects[uLayingItemID].uType == 4100 || pSpriteObjects[uLayingItemID].uType == 6010 ) |
2101 | 3049 { |
3050 sub_43A97E(uLayingItemID, a2); | |
3051 ++pSpriteObjects[uLayingItemID].uType; | |
3052 v95 = 0; | |
3053 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
3054 { | |
3055 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
3056 v95 = v52; | |
3057 } | |
3058 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
3059 if ( !v95 ) | |
3060 SpriteObject::OnInteraction(uLayingItemID); | |
3061 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
3062 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
3063 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
3064 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
3065 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
3066 if ( !v96 ) | |
3067 v97 = 0; | |
3068 else | |
3069 v97 = (signed __int16)v96 + 4; | |
3070 v124 = 8 * uLayingItemID; | |
3071 LOBYTE(v124) = v124 | 2; | |
3072 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
3073 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
3074 return 0; | |
3075 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3076 v79 = pSpriteObjects[uLayingItemID].uType == 6040; |
0 | 3077 } |
3078 if ( !v79 ) | |
3079 return 0; | |
3080 goto LABEL_172; | |
3081 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3082 if ( pSpriteObjects[uLayingItemID].uType == 3060 ) |
2101 | 3083 { |
3084 sub_43A97E(uLayingItemID, a2); | |
3085 ++pSpriteObjects[uLayingItemID].uType; | |
3086 v95 = 0; | |
3087 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
3088 { | |
3089 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
3090 v95 = v52; | |
3091 } | |
3092 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
3093 if ( !v95 ) | |
3094 SpriteObject::OnInteraction(uLayingItemID); | |
3095 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
3096 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
3097 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
3098 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
3099 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
3100 if ( !v96 ) | |
3101 v97 = 0; | |
3102 else | |
3103 v97 = (signed __int16)v96 + 4; | |
3104 v124 = 8 * uLayingItemID; | |
3105 LOBYTE(v124) = v124 | 2; | |
3106 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
3107 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
3108 return 0; | |
3109 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3110 if ( pSpriteObjects[uLayingItemID].uType <= 555 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3111 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3112 if ( pSpriteObjects[uLayingItemID].uType == 555 ) |
0 | 3113 { |
2101 | 3114 sub_43A97E(uLayingItemID, a2); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3115 ++pSpriteObjects[uLayingItemID].uType; |
0 | 3116 v18 = 0; |
2101 | 3117 v22 = 0; |
3118 v25 = (char *)&pObjectList->pObjects->uObjectID; | |
3119 for ( v24 = 0; v24 < (signed int)pObjectList->uNumObjects; ++v24 ) | |
0 | 3120 { |
2101 | 3121 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v24].uObjectID ) |
3122 v22 = v24; | |
0 | 3123 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3124 pSpriteObjects[uLayingItemID].uObjectDescID = v22; |
0 | 3125 if ( v22 == v18 ) |
2101 | 3126 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3127 pSpriteObjects[uLayingItemID].vVelocity.z = v18; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3128 pSpriteObjects[uLayingItemID].vVelocity.y = v18; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3129 pSpriteObjects[uLayingItemID].vVelocity.x = v18; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3130 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; |
0 | 3131 } |
3132 else | |
3133 { | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3134 switch ( pSpriteObjects[uLayingItemID].uType ) |
0 | 3135 { |
3136 case 500: | |
3137 case 505: | |
3138 case 510: | |
3139 case 515: | |
3140 case 520: | |
3141 case 525: | |
3142 case 530: | |
3143 case 535: | |
3144 case 540: | |
2101 | 3145 sub_43A97E(uLayingItemID, a2); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3146 ++pSpriteObjects[uLayingItemID].uType; |
2101 | 3147 v12 = 0; |
3148 for ( v10 = 0; v10 < (signed int)pObjectList->uNumObjects; ++v10 ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3149 { |
2101 | 3150 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v10].uObjectID ) |
3151 v12 = v10; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3152 } |
2101 | 3153 pSpriteObjects[uLayingItemID].uObjectDescID = v12; |
3154 if ( !v12 ) | |
3155 SpriteObject::OnInteraction(uLayingItemID); | |
3156 v44 = pSpriteObjects[uLayingItemID].uType == 555; | |
3157 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
3158 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
3159 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
3160 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
3161 if ( !v44 ) | |
3162 { | |
3163 v13 = 8 * uLayingItemID; | |
3164 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); | |
3165 pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); | |
3166 } | |
3167 return 0; | |
0 | 3168 case 545: |
3169 case 550: | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3170 if ( pSpriteObjects[uLayingItemID].stru_24.uItemID != 405 && pSpriteObjects[uLayingItemID].stru_24.uSpecEnchantmentType != 3 ) |
0 | 3171 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3172 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3173 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3174 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3175 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
2101 | 3176 sub_43A97E(uLayingItemID, a2); |
3177 SpriteObject::OnInteraction(uLayingItemID); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3178 if ( pSpriteObjects[uLayingItemID].uSoundID == 0 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3179 v16 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3180 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3181 v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
2101 | 3182 v124 = 8 * uLayingItemID; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3183 LOBYTE(v124) = v124 | 2; |
1996 | 3184 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3185 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3186 return 0; |
0 | 3187 } |
3188 v18 = 0; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3189 pSpriteObjects[uLayingItemID].uType = 600; |
2101 | 3190 v22 = 0; |
3191 for ( v19 = 0; v19 < (signed int)pObjectList->uNumObjects; ++v19 ) | |
0 | 3192 { |
2101 | 3193 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v19].uObjectID ) |
3194 v22 = v19; | |
0 | 3195 } |
2101 | 3196 pSpriteObjects[uLayingItemID].uObjectDescID = v22; |
3197 if ( !v22 ) | |
3198 SpriteObject::OnInteraction(uLayingItemID); | |
3199 pSpriteObjects[uLayingItemID].vVelocity.z = v18; | |
3200 pSpriteObjects[uLayingItemID].vVelocity.y = v18; | |
3201 pSpriteObjects[uLayingItemID].vVelocity.x = v18; | |
3202 pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; | |
0 | 3203 default: |
3204 return 0; | |
3205 } | |
2101 | 3206 v12 = 0; |
3207 for ( v10; v10 < (signed int)v8; ++v10 ) | |
0 | 3208 { |
3209 v11 += 56; | |
2101 | 3210 if ( pSpriteObjects[uLayingItemID].uType != *(short *)v11 ) |
3211 v12 = v10; | |
0 | 3212 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3213 pSpriteObjects[uLayingItemID].uObjectDescID = v12; |
0 | 3214 if ( !v12 ) |
2101 | 3215 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3216 v44 = pSpriteObjects[uLayingItemID].uType == 555; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3217 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3218 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3219 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3220 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
0 | 3221 if ( !v44 ) |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3222 { |
2101 | 3223 v13 = 8 * uLayingItemID; |
3224 LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); | |
3225 pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3226 return 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3227 } |
0 | 3228 } |
3229 return 0; | |
3230 } | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3231 if ( pSpriteObjects[uLayingItemID].uType > 1100 ) |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3232 { |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3233 v41 = pSpriteObjects[uLayingItemID].uType - 2030; |
0 | 3234 if ( !v41 ) |
3235 goto LABEL_247; | |
3236 v42 = v41 - 30; | |
3237 if ( v42 ) | |
3238 { | |
3239 v43 = v42 - 40; | |
2101 | 3240 if ( v42 == 40 ) |
3241 { | |
3242 if ( PID_TYPE(a2) != 3 ) | |
3243 { | |
3244 //v32 = 0; | |
3245 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; | |
3246 v46 = 0; | |
3247 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) | |
3248 { | |
3249 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) | |
3250 v46 = v146; | |
3251 } | |
3252 pSpriteObjects[uLayingItemID].uObjectDescID = v46; | |
3253 if ( !v46 ) | |
3254 SpriteObject::OnInteraction(uLayingItemID); | |
3255 v100 = pSpriteObjects[uLayingItemID].field_61; | |
3256 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
3257 v102 = 8 * uLayingItemID; | |
3258 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); | |
3259 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
3260 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
3261 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
3262 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); | |
3263 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) | |
3264 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); | |
3265 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
3266 v47 = 0; | |
3267 else | |
3268 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; | |
3269 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
3270 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0); | |
3271 return 0; | |
3272 } | |
3273 return 1; | |
3274 } | |
0 | 3275 v45 = v43 - 910; |
3276 v44 = v45 == 0; | |
3277 LABEL_91: | |
3278 if ( !v44 && v45 != 20 ) | |
3279 return 0; | |
3280 } | |
2101 | 3281 sub_43A97E(uLayingItemID, a2); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3282 ++pSpriteObjects[uLayingItemID].uType; |
2101 | 3283 v95 = 0; |
3284 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
0 | 3285 { |
2101 | 3286 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) |
3287 v95 = v52; | |
0 | 3288 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3289 pSpriteObjects[uLayingItemID].uObjectDescID = v95; |
2101 | 3290 if ( !v95 ) |
3291 SpriteObject::OnInteraction(uLayingItemID); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3292 v96 = pSpriteObjects[uLayingItemID].uSoundID; |
2101 | 3293 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
3294 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
3295 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
3296 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
3297 if ( !v96 ) | |
0 | 3298 v97 = 0; |
3299 else | |
3300 v97 = (signed __int16)v96 + 4; | |
2101 | 3301 v124 = 8 * uLayingItemID; |
3302 LOBYTE(v124) = v124 | 2; | |
3303 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
3304 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
3305 return 0; | |
3306 } | |
3307 if ( pSpriteObjects[uLayingItemID].uType == 1100 ) | |
3308 { | |
3309 sub_43A97E(uLayingItemID, a2); | |
3310 ++pSpriteObjects[uLayingItemID].uType; | |
3311 v95 = 0; | |
3312 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
3313 { | |
3314 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
3315 v95 = v52; | |
3316 } | |
3317 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
3318 if ( !v95 ) | |
3319 SpriteObject::OnInteraction(uLayingItemID); | |
3320 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
3321 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
3322 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
3323 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
3324 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
3325 if ( !v96 ) | |
3326 v97 = 0; | |
3327 else | |
3328 v97 = (signed __int16)v96 + 4; | |
3329 v92 = uLayingItemID; | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3330 v124 = 8 * v92; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3331 LOBYTE(v124) = v124 | 2; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3332 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2101 | 3333 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3334 return 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3335 } |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3336 v26 = pSpriteObjects[uLayingItemID].uType - 600; |
2101 | 3337 if ( pSpriteObjects[uLayingItemID].uType == 600 ) |
0 | 3338 { |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3339 pSpriteObjects[uLayingItemID].uType = 601; |
2101 | 3340 v36 = 0; |
3341 for ( v34 = 0; v34 < (signed int)pObjectList->uNumObjects; ++v34 ) | |
0 | 3342 { |
2101 | 3343 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v34].uObjectID ) |
3344 v36 = v34; | |
0 | 3345 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3346 pSpriteObjects[uLayingItemID].uObjectDescID = v36; |
0 | 3347 if ( !v36 ) |
2101 | 3348 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3349 v37 = pSpriteObjects[uLayingItemID].vPosition.z; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3350 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
2101 | 3351 v38 = 8 * uLayingItemID; |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3352 v39 = pSpriteObjects[uLayingItemID].vPosition.y; |
2101 | 3353 LOBYTE(v38) = PID(OBJECT_Item, uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3354 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3355 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3356 v40 = pSpriteObjects[uLayingItemID].vPosition.x; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3357 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
0 | 3358 v147 = v38; |
2059 | 3359 AttackerInfo.Add(v38, 512, v40, v39, v37, 0, 0); |
2101 | 3360 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) |
3361 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3362 pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0); |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3363 return 0; |
0 | 3364 } |
3365 v27 = v26 - 410; | |
2101 | 3366 if ( v26 == 410 ) |
3367 { | |
3368 sub_43A97E(uLayingItemID, a2); | |
3369 ++pSpriteObjects[uLayingItemID].uType; | |
3370 v95 = 0; | |
3371 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
3372 { | |
3373 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) | |
3374 v95 = v52; | |
3375 } | |
3376 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
3377 if ( !v95 ) | |
3378 SpriteObject::OnInteraction(uLayingItemID); | |
3379 v96 = pSpriteObjects[uLayingItemID].uSoundID; | |
3380 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
3381 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
3382 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
3383 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
3384 if ( !v96 ) | |
3385 v97 = 0; | |
3386 else | |
3387 v97 = (signed __int16)v96 + 4; | |
3388 v124 = 8 * uLayingItemID; | |
3389 LOBYTE(v124) = v124 | 2; | |
3390 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
3391 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
3392 return 0; | |
3393 } | |
0 | 3394 v28 = v27 - 40; |
3395 if ( !v28 ) | |
2101 | 3396 { |
3397 v95 = 0; | |
3398 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; | |
3399 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) | |
3400 { | |
3401 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) | |
3402 v95 = v146; | |
3403 } | |
3404 pSpriteObjects[uLayingItemID].uObjectDescID = v95; | |
3405 if ( !v95 ) | |
3406 SpriteObject::OnInteraction(uLayingItemID); | |
3407 v100 = pSpriteObjects[uLayingItemID].field_61; | |
3408 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
3409 v102 = 8 * uLayingItemID; | |
3410 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); | |
3411 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
3412 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
3413 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
3414 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); | |
3415 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) | |
3416 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); | |
3417 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
3418 v47 = 0; | |
3419 else | |
3420 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; | |
3421 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
3422 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0); | |
3423 return 0; | |
3424 } | |
0 | 3425 v29 = v28 - 10; |
3426 if ( v29 ) | |
3427 { | |
3428 if ( v29 != 20 ) | |
3429 return 0; | |
2101 | 3430 if ( PID_TYPE(a2) != 3 ) |
0 | 3431 { |
2101 | 3432 //v32 = 0; |
3433 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; | |
3434 v46 = 0; | |
3435 for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) | |
0 | 3436 { |
2101 | 3437 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) |
3438 v46 = v146; | |
0 | 3439 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3440 pSpriteObjects[uLayingItemID].uObjectDescID = v46; |
2101 | 3441 if ( !v46 ) |
3442 SpriteObject::OnInteraction(uLayingItemID); | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3443 v100 = pSpriteObjects[uLayingItemID].field_61; |
2101 | 3444 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
3445 v102 = 8 * uLayingItemID; | |
3446 LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); | |
3447 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
3448 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
3449 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
3450 AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); | |
3451 if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) | |
3452 trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); | |
3453 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3454 v47 = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3455 else |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3456 v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3457 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; |
2101 | 3458 pAudioPlayer->PlaySound((SoundID)v125, v102, 0, -1, 0, v47, 0, 0); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3459 return 0; |
0 | 3460 } |
3461 return 1; | |
3462 } | |
3463 LABEL_247: | |
2101 | 3464 //v9 = 0; |
3465 if ( PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2) ) | |
0 | 3466 return 1; |
2101 | 3467 if ( PID_TYPE(a2) != 2 ) |
0 | 3468 { |
2101 | 3469 sub_43A97E(uLayingItemID, a2); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3470 ++pSpriteObjects[uLayingItemID].uType; |
2101 | 3471 v95 = 0; |
3472 for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) | |
0 | 3473 { |
2101 | 3474 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) |
3475 v95 = v52; | |
0 | 3476 } |
2101 | 3477 pSpriteObjects[uLayingItemID].uObjectDescID = v95; |
3478 if ( !v95 ) | |
3479 SpriteObject::OnInteraction(uLayingItemID); | |
3480 pSpriteObjects[uLayingItemID].vVelocity.z = 0; | |
3481 pSpriteObjects[uLayingItemID].vVelocity.y = 0; | |
3482 pSpriteObjects[uLayingItemID].vVelocity.x = 0; | |
3483 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; | |
3484 if ( !pSpriteObjects[uLayingItemID].uSoundID ) | |
3485 v97 = 0; | |
3486 else | |
3487 v97 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; | |
3488 v124 = 8 * uLayingItemID; | |
3489 LOBYTE(v124) = v124 | 2; | |
3490 v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; | |
3491 pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); | |
3492 return 0; | |
0 | 3493 } |
2101 | 3494 pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; |
3495 v121 = 0; | |
3496 for ( v119 = 0; v119 < (signed int)pObjectList->uNumObjects; ++v119 ) | |
0 | 3497 { |
2101 | 3498 if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v119].uObjectID ) |
3499 v121 = v119; | |
0 | 3500 } |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3501 pSpriteObjects[uLayingItemID].uObjectDescID = v121; |
0 | 3502 if ( !v121 ) |
2101 | 3503 SpriteObject::OnInteraction(uLayingItemID); |
1429
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3504 pSpriteObjects[uLayingItemID].vVelocity.z = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3505 pSpriteObjects[uLayingItemID].vVelocity.y = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3506 pSpriteObjects[uLayingItemID].vVelocity.x = 0; |
c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
Ritor1
parents:
1417
diff
changeset
|
3507 pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; |
2101 | 3508 v13 = 8 * uLayingItemID; |
3509 LOBYTE(v13) = PID(OBJECT_Item,uLayingItemID); | |
3510 pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); | |
0 | 3511 return 0; |
3512 } |