diff --git a/engines/sherlock/scene.cpp b/engines/sherlock/scene.cpp index 78858bc284b..e71bc7eef73 100644 --- a/engines/sherlock/scene.cpp +++ b/engines/sherlock/scene.cpp @@ -26,6 +26,13 @@ namespace Sherlock { +static const int FS_TRANS[8] = { + STOP_UP, STOP_UPRIGHT, STOP_RIGHT, STOP_DOWNRIGHT, STOP_DOWN, + STOP_DOWNLEFT, STOP_LEFT, STOP_UPLEFT +}; + +/*----------------------------------------------------------------*/ + /** * Load the data for the object */ @@ -637,11 +644,6 @@ void Scene::transitionToScene() { Common::Point &hSavedPos = people._hSavedPos; int &hSavedFacing = people._hSavedFacing; - const int FS_TRANS[8] = { - STOP_UP, STOP_UPRIGHT, STOP_RIGHT, STOP_DOWNRIGHT, STOP_DOWN, - STOP_DOWNLEFT, STOP_LEFT, STOP_UPLEFT - }; - if (hSavedPos.x < 1) { // No exit information from last scene-check entrance info if (_entrance._startPosition.x < 1) { diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp index d9ec1d745d6..4c70bf21c5f 100644 --- a/engines/sherlock/screen.cpp +++ b/engines/sherlock/screen.cpp @@ -328,13 +328,10 @@ void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, */ void Screen::print(const Common::Point &pt, byte color, const char *formatStr, ...) { // Create the string to display - char buffer[100]; va_list args; - va_start(args, formatStr); - vsprintf(buffer, formatStr, args); + Common::String str = Common::String::vformat(formatStr, args); va_end(args); - Common::String str(buffer); // Figure out area to draw text in Common::Point pos = pt; @@ -362,13 +359,10 @@ void Screen::print(const Common::Point &pt, byte color, const char *formatStr, . */ void Screen::gPrint(const Common::Point &pt, byte color, const char *formatStr, ...) { // Create the string to display - char buffer[100]; va_list args; - va_start(args, formatStr); - vsprintf(buffer, formatStr, args); + Common::String str = Common::String::vformat(formatStr, args); va_end(args); - Common::String str(buffer); // Print the text writeString(str, pt, color); diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h index 2103588fe03..452a18631f0 100644 --- a/engines/sherlock/screen.h +++ b/engines/sherlock/screen.h @@ -101,8 +101,8 @@ public: void verticalTransition(); - void print(const Common::Point &pt, byte color, const char *formatStr, ...); - void gPrint(const Common::Point &pt, byte color, const char *formatStr, ...); + void print(const Common::Point &pt, byte color, const char *formatStr, ...) GCC_PRINTF(4, 5); + void gPrint(const Common::Point &pt, byte color, const char *formatStr, ...) GCC_PRINTF(4, 5); void restoreBackground(const Common::Rect &r); diff --git a/engines/sherlock/settings.cpp b/engines/sherlock/settings.cpp index b4110d593cc..036177adbe3 100644 --- a/engines/sherlock/settings.cpp +++ b/engines/sherlock/settings.cpp @@ -25,7 +25,7 @@ namespace Sherlock { -const int SETUP_POINTS[12][4] = { +static const int SETUP_POINTS[12][4] = { { 4, 154, 101, 53 }, // Exit { 4, 165, 101, 53 }, // Music Toggle { 219, 165, 316, 268 }, // Voice Toggle @@ -40,13 +40,13 @@ const int SETUP_POINTS[12][4] = { { 219, 187, 316, 268 } // _key Pad Accel. Toggle }; -const char *const SETUP_STRS0[2] = { "off", "on" }; -const char *const SETUP_STRS1[2] = { "Directly", "by Pixel" }; -const char *const SETUP_STRS2[2] = { "Left", "Right" }; -const char *const SETUP_STRS3[2] = { "Appear", "Slide" }; -const char *const SETUP_STRS4[2] = { "Slow", "Fast" }; -const char *const SETUP_STRS5[2] = { "Left", "Right" }; -const char *const SETUP_NAMES[12] = { +static const char *const SETUP_STRS0[2] = { "off", "on" }; +static const char *const SETUP_STRS1[2] = { "Directly", "by Pixel" }; +static const char *const SETUP_STRS2[2] = { "Left", "Right" }; +static const char *const SETUP_STRS3[2] = { "Appear", "Slide" }; +static const char *const SETUP_STRS4[2] = { "Slow", "Fast" }; +static const char *const SETUP_STRS5[2] = { "Left", "Right" }; +static const char *const SETUP_NAMES[12] = { "Exit", "M", "V", "S", "B", "New Font Style", "J", "Calibrate Joystick", "F", "W", "P", "K" }; diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp index bd8dcb69ee8..fd5c9a84d5f 100644 --- a/engines/sherlock/sherlock.cpp +++ b/engines/sherlock/sherlock.cpp @@ -203,6 +203,8 @@ void SherlockEngine::handleInput() { /** * Read the state of a global flag + * @remarks If a negative value is specified, it will return the inverse value + * of the positive flag number */ bool SherlockEngine::readFlags(int flagNum) { bool value = _flags[ABS(flagNum)]; diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp index 9693ccbd946..205178c0ec6 100644 --- a/engines/sherlock/sound.cpp +++ b/engines/sherlock/sound.cpp @@ -30,6 +30,26 @@ namespace Sherlock { +static const int8 creativeADPCM_ScaleMap[64] = { + 0, 1, 2, 3, 4, 5, 6, 7, 0, -1, -2, -3, -4, -5, -6, -7, + 1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15, + 2, 6, 10, 14, 18, 22, 26, 30, -2, -6, -10, -14, -18, -22, -26, -30, + 4, 12, 20, 28, 36, 44, 52, 60, -4, -12, -20, -28, -36, -44, -52, -60 +}; + +static const uint8 creativeADPCM_AdjustMap[64] = { + 0, 0, 0, 0, 0, 16, 16, 16, + 0, 0, 0, 0, 0, 16, 16, 16, + 240, 0, 0, 0, 0, 16, 16, 16, + 240, 0, 0, 0, 0, 16, 16, 16, + 240, 0, 0, 0, 0, 16, 16, 16, + 240, 0, 0, 0, 0, 16, 16, 16, + 240, 0, 0, 0, 0, 0, 0, 0, + 240, 0, 0, 0, 0, 0, 0, 0 +}; + +/*----------------------------------------------------------------*/ + Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) { _digitized = false; _music = false; @@ -70,24 +90,6 @@ void Sound::loadSound(const Common::String &name, int priority) { warning("loadSound"); } -static int8 creativeADPCM_ScaleMap[64] = { - 0, 1, 2, 3, 4, 5, 6, 7, 0, -1, -2, -3, -4, -5, -6, -7, - 1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15, - 2, 6, 10, 14, 18, 22, 26, 30, -2, -6, -10, -14, -18, -22, -26, -30, - 4, 12, 20, 28, 36, 44, 52, 60, -4, -12, -20, -28, -36, -44, -52, -60 -}; - -static uint8 creativeADPCM_AdjustMap[64] = { - 0, 0, 0, 0, 0, 16, 16, 16, - 0, 0, 0, 0, 0, 16, 16, 16, - 240, 0, 0, 0, 0, 16, 16, 16, - 240, 0, 0, 0, 0, 16, 16, 16, - 240, 0, 0, 0, 0, 16, 16, 16, - 240, 0, 0, 0, 0, 16, 16, 16, - 240, 0, 0, 0, 0, 0, 0, 0, - 240, 0, 0, 0, 0, 0, 0, 0 -}; - byte Sound::decodeSample(byte sample, byte &reference, int16 &scale) { int16 samp = sample + scale; int16 ref = 0; diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index ec7e63e835f..79ed052c1e4 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -1665,7 +1665,7 @@ int Talk::waitForMore(int delay) { if (events.kbHit()) { Common::KeyState keyState = events.getKey(); - if (keyState.keycode >= 32 && keyState.keycode < 128) + if (keyState.keycode >= ' ' && keyState.keycode < '~') key2 = keyState.keycode; }