1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Replace a lot of string resources by gettext calls

This commit is contained in:
Mathieu Schroeter 2017-02-07 19:42:34 +01:00
parent fd92969e05
commit fc51d054e6
6 changed files with 324 additions and 238 deletions

413
decor.cpp
View File

@ -3,6 +3,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <unordered_map>
#include "gettext.h"
#include "def.h" #include "def.h"
#include "resource.h" #include "resource.h"
#include "pixmap.h" #include "pixmap.h"
@ -1516,13 +1518,12 @@ void CDecor::Build(RECT clip, POINT posMouse)
{ {
if ( m_textCount == 0 ) if ( m_textCount == 0 )
{ {
n = GetResHili(posMouse); const auto text = GetResHili(posMouse);
if ( n != -1 ) if (text)
{ {
LoadString(n, m_text, 50);
posMouse.x += 10; posMouse.x += 10;
posMouse.y += 20; posMouse.y += 20;
DrawText(m_pPixmap, posMouse, m_text); DrawText(m_pPixmap, posMouse, text);
} }
} }
else else
@ -3009,188 +3010,274 @@ void CDecor::CelHiliRepeat(int list)
// Retourne l'identificateur du texte correspondant à // Retourne l'identificateur du texte correspondant à
// l'objet ou au blupi visé par la souris. // l'objet ou au blupi visé par la souris.
int CDecor::GetResHili(POINT posMouse) const char *CDecor::GetResHili(POINT posMouse)
{ {
int res, icon; int icon;
const char *res = nullptr;
// Les valeurs négatives correspondent aux objets placés // Les valeurs `corner == true` correspondent aux objets placés
// au coin inf/droite de la cellule. // au coin inf/droit de la cellule.
static short table_object[] = struct object_t
{ {
131, // nb bool corner;
0,0,0,0,0,0, const char *text;
TX_OBJ_ARBRE, TX_OBJ_ARBRE, TX_OBJ_ARBRE,
TX_OBJ_ARBRE, TX_OBJ_ARBRE, TX_OBJ_ARBRE,
TX_OBJ_FUSEE,0,
TX_OBJ_METAL,
0, -TX_OBJ_ARMURE,
0,0,0,
TX_OBJ_MUR, TX_OBJ_MUR, TX_OBJ_MUR, TX_OBJ_MUR,
TX_OBJ_MUR, TX_OBJ_MUR, TX_OBJ_MUR,
TX_OBJ_TOUR,
TX_OBJ_LABO, TX_OBJ_LABO,
TX_OBJ_ARBREb, TX_OBJ_ARBREb, TX_OBJ_ARBREb,
TX_OBJ_ARBREb, TX_OBJ_ARBREb, TX_OBJ_ARBREb,
-TX_OBJ_PLANCHE,
TX_OBJ_ROC, TX_OBJ_ROC, TX_OBJ_ROC, TX_OBJ_ROC,
TX_OBJ_ROC, TX_OBJ_ROC, TX_OBJ_ROC,
-TX_OBJ_PIERRE,
TX_OBJ_FEU, TX_OBJ_FEU, TX_OBJ_FEU, TX_OBJ_FEU,
TX_OBJ_FEU, TX_OBJ_FEU, TX_OBJ_FEU, TX_OBJ_FEU,
0,0,0,0,
-TX_OBJ_TOMATE, -TX_OBJ_TOMATE, -TX_OBJ_TOMATE, -TX_OBJ_TOMATE,
TX_OBJ_CABANE, TX_OBJ_CABANE,
-TX_OBJ_OEUF, TX_OBJ_OEUF,
TX_OBJ_PALISSADE, TX_OBJ_PALISSADE, TX_OBJ_PALISSADE, TX_OBJ_PALISSADE,
TX_OBJ_PALISSADE, TX_OBJ_PALISSADE, TX_OBJ_PALISSADE,
TX_OBJ_PONT, TX_OBJ_PONT,
0,0,0,0,0,0,
-TX_OBJ_POTION,
TX_OBJ_FLEUR1, -TX_OBJ_BOUQUET1,
TX_OBJ_FLEUR2, -TX_OBJ_BOUQUET2,
-TX_OBJ_DYNAMITE, -TX_OBJ_DYNAMITE, -TX_OBJ_DYNAMITE,
0,0,0,0,
-TX_OBJ_POISON,
-TX_OBJ_PIEGE,
TX_OBJ_FLEUR3, -TX_OBJ_BOUQUET3,
-TX_OBJ_ENNEMIp, -TX_OBJ_ENNEMIp, -TX_OBJ_ENNEMIp,
TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI,
TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI,
TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI, TX_OBJ_ENNEMI,
TX_OBJ_ENNEMI, TX_OBJ_ENNEMI,
TX_OBJ_MAISON,
-TX_OBJ_ENNEMIp,
TX_OBJ_ENNEMI, TX_OBJ_ENNEMI,
-TX_OBJ_BATEAU,
-TX_OBJ_JEEP,
TX_OBJ_USINE, TX_OBJ_USINE,
TX_OBJ_MINEFER, TX_OBJ_MINEFER,
-TX_OBJ_FER,
TX_OBJ_DRAPEAU,
-TX_OBJ_MINE,
TX_OBJ_MINEFER,
-TX_OBJ_MINE,
TX_OBJ_ENNEMI, TX_OBJ_ENNEMI,
-TX_OBJ_ENNEMIp,
}; };
static short table_floor[] = static const std::unordered_map<size_t, object_t> tableObject = {
{ { 6, { false, gettext ("Tree") } },
85, // nb { 7, { false, gettext ("Tree") } },
0, { 8, { false, gettext ("Tree") } },
TX_OBJ_HERBE, { 9, { false, gettext ("Tree") } },
TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, { 10, { false, gettext ("Tree") } },
TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, { 11, { false, gettext ("Tree") } },
TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, TX_OBJ_RIVE, { 12, { false, gettext ("Enemy rocket") } },
TX_OBJ_EAU, { 14, { false, gettext ("Platinium") } },
TX_OBJ_DALLE, TX_OBJ_DALLE, { 16, { true, gettext ("Armour") } },
TX_OBJ_HACHURE, { 20, { false, gettext ("Wall") } },
TX_OBJ_GLACE, { 21, { false, gettext ("Wall") } },
TX_OBJ_MOUSSEb, { 22, { false, gettext ("Wall") } },
TX_OBJ_MOUSSE, { 23, { false, gettext ("Wall") } },
TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, { 24, { false, gettext ("Wall") } },
TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, { 25, { false, gettext ("Wall") } },
TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, { 26, { false, gettext ("Wall") } },
TX_OBJ_TERRE, { 27, { false, gettext ("Protection tower") } },
TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, { 28, { false, gettext ("Laboratory") } },
TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, { 29, { false, gettext ("Laboratory") } },
TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, TX_OBJ_MIXTE, { 30, { false, gettext ("Tree trunks") } },
TX_OBJ_TERRE, TX_OBJ_TERRE, TX_OBJ_TERRE, { 31, { false, gettext ("Tree trunks") } },
TX_OBJ_HERBE, TX_OBJ_HERBE, TX_OBJ_HERBE, { 32, { false, gettext ("Tree trunks") } },
TX_OBJ_COUVEUSE, TX_OBJ_COUVEUSE, TX_OBJ_COUVEUSE, { 33, { false, gettext ("Tree trunks") } },
TX_OBJ_COUVEUSE, TX_OBJ_COUVEUSE, { 34, { false, gettext ("Tree trunks") } },
TX_OBJ_HERBE, { 35, { false, gettext ("Tree trunks") } },
TX_OBJ_MOUSSE, { 36, { true, gettext ("Planks") } },
TX_OBJ_PONT, TX_OBJ_PONT, TX_OBJ_PONT, { 37, { false, gettext ("Rocks") } },
TX_OBJ_PONT, TX_OBJ_PONT, TX_OBJ_PONT, { 38, { false, gettext ("Rocks") } },
TX_OBJ_ENNEMIs, TX_OBJ_MIXTE, TX_OBJ_ENNEMIs, { 39, { false, gettext ("Rocks") } },
TX_OBJ_EAU, TX_OBJ_EAU, TX_OBJ_EAU, { 40, { false, gettext ("Rocks") } },
TX_OBJ_TERRE, { 41, { false, gettext ("Rocks") } },
0,0,0,0, { 42, { false, gettext ("Rocks") } },
0,0, { 43, { false, gettext ("Rocks") } },
TX_OBJ_MIXTE, TX_OBJ_MIXTE, { 44, { true, gettext ("Stones") } },
TX_OBJ_TELEPORTE, TX_OBJ_TELEPORTE, TX_OBJ_TELEPORTE, { 45, { false, gettext ("Fire") } },
TX_OBJ_TELEPORTE, TX_OBJ_TELEPORTE, { 46, { false, gettext ("Fire") } },
{ 47, { false, gettext ("Fire") } },
{ 48, { false, gettext ("Fire") } },
{ 49, { false, gettext ("Fire") } },
{ 50, { false, gettext ("Fire") } },
{ 51, { false, gettext ("Fire") } },
{ 52, { false, gettext ("Fire") } },
{ 57, { true, gettext ("Tomatoes") } },
{ 58, { true, gettext ("Tomatoes") } },
{ 59, { true, gettext ("Tomatoes") } },
{ 60, { true, gettext ("Tomatoes") } },
{ 61, { false, gettext ("Garden shed") } },
{ 62, { false, gettext ("Garden shed") } },
{ 63, { true, gettext ("Eggs") } },
{ 64, { false, gettext ("Eggs") } },
{ 65, { false, gettext ("Palisade") } },
{ 66, { false, gettext ("Palisade") } },
{ 67, { false, gettext ("Palisade") } },
{ 68, { false, gettext ("Palisade") } },
{ 69, { false, gettext ("Palisade") } },
{ 70, { false, gettext ("Palisade") } },
{ 71, { false, gettext ("Palisade") } },
{ 72, { false, gettext ("Bridge") } },
{ 73, { false, gettext ("Bridge") } },
{ 80, { true, gettext ("Medical potion") } },
{ 81, { false, pgettext ("Flower|1|", "Flowers") } },
{ 82, { true, pgettext ("Flower|1|", "Bunch of flowers") } },
{ 83, { false, pgettext ("Flower|2|", "Flowers") } },
{ 84, { true, pgettext ("Flower|2|", "Bunch of flowers") } },
{ 85, { true, gettext ("Dynamite") } },
{ 86, { true, gettext ("Dynamite") } },
{ 87, { true, gettext ("Dynamite") } },
{ 92, { true, gettext ("Poison") } },
{ 93, { true, gettext ("Sticky trap") } },
{ 94, { false, pgettext ("Flower|3|", "Flowers") } },
{ 95, { true, pgettext ("Flower|3|", "Bunch of flowers") } },
{ 96, { true, gettext ("Trapped enemy") } },
{ 97, { true, gettext ("Trapped enemy") } },
{ 98, { true, gettext ("Trapped enemy") } },
{ 99, { false, gettext ("Enemy construction") } },
{ 100, { false, gettext ("Enemy construction") } },
{ 101, { false, gettext ("Enemy construction") } },
{ 102, { false, gettext ("Enemy construction") } },
{ 103, { false, gettext ("Enemy construction") } },
{ 104, { false, gettext ("Enemy construction") } },
{ 105, { false, gettext ("Enemy construction") } },
{ 106, { false, gettext ("Enemy construction") } },
{ 107, { false, gettext ("Enemy construction") } },
{ 108, { false, gettext ("Enemy construction") } },
{ 109, { false, gettext ("Enemy construction") } },
{ 110, { false, gettext ("Enemy construction") } },
{ 111, { false, gettext ("Enemy construction") } },
{ 112, { false, gettext ("Enemy construction") } },
{ 113, { false, gettext ("Blupi's house") } },
{ 114, { true, gettext ("Trapped enemy") } },
{ 115, { false, gettext ("Enemy construction") } },
{ 116, { false, gettext ("Enemy construction") } },
{ 117, { true, gettext ("Boat") } },
{ 118, { true, gettext ("Jeep") } },
{ 119, { false, gettext ("Workshop") } },
{ 120, { false, gettext ("Workshop") } },
{ 121, { false, gettext ("Mine") } },
{ 122, { false, gettext ("Mine") } },
{ 123, { true, gettext ("Iron") } },
{ 124, { false, gettext ("Flag") } },
{ 125, { true, gettext ("Time bomb") } },
{ 126, { false, gettext ("Mine") } },
{ 127, { true, gettext ("Time bomb") } },
{ 128, { false, gettext ("Enemy construction") } },
{ 129, { false, gettext ("Enemy construction") } },
{ 130, { true, gettext ("Trapped enemy") } },
}; };
if ( m_bHideTooltips ) return -1; // rien si menu présent static const std::unordered_map<size_t, object_t> tableFloor = {
{ 1, { false, gettext ("Normal ground") } },
{ 2, { false, gettext ("Bank") } },
{ 3, { false, gettext ("Bank") } },
{ 4, { false, gettext ("Bank") } },
{ 5, { false, gettext ("Bank") } },
{ 6, { false, gettext ("Bank") } },
{ 7, { false, gettext ("Bank") } },
{ 8, { false, gettext ("Bank") } },
{ 9, { false, gettext ("Bank") } },
{ 10, { false, gettext ("Bank") } },
{ 11, { false, gettext ("Bank") } },
{ 12, { false, gettext ("Bank") } },
{ 13, { false, gettext ("Bank") } },
{ 14, { false, gettext ("Water") } },
{ 15, { false, gettext ("Paving stones") } },
{ 16, { false, gettext ("Paving stones") } },
{ 17, { false, gettext ("Striped paving stones") } },
{ 18, { false, gettext ("Ice") } },
{ 19, { false, gettext ("Burnt ground") } },
{ 20, { false, gettext ("Inflammable ground") } },
{ 21, { false, gettext ("Miscellaneous ground") } },
{ 22, { false, gettext ("Miscellaneous ground") } },
{ 23, { false, gettext ("Miscellaneous ground") } },
{ 24, { false, gettext ("Miscellaneous ground") } },
{ 25, { false, gettext ("Miscellaneous ground") } },
{ 26, { false, gettext ("Miscellaneous ground") } },
{ 27, { false, gettext ("Miscellaneous ground") } },
{ 28, { false, gettext ("Miscellaneous ground") } },
{ 29, { false, gettext ("Miscellaneous ground") } },
{ 30, { false, gettext ("Miscellaneous ground") } },
{ 31, { false, gettext ("Miscellaneous ground") } },
{ 32, { false, gettext ("Miscellaneous ground") } },
{ 33, { false, gettext ("Sterile ground") } },
{ 34, { false, gettext ("Miscellaneous ground") } },
{ 35, { false, gettext ("Miscellaneous ground") } },
{ 36, { false, gettext ("Miscellaneous ground") } },
{ 37, { false, gettext ("Miscellaneous ground") } },
{ 38, { false, gettext ("Miscellaneous ground") } },
{ 39, { false, gettext ("Miscellaneous ground") } },
{ 40, { false, gettext ("Miscellaneous ground") } },
{ 41, { false, gettext ("Miscellaneous ground") } },
{ 42, { false, gettext ("Miscellaneous ground") } },
{ 43, { false, gettext ("Miscellaneous ground") } },
{ 44, { false, gettext ("Miscellaneous ground") } },
{ 45, { false, gettext ("Miscellaneous ground") } },
{ 46, { false, gettext ("Sterile ground") } },
{ 47, { false, gettext ("Sterile ground") } },
{ 48, { false, gettext ("Sterile ground") } },
{ 49, { false, gettext ("Normal ground") } },
{ 50, { false, gettext ("Normal ground") } },
{ 51, { false, gettext ("Normal ground") } },
{ 52, { false, gettext ("Incubator") } },
{ 53, { false, gettext ("Incubator") } },
{ 54, { false, gettext ("Incubator") } },
{ 55, { false, gettext ("Incubator") } },
{ 56, { false, gettext ("Incubator") } },
{ 57, { false, gettext ("Normal ground") } },
{ 58, { false, gettext ("Inflammable ground") } },
{ 59, { false, gettext ("Bridge") } },
{ 60, { false, gettext ("Bridge") } },
{ 61, { false, gettext ("Bridge") } },
{ 62, { false, gettext ("Bridge") } },
{ 63, { false, gettext ("Bridge") } },
{ 64, { false, gettext ("Bridge") } },
{ 65, { false, gettext ("Enemy ground") } },
{ 66, { false, gettext ("Miscellaneous ground") } },
{ 67, { false, gettext ("Enemy ground") } },
{ 68, { false, gettext ("Water") } },
{ 69, { false, gettext ("Water") } },
{ 70, { false, gettext ("Water") } },
{ 71, { false, gettext ("Sterile ground") } },
{ 78, { false, gettext ("Miscellaneous ground") } },
{ 79, { false, gettext ("Miscellaneous ground") } },
{ 80, { false, gettext ("Teleporter") } },
{ 81, { false, gettext ("Teleporter") } },
{ 82, { false, gettext ("Teleporter") } },
{ 83, { false, gettext ("Teleporter") } },
{ 84, { false, gettext ("Teleporter") } },
};
if ( posMouse.x < POSDRAWX || if (m_bHideTooltips)
posMouse.x > POSDRAWX+DIMDRAWX || return nullptr; // rien si menu présent
posMouse.y < POSDRAWY ||
posMouse.y > POSDRAWY+DIMDRAWY ) return -1; if ( posMouse.x < POSDRAWX
|| posMouse.x > POSDRAWX + DIMDRAWX
|| posMouse.y < POSDRAWY
|| posMouse.y > POSDRAWY + DIMDRAWY)
return nullptr;
if ( m_celHili.x != -1 ) if ( m_celHili.x != -1 )
{ {
if ( m_rankHili != -1 ) // blupi visé ? if ( m_rankHili != -1 ) // blupi visé ?
{ {
if ( m_blupi[m_rankHili].perso == 0 ) // blupi ? switch (m_blupi[m_rankHili].perso)
{ {
res = TX_OBJ_BLUPI; case 0: // blupi ?
if ( m_blupi[m_rankHili].energy <= MAXENERGY/4 ) if (m_blupi[m_rankHili].energy <= MAXENERGY / 4)
{ return gettext ("Tired Blupi");
res = TX_OBJ_BLUPIf; if (m_blupi[m_rankHili].bMalade)
} return gettext ("Sick Blupi");
if ( m_blupi[m_rankHili].bMalade ) return gettext ("Blupi");
{ case 1: // araignée ?
res = TX_OBJ_BLUPIm; return gettext ("Spider");
} case 2: // virus ?
} return gettext ("Virus");
if ( m_blupi[m_rankHili].perso == 1 ) // araignée ? case 3: // tracks ?
{ return gettext ("Bulldozer");
res = TX_OBJ_ARAIGNEE; case 4: // robot ?
} return gettext ("Master robot");
if ( m_blupi[m_rankHili].perso == 2 ) // virus ? case 5: // bombe ?
{ return gettext ("Bouncing bomb");
res = TX_OBJ_VIRUS; case 7: // electro ?
} return gettext ("Electrocutor");
if ( m_blupi[m_rankHili].perso == 3 ) // tracks ? case 8: // disciple ?
{ return gettext ("Helper robot");
res = TX_OBJ_TRACKS;
}
if ( m_blupi[m_rankHili].perso == 4 ) // robot ?
{
res = TX_OBJ_ROBOT;
}
if ( m_blupi[m_rankHili].perso == 5 ) // bombe ?
{
res = TX_OBJ_BOMBE;
}
if ( m_blupi[m_rankHili].perso == 7 ) // electro ?
{
res = TX_OBJ_ELECTRO;
}
if ( m_blupi[m_rankHili].perso == 8 ) // disciple ?
{
res = TX_OBJ_DISCIPLE;
} }
return res; return nullptr;
} }
else
{
icon = m_decor[m_celHili.x/2][m_celHili.y/2].objectIcon;
if ( icon != -1 && icon < table_object[0] )
{
res = table_object[1+icon];
if ( res != 0 )
{
if ( res > 0 ) return res;
if ( m_celHili.x%2 != 0 &&
m_celHili.y%2 != 0 ) return -res;
}
}
icon = m_decor[m_celHili.x/2][m_celHili.y/2].floorIcon; icon = m_decor[m_celHili.x/2][m_celHili.y/2].objectIcon;
if ( icon != -1 && icon < table_floor[0] ) if (icon != -1)
{
const auto obj = tableObject.find (icon);
if (obj != tableObject.end ())
{ {
res = table_floor[1+icon]; if (!obj->second.corner)
if ( res != 0 ) return res; return obj->second.text;
if ( m_celHili.x % 2
&& m_celHili.y % 2)
return obj->second.text;
} }
} }
icon = m_decor[m_celHili.x/2][m_celHili.y/2].floorIcon;
if (icon != -1)
{
const auto obj = tableFloor.find (icon);
if (obj != tableFloor.end ())
return obj->second.text;
}
} }
return -1; return nullptr;
} }
// Indique si le menu est présent et qu'il faut cacher // Indique si le menu est présent et qu'il faut cacher

View File

@ -424,7 +424,7 @@ public:
void CelHili(POINT pos, int action); void CelHili(POINT pos, int action);
void CelHiliButton(POINT cel, int button); void CelHiliButton(POINT cel, int button);
void CelHiliRepeat(int list); void CelHiliRepeat(int list);
int GetResHili(POINT posMouse); const char *GetResHili(POINT posMouse);
void HideTooltips(bool bHide); void HideTooltips(bool bHide);
void UndoOpen(); void UndoOpen();

View File

@ -1,6 +1,7 @@
// DecStat.cpp // DecStat.cpp
// //
#include "gettext.h"
#include "RESOURCE.H" #include "RESOURCE.H"
#include "DECOR.H" #include "DECOR.H"
#include "TEXT.H" #include "TEXT.H"
@ -29,7 +30,7 @@ typedef struct
short lastIcon; // négatif si sol short lastIcon; // négatif si sol
short drawIcon; short drawIcon;
short bBigIcon; short bBigIcon;
short text; const char *text;
short nb; short nb;
short lastShow; short lastShow;
} }
@ -44,7 +45,7 @@ static Statistic table_statistic[] =
0,0, // 0,0, //
76, 76,
false, false,
TX_OBJ_BLUPIm, gettext ("Sick Blupi"),
0, 0, 0, 0,
}, },
{ // STATBLUPIf = 1 { // STATBLUPIf = 1
@ -53,7 +54,7 @@ static Statistic table_statistic[] =
0,0, // 0,0, //
13, 13,
false, false,
TX_OBJ_BLUPIf, gettext ("Tired Blupi"),
0, 0, 0, 0,
}, },
{ // STATBLUPI = 2 { // STATBLUPI = 2
@ -62,7 +63,7 @@ static Statistic table_statistic[] =
0,0, // 0,0, //
14, 14,
false, false,
TX_OBJ_BLUPI, gettext ("Blupi"),
0, 0, 0, 0,
}, },
{ // STATDISCIPLE = 3 { // STATDISCIPLE = 3
@ -71,7 +72,7 @@ static Statistic table_statistic[] =
0,0, // 0,0, //
85, 85,
false, false,
TX_OBJ_DISCIPLE, gettext ("Helper robot"),
0, 0, 0, 0,
}, },
{ // 4 { // 4
@ -80,7 +81,7 @@ static Statistic table_statistic[] =
117,117, // bateau 117,117, // bateau
58, 58,
false, false,
TX_OBJ_BATEAU, gettext ("Boat"),
0, 0, 0, 0,
}, },
{ // 5 { // 5
@ -89,7 +90,7 @@ static Statistic table_statistic[] =
118,118, // jeep 118,118, // jeep
65, 65,
false, false,
TX_OBJ_JEEP, gettext ("Jeep"),
0, 0, 0, 0,
}, },
{ // 6 { // 6
@ -98,7 +99,7 @@ static Statistic table_statistic[] =
16,16, // armure 16,16, // armure
106, 106,
false, false,
TX_OBJ_ARMURE, gettext ("Armour"),
0, 0, 0, 0,
}, },
{ // 7 { // 7
@ -107,7 +108,7 @@ static Statistic table_statistic[] =
93,93, // piège 93,93, // piège
70, 70,
false, false,
TX_OBJ_PIEGE, gettext ("Sticky trap"),
0, 0, 0, 0,
}, },
{ // 8 { // 8
@ -116,7 +117,7 @@ static Statistic table_statistic[] =
92,92, // poison 92,92, // poison
71, 71,
false, false,
TX_OBJ_POISON, gettext ("Poison"),
0, 0, 0, 0,
}, },
{ // 9 { // 9
@ -125,7 +126,7 @@ static Statistic table_statistic[] =
85,85, // dynamite 85,85, // dynamite
57, 57,
false, false,
TX_OBJ_DYNAMITE, gettext ("Dynamite"),
0, 0, 0, 0,
}, },
{ // 10 { // 10
@ -134,7 +135,7 @@ static Statistic table_statistic[] =
125,125, // mine 125,125, // mine
63, 63,
false, false,
TX_OBJ_MINE, gettext ("Time bomb"),
0, 0, 0, 0,
}, },
{ // 11 { // 11
@ -143,7 +144,7 @@ static Statistic table_statistic[] =
60,60, // tomate 60,60, // tomate
28, 28,
false, false,
TX_OBJ_TOMATE, gettext ("Tomatoes"),
0, 0, 0, 0,
}, },
{ // 12 { // 12
@ -152,7 +153,7 @@ static Statistic table_statistic[] =
80,80, // bouteille 80,80, // bouteille
34, 34,
false, false,
TX_OBJ_POTION, gettext ("Medical potion"),
0, 0, 0, 0,
}, },
{ // 13 { // 13
@ -161,7 +162,7 @@ static Statistic table_statistic[] =
36,36, // planches 36,36, // planches
22, 22,
false, false,
TX_OBJ_PLANCHE, gettext ("Planks"),
0, 0, 0, 0,
}, },
{ // 14 { // 14
@ -170,7 +171,7 @@ static Statistic table_statistic[] =
44,44, // pierres 44,44, // pierres
27, 27,
false, false,
TX_OBJ_PIERRE, gettext ("Stones"),
0, 0, 0, 0,
}, },
{ // 15 { // 15
@ -179,7 +180,7 @@ static Statistic table_statistic[] =
124,124, // drapeau 124,124, // drapeau
64, 64,
true, true,
TX_OBJ_DRAPEAU, gettext ("Flag"),
0, 0, 0, 0,
}, },
{ // 16 { // 16
@ -188,7 +189,7 @@ static Statistic table_statistic[] =
123,123, // fer 123,123, // fer
62, 62,
false, false,
TX_OBJ_FER, gettext ("Iron"),
0, 0, 0, 0,
}, },
{ // 17 { // 17
@ -197,7 +198,7 @@ static Statistic table_statistic[] =
82,82, // fleurs1 82,82, // fleurs1
72, 72,
false, false,
TX_OBJ_FLEUR1, pgettext ("Flower|1|", "Flowers"),
0, 0, 0, 0,
}, },
{ // 18 { // 18
@ -206,7 +207,7 @@ static Statistic table_statistic[] =
84,84, // fleurs2 84,84, // fleurs2
73, 73,
false, false,
TX_OBJ_FLEUR2, pgettext ("Flower|2|", "Flowers"),
0, 0, 0, 0,
}, },
{ // 19 { // 19
@ -215,7 +216,7 @@ static Statistic table_statistic[] =
95,95, // fleurs3 95,95, // fleurs3
74, 74,
false, false,
TX_OBJ_FLEUR3, pgettext ("Flower|3|", "Flowers"),
0, 0, 0, 0,
}, },
{ // 20 { // 20
@ -224,7 +225,7 @@ static Statistic table_statistic[] =
61,61, // cabane 61,61, // cabane
19, 19,
true, true,
TX_OBJ_CABANE, gettext ("Garden shed"),
0, 0, 0, 0,
}, },
{ // 21 { // 21
@ -233,7 +234,7 @@ static Statistic table_statistic[] =
-52,-56, // couveuse -52,-56, // couveuse
25, 25,
false, false,
TX_OBJ_COUVEUSE, gettext ("Incubator"),
0, 0, 0, 0,
}, },
{ // 22 { // 22
@ -242,7 +243,7 @@ static Statistic table_statistic[] =
-80,-84, // téléporteur -80,-84, // téléporteur
101, 101,
false, false,
TX_OBJ_TELEPORTE, gettext ("Teleporter"),
0, 0, 0, 0,
}, },
{ // 23 { // 23
@ -251,7 +252,7 @@ static Statistic table_statistic[] =
28,29, // laboratoire 28,29, // laboratoire
35, 35,
true, true,
TX_OBJ_LABO, gettext ("Laboratory"),
0, 0, 0, 0,
}, },
{ // 24 { // 24
@ -260,7 +261,7 @@ static Statistic table_statistic[] =
121,122, // mine de fer 121,122, // mine de fer
61, 61,
true, true,
TX_OBJ_MINEFER, gettext ("Mine"),
0, 0, 0, 0,
}, },
{ // 25 { // 25
@ -269,7 +270,7 @@ static Statistic table_statistic[] =
119,120, // usine 119,120, // usine
59, 59,
true, true,
TX_OBJ_USINE, gettext ("Workshop"),
0, 0, 0, 0,
}, },
{ // 26 { // 26
@ -278,7 +279,7 @@ static Statistic table_statistic[] =
27,27, // tour 27,27, // tour
33, 33,
true, true,
TX_OBJ_TOUR, gettext ("Protection tower"),
0, 0, 0, 0,
}, },
{ // STATFEU = 27 { // STATFEU = 27
@ -287,7 +288,7 @@ static Statistic table_statistic[] =
0,0, // 0,0, //
37, 37,
true, true,
TX_OBJ_FEU, gettext ("Fire"),
0, 0, 0, 0,
}, },
{ // STATROBOT = 28 { // STATROBOT = 28
@ -296,7 +297,7 @@ static Statistic table_statistic[] =
0,0, // 0,0, //
56, 56,
false, false,
TX_OBJ_ROBOT, gettext ("Master robot"),
0, 0, 0, 0,
}, },
{ // STATTRACKS = 29 { // STATTRACKS = 29
@ -305,7 +306,7 @@ static Statistic table_statistic[] =
0,0, // 0,0, //
17, 17,
false, false,
TX_OBJ_TRACKS, gettext ("Bulldozer"),
0, 0, 0, 0,
}, },
{ // STATBOMBE = 30 { // STATBOMBE = 30
@ -314,7 +315,7 @@ static Statistic table_statistic[] =
0,0, // 0,0, //
38, 38,
false, false,
TX_OBJ_BOMBE, gettext ("Bouncing bomb"),
0, 0, 0, 0,
}, },
{ // STATARAIGNEE = 31 { // STATARAIGNEE = 31
@ -323,7 +324,7 @@ static Statistic table_statistic[] =
0,0, // 0,0, //
15, 15,
false, false,
TX_OBJ_ARAIGNEE, gettext ("Spider"),
0, 0, 0, 0,
}, },
{ // STATVIRUS = 32 { // STATVIRUS = 32
@ -332,7 +333,7 @@ static Statistic table_statistic[] =
0,0, // 0,0, //
16, 16,
false, false,
TX_OBJ_VIRUS, gettext ("Virus"),
0, 0, 0, 0,
}, },
{ // STATELECTRO = 33 { // STATELECTRO = 33
@ -341,7 +342,7 @@ static Statistic table_statistic[] =
0,0, // 0,0, //
75, 75,
false, false,
TX_OBJ_ELECTRO, gettext ("Electrocutor"),
0, 0, 0, 0,
}, },
@ -351,7 +352,7 @@ static Statistic table_statistic[] =
0,0, 0,0,
-1, -1,
false, false,
0, "",
999, 999, 999, 999,
}, },
}; };
@ -662,9 +663,10 @@ void CDecor::StatisticDraw()
{ {
POINT pos; POINT pos;
RECT rect; RECT rect;
int rank, icon, nb, textRes; int rank, icon, nb;
Statistic* pStatistic; Statistic* pStatistic;
char text[50]; char text[50];
const char *textRes;
pStatistic = table_statistic; pStatistic = table_statistic;
@ -684,7 +686,7 @@ void CDecor::StatisticDraw()
nb --; nb --;
} }
textRes = 0; textRes = "";
for ( rank=0 ; rank<STATNB ; rank++ ) for ( rank=0 ; rank<STATNB ; rank++ )
{ {
pos.x = POSSTATX+DIMSTATX*(rank/(STATNB/2)); pos.x = POSSTATX+DIMSTATX*(rank/(STATNB/2));
@ -757,9 +759,9 @@ void CDecor::StatisticDraw()
// Dans un bouton stop/setup/write ? // Dans un bouton stop/setup/write ?
if ( textRes == 0 && m_statHili >= 100 ) if ( textRes == 0 && m_statHili >= 100 )
{ {
if ( m_statHili == 100 ) textRes = TX_BUTTON_PLAY_STOP; if ( m_statHili == 100 ) textRes = gettext ("Interrupt");
if ( m_statHili == 101 ) textRes = TX_BUTTON_PLAY_SETUP; if ( m_statHili == 101 ) textRes = gettext ("Settings");
if ( m_statHili == 102 ) textRes = TX_BUTTON_PLAY_WRITE; if ( m_statHili == 102 ) textRes = gettext ("Save");
} }
// Dessine le nom de la statistique survolée. // Dessine le nom de la statistique survolée.
@ -771,12 +773,11 @@ void CDecor::StatisticDraw()
rect.bottom = pos.y+16; rect.bottom = pos.y+16;
m_pPixmap->DrawPart(-1, CHBACK, pos, rect, 1); // dessine le fond m_pPixmap->DrawPart(-1, CHBACK, pos, rect, 1); // dessine le fond
if ( textRes != 0 ) if (strlen (textRes))
{ {
LoadString(textRes, text, 50); nb = GetTextWidth(textRes);
nb = GetTextWidth(text);
pos.x += (POSDRAWX-nb)/2; pos.x += (POSDRAWX-nb)/2;
DrawText(m_pPixmap, pos, text); DrawText(m_pPixmap, pos, textRes);
} }
m_bStatRedraw = false; // dessin plus nécessaire m_bStatRedraw = false; // dessin plus nécessaire

View File

@ -2292,22 +2292,18 @@ bool CEvent::DrawButtons()
pos.y = 330-20; pos.y = 330-20;
DrawText(m_pPixmap, pos, res); DrawText(m_pPixmap, pos, res);
if ( m_pMovie->GetEnable() ) char *text = gettext ("No");
{ if (m_pMovie->GetEnable() && m_bMovie)
if ( m_bMovie ) LoadString(TX_OUI, res, 50); text = gettext ("Yes");
else LoadString(TX_NON, res, 50); lg = GetTextWidth(text);
}
else
{
LoadString(TX_NON, res, 50);
}
lg = GetTextWidth(res);
pos.x = (514+40)-lg/2; pos.x = (514+40)-lg/2;
pos.y = 330-20; pos.y = 330-20;
DrawText(m_pPixmap, pos, res); DrawText(m_pPixmap, pos, text);
if ( m_scrollSpeed == 0 ) LoadString(TX_INFO_NOSCROLL, res, 50); if (!m_scrollSpeed)
else sprintf(res, "%d", m_scrollSpeed); snprintf (res, sizeof (res), gettext ("None"));
else
sprintf(res, "%d", m_scrollSpeed);
lg = GetTextWidth(res); lg = GetTextWidth(res);
pos.x = (169+40)-lg/2; pos.x = (169+40)-lg/2;
pos.y = 330-20; pos.y = 330-20;
@ -2317,33 +2313,35 @@ bool CEvent::DrawButtons()
// Affiche le texte de fin de la version demo. // Affiche le texte de fin de la version demo.
if ( m_phase == WM_PHASE_BYE ) if ( m_phase == WM_PHASE_BYE )
{ {
LoadString(TX_FULL_END1, res, 100); char *text;
lg = GetTextWidth(res); text = gettext ("You have played Planet Blupi.");
lg = GetTextWidth(text);
pos.x = LXIMAGE/2-lg/2; pos.x = LXIMAGE/2-lg/2;
pos.y = 20; pos.y = 20;
DrawText(m_pPixmap, pos, res); DrawText(m_pPixmap, pos, text);
LoadString(TX_FULL_END2, res, 100); text = gettext ("We hope you have had as much fun playing the game as we had making it !");
lg = GetTextWidth(res); lg = GetTextWidth(text);
pos.x = LXIMAGE/2-lg/2; pos.x = LXIMAGE/2-lg/2;
pos.y = 40; pos.y = 40;
DrawText(m_pPixmap, pos, res); DrawText(m_pPixmap, pos, text);
LoadString(TX_FULL_END3, res, 100); text = gettext ("This game is an original creation of EPSITEC SA, CH-1092 Belmont");
lg = GetTextWidth(res); lg = GetTextWidth(text);
pos.x = LXIMAGE/2-lg/2; pos.x = LXIMAGE/2-lg/2;
pos.y = 430; pos.y = 430;
DrawText(m_pPixmap, pos, res); DrawText(m_pPixmap, pos, text);
LoadString(TX_FULL_END4, res, 100); text = gettext ("http://www.blupi.com blupi@epsitec.ch");
lg = GetTextWidth(res); lg = GetTextWidth(text);
pos.x = LXIMAGE/2-lg/2; pos.x = LXIMAGE/2-lg/2;
pos.y = 450; pos.y = 450;
DrawText(m_pPixmap, pos, res); DrawText(m_pPixmap, pos, text);
} }
// Affiche le texte lorsqu'il faut insérer le CD-Rom. // Affiche le texte lorsqu'il faut insérer le CD-Rom.

View File

@ -74,7 +74,7 @@ int GetCharWidth(char c, int font)
// Affiche un texte. // Affiche un texte.
void DrawText(CPixmap *pPixmap, POINT pos, char *pText, int font) void DrawText(CPixmap *pPixmap, POINT pos, const char *pText, int font)
{ {
int rank; int rank;
@ -269,7 +269,7 @@ int GetTextHeight(char *pText, int font, int part)
// Retourne la longueur d'un texte. // Retourne la longueur d'un texte.
int GetTextWidth(char *pText, int font) int GetTextWidth(const char *pText, int font)
{ {
int width = 0; int width = 0;

4
text.h
View File

@ -8,7 +8,7 @@
#define FONTLITTLE 10 #define FONTLITTLE 10
extern extern
void DrawText(CPixmap *pPixmap, POINT pos, char *pText, int font=0); void DrawText(CPixmap *pPixmap, POINT pos, const char *pText, int font=0);
extern extern
void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText, void DrawTextPente(CPixmap *pPixmap, POINT pos, char *pText,
@ -25,7 +25,7 @@ extern
int GetTextHeight(char *pText, int font=0, int part=-1); int GetTextHeight(char *pText, int font=0, int part=-1);
extern extern
int GetTextWidth(char *pText, int font=0); int GetTextWidth(const char *pText, int font=0);
extern extern
void DrawBignum(CPixmap *pPixmap, POINT pos, int num); void DrawBignum(CPixmap *pPixmap, POINT pos, int num);