3 Commits

9 changed files with 142 additions and 95 deletions

View File

@@ -190,8 +190,8 @@ CONTROLS DEL JUGADOR 1
## 63 - MENU DE OPCIONES
CONTROLS DEL JUGADOR 2
## 64 -
-
## 64 - MENU DE OPCIONES
(FORA DE LINEA)
## 65 -
-
@@ -259,8 +259,20 @@ ha iniciat la sesio
## 86 - NOTIFICACIONES
Punts enviats:
## 86 - NOTIFICACIONES
## 87 - NOTIFICACIONES
No s'ha pogut
## 87 - NOTIFICACIONES
enviar la puntuacio
## 88 - NOTIFICACIONES
enviar la puntuacio
## 89 - ENTER ID
CONFIGURACIO EN LINEA
## 90 - ENTER ID
INTRODUEIX UN JAILER_ID
## 91 - ENTER ID
O DEIXA BUIT PER A
## 92 - ENTER ID
MODE FORA DE LINEA

View File

@@ -190,8 +190,8 @@ PLAYER 1 CONTROLS
## 63 - MENU DE OPCIONES
PLAYER 2 CONTROLS
## 64 -
-
## 64 - MENU DE OPCIONES
(OFFLINE MODE)
## 65 -
-
@@ -259,8 +259,20 @@ is logged in
## 86 - NOTIFICACIONES
Score submitted
## 86 - NOTIFICACIONES
## 87 - NOTIFICACIONES
Failed to send
## 87 - NOTIFICACIONES
score to online server
## 88 - NOTIFICACIONES
score to online server
## 89 - ENTER ID
ONLINE CONFIGURATION
## 90 - ENTER ID
PLEASE ENTER AN ID
## 91 - ENTER ID
OR LEAVE BLANK FOR
## 92 - ENTER ID
OFFLINE MODE

View File

@@ -190,8 +190,8 @@ CONTROLES DEL JUGADOR 1
## 63 - MENU DE OPCIONES
CONTROLES DEL JUGADOR 2
## 64 -
-
## 64 - MENU DE OPCIONES
(MODO OFFLINE)
## 65 -
-
@@ -259,8 +259,20 @@ ha iniciado la sesion
## 86 - NOTIFICACIONES
Puntos enviados:
## 86 - NOTIFICACIONES
## 87 - NOTIFICACIONES
No se ha podido
## 87 - NOTIFICACIONES
enviar la puntuacion
## 88 - NOTIFICACIONES
enviar la puntuacion
## 89 - ENTER ID
CONFIGURACION ONLNE
## 90 - ENTER ID
INTRODUCE UN JAILER_ID
## 91 - ENTER ID
O DEJA EN BLANCO PARA
## 92 - ENTER ID
MODO OFFLINE

View File

@@ -21,11 +21,11 @@ centerY=96
selector_color=229,28,35,255
selector_text_color=255,241,118
defaultActionWhenCancel=13
defaultActionWhenCancel=14
[item]
text=DIFFICULTY
hPaddingDown=7
hPaddingDown=5
[/item]
[item]
@@ -38,7 +38,7 @@ linkedDown=true
[item]
text=KEYBOARD
hPaddingDown=7
hPaddingDown=5
selectable=false
greyed=false
[/item]
@@ -53,14 +53,14 @@ linkedDown=true
[item]
text=GAME CONTROLLER
hPaddingDown=7
hPaddingDown=5
selectable=false
greyed=false
[/item]
[item]
text=LANGUAGE
hPaddingDown=7
hPaddingDown=5
[/item]
[item]
@@ -73,7 +73,7 @@ linkedDown=true
[item]
text=WINDOW
hPaddingDown=7
hPaddingDown=5
selectable=false
greyed=false
[/item]
@@ -90,12 +90,17 @@ hPaddingDown=2
[item]
text=VSYNC
hPaddingDown=7
hPaddingDown=5
[/item]
[item]
text=HOW TO PLAY
hPaddingDown=7
hPaddingDown=5
[/item]
[item]
text=JAILERID:
hPaddingDown=5
[/item]
[item]

View File

@@ -741,7 +741,8 @@ void Director::initOnline()
#else
const std::string caption = options->online.jailerID;
#endif
screen->showNotification(caption, lang->getText(85), 12);
//screen->showNotification(caption, lang->getText(85), 12);
screen->showNotification(caption, lang->getText(85));
if (options->console)
{
std::cout << caption << std::endl;

View File

@@ -32,6 +32,7 @@ EnterID::EnterID(SDL_Renderer *renderer, Screen *screen, Asset *asset, Lang *lan
SDL_SetTextureBlendMode(textTexture, SDL_BLENDMODE_BLEND);
// Inicializa variables
oldJailerID = options->online.jailerID;
loopRunning = true;
counter = 0;
ticks = 0;
@@ -75,8 +76,8 @@ void EnterID::checkEvents()
break;
}
// El ENTER solo se comprueba cuando se suelta, para no saltarse la siguiente sección
if ((eventHandler->type == SDL_KEYUP && eventHandler->key.repeat == 0) || (eventHandler->type == SDL_JOYBUTTONUP))
// 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_RETURN)
{
@@ -84,11 +85,7 @@ void EnterID::checkEvents()
endSection();
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)
{ // Si pulsa una letra
if (pos < maxLenght)
@@ -183,9 +180,6 @@ void EnterID::render()
// Prepara para empezar a dibujar en la textura de juego
screen->start();
// Limpia la pantalla
screen->clean();
// Dibuja la textura con el texto en pantalla
SDL_RenderCopy(renderer, textTexture, nullptr, nullptr);
@@ -206,13 +200,13 @@ void EnterID::iniTexts()
texts.push_back({"", stringToColor(options->palette, "white")});
texts.push_back({"", stringToColor(options->palette, "white")});
texts.push_back({"", stringToColor(options->palette, "white")});
texts.push_back({"ONLINE CONFIGURATION:", stringToColor(options->palette, "red")});
texts.push_back({"", stringToColor(options->palette, "white")});
texts.push_back({"YOU HAVE NOT SPECIFIED ANY ID", stringToColor(options->palette, "white")});
texts.push_back({"FOR THE ONLINE SERVICE", stringToColor(options->palette, "white")});
texts.push_back({"", stringToColor(options->palette, "white")});
texts.push_back({"PLEASE ENTER AN ID OR", stringToColor(options->palette, "white")});
texts.push_back({"LEAVE BLANK FOR OFFLINE MODE", stringToColor(options->palette, "white")});
texts.push_back({lang->getText(89), stringToColor(options->palette, "red")});
texts.push_back({"", stringToColor(options->palette, "white")});
texts.push_back({lang->getText(90), stringToColor(options->palette, "white")});
texts.push_back({lang->getText(91), stringToColor(options->palette, "white")});
texts.push_back({lang->getText(92), stringToColor(options->palette, "white")});
texts.push_back({"", stringToColor(options->palette, "white")});
texts.push_back({"", stringToColor(options->palette, "white")});
texts.push_back({"", stringToColor(options->palette, "white")});
@@ -236,8 +230,7 @@ void EnterID::fillTexture()
// Rellena la textura de texto
SDL_SetRenderTarget(renderer, textTexture);
color_t c = stringToColor(options->palette, "black");
SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, 0xFF);
SDL_SetRenderDrawColor(renderer, bgColor.r, bgColor.g, bgColor.b, 0xFF);
SDL_RenderClear(renderer);
// Escribe el texto en la textura
@@ -256,60 +249,65 @@ void EnterID::fillTexture()
// Inicializa los servicios online
void EnterID::initOnline()
{
// Si ya ha iniciado la sesión y no ha cambiado el jailerID, que no continue
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 == "")
{ // Jailer ID no definido
options->online.enabled = false;
}
else
{ // Jailer ID iniciado
options->online.enabled = options->online.sessionEnabled = true;
// Establece el servidor y el puerto
jscore::init(options->online.server, options->online.port);
if (options->online.jailerID == "")
{ // Jailer ID no definido
options->online.enabled = false;
}
else
{ // Jailer ID iniciado
options->online.enabled = options->online.sessionEnabled = true;
// Establece el servidor y el puerto
jscore::init(options->online.server, options->online.port);
#ifdef DEBUG
const std::string caption = options->online.jailerID + " (DEBUG)";
const std::string caption = options->online.jailerID + " (DEBUG)";
#else
const std::string caption = options->online.jailerID;
const std::string caption = options->online.jailerID;
#endif
screen->showNotification(caption, lang->getText(85), 12);
if (options->console)
{
std::cout << caption << std::endl;
}
//screen->showNotification(caption, lang->getText(85), 12);
screen->showNotification(caption, lang->getText(85));
if (options->console)
{
std::cout << caption << std::endl;
}
// Obtiene la información de puntuaciones online
if (!jscore::initOnlineScore(options->online.gameID))
{
screen->showNotification(lang->getText(80), options->online.server);
if (options->console)
{
std::cout << "Can't connect to " << options->online.server << std::endl;
}
// Obtiene la información de puntuaciones online
if (!jscore::initOnlineScore(options->online.gameID))
{
screen->showNotification(lang->getText(80), options->online.server);
if (options->console)
{
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
const int points = jscore::getUserPoints(options->online.gameID, options->online.jailerID);
if (points == 0)
{ // Fallo de conexión o no hay registros
screen->showNotification(lang->getText(81), lang->getText(82));
if (options->console)
{
std::cout << "Can't get online scores" << std::endl;
}
}
else
{
options->online.score = points;
}
}
// Obten la puntuación online para el jailerID
const int points = jscore::getUserPoints(options->online.gameID, options->online.jailerID);
if (points == 0)
{ // Fallo de conexión o no hay registros
screen->showNotification(lang->getText(81), lang->getText(82));
if (options->console)
{
std::cout << "Can't get online scores" << std::endl;
}
}
else
{
options->online.score = points;
}
}
}
// Termina la sección
@@ -322,8 +320,6 @@ void EnterID::endSection()
// Inicializa el vector utilizado para almacenar el texto que se escribe en pantalla
void EnterID::initName()
{
std::cout << options->online.jailerID << std::endl;
// Calcula el tamaño del vector
name[0] = 0;
maxLenght = sizeof(name) / sizeof(name[pos]);
@@ -348,6 +344,4 @@ void EnterID::initName()
}
pos = len;
}
std::cout << (std::string)name << std::endl;
}

View File

@@ -41,9 +41,10 @@ private:
std::vector<captions_t> texts; // Vector con los textos
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
int pos; // Posición actual en el vector name
int maxLenght; // Tamaño máximo del jailerID
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 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
void update();

View File

@@ -20,7 +20,7 @@
class Lang
{
private:
Asset *mAsset; // Objeto que gestiona todos los ficheros de recursos
Asset *mAsset; // Objeto que gestiona todos los ficheros de recursos
std::string mTextStrings[MAX_TEXT_STRINGS]; // Vector con los textos
public:

View File

@@ -478,13 +478,18 @@ void Title::update()
runInstructions(m_manual);
break;
case 12: // ACCEPT
case 12: // JAILERID:
runEnterID();
updateMenuLabels();
break;
case 13: // ACCEPT
applyOptions();
menu.active->reset();
menu.active = menu.title;
break;
case 13: // CANCEL
case 14: // CANCEL
options = &optionsPrevious;
updateMenuLabels();
menu.active->reset();
@@ -921,6 +926,11 @@ void Title::updateMenuLabels()
// HOW TO PLAY
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++;
// ACCEPT
menu.options->setItemCaption(i, lang->getText(9)); // ACCEPT