Merge branch 'hereicome_rougherthanleather' into 'next'

P_IsPointInSubsector fix! (Most importantly: Knuckles No Longer In Space)

Now works in GL by not relying on stuff which GL mutates! Thanks for the guidance, @MonsterIestyn! Tested in Steel_Titanium's Nightlight Ruins (in SUGOI), which had the perfect testbed for plenty of Knuckles issues AND is one of the first maps out to the public which eschews thok barriers altogether in some sections.

* Knuckles climbing on one sided lines is now super great and doesn't allow any space-climbing at all, OGL-exclusive OR renderer-independent. I was able to restore my earlier perfect-in-Software fix because now it also works fine in GL, too!
* The devmode TELEPORT command now actually prevents you from going outside maps which don't have thok barriers near where you were. (It only prevented you from going outside maps with thok barriers because the thok barriers bled outwards and failed some other conditions.)
* Camera now behaves identically between Software and GL. (Look closely at p_user.c - I didn't modify any code in that section, but the chasecam DOES call P_IsPointInSubsector...)
* Here's a biggun - OpenGL precipitation is ALSO fixed! Yup. That's right. It used P_IsPointInSubsector too, and THAT'S why it was broken for all this time. (I did have to do a few other changes beyond just flipping the ifdef, but HOLY SHIT.) Tested this in Mystic Realm's second zone, which kept rain all the way through in OGL!!

(And yes, I AM compiling with OGL on for this branch.)

See merge request !128
This commit is contained in:
Monster Iestyn 2016-10-29 12:00:17 -04:00
commit 158db5d380
4 changed files with 42 additions and 20 deletions

View File

@ -45,7 +45,7 @@
#include "hw_md2.h"
#define R_FAKEFLOORS
//#define HWPRECIP
#define HWPRECIP
#define SORTING
//#define POLYSKY
@ -4401,7 +4401,6 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
FOutVector *wv;
GLPatch_t *gpatch; // sprite patch converted to hardware
FSurfaceInfo Surf;
sector_t *sector;
if (!spr->mobj)
return;
@ -4455,19 +4454,38 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr)
//Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap);
sector = spr->mobj->subsector->sector;
if (sector->ffloors)
// colormap test
{
ffloor_t *caster = sector->lightlist[R_GetPlaneLight(sector, spr->mobj->z, false)].caster;
sector = caster ? &sectors[caster->secnum] : sector;
}
sector_t *sector = spr->mobj->subsector->sector;
UINT8 lightlevel = 255;
extracolormap_t *colormap = sector->extra_colormap;
// sprite lighting by modulating the RGB components
if (sector->extra_colormap)
Surf.FlatColor.rgba = HWR_Lighting(spr->sectorlight,sector->extra_colormap->rgba,sector->extra_colormap->fadergba, false, false);
if (sector->numlights)
{
INT32 light;
light = R_GetPlaneLight(sector, spr->mobj->z + spr->mobj->height, false); // Always use the light at the top instead of whatever I was doing before
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *sector->lightlist[light].lightlevel;
if (sector->lightlist[light].extra_colormap)
colormap = sector->lightlist[light].extra_colormap;
}
else
Surf.FlatColor.rgba = HWR_Lighting(spr->sectorlight,NORMALFOG,FADEFOG, false, false);
{
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = sector->lightlevel;
if (sector->extra_colormap)
colormap = sector->extra_colormap;
}
if (colormap)
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
else
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
}
if (spr->mobj->flags2 & MF2_SHADOW)
{
@ -5289,6 +5307,11 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
//
vis = HWR_NewVisSprite();
vis->x1 = x1;
#if 0
vis->x2 = x2;
#else
(void)x2;
#endif
vis->x2 = tx;
vis->tz = tz;
vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
@ -5301,7 +5324,6 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
// set top/bottom coords
vis->ty = FIXED_TO_FLOAT(thing->z + spritecachedinfo[lumpoff].topoffset) - gr_viewz;
vis->sectorlight = 0xff;
vis->precip = true;
}
#endif

View File

@ -452,7 +452,7 @@ void Command_RTeleport_f(void)
else
inty = 0;
ss = R_PointInSubsector(p->mo->x + intx*FRACUNIT, p->mo->y + inty*FRACUNIT);
ss = R_IsPointInSubsector(p->mo->x + intx*FRACUNIT, p->mo->y + inty*FRACUNIT);
if (!ss || ss->sector->ceilingheight - ss->sector->floorheight < p->mo->height)
{
CONS_Alert(CONS_NOTICE, M_GetText("Not a valid location.\n"));

View File

@ -2280,14 +2280,13 @@ static void P_DoClimbing(player_t *player)
fixed_t platy;
subsector_t *glidesector;
boolean climb = true;
boolean onesided = ((player->lastsidehit != -1 && player->lastlinehit != -1) && !(lines[player->lastlinehit].backsector));
platx = P_ReturnThrustX(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
platy = P_ReturnThrustY(player->mo, player->mo->angle, player->mo->radius + FixedMul(8*FRACUNIT, player->mo->scale));
glidesector = R_PointInSubsector(player->mo->x + platx, player->mo->y + platy);
glidesector = R_IsPointInSubsector(player->mo->x + platx, player->mo->y + platy);
if (onesided || glidesector->sector != player->mo->subsector->sector)
if (!glidesector || glidesector->sector != player->mo->subsector->sector)
{
boolean floorclimb = false;
boolean thrust = false;
@ -2295,7 +2294,7 @@ static void P_DoClimbing(player_t *player)
boolean skyclimber = false;
fixed_t floorheight, ceilingheight; // ESLOPE
if (onesided)
if (!glidesector)
floorclimb = true;
else
{

View File

@ -771,7 +771,7 @@ subsector_t *R_PointInSubsector(fixed_t x, fixed_t y)
}
//
// R_IsPointInSubsector, same as above but returns 0 if not in subsector - this does not work in opengl because of polyvertex_t
// R_IsPointInSubsector, same as above but returns 0 if not in subsector
//
subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
{
@ -795,7 +795,8 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
ret = &subsectors[nodenum & ~NF_SUBSECTOR];
for (i = 0; i < ret->numlines; i++)
if (R_PointOnSegSide(x, y, &segs[ret->firstline + i]))
//if (R_PointOnSegSide(x, y, &segs[ret->firstline + i])) -- breaks in ogl because polyvertex_t cast over vertex pointers
if (P_PointOnLineSide(x, y, segs[ret->firstline + i].linedef) != segs[ret->firstline + i].side)
return 0;
return ret;