diff options
author | Eugene Sandulenko | 2004-08-12 23:57:45 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2004-08-12 23:57:45 +0000 |
commit | 3fe739efb24e72a97fd9212657cd692df8d97c90 (patch) | |
tree | a063d8ab02f7cf19e179e4ae8c8f7e7504f30ac7 /saga/script.h | |
parent | cdb88416a850cea68baab90685c14aa1d7624111 (diff) | |
download | scummvm-rg350-3fe739efb24e72a97fd9212657cd692df8d97c90.tar.gz scummvm-rg350-3fe739efb24e72a97fd9212657cd692df8d97c90.tar.bz2 scummvm-rg350-3fe739efb24e72a97fd9212657cd692df8d97c90.zip |
Merge SDEBUG_*, SF_* and STHREAD_* into Script class.
svn-id: r14568
Diffstat (limited to 'saga/script.h')
-rw-r--r-- | saga/script.h | 104 |
1 files changed, 103 insertions, 1 deletions
diff --git a/saga/script.h b/saga/script.h index 69a2788285..46ef3b5f9b 100644 --- a/saga/script.h +++ b/saga/script.h @@ -26,12 +26,15 @@ #ifndef SAGA_SCRIPT_H #define SAGA_SCRIPT_H -#include "saga/sdata.h" #include "saga/text.h" #include "saga/yslib.h" +#include "common/stack.h" namespace Saga { +#define R_SCRIPT_DATABUF_NUM 5 +#define R_SCRIPT_DATABUF_LEN 1024 + #define R_S_LUT_ENTRYLEN_ITECD 22 #define R_S_LUT_ENTRYLEN_ITEDISK 16 @@ -47,6 +50,41 @@ namespace Saga { #define S_ERROR_PREFIX "SError: " #define S_WARN_PREFIX "SWarning: " +#define R_SFUNC_NUM 78 + +typedef unsigned int SDataWord_T; + +enum R_SCRIPT_VERBS { + S_VERB_WALKTO = 0, + S_VERB_LOOKAT = 2, + S_VERB_PICKUP = 1, + S_VERB_TALKTO, + S_VERB_OPEN = 5, + S_VERB_CLOSE = 6, + S_VERB_USE = 8, + S_VERB_GIVE +}; + +#define STHREAD_DEF_INSTR_COUNT 8 + +struct R_SEMAPHORE { + int hold_count; +}; + +struct R_SCRIPT_THREAD_tag { + int executing; + + int sleep_time; + int ep_num; // Entrypoint number + unsigned long ep_offset; // Entrypoint offset + unsigned long i_offset; // Instruction offset + + R_SEMAPHORE sem; + Common::Stack<SDataWord_T> *stack; +}; + +typedef struct R_SCRIPT_THREAD_tag R_SCRIPT_THREAD; + struct R_PROC_TBLENTRY { size_t name_offset; size_t offset; @@ -89,6 +127,7 @@ struct R_SCRIPT_DATABUF { int len; }; +#define R_SCRIPTFUNC_PARAMS R_SCRIPT_THREAD *thread class Script { public: @@ -129,6 +168,69 @@ public: int _dbg_dostep; R_SCRIPT_THREAD *_dbg_thread; R_TEXTLIST_ENTRY *_dbg_txtentry; + +public: + R_SCRIPT_THREAD *SThreadCreate(); + int SThreadExecute(R_SCRIPT_THREAD *thread, int ep_num); + int SThreadExecThreads(int msec); + int SThreadHoldSem(R_SEMAPHORE *sem); + int SThreadReleaseSem(R_SEMAPHORE *sem); + int SThreadDebugStep(); + void SThreadCompleteThread(void); + int SThreadDestroy(R_SCRIPT_THREAD *thread); + +private: + unsigned char *SThreadGetReadPtr(R_SCRIPT_THREAD *thread); + unsigned long SThreadGetReadOffset(const byte *read_p); + size_t SThreadGetReadLen(R_SCRIPT_THREAD *thread); + int SThreadRun(R_SCRIPT_THREAD *thread, int instr_limit, int msec); + int SThreadSetEntrypoint(R_SCRIPT_THREAD *thread, int ep_num); + +private: + typedef int (Script::*SFunc_T)(R_SCRIPTFUNC_PARAMS); + + struct R_SFUNC_ENTRY { + int sfunc_num; + int sfunc_argc; + SFunc_T sfunc_fp; + }; + + const R_SFUNC_ENTRY *_SFuncList; + + void setupScriptFuncList(void); + int SDebugPrintInstr(R_SCRIPT_THREAD *thread); + + int SF_sleep(R_SCRIPTFUNC_PARAMS); + int SF_3(R_SCRIPTFUNC_PARAMS); + int SF_setCommandText(R_SCRIPTFUNC_PARAMS); + int SF_actorWalkTo(R_SCRIPTFUNC_PARAMS); + int SF_setFacing(R_SCRIPTFUNC_PARAMS); + int SF_freezeInterface(R_SCRIPTFUNC_PARAMS); + int SF_startAnim(R_SCRIPTFUNC_PARAMS); + int SF_actorWalkToAsync(R_SCRIPTFUNC_PARAMS); + int SF_moveTo(R_SCRIPTFUNC_PARAMS); + int SF_actorWalk(R_SCRIPTFUNC_PARAMS); + int SF_cycleActorFrames(R_SCRIPTFUNC_PARAMS); + int SF_setFrame(R_SCRIPTFUNC_PARAMS); + int SF_linkAnim(R_SCRIPTFUNC_PARAMS); + int SF_placeActor(R_SCRIPTFUNC_PARAMS); + int SF_checkUserInterrupt(R_SCRIPTFUNC_PARAMS); + int SF_moveRelative(R_SCRIPTFUNC_PARAMS); + int SF_doAction(R_SCRIPTFUNC_PARAMS); + int SF_faceTowards(R_SCRIPTFUNC_PARAMS); + int SF_setFollower(R_SCRIPTFUNC_PARAMS); + int SF_centerActor(R_SCRIPTFUNC_PARAMS); + int SF_setActorState(R_SCRIPTFUNC_PARAMS); + int SF_swapActors(R_SCRIPTFUNC_PARAMS); + int SF_scriptSpecialWalk(R_SCRIPTFUNC_PARAMS); + int SF_walkRelative(R_SCRIPTFUNC_PARAMS); + int SF_throwActor(R_SCRIPTFUNC_PARAMS); + int SF_waitWalk(R_SCRIPTFUNC_PARAMS); + int SF_changeActorScene(R_SCRIPTFUNC_PARAMS); + int SF_climb(R_SCRIPTFUNC_PARAMS); + int SF_setActorZ(R_SCRIPTFUNC_PARAMS); + int SF_getActorX(R_SCRIPTFUNC_PARAMS); + int SF_getActorY(R_SCRIPTFUNC_PARAMS); }; } // End of namespace Saga |