aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorChristopher Page2008-06-20 19:42:29 +0000
committerChristopher Page2008-06-20 19:42:29 +0000
commit65abece4c67c4fb574caac717fff24bfb5f31d69 (patch)
treed5667167747cfbf45b7ffd38d05e6c81182ff1bc /engines
parent6dce28e166865dd8c892e0e298ed6abcdc1042bd (diff)
parent0c6c7de3554a65a22324a0aa89b111aa7f2fa79f (diff)
downloadscummvm-rg350-65abece4c67c4fb574caac717fff24bfb5f31d69.tar.gz
scummvm-rg350-65abece4c67c4fb574caac717fff24bfb5f31d69.tar.bz2
scummvm-rg350-65abece4c67c4fb574caac717fff24bfb5f31d69.zip
Merged revisions 32727-32728,32730-32733,32737-32738 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk svn-id: r32740
Diffstat (limited to 'engines')
-rw-r--r--engines/cine/unpack.cpp2
-rw-r--r--engines/drascula/animation.cpp2
-rw-r--r--engines/drascula/drascula.h4
-rw-r--r--engines/drascula/graphics.cpp31
-rw-r--r--engines/drascula/palette.cpp8
-rw-r--r--engines/gob/scenery.cpp4
-rw-r--r--engines/gob/videoplayer.cpp14
-rw-r--r--engines/m4/converse.cpp2
-rw-r--r--engines/m4/graphics.cpp6
-rw-r--r--engines/m4/graphics.h2
-rw-r--r--engines/m4/m4_views.cpp2
-rw-r--r--engines/m4/mads_anim.cpp16
-rw-r--r--engines/m4/viewmgr.cpp2
-rw-r--r--engines/made/database.cpp13
-rw-r--r--engines/made/detection.cpp4
-rw-r--r--engines/made/made.cpp26
-rw-r--r--engines/made/made.h1
-rw-r--r--engines/made/scriptfuncs.cpp10
18 files changed, 70 insertions, 79 deletions
diff --git a/engines/cine/unpack.cpp b/engines/cine/unpack.cpp
index dcd3181242..5d85ff6cab 100644
--- a/engines/cine/unpack.cpp
+++ b/engines/cine/unpack.cpp
@@ -111,7 +111,7 @@ bool CineUnpacker::unpack(const byte *src, uint srcLen, byte *dst, uint dstLen)
while (_dst >= _dstBegin && !_error) {
/*
Bits => Action:
- 0 0 => unpackRawBytes(3 bits + 1) i.e. unpackRawBytes(1..9)
+ 0 0 => unpackRawBytes(3 bits + 1) i.e. unpackRawBytes(1..8)
1 1 1 => unpackRawBytes(8 bits + 9) i.e. unpackRawBytes(9..264)
0 1 => copyRelocatedBytes(8 bits, 2) i.e. copyRelocatedBytes(0..255, 2)
1 0 0 => copyRelocatedBytes(9 bits, 3) i.e. copyRelocatedBytes(0..511, 3)
diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp
index feb6cb93ca..b0877a2e3e 100644
--- a/engines/drascula/animation.cpp
+++ b/engines/drascula/animation.cpp
@@ -1669,7 +1669,7 @@ void DrasculaEngine::animation_12_5() {
const int frusky_x[] = {100, 139, 178, 217, 100, 178, 217, 139, 100, 139};
const int elfrusky_x[] = {1, 68, 135, 1, 68, 135, 1, 68, 135, 68, 1, 135, 68, 135, 68};
int color, component;
- char fade;
+ signed char fade;
playMusic(26);
updateRoom();
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index ce67cc2c0e..567d894b75 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -245,7 +245,7 @@ public:
void loadPic(const char *NamePcc, byte *targetSurface, int colorCount = 1);
- typedef char DacPalette256[256][3];
+ typedef signed char DacPalette256[256][3];
void setRGB(byte *pal, int plt);
void assignDefaultPalette();
@@ -397,7 +397,7 @@ public:
void playFLI(const char *filefli, int vel);
void fadeFromBlack(int fadeSpeed);
void fadeToBlack(int fadeSpeed);
- char adjustToVGA(char value);
+ signed char adjustToVGA(signed char value);
void color_abc(int cl);
void centerText(const char *,int,int);
void playSound(int soundNum);
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp
index 64591a856e..67993bfb6c 100644
--- a/engines/drascula/graphics.cpp
+++ b/engines/drascula/graphics.cpp
@@ -89,31 +89,21 @@ void DrasculaEngine::setCursorTable() {
}
void DrasculaEngine::loadPic(const char *NamePcc, byte *targetSurface, int colorCount) {
- unsigned int con, x = 0;
- unsigned int fExit = 0;
- byte ch, rep;
+ uint dataSize = 0;
+ byte *pcxData;
_arj.open(NamePcc);
if (!_arj.isOpen())
error("missing game data %s %c", NamePcc, 7);
- _arj.seek(128);
- while (!fExit) {
- ch = _arj.readByte();
- rep = 1;
- if ((ch & 192) == 192) {
- rep = (ch & 63);
- ch = _arj.readByte();
- }
- for (con = 0; con < rep; con++) {
- x++;
- if (x > 64000) {
- fExit = 1;
- break;
- }
- *targetSurface++ = ch;
- }
- }
+ dataSize = _arj.size() - 128 - (256 * 3);
+ pcxData = (byte *)malloc(dataSize);
+
+ _arj.seek(128, SEEK_SET);
+ _arj.read(pcxData, dataSize);
+
+ decodeRLE(pcxData, targetSurface);
+ free(pcxData);
for (int i = 0; i < 256; i++) {
cPal[i * 3 + 0] = _arj.readByte();
@@ -141,7 +131,6 @@ void DrasculaEngine::showFrame(bool firstFrame) {
memcpy(prevFrame, VGA, 64000);
decodeRLE(pcxData, VGA);
-
free(pcxData);
if (!firstFrame)
diff --git a/engines/drascula/palette.cpp b/engines/drascula/palette.cpp
index ad57bce618..6a93f21e55 100644
--- a/engines/drascula/palette.cpp
+++ b/engines/drascula/palette.cpp
@@ -87,12 +87,12 @@ void DrasculaEngine::color_abc(int cl) {
setPalette((byte *)&gamePalette);
}
-char DrasculaEngine::adjustToVGA(char value) {
+signed char DrasculaEngine::adjustToVGA(signed char value) {
return (value & 0x3F) * (value > 0);
}
void DrasculaEngine::fadeToBlack(int fadeSpeed) {
- char fade;
+ signed char fade;
unsigned int color, component;
DacPalette256 palFade;
@@ -110,7 +110,7 @@ void DrasculaEngine::fadeToBlack(int fadeSpeed) {
}
void DrasculaEngine::fadeFromBlack(int fadeSpeed) {
- char fade;
+ signed char fade;
unsigned int color, component;
DacPalette256 palFade;
@@ -186,7 +186,7 @@ void DrasculaEngine::setDarkPalette() {
}
void DrasculaEngine::setPaletteBase(int darkness) {
- char fade;
+ signed char fade;
unsigned int color, component;
for (fade = darkness; fade >= 0; fade--) {
diff --git a/engines/gob/scenery.cpp b/engines/gob/scenery.cpp
index 6b52cdbbd6..33e540ace4 100644
--- a/engines/gob/scenery.cpp
+++ b/engines/gob/scenery.cpp
@@ -595,7 +595,7 @@ void Scenery::updateAnim(int16 layer, int16 frame, int16 animation, int16 flags,
int16 destX;
int16 destY;
- if (animation < 0) {
+ if ((_vm->getGameType() == kGameTypeWoodruff) && (animation < 0)) {
// Object video
if (flags & 1) { // Do capture
@@ -736,6 +736,8 @@ void Scenery::updateAnim(int16 layer, int16 frame, int16 animation, int16 flags,
return;
}
+ if ((animation < 0) || (animation >= 10))
+ return;
if ((_animPictCount[animation] == 0) || (layer < 0))
return;
if (layer >= _animations[animation].layersCount)
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index 909d39a63b..aa47e6cf84 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -588,12 +588,14 @@ bool VideoPlayer::doPlay(int16 frame, int16 breakKey,
}
void VideoPlayer::copyPalette(CoktelVideo &video, int16 palStart, int16 palEnd) {
- if ((palStart != -1) && (palEnd != -1))
- memcpy(((char *) (_vm->_global->_pPaletteDesc->vgaPal)) + palStart * 3,
- video.getPalette() + palStart * 3,
- (palEnd - palStart + 1) * 3);
- else
- memcpy((char *) _vm->_global->_pPaletteDesc->vgaPal, video.getPalette(), 768);
+ if (palStart < 0)
+ palStart = 0;
+ if (palEnd < 0)
+ palEnd = 255;
+
+ memcpy(((char *) (_vm->_global->_pPaletteDesc->vgaPal)) + palStart * 3,
+ video.getPalette() + palStart * 3,
+ (palEnd - palStart + 1) * 3);
}
void VideoPlayer::writeVideoInfo(const char *videoFile, int16 varX, int16 varY,
diff --git a/engines/m4/converse.cpp b/engines/m4/converse.cpp
index 729af6c40f..a07a175066 100644
--- a/engines/m4/converse.cpp
+++ b/engines/m4/converse.cpp
@@ -153,7 +153,7 @@ void ConversationView::setNode(int32 nodeIndex) {
void ConversationView::onRefresh(RectList *rects, M4Surface *destSurface) {
//if (!this->isVisible())
// return;
- empty();
+ clear();
if (_entriesShown) {
// Write out the conversation options
diff --git a/engines/m4/graphics.cpp b/engines/m4/graphics.cpp
index beda178344..1846f1c1e7 100644
--- a/engines/m4/graphics.cpp
+++ b/engines/m4/graphics.cpp
@@ -320,7 +320,7 @@ byte *M4Surface::getBasePtr(int x, int y) {
void M4Surface::freeData() {
}
-void M4Surface::empty() {
+void M4Surface::clear() {
Common::set_to((byte *) pixels, (byte *) pixels + w * h, _vm->_palette->BLACK);
}
@@ -389,7 +389,7 @@ void M4Surface::loadBackgroundRiddle(const char *sceneName) {
}
void M4Surface::loadBackground(int sceneNumber, RGBList **palData) {
- this->empty(); // clear previous scene
+ clear(); // clear previous scene
if (_vm->isM4() || (_vm->getGameType() == GType_RexNebular)) {
char resourceName[20];
@@ -502,7 +502,7 @@ void M4Surface::madsLoadBackground(int roomNumber, RGBList **palData) {
//printf("Tile: %i, compressed size: %i\n", i, compressedTileDataSize);
- newTile->empty();
+ newTile->clear();
byte *compressedTileData = new byte[compressedTileDataSize];
diff --git a/engines/m4/graphics.h b/engines/m4/graphics.h
index 60e608c148..84fc77656f 100644
--- a/engines/m4/graphics.h
+++ b/engines/m4/graphics.h
@@ -128,7 +128,7 @@ public:
byte *getData();
byte *getBasePtr(int x, int y);
void freeData();
- void empty();
+ void clear();
void frameRect(const Common::Rect &r, uint8 color);
void fillRect(const Common::Rect &r, uint8 color);
void copyFrom(M4Surface *src, const Common::Rect &srcBounds, int destX, int destY,
diff --git a/engines/m4/m4_views.cpp b/engines/m4/m4_views.cpp
index 9bf964ee96..777356467b 100644
--- a/engines/m4/m4_views.cpp
+++ b/engines/m4/m4_views.cpp
@@ -331,7 +331,7 @@ bool GameInterfaceView::onEvent(M4EventType eventType, int param, int x, int y,
}
void GameInterfaceView::onRefresh(RectList *rects, M4Surface *destSurface) {
- empty();
+ clear();
_statusText.onRefresh();
_inventory.onRefresh();
diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp
index 3e80d0f1e0..c51daa84c4 100644
--- a/engines/m4/mads_anim.cpp
+++ b/engines/m4/mads_anim.cpp
@@ -61,9 +61,9 @@ TextviewView::TextviewView(M4Engine *vm):
_vm->_font->setColors(5, 6, 4);
- empty();
- _bgSurface.empty();
- _textSurface.empty();
+ clear();
+ _bgSurface.clear();
+ _textSurface.clear();
int y = (height() - MADS_SURFACE_HEIGHT) / 2;
setColor(2);
@@ -83,8 +83,8 @@ TextviewView::~TextviewView() {
}
void TextviewView::reset() {
- _bgSurface.empty();
- _textSurface.empty();
+ _bgSurface.clear();
+ _textSurface.clear();
_animating = false;
_panX = 0;
_panY = 0;
@@ -456,8 +456,8 @@ AnimviewView::AnimviewView(M4Engine *vm):
// Set up system palette colors
_vm->_palette->setMadsSystemPalette();
- empty();
- _bgSurface.empty();
+ clear();
+ _bgSurface.clear();
int y = (height() - MADS_SURFACE_HEIGHT) / 2;
setColor(2);
@@ -471,7 +471,7 @@ AnimviewView::~AnimviewView() {
}
void AnimviewView::reset() {
- _bgSurface.empty();
+ _bgSurface.clear();
_soundDriverLoaded = false;
}
diff --git a/engines/m4/viewmgr.cpp b/engines/m4/viewmgr.cpp
index 3a8b5d24a8..b74e598c6c 100644
--- a/engines/m4/viewmgr.cpp
+++ b/engines/m4/viewmgr.cpp
@@ -380,7 +380,7 @@ void ViewManager::updateState() {
}
void ViewManager::refreshAll() {
- _vm->_screen->empty();
+ _vm->_screen->clear();
for (ListIterator i = _views.begin(); i != _views.end(); ++i) {
View *v = *i;
diff --git a/engines/made/database.cpp b/engines/made/database.cpp
index 55e0e90732..3497b5b46f 100644
--- a/engines/made/database.cpp
+++ b/engines/made/database.cpp
@@ -88,10 +88,7 @@ int16 Object::getVectorItem(int16 index) {
if (getClass() == 0x7FFF) {
byte *vector = (byte*)getData();
return vector[index];
- } else if (getClass() == 0x7FFE) {
- int16 *vector = (int16*)getData();
- return READ_LE_UINT16(&vector[index]);
- } else if (getClass() < 0x7FFE) {
+ } else if (getClass() <= 0x7FFE) {
int16 *vector = (int16*)getData();
return READ_LE_UINT16(&vector[index]);
} else {
@@ -372,7 +369,7 @@ void GameDatabaseV2::load(Common::SeekableReadStream &sourceS) {
debug(2, "textOffs = %08X; textSize = %08X; objectCount = %d; varObjectCount = %d; gameStateSize = %d; objectsOffs = %08X; objectsSize = %d\n", textOffs, textSize, objectCount, varObjectCount, _gameStateSize, objectsOffs, objectsSize);
_gameState = new byte[_gameStateSize + 2];
- memset(_gameState, 0, _gameStateSize);
+ memset(_gameState, 0, _gameStateSize + 2);
setVar(1, objectCount);
sourceS.seek(textOffs);
@@ -441,7 +438,7 @@ int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, i
int16 *propPtr2 = prop + count2;
// First see if the property exists in the given object
- while (count2-- > 0) {
+ while (count2--) {
if ((READ_LE_UINT16(prop) & 0x7FFF) == propertyId) {
propertyFlag = obj->getFlags() & 1;
return propPtr1;
@@ -467,8 +464,8 @@ int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, i
propPtr1 = propPtr2 + count1 - count2;
int16 *propertyPtr = prop + count1;
- while (count2-- > 0) {
- if (!(READ_LE_UINT16(prop) & 0x8000)) {
+ while (count2--) {
+ if ((READ_LE_UINT16(prop) & 0x8000) == 0) {
if ((READ_LE_UINT16(prop) & 0x7FFF) == propertyId) {
propertyFlag = obj->getFlags() & 1;
return propPtr1;
diff --git a/engines/made/detection.cpp b/engines/made/detection.cpp
index dc7dbdee87..e5870bfeec 100644
--- a/engines/made/detection.cpp
+++ b/engines/made/detection.cpp
@@ -65,7 +65,7 @@ static const PlainGameDescriptor madeGames[] = {
{"manhole", "The Manhole"},
{"rtz", "Return to Zork"},
{"lgop2", "Leather Goddesses of Phobos 2"},
- {"rodney", "Rodney's Fun Screen"},
+ {"rodney", "Rodney's Funscreen"},
{0, 0}
};
@@ -278,7 +278,7 @@ static const MadeGameDescription gameDescriptions[] = {
},
{
- // Rodney's Fun Screen
+ // Rodney's Funscreen
{
"rodney",
"",
diff --git a/engines/made/made.cpp b/engines/made/made.cpp
index 59ec487c37..dc45dc4d2f 100644
--- a/engines/made/made.cpp
+++ b/engines/made/made.cpp
@@ -148,27 +148,31 @@ int MadeEngine::init() {
return 0;
}
+int16 MadeEngine::getTicks() {
+ return g_system->getMillis() * 30 / 1000;
+}
+
int16 MadeEngine::getTimer(int16 timerNum) {
if (timerNum > 0 && timerNum <= ARRAYSIZE(_timers) && _timers[timerNum - 1] != -1)
- return (_system->getMillis() - _timers[timerNum - 1]) / kTimerResolution;
+ return (getTicks() - _timers[timerNum - 1]);
else
return 32000;
}
void MadeEngine::setTimer(int16 timerNum, int16 value) {
if (timerNum > 0 && timerNum <= ARRAYSIZE(_timers))
- _timers[timerNum - 1] = value * kTimerResolution;
+ _timers[timerNum - 1] = value;
}
void MadeEngine::resetTimer(int16 timerNum) {
if (timerNum > 0 && timerNum <= ARRAYSIZE(_timers))
- _timers[timerNum - 1] = _system->getMillis();
+ _timers[timerNum - 1] = getTicks();
}
int16 MadeEngine::allocTimer() {
for (int i = 0; i < ARRAYSIZE(_timers); i++) {
if (_timers[i] == -1) {
- _timers[i] = _system->getMillis();
+ _timers[i] = getTicks();
return i + 1;
}
}
@@ -202,24 +206,20 @@ void MadeEngine::handleEvents() {
break;
case Common::EVENT_LBUTTONDOWN:
- _eventNum = 1;
+ _eventNum = 2;
break;
- /*
case Common::EVENT_LBUTTONUP:
- _eventNum = 2; // TODO: Is this correct?
+ _eventNum = 1;
break;
- */
case Common::EVENT_RBUTTONDOWN:
- _eventNum = 3;
+ _eventNum = 4;
break;
- /*
case Common::EVENT_RBUTTONUP:
- eventNum = 4; // TODO: Is this correct?
+ _eventNum = 3;
break;
- */
case Common::EVENT_KEYDOWN:
_eventKey = event.kbd.ascii;
@@ -239,7 +239,7 @@ void MadeEngine::handleEvents() {
}
}
-
+
AudioCD.updateCD();
}
diff --git a/engines/made/made.h b/engines/made/made.h
index 461941e5cf..971961c867 100644
--- a/engines/made/made.h
+++ b/engines/made/made.h
@@ -120,6 +120,7 @@ public:
int _engineVersion;
int32 _timers[50];
+ int16 getTicks();
int16 getTimer(int16 timerNum);
void setTimer(int16 timerNum, int16 value);
void resetTimer(int16 timerNum);
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index 932447a1eb..d697e24b04 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -106,7 +106,7 @@ void ScriptFunctions::setupExternalsTable() {
External(sfStopSound);
External(sfPlayVoice);
- if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RTZ) {
+ if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RTZ || _vm->getGameID() == GID_RODNEY) {
External(sfPlayCd);
External(sfStopCd);
External(sfGetCdStatus);
@@ -332,7 +332,7 @@ int16 ScriptFunctions::sfAddSprite(int16 argc, int16 *argv) {
if (_vm->getGameID() == GID_RTZ) {
// Unused in RTZ
return 0;
- } if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE) {
+ } if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RODNEY) {
return _vm->_screen->addToSpriteList(argv[2], argv[1], argv[0]);
} else {
return 0;
@@ -341,7 +341,7 @@ int16 ScriptFunctions::sfAddSprite(int16 argc, int16 *argv) {
int16 ScriptFunctions::sfFreeAnim(int16 argc, int16 *argv) {
_vm->_screen->clearChannels();
- if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE) {
+ if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RODNEY) {
_vm->_screen->clearSpriteList();
}
return 0;
@@ -350,7 +350,7 @@ int16 ScriptFunctions::sfFreeAnim(int16 argc, int16 *argv) {
int16 ScriptFunctions::sfDrawSprite(int16 argc, int16 *argv) {
if (_vm->getGameID() == GID_RTZ) {
return _vm->_screen->drawSprite(argv[2], argv[1], argv[0]);
- } if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE) {
+ } if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RODNEY) {
SpriteListItem item = _vm->_screen->getFromSpriteList(argv[2]);
int16 channelIndex = _vm->_screen->drawSprite(item.index, argv[1] - item.xofs, argv[0] - item.yofs);
_vm->_screen->setChannelUseMask(channelIndex);
@@ -409,7 +409,7 @@ int16 ScriptFunctions::sfDrawText(int16 argc, int16 *argv) {
if (_vm->getGameID() == GID_RTZ) {
text = _vm->_dat->getObjectString(argv[argc - 1]);
- } if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE) {
+ } if (_vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_RODNEY) {
text = _vm->_dat->getString(argv[argc - 1]);
}