Browse Source

maked levels

meemknight 1 year ago
parent
commit
61dab28ceb

+ 40 - 5
Pika/gameplay/containers/isometricGame/isometricGameEditor.cpp

@@ -22,14 +22,18 @@ static bool pointInBox(glm::vec2 p, glm::vec4 box)
 static bool redstoneWire(int type)
 static bool redstoneWire(int type)
 {
 {
 	return type == IsometricGameEditor::Blocks::redstone ||
 	return type == IsometricGameEditor::Blocks::redstone ||
-	type == IsometricGameEditor::Blocks::trapdor ||
+		type == IsometricGameEditor::Blocks::trapdor ||
+		type == IsometricGameEditor::Blocks::redstoneTorch ||
+		type == IsometricGameEditor::Blocks::redstoneBlock ||
 	type == IsometricGameEditor::Blocks::lever;
 	type == IsometricGameEditor::Blocks::lever;
 }
 }
 
 
 static bool canPlaceRedstoneOn(int type)
 static bool canPlaceRedstoneOn(int type)
 {
 {
-	return type >= IsometricGameEditor::Blocks::clay &&
-		type <= IsometricGameEditor::Blocks::woddenPlank;
+	return (type >= IsometricGameEditor::Blocks::clay &&
+		type <= IsometricGameEditor::Blocks::woddenPlank)
+		|| type == IsometricGameEditor::Blocks::redstoneBlock;
+		
 }
 }
 
 
 
 
@@ -249,7 +253,9 @@ bool IsometricGameEditor::update(pika::Input input, pika::WindowState windowStat
 						color = glm::vec4(0.8, 0.2, 0.2, 1.0);
 						color = glm::vec4(0.8, 0.2, 0.2, 1.0);
 					}
 					}
 
 
-					if (b->get().x == Blocks::redstone || b->get().x == Blocks::lever)
+					if (b->get().x == Blocks::redstone || b->get().x == Blocks::lever
+						|| b->get().x == Blocks::redstoneTorch
+						)
 					{
 					{
 						auto cr = glm::vec4(0.8, 0.2, 0.2, 1.0);
 						auto cr = glm::vec4(0.8, 0.2, 0.2, 1.0);
 
 
@@ -332,7 +338,8 @@ bool IsometricGameEditor::update(pika::Input input, pika::WindowState windowStat
 
 
 						auto b2 = map.getSafe({x,y2,z});
 						auto b2 = map.getSafe({x,y2,z});
 
 
-						if (b2 && b2->get().x != 0)
+						if (b2 && b2->get().x != 0 && b->get().x != Blocks::redstone 
+							&& b->get().x != Blocks::lever)
 						{
 						{
 							renderer.renderRectangle({position,size,size}, shadow, 
 							renderer.renderRectangle({position,size,size}, shadow, 
 								{1,1,1,1.f/advance}
 								{1,1,1,1.f/advance}
@@ -359,6 +366,14 @@ bool IsometricGameEditor::update(pika::Input input, pika::WindowState windowStat
 					renderer.renderRectangle({position,size,size}, tiles, {0.1,0.1,0.1,0.1}, {}, 0,
 					renderer.renderRectangle({position,size,size}, tiles, {0.1,0.1,0.1,0.1}, {}, 0,
 						tilesAtlas.get(0, 1));
 						tilesAtlas.get(0, 1));
 				}
 				}
+
+				if (blockSelector == glm::ivec3{x, y, z})
+				{
+					glm::vec2 position = calculateBlockPos({x,y,z});
+
+					renderer.renderRectangle({position,size,size}, tiles, {0.5,0.9,0.1,0.9}, {}, 0,
+						tilesAtlas.get(0, 1));
+				}
 			}
 			}
 
 
 	if (currentSelectedBlockDelete.x > -1)
 	if (currentSelectedBlockDelete.x > -1)
@@ -407,6 +422,10 @@ bool IsometricGameEditor::update(pika::Input input, pika::WindowState windowStat
 	ImGui::DragFloat2("camera", &renderer.currentCamera.position[0], 2, -3200, 3200);
 	ImGui::DragFloat2("camera", &renderer.currentCamera.position[0], 2, -3200, 3200);
 
 
 
 
+	ImGui::DragInt3("block selector", &blockSelector[0], 1, 0);
+
+
+
 	{
 	{
 		auto uv1 = tilesAtlas.get(currentBlock, 0);
 		auto uv1 = tilesAtlas.get(currentBlock, 0);
 		ImGui::Image((void *)(intptr_t)tiles.id,
 		ImGui::Image((void *)(intptr_t)tiles.id,
@@ -436,6 +455,9 @@ bool IsometricGameEditor::update(pika::Input input, pika::WindowState windowStat
 		}
 		}
 	}
 	}
 
 
+	if (input.buttons[pika::Button::Z].pressed()) { currentBlock--; }
+	if (input.buttons[pika::Button::X].pressed()) { currentBlock++; }
+
 	currentBlock = glm::clamp(currentBlock, 0, blocksCount-1);
 	currentBlock = glm::clamp(currentBlock, 0, blocksCount-1);
 
 
 	ImGui::NewLine();
 	ImGui::NewLine();
@@ -471,6 +493,18 @@ bool IsometricGameEditor::update(pika::Input input, pika::WindowState windowStat
 		map = std::move(newMap);
 		map = std::move(newMap);
 	}
 	}
 
 
+	if (ImGui::Button("Replace floor"))
+	{
+		for (int x = 0; x < map.size.x; x++)
+			for (int z = 0; z < map.size.z; z++)
+			{
+
+				auto b = map.getSafe({x,0,z});
+				b->set(currentBlock, 0);
+			}
+
+	}
+
 	ImGui::NewLine();
 	ImGui::NewLine();
 
 
 
 
@@ -487,6 +521,7 @@ bool IsometricGameEditor::update(pika::Input input, pika::WindowState windowStat
 		}
 		}
 	}
 	}
 
 
+
 	ImGui::NewLine();
 	ImGui::NewLine();
 
 
 
 

+ 4 - 0
Pika/gameplay/containers/isometricGame/isometricGameEditor.h

@@ -25,6 +25,8 @@ struct IsometricGameEditor: public Container
 		redstone,
 		redstone,
 		trapdor,
 		trapdor,
 		lever,
 		lever,
+		redstoneTorch,
+		redstoneBlock,
 	};
 	};
 
 
 
 
@@ -39,6 +41,8 @@ struct IsometricGameEditor: public Container
 
 
 	glm::ivec3 newMapSize = {};
 	glm::ivec3 newMapSize = {};
 
 
+	glm::ivec3 blockSelector = {};
+
 	static ContainerStaticInfo containerInfo()
 	static ContainerStaticInfo containerInfo()
 	{
 	{
 		ContainerStaticInfo info = {};
 		ContainerStaticInfo info = {};

BIN
Pika/resources/isoSaves/map1.isomap


BIN
Pika/resources/isoSaves/map2.isomap


BIN
Pika/resources/isoSaves/map3.isomap


BIN
Pika/resources/isoSaves/map4.isomap


BIN
Pika/resources/isoSaves/map5.isomap


BIN
Pika/resources/isoSaves/test1.isomap


+ 40 - 0
Pika/resources/isoSaves/zones.txt

@@ -0,0 +1,40 @@
+start 1 -> 13, 1, 3
+
+exit -> 2 -> 0, 1, 10
+	2 -> 0, 1, 11
+
+exit -> 3 -> 4, 1, 6
+	3 -> 3, 1, 6
+
+
+
+2 -> enter from 1: 8, 1, 4
+  -> enter from 4: 1, 1, 4
+
+exit -> 4 -> 0, 1, 4
+
+
+3 -> enter from 1: 3, 1 ,7
+
+exit -> 1 -> 3, 1, 9
+exit -> 1 -> 2, 1, 9
+
+
+4 -> enter from 2: 8, 1, 2
+
+exit -> 2 -> 9, 1, 2
+exit -> 2 -> 9, 1, 3s
+
+exit -> 5 -> 1, 1, 16
+
+
+5 -> enter from 4: 13, 1, 3
+
+exit -> 4 -> 14, 1, 3
+exit -> 4 -> 14, 1, 4
+
+
+final exit: 6,1,14    5,1,14
+
+
+dw

BIN
Pika/resources/isoTiles/Isometric-Tiles.png


+ 16 - 2
Pika/resources/logs.txt

@@ -1,2 +1,16 @@
-#2024-01-04 12:47:49: Created container: IsometricGameEditor
-#2024-01-04 12:49:03: Destroyed continer: IsometricGameEditor #1
+#2024-01-04 16:57:38: Created container: IsometricGameEditor
+#2024-01-04 16:59:44: Created container: IsometricGameEditor
+#2024-01-04 16:59:45: Created container: IsometricGameEditor
+#2024-01-04 16:59:47: Destroyed continer: IsometricGameEditor #3
+#2024-01-04 16:59:48: Destroyed continer: IsometricGameEditor #2
+#2024-01-04 17:00:32: Created container: IsometricGameEditor
+#2024-01-04 17:00:33: Destroyed continer: IsometricGameEditor #1
+#2024-01-04 17:01:42: Created container: IsometricGameEditor
+#2024-01-04 17:01:44: Destroyed continer: IsometricGameEditor #5
+#2024-01-04 17:02:41: Created container: IsometricGameEditor
+#2024-01-04 17:02:43: Destroyed continer: IsometricGameEditor #4
+#2024-01-04 17:03:53: Created container: IsometricGameEditor
+#2024-01-04 17:03:57: Destroyed continer: IsometricGameEditor #6
+#2024-01-04 17:05:49: Created container: IsometricGameEditor
+#2024-01-04 17:06:21: Destroyed continer: IsometricGameEditor #7
+#2024-01-04 17:07:43: Destroyed continer: IsometricGameEditor #8