2014-10-20 12:16:51 +00:00
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
2017-03-01 22:21:08 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Config;
|
2012-04-17 19:13:47 +00:00
|
|
|
|
using CodeImp.DoomBuilder.GZBuilder.Data;
|
2017-03-01 22:21:08 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
2017-03-01 22:36:33 +00:00
|
|
|
|
using CodeImp.DoomBuilder.ZDoom;
|
2017-03-01 22:21:08 +00:00
|
|
|
|
using System;
|
2012-04-17 19:13:47 +00:00
|
|
|
|
|
2014-10-20 12:16:51 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2012-04-17 19:13:47 +00:00
|
|
|
|
namespace CodeImp.DoomBuilder.GZBuilder
|
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
|
//mxd. should get rid of this class one day...
|
|
|
|
|
public static class GZGeneral
|
2017-03-01 22:21:08 +00:00
|
|
|
|
{
|
2014-10-20 12:16:51 +00:00
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
//gzdoom light types
|
2017-01-19 22:17:43 +00:00
|
|
|
|
private static readonly int[] gzLights = {
|
|
|
|
|
/* normal lights */ 9800, 9801, 9802, 9803, 9804,
|
|
|
|
|
/* additive lights */ 9810, 9811, 9812, 9813, 9814,
|
|
|
|
|
/* negative lights */ 9820, 9821, 9822, 9823, 9824,
|
|
|
|
|
/* attenuated lights */ 9830, 9831, 9832, 9833, 9834,
|
|
|
|
|
/* vavoom lights */ 1502, 1503};
|
2013-09-11 09:47:53 +00:00
|
|
|
|
public static int[] GZ_LIGHTS { get { return gzLights; } }
|
2017-01-19 22:17:43 +00:00
|
|
|
|
private static readonly int[] gzLightTypes = { 5, 10, 15, 20 }; //these are actually offsets in gz_lights
|
2013-09-11 09:47:53 +00:00
|
|
|
|
public static int[] GZ_LIGHT_TYPES { get { return gzLightTypes; } }
|
2014-10-20 12:16:51 +00:00
|
|
|
|
private static readonly DynamicLightType[] gzAnimatedLightTypes = { DynamicLightType.FLICKER, DynamicLightType.RANDOM, DynamicLightType.PULSE };
|
2013-12-18 09:11:04 +00:00
|
|
|
|
public static DynamicLightType[] GZ_ANIMATED_LIGHT_TYPES { get { return gzAnimatedLightTypes; } }
|
2013-09-11 09:47:53 +00:00
|
|
|
|
|
|
|
|
|
//asc script action specials
|
2014-10-20 12:16:51 +00:00
|
|
|
|
private static readonly int[] acsSpecials = { 80, 81, 82, 83, 84, 85, 226 };
|
2013-09-11 09:47:53 +00:00
|
|
|
|
public static int[] ACS_SPECIALS { get { return acsSpecials; } }
|
|
|
|
|
|
2017-03-01 22:21:08 +00:00
|
|
|
|
// [ZZ] this is for proper inheritance of lights.
|
|
|
|
|
// technically this can be found by parsing gzdoom.pk3/mapinfo/common.txt, but I wouldn't do that without a good reason for now.
|
|
|
|
|
private static readonly string[] gzLightClasses =
|
|
|
|
|
{
|
|
|
|
|
/* normal lights */ "pointlight", "pointlightpulse", "pointlightflicker", "sectorpointlight", "pointlightflickerrandom",
|
|
|
|
|
/* additive lights */ "pointlightadditive", "pointlightpulseadditive", "pointlightflickeradditive", "sectorpointlightadditive", "pointlightflickerrandomadditive",
|
|
|
|
|
/* subtractive lights */ "pointlightsubtractive", "pointlightpulsesubtractive", "pointlightflickersubtractive", "sectorpointlightsubtractive", "pointlightflickerrandomsubtractive",
|
|
|
|
|
/* attenuated lights */ "pointlightattenuated", "pointlightpulseattenuated", "pointlightflickerattenuated", "sectorpointlightattenuated", "pointlightflickerrandomattenuated",
|
|
|
|
|
/* vavoom lights */ "vavoomlightwhite", "vavoomlightcolor"
|
|
|
|
|
};
|
2014-10-20 12:16:51 +00:00
|
|
|
|
|
2017-03-01 22:36:33 +00:00
|
|
|
|
public static int GetGZLightTypeByClass(ActorStructure actor)
|
2017-03-01 22:21:08 +00:00
|
|
|
|
{
|
2017-03-01 22:36:33 +00:00
|
|
|
|
int idx = -1;
|
|
|
|
|
ActorStructure p = actor;
|
|
|
|
|
while (p != null)
|
|
|
|
|
{
|
|
|
|
|
idx = Array.IndexOf(gzLightClasses, p.ClassName.ToLowerInvariant());
|
|
|
|
|
|
|
|
|
|
if (idx != -1)
|
|
|
|
|
{
|
|
|
|
|
// found dynamic light type. alter it by actor flags.
|
|
|
|
|
// +MISSILEMORE makes it additive.
|
|
|
|
|
// +MISSILEEVENMORE makes it subtractive.
|
|
|
|
|
// +INCOMBAT makes it attenuated.
|
|
|
|
|
if (idx < GZ_LIGHT_TYPES[3])
|
|
|
|
|
{
|
|
|
|
|
int baseType = idx % 10;
|
|
|
|
|
int dispType = idx - 9800 - baseType;
|
|
|
|
|
if (actor.GetFlagValue("MISSILEMORE", false))
|
|
|
|
|
dispType = 9810;
|
|
|
|
|
else if (actor.GetFlagValue("MISSILEEVENMORE", false))
|
|
|
|
|
dispType = 9820;
|
|
|
|
|
else if (actor.GetFlagValue("INCOMBAT", false))
|
|
|
|
|
dispType = 9830;
|
|
|
|
|
return dispType + baseType;
|
|
|
|
|
}
|
|
|
|
|
else return gzLights[idx];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p = p.BaseClass;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-01 22:21:08 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int GetGZLightTypeByThing(Thing t)
|
|
|
|
|
{
|
|
|
|
|
int type = Array.IndexOf(gzLights, t.DynamicLightType);
|
|
|
|
|
if (type >= 0)
|
|
|
|
|
return type;
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
2012-07-10 10:20:45 +00:00
|
|
|
|
}
|