This commit is contained in:
parent
fda1fc3ca7
commit
b56cd688ae
16 changed files with 1569 additions and 849 deletions
|
@ -22,6 +22,10 @@
|
|||
#include "system\dbg.h"
|
||||
#endif
|
||||
|
||||
#ifndef __SYSTEM_GSTATE_H__
|
||||
#include "system\gstate.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* Std Lib
|
||||
------- */
|
||||
|
@ -48,8 +52,10 @@ typedef struct
|
|||
Function Prototypes
|
||||
------------------- */
|
||||
|
||||
static signed short func_setCharacterExpression(unsigned short *_args);
|
||||
static signed short func_setCharacterAnimation(unsigned short *_args);
|
||||
static signed short func_setText(unsigned short *_args);
|
||||
static signed short func_drawSprite(unsigned short *_args);
|
||||
static signed short func_getFrameTime(unsigned short *_args);
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
|
@ -58,8 +64,10 @@ static signed short func_setText(unsigned short *_args);
|
|||
|
||||
static FunctionDef s_functionDefs[]=
|
||||
{
|
||||
{ func_setCharacterExpression, 2 }, // character, expression
|
||||
{ func_setCharacterAnimation, 2 }, // character,animation
|
||||
{ func_setText, 1 }, // textId
|
||||
{ func_drawSprite, 4 }, // frame,x,y,ot
|
||||
{ func_getFrameTime, 0 }, //
|
||||
};
|
||||
static const int s_numFunctionDefs=sizeof(s_functionDefs)/sizeof(FunctionDef);
|
||||
|
||||
|
@ -86,10 +94,10 @@ signed short callFunction(int _functionNumber,int _argCount,unsigned short *_arg
|
|||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Params: character,animation
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
static signed short func_setCharacterExpression(unsigned short *_args)
|
||||
static signed short func_setCharacterAnimation(unsigned short *_args)
|
||||
{
|
||||
return _args[0];
|
||||
}
|
||||
|
@ -98,7 +106,7 @@ static signed short func_setCharacterExpression(unsigned short *_args)
|
|||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Params: textid
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
static signed short func_setText(unsigned short *_args)
|
||||
|
@ -107,5 +115,39 @@ static signed short func_setText(unsigned short *_args)
|
|||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params: frame,x,y,ot
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
#include "gfx\sprbank.h"
|
||||
SpriteBank *sb=NULL;
|
||||
static signed short func_drawSprite(unsigned short *_args)
|
||||
{
|
||||
sFrameHdr *fh;
|
||||
if(!sb)
|
||||
{
|
||||
sb=new ("sb") SpriteBank;
|
||||
sb->load(UI_UIGFX_SPR);
|
||||
}
|
||||
fh=sb->getFrameHeader(_args[0]);
|
||||
sb->printFT4(_args[0],_args[1]-(fh->W/2),_args[2]-(fh->H/2),0,0,_args[3]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params: textid
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
static signed short func_getFrameTime(unsigned short *_args)
|
||||
{
|
||||
return GameState::getFramesSinceLast();
|
||||
}
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
end */
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
------------------- */
|
||||
|
||||
//#define FULL_CODE_OUTPUT
|
||||
//#define SHOW_RUN_COUNT
|
||||
//#define SHOW_RUN_COUNT
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
|
@ -258,6 +258,24 @@ PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
|||
#endif
|
||||
push(val1!=val2);
|
||||
break;
|
||||
|
||||
case OP_IS_LESSTHAN_VALUE: // value, value pushes result ( 0 or 1 ) to stack
|
||||
val1=pop();
|
||||
val2=pop();
|
||||
#ifdef FULL_CODE_OUTPUT
|
||||
PAUL_DBGMSG("OP_IS_LESSTHAN_VALUE %d,%d",val1,val2);
|
||||
#endif
|
||||
push(val1<val2);
|
||||
break;
|
||||
|
||||
case OP_IS_GREATERTHAN_VALUE:// value, value pushes result ( 0 or 1 ) to stack
|
||||
val1=pop();
|
||||
val2=pop();
|
||||
#ifdef FULL_CODE_OUTPUT
|
||||
PAUL_DBGMSG("OP_IS_GREATERTHAN_VALUE %d,%d",val1,val2);
|
||||
#endif
|
||||
push(val1>val2);
|
||||
break;
|
||||
|
||||
case OP_ASSIGN: // varidx, value
|
||||
val1=pop();
|
||||
|
@ -276,7 +294,15 @@ PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
|||
#endif
|
||||
push(val1+val2);
|
||||
break;
|
||||
|
||||
|
||||
case OP_NEG: // value pushes result to stack
|
||||
val1=pop();
|
||||
#ifdef FULL_CODE_OUTPUT
|
||||
PAUL_DBGMSG("NEG %d",val1);
|
||||
#endif
|
||||
push(-val1);
|
||||
break;
|
||||
|
||||
case OP_PRINT: // value
|
||||
val1=pop();
|
||||
PAUL_DBGMSG("PRINT %d",val1);
|
||||
|
@ -291,7 +317,7 @@ PAUL_DBGMSG("pc:0x%04d sp:%03d",m_pc*2,m_sp);
|
|||
ASSERT(val2<MAX_FUNCTION_ARGS); // Too many args.. just increase the #define to fix this
|
||||
for(i=0;i<val2;i++)
|
||||
{
|
||||
s_argBuffer[i]=pop();
|
||||
s_argBuffer[val2-i-1]=pop();
|
||||
}
|
||||
val3=callFunction(val1,val2,s_argBuffer);
|
||||
#ifdef FULL_CODE_OUTPUT
|
||||
|
|
|
@ -55,9 +55,16 @@ private:
|
|||
// Local vars
|
||||
enum
|
||||
{
|
||||
TMP0,
|
||||
TMP1,
|
||||
TMP2,
|
||||
TMP3,
|
||||
TMP4,
|
||||
TMP5,
|
||||
TMP6,
|
||||
TMP7,
|
||||
TMP8,
|
||||
TMP9,
|
||||
NUM_LOCAL_VARS,
|
||||
};
|
||||
|
||||
|
@ -93,8 +100,11 @@ private:
|
|||
OP_JMPT, // jump, value
|
||||
OP_IS_EQUAL_VALUE, // value, value pushes result ( 0 or 1 ) to stack
|
||||
OP_IS_NOTEQUAL_VALUE, // value, value pushes result ( 0 or 1 ) to stack
|
||||
OP_IS_LESSTHAN_VALUE, // value, value pushes result ( 0 or 1 ) to stack
|
||||
OP_IS_GREATERTHAN_VALUE,// value, value pushes result ( 0 or 1 ) to stack
|
||||
OP_ASSIGN, // varidx, value
|
||||
OP_ADD, // value, value pushes result to stack
|
||||
OP_NEG, // value pushes result to stack
|
||||
OP_PRINT, // value
|
||||
OP_CALL_FUNCTION, // functionnumber, argcount args pushes return value to stack
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue