2004-04-12 21:40:49 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2005-01-01 16:20:17 +00:00
|
|
|
* Copyright (C) 2004-2005 The ScummVM project
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
|
|
|
* The ReInherit Engine is (C)2000-2003 by Daniel Balsom.
|
|
|
|
*
|
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Scripting module script function component
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-02 16:20:35 +00:00
|
|
|
#include "saga/saga.h"
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-02 16:20:35 +00:00
|
|
|
#include "saga/gfx.h"
|
|
|
|
#include "saga/actor.h"
|
|
|
|
#include "saga/animation.h"
|
2004-08-10 18:31:33 +00:00
|
|
|
#include "saga/console.h"
|
2005-01-06 16:07:46 +00:00
|
|
|
#include "saga/events.h"
|
2004-12-29 16:10:53 +00:00
|
|
|
#include "saga/font.h"
|
2004-08-06 01:39:17 +00:00
|
|
|
#include "saga/interface.h"
|
2004-09-23 06:46:44 +00:00
|
|
|
#include "saga/music.h"
|
2004-11-07 14:15:41 +00:00
|
|
|
#include "saga/objectdata.h"
|
2004-12-29 16:10:53 +00:00
|
|
|
#include "saga/render.h"
|
2004-10-19 17:12:53 +00:00
|
|
|
#include "saga/sound.h"
|
|
|
|
#include "saga/sndres.h"
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-02 16:20:35 +00:00
|
|
|
#include "saga/script.h"
|
2005-01-22 19:21:38 +00:00
|
|
|
#include "saga/objectmap.h"
|
2004-08-12 23:57:45 +00:00
|
|
|
|
2004-10-27 22:17:11 +00:00
|
|
|
#include "saga/scene.h"
|
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
namespace Saga {
|
|
|
|
|
2004-12-24 11:11:01 +00:00
|
|
|
#define OPCODE(x) {&Script::x, #x}
|
2004-08-12 23:57:45 +00:00
|
|
|
|
|
|
|
void Script::setupScriptFuncList(void) {
|
2004-12-24 11:11:01 +00:00
|
|
|
static const ScriptFunctionDescription scriptFunctionsList[SCRIPT_FUNCTION_MAX] = {
|
2005-01-22 19:21:38 +00:00
|
|
|
OPCODE(sfPutString),
|
2004-12-22 21:04:50 +00:00
|
|
|
OPCODE(sfWait),
|
2005-01-22 19:21:38 +00:00
|
|
|
OPCODE(sfTakeObject),
|
|
|
|
OPCODE(sfIsCarried),
|
2005-01-02 20:29:27 +00:00
|
|
|
OPCODE(sfStatusBar),
|
2005-01-22 19:21:38 +00:00
|
|
|
OPCODE(sfMainMode),
|
2004-12-24 20:44:39 +00:00
|
|
|
OPCODE(sfScriptWalkTo),
|
2005-01-22 19:21:38 +00:00
|
|
|
OPCODE(sfScriptDoAction),
|
2004-12-22 21:04:50 +00:00
|
|
|
OPCODE(sfSetActorFacing),
|
2004-12-28 03:44:07 +00:00
|
|
|
OPCODE(sfStartBgdAnim),
|
|
|
|
OPCODE(sfStopBgdAnim),
|
2005-01-06 14:02:53 +00:00
|
|
|
OPCODE(sfLockUser),
|
2005-01-22 19:21:38 +00:00
|
|
|
OPCODE(sfPreDialog),
|
|
|
|
OPCODE(sfKillActorThreads),
|
2005-01-06 19:15:01 +00:00
|
|
|
OPCODE(sfFaceTowards),
|
2004-12-22 21:04:50 +00:00
|
|
|
OPCODE(sfSetFollower),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_gotoScene),
|
|
|
|
OPCODE(SF_setObjImage),
|
|
|
|
OPCODE(SF_setObjName),
|
2004-11-07 15:35:42 +00:00
|
|
|
OPCODE(SF_getObjImage),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_getNumber),
|
2004-12-28 21:27:18 +00:00
|
|
|
OPCODE(sfScriptOpenDoor),
|
|
|
|
OPCODE(sfScriptCloseDoor),
|
2004-12-28 03:44:07 +00:00
|
|
|
OPCODE(sfSetBgdAnimSpeed),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_cycleColors),
|
2004-12-28 21:27:18 +00:00
|
|
|
OPCODE(sfDoCenterActor),
|
2004-12-28 03:44:07 +00:00
|
|
|
OPCODE(sfStartBgdAnimSpeed),
|
2004-12-29 21:49:25 +00:00
|
|
|
OPCODE(sfScriptWalkToAsync),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_enableZone),
|
2004-12-24 10:22:01 +00:00
|
|
|
OPCODE(sfSetActorState),
|
2004-12-22 21:04:50 +00:00
|
|
|
OPCODE(scriptMoveTo),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_sceneEq),
|
|
|
|
OPCODE(SF_dropObject),
|
2004-12-28 04:09:10 +00:00
|
|
|
OPCODE(sfFinishBgdAnim),
|
2004-12-22 21:04:50 +00:00
|
|
|
OPCODE(sfSwapActors),
|
|
|
|
OPCODE(sfSimulSpeech),
|
2004-12-29 21:49:25 +00:00
|
|
|
OPCODE(sfScriptWalk),
|
2004-12-22 21:04:50 +00:00
|
|
|
OPCODE(sfCycleFrames),
|
|
|
|
OPCODE(sfSetFrame),
|
2004-12-30 18:45:48 +00:00
|
|
|
OPCODE(sfSetPortrait),
|
|
|
|
OPCODE(sfSetProtagPortrait),
|
|
|
|
OPCODE(sfChainBgdAnim),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_scriptSpecialWalk),
|
2004-12-22 21:04:50 +00:00
|
|
|
OPCODE(sfPlaceActor),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_checkUserInterrupt),
|
|
|
|
OPCODE(SF_walkRelative),
|
|
|
|
OPCODE(SF_moveRelative),
|
2004-11-12 15:32:42 +00:00
|
|
|
OPCODE(SF_simulSpeech2),
|
2004-12-30 14:54:40 +00:00
|
|
|
OPCODE(sfPlacard),
|
|
|
|
OPCODE(sfPlacardOff),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_setProtagState),
|
2004-12-28 04:09:10 +00:00
|
|
|
OPCODE(sfResumeBgdAnim),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_throwActor),
|
|
|
|
OPCODE(SF_waitWalk),
|
|
|
|
OPCODE(SF_sceneID),
|
|
|
|
OPCODE(SF_changeActorScene),
|
|
|
|
OPCODE(SF_climb),
|
2004-12-28 21:27:18 +00:00
|
|
|
OPCODE(sfSetDoorState),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_setActorZ),
|
|
|
|
OPCODE(SF_text),
|
|
|
|
OPCODE(SF_getActorX),
|
|
|
|
OPCODE(SF_getActorY),
|
|
|
|
OPCODE(SF_eraseDelta),
|
2004-12-30 18:45:48 +00:00
|
|
|
OPCODE(sfPlayMusic),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_pickClimbOutPos),
|
|
|
|
OPCODE(SF_tossRif),
|
|
|
|
OPCODE(SF_showControls),
|
|
|
|
OPCODE(SF_showMap),
|
|
|
|
OPCODE(SF_puzzleWon),
|
2004-12-30 18:45:48 +00:00
|
|
|
OPCODE(sfEnableEscape),
|
|
|
|
OPCODE(sfPlaySound),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_playLoopedSound),
|
|
|
|
OPCODE(SF_getDeltaFrame),
|
|
|
|
OPCODE(SF_showProtect),
|
|
|
|
OPCODE(SF_protectResult),
|
2004-12-30 18:45:48 +00:00
|
|
|
OPCODE(sfRand),
|
2004-11-06 22:33:08 +00:00
|
|
|
OPCODE(SF_fadeMusic),
|
|
|
|
OPCODE(SF_playVoice)
|
2004-08-12 23:57:45 +00:00
|
|
|
};
|
2004-12-22 21:04:50 +00:00
|
|
|
_scriptFunctionsList = scriptFunctionsList;
|
2004-08-12 23:57:45 +00:00
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #0 (0x00)
|
2004-11-07 15:23:00 +00:00
|
|
|
// Print a debugging message
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfPutString(SCRIPTFUNC_PARAMS) {
|
|
|
|
const char *str;
|
|
|
|
str = thread->_strings->getString(thread->pop());
|
2004-11-07 15:23:00 +00:00
|
|
|
|
2005-01-22 19:21:38 +00:00
|
|
|
_vm->_console->DebugPrintf("sfPutString: %s\n",str);
|
|
|
|
debug(0, "sfPutString: %s", str);
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #1 (0x01) blocking
|
2004-12-22 21:04:50 +00:00
|
|
|
// Param1: time in ticks
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfWait(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 time;
|
|
|
|
time = thread->pop();
|
2004-10-27 02:27:54 +00:00
|
|
|
|
|
|
|
if (!_skipSpeeches) {
|
2004-12-24 20:44:39 +00:00
|
|
|
thread->waitDelay(ticksToMSec(time)); // put thread to sleep
|
2004-10-27 02:27:54 +00:00
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #2 (0x02)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfTakeObject(SCRIPTFUNC_PARAMS) {
|
|
|
|
uint16 objectId = thread->pop();
|
|
|
|
ObjectData *obj;
|
|
|
|
obj = _vm->_actor->getObj(objectId);
|
|
|
|
if (obj->sceneNumber != ITE_SCENE_INV) {
|
|
|
|
obj->sceneNumber = ITE_SCENE_INV;
|
|
|
|
//_vm->_interface->addToInventory(index); TODO: do it
|
2004-11-07 15:11:04 +00:00
|
|
|
}
|
2004-09-25 10:11:17 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #3 (0x03)
|
2004-11-01 10:49:21 +00:00
|
|
|
// Check if an object is carried.
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfIsCarried(SCRIPTFUNC_PARAMS) {
|
|
|
|
uint16 objectId = thread->pop();
|
|
|
|
ObjectData *obj;
|
|
|
|
obj = _vm->_actor->getObj(objectId);
|
2004-10-03 17:11:23 +00:00
|
|
|
|
2005-01-22 19:21:38 +00:00
|
|
|
thread->_returnValue = (obj->sceneNumber == ITE_SCENE_INV) ? 1 : 0;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #4 (0x04) nonblocking
|
|
|
|
// Set the command display to the specified text string
|
|
|
|
// Param1: dialogue index of string
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfStatusBar(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 stringIndex = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-22 19:21:38 +00:00
|
|
|
_vm->_interface->setStatusText(thread->_strings->getString(stringIndex));
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #5 (0x05)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfMainMode(SCRIPTFUNC_PARAMS) {
|
|
|
|
_vm->_actor->_centerActor = _vm->_actor->_protagonist;
|
|
|
|
showVerb();
|
2005-01-06 14:02:53 +00:00
|
|
|
_vm->_interface->activate();
|
2005-01-06 14:49:47 +00:00
|
|
|
_vm->_interface->setMode(kPanelInventory);
|
2005-01-22 19:21:38 +00:00
|
|
|
setPointerVerb();
|
2004-09-25 10:11:17 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #6 (0x06) blocking
|
|
|
|
// Param1: actor id
|
2004-12-24 20:44:39 +00:00
|
|
|
// Param2: actor x
|
|
|
|
// Param3: actor y
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfScriptWalkTo(SCRIPTFUNC_PARAMS) {
|
|
|
|
uint16 actorId;
|
2005-01-15 20:12:49 +00:00
|
|
|
Location actorLocation;
|
2004-12-24 20:44:39 +00:00
|
|
|
ActorData *actor;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId = thread->pop();
|
|
|
|
actorLocation.x = thread->pop();
|
|
|
|
actorLocation.y = thread->pop();
|
2004-12-24 20:44:39 +00:00
|
|
|
|
|
|
|
actor = _vm->_actor->getActor(actorId);
|
|
|
|
actorLocation.z = actor->location.z;
|
|
|
|
|
|
|
|
actor->flags &= ~kFollower;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-24 20:44:39 +00:00
|
|
|
if (_vm->_actor->actorWalkTo(actorId, actorLocation)) {
|
|
|
|
thread->waitWalk(actor);
|
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #7 (0x07)
|
2005-01-22 19:21:38 +00:00
|
|
|
// Param1: actor id
|
|
|
|
// Param2: action
|
|
|
|
// Param3: theObject
|
|
|
|
// Param4: withObject
|
|
|
|
void Script::sfScriptDoAction(SCRIPTFUNC_PARAMS) {
|
|
|
|
uint16 objectId;
|
|
|
|
uint16 action;
|
|
|
|
uint16 theObject;
|
|
|
|
uint16 withObject;
|
|
|
|
int16 scriptEntryPointNumber;
|
|
|
|
int16 moduleNumber;
|
|
|
|
ActorData *actor;
|
|
|
|
ObjectData *obj;
|
|
|
|
const HitZone *hitZone;
|
|
|
|
EVENT event;
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2005-01-22 19:21:38 +00:00
|
|
|
objectId = thread->pop();
|
|
|
|
action = thread->pop();
|
|
|
|
theObject = thread->pop();
|
|
|
|
withObject = thread->pop();
|
|
|
|
|
|
|
|
switch (objectTypeId(objectId)) {
|
|
|
|
case kGameObjectObject:
|
|
|
|
obj = _vm->_actor->getObj(objectId);
|
|
|
|
scriptEntryPointNumber = obj->scriptEntrypointNumber;
|
|
|
|
if (scriptEntryPointNumber <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
moduleNumber = 0;
|
|
|
|
break;
|
|
|
|
case kGameObjectActor:
|
|
|
|
actor = _vm->_actor->getActor(objectId);
|
|
|
|
scriptEntryPointNumber = actor->scriptEntrypointNumber;
|
|
|
|
if (scriptEntryPointNumber <= 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (actor->flags & (kProtagonist | kFollower)) {
|
|
|
|
moduleNumber = 0;
|
|
|
|
} else {
|
|
|
|
moduleNumber = _vm->_scene->getScriptModuleNumber();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case kGameObjectHitZone:
|
|
|
|
case kGameObjectStepZone:
|
|
|
|
if (objectTypeId(objectId) == kGameObjectHitZone) {
|
|
|
|
hitZone = _vm->_scene->_objectMap->getHitZone(objectIdToIndex(objectId));
|
|
|
|
} else {
|
|
|
|
hitZone = _vm->_scene->_actionMap->getHitZone(objectIdToIndex(objectId));
|
|
|
|
}
|
|
|
|
scriptEntryPointNumber = hitZone->getScriptNumber();
|
|
|
|
moduleNumber = _vm->_scene->getScriptModuleNumber();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
error("Script::sfScriptDoAction wrong object type");
|
|
|
|
}
|
2004-11-12 15:19:32 +00:00
|
|
|
|
2005-01-22 19:21:38 +00:00
|
|
|
event.type = ONESHOT_EVENT;
|
|
|
|
event.code = SCRIPT_EVENT;
|
|
|
|
event.op = EVENT_EXEC_NONBLOCKING;
|
|
|
|
event.time = 0;
|
|
|
|
event.param = moduleNumber;
|
|
|
|
event.param2 = scriptEntryPointNumber;
|
|
|
|
event.param3 = action; // Action
|
|
|
|
event.param4 = theObject; // Object
|
|
|
|
event.param5 = theObject; // With Object
|
|
|
|
event.param6 = objectId;
|
|
|
|
|
|
|
|
_vm->_events->queue(&event);
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #8 (0x08) nonblocking
|
|
|
|
// Param1: actor id
|
|
|
|
// Param2: actor orientation
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfSetActorFacing(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 actorId;
|
2004-12-22 21:04:50 +00:00
|
|
|
int actorDirection;
|
|
|
|
ActorData *actor;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId = thread->pop();
|
|
|
|
actorDirection = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
actor = _vm->_actor->getActor(actorId);
|
|
|
|
actor->facingDirection = actor->actionDirection = actorDirection;
|
2004-12-24 10:22:01 +00:00
|
|
|
actor->targetObject = ID_NOTHING;
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #9 (0x09)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfStartBgdAnim(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 animId = thread->pop();
|
|
|
|
int16 cycles = thread->pop();
|
2004-12-28 03:44:07 +00:00
|
|
|
|
|
|
|
_vm->_anim->setCycles(animId, cycles);
|
|
|
|
_vm->_anim->play(animId, kRepeatSpeed);
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2004-12-28 03:44:07 +00:00
|
|
|
debug(1, "sfStartBgdAnim(%d, %d)", animId, cycles);
|
2004-09-25 10:11:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #10 (0x0A)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfStopBgdAnim(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 animId = thread->pop();
|
2004-12-28 03:44:07 +00:00
|
|
|
|
|
|
|
_vm->_anim->stop(animId);
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2004-12-28 03:44:07 +00:00
|
|
|
debug(1, "sfStopBgdAnim(%d)", animId);
|
2004-09-25 10:11:17 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #11 (0x0B) nonblocking
|
|
|
|
// If the parameter is true, the user interface is disabled while script
|
|
|
|
// continues to run. If the parameter is false, the user interface is
|
|
|
|
// reenabled.
|
|
|
|
// Param1: boolean
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfLockUser(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 lock;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
lock = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
if (lock) {
|
2004-08-06 01:39:17 +00:00
|
|
|
_vm->_interface->deactivate();
|
2004-04-12 21:40:49 +00:00
|
|
|
} else {
|
2004-08-06 01:39:17 +00:00
|
|
|
_vm->_interface->activate();
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #12 (0x0C)
|
|
|
|
// Disables mouse input, etc.
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfPreDialog(SCRIPTFUNC_PARAMS) {
|
2005-01-06 14:02:53 +00:00
|
|
|
_vm->_interface->deactivate();
|
|
|
|
; // clear converse text
|
|
|
|
if (_vm->_interface->isInMainMode())
|
|
|
|
_vm->_interface->setMode(kPanelConverse);
|
|
|
|
else
|
|
|
|
; // display zero text
|
|
|
|
_vm->_interface->setMode(kPanelNull);
|
|
|
|
|
|
|
|
debug(1, "stub: SF_preDialog()");
|
2004-09-25 10:11:17 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #13 (0x0D)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfKillActorThreads(SCRIPTFUNC_PARAMS) {
|
|
|
|
ScriptThread *anotherThread;
|
|
|
|
ScriptThreadList::iterator threadIterator;
|
|
|
|
int16 actorId;
|
|
|
|
|
|
|
|
actorId = thread->pop();
|
2004-11-06 22:33:08 +00:00
|
|
|
|
2005-01-22 19:21:38 +00:00
|
|
|
|
|
|
|
for (threadIterator = _threadList.begin(); threadIterator != _threadList.end(); ++threadIterator) {
|
|
|
|
anotherThread = threadIterator.operator->();
|
|
|
|
if ((anotherThread != thread) && (anotherThread->_threadVars[kThreadVarActor] == actorId)) {
|
|
|
|
thread->_flags &= ~kTFlagWaiting;
|
|
|
|
thread->_flags |= kTFlagAborted;
|
|
|
|
}
|
|
|
|
}
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #14 (0x0E)
|
2005-01-06 19:15:01 +00:00
|
|
|
// Param1: actor id
|
|
|
|
// Param2: object id
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfFaceTowards(SCRIPTFUNC_PARAMS) {
|
2005-01-06 19:15:01 +00:00
|
|
|
int16 actorId;
|
|
|
|
int16 targetObject;
|
|
|
|
ActorData *actor;
|
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId = thread->pop();
|
|
|
|
targetObject = thread->pop();
|
2005-01-06 19:15:01 +00:00
|
|
|
|
|
|
|
actor = _vm->_actor->getActor(actorId);
|
|
|
|
actor->targetObject = targetObject;
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #15 (0x0F)
|
2004-12-22 21:04:50 +00:00
|
|
|
// Param1: actor id
|
|
|
|
// Param2: target object
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfSetFollower(SCRIPTFUNC_PARAMS) {
|
2004-12-30 18:45:48 +00:00
|
|
|
int16 actorId;
|
|
|
|
int16 targetObject;
|
2004-12-22 21:04:50 +00:00
|
|
|
|
|
|
|
ActorData *actor;
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId = thread->pop();
|
|
|
|
targetObject = thread->pop();
|
2004-12-30 18:45:48 +00:00
|
|
|
|
2005-01-08 20:30:07 +00:00
|
|
|
debug(1, "sfSetFollower(%d, %d) [%d]", actorId, targetObject, _vm->_actor->actorIdToIndex(actorId));
|
2004-12-22 21:04:50 +00:00
|
|
|
|
|
|
|
actor = _vm->_actor->getActor(actorId);
|
|
|
|
actor->targetObject = targetObject;
|
|
|
|
if (targetObject != ID_NOTHING) {
|
|
|
|
actor->flags |= kFollower;
|
|
|
|
actor->actorFlags &= ~kActorNoFollow;
|
|
|
|
} else {
|
|
|
|
actor->flags &= ~kFollower;
|
|
|
|
}
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2005-01-07 00:57:43 +00:00
|
|
|
static struct SceneSubstitutes {
|
|
|
|
int sceneId;
|
|
|
|
const char *message;
|
|
|
|
const char *name;
|
|
|
|
const char *image;
|
|
|
|
} sceneSubstitutes[] = {
|
|
|
|
{
|
|
|
|
7,
|
|
|
|
"Tycho says he knows much about the northern lands. Can Rif convince "
|
|
|
|
"the Dog to share this knowledge?",
|
|
|
|
"The Home of Tycho Northpaw",
|
|
|
|
"tycho.bbm"
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
27,
|
|
|
|
"The scene of the crime may hold many clues, but will the servants of "
|
|
|
|
"the Sanctuary trust Rif?",
|
|
|
|
"The Sanctuary of the Orb",
|
|
|
|
"sanctuar.bbm"
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
5,
|
|
|
|
"The Rats hold many secrets that could guide Rif on his quest -- assuming "
|
|
|
|
"he can get past the doorkeeper.",
|
|
|
|
"The Rat Complex",
|
|
|
|
"ratdoor.bbm"
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
2,
|
|
|
|
"The Ferrets enjoy making things and have the materials to do so. How can "
|
|
|
|
"that help Rif?",
|
|
|
|
"The Ferret Village",
|
|
|
|
"ferrets.bbm"
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
67,
|
|
|
|
"What aid can the noble King of the Elks provide to Rif and his companions?",
|
|
|
|
"The Realm of the Forest King",
|
|
|
|
"elkenter.bbm"
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
3,
|
|
|
|
"The King holds Rif's sweetheart hostage. Will the Boar provide any "
|
|
|
|
"assistance to Rif?",
|
|
|
|
"The Great Hall of the Boar King",
|
|
|
|
"boarhall.bbm"
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2004-10-27 02:27:54 +00:00
|
|
|
// Script function #16 (0x10)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_gotoScene(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 sceneNum = thread->pop();
|
|
|
|
int16 entrance = thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2005-01-07 00:57:43 +00:00
|
|
|
for (int i = 0; i < ARRAYSIZE(sceneSubstitutes); i++)
|
|
|
|
if (sceneSubstitutes[i].sceneId == sceneNum)
|
|
|
|
debug(0, "Scene %d substitute exists", sceneNum);
|
|
|
|
|
|
|
|
debug(1, "stub: SF_gotoScene(%d, %d)", sceneNum, entrance);
|
2004-10-27 02:27:54 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #17 (0x11)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_setObjImage(SCRIPTFUNC_PARAMS) {
|
2005-01-18 21:13:44 +00:00
|
|
|
error("Not implemented");
|
|
|
|
/* int16 obj_param = getSWord(thread->pop());
|
2005-01-07 00:57:43 +00:00
|
|
|
int16 sprite_param = getSWord(thread->pop());
|
2004-11-07 15:28:20 +00:00
|
|
|
|
2005-01-18 21:13:44 +00:00
|
|
|
|
2004-11-07 15:28:20 +00:00
|
|
|
int index = obj_param & 0x1FFF;
|
|
|
|
|
|
|
|
if (index >= ARRAYSIZE(ObjectTable)) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectTable[index].spritelistRn = sprite_param + 9;
|
|
|
|
_vm->_interface->draw();
|
2005-01-18 21:13:44 +00:00
|
|
|
*/
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #18 (0x12)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_setObjName(SCRIPTFUNC_PARAMS) {
|
2005-01-18 21:13:44 +00:00
|
|
|
error("Not implemented");
|
|
|
|
|
|
|
|
/* int obj_param = getSWord(thread->pop());
|
2005-01-07 00:57:43 +00:00
|
|
|
int name_param = getSWord(thread->pop());
|
2004-11-07 15:35:42 +00:00
|
|
|
|
|
|
|
int index = obj_param & 0x1FFF;
|
|
|
|
|
|
|
|
if (index >= ARRAYSIZE(ObjectTable)) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
2004-11-06 22:33:08 +00:00
|
|
|
|
2005-01-18 21:13:44 +00:00
|
|
|
ObjectTable[index].nameIndex = name_param;*/
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #19 (0x13)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_getObjImage(SCRIPTFUNC_PARAMS) {
|
2005-01-18 21:13:44 +00:00
|
|
|
error("Not implemented");
|
|
|
|
|
|
|
|
/* int param = getSWord(thread->pop());
|
2004-11-07 15:35:42 +00:00
|
|
|
int index = param & 0x1FFF;
|
|
|
|
|
|
|
|
if (index >= ARRAYSIZE(ObjectTable)) {
|
|
|
|
thread->retVal = 0;
|
|
|
|
return FAILURE;
|
|
|
|
}
|
2004-11-06 22:33:08 +00:00
|
|
|
|
2005-01-18 21:13:44 +00:00
|
|
|
thread->retVal = ObjectTable[index].spritelistRn;*/
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #20 (0x14)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_getNumber(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_getNumber(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #21 (0x15)
|
2004-12-28 21:27:18 +00:00
|
|
|
// Param1: door #
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfScriptOpenDoor(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 doorNumber;
|
|
|
|
doorNumber = thread->pop();
|
2004-11-06 22:33:08 +00:00
|
|
|
|
2005-01-07 22:18:53 +00:00
|
|
|
if (_vm->_scene->getFlags() & kSceneFlagISO) {
|
2004-12-28 21:27:18 +00:00
|
|
|
//todo: it
|
|
|
|
} else {
|
|
|
|
_vm->_scene->setDoorState(doorNumber, 0);
|
|
|
|
}
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #22 (0x16)
|
2004-12-28 21:27:18 +00:00
|
|
|
// Param1: door #
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfScriptCloseDoor(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 doorNumber;
|
|
|
|
doorNumber = thread->pop();
|
2004-11-06 22:33:08 +00:00
|
|
|
|
2005-01-07 22:18:53 +00:00
|
|
|
if (_vm->_scene->getFlags() & kSceneFlagISO) {
|
2004-12-28 21:27:18 +00:00
|
|
|
//todo: it
|
|
|
|
} else {
|
|
|
|
_vm->_scene->setDoorState(doorNumber, 0xff);
|
|
|
|
}
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #23 (0x17)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfSetBgdAnimSpeed(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 animId = thread->pop();
|
|
|
|
int16 speed = thread->pop();
|
2004-12-28 03:44:07 +00:00
|
|
|
|
|
|
|
_vm->_anim->setFrameTime(animId, ticksToMSec(speed));
|
|
|
|
debug(1, "sfSetBgdAnimSpeed(%d, %d)", animId, speed);
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #24 (0x18)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_cycleColors(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_cycleColors(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #25 (0x19)
|
2004-12-28 21:27:18 +00:00
|
|
|
// Param1: actor id
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfDoCenterActor(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 actorId;
|
|
|
|
actorId = thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2004-12-28 21:27:18 +00:00
|
|
|
_vm->_actor->_centerActor = _vm->_actor->getActor(actorId);
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #26 (0x1A) nonblocking
|
|
|
|
// Starts the specified animation
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfStartBgdAnimSpeed(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 animId = thread->pop();
|
|
|
|
int16 cycles = thread->pop();
|
|
|
|
int16 speed = thread->pop();
|
2004-12-28 03:44:07 +00:00
|
|
|
|
|
|
|
_vm->_anim->setCycles(animId, cycles);
|
|
|
|
_vm->_anim->play(animId, ticksToMSec(speed));
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-28 03:44:07 +00:00
|
|
|
debug(1, "sfStartBgdAnimSpeed(%d, %d, %d)", animId, cycles, speed);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #27 (0x1B) nonblocking
|
|
|
|
// Param1: actor id
|
2004-12-29 21:49:25 +00:00
|
|
|
// Param2: actor x
|
|
|
|
// Param3: actor y
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfScriptWalkToAsync(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 actorId;
|
2005-01-15 20:12:49 +00:00
|
|
|
Location actorLocation;
|
2004-12-29 21:49:25 +00:00
|
|
|
ActorData *actor;
|
2004-12-17 11:18:56 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId = thread->pop();
|
|
|
|
actorLocation.x = thread->pop();
|
|
|
|
actorLocation.y = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-29 21:49:25 +00:00
|
|
|
actor = _vm->_actor->getActor(actorId);
|
|
|
|
actorLocation.z = actor->location.z;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-29 21:49:25 +00:00
|
|
|
actor->flags &= ~kFollower;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-29 21:49:25 +00:00
|
|
|
_vm->_actor->actorWalkTo(actorId, actorLocation);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #28 (0x1C)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_enableZone(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_enableZone(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #29 (0x1D)
|
2004-12-24 10:22:01 +00:00
|
|
|
// Param1: actor id
|
|
|
|
// Param2: current action
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfSetActorState(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 actorId;
|
2004-12-24 10:22:01 +00:00
|
|
|
int currentAction;
|
|
|
|
ActorData *actor;
|
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId = thread->pop();
|
|
|
|
currentAction = thread->pop();
|
2004-12-24 10:22:01 +00:00
|
|
|
|
|
|
|
actor = _vm->_actor->getActor(actorId);
|
|
|
|
|
|
|
|
if ((currentAction >= kActionWalkToPoint) && (currentAction <= kActionWalkToPoint)) {
|
|
|
|
wakeUpActorThread(kWaitTypeWalk, actor);
|
|
|
|
}
|
|
|
|
actor->currentAction = currentAction;
|
|
|
|
actor->actorFlags &= ~kActorBackwards;
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #30 (0x1E) nonblocking
|
|
|
|
// Param1: actor id
|
|
|
|
// Param2: actor pos x
|
|
|
|
// Param3: actor pos y
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::scriptMoveTo(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 actorId;
|
2005-01-15 20:12:49 +00:00
|
|
|
Location actorLocation;
|
2004-12-22 21:04:50 +00:00
|
|
|
ActorData *actor;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId = thread->pop();
|
|
|
|
actorLocation.x = thread->pop();
|
|
|
|
actorLocation.y = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
actor = _vm->_actor->getActor(actorId);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
actor->location.x = actorLocation.x;
|
|
|
|
actor->location.y = actorLocation.y;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-10-27 22:17:11 +00:00
|
|
|
// Script function #31 (0x21)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_sceneEq(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 param = thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
|
|
|
if (_vm->_scene->getSceneLUT(param) == _vm->_scene->currentSceneNumber())
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->_returnValue = 1;
|
2004-10-27 22:17:11 +00:00
|
|
|
else
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->_returnValue = 0;
|
2004-10-27 22:17:11 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #32 (0x20)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_dropObject(SCRIPTFUNC_PARAMS) {
|
2005-01-18 21:13:44 +00:00
|
|
|
error("Not implemented");
|
|
|
|
|
|
|
|
/* ScriptDataWord obj_param = thread->pop();
|
2004-12-22 21:04:50 +00:00
|
|
|
ScriptDataWord sprite_param = thread->pop();
|
|
|
|
ScriptDataWord x_param = thread->pop();
|
|
|
|
ScriptDataWord y_param = thread->pop();
|
2004-11-07 15:11:04 +00:00
|
|
|
|
|
|
|
int index = obj_param & 0x1FFF;
|
|
|
|
|
|
|
|
if (index >= ARRAYSIZE(ObjectTable)) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ObjectTable[index].sceneIndex == -1) {
|
|
|
|
_vm->_interface->removeFromInventory(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectTable[index].sceneIndex = _vm->_scene->currentSceneNumber();
|
|
|
|
ObjectTable[index].spritelistRn = 9 + sprite_param;
|
|
|
|
ObjectTable[index].x = x_param;
|
|
|
|
ObjectTable[index].y = y_param;
|
2005-01-18 21:13:44 +00:00
|
|
|
*/
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #33 (0x21)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfFinishBgdAnim(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 animId = thread->pop();
|
2004-12-28 04:09:10 +00:00
|
|
|
|
|
|
|
_vm->_anim->finish(animId);
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2004-12-28 04:09:10 +00:00
|
|
|
debug(1, "sfFinishBgdAnim(%d)", animId);
|
2004-09-25 10:11:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #34 (0x22)
|
2004-12-22 21:04:50 +00:00
|
|
|
// Param1: actor id 1
|
|
|
|
// Param2: actor id 2
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfSwapActors(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 actorId1;
|
|
|
|
int16 actorId2;
|
2004-12-22 21:04:50 +00:00
|
|
|
ActorData *actor1;
|
|
|
|
ActorData *actor2;
|
2005-01-15 20:12:49 +00:00
|
|
|
Location location;
|
2004-12-22 21:04:50 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId1 = thread->pop();
|
|
|
|
actorId2 = thread->pop();
|
2004-12-22 21:04:50 +00:00
|
|
|
|
|
|
|
actor1 = _vm->_actor->getActor(actorId1);
|
|
|
|
actor2 = _vm->_actor->getActor(actorId2);
|
|
|
|
location = actor1->location;
|
|
|
|
actor1->location = actor2->location;
|
|
|
|
actor2->location = location;
|
|
|
|
|
|
|
|
|
|
|
|
if (actor1->flags & kProtagonist) {
|
|
|
|
actor1->flags &= ~kProtagonist;
|
|
|
|
actor2->flags |= kProtagonist;
|
|
|
|
_vm->_actor->_protagonist = _vm->_actor->_centerActor = actor2;
|
|
|
|
} else {
|
|
|
|
if (actor2->flags & kProtagonist) {
|
|
|
|
actor2->flags &= ~kProtagonist;
|
|
|
|
actor1->flags |= kProtagonist;
|
|
|
|
_vm->_actor->_protagonist = _vm->_actor->_centerActor = actor1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #35 (0x23)
|
2004-12-22 21:04:50 +00:00
|
|
|
// Param1: string rid
|
|
|
|
// Param2: actorscount
|
|
|
|
// Param3: actor id1
|
|
|
|
///....
|
|
|
|
// Param3: actor idN
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfSimulSpeech(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 stringId;
|
|
|
|
int16 actorsCount;
|
2004-12-22 21:04:50 +00:00
|
|
|
int i;
|
|
|
|
uint16 actorsIds[ACTOR_SPEECH_ACTORS_MAX];
|
|
|
|
const char *string;
|
|
|
|
|
|
|
|
stringId = thread->pop();
|
2005-01-21 21:55:54 +00:00
|
|
|
actorsCount = thread->pop();
|
2004-12-22 21:04:50 +00:00
|
|
|
|
|
|
|
if (actorsCount > ACTOR_SPEECH_ACTORS_MAX)
|
|
|
|
error("sfSimulSpeech actorsCount=0x%X exceed ACTOR_SPEECH_ACTORS_MAX", actorsCount);
|
|
|
|
|
|
|
|
for (i = 0; i < actorsCount; i++)
|
2005-01-21 21:55:54 +00:00
|
|
|
actorsIds[i] = thread->pop();
|
2004-12-22 21:04:50 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
string = thread->_strings->getString(stringId);
|
2004-11-06 22:33:08 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
_vm->_actor->simulSpeech(string, actorsIds, actorsCount, 0);
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #36 (0x24) ?
|
|
|
|
// Param1: actor id
|
2004-12-29 21:49:25 +00:00
|
|
|
// Param2: actor x
|
|
|
|
// Param3: actor y
|
|
|
|
// Param4: actor walk flag
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfScriptWalk(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 actorId;
|
2005-01-15 20:12:49 +00:00
|
|
|
Location actorLocation;
|
2004-12-29 21:49:25 +00:00
|
|
|
ActorData *actor;
|
|
|
|
uint16 walkFlags;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId = thread->pop();
|
|
|
|
actorLocation.x = thread->pop();
|
|
|
|
actorLocation.y = thread->pop();
|
|
|
|
walkFlags = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-29 21:49:25 +00:00
|
|
|
actor = _vm->_actor->getActor(actorId);
|
|
|
|
actorLocation.z = actor->location.z;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-29 21:49:25 +00:00
|
|
|
_vm->_actor->realLocation(actorLocation, ID_NOTHING, walkFlags);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-29 21:49:25 +00:00
|
|
|
actor->flags &= ~kFollower;
|
|
|
|
|
|
|
|
if (_vm->_actor->actorWalkTo(actorId, actorLocation) && !(walkFlags & kWalkAsync)) {
|
|
|
|
thread->waitWalk(actor);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (walkFlags & kWalkBackPedal) {
|
|
|
|
actor->actorFlags |= kActorBackwards;
|
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-29 21:49:25 +00:00
|
|
|
actor->actorFlags = (actor->actorFlags & ~kActorFacingMask) | (walkFlags & kActorFacingMask);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #37 (0x25) nonblocking
|
|
|
|
// Param1: actor id
|
2004-11-01 10:49:21 +00:00
|
|
|
// Param2: flags telling how to cycle the frames
|
2004-12-22 21:04:50 +00:00
|
|
|
// Param3: cycle frame number
|
|
|
|
// Param4: cycle delay
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfCycleFrames(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 actorId;
|
2004-12-22 21:04:50 +00:00
|
|
|
int flags;
|
2004-12-25 11:17:03 +00:00
|
|
|
int cycleFrameSequence;
|
2004-12-22 21:04:50 +00:00
|
|
|
int cycleDelay;
|
|
|
|
ActorData *actor;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId = thread->pop();
|
|
|
|
flags = thread->pop();
|
|
|
|
cycleFrameSequence = thread->pop();
|
|
|
|
cycleDelay = thread->pop();
|
2004-12-22 21:04:50 +00:00
|
|
|
|
|
|
|
actor = _vm->_actor->getActor(actorId);
|
|
|
|
|
|
|
|
if (flags & kCyclePong) {
|
|
|
|
actor->currentAction = kActionPongFrames;
|
|
|
|
} else {
|
|
|
|
actor->currentAction = kActionCycleFrames;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor->actorFlags &= ~(kActorContinuous | kActorRandom | kActorBackwards);
|
|
|
|
|
|
|
|
if (!(flags & kCycleOnce)) {
|
|
|
|
actor->actorFlags |= kActorContinuous;
|
|
|
|
}
|
|
|
|
if (flags & kCycleRandom) {
|
|
|
|
actor->actorFlags |= kActorRandom;
|
|
|
|
}
|
|
|
|
if (flags & kCycleReverse) {
|
|
|
|
actor->actorFlags |= kActorBackwards;
|
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-25 11:17:03 +00:00
|
|
|
actor->cycleFrameSequence = cycleFrameSequence;
|
2004-12-22 21:04:50 +00:00
|
|
|
actor->cycleTimeCount = 0;
|
|
|
|
actor->cycleDelay = cycleDelay;
|
|
|
|
actor->actionCycle = 0;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #38 (0x26) nonblocking
|
|
|
|
// Param1: actor id
|
2004-12-22 21:04:50 +00:00
|
|
|
// Param2: frame type
|
|
|
|
// Param3: frame offset
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfSetFrame(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 actorId;
|
2004-12-22 21:04:50 +00:00
|
|
|
int frameType;
|
|
|
|
int frameOffset;
|
|
|
|
ActorData *actor;
|
|
|
|
ActorFrameRange *frameRange;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId = thread->pop();
|
|
|
|
frameType = thread->pop();
|
|
|
|
frameOffset = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
actor = _vm->_actor->getActor(actorId);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
frameRange = _vm->_actor->getActorFrameRange(actorId, frameType);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-24 10:22:01 +00:00
|
|
|
if (frameRange->frameCount <= frameOffset) {
|
|
|
|
// frameRange = _vm->_actor->getActorFrameRange(actorId, frameType);
|
|
|
|
|
2004-12-24 14:21:47 +00:00
|
|
|
error("Wrong frameOffset 0x%X", frameOffset);
|
2004-12-24 10:22:01 +00:00
|
|
|
}
|
2004-12-22 21:04:50 +00:00
|
|
|
actor->frameNumber = frameRange->frameIndex + frameOffset;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
if (actor->currentAction != kActionFall) {
|
|
|
|
actor->currentAction = kActionFreeze;
|
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #39 (0x27)
|
|
|
|
// Sets the right-hand portrait
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfSetPortrait(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 param = thread->pop();
|
2004-10-21 06:49:11 +00:00
|
|
|
|
2005-01-22 19:21:38 +00:00
|
|
|
_vm->_interface->setRightPortrait(param);
|
2004-09-25 10:11:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #40 (0x28)
|
|
|
|
// Sets the left-hand portrait
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfSetProtagPortrait(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 param = thread->pop();
|
2004-10-21 06:49:11 +00:00
|
|
|
|
2005-01-22 19:21:38 +00:00
|
|
|
_vm->_interface->setLeftPortrait(param);
|
2004-09-25 10:11:17 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #41 (0x29) nonblocking
|
|
|
|
// Links the specified animations for playback
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Param1: ?
|
|
|
|
// Param2: total linked frame count
|
|
|
|
// Param3: animation id link target
|
|
|
|
// Param4: animation id link source
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfChainBgdAnim(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 animId1 = thread->pop();
|
|
|
|
int16 animId = thread->pop();
|
|
|
|
int16 cycles = thread->pop();
|
|
|
|
int16 speed = thread->pop();
|
2004-12-30 18:45:48 +00:00
|
|
|
|
|
|
|
if (speed >= 0) {
|
|
|
|
_vm->_anim->setCycles(animId, cycles);
|
|
|
|
_vm->_anim->stop(animId);
|
|
|
|
_vm->_anim->setFrameTime(animId, ticksToMSec(speed));
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-12-30 18:45:48 +00:00
|
|
|
_vm->_anim->link(animId1, animId);
|
|
|
|
debug(1, "sfChainBgdAnim(%d, %d, %d, %d)", animId1, animId, cycles, speed);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #42 (0x2A)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_scriptSpecialWalk(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
//debug(1, "stub: SF_scriptSpecialWalk(%d, %d, %d, %d)", param1, param2, param3, param4);
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #43 (0x2B) nonblocking
|
|
|
|
// Param1: actor id
|
2004-12-22 21:04:50 +00:00
|
|
|
// Param2: actor x
|
|
|
|
// Param3: actor y
|
|
|
|
// Param4: actor direction
|
2004-05-01 14:34:00 +00:00
|
|
|
// Param5: actor action
|
2004-12-22 21:04:50 +00:00
|
|
|
// Param6: actor frame number
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfPlaceActor(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 actorId;
|
2005-01-15 20:12:49 +00:00
|
|
|
Location actorLocation;
|
2004-12-22 21:04:50 +00:00
|
|
|
int actorDirection;
|
|
|
|
int frameType;
|
|
|
|
int frameOffset;
|
|
|
|
ActorData *actor;
|
|
|
|
ActorFrameRange *frameRange;
|
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
actorId = thread->pop();
|
|
|
|
actorLocation.x = thread->pop();
|
|
|
|
actorLocation.y = thread->pop();
|
|
|
|
actorDirection = thread->pop();
|
|
|
|
frameType = thread->pop();
|
|
|
|
frameOffset = thread->pop();
|
2005-01-02 20:29:27 +00:00
|
|
|
|
|
|
|
debug(1, "sfPlaceActor(%d, %d, %d, %d, %d, %d)", actorId, actorLocation.x,
|
|
|
|
actorLocation.y, actorDirection, frameType, frameOffset);
|
|
|
|
|
2005-01-17 07:21:08 +00:00
|
|
|
if (_vm->getGameType() == GType_IHNM) {
|
|
|
|
warning("Actors aren't implemented for IHNM yet");
|
2005-01-22 19:21:38 +00:00
|
|
|
return;
|
2005-01-17 07:21:08 +00:00
|
|
|
}
|
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
actor = _vm->_actor->getActor(actorId);
|
|
|
|
actor->location.x = actorLocation.x;
|
|
|
|
actor->location.y = actorLocation.y;
|
|
|
|
actor->facingDirection = actor->actionDirection = actorDirection;
|
2004-12-24 10:22:01 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
if (frameType >= 0) {
|
|
|
|
frameRange = _vm->_actor->getActorFrameRange(actorId, frameType);
|
|
|
|
|
|
|
|
if (frameRange->frameCount <= frameOffset)
|
|
|
|
error("Wrong frameOffset 0x%X", frameOffset);
|
2004-12-17 11:18:56 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
actor->frameNumber = frameRange->frameIndex + frameOffset;
|
|
|
|
actor->currentAction = kActionFreeze;
|
|
|
|
} else {
|
|
|
|
actor->currentAction = kActionWait;
|
|
|
|
}
|
2004-12-17 20:38:17 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
actor->targetObject = ID_NOTHING;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #44 (0x2C) nonblocking
|
|
|
|
// Checks to see if the user has interrupted a currently playing
|
|
|
|
// game cinematic. Pushes a zero or positive value if the game
|
|
|
|
// has not been interrupted.
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_checkUserInterrupt(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->_returnValue = (_skipSpeeches == true);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #45 (0x2D)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_walkRelative(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
//debug(1, "stub: SF_walkRelative(%d, %d, %d, %d, %d)", param1, param2, param3, param4, param5);
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #46 (0x2E)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_moveRelative(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
//debug(1, "stub: SF_moveRelative(%d, %d, %d, %d, %d)", param1, param2, param3, param4, param5);
|
2004-10-27 22:17:11 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #47 (0x2F)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_simulSpeech2(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
2004-11-12 15:32:42 +00:00
|
|
|
debug(1, "stub: SF_simulSpeech2(), %d args", nArgs);
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
2005-01-06 16:07:46 +00:00
|
|
|
static TEXTLIST_ENTRY *placardTextEntry;
|
|
|
|
|
2004-10-27 22:17:11 +00:00
|
|
|
// Script function #48 (0x30)
|
2005-01-03 21:17:32 +00:00
|
|
|
// Param1: string rid
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfPlacard(SCRIPTFUNC_PARAMS) {
|
2005-01-03 21:17:32 +00:00
|
|
|
int stringId;
|
2004-12-29 16:10:53 +00:00
|
|
|
SURFACE *back_buf = _vm->_gfx->getBackBuffer();
|
2005-01-06 16:07:46 +00:00
|
|
|
static PALENTRY cur_pal[PAL_ENTRIES];
|
2004-12-29 16:10:53 +00:00
|
|
|
PALENTRY *pal;
|
2005-01-06 16:07:46 +00:00
|
|
|
EVENT event;
|
|
|
|
EVENT *q_event;
|
2005-01-06 19:15:01 +00:00
|
|
|
|
2005-01-06 16:07:46 +00:00
|
|
|
thread->wait(kWaitTypePlacard);
|
|
|
|
|
|
|
|
_vm->_interface->rememberMode();
|
|
|
|
_vm->_interface->setMode(kPanelPlacard);
|
2004-12-29 16:10:53 +00:00
|
|
|
|
2005-01-06 16:07:46 +00:00
|
|
|
stringId = thread->pop();
|
|
|
|
|
|
|
|
event.type = ONESHOT_EVENT;
|
|
|
|
event.code = CURSOR_EVENT;
|
|
|
|
event.op = EVENT_HIDE;
|
|
|
|
|
|
|
|
q_event = _vm->_events->queue(&event);
|
|
|
|
|
2004-12-29 16:10:53 +00:00
|
|
|
_vm->_gfx->getCurrentPal(cur_pal);
|
|
|
|
|
2005-01-06 16:07:46 +00:00
|
|
|
event.type = IMMEDIATE_EVENT;
|
|
|
|
event.code = PAL_EVENT;
|
|
|
|
event.op = EVENT_PALTOBLACK;
|
|
|
|
event.time = 0;
|
|
|
|
event.duration = kNormalFadeDuration;
|
|
|
|
event.data = cur_pal;
|
|
|
|
|
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
|
|
|
|
|
|
|
event.type = ONESHOT_EVENT;
|
|
|
|
event.code = INTERFACE_EVENT;
|
|
|
|
event.op = EVENT_CLEAR_STATUS;
|
|
|
|
|
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
2004-12-29 16:10:53 +00:00
|
|
|
|
2005-01-06 16:07:46 +00:00
|
|
|
event.type = ONESHOT_EVENT;
|
|
|
|
event.code = GRAPHICS_EVENT;
|
|
|
|
event.op = EVENT_SETFLAG;
|
|
|
|
event.param = RF_PLACARD;
|
|
|
|
|
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
|
|
|
|
|
|
|
event.type = ONESHOT_EVENT;
|
|
|
|
event.code = GRAPHICS_EVENT;
|
|
|
|
event.op = EVENT_FILL_RECT;
|
|
|
|
event.data = back_buf;
|
|
|
|
event.param = 138;
|
|
|
|
event.param2 = 0;
|
2005-01-11 21:10:36 +00:00
|
|
|
event.param3 = _vm->getSceneHeight();
|
2005-01-06 16:07:46 +00:00
|
|
|
event.param4 = 0;
|
2005-01-09 23:41:22 +00:00
|
|
|
event.param5 = _vm->getDisplayWidth();
|
2005-01-06 16:07:46 +00:00
|
|
|
|
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
2004-12-29 16:10:53 +00:00
|
|
|
|
2004-12-31 17:39:57 +00:00
|
|
|
// Put the text in the center of the viewport, assuming it will fit on
|
|
|
|
// one line. If we cannot make that assumption we'll need to extend
|
|
|
|
// the text drawing function so that it can center text around a point.
|
|
|
|
// It doesn't end up in exactly the same spot as the original did it,
|
|
|
|
// but it's close enough for now at least.
|
|
|
|
|
2005-01-06 16:07:46 +00:00
|
|
|
TEXTLIST_ENTRY text_entry;
|
|
|
|
SCENE_INFO scene_info;
|
|
|
|
|
|
|
|
_vm->_scene->getInfo(&scene_info);
|
|
|
|
|
|
|
|
text_entry.color = _vm->_gfx->getWhite();
|
|
|
|
text_entry.effect_color = _vm->_gfx->getBlack();
|
2005-01-09 23:41:22 +00:00
|
|
|
text_entry.text_x = _vm->getDisplayWidth() / 2;
|
2005-01-11 21:10:36 +00:00
|
|
|
text_entry.text_y = (_vm->getSceneHeight() - _vm->_font->getHeight(MEDIUM_FONT_ID)) / 2;
|
2005-01-06 16:07:46 +00:00
|
|
|
text_entry.font_id = MEDIUM_FONT_ID;
|
|
|
|
text_entry.flags = FONT_OUTLINE | FONT_CENTERED;
|
2005-01-21 21:55:54 +00:00
|
|
|
text_entry.string = thread->_strings->getString(stringId);
|
2004-12-29 16:10:53 +00:00
|
|
|
|
2005-01-06 16:07:46 +00:00
|
|
|
placardTextEntry = _vm->textAddEntry(scene_info.text_list, &text_entry);
|
|
|
|
|
|
|
|
event.type = ONESHOT_EVENT;
|
|
|
|
event.code = TEXT_EVENT;
|
|
|
|
event.op = EVENT_DISPLAY;
|
|
|
|
event.data = placardTextEntry;
|
|
|
|
|
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
2004-12-29 16:10:53 +00:00
|
|
|
|
|
|
|
_vm->_scene->getBGPal(&pal);
|
|
|
|
|
2005-01-06 16:07:46 +00:00
|
|
|
event.type = IMMEDIATE_EVENT;
|
|
|
|
event.code = PAL_EVENT;
|
|
|
|
event.op = EVENT_BLACKTOPAL;
|
|
|
|
event.time = 0;
|
|
|
|
event.duration = kNormalFadeDuration;
|
|
|
|
event.data = pal;
|
|
|
|
|
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
|
|
|
|
|
|
|
event.type = ONESHOT_EVENT;
|
|
|
|
event.code = SCRIPT_EVENT;
|
|
|
|
event.op = EVENT_THREAD_WAKE;
|
|
|
|
event.param = kWaitTypePlacard;
|
|
|
|
|
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
2005-01-02 20:29:27 +00:00
|
|
|
|
2004-10-27 22:17:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #49 (0x31)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfPlacardOff(SCRIPTFUNC_PARAMS) {
|
2005-01-06 16:07:46 +00:00
|
|
|
static PALENTRY cur_pal[PAL_ENTRIES];
|
2004-12-29 16:10:53 +00:00
|
|
|
PALENTRY *pal;
|
2005-01-06 16:07:46 +00:00
|
|
|
EVENT event;
|
|
|
|
EVENT *q_event;
|
|
|
|
|
|
|
|
thread->wait(kWaitTypePlacard);
|
|
|
|
|
|
|
|
_vm->_interface->restoreMode();
|
2004-12-29 16:10:53 +00:00
|
|
|
|
|
|
|
_vm->_gfx->getCurrentPal(cur_pal);
|
|
|
|
|
2005-01-06 16:07:46 +00:00
|
|
|
event.type = IMMEDIATE_EVENT;
|
|
|
|
event.code = PAL_EVENT;
|
|
|
|
event.op = EVENT_PALTOBLACK;
|
|
|
|
event.time = 0;
|
|
|
|
event.duration = kNormalFadeDuration;
|
|
|
|
event.data = cur_pal;
|
|
|
|
|
|
|
|
q_event = _vm->_events->queue(&event);
|
|
|
|
|
|
|
|
event.type = ONESHOT_EVENT;
|
|
|
|
event.code = GRAPHICS_EVENT;
|
|
|
|
event.op = EVENT_CLEARFLAG;
|
|
|
|
event.param = RF_PLACARD;
|
|
|
|
|
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
|
|
|
|
|
|
|
event.type = ONESHOT_EVENT;
|
|
|
|
event.code = TEXT_EVENT;
|
|
|
|
event.op = EVENT_REMOVE;
|
|
|
|
event.data = placardTextEntry;
|
|
|
|
|
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
2004-12-29 16:10:53 +00:00
|
|
|
|
|
|
|
_vm->_scene->getBGPal(&pal);
|
|
|
|
|
2005-01-06 16:07:46 +00:00
|
|
|
event.type = IMMEDIATE_EVENT;
|
|
|
|
event.code = PAL_EVENT;
|
|
|
|
event.op = EVENT_BLACKTOPAL;
|
|
|
|
event.time = 0;
|
|
|
|
event.duration = kNormalFadeDuration;
|
|
|
|
event.data = pal;
|
2004-12-29 16:10:53 +00:00
|
|
|
|
2005-01-06 16:07:46 +00:00
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
|
|
|
|
|
|
|
event.type = ONESHOT_EVENT;
|
|
|
|
event.code = CURSOR_EVENT;
|
|
|
|
event.op = EVENT_SHOW;
|
|
|
|
|
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
|
|
|
|
|
|
|
event.type = ONESHOT_EVENT;
|
|
|
|
event.code = SCRIPT_EVENT;
|
|
|
|
event.op = EVENT_THREAD_WAKE;
|
|
|
|
event.param = kWaitTypePlacard;
|
|
|
|
|
|
|
|
q_event = _vm->_events->chain(q_event, &event);
|
2005-01-02 20:29:27 +00:00
|
|
|
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #50 (0x32)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_setProtagState(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_setProtagState(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #51 (0x33)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfResumeBgdAnim(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 animId = thread->pop();
|
|
|
|
int16 cycles = thread->pop();
|
2004-12-28 04:09:10 +00:00
|
|
|
|
|
|
|
_vm->_anim->resume(animId, cycles);
|
|
|
|
debug(1, "sfResumeBgdAnimSpeed(%d, %d)", animId, cycles);
|
2004-11-06 22:33:08 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #52 (0x34)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_throwActor(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
//debug(1, "stub: SF_throwActor(%d, %d, %d, %d, %d, %d)", param1, param2, param3, param4, param5, param6);
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #53 (0x35)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_waitWalk(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 param = thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
|
|
|
debug(1, "stub: SF_waitWalk(%d)", param);
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #54 (0x36)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_sceneID(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->_returnValue = _vm->_scene->currentSceneNumber();
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #55 (0x37)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_changeActorScene(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
//debug(1, "stub: SF_changeActorScene(%d, %d)", param1, param2);
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #56 (0x38)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_climb(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
//debug(1, "stub: SF_climb(%d, %d, %d, %d)", param1, param2, param3, param4);
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #57 (0x39)
|
2004-12-28 21:27:18 +00:00
|
|
|
// Param1: door #
|
|
|
|
// Param2: door state
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfSetDoorState(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 doorNumber;
|
|
|
|
int16 doorState;
|
|
|
|
doorNumber = thread->pop();
|
|
|
|
doorState = thread->pop();
|
2004-12-28 21:27:18 +00:00
|
|
|
|
2005-01-07 22:18:53 +00:00
|
|
|
if (_vm->_scene->getFlags() & kSceneFlagISO) {
|
2004-12-28 21:27:18 +00:00
|
|
|
//todo: it
|
|
|
|
} else {
|
|
|
|
_vm->_scene->setDoorState(doorNumber, doorState);
|
|
|
|
}
|
2004-11-06 22:33:08 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #58 (0x3A)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_setActorZ(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
//debug(1, "stub: SF_setActorZ(%d, %d)", param1, param2);
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #59 (0x3B)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_text(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_text(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #60 (0x3C)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_getActorX(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 param = thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
|
|
|
debug(1, "stub: SF_getActorX(%d)", param);
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #61 (0x3D)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_getActorY(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 param = thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
|
|
|
debug(1, "stub: SF_getActorY(%d)", param);
|
2004-05-13 01:41:23 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #62 (0x3E)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_eraseDelta(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_eraseDelta(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #63 (0x3F)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfPlayMusic(SCRIPTFUNC_PARAMS) {
|
2005-01-16 17:06:40 +00:00
|
|
|
if (_vm->getGameType() == GType_ITE) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 param = thread->pop() + 9;
|
2004-09-23 06:53:46 +00:00
|
|
|
|
2005-01-16 17:06:40 +00:00
|
|
|
if (param >= 9 && param <= 34)
|
|
|
|
_vm->_music->play(param);
|
|
|
|
else
|
|
|
|
_vm->_music->stop();
|
|
|
|
} else {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 param1 = thread->pop();
|
|
|
|
int16 param2 = thread->pop();
|
2005-01-16 17:06:40 +00:00
|
|
|
|
|
|
|
debug(1, "Stub: sfPlayMusic(%d, %d)", param1, param2);
|
|
|
|
}
|
2004-09-23 06:53:46 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #64 (0x40)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_pickClimbOutPos(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_pickClimbOutPos(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #65 (0x41)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_tossRif(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_tossRif(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #66 (0x42)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_showControls(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_showControls(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #67 (0x43)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_showMap(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_showMap(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #68 (0x44)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_puzzleWon(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_puzzleWon(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #69 (0x45)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfEnableEscape(SCRIPTFUNC_PARAMS) {
|
2004-10-27 02:27:54 +00:00
|
|
|
if (thread->pop())
|
|
|
|
_abortEnabled = true;
|
|
|
|
else {
|
|
|
|
_skipSpeeches = false;
|
|
|
|
_abortEnabled = false;
|
|
|
|
}
|
2004-10-20 22:38:24 +00:00
|
|
|
}
|
|
|
|
|
2004-10-19 17:12:53 +00:00
|
|
|
static struct {
|
|
|
|
int res;
|
|
|
|
int vol;
|
|
|
|
} sfxTable[] = {
|
|
|
|
{ FX_DOOR_OPEN, 127 },
|
|
|
|
{ FX_DOOR_CLOSE, 127 },
|
|
|
|
{ FX_RUSH_WATER, 63 }, // Floppy volume: 127
|
|
|
|
{ FX_RUSH_WATER, 26 }, // Floppy volume: 40
|
|
|
|
{ FX_CRICKET, 64 },
|
|
|
|
{ FX_PORTICULLIS, 84 }, // Floppy volume: 127
|
|
|
|
{ FX_CLOCK_1, 64 },
|
|
|
|
{ FX_CLOCK_2, 64 },
|
|
|
|
{ FX_DAM_MACHINE, 64 },
|
|
|
|
{ FX_DAM_MACHINE, 40 },
|
|
|
|
{ FX_HUM1, 64 },
|
|
|
|
{ FX_HUM2, 64 },
|
|
|
|
{ FX_HUM3, 64 },
|
|
|
|
{ FX_HUM4, 64 },
|
|
|
|
{ FX_WATER_LOOP_S, 32 }, // Floppy volume: 64
|
|
|
|
{ FX_SURF, 42 }, // Floppy volume: 127
|
|
|
|
{ FX_SURF, 32 }, // Floppy volume: 64
|
|
|
|
{ FX_FIRELOOP, 64 }, // Floppy volume: 96
|
|
|
|
{ FX_SCRAPING, 84 }, // Floppy volume: 127
|
|
|
|
{ FX_BEE_SWARM, 64 }, // Floppy volume: 96
|
|
|
|
{ FX_BEE_SWARM, 26 }, // Floppy volume: 40
|
|
|
|
{ FX_SQUEAKBOARD, 64 },
|
|
|
|
{ FX_KNOCK, 127 },
|
|
|
|
{ FX_COINS, 32 }, // Floppy volume: 48
|
|
|
|
{ FX_STORM, 84 }, // Floppy volume: 127
|
|
|
|
{ FX_DOOR_CLOSE_2, 84 }, // Floppy volume: 127
|
|
|
|
{ FX_ARCWELD, 84 }, // Floppy volume: 127
|
|
|
|
{ FX_RETRACT_ORB, 127 },
|
|
|
|
{ FX_DRAGON, 127 },
|
|
|
|
{ FX_SNORES, 127 },
|
|
|
|
{ FX_SPLASH, 127 },
|
|
|
|
{ FX_LOBBY_DOOR, 127 },
|
|
|
|
{ FX_CHIRP_LOOP, 26 }, // Floppy volume: 40
|
|
|
|
{ FX_DOOR_CREAK, 96 },
|
|
|
|
{ FX_SPOON_DIG, 64 },
|
|
|
|
{ FX_CROW, 96 },
|
|
|
|
{ FX_COLDWIND, 42 }, // Floppy volume: 64
|
|
|
|
{ FX_TOOL_SND_1, 96 },
|
|
|
|
{ FX_TOOL_SND_2, 127 },
|
|
|
|
{ FX_TOOL_SND_3, 64 },
|
|
|
|
{ FX_DOOR_METAL, 96 },
|
|
|
|
{ FX_WATER_LOOP_S, 32 },
|
|
|
|
{ FX_WATER_LOOP_L, 32 }, // Floppy volume: 64
|
|
|
|
{ FX_DOOR_OPEN_2, 127 },
|
|
|
|
{ FX_JAIL_DOOR, 64 },
|
|
|
|
{ FX_KILN_FIRE, 53 }, // Floppy volume: 80
|
|
|
|
|
|
|
|
// Only in the CD version
|
|
|
|
{ FX_CROWD_01, 64 },
|
|
|
|
{ FX_CROWD_02, 64 },
|
|
|
|
{ FX_CROWD_03, 64 },
|
|
|
|
{ FX_CROWD_04, 64 },
|
|
|
|
{ FX_CROWD_05, 64 },
|
|
|
|
{ FX_CROWD_06, 64 },
|
|
|
|
{ FX_CROWD_07, 64 },
|
|
|
|
{ FX_CROWD_08, 64 },
|
|
|
|
{ FX_CROWD_09, 64 },
|
|
|
|
{ FX_CROWD_10, 64 },
|
|
|
|
{ FX_CROWD_11, 64 },
|
|
|
|
{ FX_CROWD_12, 64 },
|
|
|
|
{ FX_CROWD_13, 64 },
|
|
|
|
{ FX_CROWD_14, 64 },
|
|
|
|
{ FX_CROWD_15, 64 },
|
|
|
|
{ FX_CROWD_16, 64 },
|
|
|
|
{ FX_CROWD_17, 64 }
|
|
|
|
};
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #70 (0x46)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfPlaySound(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 param = thread->pop();
|
2005-01-17 18:49:00 +00:00
|
|
|
int res;
|
2004-10-19 17:12:53 +00:00
|
|
|
|
2005-01-17 18:49:00 +00:00
|
|
|
if (param < ARRAYSIZE(sfxTable)) {
|
|
|
|
res = sfxTable[param].res;
|
|
|
|
if (_vm->getFeatures() & GF_CD_FX)
|
|
|
|
res -= 14;
|
|
|
|
|
|
|
|
_vm->_sndRes->playSound(res, sfxTable[param].vol, false);
|
|
|
|
} else {
|
2004-10-19 17:12:53 +00:00
|
|
|
_vm->_sound->stopSound();
|
2005-01-17 18:49:00 +00:00
|
|
|
}
|
2004-10-19 17:12:53 +00:00
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #71 (0x47)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_playLoopedSound(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_playLoopedSound(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #72 (0x48)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_getDeltaFrame(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_getDeltaFrame(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #73 (0x49)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_showProtect(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_showProtect(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #74 (0x4A)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_protectResult(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_protectResult(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
2004-10-27 22:17:11 +00:00
|
|
|
// Script function #75 (0x4d)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::sfRand(SCRIPTFUNC_PARAMS) {
|
2005-01-21 21:55:54 +00:00
|
|
|
int16 param = thread->pop();
|
2004-10-27 22:17:11 +00:00
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
thread->_returnValue = (_vm->_rnd.getRandomNumber(param));
|
2004-10-27 22:17:11 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #76 (0x4c)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_fadeMusic(SCRIPTFUNC_PARAMS) {
|
2004-10-27 22:17:11 +00:00
|
|
|
debug(1, "stub: SF_fadeMusic()");
|
|
|
|
}
|
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
// Script function #77 (0x4d)
|
2005-01-22 19:21:38 +00:00
|
|
|
void Script::SF_playVoice(SCRIPTFUNC_PARAMS) {
|
2004-11-06 22:33:08 +00:00
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
thread->pop();
|
|
|
|
|
|
|
|
debug(1, "stub: SF_playVoice(), %d args", nArgs);
|
|
|
|
}
|
|
|
|
|
2005-01-17 23:11:31 +00:00
|
|
|
void Script::finishDialog(int replyID, int flags, int bitOffset) {
|
|
|
|
if (_conversingThread) {
|
|
|
|
_vm->_interface->setMode(kPanelNull);
|
|
|
|
|
2005-01-21 21:55:54 +00:00
|
|
|
_conversingThread->_flags &= ~kTFlagWaiting;
|
2005-01-17 23:11:31 +00:00
|
|
|
|
|
|
|
_conversingThread->push(replyID);
|
|
|
|
|
|
|
|
if (flags & kReplyOnce) {
|
|
|
|
// TODO:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_conversingThread = NULL;
|
|
|
|
wakeUpThreads(kWaitTypeDialogBegin);
|
|
|
|
}
|
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
} // End of namespace Saga
|