aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBenjamin Haisch2008-06-18 11:01:51 +0000
committerBenjamin Haisch2008-06-18 11:01:51 +0000
commit7bceafb3f2cff0f80b5b489d21e8bff90ddb5fbe (patch)
tree5bd254aeca2d3963bc6461aa530e10f43c6021b4 /engines
parent9b910eedba4b7f01e9b0aa7c90831904409ba98a (diff)
downloadscummvm-rg350-7bceafb3f2cff0f80b5b489d21e8bff90ddb5fbe.tar.gz
scummvm-rg350-7bceafb3f2cff0f80b5b489d21e8bff90ddb5fbe.tar.bz2
scummvm-rg350-7bceafb3f2cff0f80b5b489d21e8bff90ddb5fbe.zip
- Fixed sprite drawing in Rodney's Funscreen
- Handle mouse button up events and event number fixes in MadeEngine::handleEvents() - Use milliseconds -> game ticks calculation based on Windows version of the original engine - "Rodney's Fun Screen" -> "Rodney's Funscreen" svn-id: r32731
Diffstat (limited to 'engines')
-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
5 files changed, 26 insertions, 28 deletions
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]);
}