PRIVATE: better detection tables + fixes

This commit is contained in:
neuromancer 2021-01-20 09:21:03 -03:00 committed by Eugene Sandulenko
parent f602fa6d56
commit fd0facc23d
4 changed files with 98 additions and 23 deletions

View file

@ -10,34 +10,56 @@ static const PlainGameDescriptor privateGames[] = {
static const ADGameDescription gameDescriptions[] = {
{
"private-eye", // Full game
"private-eye", // US release
0,
AD_ENTRY1s("ASSETS.Z", "3a7532349cda8126e96dd5e49884af3a", 40232),
Common::EN_ANY,
Common::EN_USA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
GUIO1(GUIO_NOMIDI)
},
{
"private-eye", // EU release
0,
AD_ENTRY1s("ASSETS.Z", "73874f969026d6fd21a4e9834ce4a1a7", 17695),
Common::EN_GRB,
Common::kPlatformWindows,
ADGF_UNSUPPORTED,
GUIO1(GUIO_NOMIDI)
},
{
"private-eye", // Demo from archive.org
"Demo",
AD_ENTRY1s("ASSETS.Z", "854e141bb67535359620a1833fcc1566", 5955),
Common::EN_ANY,
Common::EN_USA,
Common::kPlatformWindows,
ADGF_DEMO,
GUIO1(GUIO_NOMIDI)
},
{
"private-eye", // Demo from the full game CDROM
"private-eye", // Demo from the US release
"Demo",
AD_ENTRY1s("ASSETS.Z", "045766e39f44d6ee3bf92f0d4521587c", 5961),
Common::EN_ANY,
Common::EN_USA,
Common::kPlatformWindows,
ADGF_DEMO,
GUIO1(GUIO_NOMIDI)
},
{
"private-eye", // Demo from the EU release
"Demo",
AD_ENTRY1s("ASSETS.Z", "15e10e8fbb1e9aac4d32c5d8215e7c86", 2299),
Common::EN_GRB,
Common::kPlatformWindows,
ADGF_DEMO | ADGF_UNSUPPORTED,
GUIO1(GUIO_NOMIDI)
},
AD_TABLE_END_MARKER
};
} // End of namespace Private

View file

@ -70,7 +70,8 @@ void LoadGame(ArgArray args) {
m->surf = g_private->loadMask(*s, 0, 0, true);
m->cursor = args[2].u.sym->name;
m->nextSetting = NULL;
m->flag = NULL;
m->flag1 = NULL;
m->flag2 = NULL;
g_private->_loadGameMask = m;
g_private->_masks.push_front(*m);
}
@ -83,7 +84,8 @@ void SaveGame(ArgArray args) {
m->surf = g_private->loadMask(*s, 0, 0, true);
m->cursor = args[1].u.sym->name;
m->nextSetting = NULL;
m->flag = NULL;
m->flag1 = NULL;
m->flag2 = NULL;
g_private->_saveGameMask = m;
g_private->_masks.push_front(*m);
}
@ -117,6 +119,8 @@ void Inventory(ArgArray args) {
Datum v2 = args[2];
Datum e = args[3];
Datum c = args[5];
Datum snd = args[8];
assert(v1.type == STRING || v1.type == NAME);
@ -142,18 +146,31 @@ void Inventory(ArgArray args) {
m->cursor = new Common::String("kInventory");
m->point = new Common::Point(0,0);
if (v2.type == NAME)
m->flag = v2.u.sym;
if (v1.type == NAME)
m->flag1 = v1.u.sym;
else
m->flag = NULL;
m->flag1 = NULL;
if (v2.type == NAME)
m->flag2 = v2.u.sym;
else
m->flag2 = NULL;
g_private->_masks.push_front(*m);
g_private->_toTake = true;
}
} else {
if (v1.type == NAME)
if (strcmp(c.u.str, "\"REMOVE\"") == 0)
v1.u.sym->u.val = 0;
else
v1.u.sym->u.val = 1;
if (v2.type == NAME)
v2.u.sym->u.val = 1;
}
if (strcmp(snd.u.str, "\"\"") != 0) {
Common::String *s = new Common::String(snd.u.str);
g_private->playSound(*s, 1);
@ -247,6 +264,17 @@ void Transition(ArgArray args) {
g_private->_nextSetting = new Common::String(args[1].u.str);
}
void Resume(ArgArray args) {
// assert types
debug("Resume(%d)", args[0].u.val); // this value is always 1
g_private->_nextSetting = g_private->_pausedSetting;
g_private->_pausedSetting = NULL;
g_private->_mode = 1;
g_private->_origin->x = 64; // use a constant
g_private->_origin->y = 48;
}
void Movie(ArgArray args) {
// assert types
debug("Movie(%s, %s)", args[0].u.str, args[1].u.str);
@ -331,7 +359,8 @@ void _Mask(ArgArray args, bool drawn) {
m->surf = g_private->loadMask(*s, x, y, drawn);
m->nextSetting = new Common::String(e);
m->cursor = c;
m->flag = NULL;
m->flag1 = NULL;
m->flag2 = NULL;
m->point = new Common::Point(x,y);
g_private->_masks.push_front(*m);
@ -407,7 +436,8 @@ void SoundArea(ArgArray args) {
m->surf = g_private->loadMask(*s, 0, 0, true);
m->cursor = args[2].u.sym->name;
m->nextSetting = NULL;
m->flag = NULL;
m->flag1 = NULL;
m->flag2 = NULL;
g_private->_AMRadioArea = m;
g_private->_masks.push_front(*m);
} else if (strcmp(n, "kPoliceRadio") == 0) {
@ -416,7 +446,8 @@ void SoundArea(ArgArray args) {
m->surf = g_private->loadMask(*s, 0, 0, true);
m->cursor = args[2].u.sym->name;
m->nextSetting = NULL;
m->flag = NULL;
m->flag1 = NULL;
m->flag2 = NULL;
g_private->_policeRadioArea = m;
g_private->_masks.push_front(*m);
} else if (strcmp(n, "kPhone") == 0) {
@ -425,7 +456,8 @@ void SoundArea(ArgArray args) {
m->surf = g_private->loadMask(*s, 0, 0, true);
m->cursor = args[2].u.sym->name;
m->nextSetting = NULL;
m->flag = NULL;
m->flag1 = NULL;
m->flag2 = NULL;
g_private->_phoneArea = m;
g_private->_masks.push_front(*m);
}
@ -457,6 +489,7 @@ static struct FuncTable {
} funcTable[] = {
{ ChgMode, "ChgMode"},
{ Resume, "Resume"},
{ Goto, "goto"},
{ SetFlag, "SetFlag"},
{ Timer, "Timer"},

View file

@ -56,6 +56,7 @@ PrivateEngine::PrivateEngine(OSystem *syst)
_loadGameMask = NULL;
_nextSetting = NULL;
_currentSetting = NULL;
_nextMovie = NULL;
_nextVS = NULL;
_modified = false;
@ -63,6 +64,7 @@ PrivateEngine::PrivateEngine(OSystem *syst)
_toTake = false;
_frame = new Common::String("inface/general/inface2.bmp");
_repeatedMovieExit = new Common::String("");
_pausedSetting = NULL;
_paperShuffleSound = new Common::String("global/audio/glsfx0");
_takeSound = new Common::String("global/audio/took");
@ -166,6 +168,12 @@ Common::Error PrivateEngine::run() {
case Common::EVENT_KEYDOWN:
if (event.kbd.keycode == Common::KEYCODE_ESCAPE && _videoDecoder)
skipVideo();
else if (event.kbd.keycode == Common::KEYCODE_m) {
if ( _pausedSetting == NULL) {
_pausedSetting = _currentSetting;
_nextSetting = new Common::String("kPauseMovie");
}
}
break;
case Common::EVENT_QUIT:
@ -233,7 +241,7 @@ Common::Error PrivateEngine::run() {
_policeRadioArea = NULL;
_AMRadioArea = NULL;
_phoneArea = NULL;
_currentSetting = _nextSetting;
loadSetting(_nextSetting);
_nextSetting = NULL;
execute(prog);
@ -365,8 +373,9 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
ns = m.nextSetting;
}
if (m.flag != NULL) { // TODO: check this
setSymbol(m.flag, 1);
if (m.flag1 != NULL) { // TODO: check this
setSymbol(m.flag1, 1);
debug("!!!!!!!!!!!!!! setting %s to 1 !!!!!!!!!!!!!!!!!!1", m.flag1->name->c_str());
// an item was taken
if (_toTake) {
playSound(*getTakeSound(), 1);
@ -374,6 +383,10 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
}
}
if (m.flag2 != NULL) {
setSymbol(m.flag2, 1);
}
break;
}
@ -687,7 +700,8 @@ void PrivateEngine::drawScreenFrame(Graphics::Surface *screen) {
Common::File file;
assert(file.open(path));
_image->loadStream(file);
screen->copyRectToSurface(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), 0, 0, Common::Rect(0, 0, _screenW, _screenH));
Graphics::Surface *frame = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
screen->copyRectToSurface(*frame, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
}
@ -722,7 +736,10 @@ void PrivateEngine::drawScreen() {
frame->create(_screenW, _screenH, _pixelFormat);
frame->copyFrom(*_videoDecoder->decodeNextFrame());
const Common::Point o(_origin->x, _origin->y);
surface->transBlitFrom(*frame->convertTo(_pixelFormat, _videoDecoder->getPalette()), o);
Graphics::Surface *cframe = frame->convertTo(_pixelFormat, _videoDecoder->getPalette());
surface->transBlitFrom(*cframe, o);
delete frame;
delete cframe;
}
assert(w == _screenW && h == _screenH);

View file

@ -47,7 +47,8 @@ typedef struct MaskInfo {
Graphics::ManagedSurface *surf;
Common::String *nextSetting;
Common::Point *point;
Symbol *flag;
Symbol *flag1;
Symbol *flag2;
Common::String *cursor;
} MaskInfo;
@ -150,6 +151,8 @@ public:
PlayedMediaTable _playedMovies;
PlayedMediaTable _playedPhoneClips;
Common::String *_repeatedMovieExit;
Common::String *_pausedSetting;
ExitList _exits;
MaskList _masks;