2004-04-12 21:40:49 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2004 The ScummVM project
|
|
|
|
*
|
|
|
|
* 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"
|
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-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"
|
2004-08-12 23:57:45 +00:00
|
|
|
#include "saga/sdata.h"
|
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
namespace Saga {
|
|
|
|
|
2004-08-12 23:57:45 +00:00
|
|
|
#define OPCODE(x) &Script::x
|
|
|
|
|
|
|
|
void Script::setupScriptFuncList(void) {
|
|
|
|
static const R_SFUNC_ENTRY SFuncList[R_SFUNC_NUM] = {
|
|
|
|
{0, 0, NULL},
|
|
|
|
{1, 1, OPCODE(SF_sleep)},
|
2004-09-25 10:11:17 +00:00
|
|
|
{2, 1, OPCODE(SF_takeObject)},
|
|
|
|
{3, 1, OPCODE(SF_objectIsCarried)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{4, 1, OPCODE(SF_setCommandText)},
|
2004-09-25 10:11:17 +00:00
|
|
|
{5, 0, OPCODE(SF_mainMode)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{6, 3, OPCODE(SF_actorWalkTo)},
|
2004-09-25 10:11:17 +00:00
|
|
|
{7, 4, OPCODE(SF_doAction)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{8, 2, OPCODE(SF_setFacing)},
|
2004-09-25 10:11:17 +00:00
|
|
|
{9, 2, OPCODE(SF_startBgdAnim)},
|
|
|
|
{10, 1, OPCODE(SF_stopBgdAnim)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{11, 1, OPCODE(SF_freezeInterface)},
|
2004-09-25 10:11:17 +00:00
|
|
|
{12, 0, OPCODE(SF_dialogMode)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{13, 0, NULL},
|
2004-09-25 10:11:17 +00:00
|
|
|
{14, 2, OPCODE(SF_faceTowards)},
|
|
|
|
{15, 2, OPCODE(SF_setFollower)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{16, 0, NULL},
|
|
|
|
{17, 0, NULL},
|
|
|
|
{18, 0, NULL},
|
|
|
|
{19, 0, NULL},
|
|
|
|
{20, 0, NULL},
|
|
|
|
{21, 0, NULL},
|
|
|
|
{22, 0, NULL},
|
2004-09-25 10:11:17 +00:00
|
|
|
{23, 2, OPCODE(SF_setBgdAnimSpeed)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{24, 0, NULL},
|
2004-09-25 10:11:17 +00:00
|
|
|
{25, 1, OPCODE(SF_centerActor)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{26, 3, OPCODE(SF_startAnim)},
|
|
|
|
{27, 3, OPCODE(SF_actorWalkToAsync)},
|
|
|
|
{28, 0, NULL},
|
2004-09-25 10:11:17 +00:00
|
|
|
{29, 2, OPCODE(SF_setActorState)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{30, 3, OPCODE(SF_moveTo)},
|
|
|
|
{31, 0, NULL},
|
|
|
|
{32, 0, NULL},
|
2004-09-25 10:11:17 +00:00
|
|
|
{33, 1, OPCODE(SF_finishBgdAnim)},
|
|
|
|
{34, 2, OPCODE(SF_swapActors)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{35, 0, NULL},
|
|
|
|
{36, 4, OPCODE(SF_actorWalk)},
|
|
|
|
{37, 4, OPCODE(SF_cycleActorFrames)},
|
|
|
|
{38, 3, OPCODE(SF_setFrame)},
|
2004-09-25 10:11:17 +00:00
|
|
|
{39, 1, OPCODE(SF_setRightPortrait)},
|
|
|
|
{40, 1, OPCODE(SF_setLeftPortrait)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{41, 4, OPCODE(SF_linkAnim)},
|
2004-09-25 10:11:17 +00:00
|
|
|
{42, 4, OPCODE(SF_scriptSpecialWalk)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{43, 6, OPCODE(SF_placeActor)},
|
|
|
|
{44, 0, OPCODE(SF_checkUserInterrupt)},
|
2004-09-25 10:11:17 +00:00
|
|
|
{45, 5, OPCODE(SF_walkRelative)},
|
|
|
|
{46, 5, OPCODE(SF_moveRelative)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{47, 0, NULL},
|
|
|
|
{48, 0, NULL},
|
|
|
|
{49, 0, NULL},
|
|
|
|
{50, 0, NULL},
|
|
|
|
{51, 0, NULL},
|
2004-09-25 10:11:17 +00:00
|
|
|
{52, 6, OPCODE(SF_throwActor)},
|
|
|
|
{53, 1, OPCODE(SF_waitWalk)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{54, 0, NULL},
|
2004-09-25 10:11:17 +00:00
|
|
|
{55, 2, OPCODE(SF_changeActorScene)},
|
|
|
|
{56, 4, OPCODE(SF_climb)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{57, 0, NULL},
|
2004-09-25 10:11:17 +00:00
|
|
|
{58, 2, OPCODE(SF_setActorZ)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{59, 0, NULL},
|
2004-09-25 10:11:17 +00:00
|
|
|
{60, 1, OPCODE(SF_getActorX)},
|
|
|
|
{61, 1, OPCODE(SF_getActorY)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{62, 0, NULL},
|
2004-09-25 10:11:17 +00:00
|
|
|
{63, 1, OPCODE(SF_playMusic)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{64, 0, NULL},
|
|
|
|
{65, 0, NULL},
|
|
|
|
{66, 0, NULL},
|
|
|
|
{67, 0, NULL},
|
|
|
|
{68, 0, NULL},
|
2004-10-20 22:38:24 +00:00
|
|
|
{69, 1, OPCODE(SF_enableEscape)},
|
2004-09-25 10:11:17 +00:00
|
|
|
{70, 1, OPCODE(SF_playSound)},
|
2004-08-12 23:57:45 +00:00
|
|
|
{71, 0, NULL},
|
|
|
|
{72, 0, NULL},
|
|
|
|
{73, 0, NULL},
|
|
|
|
{74, 0, NULL},
|
|
|
|
{75, 0, NULL},
|
|
|
|
{76, 0, NULL},
|
|
|
|
{77, 0, NULL}
|
|
|
|
};
|
|
|
|
_SFuncList = SFuncList;
|
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #1 (0x01) blocking
|
|
|
|
// Suspends thread execution for the specified time period
|
|
|
|
// Param1: time to suspend ( units? )
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_sleep(R_SCRIPTFUNC_PARAMS) {
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T time_param;
|
|
|
|
int time;
|
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
time_param = thread->pop();
|
2004-08-01 19:53:29 +00:00
|
|
|
time = _vm->_sdata->readWordU(time_param);
|
2004-04-12 21:40:49 +00:00
|
|
|
thread->sleep_time = time * 10;
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #2 (0x02)
|
|
|
|
int Script::SF_takeObject(R_SCRIPTFUNC_PARAMS) {
|
|
|
|
thread->pop();
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #3 (0x03)
|
|
|
|
// Unknown function; pops a parameter and pushes a return value
|
|
|
|
// Param1: unknown
|
2004-09-25 10:11:17 +00:00
|
|
|
int Script::SF_objectIsCarried(R_SCRIPTFUNC_PARAMS) {
|
2004-05-01 14:34:00 +00:00
|
|
|
// INCOMPLETE
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T param1;
|
2004-09-23 06:46:44 +00:00
|
|
|
param1 = thread->pop();
|
2004-10-03 17:11:23 +00:00
|
|
|
|
|
|
|
// FIXME: Incomplete, but returning 0 assures that the fair start
|
|
|
|
// script will run completely.
|
|
|
|
|
|
|
|
thread->retVal = 0;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_setCommandText(R_SCRIPTFUNC_PARAMS) {
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T s_idx_parm;
|
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
s_idx_parm = thread->pop();
|
2004-05-01 14:34:00 +00:00
|
|
|
// INCOMPLETE
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #5 (0x05)
|
|
|
|
int Script::SF_mainMode(R_SCRIPTFUNC_PARAMS) {
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #6 (0x06) blocking
|
|
|
|
// Commands the specified actor to walk to the given position
|
|
|
|
// Param1: actor id
|
|
|
|
// Param2: actor destination x
|
|
|
|
// Param3: actor destination y
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_actorWalkTo(R_SCRIPTFUNC_PARAMS) {
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T actor_parm;
|
|
|
|
SDataWord_T x_parm;
|
|
|
|
SDataWord_T y_parm;
|
|
|
|
int actor_id;
|
|
|
|
int actor_idx;
|
2004-10-04 23:09:38 +00:00
|
|
|
Point pt;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
actor_parm = thread->pop();
|
|
|
|
x_parm = thread->pop();
|
|
|
|
y_parm = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-01 19:53:29 +00:00
|
|
|
actor_id = _vm->_sdata->readWordS(actor_parm);
|
2004-08-02 15:47:42 +00:00
|
|
|
actor_idx = _vm->_actor->getActorIndex(actor_id);
|
2004-04-12 21:40:49 +00:00
|
|
|
if (actor_idx < 0) {
|
2004-08-10 18:31:33 +00:00
|
|
|
_vm->_console->print(S_WARN_PREFIX "SF.08: Actor id 0x%X not found.", actor_id);
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
2004-08-01 19:53:29 +00:00
|
|
|
pt.x = _vm->_sdata->readWordS(x_parm);
|
|
|
|
pt.y = _vm->_sdata->readWordS(y_parm);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-02 15:47:42 +00:00
|
|
|
_vm->_actor->walkTo(actor_idx, &pt, 0, &thread->sem);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #7 (0x07)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_doAction(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #8 (0x08) nonblocking
|
|
|
|
// Sets the orientation of the specified actor.
|
|
|
|
// Param1: actor id
|
|
|
|
// Param2: actor orientation
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_setFacing(R_SCRIPTFUNC_PARAMS) {
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T actor_parm;
|
|
|
|
SDataWord_T orient_parm;
|
|
|
|
int actor_id;
|
|
|
|
int actor_idx;
|
|
|
|
int orientation;
|
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
actor_parm = thread->pop();
|
|
|
|
orient_parm = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-01 19:53:29 +00:00
|
|
|
actor_id = _vm->_sdata->readWordS(actor_parm);
|
|
|
|
orientation = _vm->_sdata->readWordS(orient_parm);
|
2004-08-02 15:47:42 +00:00
|
|
|
actor_idx = _vm->_actor->getActorIndex(actor_id);
|
2004-04-12 21:40:49 +00:00
|
|
|
if (actor_idx < 0) {
|
2004-08-10 18:31:33 +00:00
|
|
|
_vm->_console->print(S_WARN_PREFIX "SF.08: Actor id 0x%X not found.", actor_id);
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
2004-08-02 15:47:42 +00:00
|
|
|
_vm->_actor->setOrientation(actor_idx, orientation);
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #9 (0x09)
|
|
|
|
int Script::SF_startBgdAnim(R_SCRIPTFUNC_PARAMS) {
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #10 (0x0A)
|
|
|
|
int Script::SF_stopBgdAnim(R_SCRIPTFUNC_PARAMS) {
|
|
|
|
thread->pop();
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_freezeInterface(R_SCRIPTFUNC_PARAMS) {
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T b_param;
|
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
b_param = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
if (b_param) {
|
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
|
|
|
}
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #12 (0x0C)
|
|
|
|
// Disables mouse input, etc.
|
|
|
|
int Script::SF_dialogMode(R_SCRIPTFUNC_PARAMS) {
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #14 (0x0E)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_faceTowards(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #15 (0x0F)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_setFollower(R_SCRIPTFUNC_PARAMS) {
|
2004-09-23 06:46:44 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #23 (0x17)
|
|
|
|
int Script::SF_setBgdAnimSpeed(R_SCRIPTFUNC_PARAMS) {
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #25 (0x19)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_centerActor(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #26 (0x1A) nonblocking
|
|
|
|
// Starts the specified animation
|
|
|
|
// Param1: ?
|
|
|
|
// Param2: frames of animation to play or -1 to loop
|
|
|
|
// Param3: animation id
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_startAnim(R_SCRIPTFUNC_PARAMS) {
|
2004-05-13 01:41:23 +00:00
|
|
|
// FIXME: implementation is wrong. Should link animation
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T unk_parm;
|
|
|
|
SDataWord_T frame_parm;
|
|
|
|
SDataWord_T anim_id_parm;
|
|
|
|
int frame_count;
|
|
|
|
int anim_id;
|
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
anim_id_parm = thread->pop();
|
|
|
|
frame_parm = thread->pop();
|
|
|
|
unk_parm = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-01 19:53:29 +00:00
|
|
|
frame_count = _vm->_sdata->readWordS(frame_parm);
|
|
|
|
anim_id = _vm->_sdata->readWordS(anim_id_parm);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-07-31 13:34:43 +00:00
|
|
|
if (_vm->_anim->play(anim_id, 0) != R_SUCCESS) {
|
2004-08-10 18:31:33 +00:00
|
|
|
_vm->_console->print(S_WARN_PREFIX "SF.26: Anim::play() failed. Anim id: %u\n", anim_id);
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #27 (0x1B) nonblocking
|
|
|
|
// Commands the specified actor to walk to the given position
|
|
|
|
// Param1: actor id
|
|
|
|
// Param2: actor destination x
|
|
|
|
// Param3: actor destination y
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_actorWalkToAsync(R_SCRIPTFUNC_PARAMS) {
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T actor_parm;
|
|
|
|
SDataWord_T x_parm;
|
|
|
|
SDataWord_T y_parm;
|
|
|
|
int actor_id;
|
|
|
|
int actor_idx;
|
2004-10-04 23:09:38 +00:00
|
|
|
Point pt;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
actor_parm = thread->pop();
|
|
|
|
x_parm = thread->pop();
|
|
|
|
y_parm = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-01 19:53:29 +00:00
|
|
|
actor_id = _vm->_sdata->readWordS(actor_parm);
|
2004-08-02 15:47:42 +00:00
|
|
|
actor_idx = _vm->_actor->getActorIndex(actor_id);
|
2004-04-12 21:40:49 +00:00
|
|
|
if (actor_idx < 0) {
|
2004-08-10 18:31:33 +00:00
|
|
|
_vm->_console->print(S_WARN_PREFIX "SF.08: Actor id 0x%X not found.",
|
2004-04-12 21:40:49 +00:00
|
|
|
actor_id);
|
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
2004-08-01 19:53:29 +00:00
|
|
|
pt.x = _vm->_sdata->readWordS(x_parm);
|
|
|
|
pt.y = _vm->_sdata->readWordS(y_parm);
|
2004-08-02 15:47:42 +00:00
|
|
|
_vm->_actor->walkTo(actor_idx, &pt, 0, NULL);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #29 (0x1D)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_setActorState(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #30 (0x1E) nonblocking
|
|
|
|
// Positions an actor at the specified location; actor is created if the
|
|
|
|
// actor does not already exist.
|
|
|
|
// Param1: actor id
|
|
|
|
// Param2: actor pos x
|
|
|
|
// Param3: actor pos y
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_moveTo(R_SCRIPTFUNC_PARAMS) {
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T actor_parm;
|
|
|
|
SDataWord_T x_parm;
|
|
|
|
SDataWord_T y_parm;
|
|
|
|
int actor_id;
|
|
|
|
int actor_idx;
|
|
|
|
int result;
|
2004-10-04 23:09:38 +00:00
|
|
|
Point pt;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
actor_parm = thread->pop();
|
|
|
|
x_parm = thread->pop();
|
|
|
|
y_parm = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-01 19:53:29 +00:00
|
|
|
actor_id = _vm->_sdata->readWordS(actor_parm);
|
|
|
|
pt.x = _vm->_sdata->readWordS(x_parm);
|
|
|
|
pt.y = _vm->_sdata->readWordS(y_parm);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-02 15:47:42 +00:00
|
|
|
if (!_vm->_actor->actorExists(actor_id)) {
|
|
|
|
result = _vm->_actor->create(actor_id, pt.x, pt.y);
|
2004-04-12 21:40:49 +00:00
|
|
|
if (result != R_SUCCESS) {
|
2004-08-10 18:31:33 +00:00
|
|
|
_vm->_console->print(S_WARN_PREFIX "SF.30: Couldn't create actor 0x%X.", actor_id);
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
} else {
|
2004-08-02 15:47:42 +00:00
|
|
|
actor_idx = _vm->_actor->getActorIndex(actor_id);
|
|
|
|
_vm->_actor->move(actor_idx, &pt);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #33 (0x21)
|
|
|
|
int Script::SF_finishBgdAnim(R_SCRIPTFUNC_PARAMS) {
|
|
|
|
thread->pop();
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #34 (0x22)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_swapActors(R_SCRIPTFUNC_PARAMS) {
|
2004-09-23 06:46:44 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #36 (0x24) ?
|
|
|
|
// Commands the specified actor to walk to the given position
|
|
|
|
// Param1: actor id
|
|
|
|
// Param2: actor destination x
|
|
|
|
// Param3: actor destination y
|
|
|
|
// Param4: unknown
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_actorWalk(R_SCRIPTFUNC_PARAMS) {
|
2004-05-01 14:34:00 +00:00
|
|
|
// INCOMPLETE
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T actor_parm;
|
|
|
|
SDataWord_T x_parm;
|
|
|
|
SDataWord_T y_parm;
|
|
|
|
SDataWord_T unk_parm;
|
|
|
|
int actor_idx;
|
2004-10-04 23:09:38 +00:00
|
|
|
Point pt;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
actor_parm = thread->pop();
|
|
|
|
x_parm = thread->pop();
|
|
|
|
y_parm = thread->pop();
|
|
|
|
unk_parm = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-02 15:47:42 +00:00
|
|
|
actor_idx = _vm->_actor->getActorIndex(_vm->_sdata->readWordS(actor_parm));
|
2004-04-12 21:40:49 +00:00
|
|
|
if (actor_idx < 0) {
|
2004-08-10 18:31:33 +00:00
|
|
|
_vm->_console->print(S_WARN_PREFIX "SF.36: Actor id 0x%X not found.", (int)actor_parm);
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
2004-08-01 19:53:29 +00:00
|
|
|
pt.x = _vm->_sdata->readWordS(x_parm);
|
|
|
|
pt.y = _vm->_sdata->readWordS(y_parm);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
#if 1
|
2004-08-02 15:47:42 +00:00
|
|
|
_vm->_actor->walkTo(actor_idx, &pt, 0, NULL);
|
2004-04-12 21:40:49 +00:00
|
|
|
#else
|
2004-08-02 15:47:42 +00:00
|
|
|
_vm->_actor->walkTo(actor_idx, &pt, 0, &thread->sem);
|
2004-04-12 21:40:49 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #37 (0x25) nonblocking
|
|
|
|
// Sets an actor to the specified action state
|
|
|
|
// Param1: actor id
|
|
|
|
// Param2: unknown
|
|
|
|
// Param3: actor action state
|
|
|
|
// Param4: unknown
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_cycleActorFrames(R_SCRIPTFUNC_PARAMS) {
|
2004-05-01 14:34:00 +00:00
|
|
|
// INCOMPLETE
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T actor_parm;
|
|
|
|
SDataWord_T unk1_parm;
|
|
|
|
SDataWord_T unk2_parm;
|
|
|
|
SDataWord_T action_parm;
|
|
|
|
int actor_id;
|
|
|
|
int actor_idx;
|
|
|
|
int action;
|
2004-05-01 14:34:00 +00:00
|
|
|
//uint16 flags;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
actor_parm = thread->pop();
|
|
|
|
unk1_parm = thread->pop();
|
|
|
|
action_parm = thread->pop();
|
|
|
|
unk2_parm = thread->pop();
|
2004-08-01 19:53:29 +00:00
|
|
|
actor_id = _vm->_sdata->readWordS(actor_parm);
|
|
|
|
action = _vm->_sdata->readWordS(action_parm);
|
2004-08-02 15:47:42 +00:00
|
|
|
actor_idx = _vm->_actor->getActorIndex(actor_id);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-02 15:47:42 +00:00
|
|
|
if (_vm->_actor->setAction(actor_idx, action, ACTION_NONE) != R_SUCCESS) {
|
2004-08-10 18:31:33 +00:00
|
|
|
_vm->_console->print(S_WARN_PREFIX "SF.37: Actor::setAction() failed.");
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #38 (0x26) nonblocking
|
|
|
|
// Sets an actor to the specified action state
|
|
|
|
// Param1: actor id
|
|
|
|
// Param2: actor action state
|
|
|
|
// Param3: unknown
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_setFrame(R_SCRIPTFUNC_PARAMS) {
|
2004-05-01 14:34:00 +00:00
|
|
|
// INCOMPLETE
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
SDataWord_T actor_parm;
|
|
|
|
SDataWord_T unk1_parm;
|
|
|
|
SDataWord_T action_parm;
|
|
|
|
|
|
|
|
int actor_id;
|
|
|
|
int actor_idx;
|
|
|
|
int action;
|
2004-05-01 14:34:00 +00:00
|
|
|
//uint16 flags;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
actor_parm = thread->pop();
|
|
|
|
action_parm = thread->pop();
|
|
|
|
unk1_parm = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-01 19:53:29 +00:00
|
|
|
actor_id = _vm->_sdata->readWordS(actor_parm);
|
|
|
|
action = _vm->_sdata->readWordS(action_parm);
|
2004-08-02 15:47:42 +00:00
|
|
|
actor_idx = _vm->_actor->getActorIndex(actor_id);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-02 15:47:42 +00:00
|
|
|
if (_vm->_actor->setAction(actor_idx, action, ACTION_NONE) != R_SUCCESS) {
|
2004-08-10 18:31:33 +00:00
|
|
|
_vm->_console->print(S_WARN_PREFIX "SF.38: Actor::setAction() failed.");
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #39 (0x27)
|
|
|
|
// Sets the right-hand portrait
|
|
|
|
int Script::SF_setRightPortrait(R_SCRIPTFUNC_PARAMS) {
|
|
|
|
thread->pop();
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Script function #40 (0x28)
|
|
|
|
// Sets the left-hand portrait
|
|
|
|
int Script::SF_setLeftPortrait(R_SCRIPTFUNC_PARAMS) {
|
|
|
|
thread->pop();
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_linkAnim(R_SCRIPTFUNC_PARAMS) {
|
2004-05-01 14:34:00 +00:00
|
|
|
SDataWord_T unk_parm;
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T tframes_parm;
|
|
|
|
SDataWord_T anim1_parm;
|
|
|
|
SDataWord_T anim2_parm;
|
|
|
|
int tframes;
|
2004-04-30 23:02:23 +00:00
|
|
|
uint16 anim_id1;
|
|
|
|
uint16 anim_id2;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
anim1_parm = thread->pop();
|
|
|
|
anim2_parm = thread->pop();
|
|
|
|
tframes_parm = thread->pop();
|
|
|
|
unk_parm = thread->pop();
|
2004-08-01 19:53:29 +00:00
|
|
|
tframes = _vm->_sdata->readWordS(tframes_parm);
|
|
|
|
anim_id1 = _vm->_sdata->readWordU(anim1_parm);
|
|
|
|
anim_id2 = _vm->_sdata->readWordU(anim2_parm);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-07-31 13:34:43 +00:00
|
|
|
if (_vm->_anim->link(anim_id1, anim_id2) != R_SUCCESS) {
|
2004-08-10 18:31:33 +00:00
|
|
|
_vm->_console->print(S_WARN_PREFIX "SF.41: Anim::link() failed. (%u->%u)\n", anim_id1, anim_id2);
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #42 (0x2A)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_scriptSpecialWalk(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// Script function #43 (0x2B) nonblocking
|
|
|
|
// Positions an actor at the specified location; actor is created if the
|
|
|
|
// actor does not already exist.
|
|
|
|
// Param1: actor id
|
|
|
|
// Param2: actor pos x
|
|
|
|
// Param3: actor pos y
|
|
|
|
// Param4: ?
|
|
|
|
// Param5: actor action
|
|
|
|
// Param6: ?
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_placeActor(R_SCRIPTFUNC_PARAMS) {
|
2004-05-01 14:34:00 +00:00
|
|
|
// INCOMPLETE
|
2004-04-12 21:40:49 +00:00
|
|
|
SDataWord_T actor_parm;
|
|
|
|
SDataWord_T x_parm;
|
|
|
|
SDataWord_T y_parm;
|
|
|
|
SDataWord_T action_parm;
|
|
|
|
SDataWord_T unknown_parm;
|
|
|
|
int actor_id;
|
|
|
|
int actor_idx;
|
|
|
|
int action_state;
|
|
|
|
int result;
|
2004-10-04 23:09:38 +00:00
|
|
|
Point pt;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
actor_parm = thread->pop();
|
|
|
|
x_parm = thread->pop();
|
|
|
|
y_parm = thread->pop();
|
|
|
|
unknown_parm = thread->pop();
|
|
|
|
action_parm = thread->pop();
|
|
|
|
unknown_parm = thread->pop();
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-01 19:53:29 +00:00
|
|
|
actor_id = _vm->_sdata->readWordS(actor_parm);
|
|
|
|
pt.x = _vm->_sdata->readWordS(x_parm);
|
|
|
|
pt.y = _vm->_sdata->readWordS(y_parm);
|
|
|
|
action_state = _vm->_sdata->readWordU(action_parm);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-02 15:47:42 +00:00
|
|
|
if (!_vm->_actor->actorExists(actor_id)) {
|
|
|
|
result = _vm->_actor->create(actor_id, pt.x, pt.y);
|
2004-04-12 21:40:49 +00:00
|
|
|
if (result != R_SUCCESS) {
|
2004-08-10 18:31:33 +00:00
|
|
|
_vm->_console->print(S_WARN_PREFIX "SF.43: Couldn't create actor 0x%X.", actor_id);
|
2004-04-12 21:40:49 +00:00
|
|
|
return R_FAILURE;
|
|
|
|
}
|
|
|
|
} else {
|
2004-08-02 15:47:42 +00:00
|
|
|
actor_idx = _vm->_actor->getActorIndex(actor_id);
|
|
|
|
_vm->_actor->move(actor_idx, &pt);
|
2004-04-12 21:40:49 +00:00
|
|
|
}
|
|
|
|
|
2004-08-02 15:47:42 +00:00
|
|
|
actor_idx = _vm->_actor->getActorIndex(actor_id);
|
|
|
|
_vm->_actor->setDefaultAction(actor_idx, action_state, ACTION_NONE);
|
|
|
|
_vm->_actor->setAction(actor_idx, action_state, ACTION_NONE);
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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.
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_checkUserInterrupt(R_SCRIPTFUNC_PARAMS) {
|
2004-10-03 17:11:23 +00:00
|
|
|
thread->retVal = 0;
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-05-01 14:34:00 +00:00
|
|
|
// INCOMPLETE
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #45 (0x2D)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_walkRelative(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #46 (0x2E)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_moveRelative(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #52 (0x34)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_throwActor(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #53 (0x35)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_waitWalk(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #55 (0x37)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_changeActorScene(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #56 (0x38)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_climb(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #58 (0x3A)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_setActorZ(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #60 (0x3C)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_getActorX(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #61 (0x3D)
|
2004-08-12 23:57:45 +00:00
|
|
|
int Script::SF_getActorY(R_SCRIPTFUNC_PARAMS) {
|
2004-09-25 10:11:17 +00:00
|
|
|
thread->pop();
|
2004-05-13 01:41:23 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
// Script function #63 (0x3F)
|
2004-09-23 06:53:46 +00:00
|
|
|
int Script::SF_playMusic(R_SCRIPTFUNC_PARAMS) {
|
2004-10-19 18:45:42 +00:00
|
|
|
SDataWord_T param = thread->pop() + 9;
|
2004-09-23 06:53:46 +00:00
|
|
|
|
2004-10-19 18:11:50 +00:00
|
|
|
if (param >= 9 && param <= 34)
|
|
|
|
_vm->_music->play(param);
|
2004-09-23 06:53:46 +00:00
|
|
|
else
|
|
|
|
_vm->_music->stop();
|
|
|
|
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-10-20 22:38:24 +00:00
|
|
|
// Script function #69
|
|
|
|
int Script::SF_enableEscape(R_SCRIPTFUNC_PARAMS) {
|
|
|
|
thread->pop();
|
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
int Script::SF_playSound(R_SCRIPTFUNC_PARAMS) {
|
2004-10-19 18:45:42 +00:00
|
|
|
SDataWord_T param = thread->pop() - 13;
|
2004-10-19 17:12:53 +00:00
|
|
|
|
|
|
|
if (/* param >= 0 && */ param < ARRAYSIZE(sfxTable))
|
|
|
|
_vm->_sndRes->playSound(sfxTable[param].res, sfxTable[param].vol);
|
|
|
|
else
|
|
|
|
_vm->_sound->stopSound();
|
|
|
|
|
2004-09-25 10:11:17 +00:00
|
|
|
return R_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
} // End of namespace Saga
|