Mercurial > mm7
changeset 2221:c69013c186c7
for video
author | Ritor1 |
---|---|
date | Tue, 18 Feb 2014 16:18:20 +0600 |
parents | 7dccb5752b66 |
children | 66bd74aa9f5e |
files | Mouse.cpp Render.cpp VideoPlayer.cpp VideoPlayer.h |
diffstat | 4 files changed, 45 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/Mouse.cpp Mon Feb 17 19:41:49 2014 +0600 +++ b/Mouse.cpp Tue Feb 18 16:18:20 2014 +0600 @@ -99,7 +99,7 @@ if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) ) { - unsigned __int8 * v6 = pIcons_LOD->pTextures[this->uCursorTextureID].pLevelOfDetail0_prolly_alpha_mask; + unsigned __int8 *v6 = pIcons_LOD->pTextures[this->uCursorTextureID].pLevelOfDetail0_prolly_alpha_mask; void *surface = Dst.lpSurface; __int32 v12 = 2 * (Dst.lPitch / 2 - texture.uTextureWidth);
--- a/Render.cpp Mon Feb 17 19:41:49 2014 +0600 +++ b/Render.cpp Tue Feb 18 16:18:20 2014 +0600 @@ -2175,16 +2175,16 @@ lineB = (char *)lineRGB + 2 * pitch; for ( uint x = 0; x < this->GetRenderWidth(); x++ ) { - int p = *line_picture_data; //0x2818 - int for_rad = (pRenderer->uTargetGBits + pRenderer->uTargetBBits );//16 = 8 + 8 - int value = (pRenderer->uTargetRMask & *line_picture_data);//0 = 0xFF0000 & 0x2818 - int result = (pRenderer->uTargetRMask & *line_picture_data) >> (pRenderer->uTargetGBits + pRenderer->uTargetBBits ); + //int p = *line_picture_data; //0x2818 + //int for_rad = (pRenderer->uTargetGBits + pRenderer->uTargetBBits );//16 = 8 + 8 + //int value = (pRenderer->uTargetRMask & *line_picture_data);//0 = 0xFF0000 & 0x2818 + //int result = (pRenderer->uTargetRMask & *line_picture_data) >> (pRenderer->uTargetGBits + pRenderer->uTargetBBits ); lineRGB[x] = (pRenderer->uTargetRMask & *line_picture_data) >> (pRenderer->uTargetGBits + pRenderer->uTargetBBits );// + pRenderer->uTargetRBits - 8); lineG[x] = (pRenderer->uTargetGMask & *line_picture_data) >> (pRenderer->uTargetBBits);// + pRenderer->uTargetGBits - 8); - int value2 = (pRenderer->uTargetGMask & *line_picture_data); //10240 = 0xFF00 & 0x2818 - int result2 = (pRenderer->uTargetGMask & *line_picture_data) >> (pRenderer->uTargetBBits); + //int value2 = (pRenderer->uTargetGMask & *line_picture_data); //10240 = 0xFF00 & 0x2818 + //int result2 = (pRenderer->uTargetGMask & *line_picture_data) >> (pRenderer->uTargetBBits); lineB[x] = (pRenderer->uTargetBMask & *line_picture_data);// << (8 - pRenderer->uTargetBBits); - int value3 = (pRenderer->uTargetBMask & *line_picture_data);//24 = 0xFF & 0x2818 + //int value3 = (pRenderer->uTargetBMask & *line_picture_data);//24 = 0xFF & 0x2818 line_picture_data += 2; } }
--- a/VideoPlayer.cpp Mon Feb 17 19:41:49 2014 +0600 +++ b/VideoPlayer.cpp Tue Feb 18 16:18:20 2014 +0600 @@ -879,8 +879,8 @@ if (pMovie->Stopped())//видео завершено/перезагрузка { - int width = pMovie->GetWidth(); - int height = pMovie->GetHeight(); + int width = game_viewport_width;//pMovie->GetWidth(); + int height = game_viewport_height;//pMovie->GetHeight(); delete pMovie; SetFilePointer(hVidFile, uOffset, nullptr, FILE_BEGIN); @@ -890,11 +890,29 @@ else { - auto image = pPlayer->DoFrame(); + char *image = pPlayer->DoFrame(); if (image) { - memcpy(pRenderer->pTargetSurface, image, 480 * 480 * 4);//запись кадра на экран + int num_r_bits = 5; + int num_g_bits = 6; + int num_b_bits = 5; + + int r_mask = 0xF800; + int g_mask = 0x7E0; + int b_mask = 0x1F; + //memcpy(pRenderer->pTargetSurface, image, 480 * 480 * 4);//запись кадра на экран + for (unsigned int y = 8; y < 8 + game_viewport_height; ++y) + { + for (unsigned int x = 8; x < 8 + game_viewport_width; ++x) + { + pRenderer->WritePixel16(x, y, image[((x - 8) + ((y - 8)*game_viewport_width))*4]);//4 - это шаг + //auto p = (unsigned __int32 *)pRenderer->pTargetSurface + x + y * pRenderer->uTargetSurfacePitch; + //*p = ((0xFF0000 & image[((x - 8) + ((y - 8)*game_viewport_width))*4]) >> (8 + 8)) + // + ((0xFF00 & image[(((x - 8) + ((y - 8)*game_viewport_width))*4]) >> 8) + // + (0xFF & image[((x - 8) + ((y - 8)*game_viewport_width))*4]); + } + } delete[] image; } }
--- a/VideoPlayer.h Mon Feb 17 19:41:49 2014 +0600 +++ b/VideoPlayer.h Tue Feb 18 16:18:20 2014 +0600 @@ -586,6 +586,11 @@ video_stream_idx = OpenStream(AVMEDIA_TYPE_VIDEO, &video_stream, &video_stream_dec, &video_stream_dec_ctx); if (video_stream_idx < 0) return Release(), false; + if (_stricmp("binkvideo", video_stream_dec->name) )//Ritor1: include + { + this->width = video_stream_dec_ctx->width; + this->height = video_stream_dec_ctx->height; + } audio_stream_idx = OpenStream(AVMEDIA_TYPE_AUDIO, &audio_stream, &audio_stream_dec, &audio_stream_dec_ctx); if (audio_stream_idx < 0) @@ -745,8 +750,16 @@ { if (movie->LoadFromLOD(h, readFunction, seekFunction, width, height)) { - current_movie_width = width; - current_movie_height = height; + if (_stricmp("binkvideo", movie->video_stream_dec->name) ) + { + current_movie_width = movie->video_stream_dec_ctx->width; + current_movie_height = movie->video_stream_dec_ctx->height; + } + else + { + current_movie_width = width; + current_movie_height = height; + } return current_movie = movie; } delete movie;