update to end sequence
This commit is contained in:
@@ -41,6 +41,33 @@ namespace game::state
|
|||||||
: World::CENTER;
|
: World::CENTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Play::start_sequence_begin()
|
||||||
|
{
|
||||||
|
auto& dialogue = character.data.dialogue;
|
||||||
|
if (!dialogue.start.is_valid()) return;
|
||||||
|
|
||||||
|
character.queue_play({.animation = dialogue.start.animation, .isInterruptible = false});
|
||||||
|
character.tick();
|
||||||
|
text.entry = nullptr;
|
||||||
|
text.isEnabled = false;
|
||||||
|
isWindows = false;
|
||||||
|
isStart = true;
|
||||||
|
isStartBegin = false;
|
||||||
|
isStartEnd = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Play::end_sequence_begin()
|
||||||
|
{
|
||||||
|
auto& dialogue = character.data.dialogue;
|
||||||
|
if (!dialogue.end.is_valid()) return;
|
||||||
|
|
||||||
|
text.entry = nullptr;
|
||||||
|
text.isEnabled = false;
|
||||||
|
isEnd = true;
|
||||||
|
isEndBegin = false;
|
||||||
|
isEndEnd = false;
|
||||||
|
}
|
||||||
|
|
||||||
void Play::set(Resources& resources, int selectedCharacterIndex, enum Game game)
|
void Play::set(Resources& resources, int selectedCharacterIndex, enum Game game)
|
||||||
{
|
{
|
||||||
auto& data = resources.character_get(selectedCharacterIndex);
|
auto& data = resources.character_get(selectedCharacterIndex);
|
||||||
@@ -128,14 +155,7 @@ namespace game::state
|
|||||||
worldCanvas.size_set(imgui::to_vec2(ImGui::GetMainViewport()->Size));
|
worldCanvas.size_set(imgui::to_vec2(ImGui::GetMainViewport()->Size));
|
||||||
world.set(character, worldCanvas, focus_get());
|
world.set(character, worldCanvas, focus_get());
|
||||||
|
|
||||||
if (game == NEW_GAME && dialogue.start.is_valid())
|
if (game == NEW_GAME && dialogue.start.is_valid()) start_sequence_begin();
|
||||||
{
|
|
||||||
character.queue_play({.animation = dialogue.start.animation, .isInterruptible = false});
|
|
||||||
character.tick();
|
|
||||||
isStart = true;
|
|
||||||
isStartBegin = false;
|
|
||||||
isStartEnd = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isPostgame)
|
if (isPostgame)
|
||||||
{
|
{
|
||||||
@@ -230,8 +250,27 @@ namespace game::state
|
|||||||
tools.update(character, cursor, world, focus, worldCanvas);
|
tools.update(character, cursor, world, focus, worldCanvas);
|
||||||
info.update(resources, character);
|
info.update(resources, character);
|
||||||
toasts.update();
|
toasts.update();
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
if (menu.isDebugOpen && ImGui::IsKeyPressed(ImGuiKey_F8, false)) end_sequence_begin();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (menu.debug.isStartSequenceRequested)
|
||||||
|
{
|
||||||
|
menu.debug.isStartSequenceRequested = false;
|
||||||
|
start_sequence_begin();
|
||||||
|
}
|
||||||
|
if (menu.debug.isEndSequenceRequested)
|
||||||
|
{
|
||||||
|
menu.debug.isEndSequenceRequested = false;
|
||||||
|
end_sequence_begin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto isEndSequenceActive = isEndBegin && !isEndEnd;
|
||||||
|
itemManager.isDisabled = isEndSequenceActive;
|
||||||
|
characterManager.isDisabled = isEndSequenceActive;
|
||||||
|
|
||||||
if (text.isEnabled) text.update(character);
|
if (text.isEnabled) text.update(character);
|
||||||
|
|
||||||
if (isStart)
|
if (isStart)
|
||||||
@@ -274,7 +313,6 @@ namespace game::state
|
|||||||
menu.isOpen = false;
|
menu.isOpen = false;
|
||||||
character.calories = 0;
|
character.calories = 0;
|
||||||
character.digestionProgress = 0;
|
character.digestionProgress = 0;
|
||||||
itemManager.items.clear();
|
|
||||||
itemManager.heldItemIndex = -1;
|
itemManager.heldItemIndex = -1;
|
||||||
world.character_focus(character, worldCanvas, focus_get());
|
world.character_focus(character, worldCanvas, focus_get());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,5 +67,7 @@ namespace game::state
|
|||||||
void render(Resources&, Canvas&);
|
void render(Resources&, Canvas&);
|
||||||
void save(Resources&);
|
void save(Resources&);
|
||||||
play::World::Focus focus_get();
|
play::World::Focus focus_get();
|
||||||
|
void start_sequence_begin();
|
||||||
|
void end_sequence_begin();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,6 +39,15 @@ namespace game::state::play
|
|||||||
auto isMouseLeftReleased = ImGui::IsMouseReleased(ImGuiMouseButton_Left);
|
auto isMouseLeftReleased = ImGui::IsMouseReleased(ImGuiMouseButton_Left);
|
||||||
auto isImguiCaptureMouse = ImGui::GetIO().WantCaptureMouse;
|
auto isImguiCaptureMouse = ImGui::GetIO().WantCaptureMouse;
|
||||||
|
|
||||||
|
if (isDisabled)
|
||||||
|
{
|
||||||
|
isInteracting = false;
|
||||||
|
isHoldInteracting = false;
|
||||||
|
isHovering = false;
|
||||||
|
interactAreaID = -1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isInteractingPrevious = isInteracting;
|
isInteractingPrevious = isInteracting;
|
||||||
isHoveringPrevious = isHovering;
|
isHoveringPrevious = isHovering;
|
||||||
isHoldInteractingPrevious = isHoldInteracting;
|
isHoldInteractingPrevious = isHoldInteracting;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace game::state::play
|
|||||||
class CharacterManager
|
class CharacterManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
bool isDisabled{};
|
||||||
bool isInteracting{};
|
bool isInteracting{};
|
||||||
bool isHovering{};
|
bool isHovering{};
|
||||||
bool isInteractingPrevious{};
|
bool isInteractingPrevious{};
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ namespace game::state::play
|
|||||||
|
|
||||||
ImGui::SeparatorText("Dialogue");
|
ImGui::SeparatorText("Dialogue");
|
||||||
|
|
||||||
|
if (character.data.dialogue.start.is_valid())
|
||||||
|
if (WIDGET_FX(ImGui::Button("Play Start Sequence"))) isStartSequenceRequested = true;
|
||||||
|
if (character.data.dialogue.end.is_valid())
|
||||||
|
if (WIDGET_FX(ImGui::Button("Play End Sequence"))) isEndSequenceRequested = true;
|
||||||
|
|
||||||
if (ImGui::BeginChild("##Dialogue", childSize, ImGuiChildFlags_Borders))
|
if (ImGui::BeginChild("##Dialogue", childSize, ImGuiChildFlags_Borders))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (int)character.data.dialogue.entries.size(); i++)
|
for (int i = 0; i < (int)character.data.dialogue.entries.size(); i++)
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ namespace game::state::play
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool isBoundsDisplay{};
|
bool isBoundsDisplay{};
|
||||||
|
bool isStartSequenceRequested{};
|
||||||
|
bool isEndSequenceRequested{};
|
||||||
|
|
||||||
void update(entity::Character&, entity::Cursor&, ItemManager&, Canvas&, Text&);
|
void update(entity::Character&, entity::Cursor&, ItemManager&, Canvas&, Text&);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -57,6 +57,24 @@ namespace game::state::play
|
|||||||
|
|
||||||
auto& io = ImGui::GetIO();
|
auto& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
if (isDisabled)
|
||||||
|
{
|
||||||
|
if (heldItemIndex != -1)
|
||||||
|
{
|
||||||
|
heldItemIndex = -1;
|
||||||
|
isJustItemHeldStopped = true;
|
||||||
|
}
|
||||||
|
isItemHovered = false;
|
||||||
|
isItemHeld = false;
|
||||||
|
isJustItemHeld = false;
|
||||||
|
isMouseLeftClicked = false;
|
||||||
|
isMouseLeftDown = false;
|
||||||
|
isMouseLeftReleased = false;
|
||||||
|
isMouseRightClicked = false;
|
||||||
|
isMouseRightDown = false;
|
||||||
|
isImguiCaptureMouse = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (isJustItemHoveredStopped)
|
if (isJustItemHoveredStopped)
|
||||||
{
|
{
|
||||||
cursor.queue_default_animation();
|
cursor.queue_default_animation();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace game::state::play
|
|||||||
public:
|
public:
|
||||||
static constexpr auto LIMIT = 100;
|
static constexpr auto LIMIT = 100;
|
||||||
|
|
||||||
|
bool isDisabled{};
|
||||||
std::vector<entity::Item> items{};
|
std::vector<entity::Item> items{};
|
||||||
int heldItemIndex{-1};
|
int heldItemIndex{-1};
|
||||||
int queuedRemoveItemIndex{-1};
|
int queuedRemoveItemIndex{-1};
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace game::state::play
|
|||||||
|
|
||||||
auto style = ImGui::GetStyle();
|
auto style = ImGui::GetStyle();
|
||||||
auto& io = ImGui::GetIO();
|
auto& io = ImGui::GetIO();
|
||||||
|
isDebugOpen = false;
|
||||||
|
|
||||||
slide.update(isOpen, io.DeltaTime);
|
slide.update(isOpen, io.DeltaTime);
|
||||||
|
|
||||||
@@ -93,6 +94,7 @@ namespace game::state::play
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (WIDGET_FX(ImGui::BeginTabItem("Debug")))
|
if (WIDGET_FX(ImGui::BeginTabItem("Debug")))
|
||||||
{
|
{
|
||||||
|
isDebugOpen = true;
|
||||||
debug.update(character, cursor, itemManager, canvas, text);
|
debug.update(character, cursor, itemManager, canvas, text);
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace game::state::play
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool isOpen{true};
|
bool isOpen{true};
|
||||||
|
bool isDebugOpen{};
|
||||||
util::imgui::WindowSlide slide{};
|
util::imgui::WindowSlide slide{};
|
||||||
|
|
||||||
void tick();
|
void tick();
|
||||||
|
|||||||
Reference in New Issue
Block a user