summaryrefslogtreecommitdiffhomepage
path: root/src/entity.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-09-01 22:27:30 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-09-01 22:27:30 +0200
commit31fd5bbc08234686cf798a93a18e0bb73615d1bf (patch)
tree59b964d01885916c5d49fef3c168ff10dcbdd93f /src/entity.hpp
parent053ea3aa1c443c368f8b43591e3e970e12b50c70 (diff)
rename entity -> object
Diffstat (limited to 'src/entity.hpp')
-rw-r--r--src/entity.hpp89
1 files changed, 0 insertions, 89 deletions
diff --git a/src/entity.hpp b/src/entity.hpp
deleted file mode 100644
index e332c93a..00000000
--- a/src/entity.hpp
+++ /dev/null
@@ -1,89 +0,0 @@
-#pragma once
-#include "compat/defs.hpp"
-#include "src/global-coords.hpp"
-#include "src/rotation.hpp"
-#include "src/pass-mode.hpp"
-#include "src/entity-type.hpp"
-#include "src/object-id.hpp"
-#include <memory>
-#include <vector>
-
-namespace floormat {
-
-template<typename T> struct entity_type_;
-struct anim_atlas;
-struct world;
-struct chunk;
-
-struct entity_proto
-{
- std::shared_ptr<anim_atlas> atlas;
- Vector2b offset, bbox_offset;
- Vector2ub bbox_size = Vector2ub(iTILE_SIZE2);
- uint16_t delta = 0, frame = 0;
- entity_type type : 3 = entity_type::none;
- rotation r : rotation_BITS = rotation::N;
- pass_mode pass : pass_mode_BITS = pass_mode::see_through;
-
- entity_proto& operator=(const entity_proto&);
- entity_proto();
- entity_proto(const entity_proto&);
-
- virtual bool operator==(const entity_proto&) const;
- bool operator!=(const entity_proto& o) const { return !operator==(o); }
- virtual ~entity_proto() noexcept;
-
- entity_type type_of() const noexcept;
-};
-
-// todo rename to 'object'
-struct entity
-{
- fm_DECLARE_DELETED_COPY_ASSIGNMENT(entity);
-
- const object_id id = 0;
- struct chunk* const c;
- const std::shared_ptr<anim_atlas> atlas;
- const global_coords coord;
- const Vector2b offset, bbox_offset;
- const Vector2ub bbox_size;
- uint16_t delta = 0, frame = 0;
- const rotation r = rotation::N;
- const pass_mode pass = pass_mode::see_through;
-
- virtual ~entity() noexcept;
-
- virtual Vector2 ordinal_offset(Vector2b offset) const = 0;
- virtual float depth_offset() const = 0;
- float ordinal() const;
- float ordinal(local_coords xy, Vector2b offset, Vector2s z_offset) const;
- struct chunk& chunk() const;
- size_t index() const;
- virtual bool is_virtual() const;
-
- explicit operator entity_proto() const;
-
- virtual entity_type type() const noexcept = 0;
- virtual bool can_activate(size_t i) const;
- virtual bool activate(size_t i);
- virtual void update(size_t i, float dt) = 0;
- virtual void rotate(size_t i, rotation r);
- virtual bool can_rotate(global_coords coord, rotation new_r, rotation old_r, Vector2b offset, Vector2b bbox_offset, Vector2ub bbox_size);
- virtual bool can_move_to(Vector2i delta, global_coords coord, Vector2b offset, Vector2b bbox_offset, Vector2ub bbox_aize);
- virtual void set_bbox(Vector2b offset, Vector2b bbox_offset, Vector2ub bbox_size, pass_mode pass);
-
- entity_type type_of() const noexcept;
- static Pair<global_coords, Vector2b> normalize_coords(global_coords coord, Vector2b cur_offset, Vector2i delta);
-
- virtual bool is_dynamic() const;
- bool can_rotate(rotation new_r);
- bool can_move_to(Vector2i delta);
- size_t move_to(size_t& i, Vector2i delta, rotation new_r);
- void move_to(Vector2i delta);
-
-protected:
- entity(object_id id, struct chunk& c, const entity_proto& proto);
- void set_bbox_(Vector2b offset, Vector2b bbox_offset, Vector2ub bbox_size, pass_mode pass);
-};
-
-} // namespace floormat