From 722b07a415f82a7fe56f595497ddf2ec0816f27c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 27 Feb 2024 21:30:00 +0100 Subject: actually speed should be the property of critter --- src/critter.cpp | 1 + src/critter.hpp | 2 ++ src/object.cpp | 2 +- src/object.hpp | 2 -- 4 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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 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 atlas; const global_coords coord; - float speed = 1; const Vector2b offset, bbox_offset; const Vector2ub bbox_size; uint16_t delta = 0, frame = 0; -- cgit v1.2.3