diff --git a/src/event.cxx b/src/event.cxx index 6acc8d8..0443a44 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -2464,7 +2464,7 @@ CEvent::DrawButtons () DrawText (m_pPixmap, pos, list[GetWorld () % 5]); } - // Affiche le texte lorsque c'est fini. + // Show the ending text when the game is finished. if (m_phase == EV_PHASE_LASTWIN) { char * text; @@ -2481,7 +2481,7 @@ CEvent::DrawButtons () DrawText (m_pPixmap, pos, text); } - // Dessine les réglages. + // Draw the game settings. if (m_phase == EV_PHASE_SETUP || m_phase == EV_PHASE_SETUPp) { DrawTextCenter (gettext ("Global game\nspeed"), 54 + 40, 80); @@ -2625,7 +2625,7 @@ CEvent::DrawButtons () DrawText (m_pPixmap, pos, text); } - // Affiche le texte lorsqu'il faut insérer le CD-Rom. + // Show the text when the CD-Rom must be inserted (deprecated). if (m_phase == EV_PHASE_INSERT) DrawTextCenter ( gettext ("Insert CD-Rom Planet Blupi and wait a few seconds..."), @@ -2634,15 +2634,19 @@ CEvent::DrawButtons () if (m_phase == EV_PHASE_BUILD) SetEnable (EV_PHASE_UNDO, m_pDecor->IsUndo ()); - // Dessine les tool tips (info bulle). + // Draw the tooltips. if (m_textToolTips[0] != 0) DrawText (m_pPixmap, m_posToolTips, m_textToolTips); return true; } -// Retourne le lutin à utiliser à une position donnée. - +/** + * \brief Return the mouse sprite to use for a position. + * + * \param[in] pos - The position. + * \return the sprite. + */ MouseSprites CEvent::MousePosToSprite (Point pos) { @@ -2713,8 +2717,11 @@ CEvent::MousePosToSprite (Point pos) return sprite; } -// Gère le lutin de la souris. - +/** + * \brief Main mouse sprite handling. + * + * \param[in] pos - The position. + */ void CEvent::MouseSprite (Point pos) { @@ -2722,8 +2729,11 @@ CEvent::MouseSprite (Point pos) m_pPixmap->ChangeSprite (m_mouseSprite); } -// Met ou enlève le sablier de la souris. - +/** + * \brief Set or remove the waiting mouse sprite. + * + * \param[in] bWait - If waiting. + */ void CEvent::WaitMouse (bool bWait) { @@ -2737,8 +2747,11 @@ CEvent::WaitMouse (bool bWait) m_pPixmap->ChangeSprite (m_mouseSprite); } -// Cache ou montre la souris. - +/** + * \brief Hide or show the mouse. + * + * \param[in] bHide - If hide. + */ void CEvent::HideMouse (bool bHide) { @@ -2759,8 +2772,13 @@ CEvent::HideMouse (bool bHide) m_pPixmap->ChangeSprite (m_mouseSprite); } -// Traite les événements pour tous les boutons. - +/** + * \brief Handle events for buttons. + * + * \param[in] event - The SDL event. + * \param[in] pos - The position. + * \return true if the event is handled. + */ bool CEvent::EventButtons (const SDL_Event & event, Point pos) { @@ -2850,7 +2868,7 @@ CEvent::EventButtons (const SDL_Event & event, Point pos) (event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) { - // Montre ou cache les infos tout en haut. + // Show or hide the informations at the top. m_pDecor->SetInfoMode (!m_pDecor->GetInfoMode ()); } } @@ -2873,7 +2891,7 @@ CEvent::EventButtons (const SDL_Event & event, Point pos) (event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) { - // Inverse le mode aide dans les infos. + // Reverse the help mode in the informations. m_bInfoHelp = !m_bInfoHelp; if (m_bInfoHelp) @@ -2891,7 +2909,7 @@ CEvent::EventButtons (const SDL_Event & event, Point pos) (event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) { - m_pDecor->HideTooltips (true); // plus de tooltips pour décor + m_pDecor->HideTooltips (true); // Remove tooltips for the decor. } if ( event.type == SDL_MOUSEBUTTONUP && @@ -2920,8 +2938,12 @@ CEvent::EventButtons (const SDL_Event & event, Point pos) return false; } -// Indique si la souris est sur un bouton. - +/** + * \brief Notify if the mouse is on a button. + * + * \param[in] pos - The mouse position. + * \return true if the mouse is on a button. + */ bool CEvent::MouseOnButton (Point pos) { @@ -2941,8 +2963,12 @@ CEvent::MouseOnButton (Point pos) return false; } -// Retourne l'index dans table pour une phase donnée. - +/** + * \brief Return the table index for a specific phase. + * + * \param[in] phase - The phase. + * \return the index in `table`. + */ Sint32 CEvent::SearchPhase (Uint32 phase) { @@ -2958,8 +2984,11 @@ CEvent::SearchPhase (Uint32 phase) return -1; } -// Donne le numéro du monde. - +/** + * \brief Return the world number. + * + * \return the number. + */ Sint32 CEvent::GetWorld () { @@ -2971,8 +3000,13 @@ CEvent::GetWorld () return m_mission; } -// Donne le numéro physique du monde. - +/** + * \brief Return the physical world number. + * + * This number should be the same as the filename. + * + * \return the number. + */ Sint32 CEvent::GetPhysicalWorld () { @@ -2995,8 +3029,11 @@ CEvent::GetImageWorld () return 1; } -// Indique si l'aide est disponible. - +/** + * Notify if the help is available. + * + * \return true if available. + */ bool CEvent::IsHelpHide () { @@ -3006,14 +3043,18 @@ CEvent::IsHelpHide () bHide = false; if (m_bSchool || m_bPrivate) { - bHide = true; // pas d'aide pour les exercices + bHide = true; // No help for the exercises. } return bHide; } -// Change de phase. - +/** + * \brief Change the phase. + * + * \param[in] phase - The new phase. + * \return true if the phase has changed. + */ bool CEvent::ChangePhase (Uint32 phase) { @@ -3082,11 +3123,11 @@ CEvent::ChangePhase (Uint32 phase) m_pSound->StopAllSounds (false, &except); } - m_phase = phase; // change de phase + m_phase = phase; // change phase m_index = index; filename = table[m_index].backName; - if (filename.find ("%.3d") != std::string::npos) // "%.3d" dans le nom ? + if (filename.find ("%.3d") != std::string::npos) filename = string_format (table[m_index].backName, GetImageWorld ()); totalDim.x = LXIMAGE; totalDim.y = LYIMAGE; @@ -3094,10 +3135,10 @@ CEvent::ChangePhase (Uint32 phase) iconDim.y = 0; if (!m_pPixmap->Cache (CHBACK, filename, totalDim, iconDim)) { - WaitMouse (false); // enlève le sablier + WaitMouse (false); m_tryInsertCount = 40; m_tryPhase = m_phase; - return ChangePhase (EV_PHASE_INSERT); // insérez le CD-Rom ... + return ChangePhase (EV_PHASE_INSERT); // insert the CD-Rom ... } if ( @@ -3122,13 +3163,13 @@ CEvent::ChangePhase (Uint32 phase) { if ( !m_pDecor->Read ( - GetPhysicalWorld (), false, world, time, total) && // lit le monde + GetPhysicalWorld (), false, world, time, total) && // read the world !m_bAccessBuild && !m_bPrivate) { m_tryInsertCount = 40; m_tryPhase = m_phase; - return ChangePhase (EV_PHASE_INSERT); // insérez le CD-Rom ... + return ChangePhase (EV_PHASE_INSERT); // insert the CD-Rom ... } m_pDecor->SetTime (0); m_pDecor->SetTotalTime (0); @@ -3164,7 +3205,7 @@ CEvent::ChangePhase (Uint32 phase) if (m_phase == EV_PHASE_TESTCD) { - if (m_pDecor->Read (0, false, world, time, total)) // lit un monde + if (m_pDecor->Read (0, false, world, time, total)) // read the world { return ChangePhase (EV_PHASE_INIT); // ok } @@ -3172,25 +3213,25 @@ CEvent::ChangePhase (Uint32 phase) { m_tryInsertCount = 40; m_tryPhase = m_phase; - return ChangePhase (EV_PHASE_INSERT); // insérez le CD-Rom ... + return ChangePhase (EV_PHASE_INSERT); // insert the CD-Rom ... } } - m_jauges[0].SetHide (true); // cache les jauges + m_jauges[0].SetHide (true); m_jauges[1].SetHide (true); - CreateButtons (); // crée les boutons selon la phase + CreateButtons (); // create the buttons accordingly to the phase m_bMenu = false; m_pDecor->HideTooltips (false); m_menu.Delete (); - m_pDecor->BlupiSetArrow (0, false); // enlève toutes les flèches - m_pDecor->ResetHili (); // enlève les mises en évidence + m_pDecor->BlupiSetArrow (0, false); // remove all arrows + m_pDecor->ResetHili (); // remove all highlights if (m_phase == EV_PHASE_PLAY) { m_pDecor->LoadImages (); m_pDecor->SetBuild (false); m_pDecor->EnableFog (true); - m_pDecor->NextPhase (0); // refait la carte tout de suite + m_pDecor->NextPhase (0); // rebuild the map immediatly m_pDecor->StatisticInit (); m_pDecor->TerminatedInit (); } @@ -3199,16 +3240,16 @@ CEvent::ChangePhase (Uint32 phase) { m_bBuildModify = true; SetState (EV_DECOR1, 1); - SetMenu (EV_DECOR1, 0); // herbe - SetMenu (EV_DECOR2, 2); // arbre - SetMenu (EV_DECOR3, 1); // maison - SetMenu (EV_DECOR4, 2); // blupi fort - SetMenu (EV_DECOR5, 1); // feu + SetMenu (EV_DECOR1, 0); // grass + SetMenu (EV_DECOR2, 2); // tree + SetMenu (EV_DECOR3, 1); // house + SetMenu (EV_DECOR4, 2); // strong blupi + SetMenu (EV_DECOR5, 1); // fire m_pDecor->LoadImages (); m_pDecor->SetBuild (true); m_pDecor->EnableFog (false); m_pDecor->BlupiDeselect (); - m_pDecor->NextPhase (0); // refait la carte tout de suite + m_pDecor->NextPhase (0); // rebuild the map immediatly } if (m_phase == EV_PHASE_INFO) @@ -3310,7 +3351,7 @@ CEvent::ChangePhase (Uint32 phase) { if (m_pSound->IsPlayingMusic ()) { - m_pSound->AdaptVolumeMusic (); // adapte le volume + m_pSound->AdaptVolumeMusic (); } else { @@ -3360,20 +3401,24 @@ CEvent::ChangePhase (Uint32 phase) m_phaseAfterMovie = EV_PHASE_LASTWIN; } - WaitMouse (false); // enlève le sablier + WaitMouse (false); return true; } -// Retourne la phase en cours. - +/** + * \brief Return the current phase. + * + * \return the phase number. + */ Uint32 CEvent::GetPhase () { return m_phase; } -// Essaye de lire le CD-Rom. - +/** + * \brief Try to read the CD-Rom. + */ void CEvent::TryInsert () { @@ -3383,19 +3428,22 @@ CEvent::TryInsert () m_tryInsertCount--; } -// Fait démarrer un film si nécessaire. - +/** + * \brief Start a movie if necessary. + * + * \return true if the movie has started. + */ bool CEvent::MovieToStart () { bool movie = false; - if (m_movieToStart[0] != 0) // y a-t-il un film à démarrer ? + if (m_movieToStart[0] != 0) // is movie available? { if (StartMovie (m_movieToStart)) { movie = true; - m_phase = m_phaseAfterMovie; // prochaine phase normale + m_phase = m_phaseAfterMovie; // the next normal phase } else ChangePhase (m_phaseAfterMovie); @@ -3406,8 +3454,12 @@ CEvent::MovieToStart () return movie; } -// Décale le décor. - +/** + * \brief Shift the decor. + * + * \param[in] dx - Delta x. + * \param[in] dy - Delta y. + */ void CEvent::DecorShift (Sint32 dx, Sint32 dy) { @@ -3422,11 +3474,11 @@ CEvent::DecorShift (Sint32 dx, Sint32 dy) coin.y += dy; m_pDecor->SetCoin (coin); - //? m_pDecor->NextPhase(0); // faudra refaire la carte tout de suite } -// Décale le décor lorsque la souris touche un bord. - +/** + * \brief Shift the decor when the mouse is on the sides. + */ void CEvent::DecorAutoShift () { @@ -3442,7 +3494,7 @@ CEvent::DecorAutoShift () if (m_phase == EV_PHASE_PLAY || m_phase == EV_PHASE_BUILD) { - if (m_shiftPhase == 0) // début du shift ? + if (m_shiftPhase == 0) // start shift ? { switch (m_mouseSprite) { @@ -3523,7 +3575,7 @@ CEvent::DecorAutoShift () offset.y = m_shiftOffset.y * (max - m_shiftPhase) * (DIMCELY / 2 / max); m_pDecor->SetShiftOffset (offset); - if (m_shiftPhase == 0) // dernière phase ? + if (m_shiftPhase == 0) // last phase ? { offset.x = 0; offset.y = 0; @@ -3534,8 +3586,11 @@ CEvent::DecorAutoShift () } } -// Indique su un shift est en cours. - +/** + * \brief Notify if a shift is doing. + * + * \return true of the shift is doing. + */ bool CEvent::IsShift () {