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. // 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, bool Action(short action, short direct,
short &phase, short &step, short &phase, short &step,
@ -2615,18 +2615,18 @@ bool Action(short action, short direct,
pos.x /= 100; pos.x /= 100;
pos.y /= 100; pos.y /= 100;
if ( phase >= nbPhase ) return FALSE; if ( phase >= nbPhase ) return false;
phase ++; phase ++;
step ++; step ++;
return TRUE; return true;
} }
pTable ++; pTable ++;
} }
return FALSE; return false;
} }
@ -2667,31 +2667,31 @@ bool Rotate(short &icon, short direct)
if ( icon >= 200 && icon <= 215 ) // tracks ? if ( icon >= 200 && icon <= 215 ) // tracks ?
{ {
icon = (direct/8)+200; icon = (direct/8)+200;
return TRUE; return true;
} }
if ( icon >= 216 && icon <= 231 ) // robot ? if ( icon >= 216 && icon <= 231 ) // robot ?
{ {
icon = (direct/8)+216; icon = (direct/8)+216;
return TRUE; return true;
} }
if ( icon >= 290 && icon <= 305 ) // disciple ? if ( icon >= 290 && icon <= 305 ) // disciple ?
{ {
icon = (direct/8)+290; icon = (direct/8)+290;
return TRUE; return true;
} }
if ( icon >= 234 && icon <= 249 ) // blupi en bateau ? if ( icon >= 234 && icon <= 249 ) // blupi en bateau ?
{ {
icon = (direct/8)+234; icon = (direct/8)+234;
return TRUE; return true;
} }
if ( icon >= 250 && icon <= 265 ) // blupi en jeep ? if ( icon >= 250 && icon <= 265 ) // blupi en jeep ?
{ {
icon = (direct/8)+250; icon = (direct/8)+250;
return TRUE; return true;
} }
if ( icon >= 169 && icon <= 192 ) // blupi malade ? if ( icon >= 169 && icon <= 192 ) // blupi malade ?
@ -2707,14 +2707,14 @@ bool Rotate(short &icon, short direct)
if ( icon == pTable[i] ) if ( icon == pTable[i] )
{ {
icon = pTable[direct/16]+offset; icon = pTable[direct/16]+offset;
return TRUE; return true;
} }
} }
pTable += 8; pTable += 8;
} }
return FALSE; return false;
} }
// Retourne la direction d'une icône. // 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. // 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; int icon;
@ -59,13 +59,13 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index)
pBits[3] = 0; pBits[3] = 0;
if ( cel.x < 0 || cel.x >= MAXCELX || 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; icon = m_decor[cel.x/2][cel.y/2].floorIcon;
if ( index == 0 ) // eau ? if ( index == 0 ) // eau ?
{ {
if ( icon < 1 || icon > 14 ) return TRUE; if ( icon < 1 || icon > 14 ) return true;
icon -= 1; icon -= 1;
pBits[0] = tableSee[icon*4+0]; pBits[0] = tableSee[icon*4+0];
pBits[1] = tableSee[icon*4+1]; pBits[1] = tableSee[icon*4+1];
@ -75,16 +75,16 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index)
if ( index == 1 ) // mousse ? 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 ? if ( icon == 66 || icon == 79 ) // mousse spéciale ?
{ {
pBits[0] = 1; pBits[0] = 1;
pBits[1] = 1; pBits[1] = 1;
pBits[2] = 1; pBits[2] = 1;
pBits[3] = 1; pBits[3] = 1;
return TRUE; return true;
} }
if ( icon < 20 || icon > 32 ) return TRUE; if ( icon < 20 || icon > 32 ) return true;
icon -= 20; icon -= 20;
pBits[0] = tableDark[icon*4+0]; pBits[0] = tableDark[icon*4+0];
pBits[1] = tableDark[icon*4+1]; pBits[1] = tableDark[icon*4+1];
@ -94,7 +94,7 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index)
if ( index == 2 ) // terre ? 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 ? if ( (icon >= 46 && icon <= 48) || // terre spéciale ?
icon == 71 ) // terre à fer ? icon == 71 ) // terre à fer ?
{ {
@ -102,9 +102,9 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index)
pBits[1] = 1; pBits[1] = 1;
pBits[2] = 1; pBits[2] = 1;
pBits[3] = 1; pBits[3] = 1;
return TRUE; return true;
} }
if ( icon < 33 || icon > 45 ) return TRUE; if ( icon < 33 || icon > 45 ) return true;
icon -= 33; icon -= 33;
pBits[0] = tableDark[icon*4+0]; pBits[0] = tableDark[icon*4+0];
pBits[1] = tableDark[icon*4+1]; 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]; pBits[3] = tableDark[icon*4+3];
} }
return TRUE; return true;
} }
void CopyBits(char *pDst, char *pSrc) 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++ ) 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. // Retourne l'icône correspondant aux bits d'eaux.
@ -186,7 +186,7 @@ void CDecor::ArrangeFloor(POINT cel)
POINT test; POINT test;
int max, index, icon; int max, index, icon;
char here[4], bits[4], init[4]; char here[4], bits[4], init[4];
BOOL bModif = FALSE; bool bModif = false;
icon = m_decor[cel.x/2][cel.y/2].floorIcon; icon = m_decor[cel.x/2][cel.y/2].floorIcon;
@ -212,7 +212,7 @@ void CDecor::ArrangeFloor(POINT cel)
bits[3] != here[2] ) bits[3] != here[2] )
{ {
here[2] = bits[1]; here[2] = bits[1];
bModif = TRUE; bModif = true;
} }
} }
@ -226,7 +226,7 @@ void CDecor::ArrangeFloor(POINT cel)
bits[3] != here[0] ) bits[3] != here[0] )
{ {
here[0] = bits[3]; here[0] = bits[3];
bModif = TRUE; bModif = true;
} }
} }
@ -240,7 +240,7 @@ void CDecor::ArrangeFloor(POINT cel)
bits[3] != here[1] ) bits[3] != here[1] )
{ {
here[1] = bits[2]; here[1] = bits[2];
bModif = TRUE; bModif = true;
} }
} }
@ -254,7 +254,7 @@ void CDecor::ArrangeFloor(POINT cel)
bits[2] != here[3] ) bits[2] != here[3] )
{ {
here[3] = bits[0]; here[3] = bits[0];
bModif = TRUE; bModif = true;
} }
} }
@ -575,7 +575,7 @@ void CDecor::ArrangeObject(POINT cel)
int first, last; int first, last;
int index, i, j, k, x, y; int index, i, j, k, x, y;
POINT vector, test, pos; POINT vector, test, pos;
BOOL bTour; bool bTour;
for ( index=0 ; index<3 ; index++ ) for ( index=0 ; index<3 ; index++ )
{ {
@ -635,16 +635,16 @@ void CDecor::ArrangeObject(POINT cel)
vector = GetVector(i*2*16); vector = GetVector(i*2*16);
test = cel; test = cel;
bTour = FALSE; bTour = false;
j = 0; j = 0;
while ( TRUE ) while ( true )
{ {
test.x += vector.x*2; test.x += vector.x*2;
test.y += vector.y*2; test.y += vector.y*2;
if ( m_decor[test.x/2][test.y/2].objectIcon == 27 ) // tour ? if ( m_decor[test.x/2][test.y/2].objectIcon == 27 ) // tour ?
{ {
bTour = TRUE; bTour = true;
break; break;
} }
@ -660,7 +660,7 @@ void CDecor::ArrangeObject(POINT cel)
if ( m_decor[cel.x/2][cel.y/2].objectIcon != 27 ) // pas tour ? if ( m_decor[cel.x/2][cel.y/2].objectIcon != 27 ) // pas tour ?
{ {
bTour = FALSE; bTour = false;
} }
test = cel; test = cel;
@ -684,10 +684,10 @@ void CDecor::ArrangeObject(POINT cel)
if ( !m_bBuild && bTour ) if ( !m_bBuild && bTour )
{ {
if ( MoveCreate(test, -1, FALSE, CHOBJECT,-1, if ( MoveCreate(test, -1, false, CHOBJECT,-1,
-1,-1, 9999,1,0, TRUE) ) -1,-1, 9999,1,0, true) )
{ {
MoveAddIcons(test, 5-i%2, TRUE); // éclairs MoveAddIcons(test, 5-i%2, true); // éclairs
} }
pos = ConvCelToPos(test); pos = ConvCelToPos(test);
@ -707,7 +707,7 @@ void CDecor::ArrangeObject(POINT cel)
// Test s'il faut remplir le sol ici. // Test s'il faut remplir le sol ici.
BOOL CDecor::ArrangeFillTestFloor(POINT cel1, POINT cel2) bool CDecor::ArrangeFillTestFloor(POINT cel1, POINT cel2)
{ {
POINT cel; POINT cel;
int icon1, icon2; 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 < icon1 ||
m_decor[cel.x/2][cel.y/2].floorIcon > icon2 ) m_decor[cel.x/2][cel.y/2].floorIcon > icon2 )
{ {
return FALSE; return false;
} }
if ( m_fillPutChannel == CHFLOOR && if ( m_fillPutChannel == CHFLOOR &&
m_fillPutIcon == 14 && // met de l'eau ? m_fillPutIcon == 14 && // met de l'eau ?
m_decor[cel.x/2][cel.y/2].objectIcon != -1 ) m_decor[cel.x/2][cel.y/2].objectIcon != -1 )
{ {
return FALSE; return false;
} }
} }
} }
if ( m_fillPutChannel == CHFLOOR && if ( m_fillPutChannel == CHFLOOR &&
m_fillPutIcon == 14 && // met de l'eau ? 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. // Test s'il faut remplir ici.
BOOL CDecor::ArrangeFillTest(POINT pos) bool CDecor::ArrangeFillTest(POINT pos)
{ {
POINT cel1, cel2; POINT cel1, cel2;
if ( m_pFillMap[(pos.x/2)+(pos.y/2)*(MAXCELX/2)] == 1 ) if ( m_pFillMap[(pos.x/2)+(pos.y/2)*(MAXCELX/2)] == 1 )
{ {
return FALSE; return false;
} }
if ( m_bFillFloor ) if ( m_bFillFloor )
@ -787,20 +787,20 @@ BOOL CDecor::ArrangeFillTest(POINT pos)
if ( m_decor[pos.x/2][pos.y/2].objectChannel == m_fillSearchChannel && if ( m_decor[pos.x/2][pos.y/2].objectChannel == m_fillSearchChannel &&
m_decor[pos.x/2][pos.y/2].objectIcon == m_fillSearchIcon && m_decor[pos.x/2][pos.y/2].objectIcon == m_fillSearchIcon &&
!IsBlupiHereEx(GetCel(pos.x+0,pos.y+0), !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 && 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 >= 2 &&
m_decor[pos.x/2][pos.y/2].floorIcon <= 14 ) // rive ou eau ? 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. // 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. // 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; m_bFillFloor = bFloor;
@ -969,7 +969,7 @@ void CDecor::ArrangeBlupi()
{ {
if ( !IsFreeCel(m_blupi[rank].cel, rank) ) 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 CMovie* g_pMovie = NULL; // movie principal
CDecor* g_pDecor = NULL; CDecor* g_pDecor = NULL;
char g_CDPath[MAX_PATH]; // chemin d'accès au CD-Rom 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_speedRate = 1;
int g_timerInterval = 50; // inverval = 50ms int g_timerInterval = 50; // inverval = 50ms
int g_mouseType = MOUSETYPEGRA; int g_mouseType = MOUSETYPEGRA;
MMRESULT g_updateTimer; // timer général MMRESULT g_updateTimer; // timer général
BOOL g_bActive = TRUE; // is application active ? bool g_bActive = true; // is application active ?
BOOL g_bTermInit = FALSE; // initialisation en cours bool g_bTermInit = false; // initialisation en cours
UINT g_lastPhase = 999; UINT g_lastPhase = 999;
@ -67,7 +67,7 @@ int GetNum(char *p)
// Lit le fichier de configuration. // Lit le fichier de configuration.
BOOL ReadConfig(LPSTR lpCmdLine) bool ReadConfig(LPSTR lpCmdLine)
{ {
FILE* file = NULL; FILE* file = NULL;
char buffer[200]; char buffer[200];
@ -75,7 +75,7 @@ BOOL ReadConfig(LPSTR lpCmdLine)
int nb; int nb;
file = fopen("data\\config.def", "rb"); file = fopen("data\\config.def", "rb");
if ( file == NULL ) return FALSE; if ( file == NULL ) return false;
nb = fread(buffer, sizeof(char), 200-1, file); nb = fread(buffer, sizeof(char), 200-1, file);
buffer[nb] = 0; buffer[nb] = 0;
fclose(file); fclose(file);
@ -93,7 +93,7 @@ BOOL ReadConfig(LPSTR lpCmdLine)
g_CDPath[i] = 0; // met le terminateur g_CDPath[i] = 0; // met le terminateur
} }
#else #else
return FALSE; return false;
#endif #endif
} }
else else
@ -122,7 +122,7 @@ BOOL ReadConfig(LPSTR lpCmdLine)
drive[2] = '\\'; drive[2] = '\\';
drive[3] = 0; drive[3] = 0;
nb = GetDriveType(drive); nb = GetDriveType(drive);
if ( nb != DRIVE_CDROM ) return FALSE; if ( nb != DRIVE_CDROM ) return false;
} }
#endif #endif
#endif #endif
@ -146,7 +146,7 @@ BOOL ReadConfig(LPSTR lpCmdLine)
pText = strstr(buffer, "FullScreen="); pText = strstr(buffer, "FullScreen=");
if ( pText != NULL ) if ( pText != NULL )
{ {
g_bFullScreen = GetNum(pText+11); g_bFullScreen = !!GetNum(pText+11);
if ( g_bFullScreen != 0 ) g_bFullScreen = 1; if ( g_bFullScreen != 0 ) g_bFullScreen = 1;
} }
@ -158,7 +158,7 @@ BOOL ReadConfig(LPSTR lpCmdLine)
if ( g_mouseType > 9 ) g_mouseType = 9; 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. // 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(); g_pEvent->RestoreGame();
return g_pPixmap->Restore(); return g_pPixmap->Restore();
@ -307,9 +307,9 @@ BOOL RestoreGame()
// Libère le jeu avant une désactivation en mode fullScreen. // 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(); return g_pPixmap->Flush();
} }
@ -417,7 +417,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
totalDim.y = 66; totalDim.y = 66;
iconDim.x = 64; iconDim.x = 64;
iconDim.y = 66/2; iconDim.y = 66/2;
g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, TRUE); g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, true);
g_pPixmap->SetTransparent(CHHILI, RGB(0,0,255)); // bleu g_pPixmap->SetTransparent(CHHILI, RGB(0,0,255)); // bleu
g_pPixmap->SavePalette(); g_pPixmap->SavePalette();
@ -485,7 +485,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
case WM_SETCURSOR: case WM_SETCURSOR:
// ChangeSprite(); // ChangeSprite();
// SetCursor(NULL); // pas de souris visible ! // SetCursor(NULL); // pas de souris visible !
return TRUE; return true;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
//? Benchmark(); //? Benchmark();
@ -544,7 +544,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message,
// Erreur dans DoInit. // Erreur dans DoInit.
BOOL InitFail(char *msg, BOOL bDirectX) bool InitFail(char *msg, bool bDirectX)
{ {
char buffer[100]; char buffer[100];
@ -556,17 +556,17 @@ BOOL InitFail(char *msg, BOOL bDirectX)
FinishObjects(); FinishObjects();
DestroyWindow(g_hWnd); DestroyWindow(g_hWnd);
return FALSE; return false;
} }
// Initialisation de l'application. // Initialisation de l'application.
static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
{ {
WNDCLASS wc; WNDCLASS wc;
POINT totalDim, iconDim; POINT totalDim, iconDim;
RECT rcRect; RECT rcRect;
BOOL bOK; bool bOK;
bOK = ReadConfig(lpCmdLine); // lit le fichier config.def 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, SetRect(&WindowRect, (sx-LXIMAGE)/2, (sy-LYIMAGE)/2,
(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); WindowRect.top += GetSystemMetrics(SM_CYCAPTION);
g_hWnd = CreateWindow g_hWnd = CreateWindow
@ -631,7 +631,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
NULL NULL
); );
} }
if ( !g_hWnd ) return FALSE; if ( !g_hWnd ) return false;
ShowWindow(g_hWnd, nCmdShow); ShowWindow(g_hWnd, nCmdShow);
UpdateWindow(g_hWnd); UpdateWindow(g_hWnd);
@ -641,17 +641,17 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
if ( !bOK ) // config.def pas correct ? 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. // Crée le pixmap principal.
g_pPixmap = new CPixmap; 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.x = LXIMAGE;
totalDim.y = LYIMAGE; totalDim.y = LYIMAGE;
if ( !g_pPixmap->Create(g_hWnd, totalDim, g_bFullScreen, g_mouseType) ) 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"); OutputDebug("Image: init\n");
totalDim.x = LXIMAGE; totalDim.x = LXIMAGE;
@ -659,11 +659,11 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
iconDim.x = 0; iconDim.x = 0;
iconDim.y = 0; iconDim.y = 0;
#if _INTRO #if _INTRO
if ( !g_pPixmap->Cache(CHBACK, "image\\intro1.blp", totalDim, iconDim, TRUE) ) if ( !g_pPixmap->Cache(CHBACK, "image\\intro1.blp", totalDim, iconDim, true) )
#else #else
if ( !g_pPixmap->Cache(CHBACK, "image\\init.blp", totalDim, iconDim, TRUE) ) if ( !g_pPixmap->Cache(CHBACK, "image\\init.blp", totalDim, iconDim, true) )
#endif #endif
return FALSE; return false;
OutputDebug("SavePalette\n"); OutputDebug("SavePalette\n");
g_pPixmap->SavePalette(); g_pPixmap->SavePalette();
@ -675,10 +675,10 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
totalDim.y = LYIMAGE; totalDim.y = LYIMAGE;
iconDim.x = 0; iconDim.x = 0;
iconDim.y = 0; iconDim.y = 0;
if ( !g_pPixmap->Cache(CHGROUND, "image\\init.blp", totalDim, iconDim, TRUE) ) if ( !g_pPixmap->Cache(CHGROUND, "image\\init.blp", totalDim, iconDim, true) )
return FALSE; return false;
g_pPixmap->SetDebug(FALSE); g_pPixmap->SetDebug(false);
rcRect.left = 0; rcRect.left = 0;
rcRect.top = 0; rcRect.top = 0;
@ -691,118 +691,118 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
totalDim.y = DIMCELY*2*6; totalDim.y = DIMCELY*2*6;
iconDim.x = DIMCELX*2; iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2; iconDim.y = DIMCELY*2;
if ( !g_pPixmap->Cache(CHFLOOR, "image\\floor000.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHFLOOR, "image\\floor000.blp", totalDim, iconDim, false) )
return InitFail("Cache floor000.blp", TRUE); return InitFail("Cache floor000.blp", true);
g_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu g_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu
totalDim.x = DIMOBJX*16; totalDim.x = DIMOBJX*16;
totalDim.y = DIMOBJY*8; totalDim.y = DIMOBJY*8;
iconDim.x = DIMOBJX; iconDim.x = DIMOBJX;
iconDim.y = DIMOBJY; iconDim.y = DIMOBJY;
if ( !g_pPixmap->Cache(CHOBJECT, "image\\obj000.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHOBJECT, "image\\obj000.blp", totalDim, iconDim, false) )
return InitFail("Cache obj000.blp", TRUE); return InitFail("Cache obj000.blp", true);
g_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu g_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu
if ( !g_pPixmap->Cache(CHOBJECTo, "image\\obj-o000.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHOBJECTo, "image\\obj-o000.blp", totalDim, iconDim, false) )
return InitFail("Cache obj-o000.blp", TRUE); return InitFail("Cache obj-o000.blp", true);
g_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc g_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc
totalDim.x = DIMBLUPIX*16; totalDim.x = DIMBLUPIX*16;
totalDim.y = DIMBLUPIY*23; totalDim.y = DIMBLUPIY*23;
iconDim.x = DIMBLUPIX; iconDim.x = DIMBLUPIX;
iconDim.y = DIMBLUPIY; iconDim.y = DIMBLUPIY;
if ( !g_pPixmap->Cache(CHBLUPI, "image\\blupi.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHBLUPI, "image\\blupi.blp", totalDim, iconDim, false) )
return InitFail("Cache blupi.blp", TRUE); return InitFail("Cache blupi.blp", true);
g_pPixmap->SetTransparent(CHBLUPI, RGB(0,0,255)); // bleu g_pPixmap->SetTransparent(CHBLUPI, RGB(0,0,255)); // bleu
totalDim.x = 64; totalDim.x = 64;
totalDim.y = 66; totalDim.y = 66;
iconDim.x = 64; iconDim.x = 64;
iconDim.y = 66/2; iconDim.y = 66/2;
if ( !g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, false) )
return InitFail("Cache hili.blp", TRUE); return InitFail("Cache hili.blp", true);
g_pPixmap->SetTransparent(CHHILI, RGB(0,0,255)); // bleu g_pPixmap->SetTransparent(CHHILI, RGB(0,0,255)); // bleu
totalDim.x = DIMCELX*2*3; totalDim.x = DIMCELX*2*3;
totalDim.y = DIMCELY*2*5; totalDim.y = DIMCELY*2*5;
iconDim.x = DIMCELX*2; iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2; iconDim.y = DIMCELY*2;
if ( !g_pPixmap->Cache(CHFOG, "image\\fog.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHFOG, "image\\fog.blp", totalDim, iconDim, false) )
return InitFail("Cache fog.blp", TRUE); return InitFail("Cache fog.blp", true);
g_pPixmap->SetTransparent(CHFOG, RGB(255,255,255)); // blanc g_pPixmap->SetTransparent(CHFOG, RGB(255,255,255)); // blanc
totalDim.x = DIMCELX*2*16; totalDim.x = DIMCELX*2*16;
totalDim.y = DIMCELY*2*1; totalDim.y = DIMCELY*2*1;
iconDim.x = DIMCELX*2; iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2; iconDim.y = DIMCELY*2;
if ( !g_pPixmap->Cache(CHMASK1, "image\\mask1.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHMASK1, "image\\mask1.blp", totalDim, iconDim, false) )
return InitFail("Cache mask1.blp", TRUE); return InitFail("Cache mask1.blp", true);
g_pPixmap->SetTransparent(CHMASK1, RGB(0,0,0)); // noir g_pPixmap->SetTransparent(CHMASK1, RGB(0,0,0)); // noir
totalDim.x = DIMBUTTONX*6; totalDim.x = DIMBUTTONX*6;
totalDim.y = DIMBUTTONY*21; totalDim.y = DIMBUTTONY*21;
iconDim.x = DIMBUTTONX; iconDim.x = DIMBUTTONX;
iconDim.y = DIMBUTTONY; iconDim.y = DIMBUTTONY;
if ( !g_pPixmap->Cache(CHBUTTON, "image\\button00.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHBUTTON, "image\\button00.blp", totalDim, iconDim, false) )
return InitFail("Cache button00.blp", TRUE); return InitFail("Cache button00.blp", true);
g_pPixmap->SetTransparent(CHBUTTON, RGB(0,0,255)); // bleu g_pPixmap->SetTransparent(CHBUTTON, RGB(0,0,255)); // bleu
totalDim.x = DIMJAUGEX*1; totalDim.x = DIMJAUGEX*1;
totalDim.y = DIMJAUGEY*4; totalDim.y = DIMJAUGEY*4;
iconDim.x = DIMJAUGEX; iconDim.x = DIMJAUGEX;
iconDim.y = DIMJAUGEY; iconDim.y = DIMJAUGEY;
if ( !g_pPixmap->Cache(CHJAUGE, "image\\jauge.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHJAUGE, "image\\jauge.blp", totalDim, iconDim, false) )
return InitFail("Cache jauge.blp", TRUE); return InitFail("Cache jauge.blp", true);
g_pPixmap->SetTransparent(CHJAUGE, RGB(0,0,255)); // bleu g_pPixmap->SetTransparent(CHJAUGE, RGB(0,0,255)); // bleu
totalDim.x = DIMTEXTX*16; totalDim.x = DIMTEXTX*16;
totalDim.y = DIMTEXTY*8*3; totalDim.y = DIMTEXTY*8*3;
iconDim.x = DIMTEXTX; iconDim.x = DIMTEXTX;
iconDim.y = DIMTEXTY; iconDim.y = DIMTEXTY;
if ( !g_pPixmap->Cache(CHTEXT, "image\\text.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHTEXT, "image\\text.blp", totalDim, iconDim, false) )
return InitFail("Cache text.blp", TRUE); return InitFail("Cache text.blp", true);
g_pPixmap->SetTransparent(CHTEXT, RGB(0,0,255)); // bleu g_pPixmap->SetTransparent(CHTEXT, RGB(0,0,255)); // bleu
totalDim.x = DIMLITTLEX*16; totalDim.x = DIMLITTLEX*16;
totalDim.y = DIMLITTLEY*8; totalDim.y = DIMLITTLEY*8;
iconDim.x = DIMLITTLEX; iconDim.x = DIMLITTLEX;
iconDim.y = DIMLITTLEY; iconDim.y = DIMLITTLEY;
if ( !g_pPixmap->Cache(CHLITTLE, "image\\little.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHLITTLE, "image\\little.blp", totalDim, iconDim, false) )
return InitFail("Cache little.blp", TRUE); return InitFail("Cache little.blp", true);
g_pPixmap->SetTransparent(CHLITTLE, RGB(0,0,255)); // bleu g_pPixmap->SetTransparent(CHLITTLE, RGB(0,0,255)); // bleu
totalDim.x = 426; totalDim.x = 426;
totalDim.y = 52; totalDim.y = 52;
iconDim.x = 426; iconDim.x = 426;
iconDim.y = 52; iconDim.y = 52;
if ( !g_pPixmap->Cache(CHBIGNUM, "image\\bignum.blp", totalDim, iconDim, FALSE) ) if ( !g_pPixmap->Cache(CHBIGNUM, "image\\bignum.blp", totalDim, iconDim, false) )
return InitFail("Cache bignum.blp", TRUE); return InitFail("Cache bignum.blp", true);
g_pPixmap->SetTransparent(CHBIGNUM, RGB(0,0,255)); // bleu g_pPixmap->SetTransparent(CHBIGNUM, RGB(0,0,255)); // bleu
// Crée le gestionnaire de son. // Crée le gestionnaire de son.
g_pSound = new CSound; 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->Create(g_hWnd);
g_pSound->CacheAll(); g_pSound->CacheAll();
g_pSound->SetState(TRUE); g_pSound->SetState(true);
// Crée le gestionnaire de films. // Crée le gestionnaire de films.
g_pMovie = new CMovie; 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(); g_pMovie->Create();
// Crée le gestionnaire de décors. // Crée le gestionnaire de décors.
g_pDecor = new CDecor; 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->Create(g_hWnd, g_pSound, g_pPixmap);
g_pDecor->MapInitColors(); g_pDecor->MapInitColors();
// Crée le gestionnaire d'événements. // Crée le gestionnaire d'événements.
g_pEvent = new CEvent; 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->Create(g_hWnd, g_pPixmap, g_pDecor, g_pSound, g_pMovie);
g_pEvent->SetFullScreen(g_bFullScreen); g_pEvent->SetFullScreen(g_bFullScreen);
@ -813,8 +813,8 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
g_pEvent->ChangePhase(WM_PHASE_TESTCD); g_pEvent->ChangePhase(WM_PHASE_TESTCD);
#endif #endif
g_bTermInit = TRUE; // initialisation terminée g_bTermInit = true; // initialisation terminée
return TRUE; return true;
} }
@ -827,12 +827,12 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
if ( !DoInit(hInstance, lpCmdLine, nCmdShow) ) if ( !DoInit(hInstance, lpCmdLine, nCmdShow) )
{ {
return FALSE; return false;
} }
SetTimer(g_hWnd, 1, g_timerInterval, NULL); SetTimer(g_hWnd, 1, g_timerInterval, NULL);
while ( TRUE ) while ( true )
{ {
if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
{ {

View File

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

View File

@ -10,8 +10,8 @@ public:
CButton(); CButton();
~CButton(); ~CButton();
BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, bool Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound,
POINT pos, int type, BOOL bMinimizeRedraw, POINT pos, int type, bool bMinimizeRedraw,
int *pMenu, int nbMenu, int *pMenu, int nbMenu,
int *pTooltips, int nbToolTips, int *pTooltips, int nbToolTips,
int region, UINT message); int region, UINT message);
@ -24,22 +24,22 @@ public:
int GetMenu(); int GetMenu();
void SetMenu(int menu); void SetMenu(int menu);
BOOL GetEnable(); bool GetEnable();
void SetEnable(BOOL bEnable); void SetEnable(bool bEnable);
BOOL GetHide(); bool GetHide();
void SetHide(BOOL bHide); void SetHide(bool bHide);
BOOL TreatEvent(UINT message, WPARAM wParam, LPARAM lParam); bool TreatEvent(UINT message, WPARAM wParam, LPARAM lParam);
BOOL MouseOnButton(POINT pos); bool MouseOnButton(POINT pos);
int GetToolTips(POINT pos); int GetToolTips(POINT pos);
protected: protected:
BOOL Detect(POINT pos); bool Detect(POINT pos);
BOOL MouseDown(POINT pos); bool MouseDown(POINT pos);
BOOL MouseMove(POINT pos); bool MouseMove(POINT pos);
BOOL MouseUp(POINT pos); bool MouseUp(POINT pos);
protected: protected:
HWND m_hWnd; HWND m_hWnd;
@ -47,8 +47,8 @@ protected:
CDecor* m_pDecor; CDecor* m_pDecor;
CSound* m_pSound; CSound* m_pSound;
int m_type; // type de bouton int m_type; // type de bouton
BOOL m_bEnable; // TRUE si bouton actif bool m_bEnable; // true si bouton actif
BOOL m_bHide; // TRUE si bouton caché bool m_bHide; // true si bouton caché
UINT m_message; // message envoyé si bouton actionné UINT m_message; // message envoyé si bouton actionné
POINT m_pos; // coin sup/gauche POINT m_pos; // coin sup/gauche
POINT m_dim; // dimensions POINT m_dim; // dimensions
@ -59,9 +59,9 @@ protected:
int m_nbMenu; // nb de case du sous-menu int m_nbMenu; // nb de case du sous-menu
int m_nbToolTips; // nb d'info-bulles int m_nbToolTips; // nb d'info-bulles
int m_selMenu; // sous-menu sélectionné int m_selMenu; // sous-menu sélectionné
BOOL m_bMouseDown; // TRUE -> bouton souris pressé bool m_bMouseDown; // true -> bouton souris pressé
BOOL m_bMinimizeRedraw; bool m_bMinimizeRedraw;
BOOL m_bRedraw; // TRUE -> doit être redessiné 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. // 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; int i;
@ -49,11 +49,11 @@ BOOL CDecor::CheminTestPos(POINT pos, int &rank)
pos.y == m_cheminPos[i].y ) pos.y == m_cheminPos[i].y )
{ {
rank = m_cheminRank[i]; 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; if ( rebours == 0 ) return -1;
while ( TRUE ) while ( true )
{ {
bis: bis:
for ( set=0 ; set<2 ; set++ ) for ( set=0 ; set<2 ; set++ )
@ -180,12 +180,12 @@ void CDecor::CheminFillTerrain(int rank)
// et le "prix à payer" pour aller dans cette direction // et le "prix à payer" pour aller dans cette direction
// coût doit être déterminé en sortie // 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 &next, int &ampli,
int &cout, int &action) int &cout, int &action)
{ {
POINT cel, vector, newCel; POINT cel, vector, newCel;
BOOL bFree; bool bFree;
int tryDirect, workBlupi, rankHere; int tryDirect, workBlupi, rankHere;
cel.x = pos%MAXCELX; 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 && m_blupi[rank].passCel.y/2 == (cel.y+vector.y*ampli)/2 &&
(workBlupi < 0 || workBlupi == rank) ) (workBlupi < 0 || workBlupi == rank) )
{ {
bFree = TRUE; bFree = true;
cout = 1; cout = 1;
} }
} }
@ -240,35 +240,35 @@ BOOL CDecor::CheminTestDirection(int rank, int pos, int dir,
{ {
// Le tracks peut aller sur les blupi // Le tracks peut aller sur les blupi
// pour les écraser ! // pour les écraser !
if ( IsTracksHere(newCel, FALSE) ) // autre perso ici ? if ( IsTracksHere(newCel, false) ) // autre perso ici ?
{ {
return FALSE; return false;
} }
} }
else else
{ {
//? if ( IsBlupiHere(newCel, FALSE) ) // autre perso ici ? //? if ( IsBlupiHere(newCel, false) ) // autre perso ici ?
if ( CheminTestPos(newCel, rankHere) ) // autre perso ici ? if ( CheminTestPos(newCel, rankHere) ) // autre perso ici ?
{ {
// Si blupi immobile, comme si obstacle qq. // Si blupi immobile, comme si obstacle qq.
//? if ( m_blupi[m_blupiHere].goalCel.x == -1 ) return FALSE; //? if ( m_blupi[m_blupiHere].goalCel.x == -1 ) return false;
if ( m_blupi[rankHere].goalCel.x == -1 ) return FALSE; if ( m_blupi[rankHere].goalCel.x == -1 ) return false;
// Si blupi mobile, possible mais coût élevé. // Si blupi mobile, possible mais coût élevé.
cout = 20; cout = 20;
} }
} }
next = vector.y*MAXCELX + vector.x; next = vector.y*MAXCELX + vector.x;
return TRUE; return true;
} }
return FALSE; return false;
} }
// Retourne TRUE si on a assigné une nouvelle direction à blupi. // Retourne true si on a assigné une nouvelle direction à blupi.
BOOL CDecor::CheminCherche(int rank, int &action) bool CDecor::CheminCherche(int rank, int &action)
{ {
int cout; // prix pour aller dans une direction int cout; // prix pour aller dans une direction
int pos, dir, next, ampli; 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 && if ( m_blupi[rank].cel.x == m_blupi[rank].goalCel.x &&
m_blupi[rank].cel.y == m_blupi[rank].goalCel.y ) m_blupi[rank].cel.y == m_blupi[rank].goalCel.y )
{ {
return FALSE; return false;
} }
// Destination occupée ? // 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); 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 // cherche le chemin à partir de la destination
dir = CheminARebours(rank); 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; pos = m_blupi[rank].cel.y*MAXCELX + m_blupi[rank].cel.x;
if ( CheminTestDirection(rank, pos, dir, next, ampli, cout, action) && if ( CheminTestDirection(rank, pos, dir, next, ampli, cout, action) &&
cout < 20 ) cout < 20 )
{ {
m_blupi[rank].sDirect = 16*dir; m_blupi[rank].sDirect = 16*dir;
return TRUE; return true;
} }
// ne devrait jamais arriver ! // ne devrait jamais arriver !
return FALSE; return false;
} }
// Teste s'il est possible de se rendre à un endroit donné. // 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; int action, sDirect;
POINT goalCel, passCel, limit; 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; goalCel = m_blupi[rank].goalCel;
passCel = m_blupi[rank].passCel; 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 && 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; m_blupi[rank].goalCel = dest;
if ( m_decor[dest.x/2][dest.y/2].objectChannel == CHOBJECT && 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. // First-chance exception in Blupi.exe (GDI32.DLL): 0xC0000005: Access Violation.
// apparaît au endroits marqués par (@) ... // 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; g_bDebug = bDebug;
} }

View File

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

View File

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

View File

@ -536,7 +536,7 @@ void CDecor::MoveFlush()
for ( i=0 ; i<MAXMOVE ; i++ ) for ( i=0 ; i<MAXMOVE ; i++ )
{ {
m_move[i].bExist = FALSE; m_move[i].bExist = false;
} }
for ( x=0 ; x<MAXCELX/2 ; x++ ) for ( x=0 ; x<MAXCELX/2 ; x++ )
@ -578,19 +578,19 @@ void CDecor::MoveFixInit()
// Démarre les éclairs entre les tours. // Démarre les éclairs entre les tours.
if ( m_decor[x/2][y/2].objectIcon == 10000 ) // éclair n-s if ( m_decor[x/2][y/2].objectIcon == 10000 ) // éclair n-s
{ {
if ( MoveCreate(GetCel(x,y), -1, FALSE, CHOBJECT,-1, if ( MoveCreate(GetCel(x,y), -1, false, CHOBJECT,-1,
-1,-1, 9999,1,0, TRUE) ) -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 ( m_decor[x/2][y/2].objectIcon == 10001 ) // éclair e-o
{ {
if ( MoveCreate(GetCel(x,y), -1, FALSE, CHOBJECT,-1, if ( MoveCreate(GetCel(x,y), -1, false, CHOBJECT,-1,
-1,-1, 9999,1,0, TRUE) ) -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é. // Crée un nouveau décor animé.
// Si bMisc=TRUE, on garde 10 mouvements en réserve pour // Si bMisc=true, on garde 10 mouvements en réserve pour
// des actions importantes (bMisc=FALSE). // 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 channel, int icon,
int maskChannel, int maskIcon, int maskChannel, int maskIcon,
int total, int delai, int stepY, int total, int delai, int stepY,
BOOL bMisc, BOOL bNotIfExist) bool bMisc, bool bNotIfExist)
{ {
int rank, max; 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.x == cel.x &&
m_move[rank].cel.y == cel.y ) m_move[rank].cel.y == cel.y )
{ {
if ( bNotIfExist ) return FALSE; if ( bNotIfExist ) return false;
goto create; goto create;
} }
} }
@ -625,15 +625,15 @@ BOOL CDecor::MoveCreate(POINT cel, int rankBlupi, BOOL bFloor,
{ {
if ( !m_move[rank].bExist ) if ( !m_move[rank].bExist )
{ {
if ( bMisc && max > MAXMOVE-10 ) return FALSE; if ( bMisc && max > MAXMOVE-10 ) return false;
goto create; goto create;
} }
max ++; max ++;
} }
return FALSE; return false;
create: create:
m_move[rank].bExist = TRUE; m_move[rank].bExist = true;
m_move[rank].cel = cel; m_move[rank].cel = cel;
m_move[rank].rankBlupi = rankBlupi; m_move[rank].rankBlupi = rankBlupi;
m_move[rank].bFloor = bFloor; m_move[rank].bFloor = bFloor;
@ -651,12 +651,12 @@ BOOL CDecor::MoveCreate(POINT cel, int rankBlupi, BOOL bFloor,
m_move[rank].phase = 0; m_move[rank].phase = 0;
m_decor[cel.x/2][cel.y/2].rankMove = rank; m_decor[cel.x/2][cel.y/2].rankMove = rank;
return TRUE; return true;
} }
// Ajoute un mouvement. // Ajoute un mouvement.
BOOL CDecor::MoveAddMoves(POINT cel, int rankMoves) bool CDecor::MoveAddMoves(POINT cel, int rankMoves)
{ {
int rank; int rank;
@ -669,16 +669,16 @@ BOOL CDecor::MoveAddMoves(POINT cel, int rankMoves)
m_move[rank].rankMoves = rankMoves; m_move[rank].rankMoves = rankMoves;
m_move[rank].phase = 0; m_move[rank].phase = 0;
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
// Ajoute un mouvement. // Ajoute un mouvement.
BOOL CDecor::MoveAddIcons(POINT cel, int rankIcons, BOOL bContinue) bool CDecor::MoveAddIcons(POINT cel, int rankIcons, bool bContinue)
{ {
int rank; int rank;
@ -696,17 +696,17 @@ BOOL CDecor::MoveAddIcons(POINT cel, int rankIcons, BOOL bContinue)
m_move[rank].cTotal = Random(0,10); m_move[rank].cTotal = Random(0,10);
} }
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
// Démarre le feu sur une cellule. // 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; int channel, icon;
@ -727,16 +727,16 @@ BOOL CDecor::MoveStartFire(POINT cel)
icon == 121 || // mine de fer ? icon == 121 || // mine de fer ?
icon == 122) ) // mine de fer ? icon == 122) ) // mine de fer ?
{ {
if ( !MoveCreate(cel, -1, FALSE, CHOBJECT,-1, if ( !MoveCreate(cel, -1, false, CHOBJECT,-1,
-1,-1, 9999,1,0, TRUE) ) return FALSE; -1,-1, 9999,1,0, true) ) return false;
MoveAddIcons(cel, 1, TRUE); // petites flammes MoveAddIcons(cel, 1, true); // petites flammes
m_decor[cel.x/2][cel.y/2].fire = 2; m_decor[cel.x/2][cel.y/2].fire = 2;
return TRUE; return true;
} }
// S'il y a un autre objet -> pas de feu ! // 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; channel = m_decor[cel.x/2][cel.y/2].floorChannel;
icon = m_decor[cel.x/2][cel.y/2].floorIcon; 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 == 20 || // herbe foncée ?
(icon >= 59 && icon <= 64)) ) // pont ? (icon >= 59 && icon <= 64)) ) // pont ?
{ {
if ( !MoveCreate(cel, -1, FALSE, CHOBJECT,-1, if ( !MoveCreate(cel, -1, false, CHOBJECT,-1,
-1,-1, 9999,1,0, TRUE) ) return FALSE; -1,-1, 9999,1,0, true) ) return false;
MoveAddIcons(cel, 1, TRUE); // petites flammes MoveAddIcons(cel, 1, true); // petites flammes
m_decor[cel.x/2][cel.y/2].fire = 2; 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é. // Démarre le feu si c'est possible par proximité.
@ -850,7 +850,7 @@ void CDecor::MoveFire(int rank)
// Début grandes flammes. // Début grandes flammes.
if ( m_decor[x/2][y/2].fire == (MoveMaxFire()-DIMOBJY*2)/2 ) 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. // Début objet squelette.
@ -869,15 +869,15 @@ void CDecor::MoveFire(int rank)
if ( icon == 113 ) newIcon = 15; // maison ? if ( icon == 113 ) newIcon = 15; // maison ?
if ( icon == 121 ) newIcon = 126; // mine de fer ? if ( icon == 121 ) newIcon = 126; // mine de fer ?
if ( icon == 122 ) 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); -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. // Fin grandes flammes.
if ( m_decor[x/2][y/2].fire == MoveMaxFire()-DIMOBJY ) 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. // Fin feu.
@ -954,7 +954,7 @@ void CDecor::MoveFire(int rank)
// Fait évoluer tous les décors animés. // Fait évoluer tous les décors animés.
void CDecor::MoveStep(BOOL bFirst) void CDecor::MoveStep(bool bFirst)
{ {
int rank, rankBlupi; int rank, rankBlupi;
@ -1033,7 +1033,7 @@ void CDecor::MoveFinish(POINT cel)
} }
m_decor[cel.x/2][cel.y/2].rankMove = -1; 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. // Vérifie si une cellule est déjà utilisée.
BOOL CDecor::MoveIsUsed(POINT cel) bool CDecor::MoveIsUsed(POINT cel)
{ {
int rank; int rank;
@ -1066,16 +1066,16 @@ BOOL CDecor::MoveIsUsed(POINT cel)
m_move[rank].cel.x == cel.x && m_move[rank].cel.x == cel.x &&
m_move[rank].cel.y == cel.y ) m_move[rank].cel.y == cel.y )
{ {
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
// Retourne l'objet en construction à un endroit donné. // 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; int rank;
@ -1084,20 +1084,20 @@ BOOL CDecor::MoveGetObject(POINT cel, int &channel, int &icon)
if ( m_move[rank].bExist && if ( m_move[rank].bExist &&
m_move[rank].cel.x == cel.x && m_move[rank].cel.x == cel.x &&
m_move[rank].cel.y == cel.y && m_move[rank].cel.y == cel.y &&
m_move[rank].bFloor == FALSE ) m_move[rank].bFloor == false )
{ {
channel = m_move[rank].channel; channel = m_move[rank].channel;
icon = m_move[rank].icon; icon = m_move[rank].icon;
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
// Modifie un objet en construction à un endroit donné. // 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; int rank;
@ -1106,14 +1106,14 @@ BOOL CDecor::MovePutObject(POINT cel, int channel, int icon)
if ( m_move[rank].bExist && if ( m_move[rank].bExist &&
m_move[rank].cel.x == cel.x && m_move[rank].cel.x == cel.x &&
m_move[rank].cel.y == cel.y && 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].channel = channel;
m_move[rank].icon = icon; 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 // bord (-2) pour permettre de gérer le brouillard proprement
// jusque dans les bords ! // jusque dans les bords !
BOOL IsValid(POINT cel) bool IsValid(POINT cel)
{ {
if ( cel.x < 2 || cel.x >= MAXCELX-2 || if ( cel.x < 2 || cel.x >= MAXCELX-2 ||
cel.y < 2 || cel.y >= MAXCELX-2 ) return FALSE; cel.y < 2 || cel.y >= MAXCELX-2 ) return false;
return TRUE; return true;
} }
// Retourne un vecteur orienté dans une direction donnée. // Retourne un vecteur orienté dans une direction donnée.
@ -110,7 +110,7 @@ CDecor::CDecor()
m_celOutline1.x = -1; m_celOutline1.x = -1;
m_celOutline2.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_shiftHili = 0;
m_shiftOffset.x = 0; m_shiftOffset.x = 0;
@ -120,12 +120,12 @@ CDecor::CDecor()
m_rankBlupiHili = -1; m_rankBlupiHili = -1;
m_rankHili = -1; m_rankHili = -1;
m_bFog = FALSE; m_bFog = false;
m_bBuild = FALSE; m_bBuild = false;
m_bInvincible = FALSE; m_bInvincible = false;
m_bSuper = FALSE; m_bSuper = false;
m_bHideTooltips = FALSE; m_bHideTooltips = false;
m_bInfo = FALSE; m_bInfo = false;
m_infoHeight = 100; m_infoHeight = 100;
m_phase = 0; m_phase = 0;
m_totalTime = 0; m_totalTime = 0;
@ -154,7 +154,7 @@ void CDecor::Create(HWND hWnd, CSound *pSound, CPixmap *pPixmap)
m_hWnd = hWnd; m_hWnd = hWnd;
m_pSound = pSound; m_pSound = pSound;
m_pPixmap = pPixmap; m_pPixmap = pPixmap;
m_bOutline = FALSE; m_bOutline = false;
} }
// Initialise le décor avec un sol plat partout. // Initialise le décor avec un sol plat partout.
@ -188,8 +188,8 @@ void CDecor::Init(int channel, int icon)
} }
} }
m_bOutline = FALSE; m_bOutline = false;
m_bGroundRedraw = TRUE; m_bGroundRedraw = true;
} }
// Initialise le décor après une modification. // Initialise le décor après une modification.
@ -207,18 +207,18 @@ void CDecor::InitAfterBuild()
void CDecor::ResetHili() void CDecor::ResetHili()
{ {
m_bHiliRect = FALSE; // plus de rectangle m_bHiliRect = false; // plus de rectangle
InitOutlineRect(); InitOutlineRect();
} }
// Charge les images nécessaires au décor. // Charge les images nécessaires au décor.
BOOL CDecor::LoadImages() bool CDecor::LoadImages()
{ {
POINT totalDim, iconDim; POINT totalDim, iconDim;
char filename[50]; char filename[50];
if ( m_region == m_lastRegion ) return TRUE; if ( m_region == m_lastRegion ) return true;
m_lastRegion = m_region; m_lastRegion = m_region;
totalDim.x = DIMCELX*2*16; totalDim.x = DIMCELX*2*16;
@ -226,8 +226,8 @@ BOOL CDecor::LoadImages()
iconDim.x = DIMCELX*2; iconDim.x = DIMCELX*2;
iconDim.y = DIMCELY*2; iconDim.y = DIMCELY*2;
sprintf(filename, "image\\floor%.3d.blp", m_region); sprintf(filename, "image\\floor%.3d.blp", m_region);
if ( !m_pPixmap->Cache(CHFLOOR, filename, totalDim, iconDim, FALSE) ) if ( !m_pPixmap->Cache(CHFLOOR, filename, totalDim, iconDim, false) )
return FALSE; return false;
m_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu m_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu
totalDim.x = DIMOBJX*16; totalDim.x = DIMOBJX*16;
@ -235,19 +235,19 @@ BOOL CDecor::LoadImages()
iconDim.x = DIMOBJX; iconDim.x = DIMOBJX;
iconDim.y = DIMOBJY; iconDim.y = DIMOBJY;
sprintf(filename, "image\\obj%.3d.blp", m_region); sprintf(filename, "image\\obj%.3d.blp", m_region);
if ( !m_pPixmap->Cache(CHOBJECT, filename, totalDim, iconDim, FALSE) ) if ( !m_pPixmap->Cache(CHOBJECT, filename, totalDim, iconDim, false) )
return FALSE; return false;
m_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu m_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu
sprintf(filename, "image\\obj-o%.3d.blp", m_region); sprintf(filename, "image\\obj-o%.3d.blp", m_region);
if ( !m_pPixmap->Cache(CHOBJECTo, filename, totalDim, iconDim, FALSE) ) if ( !m_pPixmap->Cache(CHOBJECTo, filename, totalDim, iconDim, false) )
return FALSE; return false;
m_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc m_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc
MapInitColors(); // init les couleurs pour la carte MapInitColors(); // init les couleurs pour la carte
m_bGroundRedraw = TRUE; m_bGroundRedraw = true;
return TRUE; return true;
} }
// Met partout du brouillard, sauf aux endroits des blupi. // 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. // Permet de nouveau aux cellules brulées de bruler.
@ -300,39 +300,39 @@ void CDecor::ClearFire()
// Indique le mode jeu/construction. // Indique le mode jeu/construction.
void CDecor::SetBuild(BOOL bBuild) void CDecor::SetBuild(bool bBuild)
{ {
m_bBuild = bBuild; m_bBuild = bBuild;
} }
// Indique s'il faut tenir compte du brouillard. // Indique s'il faut tenir compte du brouillard.
void CDecor::EnableFog(BOOL bEnable) void CDecor::EnableFog(bool bEnable)
{ {
m_bFog = bEnable; m_bFog = bEnable;
m_bOutline = FALSE; m_bOutline = false;
} }
// Gestion du mode invincible. // Gestion du mode invincible.
BOOL CDecor::GetInvincible() bool CDecor::GetInvincible()
{ {
return m_bInvincible; return m_bInvincible;
} }
void CDecor::SetInvincible(BOOL bInvincible) void CDecor::SetInvincible(bool bInvincible)
{ {
m_bInvincible = bInvincible; m_bInvincible = bInvincible;
} }
// Gestion du mode costaud (superblupi). // Gestion du mode costaud (superblupi).
BOOL CDecor::GetSuper() bool CDecor::GetSuper()
{ {
return m_bSuper; return m_bSuper;
} }
void CDecor::SetSuper(BOOL bSuper) void CDecor::SetSuper(bool bSuper)
{ {
m_bSuper = bSuper; m_bSuper = bSuper;
} }
@ -347,27 +347,27 @@ void CDecor::FlipOutline()
// Initialise un sol dans une cellule. // 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 || 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].floorChannel = channel;
m_decor[cel.x/2][cel.y/2].floorIcon = icon; 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 //? SubDrapeau(cel); // on pourra de nouveau planter un drapeau
return TRUE; return true;
} }
// Initialise un objet dans une cellule. // 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 || 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; 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 SubDrapeau(cel); // on pourra de nouveau planter un drapeau
return TRUE; return true;
} }
// Retourne un sol dans une cellule. // 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 || 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; channel = m_decor[cel.x/2][cel.y/2].floorChannel;
icon = m_decor[cel.x/2][cel.y/2].floorIcon; icon = m_decor[cel.x/2][cel.y/2].floorIcon;
return TRUE; return true;
} }
// Retourne une objet dans une cellule. // 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 || 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; channel = m_decor[cel.x/2][cel.y/2].objectChannel;
icon = m_decor[cel.x/2][cel.y/2].objectIcon; icon = m_decor[cel.x/2][cel.y/2].objectIcon;
return TRUE; return true;
} }
// Modifie le feu pour une cellule. // 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 || 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; 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) void CDecor::SetShiftOffset(POINT offset)
{ {
m_shiftOffset = offset; m_shiftOffset = offset;
m_bGroundRedraw = TRUE; m_bGroundRedraw = true;
} }
// Convertit la position d'une cellule en coordonnée graphique. // 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. // Convertit une coordonnée graphique en cellule.
POINT CDecor::ConvPosToCel(POINT pos, BOOL bMap) POINT CDecor::ConvPosToCel(POINT pos, bool bMap)
{ {
POINT cel; POINT cel;
@ -650,7 +650,7 @@ void CDecor::BuildMoveFloor(int x, int y, POINT pos, int rank)
m_move[rank].icon, 0); m_move[rank].icon, 0);
m_pPixmap->DrawIcon(-1, m_move[rank].channel, 0, m_pPixmap->DrawIcon(-1, m_move[rank].channel, 0,
pos, 0, TRUE); pos, 0, true);
} }
else else
{ {
@ -1004,7 +1004,7 @@ void CDecor::BuildGround(RECT clip)
} }
} }
m_bGroundRedraw = FALSE; m_bGroundRedraw = false;
} }
// Construit le décor dans un pixmap. // 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 x, y, i, j, channel, icon, nb, start, direct;
int error = 0; int error = 0;
BOOL bStrong = FALSE; bool bStrong = false;
BOOL bTransport = FALSE; bool bTransport = false;
BOOL bVehicule = FALSE; bool bVehicule = false;
BOOL bVehiculeA = FALSE; bool bVehiculeA = false;
POINT vector; POINT vector;
for ( x=0 ; x<4 ; x++ ) 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 ? if ( m_blupi[rank].energy > MAXENERGY/4 ) // blupi fort ?
{ {
bStrong = TRUE; bStrong = true;
} }
if ( m_blupi[rank].takeChannel != -1 ) // porte qq chose ? if ( m_blupi[rank].takeChannel != -1 ) // porte qq chose ?
{ {
bTransport = TRUE; bTransport = true;
} }
if ( m_blupi[rank].vehicule != 0 ) // pas à pied ? if ( m_blupi[rank].vehicule != 0 ) // pas à pied ?
{ {
bVehicule = TRUE; bVehicule = true;
} }
if ( m_blupi[rank].vehicule != 0 && // pas à pied ? if ( m_blupi[rank].vehicule != 0 && // pas à pied ?
m_blupi[rank].vehicule != 3 ) // pas armure ? m_blupi[rank].vehicule != 3 ) // pas armure ?
{ {
bVehiculeA = TRUE; bVehiculeA = true;
} }
} }
if ( action == 0 ) if ( action == 0 )
{ {
if ( IsBlupiHere(cel, FALSE) ) if ( IsBlupiHere(cel, false) )
{ {
icons[1][1] = ICON_HILI_SEL; 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) || if ( ((m_blupi[rank].takeChannel == -1) ||
(m_blupi[rank].energy > MAXENERGY/4)) && (m_blupi[rank].energy > MAXENERGY/4)) &&
IsFreeCelGo(GetCel(cel.x+x,cel.y+y), rank) && 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_GO; // flèche
icons[1+x][1+y] = ICON_HILI_OP; // action 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; error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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; error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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++ ) 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; error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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 ) if ( action == WM_ACTION_TOUR )
{ {
BOOL bTour; bool bTour;
if ( cel.x%2 != 1 || cel.y%2 != 1 ) 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 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; error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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 ) if ( error == 0 )
{ {
bTour = FALSE; bTour = false;
for ( i=0 ; i<4 ; i++ ) for ( i=0 ; i<4 ; i++ )
{ {
vector = GetVector(i*2*16); 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 ? if ( m_decor[x/2][y/2].objectIcon == 27 ) // tour ?
{ {
bTour = TRUE; bTour = true;
} }
if ( MoveGetObject(GetCel(x,y), channel, icon) && if ( MoveGetObject(GetCel(x,y), channel, icon) &&
channel == CHOBJECT && icon == 27 ) // tour en construction ? 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++ ) 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; error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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++ ) 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; error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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 == 93 || // piège ?
icon == 123 || // fer ? icon == 123 || // fer ?
icon == 125) && // mine ? icon == 125) && // mine ?
(!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) || (!IsBlupiHereEx(GetCel(cel,-1,0), rank, false) ||
!IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) ) !IsBlupiHereEx(GetCel(cel,0,-1), rank, false)) )
{ {
icons[1][1] = ICON_HILI_OP; // action 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++ ) for ( y=0 ; y<2 ; y++ )
{ {
if ( !IsFreeCelDepose(GetCel(cel,x,y), rank) || if ( !IsFreeCelDepose(GetCel(cel,x,y), rank) ||
IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) IsBlupiHereEx(GetCel(cel,x,y), rank, false) )
{ {
error = ERROR_MISC; error = ERROR_MISC;
} }
@ -2230,17 +2230,17 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
else else
{ {
if ( !IsFreeCelDepose(GetCel(cel,1,1), rank) || if ( !IsFreeCelDepose(GetCel(cel,1,1), rank) ||
IsBlupiHereEx(GetCel(cel,1,1), rank, FALSE) ) IsBlupiHereEx(GetCel(cel,1,1), rank, false) )
{ {
error = ERROR_MISC; error = ERROR_MISC;
} }
else else
{ {
if ( !IsFreeCelDepose(GetCel(cel,0,1), rank) || 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) || if ( !IsFreeCelDepose(GetCel(cel,1,0), rank) ||
IsBlupiHereEx(GetCel(cel,1,0), rank, FALSE) ) IsBlupiHereEx(GetCel(cel,1,0), rank, false) )
{ {
error = ERROR_MISC; error = ERROR_MISC;
} }
@ -2285,7 +2285,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank,
{ {
for ( y=0 ; y<2 ; y++ ) 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; error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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++ ) 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; error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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; error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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; error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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 ? m_blupi[rank].perso != 8 && // pas disciple ?
channel == CHOBJECT && channel == CHOBJECT &&
icon == 60 && // tomates ? icon == 60 && // tomates ?
(!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) || (!IsBlupiHereEx(GetCel(cel,-1,0), rank, false) ||
!IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) ) !IsBlupiHereEx(GetCel(cel,0,-1), rank, false)) )
{ {
icons[1][1] = ICON_HILI_OP; // action 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 ? m_blupi[rank].perso != 8 && // pas disciple ?
channel == CHOBJECT && channel == CHOBJECT &&
icon == 80 && // bouteille ? icon == 80 && // bouteille ?
(!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) || (!IsBlupiHereEx(GetCel(cel,-1,0), rank, false) ||
!IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) ) !IsBlupiHereEx(GetCel(cel,0,-1), rank, false)) )
{ {
icons[1][1] = ICON_HILI_OP; // action 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++ ) 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; error = ERROR_FREE;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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) && if ( IsFreeCelGo(GetCel(cel,+1, 0), rank) &&
IsFreeCelGo(GetCel(cel,+1,+1), rank) && IsFreeCelGo(GetCel(cel,+1,+1), rank) &&
!IsBlupiHereEx(GetCel(cel,+1, 0), rank, FALSE) && !IsBlupiHereEx(GetCel(cel,+1, 0), rank, false) &&
!IsBlupiHereEx(GetCel(cel,+1,+1), rank, FALSE) ) !IsBlupiHereEx(GetCel(cel,+1,+1), rank, false) )
{ {
icons[1][1] = ICON_HILI_OP; // action icons[1][1] = ICON_HILI_OP; // action
icons[2][1] = ICON_HILI_OP; 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) && if ( IsFreeCelGo(GetCel(cel,+1, 0), rank) &&
IsFreeCelGo(GetCel(cel,+1,+1), rank) && IsFreeCelGo(GetCel(cel,+1,+1), rank) &&
!IsBlupiHereEx(GetCel(cel,+1, 0), rank, FALSE) && !IsBlupiHereEx(GetCel(cel,+1, 0), rank, false) &&
!IsBlupiHereEx(GetCel(cel,+1,+1), rank, FALSE) ) !IsBlupiHereEx(GetCel(cel,+1,+1), rank, false) )
{ {
icons[1][1] = ICON_HILI_OP; // action icons[1][1] = ICON_HILI_OP; // action
icons[2][1] = ICON_HILI_OP; 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++ ) 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; error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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++ ) 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; error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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++ ) 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; error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix 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++ ) 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; error = ERROR_MISC;
icons[x+1][y+1] = ICON_HILI_ERR; // croix icons[x+1][y+1] = ICON_HILI_ERR; // croix
@ -2821,7 +2821,7 @@ void CDecor::CelHili(POINT pos, int action)
{ {
m_celHili = ConvPosToCel(pos); m_celHili = ConvPosToCel(pos);
if ( IsBlupiHere(m_celHili, FALSE) ) if ( IsBlupiHere(m_celHili, false) )
{ {
m_rankHili = m_blupiHere; m_rankHili = m_blupiHere;
m_iconHili[1][1] = ICON_HILI_SEL; 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 // Indique si le menu est présent et qu'il faut cacher
// les tooltips du décor. // les tooltips du décor.
void CDecor::HideTooltips(BOOL bHide) void CDecor::HideTooltips(bool bHide)
{ {
m_bHideTooltips = bHide; m_bHideTooltips = bHide;
} }
@ -3211,7 +3211,7 @@ void CDecor::HideTooltips(BOOL bHide)
// Modifie l'origine supérieure/gauche du décor. // 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 ) if ( bCenter )
{ {
@ -3225,7 +3225,7 @@ void CDecor::SetCoin(POINT coin, BOOL bCenter)
if ( coin.y > MAXCELY-4 ) coin.y = MAXCELY-4; if ( coin.y > MAXCELY-4 ) coin.y = MAXCELY-4;
m_celCoin = coin; m_celCoin = coin;
m_bGroundRedraw = TRUE; // faudra redessiner les sols m_bGroundRedraw = true; // faudra redessiner les sols
m_celHili.x = -1; m_celHili.x = -1;
m_textLastPos.x = -1; // tooltips plus lavable ! m_textLastPos.x = -1; // tooltips plus lavable !
} }
@ -3243,7 +3243,7 @@ POINT CDecor::GetHome()
// Mémoirise une position pendant le jeu. // Mémoirise une position pendant le jeu.
void CDecor::MemoPos(int rank, BOOL bRecord) void CDecor::MemoPos(int rank, bool bRecord)
{ {
POINT pos; POINT pos;
@ -3267,7 +3267,7 @@ void CDecor::MemoPos(int rank, BOOL bRecord)
else else
{ {
m_pSound->PlayImage(SOUND_BUT, pos); 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. // Gestion des infos.
void CDecor::SetInfoMode(BOOL bInfo) void CDecor::SetInfoMode(bool bInfo)
{ {
m_bInfo = 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; return m_bInfo;
} }
@ -3347,7 +3347,7 @@ BOOL CDecor::GetInfoMode()
void CDecor::SetInfoHeight(int height) void CDecor::SetInfoHeight(int height)
{ {
m_infoHeight = height; m_infoHeight = height;
m_bGroundRedraw = TRUE; // faudra redessiner les sols m_bGroundRedraw = true; // faudra redessiner les sols
} }
int CDecor::GetInfoHeight() int CDecor::GetInfoHeight()
@ -3407,13 +3407,13 @@ void CDecor::UndoBack()
{ {
memcpy(&m_decor, m_pUndoDecor, sizeof(Cellule)*(MAXCELX/2)*(MAXCELY/2)); memcpy(&m_decor, m_pUndoDecor, sizeof(Cellule)*(MAXCELX/2)*(MAXCELY/2));
UndoClose(); UndoClose();
m_bGroundRedraw = TRUE; m_bGroundRedraw = true;
} }
} }
// Indique s'il est possible d'effectuer un undo. // Indique s'il est possible d'effectuer un undo.
BOOL CDecor::IsUndo() bool CDecor::IsUndo()
{ {
return ( m_pUndoDecor != NULL ); return ( m_pUndoDecor != NULL );
} }

242
decor.h
View File

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

View File

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

8
def.h
View File

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

View File

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

View File

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

14
jauge.h
View File

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

View File

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

14
menu.h
View File

@ -10,7 +10,7 @@ public:
CMenu(); CMenu();
~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, POINT pos, int nb, int *pButtons, int *pErrors,
int perso); int perso);
void Update(int nb, int *pButtons, int *pErrors); void Update(int nb, int *pButtons, int *pErrors);
@ -18,17 +18,17 @@ public:
void Draw(); void Draw();
int GetSel(); int GetSel();
int GetRank(); int GetRank();
BOOL IsError(); bool IsError();
BOOL IsExist(); bool IsExist();
void Message(); void Message();
BOOL TreatEvent(UINT message, WPARAM wParam, LPARAM lParam); bool TreatEvent(UINT message, WPARAM wParam, LPARAM lParam);
protected: protected:
int Detect(POINT pos); int Detect(POINT pos);
BOOL MouseDown(POINT pos); bool MouseDown(POINT pos);
BOOL MouseMove(POINT pos); bool MouseMove(POINT pos);
BOOL MouseUp(POINT pos); bool MouseUp(POINT pos);
protected: protected:
HWND m_hWnd; HWND m_hWnd;

View File

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

View File

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

18
movie.h
View File

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

View File

@ -15,44 +15,44 @@ public:
CPixmap(); CPixmap();
~CPixmap(); ~CPixmap();
void SetDebug(BOOL bDebug); void SetDebug(bool bDebug);
BOOL Create(HWND hwnd, POINT dim, BOOL bFullScreen, int mouseType); bool Create(HWND hwnd, POINT dim, bool bFullScreen, int mouseType);
BOOL Flush(); bool Flush();
BOOL Restore(); bool Restore();
BOOL InitSysPalette(); bool InitSysPalette();
BOOL IsPalette(); bool IsPalette();
void Fill(RECT rect, COLORREF color); void Fill(RECT rect, COLORREF color);
BOOL SavePalette(); bool SavePalette();
BOOL RestorePalette(); bool RestorePalette();
int SearchColor(int red, int green, int blue); 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, POINT iconDim, bool bUsePalette);
BOOL Cache(int channel, char *pFilename, POINT totalDim, BOOL bUsePalette); bool Cache(int channel, char *pFilename, POINT totalDim, bool bUsePalette);
BOOL Cache(int channel, HBITMAP hbm, POINT totalDim); bool Cache(int channel, HBITMAP hbm, POINT totalDim);
void Flush(int channel); void Flush(int channel);
void SetTransparent(int channel, COLORREF color); void SetTransparent(int channel, COLORREF color);
void SetTransparent2(int channel, COLORREF color1, COLORREF color2); void SetTransparent2(int channel, COLORREF color1, COLORREF color2);
void SetClipping(RECT clip); void SetClipping(RECT clip);
RECT GetClipping(); 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 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 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 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 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 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); int channel, int rankSrc, int rankDst);
BOOL Display(); bool Display();
void SetMousePosSprite(POINT pos, int sprite, BOOL bDemoPlay); void SetMousePosSprite(POINT pos, int sprite, bool bDemoPlay);
void SetMousePos(POINT pos, BOOL bDemoPlay); void SetMousePos(POINT pos, bool bDemoPlay);
void SetMouseSprite(int sprite, BOOL bDemoPlay); void SetMouseSprite(int sprite, bool bDemoPlay);
void MouseShow(BOOL bShow); void MouseShow(bool bShow);
void MouseInvalidate(); void MouseInvalidate();
void MouseBackClear(); void MouseBackClear();
void MouseBackDraw(); void MouseBackDraw();
@ -64,7 +64,7 @@ protected:
int channel, POINT dst, RECT rcRect, int mode); int channel, POINT dst, RECT rcRect, int mode);
void MouseUpdate(); void MouseUpdate();
BOOL MouseQuickDraw(RECT rect); bool MouseQuickDraw(RECT rect);
void MouseBackSave(); void MouseBackSave();
void MouseBackRestore(); void MouseBackRestore();
void MouseBackDebug(); void MouseBackDebug();
@ -72,10 +72,10 @@ protected:
void MouseHotSpot(); void MouseHotSpot();
protected: protected:
BOOL m_bFullScreen; bool m_bFullScreen;
int m_mouseType; int m_mouseType;
BOOL m_bDebug; bool m_bDebug;
BOOL m_bPalette; bool m_bPalette;
HWND m_hWnd; HWND m_hWnd;
POINT m_dim; // dimensions totales POINT m_dim; // dimensions totales
RECT m_clipRect; // rectangle de clipping RECT m_clipRect; // rectangle de clipping
@ -84,9 +84,9 @@ protected:
int m_mouseSprite; int m_mouseSprite;
POINT m_mouseHotSpot; POINT m_mouseHotSpot;
POINT m_mouseBackPos; POINT m_mouseBackPos;
BOOL m_bMouseBack; bool m_bMouseBack;
BOOL m_bMouseShow; bool m_bMouseShow;
BOOL m_bBackDisplayed; bool m_bBackDisplayed;
LPDIRECTDRAW m_lpDD; // DirectDraw object LPDIRECTDRAW m_lpDD; // DirectDraw object
LPDIRECTDRAWSURFACE m_lpDDSPrimary; // DirectDraw primary surface 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. // 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 struct WaveHeader
@ -39,7 +39,7 @@ struct WaveHeader
// Creates a DirectSound buffer. // 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; PCMWAVEFORMAT pcmwf;
DSBUFFERDESC dsbdesc; DSBUFFERDESC dsbdesc;
@ -61,19 +61,19 @@ BOOL CSound::CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD d
dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf; dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf;
TRY_DS(m_lpDS->CreateSoundBuffer(&dsbdesc, &m_lpDSB[dwBuf], NULL)) TRY_DS(m_lpDS->CreateSoundBuffer(&dsbdesc, &m_lpDSB[dwBuf], NULL))
return TRUE; return true;
} }
// Reads in data from a wave file. // 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) // Seek to correct position in file (if necessary)
if ( dwPos != 0xffffffff ) if ( dwPos != 0xffffffff )
{ {
if ( fseek(pFile, dwPos, SEEK_SET) != 0 ) 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); rval = lpDSB->Lock(0, dwSize, &pData1, &dwData1Size, &pData2, &dwData2Size, DSBLOCK_FROMWRITECURSOR);
if ( rval != DS_OK ) if ( rval != DS_OK )
{ {
return FALSE; return false;
} }
// Read in first chunk of data // Read in first chunk of data
@ -98,7 +98,7 @@ BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWOR
char holder[256]; char holder[256];
wsprintf(holder,"Data1 : %d, dwdata: %d, pFile: %d",pData1,dwData1Size,pFile); wsprintf(holder,"Data1 : %d, dwdata: %d, pFile: %d",pData1,dwData1Size,pFile);
OutputDebug(holder); 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 ) 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); rval = lpDSB->Unlock(pData1, dwData1Size, pData2, dwData2Size);
if ( rval != DS_OK ) if ( rval != DS_OK )
{ {
return FALSE; return false;
} }
return TRUE; return true;
} }
// Creates a DirectSound buffer from a wave file. // 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 // Open the wave file
FILE* pFile = fopen(pFileName, "rb"); FILE* pFile = fopen(pFileName, "rb");
if ( pFile == NULL ) return FALSE; if ( pFile == NULL ) return false;
// Read in the wave header // Read in the wave header
WaveHeader wavHdr; WaveHeader wavHdr;
@ -141,7 +141,7 @@ BOOL CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName)
DWORD dwSize = wavHdr.dwDSize; DWORD dwSize = wavHdr.dwDSize;
// Is this a stereo or mono file? // 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 // Create the sound buffer for the wave file
if ( !CreateSoundBuffer(dwBuf, dwSize, wavHdr.dwSRate, if ( !CreateSoundBuffer(dwBuf, dwSize, wavHdr.dwSRate,
@ -150,25 +150,25 @@ BOOL CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName)
// Close the file // Close the file
fclose(pFile); fclose(pFile);
return FALSE; return false;
} }
// Read the data for the wave file into the sound buffer // Read the data for the wave file into the sound buffer
if ( !ReadData(m_lpDSB[dwBuf], pFile, dwSize, sizeof(wavHdr)) ) if ( !ReadData(m_lpDSB[dwBuf], pFile, dwSize, sizeof(wavHdr)) )
{ {
fclose(pFile); fclose(pFile);
return FALSE; return false;
} }
// Close out the wave file // Close out the wave file
fclose(pFile); fclose(pFile);
return TRUE; return true;
} }
// Stops all sounds. // Stops all sounds.
BOOL CSound::StopAllSounds() bool CSound::StopAllSounds()
{ {
// Make sure we have a valid sound buffer // Make sure we have a valid sound buffer
for (int i = 0; i < MAXSOUND; i ++) for (int i = 0; i < MAXSOUND; i ++)
@ -185,15 +185,15 @@ BOOL CSound::StopAllSounds()
} }
} }
return TRUE; return true;
} }
// Plays a sound using direct sound. // 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 // Make sure the sound is valid
if ( dwSound >= MAXSOUND ) return FALSE; if ( dwSound >= MAXSOUND ) return false;
// Make sure we have a valid sound buffer // Make sure we have a valid sound buffer
if ( m_lpDSB[dwSound] ) 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; int i;
m_bEnable = FALSE; m_bEnable = false;
m_bState = FALSE; m_bState = false;
m_MidiDeviceID = 0; m_MidiDeviceID = 0;
m_MIDIFilename[0] = 0; m_MIDIFilename[0] = 0;
m_audioVolume = 20; m_audioVolume = 20;
@ -334,25 +334,25 @@ CSound::~CSound()
// Initialisation de DirectSound. // Initialisation de DirectSound.
BOOL CSound::Create(HWND hWnd) bool CSound::Create(HWND hWnd)
{ {
if ( !DirectSoundCreate(NULL, &m_lpDS, NULL) == DS_OK ) if ( !DirectSoundCreate(NULL, &m_lpDS, NULL) == DS_OK )
{ {
OutputDebug("Fatal error: DirectSoundCreate\n"); OutputDebug("Fatal error: DirectSoundCreate\n");
m_bEnable = FALSE; m_bEnable = false;
return FALSE; return false;
} }
m_lpDS->SetCooperativeLevel(hWnd, DSSCL_NORMAL); m_lpDS->SetCooperativeLevel(hWnd, DSSCL_NORMAL);
m_bEnable = TRUE; m_bEnable = true;
m_hWnd = hWnd; m_hWnd = hWnd;
return TRUE; return true;
} }
// Retourne l'état de DirectSound. // Retourne l'état de DirectSound.
BOOL CSound::GetEnable() bool CSound::GetEnable()
{ {
return m_bEnable; return m_bEnable;
} }
@ -360,7 +360,7 @@ BOOL CSound::GetEnable()
// Enclenche ou déclenche le son. // Enclenche ou déclenche le son.
void CSound::SetState(BOOL bState) void CSound::SetState(bool bState)
{ {
m_bState = bState; m_bState = bState;
} }
@ -409,10 +409,10 @@ void CSound::CacheAll()
// Charge un fichier son (.wav). // 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 ( !m_bEnable ) return false;
if ( channel < 0 || channel >= MAXSOUND ) return FALSE; if ( channel < 0 || channel >= MAXSOUND ) return false;
if ( m_lpDSB[channel] != NULL ) if ( m_lpDSB[channel] != NULL )
{ {
@ -441,31 +441,31 @@ void CSound::Flush(int channel)
// Le panoramique est compris entre -10000 (gauche), 0 (centre) // Le panoramique est compris entre -10000 (gauche), 0 (centre)
// et +10000 (droite). // 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_bEnable ) return true;
if ( !m_bState || m_audioVolume == 0 ) return TRUE; if ( !m_bState || m_audioVolume == 0 ) return true;
volume -= (MAXVOLUME-m_audioVolume)*((10000/4)/MAXVOLUME); volume -= (MAXVOLUME-m_audioVolume)*((10000/4)/MAXVOLUME);
//? if ( volume == -10000 ) return TRUE; //? if ( volume == -10000 ) return true;
if ( volume <= -10000/4 ) return TRUE; if ( volume <= -10000/4 ) return true;
if ( channel < 0 || channel >= MAXSOUND ) return FALSE; if ( channel < 0 || channel >= MAXSOUND ) return false;
if ( m_lpDSB[channel] == NULL ) return FALSE; if ( m_lpDSB[channel] == NULL ) return false;
m_lpDSB[channel]->SetVolume(volume); m_lpDSB[channel]->SetVolume(volume);
m_lpDSB[channel]->SetPan(pan); m_lpDSB[channel]->SetPan(pan);
m_lpDSB[channel]->Play(0, 0, 0); m_lpDSB[channel]->Play(0, 0, 0);
return TRUE; return true;
} }
// Fait entendre un son dans une image. // Fait entendre un son dans une image.
// Si rank != -1, il indique le rang du blupi dont il faudra // Si rank != -1, il indique le rang du blupi dont il faudra
// éventuellement stopper le dernier son en cours ! // é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; 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 // Uses MCI to play a MIDI file. The window procedure
// is notified when playback is complete. // 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_OPEN_PARMS mciOpenParms;
MCI_PLAY_PARMS mciPlayParms; MCI_PLAY_PARMS mciPlayParms;
DWORD dwReturn; DWORD dwReturn;
char string[MAX_PATH]; char string[MAX_PATH];
if ( !m_bEnable ) return TRUE; if ( !m_bEnable ) return true;
if ( m_midiVolume == 0 ) return TRUE; if ( m_midiVolume == 0 ) return true;
InitMidiVolume(m_midiVolume); InitMidiVolume(m_midiVolume);
m_lastMidiVolume = m_midiVolume; m_lastMidiVolume = m_midiVolume;
@ -555,7 +555,7 @@ BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename)
mciGetErrorString(dwReturn, string, 128); mciGetErrorString(dwReturn, string, 128);
OutputDebug(string); OutputDebug(string);
// Failed to open device. Don't close it; just return error. // Failed to open device. Don't close it; just return error.
return FALSE; return false;
} }
// The device opened successfully; get the device ID. // The device opened successfully; get the device ID.
@ -573,22 +573,22 @@ BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename)
mciGetErrorString(dwReturn, string, 128); mciGetErrorString(dwReturn, string, 128);
OutputDebug(string); OutputDebug(string);
StopMusic(); StopMusic();
return FALSE; return false;
} }
strcpy(m_MIDIFilename, lpszMIDIFilename); strcpy(m_MIDIFilename, lpszMIDIFilename);
return TRUE; return true;
} }
// Restart the MIDI player. // Restart the MIDI player.
BOOL CSound::RestartMusic() bool CSound::RestartMusic()
{ {
OutputDebug("RestartMusic\n"); OutputDebug("RestartMusic\n");
if ( !m_bEnable ) return TRUE; if ( !m_bEnable ) return true;
if ( m_midiVolume == 0 ) return TRUE; if ( m_midiVolume == 0 ) return true;
if ( m_MIDIFilename[0] == 0 ) return FALSE; if ( m_MIDIFilename[0] == 0 ) return false;
return PlayMusic(m_hWnd, m_MIDIFilename); return PlayMusic(m_hWnd, m_MIDIFilename);
} }
@ -620,9 +620,9 @@ void CSound::StopMusic()
m_MIDIFilename[0] = 0; 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); return (m_MIDIFilename[0] != 0);
} }

32
sound.h
View File

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

View File

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