Browse Source

🚚 engine.h: Extract `ActorPosition`

pull/2204/head
Gleb Mazovetskiy 5 years ago committed by Anders Jenbo
parent
commit
dcf3397139
  1. 18
      Source/engine.h
  2. 25
      Source/engine/actor_position.hpp
  3. 4
      Source/items.cpp
  4. 1
      Source/monster.h
  5. 1
      Source/player.h

18
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<const std::uint32_t *>(pCelBuff);

25
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

4
Source/items.cpp

@ -3,7 +3,8 @@
*
* Implementation of item functionality.
*/
#include <algorithm>
#include "items.h"
#include <climits>
#include <cstdint>
#include <bitset>
@ -22,6 +23,7 @@
#include "stores.h"
#include "utils/language.h"
#include "utils/math.h"
#include "utils/stdcompat/algorithm.hpp"
namespace devilution {
namespace {

1
Source/monster.h

@ -9,6 +9,7 @@
#include <array>
#include "engine.h"
#include "engine/actor_position.hpp"
#include "engine/point.hpp"
#include "miniwin/miniwin.h"
#include "utils/stdcompat/optional.hpp"

1
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"

Loading…
Cancel
Save