Compare commits

..

3 Commits

Author SHA1 Message Date
Asuro
42c5b55f95 fix texture rotation, add tutorial popup 2025-06-20 23:34:32 +02:00
Asuro
d7fc6b781e ui hack 2025-06-20 15:42:05 +02:00
Asuro
e15cd79e04 fix collision 2025-06-20 15:41:52 +02:00
13 changed files with 73 additions and 22 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -107,8 +107,9 @@ namespace Game
if (rendering.SetupData.UseImgui) if (rendering.SetupData.UseImgui)
{ {
auto& IO = ImGui::GetIO(); auto& IO = ImGui::GetIO();
IO.ConfigFlags = IO.ConfigFlags = FlagBool(IO.ConfigFlags,
FlagBool(IO.ConfigFlags, ImGuiConfigFlags_NoMouse | ImGuiConfigFlags_NoKeyboard, IsGaming); ImGuiConfigFlags_NoMouse | ImGuiConfigFlags_NoKeyboard,
GetInstance().Player.InteractionM == InteractionMode::Walk);
} }
rendering.UIVisible = IsGaming ? UIVisibilityState::Game : UIVisibilityState::Debug; rendering.UIVisible = IsGaming ? UIVisibilityState::Game : UIVisibilityState::Debug;
} }
@@ -241,10 +242,26 @@ namespace Game
float fracOffsetY = scaledOffset.z - offsetY; float fracOffsetY = scaledOffset.z - offsetY;
int32_t xPos = (int32_t)(fracOffsetX * heightmap.Width); int32_t xPos = (int32_t)(fracOffsetX * heightmap.Width);
int32_t yPos = (int32_t)(fracOffsetY * heightmap.Height); int32_t yPos = (int32_t)(fracOffsetY * heightmap.Height);
uint8_t height = heightmap.Values[yPos * heightmap.Width + xPos];
LOG("Height: %u", height); uint8_t height = 0;
return height > 230; switch (card.Rotation)
{
case 0:
height = heightmap.Values[yPos * heightmap.Width + xPos];
break;
case 1:
height = heightmap.Values[(heightmap.Height - xPos - 1) * heightmap.Width + yPos];
break;
case 2:
height =
heightmap
.Values[(heightmap.Height - yPos - 1) * heightmap.Width + (heightmap.Width - xPos - 1)];
break;
default:
height = heightmap.Values[xPos * heightmap.Width + (heightmap.Height - yPos - 1)];
break;
}
return height >= 110 && height <= 125;
} }
} }
return false; return false;

View File

@@ -117,6 +117,8 @@ namespace Game
} }
LOG("min/max: %lli", bx::getHPCounter() - startTime); LOG("min/max: %lli", bx::getHPCounter() - startTime);
mesh.MinPos = {-5.0f, -5.0f, -5.0f};
mesh.MaxPos = {5.0f, 5.0f, 5.0f};
mesh.Size = mesh.MaxPos - mesh.MinPos; mesh.Size = mesh.MaxPos - mesh.MinPos;
startTime = bx::getHPCounter(); startTime = bx::getHPCounter();

View File

@@ -666,6 +666,43 @@ namespace Tools
auto& level = Game::GetInstance().GameLevel; auto& level = Game::GetInstance().GameLevel;
auto& player = Game::GetInstance().Player; auto& player = Game::GetInstance().Player;
if (ImGui::Begin("Hilfe"))
{
if (ImGui::Button("Spiel Neustarten"))
{
}
ImGui::SameLine();
if (ImGui::Button("Zurück zum Anfang"))
{
player.PlayerCamTransform.Position = {0.0f, 3.0f, 0.0f};
}
ImGui::Separator();
ImGui::Text("Anleitung:");
ImGui::Text("Bewege dich mit");
ImGui::SameLine();
ImGui::TextColored({1.0f, 0.8f, 0.8f, 1.0f}, "W, A, S, D");
ImGui::SameLine();
ImGui::Text("und schau dich um mit der");
ImGui::SameLine();
ImGui::TextColored({1.0f, 0.8f, 0.8f, 1.0f}, "Maus.");
ImGui::Text("Drücke");
ImGui::SameLine();
ImGui::TextColored({1.0f, 0.8f, 0.8f, 1.0f}, "Leertaste");
ImGui::SameLine();
ImGui::Text("um den Spielplan zu öffnen.");
ImGui::Text("");
auto& inflowTexture = rendering.Textures[10];
auto& outflowTexture = rendering.Textures[9];
auto& connectionTexture = rendering.Textures[8];
ImGui::Text("Pumpe (Wasserquelle):");
ImGui::Image(inflowTexture.RenderHandle.idx, {64.0f, 64.0f});
ImGui::Text("Abfluss (Ziel):");
ImGui::Image(outflowTexture.RenderHandle.idx, {64.0f, 64.0f});
ImGui::Text("Verbindung:");
ImGui::Image(connectionTexture.RenderHandle.idx, {64.0f, 64.0f});
}
ImGui::End();
if (rendering.UIVisible == Game::UIVisibilityState::Debug) if (rendering.UIVisible == Game::UIVisibilityState::Debug)
{ {
if (ImGui::IsMouseClicked(ImGuiMouseButton_Right)) if (ImGui::IsMouseClicked(ImGuiMouseButton_Right))

View File

@@ -134,7 +134,7 @@ namespace Game
{ {
quad.UIPos = Vec3{cardIdx * 0.05f + stackIdx * 1.2f, quad.UIPos = Vec3{cardIdx * 0.05f + stackIdx * 1.2f,
4.2f + (cardIdx % 2 == 0 ? 0.02f : 0.0f), 4.2f + (cardIdx % 2 == 0 ? 0.02f : 0.0f),
cardIdx * 0.001f} * cardIdx * 0.001f - 0.3f} *
UICardOffset * UICardScale; UICardOffset * UICardScale;
UpdateQuad(level.UIQuads, h); UpdateQuad(level.UIQuads, h);
quad.EData.Visible = true; quad.EData.Visible = true;
@@ -219,7 +219,7 @@ namespace Game
bool isLocked = GetFlag(card.Flags, PlacedPuzzleCardFlags::Locked); bool isLocked = GetFlag(card.Flags, PlacedPuzzleCardFlags::Locked);
auto& quad = level.UIQuads.Get(UIPlacedCards[cardIdx]); auto& quad = level.UIQuads.Get(UIPlacedCards[cardIdx]);
quad.UIPos = Vec3{(float)card.Position.X, (float)card.Position.Y, 0.0f} * UICardOffset * UICardScale; quad.UIPos = Vec3{(float)card.Position.X, (float)card.Position.Y, -0.3f} * UICardOffset * UICardScale;
quad.UIPos -= boardOffset; quad.UIPos -= boardOffset;
quad.UIRot = card.Rotation * bx::kPi * 0.5f; quad.UIRot = card.Rotation * bx::kPi * 0.5f;
UpdateQuad(level.UIQuads, UIPlacedCards[cardIdx]); UpdateQuad(level.UIQuads, UIPlacedCards[cardIdx]);
@@ -339,11 +339,6 @@ namespace Game
// NOLINTEND // NOLINTEND
uiOffset *= -UICardOffset * 0.5f; uiOffset *= -UICardOffset * 0.5f;
Transform tileOriginTransform = StaticData.UITransform;
tileOriginTransform.Position += AxisForward(StaticData.UITransform.M) * -1.0f;
TranslateLocal(tileOriginTransform, Vec3{uiOffset.x, 0.0f, uiOffset.y} * 1.0f);
UpdateMatrix(tileOriginTransform);
auto& solvedQuad = level.UIQuads.Get(SolvedQuad); auto& solvedQuad = level.UIQuads.Get(SolvedQuad);
solvedQuad.EData.Visible = true; solvedQuad.EData.Visible = true;
solvedQuad.EData.TextureHandle = IsPuzzleSolved ? GetInstance().Player.Config.TabletStatusSolvedTexture solvedQuad.EData.TextureHandle = IsPuzzleSolved ? GetInstance().Player.Config.TabletStatusSolvedTexture

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -116,7 +116,7 @@ namespace Game
uint32_t ResetFlags = BGFX_RESET_VSYNC; uint32_t ResetFlags = BGFX_RESET_VSYNC;
uint16_t MainViewID = 10; uint16_t MainViewID = 10;
float LastShaderLoadTime = 0.0f; float LastShaderLoadTime = 0.0f;
int32_t DitherRecursion = 3; int32_t DitherRecursion = 1;
public: public:
void Setup(const RenderingSetup& setup); void Setup(const RenderingSetup& setup);

Binary file not shown.

Binary file not shown.

Binary file not shown.