aboutsummaryrefslogtreecommitdiff
path: root/engines/cine
diff options
context:
space:
mode:
authorMarisa-Chan2014-06-13 21:43:04 +0700
committerMarisa-Chan2014-06-13 21:43:04 +0700
commit45589950c0fb1a449351e6a00ef10d42290d8bae (patch)
tree44e4eedcb7e69d5fc386155b000ed038af07251d /engines/cine
parent48360645dcd5f8fddb135b6e31ae5cae4be8d77f (diff)
parent5c005ad3a3f1df0bc968c85c1cf0fc48e36ab0b2 (diff)
downloadscummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.tar.gz
scummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.tar.bz2
scummvm-rg350-45589950c0fb1a449351e6a00ef10d42290d8bae.zip
Merge remote-tracking branch 'upstream/master' into zvision
Conflicts: engines/zvision/animation/rlf_animation.cpp engines/zvision/animation_control.h engines/zvision/core/console.cpp engines/zvision/core/events.cpp engines/zvision/cursors/cursor.cpp engines/zvision/cursors/cursor_manager.cpp engines/zvision/cursors/cursor_manager.h engines/zvision/fonts/truetype_font.cpp engines/zvision/graphics/render_manager.cpp engines/zvision/graphics/render_manager.h engines/zvision/inventory/inventory_manager.h engines/zvision/inventory_manager.h engines/zvision/meta_animation.h engines/zvision/module.mk engines/zvision/scripting/actions.cpp engines/zvision/scripting/control.h engines/zvision/scripting/controls/animation_control.cpp engines/zvision/scripting/controls/animation_control.h engines/zvision/scripting/controls/input_control.cpp engines/zvision/scripting/controls/lever_control.cpp engines/zvision/scripting/controls/timer_node.cpp engines/zvision/scripting/controls/timer_node.h engines/zvision/scripting/puzzle.h engines/zvision/scripting/scr_file_handling.cpp engines/zvision/scripting/script_manager.cpp engines/zvision/scripting/script_manager.h engines/zvision/sidefx.cpp engines/zvision/sound/zork_raw.cpp engines/zvision/sound/zork_raw.h engines/zvision/video/video.cpp engines/zvision/video/zork_avi_decoder.h engines/zvision/zvision.cpp engines/zvision/zvision.h
Diffstat (limited to 'engines/cine')
-rw-r--r--engines/cine/anim.cpp6
-rw-r--r--engines/cine/anim.h4
-rw-r--r--engines/cine/bg.cpp8
-rw-r--r--engines/cine/bg.h4
-rw-r--r--engines/cine/bg_list.cpp4
-rw-r--r--engines/cine/bg_list.h4
-rw-r--r--engines/cine/cine.cpp12
-rw-r--r--engines/cine/cine.h4
-rw-r--r--engines/cine/configure.engine3
-rw-r--r--engines/cine/console.cpp6
-rw-r--r--engines/cine/console.h4
-rw-r--r--engines/cine/detection.cpp4
-rw-r--r--engines/cine/detection_tables.h4
-rw-r--r--engines/cine/gfx.cpp41
-rw-r--r--engines/cine/gfx.h4
-rw-r--r--engines/cine/main_loop.cpp6
-rw-r--r--engines/cine/main_loop.h4
-rw-r--r--engines/cine/msg.cpp4
-rw-r--r--engines/cine/msg.h4
-rw-r--r--engines/cine/object.cpp4
-rw-r--r--engines/cine/object.h4
-rw-r--r--engines/cine/pal.cpp14
-rw-r--r--engines/cine/pal.h4
-rw-r--r--engines/cine/part.cpp6
-rw-r--r--engines/cine/part.h4
-rw-r--r--engines/cine/prc.cpp4
-rw-r--r--engines/cine/prc.h4
-rw-r--r--engines/cine/rel.cpp4
-rw-r--r--engines/cine/rel.h4
-rw-r--r--engines/cine/saveload.cpp4
-rw-r--r--engines/cine/saveload.h4
-rw-r--r--engines/cine/script.h4
-rw-r--r--engines/cine/script_fw.cpp12
-rw-r--r--engines/cine/script_os.cpp4
-rw-r--r--engines/cine/sound.cpp10
-rw-r--r--engines/cine/sound.h4
-rw-r--r--engines/cine/texte.cpp4
-rw-r--r--engines/cine/texte.h4
-rw-r--r--engines/cine/unpack.cpp4
-rw-r--r--engines/cine/unpack.h4
-rw-r--r--engines/cine/various.cpp118
-rw-r--r--engines/cine/various.h6
42 files changed, 206 insertions, 158 deletions
diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp
index 075a59cfb6..c6099447d8 100644
--- a/engines/cine/anim.cpp
+++ b/engines/cine/anim.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -287,7 +287,7 @@ void AnimData::load(byte *d, int type, uint16 w, uint16 h, int16 file,
_fileIdx = file;
_frameIdx = frame;
memset(_name, 0, sizeof(_name));
- strcpy(_name, n);
+ Common::strlcpy(_name, n, sizeof(_name));
_realWidth = w;
switch (type) {
diff --git a/engines/cine/anim.h b/engines/cine/anim.h
index c5130aab82..7b4daafa88 100644
--- a/engines/cine/anim.h
+++ b/engines/cine/anim.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/bg.cpp b/engines/cine/bg.cpp
index 2bad2183f5..ce808e0f6a 100644
--- a/engines/cine/bg.cpp
+++ b/engines/cine/bg.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -48,7 +48,7 @@ byte loadCtFW(const char *ctName) {
}
if (currentCtName != ctName)
- strcpy(currentCtName, ctName);
+ Common::strlcpy(currentCtName, ctName, sizeof(currentCtName));
ptr = dataPtr = readBundleFile(foundFileIdx);
@@ -75,7 +75,7 @@ byte loadCtOS(const char *ctName) {
}
if (currentCtName != ctName)
- strcpy(currentCtName, ctName);
+ Common::strlcpy(currentCtName, ctName, sizeof(currentCtName));
ptr = dataPtr = readBundleFile(foundFileIdx);
diff --git a/engines/cine/bg.h b/engines/cine/bg.h
index c464cd68be..ac884463cb 100644
--- a/engines/cine/bg.h
+++ b/engines/cine/bg.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/bg_list.cpp b/engines/cine/bg_list.cpp
index 36ecf53dea..d2f05a3fbd 100644
--- a/engines/cine/bg_list.cpp
+++ b/engines/cine/bg_list.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/bg_list.h b/engines/cine/bg_list.h
index c564b4b43f..3cfc33e274 100644
--- a/engines/cine/bg_list.h
+++ b/engines/cine/bg_list.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 63092a8ffd..a4af8f2201 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -55,6 +55,14 @@ CineEngine::CineEngine(OSystem *syst, const CINEGameDescription *gameDesc)
_console = new CineConsole(this);
g_cine = this;
+
+ for (int i = 0; i < NUM_FONT_CHARS; i++) {
+ _textHandler.fontParamTable[i].characterIdx = 0;
+ _textHandler.fontParamTable[i].characterWidth = 0;
+ }
+ _restartRequested = false;
+ _preLoad = false;
+ _timerDelayMultiplier = 12;
}
CineEngine::~CineEngine() {
diff --git a/engines/cine/cine.h b/engines/cine/cine.h
index 47edf51c30..e620d2ffa5 100644
--- a/engines/cine/cine.h
+++ b/engines/cine/cine.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/configure.engine b/engines/cine/configure.engine
new file mode 100644
index 0000000000..2b7e2085fa
--- /dev/null
+++ b/engines/cine/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine cine "Cinematique evo 1" yes
diff --git a/engines/cine/console.cpp b/engines/cine/console.cpp
index 46f0ea61d3..4646bdf280 100644
--- a/engines/cine/console.cpp
+++ b/engines/cine/console.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -29,7 +29,7 @@ bool labyrinthCheat;
CineConsole::CineConsole(CineEngine *vm) : GUI::Debugger(), _vm(vm) {
assert(_vm);
- DCmd_Register("labyrinthCheat", WRAP_METHOD(CineConsole, Cmd_LabyrinthCheat));
+ registerCmd("labyrinthCheat", WRAP_METHOD(CineConsole, Cmd_LabyrinthCheat));
labyrinthCheat = false;
}
diff --git a/engines/cine/console.h b/engines/cine/console.h
index 7c19621e5f..9b901982b9 100644
--- a/engines/cine/console.h
+++ b/engines/cine/console.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index a3d36cfd97..4202bdc942 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/detection_tables.h b/engines/cine/detection_tables.h
index 224ebe5de2..6069e3a99b 100644
--- a/engines/cine/detection_tables.h
+++ b/engines/cine/detection_tables.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index 636c0cf8d9..b9175cac72 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -246,17 +246,16 @@ void FWRenderer::incrustSprite(const BGIncrust &incrust) {
* Draw command box on screen
*/
void FWRenderer::drawCommand() {
- unsigned int i;
- int x = 10, y = _cmdY;
-
if (disableSystemMenu == 0) {
+ int x = 10, y = _cmdY;
+
drawPlainBox(x, y, 301, 11, 0);
drawBorder(x - 1, y - 1, 302, 12, 2);
x += 2;
y += 2;
- for (i = 0; i < _cmd.size(); i++) {
+ for (unsigned int i = 0; i < _cmd.size(); i++) {
x = drawChar(_cmd[i], x, y);
}
}
@@ -458,12 +457,12 @@ void FWRenderer::drawDoubleBorder(int x, int y, int width, int height, byte colo
* @param y Character coordinate
*/
int FWRenderer::drawChar(char character, int x, int y) {
- int width, idx;
+ int width;
if (character == ' ') {
x += 5;
} else if ((width = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterWidth)) {
- idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
+ int idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
drawSpriteRaw(g_cine->_textHandler.textTable[idx][FONT_DATA], g_cine->_textHandler.textTable[idx][FONT_MASK], FONT_WIDTH, FONT_HEIGHT, _backBuffer, x, y);
x += width + 1;
}
@@ -481,12 +480,12 @@ int FWRenderer::drawChar(char character, int x, int y) {
* @param y Character coordinate
*/
int FWRenderer::undrawChar(char character, int x, int y) {
- int width, idx;
+ int width;
if (character == ' ') {
x += 5;
} else if ((width = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterWidth)) {
- idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
+ int idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
const byte *sprite = g_cine->_textHandler.textTable[idx][FONT_DATA];
for (uint i = 0; i < FONT_HEIGHT; ++i) {
byte *dst = _backBuffer + (y + i) * 320 + x;
@@ -731,7 +730,7 @@ void FWRenderer::loadBg16(const byte *bg, const char *name, unsigned int idx) {
assert(_background);
- strcpy(_bgName, name);
+ Common::strlcpy(_bgName, name, sizeof(_bgName));
// Load the 16 color palette
_backupPal.load(bg, kLowPalNumBytes, kLowPalFormat, kLowPalNumColors, CINE_BIG_ENDIAN);
@@ -997,11 +996,10 @@ void SelectionMenu::drawMenu(FWRenderer &r, bool top) {
}
int lineY = y + 4;
- int charX;
const int elemCount = getElementCount();
for (int i = 0; i < elemCount; ++i, lineY += 9) {
- charX = x + 4;
+ int charX = x + 4;
if (i == _selection) {
int color;
@@ -1228,12 +1226,12 @@ void OSRenderer::incrustSprite(const BGIncrust &incrust) {
* @param y Character coordinate
*/
int OSRenderer::drawChar(char character, int x, int y) {
- int width, idx;
+ int width;
if (character == ' ') {
x += 5;
} else if ((width = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterWidth)) {
- idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
+ int idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
drawSpriteRaw2(g_cine->_textHandler.textTable[idx][FONT_DATA], 0, FONT_WIDTH, FONT_HEIGHT, _backBuffer, x, y);
x += width + 1;
}
@@ -1405,7 +1403,7 @@ void OSRenderer::loadBg16(const byte *bg, const char *name, unsigned int idx) {
assert(_bgTable[idx].bg);
- strcpy(_bgTable[idx].name, name);
+ Common::strlcpy(_bgTable[idx].name, name, sizeof(_bgTable[idx].name));
// Load the 16 color palette
_bgTable[idx].pal.load(bg, kLowPalNumBytes, kLowPalFormat, kLowPalNumColors, CINE_BIG_ENDIAN);
@@ -1443,7 +1441,7 @@ void OSRenderer::loadBg256(const byte *bg, const char *name, unsigned int idx) {
assert(_bgTable[idx].bg);
- strcpy(_bgTable[idx].name, name);
+ Common::strlcpy(_bgTable[idx].name, name, sizeof(_bgTable[idx].name));
_bgTable[idx].pal.load(bg, kHighPalNumBytes, kHighPalFormat, kHighPalNumColors, CINE_LITTLE_ENDIAN);
memcpy(_bgTable[idx].bg, bg + kHighPalNumBytes, _screenSize);
}
@@ -1834,7 +1832,7 @@ void OSRenderer::drawSprite(overlay *overlayPtr, const byte *spritePtr, int16 wi
}
}
}
- it++;
+ ++it;
}
// now, draw with the mask we created
@@ -1887,7 +1885,6 @@ void maskBgOverlay(const byte *bgPtr, const byte *maskPtr, int16 width, int16 he
byte *page, int16 x, int16 y) {
int16 i, j, tmpWidth, tmpHeight;
Common::List<BGIncrust>::iterator it;
- byte *mask;
const byte *backup = maskPtr;
// background pass
@@ -1905,7 +1902,9 @@ void maskBgOverlay(const byte *bgPtr, const byte *maskPtr, int16 width, int16 he
destPtr++;
srcPtr++;
- maskPtr++;
+
+ if (maskPtr)
+ maskPtr++;
}
}
@@ -1915,7 +1914,7 @@ void maskBgOverlay(const byte *bgPtr, const byte *maskPtr, int16 width, int16 he
for (it = g_cine->_bgIncrustList.begin(); it != g_cine->_bgIncrustList.end(); ++it) {
tmpWidth = g_cine->_animDataTable[it->frame]._realWidth;
tmpHeight = g_cine->_animDataTable[it->frame]._height;
- mask = (byte *)malloc(tmpWidth * tmpHeight);
+ byte *mask = (byte *)malloc(tmpWidth * tmpHeight);
if (it->param == 0) {
generateMask(g_cine->_animDataTable[it->frame].data(), mask, tmpWidth * tmpHeight, it->part);
diff --git a/engines/cine/gfx.h b/engines/cine/gfx.h
index 8b8843fd72..bfb7dbde1d 100644
--- a/engines/cine/gfx.h
+++ b/engines/cine/gfx.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index c822f1cabd..9ce683445f 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -254,7 +254,7 @@ void purgeSeqList() {
it = g_cine->_seqList.erase(it);
} else {
// Let the element be and jump to the next element
- it++;
+ ++it;
}
}
}
diff --git a/engines/cine/main_loop.h b/engines/cine/main_loop.h
index 4ab29149d8..98e8f8878a 100644
--- a/engines/cine/main_loop.h
+++ b/engines/cine/main_loop.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/msg.cpp b/engines/cine/msg.cpp
index b84982b19e..5366da4a05 100644
--- a/engines/cine/msg.cpp
+++ b/engines/cine/msg.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/msg.h b/engines/cine/msg.h
index 8d6291e2df..dce70c4295 100644
--- a/engines/cine/msg.h
+++ b/engines/cine/msg.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/object.cpp b/engines/cine/object.cpp
index a75828abb1..f014843f9d 100644
--- a/engines/cine/object.cpp
+++ b/engines/cine/object.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/object.h b/engines/cine/object.h
index 8331cf9f89..9c44162d28 100644
--- a/engines/cine/object.h
+++ b/engines/cine/object.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp
index 10077ecdc9..18f260cab7 100644
--- a/engines/cine/pal.cpp
+++ b/engines/cine/pal.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -62,9 +62,9 @@ int16 findPaletteFromName(const char *fileName) {
uint16 position = 0;
uint16 i;
- strcpy(buffer, fileName);
+ Common::strlcpy(buffer, fileName, sizeof(buffer));
- while (position < strlen(fileName)) {
+ while (position < strlen(buffer)) {
if (buffer[position] > 'a' && buffer[position] < 'z') {
buffer[position] += 'A' - 'a';
}
@@ -332,9 +332,9 @@ byte *Palette::save(byte *buf, const uint size, const Graphics::PixelFormat form
// Save the palette to the output in the specified format
for (uint i = firstIndex; i < firstIndex + numColors; i++) {
- const uint r = (_colors[i].r * rNewMax) / rOrigMax;
- const uint g = (_colors[i].g * gNewMax) / gOrigMax;
- const uint b = (_colors[i].b * bNewMax) / bOrigMax;
+ const uint r = (_colors[i].r * rNewMax) / (rOrigMax == 0 ? 1 : rOrigMax);
+ const uint g = (_colors[i].g * gNewMax) / (gOrigMax == 0 ? 1 : gOrigMax);
+ const uint b = (_colors[i].b * bNewMax) / (bOrigMax == 0 ? 1 : bOrigMax);
buf[i * format.bytesPerPixel + rBytePos] |= r << (format.rShift % 8);
buf[i * format.bytesPerPixel + gBytePos] |= g << (format.gShift % 8);
diff --git a/engines/cine/pal.h b/engines/cine/pal.h
index d41154aa0b..6dc56d8c19 100644
--- a/engines/cine/pal.h
+++ b/engines/cine/pal.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp
index 7c0ba3af0a..30d9461a6a 100644
--- a/engines/cine/part.cpp
+++ b/engines/cine/part.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -47,7 +47,7 @@ void loadPart(const char *partName) {
g_cine->_partFileHandle.readUint16BE(); // entry size
if (currentPartName != partName)
- strcpy(currentPartName, partName);
+ Common::strlcpy(currentPartName, partName, sizeof(currentPartName));
for (uint16 i = 0; i < g_cine->_partBuffer.size(); i++) {
g_cine->_partFileHandle.read(g_cine->_partBuffer[i].partName, 14);
diff --git a/engines/cine/part.h b/engines/cine/part.h
index 3d321f17e1..9886a4ab43 100644
--- a/engines/cine/part.h
+++ b/engines/cine/part.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/prc.cpp b/engines/cine/prc.cpp
index ba9ba70110..6c78274a09 100644
--- a/engines/cine/prc.cpp
+++ b/engines/cine/prc.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/prc.h b/engines/cine/prc.h
index ff0147d81e..262b129e1c 100644
--- a/engines/cine/prc.h
+++ b/engines/cine/prc.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/rel.cpp b/engines/cine/rel.cpp
index 0af9a2bc1f..09b8499618 100644
--- a/engines/cine/rel.cpp
+++ b/engines/cine/rel.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/rel.h b/engines/cine/rel.h
index d102791f6b..f32f6301c4 100644
--- a/engines/cine/rel.h
+++ b/engines/cine/rel.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/saveload.cpp b/engines/cine/saveload.cpp
index 51d2c1f6be..c707c60695 100644
--- a/engines/cine/saveload.cpp
+++ b/engines/cine/saveload.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/saveload.h b/engines/cine/saveload.h
index fd661904af..91c9452d60 100644
--- a/engines/cine/saveload.h
+++ b/engines/cine/saveload.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/script.h b/engines/cine/script.h
index a07c8d6cfc..ec8278065f 100644
--- a/engines/cine/script.h
+++ b/engines/cine/script.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp
index 2abe32f797..c0b0c1f5da 100644
--- a/engines/cine/script_fw.cpp
+++ b/engines/cine/script_fw.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -1419,19 +1419,19 @@ int FWScript::o1_loadNewPrcName() {
switch (param1) {
case 0:
debugC(5, kCineDebugScript, "Line: %d: loadPrc(\"%s\")", _line, param2);
- strcpy(newPrcName, param2);
+ Common::strlcpy(newPrcName, param2, sizeof(newPrcName));
break;
case 1:
debugC(5, kCineDebugScript, "Line: %d: loadRel(\"%s\")", _line, param2);
- strcpy(newRelName, param2);
+ Common::strlcpy(newRelName, param2, sizeof(newRelName));
break;
case 2:
debugC(5, kCineDebugScript, "Line: %d: loadObject(\"%s\")", _line, param2);
- strcpy(newObjectName, param2);
+ Common::strlcpy(newObjectName, param2, sizeof(newObjectName));
break;
case 3:
debugC(5, kCineDebugScript, "Line: %d: loadMsg(\"%s\")", _line, param2);
- strcpy(newMsgName, param2);
+ Common::strlcpy(newMsgName, param2, sizeof(newMsgName));
break;
}
return 0;
diff --git a/engines/cine/script_os.cpp b/engines/cine/script_os.cpp
index 84bb484369..07ed295eab 100644
--- a/engines/cine/script_os.cpp
+++ b/engines/cine/script_os.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index 0df926675e..069a4787ac 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -309,9 +309,7 @@ void AdLibSoundDriver::setupChannel(int channel, const byte *data, int instrumen
volume = 0;
}
volume += volume / 4;
- if (volume > 127) {
- volume = 127;
- }
+
_channelsVolumeTable[channel] = volume;
setupInstrument(data, channel);
}
@@ -815,7 +813,7 @@ bool PCSoundFxPlayer::load(const char *song) {
if (dot) {
*dot = '\0';
}
- strcat(instrument, _driver->getInstrumentExtension());
+ Common::strlcat(instrument, _driver->getInstrumentExtension(), sizeof(instrument));
uint32 instrumentSize;
_instrumentsData[i] = readBundleSoundFile(instrument, &instrumentSize);
if (!_instrumentsData[i]) {
diff --git a/engines/cine/sound.h b/engines/cine/sound.h
index fdb183ad34..efb3811f9a 100644
--- a/engines/cine/sound.h
+++ b/engines/cine/sound.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/texte.cpp b/engines/cine/texte.cpp
index 998075c6ce..8d904cb1f2 100644
--- a/engines/cine/texte.cpp
+++ b/engines/cine/texte.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/texte.h b/engines/cine/texte.h
index 185dc53bfd..1e0944c312 100644
--- a/engines/cine/texte.h
+++ b/engines/cine/texte.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/unpack.cpp b/engines/cine/unpack.cpp
index f68fbbc02c..6741b07118 100644
--- a/engines/cine/unpack.cpp
+++ b/engines/cine/unpack.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/unpack.h b/engines/cine/unpack.h
index d22c4944a7..0fa58874df 100644
--- a/engines/cine/unpack.h
+++ b/engines/cine/unpack.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index 99d93cfc09..8687699a44 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -557,12 +557,20 @@ int16 selectSubObject(int16 x, int16 y, int16 param) {
}
}
+ if (selectedObject >= 20)
+ error("Invalid value for selectedObject: %d", selectedObject);
return objListTab[selectedObject];
}
-// TODO: Make separate functions for Future Wars's and Operation Stealth's version of this function, this is getting too messy
-// TODO: Add support for using the different prepositions for different verbs (Doesn't work currently)
void makeCommandLine() {
+ if (g_cine->getGameType() == Cine::GType_FW)
+ makeFWCommandLine();
+ else
+ makeOSCommandLine();
+}
+
+// TODO: Add support for using the different prepositions for different verbs (Doesn't work currently)
+void makeOSCommandLine() {
uint16 x, y;
commandVar1 = 0;
@@ -578,28 +586,16 @@ void makeCommandLine() {
int16 si;
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
-
- if (g_cine->getGameType() == Cine::GType_FW) {
- si = selectSubObject(x, y + 8, -2);
- } else {
- si = selectSubObject(x, y + 8, -subObjectUseTable[playerCommand]);
- }
+ si = selectSubObject(x, y + 8, -subObjectUseTable[playerCommand]);
if (si < 0) {
- if (g_cine->getGameType() == Cine::GType_OS) {
- canUseOnObject = 0;
- } else { // Future Wars
- playerCommand = -1;
- g_cine->_commandBuffer = "";
- }
+ canUseOnObject = 0;
} else {
- if (g_cine->getGameType() == Cine::GType_OS) {
- if (si >= 8000) {
- si -= 8000;
- canUseOnObject = canUseOnItemTable[playerCommand];
- } else {
- canUseOnObject = 0;
- }
+ if (si >= 8000) {
+ si -= 8000;
+ canUseOnObject = canUseOnItemTable[playerCommand];
+ } else {
+ canUseOnObject = 0;
}
commandVar3[0] = si;
@@ -607,27 +603,21 @@ void makeCommandLine() {
g_cine->_commandBuffer += " ";
g_cine->_commandBuffer += g_cine->_objectTable[commandVar3[0]].name;
g_cine->_commandBuffer += " ";
- if (g_cine->getGameType() == Cine::GType_OS) {
- g_cine->_commandBuffer += commandPrepositionTable[playerCommand];
- } else { // Future Wars
- g_cine->_commandBuffer += defaultCommandPreposition;
- }
+ g_cine->_commandBuffer += commandPrepositionTable[playerCommand];
}
}
- if (g_cine->getGameType() == Cine::GType_OS || !(playerCommand != -1 && choiceResultTable[playerCommand] == 2)) {
- if (playerCommand == 2) {
- getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
- CursorMan.showMouse(false);
- processInventory(x, y + 8);
- playerCommand = -1;
- commandVar1 = 0;
- g_cine->_commandBuffer = "";
- CursorMan.showMouse(true);
- }
+ if (playerCommand == 2) {
+ getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
+ CursorMan.showMouse(false);
+ processInventory(x, y + 8);
+ playerCommand = -1;
+ commandVar1 = 0;
+ g_cine->_commandBuffer = "";
+ CursorMan.showMouse(true);
}
- if (g_cine->getGameType() == Cine::GType_OS && playerCommand != 2) {
+ if (playerCommand != 2) {
if (playerCommand != -1 && canUseOnObject != 0) { // call use on sub object
int16 si;
@@ -665,7 +655,55 @@ void makeCommandLine() {
}
}
- if (g_cine->getGameType() == Cine::GType_OS || !disableSystemMenu) {
+ isDrawCommandEnabled = 1;
+ renderer->setCommand(g_cine->_commandBuffer);
+}
+
+// TODO: Add support for using the different prepositions for different verbs (Doesn't work currently)
+void makeFWCommandLine() {
+ uint16 x, y;
+
+ commandVar1 = 0;
+ commandVar2 = -10;
+
+ if (playerCommand != -1) {
+ g_cine->_commandBuffer = defaultActionCommand[playerCommand];
+ } else {
+ g_cine->_commandBuffer = "";
+ }
+
+ if ((playerCommand != -1) && (choiceResultTable[playerCommand] == 2)) { // need object selection?
+ int16 si;
+
+ getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
+ si = selectSubObject(x, y + 8, -2);
+
+ if (si < 0) {
+ playerCommand = -1;
+ g_cine->_commandBuffer = "";
+ } else {
+ commandVar3[0] = si;
+ commandVar1 = 1;
+ g_cine->_commandBuffer += " ";
+ g_cine->_commandBuffer += g_cine->_objectTable[commandVar3[0]].name;
+ g_cine->_commandBuffer += " ";
+ g_cine->_commandBuffer += defaultCommandPreposition;
+ }
+ }
+
+ if (!(playerCommand != -1 && choiceResultTable[playerCommand] == 2)) {
+ if (playerCommand == 2) {
+ getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
+ CursorMan.showMouse(false);
+ processInventory(x, y + 8);
+ playerCommand = -1;
+ commandVar1 = 0;
+ g_cine->_commandBuffer = "";
+ CursorMan.showMouse(true);
+ }
+ }
+
+ if (!disableSystemMenu) {
isDrawCommandEnabled = 1;
renderer->setCommand(g_cine->_commandBuffer);
}
diff --git a/engines/cine/various.h b/engines/cine/various.h
index 813619816d..eb6312997d 100644
--- a/engines/cine/various.h
+++ b/engines/cine/various.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -37,6 +37,8 @@ void initLanguage(Common::Language lang);
int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X, uint16 Y, uint16 width, bool recheckValue = false);
void makeCommandLine();
+void makeFWCommandLine();
+void makeOSCommandLine();
void makeActionMenu();
void waitPlayerInput();
void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4);