mini stage 6

This commit is contained in:
2026-09-01 17:18:24 -04:00
parent 019a2f73fb
commit 92b8fcae24
23 changed files with 293556 additions and 132265 deletions
+10 -1
View File
@@ -266,8 +266,17 @@ namespace game::state
if (!isSceneActive)
{
tools.update(character, cursor, world, focus, worldCanvas, false, UI_ALPHA_MAX);
auto tool_rub_apply = [&]()
{
static constexpr auto AUTOFEED_INTERACT_TYPE_RUB = "Rub";
auto rubInteractTypeID = character.data.interact_type_id_get(AUTOFEED_INTERACT_TYPE_RUB);
if (rubInteractTypeID != -1) cursor.interactTypeID = rubInteractTypeID;
};
if (autofeed.enabled_get()) tool_rub_apply();
tools.update(character, cursor, world, focus, worldCanvas, false, autofeed.enabled_get(), UI_ALPHA_MAX);
menu.update(resources, itemManager, character, text, autofeed);
if (autofeed.enabled_get()) tool_rub_apply();
toasts.update();
}
+5 -1
View File
@@ -130,6 +130,8 @@ namespace game::state::play
.interrupt = Entity::Interrupt::ALWAYS});
}
interactArea->soundEntries.play();
if (!interactArea->defaultAnimationOnEnd.empty())
character.default_animation_override_set(interactArea->defaultAnimationOnEnd);
for (auto* particle : character.data.children_get(*interactArea, Schema::Element::PARTICLE))
if (particle && !particle->typeString.empty())
particles.push_back({.label = particle->typeString, .position = cursorWorldPosition});
@@ -160,7 +162,9 @@ namespace game::state::play
if (text.is_interruptible() && isDialogueReady)
{
auto* entry = dialogue.dialogue_pool_entry_get(poolID);
if (entry) text.set(entry, character);
if (entry)
text.set(entry, character, true, false,
isInteract ? std::string{} : interactArea->defaultAnimationOnEnd);
}
}
else if (interactArea->dialoguePoolID.empty() && !interactArea->animation.empty())
+13 -1
View File
@@ -119,11 +119,20 @@ namespace game::state::play
}
}
void Text::default_animation_on_end_play(Entity& character)
{
if (defaultAnimationOnEnd.empty()) return;
character.default_animation_override_set(defaultAnimationOnEnd);
character.play({.animation = character.idle_animation_get(), .appendID = character.animation_append_id_get()});
defaultAnimationOnEnd.clear();
}
void Text::set(resource::xml::Schema::Element* dialogueEntry, Entity& character, bool isInterruptible,
bool isSequenceAdvance)
bool isSequenceAdvance, std::string defaultAnimationOnEnd)
{
if (!dialogueEntry) return;
this->entry = dialogueEntry;
if (!isSequenceAdvance) this->defaultAnimationOnEnd = defaultAnimationOnEnd;
if (!isSequenceAdvance) isSceneActive = false;
if (!isSceneActive && !isSequenceAdvance)
@@ -267,6 +276,7 @@ namespace game::state::play
{
isFinished = true;
isEnabled = false;
default_animation_on_end_play(character);
if (isTerminal) isSceneActive = false;
}
return;
@@ -427,6 +437,7 @@ namespace game::state::play
}
else if (isAdvance)
{
default_animation_on_end_play(character);
isEnabled = false;
entry = nullptr;
isSceneActive = false;
@@ -479,6 +490,7 @@ namespace game::state::play
{
if (time += ImGui::GetIO().DeltaTime; time > LIFETIME)
{
default_animation_on_end_play(character);
isEnabled = false;
entry = nullptr;
isSceneActive = false;
+6 -1
View File
@@ -1,6 +1,7 @@
#pragma once
#include <imgui.h>
#include <string>
#include "../../entity.hpp"
#include "../../render/canvas.hpp"
@@ -22,6 +23,9 @@ namespace game::state::play
bool isSceneActive{};
bool isAnimationEntryStarted{};
float animationEntryTimePrevious{};
std::string defaultAnimationOnEnd{};
void default_animation_on_end_play(Entity&);
public:
static constexpr auto LIFETIME = 10.0f;
@@ -31,7 +35,8 @@ namespace game::state::play
bool isEnabled{true};
float time{};
void set(resource::xml::Schema::Element*, Entity&, bool isInterruptible = true, bool isSequenceAdvance = false);
void set(resource::xml::Schema::Element*, Entity&, bool isInterruptible = true, bool isSequenceAdvance = false,
std::string defaultAnimationOnEnd = {});
void update(Entity&, Canvas&);
bool is_interruptible() const;
bool is_finished() const;
+11 -6
View File
@@ -12,7 +12,7 @@ using namespace game::resource::xml;
namespace game::state::play
{
void Tools::update(Entity& character, Entity& cursor, World& world, World::Focus focus, Canvas& canvas,
bool isDisabled, float fadeAlpha)
bool isDisabled, bool isAutofeedEnabled, float fadeAlpha)
{
static constexpr auto WIDTH_MULTIPLIER = 0.05f;
static constexpr auto ALPHA_MIN = 0.0f;
@@ -63,7 +63,7 @@ namespace game::state::play
auto* iconsFont = schema.iconsFont.is_valid() ? schema.iconsFont.get() : nullptr;
auto tool_button = [&](const char* id, const std::string& label, const std::string& iconGlyph,
const std::string& tooltip, bool isActive = false)
const std::string& tooltip, bool isActive = false, bool isToolDisabled = false)
{
auto useIcon = iconsFont && !iconGlyph.empty();
auto result = false;
@@ -71,10 +71,9 @@ namespace game::state::play
ImGui::PushID(id);
if (isActive) ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered));
ImGui::BeginDisabled(isToolDisabled);
result = WIDGET_FX(ImGui::Button(useIcon ? "##ToolIcon" : label.c_str(), buttonSize));
if (isActive) ImGui::PopStyleColor();
if (useIcon)
{
auto min = ImGui::GetItemRectMin();
@@ -86,6 +85,10 @@ namespace game::state::play
iconGlyph.c_str());
}
ImGui::EndDisabled();
if (isActive) ImGui::PopStyleColor();
if (!tooltip.empty()) ImGui::SetItemTooltip("%s", tooltip.c_str());
ImGui::PopID();
return result;
@@ -101,8 +104,10 @@ namespace game::state::play
break;
}
if (tool_button(name.c_str(), name, iconGlyph, iconsFont && !iconGlyph.empty() ? name : "",
cursor.interactTypeID == interactTypeID))
auto tooltip = isAutofeedEnabled ? strings.get(Strings::ToolsAutofeedDisabledTooltip)
: iconsFont && !iconGlyph.empty() ? name : "";
if (tool_button(name.c_str(), name, iconGlyph, tooltip, cursor.interactTypeID == interactTypeID,
isAutofeedEnabled))
cursor.interactTypeID = interactTypeID;
};
+2 -1
View File
@@ -13,6 +13,7 @@ namespace game::state::play
bool isOpen{};
util::imgui::WindowSlide slide{0.125f, 0.0f};
void update(Entity&, Entity&, World&, World::Focus, Canvas&, bool isDisabled, float fadeAlpha);
void update(Entity&, Entity&, World&, World::Focus, Canvas&, bool isDisabled, bool isAutofeedEnabled,
float fadeAlpha);
};
}