Browse Source

almost ready

meemknight 1 year ago
parent
commit
aaa29dcaf1

+ 114 - 6
Pika/gameplay/containers/isometricGame/isometricGame.cpp

@@ -64,14 +64,13 @@ bool IsometricGame::create(RequestedContainerInfo &requestedInfo, pika::StaticSt
 			
 			
 	}
 	}
 
 
-	map = levels[0];
-	
 	return true;
 	return true;
 }
 }
 
 
 static bool canPlayerStay(int type, int redstone)
 static bool canPlayerStay(int type, int redstone)
 {
 {
 	return type == 0 || type == IsometricGameEditor::Blocks::redstone ||
 	return type == 0 || type == IsometricGameEditor::Blocks::redstone ||
+		type == IsometricGameEditor::Blocks::redstoneTorch ||
 		type == IsometricGameEditor::Blocks::lever ||
 		type == IsometricGameEditor::Blocks::lever ||
 	 	(type == IsometricGameEditor::Blocks::trapdor && redstone == 1);
 	 	(type == IsometricGameEditor::Blocks::trapdor && redstone == 1);
 }
 }
@@ -85,13 +84,97 @@ bool IsometricGame::update(pika::Input input, pika::WindowState windowState, Req
 #pragma endregion
 #pragma endregion
 
 
 	float size = 100;
 	float size = 100;
+
+#pragma region Change Level
+	{
+		
+		if (currentLevel == 0)
+		{
+			if(
+				playerPosition == glm::ivec3{0,1,10} ||
+				playerPosition == glm::ivec3{0,1,11}
+				)
+			{currentLevel = 1; playerPosition = glm::ivec3(8, 1, 4);}
+			else
+			if(
+				playerPosition == glm::ivec3{4,1,6} ||
+				playerPosition == glm::ivec3{3,1,6}
+				)
+			{currentLevel = 2; playerPosition = glm::ivec3(3, 1, 7); };
+		}
+		else if (currentLevel == 1)
+		{
+			if (
+				playerPosition == glm::ivec3{0,1,4}
+				){currentLevel = 3; playerPosition = glm::ivec3(8, 1, 2); }
+			else if (playerPosition == glm::ivec3(9, 1, 4) ||
+				playerPosition == glm::ivec3(9, 1, 5)
+				)
+			{
+				currentLevel = 0; playerPosition = glm::ivec3(1, 1, 10);
+			}
+
+		}
+		else if (currentLevel == 2)
+		{
+			if (
+				playerPosition == glm::ivec3{3,1,9} ||
+				playerPosition == glm::ivec3{2,1,9}
+				)
+			{
+				currentLevel = 0; playerPosition = glm::ivec3(4, 1, 7);
+			}
+		}
+		else if (currentLevel == 3)
+		{
+
+			if (
+				playerPosition == glm::ivec3{9,1,2} ||
+				playerPosition == glm::ivec3{9,1,3}
+				)
+			{
+				currentLevel = 1; playerPosition = glm::ivec3(1, 1, 4);
+			}else
+			if (
+				playerPosition == glm::ivec3{1,1,16} ||
+				playerPosition == glm::ivec3{0,1,16} ||
+				playerPosition == glm::ivec3{0,1,15}
+				)
+			{
+				currentLevel = 4; playerPosition = glm::ivec3(13, 1, 3);
+			}
+		}
+		else if (currentLevel == 4)
+		{
+
+			if (
+				playerPosition == glm::ivec3{14,1,3} ||
+				playerPosition == glm::ivec3{14,1,4}
+				)
+			{
+				currentLevel = 3; playerPosition = glm::ivec3(2, 1, 16); //?
+			}
+			else if(playerPosition == glm::ivec3{6,1,14} ||
+				playerPosition == glm::ivec3{5,1,14})
+			{
+				return 0;
+			}
+		}
+
+	}
+#pragma endregion
+
 	
 	
-	auto getRedstoneStatusUnsafe = [&](glm::ivec3 v) -> RedstoneStatus&
+	
+	IsometricGameEditor::Map &map = levels[currentLevel];
+
+#pragma region Redstone
+
+	auto getRedstoneStatusUnsafe = [&](glm::ivec3 v) -> RedstoneStatus &
 	{
 	{
 		return redstone[v.x * map.size.z * map.size.y + v.y * map.size.z + v.z];
 		return redstone[v.x * map.size.z * map.size.y + v.y * map.size.z + v.z];
 	};
 	};
 
 
-#pragma region Redstone
 	{
 	{
 		redstone.clear();
 		redstone.clear();
 		redstone.resize(map.size.x * map.size.y * map.size.z);
 		redstone.resize(map.size.x * map.size.y * map.size.z);
@@ -182,7 +265,7 @@ bool IsometricGame::update(pika::Input input, pika::WindowState windowState, Req
 	//	100, 0, 0, windowState.windowW, windowState.windowH);
 	//	100, 0, 0, windowState.windowW, windowState.windowH);
 
 
 	renderer.currentCamera.follow(calculateBlockPos({glm::vec3(playerPosition) + playerAnimations.delta}),
 	renderer.currentCamera.follow(calculateBlockPos({glm::vec3(playerPosition) + playerAnimations.delta}),
-		input.deltaTime*90, 1, 100, windowState.windowW, windowState.windowH);
+		input.deltaTime*180, 1, 90, windowState.windowW, windowState.windowH);
 
 
 #pragma endregion
 #pragma endregion
 
 
@@ -249,7 +332,17 @@ bool IsometricGame::update(pika::Input input, pika::WindowState windowState, Req
 								&& !IsometricGameEditor::pointInBox(glm::vec2(input.mouseX, input.mouseY), uiBox)
 								&& !IsometricGameEditor::pointInBox(glm::vec2(input.mouseX, input.mouseY), uiBox)
 								)
 								)
 							{
 							{
-								return true;
+								float manhatan1 = glm::dot((glm::vec2(input.mouseX, input.mouseY) - glm::vec2(box)), glm::vec2(1,1));
+								float manhatan2 = glm::dot((glm::vec2(box) + glm::vec2(box.z, box.w)
+									- glm::vec2(input.mouseX, input.mouseY)), glm::vec2(1, 1));
+
+								if (manhatan1 > size / 4)
+								if (manhatan2 > size / 4)
+								{
+
+									return true;
+								}
+
 							}
 							}
 
 
 						}
 						}
@@ -614,6 +707,21 @@ bool IsometricGame::update(pika::Input input, pika::WindowState windowState, Req
 				b->set(0, 0);
 				b->set(0, 0);
 				redstoneTorchesCount++;
 				redstoneTorchesCount++;
 			}
 			}
+			else if (b->get().x == 0)
+			{
+				if (itemSelected == 0 && redstoneCount)
+				{
+					itemSelected = -1;
+					redstoneCount--;
+					b->set(IsometricGameEditor::Blocks::redstone, 0);
+				}else 
+				if (itemSelected == 1 && redstoneTorchesCount)
+				{
+					itemSelected = -1;
+					redstoneTorchesCount--;
+					b->set(IsometricGameEditor::Blocks::redstoneTorch, 0);
+				}
+			}
 		}
 		}
 
 
 	}
 	}

+ 3 - 5
Pika/gameplay/containers/isometricGame/isometricGame.h

@@ -37,8 +37,9 @@ struct IsometricGame: public Container
 	int redstoneTorchesCount = 0;
 	int redstoneTorchesCount = 0;
 	int foodCount = 0;
 	int foodCount = 0;
 	int itemSelected = -1;
 	int itemSelected = -1;
+	int currentLevel = 0;
 
 
-	glm::ivec3 playerPosition = {7, 1, 7};
+	glm::ivec3 playerPosition = {13, 1, 3};
 
 
 	struct PlayerAnimations
 	struct PlayerAnimations
 	{
 	{
@@ -90,10 +91,7 @@ struct IsometricGame: public Container
 		unsigned char status = {};
 		unsigned char status = {};
 	};
 	};
 
 
-	std::vector<RedstoneStatus> redstone;
-
-	IsometricGameEditor::Map map;
-	
+	std::vector<RedstoneStatus> redstone;	
 
 
 	bool update(pika::Input input, pika::WindowState windowState,
 	bool update(pika::Input input, pika::WindowState windowState,
 		RequestedContainerInfo &requestedInfo) override;
 		RequestedContainerInfo &requestedInfo) override;

BIN
Pika/resources/iso/maps/map2.isomap


BIN
Pika/resources/iso/maps/map4.isomap


BIN
Pika/resources/iso/maps/map5.isomap


+ 18 - 18
Pika/resources/iso/maps/zones.txt

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

+ 26 - 2
Pika/resources/logs.txt

@@ -1,2 +1,26 @@
-#2024-01-08 14:41:14: Created container: IsometricGame
-#2024-01-08 14:41:38: Destroyed continer: IsometricGame #1
+#2024-01-08 20:03:06: Created container: IsometricGame
+#2024-01-08 20:07:15: Reloaded dll
+#2024-01-08 20:10:16: Destroyed continer: IsometricGame #1
+#2024-01-08 20:10:24: Created container: IsometricGameEditor
+#2024-01-08 20:10:26: Destroyed continer: IsometricGameEditor #2
+#2024-01-08 20:10:27: Created container: IsometricGameEditor
+#2024-01-08 20:10:36: Destroyed continer: IsometricGameEditor #3
+#2024-01-08 20:10:38: Created container: IsometricGameEditor
+#2024-01-08 20:10:41: Destroyed continer: IsometricGameEditor #4
+#2024-01-08 20:10:42: Created container: IsometricGameEditor
+#2024-01-08 20:10:44: Destroyed continer: IsometricGameEditor #5
+#2024-01-08 20:10:45: Created container: IsometricGameEditor
+#2024-01-08 20:11:37: Destroyed continer: IsometricGameEditor #6
+#2024-01-08 20:11:41: Created container: IsometricGameEditor
+#2024-01-08 20:13:09: Destroyed continer: IsometricGameEditor #7
+#2024-01-08 20:13:28: Created container: IsometricGame
+#2024-01-08 20:14:53: Reloaded dll
+#2024-01-08 20:19:05: Destroyed continer: IsometricGame #8
+#2024-01-08 20:19:19: Created container: IsometricGameEditor
+#2024-01-08 20:19:21: Destroyed continer: IsometricGameEditor #9
+#2024-01-08 20:19:27: Created container: IsometricGameEditor
+#2024-01-08 20:19:50: Destroyed continer: IsometricGameEditor #10
+#2024-01-08 20:19:52: Created container: IsometricGameEditor
+#2024-01-08 20:19:54: Destroyed continer: IsometricGameEditor #11
+#2024-01-08 20:19:55: Created container: IsometricGameEditor
+#2024-01-08 20:25:02: Destroyed continer: IsometricGameEditor #12