Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into break-through-them-all

This commit is contained in:
toaster 2023-10-08 13:20:21 +01:00
commit 2368ee89e6
14 changed files with 239 additions and 76 deletions

View file

@ -11,11 +11,14 @@
/// \file interface.cpp /// \file interface.cpp
/// \brief Action Code Script: Interface for the rest of SRB2's game logic /// \brief Action Code Script: Interface for the rest of SRB2's game logic
#include <algorithm>
#include <cstddef> #include <cstddef>
#include <istream> #include <istream>
#include <ostream> #include <ostream>
#include <vector> #include <vector>
#include <tcb/span.hpp>
#include "acsvm.hpp" #include "acsvm.hpp"
#include "interface.h" #include "interface.h"
@ -347,31 +350,63 @@ void ACS_Tick(void)
} }
/*-------------------------------------------------- /*--------------------------------------------------
boolean ACS_Execute(const char *name, const INT32 *args, size_t numArgs, activator_t *activator) static std::vector<ACSVM::Word> ACS_MixArgs(tcb::span<const INT32> args, tcb::span<const char* const> stringArgs)
See header file for description. Convert strings to ACS arguments and position them
correctly among integer arguments.
Input Arguments:-
args: Integer arguments.
stringArgs: C string arguments.
Return:-
Final argument vector.
--------------------------------------------------*/ --------------------------------------------------*/
boolean ACS_Execute(const char *name, const INT32 *args, size_t numArgs, activator_t *activator) static std::vector<ACSVM::Word> ACS_MixArgs(tcb::span<const INT32> args, tcb::span<const char* const> stringArgs)
{ {
Environment *env = &ACSEnv; std::vector<ACSVM::Word> argV;
size_t first = std::min(args.size(), stringArgs.size());
ACSVM::GlobalScope *const global = env->getGlobalScope(0); auto new_string = [env = &ACSEnv](const char* str) -> ACSVM::Word { return ~env->getString(str, strlen(str))->idx; };
ACSVM::HubScope *const hub = global->getHubScope(0);
ACSVM::MapScope *const map = hub->getMapScope(0);
ACSVM::ScopeID scope{global->id, hub->id, map->id};
ThreadInfo info{activator}; for (size_t i = 0; i < first; ++i)
{
// args[i] must be 0.
//
// If ACS_Execute is called from ACS, stringargs[i]
// will always be set, because there is no
// differentiation between integers and strings on
// arguments passed to a function. In this case,
// string arguments already exist in the ACS string
// table beforehand (and set in args[i]), so no
// conversion is required here.
//
// If ACS_Execute is called from a map line special,
// args[i] may be left unset (0), while stringArgs[i]
// is set. In this case, conversion to ACS string
// table is necessary.
argV.push_back(!args[i] && stringArgs[i] ? new_string(stringArgs[i]) : args[i]);
}
ACSVM::String *script = env->getString(name, strlen(name)); for (size_t i = first; i < args.size(); ++i)
return map->scriptStart(script, scope, {reinterpret_cast<const ACSVM::Word *>(args), numArgs, &info}); {
argV.push_back(args[i]);
}
for (size_t i = first; i < stringArgs.size(); ++i)
{
argV.push_back(new_string(stringArgs[i] ? stringArgs[i] : ""));
}
return argV;
} }
/*-------------------------------------------------- /*--------------------------------------------------
boolean ACS_ExecuteAlways(const char *name, const INT32 *args, size_t numArgs, activator_t *activator) boolean ACS_Execute(const char *name, const INT32 *args, size_t numArgs, const char *const *stringArgs, size_t numStringArgs, activator_t *activator)
See header file for description. See header file for description.
--------------------------------------------------*/ --------------------------------------------------*/
boolean ACS_ExecuteAlways(const char *name, const INT32 *args, size_t numArgs, activator_t *activator) boolean ACS_Execute(const char *name, const INT32 *args, size_t numArgs, const char *const *stringArgs, size_t numStringArgs, activator_t *activator)
{ {
Environment *env = &ACSEnv; Environment *env = &ACSEnv;
@ -383,7 +418,29 @@ boolean ACS_ExecuteAlways(const char *name, const INT32 *args, size_t numArgs, a
ThreadInfo info{activator}; ThreadInfo info{activator};
ACSVM::String *script = env->getString(name, strlen(name)); ACSVM::String *script = env->getString(name, strlen(name));
return map->scriptStartForced(script, scope, {reinterpret_cast<const ACSVM::Word *>(args), numArgs, &info}); std::vector<ACSVM::Word> argV = ACS_MixArgs(tcb::span {args, numArgs}, tcb::span {stringArgs, numStringArgs});
return map->scriptStart(script, scope, {argV.data(), argV.size(), &info});
}
/*--------------------------------------------------
boolean ACS_ExecuteAlways(const char *name, const INT32 *args, size_t numArgs, const char *const *stringArgs, size_t numStringArgs, activator_t *activator)
See header file for description.
--------------------------------------------------*/
boolean ACS_ExecuteAlways(const char *name, const INT32 *args, size_t numArgs, const char *const *stringArgs, size_t numStringArgs, activator_t *activator)
{
Environment *env = &ACSEnv;
ACSVM::GlobalScope *const global = env->getGlobalScope(0);
ACSVM::HubScope *const hub = global->getHubScope(0);
ACSVM::MapScope *const map = hub->getMapScope(0);
ACSVM::ScopeID scope{global->id, hub->id, map->id};
ThreadInfo info{activator};
ACSVM::String *script = env->getString(name, strlen(name));
std::vector<ACSVM::Word> argV = ACS_MixArgs(tcb::span {args, numArgs}, tcb::span {stringArgs, numStringArgs});
return map->scriptStartForced(script, scope, {argV.data(), argV.size(), &info});
} }
/*-------------------------------------------------- /*--------------------------------------------------

View file

@ -201,7 +201,7 @@ void ACS_Tick(void);
/*-------------------------------------------------- /*--------------------------------------------------
boolean ACS_Execute(const char *name, const INT32 *args, size_t numArgs, activator_t *activator); boolean ACS_Execute(const INT32 *args, size_t numArgs, const char *const *stringArgs, size_t numStringArgs, activator_t *activator);
Runs an ACS script by its string name. Runs an ACS script by its string name.
Only one instance of the script will run at Only one instance of the script will run at
@ -213,6 +213,8 @@ void ACS_Tick(void);
Strings should be transformed into Strings should be transformed into
ACSVM string IDs. ACSVM string IDs.
numArgs: Number of input arguments. numArgs: Number of input arguments.
stringArgs: Array of input string arguments.
numStringArgs: Number of input string arguments.
activator: Container for information on what activator: Container for information on what
activated this script. activated this script.
@ -220,11 +222,11 @@ void ACS_Tick(void);
true if we were able to run the script, otherwise false. true if we were able to run the script, otherwise false.
--------------------------------------------------*/ --------------------------------------------------*/
boolean ACS_Execute(const char *name, const INT32 *args, size_t numArgs, activator_t *activator); boolean ACS_Execute(const char *name, const INT32 *args, size_t numArgs, const char *const *stringArgs, size_t numStringArgs, activator_t *activator);
/*-------------------------------------------------- /*--------------------------------------------------
boolean ACS_ExecuteAlways(const char *name, const INT32 *args, size_t numArgs, activator_t *activator); boolean ACS_ExecuteAlways(const INT32 *args, size_t numArgs, const char *const *stringArgs, size_t numStringArgs, activator_t *activator)
Runs an ACS script by its string name. Runs an ACS script by its string name.
If the script is already running, this method If the script is already running, this method
@ -237,6 +239,8 @@ boolean ACS_Execute(const char *name, const INT32 *args, size_t numArgs, activat
Strings should be transformed into Strings should be transformed into
ACSVM string IDs. ACSVM string IDs.
numArgs: Number of input arguments. numArgs: Number of input arguments.
stringArgs: Array of input string arguments.
numStringArgs: Number of input string arguments.
activator: Container for information on what activator: Container for information on what
activated this script. activated this script.
@ -244,11 +248,11 @@ boolean ACS_Execute(const char *name, const INT32 *args, size_t numArgs, activat
true if we were able to run the script, otherwise false. true if we were able to run the script, otherwise false.
--------------------------------------------------*/ --------------------------------------------------*/
boolean ACS_ExecuteAlways(const char *name, const INT32 *args, size_t numArgs, activator_t *activator); boolean ACS_ExecuteAlways(const char *name, const INT32 *args, size_t numArgs, const char *const *stringArgs, size_t numStringArgs, activator_t *activator);
/*-------------------------------------------------- /*--------------------------------------------------
INT32 ACS_ExecuteResult(const char *name, const INT32 *args, size_t numArgs, activator_t *activator); INT32 ACS_ExecuteResult(const char *name, const INT32 *args, size_t numArgs, activator_t *activator)
Runs an ACS script by its string name. Runs an ACS script by its string name.
Will return the scripts special result Will return the scripts special result

View file

@ -834,7 +834,7 @@ consvar_t cv_kartdebugnodes = ServerCheat("debugnodes", "Off").on_off().descript
consvar_t cv_1pswap = PlayerCheat("1pswap", "1").min_max(1, MAXSPLITSCREENPLAYERS).description("Let P1's Profile control a different splitscreen player"); consvar_t cv_1pswap = PlayerCheat("1pswap", "1").min_max(1, MAXSPLITSCREENPLAYERS).description("Let P1's Profile control a different splitscreen player");
consvar_t cv_debugfinishline = PlayerCheat("debugfinishline", "Off").on_off().description("Highlight finish lines and respawn lines with high contrast colors"); consvar_t cv_debugfinishline = PlayerCheat("debugfinishline", "Off").on_off().description("Highlight finish lines, respawn lines, death pits and instakill planes with high contrast colors");
consvar_t cv_debugrank = PlayerCheat("debugrank", "Off").description("Show GP rank state on the HUD; optionally force a rank grade").values({ consvar_t cv_debugrank = PlayerCheat("debugrank", "Off").description("Show GP rank state on the HUD; optionally force a rank grade").values({
{0, "Off"}, {0, "Off"},

View file

@ -29477,7 +29477,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL, // xdeathstate S_NULL, // xdeathstate
sfx_None, // deathsound sfx_None, // deathsound
0, // speed 0, // speed
90<<FRACBITS, // radius 60<<FRACBITS, // radius
420<<FRACBITS, // height 420<<FRACBITS, // height
0, // display offset 0, // display offset
100, // mass 100, // mass

View file

@ -4307,40 +4307,24 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
case 475: // ACS_Execute case 475: // ACS_Execute
{ {
INT32 newArgs[NUM_SCRIPT_ARGS-1] = {0};
INT32 i;
if (!stringargs[0]) if (!stringargs[0])
{ {
CONS_Debug(DBG_GAMELOGIC, "Special type 475: No script name given\n"); CONS_Debug(DBG_GAMELOGIC, "Special type 475: No script name given\n");
return false; return false;
} }
for (i = 1; i < NUM_SCRIPT_ARGS; i++) ACS_Execute(stringargs[0], &args[1], NUM_SCRIPT_ARGS - 1, (const char* const*)&stringargs[1], NUM_SCRIPT_STRINGARGS - 1, activator);
{
newArgs[i - 1] = args[i];
}
ACS_Execute(stringargs[0], newArgs, NUM_SCRIPT_ARGS-1, activator);
} }
break; break;
case 476: // ACS_ExecuteAlways case 476: // ACS_ExecuteAlways
{ {
INT32 newArgs[NUM_SCRIPT_ARGS-1] = {0};
INT32 i;
if (!stringargs[0]) if (!stringargs[0])
{ {
CONS_Debug(DBG_GAMELOGIC, "Special type 475: No script name given\n"); CONS_Debug(DBG_GAMELOGIC, "Special type 475: No script name given\n");
return false; return false;
} }
for (i = 1; i < NUM_SCRIPT_ARGS; i++) ACS_ExecuteAlways(stringargs[0], &args[1], NUM_SCRIPT_ARGS - 1, (const char* const*)&stringargs[1], NUM_SCRIPT_STRINGARGS - 1, activator);
{
newArgs[i - 1] = args[i];
}
ACS_ExecuteAlways(stringargs[0], newArgs, NUM_SCRIPT_ARGS-1, activator);
} }
break; break;
case 477: // ACS_Suspend case 477: // ACS_Suspend

View file

@ -15,6 +15,7 @@
#include <tracy/tracy/Tracy.hpp> #include <tracy/tracy/Tracy.hpp>
#include "command.h"
#include "doomdef.h" #include "doomdef.h"
#include "g_game.h" #include "g_game.h"
#include "r_local.h" #include "r_local.h"
@ -30,6 +31,8 @@
#include "k_terrain.h" #include "k_terrain.h"
extern "C" consvar_t cv_debugfinishline;
seg_t *curline; seg_t *curline;
side_t *sidedef; side_t *sidedef;
line_t *linedef; line_t *linedef;
@ -404,7 +407,8 @@ boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back)
// Consider colormaps // Consider colormaps
&& back->extra_colormap == front->extra_colormap && back->extra_colormap == front->extra_colormap
&& ((!front->ffloors && !back->ffloors) && ((!front->ffloors && !back->ffloors)
|| Tag_Compare(&front->tags, &back->tags))); || Tag_Compare(&front->tags, &back->tags))
&& (!cv_debugfinishline.value || back->damagetype == front->damagetype));
} }
boolean R_IsDebugLine(seg_t *line) boolean R_IsDebugLine(seg_t *line)
@ -963,6 +967,11 @@ static void R_Subsector(size_t num)
ceilingcolormap = *frontsector->lightlist[light].extra_colormap; ceilingcolormap = *frontsector->lightlist[light].extra_colormap;
} }
auto sector_damage = [](sector_t* s) { return static_cast<sectordamage_t>(s->damagetype); };
auto floor_damage = [&](sector_t* s) { return s->flags & MSF_FLIPSPECIAL_FLOOR ? sector_damage(s) : SD_NONE; };
auto ceiling_damage = [&](sector_t* s) { return s->flags & MSF_FLIPSPECIAL_CEILING ? sector_damage(s) : SD_NONE; };
sub->sector->extra_colormap = frontsector->extra_colormap; sub->sector->extra_colormap = frontsector->extra_colormap;
if (P_GetSectorFloorZAt(frontsector, viewx, viewy) < viewz if (P_GetSectorFloorZAt(frontsector, viewx, viewy) < viewz
@ -975,7 +984,7 @@ static void R_Subsector(size_t num)
floorcolormap, NULL, NULL, frontsector->f_slope, floorcolormap, NULL, NULL, frontsector->f_slope,
R_NoEncore(frontsector, &levelflats[frontsector->floorpic], false), R_NoEncore(frontsector, &levelflats[frontsector->floorpic], false),
R_IsRipplePlane(frontsector, NULL, false), R_IsRipplePlane(frontsector, NULL, false),
false, frontsector false, frontsector, floor_damage(frontsector)
); );
} }
else else
@ -991,7 +1000,7 @@ static void R_Subsector(size_t num)
ceilingcolormap, NULL, NULL, frontsector->c_slope, ceilingcolormap, NULL, NULL, frontsector->c_slope,
R_NoEncore(frontsector, &levelflats[frontsector->ceilingpic], true), R_NoEncore(frontsector, &levelflats[frontsector->ceilingpic], true),
R_IsRipplePlane(frontsector, NULL, true), R_IsRipplePlane(frontsector, NULL, true),
true, frontsector true, frontsector, ceiling_damage(frontsector)
); );
} }
else else
@ -1005,9 +1014,20 @@ static void R_Subsector(size_t num)
{ {
fixed_t heightcheck, planecenterz; fixed_t heightcheck, planecenterz;
auto fof_damage = [&](auto& f)
{
sector_t* s = rover->master->frontsector;
return rover->fofflags & FOF_BLOCKPLAYER ? f(s) : sector_damage(s);
};
auto fof_top_damage = [&] { return fof_damage(floor_damage); };
auto fof_bottom_damage = [&] { return fof_damage(ceiling_damage); };
for (rover = frontsector->ffloors; rover && numffloors < MAXFFLOORS; rover = rover->next) for (rover = frontsector->ffloors; rover && numffloors < MAXFFLOORS; rover = rover->next)
{ {
if (!(rover->fofflags & FOF_EXISTS) || !(rover->fofflags & FOF_RENDERPLANES)) bool visible = rover->fofflags & FOF_RENDERPLANES;
if (!(rover->fofflags & FOF_EXISTS) || (!cv_debugfinishline.value && !visible))
continue; continue;
if (frontsector->cullheight) if (frontsector->cullheight)
@ -1030,6 +1050,14 @@ static void R_Subsector(size_t num)
&& ((viewz < heightcheck && (rover->fofflags & FOF_BOTHPLANES || !(rover->fofflags & FOF_INVERTPLANES))) && ((viewz < heightcheck && (rover->fofflags & FOF_BOTHPLANES || !(rover->fofflags & FOF_INVERTPLANES)))
|| (viewz > heightcheck && (rover->fofflags & FOF_BOTHPLANES || rover->fofflags & FOF_INVERTPLANES)))) || (viewz > heightcheck && (rover->fofflags & FOF_BOTHPLANES || rover->fofflags & FOF_INVERTPLANES))))
{ {
sectordamage_t damage = fof_bottom_damage();
if (!damage && !visible)
{
rover->norender = leveltime; // Tell R_StoreWallRange to skip this
continue;
}
light = R_GetPlaneLight(frontsector, planecenterz, light = R_GetPlaneLight(frontsector, planecenterz,
viewz < heightcheck); viewz < heightcheck);
@ -1039,7 +1067,7 @@ static void R_Subsector(size_t num)
*rover->bottomyoffs, *rover->bottomangle, *frontsector->lightlist[light].extra_colormap, rover, NULL, *rover->b_slope, *rover->bottomyoffs, *rover->bottomangle, *frontsector->lightlist[light].extra_colormap, rover, NULL, *rover->b_slope,
R_NoEncore(rover->master->frontsector, &levelflats[*rover->bottompic], true), R_NoEncore(rover->master->frontsector, &levelflats[*rover->bottompic], true),
R_IsRipplePlane(rover->master->frontsector, rover, true), R_IsRipplePlane(rover->master->frontsector, rover, true),
true, frontsector true, frontsector, damage
); );
ffloor[numffloors].slope = *rover->b_slope; ffloor[numffloors].slope = *rover->b_slope;
@ -1065,6 +1093,14 @@ static void R_Subsector(size_t num)
&& ((viewz > heightcheck && (rover->fofflags & FOF_BOTHPLANES || !(rover->fofflags & FOF_INVERTPLANES))) && ((viewz > heightcheck && (rover->fofflags & FOF_BOTHPLANES || !(rover->fofflags & FOF_INVERTPLANES)))
|| (viewz < heightcheck && (rover->fofflags & FOF_BOTHPLANES || rover->fofflags & FOF_INVERTPLANES)))) || (viewz < heightcheck && (rover->fofflags & FOF_BOTHPLANES || rover->fofflags & FOF_INVERTPLANES))))
{ {
sectordamage_t damage = fof_top_damage();
if (!damage && !visible)
{
rover->norender = leveltime; // Tell R_StoreWallRange to skip this
continue;
}
light = R_GetPlaneLight(frontsector, planecenterz, viewz < heightcheck); light = R_GetPlaneLight(frontsector, planecenterz, viewz < heightcheck);
ffloor[numffloors].plane = R_FindPlane( ffloor[numffloors].plane = R_FindPlane(
@ -1073,7 +1109,7 @@ static void R_Subsector(size_t num)
*frontsector->lightlist[light].extra_colormap, rover, NULL, *rover->t_slope, *frontsector->lightlist[light].extra_colormap, rover, NULL, *rover->t_slope,
R_NoEncore(rover->master->frontsector, &levelflats[*rover->toppic], false), R_NoEncore(rover->master->frontsector, &levelflats[*rover->toppic], false),
R_IsRipplePlane(rover->master->frontsector, rover, false), R_IsRipplePlane(rover->master->frontsector, rover, false),
false, frontsector false, frontsector, damage
); );
ffloor[numffloors].slope = *rover->t_slope; ffloor[numffloors].slope = *rover->t_slope;
@ -1095,6 +1131,10 @@ static void R_Subsector(size_t num)
polyobj_t *po = sub->polyList; polyobj_t *po = sub->polyList;
sector_t *polysec; sector_t *polysec;
auto poly_damage = [&](auto& f) { return polysec->flags & POF_SOLID ? f(polysec) : sector_damage(polysec); };
auto poly_top_damage = [&] { return poly_damage(floor_damage); };
auto poly_bottom_damage = [&] { return poly_damage(ceiling_damage); };
while (po) while (po)
{ {
if (numffloors >= MAXFFLOORS) if (numffloors >= MAXFFLOORS)
@ -1123,7 +1163,7 @@ static void R_Subsector(size_t num)
NULL, // will ffloors be slopable eventually? NULL, // will ffloors be slopable eventually?
R_NoEncore(polysec, &levelflats[polysec->floorpic], false), R_NoEncore(polysec, &levelflats[polysec->floorpic], false),
false, /* TODO: wet polyobjects? */ false, /* TODO: wet polyobjects? */
true, frontsector true, frontsector, poly_bottom_damage()
); );
ffloor[numffloors].height = polysec->floorheight; ffloor[numffloors].height = polysec->floorheight;
@ -1152,7 +1192,7 @@ static void R_Subsector(size_t num)
NULL, // will ffloors be slopable eventually? NULL, // will ffloors be slopable eventually?
R_NoEncore(polysec, &levelflats[polysec->ceilingpic], true), R_NoEncore(polysec, &levelflats[polysec->ceilingpic], true),
false, /* TODO: wet polyobjects? */ false, /* TODO: wet polyobjects? */
false, frontsector false, frontsector, poly_top_damage()
); );
ffloor[numffloors].polyobj = po; ffloor[numffloors].polyobj = po;

View file

@ -117,6 +117,7 @@ INT32 ds_y, ds_x1, ds_x2;
lighttable_t *ds_colormap; lighttable_t *ds_colormap;
lighttable_t *ds_fullbright; lighttable_t *ds_fullbright;
lighttable_t *ds_translation; // Lactozilla: Sprite splat drawer lighttable_t *ds_translation; // Lactozilla: Sprite splat drawer
lighttable_t *ds_flatlighting;
fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep; fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
INT32 ds_waterofs, ds_bgofs; INT32 ds_waterofs, ds_bgofs;

View file

@ -69,6 +69,7 @@ extern INT32 ds_y, ds_x1, ds_x2;
extern lighttable_t *ds_colormap; extern lighttable_t *ds_colormap;
extern lighttable_t *ds_fullbright; extern lighttable_t *ds_fullbright;
extern lighttable_t *ds_translation; extern lighttable_t *ds_translation;
extern lighttable_t *ds_flatlighting;
extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep; extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
extern INT32 ds_waterofs, ds_bgofs; extern INT32 ds_waterofs, ds_bgofs;
@ -80,8 +81,6 @@ extern UINT8 *ds_source;
extern UINT8 *ds_brightmap; extern UINT8 *ds_brightmap;
extern UINT8 *ds_transmap; extern UINT8 *ds_transmap;
extern UINT8 ds_flatcolor;
struct floatv3_t { struct floatv3_t {
float x, y, z; float x, y, z;
}; };

View file

@ -15,6 +15,7 @@
#include <tracy/tracy/Tracy.hpp> #include <tracy/tracy/Tracy.hpp>
#include "command.h"
#include "doomdef.h" #include "doomdef.h"
#include "console.h" #include "console.h"
#include "g_game.h" #include "g_game.h"
@ -34,6 +35,8 @@
#include "z_zone.h" #include "z_zone.h"
#include "p_tick.h" #include "p_tick.h"
extern "C" consvar_t cv_debugfinishline;
// //
// opening // opening
// //
@ -212,21 +215,29 @@ static void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
ds_bgofs = -y; ds_bgofs = -y;
} }
pindex = distance >> LIGHTZSHIFT; if (ds_flatlighting)
if (pindex >= MAXLIGHTZ)
pindex = MAXLIGHTZ - 1;
ds_colormap = planezlight[pindex];
if (!debugrender_highlight)
{ {
if (currentplane->extra_colormap) ds_colormap = ds_flatlighting;
ds_colormap = currentplane->extra_colormap->colormap + (ds_colormap - colormaps); }
else
{
pindex = distance >> LIGHTZSHIFT;
if (pindex >= MAXLIGHTZ)
pindex = MAXLIGHTZ - 1;
ds_fullbright = colormaps; ds_colormap = planezlight[pindex];
if (encoremap && !currentplane->noencore)
if (!debugrender_highlight)
{ {
ds_colormap += COLORMAP_REMAPOFFSET; if (currentplane->extra_colormap)
ds_fullbright += COLORMAP_REMAPOFFSET; ds_colormap = currentplane->extra_colormap->colormap + (ds_colormap - colormaps);
ds_fullbright = colormaps;
if (encoremap && !currentplane->noencore)
{
ds_colormap += COLORMAP_REMAPOFFSET;
ds_fullbright += COLORMAP_REMAPOFFSET;
}
} }
} }
@ -363,11 +374,17 @@ static visplane_t *new_visplane(unsigned hash)
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
fixed_t xoff, fixed_t yoff, angle_t plangle, extracolormap_t *planecolormap, fixed_t xoff, fixed_t yoff, angle_t plangle, extracolormap_t *planecolormap,
ffloor_t *pfloor, polyobj_t *polyobj, pslope_t *slope, boolean noencore, ffloor_t *pfloor, polyobj_t *polyobj, pslope_t *slope, boolean noencore,
boolean ripple, boolean reverseLight, const sector_t *lighting_sector) boolean ripple, boolean reverseLight, const sector_t *lighting_sector,
sectordamage_t damage)
{ {
visplane_t *check; visplane_t *check;
unsigned hash; unsigned hash;
if (!cv_debugfinishline.value)
{
damage = SD_NONE;
}
if (!slope) // Don't mess with this right now if a slope is involved if (!slope) // Don't mess with this right now if a slope is involved
{ {
if (plangle != 0) if (plangle != 0)
@ -446,7 +463,8 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
&& check->plangle == plangle && check->plangle == plangle
&& check->slope == slope && check->slope == slope
&& check->noencore == noencore && check->noencore == noencore
&& check->ripple == ripple) && check->ripple == ripple
&& check->damage == damage)
{ {
return check; return check;
} }
@ -477,6 +495,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
check->slope = slope; check->slope = slope;
check->noencore = noencore; check->noencore = noencore;
check->ripple = ripple; check->ripple = ripple;
check->damage = damage;
memset(check->top, 0xff, sizeof (check->top)); memset(check->top, 0xff, sizeof (check->top));
memset(check->bottom, 0x00, sizeof (check->bottom)); memset(check->bottom, 0x00, sizeof (check->bottom));
@ -555,6 +574,7 @@ visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop)
new_pl->slope = pl->slope; new_pl->slope = pl->slope;
new_pl->noencore = pl->noencore; new_pl->noencore = pl->noencore;
new_pl->ripple = pl->ripple; new_pl->ripple = pl->ripple;
new_pl->damage = pl->damage;
pl = new_pl; pl = new_pl;
pl->minx = start; pl->minx = start;
pl->maxx = stop; pl->maxx = stop;
@ -865,6 +885,7 @@ void R_DrawSinglePlane(visplane_t *pl)
INT32 type, spanfunctype = BASEDRAWFUNC; INT32 type, spanfunctype = BASEDRAWFUNC;
debugrender_highlight_t debug = debugrender_highlight_t::SW_HI_PLANES; debugrender_highlight_t debug = debugrender_highlight_t::SW_HI_PLANES;
void (*mapfunc)(INT32, INT32, INT32) = R_MapPlane; void (*mapfunc)(INT32, INT32, INT32) = R_MapPlane;
bool highlight = R_PlaneIsHighlighted(pl);
if (!(pl->minx <= pl->maxx)) if (!(pl->minx <= pl->maxx))
return; return;
@ -874,7 +895,22 @@ void R_DrawSinglePlane(visplane_t *pl)
// sky flat // sky flat
if (pl->picnum == skyflatnum) if (pl->picnum == skyflatnum)
{ {
R_DrawSkyPlane(pl); if (highlight)
{
r8_flatcolor = 35; // red
dc_lightmap = colormaps;
for (dc_x = pl->minx; dc_x <= pl->maxx; ++dc_x)
{
dc_yl = pl->top[dc_x];
dc_yh = pl->bottom[dc_x];
R_DrawColumn_Flat_8();
}
}
else
{
R_DrawSkyPlane(pl);
}
return; return;
} }
@ -927,6 +963,7 @@ void R_DrawSinglePlane(visplane_t *pl)
// Hacked up support for alpha value in software mode Tails 09-24-2002 // Hacked up support for alpha value in software mode Tails 09-24-2002
// ...unhacked by toaster 04-01-2021 // ...unhacked by toaster 04-01-2021
if (!highlight)
{ {
INT32 trans = (10*((256+12) - pl->ffloor->alpha))/255; INT32 trans = (10*((256+12) - pl->ffloor->alpha))/255;
if (trans >= 10) if (trans >= 10)
@ -1121,11 +1158,20 @@ void R_DrawSinglePlane(visplane_t *pl)
planezlight = zlight[light]; planezlight = zlight[light];
} }
if (highlight && R_SetSpanFuncFlat(BASEDRAWFUNC))
{
r8_flatcolor = 35; // red
ds_flatlighting = colormaps;
}
else
{
R_CheckDebugHighlight(debug);
R_CheckDebugHighlight(debug); // Use the correct span drawer depending on the powers-of-twoness
R_SetSpanFunc(spanfunctype, !ds_powersoftwo, ds_brightmap != NULL);
// Use the correct span drawer depending on the powers-of-twoness ds_flatlighting = NULL;
R_SetSpanFunc(spanfunctype, !ds_powersoftwo, ds_brightmap != NULL); }
// set the maximum value for unsigned // set the maximum value for unsigned
pl->top[pl->maxx+1] = 0xffff; pl->top[pl->maxx+1] = 0xffff;
@ -1228,3 +1274,8 @@ void R_PlaneBounds(visplane_t *plane)
plane->high = hi; plane->high = hi;
plane->low = low; plane->low = low;
} }
boolean R_PlaneIsHighlighted(const visplane_t *pl)
{
return pl->damage == SD_DEATHPIT || pl->damage == SD_INSTAKILL;
}

View file

@ -20,6 +20,7 @@ extern "C" {
#include "screen.h" // needs MAXVIDWIDTH/MAXVIDHEIGHT #include "screen.h" // needs MAXVIDWIDTH/MAXVIDHEIGHT
#include "r_data.h" #include "r_data.h"
#include "r_defs.h"
#include "r_textures.h" #include "r_textures.h"
#include "p_polyobj.h" #include "p_polyobj.h"
@ -60,6 +61,7 @@ struct visplane_t
boolean noencore; boolean noencore;
boolean ripple; boolean ripple;
sectordamage_t damage;
}; };
extern visplane_t *visplanes[MAXVISPLANES]; extern visplane_t *visplanes[MAXVISPLANES];
@ -88,7 +90,7 @@ void R_ClearFFloorClips (void);
void R_DrawPlanes(void); void R_DrawPlanes(void);
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle, visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle,
extracolormap_t *planecolormap, ffloor_t *ffloor, polyobj_t *polyobj, pslope_t *slope, boolean noencore, extracolormap_t *planecolormap, ffloor_t *ffloor, polyobj_t *polyobj, pslope_t *slope, boolean noencore,
boolean ripple, boolean reverseLight, const sector_t *lighting_sector); boolean ripple, boolean reverseLight, const sector_t *lighting_sector, sectordamage_t damage);
visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop); visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop);
void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop); void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop);
void R_PlaneBounds(visplane_t *plane); void R_PlaneBounds(visplane_t *plane);
@ -108,6 +110,8 @@ void R_CalculateSlopeVectors(void);
// Sets the slope vector pointers for the current tilted span. // Sets the slope vector pointers for the current tilted span.
void R_SetTiltedSpan(INT32 span); void R_SetTiltedSpan(INT32 span);
boolean R_PlaneIsHighlighted(const visplane_t *pl);
struct visffloor_t struct visffloor_t
{ {
visplane_t *plane; visplane_t *plane;

View file

@ -300,7 +300,7 @@ void Portal_AddSkyboxPortals (const player_t *player)
{ {
for (pl = visplanes[i]; pl; pl = pl->next) for (pl = visplanes[i]; pl; pl = pl->next)
{ {
if (pl->picnum == skyflatnum) if (pl->picnum == skyflatnum && !pl->damage)
{ {
Portal_AddSkybox(player, pl); Portal_AddSkybox(player, pl);

View file

@ -13,6 +13,7 @@
#include <tracy/tracy/Tracy.hpp> #include <tracy/tracy/Tracy.hpp>
#include "command.h"
#include "doomdef.h" #include "doomdef.h"
#include "r_local.h" #include "r_local.h"
#include "r_sky.h" #include "r_sky.h"
@ -30,6 +31,8 @@
#include "taglist.h" #include "taglist.h"
#include "r_draw.h" #include "r_draw.h"
extern "C" consvar_t cv_debugfinishline;
#define HEIGHTBITS 12 #define HEIGHTBITS 12
#define HEIGHTUNIT (1<<HEIGHTBITS) #define HEIGHTUNIT (1<<HEIGHTBITS)
@ -2111,7 +2114,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|| frontsector->extra_colormap != backsector->extra_colormap || frontsector->extra_colormap != backsector->extra_colormap
|| (frontsector->ffloors != backsector->ffloors && !Tag_Compare(&frontsector->tags, &backsector->tags)) || (frontsector->ffloors != backsector->ffloors && !Tag_Compare(&frontsector->tags, &backsector->tags))
// Portals block traversal behind them // Portals block traversal behind them
|| g_portal) || g_portal
// Highlighting death pits
|| (cv_debugfinishline.value && frontsector->damagetype != backsector->damagetype))
{ {
markfloor = true; markfloor = true;
} }
@ -2147,7 +2152,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|| frontsector->extra_colormap != backsector->extra_colormap || frontsector->extra_colormap != backsector->extra_colormap
|| (frontsector->ffloors != backsector->ffloors && !Tag_Compare(&frontsector->tags, &backsector->tags)) || (frontsector->ffloors != backsector->ffloors && !Tag_Compare(&frontsector->tags, &backsector->tags))
// Portals block traversal behind them // Portals block traversal behind them
|| g_portal) || g_portal
// Highlighting death pits
|| (cv_debugfinishline.value && frontsector->damagetype != backsector->damagetype))
{ {
markceiling = true; markceiling = true;
} }
@ -2713,7 +2720,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{ {
for (rover = backsector->ffloors; rover && i < MAXFFLOORS; rover = rover->next) for (rover = backsector->ffloors; rover && i < MAXFFLOORS; rover = rover->next)
{ {
if (!(rover->fofflags & FOF_EXISTS) || !(rover->fofflags & FOF_RENDERPLANES)) if (!(rover->fofflags & FOF_EXISTS) || (!cv_debugfinishline.value && !(rover->fofflags & FOF_RENDERPLANES)))
continue; continue;
if (rover->norender == leveltime) if (rover->norender == leveltime)
continue; continue;
@ -2770,7 +2777,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{ {
for (rover = frontsector->ffloors; rover && i < MAXFFLOORS; rover = rover->next) for (rover = frontsector->ffloors; rover && i < MAXFFLOORS; rover = rover->next)
{ {
if (!(rover->fofflags & FOF_EXISTS) || !(rover->fofflags & FOF_RENDERPLANES)) if (!(rover->fofflags & FOF_EXISTS) || (!cv_debugfinishline.value && !(rover->fofflags & FOF_RENDERPLANES)))
continue; continue;
if (rover->norender == leveltime) if (rover->norender == leveltime)
continue; continue;

View file

@ -238,11 +238,12 @@ void R_SetSpanFunc(size_t id, boolean npo2, boolean brightmapped)
{ {
I_Assert(id < SPANDRAWFUNC_MAX); I_Assert(id < SPANDRAWFUNC_MAX);
if (spanfuncs_flat[id] != NULL && debugrender_highlight != 0) if (debugrender_highlight != 0 && R_SetSpanFuncFlat(id))
{ {
spanfunc = spanfuncs_flat[id]; return;
} }
else if (spanfuncs_npo2[id] != NULL && npo2 == true)
if (spanfuncs_npo2[id] != NULL && npo2 == true)
{ {
spanfunc = spanfuncs_npo2[id]; spanfunc = spanfuncs_npo2[id];
} }
@ -258,6 +259,20 @@ void R_SetSpanFunc(size_t id, boolean npo2, boolean brightmapped)
} }
} }
boolean R_SetSpanFuncFlat(size_t id)
{
I_Assert(id < SPANDRAWFUNC_MAX);
if (spanfuncs_flat[id] == NULL)
{
return false;
}
spanfunc = spanfuncs_flat[id];
return true;
}
boolean R_CheckColumnFunc(size_t id) boolean R_CheckColumnFunc(size_t id)
{ {
size_t i; size_t i;

View file

@ -227,6 +227,7 @@ void SCR_SetDrawFuncs(void);
// Set current column / span drawers // Set current column / span drawers
void R_SetColumnFunc(size_t id, boolean brightmapped); void R_SetColumnFunc(size_t id, boolean brightmapped);
void R_SetSpanFunc(size_t id, boolean npo2, boolean brightmapped); void R_SetSpanFunc(size_t id, boolean npo2, boolean brightmapped);
boolean R_SetSpanFuncFlat(size_t id); // flat color
// Compare current column drawer // Compare current column drawer
boolean R_CheckColumnFunc(size_t id); boolean R_CheckColumnFunc(size_t id);