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