2012-05-21 23:51:32 +00:00
using System ;
2012-06-01 10:17:47 +00:00
using System.IO ;
2012-05-21 23:51:32 +00:00
using System.Globalization ;
using SlimDX ;
using CodeImp.DoomBuilder.GZBuilder.Data ;
2013-04-11 09:27:16 +00:00
using CodeImp.DoomBuilder.Geometry ;
2012-05-21 23:51:32 +00:00
namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
2013-09-11 09:47:53 +00:00
internal sealed class ModeldefStructure {
private const int MAX_MODELS = 4 ; //maximum models per modeldef entry, zero-based
internal ModelData Parse ( ModeldefParser parser ) {
string [ ] textureNames = new string [ 4 ] ;
string [ ] modelNames = new string [ 4 ] ;
string path = "" ;
Vector3 scale = new Vector3 ( 1 , 1 , 1 ) ;
float zOffset = 0 ;
float angleOffset = 0 ;
float pitchOffset = 0 ;
float rollOffset = 0 ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
bool inheritactorpitch = false ;
bool inheritactorroll = false ;
2013-09-11 09:47:53 +00:00
string token ;
bool gotErrors = false ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
bool allParsed = false ;
2013-09-11 09:47:53 +00:00
//read modeldef structure contents
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
while ( ! gotErrors & & ! allParsed & & parser . SkipWhitespace ( true ) ) {
2013-09-11 09:47:53 +00:00
token = parser . ReadToken ( ) ;
if ( ! string . IsNullOrEmpty ( token ) ) {
token = parser . StripTokenQuotes ( token ) . ToLowerInvariant ( ) ; //ANYTHING can be quoted...
2012-07-28 20:36:28 +00:00
//path
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
switch ( token ) {
case "path" :
parser . SkipWhitespace ( true ) ;
path = parser . StripTokenQuotes ( parser . ReadToken ( ) ) . Replace ( "/" , "\\" ) ;
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
if ( string . IsNullOrEmpty ( path ) ) {
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected path to model, but got '" + token + "'" ) ;
gotErrors = true ;
}
2013-09-11 09:47:53 +00:00
break ;
2012-05-21 23:51:32 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
case "model" :
parser . SkipWhitespace ( true ) ;
//model index
int index ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! int . TryParse ( token , NumberStyles . Integer , CultureInfo . InvariantCulture , out index ) ) {
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected model index, but got '" + token + "'" ) ;
gotErrors = true ;
break ;
}
if ( index > = MAX_MODELS ) {
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": GZDoom doesn't allow more than " + MAX_MODELS + " models per MODELDEF entry!" ) ;
gotErrors = true ;
break ;
}
parser . SkipWhitespace ( true ) ;
2012-06-01 10:17:47 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
//model path
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) . ToLowerInvariant ( ) ;
if ( string . IsNullOrEmpty ( token ) ) {
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected model name, but got '" + token + "'" ) ;
gotErrors = true ;
} else {
//check extension
string fileExt = Path . GetExtension ( token ) ;
if ( string . IsNullOrEmpty ( fileExt ) ) {
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": model '" + token + "' won't be loaded. Models without extension are not supported by GZDoom." ) ;
gotErrors = true ;
break ;
}
if ( fileExt ! = ".md3" & & fileExt ! = ".md2" ) {
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": model '" + token + "' won't be loaded. Only MD2 and MD3 models are supported." ) ;
gotErrors = true ;
break ;
}
2013-03-18 13:52:27 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
//GZDoom allows models with identical modelIndex, it uses the last one encountered
modelNames [ index ] = Path . Combine ( path , token ) ;
}
2013-09-11 09:47:53 +00:00
break ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
case "skin" :
parser . SkipWhitespace ( true ) ;
//skin index
int skinIndex ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! int . TryParse ( token , NumberStyles . Integer , CultureInfo . InvariantCulture , out skinIndex ) ) {
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected skin index, but got '" + token + "'" ) ;
2013-07-24 13:11:50 +00:00
gotErrors = true ;
break ;
2013-09-11 09:47:53 +00:00
}
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
if ( skinIndex > = MAX_MODELS ) {
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": GZDoom doesn't allow more than " + MAX_MODELS + " skins per MODELDEF entry!" ) ;
2013-09-11 09:47:53 +00:00
gotErrors = true ;
break ;
}
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
parser . SkipWhitespace ( true ) ;
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
//skin path
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) . ToLowerInvariant ( ) ;
if ( string . IsNullOrEmpty ( token ) ) {
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected skin name, but got '" + token + "'" ) ;
gotErrors = true ;
} else {
//check extension
string ext = Path . GetExtension ( token ) ;
if ( Array . IndexOf ( TextureData . SUPPORTED_TEXTURE_EXTENSIONS , ext ) = = - 1 ) {
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": image format '" + ext + "' is not supported!" ) ;
textureNames [ skinIndex ] = TextureData . INVALID_TEXTURE ;
} else {
//GZDoom allows skins with identical modelIndex, it uses the last one encountered
textureNames [ skinIndex ] = Path . Combine ( path , token ) ;
}
}
2013-09-11 09:47:53 +00:00
break ;
2012-06-01 10:17:47 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
case "scale" :
parser . SkipWhitespace ( true ) ;
2013-03-18 13:52:27 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! parser . ReadSignedFloat ( token , ref scale . X ) ) {
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected scale X value, but got '" + token + "'" ) ;
gotErrors = true ;
break ;
}
parser . SkipWhitespace ( true ) ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! parser . ReadSignedFloat ( token , ref scale . Y ) ) {
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected scale Y value, but got '" + token + "'" ) ;
gotErrors = true ;
break ;
}
parser . SkipWhitespace ( true ) ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! parser . ReadSignedFloat ( token , ref scale . Z ) ) {
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected scale Z value, but got '" + token + "'" ) ;
gotErrors = true ;
2013-03-18 13:52:27 +00:00
}
2013-09-11 09:47:53 +00:00
break ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
case "zoffset" :
parser . SkipWhitespace ( true ) ;
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! parser . ReadSignedFloat ( token , ref zOffset ) ) {
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected ZOffset value, but got '" + token + "'" ) ;
gotErrors = true ;
}
2013-09-11 09:47:53 +00:00
break ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
case "angleoffset" :
parser . SkipWhitespace ( true ) ;
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! parser . ReadSignedFloat ( token , ref angleOffset ) ) {
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected AngleOffset value, but got '" + token + "'" ) ;
gotErrors = true ;
}
2013-09-11 09:47:53 +00:00
break ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
case "pitchoffset" :
parser . SkipWhitespace ( true ) ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! parser . ReadSignedFloat ( token , ref pitchOffset ) ) {
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected PitchOffset value, but got '" + token + "'" ) ;
gotErrors = true ;
}
2013-09-11 09:47:53 +00:00
break ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
case "rolloffset" :
parser . SkipWhitespace ( true ) ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! parser . ReadSignedFloat ( token , ref rollOffset ) ) {
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected RollOffset value, but got '" + token + "'" ) ;
gotErrors = true ;
}
2013-09-11 09:47:53 +00:00
break ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
case "inheritactorpitch" :
inheritactorpitch = true ;
2013-09-11 09:47:53 +00:00
break ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
case "inheritactorroll" :
inheritactorroll = true ;
2013-09-11 09:47:53 +00:00
break ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
case "frameindex" :
case "frame" :
//parsed all required fields. if got more than one model - find which one(s) should be displayed
int len = modelNames . GetLength ( 0 ) ;
if ( ! gotErrors & & len > 1 ) {
string spriteLump = null ;
string spriteFrame = null ;
bool [ ] modelsUsed = new bool [ MAX_MODELS ] ;
//step back
parser . DataStream . Seek ( - token . Length - 1 , SeekOrigin . Current ) ;
//here we check which models are used in first encountered lump and frame
while ( parser . SkipWhitespace ( true ) ) {
2013-09-11 09:47:53 +00:00
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) . ToLowerInvariant ( ) ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
if ( token = = "frameindex" | | token = = "frame" ) {
bool frameIndex = ( token = = "frameindex" ) ;
parser . SkipWhitespace ( true ) ;
//should be sprite lump
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) . ToLowerInvariant ( ) ;
if ( string . IsNullOrEmpty ( spriteLump ) ) {
spriteLump = token ;
} else if ( spriteLump ! = token ) { //got another lump
for ( int i = 0 ; i < modelsUsed . Length ; i + + ) {
if ( ! modelsUsed [ i ] ) {
modelNames [ i ] = null ;
textureNames [ i ] = null ;
}
2013-09-11 09:47:53 +00:00
}
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
break ;
2013-09-11 09:47:53 +00:00
}
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
parser . SkipWhitespace ( true ) ;
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
//should be sprite frame
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) . ToLowerInvariant ( ) ;
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
if ( string . IsNullOrEmpty ( spriteFrame ) ) {
spriteFrame = token ;
} else if ( spriteFrame ! = token ) { //got another frame
for ( int i = 0 ; i < modelsUsed . Length ; i + + ) {
if ( ! modelsUsed [ i ] ) {
modelNames [ i ] = null ;
textureNames [ i ] = null ;
}
2013-09-11 09:47:53 +00:00
}
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
break ;
2013-09-11 09:47:53 +00:00
}
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
parser . SkipWhitespace ( true ) ;
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
//should be model index
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
int modelIndex ;
if ( ! int . TryParse ( token , NumberStyles . Integer , CultureInfo . InvariantCulture , out modelIndex ) ) {
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected model index, but got '" + token + "'" ) ;
gotErrors = true ;
break ;
}
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
if ( modelIndex > = MAX_MODELS ) {
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": GZDoom doesn't allow more than " + MAX_MODELS + " models per MODELDEF entry!" ) ;
gotErrors = true ;
break ;
}
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
if ( modelNames [ modelIndex ] = = null ) {
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": got model index, which doesn't correspond to any defined model!" ) ;
gotErrors = true ;
break ;
}
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
modelsUsed [ modelIndex ] = true ;
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
parser . SkipWhitespace ( true ) ;
2013-09-11 09:47:53 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
//should be frame name or index. Currently I have no use for it
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
2012-08-14 12:47:27 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
if ( frameIndex ) {
int frame ;
if ( ! int . TryParse ( token , NumberStyles . Integer , CultureInfo . InvariantCulture , out frame ) ) {
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected model frame, but got '" + token + "'" ) ;
gotErrors = true ;
break ;
}
2012-08-14 12:47:27 +00:00
}
2012-06-01 10:17:47 +00:00
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
} else {
//must be "}", step back
parser . DataStream . Seek ( - token . Length - 1 , SeekOrigin . Current ) ;
break ;
}
2013-09-11 09:47:53 +00:00
}
}
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
allParsed = true ;
break ;
2013-09-11 09:47:53 +00:00
}
}
}
//find closing brace, then quit;
while ( parser . SkipWhitespace ( true ) ) {
token = parser . ReadToken ( ) ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
if ( token = = "}" ) break ;
2013-09-11 09:47:53 +00:00
}
if ( gotErrors ) return null ;
//classname is set in ModeldefParser
ModelData mde = new ModelData ( ) ;
mde . Scale = scale ;
mde . zOffset = zOffset ;
2014-01-03 10:33:45 +00:00
mde . AngleOffset = Angle2D . DegToRad ( angleOffset ) ;
mde . RollOffset = Angle2D . DegToRad ( rollOffset ) ;
mde . PitchOffset = Angle2D . DegToRad ( pitchOffset ) ;
Model rendering (all modes): UDMF scale, pitch and roll are now displayed.
Thing Edit Form, UDMF: added controls for setting pitch, roll, scale, render style, fill color, alpha, health and score.
Visual mode, UDMF: UDMF scale is now applied when rendering sprites.
Added Thing Statistics form (Edit -> View Thing Types...), which shows all loaded thing types with some additional info.
Visual mode: sprites with negative ScaleX and positive ScaleY were not rendered properly.
Classic modes: display was not updated after loading a sprite.
Current testing engine change was not saved on closing the program when no other game configuration settings were changed.
2014-04-30 10:01:22 +00:00
mde . InheritActorPitch = inheritactorpitch ;
mde . InheritActorRoll = inheritactorroll ;
2012-05-21 23:51:32 +00:00
2013-03-18 13:52:27 +00:00
for ( int i = 0 ; i < modelNames . Length ; i + + ) {
2013-09-11 09:47:53 +00:00
if ( ! string . IsNullOrEmpty ( modelNames [ i ] ) ) {
2013-03-18 13:52:27 +00:00
mde . TextureNames . Add ( string . IsNullOrEmpty ( textureNames [ i ] ) ? textureNames [ i ] : textureNames [ i ] . ToLowerInvariant ( ) ) ;
2013-09-11 09:47:53 +00:00
mde . ModelNames . Add ( modelNames [ i ] . ToLowerInvariant ( ) ) ;
}
}
2012-05-21 23:51:32 +00:00
2013-09-11 09:47:53 +00:00
return mde ;
}
}
2012-05-21 23:51:32 +00:00
}