Retocando la abadía
This commit is contained in:
@@ -100,6 +100,27 @@ void Resource::reLoadTextures()
|
||||
}
|
||||
}
|
||||
|
||||
// Recarga las habitaciones
|
||||
void Resource::reLoadRooms()
|
||||
{
|
||||
for (auto r : rooms)
|
||||
{
|
||||
delete r.room;
|
||||
r.room = new room_t(loadRoomFile(asset->get(r.name)));
|
||||
r.room->tileMap = getTileMap(r.room->tileMapFile);
|
||||
for (auto &e : r.room->enemies)
|
||||
{
|
||||
e.animation = getAnimation(e.animationString);
|
||||
}
|
||||
for (auto &i : r.room->items)
|
||||
{
|
||||
i.texture = getTexture(i.tileSetFile);
|
||||
}
|
||||
r.room->textureA = getTexture("standard.png");
|
||||
r.room->textureB = getTexture("standard_zxarne.png");
|
||||
}
|
||||
}
|
||||
|
||||
// Libera las texturas
|
||||
void Resource::freeTextures()
|
||||
{
|
||||
|
||||
@@ -39,8 +39,8 @@ struct res_tileMap_t
|
||||
|
||||
struct res_room_t
|
||||
{
|
||||
std::string name; // Nombre de la habitación
|
||||
room_t *room; // Vecor con las habitaciones
|
||||
std::string name; // Nombre de la habitación
|
||||
room_t *room; // Vecor con las habitaciones
|
||||
};
|
||||
|
||||
// Clase Resource. Almacena recursos de disco en memoria
|
||||
@@ -81,6 +81,9 @@ public:
|
||||
// Recarga las texturas
|
||||
void reLoadTextures();
|
||||
|
||||
// Recarga las habitaciones
|
||||
void reLoadRooms();
|
||||
|
||||
// Libera las texturas
|
||||
void freeTextures();
|
||||
|
||||
|
||||
@@ -132,20 +132,31 @@ void Credits::fillTexture()
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"INSTRUCTIONS:", stringToColor(options->palette, "yellow")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"HELP JAILDOC TO GET BACK ALL HIS", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"PROJECTS AND GO TO THE JAIL TO", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"FINISH THEM", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"HELP JAILDOC TO GET BACK ALL", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"HIS PROJECTS AND GO TO THE", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"JAIL TO FINISH THEM", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
|
||||
//texts.push_back({"KEYS:", stringToColor(options->palette, "yellow")});
|
||||
//texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
//texts.push_back({"USE 'CURSORS' TO MOVE AND JUMP", stringToColor(options->palette, "white")});
|
||||
//texts.push_back({"'F1-F4' TO CHANGE WINDOWS SIZE", stringToColor(options->palette, "white")});
|
||||
//texts.push_back({"'F' TO SWITCH TO FULLSCREEN", stringToColor(options->palette, "white")});
|
||||
//texts.push_back({"'B' TO SWITCH THE BORDER SCREEN", stringToColor(options->palette, "white")});
|
||||
//texts.push_back({"'M' TO TURN ON/OFF THE MUSIC", stringToColor(options->palette, "white")});
|
||||
//texts.push_back({"'ESC' TO LEAVE THE GAME", stringToColor(options->palette, "white")});
|
||||
//texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
//texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
|
||||
texts.push_back({"KEYS:", stringToColor(options->palette, "yellow")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"USE 'CURSORS' TO MOVE AND JUMP", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"'F1-F4' TO CHANGE WINDOWS SIZE", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"'F' TO SWITCH TO FULLSCREEN", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"'B' TO SWITCH THE BORDER SCREEN", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"'M' TO TURN ON/OFF THE MUSIC", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"'ESC' TO LEAVE THE GAME", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"CURSORS: MOVE AND JUMP", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"F1-F4: CHANGE WINDOWS SIZE", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"F: SWITCH TO FULLSCREEN", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"B: SWITCH THE BORDER SCREEN", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"M: TURN ON/OFF THE MUSIC", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"ESC: LEAVE THE GAME", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
texts.push_back({"", stringToColor(options->palette, "white")});
|
||||
|
||||
@@ -197,8 +208,6 @@ void Credits::fillTexture()
|
||||
SDL_RenderDrawPoint(renderer, i, 4);
|
||||
SDL_RenderDrawPoint(renderer, i, 6);
|
||||
|
||||
// SDL_RenderDrawPoint(renderer, i + 1, 1);
|
||||
// SDL_RenderDrawPoint(renderer, i + 1, 3);
|
||||
SDL_RenderDrawPoint(renderer, i + 1, 5);
|
||||
SDL_RenderDrawPoint(renderer, i + 1, 7);
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
|
||||
// ****
|
||||
// this->debug->setEnabled(true);
|
||||
currentRoom = "25.room";
|
||||
const int x = 28;
|
||||
const int y = 13;
|
||||
const int x = 30;
|
||||
const int y = 7;
|
||||
spawnPoint = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||
// ****
|
||||
|
||||
@@ -105,6 +105,10 @@ void Game::checkEventHandler()
|
||||
board.music ? JA_ResumeMusic() : JA_PauseMusic();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_R:
|
||||
resource->reLoadRooms();
|
||||
break;
|
||||
|
||||
case SDL_SCANCODE_M:
|
||||
board.music = !board.music;
|
||||
board.music ? JA_ResumeMusic() : JA_PauseMusic();
|
||||
|
||||
@@ -895,7 +895,7 @@ void Room::setBottomSurfaces()
|
||||
lastOne = i;
|
||||
i++;
|
||||
|
||||
if (i < (int)tile.size() - 1)
|
||||
if (i <= (int)tile.size() - 1)
|
||||
{
|
||||
while (tile.at(i) == tile.at(i - 1) + 1)
|
||||
{
|
||||
@@ -910,7 +910,7 @@ void Room::setBottomSurfaces()
|
||||
|
||||
line.x2 = ((tile[lastOne] % mapWidth) * tileSize) + tileSize - 1;
|
||||
bottomSurfaces.push_back(line);
|
||||
if (i < (int)tile.size() - 1)
|
||||
if (i <= (int)tile.size() - 1)
|
||||
{
|
||||
if (tile.at(i) == -1)
|
||||
{ // Si el siguiente elemento es un separador, hay que saltarlo
|
||||
@@ -955,7 +955,7 @@ void Room::setTopSurfaces()
|
||||
lastOne = i;
|
||||
i++;
|
||||
|
||||
if (i < (int)tile.size() - 1)
|
||||
if (i <= (int)tile.size() - 1)
|
||||
{
|
||||
while (tile.at(i) == tile.at(i - 1) + 1)
|
||||
{
|
||||
@@ -970,7 +970,7 @@ void Room::setTopSurfaces()
|
||||
|
||||
line.x2 = ((tile[lastOne] % mapWidth) * tileSize) + tileSize - 1;
|
||||
topSurfaces.push_back(line);
|
||||
if (i < (int)tile.size() - 1)
|
||||
if (i <= (int)tile.size() - 1)
|
||||
{
|
||||
if (tile.at(i) == -1)
|
||||
{ // Si el siguiente elemento es un separador, hay que saltarlo
|
||||
@@ -1187,7 +1187,7 @@ void Room::setAutoSurfaces()
|
||||
lastOne = i;
|
||||
i++;
|
||||
|
||||
if (i < (int)tile.size() - 1)
|
||||
if (i <= (int)tile.size() - 1)
|
||||
{
|
||||
while (tile.at(i) == tile.at(i - 1) + 1)
|
||||
{
|
||||
@@ -1202,7 +1202,7 @@ void Room::setAutoSurfaces()
|
||||
|
||||
line.x2 = ((tile[lastOne] % mapWidth) * tileSize) + tileSize - 1;
|
||||
autoSurfaces.push_back(line);
|
||||
if (i < (int)tile.size() - 1)
|
||||
if (i <= (int)tile.size() - 1)
|
||||
{
|
||||
if (tile.at(i) == -1)
|
||||
{ // Si el siguiente elemento es un separador, hay que saltarlo
|
||||
|
||||
Reference in New Issue
Block a user