forked from jaildesigner-jailgames/jaildoctors_dilemma
Singletonejant
Borrat menu.cpp que no estava gastantse...mmm.. desde mai
This commit is contained in:
@@ -21,15 +21,16 @@
|
||||
#include "text.h" // for Text, TXT_CENTER, TXT_COLOR
|
||||
#include "utils.h" // for options_t, cheat_t, stringToColor
|
||||
#include "options.h"
|
||||
#include "notifier.h"
|
||||
|
||||
// Constructor
|
||||
Game::Game(Resource *resource, Debug *debug)
|
||||
Game::Game()
|
||||
: screen_(Screen::get()),
|
||||
renderer_(Screen::get()->getRenderer()),
|
||||
asset_(Asset::get()),
|
||||
input_(Input::get()),
|
||||
resource_(resource),
|
||||
debug_(debug)
|
||||
resource_(Resource::get()),
|
||||
debug_(Debug::get())
|
||||
{
|
||||
// Inicia algunas variables
|
||||
board_.iniClock = SDL_GetTicks();
|
||||
@@ -38,7 +39,7 @@ Game::Game(Resource *resource, Debug *debug)
|
||||
const int x = 25;
|
||||
const int y = 13;
|
||||
spawn_point_ = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||
debug->setEnabled(false);
|
||||
debug_->setEnabled(false);
|
||||
#else
|
||||
current_room_ = "03.room";
|
||||
const int x = 25;
|
||||
@@ -47,17 +48,17 @@ Game::Game(Resource *resource, Debug *debug)
|
||||
#endif
|
||||
|
||||
// Crea los objetos
|
||||
cheevos_ = new Cheevos(screen_, asset_->get("cheevos.bin"));
|
||||
scoreboard_ = new ScoreBoard(renderer_, resource, asset_, &board_);
|
||||
cheevos_ = new Cheevos(asset_->get("cheevos.bin"));
|
||||
scoreboard_ = new Scoreboard(&board_);
|
||||
item_tracker_ = new ItemTracker();
|
||||
room_tracker_ = new RoomTracker();
|
||||
room_ = new Room(resource->getRoom(current_room_), renderer_, screen_, asset_, item_tracker_, &board_.items, false, debug);
|
||||
room_ = new Room(resource_->getRoom(current_room_), item_tracker_, &board_.items, false);
|
||||
const std::string playerPNG = options.cheat.altSkin ? "player2.png" : "player.png";
|
||||
const std::string playerANI = options.cheat.altSkin ? "player2.ani" : "player.ani";
|
||||
const player_t player = {spawn_point_, playerPNG, playerANI, renderer_, resource, asset_, input_, room_, debug};
|
||||
const player_t player = {spawn_point_, playerPNG, playerANI, room_};
|
||||
this->player_ = new Player(player);
|
||||
event_handler_ = new SDL_Event();
|
||||
text_ = new Text(resource->getOffset("smb2.txt"), resource->getTexture("smb2.png"), renderer_);
|
||||
text_ = new Text(resource_->getOffset("smb2.txt"), resource_->getTexture("smb2.png"), renderer_);
|
||||
music_ = JA_LoadMusic(asset_->get("game.ogg").c_str());
|
||||
death_sound_ = JA_LoadSound(asset_->get("death.wav").c_str());
|
||||
stats_ = new Stats(asset_->get("stats.csv"), asset_->get("stats_buffer.csv"));
|
||||
@@ -178,19 +179,19 @@ void Game::checkEvents()
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F6:
|
||||
screen_->showNotification("ACHIEVEMENT UNLOCKED!", "I LIKE MY MULTICOLOURED FRIENDS", 2);
|
||||
Notifier::get()->show("ACHIEVEMENT UNLOCKED!", "I LIKE MY MULTICOLOURED FRIENDS", 2);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F7:
|
||||
screen_->showNotification("ACHIEVEMENT UNLOCKED!", "I LIKE MY MULTICOLOURED FRIENDS", 3);
|
||||
Notifier::get()->show("ACHIEVEMENT UNLOCKED!", "I LIKE MY MULTICOLOURED FRIENDS", 3);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F8:
|
||||
screen_->showNotification("JAILDESIGNER IS LOGGED IN", "", 4);
|
||||
Notifier::get()->show("JAILDESIGNER IS LOGGED IN", "", 4);
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_F9:
|
||||
screen_->showNotification("JAILDESIGNER IS LOGGED IN", "", 5);
|
||||
Notifier::get()->show("JAILDESIGNER IS LOGGED IN", "", 5);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -305,8 +306,7 @@ void Game::update()
|
||||
|
||||
updateBlackScreen();
|
||||
|
||||
// Actualiza las notificaciones
|
||||
screen_->updateNotifier();
|
||||
screen_->update();
|
||||
|
||||
#ifdef DEBUG
|
||||
updateDebugInfo();
|
||||
@@ -401,7 +401,7 @@ bool Game::changeRoom(std::string file)
|
||||
room_ = nullptr;
|
||||
|
||||
// Crea un objeto habitación nuevo a partir del fichero
|
||||
room_ = new Room(resource_->getRoom(file), renderer_, screen_, asset_, item_tracker_, &board_.items, board_.jailEnabled, debug_);
|
||||
room_ = new Room(resource_->getRoom(file), item_tracker_, &board_.items, board_.jailEnabled);
|
||||
|
||||
// Pone el nombre de la habitación en la textura
|
||||
fillRoomNameTexture();
|
||||
@@ -509,10 +509,10 @@ void Game::killPlayer()
|
||||
setBlackScreen();
|
||||
|
||||
// Crea la nueva habitación y el nuevo jugador
|
||||
room_ = new Room(resource_->getRoom(current_room_), renderer_, screen_, asset_, item_tracker_, &board_.items, board_.jailEnabled, debug_);
|
||||
room_ = new Room(resource_->getRoom(current_room_),item_tracker_, &board_.items, board_.jailEnabled);
|
||||
const std::string playerPNG = options.cheat.altSkin ? "player2.png" : "player.png";
|
||||
const std::string playerANI = options.cheat.altSkin ? "player2.ani" : "player.ani";
|
||||
const player_t player = {spawn_point_, playerPNG, playerANI, renderer_, resource_, asset_, input_, room_, debug_};
|
||||
const player_t player = {spawn_point_, playerPNG, playerANI, room_};
|
||||
this->player_ = new Player(player);
|
||||
|
||||
// Pone los objetos en pausa mientras esta la habitación en negro
|
||||
|
||||
Reference in New Issue
Block a user