Add in strange gamepad edge case where analog sticks may be falsely spazzing out between 0 and 1. Fix using software checks. Release Build 7967.

mac-build
sigonasr2 9 months ago
parent 2c81cf15f2
commit 2a325810af
  1. 1
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 2
      Adventures in Lestoria/Version.h
  3. 7
      Adventures in Lestoria/olcPGEX_Gamepad.h
  4. BIN
      x64/Release/Adventures in Lestoria.exe

@ -410,6 +410,7 @@ void AiL::HandleUserInput(float fElapsedTime){
bool setIdleAnimation=true; bool setIdleAnimation=true;
bool heldDownMovementKey=false; //Is true when a movement key has been held down. bool heldDownMovementKey=false; //Is true when a movement key has been held down.
if(KEY_MENU.Released()){ if(KEY_MENU.Released()){
Menu::OpenMenu(MenuType::PAUSE); Menu::OpenMenu(MenuType::PAUSE);
} }

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 4 #define VERSION_MINOR 4
#define VERSION_PATCH 5 #define VERSION_PATCH 5
#define VERSION_BUILD 7966 #define VERSION_BUILD 7967
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -236,6 +236,7 @@ namespace olc {
int axisCount = GP_AXIS_COUNT; int axisCount = GP_AXIS_COUNT;
int buttonCount = GP_BUTTON_COUNT; int buttonCount = GP_BUTTON_COUNT;
float axes[GP_AXIS_COUNT]{0}; float axes[GP_AXIS_COUNT]{0};
float prevAxes[GP_AXIS_COUNT]{0};
olc::HWButton buttons[GP_BUTTON_COUNT]; olc::HWButton buttons[GP_BUTTON_COUNT];
bool ff = false; bool ff = false;
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
@ -1318,6 +1319,9 @@ olc::GamePad *olc::GamePad::selectWithAnyButton() {
float olc::GamePad::getAxis(olc::GPAxes a) { float olc::GamePad::getAxis(olc::GPAxes a) {
float axis = axes[static_cast<int>(a)]; float axis = axes[static_cast<int>(a)];
if(prevAxes[static_cast<int>(a)]==0.f&&std::abs(prevAxes[static_cast<int>(a)]-axis)>0.9f)return 0.f;
if (std::abs(axis) < deadZone) { if (std::abs(axis) < deadZone) {
axis = 0; axis = 0;
} }
@ -1329,6 +1333,9 @@ float olc::GamePad::getAxis(olc::GPAxes a) {
if (!xInput && (a == GPAxes::TL || a == GPAxes::TR)) if (!xInput && (a == GPAxes::TL || a == GPAxes::TR))
return (axis + 1) / 2; return (axis + 1) / 2;
#endif #endif
prevAxes[static_cast<int>(a)]=axis;
return axis; return axis;
} }

Loading…
Cancel
Save