Browse Source

Backup and recover game pallet during movie playback

pull/31/head
Anders Jenbo 7 years ago
parent
commit
f93f9d984a
  1. 6
      SourceX/movie.cpp

6
SourceX/movie.cpp

@ -1,6 +1,7 @@
#include "../3rdParty/libsmacker/smacker.h"
#include "pch.h"
PALETTEENTRY previousPalette[256];
BYTE movie_playing;
BOOL loop_movie; // TODO
@ -64,6 +65,8 @@ void __fastcall play_movie(char *pszMovie, BOOL user_can_close)
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING, width, height);
SDL_RenderSetLogicalSize(renderer, width, height);
memcpy(previousPalette, orig_palette, 1024);
// Copy frame to buffer
SDL_Surface *videoSurface = SDL_CreateRGBSurfaceWithFormatFrom(
smk_get_video(smacker),
@ -140,6 +143,7 @@ void __fastcall play_movie(char *pszMovie, BOOL user_can_close)
if (now < frameEnd) {
usleep(frameEnd - now); // wait with next frame if the system is to fast
}
frameEnd += usPerFrame;
if (smk_next(smacker) == SMK_DONE) {
if (loop_movie)
@ -155,6 +159,8 @@ void __fastcall play_movie(char *pszMovie, BOOL user_can_close)
}
smk_close(smacker);
memcpy(orig_palette, previousPalette, 1024);
SDL_DestroyTexture(texture);
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING, SCREEN_WIDTH, SCREEN_HEIGHT);
SDL_RenderSetLogicalSize(renderer, SCREEN_WIDTH, SCREEN_HEIGHT);

Loading…
Cancel
Save