Mercurial > mm7
comparison UI/UIMainMenu.cpp @ 1698:8cfb2e978445
Merge
author | Ritor1 |
---|---|
date | Sun, 22 Sep 2013 16:45:46 +0600 |
parents | 6faacde46271 |
children | 03d9336e862f |
comparison
equal
deleted
inserted
replaced
1697:eccd4278fc2f | 1698:8cfb2e978445 |
---|---|
192 } | 192 } |
193 | 193 |
194 //----- (004979D2) -------------------------------------------------------- | 194 //----- (004979D2) -------------------------------------------------------- |
195 MENU_STATE MainMenuUI_Credits_Loop() | 195 MENU_STATE MainMenuUI_Credits_Loop() |
196 { | 196 { |
197 char *v1; // edi@5 | 197 char *cred_texturet; // edi@5 |
198 FILE *pFile; // eax@5 | 198 FILE *pFile; // eax@5 |
199 unsigned int pSize; // esi@7 | 199 unsigned int pSize; // esi@7 |
200 __int16 pHeight; // ax@9 | |
201 void *v7; // eax@9 | |
202 unsigned int pNumPixels; // ST2C_4@9 | |
203 unsigned int v10; // ST2C_4@19 | |
204 MSG Msg; // [sp+84h] [bp-B8h]@10 | 200 MSG Msg; // [sp+84h] [bp-B8h]@10 |
205 int v17; // [sp+A0h] [bp-9Ch]@9 | |
206 GUIWindow credit_window; | 201 GUIWindow credit_window; |
207 int a5; // [sp+128h] [bp-14h]@1 | 202 int move_Y; // [sp+128h] [bp-14h]@1 |
208 char *pString; // [sp+12Ch] [bp-10h]@9 | 203 char *pString; // [sp+12Ch] [bp-10h]@9 |
209 char *ptr; // [sp+130h] [bp-Ch]@5 | |
210 GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1 | 204 GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1 |
211 GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1 | 205 GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1 |
212 RGBTexture pTexture; // [sp+54h] [bp-E8h]@1 | 206 RGBTexture mm6title_texture; // [sp+54h] [bp-E8h]@1 |
213 RGBTexture pTexture2; // [sp+100h] [bp-3Ch]@1 | 207 RGBTexture cred_texture; // [sp+100h] [bp-3Ch]@1 |
214 Texture pTexture3; // [sp+Ch] [bp-130h]@5 | 208 Texture pTemporaryTexture; // [sp+Ch] [bp-130h]@5 |
215 | 209 |
216 a5 = 0; | |
217 pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL); | 210 pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL); |
218 pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); | 211 pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); |
212 | |
219 if ( pMessageQueue_50CBD0->uNumMessages ) | 213 if ( pMessageQueue_50CBD0->uNumMessages ) |
220 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | 214 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
221 ++pIcons_LOD->uTexturePacksCount; | 215 ++pIcons_LOD->uTexturePacksCount; |
222 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | 216 if ( !pIcons_LOD->uNumPrevLoadedFiles ) |
223 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | 217 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; |
224 dword_A74C88 = 0; | 218 //dword_A74C88 = 0;//??? часть дальнейшего кода отсутствует, там использовалась данная переменная |
219 | |
225 pAudioPlayer->PlayMusicTrack(MUSIC_Credits); | 220 pAudioPlayer->PlayMusicTrack(MUSIC_Credits); |
226 pTexture.Load("mm6title.pcx", 0); | 221 |
227 ptr = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); | 222 mm6title_texture.Load("mm6title.pcx", 0); |
228 v1 = ptr; | 223 cred_texturet = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); |
229 pFile = pEvents_LOD->FindContainer("credits.txt", 0); | 224 pFile = pEvents_LOD->FindContainer("credits.txt", 0); |
230 if ( !pFile ) | 225 if ( !pFile ) |
231 Error(pGlobalTXT_LocalizationStrings[63]); // "Might and Magic VII is having trouble loading files. | 226 Error(pGlobalTXT_LocalizationStrings[63]); // "Might and Magic VII is having trouble loading files. |
232 | 227 |
233 // Please re-install to fix this problem. Note: Re-installing will not destroy your save games." | 228 // Please re-install to fix this problem. Note: Re-installing will not destroy your save games." |
234 fread(&pTexture3, 1, 0x30, pFile); | 229 |
235 pSize = pTexture3.uDecompressedSize; | 230 //для получения размера----------------------- |
236 if ( !pTexture3.uDecompressedSize ) | 231 fread(&pTemporaryTexture, 1, 0x30, pFile); |
237 pSize = pTexture3.uTextureSize; | 232 pSize = pTemporaryTexture.uDecompressedSize; |
238 memset(&pTexture3, 0, 0x48); | 233 if ( !pSize ) |
239 v1[pSize] = 0; | 234 pSize = pTemporaryTexture.uTextureSize; |
235 memset(&pTemporaryTexture, 0, 0x48);//обнуление | |
236 cred_texturet[pSize] = 0;//конец текста | |
240 | 237 |
241 credit_window.uFrameWidth = 250; | 238 credit_window.uFrameWidth = 250; |
242 credit_window.uFrameHeight = 440; | 239 credit_window.uFrameHeight = 440; |
243 credit_window.uFrameX = 389; | 240 credit_window.uFrameX = 389; |
244 credit_window.uFrameY = 19; | 241 credit_window.uFrameY = 19; |
245 | 242 |
246 pTexture2.uWidth = 250; | 243 cred_texture.uWidth = 250; |
247 pHeight = pFontQuick->GetStringHeight2(pFontCChar, v1, &credit_window, 0, 1); | 244 cred_texture.uHeight = pFontQuick->GetStringHeight2(pFontCChar, cred_texturet, &credit_window, 0, 1) + 2 * credit_window.uFrameHeight; |
248 pTexture2.uHeight = pHeight + 2 * credit_window.uFrameHeight; | 245 cred_texture.uNumPixels = cred_texture.uWidth * cred_texture.uHeight; |
249 pTexture2.uNumPixels = (signed __int16)pTexture2.uWidth * (signed __int16)pTexture2.uHeight; | 246 cred_texture.pPixels = (unsigned __int16 *)malloc(2 * cred_texture.uNumPixels); |
250 v7 = malloc(2 * pTexture2.uNumPixels);//, "scrollermap"); | 247 fill_pixels_fast(TargetColor(0, 0xFFu, 0xFFu), cred_texture.pPixels, cred_texture.uNumPixels); |
251 pNumPixels = pTexture2.uNumPixels; | 248 cred_texture._allocation_flags = 0; |
252 pTexture2.pPixels = (unsigned __int16 *)v7; | 249 |
253 fill_pixels_fast(TargetColor(0, 0xFFu, 0xFFu), pTexture2.pPixels, pNumPixels); | 250 //дать шрифт и цвета тексту |
254 pTexture2._allocation_flags = 0; | |
255 pString = (char *)malloc(2 * pSize); | 251 pString = (char *)malloc(2 * pSize); |
256 strncpy(pString, ptr, pSize); | 252 strncpy(pString, cred_texturet, pSize); |
257 pString[pSize]=0; | 253 pString[pSize] = 0; |
258 pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, credit_window.uFrameHeight, (signed __int16)pTexture2.uWidth, | 254 pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, credit_window.uFrameHeight, cred_texture.uWidth, |
259 (signed __int16)pTexture2.uHeight, TargetColor(0x70u, 0x8Fu, 0xFEu), TargetColor(0xECu, 0xE6u, 0x9Cu), pString, pTexture2.pPixels, | 255 cred_texture.uHeight, TargetColor(0x70u, 0x8Fu, 0xFEu), TargetColor(0xECu, 0xE6u, 0x9Cu), pString, cred_texture.pPixels, cred_texture.uWidth); |
260 (signed __int16)pTexture2.uWidth); | |
261 free(pString); | 256 free(pString); |
262 pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, ptr); | 257 |
263 pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 0x1Bu, "", 0); | 258 pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, cred_texturet); |
259 pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 27, "", 0); | |
264 pCurrentScreen = SCREEN_CREATORS; | 260 pCurrentScreen = SCREEN_CREATORS; |
265 SetCurrentMenuID(MENU_CREDITSPROC); | 261 SetCurrentMenuID(MENU_CREDITSPROC); |
262 | |
263 move_Y = 0; | |
266 do | 264 do |
267 { | 265 { |
268 while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) | 266 while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) |
269 { | 267 { |
270 if ( Msg.message == 18 ) | 268 if ( Msg.message == 18 ) |
277 WaitMessage(); | 275 WaitMessage(); |
278 } | 276 } |
279 else | 277 else |
280 { | 278 { |
281 pRenderer->BeginScene(); | 279 pRenderer->BeginScene(); |
282 pRenderer->DrawTextureRGB(0, 0, &pTexture); | 280 pRenderer->DrawTextureRGB(0, 0, &mm6title_texture); |
283 pRenderer->SetTextureClipRect(credit_window.uFrameX, credit_window.uFrameY, credit_window.uFrameX + credit_window.uFrameWidth, | 281 pRenderer->SetTextureClipRect(credit_window.uFrameX, credit_window.uFrameY, credit_window.uFrameX + credit_window.uFrameWidth, |
284 credit_window.uFrameY + credit_window.uFrameHeight); | 282 credit_window.uFrameY + credit_window.uFrameHeight); |
285 pRenderer->_4A5D33(credit_window.uFrameX, credit_window.uFrameY, 0, a5, &pTexture2); | 283 pRenderer->CreditsTextureScroll(credit_window.uFrameX, credit_window.uFrameY, 0, move_Y, &cred_texture); |
286 pRenderer->ResetTextureClipRect(); | 284 pRenderer->ResetTextureClipRect(); |
287 pRenderer->EndScene(); | 285 pRenderer->EndScene(); |
288 ++a5; | 286 ++move_Y; |
289 if ( a5 >= (signed __int16)pTexture2.uHeight ) | 287 if ( move_Y >= cred_texture.uHeight ) |
290 SetCurrentMenuID(MENU_MAIN); | 288 SetCurrentMenuID(MENU_MAIN); |
291 pRenderer->Present(); | 289 pRenderer->Present(); |
292 pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() | 290 pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() |
293 GUI_MainMenuMessageProc(); | 291 GUI_MainMenuMessageProc(); |
294 } | 292 } |
295 } | 293 } |
296 while ( GetCurrentMenuID() == MENU_CREDITSPROC ); | 294 while ( GetCurrentMenuID() == MENU_CREDITSPROC ); |
297 pAudioPlayer->_4AA258(1); | 295 pAudioPlayer->_4AA258(1); |
298 free(ptr); | 296 free(cred_texturet); |
299 free(pFontQuick); | 297 free(pFontQuick); |
300 free(pFontCChar); | 298 free(pFontCChar); |
301 pWindow_MainMenu->Release(); | 299 pWindow_MainMenu->Release(); |
302 pIcons_LOD->RemoveTexturesPackFromTextureList(); | 300 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
303 pTexture.Release(); | 301 mm6title_texture.Release(); |
304 pTexture2.Release(); | 302 cred_texture.Release(); |
305 return MENU_MAIN; // return MENU_Main | 303 return MENU_MAIN; // return MENU_Main |
306 } | 304 } |
305 /*MENU_STATE MainMenuUI_Credits_Loop()//NewTitle | |
306 { | |
307 MSG Msg; | |
308 GUIWindow credit_window; | |
309 RGBTexture mm6title_texture; | |
310 | |
311 if ( pMessageQueue_50CBD0->uNumMessages ) | |
312 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
313 ++pIcons_LOD->uTexturePacksCount; | |
314 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
315 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
316 | |
317 //pAudioPlayer->PlayMusicTrack(MUSIC_Credits); | |
318 | |
319 mm6title_texture.Load("newtitle.pcx", 0); | |
320 pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 27, "", 0); | |
321 pCurrentScreen = SCREEN_CREATORS; | |
322 SetCurrentMenuID(MENU_CREDITSPROC); | |
323 | |
324 do | |
325 { | |
326 while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) | |
327 { | |
328 if ( Msg.message == 18 ) | |
329 Game_DeinitializeAndTerminate(0); | |
330 TranslateMessage(&Msg); | |
331 DispatchMessageA(&Msg); | |
332 } | |
333 if ( BYTE1(dword_6BE364_game_settings_1) & 1 ) | |
334 { | |
335 WaitMessage(); | |
336 } | |
337 else | |
338 { | |
339 pRenderer->BeginScene(); | |
340 pRenderer->DrawTextureRGB(0, 0, &mm6title_texture); | |
341 pRenderer->EndScene(); | |
342 pRenderer->Present(); | |
343 pCurrentScreen = SCREEN_GAME; | |
344 GUI_MainMenuMessageProc(); | |
345 } | |
346 } | |
347 while ( GetCurrentMenuID() == MENU_CREDITSPROC ); | |
348 //pAudioPlayer->_4AA258(1); | |
349 mm6title_texture.Release(); | |
350 return MENU_MAIN; // return MENU_Main | |
351 }*/ |