1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Use the back-build image as stretched background for wide screen

Concerns only screens provided with the map builder.
This commit is contained in:
Mathieu Schroeter 2017-10-21 15:31:38 +02:00
parent dfe3647a74
commit 108c577b85
6 changed files with 55 additions and 3 deletions

View File

@ -756,6 +756,13 @@ DoInit (int argc, char * argv[], bool & exit)
g_pPixmap->DrawImage (-1, CHBACK, rcRect); // dessine le fond g_pPixmap->DrawImage (-1, CHBACK, rcRect); // dessine le fond
g_pPixmap->Display (); g_pPixmap->Display ();
totalDim.x = LXLOGIC;
totalDim.y = LYLOGIC;
iconDim.x = 0;
iconDim.y = 0;
if (!g_pPixmap->Cache (CHBACKBUILD, "image/back-build.png", totalDim, iconDim))
return EXIT_FAILURE;
totalDim.x = DIMCELX * 2 * 16; totalDim.x = DIMCELX * 2 * 16;
totalDim.y = DIMCELY * 2 * 6; totalDim.y = DIMCELY * 2 * 6;
iconDim.x = DIMCELX * 2; iconDim.x = DIMCELX * 2;

View File

@ -72,6 +72,7 @@
#define DIMLITTLEX 16 // max small char size #define DIMLITTLEX 16 // max small char size
#define DIMLITTLEY 12 #define DIMLITTLEY 12
#define CHNONE -1
#define CHBACK 0 #define CHBACK 0
#define CHFLOOR 1 #define CHFLOOR 1
#define CHOBJECT 2 #define CHOBJECT 2
@ -88,6 +89,7 @@
#define CHTEXT 13 #define CHTEXT 13
#define CHBIGNUM 14 #define CHBIGNUM 14
#define CHMASK2 15 #define CHMASK2 15
#define CHBACKBUILD 16
#define FOGHIDE 4 #define FOGHIDE 4
// clang-format on // clang-format on

View File

@ -97,6 +97,7 @@ static Phase table[] =
{ {
EV_PHASE_TESTCD, EV_PHASE_TESTCD,
"image/init.png", "image/init.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -109,6 +110,7 @@ static Phase table[] =
{ {
EV_PHASE_INTRO1, EV_PHASE_INTRO1,
"image/intro1.png", "image/intro1.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -121,6 +123,7 @@ static Phase table[] =
{ {
EV_PHASE_INIT, EV_PHASE_INIT,
"image/init.png", "image/init.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -169,6 +172,7 @@ static Phase table[] =
{ {
EV_PHASE_HISTORY0, EV_PHASE_HISTORY0,
"image/history0.png", "image/history0.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
true, true,
{ {
@ -193,6 +197,7 @@ static Phase table[] =
{ {
EV_PHASE_HISTORY1, EV_PHASE_HISTORY1,
"image/history1.png", "image/history1.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
true, true,
{ {
@ -217,6 +222,7 @@ static Phase table[] =
{ {
EV_PHASE_INFO, EV_PHASE_INFO,
"image/info%.3d.png", "image/info%.3d.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -283,6 +289,7 @@ static Phase table[] =
{ {
EV_PHASE_PLAY, EV_PHASE_PLAY,
"image/play.png", "image/play.png",
CHNONE,
CPixmap::Mode::EXPAND, CPixmap::Mode::EXPAND,
false, false,
{ {
@ -313,6 +320,7 @@ static Phase table[] =
{ {
EV_PHASE_STOP, EV_PHASE_STOP,
"image/stop%.3d.png", "image/stop%.3d.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -361,6 +369,7 @@ static Phase table[] =
{ {
EV_PHASE_HELP, EV_PHASE_HELP,
"image/help.png", "image/help.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
true, true,
{ {
@ -403,6 +412,7 @@ static Phase table[] =
{ {
EV_PHASE_SETUP, EV_PHASE_SETUP,
"image/setup01.png", "image/setup01.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -481,6 +491,7 @@ static Phase table[] =
{ {
EV_PHASE_SETUPp, EV_PHASE_SETUPp,
"image/setup01.png", "image/setup01.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -559,6 +570,7 @@ static Phase table[] =
{ {
EV_PHASE_READ, EV_PHASE_READ,
"image/read.png", "image/read.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -637,6 +649,7 @@ static Phase table[] =
{ {
EV_PHASE_WRITE, EV_PHASE_WRITE,
"image/write.png", "image/write.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -715,6 +728,7 @@ static Phase table[] =
{ {
EV_PHASE_WRITEp, EV_PHASE_WRITEp,
"image/write.png", "image/write.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -793,6 +807,7 @@ static Phase table[] =
{ {
EV_PHASE_LOST, EV_PHASE_LOST,
"image/lost.png", "image/lost.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
true, true,
{ {
@ -811,6 +826,7 @@ static Phase table[] =
{ {
EV_PHASE_WIN, EV_PHASE_WIN,
"image/win.png", "image/win.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
true, true,
{ {
@ -829,6 +845,7 @@ static Phase table[] =
{ {
EV_PHASE_LASTWIN, EV_PHASE_LASTWIN,
"image/last%.3d.png", "image/last%.3d.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
true, true,
{ {
@ -847,6 +864,7 @@ static Phase table[] =
{ {
EV_PHASE_BUILD, EV_PHASE_BUILD,
"image/build.png", "image/build.png",
CHNONE,
CPixmap::Mode::EXPAND, CPixmap::Mode::EXPAND,
true, true,
{ {
@ -963,6 +981,7 @@ static Phase table[] =
{ {
EV_PHASE_BUTTON, EV_PHASE_BUTTON,
"image/button.png", "image/button.png",
CHBACKBUILD,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
true, true,
{ {
@ -1184,6 +1203,7 @@ static Phase table[] =
{ {
EV_PHASE_TERM, EV_PHASE_TERM,
"image/term.png", "image/term.png",
CHBACKBUILD,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
true, true,
{ {
@ -1274,6 +1294,7 @@ static Phase table[] =
{ {
EV_PHASE_MUSIC, EV_PHASE_MUSIC,
"image/music.png", "image/music.png",
CHBACKBUILD,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
true, true,
{ {
@ -1358,6 +1379,7 @@ static Phase table[] =
{ {
EV_PHASE_REGION, EV_PHASE_REGION,
"image/region.png", "image/region.png",
CHBACKBUILD,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
true, true,
{ {
@ -1400,6 +1422,7 @@ static Phase table[] =
{ {
EV_PHASE_PLAYMOVIE, EV_PHASE_PLAYMOVIE,
"image/movie.png", "image/movie.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -1412,6 +1435,7 @@ static Phase table[] =
{ {
EV_PHASE_WINMOVIE, EV_PHASE_WINMOVIE,
"image/movie.png", "image/movie.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -1424,6 +1448,7 @@ static Phase table[] =
{ {
EV_PHASE_H0MOVIE, EV_PHASE_H0MOVIE,
"image/movie.png", "image/movie.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -1436,6 +1461,7 @@ static Phase table[] =
{ {
EV_PHASE_H1MOVIE, EV_PHASE_H1MOVIE,
"image/movie.png", "image/movie.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -1448,6 +1474,7 @@ static Phase table[] =
{ {
EV_PHASE_H2MOVIE, EV_PHASE_H2MOVIE,
"image/movie.png", "image/movie.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -1460,6 +1487,7 @@ static Phase table[] =
{ {
EV_PHASE_BYE, EV_PHASE_BYE,
"image/bye.png", "image/bye.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -1472,6 +1500,7 @@ static Phase table[] =
{ {
EV_PHASE_INSERT, EV_PHASE_INSERT,
"image/insert.png", "image/insert.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -1490,6 +1519,7 @@ static Phase table[] =
{ {
EV_PHASE_SETTINGS, EV_PHASE_SETTINGS,
"image/setup00.png", "image/setup00.png",
CHNONE,
CPixmap::Mode::FIX, CPixmap::Mode::FIX,
false, false,
{ {
@ -3130,7 +3160,8 @@ CEvent::ChangePhase (Uint32 phase)
iconDim.x = 0; iconDim.x = 0;
iconDim.y = 0; iconDim.y = 0;
if (!m_pPixmap->Cache ( if (!m_pPixmap->Cache (
CHBACK, filename, totalDim, iconDim, table[m_index].mode)) CHBACK, filename, totalDim, iconDim, table[m_index].mode,
table[m_index].chBackWide))
{ {
WaitMouse (false); // enlève le sablier WaitMouse (false); // enlève le sablier
m_tryInsertCount = 40; m_tryInsertCount = 40;

View File

@ -44,6 +44,7 @@ typedef struct {
typedef struct { typedef struct {
Uint32 phase; Uint32 phase;
char backName[20]; char backName[20];
Sint32 chBackWide;
CPixmap::Mode mode; CPixmap::Mode mode;
Sint32 bCDrom; Sint32 bCDrom;
Button buttons[MAXBUTTON]; Button buttons[MAXBUTTON];

View File

@ -273,7 +273,7 @@ CPixmap::Cache (size_t channel, Point totalDim)
bool bool
CPixmap::Cache ( CPixmap::Cache (
size_t channel, const std::string & pFilename, Point totalDim, Point iconDim, size_t channel, const std::string & pFilename, Point totalDim, Point iconDim,
Mode mode) Mode mode, size_t chBackWide)
{ {
std::string file = GetBaseDir () + pFilename; std::string file = GetBaseDir () + pFilename;
SDL_Surface * surface = IMG_Load (file.c_str ()); SDL_Surface * surface = IMG_Load (file.c_str ());
@ -335,6 +335,16 @@ CPixmap::Cache (
{ {
if (channel == CHBACK) if (channel == CHBACK)
{ {
if (chBackWide > 0)
{
Rect srcRect;
srcRect.left = 0;
srcRect.right = LXIMAGE;
srcRect.top = 0;
srcRect.bottom = LYIMAGE;
this->DrawImage (-1, chBackWide, srcRect);
}
SDL_Rect dst; SDL_Rect dst;
dst.x = (LXIMAGE - ow) / 2; dst.x = (LXIMAGE - ow) / 2;
dst.y = 0; dst.y = 0;

View File

@ -64,7 +64,7 @@ public:
bool Cache (size_t channel, Point totalDim); bool Cache (size_t channel, Point totalDim);
bool Cache ( bool Cache (
size_t channel, const std::string & pFilename, Point totalDim, size_t channel, const std::string & pFilename, Point totalDim,
Point iconDim, Mode mode = FIX); Point iconDim, Mode mode = FIX, size_t chBackWide = CHNONE);
bool Cache (size_t channel, const std::string & pFilename, Point totalDim); bool Cache (size_t channel, const std::string & pFilename, Point totalDim);
bool Cache (size_t channel, SDL_Surface * surface, Point totalDim); bool Cache (size_t channel, SDL_Surface * surface, Point totalDim);
void SetClipping (Rect clip); void SetClipping (Rect clip);
@ -92,6 +92,7 @@ public:
void ChangeSprite (MouseSprites sprite); void ChangeSprite (MouseSprites sprite);
protected: protected:
Sint32 BltFast (Sint32 dstCh, size_t srcCh, Rect dstR, Rect srcR);
Sint32 BltFast (Sint32 chDst, size_t channel, Point dst, Rect rcRect); Sint32 BltFast (Sint32 chDst, size_t channel, Point dst, Rect rcRect);
Sint32 BltFast ( Sint32 BltFast (
SDL_Texture * lpSDL, size_t channel, Point dst, Rect rcRect, SDL_Texture * lpSDL, size_t channel, Point dst, Rect rcRect,