2014-12-03 23:15:26 +00:00
#region = = = = = = = = = = = = = = = = = = Namespaces
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
2014-12-03 23:15:26 +00:00
#endregion
namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
{
internal sealed class ModeldefStructure
{
2013-09-11 09:47:53 +00:00
private const int MAX_MODELS = 4 ; //maximum models per modeldef entry, zero-based
2014-12-03 23:15:26 +00:00
internal ModelData Parse ( ModeldefParser parser )
{
2013-09-11 09:47:53 +00:00
string [ ] textureNames = new string [ 4 ] ;
string [ ] modelNames = new string [ 4 ] ;
2015-04-13 09:50:17 +00:00
bool [ ] modelsUsed = new bool [ MAX_MODELS ] ;
2013-09-11 09:47:53 +00:00
string path = "" ;
Vector3 scale = new Vector3 ( 1 , 1 , 1 ) ;
2014-12-11 12:55:35 +00:00
Vector3 offset = new Vector3 ( ) ;
2013-09-11 09:47:53 +00:00
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
2014-12-03 23:15:26 +00:00
while ( ! gotErrors & & ! allParsed & & parser . SkipWhitespace ( true ) )
{
2013-09-11 09:47:53 +00:00
token = parser . ReadToken ( ) ;
2014-12-03 23:15:26 +00:00
if ( ! string . IsNullOrEmpty ( token ) )
{
2013-09-11 09:47:53 +00:00
token = parser . StripTokenQuotes ( token ) . ToLowerInvariant ( ) ; //ANYTHING can be quoted...
2014-12-03 23:15:26 +00:00
switch ( token )
{
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 "path" :
parser . SkipWhitespace ( true ) ;
path = parser . StripTokenQuotes ( parser . ReadToken ( ) ) . Replace ( "/" , "\\" ) ;
2013-09-11 09:47:53 +00:00
2014-12-03 23:15:26 +00:00
if ( string . IsNullOrEmpty ( 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
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 ( ) ) ;
2014-12-03 23:15:26 +00:00
if ( ! int . TryParse ( token , NumberStyles . Integer , CultureInfo . InvariantCulture , out index ) )
{
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
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected model index, but got '" + token + "'" ) ;
gotErrors = true ;
break ;
}
2014-12-03 23:15:26 +00:00
if ( index > = MAX_MODELS )
{
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
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 ( ) ;
2014-12-03 23:15:26 +00:00
if ( string . IsNullOrEmpty ( token ) )
{
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
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected model name, but got '" + token + "'" ) ;
gotErrors = true ;
2014-12-03 23:15:26 +00:00
}
else
{
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
//check extension
string fileExt = Path . GetExtension ( token ) ;
2014-12-03 23:15:26 +00:00
if ( string . IsNullOrEmpty ( fileExt ) )
{
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
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 ;
}
2014-12-03 23:15:26 +00:00
if ( fileExt ! = ".md3" & & fileExt ! = ".md2" )
{
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
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 ( ) ) ;
2014-12-03 23:15:26 +00:00
if ( ! int . TryParse ( token , NumberStyles . Integer , CultureInfo . InvariantCulture , out skinIndex ) )
{
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
// 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
2014-12-03 23:15:26 +00:00
if ( skinIndex > = MAX_MODELS )
{
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
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 ( ) ;
2014-12-03 23:15:26 +00:00
if ( string . IsNullOrEmpty ( token ) )
{
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
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected skin name, but got '" + token + "'" ) ;
gotErrors = true ;
2014-12-03 23:15:26 +00:00
}
else
{
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
//check extension
string ext = Path . GetExtension ( token ) ;
2014-12-03 23:15:26 +00:00
if ( Array . IndexOf ( TextureData . SUPPORTED_TEXTURE_EXTENSIONS , ext ) = = - 1 )
{
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
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": image format '" + ext + "' is not supported!" ) ;
textureNames [ skinIndex ] = TextureData . INVALID_TEXTURE ;
2014-12-03 23:15:26 +00:00
}
else
{
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 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 ) ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
2014-12-03 23:15:26 +00:00
if ( ! parser . ReadSignedFloat ( token , ref scale . X ) )
{
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
// Not numeric!
2014-12-11 12:55:35 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected Scale X value, but got '" + token + "'" ) ;
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
gotErrors = true ;
break ;
}
parser . SkipWhitespace ( true ) ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
2014-12-03 23:15:26 +00:00
if ( ! parser . ReadSignedFloat ( token , ref scale . Y ) )
{
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
// Not numeric!
2014-12-11 12:55:35 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected Scale Y value, but got '" + token + "'" ) ;
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
gotErrors = true ;
break ;
}
parser . SkipWhitespace ( true ) ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
2014-12-03 23:15:26 +00:00
if ( ! parser . ReadSignedFloat ( token , ref scale . Z ) )
{
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
// Not numeric!
2014-12-11 12:55:35 +00:00
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected Scale Z value, but got '" + token + "'" ) ;
gotErrors = true ;
}
break ;
case "offset" :
parser . SkipWhitespace ( true ) ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! parser . ReadSignedFloat ( token , ref offset . X ) )
{
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected Offset X value, but got '" + token + "'" ) ;
gotErrors = true ;
break ;
}
parser . SkipWhitespace ( true ) ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! parser . ReadSignedFloat ( token , ref offset . Y ) )
{
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected Offset Y value, but got '" + token + "'" ) ;
gotErrors = true ;
break ;
}
parser . SkipWhitespace ( true ) ;
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) ;
if ( ! parser . ReadSignedFloat ( token , ref offset . Z ) )
{
// Not numeric!
General . ErrorLogger . Add ( ErrorType . Error , "Error in " + parser . Source + " at line " + parser . GetCurrentLineNumber ( ) + ": expected Offset Z value, but got '" + token + "'" ) ;
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
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 ( ) ) ;
2014-12-11 12:55:35 +00:00
if ( ! parser . ReadSignedFloat ( token , ref offset . Z ) )
2014-12-03 23:15:26 +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
// 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 ( ) ) ;
2014-12-03 23:15:26 +00:00
if ( ! parser . ReadSignedFloat ( token , ref angleOffset ) )
{
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
// 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 ( ) ) ;
2014-12-03 23:15:26 +00:00
if ( ! parser . ReadSignedFloat ( token , ref 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
// 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 ( ) ) ;
2014-12-03 23:15:26 +00:00
if ( ! parser . ReadSignedFloat ( token , ref rollOffset ) )
{
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
// 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 ) ;
2014-12-03 23:15:26 +00:00
if ( ! gotErrors & & len > 1 )
{
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
string spriteLump = null ;
string spriteFrame = null ;
//step back
parser . DataStream . Seek ( - token . Length - 1 , SeekOrigin . Current ) ;
//here we check which models are used in first encountered lump and frame
2014-12-03 23:15:26 +00:00
while ( parser . SkipWhitespace ( true ) )
{
2013-09-11 09:47:53 +00:00
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) . ToLowerInvariant ( ) ;
2014-12-03 23:15:26 +00:00
if ( token = = "frameindex" | | token = = "frame" )
{
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 frameIndex = ( token = = "frameindex" ) ;
parser . SkipWhitespace ( true ) ;
//should be sprite lump
token = parser . StripTokenQuotes ( parser . ReadToken ( ) ) . ToLowerInvariant ( ) ;
2014-12-03 23:15:26 +00:00
if ( string . IsNullOrEmpty ( spriteLump ) )
{
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
spriteLump = token ;
2014-12-03 23:15:26 +00:00
}
else if ( spriteLump ! = token ) //got another lump
{
for ( int i = 0 ; i < modelsUsed . Length ; i + + )
{
if ( ! modelsUsed [ i ] )
{
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
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
2014-12-03 23:15:26 +00:00
if ( string . IsNullOrEmpty ( spriteFrame ) )
{
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
spriteFrame = token ;
2014-12-03 23:15:26 +00:00
}
else if ( spriteFrame ! = token ) //got another frame
{
for ( int i = 0 ; i < modelsUsed . Length ; i + + )
{
if ( ! modelsUsed [ i ] )
{
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
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 ;
2014-12-03 23:15:26 +00:00
if ( ! int . TryParse ( token , NumberStyles . Integer , CultureInfo . InvariantCulture , out modelIndex ) )
{
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
// 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
2014-12-03 23:15:26 +00:00
if ( modelIndex > = MAX_MODELS )
{
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
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
2014-12-03 23:15:26 +00:00
if ( modelNames [ modelIndex ] = = null )
{
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
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
2015-04-13 09:50:17 +00:00
// Should be frame name or index. Currently I have no use for it
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 ( ) ) ;
2012-08-14 12:47:27 +00:00
2014-12-03 23:15:26 +00:00
if ( frameIndex )
{
2015-04-13 09:50:17 +00:00
int frame = 0 ;
if ( ! parser . ReadSignedInt ( token , ref frame ) )
2014-12-03 23:15:26 +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
// 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-06-01 10:17:47 +00:00
2015-04-13 09:50:17 +00:00
// Skip the model if frame index is -1
if ( frame = = - 1 ) modelsUsed [ modelIndex ] = false ;
}
2014-12-03 23:15:26 +00:00
}
else
{
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
//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
}
}
}
2015-04-13 09:50:17 +00:00
// Find closing brace, then quit
2014-12-03 23:15:26 +00:00
while ( parser . SkipWhitespace ( true ) )
{
2013-09-11 09:47:53 +00:00
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
}
2015-04-13 09:50:17 +00:00
// Bail out when got errors or no models are used
if ( gotErrors | | Array . IndexOf ( modelsUsed , true ) = = - 1 ) return null ;
// Classname is set in ModeldefParser
2013-09-11 09:47:53 +00:00
ModelData mde = new ModelData ( ) ;
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 ;
2014-12-22 21:36:49 +00:00
Matrix moffset = Matrix . Translation ( offset . Y , - offset . X , offset . Z ) ; // Things are complicated in GZDoom...
2015-02-19 17:59:45 +00:00
Matrix mrotation = Matrix . RotationY ( - Angle2D . DegToRad ( rollOffset ) ) * Matrix . RotationX ( - Angle2D . DegToRad ( pitchOffset ) ) * Matrix . RotationZ ( Angle2D . DegToRad ( angleOffset ) ) ;
2014-12-22 21:36:49 +00:00
mde . SetTransform ( mrotation , moffset , scale ) ;
2012-05-21 23:51:32 +00:00
2014-12-03 23:15:26 +00:00
for ( int i = 0 ; i < modelNames . Length ; i + + )
{
2015-04-13 10:37:08 +00:00
if ( ! string . IsNullOrEmpty ( modelNames [ i ] ) & & modelsUsed [ i ] )
2014-12-03 23:15:26 +00:00
{
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
2015-04-13 10:37:08 +00:00
return ( mde . ModelNames . Count > 0 ? mde : null ) ;
2013-09-11 09:47:53 +00:00
}
}
2012-05-21 23:51:32 +00:00
}