1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:59:54 +00:00
openmw/components/esm3/controlsstate.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

56 lines
1.5 KiB
C++
Raw Normal View History

2016-10-20 00:12:01 +00:00
#include "controlsstate.hpp"
#include "esmreader.hpp"
#include "esmwriter.hpp"
namespace ESM
{
ControlsState::ControlsState()
2016-10-20 00:12:01 +00:00
: mViewSwitchDisabled(false)
, mControlsDisabled(false)
, mJumpingDisabled(false)
, mLookingDisabled(false)
, mVanityModeDisabled(false)
, mWeaponDrawingDisabled(false)
, mSpellDrawingDisabled(false)
{
}
2022-09-22 18:26:05 +00:00
void ControlsState::load(ESMReader& esm)
2016-10-20 00:12:01 +00:00
{
int flags;
esm.getHNT(flags, "CFLG");
2022-09-22 18:26:05 +00:00
2016-10-20 00:12:01 +00:00
mViewSwitchDisabled = flags & ViewSwitchDisabled;
mControlsDisabled = flags & ControlsDisabled;
mJumpingDisabled = flags & JumpingDisabled;
mLookingDisabled = flags & LookingDisabled;
mVanityModeDisabled = flags & VanityModeDisabled;
mWeaponDrawingDisabled = flags & WeaponDrawingDisabled;
mSpellDrawingDisabled = flags & SpellDrawingDisabled;
}
2022-09-22 18:26:05 +00:00
void ControlsState::save(ESMWriter& esm) const
2016-10-20 00:12:01 +00:00
{
int flags = 0;
if (mViewSwitchDisabled)
flags |= ViewSwitchDisabled;
if (mControlsDisabled)
flags |= ControlsDisabled;
if (mJumpingDisabled)
flags |= JumpingDisabled;
if (mLookingDisabled)
flags |= LookingDisabled;
if (mVanityModeDisabled)
flags |= VanityModeDisabled;
if (mWeaponDrawingDisabled)
flags |= WeaponDrawingDisabled;
if (mSpellDrawingDisabled)
flags |= SpellDrawingDisabled;
2022-09-22 18:26:05 +00:00
2016-10-20 00:12:01 +00:00
esm.writeHNT("CFLG", flags);
}
}