3 #include <BLIB/Logging.hpp>
10 : _type(
Type::StandStill)
14 std::uint8_t behaviorType;
15 if (!input.read(behaviorType))
return false;
16 switch (behaviorType) {
30 BL_LOG_ERROR <<
"Unrecognized behavior: " << behaviorType;
40 if (!input.read<std::uint8_t>(spinDir))
return false;
46 std::uint8_t paceCount;
47 std::uint8_t backwards;
48 if (!input.read<std::uint8_t>(paceCount))
return false;
49 if (!input.read<std::uint8_t>(backwards))
return false;
53 for (std::uint8_t i = 0; i < paceCount; ++i) {
56 if (!input.read<std::uint8_t>(dir))
return false;
57 if (!input.read<std::uint8_t>(steps))
return false;
58 path().
paces.emplace_back(
static_cast<bl::tmap::Direction
>(dir), steps);
65 if (!input.read<std::uint8_t>(radius))
return false;
81 data.emplace<
Standing>(bl::tmap::Direction::Down);
97 BL_LOG_ERROR <<
"Unknown behavior type: " << t;
119 : facedir(
bl::tmap::Direction::Down) {}
144 : direction(
bl::tmap::Direction::Up)
Core classes and functionality for both the editor and game.
bool legacyLoad(bl::serial::binary::InputStream &input)
Loads the behavior data from the legacy formatted file. Use serialize and deserialize for reading and...
Spinning & spinning()
The data for spinning.
Behavior()
Empty behavior. Standing still facing down.
Type type() const
The type of behavior this is.
void setType(Type type)
Set the Type of behavior. Existing behavior data is cleared.
Wander & wander()
The data for wandering.
Standing & standing()
The data for standing still.
Type
The type of behavior.
@ Wandering
The character is allowed to wander freely.
@ FollowingPath
The character will follow a preset path.
@ StandStill
The character will stand and face a given direction.
@ SpinInPlace
The character will spin in place.
Path & path()
The data for path following.
Contains data if the behavior type is StandStill.
Standing()
Stand facing down.
Contains data for when the behavior type is SpinInPlace.
enum core::file::Behavior::Spinning::Direction spinDir
Direction
The direction to spin.
@ Clockwise
The character spins clockwise.
Contains data for when the behavior type is following a path.
std::vector< Pace > paces
The sections of the path.
bool reverse
True if the path should be done in reverse when completed, false to loop.
Path()
Makes an empty path.
Pace()
Makes a single step up.
Contains data for when the behavior type is Wandering.
std::uint32_t radius
The radius to stay within, in tiles.
Wander()
Wander in a 10 tile radius.