forked from jaildesigner-jailgames/jaildoctors_dilemma
Eliminat TOT el online i merdes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "gamestate_title.h"
|
||||
|
||||
// Constructor
|
||||
Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, Online *online, options_t *options, section_t *section)
|
||||
Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, Input *input, options_t *options, section_t *section)
|
||||
{
|
||||
// Copia la dirección de los objetos
|
||||
this->resource = resource;
|
||||
@@ -9,13 +9,12 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *
|
||||
this->screen = screen;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->online = online;
|
||||
this->options = options;
|
||||
this->section = section;
|
||||
|
||||
// Reserva memoria para los punteros
|
||||
eventHandler = new SDL_Event();
|
||||
cheevos = new Cheevos(screen, options, asset->get("cheevos.bin"), online);
|
||||
cheevos = new Cheevos(screen, options, asset->get("cheevos.bin"));
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
texture = resource->getTexture("title_logo.png");
|
||||
@@ -125,14 +124,6 @@ void Title::checkEvents()
|
||||
showCheevos = true;
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_3:
|
||||
runEnterID();
|
||||
counter = 0;
|
||||
cheevos->reload();
|
||||
fillTexture();
|
||||
createCheevosTexture();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -257,8 +248,6 @@ void Title::renderMarquee()
|
||||
// Dibuja la linea de información inferior
|
||||
void Title::renderInfo()
|
||||
{
|
||||
const std::string loginText = options->online.enabled ? "OnLine: " + options->online.jailerID : "OnLine: OFF";
|
||||
infoText->write(1, 1, loginText);
|
||||
const std::string version = "v.1.09";
|
||||
const int x = GAMECANVAS_WIDTH - infoText->lenght(version) - 1;
|
||||
infoText->write(x, 1, version);
|
||||
@@ -375,12 +364,10 @@ void Title::reLoadTextures()
|
||||
// Carga la textura adecuada
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
// texture->loadFromFile(asset->get("loading_screen_color.png"), renderer);
|
||||
texture = resource->getTexture("loading_screen_color.png");
|
||||
}
|
||||
else if (options->palette == p_zxarne)
|
||||
{
|
||||
// texture->loadFromFile(asset->get("loading_screen_color_zxarne.png"), renderer);
|
||||
texture = resource->getTexture("loading_screen_color_zxarne.png");
|
||||
}
|
||||
|
||||
@@ -413,21 +400,17 @@ void Title::moveCheevosList(int direction)
|
||||
|
||||
const int bottom = cheevosTexture->getHeight() - cheevosTextureView.h;
|
||||
if (cheevosTextureView.y < 0)
|
||||
{
|
||||
cheevosTextureView.y = 0;
|
||||
}
|
||||
else if (cheevosTextureView.y > bottom)
|
||||
{
|
||||
cheevosTextureView.y = bottom;
|
||||
}
|
||||
|
||||
cheevosSprite->setSpriteClip(cheevosTextureView);
|
||||
}
|
||||
|
||||
// Ejecuta la seccion en la que se solicita al usuario su ID online
|
||||
void Title::runEnterID()
|
||||
{
|
||||
enterID = new EnterID(renderer, screen, asset, options, section);
|
||||
enterID->run();
|
||||
delete enterID;
|
||||
}
|
||||
|
||||
// Rellena la textura de fondo con todos los gráficos
|
||||
void Title::fillTexture()
|
||||
{
|
||||
@@ -442,20 +425,12 @@ void Title::fillTexture()
|
||||
// Pinta el gráfico del titulo a partir del sprite
|
||||
sprite->render();
|
||||
|
||||
// Borra la firma
|
||||
// const color_t coverColor = stringToColor(options->palette, "black");
|
||||
// SDL_SetRenderDrawColor(renderer, coverColor.r, coverColor.g, coverColor.b, 0xFF);
|
||||
// SDL_Rect coverRect = {28, 11, 21, 5};
|
||||
// SDL_RenderFillRect(renderer, &coverRect);
|
||||
|
||||
// Escribe el texto en la textura
|
||||
const color_t textColor = stringToColor(options->palette, "green");
|
||||
const int textSize = text->getCharacterSize();
|
||||
const std::string onlineText = options->online.jailerID == "" ? "(OFF)" : "(" + options->online.jailerID + ")";
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, PLAY_AREA_CENTER_X, 11 * textSize, "1.PLAY", 1, textColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, PLAY_AREA_CENTER_X, 13 * textSize, "2.ACHIEVEMENTS", 1, textColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, PLAY_AREA_CENTER_X, 15 * textSize, "3.ONLINE MODE", 1, textColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, PLAY_AREA_CENTER_X, 16 * textSize + 1, onlineText, 1, textColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, PLAY_AREA_CENTER_X, 15 * textSize, "3.REDEFINE KEYS", 1, textColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, PLAY_AREA_CENTER_X, 20 * textSize, "ESC.EXIT GAME", 1, textColor);
|
||||
|
||||
// Devuelve el puntero del renderizador a su sitio
|
||||
@@ -467,7 +442,6 @@ void Title::createCheevosTexture()
|
||||
{
|
||||
// Crea la textura con el listado de logros
|
||||
const std::vector<cheevos_t> cheevosList = cheevos->list();
|
||||
// const int iconSize = 16; // Altura del icono que representa a cada logro
|
||||
const int cheevosTextureWidth = 200;
|
||||
const int cheevosTextureViewHeight = 110;
|
||||
const int cheevosTexturePosY = 73;
|
||||
@@ -485,7 +459,7 @@ void Title::createCheevosTexture()
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
// Escribe la lista de logros en la textura
|
||||
const std::string cheevosOwner = options->online.jailerID == "" ? "LOCAL ACHIEVEMENTS" : "ACHIEVEMENTS FOR " + toUpper(options->online.jailerID);
|
||||
const std::string cheevosOwner = "LOCAL ACHIEVEMENTS";
|
||||
const std::string cheevosListCaption = cheevosOwner + " (" + std::to_string(cheevos->unlocked()) + " / " + std::to_string(cheevos->count()) + ")";
|
||||
int pos = 2;
|
||||
infoText->writeDX(TXT_CENTER | TXT_COLOR, cheevosTexture->getWidth() / 2, pos, cheevosListCaption, 1, stringToColor(options->palette, "bright_green"));
|
||||
@@ -497,31 +471,19 @@ void Title::createCheevosTexture()
|
||||
const int lineX1 = (cheevosTextureWidth / 7) * 3;
|
||||
const int lineX2 = lineX1 + ((cheevosTextureWidth / 7) * 1);
|
||||
|
||||
// Texture *iconTexture = new Texture(renderer, asset->get("notify.png"));
|
||||
// Sprite *sp = new Sprite({0, 0, iconSize, iconSize}, iconTexture, renderer);
|
||||
for (auto cheevo : cheevosList)
|
||||
{
|
||||
cheevoColor = cheevo.completed ? cheevoUnlockedColor : cheevoLockedColor;
|
||||
// sp->setPos({2, pos, iconSize, iconSize});
|
||||
// sp->setSpriteClip({iconSize * 2, 0, iconSize, iconSize});
|
||||
// sp->getTexture()->setColor(cheevoColor.r, cheevoColor.g, cheevoColor.b);
|
||||
// sp->render();
|
||||
pos += cheevosPadding;
|
||||
int half = cheevosPadding / 2;
|
||||
SDL_RenderDrawLine(renderer, lineX1, pos - half - 1, lineX2, pos - half - 1);
|
||||
// infoText->writeColored(2 + iconSize + 2, pos, cheevo.caption, cheevoColor);
|
||||
infoText->writeDX(TXT_CENTER | TXT_COLOR, cheevosTextureWidth / 2, pos, cheevo.caption, 1, cheevoColor);
|
||||
pos += infoText->getCharacterSize() + 1;
|
||||
// infoText->writeColored(2 + iconSize + 2, pos, cheevo.description, cheevoColor);
|
||||
infoText->writeDX(TXT_CENTER | TXT_COLOR, cheevosTextureWidth / 2, pos, cheevo.description, 1, cheevoColor);
|
||||
// pos += cheevosPadding;
|
||||
pos += infoText->getCharacterSize();
|
||||
}
|
||||
// delete sp;
|
||||
// delete iconTexture;
|
||||
|
||||
// Crea el sprite para el listado de logros
|
||||
// cheevosSprite = new Sprite((GAMECANVAS_WIDTH - cheevosTexture->getWidth()) / 2, (GAMECANVAS_HEIGHT - cheevosTextureViewHeight) / 2, cheevosTexture->getWidth(), cheevosTexture->getHeight(), cheevosTexture, renderer);
|
||||
cheevosSprite = new Sprite((GAMECANVAS_WIDTH - cheevosTexture->getWidth()) / 2, cheevosTexturePosY, cheevosTexture->getWidth(), cheevosTexture->getHeight(), cheevosTexture, renderer);
|
||||
cheevosTextureView = {0, 0, cheevosTexture->getWidth(), cheevosTextureViewHeight};
|
||||
cheevosSprite->setSpriteClip(cheevosTextureView);
|
||||
|
||||
Reference in New Issue
Block a user