From 2a1128ecefa48d6b4c0174189744da5c45666f31 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Mon, 14 Aug 2017 22:10:26 +0200 Subject: [PATCH] COsmetic: update clang-format definition --- src/.clang-format | 2 +- src/action.cxx | 12 ++- src/blupi.cxx | 36 +++++--- src/button.cxx | 51 +++++++---- src/decblupi.cxx | 172 ++++++++++++++++++++++++------------- src/decgoal.cxx | 3 +- src/decio.cxx | 13 +-- src/decmap.cxx | 18 ++-- src/decmove.cxx | 51 +++++++---- src/decor.cxx | 201 +++++++++++++++++++++++++++++--------------- src/decstat.cxx | 33 +++++--- src/event.cxx | 210 ++++++++++++++++++++++++++++++---------------- src/fix.cxx | 42 ++++++---- src/fog.cxx | 9 +- src/menu.cxx | 48 +++++++---- src/misc.cxx | 27 ++++-- src/misc.h | 3 +- src/movie.cxx | 39 ++++++--- src/obstacle.cxx | 136 ++++++++++++++++++++---------- src/path.cxx | 21 +++-- src/pixmap.cxx | 76 +++++++++++------ src/progress.cxx | 21 +++-- src/sound.cxx | 63 +++++++++----- src/text.cxx | 34 +++++--- src/text.h | 8 +- 25 files changed, 883 insertions(+), 446 deletions(-) diff --git a/src/.clang-format b/src/.clang-format index 717a95d..5c925b2 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -15,7 +15,7 @@ AllowShortFunctionsOnASingleLine: Inline AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None +AlwaysBreakAfterReturnType: TopLevelDefinitions AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: true BinPackArguments: true diff --git a/src/action.cxx b/src/action.cxx index b30b235..84eb580 100644 --- a/src/action.cxx +++ b/src/action.cxx @@ -2730,7 +2730,8 @@ static const DescAction action_table[] = // Calcule l'action suivante. // Retourne false lorsque l'action est terminée. -bool Action ( +bool +Action ( Sint16 action, Sint16 direct, Sint16 & phase, Sint16 & step, Sint16 & channel, Sint16 & icon, POINT & pos, Sint16 & posZ, Sounds & sound) { @@ -2816,7 +2817,8 @@ static const Sint16 rotate_table[] = // Tourne une icône dans une direction donnée. -bool Rotate (Sint16 & icon, Sint16 direct) +bool +Rotate (Sint16 & icon, Sint16 direct) { const auto * pTable = rotate_table; Sint16 i; @@ -2877,7 +2879,8 @@ bool Rotate (Sint16 & icon, Sint16 direct) // Retourne la direction d'une icône. -Sint32 GetIconDirect (Sint16 icon) +Sint32 +GetIconDirect (Sint16 icon) { const auto * pTable = rotate_table; Sint16 i; @@ -2909,7 +2912,8 @@ Sint32 GetIconDirect (Sint16 icon) // Retourne l'amplitude d'une action, en nombre // de cellules. -Sint32 GetAmplitude (Sint16 action) +Sint32 +GetAmplitude (Sint16 action) { switch (action) { diff --git a/src/blupi.cxx b/src/blupi.cxx index c058952..8578d73 100644 --- a/src/blupi.cxx +++ b/src/blupi.cxx @@ -82,7 +82,8 @@ struct url_data { }; template -static void split (const std::string & s, char delim, Out result) +static void +split (const std::string & s, char delim, Out result) { std::stringstream ss; ss.str (s); @@ -91,7 +92,8 @@ static void split (const std::string & s, char delim, Out result) *(result++) = item; } -static std::vector split (const std::string & s, char delim) +static std::vector +split (const std::string & s, char delim) { std::vector elems; split (s, delim, std::back_inserter (elems)); @@ -103,7 +105,8 @@ static std::vector split (const std::string & s, char delim) * * \returns true on success. */ -static bool ReadConfig () +static bool +ReadConfig () { const auto config = GetBaseDir () + "data/config.json"; @@ -157,7 +160,8 @@ static bool ReadConfig () /** * \brief Main frame update. */ -static void UpdateFrame (void) +static void +UpdateFrame (void) { RECT clip, rcRect; Uint32 phase; @@ -254,7 +258,8 @@ static void UpdateFrame (void) /** * \brief Finished with all objects we use; release them. */ -static void FinishObjects (void) +static void +FinishObjects (void) { if (g_pMovie != nullptr) { @@ -289,7 +294,8 @@ static void FinishObjects (void) } } -static void HandleEvent (const SDL_Event & event) +static void +HandleEvent (const SDL_Event & event) { POINT totalDim, iconDim; @@ -418,7 +424,8 @@ static void HandleEvent (const SDL_Event & event) // Error with DoInit function. -static void InitFail (const char * msg) +static void +InitFail (const char * msg) { char buffer[100]; @@ -450,7 +457,8 @@ updateCallback (void * ptr, size_t size, size_t nmemb, void * data) return realsize; } -static void CheckForUpdates () +static void +CheckForUpdates () { url_data chunk; @@ -490,7 +498,8 @@ static void CheckForUpdates () curl_easy_cleanup (curl); } -static int parseArgs (int argc, char * argv[], bool & exit) +static int +parseArgs (int argc, char * argv[], bool & exit) { argagg::parser argparser{{ {"help", {"-h", "--help"}, "print this help message and exit", 0}, @@ -573,7 +582,8 @@ static int parseArgs (int argc, char * argv[], bool & exit) // Main initialization function. -static int DoInit (int argc, char * argv[], bool & exit) +static int +DoInit (int argc, char * argv[], bool & exit) { int rc = parseArgs (argc, argv, exit); if (exit) @@ -876,7 +886,8 @@ static int DoInit (int argc, char * argv[], bool & exit) return EXIT_SUCCESS; } -static void initGettext () +static void +initGettext () { setlocale (LC_ALL, ""); textdomain ("planetblupi"); @@ -884,7 +895,8 @@ static void initGettext () bind_textdomain_codeset ("planetblupi", "UTF-8"); } -int main (int argc, char * argv[]) +int +main (int argc, char * argv[]) { initGettext (); diff --git a/src/button.cxx b/src/button.cxx index a35395e..8a38630 100644 --- a/src/button.cxx +++ b/src/button.cxx @@ -54,7 +54,8 @@ CButton::~CButton () // Crée un nouveau bouton. -bool CButton::Create ( +bool +CButton::Create ( CPixmap * pPixmap, CSound * pSound, POINT pos, Sint32 type, Sint32 * pMenu, Sint32 nbMenu, const char ** pToolTips, Sint32 region, Uint32 message) { @@ -141,7 +142,8 @@ bool CButton::Create ( // Dessine un bouton dans son état. -void CButton::Draw () +void +CButton::Draw () { Sint32 i; POINT pos; @@ -184,50 +186,59 @@ void CButton::Draw () } } -Sint32 CButton::GetState () +Sint32 +CButton::GetState () { return m_state; } -void CButton::SetState (Sint32 state) +void +CButton::SetState (Sint32 state) { m_state = state; m_mouseState = state; } -Sint32 CButton::GetMenu () +Sint32 +CButton::GetMenu () { return m_selMenu; } -void CButton::SetMenu (Sint32 menu) +void +CButton::SetMenu (Sint32 menu) { m_selMenu = menu; } -bool CButton::GetEnable () +bool +CButton::GetEnable () { return m_bEnable; } -void CButton::SetEnable (bool bEnable) +void +CButton::SetEnable (bool bEnable) { m_bEnable = bEnable; } -bool CButton::GetHide () +bool +CButton::GetHide () { return m_bHide; } -void CButton::SetHide (bool bHide) +void +CButton::SetHide (bool bHide) { m_bHide = bHide; } // Traitement d'un événement. -bool CButton::TreatEvent (const SDL_Event & event) +bool +CButton::TreatEvent (const SDL_Event & event) { POINT pos; @@ -277,7 +288,8 @@ bool CButton::TreatEvent (const SDL_Event & event) // Indique si la souris est sur ce bouton. -bool CButton::MouseOnButton (POINT pos) +bool +CButton::MouseOnButton (POINT pos) { return Detect (pos); } @@ -285,7 +297,8 @@ bool CButton::MouseOnButton (POINT pos) // Retourne le tooltips pour un bouton, en fonction // de la position de la souris. -const char * CButton::GetToolTips (POINT pos) +const char * +CButton::GetToolTips (POINT pos) { Sint32 width = m_dim.x; Sint32 rank; @@ -320,7 +333,8 @@ const char * CButton::GetToolTips (POINT pos) // Détecte si la souris est dans le bouton. -bool CButton::Detect (POINT pos) +bool +CButton::Detect (POINT pos) { Sint32 width = m_dim.x; @@ -340,7 +354,8 @@ bool CButton::Detect (POINT pos) // Bouton de la souris pressé. -bool CButton::MouseDown (POINT pos) +bool +CButton::MouseDown (POINT pos) { if (!Detect (pos)) return false; @@ -356,7 +371,8 @@ bool CButton::MouseDown (POINT pos) // Souris déplacés. -bool CButton::MouseMove (POINT pos) +bool +CButton::MouseMove (POINT pos) { bool bDetect; Sint32 iState, iMenu; @@ -398,7 +414,8 @@ bool CButton::MouseMove (POINT pos) // Bouton de la souris relâché. -bool CButton::MouseUp (POINT pos) +bool +CButton::MouseUp (POINT pos) { bool bDetect; diff --git a/src/decblupi.cxx b/src/decblupi.cxx index e2d7679..b0e1a9d 100644 --- a/src/decblupi.cxx +++ b/src/decblupi.cxx @@ -43,7 +43,8 @@ const Sint16 table_actions[] = { // Supprime tous les blupi. -void CDecor::BlupiFlush () +void +CDecor::BlupiFlush () { Sint32 i; @@ -55,7 +56,8 @@ void CDecor::BlupiFlush () // Crée un nouveau blupi, et retourne son rang. -Sint32 CDecor::BlupiCreate ( +Sint32 +CDecor::BlupiCreate ( POINT cel, Sint32 action, Sint32 direct, Sint32 perso, Sint32 energy) { Sint32 rank; @@ -158,7 +160,8 @@ Sint32 CDecor::BlupiCreate ( // Si perso == -1, supprime n'importe quel personnage ici. // Si perso >= 0, supprime seulement ce personnage. -bool CDecor::BlupiDelete (POINT cel, Sint32 perso) +bool +CDecor::BlupiDelete (POINT cel, Sint32 perso) { Sint32 rank; @@ -193,7 +196,8 @@ bool CDecor::BlupiDelete (POINT cel, Sint32 perso) // Supprime un blupi existant. -void CDecor::BlupiDelete (Sint32 rank) +void +CDecor::BlupiDelete (Sint32 rank) { m_blupi[rank].bExist = false; @@ -211,7 +215,8 @@ void CDecor::BlupiDelete (Sint32 rank) // type=0 -> explosion // type=1 -> électro -void CDecor::BlupiKill (Sint32 exRank, POINT cel, Sint32 type) +void +CDecor::BlupiKill (Sint32 exRank, POINT cel, Sint32 type) { Sint32 rank, action, x, y, icon; @@ -273,7 +278,8 @@ void CDecor::BlupiKill (Sint32 exRank, POINT cel, Sint32 type) // Test si un blupi existe. -bool CDecor::BlupiIfExist (Sint32 rank) +bool +CDecor::BlupiIfExist (Sint32 rank) { return !!m_blupi[rank].bExist; } @@ -282,7 +288,8 @@ bool CDecor::BlupiIfExist (Sint32 rank) // #1 -> (POWER) redonne l'énergie maximale // #2 -> (LONESOME) tue toutes les araignées/virus/etc. -void CDecor::BlupiCheat (Sint32 cheat) +void +CDecor::BlupiCheat (Sint32 cheat) { Sint32 rank; @@ -309,7 +316,8 @@ void CDecor::BlupiCheat (Sint32 cheat) // Actualise un blupi pour pouvoir le dessiner dans son état. -void CDecor::BlupiActualise (Sint32 rank) +void +CDecor::BlupiActualise (Sint32 rank) { Sounds sound; @@ -328,7 +336,8 @@ void CDecor::BlupiActualise (Sint32 rank) // Adapte une icône. -void CDecor::BlupiAdaptIcon (Sint32 rank) +void +CDecor::BlupiAdaptIcon (Sint32 rank) { Sint32 direct; @@ -416,7 +425,8 @@ void CDecor::BlupiAdaptIcon (Sint32 rank) // Si bStop=true, on stoppe le son précédent associé // à ce blupi (rank), si nécessaire. -void CDecor::BlupiSound (Sint32 rank, Sounds sound, POINT pos, bool bStop) +void +CDecor::BlupiSound (Sint32 rank, Sounds sound, POINT pos, bool bStop) { Sounds newSound; @@ -474,7 +484,8 @@ static const struct { // Effectue quelques initialisations pour une nouvelle action. -void CDecor::BlupiInitAction (Sint32 rank, Sint32 action, Sint32 direct) +void +CDecor::BlupiInitAction (Sint32 rank, Sint32 action, Sint32 direct) { POINT pos; Sint32 rand; @@ -750,7 +761,8 @@ void CDecor::BlupiInitAction (Sint32 rank, Sint32 action, Sint32 direct) // Change l'action de blupi. -void CDecor::BlupiChangeAction (Sint32 rank, Sint32 action, Sint32 direct) +void +CDecor::BlupiChangeAction (Sint32 rank, Sint32 action, Sint32 direct) { if (rank < 0) return; @@ -765,7 +777,8 @@ void CDecor::BlupiChangeAction (Sint32 rank, Sint32 action, Sint32 direct) // Vide la liste des actions. -void CDecor::ListFlush (Sint32 rank) +void +CDecor::ListFlush (Sint32 rank) { Sint32 i; @@ -777,7 +790,8 @@ void CDecor::ListFlush (Sint32 rank) // Retourne le paramètre associé à une action. -Sint32 CDecor::ListGetParam (Sint32 rank, Buttons button, POINT cel) +Sint32 +CDecor::ListGetParam (Sint32 rank, Buttons button, POINT cel) { Sint32 icon; @@ -801,7 +815,8 @@ Sint32 CDecor::ListGetParam (Sint32 rank, Buttons button, POINT cel) // Ajoute une action dans la liste. -bool CDecor::ListPut (Sint32 rank, Buttons button, POINT cel, POINT cMem) +bool +CDecor::ListPut (Sint32 rank, Buttons button, POINT cel, POINT cMem) { Sint32 i, last; @@ -844,7 +859,8 @@ bool CDecor::ListPut (Sint32 rank, Buttons button, POINT cel, POINT cMem) // Enlève la dernière action ajoutée dans la liste. -void CDecor::ListRemove (Sint32 rank) +void +CDecor::ListRemove (Sint32 rank) { Sint32 i; @@ -865,7 +881,8 @@ void CDecor::ListRemove (Sint32 rank) // Retourne la profondeur de la répétition. // Retourne -1 si aucune répétiton n'est possible. -Sint32 CDecor::ListSearch ( +Sint32 +CDecor::ListSearch ( Sint32 rank, Buttons button, POINT cel, const char *& textForButton) { Sint32 i, j, param, nb; @@ -970,7 +987,8 @@ Sint32 CDecor::ListSearch ( // Ajuste une action à répéter. -bool CDecor::RepeatAdjust ( +bool +CDecor::RepeatAdjust ( Sint32 rank, Sint32 button, POINT & cel, POINT & cMem, Sint32 param, Sint32 list) { @@ -1153,7 +1171,8 @@ ok: // Démarre une action. -void CDecor::GoalStart (Sint32 rank, Sint32 action, POINT cel) +void +CDecor::GoalStart (Sint32 rank, Sint32 action, POINT cel) { m_blupi[rank].goalHili = cel; m_blupi[rank].goalAction = action; @@ -1168,7 +1187,8 @@ void CDecor::GoalStart (Sint32 rank, Sint32 action, POINT cel) // Effectue la méta opération suivante. // Retourne false lorsque c'est fini ! -bool CDecor::GoalNextPhase (Sint32 rank) +bool +CDecor::GoalNextPhase (Sint32 rank) { Sint16 * pTable; Sint32 i, nb; @@ -1211,7 +1231,8 @@ bool CDecor::GoalNextPhase (Sint32 rank) // Initialise la jauge pour une méta opération. -void CDecor::GoalInitJauge (Sint32 rank) +void +CDecor::GoalInitJauge (Sint32 rank) { Sint16 * pTable; Sint32 max = 0, op; @@ -1250,7 +1271,8 @@ term: // Permet de passer à travers certains arbres. -void CDecor::GoalInitPassCel (Sint32 rank) +void +CDecor::GoalInitPassCel (Sint32 rank) { POINT cel; Sint32 channel, icon; @@ -1279,7 +1301,8 @@ void CDecor::GoalInitPassCel (Sint32 rank) // Ajuste une coordonnée de cellule. -void CDecor::GoalAdjustCel (Sint32 rank, Sint32 & x, Sint32 & y) +void +CDecor::GoalAdjustCel (Sint32 rank, Sint32 & x, Sint32 & y) { if (x == -10 && y == -10) { @@ -1322,7 +1345,8 @@ Sint32 table_multi_goal[16 * 2] = { // Effectue une méta opération. -bool CDecor::GoalNextOp (Sint32 rank, Sint16 * pTable) +bool +CDecor::GoalNextOp (Sint32 rank, Sint16 * pTable) { Sint32 op, x, y; Sint32 action, direct, channel, icon, mchannel, micon; @@ -2124,7 +2148,8 @@ error: // Supprime le blocage de la cellule dans laquelle // blupi travaille. -void CDecor::GoalUnwork (Sint32 rank) +void +CDecor::GoalUnwork (Sint32 rank) { Sint32 x, y; @@ -2142,7 +2167,8 @@ void CDecor::GoalUnwork (Sint32 rank) // Stoppe complètement une action. -void CDecor::GoalStop (Sint32 rank, bool bError, bool bSound) +void +CDecor::GoalStop (Sint32 rank, bool bError, bool bSound) { POINT pos; @@ -2207,7 +2233,8 @@ void CDecor::GoalStop (Sint32 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) { Sint32 rank; @@ -2224,7 +2251,8 @@ bool CDecor::BlupiIsGoalUsed (POINT cel) // Démarre ou stoppe un rayon entre deux tours. -void CDecor::BlupiStartStopRayon (Sint32 rank, POINT startCel, POINT endCel) +void +CDecor::BlupiStartStopRayon (Sint32 rank, POINT startCel, POINT endCel) { Sint32 i, icon, icon2; POINT cel, cel2, vector, pos; @@ -2296,7 +2324,8 @@ void CDecor::BlupiStartStopRayon (Sint32 rank, POINT startCel, POINT endCel) // Tourne un blupi, si nécessaire. // Retourne false si ce n'est pas nécessaire. -bool CDecor::BlupiRotate (Sint32 rank) +bool +CDecor::BlupiRotate (Sint32 rank) { Sint32 aDirect, sDirect, ip, in, sens = 0; bool bOK; @@ -2420,7 +2449,8 @@ bool CDecor::BlupiRotate (Sint32 rank) // Avance un blupi existant. -bool CDecor::BlupiNextAction (Sint32 rank) +bool +CDecor::BlupiNextAction (Sint32 rank) { bool bOK; POINT pos, iCel; @@ -2642,7 +2672,8 @@ bool CDecor::BlupiNextAction (Sint32 rank) // Action suivante pour un blupi existant. -void CDecor::BlupiNextGoal (Sint32 rank) +void +CDecor::BlupiNextGoal (Sint32 rank) { Sint32 direct, action, channel, icon, min, lg, fRank, i; POINT pos, cel, vector; @@ -3148,7 +3179,8 @@ init: // Calcule la cellule de destination. -void CDecor::BlupiDestCel (Sint32 rank) +void +CDecor::BlupiDestCel (Sint32 rank) { Sint32 a; POINT vector; @@ -3187,7 +3219,8 @@ void CDecor::BlupiDestCel (Sint32 rank) // Avance tous les blupis. -void CDecor::BlupiStep (bool bFirst) +void +CDecor::BlupiStep (bool bFirst) { Sint32 rank; @@ -3215,7 +3248,8 @@ void CDecor::BlupiStep (bool bFirst) // Retourne le rectangle occupé par un blupi, // pour les sélections (pas exact). -void CDecor::BlupiGetRect (Sint32 rank, RECT & rect) +void +CDecor::BlupiGetRect (Sint32 rank, RECT & rect) { POINT pos; @@ -3231,7 +3265,8 @@ void CDecor::BlupiGetRect (Sint32 rank, RECT & rect) // Retourne le blupi visé par la souris. -Sint32 CDecor::GetTargetBlupi (POINT pos) +Sint32 +CDecor::GetTargetBlupi (POINT pos) { Sint32 rank, found, prof; POINT test, rel, cel; @@ -3278,7 +3313,8 @@ Sint32 CDecor::GetTargetBlupi (POINT pos) // Déslectionne tous les blupi. -void CDecor::BlupiDeselect () +void +CDecor::BlupiDeselect () { Sint32 rank; @@ -3294,7 +3330,8 @@ void CDecor::BlupiDeselect () // Déslectionne un blupi. -void CDecor::BlupiDeselect (Sint32 rank) +void +CDecor::BlupiDeselect (Sint32 rank) { m_blupi[rank].bHili = false; m_blupi[rank].bArrow = false; @@ -3309,7 +3346,8 @@ void CDecor::BlupiDeselect (Sint32 rank) // Met ou enlève une flèche au blupi sélectionné blupi. -void CDecor::BlupiSetArrow (Sint32 rank, bool bArrow) +void +CDecor::BlupiSetArrow (Sint32 rank, bool bArrow) { m_celArrow.x = -1; @@ -3324,7 +3362,8 @@ void CDecor::BlupiSetArrow (Sint32 rank, bool bArrow) // Initialise la zone outline en fonction du rectangle de sélection. -void CDecor::InitOutlineRect () +void +CDecor::InitOutlineRect () { if (!m_bOutline && m_bHiliRect) { @@ -3346,7 +3385,8 @@ void CDecor::InitOutlineRect () // Sélectionne un blupi lorsque le bouton est pressé. -void CDecor::BlupiHiliDown (POINT pos, bool bAdd) +void +CDecor::BlupiHiliDown (POINT pos, bool bAdd) { if (MapMove (pos)) return; @@ -3364,7 +3404,8 @@ void CDecor::BlupiHiliDown (POINT pos, bool bAdd) // Sélectionne un blupi lorsque la souris est déplacée. -void CDecor::BlupiHiliMove (POINT pos) +void +CDecor::BlupiHiliMove (POINT pos) { if (m_bHiliRect) // rectangle de sélection existe ? { @@ -3376,7 +3417,8 @@ void CDecor::BlupiHiliMove (POINT pos) // Sélectionne un blupi lorsque le bouton est relâché. // Retourne false si la sélection n'a pas changé ! -void CDecor::BlupiHiliUp (POINT pos) +void +CDecor::BlupiHiliUp (POINT pos) { Sint32 rank, r, nb; Sounds sound; @@ -3500,7 +3542,8 @@ void CDecor::BlupiHiliUp (POINT pos) // Dessine le rectangle de sélection, si nécessaire. -void CDecor::BlupiDrawHili () +void +CDecor::BlupiDrawHili () { POINT c1, c2, cc; POINT p1, p2, p3, p4; @@ -3652,7 +3695,8 @@ void CDecor::BlupiDrawHili () // Est utilisé pour trouver que faire lors d'un clic // avec le bouton de droite. -Buttons CDecor::GetDefButton (POINT cel) +Buttons +CDecor::GetDefButton (POINT cel) { Buttons button; Sint32 rank, channel, icon; @@ -3751,7 +3795,8 @@ Buttons CDecor::GetDefButton (POINT cel) // Indique un but visé à Sint32 terme, pour un blupi donné. -bool CDecor::BlupiGoal (Sint32 rank, Buttons button, POINT cel, POINT cMem) +bool +CDecor::BlupiGoal (Sint32 rank, Buttons button, POINT cel, POINT cMem) { POINT goalHili, goalHili2, goal, test; Sint32 i, action, channel, icon, error, direct, step; @@ -4014,7 +4059,8 @@ bool CDecor::BlupiGoal (Sint32 rank, Buttons button, POINT cel, POINT cMem) // Indique un but visé à Sint32 terme, pour tous les blupi // sélectionnés. -void CDecor::BlupiGoal (POINT cel, Buttons button) +void +CDecor::BlupiGoal (POINT cel, Buttons button) { POINT bPos, avg; Sint32 rank, nb, nbHili; @@ -4093,7 +4139,8 @@ void CDecor::BlupiGoal (POINT cel, Buttons 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) { Sint32 rank; @@ -4132,8 +4179,8 @@ bool CDecor::IsTracksHere (POINT cel, bool bSkipInMove) // Indique si une cellule est occupée par un blupi. // Le blupi donné dans exRank est ignoré ! -bool CDecor::IsBlupiHereEx ( - POINT cel1, POINT cel2, Sint32 exRank, bool bSkipInMove) +bool +CDecor::IsBlupiHereEx (POINT cel1, POINT cel2, Sint32 exRank, bool bSkipInMove) { Sint32 rank; @@ -4177,7 +4224,8 @@ bool CDecor::IsBlupiHereEx ( // Indique si une cellule est occupée par un blupi. // Le blupi donné dans exRank est ignoré ! -bool CDecor::IsBlupiHereEx (POINT cel, Sint32 exRank, bool bSkipInMove) +bool +CDecor::IsBlupiHereEx (POINT cel, Sint32 exRank, bool bSkipInMove) { Sint32 rank; @@ -4213,7 +4261,8 @@ bool CDecor::IsBlupiHereEx (POINT cel, Sint32 exRank, bool bSkipInMove) // Indique si une cellule est occupée par un blupi. -bool CDecor::IsBlupiHere (POINT cel, bool bSkipInMove) +bool +CDecor::IsBlupiHere (POINT cel, bool bSkipInMove) { return IsBlupiHereEx (cel, -1, bSkipInMove); } @@ -4221,7 +4270,8 @@ bool CDecor::IsBlupiHere (POINT cel, bool bSkipInMove) // Indique si une cellule future (dans une direction donnée) // est déjà occupée par un blupi. -bool CDecor::IsBlupiHere (POINT cel, Sint32 direct, bool bSkipInMove) +bool +CDecor::IsBlupiHere (POINT cel, Sint32 direct, bool bSkipInMove) { POINT vector; @@ -4235,7 +4285,8 @@ bool CDecor::IsBlupiHere (POINT cel, Sint32 direct, bool bSkipInMove) // Retourne les niveaux des jauges. -void CDecor::GetLevelJauge (Sint32 * pLevels, Sint32 * pTypes) +void +CDecor::GetLevelJauge (Sint32 * pLevels, Sint32 * pTypes) { Sint32 rank; @@ -4266,7 +4317,8 @@ void CDecor::GetLevelJauge (Sint32 * pLevels, Sint32 * pTypes) // effectue une action prioritaire. Dans ce cas, il faut tout // de suite mettre le menu "stoppe" s'il est cliqué. -bool CDecor::IsWorkBlupi (Sint32 rank) +bool +CDecor::IsWorkBlupi (Sint32 rank) { if ( m_blupi[rank].bHili && m_blupi[m_rankBlupiHili].goalAction != 0 && @@ -4279,7 +4331,8 @@ bool CDecor::IsWorkBlupi (Sint32 rank) // Retourne les boutons possibles à un endroit donné, // pour le blupi sélectionné. -void CDecor::BlupiGetButtons ( +void +CDecor::BlupiGetButtons ( POINT pos, Sint32 & nb, Buttons * pButtons, Errors * pErrors, std::unordered_map & texts, Sint32 & perso) { @@ -4477,7 +4530,8 @@ void CDecor::BlupiGetButtons ( // Initialise les conditions de fin. -void CDecor::TerminatedInit () +void +CDecor::TerminatedInit () { m_winCount = 50; @@ -4496,7 +4550,8 @@ void CDecor::TerminatedInit () // Retourne 1 si la partie est perdue. // Retourne 2 si la partie est gagnée. -Sint32 CDecor::IsTerminated () +Sint32 +CDecor::IsTerminated () { Sint32 nb, count, out; POINT pos; @@ -4632,7 +4687,8 @@ delay: // Retourne la structure pour terminer une partie. -Term * CDecor::GetTerminated () +Term * +CDecor::GetTerminated () { return &m_term; } diff --git a/src/decgoal.cxx b/src/decgoal.cxx index b0d23c2..32c2f1c 100644 --- a/src/decgoal.cxx +++ b/src/decgoal.cxx @@ -3550,7 +3550,8 @@ static Sint16 *table_pGoal[] = // Retourne le pointeur à la table table_goal_*. -Sint16 * GetTableGoal (Sint32 action) +Sint16 * +GetTableGoal (Sint32 action) { Sint16 ** ppTable = table_pGoal; diff --git a/src/decio.cxx b/src/decio.cxx index 2accee4..371843f 100644 --- a/src/decio.cxx +++ b/src/decio.cxx @@ -105,8 +105,8 @@ typedef struct { // Sauve le décor sur disque. -bool CDecor::Write ( - Sint32 rank, bool bUser, Sint32 world, Sint32 time, Sint32 total) +bool +CDecor::Write (Sint32 rank, bool bUser, Sint32 world, Sint32 time, Sint32 total) { std::string filename; FILE * file = nullptr; @@ -188,7 +188,8 @@ error: // Lit le décor sur disque. -bool CDecor::Read ( +bool +CDecor::Read ( Sint32 rank, bool bUser, Sint32 & world, Sint32 & time, Sint32 & total) { std::string filename; @@ -327,7 +328,8 @@ error: // Indique si un fichier existe sur disque. -bool CDecor::FileExist ( +bool +CDecor::FileExist ( Sint32 rank, bool bUser, Sint32 & world, Sint32 & time, Sint32 & total) { std::string filename; @@ -401,7 +403,8 @@ error: // Initialise un décor neutre. -void CDecor::Flush () +void +CDecor::Flush () { Sint32 x, y, i, icon; diff --git a/src/decmap.cxx b/src/decmap.cxx index d77d14a..e5fdc43 100644 --- a/src/decmap.cxx +++ b/src/decmap.cxx @@ -53,7 +53,8 @@ static Uint32 g_map32_bits[DIMMAPY][DIMMAPX]; // Initialise les couleurs pour la carte. -void CDecor::MapInitColors () +void +CDecor::MapInitColors () { // FIXME: add big-endian support const auto MapRGB = [](Uint8 r, Uint8 g, Uint8 b) { @@ -108,7 +109,8 @@ void CDecor::MapInitColors () // COnversion d'un cellule en point dans la carte. -POINT CDecor::ConvCelToMap (POINT cel) +POINT +CDecor::ConvCelToMap (POINT cel) { POINT pos; @@ -123,7 +125,8 @@ POINT CDecor::ConvCelToMap (POINT cel) // Conversion d'un point dans la carte en cellule. -POINT CDecor::ConvMapToCel (POINT pos) +POINT +CDecor::ConvMapToCel (POINT pos) { POINT cel; @@ -141,7 +144,8 @@ POINT CDecor::ConvMapToCel (POINT pos) // Déplace le décor suite à un clic dans la carte. -bool CDecor::MapMove (POINT pos) +bool +CDecor::MapMove (POINT pos) { POINT cel; @@ -420,7 +424,8 @@ static char color_fire[4] = { // Met le contenu d'une cellule dans le bitmap de la carte // (sol, objets et brouillard). -void CDecor::MapPutCel (POINT pos) +void +CDecor::MapPutCel (POINT pos) { POINT cel, fogCel; Sint32 icon, i; @@ -492,7 +497,8 @@ color: // Génère la carte. -bool CDecor::GenerateMap () +bool +CDecor::GenerateMap () { POINT pos, cel; Sint32 dx, rank, i; diff --git a/src/decmove.cxx b/src/decmove.cxx index cb167cd..98eaef1 100644 --- a/src/decmove.cxx +++ b/src/decmove.cxx @@ -621,7 +621,8 @@ static Sint16 table_move12[] = }; // clang-format on -Sint16 * GetListMoves (Sint32 rank) +Sint16 * +GetListMoves (Sint32 rank) { switch (rank) { @@ -780,7 +781,8 @@ static Sint16 table_icon11[] = }; // clang-format on -Sint16 * GetListIcons (Sint32 rank) +Sint16 * +GetListIcons (Sint32 rank) { switch (rank) { @@ -814,7 +816,8 @@ Sint16 * GetListIcons (Sint32 rank) /** * \brief Remove all animated environments. */ -void CDecor::MoveFlush () +void +CDecor::MoveFlush () { Sint32 i, x, y; @@ -833,7 +836,8 @@ void CDecor::MoveFlush () * * \returns the duration. */ -Sint32 CDecor::MoveMaxFire () +Sint32 +CDecor::MoveMaxFire () { if (m_skill >= 1) return (MAXFIRE / 4) * 3; @@ -843,7 +847,8 @@ Sint32 CDecor::MoveMaxFire () /** * \brief Initialize all environment perpetual movements. */ -void CDecor::MoveFixInit () +void +CDecor::MoveFixInit () { Sint32 x, y; @@ -901,7 +906,8 @@ void CDecor::MoveFixInit () * \param[in] bNotIfExist - ? * \returns true on success. */ -bool CDecor::MoveCreate ( +bool +CDecor::MoveCreate ( POINT cel, Sint32 rankBlupi, bool bFloor, Sint32 channel, Sint32 icon, Sint32 maskChannel, Sint32 maskIcon, Sint32 total, Sint32 delai, Sint32 stepY, bool bMisc, bool bNotIfExist) @@ -957,7 +963,8 @@ create: // Ajoute un mouvement. -bool CDecor::MoveAddMoves (POINT cel, Sint32 rankMoves) +bool +CDecor::MoveAddMoves (POINT cel, Sint32 rankMoves) { Sint32 rank; @@ -979,7 +986,8 @@ bool CDecor::MoveAddMoves (POINT cel, Sint32 rankMoves) // Ajoute un mouvement. -bool CDecor::MoveAddIcons (POINT cel, Sint32 rankIcons, bool bContinue) +bool +CDecor::MoveAddIcons (POINT cel, Sint32 rankIcons, bool bContinue) { Sint32 rank; @@ -1009,7 +1017,8 @@ bool CDecor::MoveAddIcons (POINT cel, Sint32 rankIcons, bool bContinue) * \param[in] cel - Position. * \returns true if possible. */ -bool CDecor::MoveStartFire (POINT cel) +bool +CDecor::MoveStartFire (POINT cel) { Sint32 channel, icon; @@ -1063,7 +1072,8 @@ bool CDecor::MoveStartFire (POINT cel) // Démarre le feu si c'est possible par proximité. -void CDecor::MoveProxiFire (POINT cel) +void +CDecor::MoveProxiFire (POINT cel) { Sint32 cx, cy, xx, yy, x, y, channel, icon; @@ -1129,7 +1139,8 @@ void CDecor::MoveProxiFire (POINT cel) // Fait évoluer le feu. -void CDecor::MoveFire (Sint32 rank) +void +CDecor::MoveFire (Sint32 rank) { Sint32 x, y, icon, newIcon; POINT pos; @@ -1271,7 +1282,8 @@ void CDecor::MoveFire (Sint32 rank) // Fait évoluer tous les décors animés. -void CDecor::MoveStep (bool bFirst) +void +CDecor::MoveStep (bool bFirst) { Sint32 rank, rankBlupi; @@ -1321,7 +1333,8 @@ void CDecor::MoveStep (bool bFirst) // Termine un mouvement pour une cellule donnée. -void CDecor::MoveFinish (POINT cel) +void +CDecor::MoveFinish (POINT cel) { Sint32 rank; @@ -1347,7 +1360,8 @@ void CDecor::MoveFinish (POINT cel) // Termine un mouvement, d'après le rang du blupi. -void CDecor::MoveFinish (Sint32 rankBlupi) +void +CDecor::MoveFinish (Sint32 rankBlupi) { Sint32 rank; @@ -1360,7 +1374,8 @@ void CDecor::MoveFinish (Sint32 rankBlupi) // Vérifie si une cellule est déjà utilisée. -bool CDecor::MoveIsUsed (POINT cel) +bool +CDecor::MoveIsUsed (POINT cel) { Sint32 rank; @@ -1377,7 +1392,8 @@ bool CDecor::MoveIsUsed (POINT cel) // Retourne l'objet en construction à un endroit donné. -bool CDecor::MoveGetObject (POINT cel, Sint32 & channel, Sint32 & icon) +bool +CDecor::MoveGetObject (POINT cel, Sint32 & channel, Sint32 & icon) { Sint32 rank; @@ -1398,7 +1414,8 @@ bool CDecor::MoveGetObject (POINT cel, Sint32 & channel, Sint32 & icon) // Modifie un objet en construction à un endroit donné. -bool CDecor::MovePutObject (POINT cel, Sint32 channel, Sint32 icon) +bool +CDecor::MovePutObject (POINT cel, Sint32 channel, Sint32 icon) { Sint32 rank; diff --git a/src/decor.cxx b/src/decor.cxx index 09c4509..39705d0 100644 --- a/src/decor.cxx +++ b/src/decor.cxx @@ -35,7 +35,8 @@ #define TEXTDELAY 10 // délai avant apparition tooltips -POINT GetCel (Sint32 x, Sint32 y) +POINT +GetCel (Sint32 x, Sint32 y) { POINT cel; @@ -45,7 +46,8 @@ POINT GetCel (Sint32 x, Sint32 y) return cel; } -POINT GetCel (POINT cel, Sint32 x, Sint32 y) +POINT +GetCel (POINT cel, Sint32 x, Sint32 y) { cel.x += x; cel.y += y; @@ -58,7 +60,8 @@ POINT GetCel (POINT cel, Sint32 x, Sint32 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; @@ -67,7 +70,8 @@ bool IsValid (POINT cel) // Retourne un vecteur orienté dans une direction donnée. -POINT GetVector (Sint32 direct) +POINT +GetVector (Sint32 direct) { POINT vector; @@ -164,7 +168,8 @@ CDecor::~CDecor () // Initialisation générale. -void CDecor::Create (CSound * pSound, CPixmap * pPixmap) +void +CDecor::Create (CSound * pSound, CPixmap * pPixmap) { m_pSound = pSound; m_pPixmap = pPixmap; @@ -173,7 +178,8 @@ void CDecor::Create (CSound * pSound, CPixmap * pPixmap) // Initialise le décor avec un sol plat partout. -void CDecor::Init (Sint32 channel, Sint32 icon) +void +CDecor::Init (Sint32 channel, Sint32 icon) { Sint32 x, y; @@ -206,7 +212,8 @@ void CDecor::Init (Sint32 channel, Sint32 icon) // Initialise le décor après une modification. -void CDecor::InitAfterBuild () +void +CDecor::InitAfterBuild () { ClearFog (); // met tout sous le brouillard ClearFire (); @@ -217,7 +224,8 @@ void CDecor::InitAfterBuild () // Initialise les mises en évidence, avant de jouer. -void CDecor::ResetHili () +void +CDecor::ResetHili () { m_bHiliRect = false; // plus de rectangle InitOutlineRect (); @@ -225,7 +233,8 @@ void CDecor::ResetHili () // Charge les images nécessaires au décor. -bool CDecor::LoadImages () +bool +CDecor::LoadImages () { POINT totalDim, iconDim; char filename[50]; @@ -262,7 +271,8 @@ bool CDecor::LoadImages () // Met partout du brouillard, sauf aux endroits des blupi. -void CDecor::ClearFog () +void +CDecor::ClearFog () { Sint32 x, y, rank; @@ -285,7 +295,8 @@ void CDecor::ClearFog () // Permet de nouveau aux cellules brulées de bruler. -void CDecor::ClearFire () +void +CDecor::ClearFire () { Sint32 x, y; @@ -308,14 +319,16 @@ 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; @@ -323,31 +336,36 @@ void CDecor::EnableFog (bool bEnable) // 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; } // Bascule le mode outline. -void CDecor::FlipOutline () +void +CDecor::FlipOutline () { m_bOutline = !m_bOutline; m_timeFlipOutline = m_timeConst + 50; @@ -355,7 +373,8 @@ void CDecor::FlipOutline () // Initialise un sol dans une cellule. -bool CDecor::PutFloor (POINT cel, Sint32 channel, Sint32 icon) +bool +CDecor::PutFloor (POINT cel, Sint32 channel, Sint32 icon) { if (cel.x < 0 || cel.x >= MAXCELX || cel.y < 0 || cel.y >= MAXCELY) return false; @@ -372,7 +391,8 @@ bool CDecor::PutFloor (POINT cel, Sint32 channel, Sint32 icon) // Initialise un objet dans une cellule. -bool CDecor::PutObject (POINT cel, Sint32 channel, Sint32 icon) +bool +CDecor::PutObject (POINT cel, Sint32 channel, Sint32 icon) { if (cel.x < 0 || cel.x >= MAXCELX || cel.y < 0 || cel.y >= MAXCELY) return false; @@ -390,7 +410,8 @@ bool CDecor::PutObject (POINT cel, Sint32 channel, Sint32 icon) // Retourne un sol dans une cellule. -bool CDecor::GetFloor (POINT cel, Sint32 & channel, Sint32 & icon) +bool +CDecor::GetFloor (POINT cel, Sint32 & channel, Sint32 & icon) { if (cel.x < 0 || cel.x >= MAXCELX || cel.y < 0 || cel.y >= MAXCELY) return false; @@ -403,7 +424,8 @@ bool CDecor::GetFloor (POINT cel, Sint32 & channel, Sint32 & icon) // Retourne une objet dans une cellule. -bool CDecor::GetObject (POINT cel, Sint32 & channel, Sint32 & icon) +bool +CDecor::GetObject (POINT cel, Sint32 & channel, Sint32 & icon) { if (cel.x < 0 || cel.x >= MAXCELX || cel.y < 0 || cel.y >= MAXCELY) return false; @@ -416,7 +438,8 @@ bool CDecor::GetObject (POINT cel, Sint32 & channel, Sint32 & icon) // 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; @@ -428,7 +451,8 @@ bool CDecor::SetFire (POINT cel, bool bFire) // Modifie l'offset pour le shift. -void CDecor::SetShiftOffset (POINT offset) +void +CDecor::SetShiftOffset (POINT offset) { m_shiftOffset = offset; m_bGroundRedraw = true; @@ -436,7 +460,8 @@ void CDecor::SetShiftOffset (POINT offset) // Convertit la position d'une cellule en coordonnée graphique. -POINT CDecor::ConvCelToPos (POINT cel) +POINT +CDecor::ConvCelToPos (POINT cel) { POINT pos; @@ -451,7 +476,8 @@ 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; @@ -482,7 +508,8 @@ POINT CDecor::ConvPosToCel (POINT pos, bool bMap) // Convertit une coordonnée graphique en grande cellule (2x2). -POINT CDecor::ConvPosToCel2 (POINT pos) +POINT +CDecor::ConvPosToCel2 (POINT pos) { POINT cel; @@ -523,7 +550,8 @@ POINT CDecor::ConvPosToCel2 (POINT pos) // il faut toujours mettre blupi le plus au fond possible // (minimiser x et y). -void CDecor::BuildPutBlupi () +void +CDecor::BuildPutBlupi () { Sint32 x, y, dx, dy, xMin, yMin, rank, clipLeft; POINT pos; @@ -642,7 +670,8 @@ void CDecor::BuildPutBlupi () // Dessine une cellule du décor contenant un sol animé. -void CDecor::BuildMoveFloor (Sint32 x, Sint32 y, POINT pos, Sint32 rank) +void +CDecor::BuildMoveFloor (Sint32 x, Sint32 y, POINT pos, Sint32 rank) { Sint32 icon, nb; Sint16 * pTable; @@ -680,7 +709,8 @@ void CDecor::BuildMoveFloor (Sint32 x, Sint32 y, POINT pos, Sint32 rank) // Dessine une cellule du décor contenant un objet animé. -void CDecor::BuildMoveObject (Sint32 x, Sint32 y, POINT pos, Sint32 rank) +void +CDecor::BuildMoveObject (Sint32 x, Sint32 y, POINT pos, Sint32 rank) { Sint32 hBuild, offset, startY, endY; Sint32 channel, icon, nb; @@ -789,7 +819,8 @@ void CDecor::BuildMoveObject (Sint32 x, Sint32 y, POINT pos, Sint32 rank) // Déplace l'objet transporté par blupi. -void BuildMoveTransport (Sint32 icon, POINT & pos) +void +BuildMoveTransport (Sint32 icon, POINT & pos) { pos.x -= DIMCELX / 2; pos.y -= 96; @@ -885,7 +916,8 @@ void BuildMoveTransport (Sint32 icon, POINT & pos) // Construit tous les sols fixes dans CHGROUND. -void CDecor::BuildGround (RECT clip) +void +CDecor::BuildGround (RECT clip) { //? OutputDebug("BuildGround\n"); Sint32 x, y, i, j, nbx, nby, width, height, channel, icon; @@ -1009,7 +1041,8 @@ void CDecor::BuildGround (RECT clip) // Construit le décor dans un pixmap. -void CDecor::Build (RECT clip, POINT posMouse) +void +CDecor::Build (RECT clip, POINT posMouse) { Sint32 x, y, i, j, nbx, nby, width, height, rank, icon, channel, n; POINT iCel, mCel, cel, iPos, mPos, cPos, pos, tPos; @@ -1513,7 +1546,8 @@ term: // 0 début de mise à jour périodique // 1 mise à jour périodique suivante -void CDecor::NextPhase (Sint32 mode) +void +CDecor::NextPhase (Sint32 mode) { if (mode == -1) m_phase = -1; @@ -1529,21 +1563,24 @@ void CDecor::NextPhase (Sint32 mode) // Modifie le temps total passé dans cette partie. -void CDecor::SetTotalTime (Sint32 total) +void +CDecor::SetTotalTime (Sint32 total) { m_totalTime = total; } // Retourne le temps total passé dans cette partie. -Sint32 CDecor::GetTotalTime () +Sint32 +CDecor::GetTotalTime () { return m_totalTime; } // Compte le nombre total de sols contenus dans les décors. -Sint32 CDecor::CountFloor (Sint32 channel, Sint32 icon) +Sint32 +CDecor::CountFloor (Sint32 channel, Sint32 icon) { Sint32 x, y; Sint32 nb = 0; @@ -1569,7 +1606,8 @@ Sint32 CDecor::CountFloor (Sint32 channel, Sint32 icon) // 2 construction d'une cellule 2x2 // EV_ACTION* action -Errors CDecor::CelOkForAction ( +Errors +CDecor::CelOkForAction ( POINT cel, Sint32 action, Sint32 rank, Sint32 icons[4][4], POINT & celOutline1, POINT & celOutline2) { @@ -2707,7 +2745,8 @@ Errors CDecor::CelOkForAction ( // Indique si une cellule est ok pour une action. // Le rang du blupi qui effectuera le travail est donnée dans rank. -Errors CDecor::CelOkForAction (POINT cel, Sint32 action, Sint32 rank) +Errors +CDecor::CelOkForAction (POINT cel, Sint32 action, Sint32 rank) { Sint32 icons[4][4]; POINT celOutline1, celOutline2; @@ -2717,7 +2756,8 @@ Errors CDecor::CelOkForAction (POINT cel, Sint32 action, Sint32 rank) // Retourne le rang du nième blupi sélectionné. -Sint32 CDecor::GetHiliRankBlupi (Sint32 nb) +Sint32 +CDecor::GetHiliRankBlupi (Sint32 nb) { Sint32 rank; @@ -2748,7 +2788,8 @@ Sint32 CDecor::GetHiliRankBlupi (Sint32 nb) // 1 construction d'une cellule 1x1 // 2 construction d'une cellule 2x2 -void CDecor::CelHili (POINT pos, Sint32 action) +void +CDecor::CelHili (POINT pos, Sint32 action) { Sint32 x, y, i, channel, icon, rank, nb; POINT cel; @@ -2851,7 +2892,8 @@ void CDecor::CelHili (POINT pos, Sint32 action) // Marque la cellule visée par la souris pour un bouton donné. -void CDecor::CelHiliButton (POINT cel, Sint32 button) +void +CDecor::CelHiliButton (POINT cel, Sint32 button) { POINT celOutline1, celOutline2; @@ -2882,7 +2924,8 @@ void CDecor::CelHiliButton (POINT cel, Sint32 button) // Marque la cellule visée par la souris pour une répétition donnée. -void CDecor::CelHiliRepeat (Sint32 list) +void +CDecor::CelHiliRepeat (Sint32 list) { Sint32 rank, button, x, y, i; POINT cel; @@ -2937,7 +2980,8 @@ void CDecor::CelHiliRepeat (Sint32 list) // Retourne l'identificateur du texte correspondant à // l'objet ou au blupi visé par la souris. -const char * CDecor::GetResHili (POINT posMouse) +const char * +CDecor::GetResHili (POINT posMouse) { Sint32 icon; @@ -3208,14 +3252,16 @@ const char * 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; } // 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) { @@ -3238,19 +3284,22 @@ void CDecor::SetCoin (POINT coin, bool bCenter) m_textLastPos.x = -1; // tooltips plus lavable ! } -POINT CDecor::GetCoin () +POINT +CDecor::GetCoin () { return m_celCoin; } -POINT CDecor::GetHome () +POINT +CDecor::GetHome () { return m_celHome; } // Mémoirise une position pendant le jeu. -void CDecor::MemoPos (Sint32 rank, bool bRecord) +void +CDecor::MemoPos (Sint32 rank, bool bRecord) { POINT pos; @@ -3279,38 +3328,44 @@ void CDecor::MemoPos (Sint32 rank, bool bRecord) // Gestion du temps absolu global. -void CDecor::SetTime (Sint32 time) +void +CDecor::SetTime (Sint32 time) { m_time = time; m_timeConst = time; // vraiment ? m_timeFlipOutline = time; } -Sint32 CDecor::GetTime () +Sint32 +CDecor::GetTime () { return m_time; } // Gestion de la musique midi. -void CDecor::SetMusic (Sint32 music) +void +CDecor::SetMusic (Sint32 music) { m_music = music; } -Sint32 CDecor::GetMusic () +Sint32 +CDecor::GetMusic () { return m_music; } // Gestion de la difficulté. -void CDecor::SetSkill (Sint32 skill) +void +CDecor::SetSkill (Sint32 skill) { m_skill = skill; } -Sint32 CDecor::GetSkill () +Sint32 +CDecor::GetSkill () { return m_skill; } @@ -3321,36 +3376,42 @@ Sint32 CDecor::GetSkill () // 2 = hiver // 3 = sapin -void CDecor::SetRegion (Sint32 region) +void +CDecor::SetRegion (Sint32 region) { m_region = region; } -Sint32 CDecor::GetRegion () +Sint32 +CDecor::GetRegion () { return m_region; } // Gestion des infos. -void CDecor::SetInfoMode (bool bInfo) +void +CDecor::SetInfoMode (bool bInfo) { m_bInfo = bInfo; m_bGroundRedraw = true; // faudra redessiner les sols } -bool CDecor::GetInfoMode () +bool +CDecor::GetInfoMode () { return m_bInfo; } -void CDecor::SetInfoHeight (Sint32 height) +void +CDecor::SetInfoHeight (Sint32 height) { m_infoHeight = height; m_bGroundRedraw = true; // faudra redessiner les sols } -Sint32 CDecor::GetInfoHeight () +Sint32 +CDecor::GetInfoHeight () { if (m_bInfo) return m_infoHeight; @@ -3360,14 +3421,16 @@ Sint32 CDecor::GetInfoHeight () // Retourne le pointeur à la liste des boutons existants. -char * CDecor::GetButtonExist () +char * +CDecor::GetButtonExist () { return m_buttonExist; } // Ouvre le buffer pour le undo pendant la construction. -void CDecor::UndoOpen () +void +CDecor::UndoOpen () { if (m_pUndoDecor == nullptr) m_pUndoDecor = @@ -3376,7 +3439,8 @@ void CDecor::UndoOpen () // Ferme le buffer pour le undo pendant la construction. -void CDecor::UndoClose () +void +CDecor::UndoClose () { if (m_pUndoDecor != nullptr) { @@ -3387,7 +3451,8 @@ void CDecor::UndoClose () // Copie le décor dans le buffer pour le undo. -void CDecor::UndoCopy () +void +CDecor::UndoCopy () { UndoOpen (); // ouvre le buffer du undo si nécessaire @@ -3398,7 +3463,8 @@ void CDecor::UndoCopy () // Revient en arrière pour tout le décor. -void CDecor::UndoBack () +void +CDecor::UndoBack () { if (m_pUndoDecor != nullptr) { @@ -3411,7 +3477,8 @@ void CDecor::UndoBack () // Indique s'il est possible d'effectuer un undo. -bool CDecor::IsUndo () +bool +CDecor::IsUndo () { return (m_pUndoDecor != nullptr); } diff --git a/src/decstat.cxx b/src/decstat.cxx index c9f95dc..f5b6572 100644 --- a/src/decstat.cxx +++ b/src/decstat.cxx @@ -375,7 +375,8 @@ static Statistic table_statistic[] = // Retourne la statistique correspondant à un rang donné. -Statistic * StatisticGet (Sint32 rank) +Statistic * +StatisticGet (Sint32 rank) { Statistic * pStatistic; @@ -397,7 +398,8 @@ Statistic * StatisticGet (Sint32 rank) // Réinitialise les statistiques. -void CDecor::StatisticInit () +void +CDecor::StatisticInit () { Statistic * pStatistic; @@ -418,7 +420,8 @@ void CDecor::StatisticInit () // Met à jour tous les compteurs des statistiques. -void CDecor::StatisticUpdate () +void +CDecor::StatisticUpdate () { Sint32 rank, x, y, icon, nb; bool bHach; @@ -620,7 +623,8 @@ void CDecor::StatisticUpdate () // Retourne le nombre de blupi. -Sint32 CDecor::StatisticGetBlupi () +Sint32 +CDecor::StatisticGetBlupi () { return table_statistic[STATBLUPIf].nb + table_statistic[STATBLUPIm].nb + table_statistic[STATBLUPI].nb; @@ -628,14 +632,16 @@ Sint32 CDecor::StatisticGetBlupi () // Retourne le nombre de cellules en feu. -Sint32 CDecor::StatisticGetFire () +Sint32 +CDecor::StatisticGetFire () { return table_statistic[STATFEU].nb; } // Dessine toutes les statistiques. -void CDecor::StatisticDraw () +void +CDecor::StatisticDraw () { POINT pos; RECT rect; @@ -756,7 +762,8 @@ void CDecor::StatisticDraw () // Génère les statistiques. -void CDecor::GenerateStatictic () +void +CDecor::GenerateStatictic () { if (m_bBuild) return; @@ -771,7 +778,8 @@ void CDecor::GenerateStatictic () // Bouton pressé dans les statistiques. -bool CDecor::StatisticDown (POINT pos) +bool +CDecor::StatisticDown (POINT pos) { Sint32 hili, rank, x, y, show, icon; POINT cel; @@ -955,7 +963,8 @@ select: // Souris déplacée dans les statistiques. -bool CDecor::StatisticMove (POINT pos) +bool +CDecor::StatisticMove (POINT pos) { Sint32 rank; @@ -969,14 +978,16 @@ bool CDecor::StatisticMove (POINT pos) // Bouton relâché dans les statistiques. -bool CDecor::StatisticUp (POINT pos) +bool +CDecor::StatisticUp (POINT pos) { return false; } // Détecte dans quelle statistique est la souris. -Sint32 CDecor::StatisticDetect (POINT pos) +Sint32 +CDecor::StatisticDetect (POINT pos) { Sint32 rank; diff --git a/src/event.cxx b/src/event.cxx index 1b6a377..ba3bfc5 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1605,7 +1605,8 @@ CEvent::~CEvent () // Retourne la position de la souris. -POINT CEvent::GetMousePos () +POINT +CEvent::GetMousePos () { POINT pos; Sint32 x, y; @@ -1619,7 +1620,8 @@ POINT CEvent::GetMousePos () // Initialise le mode full screen ou non. -void CEvent::SetFullScreen (bool bFullScreen) +void +CEvent::SetFullScreen (bool bFullScreen) { if (bFullScreen == m_bFullScreen) return; @@ -1660,7 +1662,8 @@ void CEvent::SetFullScreen (bool bFullScreen) * \param[in] prevScale - The current scale. * \param[in] newScale - The new scale. */ -void CEvent::SetWindowSize (Uint8 prevScale, Uint8 newScale) +void +CEvent::SetWindowSize (Uint8 prevScale, Uint8 newScale) { int x, y; SDL_GetMouseState (&x, &y); @@ -1682,14 +1685,16 @@ void CEvent::SetWindowSize (Uint8 prevScale, Uint8 newScale) CEvent::PushUserEvent (EV_WARPMOUSE, coord); } -Uint8 CEvent::GetWindowScale () +Uint8 +CEvent::GetWindowScale () { return m_WindowScale; } // Crée le gestionnaire d'événements. -void CEvent::Create ( +void +CEvent::Create ( CPixmap * pPixmap, CDecor * pDecor, CSound * pSound, CMovie * pMovie) { POINT pos; @@ -1711,7 +1716,8 @@ void CEvent::Create ( // Retourne l'index d'un bouton. -Sint32 CEvent::GetButtonIndex (Sint32 button) +Sint32 +CEvent::GetButtonIndex (Sint32 button) { int i = 0; @@ -1728,7 +1734,8 @@ Sint32 CEvent::GetButtonIndex (Sint32 button) return -1; } -Sint32 CEvent::GetState (Sint32 button) +Sint32 +CEvent::GetState (Sint32 button) { Sint32 index; @@ -1739,7 +1746,8 @@ Sint32 CEvent::GetState (Sint32 button) return m_buttons[index].GetState (); } -void CEvent::SetState (Sint32 button, Sint32 state) +void +CEvent::SetState (Sint32 button, Sint32 state) { Sint32 index; @@ -1750,7 +1758,8 @@ void CEvent::SetState (Sint32 button, Sint32 state) m_buttons[index].SetState (state); } -bool CEvent::GetEnable (Sint32 button) +bool +CEvent::GetEnable (Sint32 button) { Sint32 index; @@ -1761,7 +1770,8 @@ bool CEvent::GetEnable (Sint32 button) return m_buttons[index].GetEnable (); } -void CEvent::SetEnable (Sint32 button, bool bEnable) +void +CEvent::SetEnable (Sint32 button, bool bEnable) { Sint32 index; @@ -1772,7 +1782,8 @@ void CEvent::SetEnable (Sint32 button, bool bEnable) m_buttons[index].SetEnable (bEnable); } -bool CEvent::GetHide (Sint32 button) +bool +CEvent::GetHide (Sint32 button) { Sint32 index; @@ -1783,7 +1794,8 @@ bool CEvent::GetHide (Sint32 button) return m_buttons[index].GetHide (); } -void CEvent::SetHide (Sint32 button, bool bHide) +void +CEvent::SetHide (Sint32 button, bool bHide) { Sint32 index; @@ -1794,7 +1806,8 @@ void CEvent::SetHide (Sint32 button, bool bHide) m_buttons[index].SetHide (bHide); } -Sint32 CEvent::GetMenu (Sint32 button) +Sint32 +CEvent::GetMenu (Sint32 button) { Sint32 index; @@ -1805,7 +1818,8 @@ Sint32 CEvent::GetMenu (Sint32 button) return m_buttons[index].GetMenu (); } -void CEvent::SetMenu (Sint32 button, Sint32 menu) +void +CEvent::SetMenu (Sint32 button, Sint32 menu) { Sint32 index; @@ -1818,7 +1832,8 @@ void CEvent::SetMenu (Sint32 button, Sint32 menu) // Crée tous les boutons nécessaires à la phase en cours. -bool CEvent::CreateButtons () +bool +CEvent::CreateButtons () { Sint32 i = 0, message; POINT pos; @@ -1859,7 +1874,8 @@ bool CEvent::CreateButtons () // Ajoute un cheat-code dans un buffer. -void AddCheatCode (char * pDst, char * pSrc) +void +AddCheatCode (char * pDst, char * pSrc) { Sint32 i; size_t j; @@ -1874,14 +1890,16 @@ void AddCheatCode (char * pDst, char * pSrc) pDst[j] = 0; } -void CEvent::SetUpdateVersion (const std::string & version) +void +CEvent::SetUpdateVersion (const std::string & version) { this->m_updateVersion = version; } // Dessine un texte multi-lignes centré. -void CEvent::DrawTextCenter (const char * text, Sint32 x, Sint32 y, Sint32 font) +void +CEvent::DrawTextCenter (const char * text, Sint32 x, Sint32 y, Sint32 font) { POINT pos; pos.x = x; @@ -1891,7 +1909,8 @@ void CEvent::DrawTextCenter (const char * text, Sint32 x, Sint32 y, Sint32 font) // Dessine tous les boutons de la phase en cours. -bool CEvent::DrawButtons () +bool +CEvent::DrawButtons () { Sint32 i; Sint32 levels[2]; @@ -2553,7 +2572,8 @@ bool CEvent::DrawButtons () // Retourne le lutin à utiliser à une position donnée. -MouseSprites CEvent::MousePosToSprite (POINT pos) +MouseSprites +CEvent::MousePosToSprite (POINT pos) { MouseSprites sprite; bool bUp = false, bDown = false, bLeft = false, bRight = false; @@ -2624,7 +2644,8 @@ MouseSprites CEvent::MousePosToSprite (POINT pos) // Gère le lutin de la souris. -void CEvent::MouseSprite (POINT pos) +void +CEvent::MouseSprite (POINT pos) { m_mouseSprite = MousePosToSprite (pos); m_pPixmap->ChangeSprite (m_mouseSprite); @@ -2632,7 +2653,8 @@ 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; @@ -2646,7 +2668,8 @@ void CEvent::WaitMouse (bool bWait) // Cache ou montre la souris. -void CEvent::HideMouse (bool bHide) +void +CEvent::HideMouse (bool bHide) { m_bHideMouse = bHide; @@ -2667,7 +2690,8 @@ void CEvent::HideMouse (bool bHide) // Traite les événements pour tous les boutons. -bool CEvent::EventButtons (const SDL_Event & event, POINT pos) +bool +CEvent::EventButtons (const SDL_Event & event, POINT pos) { POINT test; Sint32 lg; @@ -2827,7 +2851,8 @@ bool CEvent::EventButtons (const SDL_Event & event, POINT pos) // Indique si la souris est sur un bouton. -bool CEvent::MouseOnButton (POINT pos) +bool +CEvent::MouseOnButton (POINT pos) { Sint32 i; @@ -2847,7 +2872,8 @@ bool CEvent::MouseOnButton (POINT pos) // Retourne l'index dans table pour une phase donnée. -Sint32 CEvent::SearchPhase (Uint32 phase) +Sint32 +CEvent::SearchPhase (Uint32 phase) { Sint32 i = 0; @@ -2863,7 +2889,8 @@ Sint32 CEvent::SearchPhase (Uint32 phase) // Donne le numéro du monde. -Sint32 CEvent::GetWorld () +Sint32 +CEvent::GetWorld () { if (m_bPrivate) return m_private; @@ -2875,7 +2902,8 @@ Sint32 CEvent::GetWorld () // Donne le numéro physique du monde. -Sint32 CEvent::GetPhysicalWorld () +Sint32 +CEvent::GetPhysicalWorld () { if (m_bPrivate) return m_private + 200; @@ -2885,7 +2913,8 @@ Sint32 CEvent::GetPhysicalWorld () return m_mission + 100; } -Sint32 CEvent::GetImageWorld () +Sint32 +CEvent::GetImageWorld () { if (m_bPrivate) return 2; @@ -2897,7 +2926,8 @@ Sint32 CEvent::GetImageWorld () // Indique si l'aide est disponible. -bool CEvent::IsHelpHide () +bool +CEvent::IsHelpHide () { bool bHide = true; @@ -2913,7 +2943,8 @@ bool CEvent::IsHelpHide () // Change de phase. -bool CEvent::ChangePhase (Uint32 phase) +bool +CEvent::ChangePhase (Uint32 phase) { Sint32 index, world, time, total, music, i, max; POINT totalDim, iconDim; @@ -3263,14 +3294,16 @@ bool CEvent::ChangePhase (Uint32 phase) // Retourne la phase en cours. -Uint32 CEvent::GetPhase () +Uint32 +CEvent::GetPhase () { return m_phase; } // Essaye de lire le CD-Rom. -void CEvent::TryInsert () +void +CEvent::TryInsert () { if (m_tryInsertCount == 0) ChangePhase (m_tryPhase); @@ -3280,7 +3313,8 @@ void CEvent::TryInsert () // Fait démarrer un film si nécessaire. -void CEvent::MovieToStart () +void +CEvent::MovieToStart () { if (m_movieToStart[0] != 0) // y a-t-il un film à démarrer ? { @@ -3299,7 +3333,8 @@ void CEvent::MovieToStart () // Décale le décor. -void CEvent::DecorShift (Sint32 dx, Sint32 dy) +void +CEvent::DecorShift (Sint32 dx, Sint32 dy) { POINT coin; @@ -3317,7 +3352,8 @@ void CEvent::DecorShift (Sint32 dx, Sint32 dy) // Décale le décor lorsque la souris touche un bord. -void CEvent::DecorAutoShift () +void +CEvent::DecorAutoShift () { Sint32 max; POINT offset; @@ -3425,14 +3461,16 @@ void CEvent::DecorAutoShift () // Indique su un shift est en cours. -bool CEvent::IsShift () +bool +CEvent::IsShift () { return m_bShift; } // Modifie le décor lorsque le bouton de la souris est pressé. -bool CEvent::PlayDown (POINT pos, const SDL_Event & event) +bool +CEvent::PlayDown (POINT pos, const SDL_Event & event) { bool bDecor = false; bool bMap = false; @@ -3504,7 +3542,8 @@ bool CEvent::PlayDown (POINT pos, const SDL_Event & event) // Modifie le décor lorsque la souris est déplacée. -bool CEvent::PlayMove (POINT pos) +bool +CEvent::PlayMove (POINT pos) { if (m_bMenu) { @@ -3534,7 +3573,8 @@ bool CEvent::PlayMove (POINT pos) // Modifie le décor lorsque le bouton de la souris est relâché. -bool CEvent::PlayUp (POINT pos) +bool +CEvent::PlayUp (POINT pos) { static Sounds table_sound_boing[] = { SOUND_BOING1, SOUND_BOING2, SOUND_BOING3, @@ -3572,7 +3612,8 @@ bool CEvent::PlayUp (POINT pos) return true; } -void CEvent::SetLanguage () +void +CEvent::SetLanguage () { static char env[64]; const char * lang; @@ -3610,7 +3651,8 @@ void CEvent::SetLanguage () // Clic dans un bouton. // Message = EV_BUTTON0..EV_BUTTON39 -void CEvent::ChangeButtons (Sint32 message) +void +CEvent::ChangeButtons (Sint32 message) { Buttons button; Sint32 state, volume, max; @@ -3817,7 +3859,8 @@ void CEvent::ChangeButtons (Sint32 message) // Met un sol si nécessaire sous un objet. -void CEvent::BuildFloor (POINT cel, Sint32 insIcon) +void +CEvent::BuildFloor (POINT cel, Sint32 insIcon) { Sint32 iFloor, channel, icon; @@ -3870,7 +3913,8 @@ void CEvent::BuildFloor (POINT cel, Sint32 insIcon) // Enlève si nécessaire un objet sur l'eau. -void CEvent::BuildWater (POINT cel, Sint32 insIcon) +void +CEvent::BuildWater (POINT cel, Sint32 insIcon) { Sint32 channel, icon; @@ -3922,7 +3966,8 @@ static Sint32 tableHome[] = { // Modifie le décor lorsque le bouton de la souris est pressé. -bool CEvent::BuildDown (POINT pos, Uint16 mod, bool bMix) +bool +CEvent::BuildDown (POINT pos, Uint16 mod, bool bMix) { POINT cel; Sint32 menu, channel, icon; @@ -4081,7 +4126,8 @@ bool CEvent::BuildDown (POINT pos, Uint16 mod, bool bMix) // Modifie le décor lorsque la souris est déplacée. -bool CEvent::BuildMove (POINT pos, Uint16 mod, const SDL_Event & event) +bool +CEvent::BuildMove (POINT pos, Uint16 mod, const SDL_Event & event) { if (event.motion.state & SDL_BUTTON (SDL_BUTTON_LEFT)) // bouton souris pressé // ? @@ -4097,7 +4143,8 @@ bool CEvent::BuildMove (POINT pos, Uint16 mod, const SDL_Event & event) // Démarre un film non interractif. -bool CEvent::StartMovie (const std::string & pFilename) +bool +CEvent::StartMovie (const std::string & pFilename) { RECT rect; @@ -4124,7 +4171,8 @@ bool CEvent::StartMovie (const std::string & pFilename) // Stoppe un film non interractif. -void CEvent::StopMovie () +void +CEvent::StopMovie () { m_pMovie->Stop (); ChangePhase (m_phase); @@ -4133,14 +4181,16 @@ void CEvent::StopMovie () // Indique s'il y a un film en cours. -bool CEvent::IsMovie () +bool +CEvent::IsMovie () { return m_bRunMovie; } // Lit une partie (user000.blp). -void CEvent::Read (Sint32 message) +void +CEvent::Read (Sint32 message) { Sint32 world, time, total; @@ -4170,7 +4220,8 @@ void CEvent::Read (Sint32 message) // Ecrit une partie (user000.blp). -void CEvent::Write (Sint32 message) +void +CEvent::Write (Sint32 message) { Sint32 time, total; @@ -4182,7 +4233,8 @@ void CEvent::Write (Sint32 message) // Initialise le libellé d'une mission privée. -void CEvent::PrivateLibelle () +void +CEvent::PrivateLibelle () { Sint32 i, nb, h1, h2; Term term; @@ -4266,7 +4318,8 @@ void CEvent::PrivateLibelle () // Lit le libellé d'un monde. -bool CEvent::ReadLibelle (Sint32 world, bool bSchool, bool bHelp) +bool +CEvent::ReadLibelle (Sint32 world, bool bSchool, bool bHelp) { FILE * file = nullptr; char * pBuffer = nullptr; @@ -4343,7 +4396,8 @@ error: // Sauve les informations sur disque. -bool CEvent::WriteInfo () +bool +CEvent::WriteInfo () { std::string filename; FILE * file = nullptr; @@ -4388,7 +4442,8 @@ error: // Lit les informations sur disque. -bool CEvent::ReadInfo () +bool +CEvent::ReadInfo () { std::string filename; FILE * file = nullptr; @@ -4431,7 +4486,8 @@ error: // Modifie la vitesse du jeu. -void CEvent::SetSpeed (Sint32 speed) +void +CEvent::SetSpeed (Sint32 speed) { Sint32 max; @@ -4446,19 +4502,22 @@ void CEvent::SetSpeed (Sint32 speed) m_speed = speed; } -Sint32 CEvent::GetSpeed () +Sint32 +CEvent::GetSpeed () { return m_speed; } -bool CEvent::GetPause () +bool +CEvent::GetPause () { return m_bPause; } // Début de l'enregistrement d'une démo. -void CEvent::DemoRecStart () +void +CEvent::DemoRecStart () { m_pDemoSDLBuffer = (DemoSDLEvent *) malloc (MAXDEMO * sizeof (DemoSDLEvent)); if (m_pDemoSDLBuffer == nullptr) @@ -4478,7 +4537,8 @@ void CEvent::DemoRecStart () // Fin de l'enregistrement d'une démo. // Sauve le fichier sur disque. -void CEvent::DemoRecStop () +void +CEvent::DemoRecStop () { FILE * file = nullptr; DemoHeader header; @@ -4515,7 +4575,8 @@ void CEvent::DemoRecStop () // Début de la reproduction d'une démo. // Lit le fichier sur disque. -bool CEvent::DemoPlayStart () +bool +CEvent::DemoPlayStart () { std::string filename; FILE * file = nullptr; @@ -4588,7 +4649,8 @@ bool CEvent::DemoPlayStart () // Fin de la reproduction d'une démo. -void CEvent::DemoPlayStop () +void +CEvent::DemoPlayStop () { if (m_pDemoBuffer != nullptr) { @@ -4609,7 +4671,8 @@ void CEvent::DemoPlayStop () ChangePhase (EV_PHASE_INIT); } -void CEvent::WinToSDLEvent ( +void +CEvent::WinToSDLEvent ( Uint32 msg, WPARAM wParam, LPARAM lParam, SDL_Event & event) { #define GET_X_LPARAM(lp) ((Sint32) (Sint16) LOWORD (lp)) @@ -4708,7 +4771,8 @@ void CEvent::WinToSDLEvent ( // Avance l'index d'enregistrement ou de reproduction. -void CEvent::DemoStep () +void +CEvent::DemoStep () { Uint32 time = 0; Uint32 message = 0; @@ -4804,7 +4868,8 @@ void CEvent::DemoStep () /** * \brief Store an event for the demos */ -void CEvent::DemoRecEvent (const SDL_Event & event) +void +CEvent::DemoRecEvent (const SDL_Event & event) { if (!m_bDemoRec || !m_pDemoSDLBuffer) return; @@ -4843,14 +4908,16 @@ void CEvent::DemoRecEvent (const SDL_Event & event) // Retourne la dernière position de la souris. -POINT CEvent::GetLastMousePos () +POINT +CEvent::GetLastMousePos () { return m_oldMousePos; } // Traitement d'un événement. -bool CEvent::TreatEvent (const SDL_Event & event) +bool +CEvent::TreatEvent (const SDL_Event & event) { if (m_bDemoPlay) { @@ -4871,7 +4938,8 @@ bool CEvent::TreatEvent (const SDL_Event & event) // Traitement d'un événement. -bool CEvent::TreatEventBase (const SDL_Event & event) +bool +CEvent::TreatEventBase (const SDL_Event & event) { POINT pos; Sint32 i; @@ -5554,7 +5622,8 @@ bool CEvent::TreatEventBase (const SDL_Event & event) // Passe les images d'introduction. -void CEvent::IntroStep () +void +CEvent::IntroStep () { m_introTime++; @@ -5568,7 +5637,8 @@ void CEvent::IntroStep () } } -void CEvent::PushUserEvent (Sint32 code, void * data) +void +CEvent::PushUserEvent (Sint32 code, void * data) { SDL_Event event; diff --git a/src/fix.cxx b/src/fix.cxx index 1063bc0..2f71186 100644 --- a/src/fix.cxx +++ b/src/fix.cxx @@ -68,7 +68,8 @@ static const char tableDark[13 * 4] = // Retourne les bits contenant de l'eau. -bool CDecor::GetSeeBits (POINT cel, char * pBits, Sint32 index) +bool +CDecor::GetSeeBits (POINT cel, char * pBits, Sint32 index) { Sint32 icon; @@ -140,13 +141,15 @@ bool CDecor::GetSeeBits (POINT cel, char * pBits, Sint32 index) return true; } -static void CopyBits (char * pDst, char * pSrc) +static void +CopyBits (char * pDst, char * pSrc) { for (Sint32 i = 0; i < 4; i++) *pDst++ = *pSrc++; } -static bool ChangeBits (char * pDst, char * pSrc) +static bool +ChangeBits (char * pDst, char * pSrc) { for (Sint32 i = 0; i < 4; i++) { @@ -158,7 +161,8 @@ static bool ChangeBits (char * pDst, char * pSrc) // Retourne l'icône correspondant aux bits d'eaux. -Sint32 CDecor::GetSeeIcon (char * pBits, Sint32 index) +Sint32 +CDecor::GetSeeIcon (char * pBits, Sint32 index) { Sint32 i; @@ -203,7 +207,8 @@ Sint32 CDecor::GetSeeIcon (char * pBits, Sint32 index) // Arrange le sol après une modification. -void CDecor::ArrangeFloor (POINT cel) +void +CDecor::ArrangeFloor (POINT cel) { POINT test; Sint32 max, index, icon; @@ -418,7 +423,8 @@ static const Sint16 tableMurDir[4 * 2] = // index=1 si palissade (65..71) // index=2 si barrière (106..112) -void CDecor::ArrangeMur (POINT cel, Sint32 & icon, Sint32 index) +void +CDecor::ArrangeMur (POINT cel, Sint32 & icon, Sint32 index) { Sint32 i, x, y, channel; Sint32 first, last, matiere; @@ -487,7 +493,8 @@ void CDecor::ArrangeMur (POINT cel, Sint32 & icon, Sint32 index) // Arrange les objets avant une construction. -void CDecor::ArrangeBuild (POINT cel, Sint32 & channel, Sint32 & icon) +void +CDecor::ArrangeBuild (POINT cel, Sint32 & channel, Sint32 & icon) { Sint32 index, i, x, y; Sint32 first, last, matiere; @@ -562,7 +569,8 @@ void CDecor::ArrangeBuild (POINT cel, Sint32 & channel, Sint32 & icon) // Arrange les objets après une modification. -void CDecor::ArrangeObject (POINT cel) +void +CDecor::ArrangeObject (POINT cel) { Sint32 channel, icon; Sint32 first, last; @@ -696,7 +704,8 @@ 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; Sint32 icon1, icon2; @@ -750,7 +759,8 @@ bool CDecor::ArrangeFillTestFloor (POINT cel1, POINT cel2) // Test s'il faut remplir ici. -bool CDecor::ArrangeFillTest (POINT pos) +bool +CDecor::ArrangeFillTest (POINT pos) { POINT cel1, cel2; @@ -789,7 +799,8 @@ bool CDecor::ArrangeFillTest (POINT pos) // Modifie le décor lors d'un remplissage. -void CDecor::ArrangeFillPut (POINT pos, Sint32 channel, Sint32 icon) +void +CDecor::ArrangeFillPut (POINT pos, Sint32 channel, Sint32 icon) { if (m_bFillFloor) { @@ -811,7 +822,8 @@ void CDecor::ArrangeFillPut (POINT pos, Sint32 channel, Sint32 icon) // Rempli un sol à partir d'une position donnée. -void CDecor::ArrangeFillSearch (POINT pos) +void +CDecor::ArrangeFillSearch (POINT pos) { Sint32 startX, endX; @@ -884,7 +896,8 @@ void CDecor::ArrangeFillSearch (POINT pos) // Rempli un sol à partir d'une position donnée. -void CDecor::ArrangeFill (POINT pos, Sint32 channel, Sint32 icon, bool bFloor) +void +CDecor::ArrangeFill (POINT pos, Sint32 channel, Sint32 icon, bool bFloor) { m_bFillFloor = bFloor; @@ -921,7 +934,8 @@ void CDecor::ArrangeFill (POINT pos, Sint32 channel, Sint32 icon, bool bFloor) // Supprime tous les personnages bloqués dans des murs // ou debout sur l'eau. -void CDecor::ArrangeBlupi () +void +CDecor::ArrangeBlupi () { Sint32 rank; diff --git a/src/fog.cxx b/src/fog.cxx index 37fc84a..03e18c8 100644 --- a/src/fog.cxx +++ b/src/fog.cxx @@ -47,7 +47,8 @@ static char tableFog[15 * 4] = // Retourne les bits contenant du brouillard. -bool GetFogBits (Sint32 icon, char * pBits) +bool +GetFogBits (Sint32 icon, char * pBits) { pBits[0] = 0; pBits[1] = 0; @@ -67,7 +68,8 @@ bool GetFogBits (Sint32 icon, char * pBits) // Retourne l'icône correspondant aux bits de brouillard. -Sint32 GetFogIcon (char * pBits) +Sint32 +GetFogIcon (char * pBits) { Sint32 i; @@ -109,7 +111,8 @@ static char table_fog[17 * 17] = // Ecarte le brouillard autour d'un blupi. -void CDecor::BlupiPushFog (Sint32 rank) +void +CDecor::BlupiPushFog (Sint32 rank) { Sint32 x, y, i; POINT cel; diff --git a/src/menu.cxx b/src/menu.cxx index da568f4..1c2b6aa 100644 --- a/src/menu.cxx +++ b/src/menu.cxx @@ -75,7 +75,8 @@ static const Sint16 table_button_icon[] = { 106, // fabarmure }; -static const char * GetText (Sint32 rank) +static const char * +GetText (Sint32 rank) { static const char * list[] = { translate ("Go"), @@ -118,7 +119,8 @@ static const char * GetText (Sint32 rank) return gettext (list[rank]); } -static const char * GetErr (Sint32 rank) +static const char * +GetErr (Sint32 rank) { static const char * list[] = { translate ("Impossible"), translate ("Inadequate ground"), @@ -152,7 +154,8 @@ CMenu::~CMenu () // Crée un nouveau bouton. -bool CMenu::Create ( +bool +CMenu::Create ( CPixmap * pPixmap, CSound * pSound, CEvent * pEvent, POINT pos, Sint32 nb, Buttons * pButtons, Errors * pErrors, std::unordered_map & texts, Sint32 perso) @@ -196,7 +199,8 @@ bool CMenu::Create ( // Met à jour le menu. -void CMenu::Update ( +void +CMenu::Update ( Sint32 nb, Buttons * pButtons, Errors * pErrors, std::unordered_map & texts) { @@ -224,7 +228,8 @@ void CMenu::Update ( // Détruit le menu. -void CMenu::Delete () +void +CMenu::Delete () { m_nbButtons = 0; m_selRank = -1; @@ -232,7 +237,8 @@ void CMenu::Delete () // Dessine un bouton dans son état. -void CMenu::Draw () +void +CMenu::Draw () { Sint32 i, state, icon; POINT pos; @@ -349,7 +355,8 @@ void CMenu::Draw () // Retourne le bouton sélectionné. -Sint32 CMenu::GetSel () +Sint32 +CMenu::GetSel () { if (m_selRank == -1) return -1; @@ -359,14 +366,16 @@ Sint32 CMenu::GetSel () // Retourne le rang sélectionné. -Sint32 CMenu::GetRank () +Sint32 +CMenu::GetRank () { return m_selRank; } // Retourne true si le bouton sélectionné a une erreur. -bool CMenu::IsError () +bool +CMenu::IsError () { if (m_selRank == -1) return true; @@ -379,14 +388,16 @@ bool CMenu::IsError () // Indique si le menu existe. -bool CMenu::IsExist () +bool +CMenu::IsExist () { return (m_nbButtons == 0) ? false : true; } // Traitement d'un événement. -bool CMenu::TreatEvent (const SDL_Event & event) +bool +CMenu::TreatEvent (const SDL_Event & event) { POINT pos; @@ -434,7 +445,8 @@ bool CMenu::TreatEvent (const SDL_Event & event) // Détecte dans quel bouton est la souris. -Sint32 CMenu::Detect (POINT pos) +Sint32 +CMenu::Detect (POINT pos) { Sint32 rank; @@ -453,14 +465,16 @@ Sint32 CMenu::Detect (POINT pos) // Bouton de la souris pressé. -bool CMenu::MouseDown (POINT pos) +bool +CMenu::MouseDown (POINT pos) { return false; } // Souris déplacés. -bool CMenu::MouseMove (POINT pos) +bool +CMenu::MouseMove (POINT pos) { m_selRank = Detect (pos); @@ -478,7 +492,8 @@ bool CMenu::MouseMove (POINT pos) // Bouton de la souris relâché. -bool CMenu::MouseUp (POINT pos) +bool +CMenu::MouseUp (POINT pos) { m_selRank = Detect (pos); @@ -487,7 +502,8 @@ bool CMenu::MouseUp (POINT pos) // Envoie le message. -void CMenu::Message () +void +CMenu::Message () { if (m_selRank != -1) CEvent::PushUserEvent (EV_BUTTON0 + m_selRank); diff --git a/src/misc.cxx b/src/misc.cxx index e72faaa..63c1af0 100644 --- a/src/misc.cxx +++ b/src/misc.cxx @@ -38,14 +38,16 @@ // Affiche un message de debug. -void OutputDebug (const char * pMessage) +void +OutputDebug (const char * pMessage) { SDL_LogDebug (SDL_LOG_CATEGORY_APPLICATION, "%s", pMessage); } // Conversion de la position de la souris. -POINT ConvLongToPos (LPARAM lParam) +POINT +ConvLongToPos (LPARAM lParam) { POINT pos; @@ -63,7 +65,8 @@ POINT ConvLongToPos (LPARAM lParam) static int g_seed; /* Initialize the Microsoft pseudo-random generator */ -void InitRandom () +void +InitRandom () { g_seed = 1; // srand (1); @@ -74,14 +77,16 @@ void InitRandom () * platforms. * See http://stackoverflow.com/a/1280765/842097 */ -int ms_rand () +int +ms_rand () { g_seed = g_seed * 0x343fd + 0x269EC3; return (g_seed >> 0x10) & 0x7FFF; } /* Returns a random number between two values (included). */ -Sint32 Random (Sint32 min, Sint32 max) +Sint32 +Random (Sint32 min, Sint32 max) { Sint32 n; @@ -91,19 +96,22 @@ Sint32 Random (Sint32 min, Sint32 max) return (Sint32) n; } -std::string GetLocale () +std::string +GetLocale () { return gettext ("en"); } // Retourne le nom de dossier en cours. -std::string GetBaseDir () +std::string +GetBaseDir () { return GetShareDir () + "planetblupi/"; } -std::string GetShareDir () +std::string +GetShareDir () { static std::string basePath; @@ -126,7 +134,8 @@ std::string GetShareDir () // Ajoute le chemin permettant de lire un fichier // utilisateur. -void AddUserPath (std::string & pFilename) +void +AddUserPath (std::string & pFilename) { const char * pText; size_t pos; diff --git a/src/misc.h b/src/misc.h index e8abc34..329e894 100644 --- a/src/misc.h +++ b/src/misc.h @@ -39,7 +39,8 @@ std::string GetLocale (); extern void AddUserPath (std::string & pFilename); template -std::string string_format (const std::string & format, Args... args) +std::string +string_format (const std::string & format, Args... args) { size_t size = snprintf (nullptr, 0, format.c_str (), args...) + 1; std::unique_ptr buf (new char[size]); diff --git a/src/movie.cxx b/src/movie.cxx index 7aa86ae..b09221e 100644 --- a/src/movie.cxx +++ b/src/movie.cxx @@ -31,7 +31,8 @@ // Initialize avi libraries. -bool CMovie::initAVI () +bool +CMovie::initAVI () { // Initialize Kitchensink with network support and all formats. Sint32 err = Kit_Init (KIT_INIT_FORMATS); @@ -46,7 +47,8 @@ bool CMovie::initAVI () // Closes the opened AVI file and the opened device type. | -void CMovie::termAVI () +void +CMovie::termAVI () { Kit_Quit (); } @@ -54,7 +56,8 @@ void CMovie::termAVI () // Close the movie and anything associated with it. | // This function clears the and flags | -void CMovie::fileCloseMovie () +void +CMovie::fileCloseMovie () { m_fPlaying = false; // can't be playing any longer m_fMovieOpen = false; // no more movies open @@ -85,7 +88,8 @@ void CMovie::fileCloseMovie () // the movie paused when opened. // Sets on success. -bool CMovie::fileOpenMovie (RECT rect, const std::string & pFilename) +bool +CMovie::fileOpenMovie (RECT rect, const std::string & pFilename) { const auto path = GetBaseDir () + pFilename; @@ -133,7 +137,8 @@ bool CMovie::fileOpenMovie (RECT rect, const std::string & pFilename) // Play/pause the movie depending on the state -void CMovie::playMovie () +void +CMovie::playMovie () { m_fPlaying = !m_fPlaying; // swap the play flag @@ -167,7 +172,8 @@ CMovie::~CMovie () // Ouvre la librairie avi. -bool CMovie::Create () +bool +CMovie::Create () { m_bEnable = initAVI (); return m_bEnable; @@ -175,14 +181,16 @@ bool CMovie::Create () // Retourne l'état de DirectMovie. -bool CMovie::GetEnable () +bool +CMovie::GetEnable () { return m_bEnable; } // Indique si un film existe. -bool CMovie::IsExist (const std::string & pFilename) +bool +CMovie::IsExist (const std::string & pFilename) { const auto path = GetBaseDir () + pFilename; FILE * file; @@ -197,7 +205,8 @@ bool CMovie::IsExist (const std::string & pFilename) // Montre un film avi. -bool CMovie::Play (RECT rect, const std::string & pFilename) +bool +CMovie::Play (RECT rect, const std::string & pFilename) { if (!m_bEnable) return false; @@ -212,7 +221,8 @@ bool CMovie::Play (RECT rect, const std::string & pFilename) // Stoppe le film avi. -void CMovie::Stop () +void +CMovie::Stop () { if (!m_bEnable) return; @@ -220,7 +230,8 @@ void CMovie::Stop () fileCloseMovie (); } -void CMovie::Pause () +void +CMovie::Pause () { if (!m_bEnable || !m_fPlaying) return; @@ -231,7 +242,8 @@ void CMovie::Pause () Kit_PlayerPause (m_player); } -void CMovie::Resume () +void +CMovie::Resume () { if (!m_bEnable || !m_fPlaying) return; @@ -242,7 +254,8 @@ void CMovie::Resume () Kit_PlayerPlay (m_player); } -bool CMovie::Render () +bool +CMovie::Render () { if (!m_bEnable || !m_fPlaying) return false; diff --git a/src/obstacle.cxx b/src/obstacle.cxx index af2d63a..998fc66 100644 --- a/src/obstacle.cxx +++ b/src/obstacle.cxx @@ -1285,7 +1285,8 @@ static char tableObstacleObject[] = // Retourne les obstacles autour d'une cellule, sous la // forme d'un tableau de 3x3. -void CDecor::SearchFloor (Sint32 rank, Sint32 icon, POINT cel, Sint32 * pBits) +void +CDecor::SearchFloor (Sint32 rank, Sint32 icon, POINT cel, Sint32 * pBits) { char * pTable; Sint32 first, last; @@ -1334,7 +1335,8 @@ void CDecor::SearchFloor (Sint32 rank, Sint32 icon, POINT cel, Sint32 * pBits) // Retourne les obstacles autour d'une cellule, sous la // forme d'un tableau de 3x3. -void CDecor::SearchObject (Sint32 rank, Sint32 icon, POINT cel, Sint32 * pBits) +void +CDecor::SearchObject (Sint32 rank, Sint32 icon, POINT cel, Sint32 * pBits) { char * pTable; Sint32 dx, dy, x, y, i; @@ -1368,7 +1370,8 @@ void CDecor::SearchObject (Sint32 rank, Sint32 icon, POINT cel, Sint32 * pBits) // Ajuste un sol en fonction du personnage. -void CDecor::AjustFloor (Sint32 rank, Sint32 icon, POINT cel, Sint32 * pBits) +void +CDecor::AjustFloor (Sint32 rank, Sint32 icon, POINT cel, Sint32 * pBits) { Sint32 i; @@ -1429,7 +1432,8 @@ lock: // Ajuste un obstacle en fonction du personnage. -void CDecor::AjustObject (Sint32 rank, Sint32 icon, POINT cel, Sint32 * pBits) +void +CDecor::AjustObject (Sint32 rank, Sint32 icon, POINT cel, Sint32 * pBits) { Sint32 i; @@ -1577,7 +1581,8 @@ lock: // Copie un tableau 3x3 dans un tableau 9x9. -void Copy33To99 (Sint32 * pSrc33, Sint32 * pDst99, Sint32 dx, Sint32 dy) +void +Copy33To99 (Sint32 * pSrc33, Sint32 * pDst99, Sint32 dx, Sint32 dy) { Sint32 x, y; @@ -1590,7 +1595,8 @@ void Copy33To99 (Sint32 * pSrc33, Sint32 * pDst99, Sint32 dx, Sint32 dy) // Indique s'il est possible d'avancer dans une direction donnée. -bool CDecor::IsFreeDirect (POINT cel, Sint32 direct, Sint32 rank) +bool +CDecor::IsFreeDirect (POINT cel, Sint32 direct, Sint32 rank) { Sint32 icon, workBlupi; Sint32 bits[3 * 3], obstacles[9 * 9]; @@ -1672,7 +1678,8 @@ bool CDecor::IsFreeDirect (POINT cel, Sint32 direct, Sint32 rank) // Est utilisé lors du dessin (BuildPutBlupi), pour savoir // si blupi est devant un objet. -bool CDecor::IsFreeCelObstacle (POINT cel) +bool +CDecor::IsFreeCelObstacle (POINT cel) { Sint32 icon; Sint32 bits[9]; @@ -1701,7 +1708,8 @@ bool CDecor::IsFreeCelObstacle (POINT cel) // en tenant compte uniquement des sols. // Retourne true si blupi peut y aller ! -bool CDecor::IsFreeCelFloor (POINT cel, Sint32 rank) +bool +CDecor::IsFreeCelFloor (POINT cel, Sint32 rank) { Sint32 icon; Sint32 bits[9]; @@ -1725,7 +1733,8 @@ bool CDecor::IsFreeCelFloor (POINT cel, Sint32 rank) // Est utilisé pour savoir si blupi peut venir ici // débarquer en bateau ou monter dans sa jeep. -bool CDecor::IsFreeCelGo (POINT cel, Sint32 rank) +bool +CDecor::IsFreeCelGo (POINT cel, Sint32 rank) { bool bOK; POINT limit; @@ -1789,7 +1798,8 @@ bool CDecor::IsFreeCelGo (POINT cel, Sint32 rank) // Est utilisé pour savoir comment est la mise en évidence (hili) // à cet endroit. -bool CDecor::IsFreeCelHili (POINT cel, Sint32 rank) +bool +CDecor::IsFreeCelHili (POINT cel, Sint32 rank) { bool bOK; POINT limit; @@ -1836,7 +1846,8 @@ bool CDecor::IsFreeCelHili (POINT cel, Sint32 rank) // Indique si une cellule est libre. // Est utilisé pour savoir si blupi peut venir ici. -bool CDecor::IsFreeCel (POINT cel, Sint32 rank) +bool +CDecor::IsFreeCel (POINT cel, Sint32 rank) { Sint32 icon, workBlupi; Sint32 bits[9]; @@ -1874,7 +1885,8 @@ bool CDecor::IsFreeCel (POINT cel, Sint32 rank) // Indique si blupi peut déposer un objet ici. -bool CDecor::IsFreeCelDepose (POINT cel, Sint32 rank) +bool +CDecor::IsFreeCelDepose (POINT cel, Sint32 rank) { Sint32 icon; @@ -1898,7 +1910,8 @@ bool CDecor::IsFreeCelDepose (POINT cel, Sint32 rank) // Le point retourné dans "limit" indique jusqu'où il est // possible de marcher normalement (sans passe muraille). -bool CDecor::IsFreeCelEmbarque ( +bool +CDecor::IsFreeCelEmbarque ( POINT cel, Sint32 rank, Sint32 & action, POINT & limit) { bool bOK; @@ -1979,7 +1992,8 @@ bool CDecor::IsFreeCelEmbarque ( // Le point retourné dans "limit" indique jusqu'où il est // possible de naviguer normalement (sans passe muraille). -bool CDecor::IsFreeCelDebarque ( +bool +CDecor::IsFreeCelDebarque ( POINT cel, Sint32 rank, Sint32 & action, POINT & limit) { bool bOK; @@ -2049,7 +2063,8 @@ bool CDecor::IsFreeCelDebarque ( // Indique s'il est possible de sauter dans une direction. -bool CDecor::IsFreeJump (POINT cel, Sint32 direct, Sint32 rank, Sint32 & action) +bool +CDecor::IsFreeJump (POINT cel, Sint32 direct, Sint32 rank, Sint32 & action) { POINT depart, vector; Sint32 i, icon; @@ -2110,8 +2125,8 @@ bool CDecor::IsFreeJump (POINT cel, Sint32 direct, Sint32 rank, Sint32 & action) // Indique s'il est possible de glisser dans une direction. -bool CDecor::IsFreeGlisse ( - POINT cel, Sint32 direct, Sint32 rank, Sint32 & action) +bool +CDecor::IsFreeGlisse (POINT cel, Sint32 direct, Sint32 rank, Sint32 & action) { Sint32 channel, icon; @@ -2133,7 +2148,8 @@ bool CDecor::IsFreeGlisse ( // Cherche la meilleure direction pour atteindre un but. // Retourne -1 si on est déjà sur le but. -Sint32 CDecor::DirectSearch (POINT cel, POINT goal) +Sint32 +CDecor::DirectSearch (POINT cel, POINT goal) { POINT dir; Sint32 direct, tan; @@ -2234,7 +2250,8 @@ Sint32 CDecor::DirectSearch (POINT cel, POINT goal) // Vide les positions déjà essayées. -void CDecor::FlushUsed (Sint32 rank) +void +CDecor::FlushUsed (Sint32 rank) { m_blupi[rank].nbUsed = 0; m_blupi[rank].nextRankUsed = 0; @@ -2242,7 +2259,8 @@ void CDecor::FlushUsed (Sint32 rank) // Ajoute une position déjà été essayée. -void CDecor::AddUsedPos (Sint32 rank, POINT pos) +void +CDecor::AddUsedPos (Sint32 rank, POINT pos) { Sint32 i, j, old; @@ -2294,7 +2312,8 @@ void CDecor::AddUsedPos (Sint32 rank, POINT pos) // Cherche si une position a déjà été essayée. -bool CDecor::IsUsedPos (Sint32 rank, POINT pos) +bool +CDecor::IsUsedPos (Sint32 rank, POINT pos) { Sint32 i; @@ -2311,7 +2330,8 @@ bool CDecor::IsUsedPos (Sint32 rank, POINT pos) // Cherche la meilleure direction pour atteindre un but. -bool CDecor::SearchBestBase ( +bool +CDecor::SearchBestBase ( Sint32 rank, Sint32 & action, POINT & newCel, Sint32 & direct) { Sint32 searchDirect[8] = {0, 1, 7, 2, 6, 5, 3, 4}; @@ -2404,7 +2424,8 @@ bool CDecor::SearchBestBase ( // Cherche la meilleure direction pour atteindre un but. -bool CDecor::SearchBestPass (Sint32 rank, Sint32 & action) +bool +CDecor::SearchBestPass (Sint32 rank, Sint32 & action) { Blupi iBlupi; Sint32 i, j, direct; @@ -2513,7 +2534,8 @@ bool CDecor::SearchBestPass (Sint32 rank, Sint32 & action) // Le sol doit permettre d'aller aux 4 coins, et il ne doit // pas y avoir un autre blupi que soi-même. -bool CDecor::IsWorkableObject (POINT cel, Sint32 rank) +bool +CDecor::IsWorkableObject (POINT cel, Sint32 rank) { if ( !IsFreeCelFloor (GetCel (cel, 0, 0), -1) || @@ -2540,7 +2562,8 @@ bool CDecor::IsWorkableObject (POINT cel, Sint32 rank) // Cherche un autre objet pour continuer une action // (comme par exemple abatre des arbres). -bool CDecor::SearchOtherObject ( +bool +CDecor::SearchOtherObject ( Sint32 rank, POINT initCel, Sint32 action, Sint32 distMax, Sint32 channel, Sint32 firstIcon1, Sint32 lastIcon1, Sint32 firstIcon2, Sint32 lastIcon2, POINT & foundCel, Sint32 & foundIcon) @@ -2658,7 +2681,8 @@ bool CDecor::SearchOtherObject ( // Cherche un autre sol pouvant contenir du fer, pour y // planter un drapeau. -bool CDecor::SearchOtherDrapeau ( +bool +CDecor::SearchOtherDrapeau ( Sint32 rank, POINT initCel, Sint32 distMax, POINT & foundCel, Sint32 & foundIcon) { @@ -2720,7 +2744,8 @@ bool CDecor::SearchOtherDrapeau ( // Cherche un autre sol permettant de déposer du bois // pour construire un bateau. -bool CDecor::SearchOtherBateau ( +bool +CDecor::SearchOtherBateau ( Sint32 rank, POINT initCel, Sint32 distMax, POINT & foundCel, Sint32 & foundIcon) { @@ -2767,7 +2792,8 @@ bool CDecor::SearchOtherBateau ( // Vérifie si l'objet peut être détruit par l'araignée. -bool CDecor::IsSpiderObject (Sint32 icon) +bool +CDecor::IsSpiderObject (Sint32 icon) { return ( icon == 60 || // tomates ? @@ -2777,7 +2803,8 @@ bool CDecor::IsSpiderObject (Sint32 icon) // Cherche un autre objet pour l'araignée. -bool CDecor::SearchSpiderObject ( +bool +CDecor::SearchSpiderObject ( Sint32 rank, POINT initCel, Sint32 distMax, POINT & foundCel, Sint32 & foundIcon) { @@ -2837,7 +2864,8 @@ bool CDecor::SearchSpiderObject ( // Vérifie si l'objet peut être détruit par le tracks. -bool CDecor::IsTracksObject (Sint32 icon) +bool +CDecor::IsTracksObject (Sint32 icon) { return ( icon == 36 || // planches ? @@ -2857,7 +2885,8 @@ bool CDecor::IsTracksObject (Sint32 icon) // Cherche un autre objet pour le tracks. -bool CDecor::SearchTracksObject ( +bool +CDecor::SearchTracksObject ( Sint32 rank, POINT initCel, Sint32 distMax, POINT & foundCel, Sint32 & foundIcon) { @@ -2942,7 +2971,8 @@ bool CDecor::SearchTracksObject ( // Vérifie si l'objet peut être détruit par le robot. -bool CDecor::IsRobotObject (Sint32 icon) +bool +CDecor::IsRobotObject (Sint32 icon) { return ( icon == 85 || // dynamite ? @@ -2954,7 +2984,8 @@ bool CDecor::IsRobotObject (Sint32 icon) // Cherche une autre action pour le robot. // C'est ici qu'est contenue l'IA du robot ! -bool CDecor::SearchRobotObject ( +bool +CDecor::SearchRobotObject ( Sint32 rank, POINT initCel, Sint32 distMax, POINT & foundCel, Sint32 & foundIcon, Sint32 & foundAction) { @@ -3250,7 +3281,8 @@ bool CDecor::SearchRobotObject ( // Teste si un emplacement est ok pour bâtir une usine. -bool CDecor::IsUsineBuild (Sint32 rank, POINT cel) +bool +CDecor::IsUsineBuild (Sint32 rank, POINT cel) { Sint32 icon, channel; Sint32 x, y; @@ -3278,7 +3310,8 @@ bool CDecor::IsUsineBuild (Sint32 rank, POINT cel) // L'usine doit être libre devant (lieu de stationnement // pour l'ennemi qui sera construit). -bool CDecor::IsUsineFree (Sint32 rank, POINT cel) +bool +CDecor::IsUsineFree (Sint32 rank, POINT cel) { Sint32 channel, icon; @@ -3304,7 +3337,8 @@ bool CDecor::IsUsineFree (Sint32 rank, POINT cel) // Vérifie si l'objet peut être détruit par une bombe. -bool CDecor::IsBombeObject (Sint32 icon) +bool +CDecor::IsBombeObject (Sint32 icon) { return ( icon == 36 || // planches ? @@ -3317,7 +3351,8 @@ bool CDecor::IsBombeObject (Sint32 icon) // Cherche un autre objet pour une bombe. -bool CDecor::SearchBombeObject ( +bool +CDecor::SearchBombeObject ( Sint32 rank, POINT initCel, Sint32 distMax, POINT & foundCel, Sint32 & foundIcon) { @@ -3377,7 +3412,8 @@ bool CDecor::SearchBombeObject ( // Cherche un autre objet pour un électro. -bool CDecor::SearchElectroObject ( +bool +CDecor::SearchElectroObject ( Sint32 rank, POINT initCel, Sint32 distMax, POINT & foundCel, Sint32 & foundIcon) { @@ -3486,7 +3522,8 @@ bool CDecor::SearchElectroObject ( // Teste si une position est très proche du feu. // Si oui, retourne true. -bool CDecor::IsFireCel (POINT cel) +bool +CDecor::IsFireCel (POINT cel) { Sint32 x, y; POINT test; @@ -3517,7 +3554,8 @@ bool CDecor::IsFireCel (POINT cel) // Teste si une position est très proche d'un virus. // Si oui, retourne true. -bool CDecor::IsVirusCel (POINT cel) +bool +CDecor::IsVirusCel (POINT cel) { Sint32 rank; @@ -3539,7 +3577,8 @@ bool CDecor::IsVirusCel (POINT cel) // d'une cellule donnée (cel). // Retourne 0 si c'est possible, ou une erreur autrement ! -Errors CDecor::IsBuildPont (POINT & cel, Sint32 & iconBuild) +Errors +CDecor::IsBuildPont (POINT & cel, Sint32 & iconBuild) { POINT vector, test; Sint32 i, channel, icon, p1, p2, p3, r1, r2, nb, rest; @@ -3664,7 +3703,8 @@ Errors CDecor::IsBuildPont (POINT & cel, Sint32 & iconBuild) // Regarde s'il est possible de construire un bateau à partir // d'une cellule donnée (cel). -bool CDecor::IsBuildBateau (POINT cel, Sint32 & direct) +bool +CDecor::IsBuildBateau (POINT cel, Sint32 & direct) { Sint32 fChannel, fIcon; Sint32 oChannel, oIcon; @@ -3715,7 +3755,8 @@ bool CDecor::IsBuildBateau (POINT cel, Sint32 & direct) // Vide toutes les positions visitées. -void CDecor::InitDrapeau () +void +CDecor::InitDrapeau () { Sint32 i; @@ -3728,7 +3769,8 @@ void CDecor::InitDrapeau () // Mémorise une cellule visitée (ne contenant pas de fer). -void CDecor::AddDrapeau (POINT cel) +void +CDecor::AddDrapeau (POINT cel) { Sint32 i; @@ -3743,7 +3785,8 @@ void CDecor::AddDrapeau (POINT cel) // Supprime une cellule visitée (ne contenant pas de fer). -void CDecor::SubDrapeau (POINT cel) +void +CDecor::SubDrapeau (POINT cel) { Sint32 i; @@ -3759,7 +3802,8 @@ 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) { Sint32 i; diff --git a/src/path.cxx b/src/path.cxx index 574debe..653bdbd 100644 --- a/src/path.cxx +++ b/src/path.cxx @@ -24,7 +24,8 @@ // Mémorise toutes les positions des blupi. -void CDecor::CheminMemPos (Sint32 exRank) +void +CDecor::CheminMemPos (Sint32 exRank) { Sint32 rank, index; @@ -57,7 +58,8 @@ void CDecor::CheminMemPos (Sint32 exRank) // Teste si une positiion est occupée par un blupi. -bool CDecor::CheminTestPos (POINT pos, Sint32 & rank) +bool +CDecor::CheminTestPos (POINT pos, Sint32 & rank) { Sint32 i; @@ -77,7 +79,8 @@ bool CDecor::CheminTestPos (POINT pos, Sint32 & rank) // à la recherche du chemin le plus court // retourne la direction à prendre -Sint32 CDecor::CheminARebours (Sint32 rank) +Sint32 +CDecor::CheminARebours (Sint32 rank) { Sint32 pos, rebours, last, dir, set; POINT v; @@ -119,7 +122,8 @@ Sint32 CDecor::CheminARebours (Sint32 rank) // semblable à la précédente, // mais les points à explorer sont classés selon leur distance à la cible -void CDecor::CheminFillTerrain (Sint32 rank) +void +CDecor::CheminFillTerrain (Sint32 rank) { Sint32 pos, last, dest, dist; Sint32 step, dir, cout, action, max, next, ampli; @@ -196,7 +200,8 @@ void CDecor::CheminFillTerrain (Sint32 rank) // et le "prix à payer" pour aller dans cette direction // coût doit être déterminé en sortie -bool CDecor::CheminTestDirection ( +bool +CDecor::CheminTestDirection ( Sint32 rank, Sint32 pos, Sint32 dir, Sint32 & next, Sint32 & ampli, Sint32 & cout, Sint32 & action) { @@ -284,7 +289,8 @@ bool CDecor::CheminTestDirection ( // Retourne true si on a assigné une nouvelle direction à blupi. -bool CDecor::CheminCherche (Sint32 rank, Sint32 & action) +bool +CDecor::CheminCherche (Sint32 rank, Sint32 & action) { Sint32 cout; // prix pour aller dans une direction Sint32 pos, dir, next, ampli; @@ -326,7 +332,8 @@ bool CDecor::CheminCherche (Sint32 rank, Sint32 & action) // Teste s'il est possible de se rendre à un endroit donné. -bool CDecor::IsCheminFree (Sint32 rank, POINT dest, Sint32 button) +bool +CDecor::IsCheminFree (Sint32 rank, POINT dest, Sint32 button) { Sint32 action, sDirect; POINT goalCel, passCel, limit; diff --git a/src/pixmap.cxx b/src/pixmap.cxx index 3081bbe..29ab02d 100644 --- a/src/pixmap.cxx +++ b/src/pixmap.cxx @@ -88,7 +88,8 @@ CPixmap::~CPixmap () // Cr�e l'objet DirectDraw principal. // Retourne false en cas d'erreur. -bool CPixmap::Create (POINT dim) +bool +CPixmap::Create (POINT dim) { m_dim = dim; @@ -102,7 +103,8 @@ bool CPixmap::Create (POINT dim) // Rempli une zone rectangulaire avec une couleur uniforme. -void CPixmap::Fill (RECT rect, COLORREF color) +void +CPixmap::Fill (RECT rect, COLORREF color) { // � faire si n�cessaire ... } @@ -110,7 +112,8 @@ void CPixmap::Fill (RECT rect, COLORREF color) // Effectue un appel BltFast. // Les modes sont 0=transparent, 1=opaque. -Sint32 CPixmap::BltFast (Sint32 chDst, size_t channel, POINT dst, RECT rcRect) +Sint32 +CPixmap::BltFast (Sint32 chDst, size_t channel, POINT dst, RECT rcRect) { Sint32 res, limit; @@ -172,7 +175,8 @@ Sint32 CPixmap::BltFast (Sint32 chDst, size_t channel, POINT dst, RECT rcRect) // Effectue un appel BltFast. // Les modes sont 0=transparent, 1=opaque. -Sint32 CPixmap::BltFast ( +Sint32 +CPixmap::BltFast ( SDL_Texture * lpSDL, size_t channel, POINT dst, RECT rcRect, SDL_BlendMode mode) { @@ -208,7 +212,8 @@ Sint32 CPixmap::BltFast ( * * \returns true on success. */ -bool CPixmap::ReloadTargetTextures () +bool +CPixmap::ReloadTargetTextures () { for (auto & tex : m_SDLTextureInfo) { @@ -225,7 +230,8 @@ bool CPixmap::ReloadTargetTextures () // Cache une image contenant des ic�nes. -bool CPixmap::Cache ( +bool +CPixmap::Cache ( size_t channel, const std::string & pFilename, POINT totalDim, POINT iconDim) { std::string file = GetBaseDir () + pFilename; @@ -284,8 +290,8 @@ bool CPixmap::Cache ( // Cache une image globale. -bool CPixmap::Cache ( - size_t channel, const std::string & pFilename, POINT totalDim) +bool +CPixmap::Cache (size_t channel, const std::string & pFilename, POINT totalDim) { POINT iconDim; @@ -297,7 +303,8 @@ bool CPixmap::Cache ( // Cache une image provenant d'un bitmap. -bool CPixmap::Cache (size_t channel, SDL_Surface * surface, POINT totalDim) +bool +CPixmap::Cache (size_t channel, SDL_Surface * surface, POINT totalDim) { // Create the offscreen surface, by loading our bitmap. if ( @@ -319,21 +326,24 @@ bool CPixmap::Cache (size_t channel, SDL_Surface * surface, POINT totalDim) // Modifie la r�gion de clipping. -void CPixmap::SetClipping (RECT clip) +void +CPixmap::SetClipping (RECT clip) { m_clipRect = clip; } // Retourne la r�gion de clipping. -RECT CPixmap::GetClipping () +RECT +CPixmap::GetClipping () { return m_clipRect; } // Teste si un point fait partie d'une ic�ne. -bool CPixmap::IsIconPixel (size_t channel, Sint32 rank, POINT pos) +bool +CPixmap::IsIconPixel (size_t channel, Sint32 rank, POINT pos) { Sint32 nbx, nby; @@ -370,7 +380,8 @@ bool CPixmap::IsIconPixel (size_t channel, Sint32 rank, POINT pos) // Dessine une partie d'image rectangulaire. // Les modes sont 0=transparent, 1=opaque. -bool CPixmap::DrawIcon ( +bool +CPixmap::DrawIcon ( Sint32 chDst, size_t channel, Sint32 rank, POINT pos, bool bMask) { Sint32 nbx, nby; @@ -407,7 +418,8 @@ bool CPixmap::DrawIcon ( // 32,32 34,33 // 33,48 35,49 -bool CPixmap::DrawIconDemi ( +bool +CPixmap::DrawIconDemi ( Sint32 chDst, size_t channel, Sint32 rank, POINT pos, bool bMask) { Sint32 nbx, nby; @@ -438,7 +450,8 @@ bool CPixmap::DrawIconDemi ( // Dessine une partie d'image rectangulaire. -bool CPixmap::DrawIconPart ( +bool +CPixmap::DrawIconPart ( Sint32 chDst, size_t channel, Sint32 rank, POINT pos, Sint32 startY, Sint32 endY, bool bMask) { @@ -471,7 +484,8 @@ bool CPixmap::DrawIconPart ( // Dessine une partie d'image n'importe o�. -bool CPixmap::DrawPart ( +bool +CPixmap::DrawPart ( Sint32 chDst, size_t channel, POINT dest, RECT rect, bool bMask) { if (m_SDLTextureInfo.find (channel) == m_SDLTextureInfo.end ()) @@ -482,7 +496,8 @@ bool CPixmap::DrawPart ( // Dessine une partie d'image rectangulaire. -bool CPixmap::DrawImage (Sint32 chDst, size_t channel, RECT rect) +bool +CPixmap::DrawImage (Sint32 chDst, size_t channel, RECT rect) { POINT dst; Sint32 res; @@ -506,7 +521,8 @@ bool CPixmap::DrawImage (Sint32 chDst, size_t channel, RECT rect) // Construit une ic�ne en utilisant un masque. -bool CPixmap::BuildIconMask ( +bool +CPixmap::BuildIconMask ( size_t channelMask, Sint32 rankMask, size_t channel, Sint32 rankSrc, Sint32 rankDst) { @@ -588,7 +604,8 @@ bool CPixmap::BuildIconMask ( // Affiche le pixmap � l'�cran. // Retourne false en cas d'erreur. -bool CPixmap::Display () +bool +CPixmap::Display () { m_bBackDisplayed = true; SDL_RenderPresent (g_renderer); @@ -597,7 +614,8 @@ bool CPixmap::Display () // Change le lutin de la souris. -void CPixmap::SetMouseSprite (MouseSprites sprite) +void +CPixmap::SetMouseSprite (MouseSprites sprite) { if (m_mouseSprite == sprite) return; @@ -609,7 +627,8 @@ void CPixmap::SetMouseSprite (MouseSprites sprite) // Montre ou cache la souris. -void CPixmap::MouseShow (bool bShow) +void +CPixmap::MouseShow (bool bShow) { SDL_ShowCursor (bShow); } @@ -617,7 +636,8 @@ void CPixmap::MouseShow (bool bShow) // Retourne le rectangle correspondant au sprite // de la souris dans CHBLUPI. -RECT CPixmap::MouseRectSprite () +RECT +CPixmap::MouseRectSprite () { Sint32 rank, nbx; RECT rcRect; @@ -662,7 +682,8 @@ RECT CPixmap::MouseRectSprite () return rcRect; } -SDL_Point CPixmap::GetCursorHotSpot (MouseSprites sprite) +SDL_Point +CPixmap::GetCursorHotSpot (MouseSprites sprite) { static const Sint32 hotspots[MAXCURSORS * 2] = { 30, 30, // SPRITE_ARROW @@ -694,7 +715,8 @@ SDL_Point CPixmap::GetCursorHotSpot (MouseSprites sprite) return hotspot; } -SDL_Rect CPixmap::GetCursorRect (MouseSprites sprite) +SDL_Rect +CPixmap::GetCursorRect (MouseSprites sprite) { Sint32 rank; SDL_Rect rcRect; @@ -755,7 +777,8 @@ SDL_Rect CPixmap::GetCursorRect (MouseSprites sprite) return rcRect; } -void CPixmap::LoadCursors () +void +CPixmap::LoadCursors () { Uint32 rmask, gmask, bmask, amask; @@ -790,7 +813,8 @@ on the endianness (byte order) of the machine */ } } -void CPixmap::ChangeSprite (MouseSprites sprite) +void +CPixmap::ChangeSprite (MouseSprites sprite) { if (m_lpCurrentCursor == m_lpSDLCursors[sprite - 1]) return; diff --git a/src/progress.cxx b/src/progress.cxx index 51a1e15..fd5c2c8 100644 --- a/src/progress.cxx +++ b/src/progress.cxx @@ -43,7 +43,8 @@ CJauge::~CJauge () // Crée un nouveau bouton. -bool CJauge::Create (CPixmap * pPixmap, CSound * pSound, POINT pos, Sint32 type) +bool +CJauge::Create (CPixmap * pPixmap, CSound * pSound, POINT pos, Sint32 type) { m_pPixmap = pPixmap; m_pSound = pSound; @@ -59,7 +60,8 @@ bool CJauge::Create (CPixmap * pPixmap, CSound * pSound, POINT pos, Sint32 type) // Dessine un bouton dans son état. -void CJauge::Draw () +void +CJauge::Draw () { Sint32 part; RECT rect; @@ -94,7 +96,8 @@ void CJauge::Draw () // Modifie le niveau. -void CJauge::SetLevel (Sint32 level) +void +CJauge::SetLevel (Sint32 level) { if (level < 0) level = 0; @@ -106,22 +109,26 @@ void CJauge::SetLevel (Sint32 level) // Modifie le type. -void CJauge::SetType (Sint32 type) +void +CJauge::SetType (Sint32 type) { m_type = type; } -bool CJauge::GetHide () +bool +CJauge::GetHide () { return m_bHide; } -void CJauge::SetHide (bool bHide) +void +CJauge::SetHide (bool bHide) { m_bHide = bHide; } -POINT CJauge::GetPos () +POINT +CJauge::GetPos () { return m_pos; } diff --git a/src/sound.cxx b/src/sound.cxx index 83201ab..99c96aa 100644 --- a/src/sound.cxx +++ b/src/sound.cxx @@ -27,7 +27,8 @@ // Stops all sounds. -bool CSound::StopAllSounds (bool immediat) +bool +CSound::StopAllSounds (bool immediat) { for (Sint32 i = 0; i < MAXSOUND; i++) { @@ -84,7 +85,8 @@ CSound::~CSound () // Initialisation de DirectSound. -bool CSound::Create () +bool +CSound::Create () { if ( Mix_OpenAudio (44100, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 4096) == -1) @@ -99,36 +101,42 @@ bool CSound::Create () // Enclenche ou d�clenche le son. -void CSound::SetState (bool bState) +void +CSound::SetState (bool bState) { m_bState = bState; } // Gestion des volumes audio (.wav) et midi (.mid). -void CSound::SetAudioVolume (Sint32 volume) +void +CSound::SetAudioVolume (Sint32 volume) { m_audioVolume = volume; } -Sint32 CSound::GetAudioVolume () +Sint32 +CSound::GetAudioVolume () { return m_audioVolume; } -void CSound::SetMidiVolume (Sint32 volume) +void +CSound::SetMidiVolume (Sint32 volume) { m_midiVolume = volume; } -Sint32 CSound::GetMidiVolume () +Sint32 +CSound::GetMidiVolume () { return m_midiVolume; } // Cache tous les ficheirs son (.wav). -void CSound::CacheAll () +void +CSound::CacheAll () { Sint32 i; char name[50]; @@ -145,7 +153,8 @@ void CSound::CacheAll () // Charge un fichier son (.wav). -bool CSound::Cache (Sint32 channel, const std::string & pFilename) +bool +CSound::Cache (Sint32 channel, const std::string & pFilename) { if (channel < 0 || channel >= MAXSOUND) return false; @@ -190,7 +199,8 @@ err: return false; } -void CSound::FlushAll () +void +CSound::FlushAll () { for (size_t ch = 0; ch < sizeof (m_lpSDL); ++ch) Flush (ch); @@ -198,7 +208,8 @@ void CSound::FlushAll () // D�charge un son. -void CSound::Flush (Sint32 channel) +void +CSound::Flush (Sint32 channel) { if (channel < 0 || channel >= MAXSOUND) return; @@ -215,7 +226,8 @@ void CSound::Flush (Sint32 channel) // Le panoramique est compris entre 255,0 (gauche), 127,128 (centre) // et 0,255 (droite). -bool CSound::Play (Sint32 channel, Sint32 volume, Uint8 panLeft, Uint8 panRight) +bool +CSound::Play (Sint32 channel, Sint32 volume, Uint8 panLeft, Uint8 panRight) { if (!m_bState || !m_audioVolume) return true; @@ -238,7 +250,8 @@ bool CSound::Play (Sint32 channel, Sint32 volume, Uint8 panLeft, Uint8 panRight) // Si rank != -1, il indique le rang du blupi dont il faudra // �ventuellement stopper le dernier son en cours ! -bool CSound::PlayImage (Sounds channel, POINT pos, Sint32 rank) +bool +CSound::PlayImage (Sounds channel, POINT pos, Sint32 rank) { Sint32 volumex, volumey, volume; Sounds stopCh; @@ -299,7 +312,8 @@ bool CSound::PlayImage (Sounds channel, POINT pos, Sint32 rank) // Uses MCI to play a MIDI file. The window procedure // is notified when playback is complete. -bool CSound::PlayMusic (const std::string & lpszMIDIFilename) +bool +CSound::PlayMusic (const std::string & lpszMIDIFilename) { std::string path = GetBaseDir (); @@ -331,7 +345,8 @@ bool CSound::PlayMusic (const std::string & lpszMIDIFilename) // Restart the MIDI player. -bool CSound::RestartMusic () +bool +CSound::RestartMusic () { OutputDebug ("RestartMusic\n"); @@ -345,7 +360,8 @@ bool CSound::RestartMusic () // Shuts down the MIDI player. -void CSound::SuspendMusic () +void +CSound::SuspendMusic () { if (m_nbSuspendSkip != 0) { @@ -359,7 +375,8 @@ void CSound::SuspendMusic () // Shuts down the MIDI player. -void CSound::StopMusic () +void +CSound::StopMusic () { SuspendMusic (); m_MIDIFilename[0] = 0; @@ -367,19 +384,22 @@ void CSound::StopMusic () // Retourne true si une musique est en cours. -bool CSound::IsPlayingMusic () +bool +CSound::IsPlayingMusic () { return (m_MIDIFilename[0] != 0); } -bool CSound::IsStoppedOnDemand () +bool +CSound::IsStoppedOnDemand () { return m_bStopped; } // Adapte le volume de la musique en cours, si n�cessaire. -void CSound::AdaptVolumeMusic () +void +CSound::AdaptVolumeMusic () { if (m_midiVolume != m_lastMidiVolume) { @@ -390,7 +410,8 @@ void CSound::AdaptVolumeMusic () // Indique le nombre de suspend � sauter. -void CSound::SetSuspendSkip (Sint32 nb) +void +CSound::SetSuspendSkip (Sint32 nb) { m_nbSuspendSkip = nb; } diff --git a/src/text.cxx b/src/text.cxx index 7f1749e..b0098f7 100644 --- a/src/text.cxx +++ b/src/text.cxx @@ -31,7 +31,8 @@ * \param[in] c - The character (incremented if 0xC3 UTF-8). * \returns the offset. */ -static Sint32 GetOffset (const char *& c) +static Sint32 +GetOffset (const char *& c) { static const unsigned char table_accents[] = { /* ü à â é è ë ê ï */ @@ -63,7 +64,8 @@ static Sint32 GetOffset (const char *& c) * \param[in] font - The font used (little or normal). * \returns the length. */ -Sint32 GetCharWidth (const char *& c, Sint32 font) +Sint32 +GetCharWidth (const char *& c, Sint32 font) { // clang-format off static const unsigned char table_width[] = @@ -105,7 +107,8 @@ Sint32 GetCharWidth (const char *& c, Sint32 font) * \param[in] pText - The text. * \param[in] font - The font style (little or normal). */ -void DrawText (CPixmap * pPixmap, POINT pos, const char * pText, Sint32 font) +void +DrawText (CPixmap * pPixmap, POINT pos, const char * pText, Sint32 font) { Sint32 rank; @@ -128,7 +131,8 @@ void DrawText (CPixmap * pPixmap, POINT pos, const char * pText, Sint32 font) // Affiche un texte penché. -void DrawTextPente ( +void +DrawTextPente ( CPixmap * pPixmap, POINT pos, const char * pText, Sint32 pente, Sint32 font) { Sint32 rank, lg, rel, start; @@ -154,7 +158,8 @@ void DrawTextPente ( // Si part != -1, n'affiche que les lignes qui commencent // par "n|", avec n=part. -void DrawTextRect ( +void +DrawTextRect ( CPixmap * pPixmap, POINT pos, char * pText, Sint32 pente, Sint32 font, Sint32 part) { @@ -210,8 +215,8 @@ void DrawTextRect ( // Affiche un texte centré pouvant éventuellement // contenir plusieurs lignes séparées par des '\n'. -void DrawTextCenter ( - CPixmap * pPixmap, POINT pos, const char * pText, Sint32 font) +void +DrawTextCenter (CPixmap * pPixmap, POINT pos, const char * pText, Sint32 font) { char text[100]; char * pDest; @@ -252,7 +257,8 @@ void DrawTextCenter ( // Retourne la hauteur d'un texte. -Sint32 GetTextHeight (char * pText, Sint32 font, Sint32 part) +Sint32 +GetTextHeight (char * pText, Sint32 font, Sint32 part) { char text[100]; char * pDest; @@ -303,7 +309,8 @@ Sint32 GetTextHeight (char * pText, Sint32 font, Sint32 part) // Retourne la longueur d'un texte. -Sint32 GetTextWidth (const char * pText, Sint32 font) +Sint32 +GetTextWidth (const char * pText, Sint32 font) { Sint32 width = 0; @@ -318,7 +325,8 @@ Sint32 GetTextWidth (const char * pText, Sint32 font) // Retourne la longueur d'un grand chiffre. -void GetBignumInfo (Sint32 num, Sint32 & start, Sint32 & lg) +void +GetBignumInfo (Sint32 num, Sint32 & start, Sint32 & lg) { static Sint32 table[11] = {0, 53, 87, 133, 164, 217, 253, 297, 340, 382, 426}; @@ -328,7 +336,8 @@ void GetBignumInfo (Sint32 num, Sint32 & start, Sint32 & lg) // Affiche un grand nombre. -void DrawBignum (CPixmap * pPixmap, POINT pos, Sint32 num) +void +DrawBignum (CPixmap * pPixmap, POINT pos, Sint32 num) { char string[10]; Sint32 i = 0; @@ -354,7 +363,8 @@ void DrawBignum (CPixmap * pPixmap, POINT pos, Sint32 num) // Retourne la longueur d'un grand nombre. -Sint32 GetBignumWidth (Sint32 num) +Sint32 +GetBignumWidth (Sint32 num) { char string[10]; Sint32 i = 0; diff --git a/src/text.h b/src/text.h index c4d3c50..9e67400 100644 --- a/src/text.h +++ b/src/text.h @@ -27,16 +27,20 @@ #define FONTLITTLE 10 // clang-format on -void DrawText ( - CPixmap * pPixmap, POINT pos, const char * pText, Sint32 font = 0); +void +DrawText (CPixmap * pPixmap, POINT pos, const char * pText, Sint32 font = 0); + void DrawTextPente ( CPixmap * pPixmap, POINT pos, const char * pText, Sint32 pente, Sint32 font = 0); + void DrawTextRect ( CPixmap * pPixmap, POINT pos, char * pText, Sint32 pente, Sint32 font = 0, Sint32 part = -1); + void DrawTextCenter ( CPixmap * pPixmap, POINT pos, const char * pText, Sint32 font = 0); + Sint32 GetTextHeight (char * pText, Sint32 font = 0, Sint32 part = -1); Sint32 GetTextWidth (const char * pText, Sint32 font = 0); void DrawBignum (CPixmap * pPixmap, POINT pos, Sint32 num);