Skip to content

Commit

Permalink
Boom Line 242/Height Sector rendering fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger authored and dashodanger committed Dec 4, 2024
1 parent bc08dcc commit fcade35
Show file tree
Hide file tree
Showing 4 changed files with 359 additions and 126 deletions.
35 changes: 3 additions & 32 deletions source_files/edge/p_spec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -967,39 +967,10 @@ static void SectorEffect(Sector *target, Line *source, const LineType *special)
{
target->height_sector = source->front_sector;
target->height_sector_side = source->side[0];
// Quick band-aid fix for Line 242 "windows" - Dasho
if (target->ceiling_height - target->floor_height < 1)
{
target->ceiling_height = source->front_sector->ceiling_height;
target->old_ceiling_height = source->front_sector->ceiling_height;
target->floor_height = source->front_sector->floor_height;
target->old_floor_height = source->front_sector->floor_height;
for (int i = 0; i < target->line_count; i++)
{
if (target->lines[i]->side[1])
{
target->lines[i]->blocked = false;
if (target->lines[i]->side[0]->middle.image && target->lines[i]->side[1]->middle.image &&
target->lines[i]->side[0]->middle.image == target->lines[i]->side[1]->middle.image)
{
target->lines[i]->side[0]->middle_mask_offset = 0;
target->lines[i]->side[1]->middle_mask_offset = 0;
for (Seg *seg = target->subsectors->segs; seg != nullptr; seg = seg->subsector_next)
{
if (seg->linedef == target->lines[i])
seg->linedef->flags |= kLineFlagLowerUnpegged;
}
}
}
}
}
else
for (int i = 0; i < target->line_count; i++)
{
for (int i = 0; i < target->line_count; i++)
{
if (target->lines[i]->side[1])
target->lines[i]->blocked = false;
}
if (target->lines[i]->side[1])
target->lines[i]->blocked = false;
}
}
}
Expand Down
75 changes: 46 additions & 29 deletions source_files/edge/r_misc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,45 +224,62 @@ Subsector *PointInSubsector(float x, float y)

RegionProperties *GetPointProperties(Subsector *sub, float z)
{
Extrafloor *S, *L, *C;
float floor_h;

// traverse extrafloors upwards

floor_h = sub->sector->floor_height;

S = sub->sector->bottom_extrafloor;
L = sub->sector->bottom_liquid;

while (S || L)
if (sub->sector->height_sector)
{
if (!L || (S && S->bottom_height < L->bottom_height))
if (view_height_zone == kHeightZoneA && view_z > sub->sector->height_sector->interpolated_ceiling_height)
{
C = S;
S = S->higher;
return sub->sector->height_sector->active_properties;
}
else if (view_height_zone == kHeightZoneC && view_z < sub->sector->height_sector->interpolated_floor_height)
{
return sub->sector->height_sector->active_properties;
}
else
{
C = L;
L = L->higher;
return sub->sector->active_properties;
}
}
else
{
Extrafloor *S, *L, *C;
float floor_h;
// traverse extrafloors upwards

floor_h = sub->sector->floor_height;

EPI_ASSERT(C);

// ignore liquids in the middle of THICK solids, or below real
// floor or above real ceiling
//
if (C->bottom_height < floor_h || C->bottom_height > sub->sector->ceiling_height)
continue;
S = sub->sector->bottom_extrafloor;
L = sub->sector->bottom_liquid;

if (z < C->top_height)
return C->properties;
while (S || L)
{
if (!L || (S && S->bottom_height < L->bottom_height))
{
C = S;
S = S->higher;
}
else
{
C = L;
L = L->higher;
}

EPI_ASSERT(C);

// ignore liquids in the middle of THICK solids, or below real
// floor or above real ceiling
//
if (C->bottom_height < floor_h || C->bottom_height > sub->sector->ceiling_height)
continue;

if (z < C->top_height)
return C->properties;

floor_h = C->top_height;
}

floor_h = C->top_height;
// extrafloors were exhausted, must be top area
return sub->sector->active_properties;
}

// extrafloors were exhausted, must be top area
return sub->sector->active_properties;
}

//----------------------------------------------------------------------------
Expand Down
10 changes: 10 additions & 0 deletions source_files/edge/r_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,22 @@
//
// POV related.
//
// Used for Boom 242 height_sector checks
enum ViewHeightZone
{
kHeightZoneNone,
kHeightZoneA,
kHeightZoneB,
kHeightZoneC
};

extern float view_cosine;
extern float view_sine;
extern BAMAngle view_vertical_angle;

extern Subsector *view_subsector;
extern RegionProperties *view_properties;
extern ViewHeightZone view_height_zone;

extern int view_window_x;
extern int view_window_y;
Expand Down
Loading

0 comments on commit fcade35

Please sign in to comment.