Some minor style changes

This commit is contained in:
Diavolo 2021-09-09 11:36:48 +02:00
parent 7de4b0a3aa
commit 906e33ac41
No known key found for this signature in database
GPG Key ID: FA77F074E98D98A5
4 changed files with 32 additions and 30 deletions

View File

@ -929,13 +929,13 @@ namespace Components
push eax
push edi
call Gamepad_ShouldUse
add esp,8
mov [esp + 0x20],eax
add esp, 8h
mov [esp + 0x20], eax
popad
pop eax
// Skip use if custom check returns false
test al,al
test al, al
jz skipUse
// perform use
@ -1710,30 +1710,30 @@ namespace Components
void Gamepad::InitDvars()
{
gpad_enabled = Dvar::Register<bool>("gpad_enabled", false, Game::DVAR_FLAG_SAVED, "Game pad enabled");
gpad_debug = Dvar::Register<bool>("gpad_debug", false, 0, "Game pad debugging");
gpad_present = Dvar::Register<bool>("gpad_present", false, 0, "Game pad present");
gpad_in_use = Dvar::Register<bool>("gpad_in_use", false, 0, "A game pad is in use");
gpad_debug = Dvar::Register<bool>("gpad_debug", false, Game::DVAR_FLAG_NONE, "Game pad debugging");
gpad_present = Dvar::Register<bool>("gpad_present", false, Game::DVAR_FLAG_NONE, "Game pad present");
gpad_in_use = Dvar::Register<bool>("gpad_in_use", false, Game::DVAR_FLAG_NONE, "A game pad is in use");
gpad_sticksConfig = Dvar::Register<const char*>("gpad_sticksConfig", "", Game::DVAR_FLAG_SAVED, "Game pad stick configuration");
gpad_buttonConfig = Dvar::Register<const char*>("gpad_buttonConfig", "", Game::DVAR_FLAG_SAVED, "Game pad button configuration");
gpad_menu_scroll_delay_first = Dvar::Register<int>("gpad_menu_scroll_delay_first", 420, 0, 1000, Game::DVAR_FLAG_SAVED, "Menu scroll key-repeat delay, for the first repeat, in milliseconds");
gpad_menu_scroll_delay_rest = Dvar::Register<int>("gpad_menu_scroll_delay_rest", 210, 0, 1000, Game::DVAR_FLAG_SAVED,
"Menu scroll key-repeat delay, for repeats after the first, in milliseconds");
gpad_rumble = Dvar::Register<bool>("gpad_rumble", true, Game::DVAR_FLAG_SAVED, "Enable game pad rumble");
gpad_stick_pressed_hysteresis = Dvar::Register<float>("gpad_stick_pressed_hysteresis", 0.1f, 0.0f, 1.0f, 0,
gpad_stick_pressed_hysteresis = Dvar::Register<float>("gpad_stick_pressed_hysteresis", 0.1f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE,
"Game pad stick pressed no-change-zone around gpad_stick_pressed to prevent bouncing");
gpad_stick_pressed = Dvar::Register<float>("gpad_stick_pressed", 0.4f, 0.0, 1.0, 0, "Game pad stick pressed threshhold");
gpad_stick_deadzone_max = Dvar::Register<float>("gpad_stick_deadzone_max", 0.01f, 0.0f, 1.0f, 0, "Game pad maximum stick deadzone");
gpad_stick_deadzone_min = Dvar::Register<float>("gpad_stick_deadzone_min", 0.2f, 0.0f, 1.0f, 0, "Game pad minimum stick deadzone");
gpad_button_deadzone = Dvar::Register<float>("gpad_button_deadzone", 0.13f, 0.0f, 1.0f, 0, "Game pad button deadzone threshhold");
gpad_button_lstick_deflect_max = Dvar::Register<float>("gpad_button_lstick_deflect_max", 1.0f, 0.0f, 1.0f, 0, "Game pad maximum pad stick pressed value");
gpad_button_rstick_deflect_max = Dvar::Register<float>("gpad_button_rstick_deflect_max", 1.0f, 0.0f, 1.0f, 0, "Game pad maximum pad stick pressed value");
gpad_use_hold_time = Dvar::Register<int>("gpad_use_hold_time", 250, 0, INT32_MAX, 0, "Time to hold the 'use' button on gamepads to activate use");
gpad_stick_pressed = Dvar::Register<float>("gpad_stick_pressed", 0.4f, 0.0, 1.0, Game::DVAR_FLAG_NONE, "Game pad stick pressed threshhold");
gpad_stick_deadzone_max = Dvar::Register<float>("gpad_stick_deadzone_max", 0.01f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE, "Game pad maximum stick deadzone");
gpad_stick_deadzone_min = Dvar::Register<float>("gpad_stick_deadzone_min", 0.2f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE, "Game pad minimum stick deadzone");
gpad_button_deadzone = Dvar::Register<float>("gpad_button_deadzone", 0.13f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE, "Game pad button deadzone threshhold");
gpad_button_lstick_deflect_max = Dvar::Register<float>("gpad_button_lstick_deflect_max", 1.0f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE, "Game pad maximum pad stick pressed value");
gpad_button_rstick_deflect_max = Dvar::Register<float>("gpad_button_rstick_deflect_max", 1.0f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE, "Game pad maximum pad stick pressed value");
gpad_use_hold_time = Dvar::Register<int>("gpad_use_hold_time", 250, 0, INT32_MAX, Game::DVAR_FLAG_NONE, "Time to hold the 'use' button on gamepads to activate use");
gpad_lockon_enabled = Dvar::Register<bool>("gpad_lockon_enabled", true, Game::DVAR_FLAG_SAVED, "Game pad lockon aim assist enabled");
gpad_slowdown_enabled = Dvar::Register<bool>("gpad_slowdown_enabled", true, Game::DVAR_FLAG_SAVED, "Game pad slowdown aim assist enabled");
input_viewSensitivity = Dvar::Register<float>("input_viewSensitivity", 1.0f, 0.0001f, 5.0f, Game::DVAR_FLAG_SAVED, "View Sensitivity");
input_invertPitch = Dvar::Register<bool>("input_invertPitch", false, Game::DVAR_FLAG_SAVED, "Invert gamepad pitch");
sv_allowAimAssist = Dvar::Register<bool>("sv_allowAimAssist", true, 0, "Controls whether aim assist features on clients are enabled");
sv_allowAimAssist = Dvar::Register<bool>("sv_allowAimAssist", true, Game::DVAR_FLAG_NONE, "Controls whether aim assist features on clients are enabled");
aim_turnrate_pitch = Dvar::Var("aim_turnrate_pitch");
aim_turnrate_pitch_ads = Dvar::Var("aim_turnrate_pitch_ads");
aim_turnrate_yaw = Dvar::Var("aim_turnrate_yaw");

View File

@ -739,9 +739,11 @@ namespace Game
float Vec3Normalize(vec3_t& vec)
{
const float length = static_cast<float>(std::sqrt(std::pow(vec[0], 2) + std::pow(vec[1], 2) + std::pow(vec[2], 2)));
vec[0] /= length;
vec[1] /= length;
vec[2] /= length;
return length;
}

View File

@ -40,7 +40,7 @@ namespace Game
typedef void*(__cdecl * BG_LoadWeaponDef_LoadObj_t)(const char* filename);
extern BG_LoadWeaponDef_LoadObj_t BG_LoadWeaponDef_LoadObj;
typedef WeaponDef* (__cdecl* BG_GetWeaponDef_t)(int weaponIndex);
typedef WeaponDef* (__cdecl * BG_GetWeaponDef_t)(int weaponIndex);
extern BG_GetWeaponDef_t BG_GetWeaponDef;
typedef void(__cdecl * Cbuf_AddServerText_t)();
@ -55,10 +55,10 @@ namespace Game
typedef void(__cdecl * CG_NextWeapon_f_t)();
extern CG_NextWeapon_f_t CG_NextWeapon_f;
typedef std::int32_t(__cdecl* CG_PlayBoltedEffect_t) (std::int32_t, FxEffectDef*, std::int32_t, std::uint32_t);
typedef std::int32_t(__cdecl * CG_PlayBoltedEffect_t) (std::int32_t, FxEffectDef*, std::int32_t, std::uint32_t);
extern CG_PlayBoltedEffect_t CG_PlayBoltedEffect;
typedef std::int32_t(__cdecl* CG_GetBoneIndex_t)(std::int32_t, std::uint32_t name, char* index);
typedef std::int32_t(__cdecl * CG_GetBoneIndex_t)(std::int32_t, std::uint32_t name, char* index);
extern CG_GetBoneIndex_t CG_GetBoneIndex;
typedef void(__cdecl * CG_ScoresDown_f_t)();
@ -375,7 +375,7 @@ namespace Game
typedef void(__cdecl * Key_SetCatcher_t)(int localClientNum, int catcher);
extern Key_SetCatcher_t Key_SetCatcher;
typedef bool(__cdecl* Key_IsKeyCatcherActive_t)(int localClientNum, int catcher);
typedef bool(__cdecl * Key_IsKeyCatcherActive_t)(int localClientNum, int catcher);
extern Key_IsKeyCatcherActive_t Key_IsKeyCatcherActive;
typedef void(__cdecl * LargeLocalInit_t)();
@ -450,13 +450,13 @@ namespace Game
typedef bool(__cdecl * Menus_MenuIsInStack_t)(UiContext *dc, menuDef_t *menu);
extern Menus_MenuIsInStack_t Menus_MenuIsInStack;
typedef menuDef_t*(__cdecl* Menu_GetFocused_t)(UiContext* ctx);
typedef menuDef_t*(__cdecl * Menu_GetFocused_t)(UiContext* ctx);
extern Menu_GetFocused_t Menu_GetFocused;
typedef void(__cdecl* Menu_HandleKey_t)(UiContext* ctx, menuDef_t* menu, Game::keyNum_t key, int down);
typedef void(__cdecl * Menu_HandleKey_t)(UiContext* ctx, menuDef_t* menu, Game::keyNum_t key, int down);
extern Menu_HandleKey_t Menu_HandleKey;
typedef bool(__cdecl* UI_KeyEvent_t)(int clientNum, int key, int down);
typedef bool(__cdecl * UI_KeyEvent_t)(int clientNum, int key, int down);
extern UI_KeyEvent_t UI_KeyEvent;
typedef void(__cdecl * MSG_Init_t)(msg_t *buf, char *data, int length);
@ -501,10 +501,10 @@ namespace Game
typedef void(__cdecl * MSG_WriteLong_t)(msg_t *msg, int c);
extern MSG_WriteLong_t MSG_WriteLong;
typedef void(*MSG_WriteShort_t)(msg_t* msg, short s);
typedef void(__cdecl * MSG_WriteShort_t)(msg_t* msg, short s);
extern MSG_WriteShort_t MSG_WriteShort;
typedef void(*MSG_WriteString_t)(msg_t* msg, const char *str);
typedef void(__cdecl * MSG_WriteString_t)(msg_t* msg, const char *str);
extern MSG_WriteString_t MSG_WriteString;
typedef int(__cdecl * MSG_WriteBitsCompress_t)(bool trainHuffman, const char *from, char *to, int size);
@ -696,7 +696,7 @@ namespace Game
typedef char* (__cdecl * SEH_StringEd_GetString_t)(const char* string);
extern SEH_StringEd_GetString_t SEH_StringEd_GetString;
typedef int (__cdecl* SEH_ReadCharFromString_t)(const char** text, int* isTrailingPunctuation);
typedef int (__cdecl * SEH_ReadCharFromString_t)(const char** text, int* isTrailingPunctuation);
extern SEH_ReadCharFromString_t SEH_ReadCharFromString;
typedef char* (__cdecl * SL_ConvertToString_t)(unsigned short stringValue);
@ -795,7 +795,7 @@ namespace Game
typedef void(__cdecl * UI_AddMenuList_t)(UiContext *dc, MenuList *menuList, int close);
extern UI_AddMenuList_t UI_AddMenuList;
typedef uiMenuCommand_t(__cdecl* UI_GetActiveMenu_t)(int localClientNum);
typedef uiMenuCommand_t(__cdecl * UI_GetActiveMenu_t)(int localClientNum);
extern UI_GetActiveMenu_t UI_GetActiveMenu;
typedef char* (__cdecl * UI_CheckStringTranslation_t)(char*, char*);
@ -828,16 +828,16 @@ namespace Game
typedef void (__cdecl * Vec3UnpackUnitVec_t)(PackedUnitVec, vec3_t *);
extern Vec3UnpackUnitVec_t Vec3UnpackUnitVec;
typedef float(__cdecl* vectoyaw_t)(vec2_t* vec);
typedef float(__cdecl * vectoyaw_t)(vec2_t* vec);
extern vectoyaw_t vectoyaw;
typedef float(__cdecl* AngleNormalize360_t)(float val);
typedef float(__cdecl * AngleNormalize360_t)(float val);
extern AngleNormalize360_t AngleNormalize360;
typedef void(__cdecl * unzClose_t)(void* handle);
extern unzClose_t unzClose;
typedef void(__cdecl* AimAssist_ApplyAutoMelee_t)(const AimInput* input, AimOutput* output);
typedef void(__cdecl * AimAssist_ApplyAutoMelee_t)(const AimInput* input, AimOutput* output);
extern AimAssist_ApplyAutoMelee_t AimAssist_ApplyAutoMelee;
extern XAssetHeader* DB_XAssetPool;

View File

@ -233,7 +233,7 @@ namespace Game
K_LASTGAMEPADBUTTON_RANGE_1 = 0x6, // Last Gamepad 1
K_TAB = 0x9,
K_ENTER = 0xD,
K_FIRSTGAMEPADBUTTON_RANGE_2 = 0xE, // First Gamepad 2
K_FIRSTGAMEPADBUTTON_RANGE_2 = 0xE, // First Gamepad 2
K_BUTTON_START = 0xE,
K_BUTTON_BACK = 0xF,
K_BUTTON_LSTICK = 0x10,