This commit is contained in:
Paul 2001-01-05 19:25:07 +00:00
parent 85076e653d
commit e1411394cb
12 changed files with 154 additions and 48 deletions

View file

@ -61,8 +61,13 @@ struct FunctionDef
---- */ ---- */
static FunctionDef s_functionNames[]= static FunctionDef s_functionNames[]=
{ {
{ "setCharacterAnimation", 2 }, // character,animation { "setCharacterAnimation", 2 }, // characterId,animationId
{ "setText", 1 }, // textId { "setText", 1 }, // textId
{ "giveItem", 1 }, // itemId
{ "gotItem", 1 }, // itemId
{ "setResponseOptions", 1 }, // optionsId
{ "getResponse", 0 }, //
{ "drawSprite", 4 }, // frame,x,y,ot { "drawSprite", 4 }, // frame,x,y,ot
{ "getFrameTime", 0 }, // { "getFrameTime", 0 }, //
}; };

View file

@ -99,6 +99,7 @@ extern int main(int argc, char *argv[])
} }
} }
printf("\n");
return ret; return ret;
} }

View file

@ -172,19 +172,21 @@ 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);
yyunput(*(name+strlen(name)-1));
name[strlen(name)-1]='\0';
while(1)
{
do do
{ {
replacement=lookupMacro(name,&result); nextChar=yyinput();
if(replacement)
{
break;
}
nextChar=yygetchar();
if(nextChar!=-1) if(nextChar!=-1)
{ {
if(strlen(name)>=255) if(strlen(name)>=255)
@ -202,9 +204,32 @@ void mylexer::unexpectedChar()
error(); error();
return; return;
} }
lookupMacro(name,&result);
} }
while(result==POSSIBLE_KNOWN_MACRO); 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
{
endOfMacro=name+strlen(name);
}
}
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();
} }
} }

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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..

View file

@ -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;

View file

@ -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)

View file

@ -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.

View file

@ -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