Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
UltimateZoneBuilder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alam Ed Arias
UltimateZoneBuilder
Commits
6c8a3cb5
Commit
6c8a3cb5
authored
3 years ago
by
biwa
Browse files
Options
Downloads
Patches
Plain Diff
Visual Mode: things inside self-referencing sectors are now displayed at the correct height
parent
fe71e53e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Source/Core/Map/Sector.cs
+11
-4
11 additions, 4 deletions
Source/Core/Map/Sector.cs
Source/Core/Map/Thing.cs
+32
-5
32 additions, 5 deletions
Source/Core/Map/Thing.cs
Source/Core/VisualModes/VisualBlockMap.cs
+32
-8
32 additions, 8 deletions
Source/Core/VisualModes/VisualBlockMap.cs
with
75 additions
and
17 deletions
Source/Core/Map/Sector.cs
+
11
−
4
View file @
6c8a3cb5
...
...
@@ -546,6 +546,9 @@ namespace CodeImp.DoomBuilder.Map
// This checks if the given point is inside the sector polygon
// See: http://paulbourke.net/geometry/polygonmesh/index.html#insidepoly
// This checks for the linedefs instead of the sidedefs, since self-referencing sectors
// will never result in an odd number of intersections when using sidedefs, since both
// sidedefs of the outer linedef belong to the same sector
public
bool
Intersect
(
Vector2D
p
)
{
return
Intersect
(
p
,
true
);
}
public
bool
Intersect
(
Vector2D
p
,
bool
countontopastrue
)
{
...
...
@@ -554,13 +557,17 @@ namespace CodeImp.DoomBuilder.Map
uint
c
=
0
;
Vector2D
v1
,
v2
;
HashSet
<
Linedef
>
linedefs
=
new
HashSet
<
Linedef
>(
sidedefs
.
Count
);
foreach
(
Sidedef
sd
in
sidedefs
)
linedefs
.
Add
(
sd
.
Line
);
// Go for all
sid
edefs
foreach
(
Sid
edef
s
d
in
sid
edefs
)
// Go for all
lin
edefs
foreach
(
Lin
edef
l
d
in
lin
edefs
)
{
// Get vertices
v1
=
sd
.
Line
.
Start
.
Position
;
v2
=
sd
.
Line
.
End
.
Position
;
v1
=
ld
.
Start
.
Position
;
v2
=
ld
.
End
.
Position
;
//mxd. On top of a vertex?
if
(
p
==
v1
||
p
==
v2
)
return
countontopastrue
;
...
...
This diff is collapsed.
Click to expand it.
Source/Core/Map/Thing.cs
+
32
−
5
View file @
6c8a3cb5
...
...
@@ -273,19 +273,46 @@ namespace CodeImp.DoomBuilder.Map
public
void
DetermineSector
(
BlockMap
<
BlockEntry
>
blockmap
)
{
BlockEntry
be
=
blockmap
.
GetBlockAt
(
pos
);
List
<
Sector
>
sectors
=
new
List
<
Sector
>(
1
);
foreach
(
Sector
s
in
be
.
Sectors
)
if
(
s
.
Intersect
(
pos
))
{
sector
=
s
;
return
;
}
sectors
.
Add
(
s
);
if
(
sectors
.
Count
==
0
)
{
sector
=
null
;
}
if
(
sectors
.
Count
==
1
)
{
sector
=
sectors
[
0
];
}
else
{
// Having multiple intersections indicates that there are self-referencing sectors in this spot.
// In this case we have to check which side of the nearest linedef pos is on, and then use that sector
HashSet
<
Linedef
>
linedefs
=
new
HashSet
<
Linedef
>(
sectors
[
0
].
Sidedefs
.
Count
*
sectors
.
Count
);
foreach
(
Sector
s
in
sectors
)
foreach
(
Sidedef
sd
in
s
.
Sidedefs
)
linedefs
.
Add
(
sd
.
Line
);
Linedef
nearest
=
MapSet
.
NearestLinedef
(
linedefs
,
pos
);
double
d
=
nearest
.
SideOfLine
(
pos
);
if
(
d
<=
0.0
&&
nearest
.
Front
!=
null
)
sector
=
nearest
.
Front
.
Sector
;
else
if
(
nearest
.
Back
!=
null
)
sector
=
nearest
.
Back
.
Sector
;
else
sector
=
null
;
}
}
// This determines which sector the thing is in and links it
public
void
DetermineSector
(
VisualBlockMap
blockmap
)
{
sector
=
blockmap
.
GetSectorAt
(
pos
);
sector
=
blockmap
.
GetSectorAt
(
pos
);
}
// This translates the flags into UDMF fields
...
...
This diff is collapsed.
Click to expand it.
Source/Core/VisualModes/VisualBlockMap.cs
+
32
−
8
View file @
6c8a3cb5
...
...
@@ -76,16 +76,40 @@ namespace CodeImp.DoomBuilder.VisualModes
public
Sector
GetSectorAt
(
Vector2D
pos
)
{
foreach
(
VisualBlockEntry
e
in
GetBlocks
(
pos
))
{
List
<
Sector
>
sectors
=
new
List
<
Sector
>(
1
);
foreach
(
VisualBlockEntry
e
in
GetBlocks
(
pos
))
foreach
(
Sector
s
in
e
.
Sectors
)
{
if
(
s
.
Intersect
(
pos
))
{
return
s
;
}
}
}
sectors
.
Add
(
s
);
if
(
sectors
.
Count
==
0
)
{
return
null
;
}
else
if
(
sectors
.
Count
==
1
)
{
return
sectors
[
0
];
}
else
{
// Having multiple intersections indicates that there are self-referencing sectors in this spot.
// In this case we have to check which side of the nearest linedef pos is on, and then use that sector
HashSet
<
Linedef
>
linedefs
=
new
HashSet
<
Linedef
>(
sectors
[
0
].
Sidedefs
.
Count
*
sectors
.
Count
);
foreach
(
Sector
s
in
sectors
)
foreach
(
Sidedef
sd
in
s
.
Sidedefs
)
linedefs
.
Add
(
sd
.
Line
);
Linedef
nearest
=
MapSet
.
NearestLinedef
(
linedefs
,
pos
);
double
d
=
nearest
.
SideOfLine
(
pos
);
if
(
d
<=
0.0
&&
nearest
.
Front
!=
null
)
return
nearest
.
Front
.
Sector
;
else
if
(
nearest
.
Back
!=
null
)
return
nearest
.
Back
.
Sector
;
}
return
null
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment