-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathPipboyPhysicalHandler.h
More file actions
66 lines (57 loc) · 2.71 KB
/
Copy pathPipboyPhysicalHandler.h
File metadata and controls
66 lines (57 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once
#include "PipboyOperationHandler.h"
#include "skeleton/Skeleton.h"
namespace frik
{
class Skeleton;
class Pipboy;
/**
* Handle Pipboy virtual physical hand interaction.
* i.e. using offhand index finger to turn on/off Pipboy, light, radio, and other controls.
*/
class PipboyPhysicalHandler
{
public:
explicit PipboyPhysicalHandler(Skeleton* skelly, Pipboy* pipboy)
: _skelly(skelly),
_pipboy(pipboy)
{}
bool isOperating() const
{
return _isOperatingPipboy;
}
void operate(PipboyPage lastPipboyPage);
void updateIsOperatingPipboy(bool isOperating);
private:
void checkHandStateToOperatePipboy(RE::NiPoint3 fingerPos, const RE::NiNode* powerButton, const RE::NiNode* lightButton, const RE::NiNode* radioButton);
void operatePowerButton(RE::NiPoint3 fingerPos, const RE::NiNode* powerButton);
void operateLightButton(RE::NiPoint3 fingerPos, const RE::NiNode* lightButton);
void operateRadioButton(RE::NiPoint3 fingerPos, const RE::NiNode* radioButton);
void updatePipboyPhysicalElements(PipboyPage lastPipboyPage);
void operatePipboyPhysicalElement(RE::NiPoint3 fingerPos, PipboyOperation operation);
RE::NiAVObject* getPipboyArmNode() const;
Skeleton* _skelly;
Pipboy* _pipboy;
bool _isOperatingPipboy = false;
// Pipboy interaction with hand variables
bool _stickyPower = false;
bool _stickyLight = false;
bool _stickyRadio = false;
float _lastRadioFreq = 0.0;
// the other 7 points of interaction with the Pipboy (not including power, light, and radio)
bool _controlsSticky[7] = { false, false, false, false, false, false, false };
inline static std::string BONES_NAMES[7] = { "TabChangeUp", "TabChangeDown", "PageChangeUp", "PageChangeDown", "ScrollItemsUp", "ScrollItemsDown", "SelectButton02" };
inline static std::string TRANS_NAMES[7] = { "TabChangeUpTrans",
"TabChangeDownTrans",
"PageChangeUpTrans",
"PageChangeDownTrans",
"ScrollItemsUpTrans",
"ScrollItemsDownTrans",
"SelectButtonTrans" };
inline static std::string
ORBS_NAMES[7] = { "TabChangeUpOrb", "TabChangeDownOrb", "PageChangeUpOrb", "PageChangeDownOrb", "ScrollItemsUpOrb", "ScrollItemsDownOrb", "SelectItemsOrb" };
inline static float BONES_DISTANCES[7] = { 2.0f, 2.0f, 2.0f, 2.0f, 1.5f, 1.5f, 2.0f };
inline static float TRANS_DISTANCES[7] = { 0.6f, 0.6f, 0.6f, 0.6f, 0.1f, 0.1f, 0.4f };
inline static float MAX_DISTANCES[7] = { 1.2f, 1.2f, 1.2f, 1.2f, 1.2f, 1.2f, 0.6f };
};
}