diff --git a/src/application.cpp b/src/application.cpp
index 9162dd1..653abb1 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -17,7 +17,6 @@
* along with Antkeeper source code. If not, see .
*/
-
#include "animation/frame-scheduler.hpp"
#include "application.hpp"
#include "debug/logger.hpp"
diff --git a/src/game/bootloader.cpp b/src/game/bootloader.cpp
index c6d609c..4e3bd1a 100644
--- a/src/game/bootloader.cpp
+++ b/src/game/bootloader.cpp
@@ -770,6 +770,7 @@ void setup_entities(game_context* ctx)
ctx->lens_entity = ctx->ecs_registry->create();
ctx->marker_entity = ctx->ecs_registry->create();
ctx->container_entity = ctx->ecs_registry->create();
+ ctx->twig_entity = ctx->ecs_registry->create();
ctx->focal_point_entity = ctx->ecs_registry->create();
}
@@ -1015,6 +1016,7 @@ void setup_controls(game_context* ctx)
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_equip_lens_control(), nullptr, scancode::three));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_equip_marker_control(), nullptr, scancode::four));
ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_equip_container_control(), nullptr, scancode::five));
+ ctx->input_event_router->add_mapping(key_mapping(ctx->control_system->get_equip_twig_control(), nullptr, scancode::six));
ctx->input_event_router->add_mapping(mouse_button_mapping(ctx->control_system->get_use_tool_control(), nullptr, 1));
ctx->control_system->get_use_tool_control()->set_activated_callback
@@ -1067,6 +1069,13 @@ void setup_controls(game_context* ctx)
ctx->tool_system->set_active_tool(ctx->container_entity);
}
);
+ ctx->control_system->get_equip_twig_control()->set_activated_callback
+ (
+ [ctx]()
+ {
+ ctx->tool_system->set_active_tool(ctx->twig_entity);
+ }
+ );
event_dispatcher->subscribe(ctx->control_system);
event_dispatcher->subscribe(ctx->camera_system);
diff --git a/src/game/game-context.hpp b/src/game/game-context.hpp
index ac29fae..fbc4517 100644
--- a/src/game/game-context.hpp
+++ b/src/game/game-context.hpp
@@ -214,6 +214,7 @@ struct game_context
entt::entity lens_entity;
entt::entity marker_entity;
entt::entity container_entity;
+ entt::entity twig_entity;
entt::entity focal_point_entity;
// Systems
diff --git a/src/game/states/play-state.cpp b/src/game/states/play-state.cpp
index 2b381fa..e8f78ba 100644
--- a/src/game/states/play-state.cpp
+++ b/src/game/states/play-state.cpp
@@ -82,6 +82,7 @@ void play_state_enter(game_context* ctx)
ecs::archetype* brush_archetype = resource_manager->load("brush.ent");
ecs::archetype* marker_archetype = resource_manager->load("marker.ent");
ecs::archetype* container_archetype = resource_manager->load("container.ent");
+ ecs::archetype* twig_archetype = resource_manager->load("twig.ent");
ecs::archetype* larva_archetype = resource_manager->load("larva.ent");
ecs::archetype* pebble_archetype = resource_manager->load("pebble.ent");
ecs::archetype* flashlight_archetype = resource_manager->load("flashlight.ent");
@@ -94,6 +95,7 @@ void play_state_enter(game_context* ctx)
brush_archetype->assign(ecs_registry, ctx->brush_entity);
marker_archetype->assign(ecs_registry, ctx->marker_entity);
container_archetype->assign(ecs_registry, ctx->container_entity);
+ twig_archetype->assign(ecs_registry, ctx->twig_entity);
// Create flashlight and light cone, set light cone parent to flashlight, and move both to underworld scene
flashlight_archetype->assign(ecs_registry, ctx->flashlight_entity);
@@ -121,6 +123,7 @@ void play_state_enter(game_context* ctx)
ec::assign_render_layers(ecs_registry, ctx->lens_entity, 0);
ec::assign_render_layers(ecs_registry, ctx->marker_entity, 0);
ec::assign_render_layers(ecs_registry, ctx->container_entity, 0);
+ ec::assign_render_layers(ecs_registry, ctx->twig_entity, 0);
// Activate lens tool
ctx->tool_system->set_active_tool(ctx->lens_entity);
diff --git a/src/game/systems/control-system.cpp b/src/game/systems/control-system.cpp
index 3896e29..8f0754e 100644
--- a/src/game/systems/control-system.cpp
+++ b/src/game/systems/control-system.cpp
@@ -56,6 +56,7 @@ control_system::control_system(entt::registry& registry):
control_set.add_control(&equip_forceps_control);
control_set.add_control(&equip_marker_control);
control_set.add_control(&equip_container_control);
+ control_set.add_control(&equip_twig_control);
control_set.add_control(&use_tool_control);
// Set deadzone at 15% for all controls
diff --git a/src/game/systems/control-system.hpp b/src/game/systems/control-system.hpp
index 6a9ed78..a3f9f50 100644
--- a/src/game/systems/control-system.hpp
+++ b/src/game/systems/control-system.hpp
@@ -76,6 +76,7 @@ public:
control* get_equip_forceps_control();
control* get_equip_marker_control();
control* get_equip_container_control();
+ control* get_equip_twig_control();
control* get_use_tool_control();
private:
@@ -103,6 +104,7 @@ private:
control equip_forceps_control;
control equip_marker_control;
control equip_container_control;
+ control equip_twig_control;
control use_tool_control;
float zoom_speed;
@@ -243,6 +245,10 @@ inline control* control_system::get_equip_container_control()
return &equip_container_control;
}
+inline control* control_system::get_equip_twig_control()
+{
+ return &equip_twig_control;
+}
inline control* control_system::get_use_tool_control()
{
diff --git a/src/game/systems/tool-system.cpp b/src/game/systems/tool-system.cpp
index 66bd01b..4acfb74 100644
--- a/src/game/systems/tool-system.cpp
+++ b/src/game/systems/tool-system.cpp
@@ -146,7 +146,7 @@ void tool_system::update(double t, double dt)
}
// Determine target hand angle
- hand_angle_spring.x1 = math::pi - std::min(0.5f, std::max(-0.5f, ((mouse_position[0] / viewport[2]) - 0.5f) * 1.0f)) * (math::pi);
+ hand_angle_spring.x1 = -std::min(0.5f, std::max(-0.5f, ((mouse_position[0] / viewport[2]) - 0.5f) * 1.0f)) * (math::pi);
// Solve springs
solve_numeric_spring(hand_angle_spring, dt);
@@ -176,7 +176,7 @@ void tool_system::update(double t, double dt)
// Interpolate between left and right hand
math::quaternion hand_rotation = math::angle_axis(orbit_cam->get_azimuth() + hand_angle_spring.x0, float3{0, 1, 0});
- math::quaternion tilt_rotation = math::angle_axis(-orbit_cam->get_elevation(), float3{-1.0f, 0.0f, 0.0f});
+ math::quaternion tilt_rotation = math::angle_axis(orbit_cam->get_elevation(), float3{-1.0f, 0.0f, 0.0f});
if (tool.heliotropic)
{