SBSPSS/source/script/function.cpp

218 lines
5.3 KiB
C++
Raw Normal View History

2001-01-05 20:25:07 +01:00
/*
//text to speech hooks
question/response
//give item
*/
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
2000-12-20 21:15:24 +01:00
#ifndef __SYSTEM_GSTATE_H__
#include "system\gstate.h"
#endif
2000-12-14 22:46:02 +01:00
/* 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-20 21:15:24 +01:00
static signed short func_setCharacterAnimation(unsigned short *_args);
2000-12-15 21:29:33 +01:00
static signed short func_setText(unsigned short *_args);
2001-01-05 20:25:07 +01:00
static signed short func_giveItem(unsigned short *_args);
static signed short func_gotItem(unsigned short *_args);
static signed short func_setResponseOptions(unsigned short *_args);
static signed short func_getResponse(unsigned short *_args);
2000-12-20 21:15:24 +01:00
static signed short func_drawSprite(unsigned short *_args);
static signed short func_getFrameTime(unsigned short *_args);
2000-12-15 21:29:33 +01:00
2000-12-14 22:46:02 +01:00
/*----------------------------------------------------------------------
Vars
---- */
static FunctionDef s_functionDefs[]=
{
2001-01-05 20:25:07 +01:00
{ func_setCharacterAnimation, 2 }, // characterId,animationId
{ func_setText, 2 }, // characterId,textId
{ func_giveItem, 1 }, // itemId
{ func_gotItem, 1 }, // itemId
{ func_setResponseOptions, 1 }, // optionsId
{ func_getResponse, 0 }, //
2000-12-20 21:15:24 +01:00
{ func_drawSprite, 4 }, // frame,x,y,ot
{ func_getFrameTime, 0 }, //
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:
2001-01-05 20:25:07 +01:00
Purpose: Set characters animation state
Params: characterId,animationId
Returns: 0
2000-12-15 21:29:33 +01:00
---------------------------------------------------------------------- */
2000-12-20 21:15:24 +01:00
static signed short func_setCharacterAnimation(unsigned short *_args)
2000-12-15 21:29:33 +01:00
{
2001-01-05 20:25:07 +01:00
return 0;
2000-12-15 21:29:33 +01:00
}
/*----------------------------------------------------------------------
Function:
2001-01-05 20:25:07 +01:00
Purpose: Set text/speech/character for ingame texts
Params: characterId, textId
Returns: 0
2000-12-15 21:29:33 +01:00
---------------------------------------------------------------------- */
static signed short func_setText(unsigned short *_args)
{
2001-01-05 20:25:07 +01:00
return 0;
}
/*----------------------------------------------------------------------
Function:
Purpose: Flag item as collected
Params: itemId
Returns: 0
---------------------------------------------------------------------- */
static signed short func_giveItem(unsigned short *_args)
{
return 0;
}
/*----------------------------------------------------------------------
Function:
Purpose: Test whether an item has been collected or not
Params: itemId
Returns: true/false
---------------------------------------------------------------------- */
static signed short func_gotItem(unsigned short *_args)
{
return false;
}
/*----------------------------------------------------------------------
Function:
Purpose: Sets the allowable responses for a question
Params: optionsId
Returns: 0
---------------------------------------------------------------------- */
static signed short func_setResponseOptions(unsigned short *_args)
{
return 0;
}
/*----------------------------------------------------------------------
Function:
Purpose: Gets the response from a question
Params: optionsId
Returns: 0
---------------------------------------------------------------------- */
static signed short func_getResponse(unsigned short *_args)
{
return 0;
2000-12-15 21:29:33 +01:00
}
2000-12-14 22:46:02 +01:00
2000-12-20 21:15:24 +01:00
/*----------------------------------------------------------------------
Function:
Purpose:
Params: frame,x,y,ot
2001-01-05 20:25:07 +01:00
Returns: 0
2000-12-20 21:15:24 +01:00
---------------------------------------------------------------------- */
#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:
2001-01-05 20:25:07 +01:00
Params: 0
Returns: frameCount
2000-12-20 21:15:24 +01:00
---------------------------------------------------------------------- */
static signed short func_getFrameTime(unsigned short *_args)
{
return GameState::getFramesSinceLast();
}
2000-12-14 22:46:02 +01:00
/*===========================================================================
end */