From 4e228fc4ea0189be7f28eba68d59b99841f91aab Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 18 Mar 2022 11:34:42 -0400 Subject: more wall renders --- src/game.cpp | 30 ++++++++++++++++++++++++++---- src/renderer.cpp | 6 +++--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 9d557e3..08c96ee 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -283,6 +283,7 @@ void Game::recalculateRender() { { if (map.at(x,y).dirtyRender) { map.at(x,y).dirtyRender = false; + map.at(x,y).renderId = -1; if (map.tile(x,y) == Tile::Floor) { int renderDesc = 0; @@ -313,12 +314,11 @@ void Game::recalculateRender() { map.at(x,y).sign = false; } } else { - map.at(x,y).renderId = -1; map.at(x,y).sign = false; } } else if (map.tile(x,y) == Tile::Wall) { static bool initWalls = false; - static std::vector wallRenders(256, TilesetIndex(0, 0)); + static std::vector wallRenders(256, TilesetIndex(21, 12)); if (!initWalls) { initWalls = true; @@ -327,41 +327,51 @@ void Game::recalculateRender() { wallRenders[0b00111100] = TilesetIndex(16, 14); wallRenders[0b00011110] = TilesetIndex(16, 14); wallRenders[0b00111110] = TilesetIndex(16, 14); + wallRenders[0b00111101] = TilesetIndex(16, 14); + wallRenders[0b10011101] = TilesetIndex(16, 14); wallRenders[0b00011111] = TilesetIndex(17, 14); wallRenders[0b10011111] = TilesetIndex(17, 14); wallRenders[0b00111111] = TilesetIndex(17, 14); wallRenders[0b10111111] = TilesetIndex(17, 14); + wallRenders[0b01011111] = TilesetIndex(17, 14); wallRenders[0b00000111] = TilesetIndex(18, 14); wallRenders[0b00001111] = TilesetIndex(18, 14); wallRenders[0b10000111] = TilesetIndex(18, 14); wallRenders[0b10001111] = TilesetIndex(18, 14); + wallRenders[0b10101111] = TilesetIndex(18, 14); wallRenders[0b01111100] = TilesetIndex(16, 15); wallRenders[0b11111100] = TilesetIndex(16, 15); wallRenders[0b01111110] = TilesetIndex(16, 15); wallRenders[0b11111110] = TilesetIndex(16, 15); + wallRenders[0b01111101] = TilesetIndex(16, 15); wallRenders[0b11000111] = TilesetIndex(18, 15); wallRenders[0b11001111] = TilesetIndex(18, 15); wallRenders[0b11100111] = TilesetIndex(18, 15); wallRenders[0b11101111] = TilesetIndex(18, 15); + wallRenders[0b11010111] = TilesetIndex(18, 15); wallRenders[0b01110000] = TilesetIndex(16, 16); wallRenders[0b01111000] = TilesetIndex(16, 16); wallRenders[0b11110000] = TilesetIndex(16, 16); wallRenders[0b11111000] = TilesetIndex(16, 16); + wallRenders[0b11111010] = TilesetIndex(16, 16); wallRenders[0b11110001] = TilesetIndex(17, 16); wallRenders[0b11110011] = TilesetIndex(17, 16); wallRenders[0b11111001] = TilesetIndex(17, 16); wallRenders[0b11111011] = TilesetIndex(17, 16); + wallRenders[0b11110101] = TilesetIndex(17, 16); wallRenders[0b11000001] = TilesetIndex(18, 16); wallRenders[0b11000011] = TilesetIndex(18, 16); wallRenders[0b11100001] = TilesetIndex(18, 16); wallRenders[0b11100011] = TilesetIndex(18, 16); + wallRenders[0b11001001] = TilesetIndex(18, 16); + wallRenders[0b11011001] = TilesetIndex(18, 16); wallRenders[0b11110111] = TilesetIndex(21, 14); @@ -382,8 +392,20 @@ void Game::recalculateRender() { map.at(x,y).renderId = wallRenders.at(renderDesc); - if (wallRenders.at(renderDesc) == 0 && renderDesc != 255) { - std::cout << renderDesc << std::endl; + if (wallRenders.at(renderDesc) == TilesetIndex(21, 12) && renderDesc != 255) { + //std::cout << renderDesc << std::endl; + std::cout << ((renderDesc & (1 << 7)) ? 'X' : 'O'); + std::cout << ((renderDesc & (1 << 6)) ? 'X' : 'O'); + std::cout << ((renderDesc & (1 << 5)) ? 'X' : 'O'); + std::cout << std::endl; + std::cout << ((renderDesc & (1 << 0)) ? 'X' : 'O'); + std::cout << ' '; + std::cout << ((renderDesc & (1 << 4)) ? 'X' : 'O'); + std::cout << " " << renderDesc << std::endl; + std::cout << ((renderDesc & (1 << 1)) ? 'X' : 'O'); + std::cout << ((renderDesc & (1 << 2)) ? 'X' : 'O'); + std::cout << ((renderDesc & (1 << 3)) ? 'X' : 'O'); + std::cout << std::endl; } } } diff --git a/src/renderer.cpp b/src/renderer.cpp index 9744e70..10027dd 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -173,7 +173,7 @@ void Renderer::renderGame( if (draw) { - if (game.map.tile(x,y) != Tile::Wall) { + /*if (game.map.tile(x,y) != Tile::Wall)*/ { SDL_Rect tileRect {17 * 16, 15 * 16, 16, 16}; SDL_RenderCopy(ren_.get(), tileset_.get(), &tileRect, &rect); @@ -182,7 +182,7 @@ void Renderer::renderGame( tileRect.y = game.map.at(x,y).renderId / 25 * 16; SDL_RenderCopy(ren_.get(), tileset_.get(), &tileRect, &rect); } - } else { + }/* else { SDL_Rect tileRect { game.map.at(x,y).renderId % 25 * 16, game.map.at(x,y).renderId / 25 * 16, @@ -190,7 +190,7 @@ void Renderer::renderGame( 16}; SDL_RenderCopy(ren_.get(), tileset_.get(), &tileRect, &rect); - } + }*/ if (game.map.tile(x,y) == Tile::Lamp) { SDL_RenderCopy(ren_.get(), lamp_.get(), nullptr, &rect); -- cgit 1.4.1