Fixed sidePieces (Need to add more cases tho)

This commit is contained in:
Bram Verhulst
2024-04-06 01:47:34 +02:00
parent 9def986c83
commit f50597d1a5
9 changed files with 143 additions and 46 deletions

View File

@@ -10,32 +10,10 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="26a0623a-44d5-441c-8048-32ff1dab3479" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/Engine/Text.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Engine/Text.h" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Game/Levels/MainMenu/MainMenuLevel.cpp" afterDir="false" />
<change afterPath="$PROJECT_DIR$/Game/Levels/MainMenu/MainMenuLevel.h" afterDir="false" />
<list default="true" id="26a0623a-44d5-441c-8048-32ff1dab3479" name="Changes" comment="Fix precompiled headers&#10;Added edge detection (if it works :/)">
<change beforePath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Motherload/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Engine/Engine.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/Engine/Engine.vcxproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Animations/Animation.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Animations/Animation.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Game.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Game.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Game.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Game.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Game.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Game.vcxproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Game.vcxproj.filters" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Game.vcxproj.filters" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/GameManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GameManager.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/GridSystem/WorldGridManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldGridManager.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/GridSystem/WorldGridManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldGridManager.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/GridSystem/WorldTile.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldTile.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/GridSystem/WorldTile.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/GridSystem/WorldTile.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Gui/Button.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Gui/Button.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Gui/Screen.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Gui/Screen.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Gui/Screens/FuelScreen.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Gui/Screens/FuelScreen.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Gui/Screens/ScreenManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Gui/Screens/ScreenManager.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Level.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/Level.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Level.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/Level.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/Player.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Player.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/WorldLevel.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Game/WorldLevel.h" beforeDir="false" afterPath="$PROJECT_DIR$/Game/Levels/World/WorldLevel.h" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -208,6 +186,11 @@
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock://C:/Users/Bram/Desktop/Programming 2/Exam/dae16-VerhulstBram/Game/Animations/Animation.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Game/Animations/Animation.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Game/Camera.cpp" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/Game/pch.cpp" root0="FORCE_HIGHLIGHTING" />
@@ -341,7 +324,7 @@
<workItem from="1712269212956" duration="5658000" />
<workItem from="1712313346695" duration="4041000" />
<workItem from="1712322453730" duration="533000" />
<workItem from="1712328371740" duration="10932000" />
<workItem from="1712328371740" duration="12603000" />
</task>
<task id="LOCAL-00001" summary="Rework Tile detection system">
<option name="closed" value="true" />
@@ -375,7 +358,15 @@
<option name="project" value="LOCAL" />
<updated>1712182067316</updated>
</task>
<option name="localTasksCounter" value="5" />
<task id="LOCAL-00005" summary="Fix precompiled headers&#10;Added edge detection (if it works :/)">
<option name="closed" value="true" />
<created>1712359406452</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1712359406452</updated>
</task>
<option name="localTasksCounter" value="6" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -388,7 +379,8 @@
<MESSAGE value="Reformat + Basic animation system&#10;General fixes" />
<MESSAGE value="Basic screen system" />
<MESSAGE value="Update Screen system&#10;Added FuelScreen (Working buttons)&#10;Added SellScreen (Nothing working)" />
<option name="LAST_COMMIT_MESSAGE" value="Update Screen system&#10;Added FuelScreen (Working buttons)&#10;Added SellScreen (Nothing working)" />
<MESSAGE value="Fix precompiled headers&#10;Added edge detection (if it works :/)" />
<option name="LAST_COMMIT_MESSAGE" value="Fix precompiled headers&#10;Added edge detection (if it works :/)" />
</component>
<component name="XDebuggerManager">
<watches-manager>

View File

@@ -15,10 +15,17 @@ WorldTile::WorldTile(const Point2f& position, GroundTileType* groundTileType, Te
// m_pTexture = new Texture(dirtPath);
m_pTexture = pTextureManager->GetTexture(groundTileType->getPath());
m_pBottomLeftTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/bottomRight.png");
m_pBottomRightTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/bottomLeft.png");
m_pTopLeftTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/topRight.png");
m_pTopRightTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/topLeft.png");
m_pBottomLeftTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/bottomLeft.png");
m_pBottomRightTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/bottomRight.png");
m_pTopLeftTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/topLeft.png");
m_pTopRightTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/topRight.png");
m_pMiddleBottomTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleBottom.png");
m_pMiddleTopTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleTop.png");
m_pMiddleLeftTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleLeft.png");
m_pMiddleRightTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/middleRight.png");
m_pAllTexture = pTextureManager->GetTexture("tiles/dirt/sidepieces/all.png");
}
WorldTile::~WorldTile() {
delete m_pTexture;
@@ -32,25 +39,117 @@ void WorldTile::Draw() {
}
}
if(m_Hightlight) {
for (int i = 0; i < 8; i++) {
WorldTile* tile = m_SurroundingTiles.GetTile(static_cast<TileDirection>(i));
if(tile != nullptr) { //Tile exists
//TODO: Wow Big mess
GroundTileTypes type = tile->GetTileType()->getType();
if(type == Tiles::AIR->getType()) {
utils::SetColor(Colors::BLACK);
utils::FillRect(Rectf{tile->GetPosition(), Point2f{50,50}});
continue;
}
if(type != Tiles::AIR->getType()) {
utils::SetColor(Colors::YELLOW);
utils::FillRect(Rectf{tile->GetPosition(), Point2f{50,50}});
}
//check if it's all around dirt
bool allDirt = true;
for (int i = 0; i < 8; i++) {
WorldTile* tile = m_SurroundingTiles.GetTile(static_cast<TileDirection>(i));
if(tile != nullptr) { //Tile exists
GroundTileTypes type = tile->GetTileType()->getType();
if(type != Tiles::DIRT->getType()) {
allDirt = false;
break;
}
}
}
if(allDirt) {
m_pAllTexture->Draw(m_Position);
return;
}
if(*m_GroundTileType == Tiles::AIR) {
WorldTile* topLeft = m_SurroundingTiles.GetTile(TileDirection::TopLeft);
if(topLeft != nullptr) {
GroundTileTypes type = topLeft->GetTileType()->getType();
if(type != Tiles::AIR->getType()) {
m_pTopLeftTexture->Draw(m_Position);
}
}
WorldTile* topRight = m_SurroundingTiles.GetTile(TileDirection::TopRight);
if(topRight != nullptr) {
GroundTileTypes type = topRight->GetTileType()->getType();
if(type != Tiles::AIR->getType()) {
m_pTopRightTexture->Draw(m_Position);
}
}
WorldTile* bottomLeft = m_SurroundingTiles.GetTile(TileDirection::BottomLeft);
if(bottomLeft != nullptr) {
GroundTileTypes type = bottomLeft->GetTileType()->getType();
if(type != Tiles::AIR->getType()) {
m_pBottomLeftTexture->Draw(m_Position);
}
}
WorldTile* bottomRight = m_SurroundingTiles.GetTile(TileDirection::BottomRight);
if(bottomRight != nullptr) {
GroundTileTypes type = bottomRight->GetTileType()->getType();
if(type != Tiles::AIR->getType()) {
m_pBottomRightTexture->Draw(m_Position);
}
}
WorldTile* middleTop = m_SurroundingTiles.GetTile(TileDirection::TopMiddle);
if(middleTop != nullptr) {
GroundTileTypes type = middleTop->GetTileType()->getType();
if(type != Tiles::AIR->getType()) {
m_pMiddleTopTexture->Draw(m_Position);
}
}
WorldTile* middleBottom = m_SurroundingTiles.GetTile(TileDirection::BottomMiddle);
if(middleBottom != nullptr) {
GroundTileTypes type = middleBottom->GetTileType()->getType();
if(type != Tiles::AIR->getType()) {
m_pMiddleBottomTexture->Draw(m_Position);
}
}
WorldTile* middleLeft = m_SurroundingTiles.GetTile(TileDirection::MiddleLeft);
if(middleLeft != nullptr) {
GroundTileTypes type = middleLeft->GetTileType()->getType();
if(type != Tiles::AIR->getType()) {
m_pMiddleLeftTexture->Draw(m_Position);
}
}
WorldTile* middleRight = m_SurroundingTiles.GetTile(TileDirection::MiddleRight);
if(middleRight != nullptr) {
GroundTileTypes type = middleRight->GetTileType()->getType();
if(type != Tiles::AIR->getType()) {
m_pMiddleRightTexture->Draw(m_Position);
}
}
WorldTile* bottomMiddle = m_SurroundingTiles.GetTile(TileDirection::BottomMiddle);
if(bottomMiddle != nullptr) {
GroundTileTypes type = bottomMiddle->GetTileType()->getType();
if(type != Tiles::AIR->getType()) {
m_pMiddleBottomTexture->Draw(m_Position);
}
}
}
// if(m_Hightlight) {
// for (int i = 0; i < 8; i++) {
// WorldTile* tile = m_SurroundingTiles.GetTile(static_cast<TileDirection>(i));
// if(tile != nullptr) { //Tile exists
// //TODO: Wow Big mess
// GroundTileTypes type = tile->GetTileType()->getType();
// if(type == Tiles::AIR->getType()) {
// utils::SetColor(Colors::BLACK);
// utils::FillRect(Rectf{tile->GetPosition(), Point2f{50,50}});
// continue;
// }
// if(type != Tiles::AIR->getType()) {
// utils::SetColor(Colors::YELLOW);
// utils::FillRect(Rectf{tile->GetPosition(), Point2f{50,50}});
// }
// }
// }
// }
//Tile is air, So check 8 tiles around
// Check the 4 tiles diagonally

View File

@@ -140,6 +140,12 @@ private:
Texture* m_pBottomLeftTexture;
Texture* m_pBottomRightTexture;
Texture* m_pMiddleTopTexture;
Texture* m_pMiddleBottomTexture;
Texture* m_pMiddleLeftTexture;
Texture* m_pMiddleRightTexture;
Texture* m_pAllTexture;
};

BIN
Resources/fonts/verdana.ttf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B