Skip to content

Commit

Permalink
Added screen shake setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Nishimura-Katsuo committed Aug 24, 2021
1 parent da57e7b commit a040069
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
14 changes: 13 additions & 1 deletion features/Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ wchar_t* __fastcall UnitVisualname(D2::Types::LivingUnit *pUnit) {

// This feature class registers itself.
class : public Feature {
DWORD disableShake = 0;
public:
void init() {
if (!Settings["disableSplash"]) {
Expand All @@ -382,7 +383,7 @@ class : public Feature {
}

MemoryPatch(0x4f5621) << NOP_TO(0x4f5672); // Allow multiple windows open
MemoryPatch(0x476D40) << ASM::RET; // Ignore shaking requests

MemoryPatch(0x43BF60) << ASM::RET; // Prevent battle.net connections
MemoryPatch(0x515FB1) << BYTE(0x01); // Delay of 1 on cleaning up sounds after quiting game
MemoryPatch(0x4781AC) << BYTESEQ{ 0x6A, 0x05, 0x90, 0x90, 0x90 }; // Hyperjoin for TCP/IP games
Expand Down Expand Up @@ -425,6 +426,17 @@ class : public Feature {
void gameLoop() {
gamestart = gamestart ? gamestart : GetTickCount();
flashy += speed;

if (Settings["disableShake"] != disableShake) {
if (Settings["disableShake"]) {
MemoryPatch(0x476D40) << ASM::RET; // Ignore shaking requests
}
else {
MemoryPatch(0x476D40) << REVERT(1);
}
}

disableShake = Settings["disableShake"];
}

void oogLoop() {
Expand Down
8 changes: 8 additions & 0 deletions features/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ std::vector<std::vector<DialogToggleInfo*>> SettingsColumns = {
SaveSettings();
}),
nullptr, // Empty Gap
new DialogToggleInfo(L"Disable screen shake",
[]() -> std::wstring {
return Settings["disableShake"] ? L"\u00FFc2On" : L"\u00FFc1Off";
}, [](MouseButton button, bool down) -> void {
if (down) return;
Settings["disableShake"] = !Settings["disableShake"];
SaveSettings();
}),
new DialogToggleInfo(L"Disable splash on start",
[]() -> std::wstring {
return Settings["disableSplash"] ? L"\u00FFc2On" : L"\u00FFc1Off";
Expand Down

0 comments on commit a040069

Please sign in to comment.