Remove indirection for movie palette processing

It existed to support the freestanding mve player, which has not been
maintained in years.  Even there, the support can be retained by
aligning the name of the function among the source files.  mve_main.c
would need to be converted to C++ to enable full support.
This commit is contained in:
Kp 2021-01-17 22:23:23 +00:00
parent 7b99654379
commit 6ffc86ef5f
6 changed files with 6 additions and 20 deletions

View file

@ -100,7 +100,7 @@ static void showFrame(unsigned char *buf, int dstx, int dsty, int bufw, int bufh
SDL_FreeSurface(sprite);
}
static void setPalette(unsigned char *p, unsigned start, unsigned count)
void MovieSetPalette(const unsigned char *p, unsigned start, unsigned count)
{
//Set color 0 to be black
g_palette[0] = g_palette[1] = g_palette[2] = 0;
@ -165,7 +165,6 @@ static int doPlay(const char *filename)
MVE_memCallbacks(malloc, free);
MVE_ioCallbacks(fileRead);
MVE_sfCallbacks(showFrame);
MVE_palCallbacks(setPalette);
MVE_rmPrepMovie(mve, -1, -1, 1);

View file

@ -24,7 +24,6 @@ mve_cb_Read mve_read;
mve_cb_Alloc mve_alloc;
mve_cb_Free mve_free;
mve_cb_ShowFrame mve_showframe;
mve_cb_SetPalette mve_setpalette;
/*
* private utility functions

View file

@ -22,7 +22,6 @@ extern mve_cb_Read mve_read;
extern mve_cb_Alloc mve_alloc;
extern mve_cb_Free mve_free;
extern mve_cb_ShowFrame mve_showframe;
extern mve_cb_SetPalette mve_setpalette;
/*
* structure for maintaining info on a MVEFILE stream

View file

@ -613,7 +613,7 @@ static int video_palette_handler(unsigned char, unsigned char, const unsigned ch
count = get_short(data+2);
auto p = data + 4;
mve_setpalette(p - 3*start, start, count);
MovieSetPalette(p - 3*start, start, count);
return 1;
}
@ -674,11 +674,6 @@ void MVE_sfCallbacks(mve_cb_ShowFrame showframe)
mve_showframe = showframe;
}
void MVE_palCallbacks(mve_cb_SetPalette setpalette)
{
mve_setpalette = setpalette;
}
int MVE_rmPrepMovie(MVESTREAM_ptr_t &pMovie, void *src, int x, int y, int)
{
if (pMovie) {

View file

@ -45,13 +45,10 @@ typedef void (*mve_cb_Free)(void *ptr);
typedef void (*mve_cb_ShowFrame)(unsigned char *buffer, int dstx, int dsty, int bufw, int bufh, int sw, int sh);
typedef void (*mve_cb_SetPalette)(const unsigned char *p,
unsigned int start, unsigned int count);
void MVE_ioCallbacks(mve_cb_Read io_read);
void MVE_memCallbacks(mve_cb_Alloc mem_alloc, mve_cb_Free mem_free);
void MVE_sfCallbacks(mve_cb_ShowFrame showframe);
void MVE_palCallbacks(mve_cb_SetPalette setpalette);
void MovieSetPalette(const unsigned char *p, unsigned start, unsigned count);
#endif

View file

@ -174,8 +174,6 @@ int PlayMovie(const char *subtitles, const char *filename, int must_have)
return ret;
}
namespace {
static void MovieShowFrame(ubyte *buf, int dstx, int dsty, int bufw, int bufh, int sw, int sh)
{
grs_bitmap source_bm;
@ -231,7 +229,7 @@ static void MovieShowFrame(ubyte *buf, int dstx, int dsty, int bufw, int bufh, i
}
//our routine to set the pallete, called from the movie code
static void MovieSetPalette(const unsigned char *p, unsigned start, unsigned count)
void MovieSetPalette(const unsigned char *p, unsigned start, unsigned count)
{
if (count == 0)
return;
@ -249,6 +247,8 @@ static void MovieSetPalette(const unsigned char *p, unsigned start, unsigned cou
memcpy(&gr_palette[start],p+start*3,count*3);
}
namespace {
struct movie : window
{
using window::window;
@ -402,7 +402,6 @@ int RunMovie(const char *const filename, const char *const subtitles, const int
gr_set_mode(hires_flag ? screen_mode{640, 480} : screen_mode{320, 200});
#endif
MVE_sfCallbacks(MovieShowFrame);
MVE_palCallbacks(MovieSetPalette);
if (MVE_rmPrepMovie(wind->pMovie, filehndl.get(), dx, dy, track)) {
Int3();
@ -413,7 +412,6 @@ int RunMovie(const char *const filename, const char *const subtitles, const int
}
MVE_sfCallbacks(MovieShowFrame);
MVE_palCallbacks(MovieSetPalette);
do {
event_process();
@ -482,7 +480,6 @@ int InitRobotMovie(const char *filename, MVESTREAM_ptr_t &pMovie)
MVE_memCallbacks(MPlayAlloc, MPlayFree);
MVE_ioCallbacks(FileRead);
MVE_sfCallbacks(MovieShowFrame);
MVE_palCallbacks(MovieSetPalette);
MVE_sndInit(-1); //tell movies to play no sound for robots
RoboFile = PHYSFSRWOPS_openRead(filename);