Browse Source

Clean up init_disable_screensaver

pull/256/head
Anders Jenbo 7 years ago
parent
commit
e24cbb2423
  1. 2
      Source/automap.cpp
  2. 2
      Source/control.cpp
  3. 6
      Source/drlg_l1.cpp
  4. 32
      Source/init.cpp

2
Source/automap.cpp

@ -577,7 +577,7 @@ void SetAutomapView(int x, int y)
return;
}
automapview[xx][yy] = 1;
automapview[xx][yy] = TRUE;
maptype = GetAutomapType(xx, yy, FALSE);
solid = maptype & 0x4000;

2
Source/control.cpp

@ -2638,7 +2638,7 @@ void control_press_enter()
}
if (i >= 8) {
strcpy(sgszTalkSave[sgbNextTalkSave], sgszTalkMsg);
sgbNextTalkSave = sgbNextTalkSave + 1;
sgbNextTalkSave++;
sgbNextTalkSave &= 7;
} else {
talk_save = sgbNextTalkSave - 1;

6
Source/drlg_l1.cpp

@ -615,10 +615,8 @@ void DRLG_L1Shadows()
dungeon[x - 1][y - 1] = SPATS[i].nv1;
if (SPATS[i].nv2 && !L5dflags[x][y - 1])
dungeon[x][y - 1] = SPATS[i].nv2;
if (SPATS[i].nv3) {
if (!L5dflags[x - 1][y])
dungeon[x - 1][y] = SPATS[i].nv3;
}
if (SPATS[i].nv3 && !L5dflags[x - 1][y])
dungeon[x - 1][y] = SPATS[i].nv3;
}
}
}

32
Source/init.cpp

@ -113,24 +113,30 @@ void init_disable_screensaver(BOOLEAN disable)
char Data[16];
DWORD Type, cbData;
HKEY phkResult;
LRESULT success;
// BUGFIX: this is probably the worst possible way to do this. Alternatives: ExtEscape() with SETPOWERMANAGEMENT,
// SystemParametersInfo() with SPI_SETSCREENSAVEACTIVE/SPI_SETPOWEROFFACTIVE/SPI_SETLOWPOWERACTIVE
if (!RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ | KEY_WRITE, (PHKEY)&phkResult)) {
if (disable) {
cbData = 16;
if (!RegQueryValueEx(phkResult, "ScreenSaveActive", 0, &Type, (LPBYTE)Data, &cbData))
screensaver_enabled_prev = Data[0] != '0';
enabled = FALSE;
} else {
enabled = screensaver_enabled_prev;
}
Data[1] = 0;
Data[0] = enabled ? '1' : '0';
RegSetValueEx(phkResult, "ScreenSaveActive", 0, REG_SZ, (const BYTE *)Data, 2);
RegCloseKey(phkResult);
success = RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ | KEY_WRITE, (PHKEY)&phkResult);
if (success != ERROR_SUCCESS) {
return;
}
if (disable) {
cbData = 16;
success = RegQueryValueEx(phkResult, "ScreenSaveActive", 0, &Type, (LPBYTE)Data, &cbData);
if (success == ERROR_SUCCESS)
screensaver_enabled_prev = Data[0] != '0';
enabled = FALSE;
} else {
enabled = screensaver_enabled_prev;
}
Data[1] = 0;
Data[0] = enabled ? '1' : '0';
RegSetValueEx(phkResult, "ScreenSaveActive", 0, REG_SZ, (const BYTE *)Data, 2);
RegCloseKey(phkResult);
}
void init_create_window(int nCmdShow)

Loading…
Cancel
Save