1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef GAME_CLIENT_COMPONENTS_CONTROLS_H
4#define GAME_CLIENT_COMPONENTS_CONTROLS_H
5
6#include <base/vmath.h>
7
8#include <engine/client.h>
9
10#include <game/client/component.h>
11#include <game/generated/protocol.h>
12
13class CControls : public CComponent
14{
15 float GetMaxMouseDistance() const;
16
17public:
18 vec2 m_aMousePos[NUM_DUMMIES];
19 vec2 m_aMousePosOnAction[NUM_DUMMIES];
20 vec2 m_aTargetPos[NUM_DUMMIES];
21 float m_OldMouseX;
22 float m_OldMouseY;
23
24 int m_aAmmoCount[NUM_WEAPONS];
25
26 CNetObj_PlayerInput m_aInputData[NUM_DUMMIES];
27 CNetObj_PlayerInput m_aLastData[NUM_DUMMIES];
28 int m_aInputDirectionLeft[NUM_DUMMIES];
29 int m_aInputDirectionRight[NUM_DUMMIES];
30 int m_aShowHookColl[NUM_DUMMIES];
31 int m_LastDummy;
32 int m_OtherFire;
33
34 CControls();
35 virtual int Sizeof() const override { return sizeof(*this); }
36
37 virtual void OnReset() override;
38 virtual void OnRelease() override;
39 virtual void OnRender() override;
40 virtual void OnMessage(int MsgType, void *pRawMsg) override;
41 virtual bool OnCursorMove(float x, float y, IInput::ECursorType CursorType) override;
42 virtual void OnConsoleInit() override;
43 virtual void OnPlayerDeath();
44
45 int SnapInput(int *pData);
46 void ClampMousePos();
47 void ResetInput(int Dummy);
48};
49#endif
50