Erwan
- Language is now an option at startup - "text" line translation for cards made easier, check Res/lang/xx_cards.txt - TODO: test on PSP/Linux, performance issues ? Allow possibility to change language in options menu
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
To translate Wagic into the language of your choice, rename the file xx.txt (where "xx" is your chosen language) into "_lang.txt"
|
|
||||||
+10831
-10830
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
|||||||
|
#LANG:English
|
||||||
|
|
||||||
|
#this file is here only to allow people to choose english
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#LANG:Espanol
|
||||||
#Traducción de Wagic The Homebrew 0.7.0 al Español
|
#Traducción de Wagic The Homebrew 0.7.0 al Español
|
||||||
#Renombra este archivo a "_lang.txt" o substituye spa por _lang en el nombre del archivo para disfrutar de Wagic en Español
|
#Renombra este archivo a "_lang.txt" o substituye spa por _lang en el nombre del archivo para disfrutar de Wagic en Español
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#LANG:Francais
|
||||||
#Fichier de traduction Francais pour Wagic The Homebrew
|
#Fichier de traduction Francais pour Wagic The Homebrew
|
||||||
#Placez ce fichier dans Res/lang.txt (renommez-le si necessaire), la traduction devrait etre automatique
|
#Placez ce fichier dans Res/lang.txt (renommez-le si necessaire), la traduction devrait etre automatique
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
|||||||
|
#LANG:Italiano
|
||||||
#File di traduzione in Italiano per Wagic 0.8.1 - by Icarus
|
#File di traduzione in Italiano per Wagic 0.8.1 - by Icarus
|
||||||
#Metti questo file nella cartella WTH/Res e rinominalo come _lang.txt
|
#Metti questo file nella cartella WTH/Res e rinominalo come _lang.txt
|
||||||
#Al prossimo avvio del gioco avrai il tutto tradotto
|
#Al prossimo avvio del gioco avrai il tutto tradotto
|
||||||
#Buon divertimento
|
#Buon divertimento
|
||||||
|
|
||||||
#Note to translators:
|
#Note to translators:
|
||||||
@@ -13,7 +14,7 @@
|
|||||||
LOADING SET: %s=CARICAMENTO SET: %s
|
LOADING SET: %s=CARICAMENTO SET: %s
|
||||||
Play=Gioca
|
Play=Gioca
|
||||||
Deck Editor=Deck Editor
|
Deck Editor=Deck Editor
|
||||||
Shop=Negozio
|
Shop=Negozio
|
||||||
Options=Opzioni
|
Options=Opzioni
|
||||||
Exit=Esci
|
Exit=Esci
|
||||||
1 Player=1 Giocatore
|
1 Player=1 Giocatore
|
||||||
@@ -22,12 +23,12 @@ Player=Giocatore
|
|||||||
Cancel=Annulla
|
Cancel=Annulla
|
||||||
Classic=Classico
|
Classic=Classico
|
||||||
Music volume=Volume Musica
|
Music volume=Volume Musica
|
||||||
SFX volume=Volume Suoni
|
SFX volume=Volume Suoni
|
||||||
|
|
||||||
Interrupt my spells=Interrompi le mie magie
|
Interrupt my spells=Interrompi le mie magie
|
||||||
|
|
||||||
Interrupt my abilities=Interrompi le mie abilita'
|
Interrupt my abilities=Interrompi le mie abilita'
|
||||||
|
|
||||||
Display InGame extra information=Mostra informazioni extra in gioco
|
Display InGame extra information=Mostra informazioni extra in gioco
|
||||||
Seconds to pause for an Interrupt=Secondi di pausa per Istantaneo
|
Seconds to pause for an Interrupt=Secondi di pausa per Istantaneo
|
||||||
Difficulty=Difficolta'
|
Difficulty=Difficolta'
|
||||||
@@ -47,7 +48,7 @@ You have played %i games with Deck%i=Hai giocato %i partite con il mazzo %i
|
|||||||
You have played a total of %i games=Hai giocato in tutto %i partite
|
You have played a total of %i games=Hai giocato in tutto %i partite
|
||||||
Unlock the difficult mode for more challenging duels!=Sblocca la modalita' difficile per partite piu' competitive!
|
Unlock the difficult mode for more challenging duels!=Sblocca la modalita' difficile per partite piu' competitive!
|
||||||
Interested in playing Momir Basic? You'll have to unlock it first :)=Conosci Momir Basic? Sblocca questa modalita' per poterla provare
|
Interested in playing Momir Basic? You'll have to unlock it first :)=Conosci Momir Basic? Sblocca questa modalita' per poterla provare
|
||||||
You have a total of %i cards in your collection=Hai un totale di %i carte nella tua collezione
|
You have a total of %i cards in your collection=Hai un totale di %i carte nella tua collezione
|
||||||
|
|
||||||
The cards in your collection have an average value of %i credits=Le carte nella tua collezione hanno un valore medio di %i crediti
|
The cards in your collection have an average value of %i credits=Le carte nella tua collezione hanno un valore medio di %i crediti
|
||||||
The shopkeeper would buy your entire collection for around %i credits=Potresti vendere la tua intera collezione per circa %i crediti
|
The shopkeeper would buy your entire collection for around %i credits=Potresti vendere la tua intera collezione per circa %i crediti
|
||||||
@@ -60,7 +61,7 @@ NO DECK AVAILABLE,=NESSUN DECK DISPONIBILE,
|
|||||||
PRESS CIRCLE TO GO TO THE DECK EDITOR!=PREMI CERCHIO PER TORNARE AL DECK EDITOR!
|
PRESS CIRCLE TO GO TO THE DECK EDITOR!=PREMI CERCHIO PER TORNARE AL DECK EDITOR!
|
||||||
You haven't unlocked the random deck mode yet=Non hai ancora sbloccato la modalita' mazzo casuale
|
You haven't unlocked the random deck mode yet=Non hai ancora sbloccato la modalita' mazzo casuale
|
||||||
You haven't locked the random deck mode yet=Non hai ancora bloccato la modalita' mazzo casuale
|
You haven't locked the random deck mode yet=Non hai ancora bloccato la modalita' mazzo casuale
|
||||||
You haven't unlocked the evil twin mode yet=Non hai ancora sbloccato la modalità evil twin
|
You haven't unlocked the evil twin mode yet=Non hai ancora sbloccato la modalit�Eevil twin
|
||||||
You have unlocked %i expansions out of %i=Hai sbloccato %i espansioni su %i
|
You have unlocked %i expansions out of %i=Hai sbloccato %i espansioni su %i
|
||||||
Premade G/R=Mazzo Iniziale V/R
|
Premade G/R=Mazzo Iniziale V/R
|
||||||
|
|
||||||
@@ -127,15 +128,15 @@ End=Fine
|
|||||||
Cleanup=Fase di Scarto
|
Cleanup=Fase di Scarto
|
||||||
|
|
||||||
#Stack
|
#Stack
|
||||||
Deals %i damage to= Fa %i danno/i a
|
Deals %i damage to= Fa %i danno/i a
|
||||||
|
|
||||||
goes to graveyard= va' nel cimitero
|
goes to graveyard= va' nel cimitero
|
||||||
%s goes to graveyard=%s va' nel cimitero
|
%s goes to graveyard=%s va' nel cimitero
|
||||||
|
|
||||||
Deplete= Mette nel cimitero
|
|
||||||
|
|
||||||
Player %i draws %i card= Il Giocatore %i pesca %i carta
|
Deplete= Mette nel cimitero
|
||||||
|
|
||||||
|
Player %i draws %i card= Il Giocatore %i pesca %i carta
|
||||||
|
|
||||||
|
|
||||||
Damage=Danno
|
Damage=Danno
|
||||||
Ability=Abilita'
|
Ability=Abilita'
|
||||||
@@ -169,8 +170,8 @@ switch to your collection.=per vedere la collezione.
|
|||||||
Press L/R to cycle through=Premi L/R per scorrere le
|
Press L/R to cycle through=Premi L/R per scorrere le
|
||||||
deck statistics.=statistiche del mazzo.
|
deck statistics.=statistiche del mazzo.
|
||||||
Deck info=Info Mazzo
|
Deck info=Info Mazzo
|
||||||
Sell card=Vendi carta
|
Sell card=Vendi carta
|
||||||
|
|
||||||
|
|
||||||
No Card=Nessuna Carta
|
No Card=Nessuna Carta
|
||||||
Your Deck: %i cards=Tuo Mazzo: %i carte
|
Your Deck: %i cards=Tuo Mazzo: %i carte
|
||||||
@@ -217,36 +218,36 @@ opponent's turn=turno avversario
|
|||||||
opponent's turn - you play=turno avvers. - tocca a te
|
opponent's turn - you play=turno avvers. - tocca a te
|
||||||
|
|
||||||
#Others
|
#Others
|
||||||
|
|
||||||
Add %i=Aggiungi %i
|
Add %i=Aggiungi %i
|
||||||
|
|
||||||
Add %i mana=Aggiungi %i mana
|
Add %i mana=Aggiungi %i mana
|
||||||
|
|
||||||
#Shop
|
#Shop
|
||||||
press [] to refresh=premi [] per cambiare
|
press [] to refresh=premi [] per cambiare
|
||||||
|
|
||||||
credits: %i=crediti: %i
|
credits: %i=crediti: %i
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Not Working Lines - maybe not yet implemented for translation
|
#Not Working Lines - maybe not yet implemented for translation
|
||||||
|
|
||||||
#Linee non funzionanti - probabilmente non sono ancora state implementate per essere tradotte
|
#Linee non funzionanti - probabilmente non sono ancora state implementate per essere tradotte
|
||||||
|
|
||||||
#Your Deck:=Mazzo:
|
#Your Deck:=Mazzo:
|
||||||
|
|
||||||
#Your Deck=Mazzo
|
#Your Deck=Mazzo
|
||||||
|
|
||||||
#Database: %i cards=Database: %i carte
|
#Database: %i cards=Database: %i carte
|
||||||
|
|
||||||
Collection=Collezione
|
Collection=Collezione
|
||||||
Collection - %i/%i=Collezione - %i/%i
|
Collection - %i/%i=Collezione - %i/%i
|
||||||
|
|
||||||
DECK: %i=MAZZO: %i
|
|
||||||
|
|
||||||
DECK:%i=MAZZO:%i
|
DECK: %i=MAZZO: %i
|
||||||
|
|
||||||
|
DECK:%i=MAZZO:%i
|
||||||
|
|
||||||
|
|
||||||
#types
|
#types
|
||||||
@@ -268,7 +269,7 @@ forest=foresta
|
|||||||
hound=segugio
|
hound=segugio
|
||||||
human=umano
|
human=umano
|
||||||
island=isola
|
island=isola
|
||||||
knight=cavaliere
|
knight=cavaliere
|
||||||
mountain=montagna
|
mountain=montagna
|
||||||
plains=pianura
|
plains=pianura
|
||||||
sliver=tramutante
|
sliver=tramutante
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public:
|
|||||||
enum {
|
enum {
|
||||||
//Global settings
|
//Global settings
|
||||||
ACTIVE_PROFILE,
|
ACTIVE_PROFILE,
|
||||||
|
LANG,
|
||||||
DIFFICULTY_MODE_UNLOCKED,
|
DIFFICULTY_MODE_UNLOCKED,
|
||||||
MOMIR_MODE_UNLOCKED,
|
MOMIR_MODE_UNLOCKED,
|
||||||
EVILTWIN_MODE_UNLOCKED,
|
EVILTWIN_MODE_UNLOCKED,
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class GameStateMenu: public GameState, public JGuiListener
|
|||||||
//JMusic * bgMusic;
|
//JMusic * bgMusic;
|
||||||
int mVolume;
|
int mVolume;
|
||||||
char nbcardsStr[400];
|
char nbcardsStr[400];
|
||||||
|
vector<string> langs;
|
||||||
|
|
||||||
DIR *mDip;
|
DIR *mDip;
|
||||||
struct dirent *mDit;
|
struct dirent *mDit;
|
||||||
@@ -38,6 +39,11 @@ class GameStateMenu: public GameState, public JGuiListener
|
|||||||
float angleW;
|
float angleW;
|
||||||
float yW;
|
float yW;
|
||||||
void fillScroller();
|
void fillScroller();
|
||||||
|
|
||||||
|
void setLang(int id);
|
||||||
|
string getLang(string s);
|
||||||
|
void loadLangMenu();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GameStateMenu(GameApp* parent);
|
GameStateMenu(GameApp* parent);
|
||||||
virtual ~GameStateMenu();
|
virtual ~GameStateMenu();
|
||||||
|
|||||||
@@ -14,8 +14,12 @@ using namespace std;
|
|||||||
class Translator{
|
class Translator{
|
||||||
protected:
|
protected:
|
||||||
static Translator * mInstance;
|
static Translator * mInstance;
|
||||||
|
bool initDone;
|
||||||
|
|
||||||
|
void load(string filename, map<string,string> * dictionary);
|
||||||
public:
|
public:
|
||||||
map<string,string> values;
|
map<string,string> values;
|
||||||
|
map<string,string> tempValues;
|
||||||
#if defined DEBUG_TRANSLATE
|
#if defined DEBUG_TRANSLATE
|
||||||
map<string,int> missingValues;
|
map<string,int> missingValues;
|
||||||
map<string,int> dontCareValues;
|
map<string,int> dontCareValues;
|
||||||
@@ -25,6 +29,8 @@ public:
|
|||||||
Translator();
|
Translator();
|
||||||
~Translator();
|
~Translator();
|
||||||
int Add(string from, string to);
|
int Add(string from, string to);
|
||||||
|
void initCards();
|
||||||
|
void init();
|
||||||
static Translator * GetInstance();
|
static Translator * GetInstance();
|
||||||
static void EndInstance();
|
static void EndInstance();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
const char * Options::optionNames[] = {
|
const char * Options::optionNames[] = {
|
||||||
//Global options
|
//Global options
|
||||||
"Profile",
|
"Profile",
|
||||||
|
"Lang",
|
||||||
"prx_handler",
|
"prx_handler",
|
||||||
"prx_rimom",
|
"prx_rimom",
|
||||||
"prx_eviltwin",
|
"prx_eviltwin",
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ enum ENUM_MENU_STATE_MAJOR
|
|||||||
MENU_STATE_MAJOR_LOADING_CARDS = 0x04,
|
MENU_STATE_MAJOR_LOADING_CARDS = 0x04,
|
||||||
MENU_STATE_MAJOR_FIRST_TIME = 0x05,
|
MENU_STATE_MAJOR_FIRST_TIME = 0x05,
|
||||||
MENU_STATE_MAJOR_DUEL = 0x06,
|
MENU_STATE_MAJOR_DUEL = 0x06,
|
||||||
|
MENU_STATE_MAJOR_LANG = 0x07,
|
||||||
|
|
||||||
MENU_STATE_MAJOR = 0xFF
|
MENU_STATE_MAJOR = 0xFF
|
||||||
};
|
};
|
||||||
@@ -98,6 +99,15 @@ void GameStateMenu::Create()
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentState = MENU_STATE_MAJOR_LOADING_CARDS | MENU_STATE_MINOR_NONE;
|
currentState = MENU_STATE_MAJOR_LOADING_CARDS | MENU_STATE_MINOR_NONE;
|
||||||
|
bool langChosen = false;
|
||||||
|
string lang = options[Options::LANG].str;
|
||||||
|
if (lang.size()){
|
||||||
|
lang = "Res/lang/" + lang + ".txt";
|
||||||
|
if (fileExists(lang.c_str())) langChosen = true;
|
||||||
|
}
|
||||||
|
if (!langChosen){
|
||||||
|
currentState = MENU_STATE_MAJOR_LANG | MENU_STATE_MINOR_NONE;
|
||||||
|
}
|
||||||
scroller = NEW TextScroller(resources.GetJLBFont(Constants::MAIN_FONT), SCREEN_WIDTH/2 - 90 , SCREEN_HEIGHT-17,180);
|
scroller = NEW TextScroller(resources.GetJLBFont(Constants::MAIN_FONT), SCREEN_WIDTH/2 - 90 , SCREEN_HEIGHT-17,180);
|
||||||
scrollerSet = 0;
|
scrollerSet = 0;
|
||||||
}
|
}
|
||||||
@@ -117,18 +127,6 @@ void GameStateMenu::Start(){
|
|||||||
JRenderer::GetInstance()->EnableVSync(true);
|
JRenderer::GetInstance()->EnableVSync(true);
|
||||||
subMenuController = NULL;
|
subMenuController = NULL;
|
||||||
SAFE_DELETE(mGuiController);
|
SAFE_DELETE(mGuiController);
|
||||||
mGuiController = NEW JGuiController(100, this);
|
|
||||||
if (mGuiController)
|
|
||||||
{
|
|
||||||
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
|
||||||
mFont->SetColor(ARGB(255,255,255,255));
|
|
||||||
mGuiController->Add(NEW MenuItem(MENUITEM_PLAY, mFont, "Play", 80, 50 + SCREEN_HEIGHT/2, mIcons[8], mIcons[9],"particle1.psi",resources.GetQuad("particles"), true));
|
|
||||||
mGuiController->Add(NEW MenuItem(MENUITEM_DECKEDITOR, mFont, "Deck Editor", 160, 50 + SCREEN_HEIGHT/2, mIcons[2], mIcons[3],"particle2.psi",resources.GetQuad("particles")));
|
|
||||||
mGuiController->Add(NEW MenuItem(MENUITEM_SHOP, mFont, "Shop", 240, 50 + SCREEN_HEIGHT/2, mIcons[0], mIcons[1],"particle3.psi",resources.GetQuad("particles")));
|
|
||||||
mGuiController->Add(NEW MenuItem(MENUITEM_OPTIONS, mFont, "Options", 320, 50 + SCREEN_HEIGHT/2, mIcons[6], mIcons[7],"particle4.psi",resources.GetQuad("particles")));
|
|
||||||
mGuiController->Add(NEW MenuItem(MENUITEM_EXIT, mFont, "Exit", 400, 50 + SCREEN_HEIGHT/2, mIcons[4], mIcons[5],"particle5.psi",resources.GetQuad("particles")));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (GameApp::HasMusic && !GameApp::music && options[Options::MUSICVOLUME].number > 0){
|
if (GameApp::HasMusic && !GameApp::music && options[Options::MUSICVOLUME].number > 0){
|
||||||
GameApp::music = resources.ssLoadMusic("Track0.mp3");
|
GameApp::music = resources.ssLoadMusic("Track0.mp3");
|
||||||
@@ -258,10 +256,7 @@ int GameStateMenu::nextDirectory(const char * root, const char * file){
|
|||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!mDit) {
|
if (!found) resetDirectory();
|
||||||
closedir(mDip);
|
|
||||||
mDip = NULL;
|
|
||||||
}
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,20 +268,69 @@ void GameStateMenu::End()
|
|||||||
SAFE_DELETE(mGuiController);
|
SAFE_DELETE(mGuiController);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string GameStateMenu::getLang(string s){
|
||||||
|
if (!s.size()) return "";
|
||||||
|
if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files
|
||||||
|
size_t found = s.find("#LANG:");
|
||||||
|
if (found != 0) return "";
|
||||||
|
return s.substr(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameStateMenu::setLang(int id){
|
||||||
|
options[Options::LANG].str = langs[id-1];
|
||||||
|
options.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameStateMenu::loadLangMenu(){
|
||||||
|
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||||
|
subMenuController = NEW SimpleMenu(103, this, mFont, 150,60);
|
||||||
|
if (!subMenuController) return;
|
||||||
|
resetDirectory();
|
||||||
|
if (!mDip){
|
||||||
|
mDip = opendir("Res/lang");
|
||||||
|
}
|
||||||
|
|
||||||
|
while (mDit = readdir(mDip)){
|
||||||
|
string filename = "Res/lang/";
|
||||||
|
filename += mDit->d_name;
|
||||||
|
std::ifstream file(filename.c_str());
|
||||||
|
string s;
|
||||||
|
string lang;
|
||||||
|
if(file){
|
||||||
|
if(std::getline(file,s)){
|
||||||
|
lang = getLang(s);
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
if (lang.size()){
|
||||||
|
string filen = mDit->d_name;
|
||||||
|
langs.push_back(filen.substr(0,filen.size()-4));
|
||||||
|
subMenuController->Add(langs.size(),lang.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resetDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
void GameStateMenu::Update(float dt)
|
void GameStateMenu::Update(float dt)
|
||||||
{
|
{
|
||||||
timeIndex += dt * 2;
|
timeIndex += dt * 2;
|
||||||
switch (MENU_STATE_MAJOR & currentState)
|
switch (MENU_STATE_MAJOR & currentState) {
|
||||||
{
|
case MENU_STATE_MAJOR_LANG :
|
||||||
|
if (MENU_STATE_MINOR_NONE == (currentState & MENU_STATE_MINOR)) {
|
||||||
|
if (!subMenuController) loadLangMenu();
|
||||||
|
}
|
||||||
|
subMenuController->Update(dt);
|
||||||
|
break;
|
||||||
case MENU_STATE_MAJOR_LOADING_CARDS :
|
case MENU_STATE_MAJOR_LOADING_CARDS :
|
||||||
if (mReadConf){
|
if (mReadConf){
|
||||||
mParent->collection->load(mCurrentSetFileName, mCurrentSetName);
|
mParent->collection->load(mCurrentSetFileName, mCurrentSetName);
|
||||||
}else{
|
}else{
|
||||||
mReadConf = 1;
|
mReadConf = 1;
|
||||||
|
Translator::GetInstance()->init();
|
||||||
}
|
}
|
||||||
if (!nextDirectory(RESPATH"/sets/","_cards.dat")){
|
if (!nextDirectory(RESPATH"/sets/","_cards.dat")){
|
||||||
|
//Remove temporary translations
|
||||||
|
Translator::GetInstance()->tempValues.clear();
|
||||||
|
|
||||||
//Force default, if necessary.
|
//Force default, if necessary.
|
||||||
if(options[Options::ACTIVE_PROFILE].str == "")
|
if(options[Options::ACTIVE_PROFILE].str == "")
|
||||||
@@ -301,9 +345,9 @@ void GameStateMenu::Update(float dt)
|
|||||||
std::ifstream file(options.profileFile(PLAYER_COLLECTION).c_str());
|
std::ifstream file(options.profileFile(PLAYER_COLLECTION).c_str());
|
||||||
if(file){
|
if(file){
|
||||||
file.close();
|
file.close();
|
||||||
currentState = MENU_STATE_MAJOR_MAINMENU | MENU_STATE_MINOR_NONE;
|
currentState = MENU_STATE_MAJOR_MAINMENU;
|
||||||
}else{
|
}else{
|
||||||
currentState = MENU_STATE_MAJOR_FIRST_TIME | MENU_STATE_MINOR_NONE;
|
currentState = MENU_STATE_MAJOR_FIRST_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reload list of unlocked sets, now that we know about the sets.
|
//Reload list of unlocked sets, now that we know about the sets.
|
||||||
@@ -322,12 +366,24 @@ void GameStateMenu::Update(float dt)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENU_STATE_MAJOR_FIRST_TIME :
|
case MENU_STATE_MAJOR_FIRST_TIME :
|
||||||
currentState = MENU_STATE_MAJOR_MAINMENU | MENU_STATE_MINOR_NONE;
|
currentState &= MENU_STATE_MAJOR_MAINMENU;
|
||||||
options.checkProfile(); //Handles building a new deck, if needed.
|
options.checkProfile(); //Handles building a new deck, if needed.
|
||||||
break;
|
break;
|
||||||
case MENU_STATE_MAJOR_MAINMENU :
|
case MENU_STATE_MAJOR_MAINMENU :
|
||||||
if (!scrollerSet) fillScroller();
|
if (!scrollerSet) fillScroller();
|
||||||
if (NULL != mGuiController)
|
if (!mGuiController) {
|
||||||
|
mGuiController = NEW JGuiController(100, this);
|
||||||
|
if (mGuiController) {
|
||||||
|
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||||
|
mFont->SetColor(ARGB(255,255,255,255));
|
||||||
|
mGuiController->Add(NEW MenuItem(MENUITEM_PLAY, mFont, "Play", 80, 50 + SCREEN_HEIGHT/2, mIcons[8], mIcons[9],"particle1.psi",resources.GetQuad("particles"), true));
|
||||||
|
mGuiController->Add(NEW MenuItem(MENUITEM_DECKEDITOR, mFont, "Deck Editor", 160, 50 + SCREEN_HEIGHT/2, mIcons[2], mIcons[3],"particle2.psi",resources.GetQuad("particles")));
|
||||||
|
mGuiController->Add(NEW MenuItem(MENUITEM_SHOP, mFont, "Shop", 240, 50 + SCREEN_HEIGHT/2, mIcons[0], mIcons[1],"particle3.psi",resources.GetQuad("particles")));
|
||||||
|
mGuiController->Add(NEW MenuItem(MENUITEM_OPTIONS, mFont, "Options", 320, 50 + SCREEN_HEIGHT/2, mIcons[6], mIcons[7],"particle4.psi",resources.GetQuad("particles")));
|
||||||
|
mGuiController->Add(NEW MenuItem(MENUITEM_EXIT, mFont, "Exit", 400, 50 + SCREEN_HEIGHT/2, mIcons[4], mIcons[5],"particle5.psi",resources.GetQuad("particles")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mGuiController)
|
||||||
mGuiController->Update(dt);
|
mGuiController->Update(dt);
|
||||||
break;
|
break;
|
||||||
case MENU_STATE_MAJOR_SUBMENU :
|
case MENU_STATE_MAJOR_SUBMENU :
|
||||||
@@ -335,38 +391,35 @@ void GameStateMenu::Update(float dt)
|
|||||||
mGuiController->Update(dt);
|
mGuiController->Update(dt);
|
||||||
break;
|
break;
|
||||||
case MENU_STATE_MAJOR_DUEL :
|
case MENU_STATE_MAJOR_DUEL :
|
||||||
if (MENU_STATE_MINOR_NONE == (currentState & MENU_STATE_MINOR))
|
if (MENU_STATE_MINOR_NONE == (currentState & MENU_STATE_MINOR)) {
|
||||||
{
|
if (!hasChosenGameType){
|
||||||
if (!hasChosenGameType){
|
currentState = MENU_STATE_MAJOR_SUBMENU;
|
||||||
currentState = MENU_STATE_MAJOR_SUBMENU;
|
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||||
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
subMenuController = NEW SimpleMenu(102, this, mFont, 150,60);
|
||||||
subMenuController = NEW SimpleMenu(102, this, mFont, 150,60);
|
if (subMenuController){
|
||||||
if (subMenuController){
|
subMenuController->Add(SUBMENUITEM_CLASSIC,"Classic");
|
||||||
subMenuController->Add(SUBMENUITEM_CLASSIC,"Classic");
|
if (options[Options::MOMIR_MODE_UNLOCKED].number)
|
||||||
if (options[Options::MOMIR_MODE_UNLOCKED].number)
|
subMenuController->Add(SUBMENUITEM_MOMIR, "Momir Basic");
|
||||||
subMenuController->Add(SUBMENUITEM_MOMIR, "Momir Basic");
|
if (options[Options::RANDOMDECK_MODE_UNLOCKED].number){
|
||||||
if (options[Options::RANDOMDECK_MODE_UNLOCKED].number){
|
subMenuController->Add(SUBMENUITEM_RANDOM1, "Random 1 Color");
|
||||||
subMenuController->Add(SUBMENUITEM_RANDOM1, "Random 1 Color");
|
subMenuController->Add(SUBMENUITEM_RANDOM2, "Random 2 Colors");
|
||||||
subMenuController->Add(SUBMENUITEM_RANDOM2, "Random 2 Colors");
|
}
|
||||||
|
subMenuController->Add(SUBMENUITEM_CANCEL, "Cancel");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
mParent->SetNextState(GAME_STATE_DUEL);
|
||||||
|
currentState = MENU_STATE_MAJOR_MAINMENU;
|
||||||
}
|
}
|
||||||
subMenuController->Add(SUBMENUITEM_CANCEL, "Cancel");
|
|
||||||
}
|
}
|
||||||
}else{
|
}
|
||||||
mParent->SetNextState(GAME_STATE_DUEL);
|
|
||||||
currentState = MENU_STATE_MAJOR_MAINMENU;
|
switch (MENU_STATE_MINOR & currentState){
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (MENU_STATE_MINOR & currentState)
|
|
||||||
{
|
|
||||||
case MENU_STATE_MINOR_SUBMENU_CLOSING :
|
case MENU_STATE_MINOR_SUBMENU_CLOSING :
|
||||||
if (subMenuController->closed)
|
if (subMenuController->closed) {
|
||||||
{
|
SAFE_DELETE(subMenuController);
|
||||||
SAFE_DELETE(subMenuController);
|
currentState &= ~MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
currentState &= ~MENU_STATE_MINOR_SUBMENU_CLOSING;
|
} else
|
||||||
}
|
subMenuController->Update(dt);
|
||||||
else
|
|
||||||
subMenuController->Update(dt);
|
|
||||||
break;
|
break;
|
||||||
case MENU_STATE_MINOR_NONE :
|
case MENU_STATE_MINOR_NONE :
|
||||||
;// Nothing to do.
|
;// Nothing to do.
|
||||||
@@ -411,7 +464,8 @@ void GameStateMenu::Render()
|
|||||||
JRenderer * renderer = JRenderer::GetInstance();
|
JRenderer * renderer = JRenderer::GetInstance();
|
||||||
renderer->ClearScreen(ARGB(0,0,0,0));
|
renderer->ClearScreen(ARGB(0,0,0,0));
|
||||||
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||||
if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LOADING_CARDS){
|
if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LANG){
|
||||||
|
}else if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LOADING_CARDS){
|
||||||
if(!splashTex){
|
if(!splashTex){
|
||||||
splashTex = resources.RetrieveTexture("splash.jpg",RETRIEVE_LOCK);
|
splashTex = resources.RetrieveTexture("splash.jpg",RETRIEVE_LOCK);
|
||||||
mSplash = resources.RetrieveTempQuad("splash.jpg");
|
mSplash = resources.RetrieveTempQuad("splash.jpg");
|
||||||
@@ -420,7 +474,12 @@ void GameStateMenu::Render()
|
|||||||
renderer->RenderQuad(mSplash,0,0);
|
renderer->RenderQuad(mSplash,0,0);
|
||||||
}else{
|
}else{
|
||||||
char text[512];
|
char text[512];
|
||||||
sprintf(text, _("LOADING SET: %s").c_str(), mCurrentSetName);
|
mFont->SetColor(ARGB(255,255,255,255));
|
||||||
|
if (mCurrentSetName[0]) {
|
||||||
|
sprintf(text, _("LOADING SET: %s").c_str(), mCurrentSetName);
|
||||||
|
}else{
|
||||||
|
sprintf(text,"LOADING...");
|
||||||
|
}
|
||||||
mFont->DrawString(text,SCREEN_WIDTH/2,SCREEN_HEIGHT/2,JGETEXT_CENTER);
|
mFont->DrawString(text,SCREEN_WIDTH/2,SCREEN_HEIGHT/2,JGETEXT_CENTER);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@@ -449,10 +508,11 @@ void GameStateMenu::Render()
|
|||||||
scroller->Render();
|
scroller->Render();
|
||||||
|
|
||||||
renderer->RenderQuad(mBg, SCREEN_WIDTH/2, 50);
|
renderer->RenderQuad(mBg, SCREEN_WIDTH/2, 50);
|
||||||
if (subMenuController){
|
|
||||||
subMenuController->Render();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (subMenuController){
|
||||||
|
subMenuController->Render();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,6 +526,11 @@ JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
|||||||
OutputDebugString(buf);
|
OutputDebugString(buf);
|
||||||
#endif
|
#endif
|
||||||
switch (controllerId){
|
switch (controllerId){
|
||||||
|
case 103:
|
||||||
|
setLang(controlId);
|
||||||
|
subMenuController->Close();
|
||||||
|
currentState = MENU_STATE_MAJOR_LOADING_CARDS | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||||
|
break;
|
||||||
case 101:
|
case 101:
|
||||||
options.createUsersFirstDeck(controlId);
|
options.createUsersFirstDeck(controlId);
|
||||||
currentState = MENU_STATE_MAJOR_MAINMENU | MENU_STATE_MINOR_NONE;
|
currentState = MENU_STATE_MAJOR_MAINMENU | MENU_STATE_MINOR_NONE;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "../include/config.h"
|
#include "../include/config.h"
|
||||||
#include "../include/MTGDeck.h"
|
#include "../include/MTGDeck.h"
|
||||||
#include "../include/utils.h"
|
#include "../include/utils.h"
|
||||||
|
#include "../include/Translate.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
using std::string;
|
using std::string;
|
||||||
@@ -320,6 +321,13 @@ int MTGAllCards::readConfLine(std::ifstream &file, int set_id){
|
|||||||
SAFE_DELETE(tempCard);
|
SAFE_DELETE(tempCard);
|
||||||
}else{
|
}else{
|
||||||
ids.push_back(newId);
|
ids.push_back(newId);
|
||||||
|
//translate cards text
|
||||||
|
Translator * t = Translator::GetInstance();
|
||||||
|
map<string,string>::iterator it = t->tempValues.find(tempCard->name);
|
||||||
|
if (it != t->tempValues.end()) {
|
||||||
|
tempCard->setText(it->second);
|
||||||
|
}
|
||||||
|
|
||||||
collection[newId] = tempCard;
|
collection[newId] = tempCard;
|
||||||
total_cards++;
|
total_cards++;
|
||||||
#if defined (_DEBUG)
|
#if defined (_DEBUG)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "../include/Translate.h"
|
#include "../include/Translate.h"
|
||||||
#include "../include/config.h"
|
#include "../include/config.h"
|
||||||
|
#include "../include/GameOptions.h"
|
||||||
#include <JGE.h>
|
#include <JGE.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -21,6 +22,7 @@ int Translator::Add(string from, string to){
|
|||||||
}
|
}
|
||||||
|
|
||||||
string Translator::translate(string value){
|
string Translator::translate(string value){
|
||||||
|
//if (!initDone) init();
|
||||||
map<string,string>::iterator it = values.find(value);
|
map<string,string>::iterator it = values.find(value);
|
||||||
if (it != values.end()) return it->second;
|
if (it != values.end()) return it->second;
|
||||||
#if defined DEBUG_TRANSLATE
|
#if defined DEBUG_TRANSLATE
|
||||||
@@ -50,13 +52,16 @@ Translator::~Translator(){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
Translator::Translator(){
|
Translator::Translator(){
|
||||||
#if defined DEBUG_TRANSLATE
|
initDone = false;
|
||||||
checkMisses = 0;
|
//init();
|
||||||
#endif
|
}
|
||||||
std::ifstream file("Res/lang/_lang.txt");
|
|
||||||
std::string s;
|
void Translator::load(string filename, map<string,string> * dictionary) {
|
||||||
|
std::ifstream file(filename.c_str());
|
||||||
|
|
||||||
if(file){
|
if(file){
|
||||||
|
string s;
|
||||||
|
initDone = true;
|
||||||
#if defined DEBUG_TRANSLATE
|
#if defined DEBUG_TRANSLATE
|
||||||
checkMisses = 1;
|
checkMisses = 1;
|
||||||
#endif
|
#endif
|
||||||
@@ -67,7 +72,7 @@ Translator::Translator(){
|
|||||||
if (found == string::npos) continue;
|
if (found == string::npos) continue;
|
||||||
string s1 = s.substr(0,found);
|
string s1 = s.substr(0,found);
|
||||||
string s2 = s.substr(found+1);
|
string s2 = s.substr(found+1);
|
||||||
Add(s1,s2);
|
(*dictionary)[s1] = s2;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
@@ -77,6 +82,7 @@ Translator::Translator(){
|
|||||||
std::ifstream file2("Res/lang/dontcare.txt");
|
std::ifstream file2("Res/lang/dontcare.txt");
|
||||||
|
|
||||||
if(file2){
|
if(file2){
|
||||||
|
string s;
|
||||||
while(std::getline(file2,s)){
|
while(std::getline(file2,s)){
|
||||||
if (!s.size()) continue;
|
if (!s.size()) continue;
|
||||||
if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files
|
if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files
|
||||||
@@ -88,7 +94,30 @@ Translator::Translator(){
|
|||||||
file2.close();
|
file2.close();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void Translator::initCards(){
|
||||||
|
string lang = options[Options::LANG].str;
|
||||||
|
if (!lang.size()) return;
|
||||||
|
string cards_dict = "Res/lang/" + lang + "_cards.txt";
|
||||||
|
load(cards_dict,&tempValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Translator::init() {
|
||||||
|
#if defined DEBUG_TRANSLATE
|
||||||
|
checkMisses = 0;
|
||||||
|
#endif
|
||||||
|
string lang = options[Options::LANG].str;
|
||||||
|
if (!lang.size()) return;
|
||||||
|
string name = "Res/lang/" + lang + ".txt";
|
||||||
|
|
||||||
|
if (fileExists(name.c_str())){
|
||||||
|
initDone = true;
|
||||||
|
load(name,&values);
|
||||||
|
}
|
||||||
|
|
||||||
|
initCards();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string _(string toTranslate){
|
string _(string toTranslate){
|
||||||
|
|||||||
Reference in New Issue
Block a user