diff options
Diffstat (limited to 'src/event.cxx')
-rw-r--r-- | src/event.cxx | 366 |
1 files changed, 259 insertions, 107 deletions
diff --git a/src/event.cxx b/src/event.cxx index 618c424..05832f3 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1,7 +1,7 @@ /* * This file is part of the planetblupi source code * Copyright (C) 1997, Daniel Roux & EPSITEC SA - * Copyright (C) 2017-2018, Mathieu Schroeter + * Copyright (C) 2017-2019, Mathieu Schroeter * http://epsitec.ch; http://www.blupi.org; http://github.com/blupi-games * * This program is free software: you can redistribute it and/or modify @@ -103,8 +103,8 @@ static Phase table[] = { { EV_PHASE_TESTCD, - "image/init.png", - "image/back-stars.png", + "init.png", + "back-stars.png", CPixmap::Mode::FIX, false, { @@ -116,7 +116,7 @@ static Phase table[] = { EV_PHASE_INTRO1, - "image/intro1.png", + "intro1.png", "", CPixmap::Mode::FIX, false, @@ -129,8 +129,8 @@ static Phase table[] = { EV_PHASE_INIT, - "image/init.png", - "image/back-stars.png", + "init.png", + "back-stars.png", CPixmap::Mode::FIX, false, { @@ -178,9 +178,9 @@ static Phase table[] = { EV_PHASE_HISTORY0, - "image/history0.png", - "image/back-book.png", - CPixmap::Mode::FIX, + "history0.png", + "back-book.png", + CPixmap::Mode::FIX_REVERSABLE, true, { { @@ -203,9 +203,9 @@ static Phase table[] = { EV_PHASE_HISTORY1, - "image/history1.png", - "image/back-book.png", - CPixmap::Mode::FIX, + "history1.png", + "back-book.png", + CPixmap::Mode::FIX_REVERSABLE, true, { { @@ -228,9 +228,9 @@ static Phase table[] = { EV_PHASE_INFO, - "image/info%.3d.png", - "image/back-book.png", - CPixmap::Mode::FIX, + "info%.3d.png", + "back-book.png", + CPixmap::Mode::FIX_REVERSABLE, false, { { @@ -295,9 +295,9 @@ static Phase table[] = { EV_PHASE_PLAY, - "image/play.png", + "play.png", "", - CPixmap::Mode::EXPAND, + CPixmap::Mode::EXPAND_REVERSABLE, false, { { @@ -326,9 +326,9 @@ static Phase table[] = { EV_PHASE_STOP, - "image/stop%.3d.png", - "image/back-book.png", - CPixmap::Mode::FIX, + "stop%.3d.png", + "back-book.png", + CPixmap::Mode::FIX_REVERSABLE, false, { { @@ -375,9 +375,9 @@ static Phase table[] = { EV_PHASE_HELP, - "image/help.png", - "image/back-book.png", - CPixmap::Mode::FIX, + "help.png", + "back-book.png", + CPixmap::Mode::FIX_REVERSABLE, true, { { @@ -418,8 +418,8 @@ static Phase table[] = { EV_PHASE_SETUP, - "image/setup01.png", - "image/back-setup.png", + "setup01.png", + "back-setup.png", CPixmap::Mode::FIX, false, { @@ -497,8 +497,8 @@ static Phase table[] = { EV_PHASE_SETUPp, - "image/setup01.png", - "image/back-setup.png", + "setup01.png", + "back-setup.png", CPixmap::Mode::FIX, false, { @@ -576,9 +576,9 @@ static Phase table[] = { EV_PHASE_READ, - "image/read.png", - "image/back-chest-r.png", - CPixmap::Mode::FIX, + "read.png", + "back-chest-r.png", + CPixmap::Mode::FIX_REVERSABLE, false, { { @@ -655,9 +655,9 @@ static Phase table[] = { EV_PHASE_WRITE, - "image/write.png", - "image/back-chest-w.png", - CPixmap::Mode::FIX, + "write.png", + "back-chest-w.png", + CPixmap::Mode::FIX_REVERSABLE, false, { { @@ -734,9 +734,9 @@ static Phase table[] = { EV_PHASE_WRITEp, - "image/write.png", - "image/back-chest-w.png", - CPixmap::Mode::FIX, + "write.png", + "back-chest-w.png", + CPixmap::Mode::FIX_REVERSABLE, false, { { @@ -813,8 +813,8 @@ static Phase table[] = { EV_PHASE_LOST, - "image/lost.png", - "image/back-lost.png", + "lost.png", + "back-lost.png", CPixmap::Mode::FIX, true, { @@ -832,8 +832,8 @@ static Phase table[] = { EV_PHASE_WIN, - "image/win.png", - "image/back-win.png", + "win.png", + "back-win.png", CPixmap::Mode::FIX, true, { @@ -851,7 +851,7 @@ static Phase table[] = { EV_PHASE_LASTWIN, - "image/last%.3d.png", + "last%.3d.png", "", CPixmap::Mode::FIX, true, @@ -870,9 +870,9 @@ static Phase table[] = { EV_PHASE_BUILD, - "image/build.png", + "build.png", "", - CPixmap::Mode::EXPAND, + CPixmap::Mode::EXPAND_REVERSABLE, true, { { @@ -987,9 +987,9 @@ static Phase table[] = { EV_PHASE_BUTTON, - "image/button.png", - "image/back-build.png", - CPixmap::Mode::FIX, + "button.png", + "back-build.png", + CPixmap::Mode::FIX_REVERSABLE, true, { { @@ -1209,9 +1209,9 @@ static Phase table[] = { EV_PHASE_TERM, - "image/term.png", - "image/back-build.png", - CPixmap::Mode::FIX, + "term.png", + "back-build.png", + CPixmap::Mode::FIX_REVERSABLE, true, { { @@ -1300,9 +1300,9 @@ static Phase table[] = { EV_PHASE_MUSIC, - "image/music.png", - "image/back-build.png", - CPixmap::Mode::FIX, + "music.png", + "back-build.png", + CPixmap::Mode::FIX_REVERSABLE, true, { { @@ -1385,9 +1385,9 @@ static Phase table[] = { EV_PHASE_REGION, - "image/region.png", - "image/back-build.png", - CPixmap::Mode::FIX, + "region.png", + "back-build.png", + CPixmap::Mode::FIX_REVERSABLE, true, { { @@ -1428,7 +1428,7 @@ static Phase table[] = { EV_PHASE_PLAYMOVIE, - "image/movie.png", + "movie.png", "", CPixmap::Mode::FIX, false, @@ -1441,7 +1441,7 @@ static Phase table[] = { EV_PHASE_WINMOVIE, - "image/movie.png", + "movie.png", "", CPixmap::Mode::FIX, false, @@ -1454,7 +1454,7 @@ static Phase table[] = { EV_PHASE_H0MOVIE, - "image/movie.png", + "movie.png", "", CPixmap::Mode::FIX, false, @@ -1467,7 +1467,7 @@ static Phase table[] = { EV_PHASE_H1MOVIE, - "image/movie.png", + "movie.png", "", CPixmap::Mode::FIX, false, @@ -1480,7 +1480,7 @@ static Phase table[] = { EV_PHASE_H2MOVIE, - "image/movie.png", + "movie.png", "", CPixmap::Mode::FIX, false, @@ -1493,8 +1493,8 @@ static Phase table[] = { EV_PHASE_BYE, - "image/bye.png", - "image/back-bye.png", + "bye.png", + "back-bye.png", CPixmap::Mode::FIX, false, { @@ -1506,7 +1506,7 @@ static Phase table[] = { EV_PHASE_INSERT, - "image/insert.png", + "insert.png", "", CPixmap::Mode::FIX, false, @@ -1525,8 +1525,8 @@ static Phase table[] = { EV_PHASE_SETTINGS, - "image/setup00.png", - "image/back-setup.png", + "setup00.png", + "back-setup.png", CPixmap::Mode::FIX, false, { @@ -1642,6 +1642,7 @@ CEvent::CEvent () m_bHelp = false; m_bAllMissions = false; m_scrollSpeed = 1; + m_scrollSpeedPrev = -1; m_bPause = false; m_bShift = false; m_shiftPhase = 0; @@ -1684,6 +1685,9 @@ CEvent::CEvent () m_Languages.push_back (Language::de); m_Languages.push_back (Language::it); m_Languages.push_back (Language::pl); + m_Languages.push_back (Language::tr); + m_Languages.push_back (Language::pt); + m_Languages.push_back (Language::he); this->m_LangStart = GetLocale (); @@ -1697,6 +1701,12 @@ CEvent::CEvent () m_Lang = m_Languages.begin () + 4; else if (this->m_LangStart == "pl") m_Lang = m_Languages.begin () + 5; + else if (this->m_LangStart == "tr") + m_Lang = m_Languages.begin () + 6; + else if (this->m_LangStart == "pt") + m_Lang = m_Languages.begin () + 7; + else if (this->m_LangStart == "he") + m_Lang = m_Languages.begin () + 8; else m_Lang = m_Languages.begin (); @@ -2019,10 +2029,20 @@ CEvent::CreateButtons (Sint32 phase) pos.y = table[m_index].buttons[i].y; message = table[m_index].buttons[i].message; + auto isRightReading = + ((message == EV_PHASE_INIT || message == EV_PHASE_PLAY || + message == EV_SETUP_EXIT) || + (phase != EV_PHASE_SETTINGS && phase != EV_PHASE_SETUP && + phase != EV_PHASE_SETUPp)) && + IsRightReading (); + + if (isRightReading) + pos.x = LXIMAGE () - pos.x - DIMBUTTONX; + if ( phase != EV_PHASE_PLAY && phase != EV_PHASE_BUILD && phase != EV_PHASE_INIT) - pos.x += LXOFFSET (); + pos.x = isRightReading ? pos.x - LXOFFSET () : pos.x + LXOFFSET (); if (m_bPrivate) { @@ -2030,11 +2050,15 @@ CEvent::CreateButtons (Sint32 phase) { pos.x = 117 + LXOFFSET (); pos.y = 115; + if (isRightReading) + pos.x = LXIMAGE () - pos.x - DIMBUTTONX; } if (message == EV_PHASE_SKILL2) { pos.x = 117 + LXOFFSET (); pos.y = 115 + 42; + if (isRightReading) + pos.x = LXIMAGE () - pos.x - DIMBUTTONX; } } @@ -2042,7 +2066,7 @@ CEvent::CreateButtons (Sint32 phase) m_pPixmap, m_pSound, pos, table[m_index].buttons[i].type, table[m_index].buttons[i].iconMenu + 1, table[m_index].buttons[i].iconMenu[0], table[m_index].buttons[i].toolTips, - m_pDecor->GetRegion (), message); + m_pDecor->GetRegion (), message, isRightReading); i++; } @@ -2124,6 +2148,8 @@ CEvent::DrawButtons () rect.right = pos.x + 300; rect.top = pos.y; rect.bottom = pos.y + DIMLITTLEY; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, text, FONTLITTLE); } } @@ -2133,7 +2159,8 @@ CEvent::DrawButtons () snprintf ( res, sizeof (res), "%s %u.%u.%u%s", gettext ("Version"), PB_VERSION_MAJOR, PB_VERSION_MINOR, PB_VERSION_PATCH, PB_VERSION_EXTRA); - pos.x = LXIMAGE () - GetTextWidth (res, FONTLITTLE) - 4; + pos.x = IsRightReading () ? 4 + GetTextWidth (res, FONTLITTLE) + : LXIMAGE () - GetTextWidth (res, FONTLITTLE) - 4; pos.y = 465; DrawText (m_pPixmap, pos, res, FONTLITTLE); @@ -2145,6 +2172,8 @@ CEvent::DrawButtons () res, sizeof (res), gettext ("New version available for download on www.blupi.org (v%s)"), this->m_updateVersion.c_str ()); + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, res, FONTLITTLE); } } @@ -2270,28 +2299,30 @@ CEvent::DrawButtons () } m_menu.Draw (); + auto offset = IsRightReading () ? POSDRAWX + DIMDRAWX : 0; + // Dessine la rose des vents. if (!m_bPause && !m_bDemoPlay) { - DrawTextCenter (gettext ("N"), (10 + 134) / 2, 17); - DrawTextCenter (gettext ("S"), (10 + 134) / 2, 126); - DrawTextCenter (gettext ("W"), 14, 70); - DrawTextCenter (gettext ("E"), 129, 70); + DrawTextCenter (gettext ("N"), (10 + 134) / 2 + offset, 17); + DrawTextCenter (gettext ("S"), (10 + 134) / 2 + offset, 126); + DrawTextCenter (gettext ("W"), 14 + offset, 70); + DrawTextCenter (gettext ("E"), 129 + offset, 70); } // Dessine la pause. if (m_bPause) - DrawTextCenter (gettext ("Game paused"), (10 + 134) / 2, 20); + DrawTextCenter (gettext ("Game paused"), (10 + 134) / 2 + offset, 20); else { if (m_bDemoRec) // recording demo ? - DrawTextCenter (gettext ("REC"), (10 + 38) / 2, 20, FONTRED); + DrawTextCenter (gettext ("REC"), (10 + 38) / 2 + offset, 20, FONTRED); if (m_bDemoPlay) // playing demo ? - DrawTextCenter (gettext ("Demo"), (10 + 134) / 2, 20, FONTRED); + DrawTextCenter (gettext ("Demo"), (10 + 134) / 2 + offset, 20, FONTRED); } // Dessine la vitesse. - pos.x = 64; + pos.x = IsRightReading () ? LXIMAGE () - 64 : 64; pos.y = LYIMAGE () - 15; rect.left = pos.x; rect.right = pos.x + 20; @@ -2325,10 +2356,14 @@ CEvent::DrawButtons () rect.bottom = POSDRAWY; m_pPixmap->DrawPart (-1, CHBACK, pos, rect); - pos.x = POSDRAWX + 20; + pos.x = POSDRAWX_ + 20; pos.y = POSDRAWY + 4; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawTextRect (m_pPixmap, pos, m_libelle, 0, FONTLITTLE, 1); - pos.x = POSDRAWX + DIMDRAWX / 2 + 20; + pos.x = POSDRAWX_ + DIMDRAWX / 2 + 20; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawTextRect (m_pPixmap, pos, m_libelle, 0, FONTLITTLE, 2); pos.x = POSDRAWX + DIMDRAWX / 2 - DIMBUTTONX / 2; @@ -2341,6 +2376,8 @@ CEvent::DrawButtons () { m_posHelpButton.x = POSDRAWX + DIMDRAWX - DIMBUTTONX - 2; m_posHelpButton.y = lg - DIMBUTTONY - 2; + if (IsRightReading ()) + m_posHelpButton.x = POSDRAWX + 2; m_pPixmap->DrawIcon ( -1, CHBUTTON, m_bHiliHelpButton ? 2 : 0, m_posHelpButton); if (m_bInfoHelp) @@ -2354,6 +2391,8 @@ CEvent::DrawButtons () { pos.x = POSDRAWX + DIMDRAWX / 2 - DIMBUTTONX / 2; pos.y = -12; + if (IsRightReading ()) + m_posHelpButton.x = POSDRAWX + 2; m_pPixmap->DrawIcon (-1, CHBUTTON, m_bHiliInfoButton ? 75 : 74, pos); } m_posInfoButton = pos; @@ -2371,6 +2410,8 @@ CEvent::DrawButtons () pos.x = 420 + LXOFFSET (); pos.y = 8; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, res); for (i = 0; i < 10; i++) @@ -2382,9 +2423,13 @@ CEvent::DrawButtons () lg = GetTextWidth (text); pos.x = (420 + 460) / 2 - lg / 2 + LXOFFSET (); pos.y = 30 + 12 + 42 * i; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, text, FONTSLIM); pos.x = 420 + 50 + LXOFFSET (); + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; if (world >= 0) { @@ -2413,14 +2458,18 @@ CEvent::DrawButtons () { Term * pTerm = m_pDecor->GetTerminated (); - DrawTextCenter ( - gettext ("Ending conditions"), (10 + 134) / 2 + LXOFFSET (), 20); + auto x = (10 + 134) / 2 + LXOFFSET (); + if (IsRightReading ()) + x = LXIMAGE () - x; + DrawTextCenter (gettext ("Ending conditions"), x, 20); pos.x = 170 + 42 * 2 + 4 + LXOFFSET (); pos.y = 30 + 12 + 42 * 4; snprintf ( text, sizeof (text), gettext ("Lost if less than %d Blupi"), pTerm->nbMinBlupi); + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, text); pos.x = 170 + 42 * 2 + 4 + LXOFFSET (); @@ -2428,22 +2477,37 @@ CEvent::DrawButtons () snprintf ( text, sizeof (text), gettext ("Impossible to win if less than %d Blupi"), pTerm->nbMaxBlupi); + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, text); } // Dessine les textes pour les choix des boutons. if (m_phase == EV_PHASE_BUTTON) - DrawTextCenter ( - gettext ("Available buttons"), (10 + 134) / 2 + LXOFFSET (), 20); + { + auto x = (10 + 134) / 2 + LXOFFSET (); + if (IsRightReading ()) + x = LXIMAGE () - x; + DrawTextCenter (gettext ("Available buttons"), x, 20); + } // Dessine les textes pour le choix des musiques. if (m_phase == EV_PHASE_MUSIC) - DrawTextCenter (gettext ("Music choice"), (10 + 134) / 2 + LXOFFSET (), 20); + { + auto x = (10 + 134) / 2 + LXOFFSET (); + if (IsRightReading ()) + x = LXIMAGE () - x; + DrawTextCenter (gettext ("Music choice"), x, 20); + } // Dessine les textes pour le choix de la région. if (m_phase == EV_PHASE_REGION) - DrawTextCenter ( - gettext ("Scenery choice"), (10 + 134) / 2 + LXOFFSET (), 20); + { + auto x = (10 + 134) / 2 + LXOFFSET (); + if (IsRightReading ()) + x = LXIMAGE () - x; + DrawTextCenter (gettext ("Scenery choice"), x, 20); + } // Ajoute "Mission numéro". if (m_phase == EV_PHASE_INFO) @@ -2465,6 +2529,8 @@ CEvent::DrawButtons () pos.x -= 100; if (m_bPrivate) pos.y += 14; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, res, FONTSLIM); } @@ -2481,6 +2547,8 @@ CEvent::DrawButtons () pos.x -= 100; if (m_bPrivate) pos.y += 14; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, text, FONTRED); } @@ -2497,6 +2565,8 @@ CEvent::DrawButtons () pos.x -= 100; if (m_bPrivate) pos.y += 14; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, text, FONTRED); } @@ -2513,6 +2583,7 @@ CEvent::DrawButtons () world = m_private; lg = GetBignumWidth (world + 1); + lg = IsRightReading () ? -lg : lg; pos.x = (140 + 270) / 2 - lg / 2 + LXOFFSET (); pos.y = 100; if (m_bSchool) @@ -2521,6 +2592,8 @@ CEvent::DrawButtons () pos.x -= 135; if (m_bPrivate) pos.y = 115; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawBignum (m_pPixmap, pos, world + 1); } @@ -2529,6 +2602,7 @@ CEvent::DrawButtons () { if (!m_bSchool) { + std::string text; if (m_pDecor->GetSkill () == 0) { if (m_bPrivate) @@ -2542,10 +2616,9 @@ CEvent::DrawButtons () pos.y = 230 + 13; } pos.x += LXOFFSET (); - DrawText (m_pPixmap, pos, gettext ("Easy"), FONTSLIM); + text = gettext ("Easy"); } - - if (m_pDecor->GetSkill () == 1) + else if (m_pDecor->GetSkill () == 1) { if (m_bPrivate) { @@ -2558,8 +2631,12 @@ CEvent::DrawButtons () pos.y = 230 + 42 + 13; } pos.x += LXOFFSET (); - DrawText (m_pPixmap, pos, gettext ("Difficult"), FONTSLIM); + text = gettext ("Difficult"); } + + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; + DrawText (m_pPixmap, pos, text.c_str (), FONTSLIM); } } @@ -2583,6 +2660,8 @@ CEvent::DrawButtons () else pente = 19; pos.x += LXOFFSET (); + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawTextRect (m_pPixmap, pos, m_libelle, pente, FONTSLIM); } @@ -2599,6 +2678,8 @@ CEvent::DrawButtons () pos.x = 60 + LXOFFSET (); pos.y = 443; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, list[GetWorld () % 5]); } @@ -2613,6 +2694,8 @@ CEvent::DrawButtons () pos.x = 60 + LXOFFSET (); pos.y = 443; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, list[GetWorld () % 5]); } @@ -2630,6 +2713,8 @@ CEvent::DrawButtons () pos.x = 60 + LXOFFSET (); pos.y = 443; + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; DrawText (m_pPixmap, pos, text); } @@ -2646,18 +2731,21 @@ CEvent::DrawButtons () snprintf (res, sizeof (res), "x%d", m_speed); lg = GetTextWidth (res); + lg = IsRightReading () ? -lg : lg; pos.x = (54 + 40) - lg / 2 + LXOFFSET (); pos.y = 330 - 20; DrawText (m_pPixmap, pos, res); snprintf (res, sizeof (res), "%d", m_pSound->GetAudioVolume ()); lg = GetTextWidth (res); + lg = IsRightReading () ? -lg : lg; pos.x = (284 + 40) - lg / 2 + LXOFFSET (); pos.y = 330 - 20; DrawText (m_pPixmap, pos, res); snprintf (res, sizeof (res), "%d", m_pSound->GetMidiVolume ()); lg = GetTextWidth (res); + lg = IsRightReading () ? -lg : lg; pos.x = (399 + 40) - lg / 2 + LXOFFSET (); pos.y = 330 - 20; DrawText (m_pPixmap, pos, res); @@ -2666,6 +2754,7 @@ CEvent::DrawButtons () if (m_pMovie->GetEnable () && m_bMovie) text = gettext ("Yes"); lg = GetTextWidth (text); + lg = IsRightReading () ? -lg : lg; pos.x = (514 + 40) - lg / 2 + LXOFFSET (); pos.y = 330 - 20; DrawText (m_pPixmap, pos, text); @@ -2675,6 +2764,7 @@ CEvent::DrawButtons () else snprintf (res, sizeof (res), "%d", m_scrollSpeed); lg = GetTextWidth (res); + lg = IsRightReading () ? -lg : lg; pos.x = (169 + 40) - lg / 2 + LXOFFSET (); pos.y = 330 - 20; DrawText (m_pPixmap, pos, res); @@ -2710,8 +2800,15 @@ CEvent::DrawButtons () lang = "Italiano"; else if (locale == "pl") lang = "Polski"; + else if (locale == "tr") + lang = "Türkçe"; + else if (locale == "pt") + lang = "Português"; + else if (locale == "he") + lang = "עברית"; lg = GetTextWidth (lang.c_str ()); + lg = IsRightReading () ? -lg : lg; pos.x = (54 + 40) - lg / 2 + LXOFFSET (); pos.y = 330 - 20; DrawText (m_pPixmap, pos, lang.c_str ()); @@ -2719,6 +2816,7 @@ CEvent::DrawButtons () const char * text = g_bFullScreen ? gettext ("Fullscreen") : gettext ("Windowed"); lg = GetTextWidth (text); + lg = IsRightReading () ? -lg : lg; pos.x = (169 + 40) - lg / 2 + LXOFFSET (); pos.y = 330 - 20; DrawText (m_pPixmap, pos, text); @@ -2731,12 +2829,14 @@ CEvent::DrawButtons () g_zoom == 2 ? gettext ("Legacy") : gettext ("Desktop")); lg = GetTextWidth (res); + lg = IsRightReading () ? -lg : lg; pos.x = (284 + 40) - lg / 2 + LXOFFSET (); pos.y = 330 - 20; DrawText (m_pPixmap, pos, res); text = (g_restoreMidi && mid) || !ogg ? gettext ("Midi") : gettext ("Ogg"); lg = GetTextWidth (text); + lg = IsRightReading () ? -lg : lg; pos.x = (399 + 40) - lg / 2 + LXOFFSET (); pos.y = 330 - 20; DrawText (m_pPixmap, pos, text); @@ -2746,6 +2846,7 @@ CEvent::DrawButtons () ? (g_renderQuality ? gettext ("Anti-aliasing") : gettext ("Aliasing")) : gettext ("Not available"); lg = GetTextWidth (text); + lg = IsRightReading () ? -lg : lg; pos.x = (514 + 40) - lg / 2 + LXOFFSET (); pos.y = 330 - 20; DrawText (m_pPixmap, pos, text); @@ -2758,6 +2859,7 @@ CEvent::DrawButtons () text = gettext ("You have played Planet Blupi."); lg = GetTextWidth (text); + lg = IsRightReading () ? -lg : lg; pos.x = LXIMAGE () / 2 - lg / 2; pos.y = 20; DrawText (m_pPixmap, pos, text); @@ -2765,6 +2867,7 @@ CEvent::DrawButtons () text = gettext ("We hope you have had as much fun playing the game as we " "had making it !"); lg = GetTextWidth (text); + lg = IsRightReading () ? -lg : lg; pos.x = LXIMAGE () / 2 - lg / 2; pos.y = 40; DrawText (m_pPixmap, pos, text); @@ -2790,6 +2893,8 @@ CEvent::DrawButtons () for (size_t i = 0; i < countof (libs); ++i) { pos.x = 30 + LXOFFSET (); + if (IsRightReading ()) + pos.x = LXIMAGE () - pos.x; pos.y = 120 + i * 20; DrawText (m_pPixmap, pos, libs[i].c_str ()); } @@ -2797,12 +2902,14 @@ CEvent::DrawButtons () text = gettext ("This game is an original creation of Epsitec SA, CH-1400 " "Yverdon-les-Bains"); lg = GetTextWidth (text); + lg = IsRightReading () ? -lg : lg; pos.x = LXIMAGE () / 2 - lg / 2; pos.y = 430; DrawText (m_pPixmap, pos, text); text = gettext ("http://www.blupi.org info@blupi.org"); lg = GetTextWidth (text); + lg = IsRightReading () ? -lg : lg; pos.x = LXIMAGE () / 2 - lg / 2; pos.y = 450; DrawText (m_pPixmap, pos, text); @@ -2969,11 +3076,15 @@ bool CEvent::EventButtons (const SDL_Event & event, Point pos) { Sint32 lg; + Point _pos = pos; // Cherche le tool tips à utiliser pour la souris. m_textToolTips[0] = 0; m_posToolTips.x = -1; + if (IsRightReading ()) + _pos.x = LXIMAGE () - _pos.x; + if (m_phase == EV_PHASE_PLAY) { auto progress = [&](CJauge & prog, const char * text) -> bool { @@ -2987,6 +3098,7 @@ CEvent::EventButtons (const SDL_Event & event, Point pos) { snprintf (m_textToolTips, sizeof (m_textToolTips), "%s", text); lg = GetTextWidth (m_textToolTips); + lg = IsRightReading () ? -lg : lg; test.x += (DIMJAUGEX - lg) / 2; test.y += 4; m_posToolTips = test; @@ -3012,10 +3124,12 @@ CEvent::EventButtons (const SDL_Event & event, Point pos) { snprintf (m_textToolTips, sizeof (m_textToolTips), "%s", text); lg = GetTextWidth (m_textToolTips); - pos.x += 10; + pos.x += IsRightReading () ? 0 : 10; pos.y += 20; - if (pos.x > LXIMAGE () - lg) + if (pos.x > LXIMAGE () + (IsRightReading () ? 0 : -lg)) pos.x = LXIMAGE () - lg; + if (pos.x < 0) + pos.x = 0; if (pos.y > LYIMAGE () - 14) pos.y = LYIMAGE () - 14; m_posToolTips = pos; @@ -3277,13 +3391,13 @@ CEvent::LoadBackground () switch (id) { case 0: - backWideName = "image/back-disco.png"; + backWideName = "back-disco.png"; break; case 1: - backWideName = "image/back-stars.png"; + backWideName = "back-stars.png"; break; case 2: - backWideName = "image/back-win.png"; + backWideName = "back-win.png"; break; } } @@ -4076,6 +4190,12 @@ CEvent::GetStartLanguage () return Language::it; if (this->m_LangStart == "pl") return Language::pl; + if (this->m_LangStart == "tr") + return Language::tr; + if (this->m_LangStart == "pt") + return Language::pt; + if (this->m_LangStart == "he") + return Language::he; return Language::en; } @@ -4116,6 +4236,15 @@ CEvent::SetLanguage (Language lang) case Language::pl: slang = "pl"; break; + case Language::tr: + slang = "tr"; + break; + case Language::pt: + slang = "pt"; + break; + case Language::he: + slang = "he"; + break; } snprintf (env, sizeof (env), "LANGUAGE=%s", slang); @@ -5095,9 +5224,11 @@ CEvent::DemoRecStart () InitRandom (); m_pDecor->SetTime (0); - m_speed = 1; - this->m_scrollSpeedPrev = this->m_scrollSpeed; - this->m_scrollSpeed = 3; + m_speed = 1; + + if (this->m_scrollSpeedPrev == -1) + this->m_scrollSpeedPrev = this->m_scrollSpeed; + this->m_scrollSpeed = 3; m_bStartRecording = true; } @@ -5138,10 +5269,15 @@ CEvent::DemoRecStop () } m_pDemoSDLBuffer.clear (); - m_bDemoRec = false; - m_demoTime = 0; - m_bStartRecording = false; - this->m_scrollSpeed = this->m_scrollSpeedPrev; + m_bDemoRec = false; + m_demoTime = 0; + m_bStartRecording = false; + + if (this->m_scrollSpeedPrev >= 0) + { + this->m_scrollSpeed = this->m_scrollSpeedPrev; + this->m_scrollSpeedPrev = -1; + } } // Début de la reproduction d'une démo. @@ -5221,8 +5357,9 @@ CEvent::DemoPlayStart (const std::string * demoFile) return false; } - this->m_scrollSpeedPrev = m_scrollSpeed; - this->m_scrollSpeed = 3; + if (this->m_scrollSpeedPrev == -1) + this->m_scrollSpeedPrev = this->m_scrollSpeed; + this->m_scrollSpeed = 3; ChangePhase (EV_PHASE_PLAY); InitRandom (); @@ -5245,10 +5382,15 @@ CEvent::DemoPlayStop () m_pDemoSDLBuffer.clear (); - m_bDemoPlay = false; - m_bDemoRec = false; - m_demoTime = 0; - this->m_scrollSpeed = this->m_scrollSpeedPrev; + m_bDemoPlay = false; + m_bDemoRec = false; + m_demoTime = 0; + + if (this->m_scrollSpeedPrev >= 0) + { + this->m_scrollSpeed = this->m_scrollSpeedPrev; + this->m_scrollSpeedPrev = -1; + } ChangePhase (EV_PHASE_INIT); } @@ -5388,6 +5530,10 @@ CEvent::DemoStep () message = m_pDemoBuffer[m_demoIndex].message; wParam = m_pDemoBuffer[m_demoIndex].wParam; lParam = m_pDemoBuffer[m_demoIndex].lParam; + + if (IsRightReading ()) + lParam = + (lParam & 0xFFFF0000) | ((lParam & 0xFFFF) - POSDRAWX_ + POSDRAWX); } else // New SDL events format { @@ -5400,12 +5546,18 @@ CEvent::DemoStep () { event.motion.x = m_pDemoSDLBuffer[m_demoIndex].x; event.motion.y = m_pDemoSDLBuffer[m_demoIndex].y; + + if (IsRightReading ()) + event.motion.x -= POSDRAWX_ + POSDRAWX; } else if (event.type != SDL_KEYUP && event.type != SDL_KEYDOWN) { event.button.button = m_pDemoSDLBuffer[m_demoIndex].button; event.button.x = m_pDemoSDLBuffer[m_demoIndex].x; event.button.y = m_pDemoSDLBuffer[m_demoIndex].y; + + if (IsRightReading ()) + event.button.x -= POSDRAWX_ + POSDRAWX; } } |