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

Replace BOOL by bool

And replace structs that are stored from BOOL to int.
This commit is contained in:
Mathieu Schroeter 2017-01-22 00:10:12 +01:00
parent 7ed67f28c4
commit 93047957fd
33 changed files with 2177 additions and 2177 deletions

View File

@ -2568,7 +2568,7 @@ static DescAction action_table[] =
// Calcule l'action suivante.
// Retourne FALSE lorsque l'action est terminée.
// Retourne false lorsque l'action est terminée.
bool Action(short action, short direct,
short &phase, short &step,
@ -2615,18 +2615,18 @@ bool Action(short action, short direct,
pos.x /= 100;
pos.y /= 100;
if ( phase >= nbPhase ) return FALSE;
if ( phase >= nbPhase ) return false;
phase ++;
step ++;
return TRUE;
return true;
}
pTable ++;
}
return FALSE;
return false;
}
@ -2667,31 +2667,31 @@ bool Rotate(short &icon, short direct)
if ( icon >= 200 && icon <= 215 ) // tracks ?
{
icon = (direct/8)+200;
return TRUE;
return true;
}
if ( icon >= 216 && icon <= 231 ) // robot ?
{
icon = (direct/8)+216;
return TRUE;
return true;
}
if ( icon >= 290 && icon <= 305 ) // disciple ?
{
icon = (direct/8)+290;
return TRUE;
return true;
}
if ( icon >= 234 && icon <= 249 ) // blupi en bateau ?
{
icon = (direct/8)+234;
return TRUE;
return true;
}
if ( icon >= 250 && icon <= 265 ) // blupi en jeep ?
{
icon = (direct/8)+250;
return TRUE;
return true;
}
if ( icon >= 169 && icon <= 192 ) // blupi malade ?
@ -2707,14 +2707,14 @@ bool Rotate(short &icon, short direct)
if ( icon == pTable[i] )
{
icon = pTable[direct/16]+offset;
return TRUE;
return true;
}
}
pTable += 8;
}
return FALSE;
return false;
}
// Retourne la direction d'une icône.

View File

@ -49,7 +49,7 @@ static char tableDark[13*4] =
// Retourne les bits contenant de l'eau.
BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index)
bool CDecor::GetSeeBits(POINT cel, char *pBits, int index)
{
int icon;
@ -59,13 +59,13 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index)
pBits[3] = 0;
if ( cel.x < 0 || cel.x >= MAXCELX ||
cel.y < 0 || cel.y >= MAXCELY ) return FALSE;
cel.y < 0 || cel.y >= MAXCELY ) return false;
icon = m_decor[cel.x/2][cel.y/2].floorIcon;
if ( index == 0 ) // eau ?
{
if ( icon < 1 || icon > 14 ) return TRUE;
if ( icon < 1 || icon > 14 ) return true;
icon -= 1;
pBits[0] = tableSee[icon*4+0];
pBits[1] = tableSee[icon*4+1];
@ -75,16 +75,16 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index)
if ( index == 1 ) // mousse ?
{
if ( icon >= 2 && icon <= 14 ) return FALSE; // eau ?
if ( icon >= 2 && icon <= 14 ) return false; // eau ?
if ( icon == 66 || icon == 79 ) // mousse spéciale ?
{
pBits[0] = 1;
pBits[1] = 1;
pBits[2] = 1;
pBits[3] = 1;
return TRUE;
return true;
}
if ( icon < 20 || icon > 32 ) return TRUE;
if ( icon < 20 || icon > 32 ) return true;
icon -= 20;
pBits[0] = tableDark[icon*4+0];
pBits[1] = tableDark[icon*4+1];
@ -94,7 +94,7 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index)
if ( index == 2 ) // terre ?
{
if ( icon >= 2 && icon <= 14 ) return FALSE; // eau ?
if ( icon >= 2 && icon <= 14 ) return false; // eau ?
if ( (icon >= 46 && icon <= 48) || // terre spéciale ?
icon == 71 ) // terre à fer ?
{
@ -102,9 +102,9 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index)
pBits[1] = 1;
pBits[2] = 1;
pBits[3] = 1;
return TRUE;
return true;
}
if ( icon < 33 || icon > 45 ) return TRUE;
if ( icon < 33 || icon > 45 ) return true;
icon -= 33;
pBits[0] = tableDark[icon*4+0];
pBits[1] = tableDark[icon*4+1];
@ -112,7 +112,7 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index)
pBits[3] = tableDark[icon*4+3];
}
return TRUE;
return true;
}
void CopyBits(char *pDst, char *pSrc)
@ -123,13 +123,13 @@ void CopyBits(char *pDst, char *pSrc)
}
}
BOOL ChangeBits(char *pDst, char *pSrc)
bool ChangeBits(char *pDst, char *pSrc)
{
for ( int i=0 ; i<4 ; i++ )
{
if ( *pDst++ != *pSrc++ ) return TRUE;
if ( *pDst++ != *pSrc++ ) return true;
}
return FALSE;
return false;
}
// Retourne l'icône correspondant aux bits d'eaux.
@ -186,7 +186,7 @@ void CDecor::ArrangeFloor(POINT cel)
POINT test;
int max, index, icon;
char here[4], bits[4], init[4];
BOOL bModif = FALSE;
bool bModif = false;
icon = m_decor[cel.x/2][cel.y/2].floorIcon;
@ -212,7 +212,7 @@ void CDecor::ArrangeFloor(POINT cel)
bits[3] != here[2] )
{
here[2] = bits[1];
bModif = TRUE;
bModif = true;
}
}
@ -226,7 +226,7 @@ void CDecor::ArrangeFloor(POINT cel)
bits[3] != here[0] )
{
here[0] = bits[3];
bModif = TRUE;
bModif = true;
}
}
@ -240,7 +240,7 @@ void CDecor::ArrangeFloor(POINT cel)
bits[3] != here[1] )
{
here[1] = bits[2];
bModif = TRUE;
bModif = true;
}
}
@ -254,7 +254,7 @@ void CDecor::ArrangeFloor(POINT cel)
bits[2] != here[3] )
{
here[3] = bits[0];
bModif = TRUE;
bModif = true;
}
}
@ -575,7 +575,7 @@ void CDecor::ArrangeObject(POINT cel)
int first, last;
int index, i, j, k, x, y;
POINT vector, test, pos;
BOOL bTour;
bool bTour;
for ( index=0 ; index<3 ; index++ )
{
@ -635,16 +635,16 @@ void CDecor::ArrangeObject(POINT cel)
vector = GetVector(i*2*16);
test = cel;
bTour = FALSE;
bTour = false;
j = 0;
while ( TRUE )
while ( true )
{
test.x += vector.x*2;
test.y += vector.y*2;
if ( m_decor[test.x/2][test.y/2].objectIcon == 27 ) // tour ?
{
bTour = TRUE;
bTour = true;
break;
}
@ -660,7 +660,7 @@ void CDecor::ArrangeObject(POINT cel)
if ( m_decor[cel.x/2][cel.y/2].objectIcon != 27 ) // pas tour ?
{
bTour = FALSE;
bTour = false;
}
test = cel;
@ -684,10 +684,10 @@ void CDecor::ArrangeObject(POINT cel)
if ( !m_bBuild && bTour )
{
if ( MoveCreate(test, -1, FALSE, CHOBJECT,-1,
-1,-1, 9999,1,0, TRUE) )
if ( MoveCreate(test, -1, false, CHOBJECT,-1,
-1,-1, 9999,1,0, true) )
{
MoveAddIcons(test, 5-i%2, TRUE); // éclairs
MoveAddIcons(test, 5-i%2, true); // éclairs
}
pos = ConvCelToPos(test);
@ -707,7 +707,7 @@ void CDecor::ArrangeObject(POINT cel)
// Test s'il faut remplir le sol ici.
BOOL CDecor::ArrangeFillTestFloor(POINT cel1, POINT cel2)
bool CDecor::ArrangeFillTestFloor(POINT cel1, POINT cel2)
{
POINT cel;
int icon1, icon2;
@ -741,37 +741,37 @@ BOOL CDecor::ArrangeFillTestFloor(POINT cel1, POINT cel2)
m_decor[cel.x/2][cel.y/2].floorIcon < icon1 ||
m_decor[cel.x/2][cel.y/2].floorIcon > icon2 )
{
return FALSE;
return false;
}
if ( m_fillPutChannel == CHFLOOR &&
m_fillPutIcon == 14 && // met de l'eau ?
m_decor[cel.x/2][cel.y/2].objectIcon != -1 )
{
return FALSE;
return false;
}
}
}
if ( m_fillPutChannel == CHFLOOR &&
m_fillPutIcon == 14 && // met de l'eau ?
IsBlupiHereEx(cel1, cel2, -1, FALSE) )
IsBlupiHereEx(cel1, cel2, -1, false) )
{
return FALSE;
return false;
}
return TRUE;
return true;
}
// Test s'il faut remplir ici.
BOOL CDecor::ArrangeFillTest(POINT pos)
bool CDecor::ArrangeFillTest(POINT pos)
{
POINT cel1, cel2;
if ( m_pFillMap[(pos.x/2)+(pos.y/2)*(MAXCELX/2)] == 1 )
{
return FALSE;
return false;
}
if ( m_bFillFloor )
@ -787,20 +787,20 @@ BOOL CDecor::ArrangeFillTest(POINT pos)
if ( m_decor[pos.x/2][pos.y/2].objectChannel == m_fillSearchChannel &&
m_decor[pos.x/2][pos.y/2].objectIcon == m_fillSearchIcon &&
!IsBlupiHereEx(GetCel(pos.x+0,pos.y+0),
GetCel(pos.x+1,pos.y+1), -1, FALSE) )
GetCel(pos.x+1,pos.y+1), -1, false) )
{
if ( m_decor[pos.x/2][pos.y/2].floorChannel == CHFLOOR &&
m_decor[pos.x/2][pos.y/2].floorIcon >= 2 &&
m_decor[pos.x/2][pos.y/2].floorIcon <= 14 ) // rive ou eau ?
{
return FALSE;
return false;
}
return TRUE;
return true;
}
}
return FALSE;
return false;
}
// Modifie le décor lors d'un remplissage.
@ -916,7 +916,7 @@ void CDecor::ArrangeFillSearch(POINT pos)
// Rempli un sol à partir d'une position donnée.
void CDecor::ArrangeFill(POINT pos, int channel, int icon, BOOL bFloor)
void CDecor::ArrangeFill(POINT pos, int channel, int icon, bool bFloor)
{
m_bFillFloor = bFloor;
@ -969,7 +969,7 @@ void CDecor::ArrangeBlupi()
{
if ( !IsFreeCel(m_blupi[rank].cel, rank) )
{
m_blupi[rank].bExist = FALSE;
m_blupi[rank].bExist = false;
}
}
}

126
blupi.cpp
View File

@ -37,13 +37,13 @@ CSound* g_pSound = NULL; // sound principal
CMovie* g_pMovie = NULL; // movie principal
CDecor* g_pDecor = NULL;
char g_CDPath[MAX_PATH]; // chemin d'accès au CD-Rom
BOOL g_bFullScreen = FALSE; // FALSE si mode de test
bool g_bFullScreen = false; // false si mode de test
int g_speedRate = 1;
int g_timerInterval = 50; // inverval = 50ms
int g_mouseType = MOUSETYPEGRA;
MMRESULT g_updateTimer; // timer général
BOOL g_bActive = TRUE; // is application active ?
BOOL g_bTermInit = FALSE; // initialisation en cours
bool g_bActive = true; // is application active ?
bool g_bTermInit = false; // initialisation en cours
UINT g_lastPhase = 999;
@ -67,7 +67,7 @@ int GetNum(char *p)
// Lit le fichier de configuration.
BOOL ReadConfig(LPSTR lpCmdLine)
bool ReadConfig(LPSTR lpCmdLine)
{
FILE* file = NULL;
char buffer[200];
@ -75,7 +75,7 @@ BOOL ReadConfig(LPSTR lpCmdLine)
int nb;
file = fopen("data\\config.def", "rb");
if ( file == NULL ) return FALSE;
if ( file == NULL ) return false;
nb = fread(buffer, sizeof(char), 200-1, file);
buffer[nb] = 0;
fclose(file);
@ -93,7 +93,7 @@ BOOL ReadConfig(LPSTR lpCmdLine)
g_CDPath[i] = 0; // met le terminateur
}
#else
return FALSE;
return false;
#endif
}
else
@ -122,7 +122,7 @@ BOOL ReadConfig(LPSTR lpCmdLine)
drive[2] = '\\';
drive[3] = 0;
nb = GetDriveType(drive);
if ( nb != DRIVE_CDROM ) return FALSE;
if ( nb != DRIVE_CDROM ) return false;
}
#endif
#endif
@ -146,7 +146,7 @@ BOOL ReadConfig(LPSTR lpCmdLine)
pText = strstr(buffer, "FullScreen=");
if ( pText != NULL )
{
g_bFullScreen = GetNum(pText+11);
g_bFullScreen = !!GetNum(pText+11);
if ( g_bFullScreen != 0 ) g_bFullScreen = 1;
}
@ -158,7 +158,7 @@ BOOL ReadConfig(LPSTR lpCmdLine)
if ( g_mouseType > 9 ) g_mouseType = 9;
}
return TRUE;
return true;
}
@ -297,9 +297,9 @@ void Benchmark()
// Restitue le jeu après une activation en mode fullScreen.
BOOL RestoreGame()
bool RestoreGame()
{
if ( g_pPixmap == NULL ) return FALSE;
if ( g_pPixmap == NULL ) return false;
g_pEvent->RestoreGame();
return g_pPixmap->Restore();
@ -307,9 +307,9 @@ BOOL RestoreGame()
// Libère le jeu avant une désactivation en mode fullScreen.
BOOL FlushGame()
bool FlushGame()
{
if ( g_pPixmap == NULL ) return FALSE;
if ( g_pPixmap == NULL ) return false;
return g_pPixmap->Flush();
}
@ -417,7 +417,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
totalDim.y = 66;
iconDim.x = 64;
iconDim.y = 66/2;
g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, TRUE);
g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, true);
g_pPixmap->SetTransparent(CHHILI, RGB(0,0,255)); // bleu
g_pPixmap->SavePalette();
@ -485,7 +485,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
case WM_SETCURSOR:
// ChangeSprite();
// SetCursor(NULL); // pas de souris visible !
return TRUE;
return true;
case WM_LBUTTONDOWN:
//? Benchmark();
@ -544,7 +544,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
// Erreur dans DoInit.
BOOL InitFail(char *msg, BOOL bDirectX)
bool InitFail(char *msg, bool bDirectX)
{
char buffer[100];
@ -556,17 +556,17 @@ BOOL InitFail(char *msg, BOOL bDirectX)
FinishObjects();
DestroyWindow(g_hWnd);
return FALSE;
return false;
}
// Initialisation de l'application.
static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASS wc;
POINT totalDim, iconDim;
RECT rcRect;
BOOL bOK;
bool bOK;
bOK = ReadConfig(lpCmdLine); // lit le fichier config.def
@ -614,7 +614,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
SetRect(&WindowRect, (sx-LXIMAGE)/2, (sy-LYIMAGE)/2,
(sx+LXIMAGE)/2, (sy+LYIMAGE)/2);
AdjustWindowRect(&WindowRect, WS_POPUPWINDOW|WS_CAPTION, TRUE);
AdjustWindowRect(&WindowRect, WS_POPUPWINDOW|WS_CAPTION, true);
WindowRect.top += GetSystemMetrics(SM_CYCAPTION);
g_hWnd = CreateWindow
@ -631,7 +631,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
NULL
);
}
if ( !g_hWnd ) return FALSE;
if ( !g_hWnd ) return false;
ShowWindow(g_hWnd, nCmdShow);
UpdateWindow(g_hWnd);
@ -641,17 +641,17 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
if ( !bOK ) // config.def pas correct ?
{
return InitFail("Game not correctly installed", FALSE);
return InitFail("Game not correctly installed", false);
}
// Crée le pixmap principal.
g_pPixmap = new CPixmap;
if ( g_pPixmap == NULL ) return InitFail("New pixmap", TRUE);
if ( g_pPixmap == NULL ) return InitFail("New pixmap", true);
totalDim.x = LXIMAGE;
totalDim.y = LYIMAGE;
if ( !g_pPixmap->Create(g_hWnd, totalDim, g_bFullScreen, g_mouseType) )
return InitFail("Create pixmap", TRUE);
return InitFail("Create pixmap", true);
OutputDebug("Image: init\n");
totalDim.x = LXIMAGE;
@ -659,11 +659,11 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
iconDim.x = 0;
iconDim.y = 0;
#if _INTRO
if ( !g_pPixmap->Cache(CHBACK, "image\\intro1.blp", totalDim, iconDim, TRUE) )
if ( !g_pPixmap->Cache(CHBACK, "image\\intro1.blp", totalDim, iconDim, true) )
#else
if ( !g_pPixmap->Cache(CHBACK, "image\\init.blp", totalDim, iconDim, TRUE) )
if ( !g_pPixmap->Cache(CHBACK, "image\\init.blp", totalDim, iconDim, true) )
#endif
return FALSE;
return false;
OutputDebug("SavePalette\n");
g_pPixmap->SavePalette();
@ -675,10 +675,10 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
totalDim.y = LYIMAGE;
iconDim.x = 0;
iconDim.y = 0;
if ( !g_pPixmap->Cache(CHGROUND, "image\\init.blp", totalDim, iconDim, TRUE) )
return FALSE;
if ( !g_pPixmap->Cache(CHGROUND, "image\\init.blp", totalDim, iconDim, true) )
return false;
g_pPixmap->SetDebug(FALSE);
g_pPixmap->SetDebug(false);
rcRect.left = 0;
rcRect.top = 0;
@ -691,118 +691,118 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
totalDim.y = DIMCELY*2*6;
iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2;
if ( !g_pPixmap->Cache(CHFLOOR, "image\\floor000.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache floor000.blp", TRUE);
if ( !g_pPixmap->Cache(CHFLOOR, "image\\floor000.blp", totalDim, iconDim, false) )
return InitFail("Cache floor000.blp", true);
g_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu
totalDim.x = DIMOBJX*16;
totalDim.y = DIMOBJY*8;
iconDim.x = DIMOBJX;
iconDim.y = DIMOBJY;
if ( !g_pPixmap->Cache(CHOBJECT, "image\\obj000.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache obj000.blp", TRUE);
if ( !g_pPixmap->Cache(CHOBJECT, "image\\obj000.blp", totalDim, iconDim, false) )
return InitFail("Cache obj000.blp", true);
g_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu
if ( !g_pPixmap->Cache(CHOBJECTo, "image\\obj-o000.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache obj-o000.blp", TRUE);
if ( !g_pPixmap->Cache(CHOBJECTo, "image\\obj-o000.blp", totalDim, iconDim, false) )
return InitFail("Cache obj-o000.blp", true);
g_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc
totalDim.x = DIMBLUPIX*16;
totalDim.y = DIMBLUPIY*23;
iconDim.x = DIMBLUPIX;
iconDim.y = DIMBLUPIY;
if ( !g_pPixmap->Cache(CHBLUPI, "image\\blupi.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache blupi.blp", TRUE);
if ( !g_pPixmap->Cache(CHBLUPI, "image\\blupi.blp", totalDim, iconDim, false) )
return InitFail("Cache blupi.blp", true);
g_pPixmap->SetTransparent(CHBLUPI, RGB(0,0,255)); // bleu
totalDim.x = 64;
totalDim.y = 66;
iconDim.x = 64;
iconDim.y = 66/2;
if ( !g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache hili.blp", TRUE);
if ( !g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, false) )
return InitFail("Cache hili.blp", true);
g_pPixmap->SetTransparent(CHHILI, RGB(0,0,255)); // bleu
totalDim.x = DIMCELX*2*3;
totalDim.y = DIMCELY*2*5;
iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2;
if ( !g_pPixmap->Cache(CHFOG, "image\\fog.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache fog.blp", TRUE);
if ( !g_pPixmap->Cache(CHFOG, "image\\fog.blp", totalDim, iconDim, false) )
return InitFail("Cache fog.blp", true);
g_pPixmap->SetTransparent(CHFOG, RGB(255,255,255)); // blanc
totalDim.x = DIMCELX*2*16;
totalDim.y = DIMCELY*2*1;
iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2;
if ( !g_pPixmap->Cache(CHMASK1, "image\\mask1.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache mask1.blp", TRUE);
if ( !g_pPixmap->Cache(CHMASK1, "image\\mask1.blp", totalDim, iconDim, false) )
return InitFail("Cache mask1.blp", true);
g_pPixmap->SetTransparent(CHMASK1, RGB(0,0,0)); // noir
totalDim.x = DIMBUTTONX*6;
totalDim.y = DIMBUTTONY*21;
iconDim.x = DIMBUTTONX;
iconDim.y = DIMBUTTONY;
if ( !g_pPixmap->Cache(CHBUTTON, "image\\button00.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache button00.blp", TRUE);
if ( !g_pPixmap->Cache(CHBUTTON, "image\\button00.blp", totalDim, iconDim, false) )
return InitFail("Cache button00.blp", true);
g_pPixmap->SetTransparent(CHBUTTON, RGB(0,0,255)); // bleu
totalDim.x = DIMJAUGEX*1;
totalDim.y = DIMJAUGEY*4;
iconDim.x = DIMJAUGEX;
iconDim.y = DIMJAUGEY;
if ( !g_pPixmap->Cache(CHJAUGE, "image\\jauge.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache jauge.blp", TRUE);
if ( !g_pPixmap->Cache(CHJAUGE, "image\\jauge.blp", totalDim, iconDim, false) )
return InitFail("Cache jauge.blp", true);
g_pPixmap->SetTransparent(CHJAUGE, RGB(0,0,255)); // bleu
totalDim.x = DIMTEXTX*16;
totalDim.y = DIMTEXTY*8*3;
iconDim.x = DIMTEXTX;
iconDim.y = DIMTEXTY;
if ( !g_pPixmap->Cache(CHTEXT, "image\\text.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache text.blp", TRUE);
if ( !g_pPixmap->Cache(CHTEXT, "image\\text.blp", totalDim, iconDim, false) )
return InitFail("Cache text.blp", true);
g_pPixmap->SetTransparent(CHTEXT, RGB(0,0,255)); // bleu
totalDim.x = DIMLITTLEX*16;
totalDim.y = DIMLITTLEY*8;
iconDim.x = DIMLITTLEX;
iconDim.y = DIMLITTLEY;
if ( !g_pPixmap->Cache(CHLITTLE, "image\\little.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache little.blp", TRUE);
if ( !g_pPixmap->Cache(CHLITTLE, "image\\little.blp", totalDim, iconDim, false) )
return InitFail("Cache little.blp", true);
g_pPixmap->SetTransparent(CHLITTLE, RGB(0,0,255)); // bleu
totalDim.x = 426;
totalDim.y = 52;
iconDim.x = 426;
iconDim.y = 52;
if ( !g_pPixmap->Cache(CHBIGNUM, "image\\bignum.blp", totalDim, iconDim, FALSE) )
return InitFail("Cache bignum.blp", TRUE);
if ( !g_pPixmap->Cache(CHBIGNUM, "image\\bignum.blp", totalDim, iconDim, false) )
return InitFail("Cache bignum.blp", true);
g_pPixmap->SetTransparent(CHBIGNUM, RGB(0,0,255)); // bleu
// Crée le gestionnaire de son.
g_pSound = new CSound;
if ( g_pSound == NULL ) return InitFail("New sound", TRUE);
if ( g_pSound == NULL ) return InitFail("New sound", true);
g_pSound->Create(g_hWnd);
g_pSound->CacheAll();
g_pSound->SetState(TRUE);
g_pSound->SetState(true);
// Crée le gestionnaire de films.
g_pMovie = new CMovie;
if ( g_pMovie == NULL ) return InitFail("New movie", FALSE);
if ( g_pMovie == NULL ) return InitFail("New movie", false);
g_pMovie->Create();
// Crée le gestionnaire de décors.
g_pDecor = new CDecor;
if ( g_pDecor == NULL ) return InitFail("New decor", FALSE);
if ( g_pDecor == NULL ) return InitFail("New decor", false);
g_pDecor->Create(g_hWnd, g_pSound, g_pPixmap);
g_pDecor->MapInitColors();
// Crée le gestionnaire d'événements.
g_pEvent = new CEvent;
if ( g_pEvent == NULL ) return InitFail("New event", FALSE);
if ( g_pEvent == NULL ) return InitFail("New event", false);
g_pEvent->Create(g_hWnd, g_pPixmap, g_pDecor, g_pSound, g_pMovie);
g_pEvent->SetFullScreen(g_bFullScreen);
@ -813,8 +813,8 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
g_pEvent->ChangePhase(WM_PHASE_TESTCD);
#endif
g_bTermInit = TRUE; // initialisation terminée
return TRUE;
g_bTermInit = true; // initialisation terminée
return true;
}
@ -827,12 +827,12 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
if ( !DoInit(hInstance, lpCmdLine, nCmdShow) )
{
return FALSE;
return false;
}
SetTimer(g_hWnd, 1, g_timerInterval, NULL);
while ( TRUE )
while ( true )
{
if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
{

View File

@ -20,16 +20,16 @@
CButton::CButton()
{
m_type = 0;
m_bEnable = TRUE;
m_bHide = FALSE;
m_bEnable = true;
m_bHide = false;
m_state = 0;
m_mouseState = 0;
m_nbMenu = 0;
m_nbToolTips = 0;
m_selMenu = 0;
m_bMouseDown = FALSE;
m_bMinimizeRedraw = FALSE;
m_bRedraw = FALSE;
m_bMouseDown = false;
m_bMinimizeRedraw = false;
m_bRedraw = false;
}
// Destructeur.
@ -41,8 +41,8 @@ CButton::~CButton()
// Crée un nouveau bouton.
BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int type, BOOL bMinimizeRedraw,
bool CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int type, bool bMinimizeRedraw,
int *pMenu, int nbMenu,
int *pToolTips, int nbToolTips,
int region, UINT message)
@ -55,7 +55,7 @@ BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
DIMBUTTONX,DIMBUTTONY, // button00.bmp
};
if ( type < 0 || type > 0 ) return FALSE;
if ( type < 0 || type > 0 ) return false;
iconDim.x = ttypes[type*2+0];
iconDim.y = ttypes[type*2+1];
@ -65,8 +65,8 @@ BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
m_pSound = pSound;
m_type = type;
m_bMinimizeRedraw = bMinimizeRedraw;
m_bEnable = TRUE;
m_bHide = FALSE;
m_bEnable = true;
m_bHide = false;
m_message = message;
m_pos = pos;
m_dim = iconDim;
@ -75,8 +75,8 @@ BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
m_selMenu = 0;
m_state = 0;
m_mouseState = 0;
m_bMouseDown = FALSE;
m_bRedraw = TRUE;
m_bMouseDown = false;
m_bRedraw = true;
for ( i=0 ; i<nbMenu ; i++ )
{
@ -115,7 +115,7 @@ BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
m_toolTips[i] = pToolTips[i];
}
return TRUE;
return true;
}
// Dessine un bouton dans son état.
@ -127,7 +127,7 @@ void CButton::Draw()
RECT rect;
if ( m_bMinimizeRedraw && !m_bRedraw ) return;
m_bRedraw = FALSE;
m_bRedraw = false;
if ( m_bHide ) // bouton caché ?
{
@ -171,7 +171,7 @@ void CButton::Draw()
void CButton::Redraw()
{
m_bRedraw = TRUE;
m_bRedraw = true;
}
int CButton::GetState()
@ -184,7 +184,7 @@ void CButton::SetState(int state)
if ( m_state != state ||
m_mouseState != state )
{
m_bRedraw = TRUE;
m_bRedraw = true;
}
m_state = state;
@ -200,39 +200,39 @@ void CButton::SetMenu(int menu)
{
if ( m_selMenu != menu )
{
m_bRedraw = TRUE;
m_bRedraw = true;
}
m_selMenu = menu;
}
BOOL CButton::GetEnable()
bool CButton::GetEnable()
{
return m_bEnable;
}
void CButton::SetEnable(BOOL bEnable)
void CButton::SetEnable(bool bEnable)
{
if ( m_bEnable != bEnable )
{
m_bRedraw = TRUE;
m_bRedraw = true;
}
m_bEnable = bEnable;
}
BOOL CButton::GetHide()
bool CButton::GetHide()
{
return m_bHide;
}
void CButton::SetHide(BOOL bHide)
void CButton::SetHide(bool bHide)
{
if ( m_bHide != bHide )
{
m_bRedraw = TRUE;
m_bRedraw = true;
}
m_bHide = bHide;
@ -241,11 +241,11 @@ void CButton::SetHide(BOOL bHide)
// Traitement d'un événement.
BOOL CButton::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
bool CButton::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
{
POINT pos;
if ( m_bHide || !m_bEnable ) return FALSE;
if ( m_bHide || !m_bEnable ) return false;
pos = ConvLongToPos(lParam);
@ -253,20 +253,20 @@ BOOL CButton::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
{
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
if ( MouseDown(pos) ) return TRUE;
if ( MouseDown(pos) ) return true;
break;
case WM_MOUSEMOVE:
if ( MouseMove(pos) ) return TRUE;
if ( MouseMove(pos) ) return true;
break;
case WM_LBUTTONUP:
case WM_RBUTTONUP:
if ( MouseUp(pos) ) return FALSE; // (*)
if ( MouseUp(pos) ) return false; // (*)
break;
}
return FALSE;
return false;
}
// (*) Tous les boutons doivent recevoir l'événement BUTTONUP !
@ -274,7 +274,7 @@ BOOL CButton::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
// Indique si la souris est sur ce bouton.
BOOL CButton::MouseOnButton(POINT pos)
bool CButton::MouseOnButton(POINT pos)
{
return Detect(pos);
}
@ -322,11 +322,11 @@ int CButton::GetToolTips(POINT pos)
// Détecte si la souris est dans le bouton.
BOOL CButton::Detect(POINT pos)
bool CButton::Detect(POINT pos)
{
int width = m_dim.x;
if ( m_bHide || !m_bEnable ) return FALSE;
if ( m_bHide || !m_bEnable ) return false;
if ( m_nbMenu > 1 && m_bMouseDown ) // sous-menu déroulé ?
{
@ -336,31 +336,31 @@ BOOL CButton::Detect(POINT pos)
if ( pos.x < m_pos.x ||
pos.x > m_pos.x+width ||
pos.y < m_pos.y ||
pos.y > m_pos.y+m_dim.y ) return FALSE;
pos.y > m_pos.y+m_dim.y ) return false;
return TRUE;
return true;
}
// Bouton de la souris pressé.
BOOL CButton::MouseDown(POINT pos)
bool CButton::MouseDown(POINT pos)
{
if ( !Detect(pos) ) return FALSE;
if ( !Detect(pos) ) return false;
m_mouseState = 1;
m_bMouseDown = TRUE;
m_bRedraw = TRUE;
m_bMouseDown = true;
m_bRedraw = true;
PostMessage(m_hWnd, WM_UPDATE, 0, 0);
m_pSound->PlayImage(SOUND_CLICK, pos);
return TRUE;
return true;
}
// Souris déplacés.
BOOL CButton::MouseMove(POINT pos)
bool CButton::MouseMove(POINT pos)
{
BOOL bDetect;
bool bDetect;
int iState, iMenu;
iState = m_mouseState;
@ -393,7 +393,7 @@ BOOL CButton::MouseMove(POINT pos)
if ( iState != m_mouseState ||
iMenu != m_selMenu )
{
m_bRedraw = TRUE;
m_bRedraw = true;
PostMessage(m_hWnd, WM_UPDATE, 0, 0);
}
@ -402,24 +402,24 @@ BOOL CButton::MouseMove(POINT pos)
// Bouton de la souris relâché.
BOOL CButton::MouseUp(POINT pos)
bool CButton::MouseUp(POINT pos)
{
BOOL bDetect;
bool bDetect;
bDetect = Detect(pos);
m_mouseState = m_state;
m_bMouseDown = FALSE;
m_bRedraw = TRUE;
m_bMouseDown = false;
m_bRedraw = true;
if ( !bDetect ) return FALSE;
if ( !bDetect ) return false;
if ( m_message != -1 )
{
PostMessage(m_hWnd, m_message, 0, 0);
}
return TRUE;
return true;
}

View File

@ -10,8 +10,8 @@ public:
CButton();
~CButton();
BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int type, BOOL bMinimizeRedraw,
bool Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int type, bool bMinimizeRedraw,
int *pMenu, int nbMenu,
int *pTooltips, int nbToolTips,
int region, UINT message);
@ -24,22 +24,22 @@ public:
int GetMenu();
void SetMenu(int menu);
BOOL GetEnable();
void SetEnable(BOOL bEnable);
bool GetEnable();
void SetEnable(bool bEnable);
BOOL GetHide();
void SetHide(BOOL bHide);
bool GetHide();
void SetHide(bool bHide);
BOOL TreatEvent(UINT message, WPARAM wParam, LPARAM lParam);
BOOL MouseOnButton(POINT pos);
bool TreatEvent(UINT message, WPARAM wParam, LPARAM lParam);
bool MouseOnButton(POINT pos);
int GetToolTips(POINT pos);
protected:
BOOL Detect(POINT pos);
BOOL MouseDown(POINT pos);
BOOL MouseMove(POINT pos);
BOOL MouseUp(POINT pos);
bool Detect(POINT pos);
bool MouseDown(POINT pos);
bool MouseMove(POINT pos);
bool MouseUp(POINT pos);
protected:
HWND m_hWnd;
@ -47,8 +47,8 @@ protected:
CDecor* m_pDecor;
CSound* m_pSound;
int m_type; // type de bouton
BOOL m_bEnable; // TRUE si bouton actif
BOOL m_bHide; // TRUE si bouton caché
bool m_bEnable; // true si bouton actif
bool m_bHide; // true si bouton caché
UINT m_message; // message envoyé si bouton actionné
POINT m_pos; // coin sup/gauche
POINT m_dim; // dimensions
@ -59,9 +59,9 @@ protected:
int m_nbMenu; // nb de case du sous-menu
int m_nbToolTips; // nb d'info-bulles
int m_selMenu; // sous-menu sélectionné
BOOL m_bMouseDown; // TRUE -> bouton souris pressé
BOOL m_bMinimizeRedraw;
BOOL m_bRedraw; // TRUE -> doit être redessiné
bool m_bMouseDown; // true -> bouton souris pressé
bool m_bMinimizeRedraw;
bool m_bRedraw; // true -> doit être redessiné
};
/////////////////////////////////////////////////////////////////////////////

View File

@ -39,7 +39,7 @@ void CDecor::CheminMemPos(int exRank)
// Teste si une positiion est occupée par un blupi.
BOOL CDecor::CheminTestPos(POINT pos, int &rank)
bool CDecor::CheminTestPos(POINT pos, int &rank)
{
int i;
@ -49,11 +49,11 @@ BOOL CDecor::CheminTestPos(POINT pos, int &rank)
pos.y == m_cheminPos[i].y )
{
rank = m_cheminRank[i];
return TRUE;
return true;
}
}
return FALSE;
return false;
}
@ -72,7 +72,7 @@ int CDecor::CheminARebours(int rank)
if ( rebours == 0 ) return -1;
while ( TRUE )
while ( true )
{
bis:
for ( set=0 ; set<2 ; set++ )
@ -180,12 +180,12 @@ void CDecor::CheminFillTerrain(int rank)
// et le "prix à payer" pour aller dans cette direction
// coût doit être déterminé en sortie
BOOL CDecor::CheminTestDirection(int rank, int pos, int dir,
bool CDecor::CheminTestDirection(int rank, int pos, int dir,
int &next, int &ampli,
int &cout, int &action)
{
POINT cel, vector, newCel;
BOOL bFree;
bool bFree;
int tryDirect, workBlupi, rankHere;
cel.x = pos%MAXCELX;
@ -226,7 +226,7 @@ BOOL CDecor::CheminTestDirection(int rank, int pos, int dir,
m_blupi[rank].passCel.y/2 == (cel.y+vector.y*ampli)/2 &&
(workBlupi < 0 || workBlupi == rank) )
{
bFree = TRUE;
bFree = true;
cout = 1;
}
}
@ -240,35 +240,35 @@ BOOL CDecor::CheminTestDirection(int rank, int pos, int dir,
{
// Le tracks peut aller sur les blupi
// pour les écraser !
if ( IsTracksHere(newCel, FALSE) ) // autre perso ici ?
if ( IsTracksHere(newCel, false) ) // autre perso ici ?
{
return FALSE;
return false;
}
}
else
{
//? if ( IsBlupiHere(newCel, FALSE) ) // autre perso ici ?
//? if ( IsBlupiHere(newCel, false) ) // autre perso ici ?
if ( CheminTestPos(newCel, rankHere) ) // autre perso ici ?
{
// Si blupi immobile, comme si obstacle qq.
//? if ( m_blupi[m_blupiHere].goalCel.x == -1 ) return FALSE;
if ( m_blupi[rankHere].goalCel.x == -1 ) return FALSE;
//? if ( m_blupi[m_blupiHere].goalCel.x == -1 ) return false;
if ( m_blupi[rankHere].goalCel.x == -1 ) return false;
// Si blupi mobile, possible mais coût élevé.
cout = 20;
}
}
next = vector.y*MAXCELX + vector.x;
return TRUE;
return true;
}
return FALSE;
return false;
}
// Retourne TRUE si on a assigné une nouvelle direction à blupi.
BOOL CDecor::CheminCherche(int rank, int &action)
// Retourne true si on a assigné une nouvelle direction à blupi.
bool CDecor::CheminCherche(int rank, int &action)
{
int cout; // prix pour aller dans une direction
int pos, dir, next, ampli;
@ -277,13 +277,13 @@ BOOL CDecor::CheminCherche(int rank, int &action)
if ( m_blupi[rank].cel.x == m_blupi[rank].goalCel.x &&
m_blupi[rank].cel.y == m_blupi[rank].goalCel.y )
{
return FALSE;
return false;
}
// Destination occupée ?
if ( IsBlupiHereEx(m_blupi[rank].goalCel, rank, FALSE) )
if ( IsBlupiHereEx(m_blupi[rank].goalCel, rank, false) )
{
return FALSE;
return false;
}
memset(m_cheminWork, 0, (BYTE)MAXCELX*(BYTE)MAXCELY);
@ -295,30 +295,30 @@ BOOL CDecor::CheminCherche(int rank, int &action)
// cherche le chemin à partir de la destination
dir = CheminARebours(rank);
if ( dir < 0 ) return FALSE;
if ( dir < 0 ) return false;
pos = m_blupi[rank].cel.y*MAXCELX + m_blupi[rank].cel.x;
if ( CheminTestDirection(rank, pos, dir, next, ampli, cout, action) &&
cout < 20 )
{
m_blupi[rank].sDirect = 16*dir;
return TRUE;
return true;
}
// ne devrait jamais arriver !
return FALSE;
return false;
}
// Teste s'il est possible de se rendre à un endroit donné.
BOOL CDecor::IsCheminFree(int rank, POINT dest, int button)
bool CDecor::IsCheminFree(int rank, POINT dest, int button)
{
int action, sDirect;
POINT goalCel, passCel, limit;
BOOL bOK;
bool bOK;
if ( button == BUTTON_STOP ) return TRUE;
if ( button == BUTTON_STOP ) return true;
goalCel = m_blupi[rank].goalCel;
passCel = m_blupi[rank].passCel;
@ -349,7 +349,7 @@ BOOL CDecor::IsCheminFree(int rank, POINT dest, int button)
}
if ( m_blupi[rank].cel.x == dest.x &&
m_blupi[rank].cel.y == dest.y ) return TRUE;
m_blupi[rank].cel.y == dest.y ) return true;
m_blupi[rank].goalCel = dest;
if ( m_decor[dest.x/2][dest.y/2].objectChannel == CHOBJECT &&

View File

@ -19,9 +19,9 @@
// First-chance exception in Blupi.exe (GDI32.DLL): 0xC0000005: Access Violation.
// apparaît au endroits marqués par (@) ...
BOOL g_bDebug = TRUE;
bool g_bDebug = true;
void DDSetDebug(BOOL bDebug)
void DDSetDebug(bool bDebug)
{
g_bDebug = bDebug;
}

View File

@ -13,7 +13,7 @@
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
extern void DDSetDebug(BOOL bDebug);
extern void DDSetDebug(bool bDebug);
extern IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm);
extern IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap);
extern IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -32,8 +32,8 @@ DescFile;
typedef struct
{
BOOL bExist; // TRUE -> utilisé
BOOL bHili; // TRUE -> sélectionné
int bExist; // true -> utilisé
int bHili; // true -> sélectionné
short perso; // personnage, voir (*)
@ -73,14 +73,14 @@ typedef struct
short jaugePhase;
short jaugeMax;
short stop; // 1 -> devra stopper
short bArrow; // TRUE -> flèche en dessus de blupi
short bRepeat; // TRUE -> répète l'action
short bArrow; // true -> flèche en dessus de blupi
short bRepeat; // true -> répète l'action
short nLoop; // nb de boucles pour GOAL_OTHERLOOP
short cLoop; // boucle en cours
short vIcon; // icône variable
POINT goalHili; // but visé
short bMalade; // TRUE -> blupi malade
short bCache; // TRUE -> caché (pas dessiné)
short bMalade; // true -> blupi malade
short bCache; // true -> caché (pas dessiné)
short vehicule; // véhicule utilisé par blupi, voir (**)
char busyCount;
char busyDelay;
@ -93,7 +93,7 @@ OldBlupi;
// Sauve le décor sur disque.
BOOL CDecor::Write(int rank, BOOL bUser, int world, int time, int total)
bool CDecor::Write(int rank, bool bUser, int world, int time, int total)
{
char filename[MAX_PATH];
FILE* file = NULL;
@ -165,17 +165,17 @@ BOOL CDecor::Write(int rank, BOOL bUser, int world, int time, int total)
free(pBuffer);
fclose(file);
return TRUE;
return true;
error:
if ( pBuffer != NULL ) free(pBuffer);
if ( file != NULL ) fclose(file);
return FALSE;
return false;
}
// Lit le décor sur disque.
BOOL CDecor::Read(int rank, BOOL bUser, int &world, int &time, int &total)
bool CDecor::Read(int rank, bool bUser, int &world, int &time, int &total)
{
char filename[MAX_PATH];
FILE* file = NULL;
@ -307,19 +307,19 @@ BOOL CDecor::Read(int rank, BOOL bUser, int &world, int &time, int &total)
free(pBuffer);
fclose(file);
return TRUE;
return true;
error:
if ( pBuffer != NULL ) free(pBuffer);
if ( file != NULL ) fclose(file);
Flush(); // initialise un décor neutre
return FALSE;
return false;
}
// Indique si un fichier existe sur disque.
BOOL CDecor::FileExist(int rank, BOOL bUser, int &world, int &time, int &total)
bool CDecor::FileExist(int rank, bool bUser, int &world, int &time, int &total)
{
char filename[MAX_PATH];
FILE* file = NULL;
@ -380,12 +380,12 @@ BOOL CDecor::FileExist(int rank, BOOL bUser, int &world, int &time, int &total)
free(pBuffer);
fclose(file);
return TRUE;
return true;
error:
if ( pBuffer != NULL ) free(pBuffer);
if ( file != NULL ) fclose(file);
return FALSE;
return false;
}
@ -462,7 +462,7 @@ void CDecor::Flush()
for ( i=0 ; i<MAXBLUPI ; i++ )
{
m_blupi[i].bExist = FALSE;
m_blupi[i].bExist = false;
}
BlupiCreate(GetCel(102,100), ACTION_STOP, DIRECT_S, 0, MAXENERGY);
@ -483,7 +483,7 @@ void CDecor::Flush()
}
memset(&m_term, 0, sizeof(Term));
m_term.bHomeBlupi = TRUE;
m_term.bHomeBlupi = true;
m_term.nbMinBlupi = 1;
m_term.nbMaxBlupi = 1;

View File

@ -33,7 +33,7 @@
static char g_map8_bits[DIMMAPY][DIMMAPX];
static unsigned short g_map16_bits[DIMMAPY][DIMMAPX];
static BOOL g_bPalette;
static bool g_bPalette;
@ -127,7 +127,7 @@ POINT CDecor::ConvMapToCel(POINT pos)
// Déplace le décor suite à un clic dans la carte.
BOOL CDecor::MapMove(POINT pos)
bool CDecor::MapMove(POINT pos)
{
POINT cel;
@ -141,10 +141,10 @@ BOOL CDecor::MapMove(POINT pos)
cel.y = cel.y;
SetCoin(cel);
NextPhase(0); // faudra refaire la carte tout de suite
return TRUE;
return true;
}
return FALSE;
return false;
}
@ -494,13 +494,13 @@ void CDecor::MapPutCel(POINT pos)
// Génère la carte.
BOOL CDecor::GenerateMap()
bool CDecor::GenerateMap()
{
HBITMAP hbm;
POINT dim, pos, cel;
int dx, rank, i;
if ( m_phase != -1 && m_phase%20 != 0 ) return TRUE;
if ( m_phase != -1 && m_phase%20 != 0 ) return true;
// Dessine le décor (sol, objets et brouillard).
for ( pos.y=0 ; pos.y<DIMMAPY ; pos.y++ )
@ -581,7 +581,7 @@ BOOL CDecor::GenerateMap()
{
hbm = CreateBitmap(DIMMAPX, DIMMAPY, 1, 16, g_map16_bits);
}
if ( hbm == NULL ) return FALSE;
if ( hbm == NULL ) return false;
dim.x = DIMMAPX;
dim.y = DIMMAPY;
@ -592,6 +592,6 @@ BOOL CDecor::GenerateMap()
m_pPixmap->DrawIcon(-1, CHMAP, 0, pos);
DeleteObject(hbm);
return TRUE;
return true;
}

View File

@ -536,7 +536,7 @@ void CDecor::MoveFlush()
for ( i=0 ; i<MAXMOVE ; i++ )
{
m_move[i].bExist = FALSE;
m_move[i].bExist = false;
}
for ( x=0 ; x<MAXCELX/2 ; x++ )
@ -578,19 +578,19 @@ void CDecor::MoveFixInit()
// Démarre les éclairs entre les tours.
if ( m_decor[x/2][y/2].objectIcon == 10000 ) // éclair n-s
{
if ( MoveCreate(GetCel(x,y), -1, FALSE, CHOBJECT,-1,
-1,-1, 9999,1,0, TRUE) )
if ( MoveCreate(GetCel(x,y), -1, false, CHOBJECT,-1,
-1,-1, 9999,1,0, true) )
{
MoveAddIcons(GetCel(x,y), 4, TRUE); // éclairs n-s
MoveAddIcons(GetCel(x,y), 4, true); // éclairs n-s
}
}
if ( m_decor[x/2][y/2].objectIcon == 10001 ) // éclair e-o
{
if ( MoveCreate(GetCel(x,y), -1, FALSE, CHOBJECT,-1,
-1,-1, 9999,1,0, TRUE) )
if ( MoveCreate(GetCel(x,y), -1, false, CHOBJECT,-1,
-1,-1, 9999,1,0, true) )
{
MoveAddIcons(GetCel(x,y), 5, TRUE); // éclairs e-o
MoveAddIcons(GetCel(x,y), 5, true); // éclairs e-o
}
}
}
@ -598,14 +598,14 @@ void CDecor::MoveFixInit()
}
// Crée un nouveau décor animé.
// Si bMisc=TRUE, on garde 10 mouvements en réserve pour
// des actions importantes (bMisc=FALSE).
// Si bMisc=true, on garde 10 mouvements en réserve pour
// des actions importantes (bMisc=false).
BOOL CDecor::MoveCreate(POINT cel, int rankBlupi, BOOL bFloor,
bool CDecor::MoveCreate(POINT cel, int rankBlupi, bool bFloor,
int channel, int icon,
int maskChannel, int maskIcon,
int total, int delai, int stepY,
BOOL bMisc, BOOL bNotIfExist)
bool bMisc, bool bNotIfExist)
{
int rank, max;
@ -615,7 +615,7 @@ BOOL CDecor::MoveCreate(POINT cel, int rankBlupi, BOOL bFloor,
m_move[rank].cel.x == cel.x &&
m_move[rank].cel.y == cel.y )
{
if ( bNotIfExist ) return FALSE;
if ( bNotIfExist ) return false;
goto create;
}
}
@ -625,15 +625,15 @@ BOOL CDecor::MoveCreate(POINT cel, int rankBlupi, BOOL bFloor,
{
if ( !m_move[rank].bExist )
{
if ( bMisc && max > MAXMOVE-10 ) return FALSE;
if ( bMisc && max > MAXMOVE-10 ) return false;
goto create;
}
max ++;
}
return FALSE;
return false;
create:
m_move[rank].bExist = TRUE;
m_move[rank].bExist = true;
m_move[rank].cel = cel;
m_move[rank].rankBlupi = rankBlupi;
m_move[rank].bFloor = bFloor;
@ -651,12 +651,12 @@ BOOL CDecor::MoveCreate(POINT cel, int rankBlupi, BOOL bFloor,
m_move[rank].phase = 0;
m_decor[cel.x/2][cel.y/2].rankMove = rank;
return TRUE;
return true;
}
// Ajoute un mouvement.
BOOL CDecor::MoveAddMoves(POINT cel, int rankMoves)
bool CDecor::MoveAddMoves(POINT cel, int rankMoves)
{
int rank;
@ -669,16 +669,16 @@ BOOL CDecor::MoveAddMoves(POINT cel, int rankMoves)
m_move[rank].rankMoves = rankMoves;
m_move[rank].phase = 0;
return TRUE;
return true;
}
}
return FALSE;
return false;
}
// Ajoute un mouvement.
BOOL CDecor::MoveAddIcons(POINT cel, int rankIcons, BOOL bContinue)
bool CDecor::MoveAddIcons(POINT cel, int rankIcons, bool bContinue)
{
int rank;
@ -696,17 +696,17 @@ BOOL CDecor::MoveAddIcons(POINT cel, int rankIcons, BOOL bContinue)
m_move[rank].cTotal = Random(0,10);
}
return TRUE;
return true;
}
}
return FALSE;
return false;
}
// Démarre le feu sur une cellule.
// Retourne TRUE si c'est possible.
// Retourne true si c'est possible.
BOOL CDecor::MoveStartFire(POINT cel)
bool CDecor::MoveStartFire(POINT cel)
{
int channel, icon;
@ -727,16 +727,16 @@ BOOL CDecor::MoveStartFire(POINT cel)
icon == 121 || // mine de fer ?
icon == 122) ) // mine de fer ?
{
if ( !MoveCreate(cel, -1, FALSE, CHOBJECT,-1,
-1,-1, 9999,1,0, TRUE) ) return FALSE;
MoveAddIcons(cel, 1, TRUE); // petites flammes
if ( !MoveCreate(cel, -1, false, CHOBJECT,-1,
-1,-1, 9999,1,0, true) ) return false;
MoveAddIcons(cel, 1, true); // petites flammes
m_decor[cel.x/2][cel.y/2].fire = 2;
return TRUE;
return true;
}
// S'il y a un autre objet -> pas de feu !
if ( channel >= 0 ) return FALSE;
if ( channel >= 0 ) return false;
channel = m_decor[cel.x/2][cel.y/2].floorChannel;
icon = m_decor[cel.x/2][cel.y/2].floorIcon;
@ -745,15 +745,15 @@ BOOL CDecor::MoveStartFire(POINT cel)
(icon == 20 || // herbe foncée ?
(icon >= 59 && icon <= 64)) ) // pont ?
{
if ( !MoveCreate(cel, -1, FALSE, CHOBJECT,-1,
-1,-1, 9999,1,0, TRUE) ) return FALSE;
MoveAddIcons(cel, 1, TRUE); // petites flammes
if ( !MoveCreate(cel, -1, false, CHOBJECT,-1,
-1,-1, 9999,1,0, true) ) return false;
MoveAddIcons(cel, 1, true); // petites flammes
m_decor[cel.x/2][cel.y/2].fire = 2;
return TRUE;
return true;
}
return FALSE;
return false;
}
// Démarre le feu si c'est possible par proximité.
@ -850,7 +850,7 @@ void CDecor::MoveFire(int rank)
// Début grandes flammes.
if ( m_decor[x/2][y/2].fire == (MoveMaxFire()-DIMOBJY*2)/2 )
{
MoveAddIcons(GetCel(x,y), 2, TRUE); // grandes flammes
MoveAddIcons(GetCel(x,y), 2, true); // grandes flammes
}
// Début objet squelette.
@ -869,15 +869,15 @@ void CDecor::MoveFire(int rank)
if ( icon == 113 ) newIcon = 15; // maison ?
if ( icon == 121 ) newIcon = 126; // mine de fer ?
if ( icon == 122 ) newIcon = 126; // mine de fer ?
MoveCreate(GetCel(x,y), -1, FALSE, CHOBJECT,newIcon,
MoveCreate(GetCel(x,y), -1, false, CHOBJECT,newIcon,
-1,-1, DIMOBJY*2,1,-1*50);
MoveAddIcons(GetCel(x,y), 2, TRUE); // grandes flammes
MoveAddIcons(GetCel(x,y), 2, true); // grandes flammes
}
// Fin grandes flammes.
if ( m_decor[x/2][y/2].fire == MoveMaxFire()-DIMOBJY )
{
MoveAddIcons(GetCel(x,y), 1, TRUE); // petites flammes
MoveAddIcons(GetCel(x,y), 1, true); // petites flammes
}
// Fin feu.
@ -954,7 +954,7 @@ void CDecor::MoveFire(int rank)
// Fait évoluer tous les décors animés.
void CDecor::MoveStep(BOOL bFirst)
void CDecor::MoveStep(bool bFirst)
{
int rank, rankBlupi;
@ -1033,7 +1033,7 @@ void CDecor::MoveFinish(POINT cel)
}
m_decor[cel.x/2][cel.y/2].rankMove = -1;
m_move[rank].bExist = FALSE;
m_move[rank].bExist = false;
}
}
}
@ -1056,7 +1056,7 @@ void CDecor::MoveFinish(int rankBlupi)
// Vérifie si une cellule est déjà utilisée.
BOOL CDecor::MoveIsUsed(POINT cel)
bool CDecor::MoveIsUsed(POINT cel)
{
int rank;
@ -1066,16 +1066,16 @@ BOOL CDecor::MoveIsUsed(POINT cel)
m_move[rank].cel.x == cel.x &&
m_move[rank].cel.y == cel.y )
{
return TRUE;
return true;
}
}
return FALSE;
return false;
}
// Retourne l'objet en construction à un endroit donné.
BOOL CDecor::MoveGetObject(POINT cel, int &channel, int &icon)
bool CDecor::MoveGetObject(POINT cel, int &channel, int &icon)
{
int rank;
@ -1084,20 +1084,20 @@ BOOL CDecor::MoveGetObject(POINT cel, int &channel, int &icon)
if ( m_move[rank].bExist &&
m_move[rank].cel.x == cel.x &&
m_move[rank].cel.y == cel.y &&
m_move[rank].bFloor == FALSE )
m_move[rank].bFloor == false )
{
channel = m_move[rank].channel;
icon = m_move[rank].icon;
return TRUE;
return true;
}
}
return FALSE;
return false;
}
// Modifie un objet en construction à un endroit donné.
BOOL CDecor::MovePutObject(POINT cel, int channel, int icon)
bool CDecor::MovePutObject(POINT cel, int channel, int icon)
{
int rank;
@ -1106,14 +1106,14 @@ BOOL CDecor::MovePutObject(POINT cel, int channel, int icon)
if ( m_move[rank].bExist &&
m_move[rank].cel.x == cel.x &&
m_move[rank].cel.y == cel.y &&
m_move[rank].bFloor == FALSE )
m_move[rank].bFloor == false )
{
m_move[rank].channel = channel;
m_move[rank].icon = icon;
return TRUE;
return true;
}
}
return FALSE;
return false;
}

210
decor.cpp
View File

@ -45,11 +45,11 @@ POINT GetCel(POINT cel, int x, int y)
// bord (-2) pour permettre de gérer le brouillard proprement
// jusque dans les bords !
BOOL IsValid(POINT cel)
bool IsValid(POINT cel)
{
if ( cel.x < 2 || cel.x >= MAXCELX-2 ||
cel.y < 2 || cel.y >= MAXCELX-2 ) return FALSE;
return TRUE;
cel.y < 2 || cel.y >= MAXCELX-2 ) return false;
return true;
}
// Retourne un vecteur orienté dans une direction donnée.
@ -110,7 +110,7 @@ CDecor::CDecor()
m_celOutline1.x = -1;
m_celOutline2.x = -1;
m_bHiliRect = FALSE; // pas de rectangle de sélection
m_bHiliRect = false; // pas de rectangle de sélection
m_shiftHili = 0;
m_shiftOffset.x = 0;
@ -120,12 +120,12 @@ CDecor::CDecor()
m_rankBlupiHili = -1;
m_rankHili = -1;
m_bFog = FALSE;
m_bBuild = FALSE;
m_bInvincible = FALSE;
m_bSuper = FALSE;
m_bHideTooltips = FALSE;
m_bInfo = FALSE;
m_bFog = false;
m_bBuild = false;
m_bInvincible = false;
m_bSuper = false;
m_bHideTooltips = false;
m_bInfo = false;
m_infoHeight = 100;
m_phase = 0;
m_totalTime = 0;
@ -154,7 +154,7 @@ void CDecor::Create(HWND hWnd, CSound *pSound, CPixmap *pPixmap)
m_hWnd = hWnd;
m_pSound = pSound;
m_pPixmap = pPixmap;
m_bOutline = FALSE;
m_bOutline = false;
}
// Initialise le décor avec un sol plat partout.
@ -188,8 +188,8 @@ void CDecor::Init(int channel, int icon)
}
}
m_bOutline = FALSE;
m_bGroundRedraw = TRUE;
m_bOutline = false;
m_bGroundRedraw = true;
}
// Initialise le décor après une modification.
@ -207,18 +207,18 @@ void CDecor::InitAfterBuild()
void CDecor::ResetHili()
{
m_bHiliRect = FALSE; // plus de rectangle
m_bHiliRect = false; // plus de rectangle
InitOutlineRect();
}
// Charge les images nécessaires au décor.
BOOL CDecor::LoadImages()
bool CDecor::LoadImages()
{
POINT totalDim, iconDim;
char filename[50];
if ( m_region == m_lastRegion ) return TRUE;
if ( m_region == m_lastRegion ) return true;
m_lastRegion = m_region;
totalDim.x = DIMCELX*2*16;
@ -226,8 +226,8 @@ BOOL CDecor::LoadImages()
iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2;
sprintf(filename, "image\\floor%.3d.blp", m_region);
if ( !m_pPixmap->Cache(CHFLOOR, filename, totalDim, iconDim, FALSE) )
return FALSE;
if ( !m_pPixmap->Cache(CHFLOOR, filename, totalDim, iconDim, false) )
return false;
m_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu
totalDim.x = DIMOBJX*16;
@ -235,19 +235,19 @@ BOOL CDecor::LoadImages()
iconDim.x = DIMOBJX;
iconDim.y = DIMOBJY;
sprintf(filename, "image\\obj%.3d.blp", m_region);
if ( !m_pPixmap->Cache(CHOBJECT, filename, totalDim, iconDim, FALSE) )
return FALSE;
if ( !m_pPixmap->Cache(CHOBJECT, filename, totalDim, iconDim, false) )
return false;
m_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu
sprintf(filename, "image\\obj-o%.3d.blp", m_region);
if ( !m_pPixmap->Cache(CHOBJECTo, filename, totalDim, iconDim, FALSE) )
return FALSE;
if ( !m_pPixmap->Cache(CHOBJECTo, filename, totalDim, iconDim, false) )
return false;
m_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc
MapInitColors(); // init les couleurs pour la carte
m_bGroundRedraw = TRUE;
return TRUE;
m_bGroundRedraw = true;
return true;
}
// Met partout du brouillard, sauf aux endroits des blupi.
@ -272,7 +272,7 @@ void CDecor::ClearFog()
}
}
m_bOutline = FALSE;
m_bOutline = false;
}
// Permet de nouveau aux cellules brulées de bruler.
@ -300,39 +300,39 @@ void CDecor::ClearFire()
// Indique le mode jeu/construction.
void CDecor::SetBuild(BOOL bBuild)
void CDecor::SetBuild(bool bBuild)
{
m_bBuild = bBuild;
}
// Indique s'il faut tenir compte du brouillard.
void CDecor::EnableFog(BOOL bEnable)
void CDecor::EnableFog(bool bEnable)
{
m_bFog = bEnable;
m_bOutline = FALSE;
m_bOutline = false;
}
// Gestion du mode invincible.
BOOL CDecor::GetInvincible()
bool CDecor::GetInvincible()
{
return m_bInvincible;
}
void CDecor::SetInvincible(BOOL bInvincible)
void CDecor::SetInvincible(bool bInvincible)
{
m_bInvincible = bInvincible;
}
// Gestion du mode costaud (superblupi).
BOOL CDecor::GetSuper()
bool CDecor::GetSuper()
{
return m_bSuper;
}
void CDecor::SetSuper(BOOL bSuper)
void CDecor::SetSuper(bool bSuper)
{
m_bSuper = bSuper;
}
@ -347,27 +347,27 @@ void CDecor::FlipOutline()
// Initialise un sol dans une cellule.
BOOL CDecor::PutFloor(POINT cel, int channel, int icon)
bool CDecor::PutFloor(POINT cel, int channel, int icon)
{
if ( cel.x < 0 || cel.x >= MAXCELX ||
cel.y < 0 || cel.y >= MAXCELY ) return FALSE;
cel.y < 0 || cel.y >= MAXCELY ) return false;
m_decor[cel.x/2][cel.y/2].floorChannel = channel;
m_decor[cel.x/2][cel.y/2].floorIcon = icon;
m_bGroundRedraw = TRUE;
m_bGroundRedraw = true;
//? SubDrapeau(cel); // on pourra de nouveau planter un drapeau
return TRUE;
return true;
}
// Initialise un objet dans une cellule.
BOOL CDecor::PutObject(POINT cel, int channel, int icon)
bool CDecor::PutObject(POINT cel, int channel, int icon)
{
if ( cel.x < 0 || cel.x >= MAXCELX ||
cel.y < 0 || cel.y >= MAXCELY ) return FALSE;
cel.y < 0 || cel.y >= MAXCELY ) return false;
if ( icon == -1 ) channel = -1;
@ -376,45 +376,45 @@ BOOL CDecor::PutObject(POINT cel, int channel, int icon)
SubDrapeau(cel); // on pourra de nouveau planter un drapeau
return TRUE;
return true;
}
// Retourne un sol dans une cellule.
BOOL CDecor::GetFloor(POINT cel, int &channel, int &icon)
bool CDecor::GetFloor(POINT cel, int &channel, int &icon)
{
if ( cel.x < 0 || cel.x >= MAXCELX ||
cel.y < 0 || cel.y >= MAXCELY ) return FALSE;
cel.y < 0 || cel.y >= MAXCELY ) return false;
channel = m_decor[cel.x/2][cel.y/2].floorChannel;
icon = m_decor[cel.x/2][cel.y/2].floorIcon;
return TRUE;
return true;
}
// Retourne une objet dans une cellule.
BOOL CDecor::GetObject(POINT cel, int &channel, int &icon)
bool CDecor::GetObject(POINT cel, int &channel, int &icon)
{
if ( cel.x < 0 || cel.x >= MAXCELX ||
cel.y < 0 || cel.y >= MAXCELY ) return FALSE;
cel.y < 0 || cel.y >= MAXCELY ) return false;
channel = m_decor[cel.x/2][cel.y/2].objectChannel;
icon = m_decor[cel.x/2][cel.y/2].objectIcon;
return TRUE;
return true;
}
// Modifie le feu pour une cellule.
BOOL CDecor::SetFire(POINT cel, BOOL bFire)
bool CDecor::SetFire(POINT cel, bool bFire)
{
if ( cel.x < 0 || cel.x >= MAXCELX ||
cel.y < 0 || cel.y >= MAXCELY ) return FALSE;
cel.y < 0 || cel.y >= MAXCELY ) return false;
m_decor[cel.x/2][cel.y/2].fire = bFire?1:0;
return TRUE;
return true;
}
@ -423,7 +423,7 @@ BOOL CDecor::SetFire(POINT cel, BOOL bFire)
void CDecor::SetShiftOffset(POINT offset)
{
m_shiftOffset = offset;
m_bGroundRedraw = TRUE;
m_bGroundRedraw = true;
}
// Convertit la position d'une cellule en coordonnée graphique.
@ -443,7 +443,7 @@ POINT CDecor::ConvCelToPos(POINT cel)
// Convertit une coordonnée graphique en cellule.
POINT CDecor::ConvPosToCel(POINT pos, BOOL bMap)
POINT CDecor::ConvPosToCel(POINT pos, bool bMap)
{
POINT cel;
@ -650,7 +650,7 @@ void CDecor::BuildMoveFloor(int x, int y, POINT pos, int rank)
m_move[rank].icon, 0);
m_pPixmap->DrawIcon(-1, m_move[rank].channel, 0,
pos, 0, TRUE);
pos, 0, true);
}
else
{
@ -1004,7 +1004,7 @@ void CDecor::BuildGround(RECT clip)
}
}
m_bGroundRedraw = FALSE;
m_bGroundRedraw = false;
}
// Construit le décor dans un pixmap.
@ -1623,10 +1623,10 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
int x, y, i, j, channel, icon, nb, start, direct;
int error = 0;
BOOL bStrong = FALSE;
BOOL bTransport = FALSE;
BOOL bVehicule = FALSE;
BOOL bVehiculeA = FALSE;
bool bStrong = false;
bool bTransport = false;
bool bVehicule = false;
bool bVehiculeA = false;
POINT vector;
for ( x=0 ; x<4 ; x++ )
@ -1657,26 +1657,26 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
if ( m_blupi[rank].energy > MAXENERGY/4 ) // blupi fort ?
{
bStrong = TRUE;
bStrong = true;
}
if ( m_blupi[rank].takeChannel != -1 ) // porte qq chose ?
{
bTransport = TRUE;
bTransport = true;
}
if ( m_blupi[rank].vehicule != 0 ) // pas à pied ?
{
bVehicule = TRUE;
bVehicule = true;
}
if ( m_blupi[rank].vehicule != 0 && // pas à pied ?
m_blupi[rank].vehicule != 3 ) // pas armure ?
{
bVehiculeA = TRUE;
bVehiculeA = true;
}
}
if ( action == 0 )
{
if ( IsBlupiHere(cel, FALSE) )
if ( IsBlupiHere(cel, false) )
{
icons[1][1] = ICON_HILI_SEL;
}
@ -1758,7 +1758,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
if ( ((m_blupi[rank].takeChannel == -1) ||
(m_blupi[rank].energy > MAXENERGY/4)) &&
IsFreeCelGo(GetCel(cel.x+x,cel.y+y), rank) &&
!IsBlupiHere(GetCel(cel.x+x,cel.y+y), TRUE) )
!IsBlupiHere(GetCel(cel.x+x,cel.y+y), true) )
{
//? icons[1+x][1+y] = ICON_HILI_GO; // flèche
icons[1+x][1+y] = ICON_HILI_OP; // action
@ -1904,7 +1904,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
}
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -1951,7 +1951,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
for ( y=0 ; y<2 ; y++ )
{
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -1963,7 +1963,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
if ( action == WM_ACTION_TOUR )
{
BOOL bTour;
bool bTour;
if ( cel.x%2 != 1 || cel.y%2 != 1 )
{
@ -2018,7 +2018,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
icons[x+1][y+1] = ICON_HILI_ERR; // croix
}
}
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2028,7 +2028,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
if ( error == 0 )
{
bTour = FALSE;
bTour = false;
for ( i=0 ; i<4 ; i++ )
{
vector = GetVector(i*2*16);
@ -2042,13 +2042,13 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
if ( m_decor[x/2][y/2].objectIcon == 27 ) // tour ?
{
bTour = TRUE;
bTour = true;
}
if ( MoveGetObject(GetCel(x,y), channel, icon) &&
channel == CHOBJECT && icon == 27 ) // tour en construction ?
{
bTour = TRUE;
bTour = true;
}
}
}
@ -2093,7 +2093,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
for ( y=0 ; y<2 ; y++ )
{
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2144,7 +2144,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
for ( y=0 ; y<2 ; y++ )
{
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2180,8 +2180,8 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
icon == 93 || // piège ?
icon == 123 || // fer ?
icon == 125) && // mine ?
(!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) ||
!IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) )
(!IsBlupiHereEx(GetCel(cel,-1,0), rank, false) ||
!IsBlupiHereEx(GetCel(cel,0,-1), rank, false)) )
{
icons[1][1] = ICON_HILI_OP; // action
}
@ -2219,7 +2219,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
for ( y=0 ; y<2 ; y++ )
{
if ( !IsFreeCelDepose(GetCel(cel,x,y), rank) ||
IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_MISC;
}
@ -2230,17 +2230,17 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
else
{
if ( !IsFreeCelDepose(GetCel(cel,1,1), rank) ||
IsBlupiHereEx(GetCel(cel,1,1), rank, FALSE) )
IsBlupiHereEx(GetCel(cel,1,1), rank, false) )
{
error = ERROR_MISC;
}
else
{
if ( !IsFreeCelDepose(GetCel(cel,0,1), rank) ||
IsBlupiHereEx(GetCel(cel,0,1), rank, FALSE) )
IsBlupiHereEx(GetCel(cel,0,1), rank, false) )
{
if ( !IsFreeCelDepose(GetCel(cel,1,0), rank) ||
IsBlupiHereEx(GetCel(cel,1,0), rank, FALSE) )
IsBlupiHereEx(GetCel(cel,1,0), rank, false) )
{
error = ERROR_MISC;
}
@ -2285,7 +2285,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
for ( y=0 ; y<2 ; y++ )
{
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2325,7 +2325,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
for ( y=0 ; y<2 ; y++ )
{
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2403,7 +2403,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
}
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2427,8 +2427,8 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
m_blupi[rank].perso != 8 && // pas disciple ?
channel == CHOBJECT &&
icon == 60 && // tomates ?
(!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) ||
!IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) )
(!IsBlupiHereEx(GetCel(cel,-1,0), rank, false) ||
!IsBlupiHereEx(GetCel(cel,0,-1), rank, false)) )
{
icons[1][1] = ICON_HILI_OP; // action
}
@ -2454,8 +2454,8 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
m_blupi[rank].perso != 8 && // pas disciple ?
channel == CHOBJECT &&
icon == 80 && // bouteille ?
(!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) ||
!IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) )
(!IsBlupiHereEx(GetCel(cel,-1,0), rank, false) ||
!IsBlupiHereEx(GetCel(cel,0,-1), rank, false)) )
{
icons[1][1] = ICON_HILI_OP; // action
}
@ -2511,7 +2511,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
for ( y=0 ; y<2 ; y++ )
{
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2532,8 +2532,8 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
if ( IsFreeCelGo(GetCel(cel,+1, 0), rank) &&
IsFreeCelGo(GetCel(cel,+1,+1), rank) &&
!IsBlupiHereEx(GetCel(cel,+1, 0), rank, FALSE) &&
!IsBlupiHereEx(GetCel(cel,+1,+1), rank, FALSE) )
!IsBlupiHereEx(GetCel(cel,+1, 0), rank, false) &&
!IsBlupiHereEx(GetCel(cel,+1,+1), rank, false) )
{
icons[1][1] = ICON_HILI_OP; // action
icons[2][1] = ICON_HILI_OP;
@ -2563,8 +2563,8 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
if ( IsFreeCelGo(GetCel(cel,+1, 0), rank) &&
IsFreeCelGo(GetCel(cel,+1,+1), rank) &&
!IsBlupiHereEx(GetCel(cel,+1, 0), rank, FALSE) &&
!IsBlupiHereEx(GetCel(cel,+1,+1), rank, FALSE) )
!IsBlupiHereEx(GetCel(cel,+1, 0), rank, false) &&
!IsBlupiHereEx(GetCel(cel,+1,+1), rank, false) )
{
icons[1][1] = ICON_HILI_OP; // action
icons[2][1] = ICON_HILI_OP;
@ -2615,7 +2615,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
for ( y=0 ; y<2 ; y++ )
{
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2650,7 +2650,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
for ( y=0 ; y<2 ; y++ )
{
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2699,7 +2699,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
for ( y=0 ; y<2 ; y++ )
{
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2736,7 +2736,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{
for ( y=0 ; y<2 ; y++ )
{
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) )
if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{
error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2821,7 +2821,7 @@ void CDecor::CelHili(POINT pos, int action)
{
m_celHili = ConvPosToCel(pos);
if ( IsBlupiHere(m_celHili, FALSE) )
if ( IsBlupiHere(m_celHili, false) )
{
m_rankHili = m_blupiHere;
m_iconHili[1][1] = ICON_HILI_SEL;
@ -3203,7 +3203,7 @@ int CDecor::GetResHili(POINT posMouse)
// Indique si le menu est présent et qu'il faut cacher
// les tooltips du décor.
void CDecor::HideTooltips(BOOL bHide)
void CDecor::HideTooltips(bool bHide)
{
m_bHideTooltips = bHide;
}
@ -3211,7 +3211,7 @@ void CDecor::HideTooltips(BOOL bHide)
// Modifie l'origine supérieure/gauche du décor.
void CDecor::SetCoin(POINT coin, BOOL bCenter)
void CDecor::SetCoin(POINT coin, bool bCenter)
{
if ( bCenter )
{
@ -3225,7 +3225,7 @@ void CDecor::SetCoin(POINT coin, BOOL bCenter)
if ( coin.y > MAXCELY-4 ) coin.y = MAXCELY-4;
m_celCoin = coin;
m_bGroundRedraw = TRUE; // faudra redessiner les sols
m_bGroundRedraw = true; // faudra redessiner les sols
m_celHili.x = -1;
m_textLastPos.x = -1; // tooltips plus lavable !
}
@ -3243,7 +3243,7 @@ POINT CDecor::GetHome()
// Mémoirise une position pendant le jeu.
void CDecor::MemoPos(int rank, BOOL bRecord)
void CDecor::MemoPos(int rank, bool bRecord)
{
POINT pos;
@ -3267,7 +3267,7 @@ void CDecor::MemoPos(int rank, BOOL bRecord)
else
{
m_pSound->PlayImage(SOUND_BUT, pos);
SetCoin(m_memoPos[rank], FALSE);
SetCoin(m_memoPos[rank], false);
}
}
}
@ -3333,13 +3333,13 @@ int CDecor::GetRegion()
// Gestion des infos.
void CDecor::SetInfoMode(BOOL bInfo)
void CDecor::SetInfoMode(bool bInfo)
{
m_bInfo = bInfo;
m_bGroundRedraw = TRUE; // faudra redessiner les sols
m_bGroundRedraw = true; // faudra redessiner les sols
}
BOOL CDecor::GetInfoMode()
bool CDecor::GetInfoMode()
{
return m_bInfo;
}
@ -3347,7 +3347,7 @@ BOOL CDecor::GetInfoMode()
void CDecor::SetInfoHeight(int height)
{
m_infoHeight = height;
m_bGroundRedraw = TRUE; // faudra redessiner les sols
m_bGroundRedraw = true; // faudra redessiner les sols
}
int CDecor::GetInfoHeight()
@ -3407,13 +3407,13 @@ void CDecor::UndoBack()
{
memcpy(&m_decor, m_pUndoDecor, sizeof(Cellule)*(MAXCELX/2)*(MAXCELY/2));
UndoClose();
m_bGroundRedraw = TRUE;
m_bGroundRedraw = true;
}
}
// Indique s'il est possible d'effectuer un undo.
BOOL CDecor::IsUndo()
bool CDecor::IsUndo()
{
return ( m_pUndoDecor != NULL );
}

242
decor.h
View File

@ -43,8 +43,8 @@ Cellule;
typedef struct
{
BOOL bExist; // TRUE -> utilisé
BOOL bHili; // TRUE -> sélectionné
int bExist; // true -> utilisé
int bHili; // true -> sélectionné
short perso; // personnage, voir (*)
@ -84,14 +84,14 @@ typedef struct
short jaugePhase;
short jaugeMax;
short stop; // 1 -> devra stopper
short bArrow; // TRUE -> flèche en dessus de blupi
short bRepeat; // TRUE -> répète l'action
short bArrow; // true -> flèche en dessus de blupi
short bRepeat; // true -> répète l'action
short nLoop; // nb de boucles pour GOAL_OTHERLOOP
short cLoop; // boucle en cours
short vIcon; // icône variable
POINT goalHili; // but visé
short bMalade; // TRUE -> blupi malade
short bCache; // TRUE -> caché (pas dessiné)
short bMalade; // true -> blupi malade
short bCache; // true -> caché (pas dessiné)
short vehicule; // véhicule utilisé par blupi, voir (**)
char busyCount;
char busyDelay;
@ -131,12 +131,12 @@ Blupi;
typedef struct
{
BOOL bExist; // TRUE -> utilisé
int bExist; // true -> utilisé
POINT cel; // cellule du décor
short rankBlupi; // blupi travaillant ici
BOOL bFloor; // TRUE -> floor, FALSE -> object
int bFloor; // true -> floor, false -> object
short channel;
short icon;
short maskChannel;
@ -169,11 +169,11 @@ public:
void ArrangeBuild(POINT cel, int &channel, int &icon);
void ArrangeObject(POINT cel);
BOOL ArrangeFillTestFloor(POINT cel1, POINT cel2);
BOOL ArrangeFillTest(POINT pos);
bool ArrangeFillTestFloor(POINT cel1, POINT cel2);
bool ArrangeFillTest(POINT pos);
void ArrangeFillPut(POINT pos, int channel, int icon);
void ArrangeFillSearch(POINT pos);
void ArrangeFill(POINT pos, int channel, int icon, BOOL bFloor);
void ArrangeFill(POINT pos, int channel, int icon, bool bFloor);
void ArrangeBlupi();
@ -182,118 +182,118 @@ public:
void SearchObject(int rank, int icon, POINT cel, int *pBits);
void AjustFloor(int rank, int icon, POINT cel, int *pBits);
void AjustObject(int rank, int icon, POINT cel, int *pBits);
BOOL IsFreeDirect(POINT cel, int direct, int rank);
BOOL IsFreeCelObstacle(POINT cel);
BOOL IsFreeCelFloor(POINT cel, int rank);
BOOL IsFreeCelGo(POINT cel, int rank);
BOOL IsFreeCelHili(POINT cel, int rank);
BOOL IsFreeCel(POINT cel, int rank);
BOOL IsFreeCelDepose(POINT cel, int rank);
BOOL IsFreeCelEmbarque(POINT cel, int rank, int &action, POINT &limit);
BOOL IsFreeCelDebarque(POINT cel, int rank, int &action, POINT &limit);
BOOL IsFreeJump(POINT cel, int direct, int rank, int &action);
BOOL IsFreeGlisse(POINT cel, int direct, int rank, int &action);
bool IsFreeDirect(POINT cel, int direct, int rank);
bool IsFreeCelObstacle(POINT cel);
bool IsFreeCelFloor(POINT cel, int rank);
bool IsFreeCelGo(POINT cel, int rank);
bool IsFreeCelHili(POINT cel, int rank);
bool IsFreeCel(POINT cel, int rank);
bool IsFreeCelDepose(POINT cel, int rank);
bool IsFreeCelEmbarque(POINT cel, int rank, int &action, POINT &limit);
bool IsFreeCelDebarque(POINT cel, int rank, int &action, POINT &limit);
bool IsFreeJump(POINT cel, int direct, int rank, int &action);
bool IsFreeGlisse(POINT cel, int direct, int rank, int &action);
int DirectSearch(POINT cel, POINT goal);
void FlushUsed(int rank);
void AddUsedPos(int rank, POINT pos);
BOOL IsUsedPos(int rank, POINT pos);
BOOL SearchBestBase(int rank, int &action, POINT &newCel, int &direct);
BOOL SearchBestPass(int rank, int &action);
BOOL IsWorkableObject(POINT cel, int rank);
BOOL SearchOtherObject(int rank, POINT initCel, int action,
bool IsUsedPos(int rank, POINT pos);
bool SearchBestBase(int rank, int &action, POINT &newCel, int &direct);
bool SearchBestPass(int rank, int &action);
bool IsWorkableObject(POINT cel, int rank);
bool SearchOtherObject(int rank, POINT initCel, int action,
int distMax, int channel,
int firstIcon1, int lastIcon1,
int firstIcon2, int lastIcon2,
POINT &foundCel, int &foundIcon);
BOOL SearchOtherDrapeau(int rank, POINT initCel, int distMax,
bool SearchOtherDrapeau(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL SearchOtherBateau(int rank, POINT initCel, int distMax,
bool SearchOtherBateau(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL IsSpiderObject(int icon);
BOOL SearchSpiderObject(int rank, POINT initCel, int distMax,
bool IsSpiderObject(int icon);
bool SearchSpiderObject(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL IsTracksObject(int icon);
BOOL SearchTracksObject(int rank, POINT initCel, int distMax,
bool IsTracksObject(int icon);
bool SearchTracksObject(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL IsRobotObject(int icon);
BOOL SearchRobotObject(int rank, POINT initCel, int distMax,
bool IsRobotObject(int icon);
bool SearchRobotObject(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon,
int &foundAction);
BOOL IsBombeObject(int icon);
BOOL SearchBombeObject(int rank, POINT initCel, int distMax,
bool IsBombeObject(int icon);
bool SearchBombeObject(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL SearchElectroObject(int rank, POINT initCel, int distMax,
bool SearchElectroObject(int rank, POINT initCel, int distMax,
POINT &foundCel, int &foundIcon);
BOOL IsUsineBuild(int rank, POINT cel);
BOOL IsUsineFree(int rank, POINT cel);
BOOL IsFireCel(POINT cel);
BOOL IsVirusCel(POINT cel);
bool IsUsineBuild(int rank, POINT cel);
bool IsUsineFree(int rank, POINT cel);
bool IsFireCel(POINT cel);
bool IsVirusCel(POINT cel);
int IsBuildPont(POINT &cel, int &iconBuild);
BOOL IsBuildBateau(POINT cel, int &direct);
bool IsBuildBateau(POINT cel, int &direct);
void InitDrapeau();
void AddDrapeau(POINT cel);
void SubDrapeau(POINT cel);
BOOL TestDrapeau(POINT cel);
bool TestDrapeau(POINT cel);
// DecBlupi.cpp
void BlupiFlush();
int BlupiCreate(POINT cel, int action, int direct,
int perso, int energy);
BOOL BlupiDelete(POINT cel, int perso=-1);
bool BlupiDelete(POINT cel, int perso=-1);
void BlupiDelete(int rank);
void BlupiKill(int exRank, POINT cel, int type);
BOOL BlupiIfExist(int rank);
bool BlupiIfExist(int rank);
void BlupiCheat(int cheat);
void BlupiActualise(int rank);
void BlupiAdaptIcon(int rank);
void BlupiPushFog(int rank);
void BlupiSound(int rank, int sound, POINT pos, BOOL bStop=FALSE);
void BlupiSound(int rank, int sound, POINT pos, bool bStop=false);
void BlupiInitAction(int rank, int action, int direct=-1);
void BlupiChangeAction(int rank, int action, int direct=-1);
void ListFlush(int rank);
int ListGetParam(int rank, int button, POINT cel);
BOOL ListPut(int rank, int button, POINT cel, POINT cMem);
bool ListPut(int rank, int button, POINT cel, POINT cMem);
void ListRemove(int rank);
int ListSearch(int rank, int button, POINT cel, int &textForButton);
BOOL RepeatAdjust(int rank, int button, POINT &cel, POINT &cMem,
bool RepeatAdjust(int rank, int button, POINT &cel, POINT &cMem,
int param, int list);
void GoalStart(int rank, int action, POINT cel);
BOOL GoalNextPhase(int rank);
bool GoalNextPhase(int rank);
void SetTotalTime(int total);
int GetTotalTime();
void GoalInitJauge(int rank);
void GoalInitPassCel(int rank);
void GoalAdjustCel(int rank, int &x, int &y);
BOOL GoalNextOp(int rank, short *pTable);
bool GoalNextOp(int rank, short *pTable);
void GoalUnwork(int rank);
void GoalStop(int rank, BOOL bError=FALSE, BOOL bSound=TRUE);
BOOL BlupiIsGoalUsed(POINT cel);
void GoalStop(int rank, bool bError=false, bool bSound=true);
bool BlupiIsGoalUsed(POINT cel);
void BlupiStartStopRayon(int rank, POINT startCel, POINT endCel);
BOOL BlupiRotate(int rank);
BOOL BlupiNextAction(int rank);
bool BlupiRotate(int rank);
bool BlupiNextAction(int rank);
void BlupiNextGoal(int rank);
void BlupiStep(BOOL bFirst);
void BlupiStep(bool bFirst);
void BlupiGetRect(int rank, RECT &rect);
int GetTargetBlupi(POINT pos);
void BlupiDeselect();
void BlupiDeselect(int rank);
void BlupiSetArrow(int rank, BOOL bArrow);
void BlupiSetArrow(int rank, bool bArrow);
void InitOutlineRect();
void BlupiHiliDown(POINT pos, BOOL bAdd=FALSE);
void BlupiHiliMove(POINT pos, BOOL bAdd=FALSE);
void BlupiHiliUp(POINT pos, BOOL bAdd=FALSE);
void BlupiHiliDown(POINT pos, bool bAdd=false);
void BlupiHiliMove(POINT pos, bool bAdd=false);
void BlupiHiliUp(POINT pos, bool bAdd=false);
void BlupiDrawHili();
int GetDefButton(POINT cel);
BOOL BlupiGoal(int rank, int button, POINT cel, POINT cMem);
bool BlupiGoal(int rank, int button, POINT cel, POINT cMem);
void BlupiGoal(POINT cel, int button);
void BlupiDestCel(int rank);
BOOL IsTracksHere(POINT cel, BOOL bSkipInMove);
BOOL IsBlupiHereEx(POINT cel1, POINT cel2, int exRank, BOOL bSkipInMove);
BOOL IsBlupiHereEx(POINT cel, int exRank, BOOL bSkipInMove);
BOOL IsBlupiHere(POINT cel, BOOL bSkipInMove);
BOOL IsBlupiHere(POINT cel, int direct, BOOL bSkipInMove);
bool IsTracksHere(POINT cel, bool bSkipInMove);
bool IsBlupiHereEx(POINT cel1, POINT cel2, int exRank, bool bSkipInMove);
bool IsBlupiHereEx(POINT cel, int exRank, bool bSkipInMove);
bool IsBlupiHere(POINT cel, bool bSkipInMove);
bool IsBlupiHere(POINT cel, int direct, bool bSkipInMove);
void GetLevelJauge(int *pLevels, int *pTypes);
BOOL IsWorkBlupi(int rank);
bool IsWorkBlupi(int rank);
void BlupiGetButtons(POINT pos, int &nb, int *pButtons, int *pErrors, int &perso);
void TerminatedInit();
int IsTerminated();
@ -303,36 +303,36 @@ public:
void MoveFlush();
int MoveMaxFire();
void MoveFixInit();
BOOL MoveCreate(POINT cel, int rankBlupi, BOOL bFloor,
bool MoveCreate(POINT cel, int rankBlupi, bool bFloor,
int channel, int icon,
int maskChannel, int maskIcon,
int total, int delai, int stepY,
BOOL bMisc=FALSE, BOOL bNotIfExist=FALSE);
BOOL MoveAddMoves(POINT cel, int rankMoves);
BOOL MoveAddIcons(POINT cel, int rankIcons, BOOL bContinue=FALSE);
BOOL MoveStartFire(POINT cel);
bool bMisc=false, bool bNotIfExist=false);
bool MoveAddMoves(POINT cel, int rankMoves);
bool MoveAddIcons(POINT cel, int rankIcons, bool bContinue=false);
bool MoveStartFire(POINT cel);
void MoveProxiFire(POINT cel);
void MoveFire(int rank);
void MoveStep(BOOL bFirst);
void MoveStep(bool bFirst);
void MoveFinish(POINT cel);
void MoveFinish(int rankBlupi);
BOOL MoveIsUsed(POINT cel);
BOOL MoveGetObject(POINT cel, int &channel, int &icon);
BOOL MovePutObject(POINT cel, int channel, int icon);
bool MoveIsUsed(POINT cel);
bool MoveGetObject(POINT cel, int &channel, int &icon);
bool MovePutObject(POINT cel, int channel, int icon);
// DecIO.cpp
BOOL Write(int rank, BOOL bUser, int world, int time, int total);
BOOL Read(int rank, BOOL bUser, int &world, int &time, int &total);
BOOL FileExist(int rank, BOOL bUser, int &world, int &time, int &total);
bool Write(int rank, bool bUser, int world, int time, int total);
bool Read(int rank, bool bUser, int &world, int &time, int &total);
bool FileExist(int rank, bool bUser, int &world, int &time, int &total);
void Flush();
// DecMap.cpp
void MapInitColors();
POINT ConvCelToMap(POINT cel);
POINT ConvMapToCel(POINT pos);
BOOL MapMove(POINT pos);
bool MapMove(POINT pos);
void MapPutCel(POINT pos);
BOOL GenerateMap();
bool GenerateMap();
// DecStat.cpp
void StatisticInit();
@ -341,52 +341,52 @@ public:
int StatisticGetFire();
void StatisticDraw();
void GenerateStatictic();
BOOL StatisticDown(POINT pos, int fwKeys);
BOOL StatisticMove(POINT pos, int fwKeys);
BOOL StatisticUp(POINT pos, int fwKeys);
bool StatisticDown(POINT pos, int fwKeys);
bool StatisticMove(POINT pos, int fwKeys);
bool StatisticUp(POINT pos, int fwKeys);
int StatisticDetect(POINT pos);
// Chemin.cpp
void CheminMemPos(int exRank);
BOOL CheminTestPos(POINT pos, int &rank);
bool CheminTestPos(POINT pos, int &rank);
int CheminARebours(int rank);
void CheminFillTerrain(int rank);
BOOL CheminTestDirection(int rank, int pos, int dir,
bool CheminTestDirection(int rank, int pos, int dir,
int &next, int &ampli,
int &cout, int &action);
BOOL CheminCherche(int rank, int &action);
BOOL IsCheminFree(int rank, POINT dest, int button);
bool CheminCherche(int rank, int &action);
bool IsCheminFree(int rank, POINT dest, int button);
// Decor.cpp
void SetShiftOffset(POINT offset);
POINT ConvCelToPos(POINT cel);
POINT ConvPosToCel(POINT pos, BOOL bMap=FALSE);
POINT ConvPosToCel(POINT pos, bool bMap=false);
POINT ConvPosToCel2(POINT pos);
void Create(HWND hWnd, CSound *pSound, CPixmap *pPixmap);
void Init(int channel, int icon);
void InitAfterBuild();
void ResetHili();
BOOL LoadImages();
bool LoadImages();
void ClearFog();
void ClearFire();
void SetBuild(BOOL bBuild);
void EnableFog(BOOL bEnable);
BOOL GetInvincible();
void SetInvincible(BOOL bInvincible);
BOOL GetSuper();
void SetSuper(BOOL bSuper);
void SetBuild(bool bBuild);
void EnableFog(bool bEnable);
bool GetInvincible();
void SetInvincible(bool bInvincible);
bool GetSuper();
void SetSuper(bool bSuper);
void FlipOutline();
BOOL PutFloor(POINT cel, int channel, int icon);
BOOL PutObject(POINT cel, int channel, int icon);
BOOL GetFloor(POINT cel, int &channel, int &icon);
BOOL GetObject(POINT cel, int &channel, int &icon);
BOOL SetFire(POINT cel, BOOL bFire);
bool PutFloor(POINT cel, int channel, int icon);
bool PutObject(POINT cel, int channel, int icon);
bool GetFloor(POINT cel, int &channel, int &icon);
bool GetObject(POINT cel, int &channel, int &icon);
bool SetFire(POINT cel, bool bFire);
void SetCoin(POINT coin, BOOL bCenter=FALSE);
void SetCoin(POINT coin, bool bCenter=false);
POINT GetCoin();
POINT GetHome();
void MemoPos(int rank, BOOL bRecord);
void MemoPos(int rank, bool bRecord);
void SetTime(int time);
int GetTime();
@ -400,8 +400,8 @@ public:
void SetRegion(int region);
int GetRegion();
void SetInfoMode(BOOL bInfo);
BOOL GetInfoMode();
void SetInfoMode(bool bInfo);
bool GetInfoMode();
void SetInfoHeight(int height);
int GetInfoHeight();
@ -425,17 +425,17 @@ public:
void CelHiliButton(POINT cel, int button);
void CelHiliRepeat(int list);
int GetResHili(POINT posMouse);
void HideTooltips(BOOL bHide);
void HideTooltips(bool bHide);
void UndoOpen();
void UndoClose();
void UndoCopy();
void UndoBack();
BOOL IsUndo();
bool IsUndo();
protected:
BOOL GetSeeBits(POINT cel, char *pBits, int index);
bool GetSeeBits(POINT cel, char *pBits, int index);
int GetSeeIcon(char *pBits, int index);
protected:
@ -455,16 +455,16 @@ protected:
POINT m_shiftOffset;
int m_iconHili[4][4];
int m_rankHili; // rang du blupi visé
BOOL m_bHiliRect;
bool m_bHiliRect;
POINT m_p1Hili; // coins rectangle de sélection
POINT m_p2Hili;
int m_shiftHili;
int m_nbBlupiHili; // nb de blupi sélectionnés
int m_rankBlupiHili; // rang blupi sélectionné
BOOL m_bFog; // TRUE -> brouillard (jeu)
BOOL m_bBuild; // TRUE -> construction
BOOL m_bInvincible; // TRUE -> cheat code
BOOL m_bSuper; // TRUE -> cheat code
bool m_bFog; // true -> brouillard (jeu)
bool m_bBuild; // true -> construction
bool m_bInvincible; // true -> cheat code
bool m_bSuper; // true -> cheat code
short m_colors[100];
int m_time; // temps relatif global
int m_timeConst; // temps relatif global constant
@ -472,16 +472,16 @@ protected:
int m_totalTime; // temps total passé sur une partie
int m_phase; // phase pour la carte
POINT m_celArrow; // cellule avec flèche
BOOL m_bOutline;
BOOL m_bGroundRedraw;
bool m_bOutline;
bool m_bGroundRedraw;
char m_buttonExist[MAXBUTTON];
int m_statNb; // nb de statistiques
int m_statFirst; // première statistique visible
int m_bStatUp; // flèche up statistique
int m_bStatDown; // flèche down statistique
int m_statHili; // statistique survolée
BOOL m_bStatRecalc; // TRUE -> recalcule les statistiques
BOOL m_bStatRedraw; // TRUE -> redessine les statistiques
bool m_bStatRecalc; // true -> recalcule les statistiques
bool m_bStatRedraw; // true -> redessine les statistiques
int m_nbStatHach; // nb de hachures
int m_nbStatHachBlupi; // hachures occupées par blupi
int m_nbStatHachPlanche;// hachures occupées par planches
@ -506,12 +506,12 @@ protected:
int m_lastRegion; // numéro dernière région
int m_blupiHere;
POINT m_lastDrapeau[MAXLASTDRAPEAU];
BOOL m_bHideTooltips; // TRUE -> menu présent
bool m_bHideTooltips; // true -> menu présent
char m_text[50];
POINT m_textLastPos;
int m_textCount;
int m_skill;
BOOL m_bInfo;
bool m_bInfo;
int m_infoHeight;
POINT m_memoPos[4];
@ -520,7 +520,7 @@ protected:
POINT m_cheminPos[MAXBLUPI*2];
int m_cheminRank[MAXBLUPI*2];
BOOL m_bFillFloor;
bool m_bFillFloor;
int m_fillSearchChannel;
int m_fillSearchIcon;
int m_fillPutChannel;
@ -538,7 +538,7 @@ protected:
POINT GetCel (int x, int y);
POINT GetCel (POINT cel, int x, int y);
BOOL IsValid (POINT cel);
bool IsValid (POINT cel);
POINT GetVector (int direct);
extern int table_multi_goal[];
extern short table_actions[];

View File

@ -39,318 +39,318 @@ Statistic;
static Statistic table_statistic[] =
{
{ // STATBLUPIm = 0
TRUE,
true,
0, // blupi malade
0,0, //
76,
FALSE,
false,
TX_OBJ_BLUPIm,
0, 0,
},
{ // STATBLUPIf = 1
TRUE,
true,
0, // blupi fatigué
0,0, //
13,
FALSE,
false,
TX_OBJ_BLUPIf,
0, 0,
},
{ // STATBLUPI = 2
TRUE,
true,
0, // blupi énergique
0,0, //
14,
FALSE,
false,
TX_OBJ_BLUPI,
0, 0,
},
{ // STATDISCIPLE = 3
TRUE,
true,
8, // disciple
0,0, //
85,
FALSE,
false,
TX_OBJ_DISCIPLE,
0, 0,
},
{ // 4
TRUE,
true,
-1, // objet
117,117, // bateau
58,
FALSE,
false,
TX_OBJ_BATEAU,
0, 0,
},
{ // 5
TRUE,
true,
-1, // objet
118,118, // jeep
65,
FALSE,
false,
TX_OBJ_JEEP,
0, 0,
},
{ // 6
TRUE,
true,
-1, // objet
16,16, // armure
106,
FALSE,
false,
TX_OBJ_ARMURE,
0, 0,
},
{ // 7
TRUE,
true,
-1, // objet
93,93, // piège
70,
FALSE,
false,
TX_OBJ_PIEGE,
0, 0,
},
{ // 8
TRUE,
true,
-1, // objet
92,92, // poison
71,
FALSE,
false,
TX_OBJ_POISON,
0, 0,
},
{ // 9
TRUE,
true,
-1, // objet
85,85, // dynamite
57,
FALSE,
false,
TX_OBJ_DYNAMITE,
0, 0,
},
{ // 10
TRUE,
true,
-1, // objet
125,125, // mine
63,
FALSE,
false,
TX_OBJ_MINE,
0, 0,
},
{ // 11
TRUE,
true,
-1, // objet
60,60, // tomate
28,
FALSE,
false,
TX_OBJ_TOMATE,
0, 0,
},
{ // 12
TRUE,
true,
-1, // objet
80,80, // bouteille
34,
FALSE,
false,
TX_OBJ_POTION,
0, 0,
},
{ // 13
TRUE,
true,
-1, // objet
36,36, // planches
22,
FALSE,
false,
TX_OBJ_PLANCHE,
0, 0,
},
{ // 14
TRUE,
true,
-1, // objet
44,44, // pierres
27,
FALSE,
false,
TX_OBJ_PIERRE,
0, 0,
},
{ // 15
TRUE,
true,
-1, // objet
124,124, // drapeau
64,
TRUE,
true,
TX_OBJ_DRAPEAU,
0, 0,
},
{ // 16
TRUE,
true,
-1, // objet
123,123, // fer
62,
FALSE,
false,
TX_OBJ_FER,
0, 0,
},
{ // 17
TRUE,
true,
-1, // objet
82,82, // fleurs1
72,
FALSE,
false,
TX_OBJ_FLEUR1,
0, 0,
},
{ // 18
TRUE,
true,
-1, // objet
84,84, // fleurs2
73,
FALSE,
false,
TX_OBJ_FLEUR2,
0, 0,
},
{ // 19
TRUE,
true,
-1, // objet
95,95, // fleurs3
74,
FALSE,
false,
TX_OBJ_FLEUR3,
0, 0,
},
{ // 20
TRUE,
true,
-1, // objet
61,61, // cabane
19,
TRUE,
true,
TX_OBJ_CABANE,
0, 0,
},
{ // 21
TRUE,
true,
-1, // objet
-52,-56, // couveuse
25,
FALSE,
false,
TX_OBJ_COUVEUSE,
0, 0,
},
{ // 22
TRUE,
true,
-1, // objet
-80,-84, // téléporteur
101,
FALSE,
false,
TX_OBJ_TELEPORTE,
0, 0,
},
{ // 23
TRUE,
true,
-1, // objet
28,29, // laboratoire
35,
TRUE,
true,
TX_OBJ_LABO,
0, 0,
},
{ // 24
TRUE,
true,
-1, // objet
121,122, // mine de fer
61,
TRUE,
true,
TX_OBJ_MINEFER,
0, 0,
},
{ // 25
TRUE,
true,
-1, // objet
119,120, // usine
59,
TRUE,
true,
TX_OBJ_USINE,
0, 0,
},
{ // 26
TRUE,
true,
-1, // objet
27,27, // tour
33,
TRUE,
true,
TX_OBJ_TOUR,
0, 0,
},
{ // STATFEU = 27
TRUE,
true,
-2, // feu
0,0, //
37,
TRUE,
true,
TX_OBJ_FEU,
0, 0,
},
{ // STATROBOT = 28
TRUE,
true,
4, // robot
0,0, //
56,
FALSE,
false,
TX_OBJ_ROBOT,
0, 0,
},
{ // STATTRACKS = 29
TRUE,
true,
3, // tracks
0,0, //
17,
FALSE,
false,
TX_OBJ_TRACKS,
0, 0,
},
{ // STATBOMBE = 30
TRUE,
true,
5, // bombe
0,0, //
38,
FALSE,
false,
TX_OBJ_BOMBE,
0, 0,
},
{ // STATARAIGNEE = 31
TRUE,
true,
1, // araignée
0,0, //
15,
FALSE,
false,
TX_OBJ_ARAIGNEE,
0, 0,
},
{ // STATVIRUS = 32
TRUE,
true,
2, // virus
0,0, //
16,
FALSE,
false,
TX_OBJ_VIRUS,
0, 0,
},
{ // STATELECTRO = 33
TRUE,
true,
7, // électro
0,0, //
75,
FALSE,
false,
TX_OBJ_ELECTRO,
0, 0,
},
{
FALSE,
false,
-1,
0,0,
-1,
FALSE,
false,
0,
999, 999,
},
@ -399,11 +399,11 @@ void CDecor::StatisticInit()
m_statNb = 0;
m_statFirst = 0;
m_bStatUp = FALSE;
m_bStatDown = FALSE;
m_bStatUp = false;
m_bStatDown = false;
m_statHili = -1;
m_bStatRecalc = TRUE; // faudra tout recalculer
m_bStatRedraw = TRUE; // faudra tout redessiner
m_bStatRecalc = true; // faudra tout recalculer
m_bStatRedraw = true; // faudra tout redessiner
}
@ -412,7 +412,7 @@ void CDecor::StatisticInit()
void CDecor::StatisticUpdate()
{
int rank, x, y, icon, nb;
BOOL bHach;
bool bHach;
Statistic* pStatistic;
m_nbStatHach = 0;
@ -525,11 +525,11 @@ void CDecor::StatisticUpdate()
{
for ( y=0 ; y<MAXCELY ; y+=2 )
{
bHach = FALSE;
bHach = false;
if ( m_decor[x/2][y/2].floorChannel == CHFLOOR &&
m_decor[x/2][y/2].floorIcon == 17 ) // dalle hachurée ?
{
bHach = TRUE;
bHach = true;
m_nbStatHach ++;
}
@ -614,8 +614,8 @@ void CDecor::StatisticUpdate()
}
if ( m_statNb <= STATNB ) // tout visible en une page ?
{
m_bStatUp = FALSE;
m_bStatDown = FALSE;
m_bStatUp = false;
m_bStatDown = false;
m_statFirst = 0;
}
else
@ -623,21 +623,21 @@ void CDecor::StatisticUpdate()
// nb <- nb de pages nécessaires
nb = (m_statNb+STATNB-5)/(STATNB-2);
m_bStatUp = TRUE;
m_bStatDown = TRUE;
m_bStatUp = true;
m_bStatDown = true;
if ( m_statFirst >= 1+(nb-1)*(STATNB-2) )
{
m_statFirst = 1+(nb-1)*(STATNB-2);
m_bStatDown = FALSE;
m_bStatDown = false;
}
if ( m_statFirst == 0 )
{
m_bStatUp = FALSE;
m_bStatUp = false;
}
}
m_bStatRecalc = FALSE; // c'est calculé
m_bStatRedraw = TRUE; // faudra tout redessiner
m_bStatRecalc = false; // c'est calculé
m_bStatRedraw = true; // faudra tout redessiner
}
// Retourne le nombre de blupi.
@ -779,7 +779,7 @@ void CDecor::StatisticDraw()
DrawText(m_pPixmap, pos, text);
}
m_bStatRedraw = FALSE; // dessin plus nécessaire
m_bStatRedraw = false; // dessin plus nécessaire
}
// Génère les statistiques.
@ -802,7 +802,7 @@ void CDecor::GenerateStatictic()
// Bouton pressé dans les statistiques.
BOOL CDecor::StatisticDown(POINT pos, int fwKeys)
bool CDecor::StatisticDown(POINT pos, int fwKeys)
{
int hili, rank, x, y, show, icon;
POINT cel;
@ -811,7 +811,7 @@ BOOL CDecor::StatisticDown(POINT pos, int fwKeys)
StatisticUpdate();
hili = StatisticDetect(pos);
if ( hili < 0 ) return FALSE;
if ( hili < 0 ) return false;
if ( m_bStatUp && hili == 0 ) // flèche up ?
{
@ -824,7 +824,7 @@ BOOL CDecor::StatisticDown(POINT pos, int fwKeys)
pos.x = LXIMAGE/2;
pos.y = LYIMAGE/2;
m_pSound->PlayImage(SOUND_OPEN, pos);
return TRUE;
return true;
}
if ( m_bStatDown && hili == STATNB-1 ) // flèche down ?
@ -841,13 +841,13 @@ BOOL CDecor::StatisticDown(POINT pos, int fwKeys)
pos.x = LXIMAGE/2;
pos.y = LYIMAGE/2;
m_pSound->PlayImage(SOUND_OPEN, pos);
return TRUE;
return true;
}
rank = m_statFirst+hili;
if ( rank > 0 && m_bStatUp ) rank --;
pStatistic = StatisticGet(rank);
if ( !pStatistic->bExist ) return FALSE;
if ( !pStatistic->bExist ) return false;
show = pStatistic->lastShow % pStatistic->nb;
pStatistic->lastShow ++;
@ -876,11 +876,11 @@ BOOL CDecor::StatisticDown(POINT pos, int fwKeys)
m_blupi[rank].perso == 8 ) // disciple ?
{
BlupiDeselect();
m_blupi[rank].bHili = TRUE;
m_blupi[rank].bHili = true;
m_rankBlupiHili = rank; // sélectionne
m_nbBlupiHili = 1;
}
BlupiSetArrow(rank, TRUE);
BlupiSetArrow(rank, true);
cel = m_blupi[rank].cel;
goto select;
}
@ -981,17 +981,17 @@ BOOL CDecor::StatisticDown(POINT pos, int fwKeys)
}
}
return FALSE;
return false;
select:
SetCoin(cel, TRUE);
SetCoin(cel, true);
NextPhase(0); // faudra refaire la carte tout de suite
return TRUE;
return true;
}
// Souris déplacée dans les statistiques.
BOOL CDecor::StatisticMove(POINT pos, int fwKeys)
bool CDecor::StatisticMove(POINT pos, int fwKeys)
{
int rank;
@ -1000,17 +1000,17 @@ BOOL CDecor::StatisticMove(POINT pos, int fwKeys)
if ( rank != m_statHili ) // autre mise en évidence ?
{
m_statHili = rank;
m_bStatRedraw = TRUE; // faudra tout redessiner
m_bStatRedraw = true; // faudra tout redessiner
}
return FALSE;
return false;
}
// Bouton relâché dans les statistiques.
BOOL CDecor::StatisticUp(POINT pos, int fwKeys)
bool CDecor::StatisticUp(POINT pos, int fwKeys)
{
return FALSE;
return false;
}
// Détecte dans quelle statistique est la souris.

8
def.h
View File

@ -5,10 +5,10 @@
#include <Windows.h>
#define _DEMO FALSE // TRUE=demo, FALSE=complet
#define _INTRO FALSE // TRUE si images d'introduction
#define _EGAMES FALSE // TRUE version pour eGames
#define _SE FALSE // TRUE eGames Special Edition
#define _DEMO false // true=demo, false=complet
#define _INTRO false // true si images d'introduction
#define _EGAMES false // true version pour eGames
#define _SE false // true eGames Special Edition
#define LXIMAGE 640 // dimensions de la fenêtre de jeu

766
event.cpp

File diff suppressed because it is too large Load Diff

116
event.h
View File

@ -18,7 +18,7 @@ typedef struct
{
UINT phase;
char backName[20];
BOOL bCDrom;
int bCDrom;
Button buttons[MAXBUTTON];
}
Phase;
@ -54,13 +54,13 @@ public:
POINT GetMousePos();
void Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, CSound *pSound, CMovie *pMovie);
void SetFullScreen(BOOL bFullScreen);
void SetFullScreen(bool bFullScreen);
void SetMouseType(int mouseType);
int GetWorld();
int GetPhysicalWorld();
int GetImageWorld();
BOOL IsHelpHide();
BOOL ChangePhase(UINT phase);
bool IsHelpHide();
bool ChangePhase(UINT phase);
void MovieToStart();
UINT GetPhase();
void TryInsert();
@ -69,37 +69,37 @@ public:
int GetButtonIndex(int button);
int GetState(int button);
void SetState(int button, int state);
BOOL GetEnable(int button);
void SetEnable(int button, BOOL bEnable);
BOOL GetHide(int button);
void SetHide(int button, BOOL bHide);
bool GetEnable(int button);
void SetEnable(int button, bool bEnable);
bool GetHide(int button);
void SetHide(int button, bool bHide);
int GetMenu(int button);
void SetMenu(int button, int menu);
BOOL DrawButtons();
bool DrawButtons();
int MousePosToSprite(POINT pos);
void MouseSprite(POINT pos);
void WaitMouse(BOOL bWait);
void HideMouse(BOOL bHide);
void WaitMouse(bool bWait);
void HideMouse(bool bHide);
POINT GetLastMousePos();
BOOL TreatEvent(UINT message, WPARAM wParam, LPARAM lParam);
BOOL TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam);
bool TreatEvent(UINT message, WPARAM wParam, LPARAM lParam);
bool TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam);
void DecorAutoShift(POINT pos);
BOOL StartMovie(char *pFilename);
bool StartMovie(char *pFilename);
void StopMovie();
BOOL IsMovie();
bool IsMovie();
BOOL FlipObject();
bool FlipObject();
void Read(int message);
void Write(int message);
void SetSpeed(int speed);
int GetSpeed();
BOOL GetPause();
BOOL IsShift();
bool GetPause();
bool IsShift();
void DemoStep();
void DebugDisplay(char m);
@ -108,31 +108,31 @@ public:
protected:
void DrawTextCenter(int res, int x, int y, int font=0);
BOOL CreateButtons();
BOOL EventButtons(UINT message, WPARAM wParam, LPARAM lParam);
BOOL MouseOnButton(POINT pos);
bool CreateButtons();
bool EventButtons(UINT message, WPARAM wParam, LPARAM lParam);
bool MouseOnButton(POINT pos);
int SearchPhase(UINT phase);
void DecorShift(int dx, int dy);
BOOL PlayDown(POINT pos, int fwKeys);
BOOL PlayMove(POINT pos, int fwKeys);
BOOL PlayUp(POINT pos, int fwKeys);
bool PlayDown(POINT pos, int fwKeys);
bool PlayMove(POINT pos, int fwKeys);
bool PlayUp(POINT pos, int fwKeys);
void ChangeButtons(int message);
void BuildFloor(POINT cel, int insIcon);
void BuildWater(POINT cel, int insIcon);
BOOL BuildDown(POINT pos, int fwKeys, BOOL bMix=TRUE);
BOOL BuildMove(POINT pos, int fwKeys);
BOOL BuildUp(POINT pos, int fwKeys);
bool BuildDown(POINT pos, int fwKeys, bool bMix=true);
bool BuildMove(POINT pos, int fwKeys);
bool BuildUp(POINT pos, int fwKeys);
void PrivateLibelle();
BOOL ReadLibelle(int world, BOOL bSchool, BOOL bHelp);
BOOL WriteInfo();
BOOL ReadInfo();
bool ReadLibelle(int world, bool bSchool, bool bHelp);
bool WriteInfo();
bool ReadInfo();
void DemoRecStart();
void DemoRecStop();
BOOL DemoPlayStart();
bool DemoPlayStart();
void DemoPlayStop();
void DemoRecEvent(UINT message, WPARAM wParam, LPARAM lParam);
@ -144,10 +144,10 @@ protected:
int m_maxMission;
int m_phase;
int m_index;
BOOL m_bSchool;
BOOL m_bPrivate;
BOOL m_bAccessBuild;
BOOL m_bFullScreen;
bool m_bSchool;
bool m_bPrivate;
bool m_bAccessBuild;
bool m_bFullScreen;
int m_mouseType;
HWND m_hWnd;
CPixmap* m_pPixmap;
@ -160,11 +160,11 @@ protected:
int m_lastFloor[MAXBUTTON];
int m_lastObject[MAXBUTTON];
int m_lastHome[MAXBUTTON];
BOOL m_bRunMovie;
BOOL m_bBuildModify;
bool m_bRunMovie;
bool m_bBuildModify;
CJauge m_jauges[2];
CMenu m_menu;
BOOL m_bMenu;
bool m_bMenu;
POINT m_menuPos;
int m_menuNb;
int m_menuButtons[MAXBUTTON];
@ -172,28 +172,28 @@ protected:
int m_menuPerso;
POINT m_menuCel;
POINT m_oldMousePos;
BOOL m_bMousePress;
BOOL m_bMouseDown;
BOOL m_bHili;
bool m_bMousePress;
bool m_bMouseDown;
bool m_bHili;
int m_fileWorld[10];
int m_fileTime[10];
POINT m_posToolTips;
char m_textToolTips[50];
int m_mouseSprite;
BOOL m_bFillMouse;
BOOL m_bWaitMouse;
BOOL m_bHideMouse;
BOOL m_bShowMouse;
bool m_bFillMouse;
bool m_bWaitMouse;
bool m_bHideMouse;
bool m_bShowMouse;
int m_rankCheat;
int m_posCheat;
BOOL m_bMovie;
BOOL m_bSpeed;
BOOL m_bHelp;
BOOL m_bAllMissions;
BOOL m_bChangeCheat;
bool m_bMovie;
bool m_bSpeed;
bool m_bHelp;
bool m_bAllMissions;
bool m_bChangeCheat;
int m_scrollSpeed;
BOOL m_bPause;
BOOL m_bShift;
bool m_bPause;
bool m_bShift;
int m_shiftPhase;
POINT m_shiftVector;
POINT m_shiftOffset;
@ -202,17 +202,17 @@ protected:
int m_tryInsertCount;
POINT m_posInfoButton;
POINT m_posHelpButton;
BOOL m_bHiliInfoButton;
BOOL m_bHiliHelpButton;
BOOL m_bInfoHelp;
BOOL m_bDemoRec;
BOOL m_bDemoPlay;
bool m_bHiliInfoButton;
bool m_bHiliHelpButton;
bool m_bInfoHelp;
bool m_bDemoRec;
bool m_bDemoPlay;
DemoEvent* m_pDemoBuffer;
int m_demoTime;
int m_demoIndex;
int m_demoEnd;
int m_demoNumber;
BOOL m_bCtrlDown;
bool m_bCtrlDown;
POINT m_debugPos;
int m_introTime;
};

View File

@ -27,21 +27,21 @@ static char tableFog[15*4] =
// Retourne les bits contenant du brouillard.
BOOL GetFogBits(int icon, char *pBits)
bool GetFogBits(int icon, char *pBits)
{
pBits[0] = 0;
pBits[1] = 0;
pBits[2] = 0;
pBits[3] = 0;
if ( icon < 0 || icon >= 15 ) return TRUE;
if ( icon < 0 || icon >= 15 ) return true;
pBits[0] = tableFog[icon*4+0];
pBits[1] = tableFog[icon*4+1];
pBits[2] = tableFog[icon*4+2];
pBits[3] = tableFog[icon*4+3];
return TRUE;
return true;
}
// Retourne l'icône correspondant aux bits de brouillard.

View File

@ -20,9 +20,9 @@
CJauge::CJauge()
{
m_type = 0;
m_bHide = TRUE;
m_bMinimizeRedraw = FALSE;
m_bRedraw = FALSE;
m_bHide = true;
m_bMinimizeRedraw = false;
m_bRedraw = false;
}
// Destructeur.
@ -34,22 +34,22 @@ CJauge::~CJauge()
// Crée un nouveau bouton.
BOOL CJauge::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int type, BOOL bMinimizeRedraw)
bool CJauge::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int type, bool bMinimizeRedraw)
{
m_hWnd = hWnd;
m_pPixmap = pPixmap;
m_pSound = pSound;
m_type = type;
m_bMinimizeRedraw = bMinimizeRedraw;
m_bHide = TRUE;
m_bHide = true;
m_pos = pos;
m_dim.x = DIMJAUGEX;
m_dim.y = DIMJAUGEY;
m_level = 0;
m_bRedraw = TRUE;
m_bRedraw = true;
return TRUE;
return true;
}
// Dessine un bouton dans son état.
@ -60,7 +60,7 @@ void CJauge::Draw()
RECT rect;
if ( m_bMinimizeRedraw && !m_bRedraw ) return;
m_bRedraw = FALSE;
m_bRedraw = false;
if ( m_bHide ) // bouton caché ?
{
@ -94,7 +94,7 @@ void CJauge::Draw()
void CJauge::Redraw()
{
m_bRedraw = TRUE;
m_bRedraw = true;
}
// Modifie le niveau.
@ -106,7 +106,7 @@ void CJauge::SetLevel(int level)
if ( m_level != level )
{
m_bRedraw = TRUE;
m_bRedraw = true;
}
m_level = level;
@ -118,23 +118,23 @@ void CJauge::SetType(int type)
{
if ( m_type != type )
{
m_bRedraw = TRUE;
m_bRedraw = true;
}
m_type = type;
}
BOOL CJauge::GetHide()
bool CJauge::GetHide()
{
return m_bHide;
}
void CJauge::SetHide(BOOL bHide)
void CJauge::SetHide(bool bHide)
{
if ( m_bHide != bHide )
{
m_bRedraw = TRUE;
m_bRedraw = true;
}
m_bHide = bHide;
@ -147,6 +147,6 @@ POINT CJauge::GetPos()
void CJauge::SetRedraw()
{
m_bRedraw = TRUE;
m_bRedraw = true;
}

14
jauge.h
View File

@ -10,16 +10,16 @@ public:
CJauge();
~CJauge();
BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int type, BOOL bMinimizeRedraw);
bool Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int type, bool bMinimizeRedraw);
void Draw();
void Redraw();
void SetLevel(int level);
void SetType(int type);
BOOL GetHide();
void SetHide(BOOL bHide);
bool GetHide();
void SetHide(bool bHide);
POINT GetPos();
void SetRedraw();
@ -29,13 +29,13 @@ protected:
CPixmap* m_pPixmap;
CDecor* m_pDecor;
CSound* m_pSound;
BOOL m_bHide; // TRUE si bouton caché
bool m_bHide; // true si bouton caché
POINT m_pos; // coin sup/gauche
POINT m_dim; // dimensions
int m_type;
int m_level;
BOOL m_bMinimizeRedraw;
BOOL m_bRedraw; // TRUE -> doit être redessiné
bool m_bMinimizeRedraw;
bool m_bRedraw; // true -> doit être redessiné
};
/////////////////////////////////////////////////////////////////////////////

View File

@ -90,7 +90,7 @@ CMenu::~CMenu()
// Crée un nouveau bouton.
BOOL CMenu::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
bool CMenu::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int nb, int *pButtons, int *pErrors,
int perso)
{
@ -123,7 +123,7 @@ BOOL CMenu::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
m_selRank = Detect(pos);
return TRUE;
return true;
}
// Met à jour le menu.
@ -164,8 +164,8 @@ void CMenu::Draw()
int i, state, icon;
POINT pos;
RECT oldClip, clipRect;
BOOL bLeft = TRUE;
BOOL bRight = TRUE;
bool bLeft = true;
bool bRight = true;
char text[50];
char* pText;
@ -178,8 +178,8 @@ void CMenu::Draw()
clipRect.bottom = POSDRAWY+DIMDRAWY;
m_pPixmap->SetClipping(clipRect);
if ( m_pos.x-150 < POSDRAWX ) bLeft = FALSE;
if ( m_pos.x+m_dim.x+150 > POSDRAWX+DIMDRAWX ) bRight = FALSE;
if ( m_pos.x-150 < POSDRAWX ) bLeft = false;
if ( m_pos.x+m_dim.x+150 > POSDRAWX+DIMDRAWX ) bRight = false;
for ( i=0 ; i<m_nbButtons ; i++ )
{
@ -323,34 +323,34 @@ int CMenu::GetRank()
return m_selRank;
}
// Retourne TRUE si le bouton sélectionné a une erreur.
// Retourne true si le bouton sélectionné a une erreur.
BOOL CMenu::IsError()
bool CMenu::IsError()
{
if ( m_selRank == -1 ) return TRUE;
if ( m_selRank == -1 ) return true;
if ( m_errors[m_selRank] != 0 &&
m_errors[m_selRank] < 100 ) return TRUE;
m_errors[m_selRank] < 100 ) return true;
return FALSE;
return false;
}
// Indique si le menu existe.
BOOL CMenu::IsExist()
bool CMenu::IsExist()
{
return ( m_nbButtons == 0 ) ? FALSE:TRUE;
return ( m_nbButtons == 0 ) ? false:true;
}
// Traitement d'un événement.
BOOL CMenu::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
bool CMenu::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
{
POINT pos;
if ( m_nbButtons == 0 ) return FALSE;
if ( m_nbButtons == 0 ) return false;
pos = ConvLongToPos(lParam);
@ -358,20 +358,20 @@ BOOL CMenu::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam)
{
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
if ( MouseDown(pos) ) return TRUE;
if ( MouseDown(pos) ) return true;
break;
case WM_MOUSEMOVE:
if ( MouseMove(pos) ) return TRUE;
if ( MouseMove(pos) ) return true;
break;
case WM_LBUTTONUP:
case WM_RBUTTONUP:
if ( MouseUp(pos) ) return TRUE;
if ( MouseUp(pos) ) return true;
break;
}
return FALSE;
return false;
}
// Détecte dans quel bouton est la souris.
@ -392,14 +392,14 @@ int CMenu::Detect(POINT pos)
// Bouton de la souris pressé.
BOOL CMenu::MouseDown(POINT pos)
bool CMenu::MouseDown(POINT pos)
{
return FALSE;
return false;
}
// Souris déplacés.
BOOL CMenu::MouseMove(POINT pos)
bool CMenu::MouseMove(POINT pos)
{
m_mousePos = pos;
m_selRank = Detect(pos);
@ -412,17 +412,17 @@ BOOL CMenu::MouseMove(POINT pos)
Delete(); // enlève le menu si souris trop loin !
}
return FALSE;
return false;
}
// Bouton de la souris relâché.
BOOL CMenu::MouseUp(POINT pos)
bool CMenu::MouseUp(POINT pos)
{
m_mousePos = pos;
m_selRank = Detect(pos);
return FALSE;
return false;
}
// Envoie le message.

14
menu.h
View File

@ -10,7 +10,7 @@ public:
CMenu();
~CMenu();
BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
bool Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int nb, int *pButtons, int *pErrors,
int perso);
void Update(int nb, int *pButtons, int *pErrors);
@ -18,17 +18,17 @@ public:
void Draw();
int GetSel();
int GetRank();
BOOL IsError();
BOOL IsExist();
bool IsError();
bool IsExist();
void Message();
BOOL TreatEvent(UINT message, WPARAM wParam, LPARAM lParam);
bool TreatEvent(UINT message, WPARAM wParam, LPARAM lParam);
protected:
int Detect(POINT pos);
BOOL MouseDown(POINT pos);
BOOL MouseMove(POINT pos);
BOOL MouseUp(POINT pos);
bool MouseDown(POINT pos);
bool MouseMove(POINT pos);
bool MouseUp(POINT pos);
protected:
HWND m_hWnd;

View File

@ -13,7 +13,7 @@
HINSTANCE g_hInstance;
int g_lastSprite = 0;
extern BOOL g_bFullScreen; // FALSE si mode de test
extern bool g_bFullScreen; // false si mode de test
extern int g_mouseType;
extern char g_CDPath[MAX_PATH];
@ -153,14 +153,14 @@ void AddCDPath(char *pFilename)
{
char temp[MAX_PATH];
int lg;
BOOL bDaniel = FALSE;
bool bDaniel = false;
if ( g_CDPath[0] == 0 ) return;
lg = strlen(g_CDPath);
if ( lg > 14 && strstr(g_CDPath+lg-14, "\\daniel\\blupi\\") )
{
bDaniel = TRUE;
bDaniel = true;
}
#if _DEMO
@ -212,7 +212,7 @@ void AddUserPath(char *pFilename)
att.nLength = sizeof(SECURITY_ATTRIBUTES);
att.lpSecurityDescriptor = NULL;
att.bInheritHandle = FALSE;
att.bInheritHandle = false;
CreateDirectory(temp, &att);
pText = strstr(pFilename, "\\");

View File

@ -26,7 +26,7 @@
// Initialize avi libraries.
BOOL CMovie::initAVI()
bool CMovie::initAVI()
{
MCI_DGV_OPEN_PARMS mciOpen;
@ -67,7 +67,7 @@ void CMovie::positionMovie(HWND hWnd, RECT rect)
// reposition the playback (child) window
MoveWindow(m_hwndMovie,
rect.left, rect.top,
rect.right, rect.bottom, TRUE);
rect.right, rect.bottom, true);
}
// Close the movie and anything associated with it. |
@ -80,11 +80,11 @@ void CMovie::fileCloseMovie(HWND hWnd)
mciSendCommand(m_wMCIDeviceID, MCI_CLOSE, 0L,
(DWORD)(LPMCI_GENERIC_PARMS)&mciGeneric);
m_fPlaying = FALSE; // can't be playing any longer
m_fMovieOpen = FALSE; // no more movies open
m_fPlaying = false; // can't be playing any longer
m_fMovieOpen = false; // no more movies open
// cause a total repaint to occur
InvalidateRect(hWnd, NULL, TRUE);
InvalidateRect(hWnd, NULL, true);
UpdateWindow(hWnd);
}
@ -95,7 +95,7 @@ void CMovie::fileCloseMovie(HWND hWnd)
// the movie paused when opened.
// Sets <m_fMovieOpen> on success.
BOOL CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename)
bool CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename)
{
MCI_DGV_OPEN_PARMS mciOpen;
MCI_DGV_WINDOW_PARMS mciWindow;
@ -132,7 +132,7 @@ BOOL CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename)
{
// we opened the file o.k., now set up to play it.
m_wMCIDeviceID = mciOpen.wDeviceID; // save ID
m_fMovieOpen = TRUE; // a movie was opened
m_fMovieOpen = true; // a movie was opened
// show the playback window
mciWindow.dwCallback = 0L;
@ -154,17 +154,17 @@ BOOL CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename)
positionMovie(hWnd, rect);
// cause an update to occur
InvalidateRect(hWnd, NULL, FALSE);
InvalidateRect(hWnd, NULL, false);
UpdateWindow(hWnd);
return TRUE;
return true;
}
else
{
// generic error for open
m_fMovieOpen = FALSE;
m_fMovieOpen = false;
return FALSE;
return false;
}
}
@ -177,7 +177,7 @@ void CMovie::playMovie(HWND hWnd, int nDirection)
m_fPlaying = !m_fPlaying; // swap the play flag
if( !nDirection )
m_fPlaying = FALSE; // wDirection == NULL means PAUSE
m_fPlaying = false; // wDirection == NULL means PAUSE
// play/pause the AVI movie
if ( m_fPlaying )
@ -213,10 +213,10 @@ void CMovie::playMovie(HWND hWnd, int nDirection)
CMovie::CMovie()
{
m_bEnable = FALSE;
m_bEnable = false;
m_wMCIDeviceID = 0;
m_fPlaying = FALSE;
m_fMovieOpen = FALSE;
m_fPlaying = false;
m_fMovieOpen = false;
}
// Destructeur.
@ -228,35 +228,35 @@ CMovie::~CMovie()
// Ouvre la librairie avi.
BOOL CMovie::Create()
bool CMovie::Create()
{
#if _EGAMES
m_bEnable = FALSE;
return FALSE;
m_bEnable = false;
return false;
#else
if ( initAVI() )
{
m_bEnable = TRUE;
return TRUE;
m_bEnable = true;
return true;
}
else
{
m_bEnable = FALSE;
return FALSE;
m_bEnable = false;
return false;
}
#endif
}
// Retourne l'état de DirectMovie.
BOOL CMovie::GetEnable()
bool CMovie::GetEnable()
{
return m_bEnable;
}
// Indique si un film existe.
BOOL CMovie::IsExist(char *pFilename)
bool CMovie::IsExist(char *pFilename)
{
char string[MAX_PATH];
FILE* file;
@ -272,21 +272,21 @@ BOOL CMovie::IsExist(char *pFilename)
}
file = fopen(string, "rb");
if ( file == NULL ) return FALSE;
if ( file == NULL ) return false;
fclose(file);
return TRUE;
return true;
}
// Montre un film avi.
BOOL CMovie::Play(HWND hWnd, RECT rect, char *pFilename)
bool CMovie::Play(HWND hWnd, RECT rect, char *pFilename)
{
if ( !m_bEnable ) return FALSE;
if ( !fileOpenMovie(hWnd, rect, pFilename) ) return FALSE;
if ( !m_bEnable ) return false;
if ( !fileOpenMovie(hWnd, rect, pFilename) ) return false;
playMovie(hWnd, IDM_PLAY);
return TRUE;
return true;
}
// Stoppe le film avi.

18
movie.h
View File

@ -9,25 +9,25 @@ public:
CMovie();
~CMovie();
BOOL Create();
BOOL GetEnable();
BOOL IsExist(char *pFilename);
BOOL Play(HWND hWnd, RECT rect, char *pFilename);
bool Create();
bool GetEnable();
bool IsExist(char *pFilename);
bool Play(HWND hWnd, RECT rect, char *pFilename);
void Stop(HWND hWnd);
protected:
void playMovie(HWND hWnd, int nDirection);
BOOL fileOpenMovie(HWND hWnd, RECT rect, char *pFilename);
bool fileOpenMovie(HWND hWnd, RECT rect, char *pFilename);
void fileCloseMovie(HWND hWnd);
void positionMovie(HWND hWnd, RECT rect);
void termAVI();
BOOL initAVI();
bool initAVI();
protected:
BOOL m_bEnable;
bool m_bEnable;
MCIDEVICEID m_wMCIDeviceID; // MCI Device ID for the AVI file
HWND m_hwndMovie; // window handle of the movie
BOOL m_fPlaying; // Play flag: TRUE == playing, FALSE == paused
BOOL m_fMovieOpen; // Open flag: TRUE == movie open, FALSE = none
bool m_fPlaying; // Play flag: true == playing, false == paused
bool m_fMovieOpen; // Open flag: true == movie open, false = none
};

File diff suppressed because it is too large Load Diff

View File

@ -20,19 +20,19 @@ CPixmap::CPixmap()
{
int i;
m_bFullScreen = FALSE;
m_bFullScreen = false;
m_mouseType = MOUSETYPEGRA;
m_bDebug = TRUE;
m_bPalette = TRUE;
m_bDebug = true;
m_bPalette = true;
m_mouseSprite = SPRITE_WAIT;
MouseHotSpot();
m_mousePos.x = LXIMAGE/2;
m_mousePos.y = LYIMAGE/2;
m_mouseBackPos = m_mousePos;
m_bMouseBack = FALSE;
m_bMouseShow = TRUE;
m_bBackDisplayed = FALSE;
m_bMouseBack = false;
m_bMouseShow = true;
m_bBackDisplayed = false;
m_lpDD = NULL;
m_lpDDSPrimary = NULL;
@ -104,7 +104,7 @@ CPixmap::~CPixmap()
}
void CPixmap::SetDebug(BOOL bDebug)
void CPixmap::SetDebug(bool bDebug)
{
m_bDebug = bDebug;
DDSetDebug(bDebug);
@ -112,10 +112,10 @@ void CPixmap::SetDebug(BOOL bDebug)
// Crée l'objet DirectDraw principal.
// Retourne FALSE en cas d'erreur.
// Retourne false en cas d'erreur.
BOOL CPixmap::Create(HWND hwnd, POINT dim,
BOOL bFullScreen, int mouseType)
bool CPixmap::Create(HWND hwnd, POINT dim,
bool bFullScreen, int mouseType)
{
DDSURFACEDESC ddsd;
HRESULT ddrval;
@ -129,7 +129,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
if ( m_mouseType == MOUSETYPEGRA )
{
// Cache définitivement la vilaine souris Windows.
ShowCursor(FALSE);
ShowCursor(false);
pos = m_mousePos;
ClientToScreen(m_hWnd, &pos);
@ -146,7 +146,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
if ( ddrval != DD_OK )
{
OutputDebug("Fatal error: DirectDrawCreate\n");
return FALSE;
return false;
}
// Get exclusive mode.
@ -161,7 +161,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
if ( ddrval != DD_OK )
{
OutputDebug("Fatal error: SetCooperativeLevel\n");
return FALSE;
return false;
}
// Set the video mode to 640x480x8.
@ -171,7 +171,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
if ( ddrval != DD_OK )
{
OutputDebug("Fatal error: SetDisplayMode\n");
return FALSE;
return false;
}
}
@ -186,7 +186,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
{
TraceErrorDD(ddrval, "pixmap", 0);
OutputDebug("Fatal error: CreateSurface\n");
return FALSE;
return false;
}
// Create the back buffer.
@ -203,7 +203,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
{
TraceErrorDD(ddrval, "pixmap", 0);
OutputDebug("Fatal error: CreateBackSurface\n");
return FALSE;
return false;
}
// Create the mouse buffer.
@ -220,7 +220,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
{
TraceErrorDD(ddrval, "pixmap", 0);
OutputDebug("Fatal error: CreateMouseSurface\n");
return FALSE;
return false;
}
// Create a DirectDrawClipper object. The object enables clipping to the
@ -233,7 +233,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
{
TraceErrorDD(ddrval, "pixmap", 0);
OutputDebug("Can't create clipper\n");
return FALSE;
return false;
}
ddrval = m_lpClipper->SetHWnd(0, hwnd);
@ -241,7 +241,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
{
TraceErrorDD(ddrval, "pixmap", 0);
OutputDebug("Can't set clipper window handle\n");
return FALSE;
return false;
}
ddrval = m_lpDDSPrimary->SetClipper(m_lpClipper);
@ -249,53 +249,53 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim,
{
TraceErrorDD(ddrval, "pixmap", 0);
OutputDebug("Can't attach clipper to primary surface\n");
return FALSE;
return false;
}
}
return TRUE;
return true;
}
// Libère les bitmaps.
BOOL CPixmap::Flush()
bool CPixmap::Flush()
{
return TRUE;
return true;
}
// Restitue les bitmaps.
BOOL CPixmap::Restore()
bool CPixmap::Restore()
{
RestoreAll();
return TRUE;
return true;
}
// Initialise la palette système.
BOOL CPixmap::InitSysPalette()
bool CPixmap::InitSysPalette()
{
HDC hdc;
int caps;
hdc = CreateCompatibleDC(NULL);
if ( hdc == NULL ) return FALSE;
if ( hdc == NULL ) return false;
if ( !m_bFullScreen )
{
caps = GetDeviceCaps(hdc, SIZEPALETTE);
if ( caps == 0 ) m_bPalette = FALSE;
else m_bPalette = TRUE;
if ( caps == 0 ) m_bPalette = false;
else m_bPalette = true;
}
GetSystemPaletteEntries(hdc, 0, 256, m_sysPal);
DeleteDC(hdc);
return TRUE;
return true;
}
// Indique si l'on utilise une palette.
BOOL CPixmap::IsPalette()
bool CPixmap::IsPalette()
{
return m_bPalette;
}
@ -387,7 +387,7 @@ HRESULT CPixmap::BltFast(int chDst, int channel,
if ( rcRect.left >= rcRect.right ||
rcRect.top >= rcRect.bottom ) return DD_OK;
while( TRUE )
while( true )
{
if ( chDst < 0 )
{
@ -427,7 +427,7 @@ HRESULT CPixmap::BltFast(LPDIRECTDRAWSURFACE lpDD,
if ( mode == 0 ) dwTrans = DDBLTFAST_SRCCOLORKEY;
else dwTrans = DDBLTFAST_NOCOLORKEY;
while( TRUE )
while( true )
{
ddrval = lpDD->BltFast(dst.x, dst.y,
m_lpDDSurface[channel],
@ -449,28 +449,28 @@ HRESULT CPixmap::BltFast(LPDIRECTDRAWSURFACE lpDD,
// Sauve toute la palette de couleurs.
BOOL CPixmap::SavePalette()
bool CPixmap::SavePalette()
{
HRESULT ddrval;
if ( m_lpDDPal == NULL ) return FALSE;
if ( m_lpDDPal == NULL ) return false;
ddrval = m_lpDDPal->GetEntries(0, 0, 256, m_pal);
if ( ddrval != DD_OK ) return FALSE;
return TRUE;
if ( ddrval != DD_OK ) return false;
return true;
}
// Restitue toute la palette de couleurs.
BOOL CPixmap::RestorePalette()
bool CPixmap::RestorePalette()
{
HRESULT ddrval;
ddrval = m_lpDDPal->SetEntries(0, 0, 256, m_pal);
if ( ddrval != DD_OK ) return FALSE;
return TRUE;
if ( ddrval != DD_OK ) return false;
return true;
}
// Cherche une couleur dans la palette principale.
@ -551,12 +551,12 @@ int CPixmap::SearchColor(int red, int green, int blue)
// Cache une image contenant des icônes.
BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim,
BOOL bUsePalette)
bool CPixmap::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim,
bool bUsePalette)
{
HRESULT ddrval;
if ( channel < 0 || channel >= MAXIMAGE ) return FALSE;
if ( channel < 0 || channel >= MAXIMAGE ) return false;
if ( m_lpDDSurface[channel] != NULL )
{
@ -594,7 +594,7 @@ BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim,
if ( m_lpDDSurface[channel] == NULL )
{
OutputDebug("Fatal error: DDLoadBitmap\n");
return FALSE;
return false;
}
// Set the color key to white
@ -606,16 +606,16 @@ BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim,
m_totalDim[channel] = totalDim;
m_iconDim[channel] = iconDim;
return TRUE;
return true;
}
// Cache une image globale.
BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, BOOL bUsePalette)
bool CPixmap::Cache(int channel, char *pFilename, POINT totalDim, bool bUsePalette)
{
POINT iconDim;
if ( channel < 0 || channel >= MAXIMAGE ) return FALSE;
if ( channel < 0 || channel >= MAXIMAGE ) return false;
iconDim.x = 0;
iconDim.y = 0;
@ -625,9 +625,9 @@ BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, BOOL bUsePalet
// Cache une image provenant d'un bitmap.
BOOL CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim)
bool CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim)
{
if ( channel < 0 || channel >= MAXIMAGE ) return FALSE;
if ( channel < 0 || channel >= MAXIMAGE ) return false;
if ( m_lpDDSurface[channel] != NULL )
{
@ -640,7 +640,7 @@ BOOL CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim)
if ( m_lpDDSurface[channel] == NULL )
{
OutputDebug("Fatal error: DDLoadBitmap\n");
return FALSE;
return false;
}
// Set the color key to white
@ -649,7 +649,7 @@ BOOL CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim)
m_totalDim[channel] = totalDim;
m_iconDim[channel] = totalDim;
return TRUE;
return true;
}
// Purge une image.
@ -705,58 +705,58 @@ RECT CPixmap::GetClipping()
// Teste si un point fait partie d'une icône.
BOOL CPixmap::IsIconPixel(int channel, int rank, POINT pos)
bool CPixmap::IsIconPixel(int channel, int rank, POINT pos)
{
int nbx, nby;
COLORREF rgb;
HDC hDC;
if ( channel < 0 || channel >= MAXIMAGE ) return FALSE;
if ( m_lpDDSurface[channel] == NULL ) return FALSE;
if ( channel < 0 || channel >= MAXIMAGE ) return false;
if ( m_lpDDSurface[channel] == NULL ) return false;
if ( m_iconDim[channel].x == 0 ||
m_iconDim[channel].y == 0 ) return FALSE;
m_iconDim[channel].y == 0 ) return false;
nbx = m_totalDim[channel].x / m_iconDim[channel].x;
nby = m_totalDim[channel].y / m_iconDim[channel].y;
if ( rank < 0 || rank >= nbx*nby ) return FALSE;
if ( rank < 0 || rank >= nbx*nby ) return false;
pos.x += (rank%nbx)*m_iconDim[channel].x;
pos.y += (rank/nbx)*m_iconDim[channel].y;
if ( m_lpDDSurface[channel]->GetDC(&hDC) != DD_OK ) return FALSE;
if ( m_lpDDSurface[channel]->GetDC(&hDC) != DD_OK ) return false;
rgb = GetPixel(hDC, pos.x, pos.y);
m_lpDDSurface[channel]->ReleaseDC(hDC);
if ( rgb == m_colorSurface[2*channel+0] ||
rgb == m_colorSurface[2*channel+1] ) return FALSE;
rgb == m_colorSurface[2*channel+1] ) return false;
return TRUE;
return true;
}
// Dessine une partie d'image rectangulaire.
// Les modes sont 0=transparent, 1=opaque.
BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos,
int mode, BOOL bMask)
bool CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos,
int mode, bool bMask)
{
int nbx, nby;
RECT rect;
HRESULT ddrval;
COLORREF oldColor1, oldColor2;
if ( channel < 0 || channel >= MAXIMAGE ) return FALSE;
if ( m_lpDDSurface[channel] == NULL ) return FALSE;
if ( channel < 0 || channel >= MAXIMAGE ) return false;
if ( m_lpDDSurface[channel] == NULL ) return false;
if ( m_iconDim[channel].x == 0 ||
m_iconDim[channel].y == 0 ) return FALSE;
m_iconDim[channel].y == 0 ) return false;
nbx = m_totalDim[channel].x / m_iconDim[channel].x;
nby = m_totalDim[channel].y / m_iconDim[channel].y;
if ( rank < 0 || rank >= nbx*nby ) return FALSE;
if ( rank < 0 || rank >= nbx*nby ) return false;
rect.left = (rank%nbx)*m_iconDim[channel].x;
rect.top = (rank/nbx)*m_iconDim[channel].y;
@ -769,8 +769,8 @@ BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos,
ddrval = BltFast(chDst, channel, pos, rect, mode);
if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2);
if ( ddrval != DD_OK ) return FALSE;
return TRUE;
if ( ddrval != DD_OK ) return false;
return true;
}
// Dessine une partie d'image rectangulaire.
@ -783,26 +783,26 @@ BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos,
// 32,32 34,33
// 33,48 35,49
BOOL CPixmap::DrawIconDemi(int chDst, int channel, int rank, POINT pos,
int mode, BOOL bMask)
bool CPixmap::DrawIconDemi(int chDst, int channel, int rank, POINT pos,
int mode, bool bMask)
{
int nbx, nby;
RECT rect;
HRESULT ddrval;
COLORREF oldColor1, oldColor2;
if ( channel < 0 || channel >= MAXIMAGE ) return FALSE;
if ( m_lpDDSurface[channel] == NULL ) return FALSE;
if ( channel < 0 || channel >= MAXIMAGE ) return false;
if ( m_lpDDSurface[channel] == NULL ) return false;
if ( m_iconDim[channel].x == 0 ||
m_iconDim[channel].y == 0 ) return FALSE;
m_iconDim[channel].y == 0 ) return false;
nbx = m_totalDim[channel].x / m_iconDim[channel].x;
nby = m_totalDim[channel].y / (m_iconDim[channel].y/2);
rank = (rank/32)*32+((rank%32)/2)+((rank%2)*16);
if ( rank < 0 || rank >= nbx*nby ) return FALSE;
if ( rank < 0 || rank >= nbx*nby ) return false;
rect.left = (rank%nbx)* m_iconDim[channel].x;
rect.top = (rank/nbx)*(m_iconDim[channel].y/2);
@ -815,32 +815,32 @@ BOOL CPixmap::DrawIconDemi(int chDst, int channel, int rank, POINT pos,
ddrval = BltFast(chDst, channel, pos, rect, mode);
if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2);
if ( ddrval != DD_OK ) return FALSE;
return TRUE;
if ( ddrval != DD_OK ) return false;
return true;
}
// Dessine une partie d'image rectangulaire.
// Les modes sont 0=transparent, 1=opaque.
BOOL CPixmap::DrawIconPart(int chDst, int channel, int rank, POINT pos,
bool CPixmap::DrawIconPart(int chDst, int channel, int rank, POINT pos,
int startY, int endY,
int mode, BOOL bMask)
int mode, bool bMask)
{
int nbx, nby;
RECT rect;
HRESULT ddrval;
COLORREF oldColor1, oldColor2;
if ( channel < 0 || channel >= MAXIMAGE ) return FALSE;
if ( m_lpDDSurface[channel] == NULL ) return FALSE;
if ( channel < 0 || channel >= MAXIMAGE ) return false;
if ( m_lpDDSurface[channel] == NULL ) return false;
if ( m_iconDim[channel].x == 0 ||
m_iconDim[channel].y == 0 ) return FALSE;
m_iconDim[channel].y == 0 ) return false;
nbx = m_totalDim[channel].x / m_iconDim[channel].x;
nby = m_totalDim[channel].y / m_iconDim[channel].y;
if ( rank < 0 || rank >= nbx*nby ) return FALSE;
if ( rank < 0 || rank >= nbx*nby ) return false;
rect.left = (rank%nbx)*m_iconDim[channel].x;
rect.top = (rank/nbx)*m_iconDim[channel].y;
@ -856,21 +856,21 @@ BOOL CPixmap::DrawIconPart(int chDst, int channel, int rank, POINT pos,
ddrval = BltFast(chDst, channel, pos, rect, mode);
if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2);
if ( ddrval != DD_OK ) return FALSE;
return TRUE;
if ( ddrval != DD_OK ) return false;
return true;
}
// Dessine une partie d'image n'importe où.
// Les modes sont 0=transparent, 1=opaque.
BOOL CPixmap::DrawPart(int chDst, int channel, POINT dest, RECT rect,
int mode, BOOL bMask)
bool CPixmap::DrawPart(int chDst, int channel, POINT dest, RECT rect,
int mode, bool bMask)
{
HRESULT ddrval;
COLORREF oldColor1, oldColor2;
if ( channel < 0 || channel >= MAXIMAGE ) return FALSE;
if ( m_lpDDSurface[channel] == NULL ) return FALSE;
if ( channel < 0 || channel >= MAXIMAGE ) return false;
if ( m_lpDDSurface[channel] == NULL ) return false;
oldColor1 = m_colorSurface[2*channel+0];
oldColor2 = m_colorSurface[2*channel+1];
@ -878,41 +878,41 @@ BOOL CPixmap::DrawPart(int chDst, int channel, POINT dest, RECT rect,
ddrval = BltFast(chDst, channel, dest, rect, mode);
if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2);
if ( ddrval != DD_OK ) return FALSE;
return TRUE;
if ( ddrval != DD_OK ) return false;
return true;
}
// Dessine une partie d'image rectangulaire.
// Les modes sont 0=transparent, 1=opaque.
BOOL CPixmap::DrawImage(int chDst, int channel, RECT rect, int mode)
bool CPixmap::DrawImage(int chDst, int channel, RECT rect, int mode)
{
POINT dst;
HRESULT ddrval;
if ( channel < 0 || channel >= MAXIMAGE ) return FALSE;
if ( m_lpDDSurface[channel] == NULL ) return FALSE;
if ( channel < 0 || channel >= MAXIMAGE ) return false;
if ( m_lpDDSurface[channel] == NULL ) return false;
dst.x = rect.left;
dst.y = rect.top;
ddrval = BltFast(chDst, channel, dst, rect, mode);
if ( ddrval != DD_OK ) return FALSE;
if ( ddrval != DD_OK ) return false;
if ( channel == CHBACK )
{
MouseBackSave(); // sauve ce qui sera sous la souris
m_bBackDisplayed = FALSE;
m_bBackDisplayed = false;
}
return TRUE;
return true;
}
// Construit une icône en utilisant un masque.
BOOL CPixmap::BuildIconMask(int channelMask, int rankMask,
bool CPixmap::BuildIconMask(int channelMask, int rankMask,
int channel, int rankSrc, int rankDst)
{
int nbx, nby;
@ -920,17 +920,17 @@ BOOL CPixmap::BuildIconMask(int channelMask, int rankMask,
RECT rect;
HRESULT ddrval;
if ( channel < 0 || channel >= MAXIMAGE ) return FALSE;
if ( m_lpDDSurface[channel] == NULL ) return FALSE;
if ( channel < 0 || channel >= MAXIMAGE ) return false;
if ( m_lpDDSurface[channel] == NULL ) return false;
if ( m_iconDim[channel].x == 0 ||
m_iconDim[channel].y == 0 ) return FALSE;
m_iconDim[channel].y == 0 ) return false;
nbx = m_totalDim[channel].x / m_iconDim[channel].x;
nby = m_totalDim[channel].y / m_iconDim[channel].y;
if ( rankSrc < 0 || rankSrc >= nbx*nby ) return FALSE;
if ( rankDst < 0 || rankDst >= nbx*nby ) return FALSE;
if ( rankSrc < 0 || rankSrc >= nbx*nby ) return false;
if ( rankDst < 0 || rankDst >= nbx*nby ) return false;
rect.left = (rankSrc%nbx)*m_iconDim[channel].x;
rect.top = (rankSrc/nbx)*m_iconDim[channel].y;
@ -939,36 +939,36 @@ BOOL CPixmap::BuildIconMask(int channelMask, int rankMask,
posDst.x = (rankDst%nbx)*m_iconDim[channel].x;
posDst.y = (rankDst/nbx)*m_iconDim[channel].y;
ddrval = BltFast(m_lpDDSurface[channel], channel, posDst, rect, 1);
if ( ddrval != DD_OK ) return FALSE;
if ( ddrval != DD_OK ) return false;
if ( m_iconDim[channelMask].x == 0 ||
m_iconDim[channelMask].y == 0 ) return FALSE;
m_iconDim[channelMask].y == 0 ) return false;
nbx = m_totalDim[channelMask].x / m_iconDim[channelMask].x;
nby = m_totalDim[channelMask].y / m_iconDim[channelMask].y;
if ( rankMask < 0 || rankMask >= nbx*nby ) return FALSE;
if ( rankMask < 0 || rankMask >= nbx*nby ) return false;
rect.left = (rankMask%nbx)*m_iconDim[channelMask].x;
rect.top = (rankMask/nbx)*m_iconDim[channelMask].y;
rect.right = rect.left + m_iconDim[channelMask].x;
rect.bottom = rect.top + m_iconDim[channelMask].y;
ddrval = BltFast(m_lpDDSurface[channel], channelMask, posDst, rect, 0);
if ( ddrval != DD_OK ) return FALSE;
if ( ddrval != DD_OK ) return false;
return TRUE;
return true;
}
// Affiche le pixmap à l'écran.
// Retourne FALSE en cas d'erreur.
// Retourne false en cas d'erreur.
BOOL CPixmap::Display()
bool CPixmap::Display()
{
HRESULT ddrval;
RECT DestRect, MapRect;
m_bBackDisplayed = TRUE;
m_bBackDisplayed = true;
// Get screen coordinates of client window for blit
GetClientRect(m_hWnd, &DestRect);
@ -993,14 +993,14 @@ BOOL CPixmap::Display()
{
ddrval = RestoreAll();
}
if ( ddrval != DD_OK ) return FALSE;
return TRUE;
if ( ddrval != DD_OK ) return false;
return true;
}
// Positionne la souris et change le lutin.
void CPixmap::SetMousePosSprite(POINT pos, int sprite, BOOL bDemoPlay)
void CPixmap::SetMousePosSprite(POINT pos, int sprite, bool bDemoPlay)
{
if ( m_mousePos.x == pos.x &&
m_mousePos.y == pos.y &&
@ -1018,7 +1018,7 @@ void CPixmap::SetMousePosSprite(POINT pos, int sprite, BOOL bDemoPlay)
// Positionne la souris.
void CPixmap::SetMousePos(POINT pos, BOOL bDemoPlay)
void CPixmap::SetMousePos(POINT pos, bool bDemoPlay)
{
if ( m_mousePos.x == pos.x &&
m_mousePos.y == pos.y ) return;
@ -1033,7 +1033,7 @@ void CPixmap::SetMousePos(POINT pos, BOOL bDemoPlay)
// Change le lutin de la souris.
void CPixmap::SetMouseSprite(int sprite, BOOL bDemoPlay)
void CPixmap::SetMouseSprite(int sprite, bool bDemoPlay)
{
if ( m_mouseSprite == sprite ) return;
@ -1048,7 +1048,7 @@ void CPixmap::SetMouseSprite(int sprite, BOOL bDemoPlay)
// Montre ou cache la souris.
void CPixmap::MouseShow(BOOL bShow)
void CPixmap::MouseShow(bool bShow)
{
m_bMouseShow = bShow;
}
@ -1096,7 +1096,7 @@ void CPixmap::MouseUpdate()
// Il s'agit en fait de dessiner un petit morceau rectangulaire
// de m_lpDDSBack dans l'écran.
BOOL CPixmap::MouseQuickDraw(RECT rect)
bool CPixmap::MouseQuickDraw(RECT rect)
{
HRESULT ddrval;
RECT DestRect;
@ -1124,15 +1124,15 @@ BOOL CPixmap::MouseQuickDraw(RECT rect)
{
ddrval = RestoreAll();
}
if ( ddrval != DD_OK ) return FALSE;
return TRUE;
if ( ddrval != DD_OK ) return false;
return true;
}
// Invalide la copie sous la souris.
void CPixmap::MouseInvalidate()
{
m_bMouseBack = FALSE;
m_bMouseBack = false;
}
// Enlève la souris dans m_lpDDSBack.
@ -1200,7 +1200,7 @@ void CPixmap::MouseBackSave()
m_mouseBackPos.x = m_mousePos.x - m_mouseHotSpot.x;
m_mouseBackPos.y = m_mousePos.y - m_mouseHotSpot.y;
m_bMouseBack = TRUE;
m_bMouseBack = true;
dst.x = 0;
dst.y = 0;
@ -1229,7 +1229,7 @@ void CPixmap::MouseBackSave()
rcRect.bottom = LYIMAGE;
}
while( TRUE )
while( true )
{
ddrval = m_lpDDSMouse->BltFast(dst.x, dst.y,
m_lpDDSBack,
@ -1285,7 +1285,7 @@ void CPixmap::MouseBackRestore()
rcRect.bottom -= (dst.y+DIMBLUPIY)-LYIMAGE;
}
while( TRUE )
while( true )
{
ddrval = m_lpDDSBack->BltFast(dst.x, dst.y,
m_lpDDSMouse,

View File

@ -15,44 +15,44 @@ public:
CPixmap();
~CPixmap();
void SetDebug(BOOL bDebug);
void SetDebug(bool bDebug);
BOOL Create(HWND hwnd, POINT dim, BOOL bFullScreen, int mouseType);
BOOL Flush();
BOOL Restore();
BOOL InitSysPalette();
BOOL IsPalette();
bool Create(HWND hwnd, POINT dim, bool bFullScreen, int mouseType);
bool Flush();
bool Restore();
bool InitSysPalette();
bool IsPalette();
void Fill(RECT rect, COLORREF color);
BOOL SavePalette();
BOOL RestorePalette();
bool SavePalette();
bool RestorePalette();
int SearchColor(int red, int green, int blue);
BOOL Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, BOOL bUsePalette);
BOOL Cache(int channel, char *pFilename, POINT totalDim, BOOL bUsePalette);
BOOL Cache(int channel, HBITMAP hbm, POINT totalDim);
bool Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, bool bUsePalette);
bool Cache(int channel, char *pFilename, POINT totalDim, bool bUsePalette);
bool Cache(int channel, HBITMAP hbm, POINT totalDim);
void Flush(int channel);
void SetTransparent(int channel, COLORREF color);
void SetTransparent2(int channel, COLORREF color1, COLORREF color2);
void SetClipping(RECT clip);
RECT GetClipping();
BOOL IsIconPixel(int channel, int rank, POINT pos);
bool IsIconPixel(int channel, int rank, POINT pos);
BOOL DrawIcon(int chDst, int channel, int rank, POINT pos, int mode=0, BOOL bMask=FALSE);
BOOL DrawIconDemi(int chDst, int channel, int rank, POINT pos, int mode=0, BOOL bMask=FALSE);
BOOL DrawIconPart(int chDst, int channel, int rank, POINT pos, int startY, int endY, int mode=0, BOOL bMask=FALSE);
BOOL DrawPart(int chDst, int channel, POINT dest, RECT rect, int mode=0, BOOL bMask=FALSE);
BOOL DrawImage(int chDst, int channel, RECT rect, int mode=0);
bool DrawIcon(int chDst, int channel, int rank, POINT pos, int mode=0, bool bMask=false);
bool DrawIconDemi(int chDst, int channel, int rank, POINT pos, int mode=0, bool bMask=false);
bool DrawIconPart(int chDst, int channel, int rank, POINT pos, int startY, int endY, int mode=0, bool bMask=false);
bool DrawPart(int chDst, int channel, POINT dest, RECT rect, int mode=0, bool bMask=false);
bool DrawImage(int chDst, int channel, RECT rect, int mode=0);
BOOL BuildIconMask(int channelMask, int rankMask,
bool BuildIconMask(int channelMask, int rankMask,
int channel, int rankSrc, int rankDst);
BOOL Display();
bool Display();
void SetMousePosSprite(POINT pos, int sprite, BOOL bDemoPlay);
void SetMousePos(POINT pos, BOOL bDemoPlay);
void SetMouseSprite(int sprite, BOOL bDemoPlay);
void MouseShow(BOOL bShow);
void SetMousePosSprite(POINT pos, int sprite, bool bDemoPlay);
void SetMousePos(POINT pos, bool bDemoPlay);
void SetMouseSprite(int sprite, bool bDemoPlay);
void MouseShow(bool bShow);
void MouseInvalidate();
void MouseBackClear();
void MouseBackDraw();
@ -64,7 +64,7 @@ protected:
int channel, POINT dst, RECT rcRect, int mode);
void MouseUpdate();
BOOL MouseQuickDraw(RECT rect);
bool MouseQuickDraw(RECT rect);
void MouseBackSave();
void MouseBackRestore();
void MouseBackDebug();
@ -72,10 +72,10 @@ protected:
void MouseHotSpot();
protected:
BOOL m_bFullScreen;
bool m_bFullScreen;
int m_mouseType;
BOOL m_bDebug;
BOOL m_bPalette;
bool m_bDebug;
bool m_bPalette;
HWND m_hWnd;
POINT m_dim; // dimensions totales
RECT m_clipRect; // rectangle de clipping
@ -84,9 +84,9 @@ protected:
int m_mouseSprite;
POINT m_mouseHotSpot;
POINT m_mouseBackPos;
BOOL m_bMouseBack;
BOOL m_bMouseShow;
BOOL m_bBackDisplayed;
bool m_bMouseBack;
bool m_bMouseShow;
bool m_bBackDisplayed;
LPDIRECTDRAW m_lpDD; // DirectDraw object
LPDIRECTDRAWSURFACE m_lpDDSPrimary; // DirectDraw primary surface

108
sound.cpp
View File

@ -14,7 +14,7 @@
// The following macro are used for proper error handling for DirectSound.
#define TRY_DS(exp) { { HRESULT rval = exp; if (rval != DS_OK) { TraceErrorDS(rval, __FILE__, __LINE__); return FALSE; } } }
#define TRY_DS(exp) { { HRESULT rval = exp; if (rval != DS_OK) { TraceErrorDS(rval, __FILE__, __LINE__); return false; } } }
struct WaveHeader
@ -39,7 +39,7 @@ struct WaveHeader
// Creates a DirectSound buffer.
BOOL CSound::CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo)
bool CSound::CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, bool bStereo)
{
PCMWAVEFORMAT pcmwf;
DSBUFFERDESC dsbdesc;
@ -61,19 +61,19 @@ BOOL CSound::CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD d
dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf;
TRY_DS(m_lpDS->CreateSoundBuffer(&dsbdesc, &m_lpDSB[dwBuf], NULL))
return TRUE;
return true;
}
// Reads in data from a wave file.
BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos)
bool CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos)
{
// Seek to correct position in file (if necessary)
if ( dwPos != 0xffffffff )
{
if ( fseek(pFile, dwPos, SEEK_SET) != 0 )
{
return FALSE;
return false;
}
}
@ -87,7 +87,7 @@ BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWOR
rval = lpDSB->Lock(0, dwSize, &pData1, &dwData1Size, &pData2, &dwData2Size, DSBLOCK_FROMWRITECURSOR);
if ( rval != DS_OK )
{
return FALSE;
return false;
}
// Read in first chunk of data
@ -98,7 +98,7 @@ BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWOR
char holder[256];
wsprintf(holder,"Data1 : %d, dwdata: %d, pFile: %d",pData1,dwData1Size,pFile);
OutputDebug(holder);
return FALSE;
return false;
}
}
@ -107,7 +107,7 @@ BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWOR
{
if ( fread(pData2, dwData2Size, 1, pFile) != 1 )
{
return FALSE;
return false;
}
}
@ -115,19 +115,19 @@ BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWOR
rval = lpDSB->Unlock(pData1, dwData1Size, pData2, dwData2Size);
if ( rval != DS_OK )
{
return FALSE;
return false;
}
return TRUE;
return true;
}
// Creates a DirectSound buffer from a wave file.
BOOL CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName)
bool CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName)
{
// Open the wave file
FILE* pFile = fopen(pFileName, "rb");
if ( pFile == NULL ) return FALSE;
if ( pFile == NULL ) return false;
// Read in the wave header
WaveHeader wavHdr;
@ -141,7 +141,7 @@ BOOL CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName)
DWORD dwSize = wavHdr.dwDSize;
// Is this a stereo or mono file?
BOOL bStereo = wavHdr.wChnls > 1 ? TRUE : FALSE;
bool bStereo = wavHdr.wChnls > 1 ? true : false;
// Create the sound buffer for the wave file
if ( !CreateSoundBuffer(dwBuf, dwSize, wavHdr.dwSRate,
@ -150,25 +150,25 @@ BOOL CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName)
// Close the file
fclose(pFile);
return FALSE;
return false;
}
// Read the data for the wave file into the sound buffer
if ( !ReadData(m_lpDSB[dwBuf], pFile, dwSize, sizeof(wavHdr)) )
{
fclose(pFile);
return FALSE;
return false;
}
// Close out the wave file
fclose(pFile);
return TRUE;
return true;
}
// Stops all sounds.
BOOL CSound::StopAllSounds()
bool CSound::StopAllSounds()
{
// Make sure we have a valid sound buffer
for (int i = 0; i < MAXSOUND; i ++)
@ -185,15 +185,15 @@ BOOL CSound::StopAllSounds()
}
}
return TRUE;
return true;
}
// Plays a sound using direct sound.
BOOL CSound::PlaySoundDS(DWORD dwSound, DWORD dwFlags)
bool CSound::PlaySoundDS(DWORD dwSound, DWORD dwFlags)
{
// Make sure the sound is valid
if ( dwSound >= MAXSOUND ) return FALSE;
if ( dwSound >= MAXSOUND ) return false;
// Make sure we have a valid sound buffer
if ( m_lpDSB[dwSound] )
@ -208,7 +208,7 @@ BOOL CSound::PlaySoundDS(DWORD dwSound, DWORD dwFlags)
}
}
return TRUE;
return true;
}
@ -282,8 +282,8 @@ CSound::CSound()
{
int i;
m_bEnable = FALSE;
m_bState = FALSE;
m_bEnable = false;
m_bState = false;
m_MidiDeviceID = 0;
m_MIDIFilename[0] = 0;
m_audioVolume = 20;
@ -334,25 +334,25 @@ CSound::~CSound()
// Initialisation de DirectSound.
BOOL CSound::Create(HWND hWnd)
bool CSound::Create(HWND hWnd)
{
if ( !DirectSoundCreate(NULL, &m_lpDS, NULL) == DS_OK )
{
OutputDebug("Fatal error: DirectSoundCreate\n");
m_bEnable = FALSE;
return FALSE;
m_bEnable = false;
return false;
}
m_lpDS->SetCooperativeLevel(hWnd, DSSCL_NORMAL);
m_bEnable = TRUE;
m_bEnable = true;
m_hWnd = hWnd;
return TRUE;
return true;
}
// Retourne l'état de DirectSound.
BOOL CSound::GetEnable()
bool CSound::GetEnable()
{
return m_bEnable;
}
@ -360,7 +360,7 @@ BOOL CSound::GetEnable()
// Enclenche ou déclenche le son.
void CSound::SetState(BOOL bState)
void CSound::SetState(bool bState)
{
m_bState = bState;
}
@ -409,10 +409,10 @@ void CSound::CacheAll()
// Charge un fichier son (.wav).
BOOL CSound::Cache(int channel, char *pFilename)
bool CSound::Cache(int channel, char *pFilename)
{
if ( !m_bEnable ) return FALSE;
if ( channel < 0 || channel >= MAXSOUND ) return FALSE;
if ( !m_bEnable ) return false;
if ( channel < 0 || channel >= MAXSOUND ) return false;
if ( m_lpDSB[channel] != NULL )
{
@ -441,31 +441,31 @@ void CSound::Flush(int channel)
// Le panoramique est compris entre -10000 (gauche), 0 (centre)
// et +10000 (droite).
BOOL CSound::Play(int channel, int volume, int pan)
bool CSound::Play(int channel, int volume, int pan)
{
if ( !m_bEnable ) return TRUE;
if ( !m_bState || m_audioVolume == 0 ) return TRUE;
if ( !m_bEnable ) return true;
if ( !m_bState || m_audioVolume == 0 ) return true;
volume -= (MAXVOLUME-m_audioVolume)*((10000/4)/MAXVOLUME);
//? if ( volume == -10000 ) return TRUE;
if ( volume <= -10000/4 ) return TRUE;
//? if ( volume == -10000 ) return true;
if ( volume <= -10000/4 ) return true;
if ( channel < 0 || channel >= MAXSOUND ) return FALSE;
if ( m_lpDSB[channel] == NULL ) return FALSE;
if ( channel < 0 || channel >= MAXSOUND ) return false;
if ( m_lpDSB[channel] == NULL ) return false;
m_lpDSB[channel]->SetVolume(volume);
m_lpDSB[channel]->SetPan(pan);
m_lpDSB[channel]->Play(0, 0, 0);
return TRUE;
return true;
}
// Fait entendre un son dans une image.
// Si rank != -1, il indique le rang du blupi dont il faudra
// éventuellement stopper le dernier son en cours !
BOOL CSound::PlayImage(int channel, POINT pos, int rank)
bool CSound::PlayImage(int channel, POINT pos, int rank)
{
int stopCh, volumex, volumey, volume, pan;
@ -519,15 +519,15 @@ BOOL CSound::PlayImage(int channel, POINT pos, int rank)
// Uses MCI to play a MIDI file. The window procedure
// is notified when playback is complete.
BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename)
bool CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename)
{
MCI_OPEN_PARMS mciOpenParms;
MCI_PLAY_PARMS mciPlayParms;
DWORD dwReturn;
char string[MAX_PATH];
if ( !m_bEnable ) return TRUE;
if ( m_midiVolume == 0 ) return TRUE;
if ( !m_bEnable ) return true;
if ( m_midiVolume == 0 ) return true;
InitMidiVolume(m_midiVolume);
m_lastMidiVolume = m_midiVolume;
@ -555,7 +555,7 @@ BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename)
mciGetErrorString(dwReturn, string, 128);
OutputDebug(string);
// Failed to open device. Don't close it; just return error.
return FALSE;
return false;
}
// The device opened successfully; get the device ID.
@ -573,22 +573,22 @@ BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename)
mciGetErrorString(dwReturn, string, 128);
OutputDebug(string);
StopMusic();
return FALSE;
return false;
}
strcpy(m_MIDIFilename, lpszMIDIFilename);
return TRUE;
return true;
}
// Restart the MIDI player.
BOOL CSound::RestartMusic()
bool CSound::RestartMusic()
{
OutputDebug("RestartMusic\n");
if ( !m_bEnable ) return TRUE;
if ( m_midiVolume == 0 ) return TRUE;
if ( m_MIDIFilename[0] == 0 ) return FALSE;
if ( !m_bEnable ) return true;
if ( m_midiVolume == 0 ) return true;
if ( m_MIDIFilename[0] == 0 ) return false;
return PlayMusic(m_hWnd, m_MIDIFilename);
}
@ -620,9 +620,9 @@ void CSound::StopMusic()
m_MIDIFilename[0] = 0;
}
// Retourne TRUE si une musique est en cours.
// Retourne true si une musique est en cours.
BOOL CSound::IsPlayingMusic()
bool CSound::IsPlayingMusic()
{
return (m_MIDIFilename[0] != 0);
}

32
sound.h
View File

@ -19,9 +19,9 @@ public:
CSound();
~CSound();
BOOL Create(HWND hWnd);
void SetState(BOOL bState);
BOOL GetEnable();
bool Create(HWND hWnd);
void SetState(bool bState);
bool GetEnable();
void SetAudioVolume(int volume);
int GetAudioVolume();
@ -29,30 +29,30 @@ public:
int GetMidiVolume();
void CacheAll();
BOOL Cache(int channel, char *pFilename);
bool Cache(int channel, char *pFilename);
void Flush(int channel);
BOOL Play(int channel, int volume=0, int pan=0);
BOOL PlayImage(int channel, POINT pos, int rank=-1);
BOOL PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename);
BOOL RestartMusic();
bool Play(int channel, int volume=0, int pan=0);
bool PlayImage(int channel, POINT pos, int rank=-1);
bool PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename);
bool RestartMusic();
void SuspendMusic();
void StopMusic();
BOOL IsPlayingMusic();
bool IsPlayingMusic();
void AdaptVolumeMusic();
void SetSuspendSkip(int nb);
protected:
BOOL CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo);
BOOL ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos);
BOOL CreateBufferFromWaveFile(int dwBuf, char *pFileName);
BOOL StopAllSounds();
BOOL PlaySoundDS(DWORD dwSound, DWORD dwFlags);
bool CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, bool bStereo);
bool ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos);
bool CreateBufferFromWaveFile(int dwBuf, char *pFileName);
bool StopAllSounds();
bool PlaySoundDS(DWORD dwSound, DWORD dwFlags);
protected:
HWND m_hWnd;
BOOL m_bEnable;
BOOL m_bState;
bool m_bEnable;
bool m_bState;
LPDIRECTSOUND m_lpDS;
LPDIRECTSOUNDBUFFER m_lpDSB[MAXSOUND];
short m_channelBlupi[MAXBLUPI];

View File

@ -21,7 +21,7 @@ WAVEFILE, *LPWAVEFILE;
// Function Prototypes
BOOL wave_ParseWaveMemory(void *pvRes,
bool wave_ParseWaveMemory(void *pvRes,
WAVEFORMATEX **ppWaveHeader,
BYTE **ppbWaveData,
DWORD *pcbWaveSize);
@ -80,7 +80,7 @@ LPVOID WAVE_LoadResource
//
//////////////////////////////////////////////////////////////////
BOOL wave_ParseWaveMemory
bool wave_ParseWaveMemory
(LPVOID lpChunkOfMemory, // Points to raw ram
LPWAVEFORMATEX *lplpWaveHeader, // Points to pointer to header
@ -115,10 +115,10 @@ BOOL wave_ParseWaveMemory
// Using the mmioFOURCC macro (part of Windows SDK), ensure
// that this is a RIFF WAVE chunk of memory
if (dwRiff != mmioFOURCC('R', 'I', 'F', 'F'))
return FALSE; // not even RIFF
return false; // not even RIFF
if (dwType != mmioFOURCC('W', 'A', 'V', 'E'))
return FALSE; // not a WAV
return false; // not a WAV
// Find the pointer to the end of the chunk of memory
pdwEnd = (DWORD *)((BYTE *)pdw + dwLength-4);
@ -137,7 +137,7 @@ BOOL wave_ParseWaveMemory
if (lplpWaveHeader && !*lplpWaveHeader)
{
if (dwLength < sizeof(WAVEFORMAT))
return FALSE; // something's wrong! Not a WAV
return false; // something's wrong! Not a WAV
// Set the lplpWaveHeader to point to this part of
// the memory chunk
@ -150,7 +150,7 @@ BOOL wave_ParseWaveMemory
if ((!lplpWaveSamples || *lplpWaveSamples) &&
(!lpcbWaveSize || *lpcbWaveSize))
{
return TRUE;
return true;
}
}
break;
@ -171,7 +171,7 @@ BOOL wave_ParseWaveMemory
// Make sure we have our header pointer set up.
// If we do, we can exit
if (!lplpWaveHeader || *lplpWaveHeader)
return TRUE;
return true;
}
break;
@ -183,7 +183,7 @@ BOOL wave_ParseWaveMemory
// Failed! If we made it here, we did not get all the pieces
// of the wave
return FALSE;
return false;
} // wave_ParseWaveMemory