comparison UI/UIMainMenu.cpp @ 1675:f1cdf8c062d4

MainMenuUI_Credits_Loop() and CreditsTextureScroll
author Ritor1
date Thu, 19 Sep 2013 16:45:21 +0600
parents 2a5f2aaec367
children 6faacde46271
comparison
equal deleted inserted replaced
1674:2a5f2aaec367 1675:f1cdf8c062d4
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 v10; // ST2C_4@19
203 MSG Msg; // [sp+84h] [bp-B8h]@10 200 MSG Msg; // [sp+84h] [bp-B8h]@10
204 int v17; // [sp+A0h] [bp-9Ch]@9
205 GUIWindow credit_window; 201 GUIWindow credit_window;
206 int a5; // [sp+128h] [bp-14h]@1 202 int move_Y; // [sp+128h] [bp-14h]@1
207 char *pString; // [sp+12Ch] [bp-10h]@9 203 char *pString; // [sp+12Ch] [bp-10h]@9
208 char *ptr; // [sp+130h] [bp-Ch]@5
209 GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1 204 GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1
210 GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1 205 GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1
211 RGBTexture pTexture; // [sp+54h] [bp-E8h]@1 206 RGBTexture mm6title_texture; // [sp+54h] [bp-E8h]@1
212 RGBTexture pTexture2; // [sp+100h] [bp-3Ch]@1 207 RGBTexture cred_texture; // [sp+100h] [bp-3Ch]@1
213 Texture pTexture3; // [sp+Ch] [bp-130h]@5 208 Texture pTemporaryTexture; // [sp+Ch] [bp-130h]@5
214 209
215 a5 = 0;
216 pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL); 210 pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL);
217 pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); 211 pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL);
212
218 if ( pMessageQueue_50CBD0->uNumMessages ) 213 if ( pMessageQueue_50CBD0->uNumMessages )
219 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 214 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
220 ++pIcons_LOD->uTexturePacksCount; 215 ++pIcons_LOD->uTexturePacksCount;
221 if ( !pIcons_LOD->uNumPrevLoadedFiles ) 216 if ( !pIcons_LOD->uNumPrevLoadedFiles )
222 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 217 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
223 dword_A74C88 = 0; 218 //dword_A74C88 = 0;//??? часть дальнейшего кода отсутствует, там использовалась данная переменная
219
224 pAudioPlayer->PlayMusicTrack(MUSIC_Credits); 220 pAudioPlayer->PlayMusicTrack(MUSIC_Credits);
225 pTexture.Load("mm6title.pcx", 0); 221
226 ptr = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); 222 mm6title_texture.Load("mm6title.pcx", 0);
227 v1 = ptr; 223 cred_texturet = (char *)pEvents_LOD->LoadRaw("credits.txt", 0);
228 pFile = pEvents_LOD->FindContainer("credits.txt", 0); 224 pFile = pEvents_LOD->FindContainer("credits.txt", 0);
229 if ( !pFile ) 225 if ( !pFile )
230 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.
231 227
232 // 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."
233 fread(&pTexture3, 1, 0x30, pFile); 229
234 pSize = pTexture3.uDecompressedSize; 230 //для получения размера-----------------------
235 if ( !pTexture3.uDecompressedSize ) 231 fread(&pTemporaryTexture, 1, 0x30, pFile);
236 pSize = pTexture3.uTextureSize; 232 pSize = pTemporaryTexture.uDecompressedSize;
237 memset(&pTexture3, 0, 0x48); 233 if ( !pSize )
238 v1[pSize] = 0; 234 pSize = pTemporaryTexture.uTextureSize;
235 memset(&pTemporaryTexture, 0, 0x48);//обнуление
236 cred_texturet[pSize] = 0;//конец текста
239 237
240 credit_window.uFrameWidth = 250; 238 credit_window.uFrameWidth = 250;
241 credit_window.uFrameHeight = 440; 239 credit_window.uFrameHeight = 440;
242 credit_window.uFrameX = 389; 240 credit_window.uFrameX = 389;
243 credit_window.uFrameY = 19; 241 credit_window.uFrameY = 19;
244 242
245 pTexture2.uWidth = 250; 243 cred_texture.uWidth = 250;
246 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;
247 pTexture2.uHeight = pHeight + 2 * credit_window.uFrameHeight; 245 cred_texture.uNumPixels = cred_texture.uWidth * cred_texture.uHeight;
248 pTexture2.uNumPixels = (signed __int16)pTexture2.uWidth * (signed __int16)pTexture2.uHeight; 246 cred_texture.pPixels = (unsigned __int16 *)malloc(2 * cred_texture.uNumPixels);
249 v7 = malloc(2 * pTexture2.uNumPixels);//, "scrollermap"); 247 fill_pixels_fast(TargetColor(0, 0xFFu, 0xFFu), cred_texture.pPixels, cred_texture.uNumPixels);
250 pTexture2.pPixels = (unsigned __int16 *)v7; 248 cred_texture._allocation_flags = 0;
251 fill_pixels_fast(TargetColor(0, 0xFFu, 0xFFu), pTexture2.pPixels, pTexture2.uNumPixels); 249
252 pTexture2._allocation_flags = 0; 250 //дать шрифт и цвета тексту
253 pString = (char *)malloc(2 * pSize); 251 pString = (char *)malloc(2 * pSize);
254 strncpy(pString, ptr, pSize); 252 strncpy(pString, cred_texturet, pSize);
255 pString[pSize]=0; 253 pString[pSize] = 0;
256 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,
257 (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);
258 (signed __int16)pTexture2.uWidth);
259 free(pString); 256 free(pString);
260 pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, ptr); 257
261 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);
262 pCurrentScreen = SCREEN_CREATORS; 260 pCurrentScreen = SCREEN_CREATORS;
263 SetCurrentMenuID(MENU_CREDITSPROC); 261 SetCurrentMenuID(MENU_CREDITSPROC);
262
263 move_Y = 0;
264 do 264 do
265 { 265 {
266 while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) 266 while ( PeekMessageA(&Msg, 0, 0, 0, 1) )
267 { 267 {
268 if ( Msg.message == 18 ) 268 if ( Msg.message == 18 )
275 WaitMessage(); 275 WaitMessage();
276 } 276 }
277 else 277 else
278 { 278 {
279 pRenderer->BeginScene(); 279 pRenderer->BeginScene();
280 pRenderer->DrawTextureRGB(0, 0, &pTexture); 280 pRenderer->DrawTextureRGB(0, 0, &mm6title_texture);
281 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,
282 credit_window.uFrameY + credit_window.uFrameHeight); 282 credit_window.uFrameY + credit_window.uFrameHeight);
283 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);
284 pRenderer->ResetTextureClipRect(); 284 pRenderer->ResetTextureClipRect();
285 pRenderer->EndScene(); 285 pRenderer->EndScene();
286 ++a5; 286 ++move_Y;
287 if ( a5 >= (signed __int16)pTexture2.uHeight ) 287 if ( move_Y >= cred_texture.uHeight )
288 SetCurrentMenuID(MENU_MAIN); 288 SetCurrentMenuID(MENU_MAIN);
289 pRenderer->Present(); 289 pRenderer->Present();
290 pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() 290 pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc()
291 GUI_MainMenuMessageProc(); 291 GUI_MainMenuMessageProc();
292 } 292 }
293 } 293 }
294 while ( GetCurrentMenuID() == MENU_CREDITSPROC ); 294 while ( GetCurrentMenuID() == MENU_CREDITSPROC );
295 pAudioPlayer->_4AA258(1); 295 pAudioPlayer->_4AA258(1);
296 free(ptr); 296 free(cred_texturet);
297 free(pFontQuick); 297 free(pFontQuick);
298 free(pFontCChar); 298 free(pFontCChar);
299 pWindow_MainMenu->Release(); 299 pWindow_MainMenu->Release();
300 pIcons_LOD->RemoveTexturesPackFromTextureList(); 300 pIcons_LOD->RemoveTexturesPackFromTextureList();
301 pTexture.Release(); 301 mm6title_texture.Release();
302 pTexture2.Release(); 302 cred_texture.Release();
303 return MENU_MAIN; // return MENU_Main 303 return MENU_MAIN; // return MENU_Main
304 } 304 }