d_vibration / d_vib_pattern

This commit is contained in:
Erilea
2024-06-18 16:39:57 +02:00
parent 9f647b6b14
commit 202fce5fa7
7 changed files with 446 additions and 75 deletions
+3 -3
View File
@@ -193,9 +193,9 @@ public:
static PADMask mEnabled;
enum ERumble {
VAL_0 = 0,
VAL_1 = 1,
VAL_2 = 2,
LOOP_ONCE = 0,
LOOP_FOREVER = 1,
SET_DURATION = 2,
};
void clear();
+5
View File
@@ -1260,6 +1260,11 @@ inline void dComIfGs_setOptVibration(u8 vib) {
g_dComIfG_gameInfo.save.getPlayer().getConfig().setVibration(vib);
}
/* Not present in debug maps, imitates TP version */
inline u8 dComIfGs_checkOptVibration() {
return g_dComIfG_gameInfo.save.getPlayer().getConfig().checkVibration();
}
inline BOOL dComIfGs_isTbox(int i_no) {
return g_dComIfG_gameInfo.save.getMemory().getBit().isTbox(i_no);
}
+54 -29
View File
@@ -1,45 +1,66 @@
#ifndef D_D_VIBRATION_H
#define D_D_VIBRATION_H
#include "dolphin/types.h"
#include "SSystem/SComponent/c_xyz.h"
class dVibration_c {
public:
/* 0x00 */ int field_0x0;
/* 0x04 */ int field_0x4;
/* 0x08 */ s32 field_0x8;
/* 0x0C */ int field_0xc;
/* 0x10 */ int field_0x10;
/* 0x14 */ cXyz field_0x14;
/* 0x20 */ s32 field_0x20;
/* 0x24 */ int field_0x24;
/* 0x28 */ u32 field_0x28;
/* 0x2C */ s32 field_0x2c;
/* 0x30 */ int field_0x30;
/* 0x34 */ int field_0x34;
/* 0x38 */ cXyz field_0x38;
/* 0x44 */ s32 field_0x44;
/* 0x48 */ int field_0x48;
/* 0x4C */ int field_0x4c;
/* 0x50 */ s32 field_0x50;
/* 0x54 */ s32 field_0x54;
/* 0x58 */ s32 field_0x58;
/* 0x5C */ s32 field_0x5c;
/* 0x60 */ int field_0x60;
/* 0x64 */ u32 field_0x64;
/* 0x68 */ u32 field_0x68;
/* 0x6C */ s32 field_0x6c;
/* 0x70 */ s32 field_0x70;
/* 0x74 */ s32 field_0x74;
/* 0x78 */ s32 field_0x78;
/* 0x7C */ int field_0x7c;
struct vib_pattern {
u16 rounds; /* Number of random bits enabled, used by quakes */
u16 length; /* length of the pattern */
u32 pattern; /* pattern bits (interpreted as bitstring) */
};
enum { /* mRumbleState values */
RUMBLE_STATE_PAUSED = -1,
RUMBLE_STATE_WAITING = 0,
RUMBLE_STATE_RUNNING = 1,
};
enum { /* Used as flags */
RUMBLE_SHOCK = 0x1,
RUMBLE_QUAKE = 0x2,
};
static const struct vib_pattern MS_patt[26];
static const struct vib_pattern CS_patt[26];
static const struct vib_pattern MQ_patt[12];
static const struct vib_pattern CQ_patt[12];
struct camera_rumble{
int mPatternIdx;
u32 mPattern;
s32 mLength;
s32 mRounds;
s32 mFlags;
cXyz mCoord;
s32 mCurrentFrame;
}; // Size: 0x24
struct motor_rumble{
int mPatternIdx;
u32 mPattern;
s32 mLength;
s32 mRounds;
s32 mCurrentFrame;
s32 mStopFrame; /* different from length for looping rumble */
}; // Size: 0x12
/* 0x0 */ struct camera_rumble mCameraShock;
/* 0x24 */ struct camera_rumble mCameraQuake;
/* 0x48 */ struct motor_rumble mMotorShock;
/* 0x60 */ struct motor_rumble mMotorQuake;
/* 0x78 */ s32 mFrameIdx;
/* 0x7C */ int mRumbleState;
/* 0x80 */ /* vtable */
public:
dVibration_c();
virtual ~dVibration_c();
int Run();
bool StartShock(int i_strength, int, cXyz);
bool StartShock(int, int, cXyz);
bool StartQuake(u8 const*, int, int, cXyz);
bool StartQuake(int, int, cXyz);
int StopQuake(int);
@@ -49,6 +70,10 @@ public:
void Init();
void Pause();
void Remove();
/* Probably debug-only function not present in release build */
inline void testShake() {}
}; // Size: 0x84
#endif /* D_D_VIBRATION_H */