Program : /* empty */
{
g_vAnimations.clear();
}
| Program Animation
{
g_vAnimations.push_back($2);
}
;
Animation : ANIMATIONKW STRING CURLY_OPEN AnimationProperties AnimationFrames CURLY_CLOSE
{
Animation an($1, $2);
an.SetProperties($4);
an.setFrames($5);
$$ = an;
}
;
AnimationProperties : AnimationProperty
{
std::vector<FieldStorage> fss;
$$ = fss;
$$.push_back($1);
}
| AnimationProperties AnimationProperty
{
$$ = $1;
$$.push_back($2);
}
;
AnimationProperty : TILE_SIZEKW EQUAL NUMBER SEMICOL
{
FieldStorage fs(AP_TILESIZE, $3, $1);
$$ = fs;
}
| VIEWKW EQUAL Direction SEMICOL
{
$$ = $3;
$$.m_iLine = $1;
}
;
Direction : NORTHKW
{
FieldStorage fs(AP_VIEW, VD_NORTH, $1);
$$ = fs;
}
| EASTKW
{
FieldStorage fs(AP_VIEW, VD_EAST, $1);
$$ = fs;
}
| SOUTHKW
{
FieldStorage fs(AP_VIEW, VD_SOUTH, $1);
$$ = fs;
}
| WESTKW
{
FieldStorage fs(AP_VIEW, VD_WEST, $1);
$$ = fs;
}
;
AnimationFrames : AnimationFrame
{
std::vector<AnimationFrame> elements;
$$ = elements;
$$.push_back($1;);
}
| AnimationFrames AnimationFrame
{
$$ = $1;
$$.push_back($2);
}
;
AnimationFrame : FRAMEKW CURLY_OPEN FrameProperties FrameElements CURLY_CLOSE
{
AnimationFrame af($1);
af.SetProperties($3);
af.SetFrames($4);
$$ = af;
}
;
FrameProperties : /* empty */
{
FieldStorage fs;
$$ = fs;
}
| SOUNDKW EQUAL NUMBER SEMICOL
{
FieldStorage fs(AF_SOUND, $3, $1);
$$ = fs;
}
;
FrameElements : FrameElement
{
std::vector<FrameElement> elements;
$$ = elements;
$$.push_back($1;);
}
| FrameElements FrameElement
{
$$ = $1;
$$.push_back($2);
}
;
FrameElement : ELEMENTKW CURLY_OPEN ElementFields CURLY_CLOSE
{
FrameElement fe($1);
fe.AssignFields($3);
$$ = fe;
}
;
ElementFields : ElementField
{
std::vector<FieldStorage> fss;
$$ = fss;
$$.push_back($1);
}
| ElementFields ElementField
{
$$ = $1;
$$.push_back($2);
}
;
ElementField : TOPKW EQUAL NUMBER SEMICOL
{
FieldStorage fs(FE_TOP, $3, $1);
$$ = fs;
}
| LEFTKW EQUAL NUMBER SEMICOL
{
FieldStorage fs(FE_LEFT, $3, $1);
$$ = fs;
}
| WIDTHKW EQUAL NUMBER SEMICOL
{
FieldStorage fs(FE_WIDTH, $3, $1);
$$ = fs;
}
| HEIGHTKW EQUAL NUMBER SEMICOL
{
FieldStorage fs(FE_HEIGHT, $3, $1);
$$ = fs;
}
| X_OFFSETKW EQUAL NUMBER SEMICOL
{
FieldStorage fs(FE_XOFFSET, $3, $1);
$$ = fs;
}
| Y_OFFSETKW EQUAL NUMBER SEMICOL
{
FieldStorage fs(FE_YOFFSET, $3, $1);
$$ = fs;
}
| BASE_IMGKW EQUAL STRING SEMICOL
{
FieldStorage fs(FE_IMAGE, $3, $1);
$$ = fs;
}
| RECOLOURKW EQUAL STRING SEMICOL
{
FieldStorage fs(FE_RECOLOUR, $3, $1);
$$ = fs;
}
| LAYERKW NUMBER EQUAL NUMBER SEMICOL
{
FieldStorage fs(FE_RECOLLAYER, $2, $4, $1);
$$ = fs;
}
| DISPLAYKW NUMBER EQUAL NUMBER SEMICOL
{
FieldStorage fs(FE_DISPLAY, $2, $4, $1);
$$ = fs;
}
| ALPHAKW EQUAL NUMBER SEMICOL
{
FieldStorage fs(FE_ALPHA, $3, $1);
$$ = fs;
}
| HOR_FLIPKW
{
FieldStorage fs(FE_HORFLIP, 1, $1);
$$ = fs;
}
| VERT_FLIPKW
{
FieldStorage fs(FE_VERTFLIP, 1, $1);
$$ = fs;
}
;