options menu completed

This commit is contained in:
2021-08-29 13:35:19 +02:00
parent 697e5d796f
commit 88e5303d28
9 changed files with 167 additions and 73 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -47,7 +47,7 @@ PREM UNA TECLA PER A TORNAR
## 23 - TITULO
PREM QUALSEVOL TECLA
## 24 - MENU SELECCION DE IDIOMA
ESPA^OL (ESPANYOL)
ESPA{OL (ESPANYOL)
## 25 - MENU SELECCION DE IDIOMA
BALOONCIA
## 26 - MENU SELECCION DE IDIOMA
@@ -105,12 +105,46 @@ FELICITATS!!
## 52 - MENU DEL TITULO
2 JUGADORS
## 53 MARCADOR
jugador 2
jugador 1
## 54 MARCADOR
jugador 2
## 55 MARCADOR
mult -
mult
## 56 MARCADOR
max. puntuacio -
max. puntuacio
## 57 MARCADOR
nivell
## 58 - MENU DE OPCIONES
MODE DE VISUALITZACIO
## 59 - MENU DE OPCIONES
DIFICULTAT
## 60 - MENU DE OPCIONES
FILTRE
## 61 - MENU DE OPCIONES
SINC. VERTICAL
## 62 - MENU DE OPCIONES
CONTROLS DEL JUGADOR 1
## 63 - MENU DE OPCIONES
CONTROLS DEL JUGADOR 2
## 64 - MENU DE OPCIONES
TECLAT
## 65 - MENU DE OPCIONES
MANDO
## 66 - MENU DE OPCIONES
FACIL
## 67 - MENU DE OPCIONES
NORMAL
## 68 - MENU DE OPCIONES
DIFICIL
## 69 - MENU DE OPCIONES
TECLAT
## 70 - MENU DE OPCIONES
MANDO
## 71 - MENU DE OPCIONES
LINEAL
## 72 - MENU DE OPCIONES
NEAREST
## 73 - MENU DE OPCIONES
ACTIVADA
## 74 - MENU DE OPCIONES
DESACTIVADA

View File

@@ -47,7 +47,7 @@ PRESS ANY KEY TO RETURN
## 23 - TITULO
PRESS ANY KEY
## 24 - MENU SELECCION DE IDIOMA
ESPA^OL (SPANISH)
ESPA{OL (SPANISH)
## 25 - MENU SELECCION DE IDIOMA
BALOONCIA (VALENCIAN)
## 26 - MENU SELECCION DE IDIOMA
@@ -141,9 +141,9 @@ KEYBOARD
## 70 - MENU DE OPCIONES
GAME CONTROLLER
## 71 - MENU DE OPCIONES
BILINEAL
## 72 - MENU DE OPCIONES
LINEAL
## 72 - MENU DE OPCIONES
NEAREST
## 73 - MENU DE OPCIONES
ON
## 74 - MENU DE OPCIONES

View File

@@ -13,7 +13,7 @@ PANTALLA COMPLETA
## 6 - MENU DE OPCIONES
PANTALLA COMPLETA FALSA
## 7 - MENU DE OPCIONES
TAMA^O DE VENTANA
TAMA{O DE VENTANA
## 8 - MENU DE OPCIONES
IDIOMA
## 9 - MENU DE OPCIONES
@@ -47,13 +47,13 @@ PULSA UNA TECLA PARA VOLVER
## 23 - TITULO
PULSA CUALQUIER TECLA
## 24 - MENU SELECCION DE IDIOMA
ESPA^OL
ESPA{OL
## 25 - MENU SELECCION DE IDIOMA
BALOONCIA (VALENCIANO)
## 26 - MENU SELECCION DE IDIOMA
ENGLISH (INGLES)
## 27 - INTRO
Un dia cualquiera del a^o 2000
Un dia cualquiera del a{o 2000
## 28 - INTRO
Todo esta tranquilo en la UPV
## 29 - INTRO
@@ -104,13 +104,47 @@ FELICIDADES!!
1 JUGADOR
## 52 - MENU DEL TITULO
2 JUGADORES
## 53 MARCADOR
## 53 - MARCADOR
jugador 1
## 54 MARCADOR
## 54 - MARCADOR
jugador 2
## 55 MARCADOR
## 55 - MARCADOR
mult -
## 56 MARCADOR
## 56 - MARCADOR
max. puntuacion -
## 57 MARCADOR
## 57 - MARCADOR
fase
## 58 - MENU DE OPCIONES
MODO DE VISUALIZACION
## 59 - MENU DE OPCIONES
DIFICULTAD
## 60 - MENU DE OPCIONES
FILTRO
## 61 - MENU DE OPCIONES
SINC. VERTICAL
## 62 - MENU DE OPCIONES
CONTROLES DEL JUGADOR 1
## 63 - MENU DE OPCIONES
CONTROLES DEL JUGADOR 2
## 64 - MENU DE OPCIONES
TECLADO
## 65 - MENU DE OPCIONES
MANDO
## 66 - MENU DE OPCIONES
FACIL
## 67 - MENU DE OPCIONES
NORMAL
## 68 - MENU DE OPCIONES
DIFICIL
## 69 - MENU DE OPCIONES
TECLADO
## 70 - MENU DE OPCIONES
MANDO
## 71 - MENU DE OPCIONES
LINEAL
## 72 - MENU DE OPCIONES
NEAREST
## 73 - MENU DE OPCIONES
ACTIVADA
## 74 - MENU DE OPCIONES
DESACTIVADA

View File

@@ -352,7 +352,7 @@ const color_t shdwTxtColor = {0x43, 0x43, 0x4F};
#define DIFFICULTY_HARD 2
// Tipo de filtro
#define FILTER_BILINEAL 0
#define FILTER_NEAREST 0
#define FILTER_LINEAL 1
#endif

View File

@@ -2,6 +2,7 @@
#include "utils.h"
#include "director.h"
#include <iostream>
#include <string>
#ifdef __MIPSEL__
#include <sys/stat.h>
#include <dirent.h>
@@ -31,13 +32,10 @@ Director::Director(std::string path)
mOptions->fullScreenMode = 0;
mOptions->windowSize = 3;
mOptions->language = en_UK;
mOptions->fullScreenMode = 0;
mOptions->windowSize = 3;
mOptions->language = en_UK;
mOptions->difficulty = 0;
mOptions->difficulty = DIFFICULTY_NORMAL;
mOptions->player1Input = INPUT_USE_KEYBOARD;
mOptions->player2Input = INPUT_USE_GAMECONTROLLER;
mOptions->filter = 0;
mOptions->filter = FILTER_NEAREST;
mOptions->vSync = true;
}
@@ -155,7 +153,7 @@ bool Director::initSDL()
else
{
// Establece el filtro de la textura a nearest
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"))
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(mOptions->filter).c_str()))
{
printf("Warning: Nearest texture filtering not enabled!\n");
}
@@ -169,8 +167,12 @@ bool Director::initSDL()
}
else
{
// Crea un renderizador para la ventana con vsync
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
if (mOptions->vSync)
mRenderer = SDL_CreateRenderer(mWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
else
mRenderer = SDL_CreateRenderer(mWindow, -1, SDL_RENDERER_ACCELERATED);
if (mRenderer == NULL)
{
printf("Renderer could not be created!\nSDL Error: %s\n", SDL_GetError());
@@ -420,7 +422,7 @@ bool Director::loadConfigFile()
mOptions->difficulty = DIFFICULTY_NORMAL;
mOptions->player1Input = INPUT_USE_KEYBOARD;
mOptions->player2Input = INPUT_USE_GAMECONTROLLER;
mOptions->filter = 0;
mOptions->filter = FILTER_NEAREST;
mOptions->vSync = true;
// Indicador de éxito en la carga

View File

@@ -1613,40 +1613,48 @@ void Game::renderScoreBoard()
mSpritePowerMeter->setSpriteClip(296, 184, (int)percent, 8);
mSpritePowerMeter->render();
*/
const int offset1 = 163;
const int offset2 = offset1 + 8;
const int offset3 = offset2 + 8;
//const int offset4 = offset3 + 8;
const int offset1 = 162;
const int offset2 = offset1 + 7;
const int offset3 = offset2 + 7;
const int offset4 = offset3 + 7;
const int offsetLeft = PLAY_AREA_LEFT + 45;
const int offsetRight = PLAY_AREA_RIGHT - 45;
// PLAYER1 - SCORE
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset1, mLang->getText(53));
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset2, updateScoreText(mPlayer[0]->getScore()));
mTextScoreBoard->writeCentered(offsetLeft, offset1, mLang->getText(53));
mTextScoreBoard->writeCentered(offsetLeft, offset2, updateScoreText(mPlayer[0]->getScore()));
// PLAYER1 - MULT
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset3, mLang->getText(55) + std::to_string(mPlayer[0]->getScoreMultiplier()).substr(0, 3));
mTextScoreBoard->writeCentered(offsetLeft, offset3, mLang->getText(55));
mTextScoreBoard->writeCentered(offsetLeft, offset4, std::to_string(mPlayer[0]->getScoreMultiplier()).substr(0, 3));
if (mNumPlayers == 2)
{
// PLAYER2 - SCORE
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset1, mLang->getText(54));
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset2, updateScoreText(mPlayer[1]->getScore()));
mTextScoreBoard->writeCentered(offsetRight, offset1, mLang->getText(54));
mTextScoreBoard->writeCentered(offsetRight, offset2, updateScoreText(mPlayer[1]->getScore()));
// PLAYER2 - MULT
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset3, mLang->getText(55) + std::to_string(mPlayer[1]->getScoreMultiplier()).substr(0, 3));
mTextScoreBoard->writeCentered(offsetRight, offset3, mLang->getText(55));
mTextScoreBoard->writeCentered(offsetRight, offset4, std::to_string(mPlayer[1]->getScoreMultiplier()).substr(0, 3));
}
else
{
// PLAYER2 - SCORE
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset1, mLang->getText(54));
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset2, "0000000");
mTextScoreBoard->writeCentered(offsetRight, offset1, mLang->getText(54));
mTextScoreBoard->writeCentered(offsetRight, offset2, "0000000");
// PLAYER2 - MULT
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset3, mLang->getText(55) + "1.0");
mTextScoreBoard->writeCentered(offsetRight, offset3, mLang->getText(55));
mTextScoreBoard->writeCentered(offsetRight, offset4, "1.0");
}
// STAGE
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1 - 1, mLang->getText(57) + std::to_string(mStage[mCurrentStage].number));
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1, mLang->getText(57) + std::to_string(mStage[mCurrentStage].number));
// POWER
mSpritePowerMeter->setPosY(offset2);
mSpritePowerMeter->setSpriteClip(256, 184, 40, 8);
mSpritePowerMeter->render();
const float percent = (mStage[mCurrentStage].currentPower * 40.0f) / mStage[mCurrentStage].powerToComplete;
@@ -1654,7 +1662,8 @@ void Game::renderScoreBoard()
mSpritePowerMeter->render();
// HI-SCORE
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3 + 1, mLang->getText(56) + updateScoreText(mHiScore));
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3, mLang->getText(56));
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, updateScoreText(mHiScore));
}
// Actualiza las variables del jugador

View File

@@ -286,8 +286,10 @@ circle_t &Item::getCollider()
// Alinea el circulo de colisión con la posición del objeto
void Item::shiftColliders()
{
mCollider.x = int(mPosX + mCollider.r);
mCollider.y = int(mPosY + mCollider.r);
//mCollider.x = int(mPosX + mCollider.r);
//mCollider.y = int(mPosY + mCollider.r);
mCollider.x = int(mPosX + (mWidth / 2));
mCollider.y = int(mPosY + (mHeight / 2));
}
// Informa si el objeto ha colisionado con el suelo

View File

@@ -274,9 +274,10 @@ void Title::init(bool demo, Uint8 subsection)
mMenu.options->addItem(mLang->getText(7)); // (8) WINDOW SIZE
mMenu.options->addItem(mLang->getText(60)); // (9) FILTER
mMenu.options->addItem(mLang->getText(61), 0, 5); // (10) VSYNC
mMenu.options->addItem(mLang->getText(9)); // (11) ACCEPT
mMenu.options->addItem(mLang->getText(10)); // (12) CANCEL
mMenu.options->setDefaultActionWhenCancel(9);
mMenu.options->addItem(mLang->getText(2), 0, 5); // (11) HOW TO PLAY
mMenu.options->addItem(mLang->getText(9)); // (12) ACCEPT
mMenu.options->addItem(mLang->getText(10)); // (13) CANCEL
mMenu.options->setDefaultActionWhenCancel(13);
mMenu.options->setBackgroundColor(0x30, 0x30, 0x40, 192);
mMenu.options->setSelectorColor(0xe5, 0x1c, 0x23, 255);
mMenu.options->setSelectorTextColor(0xFF, 0xF1, 0x76);
@@ -353,8 +354,12 @@ void Title::updateMenuLabels()
break;
}
i = 2;
i++;
// PLAYER 1 CONTROLS
mMenu.options->setItemCaption(i, mLang->getText(62));
i++;
// PLAYER 1 CONTROLS - OPTIONS
switch (mOptions->player1Input)
{
case INPUT_USE_KEYBOARD:
@@ -370,8 +375,12 @@ void Title::updateMenuLabels()
break;
}
i = 4;
i++;
// PLAYER 2 CONTROLS
mMenu.options->setItemCaption(i, mLang->getText(63));
i++;
// PLAYER 2 CONTROLS - OPTIONS
switch (mOptions->player2Input)
{
case INPUT_USE_KEYBOARD:
@@ -408,8 +417,12 @@ void Title::updateMenuLabels()
break;
}
i = 7;
i++;
// DISPLAY MODE
mMenu.options->setItemCaption(i, mLang->getText(58));
i++;
// DISPLAY MODE - OPTIONS
switch (mOptions->fullScreenMode)
{
case 0:
@@ -435,7 +448,7 @@ void Title::updateMenuLabels()
i++;
// FILTER
if (mOptions->filter == FILTER_BILINEAL)
if (mOptions->filter == FILTER_LINEAL)
mMenu.options->setItemCaption(i, mLang->getText(60) + ": " + mLang->getText(71)); // BILINEAL
else
mMenu.options->setItemCaption(i, mLang->getText(60) + ": " + mLang->getText(72)); // LINEAL
@@ -447,6 +460,10 @@ void Title::updateMenuLabels()
else
mMenu.options->setItemCaption(i, mLang->getText(61) + ": " + mLang->getText(74)); // OFF
i++;
// HOW TO PLAY
mMenu.options->setItemCaption(i, mLang->getText(2));
i++;
// ACCEPT
mMenu.options->setItemCaption(i, mLang->getText(9)); // ACCEPT
@@ -462,7 +479,6 @@ void Title::updateMenuLabels()
mMenu.title->setItemCaption(0, mLang->getText(51)); // 1 PLAYER
mMenu.title->setItemCaption(1, mLang->getText(52)); // 2 PLAYERS
mMenu.title->setItemCaption(2, mLang->getText(1)); // OPTIONS
//mMenu.title->setItemCaption(3, mLang->getText(2)); // HOW TO PLAY
mMenu.title->setItemCaption(3, mLang->getText(3)); // QUIT
mMenu.title->centerMenuOnX(SCREEN_CENTER_X);
@@ -707,13 +723,7 @@ section_t Title::run(Uint8 subsection)
case 2: // OPTIONS
mMenu.active = mMenu.options;
mOptionsPrevious = *mOptions;
//mOptions->fullScreenModePrevious = mOptions->fullScreenMode;
//mOptions->windowSizePrevious = mOptions->windowSize;
//mOptions->languagePrevious = mOptions->language;
break;
//case 3: // HOW TO PLAY
// runInstructions(INSTRUCTIONS_MODE_MANUAL);
// break;
case 3: // QUIT
mPostFade = 2;
mFade->activateFade();
@@ -773,10 +783,10 @@ section_t Title::run(Uint8 subsection)
updateMenuLabels();
break;
case 9: // FILTER
if (mOptions->filter == FILTER_BILINEAL)
mOptions->filter = FILTER_LINEAL;
if (mOptions->filter == FILTER_LINEAL)
mOptions->filter = FILTER_NEAREST;
else
mOptions->filter = FILTER_BILINEAL;
mOptions->filter = FILTER_LINEAL;
updateMenuLabels();
break;
case 10: // VSYNC
@@ -786,16 +796,16 @@ section_t Title::run(Uint8 subsection)
mOptions->vSync = true;
updateMenuLabels();
break;
case 11: // ACCEPT
case 11: // HOW TO PLAY
runInstructions(INSTRUCTIONS_MODE_MANUAL);
break;
case 12: // ACCEPT
applyOptions();
mMenu.active->reset();
mMenu.active = mMenu.title;
break;
case 12: // CANCEL
case 13: // CANCEL
mOptions = &mOptionsPrevious;
//mOptions->fullScreenMode = mOptions->fullScreenModePrevious;
//mOptions->windowSize = mOptions->windowSizePrevious;
//mOptions->language = mOptions->languagePrevious;
updateMenuLabels();
mMenu.active->reset();
mMenu.active = mMenu.title;
@@ -825,11 +835,17 @@ section_t Title::run(Uint8 subsection)
// Dibuja los objetos
if (mMenu.active->getName() != "OPTIONS")
{
// Bitmaps con el logo/titulo del juego
mCoffeeBitmap->render();
mCrisisBitmap->render();
// Texto con el copyright y versión
mText2->writeDX(TXT_CENTER | TXT_SHADOW, SCREEN_CENTER_X, SCREEN_HEIGHT - (BLOCK * 2), TEXT_COPYRIGHT, 1, noColor, 1, shdwTxtColor);
}
if (mMenuVisible == true)
mMenu.active->render();
mDustBitmapR->animate(0);
mDustBitmapL->animate(0);
mDustBitmapR->render();
@@ -839,9 +855,6 @@ section_t Title::run(Uint8 subsection)
if ((mCounter % 50 > 14) && (mMenuVisible == false))
mText->writeDX(TXT_CENTER | TXT_SHADOW, SCREEN_CENTER_X, PLAY_AREA_THIRD_QUARTER_Y + BLOCK, mLang->getText(23), 1, noColor, 1, shdwTxtColor);
// Texto con el copyright y versión
mText2->writeDX(TXT_CENTER | TXT_SHADOW, SCREEN_CENTER_X, SCREEN_HEIGHT - (BLOCK * 2), TEXT_COPYRIGHT, 1, noColor, 1, shdwTxtColor);
// Fade
mFade->render();