From cc2bc2687450d7e048c86859d219652a61ec1709 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Wed, 8 Feb 2017 23:26:59 +0100 Subject: [PATCH] Add more gettext convertions --- event.cpp | 39 ++++++++++++++++++--------------------- event.h | 2 +- text.cpp | 2 +- text.h | 2 +- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/event.cpp b/event.cpp index 547f702..308d9b6 100644 --- a/event.cpp +++ b/event.cpp @@ -1760,12 +1760,9 @@ void AddCheatCode(char *pDst, char *pSrc) // Dessine un texte multi-lignes centré. -void CEvent::DrawTextCenter(int res, int x, int y, int font) +void CEvent::DrawTextCenter(const char *text, int x, int y, int font) { - char text[100]; POINT pos; - - LoadString(res, text, 100); pos.x = x; pos.y = y; ::DrawTextCenter(m_pPixmap, pos, text, font); @@ -1940,27 +1937,27 @@ bool CEvent::DrawButtons() // Dessine la pause. if ( m_bPause ) { - DrawTextCenter(TX_PAUSE, (10+134)/2, 20); + DrawTextCenter(gettext ("Game paused"), (10+134)/2, 20); } else { if ( m_bDemoRec ) // démo en enregistrement ? { - DrawTextCenter(TX_DEMOREC, (10+134)/2, 20, FONTRED); + DrawTextCenter(gettext ("REC"), (10+134)/2, 20, FONTRED); } if ( m_bDemoPlay ) // démo en restitution ? { - DrawTextCenter(TX_DEMOPLAY, (10+134)/2, 20, FONTRED); + DrawTextCenter(gettext ("Demo"), (10+134)/2, 20, FONTRED); } } // Dessine la rose des vents. if ( !m_bPause && !m_bDemoRec && !m_bDemoPlay ) { - DrawTextCenter(TX_DIRECT_N, (10+134)/2, 17); - DrawTextCenter(TX_DIRECT_S, (10+134)/2, 126); - DrawTextCenter(TX_DIRECT_O, 14, 70); - DrawTextCenter(TX_DIRECT_E, 129, 70); + DrawTextCenter(gettext ("N"), (10+134)/2, 17); + DrawTextCenter(gettext ("S"), (10+134)/2, 126); + DrawTextCenter(gettext ("E"), 14, 70); + DrawTextCenter(gettext ("W"), 129, 70); } // Dessine la vitesse. @@ -2079,7 +2076,7 @@ bool CEvent::DrawButtons() { Term* pTerm = m_pDecor->GetTerminated(); - DrawTextCenter(TX_TERM, (10+134)/2, 20); + DrawTextCenter(gettext ("Ending conditions"), (10+134)/2, 20); pos.x = 170+42*2+4; pos.y = 30+12+42*4; @@ -2095,19 +2092,19 @@ bool CEvent::DrawButtons() // Dessine les textes pour les choix des boutons. if ( m_phase == WM_PHASE_BUTTON ) { - DrawTextCenter(TX_BUTTON, (10+134)/2, 20); + DrawTextCenter(gettext ("Available buttons"), (10+134)/2, 20); } // Dessine les textes pour le choix des musiques. if ( m_phase == WM_PHASE_MUSIC ) { - DrawTextCenter(TX_MUSIC, (10+134)/2, 20); + DrawTextCenter(gettext ("Music choice"), (10+134)/2, 20); } // Dessine les textes pour le choix de la région. if ( m_phase == WM_PHASE_REGION ) { - DrawTextCenter(TX_REGION, (10+134)/2, 20); + DrawTextCenter(gettext ("Scenery choice"), (10+134)/2, 20); } // Ajoute "Mission numéro". @@ -2284,11 +2281,11 @@ bool CEvent::DrawButtons() if ( m_phase == WM_PHASE_SETUP || m_phase == WM_PHASE_SETUPp ) { - DrawTextCenter(TX_INFO_SETUP1, 54+40, 80); - DrawTextCenter(TX_INFO_SETUP5, 169+40, 80); - DrawTextCenter(TX_INFO_SETUP2, 284+40, 80); - DrawTextCenter(TX_INFO_SETUP3, 399+40, 80); - DrawTextCenter(TX_INFO_SETUP4, 514+40, 80); + DrawTextCenter(gettext ("Global game\nspeed"), 54+40, 80); + DrawTextCenter(gettext ("Scroll speed\nwith mouse"), 169+40, 80); + DrawTextCenter(gettext ("Sound effect\nvolume"), 284+40, 80); + DrawTextCenter(gettext ("Music\nvolume"), 399+40, 80); + DrawTextCenter(gettext ("Video\nsequences"), 514+40, 80); sprintf(res, "x%d", m_speed); lg = GetTextWidth(res); @@ -2363,7 +2360,7 @@ bool CEvent::DrawButtons() // Affiche le texte lorsqu'il faut insérer le CD-Rom. if ( m_phase == WM_PHASE_INSERT ) { - DrawTextCenter(TX_INSERT, LXIMAGE/2, 20); + DrawTextCenter(gettext ("Insert CD-Rom Planet Blupi and wait a few seconds..."), LXIMAGE/2, 20); } if ( m_phase == WM_PHASE_BUILD ) diff --git a/event.h b/event.h index 97b4b28..561362a 100644 --- a/event.h +++ b/event.h @@ -114,7 +114,7 @@ public: static void PushUserEvent (int code); protected: - void DrawTextCenter(int res, int x, int y, int font=0); + void DrawTextCenter(const char *text, int x, int y, int font=0); bool CreateButtons(); bool EventButtons(const SDL_Event &event, POINT pos); bool MouseOnButton(POINT pos); diff --git a/text.cpp b/text.cpp index bc942f2..28b1da1 100644 --- a/text.cpp +++ b/text.cpp @@ -183,7 +183,7 @@ void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText, // Affiche un texte centré pouvant éventuellement // contenir plusieurs lignes séparées par des '\n'. -void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font) +void DrawTextCenter(CPixmap *pPixmap, POINT pos, const char *pText, int font) { char text[100]; char* pDest; diff --git a/text.h b/text.h index 5e95ada..0091419 100644 --- a/text.h +++ b/text.h @@ -19,7 +19,7 @@ void DrawTextRect(CPixmap *pPixmap, POINT pos, char *pText, int pente, int font=0, int part=-1); extern -void DrawTextCenter(CPixmap *pPixmap, POINT pos, char *pText, int font=0); +void DrawTextCenter(CPixmap *pPixmap, POINT pos, const char *pText, int font=0); extern int GetTextHeight(char *pText, int font=0, int part=-1);