Skip to content

[MDS].mds events without curly bracket will cause parsing errors #122

@JaXt0r

Description

@JaXt0r

Current behavior

Currently, when a .mds file contains an *event element without curly brackets, parsing will fail with this exception and not returning the .mds object:
level=Error, name=<Native>, message=ZkModelScript_load() failed: failed parsing resource of type ModelScript (source) [context: MDS syntax error

It seems to be caused by this line of code which expects RBRACE before parsing *event elements. If brackets aren't there, the upcoming lines will be treated as new keywords but not the events itself.

Reproduction

  1. Used ZenKit version = 1.0.3.0
  2. Use a custom .mds file (example below)
  3. Try to parse it

Example part which is causing the error:

Model ("HuS")
{
	...
	aniEnum
	{
			...
			//3. Transition zum Loop
			ani  ("s_Moers_S1"          	1    "s_Moers_S1"    0.0 0.0    M.    "Hum_Moerser_Ani.ASC"   F   28    40 FPS:25)

					*eventTag	(8	"DEF_DESTROY_ITEM")
			//4. Loop
			ani  ("s_Moers_S1"          	1    "s_Moers_S1"    0.0 0.0    M.    "Hum_Moerser_Ani.ASC"   F   28    40 FPS:25)
			...
    }
}

Expected behavior

Disclaimer: I found this parsing error by testing with a WIP Gothic Mod. Yes, it's an issue on the mod's side to not have the brackets there as expected, but parsing should go on as it is doing in G2 too.

Gothic 2 behavior seems to simply ignore these elements by skipping them (I tested it by starting the game with such an invalid event element. Therefore I'd like to ask if ZenKit can throw a warning about it or simply ignoring it too.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestmoddedIssues or features related to modifications of Gothic

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions