Cleanup movie_effect.h

See #42
This commit is contained in:
Alexander Batalov 2022-06-18 18:00:37 +03:00
parent 7b0c92843c
commit 94f7ee280e
2 changed files with 31 additions and 36 deletions

View File

@ -11,17 +11,41 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
typedef enum MovieEffectType {
MOVIE_EFFECT_TYPE_NONE = 0,
MOVIE_EFFECT_TYPE_FADE_IN = 1,
MOVIE_EFFECT_TYPE_FADE_OUT = 2,
} MovieEffectFadeType;
typedef struct MovieEffect {
int startFrame;
int endFrame;
int steps;
unsigned char fadeType;
// range 0-63
unsigned char r;
// range 0-63
unsigned char g;
// range 0-63
unsigned char b;
struct MovieEffect* next;
} MovieEffect;
static void _moviefx_callback_func(int frame);
static void _moviefx_palette_func(unsigned char* palette, int start, int end);
static void movieEffectsClear();
// 0x5195F0 // 0x5195F0
bool gMovieEffectsInitialized = false; static bool gMovieEffectsInitialized = false;
// 0x5195F4 // 0x5195F4
MovieEffect* gMovieEffectHead = NULL; static MovieEffect* gMovieEffectHead = NULL;
// 0x638EC4 // 0x638EC4
unsigned char _source_palette[768]; static unsigned char _source_palette[768];
// 0x6391C4 // 0x6391C4
bool _inside_fade; static bool _inside_fade;
// 0x487CC0 // 0x487CC0
int movieEffectsInit() int movieEffectsInit()
@ -215,7 +239,7 @@ void _moviefx_stop()
} }
// 0x488144 // 0x488144
void _moviefx_callback_func(int frame) static void _moviefx_callback_func(int frame)
{ {
MovieEffect* movieEffect = gMovieEffectHead; MovieEffect* movieEffect = gMovieEffectHead;
while (movieEffect != NULL) { while (movieEffect != NULL) {
@ -250,7 +274,7 @@ void _moviefx_callback_func(int frame)
} }
// 0x4882AC // 0x4882AC
void _moviefx_palette_func(unsigned char* palette, int start, int end) static void _moviefx_palette_func(unsigned char* palette, int start, int end)
{ {
memcpy(_source_palette + 3 * start, palette, 3 * (end - start + 1)); memcpy(_source_palette + 3 * start, palette, 3 * (end - start + 1));
@ -260,7 +284,7 @@ void _moviefx_palette_func(unsigned char* palette, int start, int end)
} }
// 0x488310 // 0x488310
void movieEffectsClear() static void movieEffectsClear()
{ {
MovieEffect* movieEffect = gMovieEffectHead; MovieEffect* movieEffect = gMovieEffectHead;
while (movieEffect != NULL) { while (movieEffect != NULL) {

View File

@ -1,39 +1,10 @@
#ifndef MOVIE_EFFECT_H #ifndef MOVIE_EFFECT_H
#define MOVIE_EFFECT_H #define MOVIE_EFFECT_H
typedef enum MovieEffectType {
MOVIE_EFFECT_TYPE_NONE = 0,
MOVIE_EFFECT_TYPE_FADE_IN = 1,
MOVIE_EFFECT_TYPE_FADE_OUT = 2,
} MovieEffectFadeType;
typedef struct MovieEffect {
int startFrame;
int endFrame;
int steps;
unsigned char fadeType;
// range 0-63
unsigned char r;
// range 0-63
unsigned char g;
// range 0-63
unsigned char b;
struct MovieEffect* next;
} MovieEffect;
extern bool gMovieEffectsInitialized;
extern MovieEffect* gMovieEffectHead;
extern unsigned char _source_palette[768];
extern bool _inside_fade;
int movieEffectsInit(); int movieEffectsInit();
void movieEffectsReset(); void movieEffectsReset();
void movieEffectsExit(); void movieEffectsExit();
int movieEffectsLoad(const char* fileName); int movieEffectsLoad(const char* fileName);
void _moviefx_stop(); void _moviefx_stop();
void _moviefx_callback_func(int frame);
void _moviefx_palette_func(unsigned char* palette, int start, int end);
void movieEffectsClear();
#endif /* MOVIE_EFFECT_H */ #endif /* MOVIE_EFFECT_H */