2000-12-14 22:46:02 +01:00
|
|
|
/*=========================================================================
|
|
|
|
|
|
|
|
function.cpp
|
|
|
|
|
|
|
|
Author: PKG
|
|
|
|
Created:
|
|
|
|
Project: Spongebob
|
|
|
|
Purpose:
|
|
|
|
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
|
|
|
|
===========================================================================*/
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Includes
|
|
|
|
-------- */
|
|
|
|
|
|
|
|
#include "script\function.h"
|
|
|
|
|
|
|
|
#ifndef __SYSTEM_DBG_H__
|
|
|
|
#include "system\dbg.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* Std Lib
|
|
|
|
------- */
|
|
|
|
|
|
|
|
/* Data
|
|
|
|
---- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Tyepdefs && Defines
|
|
|
|
------------------- */
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Structure defintions
|
|
|
|
-------------------- */
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2000-12-15 21:29:33 +01:00
|
|
|
signed short (*m_func)(unsigned short *_args);
|
2000-12-14 22:46:02 +01:00
|
|
|
int m_argCount;
|
|
|
|
} FunctionDef;
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function Prototypes
|
|
|
|
------------------- */
|
|
|
|
|
2000-12-15 21:29:33 +01:00
|
|
|
static signed short func_setCharacterExpression(unsigned short *_args);
|
|
|
|
static signed short func_setText(unsigned short *_args);
|
|
|
|
|
|
|
|
|
2000-12-14 22:46:02 +01:00
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Vars
|
|
|
|
---- */
|
|
|
|
|
|
|
|
static FunctionDef s_functionDefs[]=
|
|
|
|
{
|
2000-12-15 21:29:33 +01:00
|
|
|
{ func_setCharacterExpression, 2 }, // character, expression
|
|
|
|
{ func_setText, 1 }, // textId
|
2000-12-14 22:46:02 +01:00
|
|
|
};
|
2000-12-15 21:29:33 +01:00
|
|
|
static const int s_numFunctionDefs=sizeof(s_functionDefs)/sizeof(FunctionDef);
|
2000-12-14 22:46:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
2000-12-15 21:29:33 +01:00
|
|
|
signed short callFunction(int _functionNumber,int _argCount,unsigned short *_args)
|
|
|
|
{
|
|
|
|
FunctionDef *fd;
|
|
|
|
|
|
|
|
ASSERT(_functionNumber<s_numFunctionDefs);
|
|
|
|
fd=&s_functionDefs[_functionNumber];
|
|
|
|
ASSERT(_argCount==fd->m_argCount);
|
|
|
|
return fd->m_func(_args);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
static signed short func_setCharacterExpression(unsigned short *_args)
|
|
|
|
{
|
|
|
|
return _args[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*----------------------------------------------------------------------
|
|
|
|
Function:
|
|
|
|
Purpose:
|
|
|
|
Params:
|
|
|
|
Returns:
|
|
|
|
---------------------------------------------------------------------- */
|
|
|
|
static signed short func_setText(unsigned short *_args)
|
|
|
|
{
|
|
|
|
return _args[0];
|
|
|
|
}
|
|
|
|
|
2000-12-14 22:46:02 +01:00
|
|
|
|
|
|
|
/*===========================================================================
|
|
|
|
end */
|