[Scummvm-cvs-logs] scummvm master -> ce32745d9c26a0b97dce6a137a46ff2004c7be02
fingolfin
max at quendi.de
Sat Jun 4 11:57:34 CEST 2011
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
91b889e2d3 COMMON: Rename kFeatureCursorHasPalette -> kFeatureCursorPalette
6575cd195b COMMON: Clarify OSystem feature flags docs a bit
ce32745d9c BACKENDS: Replace OSystem::disableCursorPalette by setFeatureState calls
Commit: 91b889e2d36baf8a8e1f56f05f4d063e5ae79849
https://github.com/scummvm/scummvm/commit/91b889e2d36baf8a8e1f56f05f4d063e5ae79849
Author: Max Horn (max at quendi.de)
Date: 2011-06-04T02:55:56-07:00
Commit Message:
COMMON: Rename kFeatureCursorHasPalette -> kFeatureCursorPalette
Changed paths:
backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
backends/graphics/gph/gph-graphics.cpp
backends/graphics/opengl/opengl-graphics.cpp
backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp
backends/graphics/sdl/sdl-graphics.cpp
backends/graphics/symbiansdl/symbiansdl-graphics.cpp
backends/platform/android/android.cpp
backends/platform/dc/dcmain.cpp
backends/platform/ds/arm9/source/osystem_ds.cpp
backends/platform/n64/osys_n64_base.cpp
backends/platform/psp/osys_psp.cpp
backends/platform/wii/osystem.cpp
common/system.h
engines/scumm/he/resource_he.cpp
engines/testbed/graphics.cpp
graphics/cursorman.cpp
graphics/cursorman.h
gui/ThemeEngine.cpp
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
index 6690244..8a141e9 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
@@ -468,7 +468,7 @@ bool DINGUXSdlGraphicsManager::loadGFXMode() {
bool DINGUXSdlGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureAspectRatioCorrection) ||
- (f == OSystem::kFeatureCursorHasPalette);
+ (f == OSystem::kFeatureCursorPalette);
}
void DINGUXSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp
index b407bf1..b650289 100644
--- a/backends/graphics/gph/gph-graphics.cpp
+++ b/backends/graphics/gph/gph-graphics.cpp
@@ -476,7 +476,7 @@ bool GPHGraphicsManager::loadGFXMode() {
bool GPHGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureAspectRatioCorrection) ||
- (f == OSystem::kFeatureCursorHasPalette);
+ (f == OSystem::kFeatureCursorPalette);
}
void GPHGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 32c0fbc..03f9593 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -91,7 +91,7 @@ void OpenGLGraphicsManager::initEventObserver() {
bool OpenGLGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureAspectRatioCorrection) ||
- (f == OSystem::kFeatureCursorHasPalette);
+ (f == OSystem::kFeatureCursorPalette);
}
void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
diff --git a/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp b/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp
index 18629d9..f683297 100644
--- a/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp
+++ b/backends/graphics/samsungtvsdl/samsungtvsdl-graphics.cpp
@@ -35,7 +35,7 @@ SamsungTVSdlGraphicsManager::SamsungTVSdlGraphicsManager(SdlEventSource *sdlEven
bool SamsungTVSdlGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureAspectRatioCorrection) ||
- (f == OSystem::kFeatureCursorHasPalette);
+ (f == OSystem::kFeatureCursorPalette);
}
void SamsungTVSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 7a5b777..8bc59a9 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -223,7 +223,7 @@ bool SdlGraphicsManager::hasFeature(OSystem::Feature f) {
return
(f == OSystem::kFeatureFullscreenMode) ||
(f == OSystem::kFeatureAspectRatioCorrection) ||
- (f == OSystem::kFeatureCursorHasPalette) ||
+ (f == OSystem::kFeatureCursorPalette) ||
(f == OSystem::kFeatureIconifyWindow);
}
diff --git a/backends/graphics/symbiansdl/symbiansdl-graphics.cpp b/backends/graphics/symbiansdl/symbiansdl-graphics.cpp
index 4d656cd..a88c8a8 100644
--- a/backends/graphics/symbiansdl/symbiansdl-graphics.cpp
+++ b/backends/graphics/symbiansdl/symbiansdl-graphics.cpp
@@ -54,7 +54,7 @@ bool SymbianSdlGraphicsManager::hasFeature(OSystem::Feature f) {
switch (f) {
case OSystem::kFeatureFullscreenMode:
case OSystem::kFeatureAspectRatioCorrection:
- case OSystem::kFeatureCursorHasPalette:
+ case OSystem::kFeatureCursorPalette:
#ifdef USE_VIBRA_SE_PXXX
case OSystem::kFeatureVibration:
#endif
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index eeeddb4..453b64b 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -399,7 +399,7 @@ void OSystem_Android::addPluginDirectories(Common::FSList &dirs) const {
bool OSystem_Android::hasFeature(Feature f) {
return (f == kFeatureFullscreenMode ||
f == kFeatureAspectRatioCorrection ||
- f == kFeatureCursorHasPalette ||
+ f == kFeatureCursorPalette ||
f == kFeatureVirtualKeyboard ||
f == kFeatureOverlaySupportsAlpha);
}
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index dfce176..b06e9ae 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -163,7 +163,7 @@ bool OSystem_Dreamcast::hasFeature(Feature f)
case kFeatureAspectRatioCorrection:
case kFeatureVirtualKeyboard:
case kFeatureOverlaySupportsAlpha:
- case kFeatureCursorHasPalette:
+ case kFeatureCursorPalette:
return true;
default:
return false;
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 462990c..528e4df 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -122,7 +122,7 @@ void OSystem_DS::initBackend() {
}
bool OSystem_DS::hasFeature(Feature f) {
- return (f == kFeatureVirtualKeyboard) || (f == kFeatureCursorHasPalette);
+ return (f == kFeatureVirtualKeyboard) || (f == kFeatureCursorPalette);
}
void OSystem_DS::setFeatureState(Feature f, bool enable) {
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 094bb83..e70c2a6 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -199,7 +199,7 @@ void OSystem_N64::initBackend() {
}
bool OSystem_N64::hasFeature(Feature f) {
- return (f == kFeatureCursorHasPalette);
+ return (f == kFeatureCursorPalette);
}
void OSystem_N64::setFeatureState(Feature f, bool enable) {
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 3db743e..2b37460 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -110,7 +110,7 @@ void OSystem_PSP::engineDone() {
}
bool OSystem_PSP::hasFeature(Feature f) {
- return (f == kFeatureOverlaySupportsAlpha || f == kFeatureCursorHasPalette);
+ return (f == kFeatureOverlaySupportsAlpha || f == kFeatureCursorPalette);
}
void OSystem_PSP::setFeatureState(Feature f, bool enable) {
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 401b19b..02ebc02 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -175,7 +175,7 @@ void OSystem_Wii::engineDone() {
bool OSystem_Wii::hasFeature(Feature f) {
return (f == kFeatureFullscreenMode) ||
(f == kFeatureAspectRatioCorrection) ||
- (f == kFeatureCursorHasPalette) ||
+ (f == kFeatureCursorPalette) ||
(f == kFeatureOverlaySupportsAlpha);
}
diff --git a/common/system.h b/common/system.h
index ad706b5..67f7ac8 100644
--- a/common/system.h
+++ b/common/system.h
@@ -168,7 +168,7 @@ public:
* To enable the cursor palette call "disableCursorPalette" with false.
* @see disableCursorPalette
*/
- kFeatureCursorHasPalette,
+ kFeatureCursorPalette,
/**
* Set to true if the overlay pixel format has an alpha channel.
@@ -776,22 +776,22 @@ public:
* The palette entries from 'start' till (start+num-1) will be replaced - so
* a full palette update is accomplished via start=0, num=256.
*
- * Backends which implement it should have kFeatureCursorHasPalette flag set
+ * Backends which implement it should have kFeatureCursorPalette flag set
*
* @see setPalette
- * @see kFeatureCursorHasPalette
+ * @see kFeatureCursorPalette
*/
virtual void setCursorPalette(const byte *colors, uint start, uint num) {}
/**
* Disable or enable cursor palette.
*
- * Backends which implement it should have kFeatureCursorHasPalette flag set
+ * Backends which implement it should have kFeatureCursorPalette flag set
*
* @param disable True to disable, false to enable.
*
* @see setPalette
- * @see kFeatureCursorHasPalette
+ * @see kFeatureCursorPalette
*/
virtual void disableCursorPalette(bool disable) {}
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index 6b195be..4565bb9 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -171,7 +171,7 @@ bool MacResExtractor::extractResource(int id, CachedCursor *cc) {
return false;
// If we don't have a cursor palette, force monochrome cursors
- bool forceMonochrome = !_vm->_system->hasFeature(OSystem::kFeatureCursorHasPalette);
+ bool forceMonochrome = !_vm->_system->hasFeature(OSystem::kFeatureCursorPalette);
Graphics::MacCursor *macCursor = new Graphics::MacCursor();
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index b38b83f..d5b5da7 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -244,7 +244,7 @@ void rotatePalette(byte *palette, int size) {
*/
void GFXtests::setupMouseLoop(bool disableCursorPalette, const char *gfxModeName, int cursorTargetScale) {
bool isFeaturePresent;
- isFeaturePresent = g_system->hasFeature(OSystem::kFeatureCursorHasPalette);
+ isFeaturePresent = g_system->hasFeature(OSystem::kFeatureCursorPalette);
Common::Rect cursorRect;
if (isFeaturePresent) {
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index 297b583..3d21e49 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -86,7 +86,7 @@ void CursorManager::popAllCursors() {
delete cur;
}
- if (g_system->hasFeature(OSystem::kFeatureCursorHasPalette)) {
+ if (g_system->hasFeature(OSystem::kFeatureCursorPalette)) {
while (!_cursorPaletteStack.empty()) {
Palette *pal = _cursorPaletteStack.pop();
delete pal;
@@ -141,11 +141,11 @@ void CursorManager::replaceCursor(const byte *buf, uint w, uint h, int hotspotX,
}
bool CursorManager::supportsCursorPalettes() {
- return g_system->hasFeature(OSystem::kFeatureCursorHasPalette);
+ return g_system->hasFeature(OSystem::kFeatureCursorPalette);
}
void CursorManager::disableCursorPalette(bool disable) {
- if (!g_system->hasFeature(OSystem::kFeatureCursorHasPalette))
+ if (!g_system->hasFeature(OSystem::kFeatureCursorPalette))
return;
if (_cursorPaletteStack.empty())
@@ -158,7 +158,7 @@ void CursorManager::disableCursorPalette(bool disable) {
}
void CursorManager::pushCursorPalette(const byte *colors, uint start, uint num) {
- if (!g_system->hasFeature(OSystem::kFeatureCursorHasPalette))
+ if (!g_system->hasFeature(OSystem::kFeatureCursorPalette))
return;
Palette *pal = new Palette(colors, start, num);
@@ -171,7 +171,7 @@ void CursorManager::pushCursorPalette(const byte *colors, uint start, uint num)
}
void CursorManager::popCursorPalette() {
- if (!g_system->hasFeature(OSystem::kFeatureCursorHasPalette))
+ if (!g_system->hasFeature(OSystem::kFeatureCursorPalette))
return;
if (_cursorPaletteStack.empty())
@@ -194,7 +194,7 @@ void CursorManager::popCursorPalette() {
}
void CursorManager::replaceCursorPalette(const byte *colors, uint start, uint num) {
- if (!g_system->hasFeature(OSystem::kFeatureCursorHasPalette))
+ if (!g_system->hasFeature(OSystem::kFeatureCursorPalette))
return;
if (_cursorPaletteStack.empty()) {
diff --git a/graphics/cursorman.h b/graphics/cursorman.h
index 1e7ce83..543a5d0 100644
--- a/graphics/cursorman.h
+++ b/graphics/cursorman.h
@@ -108,9 +108,9 @@ public:
* Test whether cursor palettes are supported.
*
* This is just an convenience wrapper for checking for
- * OSystem::kFeatureCursorHasPalette to be supported by OSystem.
+ * OSystem::kFeatureCursorPalette to be supported by OSystem.
*
- * @see OSystem::kFeatureCursorHasPalette
+ * @see OSystem::kFeatureCursorPalette
* @see OSystem::hasFeature
*/
bool supportsCursorPalettes();
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 678b5f0..f8e94ad 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1271,7 +1271,7 @@ void ThemeEngine::openDialog(bool doBuffer, ShadingStyle style) {
}
bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int hotspotY, int scale) {
- if (!_system->hasFeature(OSystem::kFeatureCursorHasPalette))
+ if (!_system->hasFeature(OSystem::kFeatureCursorPalette))
return true;
// Try to locate the specified file among all loaded bitmaps
Commit: 6575cd195bef842697ea0b0ec80c3c1aa91f58e5
https://github.com/scummvm/scummvm/commit/6575cd195bef842697ea0b0ec80c3c1aa91f58e5
Author: Max Horn (max at quendi.de)
Date: 2011-06-04T02:55:56-07:00
Commit Message:
COMMON: Clarify OSystem feature flags docs a bit
Changed paths:
common/system.h
diff --git a/common/system.h b/common/system.h
index 67f7ac8..e74b878 100644
--- a/common/system.h
+++ b/common/system.h
@@ -128,11 +128,19 @@ public:
* - fullscreen mode
* - aspect ration correction
* - a virtual keyboard for text entry (on PDAs)
+ *
+ * One has to distinguish between the *availability* of a feature,
+ * which can be checked using hasFeature(), and its *state*.
+ * For example, the SDL backend *has* the kFeatureFullscreenMode,
+ * so hasFeature returns true for it. On the other hand,
+ * fullscreen mode may be active or not; this can be determined
+ * by checking the state via getFeatureState(). Finally, to
+ * switch between fullscreen and windowed mode, use setFeatureState().
*/
enum Feature {
/**
- * If your backend supports both a windowed and a fullscreen mode,
- * then this feature flag can be used to switch between the two.
+ * If supported, this feature flag can be used to switch between
+ * windowed and fullscreen mode.
*/
kFeatureFullscreenMode,
@@ -144,10 +152,10 @@ public:
* pixels). When the backend support this, then games running at
* 320x200 pixels should be scaled up to 320x240 pixels. For all other
* resolutions, ignore this feature flag.
- * @note You can find utility functions in common/scaler.h which can
- * be used to implement aspect ratio correction. In particular,
+ * @note Backend implementors can find utility functions in common/scaler.h
+ * which can be used to implement aspect ratio correction. In
* stretch200To240() can stretch a rect, including (very fast)
- * interpolation, and works in-place.
+ * particular, interpolation, and works in-place.
*/
kFeatureAspectRatioCorrection,
@@ -171,25 +179,32 @@ public:
kFeatureCursorPalette,
/**
- * Set to true if the overlay pixel format has an alpha channel.
- * This should only be set if it offers at least 3-4 bits of accuracy,
- * as opposed to a single alpha bit.
+ * A backend have this feature if its overlay pixel format has an alpha
+ * channel which offers at least 3-4 bits of accuracy (as opposed to
+ * just a single alpha bit).
+ *
+ * This feature has no associated state.
*/
kFeatureOverlaySupportsAlpha,
/**
- * Set to true to iconify the window.
+ * Client code can set the state of this feature to true in order to
+ * iconify the application window.
*/
kFeatureIconifyWindow,
/**
- * This feature, set to true, is a hint toward the backend to disable all
- * key filtering/mapping, in cases where it would be beneficial to do so.
- * As an example case, this is used in the agi engine's predictive dialog.
+ * Setting the state of this feature to true tells the backend to disable
+ * all key filtering/mapping, in cases where it would be beneficial to do so.
+ * As an example case, this is used in the AGI engine's predictive dialog.
* When the dialog is displayed this feature is set so that backends with
* phone-like keypad temporarily unmap all user actions which leads to
* comfortable word entry. Conversely, when the dialog exits the feature
* is set to false.
+ *
+ * TODO: The word 'beneficial' above is very unclear. Beneficial to
+ * whom and for what??? Just giving an example is not enough.
+ *
* TODO: Fingolfin suggests that the way the feature is used can be
* generalized in this sense: Have a keyboard mapping feature, which the
* engine queries for to assign keys to actions ("Here's my default key
@@ -198,8 +213,10 @@ public:
kFeatureDisableKeyFiltering,
/**
- * This feature indicates whether the displayLogFile() call
- * is supported.
+ * The presence of this feature indicates whether the displayLogFile()
+ * call is supported.
+ *
+ * This feature has no associated state.
*/
kFeatureDisplayLogFile
};
Commit: ce32745d9c26a0b97dce6a137a46ff2004c7be02
https://github.com/scummvm/scummvm/commit/ce32745d9c26a0b97dce6a137a46ff2004c7be02
Author: Max Horn (max at quendi.de)
Date: 2011-06-04T02:55:56-07:00
Commit Message:
BACKENDS: Replace OSystem::disableCursorPalette by setFeatureState calls
Changed paths:
backends/graphics/graphics.h
backends/graphics/null/null-graphics.h
backends/graphics/opengl/opengl-graphics.cpp
backends/graphics/opengl/opengl-graphics.h
backends/graphics/sdl/sdl-graphics.cpp
backends/graphics/sdl/sdl-graphics.h
backends/modular-backend.cpp
backends/modular-backend.h
backends/platform/android/android.cpp
backends/platform/android/android.h
backends/platform/android/gfx.cpp
backends/platform/dc/dc.h
backends/platform/dc/dcmain.cpp
backends/platform/dc/display.cpp
backends/platform/ds/arm9/source/osystem_ds.cpp
backends/platform/ds/arm9/source/osystem_ds.h
backends/platform/n64/osys_n64.h
backends/platform/n64/osys_n64_base.cpp
backends/platform/psp/cursor.h
backends/platform/psp/osys_psp.cpp
backends/platform/psp/osys_psp.h
backends/platform/wii/osystem.cpp
backends/platform/wii/osystem.h
backends/platform/wii/osystem_gfx.cpp
common/system.h
graphics/cursorman.cpp
diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h
index 4e681eb..20924ed 100644
--- a/backends/graphics/graphics.h
+++ b/backends/graphics/graphics.h
@@ -82,7 +82,6 @@ public:
virtual void warpMouse(int x, int y) = 0;
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) = 0;
virtual void setCursorPalette(const byte *colors, uint start, uint num) = 0;
- virtual void disableCursorPalette(bool disable) = 0;
virtual void displayMessageOnOSD(const char *msg) {}
};
diff --git a/backends/graphics/null/null-graphics.h b/backends/graphics/null/null-graphics.h
index 673d598..28b24f6 100644
--- a/backends/graphics/null/null-graphics.h
+++ b/backends/graphics/null/null-graphics.h
@@ -79,7 +79,6 @@ public:
void warpMouse(int x, int y) {}
void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL) {}
void setCursorPalette(const byte *colors, uint start, uint num) {}
- void disableCursorPalette(bool disable) {}
};
#endif
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 03f9593..c1bbdb2 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -105,6 +105,11 @@ void OpenGLGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
_transactionDetails.needRefresh = true;
break;
+ case OSystem::kFeatureCursorPalette:
+ _cursorPaletteDisabled = !enable;
+ _cursorNeedsRedraw = true;
+ break;
+
default:
break;
}
@@ -118,6 +123,9 @@ bool OpenGLGraphicsManager::getFeatureState(OSystem::Feature f) {
case OSystem::kFeatureAspectRatioCorrection:
return _videoMode.aspectRatioCorrection;
+ case OSystem::kFeatureCursorPalette:
+ return !_cursorPaletteDisabled;
+
default:
return false;
}
@@ -642,11 +650,6 @@ void OpenGLGraphicsManager::setCursorPalette(const byte *colors, uint start, uin
_cursorNeedsRedraw = true;
}
-void OpenGLGraphicsManager::disableCursorPalette(bool disable) {
- _cursorPaletteDisabled = disable;
- _cursorNeedsRedraw = true;
-}
-
//
// Misc
//
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index daba774..463715a 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -107,7 +107,6 @@ public:
virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
virtual void displayMessageOnOSD(const char *msg);
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 8bc59a9..ab09c3e 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -235,6 +235,10 @@ void SdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
case OSystem::kFeatureAspectRatioCorrection:
setAspectRatioCorrection(enable);
break;
+ case OSystem::kFeatureCursorPalette:
+ _cursorPaletteDisabled = !enable;
+ blitCursor();
+ break;
case OSystem::kFeatureIconifyWindow:
if (enable)
SDL_WM_IconifyWindow();
@@ -245,13 +249,15 @@ void SdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) {
}
bool SdlGraphicsManager::getFeatureState(OSystem::Feature f) {
- assert (_transactionMode == kTransactionNone);
+ assert(_transactionMode == kTransactionNone);
switch (f) {
case OSystem::kFeatureFullscreenMode:
return _videoMode.fullscreen;
case OSystem::kFeatureAspectRatioCorrection:
return _videoMode.aspectRatioCorrection;
+ case OSystem::kFeatureCursorPalette:
+ return !_cursorPaletteDisabled;
default:
return false;
}
@@ -1458,11 +1464,6 @@ void SdlGraphicsManager::setCursorPalette(const byte *colors, uint start, uint n
blitCursor();
}
-void SdlGraphicsManager::disableCursorPalette(bool disable) {
- _cursorPaletteDisabled = disable;
- blitCursor();
-}
-
void SdlGraphicsManager::setShakePos(int shake_pos) {
assert (_transactionMode == kTransactionNone);
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h
index 86e52a0..9627ab2 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/sdl/sdl-graphics.h
@@ -132,7 +132,6 @@ public:
virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
#ifdef USE_OSD
virtual void displayMessageOnOSD(const char *msg);
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index c5f147f..a1c227b 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -222,10 +222,6 @@ void ModularBackend::setCursorPalette(const byte *colors, uint start, uint num)
_graphicsManager->setCursorPalette(colors, start, num);
}
-void ModularBackend::disableCursorPalette(bool disable) {
- _graphicsManager->disableCursorPalette(disable);
-}
-
Common::TimerManager *ModularBackend::getTimerManager() {
assert(_timerManager);
return _timerManager;
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index e46fbfd..74603e3 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -106,7 +106,6 @@ public:
virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
//@}
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 453b64b..5ae0239 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -420,6 +420,11 @@ void OSystem_Android::setFeatureState(Feature f, bool enable) {
_virtkeybd_on = enable;
showVirtualKeyboard(enable);
break;
+ case kFeatureCursorPalette:
+ _use_mouse_palette = !enable;
+ if (!enable)
+ disableCursorPalette();
+ break;
default:
break;
}
@@ -433,6 +438,8 @@ bool OSystem_Android::getFeatureState(Feature f) {
return _ar_correction;
case kFeatureVirtualKeyboard:
return _virtkeybd_on;
+ case kFeatureCursorPalette:
+ return _use_mouse_palette;
default:
return false;
}
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 752a31a..b70fdb7 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -237,6 +237,7 @@ private:
void clipMouse(Common::Point &p);
void scaleMouse(Common::Point &p, int x, int y, bool deductDrawRect = true);
void updateEventScale();
+ void disableCursorPalette();
protected:
// PaletteManager API
@@ -272,7 +273,6 @@ public:
int cursorTargetScale,
const Graphics::PixelFormat *format);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
virtual bool pollEvent(Common::Event &event);
virtual uint32 getMillis();
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 89e918a..b8a9e74 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -801,12 +801,10 @@ void OSystem_Android::setCursorPalette(const byte *colors,
_use_mouse_palette = true;
}
-void OSystem_Android::disableCursorPalette(bool disable) {
- ENTER("%d", disable);
-
+void OSystem_Android::disableCursorPalette() {
// when disabling the cursor palette, and we're running a clut8 game,
// it expects the game palette to be used for the cursor
- if (disable && _game_texture->hasPalette()) {
+ if (_game_texture->hasPalette()) {
const byte *src = _game_texture->palette_const();
byte *dst = _mouse_texture_palette->palette();
@@ -825,8 +823,6 @@ void OSystem_Android::disableCursorPalette(bool disable) {
byte *p = _mouse_texture_palette->palette() + _mouse_keycolor * 2;
WRITE_UINT16(p, READ_UINT16(p) & ~1);
}
-
- _use_mouse_palette = !disable;
}
#endif
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index e31b817..0ae4e09 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -145,9 +145,6 @@ public:
// Replace the specified range of cursor the palette with new colors.
void setCursorPalette(const byte *colors, uint start, uint num);
- // Disable or enable cursor palette.
- void disableCursorPalette(bool disable);
-
// Shaking is used in SCUMM. Set current shake position.
void setShakePos(int shake_pos);
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index b06e9ae..916dfb8 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -181,6 +181,9 @@ void OSystem_Dreamcast::setFeatureState(Feature f, bool enable)
case kFeatureVirtualKeyboard:
_softkbd_on = enable;
break;
+ case kFeatureCursorPalette:
+ _enable_cursor_palette = enable;
+ break;
default:
break;
}
@@ -193,6 +196,8 @@ bool OSystem_Dreamcast::getFeatureState(Feature f)
return _aspect_stretch;
case kFeatureVirtualKeyboard:
return _softkbd_on;
+ case kFeatureCursorPalette:
+ return _enable_cursor_palette;
default:
return false;
}
diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp
index 56eef87..a11e329 100644
--- a/backends/platform/dc/display.cpp
+++ b/backends/platform/dc/display.cpp
@@ -171,11 +171,6 @@ void OSystem_Dreamcast::setCursorPalette(const byte *colors, uint start, uint nu
_enable_cursor_palette = true;
}
-void OSystem_Dreamcast::disableCursorPalette(bool disable)
-{
- _enable_cursor_palette = !disable;
-}
-
void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num)
{
const unsigned short *src = palette + start;
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 528e4df..db274b7 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -128,11 +128,17 @@ bool OSystem_DS::hasFeature(Feature f) {
void OSystem_DS::setFeatureState(Feature f, bool enable) {
if (f == kFeatureVirtualKeyboard)
DS::setKeyboardIcon(enable);
+ else if (f == kFeatureCursorPalette) {
+ _disableCursorPalette = !enable;
+ refreshCursor();
+ }
}
bool OSystem_DS::getFeatureState(Feature f) {
if (f == kFeatureVirtualKeyboard)
return DS::getKeyboardIcon();
+ if (f == kFeatureCursorPalette)
+ return !_disableCursorPalette;
return false;
}
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index 4ab2e36..ecb8011 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -172,8 +172,6 @@ public:
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool dis) { _disableCursorPalette = dis; refreshCursor(); }
-
FilesystemFactory *getFilesystemFactory();
void refreshCursor();
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index 8c0b34c..f22b221 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -189,7 +189,6 @@ public:
virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format);
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
virtual bool pollEvent(Common::Event &event);
virtual uint32 getMillis();
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index e70c2a6..ba2aa20 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -203,10 +203,19 @@ bool OSystem_N64::hasFeature(Feature f) {
}
void OSystem_N64::setFeatureState(Feature f, bool enable) {
- return;
+ if (f == kFeatureCursorPalette) {
+ _cursorPaletteDisabled = !enable;
+
+ // Rebuild cursor hicolor buffer
+ rebuildOffscreenMouseBuffer();
+
+ _dirtyOffscreen = true;
+ }
}
bool OSystem_N64::getFeatureState(Feature f) {
+ if (f == kFeatureCursorPalette)
+ return !_cursorPaletteDisabled
return false;
}
@@ -437,15 +446,6 @@ void OSystem_N64::setCursorPalette(const byte *colors, uint start, uint num) {
_dirtyOffscreen = true;
}
-void OSystem_N64::disableCursorPalette(bool disable) {
- _cursorPaletteDisabled = disable;
-
- // Rebuild cursor hicolor buffer
- rebuildOffscreenMouseBuffer();
-
- _dirtyOffscreen = true;
-}
-
void OSystem_N64::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
//Clip the coordinates
if (x < 0) {
diff --git a/backends/platform/psp/cursor.h b/backends/platform/psp/cursor.h
index 9c24d00..f799682 100644
--- a/backends/platform/psp/cursor.h
+++ b/backends/platform/psp/cursor.h
@@ -53,6 +53,7 @@ public:
Buffer &buffer() { return _buffer; }
void setCursorPalette(const byte *colors, uint start, uint num);
void enableCursorPalette(bool enable);
+ bool isCursorPaletteEnabled() const { return _useCursorPalette; }
void setLimits(uint32 width, uint32 height);
void setXY(int x, int y);
int32 getX() const { return _x; }
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 2b37460..eb62937 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -114,9 +114,16 @@ bool OSystem_PSP::hasFeature(Feature f) {
}
void OSystem_PSP::setFeatureState(Feature f, bool enable) {
+ if (f == kFeatureCursorPalette) {
+ _pendingUpdate = false;
+ _cursor.enableCursorPalette(enable);
+ }
}
bool OSystem_PSP::getFeatureState(Feature f) {
+ if (f == kFeatureCursorPalette) {
+ return _cursor.isCursorPaletteEnabled();
+ }
return false;
}
@@ -198,12 +205,6 @@ void OSystem_PSP::setCursorPalette(const byte *colors, uint start, uint num) {
_cursor.clearKeyColor(); // Do we need this?
}
-void OSystem_PSP::disableCursorPalette(bool disable) {
- DEBUG_ENTER_FUNC();
- _pendingUpdate = false;
- _cursor.enableCursorPalette(!disable);
-}
-
void OSystem_PSP::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
DEBUG_ENTER_FUNC();
_displayManager.waitUntilRenderFinished();
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index 00eec3d..8b7c960 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -99,7 +99,6 @@ protected:
void grabPalette(byte *colors, uint start, uint num);
public:
void setCursorPalette(const byte *colors, uint start, uint num);
- void disableCursorPalette(bool disable);
// Screen related
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 02ebc02..d293828 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -188,6 +188,13 @@ void OSystem_Wii::setFeatureState(Feature f, bool enable) {
case kFeatureAspectRatioCorrection:
_arCorrection = enable;
break;
+ case kFeatureCursorPalette:
+ _cursorPaletteDisabled = !enable;
+ if (_texMouse.palette && !enable) {
+ memcpy(_texMouse.palette, _cursorPalette, 256 * 2);
+ _cursorPaletteDirty = true;
+ }
+ break;
default:
break;
}
@@ -199,6 +206,8 @@ bool OSystem_Wii::getFeatureState(Feature f) {
return _fullscreen;
case kFeatureAspectRatioCorrection:
return _arCorrection;
+ case kFeatureCursorPalette:
+ return !_cursorPaletteDisabled;
default:
return false;
}
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 0db5f92..981b25f 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -171,7 +171,6 @@ protected:
virtual void grabPalette(byte *colors, uint start, uint num);
public:
virtual void setCursorPalette(const byte *colors, uint start, uint num);
- virtual void disableCursorPalette(bool disable);
virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y,
int w, int h);
virtual void updateScreen();
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index b44c127..859e3a1 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -394,15 +394,6 @@ void OSystem_Wii::setCursorPalette(const byte *colors, uint start, uint num) {
_cursorPaletteDirty = true;
}
-void OSystem_Wii::disableCursorPalette(bool disable) {
- _cursorPaletteDisabled = disable;
-
- if (_texMouse.palette && disable) {
- memcpy(_texMouse.palette, _cursorPalette, 256 * 2);
- _cursorPaletteDirty = true;
- }
-}
-
void OSystem_Wii::copyRectToScreen(const byte *buf, int pitch, int x, int y,
int w, int h) {
assert(x >= 0 && x < _gameWidth);
diff --git a/common/system.h b/common/system.h
index e74b878..b7fc870 100644
--- a/common/system.h
+++ b/common/system.h
@@ -167,14 +167,14 @@ public:
kFeatureVirtualKeyboard,
/**
- * This flag determines whether or not the cursor can have its own palette.
+ * Backends supporting this feature allow specifying a custom palette
+ * for the cursor. The custom palette is used if the feature state
+ * is set to true by the client code via setFeatureState().
+ *
* It is currently used only by some Macintosh versions of Humongous
- * Entertainment games. If the backend doesn't implement this feature then
- * the engine switches to b/w versions of cursors.
+ * Entertainment games. If the backend doesn't implement this feature
+ * then the engine switches to b/w versions of cursors.
* The GUI also relies on this feature for mouse cursors.
- *
- * To enable the cursor palette call "disableCursorPalette" with false.
- * @see disableCursorPalette
*/
kFeatureCursorPalette,
@@ -800,18 +800,6 @@ public:
*/
virtual void setCursorPalette(const byte *colors, uint start, uint num) {}
- /**
- * Disable or enable cursor palette.
- *
- * Backends which implement it should have kFeatureCursorPalette flag set
- *
- * @param disable True to disable, false to enable.
- *
- * @see setPalette
- * @see kFeatureCursorPalette
- */
- virtual void disableCursorPalette(bool disable) {}
-
//@}
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index 3d21e49..a549890 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -154,7 +154,7 @@ void CursorManager::disableCursorPalette(bool disable) {
Palette *pal = _cursorPaletteStack.top();
pal->_disabled = disable;
- g_system->disableCursorPalette(disable);
+ g_system->setFeatureState(OSystem::kFeatureCursorPalette, !disable);
}
void CursorManager::pushCursorPalette(const byte *colors, uint start, uint num) {
@@ -167,7 +167,7 @@ void CursorManager::pushCursorPalette(const byte *colors, uint start, uint num)
if (num)
g_system->setCursorPalette(colors, start, num);
else
- g_system->disableCursorPalette(true);
+ g_system->setFeatureState(OSystem::kFeatureCursorPalette, false);
}
void CursorManager::popCursorPalette() {
@@ -181,7 +181,7 @@ void CursorManager::popCursorPalette() {
delete pal;
if (_cursorPaletteStack.empty()) {
- g_system->disableCursorPalette(true);
+ g_system->setFeatureState(OSystem::kFeatureCursorPalette, false);
return;
}
@@ -190,7 +190,7 @@ void CursorManager::popCursorPalette() {
if (pal->_num && !pal->_disabled)
g_system->setCursorPalette(pal->_data, pal->_start, pal->_num);
else
- g_system->disableCursorPalette(true);
+ g_system->setFeatureState(OSystem::kFeatureCursorPalette, false);
}
void CursorManager::replaceCursorPalette(const byte *colors, uint start, uint num) {
@@ -219,7 +219,7 @@ void CursorManager::replaceCursorPalette(const byte *colors, uint start, uint nu
memcpy(pal->_data, colors, size);
g_system->setCursorPalette(pal->_data, pal->_start, pal->_num);
} else {
- g_system->disableCursorPalette(true);
+ g_system->setFeatureState(OSystem::kFeatureCursorPalette, false);
}
}
More information about the Scummvm-git-logs
mailing list