This commit is contained in:
@@ -37,6 +37,9 @@ namespace game::state
|
||||
|
||||
character =
|
||||
entity::Character(data, vec2(World::BOUNDS.x + World::BOUNDS.z * 0.5f, World::BOUNDS.w - World::BOUNDS.y));
|
||||
character.digestionRate = glm::clamp(data.digestionRateMin, character.digestionRate, data.digestionRateMax);
|
||||
character.eatSpeed = glm::clamp(data.eatSpeedMin, character.eatSpeed, data.eatSpeedMax);
|
||||
character.capacity = glm::clamp(data.capacityMin, character.capacity, data.capacityMax);
|
||||
|
||||
auto isAlternateSpritesheet =
|
||||
(game == NEW_GAME && math::random_percent_roll(data.alternateSpritesheet.chanceOnNewGame));
|
||||
@@ -88,16 +91,13 @@ namespace game::state
|
||||
|
||||
isPostgame = saveData.isPostgame;
|
||||
|
||||
if (isPostgame)
|
||||
menu.isCheats = true;
|
||||
else
|
||||
menu.isCheats = false;
|
||||
if (isPostgame) menu.isCheats = true;
|
||||
|
||||
if (game == NEW_GAME) isWindows = false;
|
||||
|
||||
if (auto font = character.data.menuSchema.font.get()) ImGui::GetIO().FontDefault = font;
|
||||
|
||||
character.play_default_animation();
|
||||
character.queue_idle_animation();
|
||||
character.tick();
|
||||
worldCanvas.size_set(imgui::to_vec2(ImGui::GetMainViewport()->Size));
|
||||
world.set(character, worldCanvas, focus_get());
|
||||
@@ -170,7 +170,8 @@ namespace game::state
|
||||
}
|
||||
}
|
||||
|
||||
if (character.isJustStageFinal && !isEnd && !isPostgame) isEnd = true;
|
||||
if (character.isJustStageFinal && !isEnd && !isPostgame)
|
||||
isEnd = true;
|
||||
|
||||
if (isEnd)
|
||||
{
|
||||
@@ -199,6 +200,7 @@ namespace game::state
|
||||
isEndEnd = true;
|
||||
isEnd = false;
|
||||
isPostgame = true;
|
||||
world.character_focus(character, worldCanvas, focus_get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,13 +32,6 @@ namespace game::state::main
|
||||
ImGui::SameLine();
|
||||
if (WIDGET_FX(ImGui::Button("Digest"))) character.digestionProgress = entity::Character::DIGESTION_MAX;
|
||||
|
||||
if (WIDGET_FX(ImGui::SliderFloat("Weight", &character.weight, character.data.weightMin, character.data.weightMax,
|
||||
"%0.2f kg")))
|
||||
{
|
||||
character.stage = character.stage_get();
|
||||
character.queue_idle_animation();
|
||||
}
|
||||
|
||||
auto stage = character.stage + 1;
|
||||
if (WIDGET_FX(ImGui::SliderInt("Stage", &stage, 1, (int)character.data.stages.size() + 1)))
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace game::state::main
|
||||
class Cheats
|
||||
{
|
||||
public:
|
||||
|
||||
void update(Resources&, entity::Character&, Inventory&, Text&);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -37,6 +37,13 @@ namespace game::state::main
|
||||
|
||||
auto isImguiCaptureMouse = ImGui::GetIO().WantCaptureMouse;
|
||||
|
||||
auto isItemsLocked = character.isStageUp;
|
||||
|
||||
if (isItemsLocked)
|
||||
{
|
||||
heldItemIndex = -1;
|
||||
}
|
||||
|
||||
auto isMouseLeftClicked = ImGui::IsMouseClicked(ImGuiMouseButton_Left);
|
||||
auto isMouseLeftDown = ImGui::IsMouseDown(ImGuiMouseButton_Left);
|
||||
auto isMouseLeftReleased = ImGui::IsMouseReleased(ImGuiMouseButton_Left);
|
||||
@@ -54,7 +61,7 @@ namespace game::state::main
|
||||
if (isJustItemHeldStopped || isJustItemThrown)
|
||||
{
|
||||
cursor.queue_default_animation();
|
||||
if (!isJustItemThrown) character.queue_idle_animation();
|
||||
if (!isJustItemThrown && !isItemsLocked) character.queue_idle_animation();
|
||||
isJustItemHeldStopped = false;
|
||||
isJustItemThrown = false;
|
||||
}
|
||||
@@ -115,10 +122,10 @@ namespace game::state::main
|
||||
|
||||
auto rect = character.null_frame_rect(eatArea.nullID);
|
||||
|
||||
if (isCanEat && math::is_point_in_rectf(rect, heldItem->position))
|
||||
if (isCanEat && math::is_point_in_rectf(rect, heldItem->position) && !isItemsLocked)
|
||||
{
|
||||
character.queue_play(
|
||||
{.animation = eatArea.animation, .speedMultiplier = character.eatSpeed, .isInterruptible = false});
|
||||
{.animation = eatArea.animation, .speedMultiplier = character.eatSpeed});
|
||||
|
||||
if (character.playedEventID == eatArea.eventID)
|
||||
{
|
||||
@@ -206,7 +213,7 @@ namespace game::state::main
|
||||
|
||||
item.update();
|
||||
|
||||
if (math::is_point_in_rectf(item.rect(), cursorPosition) && !isImguiCaptureMouse)
|
||||
if (math::is_point_in_rectf(item.rect(), cursorPosition) && !isImguiCaptureMouse && !isItemsLocked)
|
||||
{
|
||||
isItemHovered = true;
|
||||
cursor.queue_play({cursorSchema.animations.hover.get()});
|
||||
|
||||
@@ -91,13 +91,11 @@ namespace game::state::main
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
#if defined(DEBUG) && DEBUG
|
||||
if (WIDGET_FX(ImGui::BeginTabItem("Debug")))
|
||||
if (isDebug && WIDGET_FX(ImGui::BeginTabItem("Debug")))
|
||||
{
|
||||
debug.update(character, cursor, itemManager, canvas);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,14 @@ namespace game::state::main
|
||||
|
||||
state::Configuration configuration;
|
||||
|
||||
#if DEBUG
|
||||
bool isCheats{true};
|
||||
bool isDebug{true};
|
||||
#else
|
||||
bool isCheats{};
|
||||
bool isDebug{};
|
||||
#endif
|
||||
|
||||
bool isOpen{true};
|
||||
bool isChat{true};
|
||||
util::imgui::WindowSlide slide{};
|
||||
|
||||
Reference in New Issue
Block a user