diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 0b13763a..aae9a997 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -2888,9 +2888,9 @@ getType__20dCursorHitCheckLyt_cFv = .text:0x800664D0; // type:function size:0xC getType__19dCursorHitCheckCC_cFv = .text:0x800664E0; // type:function size:0xC __ct__9dRumble_cFv = .text:0x800664F0; // type:function size:0x10 __dt__9dRumble_cFv = .text:0x80066500; // type:function size:0x48 -init__9dRumble_cFv = .text:0x80066550; // type:function size:0x54 -play__9dRumble_cFv = .text:0x800665B0; // type:function size:0x4B8 -deinit__9dRumble_cFv = .text:0x80066A70; // type:function size:0x90 +create__9dRumble_cFv = .text:0x80066550; // type:function size:0x54 +execute__9dRumble_cFv = .text:0x800665B0; // type:function size:0x4B8 +remove__9dRumble_cFv = .text:0x80066A70; // type:function size:0x90 start__9dRumble_cFRC14dRumbleEntry_cUl = .text:0x80066B00; // type:function size:0x224 stop__9dRumble_cFl = .text:0x80066D30; // type:function size:0x54 __ct__14dRumbleEntry_cFlUlf = .text:0x80066D90; // type:function size:0x10 diff --git a/include/d/d_rumble.h b/include/d/d_rumble.h index 10087cb7..034be95d 100644 --- a/include/d/d_rumble.h +++ b/include/d/d_rumble.h @@ -7,7 +7,7 @@ class dRumbleEntry_c { friend class dRumble_c; public: - dRumbleEntry_c(s32 length, u32 bits, f32 instesity); + dRumbleEntry_c(s32 length, u32 bits, f32 intensity); private: /* 0x00 */ s32 mLength; @@ -23,6 +23,8 @@ public: /* Queues the entry into the Rumble Manager */ bool start(const dRumbleEntry_c &entry, u32 flags); + + /* Removes the entry from the Rumble Manager*/ void stop(); bool isActive() const { @@ -61,21 +63,23 @@ public: }; public: - /** Generates the instance */ - static void init(); - /** Deletes the instance */ - static void deinit(); + /** Generates the single instance */ + static void create(); + + /** Deletes the single instance */ + static void remove(); /** Runs the rumble instances */ - static void play(); + static void execute(); - /** inserts a rumble isntance into the manger. returns the index */ + /** inserts a rumble instance into the manager. returns the index */ static s32 start(const dRumbleEntry_c &entry, u32 flags); - /** Stops one of the data instances (sets lenght to 0)/ -1 means to stop all */ + + /** Stops one of the data instances (sets length to 0). -1 means to stop all */ static void stop(s32 idx); virtual ~dRumble_c(); - // 80066e50 + /** Rumble Presets */ static dRumbleEntry_c sRumblePreset0; static dRumbleEntry_c sRumblePreset1; diff --git a/src/d/d_rumble.cpp b/src/d/d_rumble.cpp index d4066cc5..bc5dcd12 100644 --- a/src/d/d_rumble.cpp +++ b/src/d/d_rumble.cpp @@ -26,7 +26,7 @@ dRumble_c::~dRumble_c() { spInstance = nullptr; } -void dRumble_c::init() { +void dRumble_c::create() { spInstance = new dRumble_c(); spInstance->mRumbleData[0].mBitsLeft = 0; @@ -35,7 +35,7 @@ void dRumble_c::init() { spInstance->mRumbleData[3].mBitsLeft = 0; } -void dRumble_c::play() { +void dRumble_c::execute() { // If the game is not being controlled, do not do anything if (dLytControlGame_c::getInstance()) { if (!dLytControlGame_c::getInstance()->isStateNormal()) { @@ -50,6 +50,8 @@ void dRumble_c::play() { return; } + // These structs are only used here. + // No need to make them global struct Entry { u32 bits; s32 length; @@ -57,9 +59,9 @@ void dRumble_c::play() { } entries[2] = {}; struct Info { u32 mBits; - f32 intensites[4]; + f32 intensities[4]; s32 combinedLength; - s32 mBitsLeft; + s32 _unused; } info = {}; for (s32 i = 0; i < 4; ++i) { @@ -72,15 +74,15 @@ void dRumble_c::play() { if (data.mFlags & FLAG_ACTIVE) { info.mBits |= data.mRumbleBits << bit; if (data.mFlags & FLAG_INITIALIZE) { - info.intensites[i] = data.mIntensity; + info.intensities[i] = data.mIntensity; } else { - info.intensites[i] = data.mIntensity * ((f32)data.mBitsLeft / data.mLength); + info.intensities[i] = data.mIntensity * ((f32)data.mBitsLeft / data.mLength); } if (info.combinedLength < data.mBitsLeft) { info.combinedLength = data.mBitsLeft; } } else { - info.intensites[i] = 0.f; + info.intensities[i] = 0.f; } if (data.mFlags & FLAG_SLOT0) { @@ -118,8 +120,8 @@ void dRumble_c::play() { f32 shake; } s = {0, 0.1f}; for (s32 i = 0; i < 4; i++) { - if (s.shake < info.intensites[i]) { - s.shake = info.intensites[i]; + if (s.shake < info.intensities[i]) { + s.shake = info.intensities[i]; s.slot = i; } } @@ -127,9 +129,9 @@ void dRumble_c::play() { f32 shake = 0.f; for (s32 i = 0; i < 4; i++) { if (i == s.slot) { - shake += info.intensites[i]; + shake += info.intensities[i]; } else { - f32 tmp = info.intensites[i]; + f32 tmp = info.intensities[i]; shake += tmp * (tmp / s.shake); } } @@ -165,7 +167,7 @@ void dRumble_c::play() { } } -void dRumble_c::deinit() { +void dRumble_c::remove() { if (spInstance != nullptr) { spInstance->mRumbleData[0].mBitsLeft = 0; spInstance->mRumbleData[1].mBitsLeft = 0;