Reestructurant la classe Options
This commit is contained in:
@@ -20,7 +20,7 @@ Scoreboard::Scoreboard(board_t *board)
|
||||
{
|
||||
// Reserva memoria para los objetos
|
||||
itemTexture = resource->getTexture("items.png");
|
||||
const std::string playerANI = options.cheat.altSkin ? "player2.ani" : "player.ani";
|
||||
const std::string playerANI = options.cheats.alternate_skin == Cheat::CheatState::ENABLED ? "player2.ani" : "player.ani";
|
||||
sprite = new AnimatedSprite(renderer, resource->getAnimation(playerANI));
|
||||
sprite->setCurrentAnimation("walk_menu");
|
||||
text = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer);
|
||||
@@ -31,13 +31,13 @@ Scoreboard::Scoreboard(board_t *board)
|
||||
paused = false;
|
||||
timePaused = 0;
|
||||
totalTimePaused = 0;
|
||||
itemsColor = stringToColor(options.palette, "white");
|
||||
itemsColor = stringToColor(options.video.palette, "white");
|
||||
|
||||
// Inicializa el vector de colores
|
||||
const std::vector<std::string> vColors = {"blue", "magenta", "green", "cyan", "yellow", "white", "bright_blue", "bright_magenta", "bright_green", "bright_cyan", "bright_yellow", "bright_white"};
|
||||
for (auto v : vColors)
|
||||
{
|
||||
color.push_back(stringToColor(options.palette, v));
|
||||
color.push_back(stringToColor(options.video.palette, v));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ void Scoreboard::render()
|
||||
// Muestra si suena la música
|
||||
if (board->music)
|
||||
{
|
||||
const color_t c = board->color;
|
||||
const Color c = board->color;
|
||||
SDL_Rect clip = {0, 8, 8, 8};
|
||||
itemTexture->setColor(c.r, c.g, c.b);
|
||||
itemTexture->render(renderer, 20 * BLOCK, line2, &clip);
|
||||
@@ -88,11 +88,11 @@ void Scoreboard::render()
|
||||
this->text->writeColored(BLOCK, line1, "Items collected ", board->color);
|
||||
this->text->writeColored(17 * BLOCK, line1, itemsTxt, itemsColor);
|
||||
this->text->writeColored(20 * BLOCK, line1, " Time ", board->color);
|
||||
this->text->writeColored(26 * BLOCK, line1, timeTxt, stringToColor(options.palette, "white"));
|
||||
this->text->writeColored(26 * BLOCK, line1, timeTxt, stringToColor(options.video.palette, "white"));
|
||||
|
||||
const std::string roomsTxt = std::to_string(board->rooms / 100) + std::to_string((board->rooms % 100) / 10) + std::to_string(board->rooms % 10);
|
||||
this->text->writeColored(22 * BLOCK, line2, "Rooms", stringToColor(options.palette, "white"));
|
||||
this->text->writeColored(28 * BLOCK, line2, roomsTxt, stringToColor(options.palette, "white"));
|
||||
this->text->writeColored(22 * BLOCK, line2, "Rooms", stringToColor(options.video.palette, "white"));
|
||||
this->text->writeColored(28 * BLOCK, line2, roomsTxt, stringToColor(options.video.palette, "white"));
|
||||
}
|
||||
|
||||
// Actualiza las variables del objeto
|
||||
@@ -141,7 +141,7 @@ void Scoreboard::reLoadPalette()
|
||||
color.clear();
|
||||
for (auto v : vColors)
|
||||
{
|
||||
color.push_back(stringToColor(options.palette, v));
|
||||
color.push_back(stringToColor(options.video.palette, v));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,18 +162,18 @@ void Scoreboard::resume()
|
||||
// Actualiza el color de la cantidad de items recogidos
|
||||
void Scoreboard::updateItemsColor()
|
||||
{
|
||||
if (!board->jailEnabled)
|
||||
if (!board->jail_is_open)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (counter % 20 < 10)
|
||||
{
|
||||
itemsColor = stringToColor(options.palette, "white");
|
||||
itemsColor = stringToColor(options.video.palette, "white");
|
||||
}
|
||||
else
|
||||
{
|
||||
itemsColor = stringToColor(options.palette, "magenta");
|
||||
itemsColor = stringToColor(options.video.palette, "magenta");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user