diff --git a/action.cpp b/action.cpp index a16e499..e337ae6 100644 --- a/action.cpp +++ b/action.cpp @@ -2568,7 +2568,7 @@ static DescAction action_table[] = // Calcule l'action suivante. -// Retourne FALSE lorsque l'action est terminée. +// Retourne false lorsque l'action est terminée. bool Action(short action, short direct, short &phase, short &step, @@ -2615,18 +2615,18 @@ bool Action(short action, short direct, pos.x /= 100; pos.y /= 100; - if ( phase >= nbPhase ) return FALSE; + if ( phase >= nbPhase ) return false; phase ++; step ++; - return TRUE; + return true; } pTable ++; } - return FALSE; + return false; } @@ -2667,31 +2667,31 @@ bool Rotate(short &icon, short direct) if ( icon >= 200 && icon <= 215 ) // tracks ? { icon = (direct/8)+200; - return TRUE; + return true; } if ( icon >= 216 && icon <= 231 ) // robot ? { icon = (direct/8)+216; - return TRUE; + return true; } if ( icon >= 290 && icon <= 305 ) // disciple ? { icon = (direct/8)+290; - return TRUE; + return true; } if ( icon >= 234 && icon <= 249 ) // blupi en bateau ? { icon = (direct/8)+234; - return TRUE; + return true; } if ( icon >= 250 && icon <= 265 ) // blupi en jeep ? { icon = (direct/8)+250; - return TRUE; + return true; } if ( icon >= 169 && icon <= 192 ) // blupi malade ? @@ -2707,14 +2707,14 @@ bool Rotate(short &icon, short direct) if ( icon == pTable[i] ) { icon = pTable[direct/16]+offset; - return TRUE; + return true; } } pTable += 8; } - return FALSE; + return false; } // Retourne la direction d'une icône. diff --git a/arrange.cpp b/arrange.cpp index 3132093..277639e 100644 --- a/arrange.cpp +++ b/arrange.cpp @@ -49,7 +49,7 @@ static char tableDark[13*4] = // Retourne les bits contenant de l'eau. -BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index) +bool CDecor::GetSeeBits(POINT cel, char *pBits, int index) { int icon; @@ -59,13 +59,13 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index) pBits[3] = 0; if ( cel.x < 0 || cel.x >= MAXCELX || - cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + cel.y < 0 || cel.y >= MAXCELY ) return false; icon = m_decor[cel.x/2][cel.y/2].floorIcon; if ( index == 0 ) // eau ? { - if ( icon < 1 || icon > 14 ) return TRUE; + if ( icon < 1 || icon > 14 ) return true; icon -= 1; pBits[0] = tableSee[icon*4+0]; pBits[1] = tableSee[icon*4+1]; @@ -75,16 +75,16 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index) if ( index == 1 ) // mousse ? { - if ( icon >= 2 && icon <= 14 ) return FALSE; // eau ? + if ( icon >= 2 && icon <= 14 ) return false; // eau ? if ( icon == 66 || icon == 79 ) // mousse spéciale ? { pBits[0] = 1; pBits[1] = 1; pBits[2] = 1; pBits[3] = 1; - return TRUE; + return true; } - if ( icon < 20 || icon > 32 ) return TRUE; + if ( icon < 20 || icon > 32 ) return true; icon -= 20; pBits[0] = tableDark[icon*4+0]; pBits[1] = tableDark[icon*4+1]; @@ -94,7 +94,7 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index) if ( index == 2 ) // terre ? { - if ( icon >= 2 && icon <= 14 ) return FALSE; // eau ? + if ( icon >= 2 && icon <= 14 ) return false; // eau ? if ( (icon >= 46 && icon <= 48) || // terre spéciale ? icon == 71 ) // terre à fer ? { @@ -102,9 +102,9 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index) pBits[1] = 1; pBits[2] = 1; pBits[3] = 1; - return TRUE; + return true; } - if ( icon < 33 || icon > 45 ) return TRUE; + if ( icon < 33 || icon > 45 ) return true; icon -= 33; pBits[0] = tableDark[icon*4+0]; pBits[1] = tableDark[icon*4+1]; @@ -112,7 +112,7 @@ BOOL CDecor::GetSeeBits(POINT cel, char *pBits, int index) pBits[3] = tableDark[icon*4+3]; } - return TRUE; + return true; } void CopyBits(char *pDst, char *pSrc) @@ -123,13 +123,13 @@ void CopyBits(char *pDst, char *pSrc) } } -BOOL ChangeBits(char *pDst, char *pSrc) +bool ChangeBits(char *pDst, char *pSrc) { for ( int i=0 ; i<4 ; i++ ) { - if ( *pDst++ != *pSrc++ ) return TRUE; + if ( *pDst++ != *pSrc++ ) return true; } - return FALSE; + return false; } // Retourne l'icône correspondant aux bits d'eaux. @@ -186,7 +186,7 @@ void CDecor::ArrangeFloor(POINT cel) POINT test; int max, index, icon; char here[4], bits[4], init[4]; - BOOL bModif = FALSE; + bool bModif = false; icon = m_decor[cel.x/2][cel.y/2].floorIcon; @@ -212,7 +212,7 @@ void CDecor::ArrangeFloor(POINT cel) bits[3] != here[2] ) { here[2] = bits[1]; - bModif = TRUE; + bModif = true; } } @@ -226,7 +226,7 @@ void CDecor::ArrangeFloor(POINT cel) bits[3] != here[0] ) { here[0] = bits[3]; - bModif = TRUE; + bModif = true; } } @@ -240,7 +240,7 @@ void CDecor::ArrangeFloor(POINT cel) bits[3] != here[1] ) { here[1] = bits[2]; - bModif = TRUE; + bModif = true; } } @@ -254,7 +254,7 @@ void CDecor::ArrangeFloor(POINT cel) bits[2] != here[3] ) { here[3] = bits[0]; - bModif = TRUE; + bModif = true; } } @@ -575,7 +575,7 @@ void CDecor::ArrangeObject(POINT cel) int first, last; int index, i, j, k, x, y; POINT vector, test, pos; - BOOL bTour; + bool bTour; for ( index=0 ; index<3 ; index++ ) { @@ -635,16 +635,16 @@ void CDecor::ArrangeObject(POINT cel) vector = GetVector(i*2*16); test = cel; - bTour = FALSE; + bTour = false; j = 0; - while ( TRUE ) + while ( true ) { test.x += vector.x*2; test.y += vector.y*2; if ( m_decor[test.x/2][test.y/2].objectIcon == 27 ) // tour ? { - bTour = TRUE; + bTour = true; break; } @@ -660,7 +660,7 @@ void CDecor::ArrangeObject(POINT cel) if ( m_decor[cel.x/2][cel.y/2].objectIcon != 27 ) // pas tour ? { - bTour = FALSE; + bTour = false; } test = cel; @@ -684,10 +684,10 @@ void CDecor::ArrangeObject(POINT cel) if ( !m_bBuild && bTour ) { - if ( MoveCreate(test, -1, FALSE, CHOBJECT,-1, - -1,-1, 9999,1,0, TRUE) ) + if ( MoveCreate(test, -1, false, CHOBJECT,-1, + -1,-1, 9999,1,0, true) ) { - MoveAddIcons(test, 5-i%2, TRUE); // éclairs + MoveAddIcons(test, 5-i%2, true); // éclairs } pos = ConvCelToPos(test); @@ -707,7 +707,7 @@ void CDecor::ArrangeObject(POINT cel) // Test s'il faut remplir le sol ici. -BOOL CDecor::ArrangeFillTestFloor(POINT cel1, POINT cel2) +bool CDecor::ArrangeFillTestFloor(POINT cel1, POINT cel2) { POINT cel; int icon1, icon2; @@ -741,37 +741,37 @@ BOOL CDecor::ArrangeFillTestFloor(POINT cel1, POINT cel2) m_decor[cel.x/2][cel.y/2].floorIcon < icon1 || m_decor[cel.x/2][cel.y/2].floorIcon > icon2 ) { - return FALSE; + return false; } if ( m_fillPutChannel == CHFLOOR && m_fillPutIcon == 14 && // met de l'eau ? m_decor[cel.x/2][cel.y/2].objectIcon != -1 ) { - return FALSE; + return false; } } } if ( m_fillPutChannel == CHFLOOR && m_fillPutIcon == 14 && // met de l'eau ? - IsBlupiHereEx(cel1, cel2, -1, FALSE) ) + IsBlupiHereEx(cel1, cel2, -1, false) ) { - return FALSE; + return false; } - return TRUE; + return true; } // Test s'il faut remplir ici. -BOOL CDecor::ArrangeFillTest(POINT pos) +bool CDecor::ArrangeFillTest(POINT pos) { POINT cel1, cel2; if ( m_pFillMap[(pos.x/2)+(pos.y/2)*(MAXCELX/2)] == 1 ) { - return FALSE; + return false; } if ( m_bFillFloor ) @@ -787,20 +787,20 @@ BOOL CDecor::ArrangeFillTest(POINT pos) if ( m_decor[pos.x/2][pos.y/2].objectChannel == m_fillSearchChannel && m_decor[pos.x/2][pos.y/2].objectIcon == m_fillSearchIcon && !IsBlupiHereEx(GetCel(pos.x+0,pos.y+0), - GetCel(pos.x+1,pos.y+1), -1, FALSE) ) + GetCel(pos.x+1,pos.y+1), -1, false) ) { if ( m_decor[pos.x/2][pos.y/2].floorChannel == CHFLOOR && m_decor[pos.x/2][pos.y/2].floorIcon >= 2 && m_decor[pos.x/2][pos.y/2].floorIcon <= 14 ) // rive ou eau ? { - return FALSE; + return false; } - return TRUE; + return true; } } - return FALSE; + return false; } // Modifie le décor lors d'un remplissage. @@ -916,7 +916,7 @@ void CDecor::ArrangeFillSearch(POINT pos) // Rempli un sol à partir d'une position donnée. -void CDecor::ArrangeFill(POINT pos, int channel, int icon, BOOL bFloor) +void CDecor::ArrangeFill(POINT pos, int channel, int icon, bool bFloor) { m_bFillFloor = bFloor; @@ -969,7 +969,7 @@ void CDecor::ArrangeBlupi() { if ( !IsFreeCel(m_blupi[rank].cel, rank) ) { - m_blupi[rank].bExist = FALSE; + m_blupi[rank].bExist = false; } } } diff --git a/blupi.cpp b/blupi.cpp index 96d96e9..7ee5bcc 100644 --- a/blupi.cpp +++ b/blupi.cpp @@ -37,13 +37,13 @@ CSound* g_pSound = NULL; // sound principal CMovie* g_pMovie = NULL; // movie principal CDecor* g_pDecor = NULL; char g_CDPath[MAX_PATH]; // chemin d'accès au CD-Rom -BOOL g_bFullScreen = FALSE; // FALSE si mode de test +bool g_bFullScreen = false; // false si mode de test int g_speedRate = 1; int g_timerInterval = 50; // inverval = 50ms int g_mouseType = MOUSETYPEGRA; MMRESULT g_updateTimer; // timer général -BOOL g_bActive = TRUE; // is application active ? -BOOL g_bTermInit = FALSE; // initialisation en cours +bool g_bActive = true; // is application active ? +bool g_bTermInit = false; // initialisation en cours UINT g_lastPhase = 999; @@ -67,7 +67,7 @@ int GetNum(char *p) // Lit le fichier de configuration. -BOOL ReadConfig(LPSTR lpCmdLine) +bool ReadConfig(LPSTR lpCmdLine) { FILE* file = NULL; char buffer[200]; @@ -75,7 +75,7 @@ BOOL ReadConfig(LPSTR lpCmdLine) int nb; file = fopen("data\\config.def", "rb"); - if ( file == NULL ) return FALSE; + if ( file == NULL ) return false; nb = fread(buffer, sizeof(char), 200-1, file); buffer[nb] = 0; fclose(file); @@ -93,7 +93,7 @@ BOOL ReadConfig(LPSTR lpCmdLine) g_CDPath[i] = 0; // met le terminateur } #else - return FALSE; + return false; #endif } else @@ -122,7 +122,7 @@ BOOL ReadConfig(LPSTR lpCmdLine) drive[2] = '\\'; drive[3] = 0; nb = GetDriveType(drive); - if ( nb != DRIVE_CDROM ) return FALSE; + if ( nb != DRIVE_CDROM ) return false; } #endif #endif @@ -146,7 +146,7 @@ BOOL ReadConfig(LPSTR lpCmdLine) pText = strstr(buffer, "FullScreen="); if ( pText != NULL ) { - g_bFullScreen = GetNum(pText+11); + g_bFullScreen = !!GetNum(pText+11); if ( g_bFullScreen != 0 ) g_bFullScreen = 1; } @@ -158,7 +158,7 @@ BOOL ReadConfig(LPSTR lpCmdLine) if ( g_mouseType > 9 ) g_mouseType = 9; } - return TRUE; + return true; } @@ -297,9 +297,9 @@ void Benchmark() // Restitue le jeu après une activation en mode fullScreen. -BOOL RestoreGame() +bool RestoreGame() { - if ( g_pPixmap == NULL ) return FALSE; + if ( g_pPixmap == NULL ) return false; g_pEvent->RestoreGame(); return g_pPixmap->Restore(); @@ -307,9 +307,9 @@ BOOL RestoreGame() // Libère le jeu avant une désactivation en mode fullScreen. -BOOL FlushGame() +bool FlushGame() { - if ( g_pPixmap == NULL ) return FALSE; + if ( g_pPixmap == NULL ) return false; return g_pPixmap->Flush(); } @@ -417,7 +417,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message, totalDim.y = 66; iconDim.x = 64; iconDim.y = 66/2; - g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, TRUE); + g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, true); g_pPixmap->SetTransparent(CHHILI, RGB(0,0,255)); // bleu g_pPixmap->SavePalette(); @@ -485,7 +485,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message, case WM_SETCURSOR: // ChangeSprite(); // SetCursor(NULL); // pas de souris visible ! - return TRUE; + return true; case WM_LBUTTONDOWN: //? Benchmark(); @@ -544,7 +544,7 @@ LRESULT CALLBACK WindowProc (HWND hWnd, UINT message, // Erreur dans DoInit. -BOOL InitFail(char *msg, BOOL bDirectX) +bool InitFail(char *msg, bool bDirectX) { char buffer[100]; @@ -556,17 +556,17 @@ BOOL InitFail(char *msg, BOOL bDirectX) FinishObjects(); DestroyWindow(g_hWnd); - return FALSE; + return false; } // Initialisation de l'application. -static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) +static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASS wc; POINT totalDim, iconDim; RECT rcRect; - BOOL bOK; + bool bOK; bOK = ReadConfig(lpCmdLine); // lit le fichier config.def @@ -614,7 +614,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) SetRect(&WindowRect, (sx-LXIMAGE)/2, (sy-LYIMAGE)/2, (sx+LXIMAGE)/2, (sy+LYIMAGE)/2); - AdjustWindowRect(&WindowRect, WS_POPUPWINDOW|WS_CAPTION, TRUE); + AdjustWindowRect(&WindowRect, WS_POPUPWINDOW|WS_CAPTION, true); WindowRect.top += GetSystemMetrics(SM_CYCAPTION); g_hWnd = CreateWindow @@ -631,7 +631,7 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) NULL ); } - if ( !g_hWnd ) return FALSE; + if ( !g_hWnd ) return false; ShowWindow(g_hWnd, nCmdShow); UpdateWindow(g_hWnd); @@ -641,17 +641,17 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) if ( !bOK ) // config.def pas correct ? { - return InitFail("Game not correctly installed", FALSE); + return InitFail("Game not correctly installed", false); } // Crée le pixmap principal. g_pPixmap = new CPixmap; - if ( g_pPixmap == NULL ) return InitFail("New pixmap", TRUE); + if ( g_pPixmap == NULL ) return InitFail("New pixmap", true); totalDim.x = LXIMAGE; totalDim.y = LYIMAGE; if ( !g_pPixmap->Create(g_hWnd, totalDim, g_bFullScreen, g_mouseType) ) - return InitFail("Create pixmap", TRUE); + return InitFail("Create pixmap", true); OutputDebug("Image: init\n"); totalDim.x = LXIMAGE; @@ -659,11 +659,11 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) iconDim.x = 0; iconDim.y = 0; #if _INTRO - if ( !g_pPixmap->Cache(CHBACK, "image\\intro1.blp", totalDim, iconDim, TRUE) ) + if ( !g_pPixmap->Cache(CHBACK, "image\\intro1.blp", totalDim, iconDim, true) ) #else - if ( !g_pPixmap->Cache(CHBACK, "image\\init.blp", totalDim, iconDim, TRUE) ) + if ( !g_pPixmap->Cache(CHBACK, "image\\init.blp", totalDim, iconDim, true) ) #endif - return FALSE; + return false; OutputDebug("SavePalette\n"); g_pPixmap->SavePalette(); @@ -675,10 +675,10 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) totalDim.y = LYIMAGE; iconDim.x = 0; iconDim.y = 0; - if ( !g_pPixmap->Cache(CHGROUND, "image\\init.blp", totalDim, iconDim, TRUE) ) - return FALSE; + if ( !g_pPixmap->Cache(CHGROUND, "image\\init.blp", totalDim, iconDim, true) ) + return false; - g_pPixmap->SetDebug(FALSE); + g_pPixmap->SetDebug(false); rcRect.left = 0; rcRect.top = 0; @@ -691,118 +691,118 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) totalDim.y = DIMCELY*2*6; iconDim.x = DIMCELX*2; iconDim.y = DIMCELY*2; - if ( !g_pPixmap->Cache(CHFLOOR, "image\\floor000.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache floor000.blp", TRUE); + if ( !g_pPixmap->Cache(CHFLOOR, "image\\floor000.blp", totalDim, iconDim, false) ) + return InitFail("Cache floor000.blp", true); g_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu totalDim.x = DIMOBJX*16; totalDim.y = DIMOBJY*8; iconDim.x = DIMOBJX; iconDim.y = DIMOBJY; - if ( !g_pPixmap->Cache(CHOBJECT, "image\\obj000.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache obj000.blp", TRUE); + if ( !g_pPixmap->Cache(CHOBJECT, "image\\obj000.blp", totalDim, iconDim, false) ) + return InitFail("Cache obj000.blp", true); g_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu - if ( !g_pPixmap->Cache(CHOBJECTo, "image\\obj-o000.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache obj-o000.blp", TRUE); + if ( !g_pPixmap->Cache(CHOBJECTo, "image\\obj-o000.blp", totalDim, iconDim, false) ) + return InitFail("Cache obj-o000.blp", true); g_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc totalDim.x = DIMBLUPIX*16; totalDim.y = DIMBLUPIY*23; iconDim.x = DIMBLUPIX; iconDim.y = DIMBLUPIY; - if ( !g_pPixmap->Cache(CHBLUPI, "image\\blupi.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache blupi.blp", TRUE); + if ( !g_pPixmap->Cache(CHBLUPI, "image\\blupi.blp", totalDim, iconDim, false) ) + return InitFail("Cache blupi.blp", true); g_pPixmap->SetTransparent(CHBLUPI, RGB(0,0,255)); // bleu totalDim.x = 64; totalDim.y = 66; iconDim.x = 64; iconDim.y = 66/2; - if ( !g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache hili.blp", TRUE); + if ( !g_pPixmap->Cache(CHHILI, "image\\hili.blp", totalDim, iconDim, false) ) + return InitFail("Cache hili.blp", true); g_pPixmap->SetTransparent(CHHILI, RGB(0,0,255)); // bleu totalDim.x = DIMCELX*2*3; totalDim.y = DIMCELY*2*5; iconDim.x = DIMCELX*2; iconDim.y = DIMCELY*2; - if ( !g_pPixmap->Cache(CHFOG, "image\\fog.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache fog.blp", TRUE); + if ( !g_pPixmap->Cache(CHFOG, "image\\fog.blp", totalDim, iconDim, false) ) + return InitFail("Cache fog.blp", true); g_pPixmap->SetTransparent(CHFOG, RGB(255,255,255)); // blanc totalDim.x = DIMCELX*2*16; totalDim.y = DIMCELY*2*1; iconDim.x = DIMCELX*2; iconDim.y = DIMCELY*2; - if ( !g_pPixmap->Cache(CHMASK1, "image\\mask1.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache mask1.blp", TRUE); + if ( !g_pPixmap->Cache(CHMASK1, "image\\mask1.blp", totalDim, iconDim, false) ) + return InitFail("Cache mask1.blp", true); g_pPixmap->SetTransparent(CHMASK1, RGB(0,0,0)); // noir totalDim.x = DIMBUTTONX*6; totalDim.y = DIMBUTTONY*21; iconDim.x = DIMBUTTONX; iconDim.y = DIMBUTTONY; - if ( !g_pPixmap->Cache(CHBUTTON, "image\\button00.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache button00.blp", TRUE); + if ( !g_pPixmap->Cache(CHBUTTON, "image\\button00.blp", totalDim, iconDim, false) ) + return InitFail("Cache button00.blp", true); g_pPixmap->SetTransparent(CHBUTTON, RGB(0,0,255)); // bleu totalDim.x = DIMJAUGEX*1; totalDim.y = DIMJAUGEY*4; iconDim.x = DIMJAUGEX; iconDim.y = DIMJAUGEY; - if ( !g_pPixmap->Cache(CHJAUGE, "image\\jauge.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache jauge.blp", TRUE); + if ( !g_pPixmap->Cache(CHJAUGE, "image\\jauge.blp", totalDim, iconDim, false) ) + return InitFail("Cache jauge.blp", true); g_pPixmap->SetTransparent(CHJAUGE, RGB(0,0,255)); // bleu totalDim.x = DIMTEXTX*16; totalDim.y = DIMTEXTY*8*3; iconDim.x = DIMTEXTX; iconDim.y = DIMTEXTY; - if ( !g_pPixmap->Cache(CHTEXT, "image\\text.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache text.blp", TRUE); + if ( !g_pPixmap->Cache(CHTEXT, "image\\text.blp", totalDim, iconDim, false) ) + return InitFail("Cache text.blp", true); g_pPixmap->SetTransparent(CHTEXT, RGB(0,0,255)); // bleu totalDim.x = DIMLITTLEX*16; totalDim.y = DIMLITTLEY*8; iconDim.x = DIMLITTLEX; iconDim.y = DIMLITTLEY; - if ( !g_pPixmap->Cache(CHLITTLE, "image\\little.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache little.blp", TRUE); + if ( !g_pPixmap->Cache(CHLITTLE, "image\\little.blp", totalDim, iconDim, false) ) + return InitFail("Cache little.blp", true); g_pPixmap->SetTransparent(CHLITTLE, RGB(0,0,255)); // bleu totalDim.x = 426; totalDim.y = 52; iconDim.x = 426; iconDim.y = 52; - if ( !g_pPixmap->Cache(CHBIGNUM, "image\\bignum.blp", totalDim, iconDim, FALSE) ) - return InitFail("Cache bignum.blp", TRUE); + if ( !g_pPixmap->Cache(CHBIGNUM, "image\\bignum.blp", totalDim, iconDim, false) ) + return InitFail("Cache bignum.blp", true); g_pPixmap->SetTransparent(CHBIGNUM, RGB(0,0,255)); // bleu // Crée le gestionnaire de son. g_pSound = new CSound; - if ( g_pSound == NULL ) return InitFail("New sound", TRUE); + if ( g_pSound == NULL ) return InitFail("New sound", true); g_pSound->Create(g_hWnd); g_pSound->CacheAll(); - g_pSound->SetState(TRUE); + g_pSound->SetState(true); // Crée le gestionnaire de films. g_pMovie = new CMovie; - if ( g_pMovie == NULL ) return InitFail("New movie", FALSE); + if ( g_pMovie == NULL ) return InitFail("New movie", false); g_pMovie->Create(); // Crée le gestionnaire de décors. g_pDecor = new CDecor; - if ( g_pDecor == NULL ) return InitFail("New decor", FALSE); + if ( g_pDecor == NULL ) return InitFail("New decor", false); g_pDecor->Create(g_hWnd, g_pSound, g_pPixmap); g_pDecor->MapInitColors(); // Crée le gestionnaire d'événements. g_pEvent = new CEvent; - if ( g_pEvent == NULL ) return InitFail("New event", FALSE); + if ( g_pEvent == NULL ) return InitFail("New event", false); g_pEvent->Create(g_hWnd, g_pPixmap, g_pDecor, g_pSound, g_pMovie); g_pEvent->SetFullScreen(g_bFullScreen); @@ -813,8 +813,8 @@ static BOOL DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) g_pEvent->ChangePhase(WM_PHASE_TESTCD); #endif - g_bTermInit = TRUE; // initialisation terminée - return TRUE; + g_bTermInit = true; // initialisation terminée + return true; } @@ -827,12 +827,12 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, if ( !DoInit(hInstance, lpCmdLine, nCmdShow) ) { - return FALSE; + return false; } SetTimer(g_hWnd, 1, g_timerInterval, NULL); - while ( TRUE ) + while ( true ) { if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) { diff --git a/button.cpp b/button.cpp index 03a4ae3..347dffa 100644 --- a/button.cpp +++ b/button.cpp @@ -20,16 +20,16 @@ CButton::CButton() { m_type = 0; - m_bEnable = TRUE; - m_bHide = FALSE; + m_bEnable = true; + m_bHide = false; m_state = 0; m_mouseState = 0; m_nbMenu = 0; m_nbToolTips = 0; m_selMenu = 0; - m_bMouseDown = FALSE; - m_bMinimizeRedraw = FALSE; - m_bRedraw = FALSE; + m_bMouseDown = false; + m_bMinimizeRedraw = false; + m_bRedraw = false; } // Destructeur. @@ -41,8 +41,8 @@ CButton::~CButton() // Crée un nouveau bouton. -BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, BOOL bMinimizeRedraw, +bool CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, + POINT pos, int type, bool bMinimizeRedraw, int *pMenu, int nbMenu, int *pToolTips, int nbToolTips, int region, UINT message) @@ -55,7 +55,7 @@ BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, DIMBUTTONX,DIMBUTTONY, // button00.bmp }; - if ( type < 0 || type > 0 ) return FALSE; + if ( type < 0 || type > 0 ) return false; iconDim.x = ttypes[type*2+0]; iconDim.y = ttypes[type*2+1]; @@ -65,8 +65,8 @@ BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, m_pSound = pSound; m_type = type; m_bMinimizeRedraw = bMinimizeRedraw; - m_bEnable = TRUE; - m_bHide = FALSE; + m_bEnable = true; + m_bHide = false; m_message = message; m_pos = pos; m_dim = iconDim; @@ -75,8 +75,8 @@ BOOL CButton::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, m_selMenu = 0; m_state = 0; m_mouseState = 0; - m_bMouseDown = FALSE; - m_bRedraw = TRUE; + m_bMouseDown = false; + m_bRedraw = true; for ( i=0 ; i 1 && m_bMouseDown ) // sous-menu déroulé ? { @@ -336,31 +336,31 @@ BOOL CButton::Detect(POINT pos) if ( pos.x < m_pos.x || pos.x > m_pos.x+width || pos.y < m_pos.y || - pos.y > m_pos.y+m_dim.y ) return FALSE; + pos.y > m_pos.y+m_dim.y ) return false; - return TRUE; + return true; } // Bouton de la souris pressé. -BOOL CButton::MouseDown(POINT pos) +bool CButton::MouseDown(POINT pos) { - if ( !Detect(pos) ) return FALSE; + if ( !Detect(pos) ) return false; m_mouseState = 1; - m_bMouseDown = TRUE; - m_bRedraw = TRUE; + m_bMouseDown = true; + m_bRedraw = true; PostMessage(m_hWnd, WM_UPDATE, 0, 0); m_pSound->PlayImage(SOUND_CLICK, pos); - return TRUE; + return true; } // Souris déplacés. -BOOL CButton::MouseMove(POINT pos) +bool CButton::MouseMove(POINT pos) { - BOOL bDetect; + bool bDetect; int iState, iMenu; iState = m_mouseState; @@ -393,7 +393,7 @@ BOOL CButton::MouseMove(POINT pos) if ( iState != m_mouseState || iMenu != m_selMenu ) { - m_bRedraw = TRUE; + m_bRedraw = true; PostMessage(m_hWnd, WM_UPDATE, 0, 0); } @@ -402,24 +402,24 @@ BOOL CButton::MouseMove(POINT pos) // Bouton de la souris relâché. -BOOL CButton::MouseUp(POINT pos) +bool CButton::MouseUp(POINT pos) { - BOOL bDetect; + bool bDetect; bDetect = Detect(pos); m_mouseState = m_state; - m_bMouseDown = FALSE; - m_bRedraw = TRUE; + m_bMouseDown = false; + m_bRedraw = true; - if ( !bDetect ) return FALSE; + if ( !bDetect ) return false; if ( m_message != -1 ) { PostMessage(m_hWnd, m_message, 0, 0); } - return TRUE; + return true; } diff --git a/button.h b/button.h index ffabf3e..223e76c 100644 --- a/button.h +++ b/button.h @@ -10,8 +10,8 @@ public: CButton(); ~CButton(); - BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, BOOL bMinimizeRedraw, + bool Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, + POINT pos, int type, bool bMinimizeRedraw, int *pMenu, int nbMenu, int *pTooltips, int nbToolTips, int region, UINT message); @@ -24,22 +24,22 @@ public: int GetMenu(); void SetMenu(int menu); - BOOL GetEnable(); - void SetEnable(BOOL bEnable); + bool GetEnable(); + void SetEnable(bool bEnable); - BOOL GetHide(); - void SetHide(BOOL bHide); + bool GetHide(); + void SetHide(bool bHide); - BOOL TreatEvent(UINT message, WPARAM wParam, LPARAM lParam); - BOOL MouseOnButton(POINT pos); + bool TreatEvent(UINT message, WPARAM wParam, LPARAM lParam); + bool MouseOnButton(POINT pos); int GetToolTips(POINT pos); protected: - BOOL Detect(POINT pos); - BOOL MouseDown(POINT pos); - BOOL MouseMove(POINT pos); - BOOL MouseUp(POINT pos); + bool Detect(POINT pos); + bool MouseDown(POINT pos); + bool MouseMove(POINT pos); + bool MouseUp(POINT pos); protected: HWND m_hWnd; @@ -47,8 +47,8 @@ protected: CDecor* m_pDecor; CSound* m_pSound; int m_type; // type de bouton - BOOL m_bEnable; // TRUE si bouton actif - BOOL m_bHide; // TRUE si bouton caché + bool m_bEnable; // true si bouton actif + bool m_bHide; // true si bouton caché UINT m_message; // message envoyé si bouton actionné POINT m_pos; // coin sup/gauche POINT m_dim; // dimensions @@ -59,9 +59,9 @@ protected: int m_nbMenu; // nb de case du sous-menu int m_nbToolTips; // nb d'info-bulles int m_selMenu; // sous-menu sélectionné - BOOL m_bMouseDown; // TRUE -> bouton souris pressé - BOOL m_bMinimizeRedraw; - BOOL m_bRedraw; // TRUE -> doit être redessiné + bool m_bMouseDown; // true -> bouton souris pressé + bool m_bMinimizeRedraw; + bool m_bRedraw; // true -> doit être redessiné }; ///////////////////////////////////////////////////////////////////////////// diff --git a/chemin.cpp b/chemin.cpp index 150235b..2797bdc 100644 --- a/chemin.cpp +++ b/chemin.cpp @@ -39,7 +39,7 @@ void CDecor::CheminMemPos(int exRank) // Teste si une positiion est occupée par un blupi. -BOOL CDecor::CheminTestPos(POINT pos, int &rank) +bool CDecor::CheminTestPos(POINT pos, int &rank) { int i; @@ -49,11 +49,11 @@ BOOL CDecor::CheminTestPos(POINT pos, int &rank) pos.y == m_cheminPos[i].y ) { rank = m_cheminRank[i]; - return TRUE; + return true; } } - return FALSE; + return false; } @@ -72,7 +72,7 @@ int CDecor::CheminARebours(int rank) if ( rebours == 0 ) return -1; - while ( TRUE ) + while ( true ) { bis: for ( set=0 ; set<2 ; set++ ) @@ -180,12 +180,12 @@ void CDecor::CheminFillTerrain(int rank) // et le "prix à payer" pour aller dans cette direction // coût doit être déterminé en sortie -BOOL CDecor::CheminTestDirection(int rank, int pos, int dir, +bool CDecor::CheminTestDirection(int rank, int pos, int dir, int &next, int &li, int &cout, int &action) { POINT cel, vector, newCel; - BOOL bFree; + bool bFree; int tryDirect, workBlupi, rankHere; cel.x = pos%MAXCELX; @@ -226,7 +226,7 @@ BOOL CDecor::CheminTestDirection(int rank, int pos, int dir, m_blupi[rank].passCel.y/2 == (cel.y+vector.y*ampli)/2 && (workBlupi < 0 || workBlupi == rank) ) { - bFree = TRUE; + bFree = true; cout = 1; } } @@ -240,35 +240,35 @@ BOOL CDecor::CheminTestDirection(int rank, int pos, int dir, { // Le tracks peut aller sur les blupi // pour les écraser ! - if ( IsTracksHere(newCel, FALSE) ) // autre perso ici ? + if ( IsTracksHere(newCel, false) ) // autre perso ici ? { - return FALSE; + return false; } } else { -//? if ( IsBlupiHere(newCel, FALSE) ) // autre perso ici ? +//? if ( IsBlupiHere(newCel, false) ) // autre perso ici ? if ( CheminTestPos(newCel, rankHere) ) // autre perso ici ? { // Si blupi immobile, comme si obstacle qq. -//? if ( m_blupi[m_blupiHere].goalCel.x == -1 ) return FALSE; - if ( m_blupi[rankHere].goalCel.x == -1 ) return FALSE; +//? if ( m_blupi[m_blupiHere].goalCel.x == -1 ) return false; + if ( m_blupi[rankHere].goalCel.x == -1 ) return false; // Si blupi mobile, possible mais coût élevé. cout = 20; } } next = vector.y*MAXCELX + vector.x; - return TRUE; + return true; } - return FALSE; + return false; } -// Retourne TRUE si on a assigné une nouvelle direction à blupi. -BOOL CDecor::CheminCherche(int rank, int &action) +// Retourne true si on a assigné une nouvelle direction à blupi. +bool CDecor::CheminCherche(int rank, int &action) { int cout; // prix pour aller dans une direction int pos, dir, next, ampli; @@ -277,13 +277,13 @@ BOOL CDecor::CheminCherche(int rank, int &action) if ( m_blupi[rank].cel.x == m_blupi[rank].goalCel.x && m_blupi[rank].cel.y == m_blupi[rank].goalCel.y ) { - return FALSE; + return false; } // Destination occupée ? - if ( IsBlupiHereEx(m_blupi[rank].goalCel, rank, FALSE) ) + if ( IsBlupiHereEx(m_blupi[rank].goalCel, rank, false) ) { - return FALSE; + return false; } memset(m_cheminWork, 0, (BYTE)MAXCELX*(BYTE)MAXCELY); @@ -295,30 +295,30 @@ BOOL CDecor::CheminCherche(int rank, int &action) // cherche le chemin à partir de la destination dir = CheminARebours(rank); - if ( dir < 0 ) return FALSE; + if ( dir < 0 ) return false; pos = m_blupi[rank].cel.y*MAXCELX + m_blupi[rank].cel.x; if ( CheminTestDirection(rank, pos, dir, next, ampli, cout, action) && cout < 20 ) { m_blupi[rank].sDirect = 16*dir; - return TRUE; + return true; } // ne devrait jamais arriver ! - return FALSE; + return false; } // Teste s'il est possible de se rendre à un endroit donné. -BOOL CDecor::IsCheminFree(int rank, POINT dest, int button) +bool CDecor::IsCheminFree(int rank, POINT dest, int button) { int action, sDirect; POINT goalCel, passCel, limit; - BOOL bOK; + bool bOK; - if ( button == BUTTON_STOP ) return TRUE; + if ( button == BUTTON_STOP ) return true; goalCel = m_blupi[rank].goalCel; passCel = m_blupi[rank].passCel; @@ -349,7 +349,7 @@ BOOL CDecor::IsCheminFree(int rank, POINT dest, int button) } if ( m_blupi[rank].cel.x == dest.x && - m_blupi[rank].cel.y == dest.y ) return TRUE; + m_blupi[rank].cel.y == dest.y ) return true; m_blupi[rank].goalCel = dest; if ( m_decor[dest.x/2][dest.y/2].objectChannel == CHOBJECT && diff --git a/ddutil.cpp b/ddutil.cpp index ffcd4d7..71cb248 100644 --- a/ddutil.cpp +++ b/ddutil.cpp @@ -19,9 +19,9 @@ // First-chance exception in Blupi.exe (GDI32.DLL): 0xC0000005: Access Violation. // apparaît au endroits marqués par (@) ... -BOOL g_bDebug = TRUE; +bool g_bDebug = true; -void DDSetDebug(BOOL bDebug) +void DDSetDebug(bool bDebug) { g_bDebug = bDebug; } diff --git a/ddutil.h b/ddutil.h index f0d282b..b93ff24 100644 --- a/ddutil.h +++ b/ddutil.h @@ -13,7 +13,7 @@ extern "C" { /* Assume C declarations for C++ */ #endif /* __cplusplus */ -extern void DDSetDebug(BOOL bDebug); +extern void DDSetDebug(bool bDebug); extern IDirectDrawSurface * DDConnectBitmap(IDirectDraw *pdd, HBITMAP hbm); extern IDirectDrawPalette * DDLoadPalette(IDirectDraw *pdd, LPCSTR szBitmap); extern IDirectDrawSurface * DDLoadBitmap(IDirectDraw *pdd, LPCSTR szBitmap, int dx, int dy); diff --git a/decblupi.cpp b/decblupi.cpp index 0aecf2b..2e0b594 100644 --- a/decblupi.cpp +++ b/decblupi.cpp @@ -63,7 +63,7 @@ void CDecor::BlupiFlush() for ( i=0 ; i= 0, supprime seulement ce personnage. -BOOL CDecor::BlupiDelete(POINT cel, int perso) +bool CDecor::BlupiDelete(POINT cel, int perso) { int rank; @@ -198,7 +198,7 @@ BOOL CDecor::BlupiDelete(POINT cel, int perso) m_blupi[rank].cel.y == cel.y && (perso == -1 || m_blupi[rank].perso == perso) ) { - m_blupi[rank].bExist = FALSE; + m_blupi[rank].bExist = false; if ( !m_bBuild ) // phase de jeu ? { @@ -213,18 +213,18 @@ BOOL CDecor::BlupiDelete(POINT cel, int perso) m_rankBlupiHili = -1; } } - return TRUE; + return true; } } - return FALSE; + return false; } // Supprime un blupi existant. void CDecor::BlupiDelete(int rank) { - m_blupi[rank].bExist = FALSE; + m_blupi[rank].bExist = false; if ( !m_bBuild && // phase de jeu ? m_nbBlupiHili > 0 && @@ -260,7 +260,7 @@ void CDecor::BlupiKill(int exRank, POINT cel, int type) if ( type == 0 ) // explosion ? { - m_blupi[rank].bExist = FALSE; // mort instantannée + m_blupi[rank].bExist = false; // mort instantannée } if ( type == 1 ) // électro ? @@ -305,7 +305,7 @@ void CDecor::BlupiKill(int exRank, POINT cel, int type) m_blupi[rank].cel.y <= cel.y+2 ) { GoalUnwork(rank); - m_blupi[rank].bExist = FALSE; + m_blupi[rank].bExist = false; } } } @@ -314,9 +314,9 @@ void CDecor::BlupiKill(int exRank, POINT cel, int type) // Test si un blupi existe. -BOOL CDecor::BlupiIfExist(int rank) +bool CDecor::BlupiIfExist(int rank) { - return m_blupi[rank].bExist; + return !!m_blupi[rank].bExist; } @@ -336,7 +336,7 @@ void CDecor::BlupiCheat(int cheat) m_blupi[rank].perso == 0 ) { m_blupi[rank].energy = MAXENERGY; - m_blupi[rank].bMalade = FALSE; + m_blupi[rank].bMalade = false; } } @@ -346,7 +346,7 @@ void CDecor::BlupiCheat(int cheat) m_blupi[rank].perso != 0 && m_blupi[rank].perso != 8 ) // araignée/virus/etc. ? { - m_blupi[rank].bExist = FALSE; + m_blupi[rank].bExist = false; } } } @@ -481,10 +481,10 @@ void CDecor::BlupiAdaptIcon(int rank) // Fait entendre un son pour un blupi. -// Si bStop=TRUE, on stoppe le son précédent associé +// Si bStop=true, on stoppe le son précédent associé // à ce blupi (rank), si nécessaire. -void CDecor::BlupiSound(int rank, int sound, POINT pos, BOOL bStop) +void CDecor::BlupiSound(int rank, int sound, POINT pos, bool bStop) { int newSound; @@ -979,16 +979,16 @@ int CDecor::ListGetParam(int rank, int button, POINT cel) // Ajoute une action dans la liste. -BOOL CDecor::ListPut(int rank, int button, POINT cel, POINT cMem) +bool CDecor::ListPut(int rank, int button, POINT cel, POINT cMem) { int i, last; if ( button == BUTTON_REPEAT || - button == BUTTON_GO ) return TRUE; + button == BUTTON_GO ) return true; // Mémorise "mange" seulement après un "cultive". if ( button == BUTTON_MANGE && - m_blupi[rank].listButton[0] != BUTTON_CULTIVE ) return TRUE; + m_blupi[rank].listButton[0] != BUTTON_CULTIVE ) return true; // Si prend/dépose à la suite au même endroit, // il est inutile de mémoriser ! @@ -1000,7 +1000,7 @@ BOOL CDecor::ListPut(int rank, int button, POINT cel, POINT cMem) cel.y/2 == m_blupi[rank].listCel[0].y/2 ) { ListRemove(rank); - return TRUE; + return true; } } @@ -1015,7 +1015,7 @@ BOOL CDecor::ListPut(int rank, int button, POINT cel, POINT cMem) m_blupi[rank].listCel[0] = cMem; m_blupi[rank].listParam[0] = ListGetParam(rank, button, cel); - return TRUE; + return true; } // Enlève la dernière action ajoutée dans la liste. @@ -1135,7 +1135,7 @@ int CDecor::ListSearch(int rank, int button, POINT cel, // Ajuste une action à répéter. -BOOL CDecor::RepeatAdjust(int rank, int button, +bool CDecor::RepeatAdjust(int rank, int button, POINT &cel, POINT &cMem, int param, int list) { int i, channel, icon, icon1, icon2, flags; @@ -1215,7 +1215,7 @@ BOOL CDecor::RepeatAdjust(int rank, int button, } } } - return FALSE; + return false; } if ( button == BUTTON_DEPOSE && // dépose pour un bateau ? @@ -1228,7 +1228,7 @@ BOOL CDecor::RepeatAdjust(int rank, int button, cMem = test; goto ok; } - return FALSE; + return false; } //? if ( button == BUTTON_MANGE ) @@ -1274,7 +1274,7 @@ BOOL CDecor::RepeatAdjust(int rank, int button, icon1, icon2, -1, -1, cel, icon1) ) { - return FALSE; + return false; } } @@ -1288,7 +1288,7 @@ BOOL CDecor::RepeatAdjust(int rank, int button, if ( cel.y%2 == 0 ) cel.y ++; // sur l'objet m_blupi[rank].interrupt = 1; - return TRUE; + return true; } @@ -1301,32 +1301,32 @@ void CDecor::GoalStart(int rank, int action, POINT cel) m_blupi[rank].goalAction = action; m_blupi[rank].goalPhase = 0; m_blupi[rank].goalCel.x = -1; - m_blupi[rank].bRepeat = FALSE; + m_blupi[rank].bRepeat = false; GoalInitJauge(rank); FlushUsed(rank); } // Effectue la méta opération suivante. -// Retourne FALSE lorsque c'est fini ! +// Retourne false lorsque c'est fini ! -BOOL CDecor::GoalNextPhase(int rank) +bool CDecor::GoalNextPhase(int rank) { short* pTable; int i, nb; - if ( m_blupi[rank].goalAction == 0 ) return FALSE; + if ( m_blupi[rank].goalAction == 0 ) return false; pTable = GetTableGoal(m_blupi[rank].goalAction); if ( pTable == NULL ) { - GoalStop(rank, TRUE); - return FALSE; + GoalStop(rank, true); + return false; } for ( i=0 ; i= 0 ) { GoalStart(rank, WM_ACTION_T_DYNAMITE, cel); - m_blupi[rank].bCache = TRUE; + m_blupi[rank].bCache = true; } } else @@ -1680,7 +1680,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) PutObject(cel, -1,-1); // supprime l'objet ArrangeObject(cel); } - return TRUE; + return true; } if ( op == GOAL_EXPLOSE2 ) @@ -1696,12 +1696,12 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) channel = CHOBJECT; icon = -1; ArrangeBuild(cel, channel, icon); // arrange les murs autour - if ( !MoveCreate(cel, rank, FALSE, + if ( !MoveCreate(cel, rank, false, CHOBJECT,-1, -1,-1, 10, 1, -1*100) ) goto error; MoveAddIcons(cel, 6); // explosion } - return TRUE; + return true; } if ( op == GOAL_ADDMOVES ) @@ -1711,7 +1711,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) GoalAdjustCel(rank, x,y); icon = *pTable++; MoveAddMoves(GetCel(x,y), icon); - return TRUE; + return true; } if ( op == GOAL_ADDICONS ) @@ -1721,7 +1721,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) GoalAdjustCel(rank, x,y); icon = *pTable++; MoveAddIcons(GetCel(x,y), icon); - return TRUE; + return true; } if ( op == GOAL_ACTION ) @@ -1729,7 +1729,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) action = *pTable++; direct = *pTable++; BlupiInitAction(rank, action, direct); - return TRUE; + return true; } if ( op == GOAL_ELECTRO ) @@ -1739,20 +1739,20 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) GoalAdjustCel(rank, x,y); cel = GetCel((x/2)*2,(y/2)*2); icon = *pTable++; - if ( MoveCreate(cel, rank, TRUE, + if ( MoveCreate(cel, rank, true, CHFLOOR,-1, -1,-1, - 100,1,100, FALSE, TRUE) ) + 100,1,100, false, true) ) { MoveAddIcons(cel, icon); } BlupiKill(rank, cel, 1); - return TRUE; + return true; } if ( op == GOAL_MALADE ) { m_blupi[rank].bMalade = *pTable++; - return TRUE; + return true; } if ( op == GOAL_WORK ) @@ -1760,25 +1760,25 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) cel.x = m_blupi[rank].cel.x+(*pTable++); cel.y = m_blupi[rank].cel.y+(*pTable++); m_decor[cel.x/2][cel.y/2].workBlupi = rank; - return TRUE; + return true; } if ( op == GOAL_INTERRUPT ) { m_blupi[rank].interrupt = *pTable++; // change le niveau - return TRUE; + return true; } if ( op == GOAL_ENERGY ) { if ( m_blupi[rank].energy <= *pTable++ ) goto error; - return TRUE; + return true; } if ( op == GOAL_ISNOMALADE ) { if ( m_blupi[rank].bMalade ) goto error; - return TRUE; + return true; } if ( op == GOAL_TAKE ) @@ -1790,7 +1790,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) m_blupi[rank].takeIcon = m_decor[cel.x/2][cel.y/2].objectIcon; m_decor[cel.x/2][cel.y/2].objectChannel = -1; m_decor[cel.x/2][cel.y/2].objectIcon = -1; - return TRUE; + return true; } if ( op == GOAL_TAKEOBJECT ) @@ -1801,7 +1801,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) icon = *pTable++; m_blupi[rank].takeChannel = channel; m_blupi[rank].takeIcon = icon; - return TRUE; + return true; } if ( op == GOAL_LABO ) @@ -1823,7 +1823,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) { m_blupi[rank].takeIcon = 92; // poison } - return TRUE; + return true; } if ( op == GOAL_CACHE ) @@ -1834,9 +1834,9 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) m_blupi[rank].vehicule == 3 && // armure ? !m_bInvincible ) { - m_blupi[rank].bCache = FALSE; + m_blupi[rank].bCache = false; } - return TRUE; + return true; } if ( op == GOAL_DELETE ) @@ -1845,16 +1845,16 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) m_blupi[rank].vehicule == 3 && // armure ? !m_bInvincible ) { - return TRUE; + return true; } BlupiDelete(rank); // snif ... - return TRUE; + return true; } if ( op == GOAL_DEPOSE ) { m_blupi[rank].takeChannel = -1; - return TRUE; + return true; } if ( op == GOAL_NEWBLUPI ) @@ -1894,7 +1894,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) m_blupi[rank].energy = MAXENERGY/4; BlupiInitAction(rank, ACTION_NAISSANCE); } - return TRUE; + return true; } if ( op == GOAL_NEWPERSO ) @@ -1905,20 +1905,20 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) destCel = cel; destCel.x ++; - if ( IsBlupiHereEx(destCel, rank, FALSE) ) // destination occupée ? + if ( IsBlupiHereEx(destCel, rank, false) ) // destination occupée ? { m_blupi[rank].goalPhase --; // on attend ... - return TRUE; + return true; } destCel.x ++; - if ( IsBlupiHereEx(destCel, rank, FALSE) ) // destination occupée ? + if ( IsBlupiHereEx(destCel, rank, false) ) // destination occupée ? { destCel.y --; if ( icon == 5 || // bombe ? - IsBlupiHereEx(destCel, rank, FALSE) ) // destination occupée ? + IsBlupiHereEx(destCel, rank, false) ) // destination occupée ? { m_blupi[rank].goalPhase --; // on attend ... - return TRUE; + return true; } } @@ -1927,7 +1927,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) { m_blupi[rank].goalCel = destCel; } - return TRUE; + return true; } if ( op == GOAL_USINEBUILD ) @@ -1935,7 +1935,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) cel.x = m_blupi[rank].cel.x+(*pTable++); cel.y = m_blupi[rank].cel.y+(*pTable++); if ( !IsUsineBuild(rank, cel) ) goto error; - return TRUE; + return true; } if ( op == GOAL_USINEFREE ) @@ -1944,32 +1944,32 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) cel.y = m_blupi[rank].cel.y+(*pTable++); if ( !IsUsineFree(rank, cel) ) { - GoalStop(rank, TRUE); + GoalStop(rank, true); m_blupi[rank].goalCel = GetCel(cel,1,-1); // à côté de la porte //? m_blupi[rank].goalAction = 0; // stoppe sitôt après //? m_blupi[rank].interrupt = 1; //? GoalUnwork(rank); //? FlushUsed(rank); } - return TRUE; + return true; } if ( op == GOAL_AMORCE ) { cel.x = m_blupi[rank].cel.x+(*pTable++); cel.y = m_blupi[rank].cel.y+(*pTable++); - if ( IsBlupiHereEx(cel, rank, FALSE) ) goto error; + if ( IsBlupiHereEx(cel, rank, false) ) goto error; // Crée un détonnateur de mine (blupi invisible). rank = BlupiCreate(cel, ACTION_STOP, DIRECT_E, 6, MAXENERGY); if ( rank >= 0 ) { - m_blupi[rank].bCache = TRUE; // invisible + m_blupi[rank].bCache = true; // invisible m_blupi[rank].goalAction = WM_ACTION_MINE2; m_blupi[rank].goalPhase = 0; m_blupi[rank].goalCel.x = -1; m_blupi[rank].interrupt = 1; } - return TRUE; + return true; } if ( op == GOAL_VEHICULE ) @@ -1981,27 +1981,27 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) { m_blupi[rank].energy = MAXENERGY/4+1; } - return TRUE; + return true; } if ( op == GOAL_ACTUALISE ) { BlupiActualise(rank); - return TRUE; + return true; } if ( op == GOAL_SOUND ) { icon = *pTable++; BlupiSound(rank, icon, pos); - return TRUE; + return true; } if ( op == GOAL_REPEAT ) { icon = *pTable++; m_blupi[rank].bRepeat = icon; - return TRUE; + return true; } if ( op == GOAL_OTHER ) @@ -2032,7 +2032,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) GoalInitJauge(rank); GoalUnwork(rank); FlushUsed(rank); - return TRUE; + return true; } if ( op == GOAL_OTHERFIX ) @@ -2063,7 +2063,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) GoalInitJauge(rank); GoalUnwork(rank); FlushUsed(rank); - return TRUE; + return true; } if ( op == GOAL_OTHERLOOP ) @@ -2079,20 +2079,20 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) GoalUnwork(rank); FlushUsed(rank); } - return TRUE; + return true; } if ( op == GOAL_NEXTLOOP ) { m_blupi[rank].cLoop ++; - return TRUE; + return true; } if ( op == GOAL_FIX ) { m_blupi[rank].fix.x = m_blupi[rank].cel.x+(*pTable++); m_blupi[rank].fix.y = m_blupi[rank].cel.y+(*pTable++); - return TRUE; + return true; } if ( op == GOAL_FLOORJUMP ) @@ -2111,7 +2111,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) GoalUnwork(rank); FlushUsed(rank); } - return TRUE; + return true; } if ( op == GOAL_ADDDRAPEAU ) @@ -2119,7 +2119,7 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) cel.x = m_blupi[rank].cel.x+(*pTable++); cel.y = m_blupi[rank].cel.y+(*pTable++); AddDrapeau(cel); // cellule sondée - return TRUE; + return true; } if ( op == GOAL_TELEPORTE ) @@ -2137,15 +2137,15 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) cel.x += pos.x; cel.y += pos.y; - if ( IsBlupiHereEx(cel, rank, FALSE) || + if ( IsBlupiHereEx(cel, rank, false) || !IsFreeCel(cel, rank) ) goto error; m_blupi[rank].cel = cel; BlupiPushFog(rank); if ( m_blupi[rank].bHili ) { - SetCoin(cel, TRUE); + SetCoin(cel, true); } - return TRUE; + return true; } if ( op == GOAL_IFTERM ) @@ -2153,8 +2153,8 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) cel.x = m_blupi[rank].cel.x+(*pTable++); cel.y = m_blupi[rank].cel.y+(*pTable++); if ( !IsFreeCel(cel, rank) || - IsBlupiHereEx(cel, rank, FALSE) ) goto term; - return TRUE; + IsBlupiHereEx(cel, rank, false) ) goto term; + return true; } if ( op == GOAL_IFDEBARQUE ) @@ -2163,10 +2163,10 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) cel.y = m_blupi[rank].cel.y+(*pTable++); m_blupi[rank].vehicule = 0; // à pied bOK = IsFreeCel(cel, rank) && - !IsBlupiHereEx(cel, rank, FALSE); + !IsBlupiHereEx(cel, rank, false); m_blupi[rank].vehicule = 1; // en bateau if ( !bOK ) goto term; - return TRUE; + return true; } if ( op == GOAL_SKIPSKILL ) @@ -2177,20 +2177,20 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) { m_blupi[rank].goalPhase += total; // saute qq instructions } - return TRUE; + return true; } if ( op == GOAL_TERM ) { term: - bError = FALSE; + bError = false; } if ( op == GOAL_WAITFREE ) { cel.x = m_blupi[rank].cel.x+(*pTable++); cel.y = m_blupi[rank].cel.y+(*pTable++); - if ( IsBlupiHereEx(cel, rank, FALSE) ) // destination occupée ? + if ( IsBlupiHereEx(cel, rank, false) ) // destination occupée ? { m_blupi[rank].goalPhase --; // on attend ... @@ -2201,42 +2201,42 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) { destCel.x = cel.x; destCel.y = cel.y-1; - if ( !IsBlupiHereEx(destCel, rank, FALSE) ) + if ( !IsBlupiHereEx(destCel, rank, false) ) { GoalStart(rank, WM_ACTION_GO, destCel); - return TRUE; + return true; } destCel.x = cel.x+1; destCel.y = cel.y; - if ( !IsBlupiHereEx(destCel, rank, FALSE) ) + if ( !IsBlupiHereEx(destCel, rank, false) ) { GoalStart(rank, WM_ACTION_GO, destCel); - return TRUE; + return true; } destCel.x = cel.x; destCel.y = cel.y+1; - if ( !IsBlupiHereEx(destCel, rank, FALSE) ) + if ( !IsBlupiHereEx(destCel, rank, false) ) { GoalStart(rank, WM_ACTION_GO, destCel); - return TRUE; + return true; } destCel.x = cel.x+1; destCel.y = cel.y-1; - if ( !IsBlupiHereEx(destCel, rank, FALSE) ) + if ( !IsBlupiHereEx(destCel, rank, false) ) { GoalStart(rank, WM_ACTION_GO, destCel); - return TRUE; + return true; } destCel.x = cel.x+1; destCel.y = cel.y+1; - if ( !IsBlupiHereEx(destCel, rank, FALSE) ) + if ( !IsBlupiHereEx(destCel, rank, false) ) { GoalStart(rank, WM_ACTION_GO, destCel); - return TRUE; + return true; } if ( m_blupi[rank].perso == 0 ) @@ -2250,11 +2250,11 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) action = WM_ACTION_ELECTRO; } GoalStart(rank, action, m_blupi[rank].cel); - return TRUE; + return true; } } } - return TRUE; + return true; } error: @@ -2268,20 +2268,20 @@ BOOL CDecor::GoalNextOp(int rank, short *pTable) cel = cMem; if ( RepeatAdjust(rank, button, cel, cMem, param, i) ) { - if ( IsBlupiHereEx(cel, rank, FALSE) ) // destination occupée ? + if ( IsBlupiHereEx(cel, rank, false) ) // destination occupée ? { m_blupi[rank].repeatLevel = i; // on continue ... GoalStart(rank, WM_ACTION_GO, m_blupi[rank].cel); // on attend ... - return TRUE; + return true; } if ( BlupiGoal(rank, button, cel, cMem) ) { m_blupi[rank].repeatLevel = i; // on continue ... - return TRUE; + return true; } } } - return FALSE; + return false; } // Supprime le blocage de la cellule dans laquelle @@ -2305,7 +2305,7 @@ void CDecor::GoalUnwork(int rank) // Stoppe complètement une action. -void CDecor::GoalStop(int rank, BOOL bError, BOOL bSound) +void CDecor::GoalStop(int rank, bool bError, bool bSound) { POINT pos; @@ -2363,12 +2363,12 @@ void CDecor::GoalStop(int rank, BOOL bError, BOOL bSound) { pos.x = LXIMAGE/2; pos.y = LYIMAGE/2; - BlupiSound(rank, table_sound_boing[Random(0,2)], pos, TRUE); + BlupiSound(rank, table_sound_boing[Random(0,2)], pos, true); } else { pos = ConvCelToPos(m_blupi[rank].cel); - BlupiSound(rank, table_sound_term[Random(0,5)], pos, TRUE); + BlupiSound(rank, table_sound_term[Random(0,5)], pos, true); } } } @@ -2377,7 +2377,7 @@ void CDecor::GoalStop(int rank, BOOL bError, BOOL bSound) // Teste si une cellule est déjà utilisée comme but pour // n'importe quel blupi. -BOOL CDecor::BlupiIsGoalUsed(POINT cel) +bool CDecor::BlupiIsGoalUsed(POINT cel) { int rank; @@ -2385,10 +2385,10 @@ BOOL CDecor::BlupiIsGoalUsed(POINT cel) { if ( m_blupi[rank].bExist && m_blupi[rank].goalCel.x/2 == cel.x/2 && - m_blupi[rank].goalCel.y/2 == cel.y/2 ) return TRUE; + m_blupi[rank].goalCel.y/2 == cel.y/2 ) return true; } - return FALSE; + return false; } @@ -2443,10 +2443,10 @@ void CDecor::BlupiStartStopRayon(int rank, POINT startCel, POINT endCel) if ( (icon == 10000 || icon == 10001) && icon2 != 10000 && icon2 != 10001 ) { - if ( MoveCreate(cel, -1, FALSE, CHOBJECT,-1, - -1,-1, 9999,1,0, TRUE) ) + if ( MoveCreate(cel, -1, false, CHOBJECT,-1, + -1,-1, 9999,1,0, true) ) { - MoveAddIcons(cel, icon==10000?4:5, TRUE); // éclairs + MoveAddIcons(cel, icon==10000?4:5, true); // éclairs } pos = ConvCelToPos(cel); @@ -2460,10 +2460,10 @@ void CDecor::BlupiStartStopRayon(int rank, POINT startCel, POINT endCel) icon = m_decor[cel.x/2][cel.y/2].objectIcon; if ( icon == 10000 || icon == 10001 ) { - if ( MoveCreate(cel, -1, FALSE, CHOBJECT,-1, - -1,-1, 9999,1,0, TRUE) ) + if ( MoveCreate(cel, -1, false, CHOBJECT,-1, + -1,-1, 9999,1,0, true) ) { - MoveAddIcons(cel, icon==10000?4:5, TRUE); // éclairs + MoveAddIcons(cel, icon==10000?4:5, true); // éclairs } } } @@ -2472,18 +2472,18 @@ void CDecor::BlupiStartStopRayon(int rank, POINT startCel, POINT endCel) // Tourne un blupi, si nécessaire. -// Retourne FALSE si ce n'est pas nécessaire. +// Retourne false si ce n'est pas nécessaire. -BOOL CDecor::BlupiRotate(int rank) +bool CDecor::BlupiRotate(int rank) { int aDirect, sDirect, ip, in, sens; - BOOL bOK; + bool bOK; POINT pos; aDirect = m_blupi[rank].aDirect; sDirect = m_blupi[rank].sDirect; - if ( aDirect == sDirect ) return FALSE; + if ( aDirect == sDirect ) return false; if ( sDirect > aDirect ) ip = sDirect+0*16-aDirect; else ip = sDirect+8*16-aDirect; @@ -2494,7 +2494,7 @@ BOOL CDecor::BlupiRotate(int rank) if ( ip == 0 || in == 0 ) { m_blupi[rank].aDirect = m_blupi[rank].sDirect; - return FALSE; + return false; } if ( m_blupi[rank].perso == 0 && // blupi ? @@ -2558,25 +2558,25 @@ BOOL CDecor::BlupiRotate(int rank) if ( bOK ) { m_blupi[rank].aDirect = aDirect; - return TRUE; + return true; } else { m_blupi[rank].aDirect = m_blupi[rank].sDirect; - return FALSE; + return false; } } // Avance un blupi existant. -BOOL CDecor::BlupiNextAction(int rank) +bool CDecor::BlupiNextAction(int rank) { - BOOL bOK; + bool bOK; POINT pos, iCel; int a, min; short sound; - if ( !m_blupi[rank].bExist ) return FALSE; + if ( !m_blupi[rank].bExist ) return false; if ( m_blupi[rank].clicDelay > 0 ) { @@ -2587,7 +2587,7 @@ BOOL CDecor::BlupiNextAction(int rank) m_blupi[rank].clicCount = 0; } - bOK = TRUE; + bOK = true; if ( !BlupiRotate(rank) ) // si rotation pas nécessaire { m_blupi[rank].lastIcon = m_blupi[rank].icon; @@ -2756,7 +2756,7 @@ BOOL CDecor::BlupiNextAction(int rank) // Blupi guérrit s'il boit. if ( m_blupi[rank].action == ACTION_BOIT ) { - m_blupi[rank].bMalade = FALSE; + m_blupi[rank].bMalade = false; if ( m_blupi[rank].energy < MAXENERGY ) { m_blupi[rank].energy += MAXENERGY/(40*3); @@ -2771,7 +2771,7 @@ BOOL CDecor::BlupiNextAction(int rank) m_blupi[rank].action == ACTION_MARCHEf ) { BlupiInitAction(rank, ACTION_STOP); - GoalStop(rank, TRUE); + GoalStop(rank, true); } return bOK; @@ -2839,7 +2839,7 @@ void CDecor::BlupiNextGoal(int rank) !m_bInvincible && IsVirusCel(m_blupi[rank].cel) ) // blupi chope un virus ? { - m_blupi[rank].bMalade = TRUE; + m_blupi[rank].bMalade = true; if ( m_blupi[rank].energy > MAXENERGY/4 ) { @@ -2914,7 +2914,7 @@ void CDecor::BlupiNextGoal(int rank) } } - m_blupi[rank].bExist = FALSE; + m_blupi[rank].bExist = false; if ( m_time%5 == rank%5 && // pas trop souvent ! SearchSpiderObject(rank, m_blupi[rank].cel, 100, cel, icon) ) { @@ -2929,7 +2929,7 @@ void CDecor::BlupiNextGoal(int rank) // FlushUsed(rank); // } } - m_blupi[rank].bExist = TRUE; + m_blupi[rank].bExist = true; } // Assigne un but s'il s'agit d'un virus. @@ -3018,15 +3018,15 @@ void CDecor::BlupiNextGoal(int rank) } } cel = m_blupi[rank].cel; - m_blupi[rank].bExist = FALSE; - if ( IsBlupiHere(cel, FALSE) && + m_blupi[rank].bExist = false; + if ( IsBlupiHere(cel, false) && m_blupi[m_blupiHere].perso == 0 && m_blupi[m_blupiHere].vehicule == 0 ) // à pied ? { - m_blupi[rank].bExist = TRUE; + m_blupi[rank].bExist = true; // Blupi écrasé au sol. - if ( MoveCreate(cel, rank, TRUE, CHFLOOR,-1, -1,-1, - 100,1,100, FALSE, TRUE) ) + if ( MoveCreate(cel, rank, true, CHFLOOR,-1, -1,-1, + 100,1,100, false, true) ) { if ( m_blupi[m_blupiHere].bMalade ) MoveAddIcons(cel, 10); else MoveAddIcons(cel, 9); @@ -3036,21 +3036,21 @@ void CDecor::BlupiNextGoal(int rank) BlupiInitAction(rank, ACTION_T_ECRASE); // écrase blupi goto init; } - m_blupi[rank].bExist = TRUE; + m_blupi[rank].bExist = true; // if ( m_blupi[rank].goalCel.x != -1 ) // { // GetObject(m_blupi[rank].goalCel, channel, icon); // if ( IsTracksObject(icon) ) goto action; // } - m_blupi[rank].bExist = FALSE; + m_blupi[rank].bExist = false; if ( m_time%5 == rank%5 && // pas trop souvent ! SearchTracksObject(rank, m_blupi[rank].cel, 25, cel, icon) ) { m_blupi[rank].goalCel = cel; FlushUsed(rank); } - m_blupi[rank].bExist = TRUE; + m_blupi[rank].bExist = true; } // Assigne un but s'il s'agit d'un robot. @@ -3222,7 +3222,7 @@ void CDecor::BlupiNextGoal(int rank) m_decor[cel.x/2][cel.y/2].objectIcon == 118 && // jeep m_blupi[rank].bMalade && m_blupi[rank].takeChannel != -1 ) goto search; - GoalStop(rank, TRUE); + GoalStop(rank, true); } else { @@ -3245,7 +3245,7 @@ void CDecor::BlupiNextGoal(int rank) { if ( m_blupi[rank].busyCount == 0 ) // dernière tentative ? { - GoalStop(rank, TRUE); + GoalStop(rank, true); m_blupi[rank].goalCel.x = -1; m_blupi[rank].goalPhase = 0; m_blupi[rank].interrupt = 1; @@ -3254,7 +3254,7 @@ void CDecor::BlupiNextGoal(int rank) else // perso ennemi ? { // On cherchera un autre but ! - GoalStop(rank, TRUE); + GoalStop(rank, true); //? m_blupi[rank].goalCel.x = -1; //? m_blupi[rank].goalPhase = 0; //? m_blupi[rank].interrupt = 1; @@ -3318,7 +3318,7 @@ void CDecor::BlupiDestCel(int rank) // Avance tous les blupis. -void CDecor::BlupiStep(BOOL bFirst) +void CDecor::BlupiStep(bool bFirst) { int rank; @@ -3339,7 +3339,7 @@ void CDecor::BlupiStep(BOOL bFirst) if ( m_timeConst == m_timeFlipOutline ) { - m_bOutline = FALSE; // supprime le mode "outline" + m_bOutline = false; // supprime le mode "outline" } } m_time ++; // avance le temps absolu global @@ -3471,8 +3471,8 @@ void CDecor::BlupiDeselect() for ( rank=0 ; rank 0 && m_rankBlupiHili == rank ) // est-ce le blupi sélectionné ? @@ -3496,19 +3496,19 @@ void CDecor::BlupiDeselect(int rank) // Met ou enlève une flèche au blupi sélectionné blupi. -void CDecor::BlupiSetArrow(int rank, BOOL bArrow) +void CDecor::BlupiSetArrow(int rank, bool bArrow) { m_celArrow.x = -1; if ( bArrow ) { - m_blupi[rank].bArrow = TRUE; + m_blupi[rank].bArrow = true; } else { for ( rank=0 ; rank 4 ) { - bEnerve = TRUE; + bEnerve = true; } } else @@ -3660,7 +3660,7 @@ void CDecor::BlupiHiliUp(POINT pos, BOOL bAdd) m_blupi[r].cel.y >= c1.y && m_blupi[r].cel.y < c2.y ) { - m_blupi[r].bHili = TRUE; + m_blupi[r].bHili = true; nb ++; rank = r; } @@ -3668,7 +3668,7 @@ void CDecor::BlupiHiliUp(POINT pos, BOOL bAdd) } } - m_bHiliRect = FALSE; // plus de rectangle + m_bHiliRect = false; // plus de rectangle InitOutlineRect(); if ( nb > 0 ) @@ -3692,7 +3692,7 @@ void CDecor::BlupiHiliUp(POINT pos, BOOL bAdd) sound = table_sound_oke[Random(0,2)]; } } - BlupiSound(rank, sound, pos, TRUE); + BlupiSound(rank, sound, pos, true); } } @@ -3700,7 +3700,7 @@ void CDecor::BlupiHiliUp(POINT pos, BOOL bAdd) m_rankBlupiHili = -1; for ( rank=0 ; rank (abs((test.x-cel.x)+(test.y-cel.y))/2); m_blupi[rank].cLoop = 0; @@ -4163,7 +4163,7 @@ BOOL CDecor::BlupiGoal(int rank, int button, POINT cel, POINT cMem) if ( action == WM_ACTION_BATEAUE ) { - if ( !IsBuildBateau(goalHili2, direct) ) return FALSE; + if ( !IsBuildBateau(goalHili2, direct) ) return false; if ( direct == DIRECT_S ) action = WM_ACTION_BATEAUS; if ( direct == DIRECT_O ) action = WM_ACTION_BATEAUO; @@ -4172,7 +4172,7 @@ BOOL CDecor::BlupiGoal(int rank, int button, POINT cel, POINT cMem) if ( action == WM_ACTION_CARRY ) { - if ( IsBlupiHereEx(GetCel(goalHili2,0,1), rank, TRUE) ) + if ( IsBlupiHereEx(GetCel(goalHili2,0,1), rank, true) ) { action = WM_ACTION_CARRY2; } @@ -4188,7 +4188,7 @@ BOOL CDecor::BlupiGoal(int rank, int button, POINT cel, POINT cMem) action = WM_ACTION_NEWBLUPI; } if ( !IsFreeCelDepose(GetCel(goalHili2,0,1), rank) || - IsBlupiHereEx(GetCel(goalHili2,0,1), rank, TRUE) ) + IsBlupiHereEx(GetCel(goalHili2,0,1), rank, true) ) { action = WM_ACTION_DEPOSE2; } @@ -4196,7 +4196,7 @@ BOOL CDecor::BlupiGoal(int rank, int button, POINT cel, POINT cMem) if ( action == WM_ACTION_MANGE ) { - if ( IsBlupiHereEx(GetCel(goalHili2,0,1), rank, TRUE) ) + if ( IsBlupiHereEx(GetCel(goalHili2,0,1), rank, true) ) { action = WM_ACTION_MANGE2; } @@ -4204,7 +4204,7 @@ BOOL CDecor::BlupiGoal(int rank, int button, POINT cel, POINT cMem) if ( action == WM_ACTION_BOIT ) { - if ( IsBlupiHereEx(GetCel(goalHili2,0,1), rank, TRUE) ) + if ( IsBlupiHereEx(GetCel(goalHili2,0,1), rank, true) ) { action = WM_ACTION_BOIT2; } @@ -4243,7 +4243,7 @@ BOOL CDecor::BlupiGoal(int rank, int button, POINT cel, POINT cMem) ListPut(rank, button, goal, cMem); } - return TRUE; + return true; } // Indique un but visé à long terme, pour tous les blupi @@ -4321,7 +4321,7 @@ void CDecor::BlupiGoal(POINT cel, int button) { if ( nbHili == 1 ) { - BlupiSound(m_rankBlupiHili, table_sound_boing[Random(0,2)], avg, TRUE); + BlupiSound(m_rankBlupiHili, table_sound_boing[Random(0,2)], avg, true); } else { @@ -4333,7 +4333,7 @@ void CDecor::BlupiGoal(POINT cel, int button) { if ( nbHili == 1 ) { - BlupiSound(m_rankBlupiHili, table_sound_go[Random(0,5)], avg, TRUE); + BlupiSound(m_rankBlupiHili, table_sound_go[Random(0,5)], avg, true); } else { @@ -4348,11 +4348,11 @@ void CDecor::BlupiGoal(POINT cel, int button) // contient un blupi à pied ou un détonnateur de mine // (personnage invisible). -BOOL CDecor::IsTracksHere(POINT cel, BOOL bSkipInMove) +bool CDecor::IsTracksHere(POINT cel, bool bSkipInMove) { int rank; - if ( !IsValid(cel) ) return FALSE; + if ( !IsValid(cel) ) return false; for ( rank=0 ; rank= m_blupi[rank].cel.y ) { m_blupiHere = rank; - return TRUE; + return true; } if ( cel1.x <= m_blupi[rank].destCel.x && @@ -4416,22 +4416,22 @@ BOOL CDecor::IsBlupiHereEx(POINT cel1, POINT cel2, int exRank, BOOL bSkipInMove) cel2.y >= m_blupi[rank].destCel.y ) { m_blupiHere = rank; - return TRUE; + return true; } } } - return FALSE; + return false; } // Indique si une cellule est occupée par un blupi. // Le blupi donné dans exRank est ignoré ! -BOOL CDecor::IsBlupiHereEx(POINT cel, int exRank, BOOL bSkipInMove) +bool CDecor::IsBlupiHereEx(POINT cel, int exRank, bool bSkipInMove) { int rank; - if ( !IsValid(cel) ) return FALSE; + if ( !IsValid(cel) ) return false; for ( rank=0 ; rank utilisé - BOOL bHili; // TRUE -> sélectionné + int bExist; // true -> utilisé + int bHili; // true -> sélectionné short perso; // personnage, voir (*) @@ -73,14 +73,14 @@ typedef struct short jaugePhase; short jaugeMax; short stop; // 1 -> devra stopper - short bArrow; // TRUE -> flèche en dessus de blupi - short bRepeat; // TRUE -> répète l'action + short bArrow; // true -> flèche en dessus de blupi + short bRepeat; // true -> répète l'action short nLoop; // nb de boucles pour GOAL_OTHERLOOP short cLoop; // boucle en cours short vIcon; // icône variable POINT goalHili; // but visé - short bMalade; // TRUE -> blupi malade - short bCache; // TRUE -> caché (pas dessiné) + short bMalade; // true -> blupi malade + short bCache; // true -> caché (pas dessiné) short vehicule; // véhicule utilisé par blupi, voir (**) char busyCount; char busyDelay; @@ -93,7 +93,7 @@ OldBlupi; // Sauve le décor sur disque. -BOOL CDecor::Write(int rank, BOOL bUser, int world, int time, int total) +bool CDecor::Write(int rank, bool bUser, int world, int time, int total) { char filename[MAX_PATH]; FILE* file = NULL; @@ -165,17 +165,17 @@ BOOL CDecor::Write(int rank, BOOL bUser, int world, int time, int total) free(pBuffer); fclose(file); - return TRUE; + return true; error: if ( pBuffer != NULL ) free(pBuffer); if ( file != NULL ) fclose(file); - return FALSE; + return false; } // Lit le décor sur disque. -BOOL CDecor::Read(int rank, BOOL bUser, int &world, int &time, int &total) +bool CDecor::Read(int rank, bool bUser, int &world, int &time, int &total) { char filename[MAX_PATH]; FILE* file = NULL; @@ -307,19 +307,19 @@ BOOL CDecor::Read(int rank, BOOL bUser, int &world, int &time, int &total) free(pBuffer); fclose(file); - return TRUE; + return true; error: if ( pBuffer != NULL ) free(pBuffer); if ( file != NULL ) fclose(file); Flush(); // initialise un décor neutre - return FALSE; + return false; } // Indique si un fichier existe sur disque. -BOOL CDecor::FileExist(int rank, BOOL bUser, int &world, int &time, int &total) +bool CDecor::FileExist(int rank, bool bUser, int &world, int &time, int &total) { char filename[MAX_PATH]; FILE* file = NULL; @@ -380,12 +380,12 @@ BOOL CDecor::FileExist(int rank, BOOL bUser, int &world, int &time, int &total) free(pBuffer); fclose(file); - return TRUE; + return true; error: if ( pBuffer != NULL ) free(pBuffer); if ( file != NULL ) fclose(file); - return FALSE; + return false; } @@ -462,7 +462,7 @@ void CDecor::Flush() for ( i=0 ; iDrawIcon(-1, CHMAP, 0, pos); DeleteObject(hbm); - return TRUE; + return true; } diff --git a/decmove.cpp b/decmove.cpp index 4143d61..9b70af0 100644 --- a/decmove.cpp +++ b/decmove.cpp @@ -536,7 +536,7 @@ void CDecor::MoveFlush() for ( i=0 ; i MAXMOVE-10 ) return FALSE; + if ( bMisc && max > MAXMOVE-10 ) return false; goto create; } max ++; } - return FALSE; + return false; create: - m_move[rank].bExist = TRUE; + m_move[rank].bExist = true; m_move[rank].cel = cel; m_move[rank].rankBlupi = rankBlupi; m_move[rank].bFloor = bFloor; @@ -651,12 +651,12 @@ BOOL CDecor::MoveCreate(POINT cel, int rankBlupi, BOOL bFloor, m_move[rank].phase = 0; m_decor[cel.x/2][cel.y/2].rankMove = rank; - return TRUE; + return true; } // Ajoute un mouvement. -BOOL CDecor::MoveAddMoves(POINT cel, int rankMoves) +bool CDecor::MoveAddMoves(POINT cel, int rankMoves) { int rank; @@ -669,16 +669,16 @@ BOOL CDecor::MoveAddMoves(POINT cel, int rankMoves) m_move[rank].rankMoves = rankMoves; m_move[rank].phase = 0; - return TRUE; + return true; } } - return FALSE; + return false; } // Ajoute un mouvement. -BOOL CDecor::MoveAddIcons(POINT cel, int rankIcons, BOOL bContinue) +bool CDecor::MoveAddIcons(POINT cel, int rankIcons, bool bContinue) { int rank; @@ -696,17 +696,17 @@ BOOL CDecor::MoveAddIcons(POINT cel, int rankIcons, BOOL bContinue) m_move[rank].cTotal = Random(0,10); } - return TRUE; + return true; } } - return FALSE; + return false; } // Démarre le feu sur une cellule. -// Retourne TRUE si c'est possible. +// Retourne true si c'est possible. -BOOL CDecor::MoveStartFire(POINT cel) +bool CDecor::MoveStartFire(POINT cel) { int channel, icon; @@ -727,16 +727,16 @@ BOOL CDecor::MoveStartFire(POINT cel) icon == 121 || // mine de fer ? icon == 122) ) // mine de fer ? { - if ( !MoveCreate(cel, -1, FALSE, CHOBJECT,-1, - -1,-1, 9999,1,0, TRUE) ) return FALSE; - MoveAddIcons(cel, 1, TRUE); // petites flammes + if ( !MoveCreate(cel, -1, false, CHOBJECT,-1, + -1,-1, 9999,1,0, true) ) return false; + MoveAddIcons(cel, 1, true); // petites flammes m_decor[cel.x/2][cel.y/2].fire = 2; - return TRUE; + return true; } // S'il y a un autre objet -> pas de feu ! - if ( channel >= 0 ) return FALSE; + if ( channel >= 0 ) return false; channel = m_decor[cel.x/2][cel.y/2].floorChannel; icon = m_decor[cel.x/2][cel.y/2].floorIcon; @@ -745,15 +745,15 @@ BOOL CDecor::MoveStartFire(POINT cel) (icon == 20 || // herbe foncée ? (icon >= 59 && icon <= 64)) ) // pont ? { - if ( !MoveCreate(cel, -1, FALSE, CHOBJECT,-1, - -1,-1, 9999,1,0, TRUE) ) return FALSE; - MoveAddIcons(cel, 1, TRUE); // petites flammes + if ( !MoveCreate(cel, -1, false, CHOBJECT,-1, + -1,-1, 9999,1,0, true) ) return false; + MoveAddIcons(cel, 1, true); // petites flammes m_decor[cel.x/2][cel.y/2].fire = 2; - return TRUE; + return true; } - return FALSE; + return false; } // Démarre le feu si c'est possible par proximité. @@ -850,7 +850,7 @@ void CDecor::MoveFire(int rank) // Début grandes flammes. if ( m_decor[x/2][y/2].fire == (MoveMaxFire()-DIMOBJY*2)/2 ) { - MoveAddIcons(GetCel(x,y), 2, TRUE); // grandes flammes + MoveAddIcons(GetCel(x,y), 2, true); // grandes flammes } // Début objet squelette. @@ -869,15 +869,15 @@ void CDecor::MoveFire(int rank) if ( icon == 113 ) newIcon = 15; // maison ? if ( icon == 121 ) newIcon = 126; // mine de fer ? if ( icon == 122 ) newIcon = 126; // mine de fer ? - MoveCreate(GetCel(x,y), -1, FALSE, CHOBJECT,newIcon, + MoveCreate(GetCel(x,y), -1, false, CHOBJECT,newIcon, -1,-1, DIMOBJY*2,1,-1*50); - MoveAddIcons(GetCel(x,y), 2, TRUE); // grandes flammes + MoveAddIcons(GetCel(x,y), 2, true); // grandes flammes } // Fin grandes flammes. if ( m_decor[x/2][y/2].fire == MoveMaxFire()-DIMOBJY ) { - MoveAddIcons(GetCel(x,y), 1, TRUE); // petites flammes + MoveAddIcons(GetCel(x,y), 1, true); // petites flammes } // Fin feu. @@ -954,7 +954,7 @@ void CDecor::MoveFire(int rank) // Fait évoluer tous les décors animés. -void CDecor::MoveStep(BOOL bFirst) +void CDecor::MoveStep(bool bFirst) { int rank, rankBlupi; @@ -1033,7 +1033,7 @@ void CDecor::MoveFinish(POINT cel) } m_decor[cel.x/2][cel.y/2].rankMove = -1; - m_move[rank].bExist = FALSE; + m_move[rank].bExist = false; } } } @@ -1056,7 +1056,7 @@ void CDecor::MoveFinish(int rankBlupi) // Vérifie si une cellule est déjà utilisée. -BOOL CDecor::MoveIsUsed(POINT cel) +bool CDecor::MoveIsUsed(POINT cel) { int rank; @@ -1066,16 +1066,16 @@ BOOL CDecor::MoveIsUsed(POINT cel) m_move[rank].cel.x == cel.x && m_move[rank].cel.y == cel.y ) { - return TRUE; + return true; } } - return FALSE; + return false; } // Retourne l'objet en construction à un endroit donné. -BOOL CDecor::MoveGetObject(POINT cel, int &channel, int &icon) +bool CDecor::MoveGetObject(POINT cel, int &channel, int &icon) { int rank; @@ -1084,20 +1084,20 @@ BOOL CDecor::MoveGetObject(POINT cel, int &channel, int &icon) if ( m_move[rank].bExist && m_move[rank].cel.x == cel.x && m_move[rank].cel.y == cel.y && - m_move[rank].bFloor == FALSE ) + m_move[rank].bFloor == false ) { channel = m_move[rank].channel; icon = m_move[rank].icon; - return TRUE; + return true; } } - return FALSE; + return false; } // Modifie un objet en construction à un endroit donné. -BOOL CDecor::MovePutObject(POINT cel, int channel, int icon) +bool CDecor::MovePutObject(POINT cel, int channel, int icon) { int rank; @@ -1106,14 +1106,14 @@ BOOL CDecor::MovePutObject(POINT cel, int channel, int icon) if ( m_move[rank].bExist && m_move[rank].cel.x == cel.x && m_move[rank].cel.y == cel.y && - m_move[rank].bFloor == FALSE ) + m_move[rank].bFloor == false ) { m_move[rank].channel = channel; m_move[rank].icon = icon; - return TRUE; + return true; } } - return FALSE; + return false; } diff --git a/decor.cpp b/decor.cpp index fe21e8e..af6df61 100644 --- a/decor.cpp +++ b/decor.cpp @@ -45,11 +45,11 @@ POINT GetCel(POINT cel, int x, int y) // bord (-2) pour permettre de gérer le brouillard proprement // jusque dans les bords ! -BOOL IsValid(POINT cel) +bool IsValid(POINT cel) { if ( cel.x < 2 || cel.x >= MAXCELX-2 || - cel.y < 2 || cel.y >= MAXCELX-2 ) return FALSE; - return TRUE; + cel.y < 2 || cel.y >= MAXCELX-2 ) return false; + return true; } // Retourne un vecteur orienté dans une direction donnée. @@ -110,7 +110,7 @@ CDecor::CDecor() m_celOutline1.x = -1; m_celOutline2.x = -1; - m_bHiliRect = FALSE; // pas de rectangle de sélection + m_bHiliRect = false; // pas de rectangle de sélection m_shiftHili = 0; m_shiftOffset.x = 0; @@ -120,12 +120,12 @@ CDecor::CDecor() m_rankBlupiHili = -1; m_rankHili = -1; - m_bFog = FALSE; - m_bBuild = FALSE; - m_bInvincible = FALSE; - m_bSuper = FALSE; - m_bHideTooltips = FALSE; - m_bInfo = FALSE; + m_bFog = false; + m_bBuild = false; + m_bInvincible = false; + m_bSuper = false; + m_bHideTooltips = false; + m_bInfo = false; m_infoHeight = 100; m_phase = 0; m_totalTime = 0; @@ -154,7 +154,7 @@ void CDecor::Create(HWND hWnd, CSound *pSound, CPixmap *pPixmap) m_hWnd = hWnd; m_pSound = pSound; m_pPixmap = pPixmap; - m_bOutline = FALSE; + m_bOutline = false; } // Initialise le décor avec un sol plat partout. @@ -188,8 +188,8 @@ void CDecor::Init(int channel, int icon) } } - m_bOutline = FALSE; - m_bGroundRedraw = TRUE; + m_bOutline = false; + m_bGroundRedraw = true; } // Initialise le décor après une modification. @@ -207,18 +207,18 @@ void CDecor::InitAfterBuild() void CDecor::ResetHili() { - m_bHiliRect = FALSE; // plus de rectangle + m_bHiliRect = false; // plus de rectangle InitOutlineRect(); } // Charge les images nécessaires au décor. -BOOL CDecor::LoadImages() +bool CDecor::LoadImages() { POINT totalDim, iconDim; char filename[50]; - if ( m_region == m_lastRegion ) return TRUE; + if ( m_region == m_lastRegion ) return true; m_lastRegion = m_region; totalDim.x = DIMCELX*2*16; @@ -226,8 +226,8 @@ BOOL CDecor::LoadImages() iconDim.x = DIMCELX*2; iconDim.y = DIMCELY*2; sprintf(filename, "image\\floor%.3d.blp", m_region); - if ( !m_pPixmap->Cache(CHFLOOR, filename, totalDim, iconDim, FALSE) ) - return FALSE; + if ( !m_pPixmap->Cache(CHFLOOR, filename, totalDim, iconDim, false) ) + return false; m_pPixmap->SetTransparent(CHFLOOR, RGB(0,0,255)); // bleu totalDim.x = DIMOBJX*16; @@ -235,19 +235,19 @@ BOOL CDecor::LoadImages() iconDim.x = DIMOBJX; iconDim.y = DIMOBJY; sprintf(filename, "image\\obj%.3d.blp", m_region); - if ( !m_pPixmap->Cache(CHOBJECT, filename, totalDim, iconDim, FALSE) ) - return FALSE; + if ( !m_pPixmap->Cache(CHOBJECT, filename, totalDim, iconDim, false) ) + return false; m_pPixmap->SetTransparent(CHOBJECT, RGB(0,0,255)); // bleu sprintf(filename, "image\\obj-o%.3d.blp", m_region); - if ( !m_pPixmap->Cache(CHOBJECTo, filename, totalDim, iconDim, FALSE) ) - return FALSE; + if ( !m_pPixmap->Cache(CHOBJECTo, filename, totalDim, iconDim, false) ) + return false; m_pPixmap->SetTransparent(CHOBJECTo, RGB(255,255,255)); // blanc MapInitColors(); // init les couleurs pour la carte - m_bGroundRedraw = TRUE; - return TRUE; + m_bGroundRedraw = true; + return true; } // Met partout du brouillard, sauf aux endroits des blupi. @@ -272,7 +272,7 @@ void CDecor::ClearFog() } } - m_bOutline = FALSE; + m_bOutline = false; } // Permet de nouveau aux cellules brulées de bruler. @@ -300,39 +300,39 @@ void CDecor::ClearFire() // Indique le mode jeu/construction. -void CDecor::SetBuild(BOOL bBuild) +void CDecor::SetBuild(bool bBuild) { m_bBuild = bBuild; } // Indique s'il faut tenir compte du brouillard. -void CDecor::EnableFog(BOOL bEnable) +void CDecor::EnableFog(bool bEnable) { m_bFog = bEnable; - m_bOutline = FALSE; + m_bOutline = false; } // Gestion du mode invincible. -BOOL CDecor::GetInvincible() +bool CDecor::GetInvincible() { return m_bInvincible; } -void CDecor::SetInvincible(BOOL bInvincible) +void CDecor::SetInvincible(bool bInvincible) { m_bInvincible = bInvincible; } // Gestion du mode costaud (superblupi). -BOOL CDecor::GetSuper() +bool CDecor::GetSuper() { return m_bSuper; } -void CDecor::SetSuper(BOOL bSuper) +void CDecor::SetSuper(bool bSuper) { m_bSuper = bSuper; } @@ -347,27 +347,27 @@ void CDecor::FlipOutline() // Initialise un sol dans une cellule. -BOOL CDecor::PutFloor(POINT cel, int channel, int icon) +bool CDecor::PutFloor(POINT cel, int channel, int icon) { if ( cel.x < 0 || cel.x >= MAXCELX || - cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + cel.y < 0 || cel.y >= MAXCELY ) return false; m_decor[cel.x/2][cel.y/2].floorChannel = channel; m_decor[cel.x/2][cel.y/2].floorIcon = icon; - m_bGroundRedraw = TRUE; + m_bGroundRedraw = true; //? SubDrapeau(cel); // on pourra de nouveau planter un drapeau - return TRUE; + return true; } // Initialise un objet dans une cellule. -BOOL CDecor::PutObject(POINT cel, int channel, int icon) +bool CDecor::PutObject(POINT cel, int channel, int icon) { if ( cel.x < 0 || cel.x >= MAXCELX || - cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + cel.y < 0 || cel.y >= MAXCELY ) return false; if ( icon == -1 ) channel = -1; @@ -376,45 +376,45 @@ BOOL CDecor::PutObject(POINT cel, int channel, int icon) SubDrapeau(cel); // on pourra de nouveau planter un drapeau - return TRUE; + return true; } // Retourne un sol dans une cellule. -BOOL CDecor::GetFloor(POINT cel, int &channel, int &icon) +bool CDecor::GetFloor(POINT cel, int &channel, int &icon) { if ( cel.x < 0 || cel.x >= MAXCELX || - cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + cel.y < 0 || cel.y >= MAXCELY ) return false; channel = m_decor[cel.x/2][cel.y/2].floorChannel; icon = m_decor[cel.x/2][cel.y/2].floorIcon; - return TRUE; + return true; } // Retourne une objet dans une cellule. -BOOL CDecor::GetObject(POINT cel, int &channel, int &icon) +bool CDecor::GetObject(POINT cel, int &channel, int &icon) { if ( cel.x < 0 || cel.x >= MAXCELX || - cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + cel.y < 0 || cel.y >= MAXCELY ) return false; channel = m_decor[cel.x/2][cel.y/2].objectChannel; icon = m_decor[cel.x/2][cel.y/2].objectIcon; - return TRUE; + return true; } // Modifie le feu pour une cellule. -BOOL CDecor::SetFire(POINT cel, BOOL bFire) +bool CDecor::SetFire(POINT cel, bool bFire) { if ( cel.x < 0 || cel.x >= MAXCELX || - cel.y < 0 || cel.y >= MAXCELY ) return FALSE; + cel.y < 0 || cel.y >= MAXCELY ) return false; m_decor[cel.x/2][cel.y/2].fire = bFire?1:0; - return TRUE; + return true; } @@ -423,7 +423,7 @@ BOOL CDecor::SetFire(POINT cel, BOOL bFire) void CDecor::SetShiftOffset(POINT offset) { m_shiftOffset = offset; - m_bGroundRedraw = TRUE; + m_bGroundRedraw = true; } // Convertit la position d'une cellule en coordonnée graphique. @@ -443,7 +443,7 @@ POINT CDecor::ConvCelToPos(POINT cel) // Convertit une coordonnée graphique en cellule. -POINT CDecor::ConvPosToCel(POINT pos, BOOL bMap) +POINT CDecor::ConvPosToCel(POINT pos, bool bMap) { POINT cel; @@ -650,7 +650,7 @@ void CDecor::BuildMoveFloor(int x, int y, POINT pos, int rank) m_move[rank].icon, 0); m_pPixmap->DrawIcon(-1, m_move[rank].channel, 0, - pos, 0, TRUE); + pos, 0, true); } else { @@ -1004,7 +1004,7 @@ void CDecor::BuildGround(RECT clip) } } - m_bGroundRedraw = FALSE; + m_bGroundRedraw = false; } // Construit le décor dans un pixmap. @@ -1623,10 +1623,10 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { int x, y, i, j, channel, icon, nb, start, direct; int error = 0; - BOOL bStrong = FALSE; - BOOL bTransport = FALSE; - BOOL bVehicule = FALSE; - BOOL bVehiculeA = FALSE; + bool bStrong = false; + bool bTransport = false; + bool bVehicule = false; + bool bVehiculeA = false; POINT vector; for ( x=0 ; x<4 ; x++ ) @@ -1657,26 +1657,26 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { if ( m_blupi[rank].energy > MAXENERGY/4 ) // blupi fort ? { - bStrong = TRUE; + bStrong = true; } if ( m_blupi[rank].takeChannel != -1 ) // porte qq chose ? { - bTransport = TRUE; + bTransport = true; } if ( m_blupi[rank].vehicule != 0 ) // pas à pied ? { - bVehicule = TRUE; + bVehicule = true; } if ( m_blupi[rank].vehicule != 0 && // pas à pied ? m_blupi[rank].vehicule != 3 ) // pas armure ? { - bVehiculeA = TRUE; + bVehiculeA = true; } } if ( action == 0 ) { - if ( IsBlupiHere(cel, FALSE) ) + if ( IsBlupiHere(cel, false) ) { icons[1][1] = ICON_HILI_SEL; } @@ -1758,7 +1758,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, if ( ((m_blupi[rank].takeChannel == -1) || (m_blupi[rank].energy > MAXENERGY/4)) && IsFreeCelGo(GetCel(cel.x+x,cel.y+y), rank) && - !IsBlupiHere(GetCel(cel.x+x,cel.y+y), TRUE) ) + !IsBlupiHere(GetCel(cel.x+x,cel.y+y), true) ) { //? icons[1+x][1+y] = ICON_HILI_GO; // flèche icons[1+x][1+y] = ICON_HILI_OP; // action @@ -1904,7 +1904,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, error = ERROR_FREE; icons[x+1][y+1] = ICON_HILI_ERR; // croix } - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_FREE; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -1951,7 +1951,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { for ( y=0 ; y<2 ; y++ ) { - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_FREE; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -1963,7 +1963,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, if ( action == WM_ACTION_TOUR ) { - BOOL bTour; + bool bTour; if ( cel.x%2 != 1 || cel.y%2 != 1 ) { @@ -2018,7 +2018,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, icons[x+1][y+1] = ICON_HILI_ERR; // croix } } - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_FREE; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -2028,7 +2028,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, if ( error == 0 ) { - bTour = FALSE; + bTour = false; for ( i=0 ; i<4 ; i++ ) { vector = GetVector(i*2*16); @@ -2042,13 +2042,13 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, if ( m_decor[x/2][y/2].objectIcon == 27 ) // tour ? { - bTour = TRUE; + bTour = true; } if ( MoveGetObject(GetCel(x,y), channel, icon) && channel == CHOBJECT && icon == 27 ) // tour en construction ? { - bTour = TRUE; + bTour = true; } } } @@ -2093,7 +2093,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { for ( y=0 ; y<2 ; y++ ) { - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_FREE; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -2144,7 +2144,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { for ( y=0 ; y<2 ; y++ ) { - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_FREE; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -2180,8 +2180,8 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, icon == 93 || // piège ? icon == 123 || // fer ? icon == 125) && // mine ? - (!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) || - !IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) ) + (!IsBlupiHereEx(GetCel(cel,-1,0), rank, false) || + !IsBlupiHereEx(GetCel(cel,0,-1), rank, false)) ) { icons[1][1] = ICON_HILI_OP; // action } @@ -2219,7 +2219,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, for ( y=0 ; y<2 ; y++ ) { if ( !IsFreeCelDepose(GetCel(cel,x,y), rank) || - IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_MISC; } @@ -2230,17 +2230,17 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, else { if ( !IsFreeCelDepose(GetCel(cel,1,1), rank) || - IsBlupiHereEx(GetCel(cel,1,1), rank, FALSE) ) + IsBlupiHereEx(GetCel(cel,1,1), rank, false) ) { error = ERROR_MISC; } else { if ( !IsFreeCelDepose(GetCel(cel,0,1), rank) || - IsBlupiHereEx(GetCel(cel,0,1), rank, FALSE) ) + IsBlupiHereEx(GetCel(cel,0,1), rank, false) ) { if ( !IsFreeCelDepose(GetCel(cel,1,0), rank) || - IsBlupiHereEx(GetCel(cel,1,0), rank, FALSE) ) + IsBlupiHereEx(GetCel(cel,1,0), rank, false) ) { error = ERROR_MISC; } @@ -2285,7 +2285,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { for ( y=0 ; y<2 ; y++ ) { - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_MISC; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -2325,7 +2325,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { for ( y=0 ; y<2 ; y++ ) { - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_MISC; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -2403,7 +2403,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, error = ERROR_FREE; icons[x+1][y+1] = ICON_HILI_ERR; // croix } - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_FREE; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -2427,8 +2427,8 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, m_blupi[rank].perso != 8 && // pas disciple ? channel == CHOBJECT && icon == 60 && // tomates ? - (!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) || - !IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) ) + (!IsBlupiHereEx(GetCel(cel,-1,0), rank, false) || + !IsBlupiHereEx(GetCel(cel,0,-1), rank, false)) ) { icons[1][1] = ICON_HILI_OP; // action } @@ -2454,8 +2454,8 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, m_blupi[rank].perso != 8 && // pas disciple ? channel == CHOBJECT && icon == 80 && // bouteille ? - (!IsBlupiHereEx(GetCel(cel,-1,0), rank, FALSE) || - !IsBlupiHereEx(GetCel(cel,0,-1), rank, FALSE)) ) + (!IsBlupiHereEx(GetCel(cel,-1,0), rank, false) || + !IsBlupiHereEx(GetCel(cel,0,-1), rank, false)) ) { icons[1][1] = ICON_HILI_OP; // action } @@ -2511,7 +2511,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { for ( y=0 ; y<2 ; y++ ) { - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_FREE; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -2532,8 +2532,8 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { if ( IsFreeCelGo(GetCel(cel,+1, 0), rank) && IsFreeCelGo(GetCel(cel,+1,+1), rank) && - !IsBlupiHereEx(GetCel(cel,+1, 0), rank, FALSE) && - !IsBlupiHereEx(GetCel(cel,+1,+1), rank, FALSE) ) + !IsBlupiHereEx(GetCel(cel,+1, 0), rank, false) && + !IsBlupiHereEx(GetCel(cel,+1,+1), rank, false) ) { icons[1][1] = ICON_HILI_OP; // action icons[2][1] = ICON_HILI_OP; @@ -2563,8 +2563,8 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { if ( IsFreeCelGo(GetCel(cel,+1, 0), rank) && IsFreeCelGo(GetCel(cel,+1,+1), rank) && - !IsBlupiHereEx(GetCel(cel,+1, 0), rank, FALSE) && - !IsBlupiHereEx(GetCel(cel,+1,+1), rank, FALSE) ) + !IsBlupiHereEx(GetCel(cel,+1, 0), rank, false) && + !IsBlupiHereEx(GetCel(cel,+1,+1), rank, false) ) { icons[1][1] = ICON_HILI_OP; // action icons[2][1] = ICON_HILI_OP; @@ -2615,7 +2615,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { for ( y=0 ; y<2 ; y++ ) { - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_MISC; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -2650,7 +2650,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { for ( y=0 ; y<2 ; y++ ) { - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_MISC; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -2699,7 +2699,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { for ( y=0 ; y<2 ; y++ ) { - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_MISC; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -2736,7 +2736,7 @@ int CDecor::CelOkForAction(POINT cel, int action, int rank, { for ( y=0 ; y<2 ; y++ ) { - if ( IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + if ( IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { error = ERROR_MISC; icons[x+1][y+1] = ICON_HILI_ERR; // croix @@ -2821,7 +2821,7 @@ void CDecor::CelHili(POINT pos, int action) { m_celHili = ConvPosToCel(pos); - if ( IsBlupiHere(m_celHili, FALSE) ) + if ( IsBlupiHere(m_celHili, false) ) { m_rankHili = m_blupiHere; m_iconHili[1][1] = ICON_HILI_SEL; @@ -3203,7 +3203,7 @@ int CDecor::GetResHili(POINT posMouse) // Indique si le menu est présent et qu'il faut cacher // les tooltips du décor. -void CDecor::HideTooltips(BOOL bHide) +void CDecor::HideTooltips(bool bHide) { m_bHideTooltips = bHide; } @@ -3211,7 +3211,7 @@ void CDecor::HideTooltips(BOOL bHide) // Modifie l'origine supérieure/gauche du décor. -void CDecor::SetCoin(POINT coin, BOOL bCenter) +void CDecor::SetCoin(POINT coin, bool bCenter) { if ( bCenter ) { @@ -3225,7 +3225,7 @@ void CDecor::SetCoin(POINT coin, BOOL bCenter) if ( coin.y > MAXCELY-4 ) coin.y = MAXCELY-4; m_celCoin = coin; - m_bGroundRedraw = TRUE; // faudra redessiner les sols + m_bGroundRedraw = true; // faudra redessiner les sols m_celHili.x = -1; m_textLastPos.x = -1; // tooltips plus lavable ! } @@ -3243,7 +3243,7 @@ POINT CDecor::GetHome() // Mémoirise une position pendant le jeu. -void CDecor::MemoPos(int rank, BOOL bRecord) +void CDecor::MemoPos(int rank, bool bRecord) { POINT pos; @@ -3267,7 +3267,7 @@ void CDecor::MemoPos(int rank, BOOL bRecord) else { m_pSound->PlayImage(SOUND_BUT, pos); - SetCoin(m_memoPos[rank], FALSE); + SetCoin(m_memoPos[rank], false); } } } @@ -3333,13 +3333,13 @@ int CDecor::GetRegion() // Gestion des infos. -void CDecor::SetInfoMode(BOOL bInfo) +void CDecor::SetInfoMode(bool bInfo) { m_bInfo = bInfo; - m_bGroundRedraw = TRUE; // faudra redessiner les sols + m_bGroundRedraw = true; // faudra redessiner les sols } -BOOL CDecor::GetInfoMode() +bool CDecor::GetInfoMode() { return m_bInfo; } @@ -3347,7 +3347,7 @@ BOOL CDecor::GetInfoMode() void CDecor::SetInfoHeight(int height) { m_infoHeight = height; - m_bGroundRedraw = TRUE; // faudra redessiner les sols + m_bGroundRedraw = true; // faudra redessiner les sols } int CDecor::GetInfoHeight() @@ -3407,13 +3407,13 @@ void CDecor::UndoBack() { memcpy(&m_decor, m_pUndoDecor, sizeof(Cellule)*(MAXCELX/2)*(MAXCELY/2)); UndoClose(); - m_bGroundRedraw = TRUE; + m_bGroundRedraw = true; } } // Indique s'il est possible d'effectuer un undo. -BOOL CDecor::IsUndo() +bool CDecor::IsUndo() { return ( m_pUndoDecor != NULL ); } diff --git a/decor.h b/decor.h index 8918acc..bca6fc5 100644 --- a/decor.h +++ b/decor.h @@ -43,8 +43,8 @@ Cellule; typedef struct { - BOOL bExist; // TRUE -> utilisé - BOOL bHili; // TRUE -> sélectionné + int bExist; // true -> utilisé + int bHili; // true -> sélectionné short perso; // personnage, voir (*) @@ -84,14 +84,14 @@ typedef struct short jaugePhase; short jaugeMax; short stop; // 1 -> devra stopper - short bArrow; // TRUE -> flèche en dessus de blupi - short bRepeat; // TRUE -> répète l'action + short bArrow; // true -> flèche en dessus de blupi + short bRepeat; // true -> répète l'action short nLoop; // nb de boucles pour GOAL_OTHERLOOP short cLoop; // boucle en cours short vIcon; // icône variable POINT goalHili; // but visé - short bMalade; // TRUE -> blupi malade - short bCache; // TRUE -> caché (pas dessiné) + short bMalade; // true -> blupi malade + short bCache; // true -> caché (pas dessiné) short vehicule; // véhicule utilisé par blupi, voir (**) char busyCount; char busyDelay; @@ -131,12 +131,12 @@ Blupi; typedef struct { - BOOL bExist; // TRUE -> utilisé + int bExist; // true -> utilisé POINT cel; // cellule du décor short rankBlupi; // blupi travaillant ici - BOOL bFloor; // TRUE -> floor, FALSE -> object + int bFloor; // true -> floor, false -> object short channel; short icon; short maskChannel; @@ -169,11 +169,11 @@ public: void ArrangeBuild(POINT cel, int &channel, int &icon); void ArrangeObject(POINT cel); - BOOL ArrangeFillTestFloor(POINT cel1, POINT cel2); - BOOL ArrangeFillTest(POINT pos); + bool ArrangeFillTestFloor(POINT cel1, POINT cel2); + bool ArrangeFillTest(POINT pos); void ArrangeFillPut(POINT pos, int channel, int icon); void ArrangeFillSearch(POINT pos); - void ArrangeFill(POINT pos, int channel, int icon, BOOL bFloor); + void ArrangeFill(POINT pos, int channel, int icon, bool bFloor); void ArrangeBlupi(); @@ -182,118 +182,118 @@ public: void SearchObject(int rank, int icon, POINT cel, int *pBits); void AjustFloor(int rank, int icon, POINT cel, int *pBits); void AjustObject(int rank, int icon, POINT cel, int *pBits); - BOOL IsFreeDirect(POINT cel, int direct, int rank); - BOOL IsFreeCelObstacle(POINT cel); - BOOL IsFreeCelFloor(POINT cel, int rank); - BOOL IsFreeCelGo(POINT cel, int rank); - BOOL IsFreeCelHili(POINT cel, int rank); - BOOL IsFreeCel(POINT cel, int rank); - BOOL IsFreeCelDepose(POINT cel, int rank); - BOOL IsFreeCelEmbarque(POINT cel, int rank, int &action, POINT &limit); - BOOL IsFreeCelDebarque(POINT cel, int rank, int &action, POINT &limit); - BOOL IsFreeJump(POINT cel, int direct, int rank, int &action); - BOOL IsFreeGlisse(POINT cel, int direct, int rank, int &action); + bool IsFreeDirect(POINT cel, int direct, int rank); + bool IsFreeCelObstacle(POINT cel); + bool IsFreeCelFloor(POINT cel, int rank); + bool IsFreeCelGo(POINT cel, int rank); + bool IsFreeCelHili(POINT cel, int rank); + bool IsFreeCel(POINT cel, int rank); + bool IsFreeCelDepose(POINT cel, int rank); + bool IsFreeCelEmbarque(POINT cel, int rank, int &action, POINT &limit); + bool IsFreeCelDebarque(POINT cel, int rank, int &action, POINT &limit); + bool IsFreeJump(POINT cel, int direct, int rank, int &action); + bool IsFreeGlisse(POINT cel, int direct, int rank, int &action); int DirectSearch(POINT cel, POINT goal); void FlushUsed(int rank); void AddUsedPos(int rank, POINT pos); - BOOL IsUsedPos(int rank, POINT pos); - BOOL SearchBestBase(int rank, int &action, POINT &newCel, int &direct); - BOOL SearchBestPass(int rank, int &action); - BOOL IsWorkableObject(POINT cel, int rank); - BOOL SearchOtherObject(int rank, POINT initCel, int action, + bool IsUsedPos(int rank, POINT pos); + bool SearchBestBase(int rank, int &action, POINT &newCel, int &direct); + bool SearchBestPass(int rank, int &action); + bool IsWorkableObject(POINT cel, int rank); + bool SearchOtherObject(int rank, POINT initCel, int action, int distMax, int channel, int firstIcon1, int lastIcon1, int firstIcon2, int lastIcon2, POINT &foundCel, int &foundIcon); - BOOL SearchOtherDrapeau(int rank, POINT initCel, int distMax, + bool SearchOtherDrapeau(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon); - BOOL SearchOtherBateau(int rank, POINT initCel, int distMax, + bool SearchOtherBateau(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon); - BOOL IsSpiderObject(int icon); - BOOL SearchSpiderObject(int rank, POINT initCel, int distMax, + bool IsSpiderObject(int icon); + bool SearchSpiderObject(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon); - BOOL IsTracksObject(int icon); - BOOL SearchTracksObject(int rank, POINT initCel, int distMax, + bool IsTracksObject(int icon); + bool SearchTracksObject(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon); - BOOL IsRobotObject(int icon); - BOOL SearchRobotObject(int rank, POINT initCel, int distMax, + bool IsRobotObject(int icon); + bool SearchRobotObject(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon, int &foundAction); - BOOL IsBombeObject(int icon); - BOOL SearchBombeObject(int rank, POINT initCel, int distMax, + bool IsBombeObject(int icon); + bool SearchBombeObject(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon); - BOOL SearchElectroObject(int rank, POINT initCel, int distMax, + bool SearchElectroObject(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon); - BOOL IsUsineBuild(int rank, POINT cel); - BOOL IsUsineFree(int rank, POINT cel); - BOOL IsFireCel(POINT cel); - BOOL IsVirusCel(POINT cel); + bool IsUsineBuild(int rank, POINT cel); + bool IsUsineFree(int rank, POINT cel); + bool IsFireCel(POINT cel); + bool IsVirusCel(POINT cel); int IsBuildPont(POINT &cel, int &iconBuild); - BOOL IsBuildBateau(POINT cel, int &direct); + bool IsBuildBateau(POINT cel, int &direct); void InitDrapeau(); void AddDrapeau(POINT cel); void SubDrapeau(POINT cel); - BOOL TestDrapeau(POINT cel); + bool TestDrapeau(POINT cel); // DecBlupi.cpp void BlupiFlush(); int BlupiCreate(POINT cel, int action, int direct, int perso, int energy); - BOOL BlupiDelete(POINT cel, int perso=-1); + bool BlupiDelete(POINT cel, int perso=-1); void BlupiDelete(int rank); void BlupiKill(int exRank, POINT cel, int type); - BOOL BlupiIfExist(int rank); + bool BlupiIfExist(int rank); void BlupiCheat(int cheat); void BlupiActualise(int rank); void BlupiAdaptIcon(int rank); void BlupiPushFog(int rank); - void BlupiSound(int rank, int sound, POINT pos, BOOL bStop=FALSE); + void BlupiSound(int rank, int sound, POINT pos, bool bStop=false); void BlupiInitAction(int rank, int action, int direct=-1); void BlupiChangeAction(int rank, int action, int direct=-1); void ListFlush(int rank); int ListGetParam(int rank, int button, POINT cel); - BOOL ListPut(int rank, int button, POINT cel, POINT cMem); + bool ListPut(int rank, int button, POINT cel, POINT cMem); void ListRemove(int rank); int ListSearch(int rank, int button, POINT cel, int &textForButton); - BOOL RepeatAdjust(int rank, int button, POINT &cel, POINT &cMem, + bool RepeatAdjust(int rank, int button, POINT &cel, POINT &cMem, int param, int list); void GoalStart(int rank, int action, POINT cel); - BOOL GoalNextPhase(int rank); + bool GoalNextPhase(int rank); void SetTotalTime(int total); int GetTotalTime(); void GoalInitJauge(int rank); void GoalInitPassCel(int rank); void GoalAdjustCel(int rank, int &x, int &y); - BOOL GoalNextOp(int rank, short *pTable); + bool GoalNextOp(int rank, short *pTable); void GoalUnwork(int rank); - void GoalStop(int rank, BOOL bError=FALSE, BOOL bSound=TRUE); - BOOL BlupiIsGoalUsed(POINT cel); + void GoalStop(int rank, bool bError=false, bool bSound=true); + bool BlupiIsGoalUsed(POINT cel); void BlupiStartStopRayon(int rank, POINT startCel, POINT endCel); - BOOL BlupiRotate(int rank); - BOOL BlupiNextAction(int rank); + bool BlupiRotate(int rank); + bool BlupiNextAction(int rank); void BlupiNextGoal(int rank); - void BlupiStep(BOOL bFirst); + void BlupiStep(bool bFirst); void BlupiGetRect(int rank, RECT &rect); int GetTargetBlupi(POINT pos); void BlupiDeselect(); void BlupiDeselect(int rank); - void BlupiSetArrow(int rank, BOOL bArrow); + void BlupiSetArrow(int rank, bool bArrow); void InitOutlineRect(); - void BlupiHiliDown(POINT pos, BOOL bAdd=FALSE); - void BlupiHiliMove(POINT pos, BOOL bAdd=FALSE); - void BlupiHiliUp(POINT pos, BOOL bAdd=FALSE); + void BlupiHiliDown(POINT pos, bool bAdd=false); + void BlupiHiliMove(POINT pos, bool bAdd=false); + void BlupiHiliUp(POINT pos, bool bAdd=false); void BlupiDrawHili(); int GetDefButton(POINT cel); - BOOL BlupiGoal(int rank, int button, POINT cel, POINT cMem); + bool BlupiGoal(int rank, int button, POINT cel, POINT cMem); void BlupiGoal(POINT cel, int button); void BlupiDestCel(int rank); - BOOL IsTracksHere(POINT cel, BOOL bSkipInMove); - BOOL IsBlupiHereEx(POINT cel1, POINT cel2, int exRank, BOOL bSkipInMove); - BOOL IsBlupiHereEx(POINT cel, int exRank, BOOL bSkipInMove); - BOOL IsBlupiHere(POINT cel, BOOL bSkipInMove); - BOOL IsBlupiHere(POINT cel, int direct, BOOL bSkipInMove); + bool IsTracksHere(POINT cel, bool bSkipInMove); + bool IsBlupiHereEx(POINT cel1, POINT cel2, int exRank, bool bSkipInMove); + bool IsBlupiHereEx(POINT cel, int exRank, bool bSkipInMove); + bool IsBlupiHere(POINT cel, bool bSkipInMove); + bool IsBlupiHere(POINT cel, int direct, bool bSkipInMove); void GetLevelJauge(int *pLevels, int *pTypes); - BOOL IsWorkBlupi(int rank); + bool IsWorkBlupi(int rank); void BlupiGetButtons(POINT pos, int &nb, int *pButtons, int *pErrors, int &perso); void TerminatedInit(); int IsTerminated(); @@ -303,36 +303,36 @@ public: void MoveFlush(); int MoveMaxFire(); void MoveFixInit(); - BOOL MoveCreate(POINT cel, int rankBlupi, BOOL bFloor, + bool MoveCreate(POINT cel, int rankBlupi, bool bFloor, int channel, int icon, int maskChannel, int maskIcon, int total, int delai, int stepY, - BOOL bMisc=FALSE, BOOL bNotIfExist=FALSE); - BOOL MoveAddMoves(POINT cel, int rankMoves); - BOOL MoveAddIcons(POINT cel, int rankIcons, BOOL bContinue=FALSE); - BOOL MoveStartFire(POINT cel); + bool bMisc=false, bool bNotIfExist=false); + bool MoveAddMoves(POINT cel, int rankMoves); + bool MoveAddIcons(POINT cel, int rankIcons, bool bContinue=false); + bool MoveStartFire(POINT cel); void MoveProxiFire(POINT cel); void MoveFire(int rank); - void MoveStep(BOOL bFirst); + void MoveStep(bool bFirst); void MoveFinish(POINT cel); void MoveFinish(int rankBlupi); - BOOL MoveIsUsed(POINT cel); - BOOL MoveGetObject(POINT cel, int &channel, int &icon); - BOOL MovePutObject(POINT cel, int channel, int icon); + bool MoveIsUsed(POINT cel); + bool MoveGetObject(POINT cel, int &channel, int &icon); + bool MovePutObject(POINT cel, int channel, int icon); // DecIO.cpp - BOOL Write(int rank, BOOL bUser, int world, int time, int total); - BOOL Read(int rank, BOOL bUser, int &world, int &time, int &total); - BOOL FileExist(int rank, BOOL bUser, int &world, int &time, int &total); + bool Write(int rank, bool bUser, int world, int time, int total); + bool Read(int rank, bool bUser, int &world, int &time, int &total); + bool FileExist(int rank, bool bUser, int &world, int &time, int &total); void Flush(); // DecMap.cpp void MapInitColors(); POINT ConvCelToMap(POINT cel); POINT ConvMapToCel(POINT pos); - BOOL MapMove(POINT pos); + bool MapMove(POINT pos); void MapPutCel(POINT pos); - BOOL GenerateMap(); + bool GenerateMap(); // DecStat.cpp void StatisticInit(); @@ -341,52 +341,52 @@ public: int StatisticGetFire(); void StatisticDraw(); void GenerateStatictic(); - BOOL StatisticDown(POINT pos, int fwKeys); - BOOL StatisticMove(POINT pos, int fwKeys); - BOOL StatisticUp(POINT pos, int fwKeys); + bool StatisticDown(POINT pos, int fwKeys); + bool StatisticMove(POINT pos, int fwKeys); + bool StatisticUp(POINT pos, int fwKeys); int StatisticDetect(POINT pos); // Chemin.cpp void CheminMemPos(int exRank); - BOOL CheminTestPos(POINT pos, int &rank); + bool CheminTestPos(POINT pos, int &rank); int CheminARebours(int rank); void CheminFillTerrain(int rank); - BOOL CheminTestDirection(int rank, int pos, int dir, + bool CheminTestDirection(int rank, int pos, int dir, int &next, int &li, int &cout, int &action); - BOOL CheminCherche(int rank, int &action); - BOOL IsCheminFree(int rank, POINT dest, int button); + bool CheminCherche(int rank, int &action); + bool IsCheminFree(int rank, POINT dest, int button); // Decor.cpp void SetShiftOffset(POINT offset); POINT ConvCelToPos(POINT cel); - POINT ConvPosToCel(POINT pos, BOOL bMap=FALSE); + POINT ConvPosToCel(POINT pos, bool bMap=false); POINT ConvPosToCel2(POINT pos); void Create(HWND hWnd, CSound *pSound, CPixmap *pPixmap); void Init(int channel, int icon); void InitAfterBuild(); void ResetHili(); - BOOL LoadImages(); + bool LoadImages(); void ClearFog(); void ClearFire(); - void SetBuild(BOOL bBuild); - void EnableFog(BOOL bEnable); - BOOL GetInvincible(); - void SetInvincible(BOOL bInvincible); - BOOL GetSuper(); - void SetSuper(BOOL bSuper); + void SetBuild(bool bBuild); + void EnableFog(bool bEnable); + bool GetInvincible(); + void SetInvincible(bool bInvincible); + bool GetSuper(); + void SetSuper(bool bSuper); void FlipOutline(); - BOOL PutFloor(POINT cel, int channel, int icon); - BOOL PutObject(POINT cel, int channel, int icon); - BOOL GetFloor(POINT cel, int &channel, int &icon); - BOOL GetObject(POINT cel, int &channel, int &icon); - BOOL SetFire(POINT cel, BOOL bFire); + bool PutFloor(POINT cel, int channel, int icon); + bool PutObject(POINT cel, int channel, int icon); + bool GetFloor(POINT cel, int &channel, int &icon); + bool GetObject(POINT cel, int &channel, int &icon); + bool SetFire(POINT cel, bool bFire); - void SetCoin(POINT coin, BOOL bCenter=FALSE); + void SetCoin(POINT coin, bool bCenter=false); POINT GetCoin(); POINT GetHome(); - void MemoPos(int rank, BOOL bRecord); + void MemoPos(int rank, bool bRecord); void SetTime(int time); int GetTime(); @@ -400,8 +400,8 @@ public: void SetRegion(int region); int GetRegion(); - void SetInfoMode(BOOL bInfo); - BOOL GetInfoMode(); + void SetInfoMode(bool bInfo); + bool GetInfoMode(); void SetInfoHeight(int height); int GetInfoHeight(); @@ -425,17 +425,17 @@ public: void CelHiliButton(POINT cel, int button); void CelHiliRepeat(int list); int GetResHili(POINT posMouse); - void HideTooltips(BOOL bHide); + void HideTooltips(bool bHide); void UndoOpen(); void UndoClose(); void UndoCopy(); void UndoBack(); - BOOL IsUndo(); + bool IsUndo(); protected: - BOOL GetSeeBits(POINT cel, char *pBits, int index); + bool GetSeeBits(POINT cel, char *pBits, int index); int GetSeeIcon(char *pBits, int index); protected: @@ -455,16 +455,16 @@ protected: POINT m_shiftOffset; int m_iconHili[4][4]; int m_rankHili; // rang du blupi visé - BOOL m_bHiliRect; + bool m_bHiliRect; POINT m_p1Hili; // coins rectangle de sélection POINT m_p2Hili; int m_shiftHili; int m_nbBlupiHili; // nb de blupi sélectionnés int m_rankBlupiHili; // rang blupi sélectionné - BOOL m_bFog; // TRUE -> brouillard (jeu) - BOOL m_bBuild; // TRUE -> construction - BOOL m_bInvincible; // TRUE -> cheat code - BOOL m_bSuper; // TRUE -> cheat code + bool m_bFog; // true -> brouillard (jeu) + bool m_bBuild; // true -> construction + bool m_bInvincible; // true -> cheat code + bool m_bSuper; // true -> cheat code short m_colors[100]; int m_time; // temps relatif global int m_timeConst; // temps relatif global constant @@ -472,16 +472,16 @@ protected: int m_totalTime; // temps total passé sur une partie int m_phase; // phase pour la carte POINT m_celArrow; // cellule avec flèche - BOOL m_bOutline; - BOOL m_bGroundRedraw; + bool m_bOutline; + bool m_bGroundRedraw; char m_buttonExist[MAXBUTTON]; int m_statNb; // nb de statistiques int m_statFirst; // première statistique visible int m_bStatUp; // flèche up statistique int m_bStatDown; // flèche down statistique int m_statHili; // statistique survolée - BOOL m_bStatRecalc; // TRUE -> recalcule les statistiques - BOOL m_bStatRedraw; // TRUE -> redessine les statistiques + bool m_bStatRecalc; // true -> recalcule les statistiques + bool m_bStatRedraw; // true -> redessine les statistiques int m_nbStatHach; // nb de hachures int m_nbStatHachBlupi; // hachures occupées par blupi int m_nbStatHachPlanche;// hachures occupées par planches @@ -506,12 +506,12 @@ protected: int m_lastRegion; // numéro dernière région int m_blupiHere; POINT m_lastDrapeau[MAXLASTDRAPEAU]; - BOOL m_bHideTooltips; // TRUE -> menu présent + bool m_bHideTooltips; // true -> menu présent char m_text[50]; POINT m_textLastPos; int m_textCount; int m_skill; - BOOL m_bInfo; + bool m_bInfo; int m_infoHeight; POINT m_memoPos[4]; @@ -520,7 +520,7 @@ protected: POINT m_cheminPos[MAXBLUPI*2]; int m_cheminRank[MAXBLUPI*2]; - BOOL m_bFillFloor; + bool m_bFillFloor; int m_fillSearchChannel; int m_fillSearchIcon; int m_fillPutChannel; @@ -538,7 +538,7 @@ protected: POINT GetCel (int x, int y); POINT GetCel (POINT cel, int x, int y); -BOOL IsValid (POINT cel); +bool IsValid (POINT cel); POINT GetVector (int direct); extern int table_multi_goal[]; extern short table_actions[]; \ No newline at end of file diff --git a/decstat.cpp b/decstat.cpp index 445e790..562300b 100644 --- a/decstat.cpp +++ b/decstat.cpp @@ -39,318 +39,318 @@ Statistic; static Statistic table_statistic[] = { { // STATBLUPIm = 0 - TRUE, + true, 0, // blupi malade 0,0, // 76, - FALSE, + false, TX_OBJ_BLUPIm, 0, 0, }, { // STATBLUPIf = 1 - TRUE, + true, 0, // blupi fatigué 0,0, // 13, - FALSE, + false, TX_OBJ_BLUPIf, 0, 0, }, { // STATBLUPI = 2 - TRUE, + true, 0, // blupi énergique 0,0, // 14, - FALSE, + false, TX_OBJ_BLUPI, 0, 0, }, { // STATDISCIPLE = 3 - TRUE, + true, 8, // disciple 0,0, // 85, - FALSE, + false, TX_OBJ_DISCIPLE, 0, 0, }, { // 4 - TRUE, + true, -1, // objet 117,117, // bateau 58, - FALSE, + false, TX_OBJ_BATEAU, 0, 0, }, { // 5 - TRUE, + true, -1, // objet 118,118, // jeep 65, - FALSE, + false, TX_OBJ_JEEP, 0, 0, }, { // 6 - TRUE, + true, -1, // objet 16,16, // armure 106, - FALSE, + false, TX_OBJ_ARMURE, 0, 0, }, { // 7 - TRUE, + true, -1, // objet 93,93, // piège 70, - FALSE, + false, TX_OBJ_PIEGE, 0, 0, }, { // 8 - TRUE, + true, -1, // objet 92,92, // poison 71, - FALSE, + false, TX_OBJ_POISON, 0, 0, }, { // 9 - TRUE, + true, -1, // objet 85,85, // dynamite 57, - FALSE, + false, TX_OBJ_DYNAMITE, 0, 0, }, { // 10 - TRUE, + true, -1, // objet 125,125, // mine 63, - FALSE, + false, TX_OBJ_MINE, 0, 0, }, { // 11 - TRUE, + true, -1, // objet 60,60, // tomate 28, - FALSE, + false, TX_OBJ_TOMATE, 0, 0, }, { // 12 - TRUE, + true, -1, // objet 80,80, // bouteille 34, - FALSE, + false, TX_OBJ_POTION, 0, 0, }, { // 13 - TRUE, + true, -1, // objet 36,36, // planches 22, - FALSE, + false, TX_OBJ_PLANCHE, 0, 0, }, { // 14 - TRUE, + true, -1, // objet 44,44, // pierres 27, - FALSE, + false, TX_OBJ_PIERRE, 0, 0, }, { // 15 - TRUE, + true, -1, // objet 124,124, // drapeau 64, - TRUE, + true, TX_OBJ_DRAPEAU, 0, 0, }, { // 16 - TRUE, + true, -1, // objet 123,123, // fer 62, - FALSE, + false, TX_OBJ_FER, 0, 0, }, { // 17 - TRUE, + true, -1, // objet 82,82, // fleurs1 72, - FALSE, + false, TX_OBJ_FLEUR1, 0, 0, }, { // 18 - TRUE, + true, -1, // objet 84,84, // fleurs2 73, - FALSE, + false, TX_OBJ_FLEUR2, 0, 0, }, { // 19 - TRUE, + true, -1, // objet 95,95, // fleurs3 74, - FALSE, + false, TX_OBJ_FLEUR3, 0, 0, }, { // 20 - TRUE, + true, -1, // objet 61,61, // cabane 19, - TRUE, + true, TX_OBJ_CABANE, 0, 0, }, { // 21 - TRUE, + true, -1, // objet -52,-56, // couveuse 25, - FALSE, + false, TX_OBJ_COUVEUSE, 0, 0, }, { // 22 - TRUE, + true, -1, // objet -80,-84, // téléporteur 101, - FALSE, + false, TX_OBJ_TELEPORTE, 0, 0, }, { // 23 - TRUE, + true, -1, // objet 28,29, // laboratoire 35, - TRUE, + true, TX_OBJ_LABO, 0, 0, }, { // 24 - TRUE, + true, -1, // objet 121,122, // mine de fer 61, - TRUE, + true, TX_OBJ_MINEFER, 0, 0, }, { // 25 - TRUE, + true, -1, // objet 119,120, // usine 59, - TRUE, + true, TX_OBJ_USINE, 0, 0, }, { // 26 - TRUE, + true, -1, // objet 27,27, // tour 33, - TRUE, + true, TX_OBJ_TOUR, 0, 0, }, { // STATFEU = 27 - TRUE, + true, -2, // feu 0,0, // 37, - TRUE, + true, TX_OBJ_FEU, 0, 0, }, { // STATROBOT = 28 - TRUE, + true, 4, // robot 0,0, // 56, - FALSE, + false, TX_OBJ_ROBOT, 0, 0, }, { // STATTRACKS = 29 - TRUE, + true, 3, // tracks 0,0, // 17, - FALSE, + false, TX_OBJ_TRACKS, 0, 0, }, { // STATBOMBE = 30 - TRUE, + true, 5, // bombe 0,0, // 38, - FALSE, + false, TX_OBJ_BOMBE, 0, 0, }, { // STATARAIGNEE = 31 - TRUE, + true, 1, // araignée 0,0, // 15, - FALSE, + false, TX_OBJ_ARAIGNEE, 0, 0, }, { // STATVIRUS = 32 - TRUE, + true, 2, // virus 0,0, // 16, - FALSE, + false, TX_OBJ_VIRUS, 0, 0, }, { // STATELECTRO = 33 - TRUE, + true, 7, // électro 0,0, // 75, - FALSE, + false, TX_OBJ_ELECTRO, 0, 0, }, { - FALSE, + false, -1, 0,0, -1, - FALSE, + false, 0, 999, 999, }, @@ -399,11 +399,11 @@ void CDecor::StatisticInit() m_statNb = 0; m_statFirst = 0; - m_bStatUp = FALSE; - m_bStatDown = FALSE; + m_bStatUp = false; + m_bStatDown = false; m_statHili = -1; - m_bStatRecalc = TRUE; // faudra tout recalculer - m_bStatRedraw = TRUE; // faudra tout redessiner + m_bStatRecalc = true; // faudra tout recalculer + m_bStatRedraw = true; // faudra tout redessiner } @@ -412,7 +412,7 @@ void CDecor::StatisticInit() void CDecor::StatisticUpdate() { int rank, x, y, icon, nb; - BOOL bHach; + bool bHach; Statistic* pStatistic; m_nbStatHach = 0; @@ -525,11 +525,11 @@ void CDecor::StatisticUpdate() { for ( y=0 ; y= 1+(nb-1)*(STATNB-2) ) { m_statFirst = 1+(nb-1)*(STATNB-2); - m_bStatDown = FALSE; + m_bStatDown = false; } if ( m_statFirst == 0 ) { - m_bStatUp = FALSE; + m_bStatUp = false; } } - m_bStatRecalc = FALSE; // c'est calculé - m_bStatRedraw = TRUE; // faudra tout redessiner + m_bStatRecalc = false; // c'est calculé + m_bStatRedraw = true; // faudra tout redessiner } // Retourne le nombre de blupi. @@ -779,7 +779,7 @@ void CDecor::StatisticDraw() DrawText(m_pPixmap, pos, text); } - m_bStatRedraw = FALSE; // dessin plus nécessaire + m_bStatRedraw = false; // dessin plus nécessaire } // Génère les statistiques. @@ -802,7 +802,7 @@ void CDecor::GenerateStatictic() // Bouton pressé dans les statistiques. -BOOL CDecor::StatisticDown(POINT pos, int fwKeys) +bool CDecor::StatisticDown(POINT pos, int fwKeys) { int hili, rank, x, y, show, icon; POINT cel; @@ -811,7 +811,7 @@ BOOL CDecor::StatisticDown(POINT pos, int fwKeys) StatisticUpdate(); hili = StatisticDetect(pos); - if ( hili < 0 ) return FALSE; + if ( hili < 0 ) return false; if ( m_bStatUp && hili == 0 ) // flèche up ? { @@ -824,7 +824,7 @@ BOOL CDecor::StatisticDown(POINT pos, int fwKeys) pos.x = LXIMAGE/2; pos.y = LYIMAGE/2; m_pSound->PlayImage(SOUND_OPEN, pos); - return TRUE; + return true; } if ( m_bStatDown && hili == STATNB-1 ) // flèche down ? @@ -841,13 +841,13 @@ BOOL CDecor::StatisticDown(POINT pos, int fwKeys) pos.x = LXIMAGE/2; pos.y = LYIMAGE/2; m_pSound->PlayImage(SOUND_OPEN, pos); - return TRUE; + return true; } rank = m_statFirst+hili; if ( rank > 0 && m_bStatUp ) rank --; pStatistic = StatisticGet(rank); - if ( !pStatistic->bExist ) return FALSE; + if ( !pStatistic->bExist ) return false; show = pStatistic->lastShow % pStatistic->nb; pStatistic->lastShow ++; @@ -876,11 +876,11 @@ BOOL CDecor::StatisticDown(POINT pos, int fwKeys) m_blupi[rank].perso == 8 ) // disciple ? { BlupiDeselect(); - m_blupi[rank].bHili = TRUE; + m_blupi[rank].bHili = true; m_rankBlupiHili = rank; // sélectionne m_nbBlupiHili = 1; } - BlupiSetArrow(rank, TRUE); + BlupiSetArrow(rank, true); cel = m_blupi[rank].cel; goto select; } @@ -981,17 +981,17 @@ BOOL CDecor::StatisticDown(POINT pos, int fwKeys) } } - return FALSE; + return false; select: - SetCoin(cel, TRUE); + SetCoin(cel, true); NextPhase(0); // faudra refaire la carte tout de suite - return TRUE; + return true; } // Souris déplacée dans les statistiques. -BOOL CDecor::StatisticMove(POINT pos, int fwKeys) +bool CDecor::StatisticMove(POINT pos, int fwKeys) { int rank; @@ -1000,17 +1000,17 @@ BOOL CDecor::StatisticMove(POINT pos, int fwKeys) if ( rank != m_statHili ) // autre mise en évidence ? { m_statHili = rank; - m_bStatRedraw = TRUE; // faudra tout redessiner + m_bStatRedraw = true; // faudra tout redessiner } - return FALSE; + return false; } // Bouton relâché dans les statistiques. -BOOL CDecor::StatisticUp(POINT pos, int fwKeys) +bool CDecor::StatisticUp(POINT pos, int fwKeys) { - return FALSE; + return false; } // Détecte dans quelle statistique est la souris. diff --git a/def.h b/def.h index f63caf4..020ea07 100644 --- a/def.h +++ b/def.h @@ -5,10 +5,10 @@ #include -#define _DEMO FALSE // TRUE=demo, FALSE=complet -#define _INTRO FALSE // TRUE si images d'introduction -#define _EGAMES FALSE // TRUE version pour eGames -#define _SE FALSE // TRUE eGames Special Edition +#define _DEMO false // true=demo, false=complet +#define _INTRO false // true si images d'introduction +#define _EGAMES false // true version pour eGames +#define _SE false // true eGames Special Edition #define LXIMAGE 640 // dimensions de la fenêtre de jeu diff --git a/event.cpp b/event.cpp index 4b273ce..bcfcbbd 100644 --- a/event.cpp +++ b/event.cpp @@ -72,7 +72,7 @@ static Phase table[] = { WM_PHASE_TESTCD, "image\\init.blp", - FALSE, + false, { { 0 @@ -83,7 +83,7 @@ static Phase table[] = { WM_PHASE_INTRO1, "image\\intro1.blp", - FALSE, + false, { { 0 @@ -94,7 +94,7 @@ static Phase table[] = { WM_PHASE_INTRO2, "image\\intro2.blp", - FALSE, + false, { { 0 @@ -105,7 +105,7 @@ static Phase table[] = { WM_PHASE_INIT, "image\\init.blp", - FALSE, + false, { { WM_PHASE_DEMO, @@ -149,7 +149,7 @@ static Phase table[] = { WM_PHASE_HISTORY0, "image\\history0.blp", - TRUE, + true, { { WM_PHASE_INIT, @@ -172,7 +172,7 @@ static Phase table[] = { WM_PHASE_HISTORY1, "image\\history1.blp", - TRUE, + true, { { WM_PHASE_HISTORY0, @@ -195,7 +195,7 @@ static Phase table[] = { WM_PHASE_INFO, "image\\info%.3d.blp", - FALSE, + false, { { WM_PREV, @@ -262,7 +262,7 @@ static Phase table[] = { WM_PHASE_PLAY, "image\\play.blp", - FALSE, + false, { { WM_PHASE_STOP, @@ -291,7 +291,7 @@ static Phase table[] = { WM_PHASE_STOP, "image\\stop%.3d.blp", - FALSE, + false, { { WM_PHASE_PLAY, @@ -340,7 +340,7 @@ static Phase table[] = { WM_PHASE_HELP, "image\\help.blp", - TRUE, + true, { { WM_PHASE_PLAY, @@ -381,7 +381,7 @@ static Phase table[] = { WM_PHASE_SETUP, "image\\setup.blp", - FALSE, + false, { { WM_BUTTON1, @@ -460,7 +460,7 @@ static Phase table[] = { WM_PHASE_SETUPp, "image\\setup.blp", - FALSE, + false, { { WM_BUTTON1, @@ -539,7 +539,7 @@ static Phase table[] = { WM_PHASE_READ, "image\\read.blp", - FALSE, + false, { { WM_READ0, @@ -616,7 +616,7 @@ static Phase table[] = { WM_PHASE_WRITE, "image\\write.blp", - FALSE, + false, { { WM_WRITE0, @@ -693,7 +693,7 @@ static Phase table[] = { WM_PHASE_WRITEp, "image\\write.blp", - FALSE, + false, { { WM_WRITE0, @@ -770,7 +770,7 @@ static Phase table[] = { WM_PHASE_LOST, "image\\lost.blp", - TRUE, + true, { { WM_PHASE_INFO, @@ -787,7 +787,7 @@ static Phase table[] = { WM_PHASE_WIN, "image\\win.blp", - TRUE, + true, { { WM_NEXT, @@ -804,7 +804,7 @@ static Phase table[] = { WM_PHASE_LASTWIN, "image\\last%.3d.blp", - TRUE, + true, { { WM_PHASE_INIT, @@ -821,7 +821,7 @@ static Phase table[] = { WM_PHASE_BUILD, "image\\build.blp", - TRUE, + true, { { WM_DECOR1, // pose des sols @@ -906,7 +906,7 @@ static Phase table[] = { WM_PHASE_BUTTON, "image\\button.blp", - TRUE, + true, { { WM_BUTTON1, // stop @@ -1133,7 +1133,7 @@ static Phase table[] = { WM_PHASE_TERM, "image\\term.blp", - TRUE, + true, { { WM_BUTTON8, // home blupi @@ -1222,7 +1222,7 @@ static Phase table[] = { WM_PHASE_MUSIC, "image\\music.blp", - TRUE, + true, { { WM_BUTTON1, @@ -1299,7 +1299,7 @@ static Phase table[] = { WM_PHASE_REGION, "image\\region.blp", - TRUE, + true, { { WM_BUTTON1, // normal @@ -1340,7 +1340,7 @@ static Phase table[] = { WM_PHASE_PLAYMOVIE, "image\\movie.blp", - FALSE, + false, { { 0 @@ -1351,7 +1351,7 @@ static Phase table[] = { WM_PHASE_WINMOVIE, "image\\movie.blp", - FALSE, + false, { { 0 @@ -1362,7 +1362,7 @@ static Phase table[] = { WM_PHASE_H0MOVIE, "image\\movie.blp", - FALSE, + false, { { 0 @@ -1373,7 +1373,7 @@ static Phase table[] = { WM_PHASE_H1MOVIE, "image\\movie.blp", - FALSE, + false, { { 0 @@ -1384,7 +1384,7 @@ static Phase table[] = { WM_PHASE_H2MOVIE, "image\\movie.blp", - FALSE, + false, { { 0 @@ -1395,7 +1395,7 @@ static Phase table[] = { WM_PHASE_BYE, "image\\bye.blp", - FALSE, + false, { { 0 @@ -1406,7 +1406,7 @@ static Phase table[] = { WM_PHASE_INSERT, "image\\insert.blp", - FALSE, + false, { //? { //? WM_PHASE_INFO, @@ -1441,7 +1441,7 @@ CEvent::CEvent() { int i; - m_bFullScreen = TRUE; + m_bFullScreen = true; m_mouseType = MOUSETYPEGRA; m_exercice = 0; m_mission = 0; @@ -1449,39 +1449,39 @@ CEvent::CEvent() m_maxMission = 0; m_phase = 0; m_index = -1; - m_bSchool = FALSE; - m_bPrivate = FALSE; - m_bAccessBuild = FALSE; - m_bRunMovie = FALSE; - m_bBuildModify = FALSE; - m_bMousePress = FALSE; - m_bMouseDown = FALSE; + m_bSchool = false; + m_bPrivate = false; + m_bAccessBuild = false; + m_bRunMovie = false; + m_bBuildModify = false; + m_bMousePress = false; + m_bMouseDown = false; m_oldMousePos.x = 0; m_oldMousePos.y = 0; m_mouseSprite = 0; - m_bFillMouse = FALSE; - m_bWaitMouse = FALSE; - m_bHideMouse = FALSE; - m_bShowMouse = FALSE; + m_bFillMouse = false; + m_bWaitMouse = false; + m_bHideMouse = false; + m_bShowMouse = false; m_rankCheat = -1; m_posCheat = 0; m_speed = 1; - m_bMovie = TRUE; - m_bSpeed = FALSE; - m_bHelp = FALSE; - m_bAllMissions = FALSE; - m_bChangeCheat = FALSE; + m_bMovie = true; + m_bSpeed = false; + m_bHelp = false; + m_bAllMissions = false; + m_bChangeCheat = false; m_scrollSpeed = 1; - m_bPause = FALSE; - m_bShift = FALSE; + m_bPause = false; + m_bShift = false; m_shiftPhase = 0; m_movieToStart[0] = 0; - m_bInfoHelp = FALSE; - m_bDemoRec = FALSE; - m_bDemoPlay = FALSE; + m_bInfoHelp = false; + m_bDemoRec = false; + m_bDemoPlay = false; m_pDemoBuffer = NULL; m_demoTime = 0; - m_bCtrlDown = FALSE; + m_bCtrlDown = false; for ( i=0 ; i= (m_bSpeed?8:2) ) bEnable = FALSE; + bEnable = true; + if ( m_speed >= (m_bSpeed?8:2) ) bEnable = false; SetEnable(WM_BUTTON2, bEnable); volume = m_pSound->GetAudioVolume(); - bEnable = TRUE; + bEnable = true; if ( volume == 0 || - !m_pSound->GetEnable() ) bEnable = FALSE; + !m_pSound->GetEnable() ) bEnable = false; SetEnable(WM_BUTTON3, bEnable); - bEnable = TRUE; + bEnable = true; if ( volume >= MAXVOLUME || - !m_pSound->GetEnable() ) bEnable = FALSE; + !m_pSound->GetEnable() ) bEnable = false; SetEnable(WM_BUTTON4, bEnable); volume = m_pSound->GetMidiVolume(); - bEnable = TRUE; + bEnable = true; if ( volume == 0 || - !m_pSound->GetEnable() ) bEnable = FALSE; + !m_pSound->GetEnable() ) bEnable = false; SetEnable(WM_BUTTON5, bEnable); - bEnable = TRUE; + bEnable = true; if ( volume >= MAXVOLUME || - !m_pSound->GetEnable() ) bEnable = FALSE; + !m_pSound->GetEnable() ) bEnable = false; SetEnable(WM_BUTTON6, bEnable); if ( m_pMovie->GetEnable() ) @@ -1891,15 +1891,15 @@ BOOL CEvent::DrawButtons() } else { - SetEnable(WM_BUTTON7, FALSE); - SetEnable(WM_BUTTON8, FALSE); + SetEnable(WM_BUTTON7, false); + SetEnable(WM_BUTTON8, false); } - bEnable = TRUE; - if ( m_scrollSpeed == 0 ) bEnable = FALSE; + bEnable = true; + if ( m_scrollSpeed == 0 ) bEnable = false; SetEnable(WM_BUTTON9, bEnable); - bEnable = TRUE; - if ( m_scrollSpeed >= 3 ) bEnable = FALSE; + bEnable = true; + if ( m_scrollSpeed >= 3 ) bEnable = false; SetEnable(WM_BUTTON10, bEnable); } @@ -1920,11 +1920,11 @@ BOOL CEvent::DrawButtons() { if ( levels[i] < 0 ) { - m_jauges[i].SetHide(TRUE); + m_jauges[i].SetHide(true); } else { - m_jauges[i].SetHide(FALSE); + m_jauges[i].SetHide(false); m_jauges[i].SetLevel(levels[i]); m_jauges[i].SetType(types[i]); } @@ -2396,7 +2396,7 @@ BOOL CEvent::DrawButtons() DrawText(m_pPixmap, m_posToolTips, m_textToolTips); } - return TRUE; + return true; } // Retourne le lutin à utiliser à une position donnée. @@ -2404,7 +2404,7 @@ BOOL CEvent::DrawButtons() int CEvent::MousePosToSprite(POINT pos) { int sprite; - BOOL bUp=FALSE, bDown=FALSE, bLeft=FALSE, bRight=FALSE; + bool bUp=false, bDown=false, bLeft=false, bRight=false; sprite = SPRITE_POINTER; @@ -2424,22 +2424,22 @@ int CEvent::MousePosToSprite(POINT pos) { if ( pos.x <= 5 && pos.x >= -2 ) { - bLeft = TRUE; + bLeft = true; } if ( pos.x >= LXIMAGE-5 && pos.x <= LXIMAGE+2 ) { - bRight = TRUE; + bRight = true; } if ( pos.y <= 5 && pos.y >= -2 ) { - bUp = TRUE; + bUp = true; } if ( pos.y >= LYIMAGE-5 && pos.y <= LYIMAGE+2 ) { - bDown = TRUE; + bDown = true; } if ( bLeft ) sprite = SPRITE_ARROWL; @@ -2499,7 +2499,7 @@ void CEvent::MouseSprite(POINT pos) // Met ou enlève le sablier de la souris. -void CEvent::WaitMouse(BOOL bWait) +void CEvent::WaitMouse(bool bWait) { m_bWaitMouse = bWait; @@ -2517,7 +2517,7 @@ void CEvent::WaitMouse(BOOL bWait) // Cache ou montre la souris. -void CEvent::HideMouse(BOOL bHide) +void CEvent::HideMouse(bool bHide) { m_bHideMouse = bHide; @@ -2535,7 +2535,7 @@ void CEvent::HideMouse(BOOL bHide) // Traite les événements pour tous les boutons. -BOOL CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam) +bool CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam) { POINT pos, test; int i, lg, oldx, sound, res; @@ -2598,13 +2598,13 @@ BOOL CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam) if ( m_phase == WM_PHASE_PLAY ) { - m_bHiliInfoButton = FALSE; + m_bHiliInfoButton = false; if ( pos.x > m_posInfoButton.x+6 && pos.x < m_posInfoButton.x+DIMBUTTONX-6 && pos.y > m_posInfoButton.y+8 && pos.y < m_posInfoButton.y+DIMBUTTONY-8 ) { - m_bHiliInfoButton = TRUE; + m_bHiliInfoButton = true; if ( message == WM_LBUTTONDOWN || message == WM_RBUTTONDOWN ) @@ -2621,14 +2621,14 @@ BOOL CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam) } } - m_bHiliHelpButton = FALSE; + m_bHiliHelpButton = false; if ( m_posHelpButton.x != -1 && pos.x > m_posHelpButton.x && pos.x < m_posHelpButton.x+DIMBUTTONX && pos.y > m_posHelpButton.y && pos.y < m_posHelpButton.y+DIMBUTTONY ) { - m_bHiliHelpButton = TRUE; + m_bHiliHelpButton = true; if ( message == WM_LBUTTONDOWN || message == WM_RBUTTONDOWN ) @@ -2643,11 +2643,11 @@ BOOL CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam) if ( m_bInfoHelp ) { - ReadLibelle(GetWorld(), FALSE, TRUE); + ReadLibelle(GetWorld(), false, true); } else { - ReadLibelle(GetWorld()+2, FALSE, FALSE); + ReadLibelle(GetWorld()+2, false, false); } } } @@ -2658,12 +2658,12 @@ BOOL CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam) if ( message == WM_LBUTTONDOWN || message == WM_RBUTTONDOWN ) { - m_pDecor->HideTooltips(TRUE); // plus de tooltips pour décor + m_pDecor->HideTooltips(true); // plus de tooltips pour décor } if ( message == WM_LBUTTONUP || message == WM_RBUTTONUP ) { - m_pDecor->HideTooltips(FALSE); + m_pDecor->HideTooltips(false); } } @@ -2671,33 +2671,33 @@ BOOL CEvent::EventButtons(UINT message, WPARAM wParam, LPARAM lParam) i = 0; while ( table[m_index].buttons[i].message != 0 ) { - if ( m_buttons[i].TreatEvent(message, wParam, lParam) ) return TRUE; + if ( m_buttons[i].TreatEvent(message, wParam, lParam) ) return true; i ++; } if ( m_phase == WM_PHASE_PLAY ) { - if ( m_menu.TreatEvent(message, wParam, lParam) ) return TRUE; + if ( m_menu.TreatEvent(message, wParam, lParam) ) return true; } - return FALSE; + return false; } // Indique si la souris est sur un bouton. -BOOL CEvent::MouseOnButton(POINT pos) +bool CEvent::MouseOnButton(POINT pos) { int i; i = 0; while ( table[m_index].buttons[i].message != 0 ) { - if ( m_buttons[i].MouseOnButton(pos) ) return TRUE; + if ( m_buttons[i].MouseOnButton(pos) ) return true; i ++; } - return FALSE; + return false; } @@ -2743,18 +2743,18 @@ int CEvent::GetImageWorld() // Indique si l'aide est disponible. -BOOL CEvent::IsHelpHide() +bool CEvent::IsHelpHide() { - BOOL bHide = TRUE; + bool bHide = true; #if !_DEMO if ( m_bHelp || m_pDecor->GetTotalTime() > DEF_TIME_HELP ) { - bHide = FALSE; + bHide = false; } if ( m_bSchool || m_bPrivate ) { - bHide = TRUE; // pas d'aide pour les exercices + bHide = true; // pas d'aide pour les exercices } #endif return bHide; @@ -2762,19 +2762,19 @@ BOOL CEvent::IsHelpHide() // Change de phase. -BOOL CEvent::ChangePhase(UINT phase) +bool CEvent::ChangePhase(UINT phase) { int index, world, time, total, music, i, max; POINT totalDim, iconDim; char filename[MAX_PATH]; char* pButtonExist; - BOOL bEnable, bHide; + bool bEnable, bHide; Term* pTerm; if ( m_mouseType == MOUSETYPEGRA && m_bFullScreen ) { - ShowCursor(FALSE); // cache la vilaine souris Windows - m_bShowMouse = FALSE; + ShowCursor(false); // cache la vilaine souris Windows + m_bShowMouse = false; } if ( phase != WM_PHASE_SETUPp && @@ -2790,16 +2790,16 @@ BOOL CEvent::ChangePhase(UINT phase) m_textToolTips[0] = 0; m_posToolTips.x = -1; - m_bPause = FALSE; - m_bCtrlDown = FALSE; - m_bMouseDown = FALSE; + m_bPause = false; + m_bCtrlDown = false; + m_bMouseDown = false; m_debugPos.x = 0; m_debugPos.y = 0; - m_pDecor->SetInfoMode(FALSE); - m_bInfoHelp = FALSE; - m_bHiliInfoButton = FALSE; - m_bHiliHelpButton = FALSE; + m_pDecor->SetInfoMode(false); + m_bInfoHelp = false; + m_bHiliInfoButton = false; + m_bHiliHelpButton = false; if ( phase == WM_PHASE_INTRO1 || phase == WM_PHASE_INTRO2 ) @@ -2826,21 +2826,21 @@ BOOL CEvent::ChangePhase(UINT phase) m_pDecor->UndoClose(); // libère le buffer undo index = SearchPhase(phase); - if ( index < 0 ) return FALSE; + if ( index < 0 ) return false; - HideMouse(FALSE); // montre la souris - WaitMouse(TRUE); // met le sablier + HideMouse(false); // montre la souris + WaitMouse(true); // met le sablier if ( m_bBuildModify ) { m_pDecor->InitAfterBuild(); - m_bBuildModify = FALSE; + m_bBuildModify = false; } if ( m_phase == WM_PHASE_BUILD && phase == WM_PHASE_INFO ) // quitte construction ? { - m_pDecor->Write(GetPhysicalWorld(), FALSE, + m_pDecor->Write(GetPhysicalWorld(), false, GetPhysicalWorld(), 0, 0); // écrit le monde } @@ -2860,9 +2860,9 @@ BOOL CEvent::ChangePhase(UINT phase) totalDim.y = LYIMAGE; iconDim.x = 0; iconDim.y = 0; - if ( !m_pPixmap->Cache(CHBACK, filename, totalDim, iconDim, FALSE) ) + if ( !m_pPixmap->Cache(CHBACK, filename, totalDim, iconDim, false) ) { - WaitMouse(FALSE); // enlève le sablier + WaitMouse(false); // enlève le sablier m_tryInsertCount = 40; m_tryPhase = m_phase; return ChangePhase(WM_PHASE_INSERT); // insérez le CD-Rom ... @@ -2874,7 +2874,7 @@ BOOL CEvent::ChangePhase(UINT phase) { for ( i=0 ; i<10 ; i++ ) { - if ( m_pDecor->FileExist(i, TRUE, world, time, total) ) + if ( m_pDecor->FileExist(i, true, world, time, total) ) { m_fileWorld[i] = world; m_fileTime[i] = time; @@ -2890,7 +2890,7 @@ BOOL CEvent::ChangePhase(UINT phase) m_phase == WM_PHASE_HISTORY0 || m_phase == WM_PHASE_HISTORY1 ) { - if ( !m_pDecor->Read(GetPhysicalWorld(), FALSE, + if ( !m_pDecor->Read(GetPhysicalWorld(), false, world, time, total) && // lit le monde !m_bAccessBuild && !m_bPrivate ) @@ -2901,8 +2901,8 @@ BOOL CEvent::ChangePhase(UINT phase) } m_pDecor->SetTime(0); m_pDecor->SetTotalTime(0); - m_pDecor->SetInvincible(FALSE); - m_pDecor->SetSuper(FALSE); + m_pDecor->SetInvincible(false); + m_pDecor->SetSuper(false); } if ( m_phase == WM_PHASE_INFO || @@ -2920,28 +2920,28 @@ BOOL CEvent::ChangePhase(UINT phase) { if ( m_bSchool ) { - ReadLibelle(GetWorld(), m_bSchool, FALSE); + ReadLibelle(GetWorld(), m_bSchool, false); } else { - ReadLibelle(GetWorld()+2, m_bSchool, FALSE); + ReadLibelle(GetWorld()+2, m_bSchool, false); } } else if ( m_phase == WM_PHASE_HELP ) { - ReadLibelle(GetWorld(), FALSE, TRUE); + ReadLibelle(GetWorld(), false, true); } else { if ( m_phase == WM_PHASE_HISTORY0 ) world = 0; else world = 1; - ReadLibelle(world, FALSE, FALSE); + ReadLibelle(world, false, false); } } if ( m_phase == WM_PHASE_TESTCD ) { - if ( m_pDecor->Read(0, FALSE, world, time, total) ) // lit un monde + if ( m_pDecor->Read(0, false, world, time, total) ) // lit un monde { return ChangePhase(WM_PHASE_INIT); // ok } @@ -2953,29 +2953,29 @@ BOOL CEvent::ChangePhase(UINT phase) } } - m_jauges[0].SetHide(TRUE); // cache les jauges - m_jauges[1].SetHide(TRUE); + m_jauges[0].SetHide(true); // cache les jauges + m_jauges[1].SetHide(true); CreateButtons(); // crée les boutons selon la phase - m_bMenu = FALSE; - m_pDecor->HideTooltips(FALSE); + m_bMenu = false; + m_pDecor->HideTooltips(false); m_menu.Delete(); - m_pDecor->BlupiSetArrow(0, FALSE); // enlève toutes les flèches + m_pDecor->BlupiSetArrow(0, false); // enlève toutes les flèches m_pDecor->ResetHili(); // enlève les mises en évidence if ( m_phase == WM_PHASE_PLAY ) { m_pDecor->LoadImages(); - m_pDecor->SetBuild(FALSE); - m_pDecor->EnableFog(TRUE); + m_pDecor->SetBuild(false); + m_pDecor->EnableFog(true); m_pDecor->NextPhase(0); // refait la carte tout de suite m_pDecor->StatisticInit(); m_pDecor->TerminatedInit(); - m_bChangeCheat = TRUE; // affiche les cheat-codes + m_bChangeCheat = true; // affiche les cheat-codes } if ( m_phase == WM_PHASE_BUILD ) { - m_bBuildModify = TRUE; + m_bBuildModify = true; SetState(WM_DECOR1, 1); SetMenu(WM_DECOR1, 0); // herbe SetMenu(WM_DECOR2, 2); // arbre @@ -2983,49 +2983,49 @@ BOOL CEvent::ChangePhase(UINT phase) SetMenu(WM_DECOR4, 2); // blupi fort SetMenu(WM_DECOR5, 1); // feu m_pDecor->LoadImages(); - m_pDecor->SetBuild(TRUE); - m_pDecor->EnableFog(FALSE); + m_pDecor->SetBuild(true); + m_pDecor->EnableFog(false); m_pDecor->BlupiDeselect(); m_pDecor->NextPhase(0); // refait la carte tout de suite } if ( m_phase == WM_PHASE_INFO ) { - bEnable = TRUE; + bEnable = true; if ( GetWorld() == 0 ) { - bEnable = FALSE; + bEnable = false; } SetEnable(WM_PREV, bEnable); - bEnable = TRUE; + bEnable = true; if ( m_bAllMissions ) max = 99; else max = m_maxMission; if ( !m_bSchool && GetWorld() >= max ) { - bEnable = FALSE; + bEnable = false; } - if ( !m_pDecor->FileExist(GetPhysicalWorld()+1, FALSE, + if ( !m_pDecor->FileExist(GetPhysicalWorld()+1, false, world, time, total) ) { - bEnable = FALSE; + bEnable = false; } #if !_DEMO if ( m_bAccessBuild || m_pDecor->GetTotalTime() > DEF_TIME_HELP*6 ) { - bEnable = TRUE; + bEnable = true; } #endif if ( GetWorld() >= 99 ) { - bEnable = FALSE; + bEnable = false; } #if _DEMO if ( GetWorld() >= 4-1 ) { - bEnable = FALSE; + bEnable = false; } #endif if ( m_bPrivate ) @@ -3034,18 +3034,18 @@ BOOL CEvent::ChangePhase(UINT phase) } SetEnable(WM_NEXT, bEnable); - bHide = TRUE; + bHide = true; if ( m_bAccessBuild || m_bPrivate ) { - bHide = FALSE; + bHide = false; } SetHide(WM_PHASE_BUILD, bHide); #if !_DEMO if ( m_bSchool ) { - SetHide(WM_PHASE_SKILL1, TRUE); - SetHide(WM_PHASE_SKILL2, TRUE); + SetHide(WM_PHASE_SKILL1, true); + SetHide(WM_PHASE_SKILL2, true); } else { @@ -3066,7 +3066,7 @@ BOOL CEvent::ChangePhase(UINT phase) { if ( m_fileWorld[i] == -1 ) { - SetEnable(WM_READ0+i, FALSE); + SetEnable(WM_READ0+i, false); } } } @@ -3169,16 +3169,16 @@ BOOL CEvent::ChangePhase(UINT phase) if ( !m_bPrivate && m_pDecor->FileExist(GetPhysicalWorld(), - FALSE, world, time, total) && + false, world, time, total) && !m_pDecor->FileExist(GetPhysicalWorld()+1, - FALSE, world, time, total) ) + false, world, time, total) ) { m_phaseAfterMovie = WM_PHASE_LASTWIN; } } - WaitMouse(FALSE); // enlève le sablier - return TRUE; + WaitMouse(false); // enlève le sablier + return true; } // Retourne la phase en cours. @@ -3208,7 +3208,7 @@ void CEvent::MovieToStart() { if ( m_movieToStart[0] != 0 ) // y a-t-il un film à démarrer ? { - HideMouse(TRUE); // cache la souris + HideMouse(true); // cache la souris if ( StartMovie(m_movieToStart) ) { @@ -3249,7 +3249,7 @@ void CEvent::DecorAutoShift(POINT pos) int max; POINT offset; - m_bShift = FALSE; + m_bShift = false; if ( !m_bFullScreen || m_bDemoRec || @@ -3344,7 +3344,7 @@ void CEvent::DecorAutoShift(POINT pos) if ( m_shiftPhase > 0 ) { - m_bShift = TRUE; + m_bShift = true; m_shiftPhase --; offset.x = m_shiftOffset.x*(max-m_shiftPhase)*(DIMCELX/2/max); @@ -3364,7 +3364,7 @@ void CEvent::DecorAutoShift(POINT pos) // Indique su un shift est en cours. -BOOL CEvent::IsShift() +bool CEvent::IsShift() { return m_bShift; } @@ -3372,24 +3372,24 @@ BOOL CEvent::IsShift() // Modifie le décor lorsque le bouton de la souris est pressé. -BOOL CEvent::PlayDown(POINT pos, int fwKeys) +bool CEvent::PlayDown(POINT pos, int fwKeys) { - BOOL bDecor = FALSE; - BOOL bMap = FALSE; + bool bDecor = false; + bool bMap = false; int rank, button, h; POINT cel; - m_pDecor->BlupiSetArrow(0, FALSE); // enlève toutes les flèches + m_pDecor->BlupiSetArrow(0, false); // enlève toutes les flèches - m_bMouseDown = FALSE; + m_bMouseDown = false; if ( m_bMenu ) { m_menu.Message(); - m_bMenu = FALSE; - m_pDecor->HideTooltips(FALSE); + m_bMenu = false; + m_pDecor->HideTooltips(false); m_menu.Delete(); - return TRUE; + return true; } m_pDecor->StatisticDown(pos, fwKeys); @@ -3397,18 +3397,18 @@ BOOL CEvent::PlayDown(POINT pos, int fwKeys) if ( pos.x >= POSMAPX && pos.x <= POSMAPX+DIMMAPX && pos.y >= POSMAPY && pos.y <= POSMAPY+DIMMAPY ) { - bMap = TRUE; + bMap = true; } h = m_pDecor->GetInfoHeight()+POSDRAWY; if ( pos.x >= POSDRAWX && pos.x <= POSDRAWX+DIMDRAWX && pos.y >= h && pos.y <= h +DIMDRAWY ) { - bDecor = TRUE; + bDecor = true; } - if ( !bDecor && !bMap ) return FALSE; + if ( !bDecor && !bMap ) return false; - cel = m_pDecor->ConvPosToCel(pos, TRUE); + cel = m_pDecor->ConvPosToCel(pos, true); if ( fwKeys&MK_RBUTTON ) { if ( bMap ) @@ -3420,46 +3420,46 @@ BOOL CEvent::PlayDown(POINT pos, int fwKeys) button = m_pDecor->GetDefButton(cel); } m_pDecor->BlupiGoal(cel, button); - return TRUE; + return true; } if ( bMap ) { - m_pDecor->SetCoin(cel, TRUE); + m_pDecor->SetCoin(cel, true); m_pDecor->NextPhase(0); // faudra refaire la carte tout de suite - return TRUE; + return true; } rank = m_pDecor->GetTargetBlupi(pos); if ( rank >= 0 && !m_pDecor->IsWorkBlupi(rank) ) { - m_bHili = TRUE; - m_bMouseDown = TRUE; - m_pDecor->BlupiHiliDown(pos, fwKeys&MK_SHIFT); + m_bHili = true; + m_bMouseDown = true; + m_pDecor->BlupiHiliDown(pos, !!(fwKeys & MK_SHIFT)); } else { - m_bHili = FALSE; - m_bMouseDown = TRUE; + m_bHili = false; + m_bMouseDown = true; } - return TRUE; + return true; } // Modifie le décor lorsque la souris est déplacée. -BOOL CEvent::PlayMove(POINT pos, int fwKeys) +bool CEvent::PlayMove(POINT pos, int fwKeys) { if ( m_bMenu ) { if ( !m_menu.IsExist() ) { - m_bMenu = FALSE; - m_pDecor->HideTooltips(FALSE); + m_bMenu = false; + m_pDecor->HideTooltips(false); m_menu.Delete(); } - return TRUE; + return true; } m_pDecor->StatisticMove(pos, fwKeys); @@ -3468,7 +3468,7 @@ BOOL CEvent::PlayMove(POINT pos, int fwKeys) { if ( m_bHili ) { - m_pDecor->BlupiHiliMove(pos, fwKeys&MK_SHIFT); + m_pDecor->BlupiHiliMove(pos, !!(fwKeys & MK_SHIFT)); } else { @@ -3480,12 +3480,12 @@ BOOL CEvent::PlayMove(POINT pos, int fwKeys) m_pDecor->CelHili(pos, 0); } - return TRUE; + return true; } // Modifie le décor lorsque le bouton de la souris est relâché. -BOOL CEvent::PlayUp(POINT pos, int fwKeys) +bool CEvent::PlayUp(POINT pos, int fwKeys) { static int table_sound_boing[3] = { @@ -3500,7 +3500,7 @@ BOOL CEvent::PlayUp(POINT pos, int fwKeys) { if ( m_bHili ) { - m_pDecor->BlupiHiliUp(pos, fwKeys&MK_SHIFT); + m_pDecor->BlupiHiliUp(pos, !!(fwKeys & MK_SHIFT)); } else { @@ -3517,15 +3517,15 @@ BOOL CEvent::PlayUp(POINT pos, int fwKeys) m_menu.Create(m_hWnd, m_pPixmap, m_pSound, pos, m_menuNb, m_menuButtons, m_menuErrors, m_menuPerso); - m_bMenu = TRUE; - m_pDecor->HideTooltips(TRUE); // plus de tooltips pour décor + m_bMenu = true; + m_pDecor->HideTooltips(true); // plus de tooltips pour décor } } } - m_bMouseDown = FALSE; + m_bMouseDown = false; - return TRUE; + return true; } @@ -3554,8 +3554,8 @@ void CEvent::ChangeButtons(int message) SetState(message, state); // pressé <-> relâché pButtonExist[message-WM_BUTTON0] = state; - pButtonExist[BUTTON_DJEEP] = TRUE; - pButtonExist[BUTTON_DARMURE] = TRUE; + pButtonExist[BUTTON_DJEEP] = true; + pButtonExist[BUTTON_DARMURE] = true; } if ( m_phase == WM_PHASE_TERM ) @@ -3675,11 +3675,11 @@ void CEvent::ChangeButtons(int message) if ( message == WM_BUTTON7 ) { - m_bMovie = FALSE; + m_bMovie = false; } if ( message == WM_BUTTON8 ) { - m_bMovie = TRUE; + m_bMovie = true; } if ( message == WM_BUTTON9 ) @@ -3808,15 +3808,15 @@ static int tableHome[] = // Modifie le décor lorsque le bouton de la souris est pressé. -BOOL CEvent::BuildDown(POINT pos, int fwKeys, BOOL bMix) +bool CEvent::BuildDown(POINT pos, int fwKeys, bool bMix) { POINT cel; int menu, channel, icon; - if ( bMix && m_pDecor->MapMove(pos) ) return TRUE; + if ( bMix && m_pDecor->MapMove(pos) ) return true; if ( pos.x < POSDRAWX || pos.x > POSDRAWX+DIMDRAWX || - pos.y < POSDRAWY || pos.y > POSDRAWY+DIMDRAWY ) return FALSE; + pos.y < POSDRAWY || pos.y > POSDRAWY+DIMDRAWY ) return false; if ( bMix ) { @@ -3828,7 +3828,7 @@ BOOL CEvent::BuildDown(POINT pos, int fwKeys, BOOL bMix) cel = m_pDecor->ConvPosToCel2(pos); menu = GetMenu(WM_DECOR1); - if ( !m_pDecor->GetFloor(cel, channel, icon) ) return FALSE; + if ( !m_pDecor->GetFloor(cel, channel, icon) ) return false; if ( bMix && tableFloor[menu*10+m_lastFloor[menu]] == icon ) { @@ -3841,9 +3841,9 @@ BOOL CEvent::BuildDown(POINT pos, int fwKeys, BOOL bMix) if ( fwKeys & MK_CONTROL ) // touche Ctrl enfoncée ? { - WaitMouse(TRUE); - m_pDecor->ArrangeFill(cel, CHFLOOR, tableFloor[menu*10+m_lastFloor[menu]], TRUE); - WaitMouse(FALSE); + WaitMouse(true); + m_pDecor->ArrangeFill(cel, CHFLOOR, tableFloor[menu*10+m_lastFloor[menu]], true); + WaitMouse(false); } else { @@ -3862,7 +3862,7 @@ BOOL CEvent::BuildDown(POINT pos, int fwKeys, BOOL bMix) cel = m_pDecor->ConvPosToCel2(pos); menu = GetMenu(WM_DECOR2); - if ( !m_pDecor->GetObject(cel, channel, icon) ) return FALSE; + if ( !m_pDecor->GetObject(cel, channel, icon) ) return false; if ( bMix && tableObject[menu*10+m_lastObject[menu]] == icon ) { @@ -3875,9 +3875,9 @@ BOOL CEvent::BuildDown(POINT pos, int fwKeys, BOOL bMix) if ( fwKeys & MK_CONTROL ) // touche Ctrl enfoncée ? { - WaitMouse(TRUE); - m_pDecor->ArrangeFill(cel, CHOBJECT, tableObject[menu*10+m_lastObject[menu]], FALSE); - WaitMouse(FALSE); + WaitMouse(true); + m_pDecor->ArrangeFill(cel, CHOBJECT, tableObject[menu*10+m_lastObject[menu]], false); + WaitMouse(false); } else { @@ -3893,7 +3893,7 @@ BOOL CEvent::BuildDown(POINT pos, int fwKeys, BOOL bMix) cel = m_pDecor->ConvPosToCel2(pos); menu = GetMenu(WM_DECOR3); - if ( !m_pDecor->GetObject(cel, channel, icon) ) return FALSE; + if ( !m_pDecor->GetObject(cel, channel, icon) ) return false; if ( bMix && tableHome[menu*10+m_lastHome[menu]] == icon ) { @@ -3906,9 +3906,9 @@ BOOL CEvent::BuildDown(POINT pos, int fwKeys, BOOL bMix) if ( fwKeys & MK_CONTROL ) // touche Ctrl enfoncée ? { - WaitMouse(TRUE); - m_pDecor->ArrangeFill(cel, CHOBJECT, tableHome[menu*10+m_lastHome[menu]], FALSE); - WaitMouse(FALSE); + WaitMouse(true); + m_pDecor->ArrangeFill(cel, CHOBJECT, tableHome[menu*10+m_lastHome[menu]], false); + WaitMouse(false); } else { @@ -3973,26 +3973,26 @@ BOOL CEvent::BuildDown(POINT pos, int fwKeys, BOOL bMix) if ( menu == 0 ) // supprime ? { - m_pDecor->SetFire(cel, FALSE); + m_pDecor->SetFire(cel, false); } if ( menu == 1 ) // ajoute ? { - m_pDecor->SetFire(cel, TRUE); + m_pDecor->SetFire(cel, true); } } m_pDecor->ArrangeBlupi(); // supprime les blupi bloqués - return TRUE; + return true; } // Modifie le décor lorsque la souris est déplacée. -BOOL CEvent::BuildMove(POINT pos, int fwKeys) +bool CEvent::BuildMove(POINT pos, int fwKeys) { if ( fwKeys & MK_LBUTTON ) // bouton souris pressé ? { - BuildDown(pos, fwKeys, FALSE); + BuildDown(pos, fwKeys, false); } if ( GetState(WM_DECOR4) == 1 ) // pose d'un blupi @@ -4004,28 +4004,28 @@ BOOL CEvent::BuildMove(POINT pos, int fwKeys) m_pDecor->CelHili(pos, 2); } - return TRUE; + return true; } // Modifie le décor lorsque le bouton de la souris est relâché. -BOOL CEvent::BuildUp(POINT pos, int fwKeys) +bool CEvent::BuildUp(POINT pos, int fwKeys) { - return TRUE; + return true; } // Démarre un film non interractif. -BOOL CEvent::StartMovie(char *pFilename) +bool CEvent::StartMovie(char *pFilename) { RECT rect; char filename[MAX_PATH]; - if ( !m_pMovie->GetEnable() ) return FALSE; - if ( !m_bMovie ) return FALSE; + if ( !m_pMovie->GetEnable() ) return false; + if ( !m_bMovie ) return false; - if ( !m_pMovie->IsExist(pFilename) ) return FALSE; + if ( !m_pMovie->IsExist(pFilename) ) return false; rect.left = 1; // mystère: plante avec 0,0,LXIMAGE,LYIMAGE !!! rect.top = 1; @@ -4039,10 +4039,10 @@ BOOL CEvent::StartMovie(char *pFilename) strcpy(filename+strlen(filename)-4, ".blp"); // remplace .avi par .blp m_pSound->Cache(SOUND_MOVIE, filename); - if ( !m_pMovie->Play(m_hWnd, rect, pFilename) ) return FALSE; - m_bRunMovie = TRUE; + if ( !m_pMovie->Play(m_hWnd, rect, pFilename) ) return false; + m_bRunMovie = true; m_pSound->Play(SOUND_MOVIE, 0, 0); - return TRUE; + return true; } // Stoppe un film non interractif. @@ -4055,12 +4055,12 @@ void CEvent::StopMovie() m_pSound->Flush(SOUND_MOVIE); // m_pSound->RestartMusic(); ChangePhase(m_phase); - m_bRunMovie = FALSE; + m_bRunMovie = false; } // Indique s'il y a un film en cours. -BOOL CEvent::IsMovie() +bool CEvent::IsMovie() { return m_bRunMovie; } @@ -4072,27 +4072,27 @@ void CEvent::Read(int message) { int world, time, total; - m_pDecor->Read(message-WM_READ0, TRUE, world, time, total); + m_pDecor->Read(message-WM_READ0, true, world, time, total); m_pDecor->SetTime(time); m_pDecor->SetTotalTime(total); if ( world >= 200 ) { m_private = world-200; - m_bSchool = FALSE; - m_bPrivate = TRUE; + m_bSchool = false; + m_bPrivate = true; } else if ( world >= 100 ) { m_mission = world-100; - m_bSchool = FALSE; - m_bPrivate = FALSE; + m_bSchool = false; + m_bPrivate = false; } else { m_exercice = world; - m_bSchool = TRUE; - m_bPrivate = FALSE; + m_bSchool = true; + m_bPrivate = false; } } @@ -4105,7 +4105,7 @@ void CEvent::Write(int message) time = m_pDecor->GetTime(); total = m_pDecor->GetTotalTime(); - m_pDecor->Write(message-WM_WRITE0, TRUE, + m_pDecor->Write(message-WM_WRITE0, true, GetPhysicalWorld(), time, total); } @@ -4128,42 +4128,42 @@ void CEvent::PrivateLibelle() res = 0; if ( term.bKillRobots ) { - term.bKillRobots = FALSE; + term.bKillRobots = false; res = TX_PRIVATE_KILLROBOTS; } else if ( term.bHachBlupi ) { - term.bHachBlupi = FALSE; + term.bHachBlupi = false; res = TX_PRIVATE_HACHBLUPI; } else if ( term.bHachPlanche ) { - term.bHachPlanche = FALSE; + term.bHachPlanche = false; res = TX_PRIVATE_HACHPLANCHE; } else if ( term.bHachTomate ) { - term.bHachTomate = FALSE; + term.bHachTomate = false; res = TX_PRIVATE_HACHTOMATE; } else if ( term.bHachMetal ) { - term.bHachMetal = FALSE; + term.bHachMetal = false; res = TX_PRIVATE_HACHMETAL; } else if ( term.bHachRobot ) { - term.bHachRobot = FALSE; + term.bHachRobot = false; res = TX_PRIVATE_HACHROBOT; } else if ( term.bHomeBlupi ) { - term.bHomeBlupi = FALSE; + term.bHomeBlupi = false; res = TX_PRIVATE_HOMEBLUPI; } else if ( term.bStopFire ) { - term.bStopFire = FALSE; + term.bStopFire = false; res = TX_PRIVATE_STOPFIRE; } if ( res == 0 ) break; @@ -4190,7 +4190,7 @@ void CEvent::PrivateLibelle() // Lit le libellé d'un monde. -BOOL CEvent::ReadLibelle(int world, BOOL bSchool, BOOL bHelp) +bool CEvent::ReadLibelle(int world, bool bSchool, bool bHelp) { FILE* file = NULL; char* pBuffer = NULL; @@ -4243,18 +4243,18 @@ BOOL CEvent::ReadLibelle(int world, BOOL bSchool, BOOL bHelp) free(pBuffer); fclose(file); - return TRUE; + return true; error: if ( pBuffer != NULL ) free(pBuffer); if ( file != NULL ) fclose(file); - return FALSE; + return false; } // Sauve les informations sur disque. -BOOL CEvent::WriteInfo() +bool CEvent::WriteInfo() { char filename[MAX_PATH]; FILE* file = NULL; @@ -4287,16 +4287,16 @@ BOOL CEvent::WriteInfo() if ( nb < 1 ) goto error; fclose(file); - return TRUE; + return true; error: if ( file != NULL ) fclose(file); - return FALSE; + return false; } // Lit les informations sur disque. -BOOL CEvent::ReadInfo() +bool CEvent::ReadInfo() { char filename[MAX_PATH]; FILE* file = NULL; @@ -4317,9 +4317,9 @@ BOOL CEvent::ReadInfo() m_mission = info.mission; m_maxMission = info.maxMission; m_speed = info.speed; - m_bMovie = info.bMovie; + m_bMovie = !!info.bMovie; m_scrollSpeed = info.scrollSpeed; - m_bAccessBuild = info.bAccessBuild; + m_bAccessBuild = !!info.bAccessBuild; m_pDecor->SetSkill(info.skill); @@ -4327,11 +4327,11 @@ BOOL CEvent::ReadInfo() m_pSound->SetMidiVolume(info.midiVolume); fclose(file); - return TRUE; + return true; error: if ( file != NULL ) fclose(file); - return FALSE; + return false; } @@ -4354,7 +4354,7 @@ int CEvent::GetSpeed() return m_speed; } -BOOL CEvent::GetPause() +bool CEvent::GetPause() { return m_bPause; } @@ -4370,8 +4370,8 @@ void CEvent::DemoRecStart() m_demoTime = 0; m_demoIndex = 0; - m_bDemoRec = TRUE; - m_bDemoPlay = FALSE; + m_bDemoRec = true; + m_bDemoPlay = false; InitRandom(); m_pDecor->SetTime(0); @@ -4409,14 +4409,14 @@ void CEvent::DemoRecStop() m_pDemoBuffer = NULL; } - m_bDemoRec = FALSE; + m_bDemoRec = false; m_demoTime = 0; } // Début de la reproduction d'une démo. // Lit le fichier sur disque. -BOOL CEvent::DemoPlayStart() +bool CEvent::DemoPlayStart() { char filename[MAX_PATH]; FILE* file = NULL; @@ -4424,7 +4424,7 @@ BOOL CEvent::DemoPlayStart() int nb, world, time, total; m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO*sizeof(DemoEvent)); - if ( m_pDemoBuffer == NULL ) return FALSE; + if ( m_pDemoBuffer == NULL ) return false; memset(m_pDemoBuffer, 0, MAXDEMO*sizeof(DemoEvent)); sprintf(filename, "data\\demo%.3d.blp", m_demoNumber); @@ -4433,17 +4433,17 @@ BOOL CEvent::DemoPlayStart() if ( file == NULL ) { DemoPlayStop(); - return FALSE; + return false; } nb = fread(&header, sizeof(DemoHeader), 1, file); if ( nb < 1 ) { DemoPlayStop(); - return FALSE; + return false; } - m_bSchool = header.bSchool; - m_bPrivate = header.bPrivate; + m_bSchool = !!header.bSchool; + m_bPrivate = !!header.bPrivate; m_pDecor->SetSkill(header.skill); m_demoEnd = fread(m_pDemoBuffer, sizeof(DemoEvent), MAXDEMO, file); @@ -4451,20 +4451,20 @@ BOOL CEvent::DemoPlayStart() m_demoTime = 0; m_demoIndex = 0; - m_bDemoPlay = TRUE; - m_bDemoRec = FALSE; + m_bDemoPlay = true; + m_bDemoRec = false; - if ( !m_pDecor->Read(header.world, FALSE, world, time, total) ) + if ( !m_pDecor->Read(header.world, false, world, time, total) ) { DemoPlayStop(); - return FALSE; + return false; } ChangePhase(WM_PHASE_PLAY); InitRandom(); m_pDecor->SetTime(0); m_speed = 1; - return TRUE; + return true; } // Fin de la reproduction d'une démo. @@ -4476,8 +4476,8 @@ void CEvent::DemoPlayStop() free(m_pDemoBuffer); m_pDemoBuffer = NULL; } - m_bDemoPlay = FALSE; - m_bDemoRec = FALSE; + m_bDemoPlay = false; + m_bDemoRec = false; m_demoTime = 0; ChangePhase(WM_PHASE_INIT); @@ -4505,7 +4505,7 @@ void CEvent::DemoStep() if ( m_bDemoPlay && // démo en lecture ? m_pDemoBuffer != NULL ) { - while ( TRUE ) + while ( true ) { time = m_pDemoBuffer[m_demoIndex].time; if ( time > m_demoTime ) break; @@ -4588,7 +4588,7 @@ POINT CEvent::GetLastMousePos() // Traitement d'un événement. -BOOL CEvent::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam) +bool CEvent::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam) { if ( m_bDemoPlay ) // démo en lecture ? { @@ -4600,11 +4600,11 @@ BOOL CEvent::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam) message == WM_RBUTTONUP ) { DemoPlayStop(); - return TRUE; + return true; } if ( message == WM_MOUSEMOVE ) // l'utilisateur bouge ? { - return TRUE; + return true; } } @@ -4613,13 +4613,13 @@ BOOL CEvent::TreatEvent(UINT message, WPARAM wParam, LPARAM lParam) // Traitement d'un événement. -BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) +bool CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) { POINT pos; int fwKeys; int i, sound; char c; - BOOL bEnable; + bool bEnable; pos = ConvLongToPos(lParam); fwKeys = wParam; @@ -4652,12 +4652,12 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_posCheat ++; if ( cheat_code[m_rankCheat][m_posCheat] == 0 ) { - bEnable = TRUE; + bEnable = true; if ( m_phase == WM_PHASE_PLAY ) { if ( m_rankCheat == 0 ) // vision ? { - m_pDecor->EnableFog(FALSE); + m_pDecor->EnableFog(false); } if ( m_rankCheat == 1 || // power ? m_rankCheat == 2 ) // lonesome ? @@ -4670,20 +4670,20 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) { m_bAllMissions = !m_bAllMissions; bEnable = m_bAllMissions; - m_bChangeCheat = TRUE; + m_bChangeCheat = true; } if ( m_rankCheat == 4 ) // quick ? { m_bSpeed = !m_bSpeed; bEnable = m_bSpeed; - m_bChangeCheat = TRUE; + m_bChangeCheat = true; } #if !_DEMO if ( m_rankCheat == 5 ) // helpme ? { m_bHelp = !m_bHelp; bEnable = m_bHelp; - m_bChangeCheat = TRUE; + m_bChangeCheat = true; } #endif @@ -4691,14 +4691,14 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) { m_pDecor->SetInvincible(!m_pDecor->GetInvincible()); bEnable = m_pDecor->GetInvincible(); - m_bChangeCheat = TRUE; + m_bChangeCheat = true; } if ( m_rankCheat == 7 ) // superblupi ? { m_pDecor->SetSuper(!m_pDecor->GetSuper()); bEnable = m_pDecor->GetSuper(); - m_bChangeCheat = TRUE; + m_bChangeCheat = true; } #if !_DEMO @@ -4706,7 +4706,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) { m_bAccessBuild = !m_bAccessBuild; bEnable = m_bAccessBuild; - m_bChangeCheat = TRUE; + m_bChangeCheat = true; } #endif @@ -4729,7 +4729,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_rankCheat = -1; m_posCheat = 0; } - return TRUE; + return true; } } } @@ -4739,13 +4739,13 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) if ( m_phase == WM_PHASE_INTRO1 ) { ChangePhase(WM_PHASE_INTRO2); - return TRUE; + return true; } if ( m_phase == WM_PHASE_INTRO2 ) { ChangePhase(WM_PHASE_INIT); - return TRUE; + return true; } if ( m_phase == WM_PHASE_BYE ) @@ -4757,13 +4757,13 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) { case VK_END: DemoRecStop(); - return TRUE; + return true; case VK_ESCAPE: if ( m_bRunMovie ) { StopMovie(); m_pSound->SetSuspendSkip(1); - return TRUE; + return true; } if ( m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_SETUP || @@ -4774,19 +4774,19 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_phase == WM_PHASE_HELP ) { ChangePhase(WM_PHASE_STOP); - return TRUE; + return true; } if ( m_phase == WM_PHASE_STOP || m_phase == WM_PHASE_LOST || m_phase == WM_PHASE_BUILD ) { ChangePhase(WM_PHASE_INFO); - return TRUE; + return true; } if ( m_phase == WM_PHASE_INFO ) { ChangePhase(WM_PHASE_INIT); - return TRUE; + return true; } if ( m_phase == WM_PHASE_BUTTON || m_phase == WM_PHASE_TERM || @@ -4794,19 +4794,19 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_phase == WM_PHASE_REGION ) { ChangePhase(WM_PHASE_BUILD); - return TRUE; + return true; } if ( m_phase == WM_PHASE_INIT ) { ChangePhase(WM_PHASE_BYE); - return TRUE; + return true; } if ( m_phase == WM_PHASE_BYE ) { PostMessage(m_hWnd, WM_CLOSE, 0, 0); break; } - return TRUE; + return true; case VK_RETURN: if ( m_phase == WM_PHASE_PLAY || m_phase == WM_PHASE_READ || @@ -4814,14 +4814,14 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_phase == WM_PHASE_SETUP ) { ChangePhase(WM_PHASE_STOP); - return TRUE; + return true; } if ( m_phase == WM_PHASE_INIT || m_phase == WM_PHASE_LOST || m_phase == WM_PHASE_BUILD ) { ChangePhase(WM_PHASE_INFO); - return TRUE; + return true; } if ( m_phase == WM_PHASE_INFO || m_phase == WM_PHASE_STOP || @@ -4830,7 +4830,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_phase == WM_PHASE_WRITEp ) { ChangePhase(WM_PHASE_PLAY); - return TRUE; + return true; } if ( m_phase == WM_PHASE_BUTTON || m_phase == WM_PHASE_TERM || @@ -4838,38 +4838,38 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_phase == WM_PHASE_REGION ) { ChangePhase(WM_PHASE_BUILD); - return TRUE; + return true; } - return TRUE; + return true; case VK_LEFT: //? DecorShift(-4,4); DecorShift(-2,2); - return TRUE; + return true; case VK_RIGHT: //? DecorShift(4,-4); DecorShift(2,-2); - return TRUE; + return true; case VK_UP: //? DecorShift(-6,-6); DecorShift(-3,-3); - return TRUE; + return true; case VK_DOWN: //? DecorShift(6,6); DecorShift(3,3); - return TRUE; + return true; case VK_HOME: pos = m_pDecor->GetHome(); m_pDecor->SetCoin(pos); - return TRUE; + return true; case VK_SPACE: if ( m_bRunMovie ) { StopMovie(); m_pSound->SetSuspendSkip(1); - return TRUE; + return true; } m_pDecor->FlipOutline(); - return TRUE; + return true; case VK_PAUSE: m_bPause = !m_bPause; if ( m_phase == WM_PHASE_PLAY ) @@ -4883,19 +4883,19 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_pSound->RestartMusic(); } } - return TRUE; + return true; case VK_CONTROL: - m_bCtrlDown = TRUE; + m_bCtrlDown = true; if ( m_phase == WM_PHASE_BUILD ) { - m_bFillMouse = TRUE; + m_bFillMouse = true; MouseSprite(GetMousePos()); } else { - m_bFillMouse = FALSE; + m_bFillMouse = false; } - return TRUE; + return true; case VK_F1: if ( m_phase == WM_PHASE_PLAY ) { @@ -4907,31 +4907,31 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_pSound->PlayImage(sound, pos); m_pDecor->SetInfoMode(!m_pDecor->GetInfoMode()); } - return TRUE; + return true; case VK_F9: if ( m_phase == WM_PHASE_PLAY ) { m_pDecor->MemoPos(0, m_bCtrlDown); } - return TRUE; + return true; case VK_F10: if ( m_phase == WM_PHASE_PLAY ) { m_pDecor->MemoPos(1, m_bCtrlDown); } - return TRUE; + return true; case VK_F11: if ( m_phase == WM_PHASE_PLAY ) { m_pDecor->MemoPos(2, m_bCtrlDown); } - return TRUE; + return true; case VK_F12: if ( m_phase == WM_PHASE_PLAY ) { m_pDecor->MemoPos(3, m_bCtrlDown); } - return TRUE; + return true; } break; @@ -4939,26 +4939,26 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) switch( wParam ) { case VK_CONTROL: - m_bCtrlDown = FALSE; - m_bFillMouse = FALSE; + m_bCtrlDown = false; + m_bFillMouse = false; MouseSprite(GetMousePos()); - return TRUE; + return true; } break; case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: - m_bMousePress = TRUE; + m_bMousePress = true; MouseSprite(pos); //? DecorAutoShift(pos); - if ( EventButtons(message, wParam, lParam) ) return TRUE; + if ( EventButtons(message, wParam, lParam) ) return true; if ( m_phase == WM_PHASE_BUILD ) { - if ( BuildDown(pos, fwKeys) ) return TRUE; + if ( BuildDown(pos, fwKeys) ) return true; } if ( m_phase == WM_PHASE_PLAY ) { - if ( PlayDown(pos, fwKeys) ) return TRUE; + if ( PlayDown(pos, fwKeys) ) return true; } break; @@ -4967,9 +4967,9 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) { if ( m_bShowMouse ) { - ShowCursor(FALSE); // cache la souris - m_pPixmap->MouseShow(TRUE); // montre sprite - m_bShowMouse = FALSE; + ShowCursor(false); // cache la souris + m_pPixmap->MouseShow(true); // montre sprite + m_bShowMouse = false; } } if ( m_mouseType == MOUSETYPEWINPOS && @@ -4983,14 +4983,14 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) m_oldMousePos = pos; MouseSprite(pos); - if ( EventButtons(message, wParam, lParam) ) return TRUE; + if ( EventButtons(message, wParam, lParam) ) return true; if ( m_phase == WM_PHASE_BUILD ) { - if ( BuildMove(pos, fwKeys) ) return TRUE; + if ( BuildMove(pos, fwKeys) ) return true; } if ( m_phase == WM_PHASE_PLAY ) { - if ( PlayMove(pos, fwKeys) ) return TRUE; + if ( PlayMove(pos, fwKeys) ) return true; } break; @@ -4999,24 +4999,24 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) { if ( !m_bShowMouse ) { - ShowCursor(TRUE); // montre la souris - m_pPixmap->MouseShow(FALSE); // cache sprite - m_bShowMouse = TRUE; + ShowCursor(true); // montre la souris + m_pPixmap->MouseShow(false); // cache sprite + m_bShowMouse = true; } } break; case WM_LBUTTONUP: case WM_RBUTTONUP: - m_bMousePress = FALSE; - if ( EventButtons(message, wParam, lParam) ) return TRUE; + m_bMousePress = false; + if ( EventButtons(message, wParam, lParam) ) return true; if ( m_phase == WM_PHASE_BUILD ) { - if ( BuildUp(pos, fwKeys) ) return TRUE; + if ( BuildUp(pos, fwKeys) ) return true; } if ( m_phase == WM_PHASE_PLAY ) { - if ( PlayUp(pos, fwKeys) ) return TRUE; + if ( PlayUp(pos, fwKeys) ) return true; } if ( m_phase == WM_PHASE_BYE ) { @@ -5030,28 +5030,28 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) break; case WM_PHASE_SCHOOL: - m_bSchool = TRUE; - m_bPrivate = FALSE; - if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + m_bSchool = true; + m_bPrivate = false; + if ( ChangePhase(WM_PHASE_INFO) ) return true; break; case WM_PHASE_MISSION: - m_bSchool = FALSE; - m_bPrivate = FALSE; + m_bSchool = false; + m_bPrivate = false; if ( m_mission == 0 ) // première mission ? { - if ( ChangePhase(WM_PHASE_H0MOVIE) ) return TRUE; + if ( ChangePhase(WM_PHASE_H0MOVIE) ) return true; } else { - if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + if ( ChangePhase(WM_PHASE_INFO) ) return true; } break; case WM_PHASE_PRIVATE: - m_bSchool = FALSE; - m_bPrivate = TRUE; - if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + m_bSchool = false; + m_bPrivate = true; + if ( ChangePhase(WM_PHASE_INFO) ) return true; break; case WM_PHASE_INTRO1: @@ -5079,7 +5079,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) case WM_PHASE_H2MOVIE: case WM_PHASE_WINMOVIE: case WM_PHASE_BYE: - if ( ChangePhase(message) ) return TRUE; + if ( ChangePhase(message) ) return true; break; case WM_PHASE_UNDO: @@ -5087,14 +5087,14 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) break; case WM_PREV: - m_pDecor->SetInvincible(FALSE); - m_pDecor->SetSuper(FALSE); + m_pDecor->SetInvincible(false); + m_pDecor->SetSuper(false); if ( m_bPrivate ) { if ( m_private > 0 ) { m_private --; - if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + if ( ChangePhase(WM_PHASE_INFO) ) return true; } } else if ( m_bSchool ) @@ -5102,7 +5102,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) if ( m_exercice > 0 ) { m_exercice --; - if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + if ( ChangePhase(WM_PHASE_INFO) ) return true; } } else @@ -5110,20 +5110,20 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) if ( m_mission > 0 ) { m_mission --; - if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + if ( ChangePhase(WM_PHASE_INFO) ) return true; } } break; case WM_NEXT: - m_pDecor->SetInvincible(FALSE); - m_pDecor->SetSuper(FALSE); + m_pDecor->SetInvincible(false); + m_pDecor->SetSuper(false); if ( m_bPrivate ) { if ( m_private < 20-1 ) { m_private ++; - if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + if ( ChangePhase(WM_PHASE_INFO) ) return true; } } else if ( m_bSchool ) @@ -5131,7 +5131,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) if ( m_exercice < 99 ) { m_exercice ++; - if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + if ( ChangePhase(WM_PHASE_INFO) ) return true; } } else @@ -5143,7 +5143,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) { m_maxMission = m_mission; } - if ( ChangePhase(WM_PHASE_INFO) ) return TRUE; + if ( ChangePhase(WM_PHASE_INFO) ) return true; } } break; @@ -5190,13 +5190,13 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) case WM_PHASE_SKILL1: m_pDecor->SetSkill(0); - SetState(WM_PHASE_SKILL1, TRUE); - SetState(WM_PHASE_SKILL2, FALSE); + SetState(WM_PHASE_SKILL1, true); + SetState(WM_PHASE_SKILL2, false); break; case WM_PHASE_SKILL2: m_pDecor->SetSkill(1); - SetState(WM_PHASE_SKILL1, FALSE); - SetState(WM_PHASE_SKILL2, TRUE); + SetState(WM_PHASE_SKILL1, false); + SetState(WM_PHASE_SKILL2, true); break; case WM_BUTTON0: @@ -5283,7 +5283,7 @@ BOOL CEvent::TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam) break; } - return FALSE; + return false; } // (*) Sans cela, il existe un drôle de problème sur diff --git a/event.h b/event.h index 41091eb..690efc6 100644 --- a/event.h +++ b/event.h @@ -18,7 +18,7 @@ typedef struct { UINT phase; char backName[20]; - BOOL bCDrom; + int bCDrom; Button buttons[MAXBUTTON]; } Phase; @@ -54,13 +54,13 @@ public: POINT GetMousePos(); void Create(HWND hWnd, CPixmap *pPixmap, CDecor *pDecor, CSound *pSound, CMovie *pMovie); - void SetFullScreen(BOOL bFullScreen); + void SetFullScreen(bool bFullScreen); void SetMouseType(int mouseType); int GetWorld(); int GetPhysicalWorld(); int GetImageWorld(); - BOOL IsHelpHide(); - BOOL ChangePhase(UINT phase); + bool IsHelpHide(); + bool ChangePhase(UINT phase); void MovieToStart(); UINT GetPhase(); void TryInsert(); @@ -69,37 +69,37 @@ public: int GetButtonIndex(int button); int GetState(int button); void SetState(int button, int state); - BOOL GetEnable(int button); - void SetEnable(int button, BOOL bEnable); - BOOL GetHide(int button); - void SetHide(int button, BOOL bHide); + bool GetEnable(int button); + void SetEnable(int button, bool bEnable); + bool GetHide(int button); + void SetHide(int button, bool bHide); int GetMenu(int button); void SetMenu(int button, int menu); - BOOL DrawButtons(); + bool DrawButtons(); int MousePosToSprite(POINT pos); void MouseSprite(POINT pos); - void WaitMouse(BOOL bWait); - void HideMouse(BOOL bHide); + void WaitMouse(bool bWait); + void HideMouse(bool bHide); POINT GetLastMousePos(); - BOOL TreatEvent(UINT message, WPARAM wParam, LPARAM lParam); - BOOL TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam); + bool TreatEvent(UINT message, WPARAM wParam, LPARAM lParam); + bool TreatEventBase(UINT message, WPARAM wParam, LPARAM lParam); void DecorAutoShift(POINT pos); - BOOL StartMovie(char *pFilename); + bool StartMovie(char *pFilename); void StopMovie(); - BOOL IsMovie(); + bool IsMovie(); - BOOL FlipObject(); + bool FlipObject(); void Read(int message); void Write(int message); void SetSpeed(int speed); int GetSpeed(); - BOOL GetPause(); - BOOL IsShift(); + bool GetPause(); + bool IsShift(); void DemoStep(); void DebugDisplay(char m); @@ -108,31 +108,31 @@ public: protected: void DrawTextCenter(int res, int x, int y, int font=0); - BOOL CreateButtons(); - BOOL EventButtons(UINT message, WPARAM wParam, LPARAM lParam); - BOOL MouseOnButton(POINT pos); + bool CreateButtons(); + bool EventButtons(UINT message, WPARAM wParam, LPARAM lParam); + bool MouseOnButton(POINT pos); int SearchPhase(UINT phase); void DecorShift(int dx, int dy); - BOOL PlayDown(POINT pos, int fwKeys); - BOOL PlayMove(POINT pos, int fwKeys); - BOOL PlayUp(POINT pos, int fwKeys); + bool PlayDown(POINT pos, int fwKeys); + bool PlayMove(POINT pos, int fwKeys); + bool PlayUp(POINT pos, int fwKeys); void ChangeButtons(int message); void BuildFloor(POINT cel, int insIcon); void BuildWater(POINT cel, int insIcon); - BOOL BuildDown(POINT pos, int fwKeys, BOOL bMix=TRUE); - BOOL BuildMove(POINT pos, int fwKeys); - BOOL BuildUp(POINT pos, int fwKeys); + bool BuildDown(POINT pos, int fwKeys, bool bMix=true); + bool BuildMove(POINT pos, int fwKeys); + bool BuildUp(POINT pos, int fwKeys); void PrivateLibelle(); - BOOL ReadLibelle(int world, BOOL bSchool, BOOL bHelp); - BOOL WriteInfo(); - BOOL ReadInfo(); + bool ReadLibelle(int world, bool bSchool, bool bHelp); + bool WriteInfo(); + bool ReadInfo(); void DemoRecStart(); void DemoRecStop(); - BOOL DemoPlayStart(); + bool DemoPlayStart(); void DemoPlayStop(); void DemoRecEvent(UINT message, WPARAM wParam, LPARAM lParam); @@ -144,10 +144,10 @@ protected: int m_maxMission; int m_phase; int m_index; - BOOL m_bSchool; - BOOL m_bPrivate; - BOOL m_bAccessBuild; - BOOL m_bFullScreen; + bool m_bSchool; + bool m_bPrivate; + bool m_bAccessBuild; + bool m_bFullScreen; int m_mouseType; HWND m_hWnd; CPixmap* m_pPixmap; @@ -160,11 +160,11 @@ protected: int m_lastFloor[MAXBUTTON]; int m_lastObject[MAXBUTTON]; int m_lastHome[MAXBUTTON]; - BOOL m_bRunMovie; - BOOL m_bBuildModify; + bool m_bRunMovie; + bool m_bBuildModify; CJauge m_jauges[2]; CMenu m_menu; - BOOL m_bMenu; + bool m_bMenu; POINT m_menuPos; int m_menuNb; int m_menuButtons[MAXBUTTON]; @@ -172,28 +172,28 @@ protected: int m_menuPerso; POINT m_menuCel; POINT m_oldMousePos; - BOOL m_bMousePress; - BOOL m_bMouseDown; - BOOL m_bHili; + bool m_bMousePress; + bool m_bMouseDown; + bool m_bHili; int m_fileWorld[10]; int m_fileTime[10]; POINT m_posToolTips; char m_textToolTips[50]; int m_mouseSprite; - BOOL m_bFillMouse; - BOOL m_bWaitMouse; - BOOL m_bHideMouse; - BOOL m_bShowMouse; + bool m_bFillMouse; + bool m_bWaitMouse; + bool m_bHideMouse; + bool m_bShowMouse; int m_rankCheat; int m_posCheat; - BOOL m_bMovie; - BOOL m_bSpeed; - BOOL m_bHelp; - BOOL m_bAllMissions; - BOOL m_bChangeCheat; + bool m_bMovie; + bool m_bSpeed; + bool m_bHelp; + bool m_bAllMissions; + bool m_bChangeCheat; int m_scrollSpeed; - BOOL m_bPause; - BOOL m_bShift; + bool m_bPause; + bool m_bShift; int m_shiftPhase; POINT m_shiftVector; POINT m_shiftOffset; @@ -202,17 +202,17 @@ protected: int m_tryInsertCount; POINT m_posInfoButton; POINT m_posHelpButton; - BOOL m_bHiliInfoButton; - BOOL m_bHiliHelpButton; - BOOL m_bInfoHelp; - BOOL m_bDemoRec; - BOOL m_bDemoPlay; + bool m_bHiliInfoButton; + bool m_bHiliHelpButton; + bool m_bInfoHelp; + bool m_bDemoRec; + bool m_bDemoPlay; DemoEvent* m_pDemoBuffer; int m_demoTime; int m_demoIndex; int m_demoEnd; int m_demoNumber; - BOOL m_bCtrlDown; + bool m_bCtrlDown; POINT m_debugPos; int m_introTime; }; diff --git a/fog.cpp b/fog.cpp index 8c17dc2..1142d4c 100644 --- a/fog.cpp +++ b/fog.cpp @@ -27,21 +27,21 @@ static char tableFog[15*4] = // Retourne les bits contenant du brouillard. -BOOL GetFogBits(int icon, char *pBits) +bool GetFogBits(int icon, char *pBits) { pBits[0] = 0; pBits[1] = 0; pBits[2] = 0; pBits[3] = 0; - if ( icon < 0 || icon >= 15 ) return TRUE; + if ( icon < 0 || icon >= 15 ) return true; pBits[0] = tableFog[icon*4+0]; pBits[1] = tableFog[icon*4+1]; pBits[2] = tableFog[icon*4+2]; pBits[3] = tableFog[icon*4+3]; - return TRUE; + return true; } // Retourne l'icône correspondant aux bits de brouillard. diff --git a/jauge.cpp b/jauge.cpp index 3a642be..bf934c9 100644 --- a/jauge.cpp +++ b/jauge.cpp @@ -20,9 +20,9 @@ CJauge::CJauge() { m_type = 0; - m_bHide = TRUE; - m_bMinimizeRedraw = FALSE; - m_bRedraw = FALSE; + m_bHide = true; + m_bMinimizeRedraw = false; + m_bRedraw = false; } // Destructeur. @@ -34,22 +34,22 @@ CJauge::~CJauge() // Crée un nouveau bouton. -BOOL CJauge::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, BOOL bMinimizeRedraw) +bool CJauge::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, + POINT pos, int type, bool bMinimizeRedraw) { m_hWnd = hWnd; m_pPixmap = pPixmap; m_pSound = pSound; m_type = type; m_bMinimizeRedraw = bMinimizeRedraw; - m_bHide = TRUE; + m_bHide = true; m_pos = pos; m_dim.x = DIMJAUGEX; m_dim.y = DIMJAUGEY; m_level = 0; - m_bRedraw = TRUE; + m_bRedraw = true; - return TRUE; + return true; } // Dessine un bouton dans son état. @@ -60,7 +60,7 @@ void CJauge::Draw() RECT rect; if ( m_bMinimizeRedraw && !m_bRedraw ) return; - m_bRedraw = FALSE; + m_bRedraw = false; if ( m_bHide ) // bouton caché ? { @@ -94,7 +94,7 @@ void CJauge::Draw() void CJauge::Redraw() { - m_bRedraw = TRUE; + m_bRedraw = true; } // Modifie le niveau. @@ -106,7 +106,7 @@ void CJauge::SetLevel(int level) if ( m_level != level ) { - m_bRedraw = TRUE; + m_bRedraw = true; } m_level = level; @@ -118,23 +118,23 @@ void CJauge::SetType(int type) { if ( m_type != type ) { - m_bRedraw = TRUE; + m_bRedraw = true; } m_type = type; } -BOOL CJauge::GetHide() +bool CJauge::GetHide() { return m_bHide; } -void CJauge::SetHide(BOOL bHide) +void CJauge::SetHide(bool bHide) { if ( m_bHide != bHide ) { - m_bRedraw = TRUE; + m_bRedraw = true; } m_bHide = bHide; @@ -147,6 +147,6 @@ POINT CJauge::GetPos() void CJauge::SetRedraw() { - m_bRedraw = TRUE; + m_bRedraw = true; } diff --git a/jauge.h b/jauge.h index d8bfd7e..875654e 100644 --- a/jauge.h +++ b/jauge.h @@ -10,16 +10,16 @@ public: CJauge(); ~CJauge(); - BOOL Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, - POINT pos, int type, BOOL bMinimizeRedraw); + bool Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, + POINT pos, int type, bool bMinimizeRedraw); void Draw(); void Redraw(); void SetLevel(int level); void SetType(int type); - BOOL GetHide(); - void SetHide(BOOL bHide); + bool GetHide(); + void SetHide(bool bHide); POINT GetPos(); void SetRedraw(); @@ -29,13 +29,13 @@ protected: CPixmap* m_pPixmap; CDecor* m_pDecor; CSound* m_pSound; - BOOL m_bHide; // TRUE si bouton caché + bool m_bHide; // true si bouton caché POINT m_pos; // coin sup/gauche POINT m_dim; // dimensions int m_type; int m_level; - BOOL m_bMinimizeRedraw; - BOOL m_bRedraw; // TRUE -> doit être redessiné + bool m_bMinimizeRedraw; + bool m_bRedraw; // true -> doit être redessiné }; ///////////////////////////////////////////////////////////////////////////// diff --git a/menu.cpp b/menu.cpp index d22f2e8..128987d 100644 --- a/menu.cpp +++ b/menu.cpp @@ -90,7 +90,7 @@ CMenu::~CMenu() // Crée un nouveau bouton. -BOOL CMenu::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, +bool CMenu::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, POINT pos, int nb, int *pButtons, int *pErrors, int perso) { @@ -123,7 +123,7 @@ BOOL CMenu::Create(HWND hWnd, CPixmap *pPixmap, CSound *pSound, m_selRank = Detect(pos); - return TRUE; + return true; } // Met à jour le menu. @@ -164,8 +164,8 @@ void CMenu::Draw() int i, state, icon; POINT pos; RECT oldClip, clipRect; - BOOL bLeft = TRUE; - BOOL bRight = TRUE; + bool bLeft = true; + bool bRight = true; char text[50]; char* pText; @@ -178,8 +178,8 @@ void CMenu::Draw() clipRect.bottom = POSDRAWY+DIMDRAWY; m_pPixmap->SetClipping(clipRect); - if ( m_pos.x-150 < POSDRAWX ) bLeft = FALSE; - if ( m_pos.x+m_dim.x+150 > POSDRAWX+DIMDRAWX ) bRight = FALSE; + if ( m_pos.x-150 < POSDRAWX ) bLeft = false; + if ( m_pos.x+m_dim.x+150 > POSDRAWX+DIMDRAWX ) bRight = false; for ( i=0 ; i 14 && strstr(g_CDPath+lg-14, "\\daniel\\blupi\\") ) { - bDaniel = TRUE; + bDaniel = true; } #if _DEMO @@ -212,7 +212,7 @@ void AddUserPath(char *pFilename) att.nLength = sizeof(SECURITY_ATTRIBUTES); att.lpSecurityDescriptor = NULL; - att.bInheritHandle = FALSE; + att.bInheritHandle = false; CreateDirectory(temp, &att); pText = strstr(pFilename, "\\"); diff --git a/movie.cpp b/movie.cpp index ff753f6..5934f7a 100644 --- a/movie.cpp +++ b/movie.cpp @@ -26,7 +26,7 @@ // Initialize avi libraries. -BOOL CMovie::initAVI() +bool CMovie::initAVI() { MCI_DGV_OPEN_PARMS mciOpen; @@ -67,7 +67,7 @@ void CMovie::positionMovie(HWND hWnd, RECT rect) // reposition the playback (child) window MoveWindow(m_hwndMovie, rect.left, rect.top, - rect.right, rect.bottom, TRUE); + rect.right, rect.bottom, true); } // Close the movie and anything associated with it. | @@ -80,11 +80,11 @@ void CMovie::fileCloseMovie(HWND hWnd) mciSendCommand(m_wMCIDeviceID, MCI_CLOSE, 0L, (DWORD)(LPMCI_GENERIC_PARMS)&mciGeneric); - m_fPlaying = FALSE; // can't be playing any longer - m_fMovieOpen = FALSE; // no more movies open + m_fPlaying = false; // can't be playing any longer + m_fMovieOpen = false; // no more movies open // cause a total repaint to occur - InvalidateRect(hWnd, NULL, TRUE); + InvalidateRect(hWnd, NULL, true); UpdateWindow(hWnd); } @@ -95,7 +95,7 @@ void CMovie::fileCloseMovie(HWND hWnd) // the movie paused when opened. // Sets on success. -BOOL CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename) +bool CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename) { MCI_DGV_OPEN_PARMS mciOpen; MCI_DGV_WINDOW_PARMS mciWindow; @@ -132,7 +132,7 @@ BOOL CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename) { // we opened the file o.k., now set up to play it. m_wMCIDeviceID = mciOpen.wDeviceID; // save ID - m_fMovieOpen = TRUE; // a movie was opened + m_fMovieOpen = true; // a movie was opened // show the playback window mciWindow.dwCallback = 0L; @@ -154,17 +154,17 @@ BOOL CMovie::fileOpenMovie(HWND hWnd, RECT rect, char *pFilename) positionMovie(hWnd, rect); // cause an update to occur - InvalidateRect(hWnd, NULL, FALSE); + InvalidateRect(hWnd, NULL, false); UpdateWindow(hWnd); - return TRUE; + return true; } else { // generic error for open - m_fMovieOpen = FALSE; + m_fMovieOpen = false; - return FALSE; + return false; } } @@ -177,7 +177,7 @@ void CMovie::playMovie(HWND hWnd, int nDirection) m_fPlaying = !m_fPlaying; // swap the play flag if( !nDirection ) - m_fPlaying = FALSE; // wDirection == NULL means PAUSE + m_fPlaying = false; // wDirection == NULL means PAUSE // play/pause the AVI movie if ( m_fPlaying ) @@ -213,10 +213,10 @@ void CMovie::playMovie(HWND hWnd, int nDirection) CMovie::CMovie() { - m_bEnable = FALSE; + m_bEnable = false; m_wMCIDeviceID = 0; - m_fPlaying = FALSE; - m_fMovieOpen = FALSE; + m_fPlaying = false; + m_fMovieOpen = false; } // Destructeur. @@ -228,35 +228,35 @@ CMovie::~CMovie() // Ouvre la librairie avi. -BOOL CMovie::Create() +bool CMovie::Create() { #if _EGAMES - m_bEnable = FALSE; - return FALSE; + m_bEnable = false; + return false; #else if ( initAVI() ) { - m_bEnable = TRUE; - return TRUE; + m_bEnable = true; + return true; } else { - m_bEnable = FALSE; - return FALSE; + m_bEnable = false; + return false; } #endif } // Retourne l'état de DirectMovie. -BOOL CMovie::GetEnable() +bool CMovie::GetEnable() { return m_bEnable; } // Indique si un film existe. -BOOL CMovie::IsExist(char *pFilename) +bool CMovie::IsExist(char *pFilename) { char string[MAX_PATH]; FILE* file; @@ -272,21 +272,21 @@ BOOL CMovie::IsExist(char *pFilename) } file = fopen(string, "rb"); - if ( file == NULL ) return FALSE; + if ( file == NULL ) return false; fclose(file); - return TRUE; + return true; } // Montre un film avi. -BOOL CMovie::Play(HWND hWnd, RECT rect, char *pFilename) +bool CMovie::Play(HWND hWnd, RECT rect, char *pFilename) { - if ( !m_bEnable ) return FALSE; - if ( !fileOpenMovie(hWnd, rect, pFilename) ) return FALSE; + if ( !m_bEnable ) return false; + if ( !fileOpenMovie(hWnd, rect, pFilename) ) return false; playMovie(hWnd, IDM_PLAY); - return TRUE; + return true; } // Stoppe le film avi. diff --git a/movie.h b/movie.h index f7af98e..5172707 100644 --- a/movie.h +++ b/movie.h @@ -9,25 +9,25 @@ public: CMovie(); ~CMovie(); - BOOL Create(); - BOOL GetEnable(); - BOOL IsExist(char *pFilename); - BOOL Play(HWND hWnd, RECT rect, char *pFilename); + bool Create(); + bool GetEnable(); + bool IsExist(char *pFilename); + bool Play(HWND hWnd, RECT rect, char *pFilename); void Stop(HWND hWnd); protected: void playMovie(HWND hWnd, int nDirection); - BOOL fileOpenMovie(HWND hWnd, RECT rect, char *pFilename); + bool fileOpenMovie(HWND hWnd, RECT rect, char *pFilename); void fileCloseMovie(HWND hWnd); void positionMovie(HWND hWnd, RECT rect); void termAVI(); - BOOL initAVI(); + bool initAVI(); protected: - BOOL m_bEnable; + bool m_bEnable; MCIDEVICEID m_wMCIDeviceID; // MCI Device ID for the AVI file HWND m_hwndMovie; // window handle of the movie - BOOL m_fPlaying; // Play flag: TRUE == playing, FALSE == paused - BOOL m_fMovieOpen; // Open flag: TRUE == movie open, FALSE = none + bool m_fPlaying; // Play flag: true == playing, false == paused + bool m_fMovieOpen; // Open flag: true == movie open, false = none }; diff --git a/obstacle.cpp b/obstacle.cpp index fdad3fd..151a337 100644 --- a/obstacle.cpp +++ b/obstacle.cpp @@ -1582,7 +1582,7 @@ void Copy33To99(int *pSrc33, int *pDst99, int dx, int dy) // Indique s'il est possible d'avancer dans une direction donnée. -BOOL CDecor::IsFreeDirect(POINT cel, int direct, int rank) +bool CDecor::IsFreeDirect(POINT cel, int direct, int rank) { int icon, workBlupi; int bits[3*3], obstacles[9*9]; @@ -1594,38 +1594,38 @@ BOOL CDecor::IsFreeDirect(POINT cel, int direct, int rank) test.y = cel.y+vector.y; if ( m_decor[test.x/2][test.y/2].fire > 0 && - m_decor[test.x/2][test.y/2].fire < MoveMaxFire() ) return FALSE; + m_decor[test.x/2][test.y/2].fire < MoveMaxFire() ) return false; // Cellule bloquée (un blupi travaille ici) ? if ( m_blupi[rank].perso != 3 ) // pas tracks ? { workBlupi = m_decor[test.x/2][test.y/2].workBlupi; - if ( workBlupi >= 0 && workBlupi != rank ) return FALSE; + if ( workBlupi >= 0 && workBlupi != rank ) return false; } // Déplacement possible par-rapport au sol ? // icon = m_decor[cel.x/2][cel.y/2].floorIcon; // SearchFloor(rank, icon, cel, bits); // AjustFloor(rank, icon, cel, bits); -// if ( bits[(1+vector.x)+(1+vector.y)*3] == 1 ) return FALSE; +// if ( bits[(1+vector.x)+(1+vector.y)*3] == 1 ) return false; icon = m_decor[test.x/2][test.y/2].floorIcon; SearchFloor(rank, icon, test, bits); AjustFloor(rank, icon, test, bits); - if ( bits[1+1*3] == 1 ) return FALSE; - if ( bits[(1-vector.x)+(1-vector.y)*3] == 1 ) return FALSE; + if ( bits[1+1*3] == 1 ) return false; + if ( bits[(1-vector.x)+(1-vector.y)*3] == 1 ) return false; // Déplacement possible par-rapport aux obstacles ? icon = m_decor[cel.x/2][cel.y/2].objectIcon; SearchObject(rank, icon, cel, bits); AjustObject(rank, icon, cel, bits); - if ( bits[(1+vector.x)+(1+vector.y)*3] == 1 ) return FALSE; + if ( bits[(1+vector.x)+(1+vector.y)*3] == 1 ) return false; icon = m_decor[test.x/2][test.y/2].objectIcon; SearchObject(rank, icon, test, bits); AjustObject(rank, icon, test, bits); - if ( bits[(1-vector.x)+(1-vector.y)*3] == 1 ) return FALSE; - if ( bits[1+1*3] == 1 ) return FALSE; + if ( bits[(1-vector.x)+(1-vector.y)*3] == 1 ) return false; + if ( bits[1+1*3] == 1 ) return false; if ( vector.x != 0 && vector.y != 0 ) // déplacement diagonal ? { @@ -1643,67 +1643,67 @@ BOOL CDecor::IsFreeDirect(POINT cel, int direct, int rank) AjustObject(rank, icon, test, bits); Copy33To99(bits, obstacles, vector.x, 0); - if ( obstacles[(4+vector.x*1)+(4+vector.y*2)*9] == 1 ) return FALSE; - if ( obstacles[(4+vector.x*2)+(4+vector.y*1)*9] == 1 ) return FALSE; + if ( obstacles[(4+vector.x*1)+(4+vector.y*2)*9] == 1 ) return false; + if ( obstacles[(4+vector.x*2)+(4+vector.y*1)*9] == 1 ) return false; } - return TRUE; // pas d'obstacle + return true; // pas d'obstacle } // Indique si une cellule contient un objet. // Est utilisé lors du dessin (BuildPutBlupi), pour savoir // si blupi est devant un objet. -BOOL CDecor::IsFreeCelObstacle(POINT cel) +bool CDecor::IsFreeCelObstacle(POINT cel) { int icon; int bits[9]; - if ( !IsValid(cel) ) return FALSE; + if ( !IsValid(cel) ) return false; if ( m_decor[cel.x/2][cel.y/2].fire > 0 && - m_decor[cel.x/2][cel.y/2].fire < MoveMaxFire() ) return FALSE; + m_decor[cel.x/2][cel.y/2].fire < MoveMaxFire() ) return false; icon = m_decor[cel.x/2][cel.y/2].objectIcon; if ( icon != -1 ) { SearchObject(-1, icon, cel, bits); - if ( bits[1+1*3] == 1 ) return FALSE; + if ( bits[1+1*3] == 1 ) return false; } - return TRUE; // pas d'obstacle + return true; // pas d'obstacle } // Indique si une cellule contient un sol. // Est utilisé pour savoir si blupi peut aller sur une cellule // en tenant compte uniquement des sols. -// Retourne TRUE si blupi peut y aller ! +// Retourne true si blupi peut y aller ! -BOOL CDecor::IsFreeCelFloor(POINT cel, int rank) +bool CDecor::IsFreeCelFloor(POINT cel, int rank) { int icon; int bits[9]; - if ( !IsValid(cel) ) return FALSE; + if ( !IsValid(cel) ) return false; icon = m_decor[cel.x/2][cel.y/2].floorIcon; if ( icon != -1 ) { SearchFloor(rank, icon, cel, bits); AjustFloor(rank, icon, cel, bits); - if ( bits[1+1*3] == 1 ) return FALSE; + if ( bits[1+1*3] == 1 ) return false; } - return TRUE; // pas d'obstacle + return true; // pas d'obstacle } // Indique si une cellule est libre. // Est utilisé pour savoir si blupi peut venir ici // débarquer en bateau ou monter dans sa jeep. -BOOL CDecor::IsFreeCelGo(POINT cel, int rank) +bool CDecor::IsFreeCelGo(POINT cel, int rank) { - BOOL bOK; + bool bOK; POINT limit; int action, channel, icon; @@ -1716,7 +1716,7 @@ BOOL CDecor::IsFreeCelGo(POINT cel, int rank) channel == CHOBJECT && icon == 113 ) // maison ? { - return FALSE; + return false; } // Refuse d'aller dans le laboratoire (on peut seulement @@ -1726,17 +1726,17 @@ BOOL CDecor::IsFreeCelGo(POINT cel, int rank) icon == 120 || // usine ? icon == 122) ) // mine de fer ? { - return FALSE; + return false; } bOK = IsFreeCel(cel, rank); - if ( bOK ) return TRUE; + if ( bOK ) return true; bOK = IsFreeCelEmbarque(cel, rank, action, limit); - if ( bOK ) return TRUE; + if ( bOK ) return true; bOK = IsFreeCelDebarque(cel, rank, action, limit); - if ( bOK ) return TRUE; + if ( bOK ) return true; if ( !m_blupi[rank].bMalade && m_blupi[rank].vehicule == 0 && // à pied ? @@ -1744,7 +1744,7 @@ BOOL CDecor::IsFreeCelGo(POINT cel, int rank) channel == CHOBJECT && icon == 118 ) // jeep ? { - return TRUE; + return true; } if ( !m_blupi[rank].bMalade && @@ -1755,26 +1755,26 @@ BOOL CDecor::IsFreeCelGo(POINT cel, int rank) channel == CHOBJECT && icon == 16 ) // armure ? { - return TRUE; + return true; } - return FALSE; + return false; } // Indique si on peut faire qq chose sur une cellule. // Est utilisé pour savoir comment est la mise en évidence (hili) // à cet endroit. -BOOL CDecor::IsFreeCelHili(POINT cel, int rank) +bool CDecor::IsFreeCelHili(POINT cel, int rank) { - BOOL bOK; + bool bOK; POINT limit; int workBlupi, channel, icon, action; if ( IsValid(cel) ) { workBlupi = m_decor[cel.x/2][cel.y/2].workBlupi; - if ( workBlupi >= 0 && workBlupi != rank ) return FALSE; + if ( workBlupi >= 0 && workBlupi != rank ) return false; channel = m_decor[cel.x/2][cel.y/2].objectChannel; icon = m_decor[cel.x/2][cel.y/2].objectIcon; @@ -1787,100 +1787,100 @@ BOOL CDecor::IsFreeCelHili(POINT cel, int rank) (icon >= 115 && icon <= 116) || // idem ? (icon >= 17 && icon <= 18)) ) // idem ? { - return FALSE; + return false; } } if ( rank == -1 ) return IsFreeCelFloor(cel, rank); bOK = IsFreeCelFloor(cel, rank); - if ( bOK ) return TRUE; + if ( bOK ) return true; bOK = IsFreeCelEmbarque(cel, rank, action, limit); - if ( bOK ) return TRUE; + if ( bOK ) return true; bOK = IsFreeCelDebarque(cel, rank, action, limit); - if ( bOK ) return TRUE; + if ( bOK ) return true; - return FALSE; + return false; } // Indique si une cellule est libre. // Est utilisé pour savoir si blupi peut venir ici. -BOOL CDecor::IsFreeCel(POINT cel, int rank) +bool CDecor::IsFreeCel(POINT cel, int rank) { int icon, workBlupi; int bits[9]; - if ( !IsValid(cel) ) return FALSE; + if ( !IsValid(cel) ) return false; if ( m_decor[cel.x/2][cel.y/2].fire > 0 && - m_decor[cel.x/2][cel.y/2].fire < MoveMaxFire() ) return FALSE; + m_decor[cel.x/2][cel.y/2].fire < MoveMaxFire() ) return false; // Cellule bloquée (un blupi travaille ici) ? if ( rank != -1 && m_blupi[rank].perso != 3 ) // pas tracks ? { workBlupi = m_decor[cel.x/2][cel.y/2].workBlupi; - if ( workBlupi >= 0 && workBlupi != rank ) return FALSE; + if ( workBlupi >= 0 && workBlupi != rank ) return false; } icon = m_decor[cel.x/2][cel.y/2].floorIcon; SearchFloor(rank, icon, cel, bits); AjustFloor(rank, icon, cel, bits); - if ( bits[1+1*3] == 1 ) return FALSE; + if ( bits[1+1*3] == 1 ) return false; icon = m_decor[cel.x/2][cel.y/2].objectIcon; SearchObject(rank, icon, cel, bits); AjustObject(rank, icon, cel, bits); - if ( bits[1+1*3] == 1 ) return FALSE; + if ( bits[1+1*3] == 1 ) return false; - return TRUE; // pas d'obstacle + return true; // pas d'obstacle } // Indique si blupi peut déposer un objet ici. -BOOL CDecor::IsFreeCelDepose(POINT cel, int rank) +bool CDecor::IsFreeCelDepose(POINT cel, int rank) { int icon; - if ( !IsFreeCel(cel, rank) ) return FALSE; + if ( !IsFreeCel(cel, rank) ) return false; icon = m_decor[cel.x/2][cel.y/2].objectIcon; if ( icon == 10000 || icon == 10001 || // éclairs entre tours ? icon == 18 ) // dalle glissante ? { - return FALSE; + return false; } icon = m_decor[cel.x/2][cel.y/2].floorIcon; if ( icon == 80 ) // téléporteur ? { - return FALSE; + return false; } - return TRUE; + return true; } // Indique s'il est possible d'embarquer ici. // Le point retourné dans "limit" indique jusqu'où il est // possible de marcher normalement (sans passe muraille). -BOOL CDecor::IsFreeCelEmbarque(POINT cel, int rank, +bool CDecor::IsFreeCelEmbarque(POINT cel, int rank, int &action, POINT &limit) { - BOOL bOK; + bool bOK; int channel, icon; // Impossible si blupi n'est pas à pied, // ou s'il s'agit d'un disciple. if ( rank == -1 || m_blupi[rank].vehicule != 0 || - m_blupi[rank].perso == 8 ) return FALSE; + m_blupi[rank].perso == 8 ) return false; // A-t-on cliqué sur un bateau ? - if ( cel.x%2 != 1 || cel.y%2 != 1 ) return FALSE; + if ( cel.x%2 != 1 || cel.y%2 != 1 ) return false; GetObject(cel, channel, icon); - if ( channel != CHOBJECT || icon != 117 ) return FALSE; + if ( channel != CHOBJECT || icon != 117 ) return false; GetFloor(cel, channel, icon); if ( channel == CHFLOOR && icon == 2 ) @@ -1892,7 +1892,7 @@ BOOL CDecor::IsFreeCelEmbarque(POINT cel, int rank, { limit = GetCel(cel,-2,0); action = WM_ACTION_BATEAUDE; - return TRUE; + return true; } } @@ -1906,7 +1906,7 @@ BOOL CDecor::IsFreeCelEmbarque(POINT cel, int rank, { limit = GetCel(cel,0,-2); action = WM_ACTION_BATEAUDS; - return TRUE; + return true; } } @@ -1920,7 +1920,7 @@ BOOL CDecor::IsFreeCelEmbarque(POINT cel, int rank, { limit = GetCel(cel,+1,0); action = WM_ACTION_BATEAUDO; - return TRUE; + return true; } } @@ -1934,31 +1934,31 @@ BOOL CDecor::IsFreeCelEmbarque(POINT cel, int rank, { limit = GetCel(cel,0,+1); action = WM_ACTION_BATEAUDN; - return TRUE; + return true; } } - return FALSE; + return false; } // Indique s'il est possible de débarquer ici. // Le point retourné dans "limit" indique jusqu'où il est // possible de naviguer normalement (sans passe muraille). -BOOL CDecor::IsFreeCelDebarque(POINT cel, int rank, +bool CDecor::IsFreeCelDebarque(POINT cel, int rank, int &action, POINT &limit) { - BOOL bOK; + bool bOK; int channel1, icon1; int channel2, icon2; // Impossible si blupi n'est pas en bateau. - if ( rank == -1 || m_blupi[rank].vehicule != 1 ) return FALSE; + if ( rank == -1 || m_blupi[rank].vehicule != 1 ) return false; m_blupi[rank].vehicule = 0; bOK = IsFreeCel(cel, rank); // libre (à pied) ? m_blupi[rank].vehicule = 1; - if ( !bOK ) return FALSE; + if ( !bOK ) return false; GetFloor(GetCel(cel,+2,0), channel1, icon1); GetObject(GetCel(cel,+2,0), channel2, icon2); @@ -1968,7 +1968,7 @@ BOOL CDecor::IsFreeCelDebarque(POINT cel, int rank, { limit = GetCel(cel,+3,0); action = WM_ACTION_BATEAUAE; - return TRUE; + return true; } GetFloor(GetCel(cel,0,+2), channel1, icon1); @@ -1979,7 +1979,7 @@ BOOL CDecor::IsFreeCelDebarque(POINT cel, int rank, { limit = GetCel(cel,0,+3); action = WM_ACTION_BATEAUAS; - return TRUE; + return true; } GetFloor(GetCel(cel,-2,0), channel1, icon1); @@ -1990,7 +1990,7 @@ BOOL CDecor::IsFreeCelDebarque(POINT cel, int rank, { limit = GetCel(cel,-2,0); action = WM_ACTION_BATEAUAO; - return TRUE; + return true; } GetFloor(GetCel(cel,0,-2), channel1, icon1); @@ -2001,36 +2001,36 @@ BOOL CDecor::IsFreeCelDebarque(POINT cel, int rank, { limit = GetCel(cel,0,-2); action = WM_ACTION_BATEAUAN; - return TRUE; + return true; } - return FALSE; + return false; } // Indique s'il est possible de sauter dans une direction. -BOOL CDecor::IsFreeJump(POINT cel, int direct, int rank, int &action) +bool CDecor::IsFreeJump(POINT cel, int direct, int rank, int &action) { POINT depart, vector; int i, icon; int bits[3*3]; // Refuse de sauter si blupi n'est pas à pied ! - if ( m_blupi[rank].vehicule != 0 ) return FALSE; + if ( m_blupi[rank].vehicule != 0 ) return false; // Refuse de sauter dans les directions se, so, no, ne. - if ( (direct/16)%2 != 0 ) return FALSE; + if ( (direct/16)%2 != 0 ) return false; // Refuse de sauter si peu d'énergie ou si porte qq chose. if ( m_blupi[rank].perso != 0 || m_blupi[rank].energy <= MAXENERGY/4 || - m_blupi[rank].takeChannel != -1 ) return FALSE; + m_blupi[rank].takeChannel != -1 ) return false; vector = GetVector(direct); depart = cel; i = 0; - while ( TRUE ) + while ( true ) { cel.x += vector.x; cel.y += vector.y; @@ -2039,46 +2039,46 @@ BOOL CDecor::IsFreeJump(POINT cel, int direct, int rank, int &action) if ( IsFreeCelFloor(cel, rank) ) break; i ++; } - if ( i == 0 ) return FALSE; + if ( i == 0 ) return false; // Départ possible par-rapport aux obstacles ? icon = m_decor[depart.x/2][depart.y/2].objectIcon; SearchObject(rank, icon, depart, bits); AjustObject(rank, icon, depart, bits); - if ( bits[(1+vector.x)+(1+vector.y)*3] == 1 ) return FALSE; + if ( bits[(1+vector.x)+(1+vector.y)*3] == 1 ) return false; // Arrivée possible par-rapport aux obstacles ? icon = m_decor[cel.x/2][cel.y/2].objectIcon; SearchObject(rank, icon, cel, bits); AjustObject(rank, icon, cel, bits); - if ( bits[(1-vector.x)+(1-vector.y)*3] == 1 ) return FALSE; + if ( bits[(1-vector.x)+(1-vector.y)*3] == 1 ) return false; if ( !IsFreeCel(cel, rank) || - IsBlupiHere(cel, TRUE) ) return FALSE; + IsBlupiHere(cel, true) ) return false; action = ACTION_SAUTE2+(i-1); - return TRUE; + return true; } // Indique s'il est possible de glisser dans une direction. -BOOL CDecor::IsFreeGlisse(POINT cel, int direct, int rank, int &action) +bool CDecor::IsFreeGlisse(POINT cel, int direct, int rank, int &action) { int channel, icon; // Y'a que blupi qui glisse ! - if ( m_blupi[rank].perso != 0 ) return FALSE; + if ( m_blupi[rank].perso != 0 ) return false; GetFloor(GetCel((cel.x/2)*2,(cel.y/2)*2), channel, icon); if ( channel != CHFLOOR || icon != 18 ) // pas dalle glissante ? { - return FALSE; + return false; } - if ( !IsFreeDirect(cel, direct, rank) ) return FALSE; + if ( !IsFreeDirect(cel, direct, rank) ) return false; action = ACTION_GLISSE; - return TRUE; + return true; } @@ -2229,28 +2229,28 @@ void CDecor::AddUsedPos(int rank, POINT pos) // Cherche si une position a déjà été essayée. -BOOL CDecor::IsUsedPos(int rank, POINT pos) +bool CDecor::IsUsedPos(int rank, POINT pos) { int i; for ( i=0 ; i 0 && - m_decor[cel.x/2][cel.y/2].fire < MoveMaxFire() ) return FALSE; + m_decor[cel.x/2][cel.y/2].fire < MoveMaxFire() ) return false; - return TRUE; + return true; } // Cherche un autre objet pour continuer une action // (comme par exemple abatre des arbres). -BOOL CDecor::SearchOtherObject(int rank, POINT initCel, int action, +bool CDecor::SearchOtherObject(int rank, POINT initCel, int action, int distMax, int channel, int firstIcon1, int lastIcon1, int firstIcon2, int lastIcon2, @@ -2486,7 +2486,7 @@ BOOL CDecor::SearchOtherObject(int rank, POINT initCel, int action, int x, y, xx, yy; int dist, min = distMax; POINT cel; - BOOL bOK; + bool bOK; if ( firstIcon1 == 33 && lastIcon1 == 48 && firstIcon2 == 71 && lastIcon2 == 71 ) // cherche du fer ? @@ -2518,7 +2518,7 @@ BOOL CDecor::SearchOtherObject(int rank, POINT initCel, int action, { for ( x=startx ; x= firstIcon2 && m_decor[x/2][y/2].floorIcon <= lastIcon2 ))&& - m_decor[x/2][y/2].objectChannel == -1 ) bOK = TRUE; + m_decor[x/2][y/2].objectChannel == -1 ) bOK = true; } else { @@ -2535,7 +2535,7 @@ BOOL CDecor::SearchOtherObject(int rank, POINT initCel, int action, ((m_decor[x/2][y/2].objectIcon >= firstIcon1 && m_decor[x/2][y/2].objectIcon <= lastIcon1 )|| (m_decor[x/2][y/2].objectIcon >= firstIcon2 && - m_decor[x/2][y/2].objectIcon <= lastIcon2 )) ) bOK = TRUE; + m_decor[x/2][y/2].objectIcon <= lastIcon2 )) ) bOK = true; } if ( bOK ) @@ -2574,7 +2574,7 @@ BOOL CDecor::SearchOtherObject(int rank, POINT initCel, int action, } } - if ( min == distMax ) return FALSE; + if ( min == distMax ) return false; foundCel.x = xx; foundCel.y = yy; @@ -2588,13 +2588,13 @@ BOOL CDecor::SearchOtherObject(int rank, POINT initCel, int action, foundIcon = m_decor[xx/2][yy/2].objectIcon; } - return TRUE; + return true; } // Cherche un autre sol pouvant contenir du fer, pour y // planter un drapeau. -BOOL CDecor::SearchOtherDrapeau(int rank, POINT initCel, int distMax, +bool CDecor::SearchOtherDrapeau(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon) { int startx, starty, endx, endy, icon; @@ -2640,14 +2640,14 @@ BOOL CDecor::SearchOtherDrapeau(int rank, POINT initCel, int distMax, } } - if ( min == distMax ) return FALSE; - return TRUE; + if ( min == distMax ) return false; + return true; } // Cherche un autre sol permettant de déposer du bois // pour construire un bateau. -BOOL CDecor::SearchOtherBateau(int rank, POINT initCel, int distMax, +bool CDecor::SearchOtherBateau(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon) { int startx, starty, endx, endy; @@ -2681,14 +2681,14 @@ BOOL CDecor::SearchOtherBateau(int rank, POINT initCel, int distMax, } } - if ( min == distMax ) return FALSE; - return TRUE; + if ( min == distMax ) return false; + return true; } // Vérifie si l'objet peut être détruit par l'araignée. -BOOL CDecor::IsSpiderObject(int icon) +bool CDecor::IsSpiderObject(int icon) { return ( icon == 60 || // tomates ? icon == 92 || // poison ? @@ -2697,7 +2697,7 @@ BOOL CDecor::IsSpiderObject(int icon) // Cherche un autre objet pour l'araignée. -BOOL CDecor::SearchSpiderObject(int rank, POINT initCel, int distMax, +bool CDecor::SearchSpiderObject(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon) { int startx, starty, endx, endy; @@ -2723,7 +2723,7 @@ BOOL CDecor::SearchSpiderObject(int rank, POINT initCel, int distMax, { cel.x = x; cel.y = y; - if ( IsBlupiHere(cel, FALSE) ) continue; + if ( IsBlupiHere(cel, false) ) continue; dist = abs(initCel.x-x) + abs(initCel.y-y); @@ -2741,15 +2741,15 @@ BOOL CDecor::SearchSpiderObject(int rank, POINT initCel, int distMax, } } - if ( min == distMax ) return FALSE; + if ( min == distMax ) return false; - return TRUE; + return true; } // Vérifie si l'objet peut être détruit par le tracks. -BOOL CDecor::IsTracksObject(int icon) +bool CDecor::IsTracksObject(int icon) { return ( icon == 36 || // planches ? icon == 44 || // pierres ? @@ -2768,7 +2768,7 @@ BOOL CDecor::IsTracksObject(int icon) // Cherche un autre objet pour le tracks. -BOOL CDecor::SearchTracksObject(int rank, POINT initCel, int distMax, +bool CDecor::SearchTracksObject(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon) { int startx, starty, endx, endy, icon; @@ -2795,7 +2795,7 @@ BOOL CDecor::SearchTracksObject(int rank, POINT initCel, int distMax, //? cel.x = x; //? cel.y = y; //? if ( BlupiIsGoalUsed(cel) ) continue; -//? if ( IsBlupiHere(cel, FALSE) ) continue; +//? if ( IsBlupiHere(cel, false) ) continue; dist = abs(initCel.x-x) + abs(initCel.y-y); if ( dist <= min ) @@ -2841,15 +2841,15 @@ BOOL CDecor::SearchTracksObject(int rank, POINT initCel, int distMax, } } - if ( min == distMax ) return FALSE; + if ( min == distMax ) return false; - return TRUE; + return true; } // Vérifie si l'objet peut être détruit par le robot. -BOOL CDecor::IsRobotObject(int icon) +bool CDecor::IsRobotObject(int icon) { return ( icon == 85 || // dynamite ? icon == 93 || // piège ? @@ -2860,7 +2860,7 @@ BOOL CDecor::IsRobotObject(int icon) // Cherche une autre action pour le robot. // C'est ici qu'est contenue l'IA du robot ! -BOOL CDecor::SearchRobotObject(int rank, POINT initCel, int distMax, +bool CDecor::SearchRobotObject(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon, int &foundAction) { @@ -2929,7 +2929,7 @@ BOOL CDecor::SearchRobotObject(int rank, POINT initCel, int distMax, if ( min < distMax ) { foundAction = -1; // robot passe tout prèt d'un piège/dynamite - return TRUE; + return true; } // Cherche l'usine la moins construite. @@ -2969,7 +2969,7 @@ BOOL CDecor::SearchRobotObject(int rank, POINT initCel, int distMax, if ( index == 3 ) foundAction = WM_ACTION_R_BUILD3; // virus if ( index == 4 ) foundAction = WM_ACTION_R_BUILD5; // bombe if ( index == 5 ) foundAction = WM_ACTION_R_BUILD6; // électro - return TRUE; + return true; } // Cherche un emplacement libre. for ( d=1 ; d MAXBLUPI-10 ) return FALSE; // rien si trop peuplé ! + if ( nb > MAXBLUPI-10 ) return false; // rien si trop peuplé ! // Cherche l'ennemi le moins répandu. min = 999; index = 0; @@ -3090,7 +3090,7 @@ BOOL CDecor::SearchRobotObject(int rank, POINT initCel, int distMax, if ( index == 3 ) foundAction = WM_ACTION_R_MAKE3; // virus if ( index == 4 ) foundAction = WM_ACTION_R_MAKE5; // bombe if ( index == 5 ) foundAction = WM_ACTION_R_MAKE6; // électro - return TRUE; + return true; } // Cherche l'usine la plus proche. @@ -3128,15 +3128,15 @@ BOOL CDecor::SearchRobotObject(int rank, POINT initCel, int distMax, if ( foundIcon == 104 ) foundAction = WM_ACTION_R_MAKE4; // tracks if ( foundIcon == 115 ) foundAction = WM_ACTION_R_MAKE5; // bombe if ( foundIcon == 17 ) foundAction = WM_ACTION_R_MAKE6; // électro - return TRUE; + return true; } - return FALSE; + return false; } // Teste si un emplacement est ok pour bâtir une usine. -BOOL CDecor::IsUsineBuild(int rank, POINT cel) +bool CDecor::IsUsineBuild(int rank, POINT cel) { int icon, channel; int x, y; @@ -3144,28 +3144,28 @@ BOOL CDecor::IsUsineBuild(int rank, POINT cel) // Pas sur les dalles hachurées ! GetFloor(cel, channel, icon); if ( channel == CHFLOOR && - (icon < 65 || icon > 67) ) return FALSE; + (icon < 65 || icon > 67) ) return false; for ( x=-1 ; x<3 ; x++ ) { for ( y=-1 ; y<3 ; y++ ) { if ( !IsFreeCel(GetCel(cel,x,y), rank) || - IsBlupiHereEx(GetCel(cel,x,y), rank, FALSE) ) + IsBlupiHereEx(GetCel(cel,x,y), rank, false) ) { - return FALSE; + return false; } } } - return TRUE; + return true; } // Teste s'il est possible d'entrer dans une usine. // L'usine doit être libre devant (lieu de stationnement // pour l'ennemi qui sera construit). -BOOL CDecor::IsUsineFree(int rank, POINT cel) +bool CDecor::IsUsineFree(int rank, POINT cel) { int channel, icon; @@ -3173,24 +3173,24 @@ BOOL CDecor::IsUsineFree(int rank, POINT cel) if ( channel == CHOBJECT && icon == 115 ) // usine à bombes ? { - return ( !IsBlupiHereEx(GetCel(cel,0,1), rank, FALSE) && - !IsBlupiHereEx(GetCel(cel,1,1), rank, FALSE) && - !IsBlupiHereEx(GetCel(cel,2,1), rank, FALSE) && - !IsBlupiHereEx(GetCel(cel,3,1), rank, FALSE) ); + return ( !IsBlupiHereEx(GetCel(cel,0,1), rank, false) && + !IsBlupiHereEx(GetCel(cel,1,1), rank, false) && + !IsBlupiHereEx(GetCel(cel,2,1), rank, false) && + !IsBlupiHereEx(GetCel(cel,3,1), rank, false) ); } - return ( !IsBlupiHereEx(GetCel(cel,0,1), rank, FALSE) && - !IsBlupiHereEx(GetCel(cel,1,1), rank, FALSE) && - !IsBlupiHereEx(GetCel(cel,2,0), rank, FALSE) && - !IsBlupiHereEx(GetCel(cel,2,1), rank, FALSE) && - (!IsBlupiHereEx(GetCel(cel,3,0), rank, FALSE)|| - !IsBlupiHereEx(GetCel(cel,3,1), rank, FALSE)) ); + return ( !IsBlupiHereEx(GetCel(cel,0,1), rank, false) && + !IsBlupiHereEx(GetCel(cel,1,1), rank, false) && + !IsBlupiHereEx(GetCel(cel,2,0), rank, false) && + !IsBlupiHereEx(GetCel(cel,2,1), rank, false) && + (!IsBlupiHereEx(GetCel(cel,3,0), rank, false)|| + !IsBlupiHereEx(GetCel(cel,3,1), rank, false)) ); } // Vérifie si l'objet peut être détruit par une bombe. -BOOL CDecor::IsBombeObject(int icon) +bool CDecor::IsBombeObject(int icon) { return ( icon == 36 || // planches ? icon == 61 || // cabane ? @@ -3202,7 +3202,7 @@ BOOL CDecor::IsBombeObject(int icon) // Cherche un autre objet pour une bombe. -BOOL CDecor::SearchBombeObject(int rank, POINT initCel, int distMax, +bool CDecor::SearchBombeObject(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon) { int startx, starty, endx, endy; @@ -3228,7 +3228,7 @@ BOOL CDecor::SearchBombeObject(int rank, POINT initCel, int distMax, { cel.x = x; cel.y = y; - if ( IsBlupiHere(cel, FALSE) ) continue; + if ( IsBlupiHere(cel, false) ) continue; dist = abs(initCel.x-x) + abs(initCel.y-y); @@ -3246,14 +3246,14 @@ BOOL CDecor::SearchBombeObject(int rank, POINT initCel, int distMax, } } - if ( min == distMax ) return FALSE; + if ( min == distMax ) return false; - return TRUE; + return true; } // Cherche un autre objet pour un électro. -BOOL CDecor::SearchElectroObject(int rank, POINT initCel, int distMax, +bool CDecor::SearchElectroObject(int rank, POINT initCel, int distMax, POINT &foundCel, int &foundIcon) { int startx, starty, endx, endy; @@ -3279,7 +3279,7 @@ BOOL CDecor::SearchElectroObject(int rank, POINT initCel, int distMax, { cel.x = x; cel.y = y; - if ( IsBlupiHere(cel, FALSE) ) continue; + if ( IsBlupiHere(cel, false) ) continue; dist = abs(initCel.x-x) + abs(initCel.y-y); @@ -3293,7 +3293,7 @@ BOOL CDecor::SearchElectroObject(int rank, POINT initCel, int distMax, } } } - if ( min <= 4 ) return TRUE; + if ( min <= 4 ) return true; min = distMax; for ( r=0 ; r 0 && - m_decor[test.x/2][test.y/2].fire < MoveMaxFire() ) return TRUE; + m_decor[test.x/2][test.y/2].fire < MoveMaxFire() ) return true; } } - return FALSE; + return false; } // Teste si une position est très proche d'un virus. -// Si oui, retourne TRUE. +// Si oui, retourne true. -BOOL CDecor::IsVirusCel(POINT cel) +bool CDecor::IsVirusCel(POINT cel) { int rank; @@ -3390,11 +3390,11 @@ BOOL CDecor::IsVirusCel(POINT cel) if ( cel.x >= m_blupi[rank].cel.x-1 && cel.x <= m_blupi[rank].cel.x+1 && cel.y >= m_blupi[rank].cel.y-1 && - cel.y <= m_blupi[rank].cel.y+1 ) return TRUE; + cel.y <= m_blupi[rank].cel.y+1 ) return true; } } - return FALSE; + return false; } @@ -3531,7 +3531,7 @@ int CDecor::IsBuildPont(POINT &cel, int &iconBuild) // Regarde s'il est possible de construire un bateau à partir // d'une cellule donnée (cel). -BOOL CDecor::IsBuildBateau(POINT cel, int &direct) +bool CDecor::IsBuildBateau(POINT cel, int &direct) { int fChannel, fIcon; int oChannel, oIcon; @@ -3542,7 +3542,7 @@ BOOL CDecor::IsBuildBateau(POINT cel, int &direct) oChannel == -1 && oIcon == -1 ) { direct = DIRECT_E; - return TRUE; + return true; } GetFloor (GetCel(cel,-2,0), fChannel, fIcon); @@ -3551,7 +3551,7 @@ BOOL CDecor::IsBuildBateau(POINT cel, int &direct) oChannel == -1 && oIcon == -1 ) { direct = DIRECT_O; - return TRUE; + return true; } GetFloor (GetCel(cel,0,+2), fChannel, fIcon); @@ -3560,7 +3560,7 @@ BOOL CDecor::IsBuildBateau(POINT cel, int &direct) oChannel == -1 && oIcon == -1 ) { direct = DIRECT_S; - return TRUE; + return true; } GetFloor (GetCel(cel,0,-2), fChannel, fIcon); @@ -3569,11 +3569,11 @@ BOOL CDecor::IsBuildBateau(POINT cel, int &direct) oChannel == -1 && oIcon == -1 ) { direct = DIRECT_N; - return TRUE; + return true; } direct = -1; - return FALSE; + return false; } @@ -3625,16 +3625,16 @@ void CDecor::SubDrapeau(POINT cel) // Teste si une cellule a déjà été visitée. -BOOL CDecor::TestDrapeau(POINT cel) +bool CDecor::TestDrapeau(POINT cel) { int i; for ( i=0 ; iSetHWnd(0, hwnd); @@ -241,7 +241,7 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim, { TraceErrorDD(ddrval, "pixmap", 0); OutputDebug("Can't set clipper window handle\n"); - return FALSE; + return false; } ddrval = m_lpDDSPrimary->SetClipper(m_lpClipper); @@ -249,53 +249,53 @@ BOOL CPixmap::Create(HWND hwnd, POINT dim, { TraceErrorDD(ddrval, "pixmap", 0); OutputDebug("Can't attach clipper to primary surface\n"); - return FALSE; + return false; } } - return TRUE; + return true; } // Libère les bitmaps. -BOOL CPixmap::Flush() +bool CPixmap::Flush() { - return TRUE; + return true; } // Restitue les bitmaps. -BOOL CPixmap::Restore() +bool CPixmap::Restore() { RestoreAll(); - return TRUE; + return true; } // Initialise la palette système. -BOOL CPixmap::InitSysPalette() +bool CPixmap::InitSysPalette() { HDC hdc; int caps; hdc = CreateCompatibleDC(NULL); - if ( hdc == NULL ) return FALSE; + if ( hdc == NULL ) return false; if ( !m_bFullScreen ) { caps = GetDeviceCaps(hdc, SIZEPALETTE); - if ( caps == 0 ) m_bPalette = FALSE; - else m_bPalette = TRUE; + if ( caps == 0 ) m_bPalette = false; + else m_bPalette = true; } GetSystemPaletteEntries(hdc, 0, 256, m_sysPal); DeleteDC(hdc); - return TRUE; + return true; } // Indique si l'on utilise une palette. -BOOL CPixmap::IsPalette() +bool CPixmap::IsPalette() { return m_bPalette; } @@ -387,7 +387,7 @@ HRESULT CPixmap::BltFast(int chDst, int channel, if ( rcRect.left >= rcRect.right || rcRect.top >= rcRect.bottom ) return DD_OK; - while( TRUE ) + while( true ) { if ( chDst < 0 ) { @@ -427,7 +427,7 @@ HRESULT CPixmap::BltFast(LPDIRECTDRAWSURFACE lpDD, if ( mode == 0 ) dwTrans = DDBLTFAST_SRCCOLORKEY; else dwTrans = DDBLTFAST_NOCOLORKEY; - while( TRUE ) + while( true ) { ddrval = lpDD->BltFast(dst.x, dst.y, m_lpDDSurface[channel], @@ -449,28 +449,28 @@ HRESULT CPixmap::BltFast(LPDIRECTDRAWSURFACE lpDD, // Sauve toute la palette de couleurs. -BOOL CPixmap::SavePalette() +bool CPixmap::SavePalette() { HRESULT ddrval; - if ( m_lpDDPal == NULL ) return FALSE; + if ( m_lpDDPal == NULL ) return false; ddrval = m_lpDDPal->GetEntries(0, 0, 256, m_pal); - if ( ddrval != DD_OK ) return FALSE; - return TRUE; + if ( ddrval != DD_OK ) return false; + return true; } // Restitue toute la palette de couleurs. -BOOL CPixmap::RestorePalette() +bool CPixmap::RestorePalette() { HRESULT ddrval; ddrval = m_lpDDPal->SetEntries(0, 0, 256, m_pal); - if ( ddrval != DD_OK ) return FALSE; - return TRUE; + if ( ddrval != DD_OK ) return false; + return true; } // Cherche une couleur dans la palette principale. @@ -551,12 +551,12 @@ int CPixmap::SearchColor(int red, int green, int blue) // Cache une image contenant des icônes. -BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, - BOOL bUsePalette) +bool CPixmap::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, + bool bUsePalette) { HRESULT ddrval; - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + if ( channel < 0 || channel >= MAXIMAGE ) return false; if ( m_lpDDSurface[channel] != NULL ) { @@ -594,7 +594,7 @@ BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, if ( m_lpDDSurface[channel] == NULL ) { OutputDebug("Fatal error: DDLoadBitmap\n"); - return FALSE; + return false; } // Set the color key to white @@ -606,16 +606,16 @@ BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, m_totalDim[channel] = totalDim; m_iconDim[channel] = iconDim; - return TRUE; + return true; } // Cache une image globale. -BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, BOOL bUsePalette) +bool CPixmap::Cache(int channel, char *pFilename, POINT totalDim, bool bUsePalette) { POINT iconDim; - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + if ( channel < 0 || channel >= MAXIMAGE ) return false; iconDim.x = 0; iconDim.y = 0; @@ -625,9 +625,9 @@ BOOL CPixmap::Cache(int channel, char *pFilename, POINT totalDim, BOOL bUsePalet // Cache une image provenant d'un bitmap. -BOOL CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim) +bool CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim) { - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; + if ( channel < 0 || channel >= MAXIMAGE ) return false; if ( m_lpDDSurface[channel] != NULL ) { @@ -640,7 +640,7 @@ BOOL CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim) if ( m_lpDDSurface[channel] == NULL ) { OutputDebug("Fatal error: DDLoadBitmap\n"); - return FALSE; + return false; } // Set the color key to white @@ -649,7 +649,7 @@ BOOL CPixmap::Cache(int channel, HBITMAP hbm, POINT totalDim) m_totalDim[channel] = totalDim; m_iconDim[channel] = totalDim; - return TRUE; + return true; } // Purge une image. @@ -705,58 +705,58 @@ RECT CPixmap::GetClipping() // Teste si un point fait partie d'une icône. -BOOL CPixmap::IsIconPixel(int channel, int rank, POINT pos) +bool CPixmap::IsIconPixel(int channel, int rank, POINT pos) { int nbx, nby; COLORREF rgb; HDC hDC; - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; - if ( m_lpDDSurface[channel] == NULL ) return FALSE; + if ( channel < 0 || channel >= MAXIMAGE ) return false; + if ( m_lpDDSurface[channel] == NULL ) return false; if ( m_iconDim[channel].x == 0 || - m_iconDim[channel].y == 0 ) return FALSE; + m_iconDim[channel].y == 0 ) return false; nbx = m_totalDim[channel].x / m_iconDim[channel].x; nby = m_totalDim[channel].y / m_iconDim[channel].y; - if ( rank < 0 || rank >= nbx*nby ) return FALSE; + if ( rank < 0 || rank >= nbx*nby ) return false; pos.x += (rank%nbx)*m_iconDim[channel].x; pos.y += (rank/nbx)*m_iconDim[channel].y; - if ( m_lpDDSurface[channel]->GetDC(&hDC) != DD_OK ) return FALSE; + if ( m_lpDDSurface[channel]->GetDC(&hDC) != DD_OK ) return false; rgb = GetPixel(hDC, pos.x, pos.y); m_lpDDSurface[channel]->ReleaseDC(hDC); if ( rgb == m_colorSurface[2*channel+0] || - rgb == m_colorSurface[2*channel+1] ) return FALSE; + rgb == m_colorSurface[2*channel+1] ) return false; - return TRUE; + return true; } // Dessine une partie d'image rectangulaire. // Les modes sont 0=transparent, 1=opaque. -BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, - int mode, BOOL bMask) +bool CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, + int mode, bool bMask) { int nbx, nby; RECT rect; HRESULT ddrval; COLORREF oldColor1, oldColor2; - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; - if ( m_lpDDSurface[channel] == NULL ) return FALSE; + if ( channel < 0 || channel >= MAXIMAGE ) return false; + if ( m_lpDDSurface[channel] == NULL ) return false; if ( m_iconDim[channel].x == 0 || - m_iconDim[channel].y == 0 ) return FALSE; + m_iconDim[channel].y == 0 ) return false; nbx = m_totalDim[channel].x / m_iconDim[channel].x; nby = m_totalDim[channel].y / m_iconDim[channel].y; - if ( rank < 0 || rank >= nbx*nby ) return FALSE; + if ( rank < 0 || rank >= nbx*nby ) return false; rect.left = (rank%nbx)*m_iconDim[channel].x; rect.top = (rank/nbx)*m_iconDim[channel].y; @@ -769,8 +769,8 @@ BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, ddrval = BltFast(chDst, channel, pos, rect, mode); if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2); - if ( ddrval != DD_OK ) return FALSE; - return TRUE; + if ( ddrval != DD_OK ) return false; + return true; } // Dessine une partie d'image rectangulaire. @@ -783,26 +783,26 @@ BOOL CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, // 32,32 34,33 // 33,48 35,49 -BOOL CPixmap::DrawIconDemi(int chDst, int channel, int rank, POINT pos, - int mode, BOOL bMask) +bool CPixmap::DrawIconDemi(int chDst, int channel, int rank, POINT pos, + int mode, bool bMask) { int nbx, nby; RECT rect; HRESULT ddrval; COLORREF oldColor1, oldColor2; - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; - if ( m_lpDDSurface[channel] == NULL ) return FALSE; + if ( channel < 0 || channel >= MAXIMAGE ) return false; + if ( m_lpDDSurface[channel] == NULL ) return false; if ( m_iconDim[channel].x == 0 || - m_iconDim[channel].y == 0 ) return FALSE; + m_iconDim[channel].y == 0 ) return false; nbx = m_totalDim[channel].x / m_iconDim[channel].x; nby = m_totalDim[channel].y / (m_iconDim[channel].y/2); rank = (rank/32)*32+((rank%32)/2)+((rank%2)*16); - if ( rank < 0 || rank >= nbx*nby ) return FALSE; + if ( rank < 0 || rank >= nbx*nby ) return false; rect.left = (rank%nbx)* m_iconDim[channel].x; rect.top = (rank/nbx)*(m_iconDim[channel].y/2); @@ -815,32 +815,32 @@ BOOL CPixmap::DrawIconDemi(int chDst, int channel, int rank, POINT pos, ddrval = BltFast(chDst, channel, pos, rect, mode); if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2); - if ( ddrval != DD_OK ) return FALSE; - return TRUE; + if ( ddrval != DD_OK ) return false; + return true; } // Dessine une partie d'image rectangulaire. // Les modes sont 0=transparent, 1=opaque. -BOOL CPixmap::DrawIconPart(int chDst, int channel, int rank, POINT pos, +bool CPixmap::DrawIconPart(int chDst, int channel, int rank, POINT pos, int startY, int endY, - int mode, BOOL bMask) + int mode, bool bMask) { int nbx, nby; RECT rect; HRESULT ddrval; COLORREF oldColor1, oldColor2; - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; - if ( m_lpDDSurface[channel] == NULL ) return FALSE; + if ( channel < 0 || channel >= MAXIMAGE ) return false; + if ( m_lpDDSurface[channel] == NULL ) return false; if ( m_iconDim[channel].x == 0 || - m_iconDim[channel].y == 0 ) return FALSE; + m_iconDim[channel].y == 0 ) return false; nbx = m_totalDim[channel].x / m_iconDim[channel].x; nby = m_totalDim[channel].y / m_iconDim[channel].y; - if ( rank < 0 || rank >= nbx*nby ) return FALSE; + if ( rank < 0 || rank >= nbx*nby ) return false; rect.left = (rank%nbx)*m_iconDim[channel].x; rect.top = (rank/nbx)*m_iconDim[channel].y; @@ -856,21 +856,21 @@ BOOL CPixmap::DrawIconPart(int chDst, int channel, int rank, POINT pos, ddrval = BltFast(chDst, channel, pos, rect, mode); if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2); - if ( ddrval != DD_OK ) return FALSE; - return TRUE; + if ( ddrval != DD_OK ) return false; + return true; } // Dessine une partie d'image n'importe où. // Les modes sont 0=transparent, 1=opaque. -BOOL CPixmap::DrawPart(int chDst, int channel, POINT dest, RECT rect, - int mode, BOOL bMask) +bool CPixmap::DrawPart(int chDst, int channel, POINT dest, RECT rect, + int mode, bool bMask) { HRESULT ddrval; COLORREF oldColor1, oldColor2; - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; - if ( m_lpDDSurface[channel] == NULL ) return FALSE; + if ( channel < 0 || channel >= MAXIMAGE ) return false; + if ( m_lpDDSurface[channel] == NULL ) return false; oldColor1 = m_colorSurface[2*channel+0]; oldColor2 = m_colorSurface[2*channel+1]; @@ -878,41 +878,41 @@ BOOL CPixmap::DrawPart(int chDst, int channel, POINT dest, RECT rect, ddrval = BltFast(chDst, channel, dest, rect, mode); if ( bMask ) SetTransparent2(channel, oldColor1, oldColor2); - if ( ddrval != DD_OK ) return FALSE; - return TRUE; + if ( ddrval != DD_OK ) return false; + return true; } // Dessine une partie d'image rectangulaire. // Les modes sont 0=transparent, 1=opaque. -BOOL CPixmap::DrawImage(int chDst, int channel, RECT rect, int mode) +bool CPixmap::DrawImage(int chDst, int channel, RECT rect, int mode) { POINT dst; HRESULT ddrval; - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; - if ( m_lpDDSurface[channel] == NULL ) return FALSE; + if ( channel < 0 || channel >= MAXIMAGE ) return false; + if ( m_lpDDSurface[channel] == NULL ) return false; dst.x = rect.left; dst.y = rect.top; ddrval = BltFast(chDst, channel, dst, rect, mode); - if ( ddrval != DD_OK ) return FALSE; + if ( ddrval != DD_OK ) return false; if ( channel == CHBACK ) { MouseBackSave(); // sauve ce qui sera sous la souris - m_bBackDisplayed = FALSE; + m_bBackDisplayed = false; } - return TRUE; + return true; } // Construit une icône en utilisant un masque. -BOOL CPixmap::BuildIconMask(int channelMask, int rankMask, +bool CPixmap::BuildIconMask(int channelMask, int rankMask, int channel, int rankSrc, int rankDst) { int nbx, nby; @@ -920,17 +920,17 @@ BOOL CPixmap::BuildIconMask(int channelMask, int rankMask, RECT rect; HRESULT ddrval; - if ( channel < 0 || channel >= MAXIMAGE ) return FALSE; - if ( m_lpDDSurface[channel] == NULL ) return FALSE; + if ( channel < 0 || channel >= MAXIMAGE ) return false; + if ( m_lpDDSurface[channel] == NULL ) return false; if ( m_iconDim[channel].x == 0 || - m_iconDim[channel].y == 0 ) return FALSE; + m_iconDim[channel].y == 0 ) return false; nbx = m_totalDim[channel].x / m_iconDim[channel].x; nby = m_totalDim[channel].y / m_iconDim[channel].y; - if ( rankSrc < 0 || rankSrc >= nbx*nby ) return FALSE; - if ( rankDst < 0 || rankDst >= nbx*nby ) return FALSE; + if ( rankSrc < 0 || rankSrc >= nbx*nby ) return false; + if ( rankDst < 0 || rankDst >= nbx*nby ) return false; rect.left = (rankSrc%nbx)*m_iconDim[channel].x; rect.top = (rankSrc/nbx)*m_iconDim[channel].y; @@ -939,36 +939,36 @@ BOOL CPixmap::BuildIconMask(int channelMask, int rankMask, posDst.x = (rankDst%nbx)*m_iconDim[channel].x; posDst.y = (rankDst/nbx)*m_iconDim[channel].y; ddrval = BltFast(m_lpDDSurface[channel], channel, posDst, rect, 1); - if ( ddrval != DD_OK ) return FALSE; + if ( ddrval != DD_OK ) return false; if ( m_iconDim[channelMask].x == 0 || - m_iconDim[channelMask].y == 0 ) return FALSE; + m_iconDim[channelMask].y == 0 ) return false; nbx = m_totalDim[channelMask].x / m_iconDim[channelMask].x; nby = m_totalDim[channelMask].y / m_iconDim[channelMask].y; - if ( rankMask < 0 || rankMask >= nbx*nby ) return FALSE; + if ( rankMask < 0 || rankMask >= nbx*nby ) return false; rect.left = (rankMask%nbx)*m_iconDim[channelMask].x; rect.top = (rankMask/nbx)*m_iconDim[channelMask].y; rect.right = rect.left + m_iconDim[channelMask].x; rect.bottom = rect.top + m_iconDim[channelMask].y; ddrval = BltFast(m_lpDDSurface[channel], channelMask, posDst, rect, 0); - if ( ddrval != DD_OK ) return FALSE; + if ( ddrval != DD_OK ) return false; - return TRUE; + return true; } // Affiche le pixmap à l'écran. -// Retourne FALSE en cas d'erreur. +// Retourne false en cas d'erreur. -BOOL CPixmap::Display() +bool CPixmap::Display() { HRESULT ddrval; RECT DestRect, MapRect; - m_bBackDisplayed = TRUE; + m_bBackDisplayed = true; // Get screen coordinates of client window for blit GetClientRect(m_hWnd, &DestRect); @@ -993,14 +993,14 @@ BOOL CPixmap::Display() { ddrval = RestoreAll(); } - if ( ddrval != DD_OK ) return FALSE; - return TRUE; + if ( ddrval != DD_OK ) return false; + return true; } // Positionne la souris et change le lutin. -void CPixmap::SetMousePosSprite(POINT pos, int sprite, BOOL bDemoPlay) +void CPixmap::SetMousePosSprite(POINT pos, int sprite, bool bDemoPlay) { if ( m_mousePos.x == pos.x && m_mousePos.y == pos.y && @@ -1018,7 +1018,7 @@ void CPixmap::SetMousePosSprite(POINT pos, int sprite, BOOL bDemoPlay) // Positionne la souris. -void CPixmap::SetMousePos(POINT pos, BOOL bDemoPlay) +void CPixmap::SetMousePos(POINT pos, bool bDemoPlay) { if ( m_mousePos.x == pos.x && m_mousePos.y == pos.y ) return; @@ -1033,7 +1033,7 @@ void CPixmap::SetMousePos(POINT pos, BOOL bDemoPlay) // Change le lutin de la souris. -void CPixmap::SetMouseSprite(int sprite, BOOL bDemoPlay) +void CPixmap::SetMouseSprite(int sprite, bool bDemoPlay) { if ( m_mouseSprite == sprite ) return; @@ -1048,7 +1048,7 @@ void CPixmap::SetMouseSprite(int sprite, BOOL bDemoPlay) // Montre ou cache la souris. -void CPixmap::MouseShow(BOOL bShow) +void CPixmap::MouseShow(bool bShow) { m_bMouseShow = bShow; } @@ -1096,7 +1096,7 @@ void CPixmap::MouseUpdate() // Il s'agit en fait de dessiner un petit morceau rectangulaire // de m_lpDDSBack dans l'écran. -BOOL CPixmap::MouseQuickDraw(RECT rect) +bool CPixmap::MouseQuickDraw(RECT rect) { HRESULT ddrval; RECT DestRect; @@ -1124,15 +1124,15 @@ BOOL CPixmap::MouseQuickDraw(RECT rect) { ddrval = RestoreAll(); } - if ( ddrval != DD_OK ) return FALSE; - return TRUE; + if ( ddrval != DD_OK ) return false; + return true; } // Invalide la copie sous la souris. void CPixmap::MouseInvalidate() { - m_bMouseBack = FALSE; + m_bMouseBack = false; } // Enlève la souris dans m_lpDDSBack. @@ -1200,7 +1200,7 @@ void CPixmap::MouseBackSave() m_mouseBackPos.x = m_mousePos.x - m_mouseHotSpot.x; m_mouseBackPos.y = m_mousePos.y - m_mouseHotSpot.y; - m_bMouseBack = TRUE; + m_bMouseBack = true; dst.x = 0; dst.y = 0; @@ -1229,7 +1229,7 @@ void CPixmap::MouseBackSave() rcRect.bottom = LYIMAGE; } - while( TRUE ) + while( true ) { ddrval = m_lpDDSMouse->BltFast(dst.x, dst.y, m_lpDDSBack, @@ -1285,7 +1285,7 @@ void CPixmap::MouseBackRestore() rcRect.bottom -= (dst.y+DIMBLUPIY)-LYIMAGE; } - while( TRUE ) + while( true ) { ddrval = m_lpDDSBack->BltFast(dst.x, dst.y, m_lpDDSMouse, diff --git a/pixmap.h b/pixmap.h index 3c314a0..b93152d 100644 --- a/pixmap.h +++ b/pixmap.h @@ -15,44 +15,44 @@ public: CPixmap(); ~CPixmap(); - void SetDebug(BOOL bDebug); + void SetDebug(bool bDebug); - BOOL Create(HWND hwnd, POINT dim, BOOL bFullScreen, int mouseType); - BOOL Flush(); - BOOL Restore(); - BOOL InitSysPalette(); - BOOL IsPalette(); + bool Create(HWND hwnd, POINT dim, bool bFullScreen, int mouseType); + bool Flush(); + bool Restore(); + bool InitSysPalette(); + bool IsPalette(); void Fill(RECT rect, COLORREF color); - BOOL SavePalette(); - BOOL RestorePalette(); + bool SavePalette(); + bool RestorePalette(); int SearchColor(int red, int green, int blue); - BOOL Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, BOOL bUsePalette); - BOOL Cache(int channel, char *pFilename, POINT totalDim, BOOL bUsePalette); - BOOL Cache(int channel, HBITMAP hbm, POINT totalDim); + bool Cache(int channel, char *pFilename, POINT totalDim, POINT iconDim, bool bUsePalette); + bool Cache(int channel, char *pFilename, POINT totalDim, bool bUsePalette); + bool Cache(int channel, HBITMAP hbm, POINT totalDim); void Flush(int channel); void SetTransparent(int channel, COLORREF color); void SetTransparent2(int channel, COLORREF color1, COLORREF color2); void SetClipping(RECT clip); RECT GetClipping(); - BOOL IsIconPixel(int channel, int rank, POINT pos); + bool IsIconPixel(int channel, int rank, POINT pos); - BOOL DrawIcon(int chDst, int channel, int rank, POINT pos, int mode=0, BOOL bMask=FALSE); - BOOL DrawIconDemi(int chDst, int channel, int rank, POINT pos, int mode=0, BOOL bMask=FALSE); - BOOL DrawIconPart(int chDst, int channel, int rank, POINT pos, int startY, int endY, int mode=0, BOOL bMask=FALSE); - BOOL DrawPart(int chDst, int channel, POINT dest, RECT rect, int mode=0, BOOL bMask=FALSE); - BOOL DrawImage(int chDst, int channel, RECT rect, int mode=0); + bool DrawIcon(int chDst, int channel, int rank, POINT pos, int mode=0, bool bMask=false); + bool DrawIconDemi(int chDst, int channel, int rank, POINT pos, int mode=0, bool bMask=false); + bool DrawIconPart(int chDst, int channel, int rank, POINT pos, int startY, int endY, int mode=0, bool bMask=false); + bool DrawPart(int chDst, int channel, POINT dest, RECT rect, int mode=0, bool bMask=false); + bool DrawImage(int chDst, int channel, RECT rect, int mode=0); - BOOL BuildIconMask(int channelMask, int rankMask, + bool BuildIconMask(int channelMask, int rankMask, int channel, int rankSrc, int rankDst); - BOOL Display(); + bool Display(); - void SetMousePosSprite(POINT pos, int sprite, BOOL bDemoPlay); - void SetMousePos(POINT pos, BOOL bDemoPlay); - void SetMouseSprite(int sprite, BOOL bDemoPlay); - void MouseShow(BOOL bShow); + void SetMousePosSprite(POINT pos, int sprite, bool bDemoPlay); + void SetMousePos(POINT pos, bool bDemoPlay); + void SetMouseSprite(int sprite, bool bDemoPlay); + void MouseShow(bool bShow); void MouseInvalidate(); void MouseBackClear(); void MouseBackDraw(); @@ -64,7 +64,7 @@ protected: int channel, POINT dst, RECT rcRect, int mode); void MouseUpdate(); - BOOL MouseQuickDraw(RECT rect); + bool MouseQuickDraw(RECT rect); void MouseBackSave(); void MouseBackRestore(); void MouseBackDebug(); @@ -72,10 +72,10 @@ protected: void MouseHotSpot(); protected: - BOOL m_bFullScreen; + bool m_bFullScreen; int m_mouseType; - BOOL m_bDebug; - BOOL m_bPalette; + bool m_bDebug; + bool m_bPalette; HWND m_hWnd; POINT m_dim; // dimensions totales RECT m_clipRect; // rectangle de clipping @@ -84,9 +84,9 @@ protected: int m_mouseSprite; POINT m_mouseHotSpot; POINT m_mouseBackPos; - BOOL m_bMouseBack; - BOOL m_bMouseShow; - BOOL m_bBackDisplayed; + bool m_bMouseBack; + bool m_bMouseShow; + bool m_bBackDisplayed; LPDIRECTDRAW m_lpDD; // DirectDraw object LPDIRECTDRAWSURFACE m_lpDDSPrimary; // DirectDraw primary surface diff --git a/sound.cpp b/sound.cpp index 09b4a4b..0f9a936 100644 --- a/sound.cpp +++ b/sound.cpp @@ -14,7 +14,7 @@ // The following macro are used for proper error handling for DirectSound. -#define TRY_DS(exp) { { HRESULT rval = exp; if (rval != DS_OK) { TraceErrorDS(rval, __FILE__, __LINE__); return FALSE; } } } +#define TRY_DS(exp) { { HRESULT rval = exp; if (rval != DS_OK) { TraceErrorDS(rval, __FILE__, __LINE__); return false; } } } struct WaveHeader @@ -39,7 +39,7 @@ struct WaveHeader // Creates a DirectSound buffer. -BOOL CSound::CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo) +bool CSound::CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, bool bStereo) { PCMWAVEFORMAT pcmwf; DSBUFFERDESC dsbdesc; @@ -61,19 +61,19 @@ BOOL CSound::CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD d dsbdesc.lpwfxFormat = (LPWAVEFORMATEX)&pcmwf; TRY_DS(m_lpDS->CreateSoundBuffer(&dsbdesc, &m_lpDSB[dwBuf], NULL)) - return TRUE; + return true; } // Reads in data from a wave file. -BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos) +bool CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos) { // Seek to correct position in file (if necessary) if ( dwPos != 0xffffffff ) { if ( fseek(pFile, dwPos, SEEK_SET) != 0 ) { - return FALSE; + return false; } } @@ -87,7 +87,7 @@ BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWOR rval = lpDSB->Lock(0, dwSize, &pData1, &dwData1Size, &pData2, &dwData2Size, DSBLOCK_FROMWRITECURSOR); if ( rval != DS_OK ) { - return FALSE; + return false; } // Read in first chunk of data @@ -98,7 +98,7 @@ BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWOR char holder[256]; wsprintf(holder,"Data1 : %d, dwdata: %d, pFile: %d",pData1,dwData1Size,pFile); OutputDebug(holder); - return FALSE; + return false; } } @@ -107,7 +107,7 @@ BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWOR { if ( fread(pData2, dwData2Size, 1, pFile) != 1 ) { - return FALSE; + return false; } } @@ -115,19 +115,19 @@ BOOL CSound::ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWOR rval = lpDSB->Unlock(pData1, dwData1Size, pData2, dwData2Size); if ( rval != DS_OK ) { - return FALSE; + return false; } - return TRUE; + return true; } // Creates a DirectSound buffer from a wave file. -BOOL CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName) +bool CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName) { // Open the wave file FILE* pFile = fopen(pFileName, "rb"); - if ( pFile == NULL ) return FALSE; + if ( pFile == NULL ) return false; // Read in the wave header WaveHeader wavHdr; @@ -141,7 +141,7 @@ BOOL CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName) DWORD dwSize = wavHdr.dwDSize; // Is this a stereo or mono file? - BOOL bStereo = wavHdr.wChnls > 1 ? TRUE : FALSE; + bool bStereo = wavHdr.wChnls > 1 ? true : false; // Create the sound buffer for the wave file if ( !CreateSoundBuffer(dwBuf, dwSize, wavHdr.dwSRate, @@ -150,25 +150,25 @@ BOOL CSound::CreateBufferFromWaveFile(int dwBuf, char *pFileName) // Close the file fclose(pFile); - return FALSE; + return false; } // Read the data for the wave file into the sound buffer if ( !ReadData(m_lpDSB[dwBuf], pFile, dwSize, sizeof(wavHdr)) ) { fclose(pFile); - return FALSE; + return false; } // Close out the wave file fclose(pFile); - return TRUE; + return true; } // Stops all sounds. -BOOL CSound::StopAllSounds() +bool CSound::StopAllSounds() { // Make sure we have a valid sound buffer for (int i = 0; i < MAXSOUND; i ++) @@ -185,15 +185,15 @@ BOOL CSound::StopAllSounds() } } - return TRUE; + return true; } // Plays a sound using direct sound. -BOOL CSound::PlaySoundDS(DWORD dwSound, DWORD dwFlags) +bool CSound::PlaySoundDS(DWORD dwSound, DWORD dwFlags) { // Make sure the sound is valid - if ( dwSound >= MAXSOUND ) return FALSE; + if ( dwSound >= MAXSOUND ) return false; // Make sure we have a valid sound buffer if ( m_lpDSB[dwSound] ) @@ -208,7 +208,7 @@ BOOL CSound::PlaySoundDS(DWORD dwSound, DWORD dwFlags) } } - return TRUE; + return true; } @@ -282,8 +282,8 @@ CSound::CSound() { int i; - m_bEnable = FALSE; - m_bState = FALSE; + m_bEnable = false; + m_bState = false; m_MidiDeviceID = 0; m_MIDIFilename[0] = 0; m_audioVolume = 20; @@ -334,25 +334,25 @@ CSound::~CSound() // Initialisation de DirectSound. -BOOL CSound::Create(HWND hWnd) +bool CSound::Create(HWND hWnd) { if ( !DirectSoundCreate(NULL, &m_lpDS, NULL) == DS_OK ) { OutputDebug("Fatal error: DirectSoundCreate\n"); - m_bEnable = FALSE; - return FALSE; + m_bEnable = false; + return false; } m_lpDS->SetCooperativeLevel(hWnd, DSSCL_NORMAL); - m_bEnable = TRUE; + m_bEnable = true; m_hWnd = hWnd; - return TRUE; + return true; } // Retourne l'état de DirectSound. -BOOL CSound::GetEnable() +bool CSound::GetEnable() { return m_bEnable; } @@ -360,7 +360,7 @@ BOOL CSound::GetEnable() // Enclenche ou déclenche le son. -void CSound::SetState(BOOL bState) +void CSound::SetState(bool bState) { m_bState = bState; } @@ -409,10 +409,10 @@ void CSound::CacheAll() // Charge un fichier son (.wav). -BOOL CSound::Cache(int channel, char *pFilename) +bool CSound::Cache(int channel, char *pFilename) { - if ( !m_bEnable ) return FALSE; - if ( channel < 0 || channel >= MAXSOUND ) return FALSE; + if ( !m_bEnable ) return false; + if ( channel < 0 || channel >= MAXSOUND ) return false; if ( m_lpDSB[channel] != NULL ) { @@ -441,31 +441,31 @@ void CSound::Flush(int channel) // Le panoramique est compris entre -10000 (gauche), 0 (centre) // et +10000 (droite). -BOOL CSound::Play(int channel, int volume, int pan) +bool CSound::Play(int channel, int volume, int pan) { - if ( !m_bEnable ) return TRUE; - if ( !m_bState || m_audioVolume == 0 ) return TRUE; + if ( !m_bEnable ) return true; + if ( !m_bState || m_audioVolume == 0 ) return true; volume -= (MAXVOLUME-m_audioVolume)*((10000/4)/MAXVOLUME); -//? if ( volume == -10000 ) return TRUE; - if ( volume <= -10000/4 ) return TRUE; +//? if ( volume == -10000 ) return true; + if ( volume <= -10000/4 ) return true; - if ( channel < 0 || channel >= MAXSOUND ) return FALSE; - if ( m_lpDSB[channel] == NULL ) return FALSE; + if ( channel < 0 || channel >= MAXSOUND ) return false; + if ( m_lpDSB[channel] == NULL ) return false; m_lpDSB[channel]->SetVolume(volume); m_lpDSB[channel]->SetPan(pan); m_lpDSB[channel]->Play(0, 0, 0); - return TRUE; + return true; } // Fait entendre un son dans une image. // Si rank != -1, il indique le rang du blupi dont il faudra // éventuellement stopper le dernier son en cours ! -BOOL CSound::PlayImage(int channel, POINT pos, int rank) +bool CSound::PlayImage(int channel, POINT pos, int rank) { int stopCh, volumex, volumey, volume, pan; @@ -519,15 +519,15 @@ BOOL CSound::PlayImage(int channel, POINT pos, int rank) // Uses MCI to play a MIDI file. The window procedure // is notified when playback is complete. -BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename) +bool CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename) { MCI_OPEN_PARMS mciOpenParms; MCI_PLAY_PARMS mciPlayParms; DWORD dwReturn; char string[MAX_PATH]; - if ( !m_bEnable ) return TRUE; - if ( m_midiVolume == 0 ) return TRUE; + if ( !m_bEnable ) return true; + if ( m_midiVolume == 0 ) return true; InitMidiVolume(m_midiVolume); m_lastMidiVolume = m_midiVolume; @@ -555,7 +555,7 @@ BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename) mciGetErrorString(dwReturn, string, 128); OutputDebug(string); // Failed to open device. Don't close it; just return error. - return FALSE; + return false; } // The device opened successfully; get the device ID. @@ -573,22 +573,22 @@ BOOL CSound::PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename) mciGetErrorString(dwReturn, string, 128); OutputDebug(string); StopMusic(); - return FALSE; + return false; } strcpy(m_MIDIFilename, lpszMIDIFilename); - return TRUE; + return true; } // Restart the MIDI player. -BOOL CSound::RestartMusic() +bool CSound::RestartMusic() { OutputDebug("RestartMusic\n"); - if ( !m_bEnable ) return TRUE; - if ( m_midiVolume == 0 ) return TRUE; - if ( m_MIDIFilename[0] == 0 ) return FALSE; + if ( !m_bEnable ) return true; + if ( m_midiVolume == 0 ) return true; + if ( m_MIDIFilename[0] == 0 ) return false; return PlayMusic(m_hWnd, m_MIDIFilename); } @@ -620,9 +620,9 @@ void CSound::StopMusic() m_MIDIFilename[0] = 0; } -// Retourne TRUE si une musique est en cours. +// Retourne true si une musique est en cours. -BOOL CSound::IsPlayingMusic() +bool CSound::IsPlayingMusic() { return (m_MIDIFilename[0] != 0); } diff --git a/sound.h b/sound.h index 4886877..a21c5d4 100644 --- a/sound.h +++ b/sound.h @@ -19,9 +19,9 @@ public: CSound(); ~CSound(); - BOOL Create(HWND hWnd); - void SetState(BOOL bState); - BOOL GetEnable(); + bool Create(HWND hWnd); + void SetState(bool bState); + bool GetEnable(); void SetAudioVolume(int volume); int GetAudioVolume(); @@ -29,30 +29,30 @@ public: int GetMidiVolume(); void CacheAll(); - BOOL Cache(int channel, char *pFilename); + bool Cache(int channel, char *pFilename); void Flush(int channel); - BOOL Play(int channel, int volume=0, int pan=0); - BOOL PlayImage(int channel, POINT pos, int rank=-1); - BOOL PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename); - BOOL RestartMusic(); + bool Play(int channel, int volume=0, int pan=0); + bool PlayImage(int channel, POINT pos, int rank=-1); + bool PlayMusic(HWND hWnd, LPSTR lpszMIDIFilename); + bool RestartMusic(); void SuspendMusic(); void StopMusic(); - BOOL IsPlayingMusic(); + bool IsPlayingMusic(); void AdaptVolumeMusic(); void SetSuspendSkip(int nb); protected: - BOOL CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, BOOL bStereo); - BOOL ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos); - BOOL CreateBufferFromWaveFile(int dwBuf, char *pFileName); - BOOL StopAllSounds(); - BOOL PlaySoundDS(DWORD dwSound, DWORD dwFlags); + bool CreateSoundBuffer(int dwBuf, DWORD dwBufSize, DWORD dwFreq, DWORD dwBitsPerSample, DWORD dwBlkAlign, bool bStereo); + bool ReadData(LPDIRECTSOUNDBUFFER lpDSB, FILE* pFile, DWORD dwSize, DWORD dwPos); + bool CreateBufferFromWaveFile(int dwBuf, char *pFileName); + bool StopAllSounds(); + bool PlaySoundDS(DWORD dwSound, DWORD dwFlags); protected: HWND m_hWnd; - BOOL m_bEnable; - BOOL m_bState; + bool m_bEnable; + bool m_bState; LPDIRECTSOUND m_lpDS; LPDIRECTSOUNDBUFFER m_lpDSB[MAXSOUND]; short m_channelBlupi[MAXBLUPI]; diff --git a/wave.cpp b/wave.cpp index eed350e..095d392 100644 --- a/wave.cpp +++ b/wave.cpp @@ -21,7 +21,7 @@ WAVEFILE, *LPWAVEFILE; // Function Prototypes -BOOL wave_ParseWaveMemory(void *pvRes, +bool wave_ParseWaveMemory(void *pvRes, WAVEFORMATEX **ppWaveHeader, BYTE **ppbWaveData, DWORD *pcbWaveSize); @@ -80,7 +80,7 @@ LPVOID WAVE_LoadResource // ////////////////////////////////////////////////////////////////// -BOOL wave_ParseWaveMemory +bool wave_ParseWaveMemory (LPVOID lpChunkOfMemory, // Points to raw ram LPWAVEFORMATEX *lplpWaveHeader, // Points to pointer to header @@ -115,10 +115,10 @@ BOOL wave_ParseWaveMemory // Using the mmioFOURCC macro (part of Windows SDK), ensure // that this is a RIFF WAVE chunk of memory if (dwRiff != mmioFOURCC('R', 'I', 'F', 'F')) - return FALSE; // not even RIFF + return false; // not even RIFF if (dwType != mmioFOURCC('W', 'A', 'V', 'E')) - return FALSE; // not a WAV + return false; // not a WAV // Find the pointer to the end of the chunk of memory pdwEnd = (DWORD *)((BYTE *)pdw + dwLength-4); @@ -137,7 +137,7 @@ BOOL wave_ParseWaveMemory if (lplpWaveHeader && !*lplpWaveHeader) { if (dwLength < sizeof(WAVEFORMAT)) - return FALSE; // something's wrong! Not a WAV + return false; // something's wrong! Not a WAV // Set the lplpWaveHeader to point to this part of // the memory chunk @@ -150,7 +150,7 @@ BOOL wave_ParseWaveMemory if ((!lplpWaveSamples || *lplpWaveSamples) && (!lpcbWaveSize || *lpcbWaveSize)) { - return TRUE; + return true; } } break; @@ -171,7 +171,7 @@ BOOL wave_ParseWaveMemory // Make sure we have our header pointer set up. // If we do, we can exit if (!lplpWaveHeader || *lplpWaveHeader) - return TRUE; + return true; } break; @@ -183,7 +183,7 @@ BOOL wave_ParseWaveMemory // Failed! If we made it here, we did not get all the pieces // of the wave - return FALSE; + return false; } // wave_ParseWaveMemory