view Keyboard.h @ 125:b90504bbb93b

Merge
author Nomad
date Fri, 16 Nov 2012 13:58:59 +0200
parents 8b8875f5b359
children af624eaf2fc5
line wrap: on
line source

#pragma once


/*  284 */
enum InputAction : __int32
{
  INPUT_MoveForward = 0x0,
  INPUT_MoveBackwards = 0x1,
  INPUT_TurnLeft = 0x2,
  INPUT_TurnRight = 0x3,
  INPUT_Yell = 0x4,
  INPUT_Jump = 0x5,
  INPUT_Combat = 0x6,
  INPUT_CastReady = 0x7,
  INPUT_Attack = 0x8,
  INPUT_EventTrigger = 0x9,
  INPUT_Cast = 0xA,
  INPUT_Pass = 0xB,
  INPUT_CharCycle = 0xC,
  INPUT_Quest = 0xD,
  INPUT_QuickRef = 0xE,
  INPUT_Rest = 0xF,
  INPUT_TimeCal = 0x10,
  INPUT_Autonotes = 0x11,
  INPUT_Mapbook = 0x12,
  INPUT_AlwaysRun = 0x13,
  INPUT_LookUp = 0x14,
  INPUT_LookDown = 0x15,
  INPUT_CenterView = 0x16,
  INPUT_ZoomIn = 0x17,
  INPUT_ZoomOut = 0x18,
  INPUT_FlyUp = 0x19,
  INPUT_FlyDown = 0x1A,
  INPUT_Land = 0x1B,
  INPUT_StrafeLeft = 0x1C,
  INPUT_StrafeRight = 0x1D,
};



enum KeyToggleType : __int32
{
  TOGGLE_Continuously = 0x0,
  TOGGLE_OneTimePress = 0x1,
};

#pragma pack(push, 1)
struct KeyboardActionMapping
{
  KeyboardActionMapping();

  void SetKeyMapping(int uAction, int vKey, KeyToggleType type);
  unsigned int GetActionVKey(enum InputAction eAction);
  const char *GetVKeyDisplayName(signed int a1);
  const unsigned __int8 GetActionDefaultVKey(const char *Str);
  void ReadMappings();
  void StoreMappings();
  bool _459F10(unsigned int a2);
  void _459ED1(int a2);
  void _459E5A(int a2, int a3, struct GUIWindow *pWindow);
  void ResetKeys();
  void SetDefaultMapping();

  unsigned int uLastKeyPressed;
  int field_4;
  int field_8;
  unsigned int pVirtualKeyCodesMapping[30];
  KeyToggleType pToggleTypes[30];
  int field_FC;
  unsigned __int8 pPressedKeysBuffer[257];
  unsigned __int8 uNumKeysPressed;
  char field_202;
  char field_203;
  int field_204;
  struct GUIWindow *pWindow;
};
#pragma pack(pop)

#pragma pack(push, 1)
struct Keyboard
{
  Keyboard();
  bool WasKeyPressed(int vKey);
  bool IsKeyBeingHeld(int vKey);
  bool IsShiftHeld();
  void EnterCriticalSection();

  void (__thiscall ***vdestructor_ptr)(Keyboard *, bool);
  unsigned int bUsingAsynKeyboard;
};
#pragma pack(pop)


#pragma pack(push, 1)
struct AsyncKeyboard
{
   AsyncKeyboard();
  ~AsyncKeyboard();

  bool Initialize();
  char map_key(int key);
  char _45B4EC(unsigned __int8 a2);
  void Thread();
  char _45B3A4();
  void Suspend();
  void Resume();
  char CreateDirectInputKeyboard();
  char _45B229();
  void _45B1B1();
  void Release();

  static int __stdcall ThreadStarter(AsyncKeyboard *pInstance);
  static void EnterCriticalSection();
  static void LeaveCriticalSection();
};
#pragma pack(pop)


extern struct KeyboardActionMapping *pKeyActionMap;
extern struct AsyncKeyboard *pAsyncKeyboard;