2021-02-13 14:55:30 -03:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-01-02 00:58:58 -03:00
|
|
|
#include "common/str.h"
|
2021-01-31 20:15:56 -03:00
|
|
|
#include "common/timer.h"
|
2021-01-02 14:19:23 -03:00
|
|
|
#include "common/system.h"
|
2021-01-02 00:58:58 -03:00
|
|
|
|
2021-02-13 16:43:38 -03:00
|
|
|
#include "private/grammar.h"
|
2021-02-14 18:15:59 -03:00
|
|
|
#include "private/tokens.h"
|
2021-02-13 16:43:38 -03:00
|
|
|
#include "private/private.h"
|
2021-01-02 00:58:58 -03:00
|
|
|
|
|
|
|
namespace Private {
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fChgMode(ArgArray args) {
|
2021-01-07 23:38:18 -03:00
|
|
|
// assert types
|
2021-02-07 14:08:28 -03:00
|
|
|
assert (args.size() == 2 || args.size() == 3);
|
|
|
|
if (args.size() == 2)
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "ChgMode(%d, %s)", args[0].u.val, args[1].u.str);
|
2021-02-07 14:08:28 -03:00
|
|
|
else if (args.size() == 3)
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "ChgMode(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.sym->name->c_str());
|
2021-02-07 17:36:09 -03:00
|
|
|
else
|
2021-02-07 14:08:28 -03:00
|
|
|
assert(0);
|
|
|
|
|
2021-01-07 23:32:17 -03:00
|
|
|
g_private->_mode = args[0].u.val;
|
2021-02-19 21:50:50 -03:00
|
|
|
g_private->_nextSetting = args[1].u.str;
|
2021-01-08 22:42:34 -03:00
|
|
|
|
2021-01-17 21:50:42 -03:00
|
|
|
if (g_private->_mode == 0) {
|
2021-02-20 15:09:25 -03:00
|
|
|
g_private->_origin = Common::Point(kOriginZero[0], kOriginZero[1]);
|
2021-02-13 19:11:11 -03:00
|
|
|
} else if (g_private->_mode == 1) {
|
2021-02-20 15:09:25 -03:00
|
|
|
g_private->_origin = Common::Point(kOriginOne[0], kOriginOne[1]);
|
2021-02-13 19:11:11 -03:00
|
|
|
} else
|
2021-01-08 22:42:34 -03:00
|
|
|
assert(0);
|
2021-01-31 22:09:26 -03:00
|
|
|
|
2021-02-07 14:08:28 -03:00
|
|
|
if (args.size() == 3)
|
|
|
|
setSymbol(args[2].u.sym, true);
|
|
|
|
|
2021-02-13 11:37:03 -03:00
|
|
|
// This is the only place where this should be used
|
2021-02-13 11:38:10 -03:00
|
|
|
if (g_private->_noStopSounds) {
|
2021-02-07 17:34:19 -03:00
|
|
|
g_private->_noStopSounds = false;
|
2021-02-13 11:37:03 -03:00
|
|
|
} else {
|
|
|
|
g_private->stopSound(true);
|
2021-02-07 17:34:19 -03:00
|
|
|
}
|
2021-01-08 22:42:34 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fVSPicture(ArgArray args) {
|
2021-01-08 22:42:34 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "VSPicture(%s)", args[0].u.str);
|
2021-02-19 21:50:50 -03:00
|
|
|
g_private->_nextVS = args[0].u.str;
|
2021-01-02 10:22:07 -03:00
|
|
|
}
|
|
|
|
|
2021-01-08 22:42:34 -03:00
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fDiaryLocList(ArgArray args) {
|
2021-02-07 14:08:28 -03:00
|
|
|
int x1, y1, x2, y2;
|
|
|
|
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "DiaryLocList(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[2].u.val, args[3].u.val);
|
2021-02-07 14:08:28 -03:00
|
|
|
|
|
|
|
x2 = args[0].u.val;
|
|
|
|
y2 = args[1].u.val;
|
|
|
|
|
|
|
|
x1 = args[2].u.val;
|
|
|
|
y1 = args[3].u.val;
|
|
|
|
|
2021-03-04 18:33:55 +09:00
|
|
|
Common::Rect rect(x1, y1, x2, y2);
|
2021-02-07 14:08:28 -03:00
|
|
|
g_private->loadLocations(rect);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fDiaryGoLoc(ArgArray args) {
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "WARNING: DiaryGoLoc not implemented");
|
2021-02-07 14:08:28 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fDiaryInvList(ArgArray args) {
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "DiaryInvList(%d, ..)", args[0].u.val);
|
2021-02-07 14:08:28 -03:00
|
|
|
|
2021-03-04 18:33:55 +09:00
|
|
|
const Common::Rect *r1 = args[1].u.rect;
|
|
|
|
const Common::Rect *r2 = args[2].u.rect;
|
2021-02-07 14:08:28 -03:00
|
|
|
|
2021-03-04 18:33:55 +09:00
|
|
|
g_private->loadInventory(args[0].u.val, *r1, *r2);
|
2021-02-07 14:08:28 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fgoto(ArgArray args) {
|
2021-01-05 21:03:34 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "goto(%s)", args[0].u.str);
|
2021-02-19 21:50:50 -03:00
|
|
|
g_private->_nextSetting = args[0].u.str;
|
2021-01-02 10:22:07 -03:00
|
|
|
}
|
|
|
|
|
2021-01-10 15:38:10 -03:00
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fSyncSound(ArgArray args) {
|
2021-01-10 15:38:10 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
|
2021-02-19 21:50:50 -03:00
|
|
|
g_private->_nextSetting = args[1].u.str;
|
|
|
|
Common::String s = args[0].u.str;
|
2021-01-16 15:30:00 -03:00
|
|
|
|
2021-02-16 15:31:58 -03:00
|
|
|
if (s != "\"\"") {
|
2021-02-16 10:12:32 -03:00
|
|
|
g_private->playSound(s, 1, true, false);
|
2021-02-13 19:11:11 -03:00
|
|
|
}
|
2021-01-10 15:38:10 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fQuit(ArgArray args) {
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Quit()");
|
2021-01-07 23:38:18 -03:00
|
|
|
g_private->quitGame();
|
2021-01-07 23:10:19 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fLoadGame(ArgArray args) {
|
2021-01-09 22:08:41 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "LoadGame(%s, %s)", args[0].u.str, args[2].u.sym->name->c_str());
|
2021-03-04 21:28:25 +09:00
|
|
|
MaskInfo m;
|
2021-02-20 11:30:07 -03:00
|
|
|
m.surf = g_private->loadMask(args[0].u.str, 0, 0, true);
|
|
|
|
m.cursor = *args[2].u.sym->name;
|
|
|
|
m.nextSetting = "";
|
|
|
|
m.flag1 = NULL;
|
|
|
|
m.flag2 = NULL;
|
|
|
|
if (g_private->_loadGameMask.surf)
|
|
|
|
g_private->_loadGameMask.surf->free();
|
|
|
|
delete g_private->_loadGameMask.surf;
|
2021-01-12 20:49:12 -03:00
|
|
|
g_private->_loadGameMask = m;
|
2021-02-20 11:30:07 -03:00
|
|
|
g_private->_masks.push_front(m);
|
2021-01-12 20:49:12 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fSaveGame(ArgArray args) {
|
2021-01-12 20:49:12 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "SaveGame(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
|
2021-03-04 21:28:25 +09:00
|
|
|
MaskInfo m;
|
2021-02-20 11:30:07 -03:00
|
|
|
m.surf = g_private->loadMask(args[0].u.str, 0, 0, true);
|
|
|
|
m.cursor = *args[1].u.sym->name;
|
|
|
|
m.nextSetting = "";
|
|
|
|
m.flag1 = NULL;
|
|
|
|
m.flag2 = NULL;
|
|
|
|
if (g_private->_saveGameMask.surf)
|
|
|
|
g_private->_saveGameMask.surf->free();
|
|
|
|
delete g_private->_saveGameMask.surf;
|
2021-01-12 20:49:12 -03:00
|
|
|
g_private->_saveGameMask = m;
|
2021-02-20 11:30:07 -03:00
|
|
|
g_private->_masks.push_front(m);
|
2021-01-09 22:08:41 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fRestartGame(ArgArray args) {
|
2021-01-31 22:09:26 -03:00
|
|
|
assert(args.size() == 0);
|
2021-01-16 15:30:00 -03:00
|
|
|
g_private->restartGame();
|
2021-01-08 22:42:34 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fPoliceBust(ArgArray args) {
|
2021-01-10 01:00:05 -03:00
|
|
|
// assert types
|
2021-01-23 20:16:42 -03:00
|
|
|
assert (args.size() == 1 || args.size() == 2);
|
|
|
|
g_private->_policeBustEnabled = args[0].u.val;
|
2021-01-28 23:01:31 -03:00
|
|
|
//debug("Number of clicks %d", g_private->computePoliceIndex());
|
|
|
|
|
|
|
|
if (g_private->_policeBustEnabled)
|
|
|
|
g_private->startPoliceBust();
|
2021-01-23 20:16:42 -03:00
|
|
|
|
|
|
|
if (args.size() == 2) {
|
|
|
|
if (args[1].u.val == 2) {
|
2021-02-13 19:11:11 -03:00
|
|
|
// Unclear what it means
|
|
|
|
} else if (args[1].u.val == 3) {
|
2021-02-19 21:28:18 -03:00
|
|
|
g_private->_nextSetting = kMainDesktop;
|
2021-01-28 23:01:31 -03:00
|
|
|
g_private->_mode = 0;
|
2021-02-20 15:09:25 -03:00
|
|
|
g_private->_origin = Common::Point(kOriginZero[0], kOriginZero[1]);
|
2021-01-23 20:16:42 -03:00
|
|
|
} else
|
|
|
|
assert(0);
|
|
|
|
}
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "PoliceBust(%d, ..)", args[0].u.val);
|
|
|
|
debugC(1, kPrivateDebugScript, "WARNING: PoliceBust partially implemented");
|
2021-01-10 01:00:05 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fBustMovie(ArgArray args) {
|
2021-02-08 21:46:25 -03:00
|
|
|
// assert types
|
|
|
|
assert (args.size() == 1);
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "BustMovie(%s)", args[0].u.str);
|
2021-02-17 11:57:16 -03:00
|
|
|
uint policeIndex = g_private->maps.variables.getVal(kPoliceIndex)->u.val;
|
2021-02-13 11:37:03 -03:00
|
|
|
int videoIndex = policeIndex/2 - 1;
|
|
|
|
if (videoIndex < 0)
|
|
|
|
videoIndex = 0;
|
|
|
|
assert(videoIndex <= 5);
|
2021-02-16 10:57:57 -03:00
|
|
|
Common::String pv =
|
|
|
|
Common::String::format("po/animatio/spoc%02dxs.smk",
|
|
|
|
kPoliceBustVideos[videoIndex]);
|
2021-02-13 11:37:03 -03:00
|
|
|
|
|
|
|
if (kPoliceBustVideos[videoIndex] == 2) {
|
2021-02-16 10:12:32 -03:00
|
|
|
Common::String s("global/transiti/audio/spoc02VO.wav");
|
|
|
|
g_private->playSound(s, 1, false, false);
|
2021-02-13 11:37:03 -03:00
|
|
|
}
|
2021-02-08 21:46:25 -03:00
|
|
|
|
2021-02-19 21:28:18 -03:00
|
|
|
g_private->_nextMovie = pv;
|
|
|
|
g_private->_nextSetting = args[0].u.str;
|
2021-02-08 21:46:25 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fDossierAdd(ArgArray args) {
|
2021-01-30 16:28:33 -03:00
|
|
|
|
|
|
|
assert (args.size() == 2);
|
2021-02-19 22:50:22 -03:00
|
|
|
Common::String s1 = args[0].u.str;
|
|
|
|
Common::String s2 = args[1].u.str;
|
2021-03-04 21:28:25 +09:00
|
|
|
DossierInfo m;
|
2021-02-19 22:50:22 -03:00
|
|
|
m.page1 = s1;
|
2021-01-30 16:28:33 -03:00
|
|
|
|
2021-02-19 22:50:22 -03:00
|
|
|
if (s2 != "\"\"") {
|
|
|
|
m.page2 = s2;
|
2021-01-30 16:28:33 -03:00
|
|
|
} else {
|
2021-02-19 22:50:22 -03:00
|
|
|
m.page2 = "";
|
2021-01-30 16:28:33 -03:00
|
|
|
}
|
|
|
|
|
2021-02-19 22:50:22 -03:00
|
|
|
g_private->_dossiers.push_back(m);
|
2021-01-30 16:28:33 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fDossierBitmap(ArgArray args) {
|
2021-01-30 16:28:33 -03:00
|
|
|
assert (args.size() == 2);
|
|
|
|
int x = args[0].u.val;
|
|
|
|
int y = args[1].u.val;
|
|
|
|
assert(x == 40 && y == 30);
|
|
|
|
g_private->loadDossier();
|
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fDossierChgSheet(ArgArray args) {
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "WARNING: DossierChgSheet is not implemented");
|
2021-01-30 16:28:33 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fDossierPrevSuspect(ArgArray args) {
|
2021-01-30 16:28:33 -03:00
|
|
|
assert (args.size() == 3);
|
2021-02-16 17:42:52 -03:00
|
|
|
Common::String s(args[0].u.str);
|
2021-03-04 21:28:25 +09:00
|
|
|
MaskInfo m;
|
2021-01-30 16:28:33 -03:00
|
|
|
|
|
|
|
int x = args[1].u.val;
|
|
|
|
int y = args[2].u.val;
|
|
|
|
|
2021-02-20 11:30:07 -03:00
|
|
|
m.surf = g_private->loadMask(s, x, y, true);
|
|
|
|
m.cursor = "kExit";
|
|
|
|
m.nextSetting = "";
|
|
|
|
m.flag1 = NULL;
|
|
|
|
m.flag2 = NULL;
|
2021-01-30 16:28:33 -03:00
|
|
|
g_private->_dossierPrevSuspectMask = m;
|
2021-02-20 11:30:07 -03:00
|
|
|
g_private->_masks.push_front(m);
|
2021-01-30 16:28:33 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fDossierNextSuspect(ArgArray args) {
|
2021-01-30 16:28:33 -03:00
|
|
|
assert (args.size() == 3);
|
2021-02-16 17:42:52 -03:00
|
|
|
Common::String s(args[0].u.str);
|
2021-03-04 21:28:25 +09:00
|
|
|
MaskInfo m;
|
2021-01-30 16:28:33 -03:00
|
|
|
|
|
|
|
int x = args[1].u.val;
|
|
|
|
int y = args[2].u.val;
|
|
|
|
|
2021-02-20 11:30:07 -03:00
|
|
|
m.surf = g_private->loadMask(s, x, y, true);
|
|
|
|
m.cursor = "kExit";
|
|
|
|
m.nextSetting = "";
|
|
|
|
m.flag1 = NULL;
|
|
|
|
m.flag2 = NULL;
|
2021-01-30 16:28:33 -03:00
|
|
|
g_private->_dossierNextSuspectMask = m;
|
2021-02-20 11:30:07 -03:00
|
|
|
g_private->_masks.push_front(m);
|
2021-01-08 22:42:34 -03:00
|
|
|
}
|
2021-01-07 23:10:19 -03:00
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fNoStopSounds(ArgArray args) {
|
2021-02-07 17:34:19 -03:00
|
|
|
assert(args.size() == 0);
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "NoStopSounds()");
|
2021-02-07 17:34:19 -03:00
|
|
|
g_private->_noStopSounds = true;
|
2021-01-10 15:38:10 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fLoseInventory(ArgArray args) {
|
2021-02-13 11:37:03 -03:00
|
|
|
assert(args.size() == 0);
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "LoveInventory()");
|
2021-02-13 11:37:03 -03:00
|
|
|
g_private->inventory.clear();
|
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fInventory(ArgArray args) {
|
2021-01-09 16:11:30 -03:00
|
|
|
// assert types
|
2021-01-10 20:17:27 -03:00
|
|
|
Datum b1 = args[0];
|
2021-01-10 15:38:10 -03:00
|
|
|
Datum v1 = args[1];
|
|
|
|
Datum v2 = args[2];
|
|
|
|
Datum e = args[3];
|
2021-02-07 14:08:28 -03:00
|
|
|
Datum i = args[4];
|
2021-01-20 09:21:03 -03:00
|
|
|
Datum c = args[5];
|
2021-01-10 15:38:10 -03:00
|
|
|
Datum snd = args[8];
|
|
|
|
|
|
|
|
assert(v1.type == STRING || v1.type == NAME);
|
|
|
|
assert(b1.type == STRING);
|
|
|
|
assert(e.type == STRING || e.type == NUM);
|
|
|
|
assert(snd.type == STRING);
|
2021-02-07 14:08:28 -03:00
|
|
|
assert(i.type == STRING);
|
2021-01-10 15:38:10 -03:00
|
|
|
|
2021-02-16 15:31:58 -03:00
|
|
|
Common::String bmp(i.u.str);
|
|
|
|
assert(g_private->isDemo() || bmp != "\"\"");
|
2021-02-07 17:36:09 -03:00
|
|
|
|
2021-01-10 15:38:10 -03:00
|
|
|
if (v1.type == STRING)
|
|
|
|
assert(strcmp(v1.u.str, "\"\"") == 0);
|
|
|
|
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Inventory(...)");
|
2021-02-16 15:31:58 -03:00
|
|
|
Common::String mask(b1.u.str);
|
|
|
|
if (mask != "\"\"") {
|
2021-03-04 21:28:25 +09:00
|
|
|
MaskInfo m;
|
2021-02-20 11:30:07 -03:00
|
|
|
m.surf = g_private->loadMask(mask, 0, 0, true);
|
2021-01-10 20:17:27 -03:00
|
|
|
|
2021-01-10 15:38:10 -03:00
|
|
|
if (e.type == NUM)
|
2021-02-20 11:30:07 -03:00
|
|
|
m.nextSetting = "";
|
2021-01-10 15:38:10 -03:00
|
|
|
else
|
2021-02-20 12:16:06 -03:00
|
|
|
m.nextSetting = e.u.str;
|
2021-01-10 15:38:10 -03:00
|
|
|
|
2021-02-20 11:30:07 -03:00
|
|
|
m.cursor = "kInventory";
|
|
|
|
m.point = Common::Point(0,0);
|
2021-01-20 09:21:03 -03:00
|
|
|
|
|
|
|
if (v1.type == NAME)
|
2021-02-20 11:30:07 -03:00
|
|
|
m.flag1 = v1.u.sym;
|
2021-01-20 09:21:03 -03:00
|
|
|
else
|
2021-02-20 11:30:07 -03:00
|
|
|
m.flag1 = NULL;
|
2021-01-20 09:21:03 -03:00
|
|
|
|
2021-01-17 21:50:42 -03:00
|
|
|
if (v2.type == NAME)
|
2021-02-20 11:30:07 -03:00
|
|
|
m.flag2 = v2.u.sym;
|
2021-01-10 15:38:10 -03:00
|
|
|
else
|
2021-02-20 11:30:07 -03:00
|
|
|
m.flag2 = NULL;
|
2021-01-10 20:17:27 -03:00
|
|
|
|
2021-02-20 11:30:07 -03:00
|
|
|
g_private->_masks.push_front(m);
|
2021-01-17 21:50:42 -03:00
|
|
|
g_private->_toTake = true;
|
2021-02-16 15:31:58 -03:00
|
|
|
Common::String sound(snd.u.str);
|
2021-01-28 23:01:31 -03:00
|
|
|
|
2021-02-16 15:31:58 -03:00
|
|
|
if (sound != "\"\"") {
|
|
|
|
g_private->playSound(sound, 1, false, false);
|
2021-01-28 23:01:31 -03:00
|
|
|
} else {
|
2021-02-16 10:07:54 -03:00
|
|
|
g_private->playSound(g_private->getTakeLeaveSound(), 1, false, false);
|
2021-01-28 23:01:31 -03:00
|
|
|
}
|
2021-02-16 10:07:54 -03:00
|
|
|
|
2021-02-16 15:31:58 -03:00
|
|
|
g_private->inventory.push_back(bmp);
|
2021-02-07 17:36:09 -03:00
|
|
|
} else {
|
2021-01-30 16:28:33 -03:00
|
|
|
if (v1.type == NAME) {
|
2021-02-07 14:08:28 -03:00
|
|
|
if (strcmp(c.u.str, "\"REMOVE\"") == 0) {
|
2021-01-20 09:21:03 -03:00
|
|
|
v1.u.sym->u.val = 0;
|
2021-02-16 15:31:58 -03:00
|
|
|
g_private->inventory.remove(bmp);
|
2021-02-07 14:08:28 -03:00
|
|
|
} else {
|
2021-01-20 09:21:03 -03:00
|
|
|
v1.u.sym->u.val = 1;
|
2021-02-16 15:31:58 -03:00
|
|
|
g_private->inventory.push_back(bmp);
|
2021-02-07 14:08:28 -03:00
|
|
|
}
|
2021-02-13 19:11:11 -03:00
|
|
|
} else {
|
2021-02-16 15:31:58 -03:00
|
|
|
g_private->inventory.push_back(bmp);
|
2021-01-30 16:28:33 -03:00
|
|
|
}
|
2021-01-20 09:21:03 -03:00
|
|
|
if (v2.type == NAME)
|
|
|
|
v2.u.sym->u.val = 1;
|
|
|
|
}
|
2021-01-09 16:11:30 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fSetFlag(ArgArray args) {
|
2021-02-14 13:15:36 -03:00
|
|
|
assert(args.size() == 2);
|
|
|
|
assert(args[0].type == NAME && args[1].type == NUM);
|
|
|
|
debugC(1, kPrivateDebugScript, "SetFlag(%s, %d)", args[0].u.sym->name->c_str(), args[1].u.val);
|
2021-01-05 21:03:34 -03:00
|
|
|
args[0].u.sym->u.val = args[1].u.val;
|
2021-01-02 10:22:07 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fExit(ArgArray args) {
|
2021-01-07 23:10:19 -03:00
|
|
|
// assert types
|
|
|
|
assert(args[2].type == RECT || args[2].type == NAME);
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Exit(%d %d %d)", args[0].type, args[1].type, args[2].type); //, args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
|
2021-03-04 21:28:25 +09:00
|
|
|
ExitInfo e;
|
2021-01-08 22:42:34 -03:00
|
|
|
|
|
|
|
if (args[0].type == NUM && args[0].u.val == 0)
|
2021-02-20 10:16:27 -03:00
|
|
|
e.nextSetting = "";
|
2021-01-08 22:42:34 -03:00
|
|
|
else
|
2021-02-20 10:16:27 -03:00
|
|
|
e.nextSetting = args[0].u.str;
|
2021-01-08 22:42:34 -03:00
|
|
|
|
|
|
|
if (args[1].type == NUM && args[1].u.val == 0)
|
2021-02-20 10:16:27 -03:00
|
|
|
e.cursor = "";
|
2021-01-08 22:42:34 -03:00
|
|
|
else
|
2021-02-20 10:16:27 -03:00
|
|
|
e.cursor = *args[1].u.sym->name;
|
2021-01-08 22:42:34 -03:00
|
|
|
|
2021-01-09 16:11:30 -03:00
|
|
|
if (args[2].type == NAME) {
|
2021-01-09 19:11:41 -03:00
|
|
|
assert(args[2].u.sym->type == RECT);
|
|
|
|
args[2].u.rect = args[2].u.sym->u.rect;
|
2021-01-09 16:11:30 -03:00
|
|
|
}
|
|
|
|
|
2021-02-20 10:16:27 -03:00
|
|
|
e.rect = *args[2].u.rect;
|
|
|
|
g_private->_exits.push_front(e);
|
2021-01-07 23:10:19 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fSetModifiedFlag(ArgArray args) {
|
2021-01-05 21:03:34 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "SetModifiedFlag(%d)", args[0].u.val);
|
2021-02-14 13:42:34 -03:00
|
|
|
g_private->_modified = args[0].u.val != 0;
|
2021-01-04 08:14:40 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fPaperShuffleSound(ArgArray args) {
|
2021-02-14 13:15:36 -03:00
|
|
|
assert(args.size() == 0);
|
|
|
|
debugC(1, kPrivateDebugScript, "PaperShuffleSound()");
|
2021-02-16 10:07:54 -03:00
|
|
|
g_private->playSound(g_private->getPaperShuffleSound(), 1, false, false);
|
2021-01-31 22:09:26 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fSoundEffect(ArgArray args) {
|
2021-01-31 22:09:26 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "SoundEffect(%s)", args[0].u.str);
|
2021-02-16 15:31:58 -03:00
|
|
|
Common::String s(args[0].u.str);
|
|
|
|
if (s != "\"\"") {
|
2021-02-16 10:12:32 -03:00
|
|
|
g_private->playSound(s, 1, false, false);
|
2021-01-31 22:09:26 -03:00
|
|
|
} else {
|
2021-02-07 14:08:28 -03:00
|
|
|
g_private->stopSound(true);
|
2021-01-31 22:09:26 -03:00
|
|
|
}
|
2021-01-17 15:38:45 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fSound(ArgArray args) {
|
2021-01-05 21:03:34 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Sound(%s)", args[0].u.str);
|
2021-02-07 14:08:28 -03:00
|
|
|
if (args.size() == 4) {
|
2021-02-14 13:42:34 -03:00
|
|
|
bool b1 = args[1].u.val != 0;
|
|
|
|
bool b2 = args[2].u.val != 0;
|
2021-02-07 14:08:28 -03:00
|
|
|
int c = args[3].u.val;
|
|
|
|
|
|
|
|
if (!b1 && !b2 && c == 1) {
|
|
|
|
g_private->stopSound(true);
|
|
|
|
} else if (!b1 && !b2 && c == 2) {
|
|
|
|
g_private->stopSound(false);
|
|
|
|
} else
|
|
|
|
assert(0);
|
|
|
|
}
|
|
|
|
|
2021-02-16 15:31:58 -03:00
|
|
|
Common::String s(args[0].u.str);
|
|
|
|
if (s != "\"\"") {
|
2021-02-16 10:12:32 -03:00
|
|
|
g_private->playSound(s, 1, false, false);
|
2021-01-02 10:22:07 -03:00
|
|
|
} else {
|
2021-02-07 14:08:28 -03:00
|
|
|
g_private->stopSound(true);
|
2021-01-02 10:22:07 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fLoopedSound(ArgArray args) {
|
2021-01-09 16:11:30 -03:00
|
|
|
// assert types
|
|
|
|
assert(args.size() == 1);
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "LoopedSound(%s)", args[0].u.str);
|
2021-02-16 15:31:58 -03:00
|
|
|
Common::String s(args[0].u.str);
|
|
|
|
|
|
|
|
if (s != "\"\"") {
|
2021-02-16 10:12:32 -03:00
|
|
|
g_private->playSound(s, 0, true, true);
|
2021-01-09 16:11:30 -03:00
|
|
|
} else {
|
2021-02-07 14:08:28 -03:00
|
|
|
g_private->stopSound(true);
|
2021-01-09 16:11:30 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fViewScreen(ArgArray args) {
|
2021-01-10 15:38:10 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "WARNING: ViewScreen not implemented!");
|
2021-01-10 15:38:10 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fTransition(ArgArray args) {
|
2021-01-05 21:03:34 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Transition(%s, %s)", args[0].u.str, args[1].u.str);
|
2021-02-19 21:28:18 -03:00
|
|
|
g_private->_nextMovie = args[0].u.str;
|
|
|
|
g_private->_nextSetting = args[1].u.str;
|
2021-01-08 22:42:34 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fResume(ArgArray args) {
|
2021-01-20 09:21:03 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Resume(%d)", args[0].u.val); // this value is always 1
|
2021-02-19 21:28:18 -03:00
|
|
|
g_private->_nextSetting = g_private->_pausedSetting;
|
|
|
|
g_private->_pausedSetting = "";
|
2021-01-20 09:21:03 -03:00
|
|
|
g_private->_mode = 1;
|
2021-02-20 15:09:25 -03:00
|
|
|
g_private->_origin = Common::Point(kOriginOne[0], kOriginOne[1]);
|
2021-01-20 09:21:03 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fMovie(ArgArray args) {
|
2021-01-08 22:42:34 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Movie(%s, %s)", args[0].u.str, args[1].u.str);
|
2021-02-19 21:28:18 -03:00
|
|
|
Common::String movie = args[0].u.str;
|
|
|
|
Common::String nextSetting = args[1].u.str;
|
|
|
|
|
|
|
|
if (!g_private->_playedMovies.contains(movie) && movie != "\"\"") {
|
|
|
|
g_private->_nextMovie = movie;
|
|
|
|
g_private->_playedMovies.setVal(movie, true);
|
|
|
|
g_private->_nextSetting = nextSetting;
|
|
|
|
} else if (movie == "\"\"") {
|
|
|
|
g_private->_repeatedMovieExit = nextSetting;
|
|
|
|
debugC(1, kPrivateDebugScript, "repeated movie exit is %s", nextSetting.c_str());
|
2021-01-17 15:38:45 -03:00
|
|
|
} else {
|
2021-02-19 21:28:18 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "movie %s already played", movie.c_str());
|
|
|
|
g_private->_nextSetting = g_private->_repeatedMovieExit;
|
2021-01-17 15:38:45 -03:00
|
|
|
}
|
2021-01-05 21:03:34 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fCRect(ArgArray args) {
|
2021-01-05 21:03:34 -03:00
|
|
|
// assert types
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "CRect(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[2].u.val, args[3].u.val);
|
2021-02-15 10:52:09 -03:00
|
|
|
int x1, y1, x2, y2;
|
2021-01-05 21:03:34 -03:00
|
|
|
x1 = args[0].u.val;
|
|
|
|
y1 = args[1].u.val;
|
|
|
|
x2 = args[2].u.val;
|
|
|
|
y2 = args[3].u.val;
|
|
|
|
|
|
|
|
Datum *d = new Datum();
|
|
|
|
Common::Rect *rect = new Common::Rect(x1, y1, x2, y2);
|
2021-01-07 23:10:19 -03:00
|
|
|
d->type = RECT;
|
2021-01-05 21:03:34 -03:00
|
|
|
d->u.rect = rect;
|
2021-02-22 20:59:12 -03:00
|
|
|
Gen::push(*d);
|
2021-01-04 08:14:40 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fBitmap(ArgArray args) {
|
2021-01-02 14:19:23 -03:00
|
|
|
assert(args.size() == 1 || args.size() == 3);
|
|
|
|
|
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
|
|
|
|
2021-03-04 17:13:20 +09:00
|
|
|
const char *f = args[0].u.str;
|
2021-01-02 14:19:23 -03:00
|
|
|
if (args.size() == 3) {
|
2021-01-07 23:38:18 -03:00
|
|
|
x = args[1].u.val;
|
|
|
|
y = args[2].u.val;
|
2021-01-02 14:19:23 -03:00
|
|
|
}
|
|
|
|
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Bitmap(%s, %d, %d)", f, x, y);
|
2021-02-16 17:42:52 -03:00
|
|
|
Common::String s(args[0].u.str);
|
|
|
|
g_private->loadImage(s, x, y);
|
2021-01-02 14:19:23 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void _fMask(ArgArray args, bool drawn) {
|
2021-01-08 22:42:34 -03:00
|
|
|
assert(args.size() == 3 || args.size() == 5);
|
|
|
|
|
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
2021-03-04 17:13:20 +09:00
|
|
|
const char *f = args[0].u.str;
|
|
|
|
const char *e = args[1].u.str;
|
2021-01-08 22:42:34 -03:00
|
|
|
Common::String *c = args[2].u.sym->name;
|
2021-01-09 19:11:41 -03:00
|
|
|
|
2021-01-08 22:42:34 -03:00
|
|
|
if (args.size() == 5) {
|
|
|
|
x = args[3].u.val;
|
|
|
|
y = args[4].u.val;
|
|
|
|
}
|
|
|
|
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Mask(%s, %s, %s, %d, %d)", f, e, c->c_str(), x, y);
|
2021-02-16 17:42:52 -03:00
|
|
|
const Common::String s(f);
|
2021-01-08 22:42:34 -03:00
|
|
|
|
2021-03-04 21:28:25 +09:00
|
|
|
MaskInfo m;
|
2021-02-20 11:30:07 -03:00
|
|
|
m.surf = g_private->loadMask(s, x, y, drawn);
|
|
|
|
m.nextSetting = e;
|
|
|
|
m.cursor = *c;
|
|
|
|
m.flag1 = NULL;
|
|
|
|
m.flag2 = NULL;
|
|
|
|
m.point = Common::Point(x,y);
|
|
|
|
g_private->_masks.push_front(m);
|
2021-01-08 22:42:34 -03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fMask(ArgArray args) {
|
|
|
|
_fMask(args, false);
|
2021-01-10 20:17:27 -03:00
|
|
|
}
|
2021-02-15 10:40:35 -03:00
|
|
|
void fMaskDrawn(ArgArray args) {
|
|
|
|
_fMask(args, true);
|
2021-01-10 20:17:27 -03:00
|
|
|
}
|
2021-01-08 22:42:34 -03:00
|
|
|
|
2021-03-04 17:13:20 +09:00
|
|
|
static void fAddSound(Common::String sound, const char *t, Symbol *flag = NULL, int val = 0) {
|
2021-02-20 13:55:05 -03:00
|
|
|
if (sound == "\"\"")
|
2021-01-16 22:27:13 -03:00
|
|
|
return;
|
|
|
|
|
2021-01-10 19:11:02 -03:00
|
|
|
if (strcmp(t, "AMRadioClip") == 0)
|
2021-02-19 22:50:22 -03:00
|
|
|
g_private->_AMRadio.push_back(sound);
|
2021-01-10 19:11:02 -03:00
|
|
|
else if (strcmp(t, "PoliceClip") == 0)
|
2021-02-19 22:50:22 -03:00
|
|
|
g_private->_policeRadio.push_back(sound);
|
2021-01-16 15:30:00 -03:00
|
|
|
else if (strcmp(t, "PhoneClip") == 0) {
|
2021-01-16 22:27:13 -03:00
|
|
|
// This condition will avoid adding the same phone call twice,
|
|
|
|
// it is unclear why this could be useful, but it looks like a bug
|
2021-01-17 21:50:42 -03:00
|
|
|
// in the original scripts
|
2021-02-19 22:50:22 -03:00
|
|
|
if (g_private->_playedPhoneClips.contains(sound))
|
2021-01-16 22:27:13 -03:00
|
|
|
return;
|
|
|
|
|
2021-02-19 22:50:22 -03:00
|
|
|
g_private->_playedPhoneClips.setVal(sound, true);
|
2021-03-04 21:28:25 +09:00
|
|
|
PhoneInfo p;
|
2021-02-19 22:50:22 -03:00
|
|
|
p.sound = sound;
|
|
|
|
p.flag = flag;
|
|
|
|
p.val = val;
|
|
|
|
g_private->_phone.push_back(p);
|
2021-02-16 08:19:12 -03:00
|
|
|
} else
|
2021-02-14 13:15:36 -03:00
|
|
|
error("error: invalid sound type %s", t);
|
2021-01-10 19:11:02 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fAMRadioClip(ArgArray args) {
|
2021-01-17 15:38:45 -03:00
|
|
|
assert(args.size() <= 4);
|
2021-02-15 10:40:35 -03:00
|
|
|
fAddSound(args[0].u.str, "AMRadioClip");
|
2021-01-10 20:17:27 -03:00
|
|
|
}
|
2021-02-15 10:52:09 -03:00
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fPoliceClip(ArgArray args) {
|
2021-01-17 15:38:45 -03:00
|
|
|
assert(args.size() <= 4);
|
2021-02-15 10:40:35 -03:00
|
|
|
fAddSound(args[0].u.str, "PoliceClip");
|
2021-01-10 20:17:27 -03:00
|
|
|
}
|
2021-02-15 10:52:09 -03:00
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fPhoneClip(ArgArray args) {
|
2021-01-16 15:30:00 -03:00
|
|
|
if (args.size() == 2) {
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Unimplemented PhoneClip special case");
|
2021-01-16 15:30:00 -03:00
|
|
|
return;
|
|
|
|
}
|
2021-01-23 09:30:16 -03:00
|
|
|
int i = args[2].u.val;
|
|
|
|
int j = args[3].u.val;
|
|
|
|
|
|
|
|
if (i == j)
|
2021-02-15 10:40:35 -03:00
|
|
|
fAddSound(args[0].u.str, "PhoneClip", args[4].u.sym, args[5].u.val);
|
2021-01-23 09:30:16 -03:00
|
|
|
else {
|
|
|
|
assert(i < j);
|
2021-02-20 13:55:05 -03:00
|
|
|
Common::String sound = g_private->getRandomPhoneClip(args[0].u.str, i, j);
|
|
|
|
fAddSound(sound, "PhoneClip", args[4].u.sym, args[5].u.val);
|
2021-01-23 09:30:16 -03:00
|
|
|
}
|
2021-01-10 20:17:27 -03:00
|
|
|
}
|
2021-01-10 19:11:02 -03:00
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fSoundArea(ArgArray args) {
|
2021-01-10 19:11:02 -03:00
|
|
|
// assert types
|
2021-02-16 16:24:47 -03:00
|
|
|
//char *n;
|
|
|
|
Common::String n;
|
2021-01-16 15:30:00 -03:00
|
|
|
if (args[1].type == NAME)
|
2021-02-16 16:24:47 -03:00
|
|
|
n = *(args[1].u.sym->name);
|
2021-01-16 15:30:00 -03:00
|
|
|
else if (args[1].type == STRING)
|
2021-02-16 16:24:47 -03:00
|
|
|
n = Common::String(args[1].u.str);
|
2021-01-16 15:30:00 -03:00
|
|
|
else
|
2021-02-16 16:24:47 -03:00
|
|
|
error("Invalid input for SoundArea");
|
2021-01-16 15:30:00 -03:00
|
|
|
|
2021-02-16 16:24:47 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "SoundArea(%s, %s, ..)", args[0].u.str, n.c_str());
|
2021-02-19 21:50:50 -03:00
|
|
|
Common::String s = args[0].u.str;
|
2021-03-04 21:28:25 +09:00
|
|
|
MaskInfo m;
|
2021-02-16 16:24:47 -03:00
|
|
|
if (n == "kAMRadio") {
|
2021-02-20 11:30:07 -03:00
|
|
|
m.surf = g_private->loadMask(s, 0, 0, true);
|
|
|
|
m.cursor = *args[2].u.sym->name;
|
|
|
|
m.nextSetting = "";
|
|
|
|
m.flag1 = NULL;
|
|
|
|
m.flag2 = NULL;
|
|
|
|
if (g_private->_AMRadioArea.surf)
|
|
|
|
g_private->_AMRadioArea.surf->free();
|
|
|
|
delete g_private->_AMRadioArea.surf;
|
2021-01-16 15:30:00 -03:00
|
|
|
g_private->_AMRadioArea = m;
|
2021-02-20 11:30:07 -03:00
|
|
|
g_private->_masks.push_front(m);
|
2021-02-16 16:24:47 -03:00
|
|
|
} else if (n == "kPoliceRadio") {
|
2021-02-20 11:30:07 -03:00
|
|
|
m.surf = g_private->loadMask(s, 0, 0, true);
|
|
|
|
m.cursor = *args[2].u.sym->name;
|
|
|
|
m.nextSetting = "";
|
|
|
|
m.flag1 = NULL;
|
|
|
|
m.flag2 = NULL;
|
|
|
|
if (g_private->_policeRadioArea.surf)
|
|
|
|
g_private->_policeRadioArea.surf->free();
|
|
|
|
delete g_private->_policeRadioArea.surf;
|
2021-01-16 15:30:00 -03:00
|
|
|
g_private->_policeRadioArea = m;
|
2021-02-20 11:30:07 -03:00
|
|
|
g_private->_masks.push_front(m);
|
2021-02-16 16:24:47 -03:00
|
|
|
} else if (n == "kPhone") {
|
2021-02-20 11:30:07 -03:00
|
|
|
m.surf = g_private->loadMask(s, 0, 0, true);
|
|
|
|
m.cursor = *args[2].u.sym->name;
|
|
|
|
m.nextSetting = "";
|
|
|
|
m.flag1 = NULL;
|
|
|
|
m.flag2 = NULL;
|
|
|
|
if (g_private->_phoneArea.surf)
|
|
|
|
g_private->_phoneArea.surf->free();
|
|
|
|
delete g_private->_phoneArea.surf;
|
2021-01-16 22:27:13 -03:00
|
|
|
g_private->_phoneArea = m;
|
2021-02-20 11:30:07 -03:00
|
|
|
g_private->_masks.push_front(m);
|
2021-01-16 15:30:00 -03:00
|
|
|
}
|
2021-01-10 19:11:02 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fSafeDigit(ArgArray args) {
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "WARNING: SafeDigit is not implemented");
|
2021-02-13 11:37:03 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fAskSave(ArgArray args) {
|
2021-01-12 20:49:12 -03:00
|
|
|
// This is not needed, since scummvm will take care of this
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "WARNING: AskSave is partially implemented");
|
2021-02-19 21:50:50 -03:00
|
|
|
g_private->_nextSetting = args[0].u.str;
|
2021-01-12 20:49:12 -03:00
|
|
|
}
|
|
|
|
|
2021-02-15 10:40:35 -03:00
|
|
|
void fTimer(ArgArray args) {
|
2021-01-09 16:11:30 -03:00
|
|
|
assert (args.size() == 2 || args.size() == 3);
|
|
|
|
|
|
|
|
if (args.size() == 3)
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Timer(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.str);
|
2021-01-09 19:11:41 -03:00
|
|
|
else
|
2021-02-14 13:15:36 -03:00
|
|
|
debugC(1, kPrivateDebugScript, "Timer(%d, %s)", args[0].u.val, args[1].u.str);
|
2021-01-09 19:11:41 -03:00
|
|
|
|
2021-01-31 20:15:56 -03:00
|
|
|
int32 delay = 1000000 * args[0].u.val;
|
2021-02-19 21:50:50 -03:00
|
|
|
// This pointer is necessary since installTimer needs one
|
2021-01-05 21:03:34 -03:00
|
|
|
Common::String *s = new Common::String(args[1].u.str);
|
2021-01-31 20:15:56 -03:00
|
|
|
if (delay > 0) {
|
|
|
|
assert(g_private->installTimer(delay, s));
|
|
|
|
} else if (delay == 0) {
|
2021-02-19 21:28:18 -03:00
|
|
|
g_private->_nextSetting = *s;
|
2021-01-31 20:15:56 -03:00
|
|
|
} else {
|
|
|
|
assert(0);
|
|
|
|
}
|
2021-01-02 14:19:23 -03:00
|
|
|
}
|
|
|
|
|
2021-02-19 18:01:52 -03:00
|
|
|
FuncTable funcTable[] = {
|
2021-01-10 19:11:02 -03:00
|
|
|
|
2021-02-15 10:52:09 -03:00
|
|
|
// Control flow
|
2021-02-15 10:40:35 -03:00
|
|
|
{ fChgMode, "ChgMode"},
|
|
|
|
{ fResume, "Resume"},
|
|
|
|
{ fgoto, "goto"},
|
|
|
|
{ fTimer, "Timer"},
|
2021-01-10 19:11:02 -03:00
|
|
|
|
2021-02-15 10:52:09 -03:00
|
|
|
// Variables
|
|
|
|
{ fSetFlag, "SetFlag"},
|
|
|
|
{ fSetModifiedFlag, "SetModifiedFlag"},
|
|
|
|
|
2021-01-10 19:11:02 -03:00
|
|
|
// Sounds
|
2021-02-15 10:40:35 -03:00
|
|
|
{ fSound, "Sound"},
|
|
|
|
{ fSoundEffect, "SoundEffect"},
|
|
|
|
{ fLoopedSound, "LoopedSound"},
|
|
|
|
{ fNoStopSounds, "NoStopSounds"},
|
|
|
|
{ fSyncSound, "SyncSound"},
|
|
|
|
{ fAMRadioClip, "AMRadioClip"},
|
|
|
|
{ fPoliceClip, "PoliceClip"},
|
|
|
|
{ fPhoneClip, "PhoneClip"},
|
|
|
|
{ fSoundArea, "SoundArea"},
|
|
|
|
{ fPaperShuffleSound, "PaperShuffleSound"},
|
2021-01-10 20:17:27 -03:00
|
|
|
|
2021-01-10 19:11:02 -03:00
|
|
|
// Images
|
2021-02-15 10:40:35 -03:00
|
|
|
{ fBitmap, "Bitmap"},
|
|
|
|
{ fMask, "Mask"},
|
|
|
|
{ fMaskDrawn, "MaskDrawn"},
|
|
|
|
{ fVSPicture, "VSPicture"},
|
|
|
|
{ fViewScreen, "ViewScreen"},
|
2021-02-15 10:52:09 -03:00
|
|
|
{ fExit, "Exit"},
|
2021-01-10 20:17:27 -03:00
|
|
|
|
2021-01-10 19:11:02 -03:00
|
|
|
// Video
|
2021-02-15 10:40:35 -03:00
|
|
|
{ fTransition, "Transition"},
|
|
|
|
{ fMovie, "Movie"},
|
2021-01-10 19:11:02 -03:00
|
|
|
|
2021-02-07 14:08:28 -03:00
|
|
|
// Diary
|
2021-02-15 10:40:35 -03:00
|
|
|
{ fDiaryLocList, "DiaryLocList"},
|
|
|
|
{ fDiaryInvList, "DiaryInvList"},
|
|
|
|
{ fDiaryGoLoc, "DiaryGoLoc"},
|
2021-01-30 16:28:33 -03:00
|
|
|
|
2021-02-15 10:52:09 -03:00
|
|
|
// Main menu
|
2021-02-15 10:40:35 -03:00
|
|
|
{ fQuit, "Quit"},
|
|
|
|
{ fLoadGame, "LoadGame"},
|
|
|
|
{ fSaveGame, "SaveGame"},
|
|
|
|
{ fAskSave, "AskSave"},
|
2021-02-15 10:52:09 -03:00
|
|
|
{ fRestartGame, "RestartGame"},
|
2021-01-17 21:50:42 -03:00
|
|
|
|
2021-01-30 16:28:33 -03:00
|
|
|
// Dossiers
|
2021-02-15 10:40:35 -03:00
|
|
|
{ fDossierAdd, "DossierAdd"},
|
|
|
|
{ fDossierChgSheet, "DossierChgSheet"},
|
|
|
|
{ fDossierBitmap, "DossierBitmap"},
|
|
|
|
{ fDossierPrevSuspect, "DossierPrevSuspect"},
|
|
|
|
{ fDossierNextSuspect, "DossierNextSuspect"},
|
2021-02-07 17:36:09 -03:00
|
|
|
|
2021-02-15 10:52:09 -03:00
|
|
|
// Inventory
|
2021-02-15 10:40:35 -03:00
|
|
|
{ fLoseInventory, "LoseInventory"},
|
|
|
|
{ fInventory, "Inventory"},
|
2021-02-08 21:46:25 -03:00
|
|
|
|
|
|
|
// PoliceBust
|
2021-02-15 10:40:35 -03:00
|
|
|
{ fPoliceBust, "PoliceBust"},
|
|
|
|
{ fBustMovie, "BustMovie"},
|
2021-02-08 21:46:25 -03:00
|
|
|
|
2021-02-13 11:37:03 -03:00
|
|
|
// Others
|
2021-02-15 10:40:35 -03:00
|
|
|
{ fSafeDigit, "SafeDigit"},
|
2021-02-15 10:52:09 -03:00
|
|
|
{ fCRect, "CRect"},
|
2021-02-13 11:37:03 -03:00
|
|
|
|
2021-01-09 22:08:41 -03:00
|
|
|
{ 0, 0}
|
|
|
|
};
|
|
|
|
|
2021-03-04 18:20:29 +09:00
|
|
|
void call(const char *name, const ArgArray &args) {
|
2021-01-09 22:08:41 -03:00
|
|
|
Common::String n(name);
|
2021-02-19 18:01:52 -03:00
|
|
|
if (!g_private->_functions.contains(n)) {
|
2021-02-14 13:15:36 -03:00
|
|
|
error("I don't know how to execute %s", name);
|
2021-01-04 08:14:40 -03:00
|
|
|
}
|
2021-01-10 20:17:27 -03:00
|
|
|
|
2021-02-19 18:01:52 -03:00
|
|
|
void (*func)(ArgArray) = (void (*)(ArgArray)) g_private->_functions.getVal(n);
|
2021-01-09 22:08:41 -03:00
|
|
|
func(args);
|
2021-01-02 00:58:58 -03:00
|
|
|
}
|
|
|
|
|
2021-02-13 18:27:24 -03:00
|
|
|
} // End of namespace Private
|