From dcf3397139e27f0b22f07da1e3777c6f9e9f9745 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Wed, 16 Jun 2021 10:54:41 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20engine.h:=20Extract=20`ActorPosi?= =?UTF-8?q?tion`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/engine.h | 18 ------------------ Source/engine/actor_position.hpp | 25 +++++++++++++++++++++++++ Source/items.cpp | 4 +++- Source/monster.h | 1 + Source/player.h | 1 + 5 files changed, 30 insertions(+), 19 deletions(-) create mode 100644 Source/engine/actor_position.hpp diff --git a/Source/engine.h b/Source/engine.h index afab67319..21222cad7 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -63,24 +63,6 @@ struct Rectangle { Size size; }; -struct ActorPosition { - Point tile; - /** Future tile position. Set at start of walking animation. */ - Point future; - /** Tile position of player. Set via network on player input. */ - Point last; - /** Most recent position in dPlayer. */ - Point old; - /** Pixel offset from tile. */ - Point offset; - /** Same as offset but contains the value in a higher range */ - Point offset2; - /** Pixel velocity while walking. Indirectly applied to offset via _pvar6/7 */ - Point velocity; - /** Used for referring to position of player when finishing moving one tile (also used to define target coordinates for spells and ranged attacks) */ - Point temp; -}; - inline byte *CelGetFrameStart(byte *pCelBuff, int nCel) { const uint32_t *pFrameTable = reinterpret_cast(pCelBuff); diff --git a/Source/engine/actor_position.hpp b/Source/engine/actor_position.hpp new file mode 100644 index 000000000..ea25c1ca0 --- /dev/null +++ b/Source/engine/actor_position.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include "engine/point.hpp" + +namespace devilution { + +struct ActorPosition { + Point tile; + /** Future tile position. Set at start of walking animation. */ + Point future; + /** Tile position of player. Set via network on player input. */ + Point last; + /** Most recent position in dPlayer. */ + Point old; + /** Pixel offset from tile. */ + Point offset; + /** Same as offset but contains the value in a higher range */ + Point offset2; + /** Pixel velocity while walking. Indirectly applied to offset via _pvar6/7 */ + Point velocity; + /** Used for referring to position of player when finishing moving one tile (also used to define target coordinates for spells and ranged attacks) */ + Point temp; +}; + +} // namespace devilution diff --git a/Source/items.cpp b/Source/items.cpp index 2cd7375b3..db711975e 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -3,7 +3,8 @@ * * Implementation of item functionality. */ -#include +#include "items.h" + #include #include #include @@ -22,6 +23,7 @@ #include "stores.h" #include "utils/language.h" #include "utils/math.h" +#include "utils/stdcompat/algorithm.hpp" namespace devilution { namespace { diff --git a/Source/monster.h b/Source/monster.h index a1015bc87..e1c5e9e41 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -9,6 +9,7 @@ #include #include "engine.h" +#include "engine/actor_position.hpp" #include "engine/point.hpp" #include "miniwin/miniwin.h" #include "utils/stdcompat/optional.hpp" diff --git a/Source/player.h b/Source/player.h index c0b2337fc..3a828a44b 100644 --- a/Source/player.h +++ b/Source/player.h @@ -10,6 +10,7 @@ #include "diablo.h" #include "engine.h" +#include "engine/actor_position.hpp" #include "engine/point.hpp" #include "gendung.h" #include "items.h"