- Added support for Rodney's Fun Screen

- Added audio cd playback (still kinda broken though)
- Renamed getObjectPropertyPtr to findObjectProperty

svn-id: r32669
This commit is contained in:
Benjamin Haisch 2008-06-12 11:09:04 +00:00
parent 555ddf9f95
commit fb31c62ad8
7 changed files with 57 additions and 26 deletions

View file

@ -301,7 +301,7 @@ int16 GameDatabase::getObjectProperty(int16 objectIndex, int16 propertyId) {
return 0;
int16 propertyFlag;
int16 *property = getObjectPropertyPtr(objectIndex, propertyId, propertyFlag);
int16 *property = findObjectProperty(objectIndex, propertyId, propertyFlag);
if (property) {
return (int16)READ_LE_UINT16(property);
@ -317,7 +317,7 @@ int16 GameDatabase::setObjectProperty(int16 objectIndex, int16 propertyId, int16
return 0;
int16 propertyFlag;
int16 *property = getObjectPropertyPtr(objectIndex, propertyId, propertyFlag);
int16 *property = findObjectProperty(objectIndex, propertyId, propertyFlag);
if (property) {
if (propertyFlag == 1) {
@ -430,7 +430,7 @@ int16 GameDatabaseV2::loadgame(const char *filename, int16 version) {
return result;
}
int16 *GameDatabaseV2::getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
Object *obj = getObject(objectIndex);
int16 *prop = (int16*)obj->getData();
@ -489,6 +489,7 @@ int16 *GameDatabaseV2::getObjectPropertyPtr(int16 objectIndex, int16 propertyId,
}
debug(1, "findObjectProperty(%04X, %04) Property not found", objectIndex, propertyId);
return NULL;
}
@ -597,7 +598,7 @@ int16 GameDatabaseV3::loadgame(const char *filename, int16 version) {
return result;
}
int16 *GameDatabaseV3::getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
Object *obj = getObject(objectIndex);
int16 *prop = (int16*)obj->getData();

View file

@ -133,7 +133,7 @@ public:
const char *getObjectString(int16 index);
void setObjectString(int16 index, const char *str);
virtual int16 *getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag) = 0;
virtual int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag) = 0;
virtual const char *getString(uint16 offset) = 0;
virtual bool getSavegameDescription(const char *filename, Common::String &description) = 0;
virtual int16 savegame(const char *filename, const char *description, int16 version) = 0;
@ -157,7 +157,7 @@ class GameDatabaseV2 : public GameDatabase {
public:
GameDatabaseV2(MadeEngine *vm);
~GameDatabaseV2();
int16 *getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag);
int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag);
const char *getString(uint16 offset);
bool getSavegameDescription(const char *filename, Common::String &description);
int16 savegame(const char *filename, const char *description, int16 version);
@ -170,7 +170,7 @@ protected:
class GameDatabaseV3 : public GameDatabase {
public:
GameDatabaseV3(MadeEngine *vm);
int16 *getObjectPropertyPtr(int16 objectIndex, int16 propertyId, int16 &propertyFlag);
int16 *findObjectProperty(int16 objectIndex, int16 propertyId, int16 &propertyFlag);
const char *getString(uint16 offset);
bool getSavegameDescription(const char *filename, Common::String &description);
int16 savegame(const char *filename, const char *description, int16 version);

View file

@ -65,6 +65,7 @@ static const PlainGameDescriptor madeGames[] = {
{"manhole", "The Manhole"},
{"rtz", "Return to Zork"},
{"lgop2", "Leather Goddesses of Phobos 2"},
{"rodney", "Rodney's Fun Screen"},
{0, 0}
};
@ -276,6 +277,22 @@ static const MadeGameDescription gameDescriptions[] = {
0,
},
{
// Rodney's Fun Screen
{
"rodney",
"",
AD_ENTRY1("rodneys.dat", "a79887dbaa47689facd7c6f09258ba5a"),
Common::EN_ANY,
Common::kPlatformPC,
Common::ADGF_NO_FLAGS
},
GID_RODNEY,
0,
GF_FLOPPY,
0,
},
{ AD_TABLE_END_MARKER, 0, 0, 0, 0 }
};

View file

@ -35,6 +35,7 @@
#include "base/plugins.h"
#include "base/version.h"
#include "sound/audiocd.h"
#include "sound/mixer.h"
#include "made/made.h"
@ -87,7 +88,7 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng
_res = new ProjectReader();
_screen = new Screen(this);
if (getGameID() == GID_LGOP2 || getGameID() == GID_MANHOLE) {
if (getGameID() == GID_LGOP2 || getGameID() == GID_MANHOLE || getGameID() == GID_RODNEY) {
_dat = new GameDatabaseV2(this);
} else if (getGameID() == GID_RTZ) {
_dat = new GameDatabaseV3(this);
@ -119,7 +120,7 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng
// Set default sound frequency
// Return to Zork sets it itself via a script funtion
if (getGameID() == GID_MANHOLE) {
if (getGameID() == GID_MANHOLE || getGameID() == GID_RODNEY) {
_soundRate = 11025;
} else {
_soundRate = 8000;
@ -239,6 +240,8 @@ void MadeEngine::handleEvents() {
}
}
AudioCD.updateCD();
}
int MadeEngine::go() {
@ -271,6 +274,10 @@ int MadeEngine::go() {
_engineVersion = 2;
_dat->open("lgop2.dat");
_res->open("lgop2.prj");
} else if (getGameID() == GID_RODNEY) {
_engineVersion = 2;
_dat->open("rodneys.dat");
_res->open("rodneys.prj");
} else {
error ("Unknown MADE game");
}

View file

@ -50,7 +50,8 @@ namespace Made {
enum MadeGameID {
GID_RTZ = 0,
GID_MANHOLE = 1,
GID_LGOP2 = 2
GID_LGOP2 = 2,
GID_RODNEY = 3
};
enum MadeGameFeatures {

View file

@ -95,6 +95,7 @@ public:
void setRGBPalette(byte *palRGB, int start = 0, int count = 256);
bool isPaletteLocked() { return _paletteLock; }
void setPaletteLock(bool lock) { _paletteLock = lock; }
bool isScreenLocked() { return _screenLock; }
void setScreenLock(bool lock) { _screenLock = lock; }
void setVisualEffectNum(int visualEffectNum) { _visualEffectNum = visualEffectNum; }

View file

@ -26,8 +26,8 @@
#include "common/endian.h"
#include "common/util.h"
#include "common/events.h"
#include "graphics/cursorman.h"
#include "sound/audiocd.h"
#include "made/made.h"
#include "made/resource.h"
@ -94,7 +94,7 @@ void ScriptFunctions::setupExternalsTable() {
External(sfSetSpriteGround);
External(sfLoadResText);
if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_LGOP2) {
if (_vm->getGameID() == GID_MANHOLE || _vm->getGameID() == GID_LGOP2 || _vm->getGameID() == GID_RODNEY) {
External(sfAddScreenMask);
External(sfSetSpriteMask);
} else if (_vm->getGameID() == GID_RTZ) {
@ -183,6 +183,8 @@ int16 ScriptFunctions::sfDrawPicture(int16 argc, int16 *argv) {
}
int16 ScriptFunctions::sfClearScreen(int16 argc, int16 *argv) {
if (_vm->_screen->isScreenLocked())
return 0;
if (_vm->_autoStopSound) {
_vm->_mixer->stopHandle(_audioStreamHandle);
_vm->_autoStopSound = false;
@ -548,25 +550,27 @@ int16 ScriptFunctions::sfPlayVoice(int16 argc, int16 *argv) {
}
int16 ScriptFunctions::sfPlayCd(int16 argc, int16 *argv) {
// This one is called loads of times, so it has been commented out to reduce spam
//warning("Unimplemented opcode: sfPlayCd");
AudioCD.play(argv[0], -1, 0, 0);
return 0;
}
int16 ScriptFunctions::sfStopCd(int16 argc, int16 *argv) {
warning("Unimplemented opcode: sfStopCd");
if (AudioCD.isPlaying()) {
AudioCD.stop();
return 1;
} else {
return 0;
}
}
int16 ScriptFunctions::sfGetCdStatus(int16 argc, int16 *argv) {
// This one is called loads of times, so it has been commented out to reduce spam
//warning("Unimplemented opcode: sfGetCdStatus");
return 0;
return AudioCD.isPlaying() ? 1 : 0;
}
int16 ScriptFunctions::sfGetCdTime(int16 argc, int16 *argv) {
// This one is called loads of times, so it has been commented out to reduce spam
//warning("Unimplemented opcode: sfGetCdTime");
// TODO
return 0;
}