Add MF_DRAWFROMFARAWAY flag, renders objects up to 2x drawdist

This commit is contained in:
James R 2023-03-26 22:01:25 -07:00
parent 629614710c
commit 61abb7a82e
3 changed files with 19 additions and 5 deletions

View file

@ -5685,7 +5685,7 @@ const char *const MOBJFLAG_LIST[] = {
"BOSS",
"SPAWNCEILING",
"NOGRAVITY",
"\x01", // free: 1<<10 (name un-matchable)
"DRAWFROMFARAWAY",
"SLIDEME",
"NOCLIP",
"FLOAT",

View file

@ -122,8 +122,8 @@ typedef enum
// Don't apply gravity (every tic); object will float, keeping current height
// or changing it actively.
MF_NOGRAVITY = 1<<9,
// Free:
// 1<<10
// This object is visible from a greater distance than normal objects.
MF_DRAWFROMFARAWAY = 1<<10,
// Slide this object when it hits a wall.
MF_SLIDEME = 1<<11,
// Don't collide with walls or solid objects. Two MF_NOCLIP objects can't touch each other at all!

View file

@ -3618,9 +3618,23 @@ boolean R_ThingWithinDist (mobj_t *thing, fixed_t limit_dist)
{
const fixed_t dist = R_PointToDist(thing->x, thing->y);
if (limit_dist && dist > limit_dist)
if (limit_dist)
{
return false;
if (thing->flags & MF_DRAWFROMFARAWAY)
{
// MF_DRAWFROMFARAWAY: visible from 2x drawdist
if (dist > limit_dist * 2)
{
return false;
}
}
else
{
if (dist > limit_dist)
{
return false;
}
}
}
return true;