this stuff somehow wasnt merged

This commit is contained in:
Alug committed 2024-12-22 18:52:27 +01:00
1 parent db90142c4b
commit 39535e9bf8
11 files changed
+48 -179

No files matched your search

+1 -1
View File
@@ -43,7 +43,7 @@ typedef struct gl_vissprite_s
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} gl_vissprite_t;
void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32 *lightlevel, boolean model);
void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32 *lightlevel, boolean model, const boolean papersprite);
// --------
// hw_bsp.c
+37 -37
View File
@@ -339,45 +339,45 @@ boolean HWR_PalRenderFlashpal(void)
return (HWR_ShouldUsePaletteRendering() && cv_glflashpal.value);
}
void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32 *lightlevel, boolean model)
void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32 *lightlevel, boolean model, const boolean papersprite)
{
const boolean papersprite = (spr->mobj->frame & FF_PAPERSPRITE);
(void)papersprite;
*lightlevel += R_ThingLightLevel(spr->mobj);
if (maplighting.directional == false || !P_SectorUsesDirectionalLighting(sector) || model == true)
return;
if (maplighting.directional == true && P_SectorUsesDirectionalLighting(sector))
fixed_t extralight = R_GetSpriteDirectionalLighting(R_PointToAngle(spr->mobj->x, spr->mobj->y));
// this seems to be wrong???
/*fixed_t extralight = R_GetSpriteDirectionalLighting(
papersprite
? R_PointToAngle(spr->mobj->x, spr->mobj->y) + (spr->flip ? -ANGLE_90 : ANGLE_90)
: R_PointToAngle(spr->mobj->x, spr->mobj->y) // fixme
);*/
// Less change in contrast in dark sectors
extralight = FixedMul(extralight, min(max(0, *lightlevel), 255) * FRACUNIT / 255);
// NO NO BAD! WHY!?
/*if (papersprite)
{
if (model == false) // this is implemented by shader
{
fixed_t extralight = R_GetSpriteDirectionalLighting(
papersprite
? R_PointToAngle(spr->mobj->x, spr->mobj->y) + (spr->flip ? -ANGLE_90 : ANGLE_90)
: R_PointToAngle(spr->mobj->x, spr->mobj->y) // fixme
);
// Less change in contrast in dark sectors
extralight = FixedMul(extralight, min(max(0, *lightlevel), 255) * FRACUNIT / 255);
if (papersprite)
{
// Papersprite contrast should match walls
*lightlevel += FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT;
}
else
{
// simple OGL approximation
fixed_t tr = R_PointToDist(spr->mobj->x, spr->mobj->y);
fixed_t xscale = FixedDiv((vid.width / 2) << FRACBITS, tr);
// Less change in contrast at further distances, to counteract DOOM diminished light
fixed_t n = FixedDiv(FixedMul(xscale, LIGHTRESOLUTIONFIX), ((MAXLIGHTSCALE-1) << LIGHTSCALESHIFT));
extralight = FixedMul(extralight, min(n, FRACUNIT));
// Contrast is stronger for normal sprites, stronger than wall lighting is at the same distance
*lightlevel += FixedFloor((extralight * 2) + (FRACUNIT / 2)) / FRACUNIT;
}
}
// Papersprite contrast should match walls
*lightlevel += FixedFloor(extralight + (FRACUNIT / 2)) / FRACUNIT;
}
else*/
{
// simple OGL approximation
fixed_t tr = R_PointToDist(spr->mobj->x, spr->mobj->y);
fixed_t xscale = FixedDiv((vid.width / 2) << FRACBITS, tr);
// Less change in contrast at further distances, to counteract DOOM diminished light
fixed_t n = FixedDiv(FixedMul(xscale, LIGHTRESOLUTIONFIX), ((MAXLIGHTSCALE-1) << LIGHTSCALESHIFT));
extralight = FixedMul(extralight, min(n, FRACUNIT));
// Contrast is stronger for normal sprites, stronger than wall lighting is at the same distance
*lightlevel += FixedFloor((extralight * 2) + (FRACUNIT / 2)) / FRACUNIT;
}
}
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap, const boolean directional)
@@ -3643,7 +3643,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
break;
}
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false);
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false, papersprite);
for (i = 0; i < sector->numlights; i++)
{
@@ -3655,7 +3655,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
{
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = min(*list[i].lightlevel, 255);
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false);
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false, papersprite);
colormap = list[i].extra_colormap;
}
@@ -3855,7 +3855,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr)
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = min(sector->lightlevel, 255);
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false);
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, false, papersprite);
HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector) && !(spr->mobj->frame & FF_FULLBRIGHT));
+2 -3
View File
@@ -1054,7 +1054,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
return;
}
// search for the mimmap
// search for the Mipmap
// skip the first (no colormap translated)
for (glMipmap = gpatch->mipmap; glMipmap->nextcolormap; )
{
@@ -1090,7 +1090,6 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
Z_ChangeTag(newMipmap->data, PU_HWRCACHE_UNLOCKED);
}
// -----------------+
// HWR_DrawMD2 : Draw MD2
// :
@@ -1144,7 +1143,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
colormap = sector->extra_colormap;
}
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, true);
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, true, false);
HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector) && !(spr->mobj->frame & FF_FULLBRIGHT));
}
+2 -2
View File
@@ -1961,7 +1961,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
return LUA_ErrInvalid(L, "player_t");
}
if (!player || P_IsLocalPlayer(player))
S_StartSoundAtVolume(origin, sound_id, volume);
S_StartSoundAtVolume(origin, sound_id, volume);
return 0;
}
@@ -2063,7 +2063,7 @@ static int lib_sChangeMusic(lua_State *L)
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
else
#endif
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
position = (UINT32)luaL_optinteger(L, 5, 0);
prefadems = (UINT32)luaL_optinteger(L, 6, 0);
+4 -8
View File
@@ -6186,8 +6186,6 @@ static void M_AddonsClearName(INT32 choice)
M_StopMessage(choice);
}
int errorshitspam = 0; // prevent the warning screen from crapping itself when errors get spammed lmao
// returns whether to do message draw
static boolean M_AddonsRefresh(void)
{
@@ -6207,6 +6205,7 @@ static boolean M_AddonsRefresh(void)
if ((refreshdirmenu & REFRESHDIR_ADDFILE) || (majormods && !prevmajormods))
{
char *message = NULL;
boolean majormodtext = false;
if (refreshdirmenu & REFRESHDIR_NOTLOADED)
{
@@ -6216,20 +6215,19 @@ static boolean M_AddonsRefresh(void)
else
message = va("%c%s\x80\nA file was not loaded.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
}
else if ((refreshdirmenu & (REFRESHDIR_WARNING | REFRESHDIR_ERROR)) && !errorshitspam)
else if (refreshdirmenu & (REFRESHDIR_WARNING | REFRESHDIR_ERROR))
{
S_StartSound(NULL, sfx_s224);
message = va("%c%s\x80\nA file was loaded with %s.\nCheck the console log for more information.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname, ((refreshdirmenu & REFRESHDIR_ERROR) ? "errors" : "warnings"));
errorshitspam = 1; // you already said that shit
}
else if (majormods && !prevmajormods)
{
S_StartSound(NULL, sfx_s221);
message = va("%c%s\x80\nYou've loaded a gameplay-modifying addon.\n\nRecord Attack has been disabled, but you\ncan still play alone in local Multiplayer.\n\nIf you wish to play Record Attack mode, restart the game to disable loaded addons.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), refreshdirname);
prevmajormods = majormods;
majormodtext = prevmajormods = majormods;
}
if (message)
if (message && (refreshdirmenu || majormodtext)) // special case for gameplay modify text
{
M_StartMessage(message,M_AddonsClearName,MM_EVENTHANDLER);
return true;
@@ -6572,7 +6570,6 @@ static void M_HandleAddons(INT32 choice)
if (DumbStartsWith("KC_", dirmenu[dir_on[menudepthleft]]+DIR_STRING) || DumbStartsWith("kc_", dirmenu[dir_on[menudepthleft]]+DIR_STRING)) {
M_StartMessage(va("%c%s\x80\nYou are loading a local skin.\nLocal skins will not be usable\nafter going back from\nthe title screen.\n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
COM_BufAddText(va("addskins \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
errorshitspam = 0; // reset it so it can show the warning screen again lmao
}
else
S_StartSound(NULL, sfx_s26d);
@@ -6580,7 +6577,6 @@ static void M_HandleAddons(INT32 choice)
else
{
COM_BufAddText(va("addfile \"%s%s\"", menupath, dirmenu[dir_on[menudepthleft]]+DIR_STRING));
errorshitspam = 0; // reset it so it can show the warning screen again lmao
}
break;
default:
-115
View File
@@ -1670,8 +1670,6 @@ static boolean PIT_CheckLine(line_t *ld)
// MOVEMENT CLIPPING
// =========================================================================
static boolean P_CheckPositionShadow(mobj_t *thing, fixed_t x, fixed_t y);
//
// P_CheckPosition
// This is purely informative, nothing is modified
@@ -1717,12 +1715,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
I_Error("Previously-removed Thing of type %u crashes P_CheckPosition!", thing->type);
#endif
// crappy optimization lmao hope this works out
if (thing->type == MT_SHADOW)
{
return P_CheckPositionShadow(thing, x, y);
}
P_SetTarget(&tmthing, thing);
tmflags = thing->flags;
@@ -1968,113 +1960,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
return blockval;
}
// P_CheckPosition but its actually R_GetShadowZ from SRB2
// this checks for less and keeps everything simpler
// since i dont want VISUAL shadows crapping by checking for a crapton of stuff
static boolean P_CheckPositionShadow(mobj_t *thing, fixed_t x, fixed_t y)
{
subsector_t *newsubsec;
P_SetTarget(&tmthing, thing);
tmflags = thing->flags;
tmx = x;
tmy = y;
tmbbox[BOXTOP] = y + tmthing->radius;
tmbbox[BOXBOTTOM] = y - tmthing->radius;
tmbbox[BOXRIGHT] = x + tmthing->radius;
tmbbox[BOXLEFT] = x - tmthing->radius;
if (thing->x != x || thing->y != y || thing->subsector == NULL)
newsubsec = R_PointInSubsector(x, y);
else
newsubsec = thing->subsector;
ceilingline = blockingline = NULL;
// The base floor / ceiling is from the subsector
// that contains the point.
// Any contacted lines the step closer together
// will adjust them.
tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->floorheight;
tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight;
tmfloorslope = newsubsec->sector->f_slope;
tmceilingslope = newsubsec->sector->c_slope;
const fixed_t halfHeight = (thing->z + (thing->height >> 1));
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
if (newsubsec->sector->ffloors)
{
ffloor_t *rover;
for (rover = newsubsec->sector->ffloors; rover; rover = rover->next)
{
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERPLANES) || (rover->alpha < 90 && !(rover->flags & FF_SWIMMABLE)))
continue;
topheight = P_GetFOFTopZ(thing, newsubsec->sector, rover, x, y, NULL);
bottomheight = P_GetFOFBottomZ(thing, newsubsec->sector, rover, x, y, NULL);
if (topheight < halfHeight && topheight > tmfloorz)
{
tmfloorz = tmdropoffz = topheight;
tmfloorslope = *rover->t_slope;
}
if (bottomheight > halfHeight && bottomheight < tmfloorz)
{
tmceilingz = tmdrpoffceilz = bottomheight;
tmceilingslope = *rover->b_slope;
}
}
}
tmfloorthing = NULL;
tmhitthing = NULL;
// Check polyobjects and see if groundz needs to be altered
// This isn't very precise, but the precise method was far too slow.
// (Polies are just naturally pretty flickery anyway :P)
// do we really have to iterate through the complete blockmap for polyobjects if there are no polyobjects on the map?
if (numPolyObjects)
{
polyobj_t *po = newsubsec->polyList;
fixed_t z;
while (po)
{
if (!(po->flags & POF_RENDERPLANES) || !P_MobjInsidePolyobj(po, tmthing))
{
po = (polyobj_t *)(po->link.next);
continue;
}
// We're inside it! Yess...
z = po->lines[0]->backsector->floorheight;
if (z < halfHeight && z > tmfloorz)
{
tmfloorz = z;
tmfloorslope = NULL;
}
z = po->lines[0]->backsector->ceilingheight;
if (z > halfHeight && z < tmfloorz)
{
tmceilingz = z;
tmceilingslope = NULL;
}
po = (polyobj_t *)(po->link.next);
}
}
return true;
}
static const fixed_t hoopblockdist = 16*FRACUNIT + 8*FRACUNIT;
static const fixed_t hoophalfheight = (56*FRACUNIT)/2;
+1 -1
View File
@@ -578,7 +578,7 @@ static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, line_t *line,
);
}
#define NOCOLLISION ((mobj->type == MT_SHADOW) || (mobj->flags & MF_NOBLOCKMAP) || (mobj->flags & MF_NOCLIPTHING))
#define NOCOLLISION ((mobj->flags & MF_NOBLOCKMAP) || (mobj->flags & MF_NOCLIPTHING))
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
{
-1
View File
@@ -306,7 +306,6 @@ void P_UnlinkThinker(thinker_t *thinker)
}
}
//
// P_RemoveThinker
//
-2
View File
@@ -4599,8 +4599,6 @@ void P_PlayerThink(player_t *player)
{
player->pflags ^= PF_WANTSTOJOIN;
player->powers[pw_flashing] = TICRATE/2 + 1;
/*if (P_SpectatorJoinGame(player))
return; // player->mo was removed.*/
}
// Even if not NiGHTS, pull in nearby objects when walking around as John Q. Elliot.
+1 -8
View File
@@ -109,13 +109,6 @@ static drawseg_xrange_item_t *drawsegs_xrange;
static size_t drawsegs_xrange_size = 0;
static INT32 drawsegs_xrange_count = 0;
INT32 R_ThingLightLevel(mobj_t* thing)
{
INT32 lightlevel = thing->lightlevel;
return lightlevel;
}
// ==========================================================================
//
// Sprite loading routines: support sprites in pwad, dehacked sprite renaming,
@@ -1616,7 +1609,7 @@ static void R_ProjectSprite(mobj_t *thing)
lightnum = thing->subsector->sector->lightlevel;
}
lightnum = (lightnum + R_ThingLightLevel(thing)) >> LIGHTSEGSHIFT;
lightnum = (lightnum) >> LIGHTSEGSHIFT;
if (maplighting.directional == true && P_SectorUsesDirectionalLighting(thing->subsector->sector))
{
-1
View File
@@ -57,7 +57,6 @@ extern fixed_t windowtop;
extern fixed_t windowbottom;
extern INT32 lengthcol;
INT32 R_ThingLightLevel(mobj_t *thing);
fixed_t R_GetSpriteDirectionalLighting(angle_t angle);
fixed_t R_GetShadowZ(mobj_t *thing, pslope_t **shadowslope);