This commit is contained in:
parent
85076e653d
commit
e1411394cb
12 changed files with 154 additions and 48 deletions
|
@ -61,10 +61,15 @@ struct FunctionDef
|
|||
---- */
|
||||
static FunctionDef s_functionNames[]=
|
||||
{
|
||||
{ "setCharacterAnimation", 2 }, // character,animation
|
||||
{ "setText", 1 }, // textId
|
||||
{ "drawSprite", 4 }, // frame,x,y,ot
|
||||
{ "getFrameTime", 0 }, //
|
||||
{ "setCharacterAnimation", 2 }, // characterId,animationId
|
||||
{ "setText", 1 }, // textId
|
||||
{ "giveItem", 1 }, // itemId
|
||||
{ "gotItem", 1 }, // itemId
|
||||
{ "setResponseOptions", 1 }, // optionsId
|
||||
{ "getResponse", 0 }, //
|
||||
|
||||
{ "drawSprite", 4 }, // frame,x,y,ot
|
||||
{ "getFrameTime", 0 }, //
|
||||
};
|
||||
static int s_functionCount=sizeof(s_functionNames)/sizeof(FunctionDef);
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ extern int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -172,39 +172,64 @@ void mylexer::unexpectedChar()
|
|||
{
|
||||
int result;
|
||||
char name[256]="\0";
|
||||
char *endOfMacro=name;
|
||||
char *replacement;
|
||||
int nextChar;
|
||||
char c[2]="*"; // Err...
|
||||
int extraChars=0;
|
||||
|
||||
// Search for a macro
|
||||
strcat(name,yytext);
|
||||
do
|
||||
yyunput(*(name+strlen(name)-1));
|
||||
name[strlen(name)-1]='\0';
|
||||
while(1)
|
||||
{
|
||||
replacement=lookupMacro(name,&result);
|
||||
if(replacement)
|
||||
do
|
||||
{
|
||||
break;
|
||||
}
|
||||
nextChar=yygetchar();
|
||||
if(nextChar!=-1)
|
||||
{
|
||||
if(strlen(name)>=255)
|
||||
nextChar=yyinput();
|
||||
if(nextChar!=-1)
|
||||
{
|
||||
printf("OVERFLOW WHILE LOOKING UP MACRO\n");
|
||||
if(strlen(name)>=255)
|
||||
{
|
||||
printf("OVERFLOW WHILE LOOKING UP MACRO\n");
|
||||
error();
|
||||
return;
|
||||
}
|
||||
c[0]=(char)nextChar;
|
||||
strcat(name,c);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("END OF FILE WHILE LOOKING FOR MACRO\n");
|
||||
error();
|
||||
return;
|
||||
}
|
||||
c[0]=(char)nextChar;
|
||||
strcat(name,c);
|
||||
lookupMacro(name,&result);
|
||||
}
|
||||
while(result==POSSIBLE_KNOWN_MACRO);
|
||||
|
||||
if(result==UNKNOWN_MACRO)
|
||||
{
|
||||
if(endOfMacro!=name)
|
||||
{
|
||||
char *cp;
|
||||
cp=name+strlen(name)-1;
|
||||
while(cp!=endOfMacro-1)
|
||||
{
|
||||
yyunput(*cp--);
|
||||
name[strlen(name)-1]='\0';
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("END OF FILE WHILE LOOKING FOR MACRO\n");
|
||||
error();
|
||||
return;
|
||||
endOfMacro=name+strlen(name);
|
||||
}
|
||||
}
|
||||
while(result==POSSIBLE_KNOWN_MACRO);
|
||||
|
||||
|
||||
replacement=lookupMacro(name,&result);
|
||||
if(result==KNOWN_MACRO)
|
||||
{
|
||||
// Err.. shove the string into the input buffer ( is this good? )
|
||||
|
@ -214,11 +239,7 @@ void mylexer::unexpectedChar()
|
|||
{
|
||||
yyunput(*--ptr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("UNEXPECTED STRING: '%s'\n",name);
|
||||
error();
|
||||
printf("found macro '%s'='%s'\n",name,replacement);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
scripts/test.dat
|
||||
scripts/speechtest.dat
|
||||
translations/swe.dat
|
||||
translations/dut.dat
|
||||
translations/ita.dat
|
||||
|
|
|
@ -18,5 +18,4 @@
|
|||
#define ITEM_JELLYFISH_2 15
|
||||
#define ITEM_JELLYFISH_3 16
|
||||
#define ITEM_JAM_JAR 17
|
||||
#define ITEM_BUBBLE_MIXTURE 18
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
// Answers
|
||||
#define ANSWER_NONE 0
|
||||
#defein ANSWER_OK 1
|
||||
#define ANSWER_OK 1
|
||||
#define ANSWER_YES 2
|
||||
#define ANSWER_NO 3
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Texts
|
||||
|
||||
#define C1_L1__KARATE_MOVES__SANDY_1
|
||||
#define C1_L1__DICING_HELMET__SANDY_1
|
||||
#define C1_L1__KARATE_MOVES__SANDY_1 0
|
||||
#define C1_L1__DICING_HELMET__SANDY_1 1
|
||||
// etc..
|
|
@ -5,7 +5,6 @@
|
|||
#include data/scripts/defs/response.scr
|
||||
#include data/scripts/defs/text.scr
|
||||
|
||||
|
||||
_setCharacterAnimation(CHAR_SPONGEBOB,ANIM_QUIET);
|
||||
_setText(C1_L1__KARATE_MOVES__SANDY_1);
|
||||
_setResponseOptions(QUESTION_OK);
|
||||
|
@ -14,5 +13,4 @@ do
|
|||
pause;
|
||||
}
|
||||
while(_getResponse()!=ANSWER_NONE);
|
||||
|
||||
stop;
|
||||
|
|
|
@ -299,9 +299,10 @@ GFX_DATA_OUT += $(MUSIC_ALL_OUT)
|
|||
#----------------------------------------------------------------------------
|
||||
# Script stuff..
|
||||
#----------------------------------------------------------------------------
|
||||
SCRIPTS_LIST := test \
|
||||
speechtest
|
||||
|
||||
SCRIPTS_IN_DIR := $(GAME_DATA_DIR)/scripts
|
||||
SCRIPTS_LIST := test
|
||||
SCRIPTS_IN := $(foreach SCRIPT,$(SCRIPTS_LIST),$(SCRIPTS_IN_DIR)/$(SCRIPT).scr)
|
||||
|
||||
SCRIPTS_OUT_DIR := $(DATA_OUT)/scripts
|
||||
SCRIPTS_OUT := $(foreach SCRIPT,$(SCRIPTS_LIST),$(SCRIPTS_OUT_DIR)/$(SCRIPT).dat)
|
||||
|
@ -311,7 +312,7 @@ scripts : $(SCRIPTS_OUT)
|
|||
cleanscripts:
|
||||
@$(RM) -f $(SCRIPTS_OUT)
|
||||
|
||||
$(SCRIPTS_OUT) : $(SCRIPTS_IN)
|
||||
$(SCRIPTS_OUT_DIR)/%.dat : $(SCRIPTS_IN_DIR)/%.scr
|
||||
@scripter $< $@
|
||||
|
||||
GRAF_DIRS_TO_MAKE += $(SCRIPTS_OUT_DIR)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/*
|
||||
//text to speech hooks
|
||||
question/response
|
||||
//give item
|
||||
*/
|
||||
/*=========================================================================
|
||||
|
||||
function.cpp
|
||||
|
@ -54,6 +59,11 @@ typedef struct
|
|||
|
||||
static signed short func_setCharacterAnimation(unsigned short *_args);
|
||||
static signed short func_setText(unsigned short *_args);
|
||||
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);
|
||||
|
||||
static signed short func_drawSprite(unsigned short *_args);
|
||||
static signed short func_getFrameTime(unsigned short *_args);
|
||||
|
||||
|
@ -64,8 +74,13 @@ static signed short func_getFrameTime(unsigned short *_args);
|
|||
|
||||
static FunctionDef s_functionDefs[]=
|
||||
{
|
||||
{ func_setCharacterAnimation, 2 }, // character,animation
|
||||
{ func_setText, 1 }, // textId
|
||||
{ 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 }, //
|
||||
|
||||
{ func_drawSprite, 4 }, // frame,x,y,ot
|
||||
{ func_getFrameTime, 0 }, //
|
||||
};
|
||||
|
@ -93,25 +108,74 @@ signed short callFunction(int _functionNumber,int _argCount,unsigned short *_arg
|
|||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params: character,animation
|
||||
Returns:
|
||||
Purpose: Set characters animation state
|
||||
Params: characterId,animationId
|
||||
Returns: 0
|
||||
---------------------------------------------------------------------- */
|
||||
static signed short func_setCharacterAnimation(unsigned short *_args)
|
||||
{
|
||||
return _args[0];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params: textid
|
||||
Returns:
|
||||
Purpose: Set text/speech/character for ingame texts
|
||||
Params: characterId, textId
|
||||
Returns: 0
|
||||
---------------------------------------------------------------------- */
|
||||
static signed short func_setText(unsigned short *_args)
|
||||
{
|
||||
return _args[0];
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,7 +183,7 @@ static signed short func_setText(unsigned short *_args)
|
|||
Function:
|
||||
Purpose:
|
||||
Params: frame,x,y,ot
|
||||
Returns:
|
||||
Returns: 0
|
||||
---------------------------------------------------------------------- */
|
||||
#include "gfx\sprbank.h"
|
||||
SpriteBank *sb=NULL;
|
||||
|
@ -140,8 +204,8 @@ static signed short func_drawSprite(unsigned short *_args)
|
|||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params: textid
|
||||
Returns:
|
||||
Params: 0
|
||||
Returns: frameCount
|
||||
---------------------------------------------------------------------- */
|
||||
static signed short func_getFrameTime(unsigned short *_args)
|
||||
{
|
||||
|
|
Binary file not shown.
|
@ -698,9 +698,25 @@ SOURCE=..\..\..\data\scripts\defs\charanim.scr
|
|||
|
||||
SOURCE=..\..\..\data\scripts\defs\defs.scr
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\data\scripts\defs\items.scr
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\data\scripts\defs\response.scr
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\data\scripts\defs\text.scr
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\data\scripts\speechtest.scr
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\data\scripts\test.scr
|
||||
# End Source File
|
||||
# End Group
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue