Compare commits
2 Commits
e0016817dd
...
fd2654c944
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd2654c944 | ||
|
|
d0f9051af7 |
@@ -277,6 +277,7 @@ namespace Game
|
||||
// Puzzle tiles
|
||||
for (int32_t i = 0; i < BX_COUNTOF(Puzzles); ++i)
|
||||
{
|
||||
Puzzles[i].IsActive = GetInstance().DebugData.SelectedDebugLevel == i;
|
||||
Puzzles[i].Update();
|
||||
}
|
||||
|
||||
@@ -348,13 +349,18 @@ namespace Game
|
||||
TileHandles[i] = level.PuzzleTiles.New();
|
||||
auto& tile = level.PuzzleTiles.Get(TileHandles[i]);
|
||||
tile.EData.MaterialHandle = EMaterial::Default;
|
||||
tile.EData.Visible = false;
|
||||
|
||||
UIPlacedCards[i] = level.UIQuads.New();
|
||||
auto& quad = level.UIQuads.Get(UIPlacedCards[i]);
|
||||
quad.EData.ModelH = GameRendering::Get().GetModelHandleFromPath("models/plane.glb");
|
||||
quad.EData.MaterialHandle = EMaterial::UI;
|
||||
quad.EData.Visible = false;
|
||||
}
|
||||
for (int32_t i = 0; i < Puzzle::Config::MaxAvailableStacks * WorldPuzzle::UIAvailableCardMaxStackPreview; ++i)
|
||||
{
|
||||
UIAvailableCards[i] = level.UIQuads.New();
|
||||
auto& quad = level.UIQuads.Get(UIAvailableCards[i]);
|
||||
quad.EData.MaterialHandle = EMaterial::UI;
|
||||
quad.EData.ModelH = GameRendering::Get().GetModelHandleFromPath("models/plane.glb");
|
||||
}
|
||||
IsSetup = true;
|
||||
LOG("finished setup!");
|
||||
@@ -396,6 +402,37 @@ namespace Game
|
||||
|
||||
Vec3 mousePosWorld = LocalToGlobalPoint(camTransform, mousePosCam);
|
||||
|
||||
// Available Cards
|
||||
for (int32_t i = 0; i < Puzzle::Config::MaxAvailableStacks; ++i)
|
||||
{
|
||||
auto& card = Data.AvailableCards[i];
|
||||
for (int32_t j = 0; j < UIAvailableCardMaxStackPreview; j++)
|
||||
{
|
||||
auto& quad = level.UIQuads.Get(UIAvailableCards[i * UIAvailableCardMaxStackPreview + j]);
|
||||
if (i < Data.AvailableCardCount & j < card.MaxAvailableCount - card.UsedCount)
|
||||
{
|
||||
quad.EData.Visible = IsActive;
|
||||
quad.EData.TextureHandle = Puzzle::IsValid(Data.AvailableCards[i].RefCard)
|
||||
? staticCards[Data.AvailableCards[i].RefCard.Idx].BoardTextureHandle
|
||||
: Gen::TextureHandle{};
|
||||
quad.EData.Transform.Position = tileOriginTransform.Position;
|
||||
quad.EData.Transform.Rotation = camTransform.Rotation;
|
||||
TranslateLocal(quad.EData.Transform,
|
||||
Vec3{j * 0.05f + i * 1.2f, 6.0f + (j % 2 == 0 ? 0.02f : 0.0f), j * 0.001f} *
|
||||
UICardOffset * UICardScale);
|
||||
Rotate(quad.EData.Transform, Vec3{bx::kPi * 0.5f, 0.0f, (1.0f - 0 * 0.5f) * bx::kPi});
|
||||
quad.EData.Transform.Scale = {UICardScale, UICardScale, UICardScale};
|
||||
quad.EData.DotColor = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
quad.EData.BaseColor = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
}
|
||||
else
|
||||
{
|
||||
quad.EData.Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Board
|
||||
for (int8_t y = 0; y < Data.HeightTiles / Puzzle::Config::CardSize; ++y)
|
||||
{
|
||||
for (int8_t x = 0; x < Data.WidthTiles / Puzzle::Config::CardSize; ++x)
|
||||
@@ -408,7 +445,7 @@ namespace Game
|
||||
bool isValid = Puzzle::IsValid(card.RefCard);
|
||||
|
||||
// World Tile
|
||||
tile.EData.Visible = true;
|
||||
tile.EData.Visible = IsActive;
|
||||
tile.EData.ModelH = isValid ? staticCards[card.RefCard.Idx].ModelHandle : staticCards[0].ModelHandle;
|
||||
tile.EData.DotColor = visuals.TileDotColor;
|
||||
tile.EData.BaseColor = visuals.TileBaseColor;
|
||||
@@ -426,7 +463,7 @@ namespace Game
|
||||
bx::mtxRotateY(tile.EData.Transform.Rotation.M, card.Rotation * bx::kPi * 0.5f);
|
||||
|
||||
// UI Quad
|
||||
quad.EData.Visible = isValid;
|
||||
quad.EData.Visible = isValid && IsActive;
|
||||
quad.EData.TextureHandle =
|
||||
isValid ? staticCards[card.RefCard.Idx].BoardTextureHandle : Gen::TextureHandle{};
|
||||
quad.EData.DotColor = card.IsLocked ? Puzzle::GetStaticPuzzleData().Visuals.DisabledCardTint
|
||||
|
||||
@@ -144,12 +144,15 @@ namespace Game
|
||||
static constexpr Gen::Vec2 WorldCardSize{10.0f, 10.0f};
|
||||
static constexpr float UICardScale = 0.05f;
|
||||
static constexpr float UICardOffset = 2.1f * UICardScale;
|
||||
static constexpr int32_t UIAvailableCardMaxStackPreview = 3;
|
||||
Gen::PuzzleData Data;
|
||||
Gen::Vec3 WorldPosition;
|
||||
PuzzleTileEntityHandle TileHandles[Puzzle::Config::MaxCardsInPuzzle];
|
||||
UIQuadEntityHandle UIPlacedCards[Puzzle::Config::MaxCardsInPuzzle];
|
||||
UIQuadEntityHandle UIAvailableCards[Puzzle::Config::MaxAvailableStacks * UIAvailableCardMaxStackPreview];
|
||||
Gen::PuzPos DraggedCard{-1, -1};
|
||||
bool IsSetup = false;
|
||||
bool IsActive = false;
|
||||
|
||||
void Setup();
|
||||
void Update();
|
||||
@@ -169,7 +172,7 @@ namespace Game
|
||||
|
||||
public:
|
||||
Gen::StaticPuzzleData PuzzleData;
|
||||
WorldPuzzle Puzzles[1];
|
||||
WorldPuzzle Puzzles[3];
|
||||
|
||||
public:
|
||||
void Setup(GameData& data);
|
||||
|
||||
BIN
src/game/data/puzzles/0.pzl
LFS
BIN
src/game/data/puzzles/0.pzl
LFS
Binary file not shown.
BIN
src/game/data/puzzles/1.pzl
LFS
Normal file
BIN
src/game/data/puzzles/1.pzl
LFS
Normal file
Binary file not shown.
BIN
src/game/data/puzzles/2.pzl
LFS
Normal file
BIN
src/game/data/puzzles/2.pzl
LFS
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user