summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-27 21:30:00 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-27 21:30:00 +0100
commit722b07a415f82a7fe56f595497ddf2ec0816f27c (patch)
tree42df92ff7f6d0a670644991cfff34ee3627a8c40 /src
parent5becc80e3c3eb04f2067cb000e32eef45441e5f3 (diff)
actually speed should be the property of critter
Diffstat (limited to 'src')
-rw-r--r--src/critter.cpp1
-rw-r--r--src/critter.hpp2
-rw-r--r--src/object.cpp2
-rw-r--r--src/object.hpp2
4 files changed, 4 insertions, 3 deletions
diff --git a/src/critter.cpp b/src/critter.cpp
index c8bb2e4f..781d086b 100644
--- a/src/critter.cpp
+++ b/src/critter.cpp
@@ -230,6 +230,7 @@ critter::operator critter_proto() const
critter::critter(object_id id, class chunk& c, const critter_proto& proto) :
object{id, c, proto},
name{proto.name},
+ speed{proto.speed},
playable{proto.playable}
{
if (!name)
diff --git a/src/critter.hpp b/src/critter.hpp
index b2f356e4..cfb6acb3 100644
--- a/src/critter.hpp
+++ b/src/critter.hpp
@@ -11,6 +11,7 @@ class world;
struct critter_proto : object_proto
{
String name;
+ float speed = 1;
bool playable : 1 = false;
critter_proto();
@@ -31,6 +32,7 @@ struct critter final : object
float depth_offset() const override;
String name;
+ float speed = 1;
Vector2us offset_frac;
bool b_L : 1 = false, b_R : 1 = false, b_U : 1 = false, b_D : 1 = false;
bool playable : 1 = false;
diff --git a/src/object.cpp b/src/object.cpp
index 96acd4b9..307a2155 100644
--- a/src/object.cpp
+++ b/src/object.cpp
@@ -47,7 +47,7 @@ object_proto::object_proto(const object_proto&) = default;
object_type object_proto::type_of() const noexcept { return type; }
object::object(object_id id, class chunk& c, const object_proto& proto) :
- id{id}, c{&c}, atlas{proto.atlas}, speed{proto.speed},
+ id{id}, c{&c}, atlas{proto.atlas},
offset{proto.offset}, bbox_offset{proto.bbox_offset},
bbox_size{proto.bbox_size}, delta{proto.delta},
frame{proto.frame}, r{proto.r}, pass{proto.pass}
diff --git a/src/object.hpp b/src/object.hpp
index c915b134..2d33885d 100644
--- a/src/object.hpp
+++ b/src/object.hpp
@@ -18,7 +18,6 @@ class chunk;
struct object_proto
{
std::shared_ptr<anim_atlas> atlas;
- float speed = 1;
Vector2b offset, bbox_offset;
Vector2ub bbox_size = Vector2ub(tile_size_xy);
uint16_t delta = 0, frame = 0;
@@ -45,7 +44,6 @@ struct object
class chunk* const c;
const std::shared_ptr<anim_atlas> atlas;
const global_coords coord;
- float speed = 1;
const Vector2b offset, bbox_offset;
const Vector2ub bbox_size;
uint16_t delta = 0, frame = 0;