00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PLAYER_H_
00021 #define __PLAYER_H_
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026
00027 #include <exception>
00028 #include <string>
00029 #include <map>
00030
00031 #include "rect.h"
00032 #include "mixer.h"
00033 #include "chunck.h"
00034 #include "palette.h"
00035 #include "codec1.h"
00036 #include "codec37.h"
00037 #include "codec44.h"
00038 #include "frenderer.h"
00039
00040 class renderer;
00041
00042 class string_resource;
00043
00048 class player {
00049 private:
00050 std::string _fname;
00051 int _version;
00052 int _secondary_version;
00053 int _sound_frequency;
00054 int _nbframes;
00055 mixer _mixer;
00056 palette _pal;
00057 short _delta_pal[768];
00058 renderer * _renderer;
00059 string_resource * _strings;
00060 font_renderer * _fr[4];
00061 codec1_decoder _codec1;
00062 codec37_decoder _codec37;
00063 codec44_decoder _codec44;
00064 point _frame_size;
00065 int _frame;
00066 bool _output_sound;
00067 bool _wait;
00068 bool _already_init;
00069 bool _codec37_called;
00070 bool _skipnext;
00071 bool _subtitles;
00072 bool _bgmusic;
00073 bool _voices;
00074 std::map<int, bool> _skips;
00075 char * _cur_buffer;
00076 public:
00077 player(renderer *, bool wait = true, bool output_sound = true) throw();
00078 virtual ~player() throw();
00079 bool play(const std::string &) throw(std::exception);
00080 void update_palette(void);
00081 void show(const std::string & p);
00082 void hide(const std::string & p);
00083 protected:
00084 bool read_string(const std::string & file) throw(std::exception);
00085 void clean() throw();
00086 void checkBlock(const chunck &, chunck::type, unsigned int = 0);
00087 void handleAnimHeader(chunck &) throw(std::exception);
00088 void handleFrame(chunck &) throw(std::exception);
00089 void handleNewPalette(chunck &) throw(std::exception);
00090 void handleFrameObject(chunck &) throw(std::exception);
00091 void handleSoundBuffer(int, int, int, int, int, int, chunck &, int) throw(std::exception);
00092 void handleImuseBuffer(int, int, int, int, int, int, chunck &, int) throw(std::exception);
00093 void handleSoundFrame(chunck &) throw(std::exception);
00094 void handleSkip(chunck &) throw(std::exception);
00095 void handleStore(chunck &) throw(std::exception);
00096 void handleFetch(chunck &) throw(std::exception);
00097 void handleImuseAction8(chunck &, int flags, int unknown, int track_id) throw(std::exception);
00098 void handleImuseAction(chunck &) throw(std::exception);
00099 void handleTextResource(chunck &) throw(std::exception);
00100 void handleDeltaPalette(chunck &) throw(std::exception);
00101 void decodeCodec(chunck &, const rect &, decoder &) throw(std::exception);
00102 void readPalette(palette &, chunck &) throw(std::exception);
00103 void init_size(const rect &, bool, bool) throw(std::exception);
00104 };
00105
00106 #endif