From 629614710cc18d5afef3a4c6af4dbf67d107d13b Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 26 Mar 2023 21:52:31 -0700 Subject: [PATCH 1/2] Free MF_AMBIENT --- src/deh_tables.c | 2 +- src/info.c | 6 +++--- src/p_mobj.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index ea5991732..bacb32563 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5685,7 +5685,7 @@ const char *const MOBJFLAG_LIST[] = { "BOSS", "SPAWNCEILING", "NOGRAVITY", - "AMBIENT", + "\x01", // free: 1<<10 (name un-matchable) "SLIDEME", "NOCLIP", "FLOAT", diff --git a/src/info.c b/src/info.c index cbde12f82..8cfb54d28 100644 --- a/src/info.c +++ b/src/info.c @@ -19016,7 +19016,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags + MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY, // flags S_NULL // raisestate }, @@ -28256,7 +28256,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags + MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY, // flags S_NULL // raisestate }, @@ -28283,7 +28283,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY|MF_AMBIENT, // flags + MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOGRAVITY, // flags S_NULL // raisestate }, diff --git a/src/p_mobj.h b/src/p_mobj.h index 429f48812..aee8cda1a 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -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, - // This object is an ambient sound. Obsolete, but keep this around for backwards compatibility. - MF_AMBIENT = 1<<10, + // Free: + // 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! From 61abb7a82e05b5e0db0a89b22c4e1ce173816759 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 26 Mar 2023 22:01:25 -0700 Subject: [PATCH 2/2] Add MF_DRAWFROMFARAWAY flag, renders objects up to 2x drawdist --- src/deh_tables.c | 2 +- src/p_mobj.h | 4 ++-- src/r_things.c | 18 ++++++++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index bacb32563..7d4f8d990 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5685,7 +5685,7 @@ const char *const MOBJFLAG_LIST[] = { "BOSS", "SPAWNCEILING", "NOGRAVITY", - "\x01", // free: 1<<10 (name un-matchable) + "DRAWFROMFARAWAY", "SLIDEME", "NOCLIP", "FLOAT", diff --git a/src/p_mobj.h b/src/p_mobj.h index aee8cda1a..3ee45aedd 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -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! diff --git a/src/r_things.c b/src/r_things.c index c8ef9b557..a4480cf69 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -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;