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:05:10 +00:00
|
|
|
// Scripting module private header
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
#ifndef SAGA_SCRIPT_H
|
|
|
|
#define SAGA_SCRIPT_H
|
|
|
|
|
2004-08-03 00:40:16 +00:00
|
|
|
#include "saga/text.h"
|
2004-12-15 00:24:12 +00:00
|
|
|
#include "saga/list.h"
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
namespace Saga {
|
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
#define SCRIPT_DATABUF_NUM 5
|
|
|
|
#define SCRIPT_DATABUF_LEN 1024
|
2004-08-12 23:57:45 +00:00
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
#define S_LUT_ENTRYLEN_ITECD 22
|
|
|
|
#define S_LUT_ENTRYLEN_ITEDISK 16
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
#define SCRIPT_TBLENTRY_LEN 4
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
#define SCRIPT_MAX 5000
|
|
|
|
#define SCRIPTLIST_HDR 12
|
|
|
|
#define SCRIPT_STRINGLIMIT 255
|
|
|
|
#define TAB " "
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
#define S_ERROR_PREFIX "SError: "
|
|
|
|
#define S_WARN_PREFIX "SWarning: "
|
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
#define SCRIPT_FUNCTION_MAX 78
|
2004-08-12 23:57:45 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
typedef unsigned int ScriptDataWord;
|
2004-08-12 23:57:45 +00:00
|
|
|
|
2004-12-25 11:17:03 +00:00
|
|
|
enum VerbTypes {
|
|
|
|
//todo: LUT for drawing
|
|
|
|
kVerbNone = 0,
|
2005-01-13 22:42:49 +00:00
|
|
|
kVerbPickUp = 1,
|
2004-12-25 11:17:03 +00:00
|
|
|
kVerbLookAt = 2,
|
|
|
|
kVerbWalkTo = 3,
|
2005-01-13 22:42:49 +00:00
|
|
|
kVerbTalkTo = 4,
|
2004-12-25 11:17:03 +00:00
|
|
|
kVerbOpen = 5,
|
|
|
|
kVerbClose = 6,
|
|
|
|
kVerbGive = 7,
|
|
|
|
kVerbUse = 8,
|
|
|
|
kVerbOptions = 9,
|
|
|
|
kVerbEnter = 10,
|
|
|
|
kVerbLeave = 11,
|
|
|
|
kVerbBegin = 12,
|
|
|
|
kVerbWalkOnly = 13,
|
2005-01-13 22:42:49 +00:00
|
|
|
kVerbLookOnly = 14,
|
|
|
|
|
|
|
|
kVerbTypesMax = kVerbLookOnly + 1
|
2004-08-12 23:57:45 +00:00
|
|
|
};
|
|
|
|
|
2004-10-27 02:27:54 +00:00
|
|
|
#define STHREAD_TIMESLICE 8
|
2004-08-12 23:57:45 +00:00
|
|
|
|
2004-10-09 07:39:46 +00:00
|
|
|
enum {
|
|
|
|
kVarObject = 0,
|
|
|
|
kVarWithObject,
|
|
|
|
kVarAction,
|
|
|
|
kVarActor
|
|
|
|
};
|
|
|
|
|
2004-12-21 06:49:07 +00:00
|
|
|
enum ThreadFlags {
|
2004-10-27 02:27:54 +00:00
|
|
|
kTFlagNone = 0,
|
|
|
|
kTFlagWaiting = 1, // wait for even denoted in waitType
|
|
|
|
kTFlagFinished = 2,
|
|
|
|
kTFlagAborted = 4,
|
2005-01-03 21:17:32 +00:00
|
|
|
kTFlagAsleep = kTFlagWaiting | kTFlagFinished | kTFlagAborted // Combination of all flags which can halt a thread
|
2004-10-27 02:27:54 +00:00
|
|
|
};
|
|
|
|
|
2004-12-21 06:49:07 +00:00
|
|
|
enum ThreadWaitTypes {
|
|
|
|
kWaitTypeNone = 0, // waiting for nothing
|
|
|
|
kWaitTypeDelay = 1, // waiting for a timer
|
|
|
|
kWaitTypeSpeech = 2, // waiting for speech to finish
|
|
|
|
kWaitTypeDialogEnd = 3, // waiting for my dialog to finish
|
|
|
|
kWaitTypeDialogBegin = 4, // waiting for other dialog to finish
|
|
|
|
kWaitTypeWalk = 5, // waiting to finish walking
|
|
|
|
kWaitTypeRequest = 6, // a request is up
|
2005-01-06 16:07:46 +00:00
|
|
|
kWaitTypePause = 7,
|
|
|
|
kWaitTypePlacard = 8
|
2004-12-21 06:49:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum OpCodes {
|
2004-12-22 21:04:50 +00:00
|
|
|
|
|
|
|
//...
|
|
|
|
opCcall = 0x18,
|
|
|
|
opCcallV = 0x19,
|
2005-01-03 21:17:32 +00:00
|
|
|
opEnter = 0x1A,
|
|
|
|
opReturn = 0x1B,
|
|
|
|
opReturnV = 0x1C,
|
2004-12-22 21:04:50 +00:00
|
|
|
//...
|
2005-01-17 20:17:06 +00:00
|
|
|
opSpeak = 0x53,
|
|
|
|
opDialogBegin = 0x54,
|
|
|
|
opDialogEnd = 0x55,
|
|
|
|
opReply = 0x56
|
2004-10-27 02:27:54 +00:00
|
|
|
};
|
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
enum CycleFlags {
|
2005-01-17 20:17:06 +00:00
|
|
|
kCyclePong = 1 << 0,
|
|
|
|
kCycleOnce = 1 << 1,
|
|
|
|
kCycleRandom = 1 << 2,
|
|
|
|
kCycleReverse = 1 << 3
|
2004-12-22 21:04:50 +00:00
|
|
|
};
|
2004-12-24 20:44:39 +00:00
|
|
|
|
2004-12-29 21:49:25 +00:00
|
|
|
enum WalkFlags {
|
2005-01-17 20:17:06 +00:00
|
|
|
kWalkBackPedal = 1 << 0,
|
|
|
|
kWalkAsync = 1 << 1,
|
|
|
|
kWalkUseAngle = 1 << 2,
|
|
|
|
kWalkFace = 1 << 5
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ReplyFlags {
|
|
|
|
kReplyOnce = 1 << 0,
|
|
|
|
kReplySummary = 1 << 1,
|
|
|
|
kReplyCondition = 1 << 2
|
2004-12-29 21:49:25 +00:00
|
|
|
};
|
|
|
|
|
2005-01-15 20:12:49 +00:00
|
|
|
struct ScriptThread {
|
2004-12-21 06:49:07 +00:00
|
|
|
int flags; // ThreadFlags
|
|
|
|
int waitType; // ThreadWaitTypes
|
2004-12-24 10:22:01 +00:00
|
|
|
void *threadObj; // which object we're handling
|
2004-08-12 23:57:45 +00:00
|
|
|
|
2004-10-27 02:27:54 +00:00
|
|
|
uint sleepTime;
|
2005-01-15 20:12:49 +00:00
|
|
|
int entrypointNumber; // Entrypoint number
|
|
|
|
unsigned long entrypointOffset; // Entrypoint offset
|
|
|
|
unsigned long instructionOffset; // Instruction offset
|
2004-08-12 23:57:45 +00:00
|
|
|
|
2004-09-23 06:46:44 +00:00
|
|
|
// The scripts are allowed to access the stack like any other memory
|
|
|
|
// area. It's therefore probably quite important that our stacks work
|
|
|
|
// the same as in the original interpreter.
|
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
ScriptDataWord stackBuf[64];
|
2004-09-23 06:46:44 +00:00
|
|
|
|
|
|
|
int stackPtr;
|
|
|
|
int framePtr;
|
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
ScriptDataWord threadVars[4];
|
2004-10-09 07:39:46 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
ScriptDataWord retVal;
|
2004-10-03 17:11:23 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
ScriptDataWord stackTop() {
|
2004-09-23 06:46:44 +00:00
|
|
|
return stackBuf[stackPtr];
|
|
|
|
}
|
|
|
|
|
|
|
|
int stackSize() {
|
|
|
|
return ARRAYSIZE(stackBuf) - stackPtr - 1;
|
|
|
|
}
|
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
void push(ScriptDataWord n) {
|
2004-09-23 06:46:44 +00:00
|
|
|
assert(stackPtr > 0);
|
|
|
|
stackBuf[--stackPtr] = n;
|
|
|
|
}
|
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
ScriptDataWord pop() {
|
2004-09-23 06:46:44 +00:00
|
|
|
assert(stackPtr < ARRAYSIZE(stackBuf));
|
|
|
|
return stackBuf[stackPtr++];
|
|
|
|
}
|
2004-12-21 06:49:07 +00:00
|
|
|
|
|
|
|
void wait(int aWaitType) {
|
|
|
|
waitType = aWaitType;
|
|
|
|
flags |= kTFlagWaiting;
|
|
|
|
}
|
2004-12-15 00:24:12 +00:00
|
|
|
|
2004-12-24 20:44:39 +00:00
|
|
|
void waitWalk(void *aThreadObj) {
|
|
|
|
wait(kWaitTypeWalk);
|
|
|
|
threadObj = aThreadObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
void waitDelay(int aSleepTime) {
|
|
|
|
wait(kWaitTypeDelay);
|
|
|
|
sleepTime = aSleepTime;
|
|
|
|
}
|
|
|
|
|
2005-01-15 20:12:49 +00:00
|
|
|
ScriptThread() {
|
|
|
|
memset(this, 0, sizeof(*this));
|
|
|
|
}
|
2004-08-12 23:57:45 +00:00
|
|
|
};
|
|
|
|
|
2005-01-15 20:12:49 +00:00
|
|
|
typedef SortedList<ScriptThread> ScriptThreadList;
|
2004-12-15 00:24:12 +00:00
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
struct PROC_TBLENTRY {
|
2004-04-12 21:40:49 +00:00
|
|
|
size_t name_offset;
|
|
|
|
size_t offset;
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
struct SCRIPT_BYTECODE {
|
2004-04-12 21:40:49 +00:00
|
|
|
unsigned char *bytecode_p;
|
|
|
|
size_t bytecode_len;
|
|
|
|
size_t ep_tbl_offset;
|
|
|
|
unsigned long n_entrypoints;
|
2004-10-27 21:32:28 +00:00
|
|
|
PROC_TBLENTRY *entrypoints;
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
struct VOICE_LUT {
|
2004-04-12 21:40:49 +00:00
|
|
|
int n_voices;
|
|
|
|
int *voices;
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-08 20:30:07 +00:00
|
|
|
struct ScriptData {
|
2004-04-12 21:40:49 +00:00
|
|
|
int loaded;
|
2004-10-27 21:32:28 +00:00
|
|
|
SCRIPT_BYTECODE *bytecode;
|
2005-01-08 21:06:06 +00:00
|
|
|
StringsTable strings;
|
2004-10-27 21:32:28 +00:00
|
|
|
VOICE_LUT *voice;
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
struct SCRIPT_LUT_ENTRY {
|
2004-04-12 21:40:49 +00:00
|
|
|
int script_rn;
|
|
|
|
int diag_list_rn;
|
|
|
|
int voice_lut_rn;
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
struct ScriptDataBuf {
|
|
|
|
ScriptDataWord *data;
|
|
|
|
int length;
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-15 20:12:49 +00:00
|
|
|
#define SCRIPTFUNC_PARAMS ScriptThread *thread, int nArgs
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-08-01 22:48:40 +00:00
|
|
|
class Script {
|
|
|
|
public:
|
2005-01-18 21:13:44 +00:00
|
|
|
StringsTable _mainStrings;
|
|
|
|
|
2004-08-01 22:48:40 +00:00
|
|
|
Script();
|
|
|
|
~Script();
|
|
|
|
|
2004-12-03 19:15:44 +00:00
|
|
|
void CF_script_togglestep();
|
|
|
|
|
2004-08-01 22:48:40 +00:00
|
|
|
int loadScript(int scriptNum);
|
|
|
|
int freeScript();
|
2004-10-27 21:32:28 +00:00
|
|
|
SCRIPT_BYTECODE *loadBytecode(byte *bytecode_p, size_t bytecode_len);
|
2005-01-08 20:30:07 +00:00
|
|
|
VOICE_LUT *loadVoiceLUT(const byte *voicelut_p, size_t voicelut_len, ScriptData *script);
|
2004-08-01 22:48:40 +00:00
|
|
|
|
2004-08-01 23:47:19 +00:00
|
|
|
bool isInitialized() const { return _initialized; }
|
|
|
|
bool isVoiceLUTPresent() const { return _voiceLUTPresent; }
|
2005-01-08 20:30:07 +00:00
|
|
|
ScriptData *currentScript() { return _currentScript; }
|
2004-12-22 21:04:50 +00:00
|
|
|
ScriptDataBuf *dataBuffer(int idx) { return &_dataBuf[idx]; }
|
|
|
|
int getWord(int bufNumber, int wordNumber, ScriptDataWord *data);
|
|
|
|
int putWord(int bufNumber, int wordNumber, ScriptDataWord data);
|
|
|
|
int setBit(int bufNumber, ScriptDataWord bitNumber, int bitState);
|
|
|
|
int getBit(int bufNumber, ScriptDataWord bitNumber, int *bitState);
|
2005-01-08 20:30:07 +00:00
|
|
|
const char * getScriptString(int index) const { return _currentScript->strings.getString(index); }
|
|
|
|
|
|
|
|
void doVerb();
|
2005-01-19 11:29:29 +00:00
|
|
|
void showVerb(int statuscolor = -1);
|
2005-01-08 20:30:07 +00:00
|
|
|
void setVerb(int verb);
|
2005-01-13 22:42:49 +00:00
|
|
|
int getCurrentVerb() const { return _currentVerb; }
|
2005-01-15 20:12:49 +00:00
|
|
|
void setPointerVerb();
|
2005-01-15 23:46:43 +00:00
|
|
|
void whichObject(const Point& mousePoint);
|
|
|
|
void hitObject(bool leftButton);
|
|
|
|
void playfieldClick(const Point& mousePoint, bool leftButton);
|
2005-01-15 20:12:49 +00:00
|
|
|
|
|
|
|
void setLeftButtonVerb(int verb);
|
2005-01-13 22:42:49 +00:00
|
|
|
int getLeftButtonVerb() const { return _leftButtonVerb; }
|
2005-01-15 20:12:49 +00:00
|
|
|
void setRightButtonVerb(int verb);
|
2005-01-13 22:42:49 +00:00
|
|
|
int getRightButtonVerb() const { return _rightButtonVerb; }
|
2005-01-15 20:12:49 +00:00
|
|
|
void setNonPlayfieldVerb() {
|
|
|
|
setRightButtonVerb(kVerbNone);
|
|
|
|
_pointerObject = ID_NOTHING;
|
|
|
|
_currentObject[_firstObjectSet ? 1 : 0] = ID_NOTHING;
|
|
|
|
}
|
2005-01-15 23:46:43 +00:00
|
|
|
void setNoPendingVerb() {
|
|
|
|
_pendingVerb = kVerbNone;
|
|
|
|
_currentObject[0] = _currentObject[0] = ID_NOTHING;
|
|
|
|
setPointerVerb();
|
|
|
|
}
|
2004-08-11 00:27:43 +00:00
|
|
|
|
2004-12-03 19:15:44 +00:00
|
|
|
void scriptInfo();
|
|
|
|
void scriptExec(int argc, const char **argv);
|
2004-08-01 23:47:19 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool _initialized;
|
|
|
|
bool _voiceLUTPresent;
|
2004-10-27 21:32:28 +00:00
|
|
|
RSCFILE_CONTEXT *_scriptContext;
|
|
|
|
SCRIPT_LUT_ENTRY *_scriptLUT;
|
2004-08-01 23:47:19 +00:00
|
|
|
int _scriptLUTMax;
|
|
|
|
uint16 _scriptLUTEntryLen;
|
2005-01-08 20:30:07 +00:00
|
|
|
ScriptData *_currentScript;
|
2004-12-22 21:04:50 +00:00
|
|
|
ScriptDataBuf _dataBuf[SCRIPT_DATABUF_NUM];
|
2004-12-15 00:24:12 +00:00
|
|
|
ScriptThreadList _threadList;
|
2005-01-18 21:13:44 +00:00
|
|
|
|
2005-01-08 20:30:07 +00:00
|
|
|
|
|
|
|
//verb
|
|
|
|
bool _firstObjectSet;
|
|
|
|
bool _secondObjectNeeded;
|
|
|
|
uint16 _currentObject[2];
|
2005-01-15 20:12:49 +00:00
|
|
|
int16 _currentObjectFlags[2];
|
2005-01-08 20:30:07 +00:00
|
|
|
int _currentVerb;
|
|
|
|
int _stickyVerb;
|
|
|
|
int _leftButtonVerb;
|
|
|
|
int _rightButtonVerb;
|
2005-01-15 20:12:49 +00:00
|
|
|
|
2005-01-15 23:46:43 +00:00
|
|
|
public:
|
|
|
|
uint16 _pendingObject[2];
|
|
|
|
int _pendingVerb;
|
2005-01-15 20:12:49 +00:00
|
|
|
uint16 _pointerObject;
|
2004-12-21 06:49:07 +00:00
|
|
|
|
|
|
|
public:
|
2004-10-27 02:27:54 +00:00
|
|
|
bool _skipSpeeches;
|
|
|
|
bool _abortEnabled;
|
|
|
|
|
2004-08-01 22:48:40 +00:00
|
|
|
int _dbg_singlestep;
|
|
|
|
int _dbg_dostep;
|
2005-01-15 20:12:49 +00:00
|
|
|
ScriptThread *_dbg_thread;
|
2004-10-27 21:32:28 +00:00
|
|
|
TEXTLIST_ENTRY *_dbg_txtentry;
|
2004-08-12 23:57:45 +00:00
|
|
|
|
|
|
|
public:
|
2005-01-15 20:12:49 +00:00
|
|
|
ScriptThread *createThread();
|
|
|
|
int executeThread(ScriptThread *thread, int entrypointNumber);
|
2004-12-21 06:49:07 +00:00
|
|
|
int executeThreads(uint msec);
|
2004-08-12 23:57:45 +00:00
|
|
|
int SThreadDebugStep();
|
2005-01-15 20:12:49 +00:00
|
|
|
void completeThread(void);
|
2004-12-21 06:49:07 +00:00
|
|
|
|
2004-12-24 10:22:01 +00:00
|
|
|
void wakeUpActorThread(int waitType, void *threadObj);
|
2004-12-21 06:49:07 +00:00
|
|
|
void wakeUpThreads(int waitType);
|
|
|
|
void wakeUpThreadsDelayed(int waitType, int sleepTime);
|
2004-08-12 23:57:45 +00:00
|
|
|
|
|
|
|
private:
|
2005-01-15 20:12:49 +00:00
|
|
|
void setFramePtr(ScriptThread *thread, int newPtr);
|
|
|
|
unsigned char *SThreadGetReadPtr(ScriptThread *thread);
|
2004-08-12 23:57:45 +00:00
|
|
|
unsigned long SThreadGetReadOffset(const byte *read_p);
|
2005-01-15 20:12:49 +00:00
|
|
|
size_t SThreadGetReadLen(ScriptThread *thread);
|
|
|
|
void runThread(ScriptThread *thread, int instr_limit);
|
|
|
|
void setThreadEntrypoint(ScriptThread *thread, int entrypointNumber);
|
2004-08-12 23:57:45 +00:00
|
|
|
|
2005-01-17 20:17:06 +00:00
|
|
|
private:
|
|
|
|
ScriptThread *_conversingThread;
|
|
|
|
|
2005-01-17 23:11:31 +00:00
|
|
|
public:
|
|
|
|
void finishDialog(int replyID, int flags, int bitOffset);
|
|
|
|
|
2004-08-12 23:57:45 +00:00
|
|
|
private:
|
2004-12-22 21:04:50 +00:00
|
|
|
typedef int (Script::*ScriptFunctionType)(SCRIPTFUNC_PARAMS);
|
2004-08-12 23:57:45 +00:00
|
|
|
|
2004-12-24 11:11:01 +00:00
|
|
|
struct ScriptFunctionDescription {
|
|
|
|
ScriptFunctionType scriptFunction;
|
|
|
|
const char *scriptFunctionName;
|
|
|
|
};
|
|
|
|
const ScriptFunctionDescription *_scriptFunctionsList;
|
2004-08-12 23:57:45 +00:00
|
|
|
|
|
|
|
void setupScriptFuncList(void);
|
2005-01-15 20:12:49 +00:00
|
|
|
void scriptError(ScriptThread *thread, const char *format, ...);
|
|
|
|
int SDebugPrintInstr(ScriptThread *thread);
|
2004-10-27 21:32:28 +00:00
|
|
|
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_putString(SCRIPTFUNC_PARAMS);
|
2004-12-22 21:04:50 +00:00
|
|
|
int sfWait(SCRIPTFUNC_PARAMS);
|
2004-10-27 21:32:28 +00:00
|
|
|
int SF_takeObject(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_objectIsCarried(SCRIPTFUNC_PARAMS);
|
2005-01-02 20:29:27 +00:00
|
|
|
int sfStatusBar(SCRIPTFUNC_PARAMS);
|
2005-01-06 14:02:53 +00:00
|
|
|
int SF_mainMode(SCRIPTFUNC_PARAMS);
|
2004-12-24 20:44:39 +00:00
|
|
|
int sfScriptWalkTo(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_doAction(SCRIPTFUNC_PARAMS);
|
2004-12-22 21:04:50 +00:00
|
|
|
int sfSetActorFacing(SCRIPTFUNC_PARAMS);
|
2004-12-28 03:44:07 +00:00
|
|
|
int sfStartBgdAnim(SCRIPTFUNC_PARAMS);
|
|
|
|
int sfStopBgdAnim(SCRIPTFUNC_PARAMS);
|
2005-01-06 14:02:53 +00:00
|
|
|
int sfLockUser(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_preDialog(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_killActorThreads(SCRIPTFUNC_PARAMS);
|
2005-01-06 19:15:01 +00:00
|
|
|
int sfFaceTowards(SCRIPTFUNC_PARAMS);
|
2004-12-22 21:04:50 +00:00
|
|
|
int sfSetFollower(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_gotoScene(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_setObjImage(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_setObjName(SCRIPTFUNC_PARAMS);
|
2004-11-07 15:35:42 +00:00
|
|
|
int SF_getObjImage(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_getNumber(SCRIPTFUNC_PARAMS);
|
2004-12-28 21:27:18 +00:00
|
|
|
int sfScriptOpenDoor(SCRIPTFUNC_PARAMS);
|
|
|
|
int sfScriptCloseDoor(SCRIPTFUNC_PARAMS);
|
2004-12-28 03:44:07 +00:00
|
|
|
int sfSetBgdAnimSpeed(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_cycleColors(SCRIPTFUNC_PARAMS);
|
2004-12-28 21:27:18 +00:00
|
|
|
int sfDoCenterActor(SCRIPTFUNC_PARAMS);
|
2004-12-28 03:44:07 +00:00
|
|
|
int sfStartBgdAnimSpeed(SCRIPTFUNC_PARAMS);
|
2004-12-29 21:49:25 +00:00
|
|
|
int sfScriptWalkToAsync(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_enableZone(SCRIPTFUNC_PARAMS);
|
2004-12-24 10:22:01 +00:00
|
|
|
int sfSetActorState(SCRIPTFUNC_PARAMS);
|
2004-12-22 21:04:50 +00:00
|
|
|
int scriptMoveTo(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_sceneEq(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_dropObject(SCRIPTFUNC_PARAMS);
|
2004-12-28 04:09:10 +00:00
|
|
|
int sfFinishBgdAnim(SCRIPTFUNC_PARAMS);
|
2004-12-22 21:04:50 +00:00
|
|
|
int sfSwapActors(SCRIPTFUNC_PARAMS);
|
|
|
|
int sfSimulSpeech(SCRIPTFUNC_PARAMS);
|
2004-12-29 21:49:25 +00:00
|
|
|
int sfScriptWalk(SCRIPTFUNC_PARAMS);
|
2004-12-22 21:04:50 +00:00
|
|
|
int sfCycleFrames(SCRIPTFUNC_PARAMS);
|
|
|
|
int sfSetFrame(SCRIPTFUNC_PARAMS);
|
2004-12-30 18:45:48 +00:00
|
|
|
int sfSetPortrait(SCRIPTFUNC_PARAMS);
|
|
|
|
int sfSetProtagPortrait(SCRIPTFUNC_PARAMS);
|
|
|
|
int sfChainBgdAnim(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_scriptSpecialWalk(SCRIPTFUNC_PARAMS);
|
2004-12-22 21:04:50 +00:00
|
|
|
int sfPlaceActor(SCRIPTFUNC_PARAMS);
|
2004-10-27 21:32:28 +00:00
|
|
|
int SF_checkUserInterrupt(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_walkRelative(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_moveRelative(SCRIPTFUNC_PARAMS);
|
2004-11-12 15:32:42 +00:00
|
|
|
int SF_simulSpeech2(SCRIPTFUNC_PARAMS);
|
2004-12-30 14:54:40 +00:00
|
|
|
int sfPlacard(SCRIPTFUNC_PARAMS);
|
|
|
|
int sfPlacardOff(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_setProtagState(SCRIPTFUNC_PARAMS);
|
2004-12-28 04:09:10 +00:00
|
|
|
int sfResumeBgdAnim(SCRIPTFUNC_PARAMS);
|
2004-10-27 21:32:28 +00:00
|
|
|
int SF_throwActor(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_waitWalk(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_sceneID(SCRIPTFUNC_PARAMS);
|
2004-10-27 21:32:28 +00:00
|
|
|
int SF_changeActorScene(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_climb(SCRIPTFUNC_PARAMS);
|
2004-12-28 21:27:18 +00:00
|
|
|
int sfSetDoorState(SCRIPTFUNC_PARAMS);
|
2004-10-27 21:32:28 +00:00
|
|
|
int SF_setActorZ(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_text(SCRIPTFUNC_PARAMS);
|
2004-10-27 21:32:28 +00:00
|
|
|
int SF_getActorX(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_getActorY(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_eraseDelta(SCRIPTFUNC_PARAMS);
|
2004-12-30 18:45:48 +00:00
|
|
|
int sfPlayMusic(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_pickClimbOutPos(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_tossRif(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_showControls(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_showMap(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_puzzleWon(SCRIPTFUNC_PARAMS);
|
2004-12-30 18:45:48 +00:00
|
|
|
int sfEnableEscape(SCRIPTFUNC_PARAMS);
|
|
|
|
int sfPlaySound(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_playLoopedSound(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_getDeltaFrame(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_showProtect(SCRIPTFUNC_PARAMS);
|
|
|
|
int SF_protectResult(SCRIPTFUNC_PARAMS);
|
2004-12-30 18:45:48 +00:00
|
|
|
int sfRand(SCRIPTFUNC_PARAMS);
|
2004-10-27 22:17:11 +00:00
|
|
|
int SF_fadeMusic(SCRIPTFUNC_PARAMS);
|
2004-11-06 22:33:08 +00:00
|
|
|
int SF_playVoice(SCRIPTFUNC_PARAMS);
|
2004-08-01 22:48:40 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2004-12-22 21:04:50 +00:00
|
|
|
inline int getSWord(ScriptDataWord word) {
|
|
|
|
uint16 uInt = word;
|
|
|
|
int sInt;
|
|
|
|
|
|
|
|
if (uInt & 0x8000U) {
|
|
|
|
sInt = (int)(uInt - 0x8000U) - 0x7FFF - 1;
|
|
|
|
} else {
|
|
|
|
sInt = uInt;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sInt;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint getUWord(ScriptDataWord word) {
|
|
|
|
return (uint16) word;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-04-12 21:40:49 +00:00
|
|
|
} // End of namespace Saga
|
|
|
|
|
|
|
|
#endif
|