50 enum WeaponAction : uint8_t {
66 enum FocusAction : uint8_t {
80 std::array<bool, KeyCodec::NumMappings>
main;
83 std::array<bool, KeyCodec::NumMappings> reverse;
86 auto value() const ->
float {
88 (this->anyMain() ? 1.f : 0.f)
89 + (this->anyReverse() ? -1.f : 0.f);
94 auto any() const ->
bool {
95 return this->value() != 0;
99 this->main.fill(
false);
100 this->reverse.fill(
false);
106 auto anyMain() const ->
bool {
107 for(
auto elem :
main) {
108 if(elem)
return true;
115 auto anyReverse() const ->
bool {
116 for(
auto elem : reverse) {
117 if(elem)
return true;
123 struct MovementStatus {
124 AxisStatus forwardBackward;
125 AxisStatus strafeRightLeft;
126 AxisStatus turnRightLeft;
130 this->forwardBackward.reset();
131 this->strafeRightLeft.reset();
132 this->turnRightLeft.reset();
136 bool ctrl[Action::Last]={};
137 bool wctrl[WeaponAction::Last]={};
140 WeaponAction wctrlLast = WeaponAction::WeaponMele;
142 bool cacheFocus=
false;
146 bool casting =
false;
147 size_t pickLockProgress = 0;
149 float runAngleDest = 0.f;
150 uint64_t runAngleSmooth = 0;
151 uint64_t turnAniSmooth = 0;
158 void setupSettings();
159 bool canInteract()
const;
160 void marvinF8(uint64_t dt);
161 void marvinK(uint64_t dt);
163 void toggleWalkMode();
164 void toggleSneakMode();
165 void moveFocus(FocusAction act);
169 void implMove(uint64_t dt);
170 void implMoveMobsi(
Npc& pl, uint64_t dt);
173 void quitPicklock(
Npc& pl);
174 void setPos(std::array<float,3> a, uint64_t dt,
float speed);
175 void assignRunAngle(
Npc& pl,
float rotation, uint64_t dt);
176 void setAnimRotate (
Npc& pl,
float rotation,
int anim,
bool force, uint64_t dt);
177 void processAutoRotate(
Npc& pl,
float& rot, uint64_t dt);
184 auto wantsToMoveForward() const ->
bool {
185 return movement.forwardBackward.value() > 0.f;
187 auto wantsToMoveBackward() const ->
bool {
188 return movement.forwardBackward.value() < 0.f;
191 auto wantsToStrafeRight() const ->
bool {
192 return movement.strafeRightLeft.value() > 0.f;
194 auto wantsToStrafeLeft() const ->
bool {
195 return movement.strafeRightLeft.value() < 0.f;
198 auto wantsToTurnRight() const ->
bool {
199 return movement.turnRightLeft.value() > 0.f;
201 auto wantsToTurnLeft() const ->
bool {
202 return movement.turnRightLeft.value() < 0.f;
int main(int argc, const char **argv)