This commit is contained in:
2
.clangd
2
.clangd
@@ -1,3 +1,3 @@
|
|||||||
CompileFlags:
|
CompileFlags:
|
||||||
CompilationDatabase: build
|
CompilationDatabase: out/build/linux-debug
|
||||||
Add: [-std=gnu++23]
|
Add: [-std=gnu++23]
|
||||||
|
|||||||
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@@ -9,7 +9,7 @@
|
|||||||
"program": "${workspaceFolder}/out/build/linux-debug/bin/Debug/snivy",
|
"program": "${workspaceFolder}/out/build/linux-debug/bin/Debug/snivy",
|
||||||
"args": [],
|
"args": [],
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${workspaceFolder}/out/build/linux-debug",
|
"cwd": "${workspaceFolder}/out/build/linux-debug/bin/Debug",
|
||||||
"environment": [],
|
"environment": [],
|
||||||
"externalConsole": false,
|
"externalConsole": false,
|
||||||
"MIMode": "gdb",
|
"MIMode": "gdb",
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
"windows": {
|
"windows": {
|
||||||
"type": "cppvsdbg",
|
"type": "cppvsdbg",
|
||||||
"program": "${workspaceFolder}/out/build/x64-Debug/bin/Debug/snivy.exe",
|
"program": "${workspaceFolder}/out/build/x64-Debug/bin/Debug/snivy.exe",
|
||||||
"cwd": "${workspaceFolder}/out/build/x64-Debug"
|
"cwd": "${workspaceFolder}/out/build/x64-Debug/bin/Debug"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
"preLaunchTask": "cmake: build release",
|
"preLaunchTask": "cmake: build release",
|
||||||
"program": "${workspaceFolder}/out/build/linux-release/bin/Release/snivy",
|
"program": "${workspaceFolder}/out/build/linux-release/bin/Release/snivy",
|
||||||
"args": [],
|
"args": [],
|
||||||
"cwd": "${workspaceFolder}/out/build/linux-release",
|
"cwd": "${workspaceFolder}/out/build/linux-release/bin/Release",
|
||||||
"environment": [],
|
"environment": [],
|
||||||
"externalConsole": false,
|
"externalConsole": false,
|
||||||
"MIMode": "gdb",
|
"MIMode": "gdb",
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
"windows": {
|
"windows": {
|
||||||
"type": "cppvsdbg",
|
"type": "cppvsdbg",
|
||||||
"program": "${workspaceFolder}/out/build/x64-Release/bin/Release/snivy.exe",
|
"program": "${workspaceFolder}/out/build/x64-Release/bin/Release/snivy.exe",
|
||||||
"cwd": "${workspaceFolder}/out/build/x64-Release"
|
"cwd": "${workspaceFolder}/out/build/x64-Release/bin/Release"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
6
.vscode/tasks.json
vendored
6
.vscode/tasks.json
vendored
@@ -61,6 +61,9 @@
|
|||||||
"linux": {
|
"linux": {
|
||||||
"command": "${workspaceFolder}/out/build/linux-debug/bin/Debug/snivy"
|
"command": "${workspaceFolder}/out/build/linux-debug/bin/Debug/snivy"
|
||||||
},
|
},
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}/out/build/linux-debug/bin/Debug"
|
||||||
|
},
|
||||||
"windows": {
|
"windows": {
|
||||||
"command": "echo \"linux: run debug is Linux-only\" && exit 1"
|
"command": "echo \"linux: run debug is Linux-only\" && exit 1"
|
||||||
},
|
},
|
||||||
@@ -73,6 +76,9 @@
|
|||||||
"linux": {
|
"linux": {
|
||||||
"command": "${workspaceFolder}/out/build/linux-release/bin/Release/snivy"
|
"command": "${workspaceFolder}/out/build/linux-release/bin/Release/snivy"
|
||||||
},
|
},
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}/out/build/linux-release/bin/Release"
|
||||||
|
},
|
||||||
"windows": {
|
"windows": {
|
||||||
"command": "echo \"linux: run release is Linux-only\" && exit 1"
|
"command": "echo \"linux: run release is Linux-only\" && exit 1"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ if(EXISTS "${PROJECT_RESOURCES_DIR}")
|
|||||||
-DSRC_DIR="${PROJECT_RESOURCES_DIR}"
|
-DSRC_DIR="${PROJECT_RESOURCES_DIR}"
|
||||||
-DDST_DIR="${PROJECT_RESOURCES_BINARY_DIR}"
|
-DDST_DIR="${PROJECT_RESOURCES_BINARY_DIR}"
|
||||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/copy_resources.cmake"
|
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/copy_resources.cmake"
|
||||||
|
WORKING_DIRECTORY "$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
||||||
DEPENDS ${PROJECT_RESOURCE_FILES}
|
DEPENDS ${PROJECT_RESOURCE_FILES}
|
||||||
COMMENT "Copying resources directory")
|
COMMENT "Copying resources directory")
|
||||||
add_dependencies(${PROJECT_NAME} copy_resources)
|
add_dependencies(${PROJECT_NAME} copy_resources)
|
||||||
|
|||||||
@@ -2,6 +2,20 @@ if(NOT DEFINED SRC_DIR OR NOT DEFINED DST_DIR)
|
|||||||
message(FATAL_ERROR "SRC_DIR and DST_DIR must be defined")
|
message(FATAL_ERROR "SRC_DIR and DST_DIR must be defined")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(CHARACTERS_DIR "${SRC_DIR}/characters")
|
||||||
|
set(CHARACTERS_ZIP_SCRIPT "${CHARACTERS_DIR}/zip")
|
||||||
|
|
||||||
|
if(EXISTS "${CHARACTERS_ZIP_SCRIPT}")
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${CHARACTERS_ZIP_SCRIPT}"
|
||||||
|
WORKING_DIRECTORY "${CHARACTERS_DIR}"
|
||||||
|
RESULT_VARIABLE ZIP_SCRIPT_RESULT
|
||||||
|
)
|
||||||
|
if(NOT ZIP_SCRIPT_RESULT EQUAL 0)
|
||||||
|
message(FATAL_ERROR "Failed running ${CHARACTERS_ZIP_SCRIPT} (exit code ${ZIP_SCRIPT_RESULT})")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
file(REMOVE_RECURSE "${DST_DIR}")
|
file(REMOVE_RECURSE "${DST_DIR}")
|
||||||
file(MAKE_DIRECTORY "${DST_DIR}")
|
file(MAKE_DIRECTORY "${DST_DIR}")
|
||||||
|
|
||||||
@@ -11,7 +25,7 @@ file(COPY "${SRC_DIR}/" DESTINATION "${DST_DIR}"
|
|||||||
|
|
||||||
# Copy only .zip archives from resources/characters.
|
# Copy only .zip archives from resources/characters.
|
||||||
file(MAKE_DIRECTORY "${DST_DIR}/characters")
|
file(MAKE_DIRECTORY "${DST_DIR}/characters")
|
||||||
file(GLOB CHARACTER_ZIPS "${SRC_DIR}/characters/*.zip")
|
file(GLOB CHARACTER_ZIPS "${CHARACTERS_DIR}/*.zip")
|
||||||
if(CHARACTER_ZIPS)
|
if(CHARACTER_ZIPS)
|
||||||
file(COPY ${CHARACTER_ZIPS} DESTINATION "${DST_DIR}/characters")
|
file(COPY ${CHARACTER_ZIPS} DESTINATION "${DST_DIR}/characters")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -139,7 +139,8 @@ namespace game::entity
|
|||||||
float Character::capacity_percent_get() const { return calories / max_capacity(); }
|
float Character::capacity_percent_get() const { return calories / max_capacity(); }
|
||||||
|
|
||||||
std::string Character::animation_name_convert(const std::string& name) { return std::format("{}{}", name, stage); }
|
std::string Character::animation_name_convert(const std::string& name) { return std::format("{}{}", name, stage); }
|
||||||
void Character::play_convert(const std::string& animation, Mode playMode, float startAtTime, float speedMultiplierValue)
|
void Character::play_convert(const std::string& animation, Mode playMode, float startAtTime,
|
||||||
|
float speedMultiplierValue)
|
||||||
{
|
{
|
||||||
play(animation_name_convert(animation), playMode, startAtTime, speedMultiplierValue);
|
play(animation_name_convert(animation), playMode, startAtTime, speedMultiplierValue);
|
||||||
}
|
}
|
||||||
@@ -225,7 +226,7 @@ namespace game::entity
|
|||||||
else
|
else
|
||||||
isJustDigested = true;
|
isJustDigested = true;
|
||||||
|
|
||||||
weight = glm::clamp(data.weightMin, weight + increment, data.weightMax);
|
weight += increment;
|
||||||
|
|
||||||
isDigesting = false;
|
isDigesting = false;
|
||||||
digestionTimer = data.digestionTimerMax;
|
digestionTimer = data.digestionTimerMax;
|
||||||
|
|||||||
@@ -4,11 +4,32 @@
|
|||||||
|
|
||||||
using namespace game::util;
|
using namespace game::util;
|
||||||
|
|
||||||
|
static ImFont* default_font_fallback_get()
|
||||||
|
{
|
||||||
|
auto& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
if (io.FontDefault) return io.FontDefault;
|
||||||
|
if (!io.Fonts->Fonts.empty()) return io.Fonts->Fonts.front();
|
||||||
|
return io.Fonts->AddFontDefault();
|
||||||
|
}
|
||||||
|
|
||||||
namespace game::resource
|
namespace game::resource
|
||||||
{
|
{
|
||||||
Font::Font(const std::filesystem::path& path, float size)
|
Font::Font(const std::filesystem::path& path, float size)
|
||||||
{
|
{
|
||||||
auto pathString = path.string();
|
auto pathString = path.string();
|
||||||
|
std::error_code ec;
|
||||||
|
|
||||||
|
if (!std::filesystem::is_regular_file(path, ec))
|
||||||
|
{
|
||||||
|
logger.error(std::format("Failed to initialize font: {} (file not found)", pathString));
|
||||||
|
internal = default_font_fallback_get();
|
||||||
|
if (internal)
|
||||||
|
logger.info(std::format("Falling back to default ImGui font: {}", pathString));
|
||||||
|
else
|
||||||
|
logger.error("Failed to initialize fallback ImGui default font");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ImFontConfig config;
|
ImFontConfig config;
|
||||||
config.FontDataOwnedByAtlas = false;
|
config.FontDataOwnedByAtlas = false;
|
||||||
@@ -18,7 +39,14 @@ namespace game::resource
|
|||||||
if (internal)
|
if (internal)
|
||||||
logger.info(std::format("Initialized font: {}", pathString));
|
logger.info(std::format("Initialized font: {}", pathString));
|
||||||
else
|
else
|
||||||
|
{
|
||||||
logger.error(std::format("Failed to initialize font: {}", pathString));
|
logger.error(std::format("Failed to initialize font: {}", pathString));
|
||||||
|
internal = default_font_fallback_get();
|
||||||
|
if (internal)
|
||||||
|
logger.info(std::format("Falling back to default ImGui font: {}", pathString));
|
||||||
|
else
|
||||||
|
logger.error("Failed to initialize fallback ImGui default font");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Font::Font(const physfs::Path& path, float size)
|
Font::Font(const physfs::Path& path, float size)
|
||||||
@@ -27,6 +55,11 @@ namespace game::resource
|
|||||||
{
|
{
|
||||||
logger.error(
|
logger.error(
|
||||||
std::format("Failed to initialize font from PhysicsFS path: {} ({})", path.c_str(), physfs::error_get()));
|
std::format("Failed to initialize font from PhysicsFS path: {} ({})", path.c_str(), physfs::error_get()));
|
||||||
|
internal = default_font_fallback_get();
|
||||||
|
if (internal)
|
||||||
|
logger.info(std::format("Falling back to default ImGui font: {}", path.c_str()));
|
||||||
|
else
|
||||||
|
logger.error("Failed to initialize fallback ImGui default font");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +69,22 @@ namespace game::resource
|
|||||||
{
|
{
|
||||||
logger.error(
|
logger.error(
|
||||||
std::format("Failed to initialize font from PhysicsFS path: {} ({})", path.c_str(), physfs::error_get()));
|
std::format("Failed to initialize font from PhysicsFS path: {} ({})", path.c_str(), physfs::error_get()));
|
||||||
|
internal = default_font_fallback_get();
|
||||||
|
if (internal)
|
||||||
|
logger.info(std::format("Falling back to default ImGui font: {}", path.c_str()));
|
||||||
|
else
|
||||||
|
logger.error("Failed to initialize fallback ImGui default font");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buffer.size() <= 100)
|
||||||
|
{
|
||||||
|
logger.error(std::format("Failed to initialize font from PhysicsFS path: {} (buffer too small)", path.c_str()));
|
||||||
|
internal = default_font_fallback_get();
|
||||||
|
if (internal)
|
||||||
|
logger.info(std::format("Falling back to default ImGui font: {}", path.c_str()));
|
||||||
|
else
|
||||||
|
logger.error("Failed to initialize fallback ImGui default font");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +96,14 @@ namespace game::resource
|
|||||||
if (internal)
|
if (internal)
|
||||||
logger.info(std::format("Initialized font: {}", path.c_str()));
|
logger.info(std::format("Initialized font: {}", path.c_str()));
|
||||||
else
|
else
|
||||||
|
{
|
||||||
logger.error(std::format("Failed to initialize font: {}", path.c_str()));
|
logger.error(std::format("Failed to initialize font: {}", path.c_str()));
|
||||||
|
internal = default_font_fallback_get();
|
||||||
|
if (internal)
|
||||||
|
logger.info(std::format("Falling back to default ImGui font: {}", path.c_str()));
|
||||||
|
else
|
||||||
|
logger.error("Failed to initialize fallback ImGui default font");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImFont* Font::get() { return internal; };
|
ImFont* Font::get() { return internal; };
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ namespace game::resource::xml
|
|||||||
query_string_attribute(root, "Name", &name);
|
query_string_attribute(root, "Name", &name);
|
||||||
|
|
||||||
root->QueryFloatAttribute("Weight", &weight);
|
root->QueryFloatAttribute("Weight", &weight);
|
||||||
root->QueryFloatAttribute("WeightMin", &weightMin);
|
|
||||||
root->QueryFloatAttribute("WeightMax", &weightMax);
|
|
||||||
|
|
||||||
root->QueryFloatAttribute("Capacity", &capacity);
|
root->QueryFloatAttribute("Capacity", &capacity);
|
||||||
root->QueryFloatAttribute("CapacityMin", &capacityMin);
|
root->QueryFloatAttribute("CapacityMin", &capacityMin);
|
||||||
|
|||||||
@@ -117,8 +117,6 @@ namespace game::resource::xml
|
|||||||
std::string name{};
|
std::string name{};
|
||||||
std::filesystem::path path{};
|
std::filesystem::path path{};
|
||||||
float weight{50};
|
float weight{50};
|
||||||
float weightMin{};
|
|
||||||
float weightMax{999};
|
|
||||||
float capacity{2000.0f};
|
float capacity{2000.0f};
|
||||||
float capacityMin{2000.0f};
|
float capacityMin{2000.0f};
|
||||||
float capacityMax{99999.0f};
|
float capacityMax{99999.0f};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "resources.hpp"
|
#include "resources.hpp"
|
||||||
|
|
||||||
#include "util/preferences.hpp"
|
#include "util/preferences.hpp"
|
||||||
|
#include "log.hpp"
|
||||||
|
|
||||||
using namespace game::resource;
|
using namespace game::resource;
|
||||||
using namespace game::util;
|
using namespace game::util;
|
||||||
@@ -12,7 +13,19 @@ namespace game
|
|||||||
for (int i = 0; i < shader::COUNT; i++)
|
for (int i = 0; i < shader::COUNT; i++)
|
||||||
shaders[i] = Shader(shader::INFO[i].vertex, shader::INFO[i].fragment);
|
shaders[i] = Shader(shader::INFO[i].vertex, shader::INFO[i].fragment);
|
||||||
|
|
||||||
for (auto& entry : std::filesystem::recursive_directory_iterator("resources/characters"))
|
std::string CHARACTERS_DIRECTORY{"resources/characters"};
|
||||||
|
std::error_code ec{};
|
||||||
|
|
||||||
|
if (!std::filesystem::is_directory(CHARACTERS_DIRECTORY, ec))
|
||||||
|
{
|
||||||
|
if (ec)
|
||||||
|
logger.warning("Failed to read characters directory: " + CHARACTERS_DIRECTORY + " (" + ec.message() + ")");
|
||||||
|
else
|
||||||
|
logger.warning("Characters directory not found: " + CHARACTERS_DIRECTORY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& entry : std::filesystem::recursive_directory_iterator(CHARACTERS_DIRECTORY))
|
||||||
if (entry.is_regular_file() && entry.path().extension() == ".zip") characterPreviews.emplace_back(entry.path());
|
if (entry.is_regular_file() && entry.path().extension() == ".zip") characterPreviews.emplace_back(entry.path());
|
||||||
characters.resize(characterPreviews.size());
|
characters.resize(characterPreviews.size());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ namespace game::state
|
|||||||
|
|
||||||
character =
|
character =
|
||||||
entity::Character(data, vec2(World::BOUNDS.x + World::BOUNDS.z * 0.5f, World::BOUNDS.w - World::BOUNDS.y));
|
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 =
|
auto isAlternateSpritesheet =
|
||||||
(game == NEW_GAME && math::random_percent_roll(data.alternateSpritesheet.chanceOnNewGame));
|
(game == NEW_GAME && math::random_percent_roll(data.alternateSpritesheet.chanceOnNewGame));
|
||||||
@@ -88,16 +91,13 @@ namespace game::state
|
|||||||
|
|
||||||
isPostgame = saveData.isPostgame;
|
isPostgame = saveData.isPostgame;
|
||||||
|
|
||||||
if (isPostgame)
|
if (isPostgame) menu.isCheats = true;
|
||||||
menu.isCheats = true;
|
|
||||||
else
|
|
||||||
menu.isCheats = false;
|
|
||||||
|
|
||||||
if (game == NEW_GAME) isWindows = false;
|
if (game == NEW_GAME) isWindows = false;
|
||||||
|
|
||||||
if (auto font = character.data.menuSchema.font.get()) ImGui::GetIO().FontDefault = font;
|
if (auto font = character.data.menuSchema.font.get()) ImGui::GetIO().FontDefault = font;
|
||||||
|
|
||||||
character.play_default_animation();
|
character.queue_idle_animation();
|
||||||
character.tick();
|
character.tick();
|
||||||
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());
|
||||||
@@ -170,7 +170,8 @@ namespace game::state
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (character.isJustStageFinal && !isEnd && !isPostgame) isEnd = true;
|
if (character.isJustStageFinal && !isEnd && !isPostgame)
|
||||||
|
isEnd = true;
|
||||||
|
|
||||||
if (isEnd)
|
if (isEnd)
|
||||||
{
|
{
|
||||||
@@ -199,6 +200,7 @@ namespace game::state
|
|||||||
isEndEnd = true;
|
isEndEnd = true;
|
||||||
isEnd = false;
|
isEnd = false;
|
||||||
isPostgame = true;
|
isPostgame = true;
|
||||||
|
world.character_focus(character, worldCanvas, focus_get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,13 +32,6 @@ namespace game::state::main
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (WIDGET_FX(ImGui::Button("Digest"))) character.digestionProgress = entity::Character::DIGESTION_MAX;
|
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;
|
auto stage = character.stage + 1;
|
||||||
if (WIDGET_FX(ImGui::SliderInt("Stage", &stage, 1, (int)character.data.stages.size() + 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
|
class Cheats
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void update(Resources&, entity::Character&, Inventory&, Text&);
|
void update(Resources&, entity::Character&, Inventory&, Text&);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,13 @@ namespace game::state::main
|
|||||||
|
|
||||||
auto isImguiCaptureMouse = ImGui::GetIO().WantCaptureMouse;
|
auto isImguiCaptureMouse = ImGui::GetIO().WantCaptureMouse;
|
||||||
|
|
||||||
|
auto isItemsLocked = character.isStageUp;
|
||||||
|
|
||||||
|
if (isItemsLocked)
|
||||||
|
{
|
||||||
|
heldItemIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
auto isMouseLeftClicked = ImGui::IsMouseClicked(ImGuiMouseButton_Left);
|
auto isMouseLeftClicked = ImGui::IsMouseClicked(ImGuiMouseButton_Left);
|
||||||
auto isMouseLeftDown = ImGui::IsMouseDown(ImGuiMouseButton_Left);
|
auto isMouseLeftDown = ImGui::IsMouseDown(ImGuiMouseButton_Left);
|
||||||
auto isMouseLeftReleased = ImGui::IsMouseReleased(ImGuiMouseButton_Left);
|
auto isMouseLeftReleased = ImGui::IsMouseReleased(ImGuiMouseButton_Left);
|
||||||
@@ -54,7 +61,7 @@ namespace game::state::main
|
|||||||
if (isJustItemHeldStopped || isJustItemThrown)
|
if (isJustItemHeldStopped || isJustItemThrown)
|
||||||
{
|
{
|
||||||
cursor.queue_default_animation();
|
cursor.queue_default_animation();
|
||||||
if (!isJustItemThrown) character.queue_idle_animation();
|
if (!isJustItemThrown && !isItemsLocked) character.queue_idle_animation();
|
||||||
isJustItemHeldStopped = false;
|
isJustItemHeldStopped = false;
|
||||||
isJustItemThrown = false;
|
isJustItemThrown = false;
|
||||||
}
|
}
|
||||||
@@ -115,10 +122,10 @@ namespace game::state::main
|
|||||||
|
|
||||||
auto rect = character.null_frame_rect(eatArea.nullID);
|
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(
|
character.queue_play(
|
||||||
{.animation = eatArea.animation, .speedMultiplier = character.eatSpeed, .isInterruptible = false});
|
{.animation = eatArea.animation, .speedMultiplier = character.eatSpeed});
|
||||||
|
|
||||||
if (character.playedEventID == eatArea.eventID)
|
if (character.playedEventID == eatArea.eventID)
|
||||||
{
|
{
|
||||||
@@ -206,7 +213,7 @@ namespace game::state::main
|
|||||||
|
|
||||||
item.update();
|
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;
|
isItemHovered = true;
|
||||||
cursor.queue_play({cursorSchema.animations.hover.get()});
|
cursor.queue_play({cursorSchema.animations.hover.get()});
|
||||||
|
|||||||
@@ -91,13 +91,11 @@ namespace game::state::main
|
|||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DEBUG) && DEBUG
|
if (isDebug && WIDGET_FX(ImGui::BeginTabItem("Debug")))
|
||||||
if (WIDGET_FX(ImGui::BeginTabItem("Debug")))
|
|
||||||
{
|
{
|
||||||
debug.update(character, cursor, itemManager, canvas);
|
debug.update(character, cursor, itemManager, canvas);
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,14 @@ namespace game::state::main
|
|||||||
|
|
||||||
state::Configuration configuration;
|
state::Configuration configuration;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
bool isCheats{true};
|
bool isCheats{true};
|
||||||
|
bool isDebug{true};
|
||||||
|
#else
|
||||||
|
bool isCheats{};
|
||||||
|
bool isDebug{};
|
||||||
|
#endif
|
||||||
|
|
||||||
bool isOpen{true};
|
bool isOpen{true};
|
||||||
bool isChat{true};
|
bool isChat{true};
|
||||||
util::imgui::WindowSlide slide{};
|
util::imgui::WindowSlide slide{};
|
||||||
|
|||||||
Reference in New Issue
Block a user