Mercurial > mm7
annotate Game/GameOver.cpp @ 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
author | a.parshin |
---|---|
date | Wed, 09 Mar 2016 01:39:52 +0200 |
parents | d87bfbd3bb3b |
children |
rev | line source |
---|---|
2543 | 1 #include "Engine/Engine.h" |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
2 #include "Engine/AssetsManager.h" |
2543 | 3 #include "Engine/Timer.h" |
4 #include "Engine/texts.h" | |
5 #include "Engine/Party.h" | |
6 #include "Engine/LOD.h" | |
7 #include "Engine/SaveLoad.h" | |
8 #include "Engine/Graphics/IRender.h" | |
9 #include "Engine/Graphics/Viewport.h" | |
10 | |
11 #include "IO/Mouse.h" | |
12 #include "IO/Keyboard.h" | |
13 | |
14 #include "Media/Audio/AudioPlayer.h" | |
15 | |
16 #include "GUI/GUIWindow.h" | |
17 #include "GUI/GUIButton.h" | |
18 #include "GUI/GUIFont.h" | |
19 #include "GUI/UI/UIPartyCreation.h" | |
20 | |
21 | |
22 //----- (004BF91E) -------------------------------------------------------- | |
23 void GameOver_Loop(int v15) | |
24 { | |
25 const char *v1; // eax@2 | |
26 unsigned int result; // eax@3 | |
27 const char *v6; // eax@10 | |
28 const char *v7; // edx@10 | |
29 const char *v8; // ecx@12 | |
30 const char *v9; // eax@14 | |
31 unsigned int v10; // eax@25 | |
32 GUIWindow pWindow; // [sp+34h] [bp-9Ch]@1 | |
33 unsigned int v14; // [sp+A4h] [bp-2Ch]@5 | |
34 const char *pInString; // [sp+ACh] [bp-24h]@5 | |
35 unsigned int v17; // [sp+B0h] [bp-20h]@5 | |
36 unsigned int v18; // [sp+B4h] [bp-1Ch]@5 | |
37 unsigned int v19; // [sp+B8h] [bp-18h]@5 | |
38 int v20; // [sp+BCh] [bp-14h]@7 | |
39 GUIFont *pFont; // [sp+C4h] [bp-Ch]@1 | |
40 unsigned __int64 v23; // [sp+C8h] [bp-8h]@5 | |
41 MSG msg; | |
42 | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
43 //RGBTexture _this; // [sp+Ch] [bp-C4h]@1 |
2543 | 44 //RGBTexture::RGBTexture(&this); |
45 | |
46 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_4000; | |
47 bGameoverLoop = true; | |
48 pMediaPlayer->bStopBeforeSchedule = 0; | |
49 pAudioPlayer->StopChannels(-1, -1); | |
50 pRenderer->BeginScene(); | |
51 pRenderer->ClearBlack(); | |
52 pRenderer->EndScene(); | |
53 pRenderer->Present(); | |
54 //pMediaPlayer->pResetflag = 0; | |
55 _449B57_test_bit(pParty->_quest_bits, 99); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
56 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
57 |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
58 Image *background = assets->GetImage_PCXFromIconsLOD(L"winbg.pcx"); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
59 { |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
60 pRenderer->BeginScene(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
61 pRenderer->DrawTextureNew(0, 0, background); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
62 pRenderer->EndScene(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
63 } |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
64 background->Release(); |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
65 background = nullptr; |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2544
diff
changeset
|
66 |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2543
diff
changeset
|
67 window_SpeakInHouse = new GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); |
2543 | 68 pWindow.uFrameX = 75; |
69 pWindow.uFrameY = 60; | |
70 pWindow.uFrameWidth = 469; | |
71 pWindow.uFrameHeight = 338; | |
72 pWindow.uFrameZ = 543; | |
73 pWindow.uFrameW = 397; | |
74 pFont = LoadFont("endgame.fnt", "FONTPAL", NULL); | |
75 if (pParty->IsPartyGood()) | |
76 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." | |
77 else if (pParty->IsPartyEvil()) | |
78 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." | |
79 else return; | |
80 pInString = v1; | |
81 v23 = pParty->uTimePlayed - 138240; | |
82 v19 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24; | |
83 v14 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C / 0xC; | |
84 v18 = (unsigned int)((signed __int64)((double)(pParty->uTimePlayed - 138240) * 0.234375) / 60 / 60) / 24 / 0x1C % 0xC; | |
85 v17 = v19 % 0x1C; | |
86 if (!v19) | |
87 v19 = 1; | |
88 pRenderer->BeginScene(); | |
89 pWindow.DrawTitleText(pFont, 1, 0x23, 1, pGlobalTXT_LocalizationStrings[9], 3);//Congratulations! | |
90 v23 = 0i64; | |
91 v20 = 0; | |
92 for (uint i = 0; i < 4; i++) | |
93 { | |
94 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[129], pParty->pPlayers[i].pName, pParty->pPlayers[i].GetBaseLevel(), pClassNames[pParty->pPlayers[i].classType]);//%s the Level %u %s | |
95 pWindow.DrawTitleText(pFont, 1, i * (LOBYTE(pFont->uFontHeight) - 2) + LOBYTE(pFont->uFontHeight) + 46, 1, pTmpBuf.data(), 3); | |
96 v23 += pParty->pPlayers[i].uExperience;//__PAIR__(*(int *)(i - 4), *(int *)(i - 8)); | |
97 } | |
98 v23 = (signed __int64)v23 / v19; | |
99 v6 = FitTextInAWindow(pInString, pFont, &pWindow, 0xC, 0); | |
100 pWindow.DrawTitleText(pFont, 1, 5 * (LOBYTE(pFont->uFontHeight) + 11), 1, v6, 0); | |
101 strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[37]);//Total Time: | |
102 | |
103 v7 = pGlobalTXT_LocalizationStrings[56]; | |
104 if (v17 != 1) | |
105 v7 = pGlobalTXT_LocalizationStrings[57]; | |
106 | |
107 v8 = pGlobalTXT_LocalizationStrings[146];//Month | |
108 if (v18 != 1) | |
109 v8 = pGlobalTXT_LocalizationStrings[148];//Months | |
110 | |
111 v9 = pGlobalTXT_LocalizationStrings[245]; | |
112 if (v14 != 1) | |
113 v9 = pGlobalTXT_LocalizationStrings[132]; | |
114 | |
115 sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7); | |
116 strcat(pTmpBuf.data(), pTmpBuf2.data()); | |
117 pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1, pTmpBuf.data(), 3); | |
118 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23); | |
119 pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1, pTmpBuf.data(), 3); | |
120 dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000; | |
121 pRenderer->EndScene(); | |
122 pRenderer->Present(); | |
123 //if ( pRenderer->pRenderD3D ) | |
124 pRenderer->pBeforePresentFunction(); | |
125 pRenderer->SaveWinnersCertificate("MM7_Win.Pcx"); | |
126 free(pFont); | |
127 window_SpeakInHouse->Release(); | |
128 window_SpeakInHouse = 0; | |
129 if (v15 == 2) | |
130 result = pMessageQueue_50CBD0->uNumMessages; | |
131 else | |
132 { | |
133 LODWORD(v23) = GetTickCount() + 5000; | |
134 while ((unsigned int)v23 > GetTickCount()) | |
135 ; | |
136 while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) | |
137 { | |
138 if (msg.message == WM_QUIT) | |
139 Engine_DeinitializeAndTerminate(0); | |
140 TranslateMessage(&msg); | |
141 DispatchMessage(&msg); | |
142 } | |
143 if (pMessageQueue_50CBD0->uNumMessages) | |
144 { | |
145 LOBYTE(v10) = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
146 pMessageQueue_50CBD0->uNumMessages = v10; | |
147 } | |
148 pKeyActionMap->ResetKeys(); | |
149 pKeyActionMap->uLastKeyPressed = 0; | |
150 do | |
151 { | |
152 while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) | |
153 { | |
154 if (msg.message == WM_QUIT) | |
155 Engine_DeinitializeAndTerminate(0); | |
156 TranslateMessage(&msg); | |
157 DispatchMessage(&msg); | |
158 } | |
159 } while (!pKeyActionMap->uLastKeyPressed); | |
160 if (pMessageQueue_50CBD0->uNumMessages) | |
161 { | |
162 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
163 } | |
164 } | |
165 if (v15) | |
166 { | |
167 /*if ( (signed int)result < 40 ) | |
168 { | |
169 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit; | |
170 }*/ | |
171 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Quit, 1, 0); | |
172 } | |
173 else | |
174 { | |
175 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ShowFinalWindow, 1, 0); | |
176 /*if ( (signed int)result < 40 ) | |
177 { | |
178 pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5; | |
179 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; | |
180 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; | |
181 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; | |
182 ++pMessageQueue_50CBD0->uNumMessages; | |
183 }*/ | |
184 } | |
185 bGameoverLoop = false; | |
186 } |