PRIVATE: more code
This commit is contained in:
parent
942addd3a1
commit
89f95256e7
5 changed files with 188 additions and 109 deletions
|
@ -162,6 +162,7 @@ int eval() {
|
||||||
} else if (d.u.sym->type == STRING) {
|
} else if (d.u.sym->type == STRING) {
|
||||||
d.type = STRING;
|
d.type = STRING;
|
||||||
d.u.str = d.u.sym->u.str;
|
d.u.str = d.u.sym->u.str;
|
||||||
|
debug("eval returned %s", d.u.str );
|
||||||
} else if (d.u.sym->type == RECT) {
|
} else if (d.u.sym->type == RECT) {
|
||||||
d.type = RECT;
|
d.type = RECT;
|
||||||
d.u.rect = d.u.sym->u.rect;
|
d.u.rect = d.u.sym->u.rect;
|
||||||
|
|
|
@ -15,15 +15,13 @@ void ChgMode(ArgArray args) {
|
||||||
Common::String *s = new Common::String(args[1].u.str);
|
Common::String *s = new Common::String(args[1].u.str);
|
||||||
g_private->_nextSetting = s;
|
g_private->_nextSetting = s;
|
||||||
|
|
||||||
if (g_private->_mode == 0) {
|
if (g_private->_mode == 0) {
|
||||||
g_private->_origin->x = 0;
|
g_private->_origin->x = 0; // use a constant
|
||||||
g_private->_origin->y = 0;
|
g_private->_origin->y = 0;
|
||||||
// TODO: should clear the screen?
|
|
||||||
}
|
}
|
||||||
else if (g_private->_mode == 1) {
|
else if (g_private->_mode == 1) {
|
||||||
g_private->_origin->x = 64;
|
g_private->_origin->x = 64; // use a constant
|
||||||
g_private->_origin->y = 48;
|
g_private->_origin->y = 48;
|
||||||
//g_private->drawScreenFrame();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
assert(0);
|
assert(0);
|
||||||
|
@ -44,11 +42,19 @@ void Goto(ArgArray args) { // should be goto, but this is a reserved word
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SyncSound(ArgArray args) { // should be goto, but this is a reserved word
|
void SyncSound(ArgArray args) {
|
||||||
// assert types
|
// assert types
|
||||||
debug("SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
|
debug("SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
|
||||||
Common::String *s = new Common::String(args[1].u.str);
|
Common::String *s = new Common::String(args[1].u.str);
|
||||||
g_private->_nextSetting = s;
|
g_private->_nextSetting = s;
|
||||||
|
|
||||||
|
if (strcmp("\"\"", args[0].u.str) != 0) {
|
||||||
|
Common::String *s = new Common::String(args[0].u.str);
|
||||||
|
g_private->playSound(*s, 1);
|
||||||
|
//assert(0);
|
||||||
|
} else {
|
||||||
|
g_private->stopSound();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Quit(ArgArray args) {
|
void Quit(ArgArray args) {
|
||||||
|
@ -63,7 +69,10 @@ void LoadGame(ArgArray args) {
|
||||||
MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
|
MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
|
||||||
m->surf = g_private->loadMask(*s, 0, 0, true);
|
m->surf = g_private->loadMask(*s, 0, 0, true);
|
||||||
m->cursor = args[2].u.sym->name;
|
m->cursor = args[2].u.sym->name;
|
||||||
|
m->nextSetting = NULL;
|
||||||
|
m->flag = NULL;
|
||||||
g_private->_loadGameMask = m;
|
g_private->_loadGameMask = m;
|
||||||
|
g_private->_masks.push_front(*m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGame(ArgArray args) {
|
void SaveGame(ArgArray args) {
|
||||||
|
@ -73,12 +82,16 @@ void SaveGame(ArgArray args) {
|
||||||
MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
|
MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
|
||||||
m->surf = g_private->loadMask(*s, 0, 0, true);
|
m->surf = g_private->loadMask(*s, 0, 0, true);
|
||||||
m->cursor = args[1].u.sym->name;
|
m->cursor = args[1].u.sym->name;
|
||||||
|
m->nextSetting = NULL;
|
||||||
|
m->flag = NULL;
|
||||||
g_private->_saveGameMask = m;
|
g_private->_saveGameMask = m;
|
||||||
|
g_private->_masks.push_front(*m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RestartGame(ArgArray args) {
|
void RestartGame(ArgArray args) {
|
||||||
// assert types
|
// assert types
|
||||||
debug("WARNING: RestartGame is not implemented");
|
g_private->restartGame();
|
||||||
|
//debug("WARNING: RestartGame is not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PoliceBust(ArgArray args) {
|
void PoliceBust(ArgArray args) {
|
||||||
|
@ -307,14 +320,20 @@ void MaskDrawn(ArgArray args) {
|
||||||
_Mask(args, true);
|
_Mask(args, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddSound(char *s, char *t) {
|
void AddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
|
||||||
Common::String str(t);
|
Common::String *sound = new Common::String(s);
|
||||||
if (strcmp(t, "AMRadioClip") == 0)
|
if (strcmp(t, "AMRadioClip") == 0)
|
||||||
g_private->_radio.push_front(str);
|
g_private->_AMRadio.push_front(*sound);
|
||||||
else if (strcmp(t, "PoliceClip") == 0)
|
else if (strcmp(t, "PoliceClip") == 0)
|
||||||
g_private->_police.push_front(str);
|
g_private->_policeRadio.push_front(*sound);
|
||||||
else if (strcmp(t, "PhoneClip") == 0)
|
else if (strcmp(t, "PhoneClip") == 0) {
|
||||||
g_private->_phone.push_front(str);
|
PhoneInfo *p = (PhoneInfo*) malloc(sizeof(PhoneInfo));
|
||||||
|
p->sound = sound;
|
||||||
|
p->flag = flag;
|
||||||
|
p->val = val;
|
||||||
|
g_private->_phone.push_front(*p);
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
debug("error: invalid sound type %s", t);
|
debug("error: invalid sound type %s", t);
|
||||||
}
|
}
|
||||||
|
@ -326,12 +345,45 @@ void PoliceClip(ArgArray args) {
|
||||||
AddSound(args[0].u.str, "PoliceClip");
|
AddSound(args[0].u.str, "PoliceClip");
|
||||||
}
|
}
|
||||||
void PhoneClip(ArgArray args) {
|
void PhoneClip(ArgArray args) {
|
||||||
AddSound(args[0].u.str, "PhoneClip");
|
if (args.size() == 2) {
|
||||||
|
debug("Unimplemented PhoneClip special case");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AddSound(args[0].u.str, "PhoneClip", args[5].u.sym, args[6].u.val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundArea(ArgArray args) {
|
void SoundArea(ArgArray args) {
|
||||||
// assert types
|
// assert types
|
||||||
debug("WARNING: SoundArea not implemented!");
|
char *n;
|
||||||
|
|
||||||
|
if (args[1].type == NAME)
|
||||||
|
n = (char *) args[1].u.sym->name->c_str();
|
||||||
|
else if (args[1].type == STRING)
|
||||||
|
n = args[1].u.str;
|
||||||
|
else
|
||||||
|
assert(0);
|
||||||
|
|
||||||
|
debug("SoundArea(%s, %s)", args[0].u.str, n);
|
||||||
|
if (strcmp(n, "kAMRadio") == 0) {
|
||||||
|
Common::String *s = new Common::String(args[0].u.str);
|
||||||
|
MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
|
||||||
|
m->surf = g_private->loadMask(*s, 0, 0, true);
|
||||||
|
m->cursor = args[2].u.sym->name;
|
||||||
|
m->nextSetting = NULL;
|
||||||
|
m->flag = NULL;
|
||||||
|
g_private->_AMRadioArea = m;
|
||||||
|
g_private->_masks.push_front(*m);
|
||||||
|
} else if (strcmp(n, "kPoliceRadio") == 0) {
|
||||||
|
Common::String *s = new Common::String(args[0].u.str);
|
||||||
|
MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
|
||||||
|
m->surf = g_private->loadMask(*s, 0, 0, true);
|
||||||
|
debug("size %d %d", m->surf->h, m->surf->w);
|
||||||
|
m->cursor = args[2].u.sym->name;
|
||||||
|
m->nextSetting = NULL;
|
||||||
|
m->flag = NULL;
|
||||||
|
g_private->_policeRadioArea = m;
|
||||||
|
g_private->_masks.push_front(*m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AskSave(ArgArray args) {
|
void AskSave(ArgArray args) {
|
||||||
|
|
|
@ -57,10 +57,19 @@ PrivateEngine::PrivateEngine(OSystem *syst)
|
||||||
|
|
||||||
_nextSetting = NULL;
|
_nextSetting = NULL;
|
||||||
_nextMovie = NULL;
|
_nextMovie = NULL;
|
||||||
|
_nextVS = NULL;
|
||||||
_modified = false;
|
_modified = false;
|
||||||
_mode = -1;
|
_mode = -1;
|
||||||
_frame = new Common::String("inface/general/inface2.bmp");
|
_frame = new Common::String("inface/general/inface2.bmp");
|
||||||
|
|
||||||
|
_policeRadioArea = NULL;
|
||||||
|
_AMRadioArea = NULL;
|
||||||
|
_phoneArea = NULL;
|
||||||
|
|
||||||
|
_AMRadioPrefix = new Common::String("inface/radio/comm_/");
|
||||||
|
_policeRadioPrefix = new Common::String("inface/radio/police/");
|
||||||
|
_phonePrefix = new Common::String("inface/telephon/");
|
||||||
|
_phoneCallSound = new Common::String("phone.wav");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,11 +92,16 @@ Common::Error PrivateEngine::run() {
|
||||||
assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
|
assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
|
||||||
Common::SeekableReadStream *file = NULL;
|
Common::SeekableReadStream *file = NULL;
|
||||||
|
|
||||||
if (_installerArchive.hasFile("GAME.DAT")) // if the full game is used
|
// if the full game is used
|
||||||
|
if (_installerArchive.hasFile("GAME.DAT"))
|
||||||
file = _installerArchive.createReadStreamForMember("GAME.DAT");
|
file = _installerArchive.createReadStreamForMember("GAME.DAT");
|
||||||
else if (_installerArchive.hasFile("GAME.TXT")) // if the archive.org demo is used
|
|
||||||
|
// if the demo from archive.org is used
|
||||||
|
else if (_installerArchive.hasFile("GAME.TXT"))
|
||||||
file = _installerArchive.createReadStreamForMember("GAME.TXT");
|
file = _installerArchive.createReadStreamForMember("GAME.TXT");
|
||||||
else if (_installerArchive.hasFile("DEMOGAME.DAT")) // if full retail CDROM demo is used
|
|
||||||
|
// if the demo from the full retail CDROM is used
|
||||||
|
else if (_installerArchive.hasFile("DEMOGAME.DAT"))
|
||||||
file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
|
file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
|
||||||
|
|
||||||
assert(file != NULL);
|
assert(file != NULL);
|
||||||
|
@ -124,15 +138,6 @@ Common::Error PrivateEngine::run() {
|
||||||
// Additional setup.
|
// Additional setup.
|
||||||
debug("PrivateEngine::init");
|
debug("PrivateEngine::init");
|
||||||
|
|
||||||
// Your main even loop should be (invoked from) here.
|
|
||||||
//debug("PrivateEngine::go: Hello, World!");
|
|
||||||
|
|
||||||
// This test will show up if -d1 and --debugflags=example are specified on the commandline
|
|
||||||
//debugC(1, kPrivateDebugExample, "Example debug call");
|
|
||||||
|
|
||||||
// This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline
|
|
||||||
//debugC(3, kPrivateDebugExample | kPrivateDebugExample2, "Example debug call two");
|
|
||||||
|
|
||||||
// Simple main event loop
|
// Simple main event loop
|
||||||
Common::Event event;
|
Common::Event event;
|
||||||
Common::Point mousePos;
|
Common::Point mousePos;
|
||||||
|
@ -160,6 +165,8 @@ Common::Error PrivateEngine::run() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Common::EVENT_LBUTTONDOWN:
|
case Common::EVENT_LBUTTONDOWN:
|
||||||
|
selectPoliceRadioArea(mousePos);
|
||||||
|
selectAMRadioArea(mousePos);
|
||||||
selectLoadGame(mousePos);
|
selectLoadGame(mousePos);
|
||||||
selectSaveGame(mousePos);
|
selectSaveGame(mousePos);
|
||||||
selectMask(mousePos);
|
selectMask(mousePos);
|
||||||
|
@ -169,10 +176,7 @@ Common::Error PrivateEngine::run() {
|
||||||
|
|
||||||
case Common::EVENT_MOUSEMOVE:
|
case Common::EVENT_MOUSEMOVE:
|
||||||
changeCursor("default");
|
changeCursor("default");
|
||||||
|
if (cursorMask(mousePos)) {}
|
||||||
if (cursorLoadGame(mousePos)) {}
|
|
||||||
else if (cursorSaveGame(mousePos)) {}
|
|
||||||
else if (cursorMask(mousePos)) {}
|
|
||||||
else if (cursorExit(mousePos)) {}
|
else if (cursorExit(mousePos)) {}
|
||||||
//
|
//
|
||||||
break;
|
break;
|
||||||
|
@ -192,6 +196,11 @@ Common::Error PrivateEngine::run() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_nextVS != NULL) {
|
||||||
|
loadImage(*_nextVS, 160, 120, true);
|
||||||
|
_nextVS = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (_videoDecoder) {
|
if (_videoDecoder) {
|
||||||
|
|
||||||
stopSound();
|
stopSound();
|
||||||
|
@ -256,24 +265,31 @@ bool PrivateEngine::cursorExit(Common::Point mousePos) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrivateEngine::cursorMask(Common::Point mousePos) {
|
bool PrivateEngine::inMask(Graphics::ManagedSurface *surf, Common::Point mousePos) {
|
||||||
//debug("Mousepos %d %d", mousePos.x, mousePos.y);
|
if (surf == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
mousePos = mousePos - *_origin;
|
mousePos = mousePos - *_origin;
|
||||||
if (mousePos.x < 0 || mousePos.y < 0)
|
if (mousePos.x < 0 || mousePos.y < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (mousePos.x > surf->w || mousePos.y > surf->h)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return ( *((uint32*) surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PrivateEngine::cursorMask(Common::Point mousePos) {
|
||||||
|
//debug("Mousepos %d %d", mousePos.x, mousePos.y);
|
||||||
MaskInfo m;
|
MaskInfo m;
|
||||||
bool inside = false;
|
bool inside = false;
|
||||||
for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
|
for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
|
||||||
m = *it;
|
m = *it;
|
||||||
|
|
||||||
if (mousePos.x > m.surf->h || mousePos.y > m.surf->w)
|
if (inMask(m.surf, mousePos)) {
|
||||||
continue;
|
|
||||||
|
|
||||||
//debug("Testing mask %s", m.nextSetting->c_str());
|
|
||||||
if ( *((uint32*) m.surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
|
|
||||||
//debug("Inside!");
|
//debug("Inside!");
|
||||||
if (m.nextSetting != NULL) { // TODO: check this
|
if (m.cursor != NULL) { // TODO: check this
|
||||||
inside = true;
|
inside = true;
|
||||||
//debug("Rendering cursor mask %s", m.cursor->c_str());
|
//debug("Rendering cursor mask %s", m.cursor->c_str());
|
||||||
changeCursor(*m.cursor);
|
changeCursor(*m.cursor);
|
||||||
|
@ -316,18 +332,13 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrivateEngine::selectMask(Common::Point mousePos) {
|
void PrivateEngine::selectMask(Common::Point mousePos) {
|
||||||
//debug("Mousepos %d %d", mousePos.x, mousePos.y);
|
|
||||||
mousePos = mousePos - *_origin;
|
|
||||||
if (mousePos.x < 0 || mousePos.y < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Common::String *ns = NULL;
|
Common::String *ns = NULL;
|
||||||
MaskInfo m;
|
MaskInfo m;
|
||||||
for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
|
for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
|
||||||
m = *it;
|
m = *it;
|
||||||
|
|
||||||
//debug("Testing mask %s", m.nextSetting->c_str());
|
//debug("Testing mask %s", m.nextSetting->c_str());
|
||||||
if ( *((uint32*) m.surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
|
if (inMask(m.surf, mousePos)) {
|
||||||
//debug("Inside!");
|
//debug("Inside!");
|
||||||
if (m.nextSetting != NULL) { // TODO: check this
|
if (m.nextSetting != NULL) { // TODO: check this
|
||||||
//debug("Found Mask %s", m.nextSetting->c_str());
|
//debug("Found Mask %s", m.nextSetting->c_str());
|
||||||
|
@ -348,79 +359,72 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrivateEngine::selectLoadGame(Common::Point mousePos) {
|
void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
|
||||||
if (_loadGameMask == NULL)
|
if (_AMRadioArea == NULL)
|
||||||
return;
|
|
||||||
//debug("Mousepos %d %d", mousePos.x, mousePos.y);
|
|
||||||
mousePos = mousePos - *_origin;
|
|
||||||
if (mousePos.x < 0 || mousePos.y < 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//debug("Testing mask %s", m.nextSetting->c_str());
|
if (_AMRadio.empty())
|
||||||
if ( *((uint32*) _loadGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
|
return;
|
||||||
//debug("loadGame!");
|
|
||||||
loadGameDialog();
|
debug("AMRadio");
|
||||||
|
if (inMask(_AMRadioArea->surf, mousePos)) {
|
||||||
|
Common::String sound = *_AMRadioPrefix + _AMRadio.back() + ".wav";
|
||||||
|
playSound(sound.c_str(), 1);
|
||||||
|
_AMRadio.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrivateEngine::cursorLoadGame(Common::Point mousePos) {
|
void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
|
||||||
if (_loadGameMask == NULL)
|
if (_policeRadioArea == NULL)
|
||||||
return false;
|
return;
|
||||||
//debug("Mousepos %d %d", mousePos.x, mousePos.y);
|
|
||||||
mousePos = mousePos - *_origin;
|
|
||||||
if (mousePos.x < 0 || mousePos.y < 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (mousePos.x > _loadGameMask->surf->h || mousePos.y > _loadGameMask->surf->w)
|
if (_policeRadio.empty())
|
||||||
return false;
|
return;
|
||||||
|
|
||||||
if ( *((uint32*) _loadGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
|
debug("PoliceRadio");
|
||||||
changeCursor(*_loadGameMask->cursor);
|
if (inMask(_policeRadioArea->surf, mousePos)) {
|
||||||
return true;
|
Common::String sound = *_policeRadioPrefix + _policeRadio.back() + ".wav";
|
||||||
|
playSound(sound.c_str(), 1);
|
||||||
|
_policeRadio.pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrivateEngine::selectLoadGame(Common::Point mousePos) {
|
||||||
|
if (_loadGameMask == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (inMask(_loadGameMask->surf, mousePos)) {
|
||||||
|
loadGameDialog();
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrivateEngine::selectSaveGame(Common::Point mousePos) {
|
void PrivateEngine::selectSaveGame(Common::Point mousePos) {
|
||||||
if (_saveGameMask == NULL)
|
if (_saveGameMask == NULL)
|
||||||
return;
|
return;
|
||||||
//debug("Mousepos %d %d", mousePos.x, mousePos.y);
|
|
||||||
mousePos = mousePos - *_origin;
|
if (inMask(_saveGameMask->surf, mousePos)) {
|
||||||
if (mousePos.x < 0 || mousePos.y < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//debug("Testing mask %s", m.nextSetting->c_str());
|
|
||||||
if ( *((uint32*) _saveGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
|
|
||||||
saveGameDialog();
|
saveGameDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PrivateEngine::cursorSaveGame(Common::Point mousePos) {
|
|
||||||
if (_saveGameMask == NULL)
|
|
||||||
return false;
|
|
||||||
//debug("Mousepos %d %d", mousePos.x, mousePos.y);
|
|
||||||
mousePos = mousePos - *_origin;
|
|
||||||
if (mousePos.x < 0 || mousePos.y < 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (mousePos.x > _saveGameMask->surf->h || mousePos.y > _saveGameMask->surf->w)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if ( *((uint32*) _saveGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
|
|
||||||
changeCursor(*_saveGameMask->cursor);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool PrivateEngine::hasFeature(EngineFeature f) const {
|
bool PrivateEngine::hasFeature(EngineFeature f) const {
|
||||||
return
|
return
|
||||||
(f == kSupportsReturnToLauncher);
|
(f == kSupportsReturnToLauncher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrivateEngine::restartGame() {
|
||||||
|
debug("restartGame");
|
||||||
|
|
||||||
|
for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
|
||||||
|
Private::Symbol *sym = variables.getVal(*it);
|
||||||
|
if (strcmp("kAlternateGame", sym->name->c_str()) != 0)
|
||||||
|
sym->u.val = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
|
Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
|
||||||
Common::Serializer s(stream, nullptr);
|
Common::Serializer s(stream, nullptr);
|
||||||
debug("loadGameStream");
|
debug("loadGameStream");
|
||||||
|
@ -524,10 +528,6 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y, bool dra
|
||||||
error("unable to load image %s", path.c_str());
|
error("unable to load image %s", path.c_str());
|
||||||
|
|
||||||
_image->loadStream(file);
|
_image->loadStream(file);
|
||||||
//debug("palette %d %d", _image->getPaletteStartIndex(), _image->getPaletteColorCount());
|
|
||||||
//for (int i = 0; i < 30; i=i+3)
|
|
||||||
// debug("%x %x %x", *(_image->getPalette()+i), *(_image->getPalette()+i+1), *(_image->getPalette()+i+2));
|
|
||||||
|
|
||||||
_compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), *_origin + Common::Point(x,y), _transparentColor);
|
_compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), *_origin + Common::Point(x,y), _transparentColor);
|
||||||
drawScreen();
|
drawScreen();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ enum {
|
||||||
// the current limitation is 32 debug channels (1 << 31 is the last one)
|
// the current limitation is 32 debug channels (1 << 31 is the last one)
|
||||||
};
|
};
|
||||||
|
|
||||||
// exits
|
// structs
|
||||||
|
|
||||||
typedef struct ExitInfo {
|
typedef struct ExitInfo {
|
||||||
Common::String *nextSetting;
|
Common::String *nextSetting;
|
||||||
|
@ -51,9 +51,20 @@ typedef struct MaskInfo {
|
||||||
Common::String *cursor;
|
Common::String *cursor;
|
||||||
} MaskInfo;
|
} MaskInfo;
|
||||||
|
|
||||||
|
typedef struct PhoneInfo {
|
||||||
|
Common::String *sound;
|
||||||
|
Symbol *flag;
|
||||||
|
int val;
|
||||||
|
} PhoneInfo;
|
||||||
|
|
||||||
|
// lists
|
||||||
|
|
||||||
typedef Common::List<ExitInfo> ExitList;
|
typedef Common::List<ExitInfo> ExitList;
|
||||||
typedef Common::List<MaskInfo> MaskList;
|
typedef Common::List<MaskInfo> MaskList;
|
||||||
typedef Common::List<Common::String> SoundList;
|
typedef Common::List<Common::String> SoundList;
|
||||||
|
typedef Common::List<PhoneInfo> PhoneList;
|
||||||
|
|
||||||
|
// hash tables
|
||||||
|
|
||||||
class PrivateEngine : public Engine {
|
class PrivateEngine : public Engine {
|
||||||
private:
|
private:
|
||||||
|
@ -75,6 +86,7 @@ public:
|
||||||
Common::InstallerArchive _installerArchive;
|
Common::InstallerArchive _installerArchive;
|
||||||
|
|
||||||
Common::Error run() override;
|
Common::Error run() override;
|
||||||
|
void restartGame();
|
||||||
void initializePath(const Common::FSNode &gamePath) override;
|
void initializePath(const Common::FSNode &gamePath) override;
|
||||||
void selectMask(Common::Point);
|
void selectMask(Common::Point);
|
||||||
void selectExit(Common::Point);
|
void selectExit(Common::Point);
|
||||||
|
@ -88,10 +100,8 @@ public:
|
||||||
bool canSaveGameStateCurrently() override { return true; }
|
bool canSaveGameStateCurrently() override { return true; }
|
||||||
|
|
||||||
void selectLoadGame(Common::Point);
|
void selectLoadGame(Common::Point);
|
||||||
bool cursorLoadGame(Common::Point);
|
|
||||||
|
|
||||||
void selectSaveGame(Common::Point);
|
void selectSaveGame(Common::Point);
|
||||||
bool cursorSaveGame(Common::Point);
|
|
||||||
|
|
||||||
Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
|
Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
|
||||||
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
|
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
|
||||||
|
@ -110,7 +120,7 @@ public:
|
||||||
void initCursors();
|
void initCursors();
|
||||||
|
|
||||||
Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
|
Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
|
||||||
|
bool inMask(Graphics::ManagedSurface*, Common::Point);
|
||||||
uint32 _transparentColor;
|
uint32 _transparentColor;
|
||||||
void drawScreen();
|
void drawScreen();
|
||||||
|
|
||||||
|
@ -132,9 +142,25 @@ public:
|
||||||
MaskList _masks;
|
MaskList _masks;
|
||||||
|
|
||||||
// Radios
|
// Radios
|
||||||
SoundList _radio;
|
|
||||||
SoundList _police;
|
MaskInfo *_AMRadioArea;
|
||||||
SoundList _phone;
|
Common::String *_AMRadioPrefix;
|
||||||
|
|
||||||
|
MaskInfo *_policeRadioArea;
|
||||||
|
Common::String *_policeRadioPrefix;
|
||||||
|
|
||||||
|
MaskInfo *_phoneArea;
|
||||||
|
Common::String *_phonePrefix;
|
||||||
|
Common::String *_phoneCallSound;
|
||||||
|
|
||||||
|
SoundList _AMRadio;
|
||||||
|
SoundList _policeRadio;
|
||||||
|
PhoneList _phone;
|
||||||
|
|
||||||
|
void selectAMRadioArea(Common::Point);
|
||||||
|
void selectPoliceRadioArea(Common::Point);
|
||||||
|
|
||||||
|
// Random values
|
||||||
|
|
||||||
bool getRandomBool(uint);
|
bool getRandomBool(uint);
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,8 @@ Symbol *lookupName(char *n) {
|
||||||
return lookup(*s, rects);
|
return lookup(*s, rects);
|
||||||
|
|
||||||
else {
|
else {
|
||||||
debug("WARNING: %s not defined", n);
|
debug("WARNING: %s not defined", s->c_str());
|
||||||
return constant(NAME, 0, n);
|
return constant(STRING, 0, (char*) s->c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue