added new event script type

This commit is contained in:
Benjamin Berkels 2014-05-04 18:22:47 +02:00 committed by Braden Obrzut
parent af77c7cd57
commit 495e6b2142
6 changed files with 19 additions and 0 deletions

View file

@ -178,6 +178,7 @@ static struct
{ ERR_HEXEN_COMPAT, "Attempt to use feature not supported by Hexen." },
{ ERR_NOT_HEXEN, "Cannot save; new features are not compatible with Hexen." },
{ ERR_SPECIAL_RANGE, "Line specials with values higher than 255 require #nocompact." },
{ ERR_EVENT_NEEDS_2_ARG, "Event scripts must have 2 arguments." }, // [BB]
{ ERR_NONE, NULL }
};

View file

@ -146,6 +146,7 @@ typedef enum
ERR_HEXEN_COMPAT,
ERR_NOT_HEXEN,
ERR_SPECIAL_RANGE,
ERR_EVENT_NEEDS_2_ARG // [BB]
} error_t;
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------

14
parse.c
View file

@ -340,6 +340,7 @@ static struct ScriptTypes ScriptCounts[] =
{ "disconnect", DISCONNECT_SCRIPTS_BASE, 0 },
{ "unloading", UNLOADING_SCRIPTS_BASE, 0 },
{ "return", RETURN_SCRIPTS_BASE, 0 },
{ "event", EVENT_SCRIPTS_BASE, 0 },
{ NULL, -1, 0 }
};
@ -660,6 +661,14 @@ static void OuterScript(void)
ERR_Error(ERR_UNCLOSED_WITH_ARGS, YES);
break;
case TK_EVENT:
scriptType = EVENT_SCRIPTS_BASE;
if(ScriptVarCount != 2)
{
ERR_Error(ERR_EVENT_NEEDS_2_ARG, YES);
}
break;
default:
TK_Undo();
}
@ -718,6 +727,11 @@ static void OuterScript(void)
ERR_Error (ERR_DISCONNECT_NEEDS_1_ARG, YES);
break;
case TK_EVENT: // [BB]
scriptType = EVENT_SCRIPTS_BASE;
ERR_Error (ERR_EVENT_NEEDS_2_ARG, YES);
break;
default:
ERR_Error(ERR_BAD_SCRIPT_DECL, YES);
SkipBraceBlock(0);

View file

@ -30,6 +30,7 @@ enum
UNLOADING_SCRIPTS_BASE = 13,
DISCONNECT_SCRIPTS_BASE = 14,
RETURN_SCRIPTS_BASE = 15,
EVENT_SCRIPTS_BASE = 16, // [BB]
};
// Values to indicate script flags (requires new-style .o)

View file

@ -192,6 +192,7 @@ static struct keyword_s
{ "net", TK_NET },
{ "clientside", TK_CLIENTSIDE }, // [BB]
{ "disconnect", TK_DISCONNECT },
{ "event", TK_EVENT }, //[BB]
{ "unloading", TK_UNLOADING },
{ "static", TK_STATIC },
{ "strparam", TK_STRPARAM_EVAL }, // [FDARI]

View file

@ -122,6 +122,7 @@ typedef enum
TK_NET, // 'net'
TK_CLIENTSIDE, // 'clientside'
TK_DISCONNECT, // 'disconnect'
TK_EVENT, // 'event' [BB]
TK_UNLOADING, // 'unloading'
TK_STATIC, // 'static'
TK_ANDASSIGN, // '&='