Make 3D floor mode support SRB2

This commit is contained in:
spherallic 2023-06-12 00:46:10 +02:00
parent ba67a87c75
commit a75489d7c6
11 changed files with 22 additions and 13 deletions

View file

@ -104,6 +104,7 @@ mapformat_udmf
distinctfloorandceilingbrightness = true;
planeequationsupport = true;
effect3dfloorsupport = true;
// Special linedefs
include("SRB222_misc.cfg", "speciallinedefs_udmf");

View file

@ -177,6 +177,9 @@ namespace CodeImp.DoomBuilder
private const string TEXTURES_DIR = "Textures"; //mxd
private const string HELP_FILE = "Refmanual.chm";
// SRB2
public static readonly int[] FOF_TYPES = { 100, 120, 150, 160, 170, 190, 200, 202, 220, 223, 250, 251, 254, 257, 258, 259, 260 };
#endregion
#region ================== Variables

View file

@ -638,7 +638,7 @@ namespace CodeImp.DoomBuilder.Rendering
//find lines with 3d floor action and collect sector tags
foreach(Linedef l in General.Map.Map.Linedefs)
{
if(l.Action == 160)
if(General.FOF_TYPES.Contains(l.Action))
{
int sectortag = (General.Map.UDMF || (l.Args[1] & 8) != 0) ? l.Args[0] : l.Args[0] + (l.Args[4] << 8);
if(sectortag != 0 && !tags.Contains(sectortag)) tags.Add(sectortag);

View file

@ -764,7 +764,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
HashSet<Sector> tmpsectors = new HashSet<Sector>();
HashSet<Sector> potentialsectors = new HashSet<Sector>();
Dictionary<int, List<Sector>> tags = new Dictionary<int, List<Sector>>();
// Immediately return if the list is empty
if (sectors.Count == 0)
return tdf;
@ -776,7 +776,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
if (ld.Front == null || ld.Front.Sector == null || ld.Front.Sector.IsDisposed || (General.Map.UDMF && ld.Front.Sector.Fields.GetValue("user_managed_3d_floor", false) == false))
continue;
if (ld.Action == 160 && ld.Args[0] != 0)
if (General.FOF_TYPES.Contains(ld.Action) && ld.Args[0] != 0)
{
if (!tags.ContainsKey(ld.Args[0]))
tags.Add(ld.Args[0], new List<Sector>() { ld.Front.Sector });

View file

@ -542,7 +542,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
//Determine whether or not the sector is actually a control sector for a 3D floor
foreach (Sidedef sd in s.Sidedefs)
{
if (sd.Line.Action == 160)
if (General.FOF_TYPES.Contains(sd.Line.Action))
return true;
}
return false;

View file

@ -168,7 +168,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
// tagged sector(s). They will be used for highlighting in slope mode
foreach (Sidedef sd in s.Sidedefs)
{
if (sd.Line.Action == 160)
if (General.FOF_TYPES.Contains(sd.Line.Action))
{
foreach (Sector ts in BuilderPlug.GetSectorsByTag(sd.Line.Args[0]))
{

View file

@ -132,7 +132,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
foreach (Sidedef sd in sector.Sidedefs)
{
if (sd.Line.Action == 160)
if (General.FOF_TYPES.Contains(sd.Line.Action))
{
bordertexture = sd.MiddleTexture;
udmftag = sd.Line.Args[0];
@ -224,7 +224,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
{
sd.SetTextureMid(bordertexture);
if (sd.Line.Action == 160)
if (General.FOF_TYPES.Contains(sd.Line.Action))
{
sd.Line.Args[1] = type;
sd.Line.Args[2] = flags;
@ -315,7 +315,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
foreach (Sidedef sd in sector.Sidedefs)
{
if (sd.Line.Action == 160 && BuilderPlug.GetSectorsByTag(sd.Line.Args[0]).Count == 0)
if (General.FOF_TYPES.Contains(sd.Line.Action) && BuilderPlug.GetSectorsByTag(sd.Line.Args[0]).Count == 0)
{
sd.Line.Action = 0;

View file

@ -24,6 +24,7 @@ using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Types;
using System.Linq;
#endregion
@ -36,7 +37,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
#endregion
#region ================== Variables
// Mouse position on map where dragging started
private Vector2D dragstartmappos;
@ -443,7 +444,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// sectors that need updating
foreach (Linedef ld in General.Map.Map.Linedefs)
{
if (ld.Action != 160) // Action 160 defines a 3D floor
if (!General.FOF_TYPES.Contains(ld.Action)) // Action 160 defines a 3D floor
continue;
foreach (Sector s in draggedsectors)

View file

@ -1592,7 +1592,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
foreach (Linedef ld in General.Map.Map.Linedefs)
{
if (ld.Action != 160) // Action 160 defines a 3D floor
if (!General.FOF_TYPES.Contains(ld.Action)) // Action 160 defines a 3D floor
continue;
if (ld.Args[0] == 0) // First argument of the action is the sector tag. 0 is not a valid value

View file

@ -19,6 +19,8 @@
using CodeImp.DoomBuilder.Map;
using System.Collections.Generic;
using System;
using System.Linq;
#endregion
@ -82,7 +84,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach (Linedef ld in General.Map.Map.Linedefs)
{
if (ld.Action == 160)
if (General.FOF_TYPES.Contains(ld.Action))
{
if ((ld.Args[1] & 4) == 4) // Type render inside
{

View file

@ -15,6 +15,8 @@ using CodeImp.DoomBuilder.VisualModes;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.BuilderModes.Interface;
using System.Windows.Forms;
using System.Linq;
#endregion
@ -377,7 +379,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.IO
{
foreach (Sidedef sd in s.Sidedefs)
{
if (sd.Line.Action == 160)
if (General.FOF_TYPES.Contains(sd.Line.Action))
{
addvs = false;
break;