Convertit "param" a variable global en lloc de anar marejant amb punterets i passant 8.000.000 de paràmetres
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
#include "title.h"
|
||||
#include "param.h"
|
||||
|
||||
// Constructor
|
||||
Title::Title(Screen *screen, Asset *asset, Input *input, options_t *options, param_t *param, section_t *section, JA_Music_t *music)
|
||||
Title::Title(Screen *screen, Asset *asset, Input *input, options_t *options, section_t *section, JA_Music_t *music)
|
||||
{
|
||||
// Copia las direcciones de los punteros y objetos
|
||||
this->screen = screen;
|
||||
this->input = input;
|
||||
this->asset = asset;
|
||||
this->options = options;
|
||||
this->param = param;
|
||||
this->section = section;
|
||||
this->music = music;
|
||||
SDL_Renderer *renderer = screen->getRenderer();
|
||||
|
||||
// Reserva memoria y crea los objetos
|
||||
eventHandler = new SDL_Event();
|
||||
fade = new Fade(renderer, param);
|
||||
fade = new Fade(renderer);
|
||||
|
||||
text1 = new Text(asset->get("smb2.gif"), asset->get("smb2.txt"), renderer);
|
||||
text1->addPalette(asset->get("smb2_pal1.gif"));
|
||||
@@ -23,14 +23,14 @@ Title::Title(Screen *screen, Asset *asset, Input *input, options_t *options, par
|
||||
text2 = new Text(asset->get("8bithud.png"), asset->get("8bithud.txt"), renderer);
|
||||
|
||||
miniLogoTexture = new Texture(renderer, asset->get("logo_jailgames_mini.png"));
|
||||
miniLogoSprite = new Sprite(param->game.gameArea.centerX - miniLogoTexture->getWidth() / 2, 0, miniLogoTexture->getWidth(), miniLogoTexture->getHeight(), miniLogoTexture);
|
||||
miniLogoSprite = new Sprite(param.game.gameArea.centerX - miniLogoTexture->getWidth() / 2, 0, miniLogoTexture->getWidth(), miniLogoTexture->getHeight(), miniLogoTexture);
|
||||
|
||||
tiledbg = new Tiledbg(renderer, asset, {0, 0, param->game.width, param->game.height}, TILED_MODE_RANDOM);
|
||||
tiledbg = new Tiledbg(renderer, asset, {0, 0, param.game.width, param.game.height}, TILED_MODE_RANDOM);
|
||||
|
||||
gameLogo = new GameLogo(renderer, screen, asset, param, param->game.gameArea.centerX, param->title.titleCCPosition);
|
||||
gameLogo = new GameLogo(renderer, screen, asset, param.game.gameArea.centerX, param.title.titleCCPosition);
|
||||
gameLogo->enable();
|
||||
|
||||
defineButtons = new DefineButtons(input, text2, param, options, section);
|
||||
defineButtons = new DefineButtons(input, text2, options, section);
|
||||
|
||||
// Inicializa los valores
|
||||
init();
|
||||
@@ -66,7 +66,7 @@ void Title::init()
|
||||
ticksSpeed = 15;
|
||||
fade->setColor(fadeColor.r, fadeColor.g, fadeColor.b);
|
||||
fade->setType(FADE_RANDOM_SQUARE);
|
||||
fade->setPost(param->fade.postDuration);
|
||||
fade->setPost(param.fade.postDuration);
|
||||
demo = true;
|
||||
numControllers = input->getNumControllers();
|
||||
}
|
||||
@@ -137,7 +137,7 @@ void Title::update()
|
||||
// Actualiza el mosaico de fondo
|
||||
tiledbg->update();
|
||||
|
||||
if (counter == param->title.titleDuration)
|
||||
if (counter == param.title.titleDuration)
|
||||
{
|
||||
fade->activate();
|
||||
postFade = -1;
|
||||
@@ -167,17 +167,17 @@ void Title::render()
|
||||
// 'PULSA 1P o 2P PARA JUGAR'
|
||||
if (counter % 50 > 14 && !defineButtons->isEnabled())
|
||||
{
|
||||
text1->writeDX(TXT_CENTER | TXT_SHADOW, param->game.gameArea.centerX, param->title.pressStartPosition, lang::getText(23), 1, noColor, 1, shadow);
|
||||
text1->writeDX(TXT_CENTER | TXT_SHADOW, param.game.gameArea.centerX, param.title.pressStartPosition, lang::getText(23), 1, noColor, 1, shadow);
|
||||
}
|
||||
|
||||
// Mini logo
|
||||
const int pos1 = (param->game.height / 5 * 4) + BLOCK;
|
||||
const int pos1 = (param.game.height / 5 * 4) + BLOCK;
|
||||
const int pos2 = pos1 + miniLogoSprite->getHeight() + 3;
|
||||
miniLogoSprite->setPosY(pos1);
|
||||
miniLogoSprite->render();
|
||||
|
||||
// Texto con el copyright
|
||||
text1->writeDX(TXT_CENTER | TXT_SHADOW, param->game.gameArea.centerX, pos2, TEXT_COPYRIGHT, 1, noColor, 1, shadow);
|
||||
text1->writeDX(TXT_CENTER | TXT_SHADOW, param.game.gameArea.centerX, pos2, TEXT_COPYRIGHT, 1, noColor, 1, shadow);
|
||||
}
|
||||
|
||||
// Define Buttons
|
||||
|
||||
Reference in New Issue
Block a user