From b7f3cff0904214f7161fed16bb5162b26260d386 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 27 Feb 2024 21:04:41 +0100 Subject: add speed field to object (yet unused) --- src/critter.hpp | 1 - src/object.cpp | 2 +- src/object.hpp | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/critter.hpp b/src/critter.hpp index 00e01cd1..b2f356e4 100644 --- a/src/critter.hpp +++ b/src/critter.hpp @@ -1,6 +1,5 @@ #pragma once #include "src/global-coords.hpp" -#include "src/rotation.hpp" #include "src/object.hpp" #include diff --git a/src/object.cpp b/src/object.cpp index 307a2155..96acd4b9 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}, + id{id}, c{&c}, atlas{proto.atlas}, speed{proto.speed}, 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 2d33885d..c915b134 100644 --- a/src/object.hpp +++ b/src/object.hpp @@ -18,6 +18,7 @@ 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; @@ -44,6 +45,7 @@ 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