- started work on parser

- implemented empty class methods.


SVN r2871 (finale)
This commit is contained in:
Christoph Oelckers 2010-10-01 22:58:31 +00:00
parent 9ef5c47e18
commit cf099f99e0
5 changed files with 310 additions and 13 deletions

View file

@ -99,8 +99,9 @@ struct FMapInfoParser
void SkipToNext(); void SkipToNext();
void CheckEndOfFile(const char *block); void CheckEndOfFile(const char *block);
FName CheckEndSequence(FScanner &sc); void ParseIntermission();
FName ParseEndGame(FScanner &sc); FName CheckEndSequence();
FName ParseEndGame();
}; };
#define DEFINE_MAP_OPTION(name, old) \ #define DEFINE_MAP_OPTION(name, old) \

View file

@ -771,7 +771,7 @@ void FMapInfoParser::ParseNextMap(char *mapname)
sc.MustGetString(); sc.MustGetString();
strncpy (mapname, sc.String, 8); strncpy (mapname, sc.String, 8);
mapname[8] = 0; mapname[8] = 0;
CheckEndSequence(sc); CheckEndSequence();
} }
} }
@ -1749,6 +1749,18 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i
sc.ScriptError("gameinfo definitions not supported with old MAPINFO syntax"); sc.ScriptError("gameinfo definitions not supported with old MAPINFO syntax");
} }
} }
else if (sc.Compare("intermission"))
{
if (format_type != FMT_Old)
{
format_type = FMT_New;
ParseIntermission();
}
else
{
sc.ScriptError("intermission definitions not supported with old MAPINFO syntax");
}
}
else else
{ {
sc.ScriptError("%s: Unknown top level keyword", sc.String); sc.ScriptError("%s: Unknown top level keyword", sc.String);

View file

@ -37,6 +37,100 @@
#include "w_wad.h" #include "w_wad.h"
#include "intermission/intermission.h" #include "intermission/intermission.h"
IMPLEMENT_CLASS(DIntermissionScreen)
IMPLEMENT_CLASS(DIntermissionScreenFader)
IMPLEMENT_CLASS(DIntermissionScreenText)
IMPLEMENT_CLASS(DIntermissionScreenCast)
IMPLEMENT_CLASS(DIntermissionController)
void DIntermissionScreen::Init(FIntermissionDescriptor *desc)
{
}
bool DIntermissionScreen::Responder (event_t *ev)
{
return false;
}
void DIntermissionScreen::Ticker ()
{
}
void DIntermissionScreen::Drawer ()
{
}
void DIntermissionScreenFader::Init(FIntermissionDescriptor *desc)
{
}
bool DIntermissionScreenFader::Responder (event_t *ev)
{
return false;
}
void DIntermissionScreenFader::Ticker ()
{
}
void DIntermissionScreenFader::Drawer ()
{
}
void DIntermissionScreenText::Init(FIntermissionDescriptor *desc)
{
}
bool DIntermissionScreenText::Responder (event_t *ev)
{
return false;
}
void DIntermissionScreenText::Ticker ()
{
}
void DIntermissionScreenText::Drawer ()
{
}
void DIntermissionScreenCast::Init(FIntermissionDescriptor *desc)
{
}
bool DIntermissionScreenCast::Responder (event_t *ev)
{
return false;
}
void DIntermissionScreenCast::Ticker ()
{
}
void DIntermissionScreenCast::Drawer ()
{
}
void DIntermissionScreenScroller::Init(FIntermissionDescriptor *desc)
{
}
bool DIntermissionScreenScroller::Responder (event_t *ev)
{
return false;
}
void DIntermissionScreenScroller::Ticker ()
{
}
void DIntermissionScreenScroller::Drawer ()
{
}
static FIntermissionDescriptor DefaultIntermission; static FIntermissionDescriptor DefaultIntermission;

View file

@ -8,6 +8,11 @@
struct event_t; struct event_t;
#define DECLARE_SUPER_CLASS(cls,parent) \
private: \
typedef parent Super; \
typedef cls ThisClass;
struct FIntermissionPatch struct FIntermissionPatch
{ {
FString mName; FString mName;
@ -36,7 +41,7 @@ struct FICastSound
//========================================================================== //==========================================================================
struct FIntermissionDescriptor struct FIntermissionAction
{ {
int mSize; int mSize;
const PClass *mClass; const PClass *mClass;
@ -49,37 +54,61 @@ struct FIntermissionDescriptor
FString mSound; FString mSound;
bool mFlatfill; bool mFlatfill;
TArray<FIntermissionPatch> mOverlays; TArray<FIntermissionPatch> mOverlays;
FIntermissionDescriptor *mLink; FName mLink;
FIntermissionAction();
virtual bool ParseKey(FScanner &sc);
}; };
struct FIntermissionDescriptorFader : public FIntermissionDescriptor struct FIntermissionActionFader : public FIntermissionAction
{ {
typedef FIntermissionAction Super;
int FadeTime; int FadeTime;
int FadeType; int FadeType;
virtual bool ParseKey(FScanner &sc);
}; };
struct FIntermissionDescriptorTextscreen : public FIntermissionDescriptor struct FIntermissionActionTextscreen : public FIntermissionAction
{ {
typedef FIntermissionAction Super;
FString mText; FString mText;
int mTextSpeed; int mTextSpeed;
int mTextX, mTextY; int mTextX, mTextY;
virtual bool ParseKey(FScanner &sc);
}; };
struct FIntermissionDescriptorCast : public FIntermissionDescriptor struct FIntermissionActionCast : public FIntermissionAction
{ {
typedef FIntermissionAction Super;
FString mWalking; FString mWalking;
FString mAttacking1; FString mAttacking1;
FString mAttacking2; FString mAttacking2;
FString mDying; FString mDying;
TArray<FCastSound> mCastSounds; TArray<FCastSound> mCastSounds;
virtual bool ParseKey(FScanner &sc);
}; };
struct FIntermissionDescriptorScroller : public FIntermissionDescriptor struct FIntermissionActionScroller : public FIntermissionAction
{ {
typedef FIntermissionAction Super;
FString mSecondPic; FString mSecondPic;
int mScrollDelay; int mScrollDelay;
int mScrollTime; int mScrollTime;
int mScrollDir; int mScrollDir;
virtual bool ParseKey(FScanner &sc);
};
struct FIntermissionDescriptor
{
TArray<FIntermissionAction *> mActions;
}; };
typedef TMap<FName, FIntermissionDescriptor*> FIntermissionDescriptorList; typedef TMap<FName, FIntermissionDescriptor*> FIntermissionDescriptorList;
@ -165,6 +194,23 @@ public:
virtual void Drawer (); virtual void Drawer ();
}; };
class DIntermissionScreenScroller : public DIntermissionScreen
{
DECLARE_CLASS (DIntermissionScreenScroller, DIntermissionScreen)
FTextureID mSecondPic;
int mScrollDelay;
int mScrollTime;
int mScrollDir;
public:
DIntermissionScreenScroller() {}
virtual void Init(FIntermissionDescriptor *desc);
virtual bool Responder (event_t *ev);
virtual void Ticker ();
virtual void Drawer ();
};
class DIntermissionController : public DObject class DIntermissionController : public DObject

View file

@ -37,6 +37,151 @@
#include "intermission/intermission.h" #include "intermission/intermission.h"
#include "g_level.h" #include "g_level.h"
//==========================================================================
//
// FIntermissionAction
//
//==========================================================================
FIntermissionAction::FIntermissionAction()
{
mSize = sizeof(FIntermissionAction);
mClass = RUNTIME_CLASS(DIntermissionScreen);
mMusicOrder =
mCdId =
mCdTrack =
mDuration = 0;
mFlatfill = false;
}
bool FIntermissionAction::ParseKey(FScanner &sc)
{
if (sc.Compare("music"))
{
sc.MustGetToken('=');
sc.MustGetToken(TK_StringConst);
mMusic = sc.String;
mMusicOrder = 0;
if (sc.CheckToken(','))
{
sc.MustGetToken(TK_IntConst);
mMusicOrder = sc.Number;
}
return true;
}
else if (sc.Compare("cdmusic"))
{
sc.MustGetToken('=');
sc.MustGetToken(TK_IntConst);
mCdTrack = sc.Number;
mCdId = 0;
if (sc.CheckToken(','))
{
sc.MustGetToken(TK_IntConst);
mCdId = sc.Number;
}
return true;
}
else if (sc.Compare("Time"))
{
sc.MustGetToken('=');
if (!sc.CheckToken('-'))
{
sc.MustGetToken(TK_FloatConst);
mDuration = xs_RoundToInt(sc.Float*TICRATE);
}
else
{
sc.MustGetToken(TK_IntConst);
mDuration = sc.Number;
}
return true;
}
else if (sc.Compare("Background"))
{
sc.MustGetToken('=');
sc.MustGetToken(TK_StringConst);
mBackground = sc.String;
mFlatfill = 0;
if (sc.CheckToken(','))
{
sc.MustGetToken(TK_IntConst);
mFlatfill = !!sc.Number;
}
return true;
}
else if (sc.Compare("Sound"))
{
sc.MustGetToken('=');
sc.MustGetToken(TK_StringConst);
mSound = sc.String;
return true;
}
else if (sc.Compare("Draw"))
{
FIntermissionPatch *pat = &mOverlays[mOverlays.Reserve(1)];
sc.MustGetToken('=');
sc.MustGetToken(TK_StringConst);
pat->mName = sc.String;
sc.MustGetToken(',');
sc.MustGetToken(TK_IntConst);
pat->x = sc.Number;
sc.MustGetToken(',');
sc.MustGetToken(TK_IntConst);
pat->y = sc.Number;
return true;
}
else if (sc.Compare("Limk"))
{
sc.MustGetToken('=');
sc.MustGetToken(TK_Identifier);
mLink = sc.String;
return true;
}
else return false;
}
void FMapInfoParser::ParseIntermission()
{
FIntermissionDescriptor *desc;
while (!sc.CheckString("}"))
{
sc.MustGetString();
if (sc.Compare("image"))
{
}
else if (sc.Compare("scroller"))
{
}
else if (sc.Compare("cast"))
{
}
else if (sc.Compare("Fader"))
{
}
else if (sc.Compare("Crossfader"))
{
}
else if (sc.Compare("Wiper"))
{
}
else if (sc.Compare("TextScreen"))
{
}
else if (sc.Compare("GotoTitle"))
{
}
else
{
sc.ScriptMessage("Unknown intermission type '%s'", sc.String);
}
}
}
struct EndSequence struct EndSequence
{ {
SBYTE EndType; SBYTE EndType;
@ -55,8 +200,7 @@ enum EndTypes
END_Demon END_Demon
}; };
FName FMapInfoParser::ParseEndGame()
FName FMapInfoParser::ParseEndGame(FScanner &sc)
{ {
EndSequence newSeq; EndSequence newSeq;
static int generated = 0; static int generated = 0;
@ -138,7 +282,7 @@ FName FMapInfoParser::ParseEndGame(FScanner &sc)
return FName(seq); return FName(seq);
} }
FName FMapInfoParser::CheckEndSequence(FScanner &sc) FName FMapInfoParser::CheckEndSequence()
{ {
const char *seqname = NULL; const char *seqname = NULL;
@ -150,7 +294,7 @@ FName FMapInfoParser::CheckEndSequence(FScanner &sc)
sc.UnGet(); sc.UnGet();
goto standard_endgame; goto standard_endgame;
} }
return ParseEndGame(sc); return ParseEndGame();
} }
else if (strnicmp (sc.String, "EndGame", 7) == 0) else if (strnicmp (sc.String, "EndGame", 7) == 0)
{ {