Ya se puede cambiar el jailerID desde el menu de opciones
This commit is contained in:
@@ -190,8 +190,8 @@ CONTROLS DEL JUGADOR 1
|
|||||||
## 63 - MENU DE OPCIONES
|
## 63 - MENU DE OPCIONES
|
||||||
CONTROLS DEL JUGADOR 2
|
CONTROLS DEL JUGADOR 2
|
||||||
|
|
||||||
## 64 -
|
## 64 - MENU DE OPCIONES
|
||||||
-
|
(FORA DE LINEA)
|
||||||
|
|
||||||
## 65 -
|
## 65 -
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -190,8 +190,8 @@ PLAYER 1 CONTROLS
|
|||||||
## 63 - MENU DE OPCIONES
|
## 63 - MENU DE OPCIONES
|
||||||
PLAYER 2 CONTROLS
|
PLAYER 2 CONTROLS
|
||||||
|
|
||||||
## 64 -
|
## 64 - MENU DE OPCIONES
|
||||||
-
|
(OFFLINE MODE)
|
||||||
|
|
||||||
## 65 -
|
## 65 -
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -190,8 +190,8 @@ CONTROLES DEL JUGADOR 1
|
|||||||
## 63 - MENU DE OPCIONES
|
## 63 - MENU DE OPCIONES
|
||||||
CONTROLES DEL JUGADOR 2
|
CONTROLES DEL JUGADOR 2
|
||||||
|
|
||||||
## 64 -
|
## 64 - MENU DE OPCIONES
|
||||||
-
|
(MODO OFFLINE)
|
||||||
|
|
||||||
## 65 -
|
## 65 -
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ centerY=96
|
|||||||
selector_color=229,28,35,255
|
selector_color=229,28,35,255
|
||||||
selector_text_color=255,241,118
|
selector_text_color=255,241,118
|
||||||
|
|
||||||
defaultActionWhenCancel=13
|
defaultActionWhenCancel=14
|
||||||
|
|
||||||
[item]
|
[item]
|
||||||
text=DIFFICULTY
|
text=DIFFICULTY
|
||||||
hPaddingDown=7
|
hPaddingDown=5
|
||||||
[/item]
|
[/item]
|
||||||
|
|
||||||
[item]
|
[item]
|
||||||
@@ -38,7 +38,7 @@ linkedDown=true
|
|||||||
|
|
||||||
[item]
|
[item]
|
||||||
text=KEYBOARD
|
text=KEYBOARD
|
||||||
hPaddingDown=7
|
hPaddingDown=5
|
||||||
selectable=false
|
selectable=false
|
||||||
greyed=false
|
greyed=false
|
||||||
[/item]
|
[/item]
|
||||||
@@ -53,14 +53,14 @@ linkedDown=true
|
|||||||
|
|
||||||
[item]
|
[item]
|
||||||
text=GAME CONTROLLER
|
text=GAME CONTROLLER
|
||||||
hPaddingDown=7
|
hPaddingDown=5
|
||||||
selectable=false
|
selectable=false
|
||||||
greyed=false
|
greyed=false
|
||||||
[/item]
|
[/item]
|
||||||
|
|
||||||
[item]
|
[item]
|
||||||
text=LANGUAGE
|
text=LANGUAGE
|
||||||
hPaddingDown=7
|
hPaddingDown=5
|
||||||
[/item]
|
[/item]
|
||||||
|
|
||||||
[item]
|
[item]
|
||||||
@@ -73,7 +73,7 @@ linkedDown=true
|
|||||||
|
|
||||||
[item]
|
[item]
|
||||||
text=WINDOW
|
text=WINDOW
|
||||||
hPaddingDown=7
|
hPaddingDown=5
|
||||||
selectable=false
|
selectable=false
|
||||||
greyed=false
|
greyed=false
|
||||||
[/item]
|
[/item]
|
||||||
@@ -90,12 +90,17 @@ hPaddingDown=2
|
|||||||
|
|
||||||
[item]
|
[item]
|
||||||
text=VSYNC
|
text=VSYNC
|
||||||
hPaddingDown=7
|
hPaddingDown=5
|
||||||
[/item]
|
[/item]
|
||||||
|
|
||||||
[item]
|
[item]
|
||||||
text=HOW TO PLAY
|
text=HOW TO PLAY
|
||||||
hPaddingDown=7
|
hPaddingDown=5
|
||||||
|
[/item]
|
||||||
|
|
||||||
|
[item]
|
||||||
|
text=JAILERID:
|
||||||
|
hPaddingDown=5
|
||||||
[/item]
|
[/item]
|
||||||
|
|
||||||
[item]
|
[item]
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lan
|
|||||||
SDL_SetTextureBlendMode(textTexture, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(textTexture, SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
// Inicializa variables
|
// Inicializa variables
|
||||||
|
oldJailerID = options->online.jailerID;
|
||||||
loopRunning = true;
|
loopRunning = true;
|
||||||
counter = 0;
|
counter = 0;
|
||||||
ticks = 0;
|
ticks = 0;
|
||||||
@@ -75,8 +76,8 @@ void EnterID::checkEvents()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// El ENTER solo se comprueba cuando se suelta, para no saltarse la siguiente sección
|
// Comprueba las teclas que se han pulsado
|
||||||
if ((eventHandler->type == SDL_KEYUP && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONUP))
|
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
||||||
{
|
{
|
||||||
if (eventHandler->key.keysym.scancode == SDL_SCANCODE_RETURN)
|
if (eventHandler->key.keysym.scancode == SDL_SCANCODE_RETURN)
|
||||||
{
|
{
|
||||||
@@ -84,11 +85,7 @@ void EnterID::checkEvents()
|
|||||||
endSection();
|
endSection();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Comprueba las teclas que se han pulsado
|
|
||||||
if ((eventHandler->type == SDL_KEYDOWN && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONDOWN))
|
|
||||||
{
|
|
||||||
if (eventHandler->key.keysym.scancode >= SDL_SCANCODE_A && eventHandler->key.keysym.scancode <= SDL_SCANCODE_Z)
|
if (eventHandler->key.keysym.scancode >= SDL_SCANCODE_A && eventHandler->key.keysym.scancode <= SDL_SCANCODE_Z)
|
||||||
{ // Si pulsa una letra
|
{ // Si pulsa una letra
|
||||||
if (pos < maxLenght)
|
if (pos < maxLenght)
|
||||||
@@ -256,60 +253,65 @@ void EnterID::fillTexture()
|
|||||||
// Inicializa los servicios online
|
// Inicializa los servicios online
|
||||||
void EnterID::initOnline()
|
void EnterID::initOnline()
|
||||||
{
|
{
|
||||||
|
// Si ya ha iniciado la sesión y no ha cambiado el jailerID, que no continue
|
||||||
if (options->online.sessionEnabled)
|
if (options->online.sessionEnabled)
|
||||||
{ // Si ya ha iniciado la sesión, que no continue
|
{
|
||||||
return;
|
if (oldJailerID == options->online.jailerID)
|
||||||
}
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (options->online.jailerID == "")
|
if (options->online.jailerID == "")
|
||||||
{ // Jailer ID no definido
|
{ // Jailer ID no definido
|
||||||
options->online.enabled = false;
|
options->online.enabled = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Jailer ID iniciado
|
{ // Jailer ID iniciado
|
||||||
options->online.enabled = options->online.sessionEnabled = true;
|
options->online.enabled = options->online.sessionEnabled = true;
|
||||||
// Establece el servidor y el puerto
|
// Establece el servidor y el puerto
|
||||||
jscore::init(options->online.server, options->online.port);
|
jscore::init(options->online.server, options->online.port);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
const std::string caption = options->online.jailerID + " (DEBUG)";
|
const std::string caption = options->online.jailerID + " (DEBUG)";
|
||||||
#else
|
#else
|
||||||
const std::string caption = options->online.jailerID;
|
const std::string caption = options->online.jailerID;
|
||||||
#endif
|
#endif
|
||||||
screen->showNotification(caption, lang->getText(85), 12);
|
//screen->showNotification(caption, lang->getText(85), 12);
|
||||||
if (options->console)
|
screen->showNotification(caption, lang->getText(85));
|
||||||
{
|
if (options->console)
|
||||||
std::cout << caption << std::endl;
|
{
|
||||||
}
|
std::cout << caption << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Obtiene la información de puntuaciones online
|
// Obtiene la información de puntuaciones online
|
||||||
if (!jscore::initOnlineScore(options->online.gameID))
|
if (!jscore::initOnlineScore(options->online.gameID))
|
||||||
{
|
{
|
||||||
screen->showNotification(lang->getText(80), options->online.server);
|
screen->showNotification(lang->getText(80), options->online.server);
|
||||||
if (options->console)
|
if (options->console)
|
||||||
{
|
{
|
||||||
std::cout << "Can't connect to " << options->online.server << std::endl;
|
std::cout << "Can't connect to " << options->online.server << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
options->online.enabled = false;
|
options->online.enabled = false;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obten la puntuación online para el jailerID
|
// Obten la puntuación online para el jailerID
|
||||||
const int points = jscore::getUserPoints(options->online.gameID, options->online.jailerID);
|
const int points = jscore::getUserPoints(options->online.gameID, options->online.jailerID);
|
||||||
if (points == 0)
|
if (points == 0)
|
||||||
{ // Fallo de conexión o no hay registros
|
{ // Fallo de conexión o no hay registros
|
||||||
screen->showNotification(lang->getText(81), lang->getText(82));
|
screen->showNotification(lang->getText(81), lang->getText(82));
|
||||||
if (options->console)
|
if (options->console)
|
||||||
{
|
{
|
||||||
std::cout << "Can't get online scores" << std::endl;
|
std::cout << "Can't get online scores" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
options->online.score = points;
|
options->online.score = points;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Termina la sección
|
// Termina la sección
|
||||||
|
|||||||
@@ -41,9 +41,10 @@ private:
|
|||||||
std::vector<captions_t> texts; // Vector con los textos
|
std::vector<captions_t> texts; // Vector con los textos
|
||||||
std::string cursor; // Contiene el caracter que se muestra como cursor
|
std::string cursor; // Contiene el caracter que se muestra como cursor
|
||||||
|
|
||||||
char name[15]; // Aqui se guardan los caracteres de las teclas que se van pulsando
|
char name[15]; // Aqui se guardan los caracteres de las teclas que se van pulsando
|
||||||
int pos; // Posición actual en el vector name
|
int pos; // Posición actual en el vector name
|
||||||
int maxLenght; // Tamaño máximo del jailerID
|
int maxLenght; // Tamaño máximo del jailerID
|
||||||
|
std::string oldJailerID; // Almacena el valor de jailerID al inicio para ver si se ha modificado
|
||||||
|
|
||||||
// Actualiza las variables
|
// Actualiza las variables
|
||||||
void update();
|
void update();
|
||||||
|
|||||||
@@ -478,13 +478,18 @@ void Title::update()
|
|||||||
runInstructions(m_manual);
|
runInstructions(m_manual);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 12: // ACCEPT
|
case 12: // JAILERID:
|
||||||
|
runEnterID();
|
||||||
|
updateMenuLabels();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 13: // ACCEPT
|
||||||
applyOptions();
|
applyOptions();
|
||||||
menu.active->reset();
|
menu.active->reset();
|
||||||
menu.active = menu.title;
|
menu.active = menu.title;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 13: // CANCEL
|
case 14: // CANCEL
|
||||||
options = &optionsPrevious;
|
options = &optionsPrevious;
|
||||||
updateMenuLabels();
|
updateMenuLabels();
|
||||||
menu.active->reset();
|
menu.active->reset();
|
||||||
@@ -921,6 +926,11 @@ void Title::updateMenuLabels()
|
|||||||
// HOW TO PLAY
|
// HOW TO PLAY
|
||||||
menu.options->setItemCaption(i, lang->getText(2));
|
menu.options->setItemCaption(i, lang->getText(2));
|
||||||
|
|
||||||
|
i++;
|
||||||
|
// JAILERID;
|
||||||
|
const std::string jailerID = options->online.jailerID == "" ? lang->getText(64) : options->online.jailerID;
|
||||||
|
menu.options->setItemCaption(i, "JAILERID: " + jailerID);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
// ACCEPT
|
// ACCEPT
|
||||||
menu.options->setItemCaption(i, lang->getText(9)); // ACCEPT
|
menu.options->setItemCaption(i, lang->getText(9)); // ACCEPT
|
||||||
|
|||||||
Reference in New Issue
Block a user