mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Merge branch 'lightfade-ticbased' into le-fadefof
This commit is contained in:
commit
e8a5735f75
5 changed files with 64 additions and 25 deletions
|
@ -13,7 +13,6 @@
|
|||
/// Fire flicker, light flash, strobe flash, lightning flash, glow, and fade.
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h" // gametic
|
||||
#include "p_local.h"
|
||||
#include "r_state.h"
|
||||
#include "z_zone.h"
|
||||
|
|
|
@ -487,10 +487,14 @@ static void P_NetUnArchivePlayers(void)
|
|||
#define SD_FYOFFS 0x02
|
||||
#define SD_CXOFFS 0x04
|
||||
#define SD_CYOFFS 0x08
|
||||
#define SD_TAG 0x10
|
||||
#define SD_FLOORANG 0x20
|
||||
#define SD_CEILANG 0x40
|
||||
#define SD_TAGLIST 0x80
|
||||
#define SD_FLOORANG 0x10
|
||||
#define SD_CEILANG 0x20
|
||||
#define SD_TAG 0x40
|
||||
#define SD_DIFF3 0x80
|
||||
|
||||
// diff3 flags
|
||||
#define SD_TAGLIST 0x01
|
||||
#define SD_MIDMAP 0x02
|
||||
|
||||
#define LD_FLAG 0x01
|
||||
#define LD_SPECIAL 0x02
|
||||
|
@ -523,7 +527,7 @@ static void P_NetArchiveWorld(void)
|
|||
mapsidedef_t *msd;
|
||||
maplinedef_t *mld;
|
||||
const sector_t *ss = sectors;
|
||||
UINT8 diff, diff2;
|
||||
UINT8 diff, diff2, diff3;
|
||||
|
||||
WRITEUINT32(save_p, ARCHIVEBLOCK_WORLD);
|
||||
put = save_p;
|
||||
|
@ -550,7 +554,7 @@ static void P_NetArchiveWorld(void)
|
|||
|
||||
for (i = 0; i < numsectors; i++, ss++, ms++)
|
||||
{
|
||||
diff = diff2 = 0;
|
||||
diff = diff2 = diff3 = 0;
|
||||
if (ss->floorheight != SHORT(ms->floorheight)<<FRACBITS)
|
||||
diff |= SD_FLOORHT;
|
||||
if (ss->ceilingheight != SHORT(ms->ceilingheight)<<FRACBITS)
|
||||
|
@ -584,7 +588,9 @@ static void P_NetArchiveWorld(void)
|
|||
if (ss->tag != SHORT(ms->tag))
|
||||
diff2 |= SD_TAG;
|
||||
if (ss->nexttag != ss->spawn_nexttag || ss->firsttag != ss->spawn_firsttag)
|
||||
diff2 |= SD_TAGLIST;
|
||||
diff3 |= SD_TAGLIST;
|
||||
if (ss->midmap != ss->spawn_midmap)
|
||||
diff3 |= SD_MIDMAP;
|
||||
|
||||
// Check if any of the sector's FOFs differ from how they spawned
|
||||
if (ss->ffloors)
|
||||
|
@ -601,6 +607,9 @@ static void P_NetArchiveWorld(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (diff3)
|
||||
diff2 |= SD_DIFF3;
|
||||
|
||||
if (diff2)
|
||||
diff |= SD_DIFF2;
|
||||
|
||||
|
@ -612,6 +621,8 @@ static void P_NetArchiveWorld(void)
|
|||
WRITEUINT8(put, diff);
|
||||
if (diff & SD_DIFF2)
|
||||
WRITEUINT8(put, diff2);
|
||||
if (diff2 & SD_DIFF3)
|
||||
WRITEUINT8(put, diff3);
|
||||
if (diff & SD_FLOORHT)
|
||||
WRITEFIXED(put, ss->floorheight);
|
||||
if (diff & SD_CEILHT)
|
||||
|
@ -632,17 +643,19 @@ static void P_NetArchiveWorld(void)
|
|||
WRITEFIXED(put, ss->ceiling_xoffs);
|
||||
if (diff2 & SD_CYOFFS)
|
||||
WRITEFIXED(put, ss->ceiling_yoffs);
|
||||
if (diff2 & SD_TAG) // save only the tag
|
||||
WRITEINT16(put, ss->tag);
|
||||
if (diff2 & SD_FLOORANG)
|
||||
WRITEANGLE(put, ss->floorpic_angle);
|
||||
if (diff2 & SD_CEILANG)
|
||||
WRITEANGLE(put, ss->ceilingpic_angle);
|
||||
if (diff2 & SD_TAGLIST) // save both firsttag and nexttag
|
||||
if (diff2 & SD_TAG) // save only the tag
|
||||
WRITEINT16(put, ss->tag);
|
||||
if (diff3 & SD_TAGLIST) // save both firsttag and nexttag
|
||||
{ // either of these could be changed even if tag isn't
|
||||
WRITEINT32(put, ss->firsttag);
|
||||
WRITEINT32(put, ss->nexttag);
|
||||
}
|
||||
if (diff3 & SD_MIDMAP)
|
||||
WRITEINT32(put, ss->midmap);
|
||||
|
||||
// Special case: save the stats of all modified ffloors along with their ffloor "number"s
|
||||
// we don't bother with ffloors that haven't changed, that would just add to savegame even more than is really needed
|
||||
|
@ -680,7 +693,7 @@ static void P_NetArchiveWorld(void)
|
|||
// do lines
|
||||
for (i = 0; i < numlines; i++, mld++, li++)
|
||||
{
|
||||
diff = diff2 = 0;
|
||||
diff = diff2 = diff3 = 0;
|
||||
|
||||
if (li->special != SHORT(mld->special))
|
||||
diff |= LD_SPECIAL;
|
||||
|
@ -772,7 +785,7 @@ static void P_NetUnArchiveWorld(void)
|
|||
line_t *li;
|
||||
side_t *si;
|
||||
UINT8 *get;
|
||||
UINT8 diff, diff2;
|
||||
UINT8 diff, diff2, diff3;
|
||||
|
||||
if (READUINT32(save_p) != ARCHIVEBLOCK_WORLD)
|
||||
I_Error("Bad $$$.sav at archive block World");
|
||||
|
@ -794,6 +807,10 @@ static void P_NetUnArchiveWorld(void)
|
|||
diff2 = READUINT8(get);
|
||||
else
|
||||
diff2 = 0;
|
||||
if (diff2 & SD_DIFF3)
|
||||
diff3 = READUINT8(get);
|
||||
else
|
||||
diff3 = 0;
|
||||
|
||||
if (diff & SD_FLOORHT)
|
||||
sectors[i].floorheight = READFIXED(get);
|
||||
|
@ -822,17 +839,19 @@ static void P_NetUnArchiveWorld(void)
|
|||
sectors[i].ceiling_xoffs = READFIXED(get);
|
||||
if (diff2 & SD_CYOFFS)
|
||||
sectors[i].ceiling_yoffs = READFIXED(get);
|
||||
if (diff2 & SD_TAG)
|
||||
sectors[i].tag = READINT16(get); // DON'T use P_ChangeSectorTag
|
||||
if (diff2 & SD_TAGLIST)
|
||||
{
|
||||
sectors[i].firsttag = READINT32(get);
|
||||
sectors[i].nexttag = READINT32(get);
|
||||
}
|
||||
if (diff2 & SD_FLOORANG)
|
||||
sectors[i].floorpic_angle = READANGLE(get);
|
||||
if (diff2 & SD_CEILANG)
|
||||
sectors[i].ceilingpic_angle = READANGLE(get);
|
||||
if (diff2 & SD_TAG)
|
||||
sectors[i].tag = READINT16(get); // DON'T use P_ChangeSectorTag
|
||||
if (diff3 & SD_TAGLIST)
|
||||
{
|
||||
sectors[i].firsttag = READINT32(get);
|
||||
sectors[i].nexttag = READINT32(get);
|
||||
}
|
||||
if (diff3 & SD_MIDMAP)
|
||||
sectors[i].midmap = READINT32(get);
|
||||
|
||||
if (diff & SD_FFLOORS)
|
||||
{
|
||||
|
@ -891,6 +910,9 @@ static void P_NetUnArchiveWorld(void)
|
|||
diff2 = READUINT8(get);
|
||||
else
|
||||
diff2 = 0;
|
||||
|
||||
diff3 = 0;
|
||||
|
||||
if (diff & LD_FLAG)
|
||||
li->flags = READINT16(get);
|
||||
if (diff & LD_SPECIAL)
|
||||
|
|
|
@ -720,6 +720,7 @@ static void P_LoadRawSectors(UINT8 *data, size_t i)
|
|||
ss->floorpic_angle = ss->ceilingpic_angle = 0;
|
||||
ss->spawn_flrpic_angle = ss->spawn_ceilpic_angle = 0;
|
||||
ss->bottommap = ss->midmap = ss->topmap = -1;
|
||||
ss->spawn_bottommap = ss->spawn_midmap = ss->spawn_topmap = -1;
|
||||
ss->gravity = NULL;
|
||||
ss->cullheight = NULL;
|
||||
ss->verticalflip = false;
|
||||
|
@ -1471,13 +1472,14 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
{
|
||||
case 63: // variable colormap via 242 linedef
|
||||
case 606: //SoM: 4/4/2000: Just colormap transfer
|
||||
case 447: // Change colormap of tagged sectors! -- Monster Iestyn 14/06/18
|
||||
// SoM: R_CreateColormap will only create a colormap in software mode...
|
||||
// Perhaps we should just call it instead of doing the calculations here.
|
||||
if (rendermode == render_soft || rendermode == render_none)
|
||||
{
|
||||
if (msd->toptexture[0] == '#' || msd->bottomtexture[0] == '#')
|
||||
{
|
||||
sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture,
|
||||
sec->midmap = sec->spawn_midmap = R_CreateColormap(msd->toptexture, msd->midtexture,
|
||||
msd->bottomtexture);
|
||||
sd->toptexture = sd->bottomtexture = 0;
|
||||
}
|
||||
|
@ -1507,7 +1509,7 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
{
|
||||
char *col;
|
||||
|
||||
sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture,
|
||||
sec->midmap = sec->spawn_midmap = R_CreateColormap(msd->toptexture, msd->midtexture,
|
||||
msd->bottomtexture);
|
||||
sd->toptexture = sd->bottomtexture = 0;
|
||||
#define HEX2INT(x) (x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0)
|
||||
|
|
21
src/p_spec.c
21
src/p_spec.c
|
@ -2791,8 +2791,14 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
|
||||
case 420: // Fade light levels in tagged sectors to new value
|
||||
P_FadeLight(line->tag,
|
||||
(line->flags & ML_DONTPEGBOTTOM) ? max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, 255), 0) : line->frontsector->lightlevel,
|
||||
(line->flags & ML_DONTPEGBOTTOM) ? max(sides[line->sidenum[0]].rowoffset>>FRACBITS, 0) : P_AproxDistance(line->dx, line->dy)>>FRACBITS,
|
||||
(line->flags & ML_DONTPEGBOTTOM) ? max(sides[line->sidenum[0]].textureoffset>>FRACBITS, 0) : line->frontsector->lightlevel,
|
||||
// failsafe: if user specifies Back Y Offset and NOT Front Y Offset, use the Back Offset
|
||||
// to be consistent with other light and fade specials
|
||||
(line->flags & ML_DONTPEGBOTTOM) ?
|
||||
((line->sidenum[1] != 0xFFFF && !(sides[line->sidenum[0]].rowoffset>>FRACBITS)) ?
|
||||
max(min(sides[line->sidenum[1]].rowoffset>>FRACBITS, 255), 0)
|
||||
: max(min(sides[line->sidenum[0]].rowoffset>>FRACBITS, 255), 0))
|
||||
: abs(P_AproxDistance(line->dx, line->dy))>>FRACBITS,
|
||||
(line->flags & ML_EFFECT4));
|
||||
break;
|
||||
|
||||
|
@ -3265,6 +3271,15 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
}
|
||||
break;
|
||||
|
||||
case 447: // Change colormap of tagged sectors!
|
||||
// Basically this special applies a colormap to the tagged sectors, just like 606 (the colormap linedef)
|
||||
// Except it is activated by linedef executor, not level load
|
||||
// This could even override existing colormaps I believe
|
||||
// -- Monster Iestyn 14/06/18
|
||||
for (secnum = -1; (secnum = P_FindSectorFromLineTag(line, secnum)) >= 0 ;)
|
||||
sectors[secnum].midmap = line->frontsector->midmap;
|
||||
break;
|
||||
|
||||
case 448: // Change skybox viewpoint/centerpoint
|
||||
if ((mo && mo->player && P_IsLocalPlayer(mo->player)) || (line->flags & ML_NOCLIMB))
|
||||
{
|
||||
|
@ -6946,7 +6961,7 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
|||
|
||||
case 606: // HACK! Copy colormaps. Just plain colormaps.
|
||||
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;)
|
||||
sectors[s].midmap = lines[i].frontsector->midmap;
|
||||
sectors[s].midmap = sectors[s].spawn_midmap = lines[i].frontsector->midmap;
|
||||
break;
|
||||
|
||||
#ifdef ESLOPE // Slope copy specials. Handled here for sanity.
|
||||
|
|
|
@ -390,6 +390,7 @@ typedef struct sector_s
|
|||
|
||||
// these are saved for netgames, so do not let Lua touch these!
|
||||
INT32 spawn_nexttag, spawn_firsttag; // the actual nexttag/firsttag values may differ if the sector's tag was changed
|
||||
INT32 spawn_bottommap, spawn_midmap, spawn_topmap;
|
||||
|
||||
// offsets sector spawned with (via linedef type 7)
|
||||
fixed_t spawn_flr_xoffs, spawn_flr_yoffs;
|
||||
|
|
Loading…
Reference in a new issue