mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
- compile fixes for linux player
This commit is contained in:
@ -4394,11 +4394,7 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
|
|||||||
}
|
}
|
||||||
|
|
||||||
CCS->musich->playMusic(musicBase::winBattle);
|
CCS->musich->playMusic(musicBase::winBattle);
|
||||||
#ifdef _WIN32
|
CCS->videoh->open(VIDEO_WIN);
|
||||||
CCS->videoh->open(VIDEO_WIN);
|
|
||||||
#else
|
|
||||||
CCS->videoh->open(VIDEO_WIN, true);
|
|
||||||
#endif
|
|
||||||
std::string str = CGI->generaltexth->allTexts[text];
|
std::string str = CGI->generaltexth->allTexts[text];
|
||||||
|
|
||||||
const CGHeroInstance * ourHero = weAreAttacker? owner->attackingHeroInstance : owner->defendingHeroInstance;
|
const CGHeroInstance * ourHero = weAreAttacker? owner->attackingHeroInstance : owner->defendingHeroInstance;
|
||||||
|
@ -214,9 +214,10 @@ void CBIKHandler::show( int x, int y, SDL_Surface *dst, bool update )
|
|||||||
SDL_UpdateRect(dst, x, y, w, h);
|
SDL_UpdateRect(dst, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBIKHandler::nextFrame()
|
bool CBIKHandler::nextFrame()
|
||||||
{
|
{
|
||||||
binkNextFrame(hBink);
|
binkNextFrame(hBink);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBIKHandler::close()
|
void CBIKHandler::close()
|
||||||
@ -269,9 +270,10 @@ void CBIKHandler::freeBuffer()
|
|||||||
bufferSize = 0;
|
bufferSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSmackPlayer::nextFrame()
|
bool CSmackPlayer::nextFrame()
|
||||||
{
|
{
|
||||||
ptrSmackNextFrame(data);
|
ptrSmackNextFrame(data);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSmackPlayer::wait()
|
bool CSmackPlayer::wait()
|
||||||
@ -670,6 +672,11 @@ CVideoPlayer::CVideoPlayer()
|
|||||||
vidh.add_file(std::string(DATA_DIR "/Data/H3ab_ahd.vid"));
|
vidh.add_file(std::string(DATA_DIR "/Data/H3ab_ahd.vid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CVideoPlayer::open(std::string fname)
|
||||||
|
{
|
||||||
|
return open(fname, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
// loop = to loop through the video
|
// loop = to loop through the video
|
||||||
// useOverlay = directly write to the screen.
|
// useOverlay = directly write to the screen.
|
||||||
bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
|
bool CVideoPlayer::open(std::string fname, bool loop, bool useOverlay)
|
||||||
|
@ -1,16 +1,57 @@
|
|||||||
#ifndef __CVIDEOHANDLER_H__
|
#ifndef __CVIDEOHANDLER_H__
|
||||||
#define __CVIDEOHANDLER_H__
|
#define __CVIDEOHANDLER_H__
|
||||||
|
|
||||||
#include "../global.h"
|
#include "../global.h"
|
||||||
|
#include "CSndHandler.h"
|
||||||
|
|
||||||
struct SDL_Surface;
|
struct SDL_Surface;
|
||||||
|
|
||||||
|
|
||||||
|
class IVideoPlayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual bool open(std::string name)=0; //true - succes
|
||||||
|
virtual void close()=0;
|
||||||
|
virtual bool nextFrame()=0;
|
||||||
|
virtual void show(int x, int y, SDL_Surface *dst, bool update = true)=0;
|
||||||
|
virtual void redraw(int x, int y, SDL_Surface *dst, bool update = true)=0; //reblits buffer
|
||||||
|
virtual bool wait()=0;
|
||||||
|
virtual int curFrame() const =0;
|
||||||
|
virtual int frameCount() const =0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class IMainVideoPlayer : public IVideoPlayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::string fname; //name of current video file (empty if idle)
|
||||||
|
|
||||||
|
virtual void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true){}
|
||||||
|
virtual bool openAndPlayVideo(std::string name, int x, int y, SDL_Surface *dst, bool stopOnKey = false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class CEmptyVideoPlayer : public IMainVideoPlayer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual int curFrame() const {return -1;};
|
||||||
|
virtual int frameCount() const {return -1;};
|
||||||
|
virtual void redraw( int x, int y, SDL_Surface *dst, bool update = true ) {};
|
||||||
|
virtual void show( int x, int y, SDL_Surface *dst, bool update = true ) {};
|
||||||
|
virtual bool nextFrame() {return false;};
|
||||||
|
virtual void close() {};
|
||||||
|
virtual bool wait() {return false;};
|
||||||
|
virtual bool open( std::string name ) {return false;};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN //excludes rarely used stuff from windows headers - delete this line if something is missing
|
#define WIN32_LEAN_AND_MEAN //excludes rarely used stuff from windows headers - delete this line if something is missing
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include "CSndHandler.h"
|
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
struct BINK_STRUCT
|
struct BINK_STRUCT
|
||||||
{
|
{
|
||||||
@ -60,45 +101,6 @@ typedef void(__stdcall* BinkDoFrame)(HBINK);
|
|||||||
typedef ui8(__stdcall* BinkWait)(HBINK);
|
typedef ui8(__stdcall* BinkWait)(HBINK);
|
||||||
typedef si32(__stdcall* BinkCopyToBuffer)(HBINK, void* buffer, int stride, int height, int x, int y, int mode);
|
typedef si32(__stdcall* BinkCopyToBuffer)(HBINK, void* buffer, int stride, int height, int x, int y, int mode);
|
||||||
|
|
||||||
class IVideoPlayer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual bool open(std::string name)=0; //true - succes
|
|
||||||
virtual void close()=0;
|
|
||||||
virtual void nextFrame()=0;
|
|
||||||
virtual void show(int x, int y, SDL_Surface *dst, bool update = true)=0;
|
|
||||||
virtual void redraw(int x, int y, SDL_Surface *dst, bool update = true)=0; //reblits buffer
|
|
||||||
virtual bool wait()=0;
|
|
||||||
virtual int curFrame() const =0;
|
|
||||||
virtual int frameCount() const =0;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class IMainVideoPlayer : public IVideoPlayer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
std::string fname; //name of current video file (empty if idle)
|
|
||||||
|
|
||||||
virtual void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true){}
|
|
||||||
virtual bool openAndPlayVideo(std::string name, int x, int y, SDL_Surface *dst, bool stopOnKey = false)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class CEmptyVideoPlayer : public IMainVideoPlayer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual int curFrame() const {return -1;};
|
|
||||||
virtual int frameCount() const {return -1;};
|
|
||||||
virtual void redraw( int x, int y, SDL_Surface *dst, bool update = true ) {};
|
|
||||||
virtual void show( int x, int y, SDL_Surface *dst, bool update = true ) {};
|
|
||||||
virtual void nextFrame() {};
|
|
||||||
virtual void close() {};
|
|
||||||
virtual bool wait() {return false;};
|
|
||||||
virtual bool open( std::string name ) {return false;};
|
|
||||||
};
|
|
||||||
|
|
||||||
class CBIKHandler : public DLLHandler, public IVideoPlayer
|
class CBIKHandler : public DLLHandler, public IVideoPlayer
|
||||||
{
|
{
|
||||||
void allocBuffer(int Bpp = 0);
|
void allocBuffer(int Bpp = 0);
|
||||||
@ -120,7 +122,7 @@ public:
|
|||||||
CBIKHandler();
|
CBIKHandler();
|
||||||
bool open(std::string name);
|
bool open(std::string name);
|
||||||
void close();
|
void close();
|
||||||
void nextFrame();
|
bool nextFrame();
|
||||||
void show(int x, int y, SDL_Surface *dst, bool update = true);
|
void show(int x, int y, SDL_Surface *dst, bool update = true);
|
||||||
void redraw(int x, int y, SDL_Surface *dst, bool update = true); //reblits buffer
|
void redraw(int x, int y, SDL_Surface *dst, bool update = true); //reblits buffer
|
||||||
bool wait();
|
bool wait();
|
||||||
@ -176,7 +178,7 @@ public:
|
|||||||
~CSmackPlayer();
|
~CSmackPlayer();
|
||||||
bool open(std::string name);
|
bool open(std::string name);
|
||||||
void close();
|
void close();
|
||||||
void nextFrame();
|
bool nextFrame();
|
||||||
void show(int x, int y, SDL_Surface *dst, bool update = true);
|
void show(int x, int y, SDL_Surface *dst, bool update = true);
|
||||||
void redraw(int x, int y, SDL_Surface *dst, bool update = true); //reblits buffer
|
void redraw(int x, int y, SDL_Surface *dst, bool update = true); //reblits buffer
|
||||||
bool wait();
|
bool wait();
|
||||||
@ -204,7 +206,7 @@ public:
|
|||||||
|
|
||||||
bool open(std::string name);
|
bool open(std::string name);
|
||||||
void close();
|
void close();
|
||||||
void nextFrame(); //move animation to the next frame
|
bool nextFrame(); //move animation to the next frame
|
||||||
void show(int x, int y, SDL_Surface *dst, bool update = true); //blit current frame
|
void show(int x, int y, SDL_Surface *dst, bool update = true); //blit current frame
|
||||||
void redraw(int x, int y, SDL_Surface *dst, bool update = true); //reblits buffer
|
void redraw(int x, int y, SDL_Surface *dst, bool update = true); //reblits buffer
|
||||||
void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true); //moves to next frame if appropriate, and blits it or blits only if redraw paremeter is set true
|
void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true); //moves to next frame if appropriate, and blits it or blits only if redraw paremeter is set true
|
||||||
@ -216,6 +218,7 @@ public:
|
|||||||
bool playVideo(int x, int y, SDL_Surface *dst, bool stopOnKey = false); //plays whole opened video; returns: true when whole video has been shown, false when it has been interrupted
|
bool playVideo(int x, int y, SDL_Surface *dst, bool stopOnKey = false); //plays whole opened video; returns: true when whole video has been shown, false when it has been interrupted
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define VIDEO_TAVERN "TAVERN.BIK"
|
||||||
#define VIDEO_WIN "WIN3.BIK"
|
#define VIDEO_WIN "WIN3.BIK"
|
||||||
#define VIDEO_LOSE_BATTLE_START "LBSTART.BIK"
|
#define VIDEO_LOSE_BATTLE_START "LBSTART.BIK"
|
||||||
#define VIDEO_LOSE_BATTLE_LOOP "LBLOOP.BIK"
|
#define VIDEO_LOSE_BATTLE_LOOP "LBLOOP.BIK"
|
||||||
@ -234,7 +237,7 @@ typedef struct AVCodec AVCodec;
|
|||||||
typedef struct AVFrame AVFrame;
|
typedef struct AVFrame AVFrame;
|
||||||
struct SwsContext;
|
struct SwsContext;
|
||||||
|
|
||||||
class CVideoPlayer //: public IVideoPlayer
|
class CVideoPlayer : public IMainVideoPlayer
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int stream; // stream index in video
|
int stream; // stream index in video
|
||||||
@ -256,12 +259,15 @@ private:
|
|||||||
int refreshCount;
|
int refreshCount;
|
||||||
bool doLoop; // loop through video
|
bool doLoop; // loop through video
|
||||||
|
|
||||||
|
bool playVideo(int x, int y, SDL_Surface *dst, bool stopOnKey);
|
||||||
|
bool open(std::string fname, bool loop, bool useOverlay = false);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CVideoPlayer();
|
CVideoPlayer();
|
||||||
~CVideoPlayer();
|
~CVideoPlayer();
|
||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
bool open(std::string fname, bool loop = false, bool useOverlay = false);
|
bool open(std::string fname);
|
||||||
void close();
|
void close();
|
||||||
bool nextFrame(); // display next frame
|
bool nextFrame(); // display next frame
|
||||||
|
|
||||||
@ -270,14 +276,19 @@ public:
|
|||||||
void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true); //moves to next frame if appropriate, and blits it or blits only if redraw parameter is set true
|
void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true); //moves to next frame if appropriate, and blits it or blits only if redraw parameter is set true
|
||||||
|
|
||||||
// Opens video, calls playVideo, closes video; returns playVideo result (if whole video has been played)
|
// Opens video, calls playVideo, closes video; returns playVideo result (if whole video has been played)
|
||||||
bool playVideo(int x, int y, SDL_Surface *dst, bool stopOnKey);
|
|
||||||
bool openAndPlayVideo(std::string name, int x, int y, SDL_Surface *dst, bool stopOnKey = false);
|
bool openAndPlayVideo(std::string name, int x, int y, SDL_Surface *dst, bool stopOnKey = false);
|
||||||
|
|
||||||
|
//TODO:
|
||||||
|
bool wait(){return false;};
|
||||||
|
int curFrame() const {return -1;};
|
||||||
|
int frameCount() const {return -1;};
|
||||||
|
|
||||||
const char *data; // video buffer
|
const char *data; // video buffer
|
||||||
int length; // video size
|
int length; // video size
|
||||||
unsigned int offset; // current data offset
|
unsigned int offset; // current data offset
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define VIDEO_TAVERN "tavern.mjpg"
|
||||||
#define VIDEO_WIN "win3.mjpg"
|
#define VIDEO_WIN "win3.mjpg"
|
||||||
#define VIDEO_LOSE_BATTLE_START "lbstart.mjpg"
|
#define VIDEO_LOSE_BATTLE_START "lbstart.mjpg"
|
||||||
#define VIDEO_LOSE_BATTLE_LOOP "lbloop.mjpg"
|
#define VIDEO_LOSE_BATTLE_LOOP "lbloop.mjpg"
|
||||||
|
@ -4167,11 +4167,7 @@ CTavernWindow::CTavernWindow(const CGObjectInstance *TavernObj)
|
|||||||
recruit->block(1);
|
recruit->block(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
CCS->videoh->open(VIDEO_TAVERN);
|
||||||
CCS->videoh->open("TAVERN.BIK");
|
|
||||||
#else
|
|
||||||
CCS->videoh->open("tavern.mjpg", true, false);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTavernWindow::recruitb()
|
void CTavernWindow::recruitb()
|
||||||
|
Reference in New Issue
Block a user