update to end sequence
This commit is contained in:
@@ -41,6 +41,33 @@ namespace game::state
|
||||
: 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)
|
||||
{
|
||||
auto& data = resources.character_get(selectedCharacterIndex);
|
||||
@@ -128,14 +155,7 @@ namespace game::state
|
||||
worldCanvas.size_set(imgui::to_vec2(ImGui::GetMainViewport()->Size));
|
||||
world.set(character, worldCanvas, focus_get());
|
||||
|
||||
if (game == NEW_GAME && dialogue.start.is_valid())
|
||||
{
|
||||
character.queue_play({.animation = dialogue.start.animation, .isInterruptible = false});
|
||||
character.tick();
|
||||
isStart = true;
|
||||
isStartBegin = false;
|
||||
isStartEnd = false;
|
||||
}
|
||||
if (game == NEW_GAME && dialogue.start.is_valid()) start_sequence_begin();
|
||||
|
||||
if (isPostgame)
|
||||
{
|
||||
@@ -230,8 +250,27 @@ namespace game::state
|
||||
tools.update(character, cursor, world, focus, worldCanvas);
|
||||
info.update(resources, character);
|
||||
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 (isStart)
|
||||
@@ -274,7 +313,6 @@ namespace game::state
|
||||
menu.isOpen = false;
|
||||
character.calories = 0;
|
||||
character.digestionProgress = 0;
|
||||
itemManager.items.clear();
|
||||
itemManager.heldItemIndex = -1;
|
||||
world.character_focus(character, worldCanvas, focus_get());
|
||||
}
|
||||
|
||||
@@ -67,5 +67,7 @@ namespace game::state
|
||||
void render(Resources&, Canvas&);
|
||||
void save(Resources&);
|
||||
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 isImguiCaptureMouse = ImGui::GetIO().WantCaptureMouse;
|
||||
|
||||
if (isDisabled)
|
||||
{
|
||||
isInteracting = false;
|
||||
isHoldInteracting = false;
|
||||
isHovering = false;
|
||||
interactAreaID = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
isInteractingPrevious = isInteracting;
|
||||
isHoveringPrevious = isHovering;
|
||||
isHoldInteractingPrevious = isHoldInteracting;
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace game::state::play
|
||||
class CharacterManager
|
||||
{
|
||||
public:
|
||||
bool isDisabled{};
|
||||
bool isInteracting{};
|
||||
bool isHovering{};
|
||||
bool isInteractingPrevious{};
|
||||
|
||||
@@ -38,6 +38,11 @@ namespace game::state::play
|
||||
|
||||
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))
|
||||
{
|
||||
for (int i = 0; i < (int)character.data.dialogue.entries.size(); i++)
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace game::state::play
|
||||
{
|
||||
public:
|
||||
bool isBoundsDisplay{};
|
||||
bool isStartSequenceRequested{};
|
||||
bool isEndSequenceRequested{};
|
||||
|
||||
void update(entity::Character&, entity::Cursor&, ItemManager&, Canvas&, Text&);
|
||||
};
|
||||
|
||||
@@ -57,6 +57,24 @@ namespace game::state::play
|
||||
|
||||
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)
|
||||
{
|
||||
cursor.queue_default_animation();
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace game::state::play
|
||||
public:
|
||||
static constexpr auto LIMIT = 100;
|
||||
|
||||
bool isDisabled{};
|
||||
std::vector<entity::Item> items{};
|
||||
int heldItemIndex{-1};
|
||||
int queuedRemoveItemIndex{-1};
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace game::state::play
|
||||
|
||||
auto style = ImGui::GetStyle();
|
||||
auto& io = ImGui::GetIO();
|
||||
isDebugOpen = false;
|
||||
|
||||
slide.update(isOpen, io.DeltaTime);
|
||||
|
||||
@@ -93,6 +94,7 @@ namespace game::state::play
|
||||
#if DEBUG
|
||||
if (WIDGET_FX(ImGui::BeginTabItem("Debug")))
|
||||
{
|
||||
isDebugOpen = true;
|
||||
debug.update(character, cursor, itemManager, canvas, text);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace game::state::play
|
||||
#endif
|
||||
|
||||
bool isOpen{true};
|
||||
bool isDebugOpen{};
|
||||
util::imgui::WindowSlide slide{};
|
||||
|
||||
void tick();
|
||||
|
||||
Reference in New Issue
Block a user