d_pad_nav OK

This commit is contained in:
robojumper
2025-07-26 18:08:58 +02:00
parent 4ec5128eb4
commit 58866f517f
14 changed files with 370 additions and 51 deletions
+12
View File
@@ -177,6 +177,18 @@ public:
return m_current_ex;
}
bool getFSStickTrig(u32 mask) const {
return mFSStickMaskChanged && mFSStickMask == mask;
}
bool getFSStickTrig() const {
return mFSStickMaskChanged && (mFSStickMask & 0xFF) != 0;
}
const mVec3_c& getMPLSVelocity() const {
return mMPLSVelocity;
}
enum ExState_e {
EX_STATE_WAITING_FOR_CONNECT = 0,
EX_STATE_POST_CONNECT = 1,
+66
View File
@@ -0,0 +1,66 @@
#ifndef D_PAD_NAV_H
#define D_PAD_NAV_H
/**
* Navigation with Wiimote and Nunchuk - seamlessly switching
* between pointer (dpd) and Nunchuk stick (FSStick).
*/
#include "common.h"
namespace dPadNav {
enum FSStickDirection_e {
FS_STICK_NONE = 0,
FS_STICK_UP = 1,
FS_STICK_UP_RIGHT = 2,
FS_STICK_RIGHT = 3,
FS_STICK_DOWN_RIGHT = 4,
FS_STICK_DOWN = 5,
FS_STICK_DOWN_LEFT = 6,
FS_STICK_LEFT = 7,
FS_STICK_UP_LEFT = 8,
};
extern bool sIsNavEnabled;
// WARNING: Swinging the Wiimote to the right -> navigate left.
// This naming refers to the latter (where the navigation goes).
extern bool sIsMplsNavLeftGesture;
extern bool sIsMplsNavRightGesture;
extern bool sIsPointerVisible;
extern bool sPrevIsPointerVisible;
extern bool sUnkCursorRelated;
extern s32 sFSStickDirection;
extern s32 sFSStickNavDirection;
inline bool isPointerVisible() {
return sIsPointerVisible;
}
void init();
void calc();
void setNavEnabled(bool navEnabled, bool autoReturnToPointerNav);
// I really wish these returned enums but the codegen requires not-enums
s32 getFSStickDirection();
s32 getFSStickDirectionTrig();
void stopFSStickNav();
void hidePointer();
void offUnkCursorRelated();
void onUnkCursorRelated();
// Not sure what this does. Related to Deposit
// and Seeker Stone scrolling
void scrollRelated();
// detail:
void checkForNavRightGesture();
void checkForNavLeftGesture();
} // namespace dPadNav
#endif
+3
View File
@@ -235,6 +235,9 @@ public:
f32 squareMagXZ() const {
return x * x + z * z;
}
f32 squareMagXY() const {
return x * x + y * y;
}
f32 squareDistanceToXZ(const mVec3_c &other) const {
return (*this - other).squareMagXZ();
}