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

Fix path on unix-like OS

This commit is contained in:
Mathieu Schroeter 2017-02-11 19:31:30 +01:00
parent f7fa611593
commit 36a1822d59
6 changed files with 78 additions and 80 deletions

View File

@ -68,7 +68,7 @@ bool ReadConfig(int argc, char *argv[])
char* pText; char* pText;
size_t nb; size_t nb;
file = fopen("data\\config.ini", "rb"); file = fopen("data/config.ini", "rb");
if ( file == nullptr ) return false; if ( file == nullptr ) return false;
nb = fread(buffer, sizeof(char), 200-1, file); nb = fread(buffer, sizeof(char), 200-1, file);
buffer[nb] = 0; buffer[nb] = 0;
@ -313,7 +313,7 @@ void WindowProc2 (const SDL_Event &event)
totalDim.y = 66; totalDim.y = 66;
iconDim.x = 64; iconDim.x = 64;
iconDim.y = 66 / 2; iconDim.y = 66 / 2;
g_pPixmap->Cache (CHHILI, "image\\hili.blp", totalDim, iconDim); g_pPixmap->Cache (CHHILI, "image/hili.blp", totalDim, iconDim);
} }
SDL_SetWindowTitle (g_window, "Blupi"); SDL_SetWindowTitle (g_window, "Blupi");
if (g_pSound != nullptr) g_pSound->RestartMusic (); if (g_pSound != nullptr) g_pSound->RestartMusic ();
@ -462,9 +462,9 @@ static bool DoInit(int argc, char *argv[])
iconDim.x = 0; iconDim.x = 0;
iconDim.y = 0; iconDim.y = 0;
#if _INTRO #if _INTRO
if ( !g_pPixmap->Cache(CHBACK, "image\\intro1.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHBACK, "image/intro1.blp", totalDim, iconDim) )
#else #else
if ( !g_pPixmap->Cache(CHBACK, "image\\init.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHBACK, "image/init.blp", totalDim, iconDim) )
#endif #endif
return false; return false;
@ -473,7 +473,7 @@ static bool DoInit(int argc, char *argv[])
totalDim.y = LYIMAGE; totalDim.y = LYIMAGE;
iconDim.x = 0; iconDim.x = 0;
iconDim.y = 0; iconDim.y = 0;
if ( !g_pPixmap->Cache(CHGROUND, "image\\init.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHGROUND, "image/init.blp", totalDim, iconDim) )
return false; return false;
rcRect.left = 0; rcRect.left = 0;
@ -487,80 +487,80 @@ static bool DoInit(int argc, char *argv[])
totalDim.y = DIMCELY*2*6; totalDim.y = DIMCELY*2*6;
iconDim.x = DIMCELX*2; iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2; iconDim.y = DIMCELY*2;
if ( !g_pPixmap->Cache(CHFLOOR, "image\\floor000.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHFLOOR, "image/floor000.blp", totalDim, iconDim) )
return InitFail("Cache floor000.blp", true); return InitFail("Cache floor000.blp", true);
totalDim.x = DIMOBJX*16; totalDim.x = DIMOBJX*16;
totalDim.y = DIMOBJY*8; totalDim.y = DIMOBJY*8;
iconDim.x = DIMOBJX; iconDim.x = DIMOBJX;
iconDim.y = DIMOBJY; iconDim.y = DIMOBJY;
if ( !g_pPixmap->Cache(CHOBJECT, "image\\obj000.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHOBJECT, "image/obj000.blp", totalDim, iconDim) )
return InitFail("Cache obj000.blp", true); return InitFail("Cache obj000.blp", true);
if ( !g_pPixmap->Cache(CHOBJECTo, "image\\obj-o000.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHOBJECTo, "image/obj-o000.blp", totalDim, iconDim) )
return InitFail("Cache obj-o000.blp", true); return InitFail("Cache obj-o000.blp", true);
totalDim.x = DIMBLUPIX*16; totalDim.x = DIMBLUPIX*16;
totalDim.y = DIMBLUPIY*23; totalDim.y = DIMBLUPIY*23;
iconDim.x = DIMBLUPIX; iconDim.x = DIMBLUPIX;
iconDim.y = DIMBLUPIY; iconDim.y = DIMBLUPIY;
if ( !g_pPixmap->Cache(CHBLUPI, "image\\blupi.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHBLUPI, "image/blupi.blp", totalDim, iconDim) )
return InitFail("Cache blupi.blp", true); return InitFail("Cache blupi.blp", true);
totalDim.x = 64; totalDim.x = 64;
totalDim.y = 66; totalDim.y = 66;
iconDim.x = 64; iconDim.x = 64;
iconDim.y = 66/2; iconDim.y = 66/2;
if ( !g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHHILI, "image/hili.blp", totalDim, iconDim) )
return InitFail("Cache hili.blp", true); return InitFail("Cache hili.blp", true);
totalDim.x = DIMCELX*2*3; totalDim.x = DIMCELX*2*3;
totalDim.y = DIMCELY*2*5; totalDim.y = DIMCELY*2*5;
iconDim.x = DIMCELX*2; iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2; iconDim.y = DIMCELY*2;
if ( !g_pPixmap->Cache(CHFOG, "image\\fog.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHFOG, "image/fog.blp", totalDim, iconDim) )
return InitFail("Cache fog.blp", true); return InitFail("Cache fog.blp", true);
totalDim.x = DIMCELX*2*16; totalDim.x = DIMCELX*2*16;
totalDim.y = DIMCELY*2*1; totalDim.y = DIMCELY*2*1;
iconDim.x = DIMCELX*2; iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2; iconDim.y = DIMCELY*2;
if ( !g_pPixmap->Cache(CHMASK1, "image\\mask1.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHMASK1, "image/mask1.blp", totalDim, iconDim) )
return InitFail("Cache mask1.blp", true); return InitFail("Cache mask1.blp", true);
totalDim.x = DIMBUTTONX*6; totalDim.x = DIMBUTTONX*6;
totalDim.y = DIMBUTTONY*21; totalDim.y = DIMBUTTONY*21;
iconDim.x = DIMBUTTONX; iconDim.x = DIMBUTTONX;
iconDim.y = DIMBUTTONY; iconDim.y = DIMBUTTONY;
if ( !g_pPixmap->Cache(CHBUTTON, "image\\button00.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHBUTTON, "image/button00.blp", totalDim, iconDim) )
return InitFail("Cache button00.blp", true); return InitFail("Cache button00.blp", true);
totalDim.x = DIMJAUGEX*1; totalDim.x = DIMJAUGEX*1;
totalDim.y = DIMJAUGEY*4; totalDim.y = DIMJAUGEY*4;
iconDim.x = DIMJAUGEX; iconDim.x = DIMJAUGEX;
iconDim.y = DIMJAUGEY; iconDim.y = DIMJAUGEY;
if ( !g_pPixmap->Cache(CHJAUGE, "image\\jauge.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHJAUGE, "image/jauge.blp", totalDim, iconDim) )
return InitFail("Cache jauge.blp", true); return InitFail("Cache jauge.blp", true);
totalDim.x = DIMTEXTX*16; totalDim.x = DIMTEXTX*16;
totalDim.y = DIMTEXTY*8*3; totalDim.y = DIMTEXTY*8*3;
iconDim.x = DIMTEXTX; iconDim.x = DIMTEXTX;
iconDim.y = DIMTEXTY; iconDim.y = DIMTEXTY;
if ( !g_pPixmap->Cache(CHTEXT, "image\\text.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHTEXT, "image/text.blp", totalDim, iconDim) )
return InitFail("Cache text.blp", true); return InitFail("Cache text.blp", true);
totalDim.x = DIMLITTLEX*16; totalDim.x = DIMLITTLEX*16;
totalDim.y = DIMLITTLEY*8; totalDim.y = DIMLITTLEY*8;
iconDim.x = DIMLITTLEX; iconDim.x = DIMLITTLEX;
iconDim.y = DIMLITTLEY; iconDim.y = DIMLITTLEY;
if ( !g_pPixmap->Cache(CHLITTLE, "image\\little.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHLITTLE, "image/little.blp", totalDim, iconDim) )
return InitFail("Cache little.blp", true); return InitFail("Cache little.blp", true);
totalDim.x = 426; totalDim.x = 426;
totalDim.y = 52; totalDim.y = 52;
iconDim.x = 426; iconDim.x = 426;
iconDim.y = 52; iconDim.y = 52;
if ( !g_pPixmap->Cache(CHBIGNUM, "image\\bignum.blp", totalDim, iconDim) ) if ( !g_pPixmap->Cache(CHBIGNUM, "image/bignum.blp", totalDim, iconDim) )
return InitFail("Cache bignum.blp", true); return InitFail("Cache bignum.blp", true);
// Load all cursors // Load all cursors

View File

@ -103,12 +103,12 @@ bool CDecor::Write(int rank, bool bUser, int world, int time, int total)
if ( bUser ) if ( bUser )
{ {
sprintf(filename, "data\\user%.3d.blp", rank); sprintf(filename, "data/user%.3d.blp", rank);
AddUserPath(filename); AddUserPath(filename);
} }
else else
{ {
sprintf(filename, "data\\world%.3d.blp", rank); sprintf(filename, "data/world%.3d.blp", rank);
} }
file = fopen(filename, "wb"); file = fopen(filename, "wb");
@ -186,12 +186,12 @@ bool CDecor::Read(int rank, bool bUser, int &world, int &time, int &total)
if ( bUser ) if ( bUser )
{ {
sprintf(filename, "data\\user%.3d.blp", rank); sprintf(filename, "data/user%.3d.blp", rank);
AddUserPath(filename); AddUserPath(filename);
} }
else else
{ {
sprintf(filename, "data\\world%.3d.blp", rank); sprintf(filename, "data/world%.3d.blp", rank);
} }
file = fopen(filename, "rb"); file = fopen(filename, "rb");
@ -323,12 +323,12 @@ bool CDecor::FileExist(int rank, bool bUser, int &world, int &time, int &total)
if ( bUser ) if ( bUser )
{ {
sprintf(filename, "data\\user%.3d.blp", rank); sprintf(filename, "data/user%.3d.blp", rank);
AddUserPath(filename); AddUserPath(filename);
} }
else else
{ {
sprintf(filename, "data\\world%.3d.blp", rank); sprintf(filename, "data/world%.3d.blp", rank);
} }
file = fopen(filename, "rb"); file = fopen(filename, "rb");

View File

@ -224,7 +224,7 @@ bool CDecor::LoadImages()
totalDim.y = DIMCELY*2*6; totalDim.y = DIMCELY*2*6;
iconDim.x = DIMCELX*2; iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2; iconDim.y = DIMCELY*2;
sprintf(filename, "image\\floor%.3d.blp", m_region); sprintf(filename, "image/floor%.3d.blp", m_region);
if ( !m_pPixmap->Cache(CHFLOOR, filename, totalDim, iconDim) ) if ( !m_pPixmap->Cache(CHFLOOR, filename, totalDim, iconDim) )
return false; return false;
@ -232,11 +232,11 @@ bool CDecor::LoadImages()
totalDim.y = DIMOBJY*8; totalDim.y = DIMOBJY*8;
iconDim.x = DIMOBJX; iconDim.x = DIMOBJX;
iconDim.y = DIMOBJY; iconDim.y = DIMOBJY;
sprintf(filename, "image\\obj%.3d.blp", m_region); sprintf(filename, "image/obj%.3d.blp", m_region);
if ( !m_pPixmap->Cache(CHOBJECT, filename, totalDim, iconDim) ) if ( !m_pPixmap->Cache(CHOBJECT, filename, totalDim, iconDim) )
return false; return false;
sprintf(filename, "image\\obj-o%.3d.blp", m_region); sprintf(filename, "image/obj-o%.3d.blp", m_region);
if ( !m_pPixmap->Cache(CHOBJECTo, filename, totalDim, iconDim) ) if ( !m_pPixmap->Cache(CHOBJECTo, filename, totalDim, iconDim) )
return false; return false;

View File

@ -73,7 +73,7 @@ static Phase table[] =
{ {
{ {
WM_PHASE_TESTCD, WM_PHASE_TESTCD,
"image\\init.blp", "image/init.blp",
false, false,
{ {
{ {
@ -84,7 +84,7 @@ static Phase table[] =
{ {
WM_PHASE_INTRO1, WM_PHASE_INTRO1,
"image\\intro1.blp", "image/intro1.blp",
false, false,
{ {
{ {
@ -95,7 +95,7 @@ static Phase table[] =
{ {
WM_PHASE_INTRO2, WM_PHASE_INTRO2,
"image\\intro2.blp", "image/intro2.blp",
false, false,
{ {
{ {
@ -106,7 +106,7 @@ static Phase table[] =
{ {
WM_PHASE_INIT, WM_PHASE_INIT,
"image\\init.blp", "image/init.blp",
false, false,
{ {
{ {
@ -147,7 +147,7 @@ static Phase table[] =
{ {
WM_PHASE_HISTORY0, WM_PHASE_HISTORY0,
"image\\history0.blp", "image/history0.blp",
true, true,
{ {
{ {
@ -170,7 +170,7 @@ static Phase table[] =
{ {
WM_PHASE_HISTORY1, WM_PHASE_HISTORY1,
"image\\history1.blp", "image/history1.blp",
true, true,
{ {
{ {
@ -193,7 +193,7 @@ static Phase table[] =
{ {
WM_PHASE_INFO, WM_PHASE_INFO,
"image\\info%.3d.blp", "image/info%.3d.blp",
false, false,
{ {
{ {
@ -258,7 +258,7 @@ static Phase table[] =
{ {
WM_PHASE_PLAY, WM_PHASE_PLAY,
"image\\play.blp", "image/play.blp",
false, false,
{ {
{ {
@ -287,7 +287,7 @@ static Phase table[] =
{ {
WM_PHASE_STOP, WM_PHASE_STOP,
"image\\stop%.3d.blp", "image/stop%.3d.blp",
false, false,
{ {
{ {
@ -334,7 +334,7 @@ static Phase table[] =
{ {
WM_PHASE_HELP, WM_PHASE_HELP,
"image\\help.blp", "image/help.blp",
true, true,
{ {
{ {
@ -375,7 +375,7 @@ static Phase table[] =
{ {
WM_PHASE_SETUP, WM_PHASE_SETUP,
"image\\setup.blp", "image/setup.blp",
false, false,
{ {
{ {
@ -452,7 +452,7 @@ static Phase table[] =
{ {
WM_PHASE_SETUPp, WM_PHASE_SETUPp,
"image\\setup.blp", "image/setup.blp",
false, false,
{ {
{ {
@ -529,7 +529,7 @@ static Phase table[] =
{ {
WM_PHASE_READ, WM_PHASE_READ,
"image\\read.blp", "image/read.blp",
false, false,
{ {
{ {
@ -606,7 +606,7 @@ static Phase table[] =
{ {
WM_PHASE_WRITE, WM_PHASE_WRITE,
"image\\write.blp", "image/write.blp",
false, false,
{ {
{ {
@ -683,7 +683,7 @@ static Phase table[] =
{ {
WM_PHASE_WRITEp, WM_PHASE_WRITEp,
"image\\write.blp", "image/write.blp",
false, false,
{ {
{ {
@ -760,7 +760,7 @@ static Phase table[] =
{ {
WM_PHASE_LOST, WM_PHASE_LOST,
"image\\lost.blp", "image/lost.blp",
true, true,
{ {
{ {
@ -777,7 +777,7 @@ static Phase table[] =
{ {
WM_PHASE_WIN, WM_PHASE_WIN,
"image\\win.blp", "image/win.blp",
true, true,
{ {
{ {
@ -794,7 +794,7 @@ static Phase table[] =
{ {
WM_PHASE_LASTWIN, WM_PHASE_LASTWIN,
"image\\last%.3d.blp", "image/last%.3d.blp",
true, true,
{ {
{ {
@ -811,7 +811,7 @@ static Phase table[] =
{ {
WM_PHASE_BUILD, WM_PHASE_BUILD,
"image\\build.blp", "image/build.blp",
true, true,
{ {
{ {
@ -926,7 +926,7 @@ static Phase table[] =
{ {
WM_PHASE_BUTTON, WM_PHASE_BUTTON,
"image\\button.blp", "image/button.blp",
true, true,
{ {
{ {
@ -1146,7 +1146,7 @@ static Phase table[] =
{ {
WM_PHASE_TERM, WM_PHASE_TERM,
"image\\term.blp", "image/term.blp",
true, true,
{ {
{ {
@ -1235,7 +1235,7 @@ static Phase table[] =
{ {
WM_PHASE_MUSIC, WM_PHASE_MUSIC,
"image\\music.blp", "image/music.blp",
true, true,
{ {
{ {
@ -1312,7 +1312,7 @@ static Phase table[] =
{ {
WM_PHASE_REGION, WM_PHASE_REGION,
"image\\region.blp", "image/region.blp",
true, true,
{ {
{ {
@ -1353,7 +1353,7 @@ static Phase table[] =
{ {
WM_PHASE_PLAYMOVIE, WM_PHASE_PLAYMOVIE,
"image\\movie.blp", "image/movie.blp",
false, false,
{ {
{ {
@ -1364,7 +1364,7 @@ static Phase table[] =
{ {
WM_PHASE_WINMOVIE, WM_PHASE_WINMOVIE,
"image\\movie.blp", "image/movie.blp",
false, false,
{ {
{ {
@ -1375,7 +1375,7 @@ static Phase table[] =
{ {
WM_PHASE_H0MOVIE, WM_PHASE_H0MOVIE,
"image\\movie.blp", "image/movie.blp",
false, false,
{ {
{ {
@ -1386,7 +1386,7 @@ static Phase table[] =
{ {
WM_PHASE_H1MOVIE, WM_PHASE_H1MOVIE,
"image\\movie.blp", "image/movie.blp",
false, false,
{ {
{ {
@ -1397,7 +1397,7 @@ static Phase table[] =
{ {
WM_PHASE_H2MOVIE, WM_PHASE_H2MOVIE,
"image\\movie.blp", "image/movie.blp",
false, false,
{ {
{ {
@ -1408,7 +1408,7 @@ static Phase table[] =
{ {
WM_PHASE_BYE, WM_PHASE_BYE,
"image\\bye.blp", "image/bye.blp",
false, false,
{ {
{ {
@ -1419,7 +1419,7 @@ static Phase table[] =
{ {
WM_PHASE_INSERT, WM_PHASE_INSERT,
"image\\insert.blp", "image/insert.blp",
false, false,
{ {
{ {
@ -3099,7 +3099,7 @@ bool CEvent::ChangePhase(unsigned int phase)
music = m_pDecor->GetMusic(); music = m_pDecor->GetMusic();
if ( music > 0 ) if ( music > 0 )
{ {
sprintf(filename, "sound\\music%.3d.blp", music-1); sprintf(filename, "sound/music%.3d.blp", music-1);
m_pSound->StopMusic (); m_pSound->StopMusic ();
m_pSound->PlayMusic(filename); m_pSound->PlayMusic(filename);
} }
@ -3108,31 +3108,31 @@ bool CEvent::ChangePhase(unsigned int phase)
if ( phase == WM_PHASE_H0MOVIE ) if ( phase == WM_PHASE_H0MOVIE )
{ {
strcpy(m_movieToStart, "movie\\history0.mkv"); strcpy(m_movieToStart, "movie/history0.mkv");
m_phaseAfterMovie = WM_PHASE_HISTORY0; m_phaseAfterMovie = WM_PHASE_HISTORY0;
} }
if ( phase == WM_PHASE_H1MOVIE ) if ( phase == WM_PHASE_H1MOVIE )
{ {
strcpy(m_movieToStart, "movie\\history1.mkv"); strcpy(m_movieToStart, "movie/history1.mkv");
m_phaseAfterMovie = WM_PHASE_HISTORY1; m_phaseAfterMovie = WM_PHASE_HISTORY1;
} }
if ( phase == WM_PHASE_H2MOVIE ) if ( phase == WM_PHASE_H2MOVIE )
{ {
strcpy(m_movieToStart, "movie\\history2.mkv"); strcpy(m_movieToStart, "movie/history2.mkv");
m_phaseAfterMovie = WM_PHASE_INFO; m_phaseAfterMovie = WM_PHASE_INFO;
} }
if ( phase == WM_PHASE_PLAYMOVIE ) if ( phase == WM_PHASE_PLAYMOVIE )
{ {
sprintf(m_movieToStart, "movie\\play%.3d.mkv", GetPhysicalWorld()); sprintf(m_movieToStart, "movie/play%.3d.mkv", GetPhysicalWorld());
m_phaseAfterMovie = WM_PHASE_PLAY; m_phaseAfterMovie = WM_PHASE_PLAY;
} }
if ( phase == WM_PHASE_WINMOVIE ) if ( phase == WM_PHASE_WINMOVIE )
{ {
sprintf(m_movieToStart, "movie\\win%.3d.mkv", GetPhysicalWorld()); sprintf(m_movieToStart, "movie/win%.3d.mkv", GetPhysicalWorld());
m_phaseAfterMovie = WM_PHASE_WIN; m_phaseAfterMovie = WM_PHASE_WIN;
if ( !m_bPrivate && if ( !m_bPrivate &&
@ -4166,7 +4166,7 @@ bool CEvent::ReadLibelle(int world, bool bSchool, bool bHelp)
if ( pBuffer == nullptr ) goto error; if ( pBuffer == nullptr ) goto error;
memset(pBuffer, 0, sizeof(char)*50000); memset(pBuffer, 0, sizeof(char)*50000);
file = fopen("data\\enigmes.blp", "rb"); file = fopen("data/enigmes.blp", "rb");
if ( file == nullptr ) goto error; if ( file == nullptr ) goto error;
nb = fread(pBuffer, sizeof(char), 50000-1, file); nb = fread(pBuffer, sizeof(char), 50000-1, file);
@ -4220,7 +4220,7 @@ bool CEvent::WriteInfo()
DescInfo info; DescInfo info;
size_t nb; size_t nb;
strcpy(filename, "data\\info.blp"); strcpy(filename, "data/info.blp");
AddUserPath(filename); AddUserPath(filename);
file = fopen(filename, "wb"); file = fopen(filename, "wb");
@ -4262,7 +4262,7 @@ bool CEvent::ReadInfo()
DescInfo info; DescInfo info;
size_t nb; size_t nb;
strcpy(filename, "data\\info.blp"); strcpy(filename, "data/info.blp");
AddUserPath(filename); AddUserPath(filename);
file = fopen(filename, "rb"); file = fopen(filename, "rb");
@ -4349,8 +4349,8 @@ void CEvent::DemoRecStop()
if ( m_pDemoBuffer != nullptr ) if ( m_pDemoBuffer != nullptr )
{ {
_unlink ("data\\demo.blp"); _unlink ("data/demo.blp");
file = fopen("data\\demo.blp", "wb"); file = fopen("data/demo.blp", "wb");
if ( file != nullptr ) if ( file != nullptr )
{ {
memset(&header, 0, sizeof(DemoHeader)); memset(&header, 0, sizeof(DemoHeader));
@ -4387,7 +4387,7 @@ bool CEvent::DemoPlayStart()
if ( m_pDemoBuffer == nullptr ) return false; if ( m_pDemoBuffer == nullptr ) return false;
memset(m_pDemoBuffer, 0, MAXDEMO*sizeof(DemoEvent)); memset(m_pDemoBuffer, 0, MAXDEMO*sizeof(DemoEvent));
sprintf(filename, "data\\demo%.3d.blp", m_demoNumber); sprintf(filename, "data/demo%.3d.blp", m_demoNumber);
file = fopen(filename, "rb"); file = fopen(filename, "rb");
if ( file == nullptr ) if ( file == nullptr )
{ {
@ -5319,7 +5319,7 @@ bool CEvent::TreatEventBase(const SDL_Event &event)
break; break;
case WM_MOVIE: case WM_MOVIE:
StartMovie("movie\\essai.avi"); StartMovie("movie/essai.avi");
ChangePhase(WM_PHASE_INIT); ChangePhase(WM_PHASE_INIT);
break; break;
} }

View File

@ -3,6 +3,7 @@
#include <SDL2/SDL_log.h> #include <SDL2/SDL_log.h>
#include <SDL2/SDL_mouse.h> #include <SDL2/SDL_mouse.h>
#include <algorithm>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -67,22 +68,19 @@ int Random(int min, int max)
std::string GetBaseDir () std::string GetBaseDir ()
{ {
char *sdlBasePath = nullptr;
static std::string basePath; static std::string basePath;
if (!basePath.size ()) if (!basePath.size ())
{ {
sdlBasePath = SDL_GetBasePath (); auto sdlBasePath = SDL_GetBasePath ();
sdlBasePath[strlen (sdlBasePath) - 1] = '\0'; sdlBasePath[strlen (sdlBasePath) - 1] = '\0';
basePath = sdlBasePath;
std::replace (basePath.begin (), basePath.end (), '\\', '/');
basePath = basePath.substr (0, basePath.find_last_of ("//") + 1);
SDL_free (sdlBasePath);
} }
std::string path = sdlBasePath; return basePath;
path = path.substr (0, path.find_last_of ("\\/") + 1);
if (sdlBasePath)
SDL_free (sdlBasePath);
return path;
} }
// Ajoute le chemin permettant de lire un fichier // Ajoute le chemin permettant de lire un fichier
@ -97,7 +95,7 @@ void AddUserPath(char *pFilename)
temp = SDL_GetPrefPath ("Epsitec SA", "Planet Blupi"); temp = SDL_GetPrefPath ("Epsitec SA", "Planet Blupi");
pText = strstr(pFilename, "\\"); pText = strstr(pFilename, "/");
if ( pText != nullptr ) if ( pText != nullptr )
{ {
pos = strlen(temp)+(pText-pFilename)+1; pos = strlen(temp)+(pText-pFilename)+1;

View File

@ -136,7 +136,7 @@ void CSound::CacheAll()
for ( i=0 ; i<MAXSOUND ; i++ ) for ( i=0 ; i<MAXSOUND ; i++ )
{ {
sprintf(name, "sound\\sound%.3d.blp", i); sprintf(name, "sound/sound%.3d.blp", i);
if ( !Cache(i, name) ) break; if ( !Cache(i, name) ) break;
} }
} }