Merge branch 'public_next'

# Conflicts:
#	src/r_things.c
#	src/v_video.c
This commit is contained in:
Monster Iestyn 2018-08-28 19:31:08 +01:00
commit 58a844d3cf
5 changed files with 65 additions and 42 deletions

View File

@ -4664,6 +4664,7 @@ void G_GhostTicker(void)
p->next = g->next; p->next = g->next;
else else
ghosts = g->next; ghosts = g->next;
Z_Free(g);
continue; continue;
} }
p = g; p = g;
@ -5664,29 +5665,28 @@ void G_AddGhost(char *defdemoname)
mthing = playerstarts[0]; mthing = playerstarts[0];
I_Assert(mthing); I_Assert(mthing);
{ // A bit more complex than P_SpawnPlayer because ghosts aren't solid and won't just push themselves out of the ceiling. { // A bit more complex than P_SpawnPlayer because ghosts aren't solid and won't just push themselves out of the ceiling.
fixed_t x,y,z; fixed_t z,f,c;
sector_t *sector; gh->mo = P_SpawnMobj(mthing->x << FRACBITS, mthing->y << FRACBITS, 0, MT_GHOST);
x = mthing->x << FRACBITS; gh->mo->angle = FixedAngle(mthing->angle*FRACUNIT);
y = mthing->y << FRACBITS; f = gh->mo->floorz;
sector = R_PointInSubsector(x, y)->sector; c = gh->mo->ceilingz - mobjinfo[MT_PLAYER].height;
if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP)) if (!!(mthing->options & MTF_AMBUSH) ^ !!(mthing->options & MTF_OBJECTFLIP))
{ {
z = sector->ceilingheight - mobjinfo[MT_PLAYER].height; z = c;
if (mthing->options >> ZSHIFT) if (mthing->options >> ZSHIFT)
z -= ((mthing->options >> ZSHIFT) << FRACBITS); z -= ((mthing->options >> ZSHIFT) << FRACBITS);
if (z < sector->floorheight) if (z < f)
z = sector->floorheight; z = f;
} }
else else
{ {
z = sector->floorheight; z = f;
if (mthing->options >> ZSHIFT) if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS); z += ((mthing->options >> ZSHIFT) << FRACBITS);
if (z > sector->ceilingheight - mobjinfo[MT_PLAYER].height) if (z > c)
z = sector->ceilingheight - mobjinfo[MT_PLAYER].height; z = c;
} }
gh->mo = P_SpawnMobj(x, y, z, MT_GHOST); gh->mo->z = z;
gh->mo->angle = FixedAngle(mthing->angle*FRACUNIT);
} }
gh->oldmo.x = gh->mo->x; gh->oldmo.x = gh->mo->x;
@ -5885,8 +5885,14 @@ boolean G_CheckDemoStatus(void)
{ {
boolean saved; boolean saved;
if(ghosts) // ... ... ... while (ghosts)
ghosts = NULL; // :) {
demoghost *next = ghosts->next;
Z_Free(ghosts);
ghosts = next;
}
ghosts = NULL;
// DO NOT end metal sonic demos here // DO NOT end metal sonic demos here

View File

@ -1362,7 +1362,7 @@ INT32 R_ColormapNumForName(char *name)
extra_colormaps[num_extra_colormaps].fadecolor = 0x0; extra_colormaps[num_extra_colormaps].fadecolor = 0x0;
extra_colormaps[num_extra_colormaps].maskamt = 0x0; extra_colormaps[num_extra_colormaps].maskamt = 0x0;
extra_colormaps[num_extra_colormaps].fadestart = 0; extra_colormaps[num_extra_colormaps].fadestart = 0;
extra_colormaps[num_extra_colormaps].fadeend = 33; extra_colormaps[num_extra_colormaps].fadeend = 31;
extra_colormaps[num_extra_colormaps].fog = 0; extra_colormaps[num_extra_colormaps].fog = 0;
num_extra_colormaps++; num_extra_colormaps++;
@ -1390,7 +1390,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
size_t mapnum = num_extra_colormaps; size_t mapnum = num_extra_colormaps;
size_t i; size_t i;
UINT32 cr, cg, cb, maskcolor, fadecolor; UINT32 cr, cg, cb, maskcolor, fadecolor;
UINT32 fadestart = 0, fadeend = 33, fadedist = 33; UINT32 fadestart = 0, fadeend = 31, fadedist = 31;
#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0) #define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
if (p1[0] == '#') if (p1[0] == '#')
@ -1431,12 +1431,12 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
// Get parameters like fadestart, fadeend, and the fogflag // Get parameters like fadestart, fadeend, and the fogflag
fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10); fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10);
fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10); fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10);
if (fadestart > 32) if (fadestart > 30)
fadestart = 0; fadestart = 0;
if (fadeend > 33 || fadeend < 1) if (fadeend > 31 || fadeend < 1)
fadeend = 33; fadeend = 31;
fadedist = fadeend - fadestart; fadedist = fadeend - fadestart;
fog = NUMFROMCHAR(p2[1]) ? 1 : 0; fog = NUMFROMCHAR(p2[1]);
} }
#undef getnum #undef getnum
@ -1537,7 +1537,7 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
size_t i; size_t i;
char *colormap_p; char *colormap_p;
UINT32 cr, cg, cb, maskcolor, fadecolor; UINT32 cr, cg, cb, maskcolor, fadecolor;
UINT32 fadestart = 0, fadeend = 33, fadedist = 33; UINT32 fadestart = 0, fadeend = 31, fadedist = 31;
#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0) #define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
if (p1[0] == '#') if (p1[0] == '#')
@ -1578,12 +1578,12 @@ void R_CreateColormap2(char *p1, char *p2, char *p3)
// Get parameters like fadestart, fadeend, and the fogflag // Get parameters like fadestart, fadeend, and the fogflag
fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10); fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10);
fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10); fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10);
if (fadestart > 32) if (fadestart > 30)
fadestart = 0; fadestart = 0;
if (fadeend > 33 || fadeend < 1) if (fadeend > 31 || fadeend < 1)
fadeend = 33; fadeend = 31;
fadedist = fadeend - fadestart; fadedist = fadeend - fadestart;
fog = NUMFROMCHAR(p2[1]) ? 1 : 0; fog = NUMFROMCHAR(p2[1]);
} }
#undef getnum #undef getnum

View File

@ -37,6 +37,9 @@
// Quincunx antialiasing of flats! // Quincunx antialiasing of flats!
//#define QUINCUNX //#define QUINCUNX
// good night sweet prince
#define SHITPLANESPARENCY
//SoM: 3/23/2000: Use Boom visplane hashing. //SoM: 3/23/2000: Use Boom visplane hashing.
#define MAXVISPLANES 512 #define MAXVISPLANES 512
@ -813,7 +816,11 @@ void R_DrawSinglePlane(visplane_t *pl)
else // Opaque, but allow transparent flat pixels else // Opaque, but allow transparent flat pixels
spanfunc = splatfunc; spanfunc = splatfunc;
if (pl->extra_colormap && pl->extra_colormap->fog) #ifdef SHITPLANESPARENCY
if (spanfunc == splatfunc || (pl->extra_colormap && pl->extra_colormap->fog))
#else
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
#endif
light = (pl->lightlevel >> LIGHTSEGSHIFT); light = (pl->lightlevel >> LIGHTSEGSHIFT);
else else
light = LIGHTLEVELS-1; light = LIGHTLEVELS-1;
@ -867,7 +874,11 @@ void R_DrawSinglePlane(visplane_t *pl)
else // Opaque, but allow transparent flat pixels else // Opaque, but allow transparent flat pixels
spanfunc = splatfunc; spanfunc = splatfunc;
if (pl->extra_colormap && pl->extra_colormap->fog) #ifdef SHITPLANESPARENCY
if (spanfunc == splatfunc || (pl->extra_colormap && pl->extra_colormap->fog))
#else
if (!pl->extra_colormap || !(pl->extra_colormap->fog & 2))
#endif
light = (pl->lightlevel >> LIGHTSEGSHIFT); light = (pl->lightlevel >> LIGHTSEGSHIFT);
else else
light = LIGHTLEVELS-1; light = LIGHTLEVELS-1;

View File

@ -983,7 +983,8 @@ static void R_SplitSprite(vissprite_t *sprite)
newsprite->extra_colormap = sector->lightlist[i].extra_colormap; newsprite->extra_colormap = sector->lightlist[i].extra_colormap;
if (!((newsprite->cut & SC_FULLBRIGHT) && (!newsprite->extra_colormap || !newsprite->extra_colormap->fog))) if (!((newsprite->cut & SC_FULLBRIGHT)
&& (!newsprite->extra_colormap || !(newsprite->extra_colormap->fog & 1))))
{ {
lindex = FixedMul(sprite->xscale, FixedDiv(640, vid.width))>>(LIGHTSCALESHIFT); lindex = FixedMul(sprite->xscale, FixedDiv(640, vid.width))>>(LIGHTSCALESHIFT);
@ -1403,7 +1404,7 @@ static void R_ProjectSprite(mobj_t *thing)
vis->cut |= SC_FULLBRIGHT; vis->cut |= SC_FULLBRIGHT;
if (vis->cut & SC_FULLBRIGHT if (vis->cut & SC_FULLBRIGHT
&& (!vis->extra_colormap || !vis->extra_colormap->fog)) && (!vis->extra_colormap || !(vis->extra_colormap->fog & 1)))
{ {
// full bright: goggles // full bright: goggles
vis->colormap = colormaps; vis->colormap = colormaps;

View File

@ -622,7 +622,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
if (scrn & V_FLIP) if (scrn & V_FLIP)
{ {
flip = true; flip = true;
x -= FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale); x -= FixedMul((SHORT(patch->width) - SHORT(patch->leftoffset))<<FRACBITS, pscale) + 1;
} }
else else
x -= FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale); x -= FixedMul(SHORT(patch->leftoffset)<<FRACBITS, pscale);
@ -1236,7 +1236,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT) if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
{ // Clear the entire screen, from dest to deststop. Yes, this really works. { // Clear the entire screen, from dest to deststop. Yes, this really works.
memset(screens[0], (UINT8)(c&255), vid.width * vid.height * vid.bpp); memset(screens[0], (c&255), vid.width * vid.height * vid.bpp);
return; return;
} }
@ -1299,7 +1299,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
c &= 255; c &= 255;
for (;(--h >= 0) && dest < deststop; dest += vid.width) for (;(--h >= 0) && dest < deststop; dest += vid.width)
memset(dest, (UINT8)(c&255), w * vid.bpp); memset(dest, c, w * vid.bpp);
} }
// //
@ -1642,6 +1642,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
dupx = dupy = 1; dupx = dupy = 1;
scrwidth = vid.width/vid.dupx; scrwidth = vid.width/vid.dupx;
left = (scrwidth - BASEVIDWIDTH)/2; left = (scrwidth - BASEVIDWIDTH)/2;
scrwidth -= left;
} }
switch (option & V_SPACINGMASK) switch (option & V_SPACINGMASK)
@ -1701,7 +1702,7 @@ void V_DrawString(INT32 x, INT32 y, INT32 option, const char *string)
else else
w = SHORT(hu_font[c]->width) * dupx; w = SHORT(hu_font[c]->width) * dupx;
if (cx+left > scrwidth) if (cx > scrwidth)
break; break;
if (cx+left + w < 0) //left boundary check if (cx+left + w < 0) //left boundary check
{ {
@ -1754,6 +1755,7 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
dupx = dupy = 1; dupx = dupy = 1;
scrwidth = vid.width/vid.dupx; scrwidth = vid.width/vid.dupx;
left = (scrwidth - BASEVIDWIDTH)/2; left = (scrwidth - BASEVIDWIDTH)/2;
scrwidth -= left;
} }
charflags = (option & V_CHARCOLORMASK); charflags = (option & V_CHARCOLORMASK);
@ -1813,7 +1815,8 @@ void V_DrawSmallString(INT32 x, INT32 y, INT32 option, const char *string)
} }
else else
w = SHORT(hu_font[c]->width) * dupx / 2; w = SHORT(hu_font[c]->width) * dupx / 2;
if (cx+left > scrwidth)
if (cx > scrwidth)
break; break;
if (cx+left + w < 0) //left boundary check if (cx+left + w < 0) //left boundary check
{ {
@ -1860,6 +1863,7 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
dupx = dupy = 1; dupx = dupy = 1;
scrwidth = vid.width/vid.dupx; scrwidth = vid.width/vid.dupx;
left = (scrwidth - BASEVIDWIDTH)/2; left = (scrwidth - BASEVIDWIDTH)/2;
scrwidth -= left;
} }
charflags = (option & V_CHARCOLORMASK); charflags = (option & V_CHARCOLORMASK);
@ -1917,7 +1921,7 @@ void V_DrawThinString(INT32 x, INT32 y, INT32 option, const char *string)
else else
w = (SHORT(tny_font[c]->width) * dupx); w = (SHORT(tny_font[c]->width) * dupx);
if (cx+left > scrwidth) if (cx > scrwidth)
break; break;
if (cx+left + w < 0) //left boundary check if (cx+left + w < 0) //left boundary check
{ {
@ -1960,6 +1964,7 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
dupx = dupy = 1; dupx = dupy = 1;
scrwidth = vid.width/vid.dupx; scrwidth = vid.width/vid.dupx;
left = (scrwidth - BASEVIDWIDTH)/2; left = (scrwidth - BASEVIDWIDTH)/2;
scrwidth -= left;
} }
switch (option & V_SPACINGMASK) switch (option & V_SPACINGMASK)
@ -2014,9 +2019,9 @@ void V_DrawStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string)
else else
w = SHORT(hu_font[c]->width) * dupx; w = SHORT(hu_font[c]->width) * dupx;
if ((cx>>FRACBITS)+left > scrwidth) if ((cx>>FRACBITS) > scrwidth)
break; break;
if (cx+left + w < 0) //left boundary check if ((cx>>FRACBITS)+left + w < 0) //left boundary check
{ {
cx += w<<FRACBITS; cx += w<<FRACBITS;
continue; continue;
@ -2126,7 +2131,7 @@ void V_DrawCreditString(fixed_t x, fixed_t y, INT32 option, const char *string)
} }
w = SHORT(cred_font[c]->width) * dupx; w = SHORT(cred_font[c]->width) * dupx;
if ((cx>>FRACBITS) + w > scrwidth) if ((cx>>FRACBITS) > scrwidth)
break; break;
V_DrawSciencePatch(cx, cy, option, cred_font[c], FRACUNIT); V_DrawSciencePatch(cx, cy, option, cred_font[c], FRACUNIT);
@ -2178,6 +2183,7 @@ void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string)
dupx = dupy = 1; dupx = dupy = 1;
scrwidth = vid.width/vid.dupx; scrwidth = vid.width/vid.dupx;
left = (scrwidth - BASEVIDWIDTH)/2; left = (scrwidth - BASEVIDWIDTH)/2;
scrwidth -= left;
} }
for (;;ch++) for (;;ch++)
@ -2207,10 +2213,9 @@ void V_DrawLevelTitle(INT32 x, INT32 y, INT32 option, const char *string)
w = SHORT(lt_font[c]->width) * dupx; w = SHORT(lt_font[c]->width) * dupx;
if (cx+left > scrwidth) if (cx > scrwidth)
break; break;
//left boundary check if (cx+left + w < 0) //left boundary check
if (cx+left + w < 0)
{ {
cx += w; cx += w;
continue; continue;