From 89478a7ba46eaa4932dc45bbfdaf520343e1e46d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 14 Jun 2018 21:51:21 +0100 Subject: [PATCH 1/6] Added linedef 447 as the change colormap linedef exec special. IMPORTANT NOTE: UNTESTED --- src/p_setup.c | 1 + src/p_spec.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/p_setup.c b/src/p_setup.c index a5544c26b..052006a35 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1428,6 +1428,7 @@ 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) diff --git a/src/p_spec.c b/src/p_spec.c index 93b5c89ca..9d1e85366 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3033,6 +3033,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)) { From 002f1bad8fe8741590b362f62a3a092ce77e0e49 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sun, 9 Sep 2018 12:01:50 -0400 Subject: [PATCH 2/6] Savegame netsync for sector colormaps; add spawn_midmap and co for comparison --- src/p_saveg.c | 74 ++++++++++++++++++++++++++++++++++++++------------- src/p_setup.c | 5 ++-- src/p_spec.c | 2 +- src/r_defs.h | 1 + 4 files changed, 60 insertions(+), 22 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 22d43f358..1c9589e8f 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -487,10 +487,16 @@ 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_BOTTOMMAP 0x02 +#define SD_MIDMAP 0x04 +#define SD_TOPMAP 0x08 #define LD_FLAG 0x01 #define LD_SPECIAL 0x02 @@ -523,7 +529,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 +556,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)<ceilingheight != SHORT(ms->ceilingheight)<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->bottommap != ss->spawn_bottommap) + diff3 |= SD_BOTTOMMAP; + if (ss->midmap != ss->spawn_midmap) + diff3 |= SD_MIDMAP; + if (ss->topmap != ss->spawn_topmap) + diff3 |= SD_TOPMAP; // Check if any of the sector's FOFs differ from how they spawned if (ss->ffloors) @@ -601,6 +613,9 @@ static void P_NetArchiveWorld(void) } } + if (diff3) + diff2 |= SD_DIFF3; + if (diff2) diff |= SD_DIFF2; @@ -612,6 +627,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 +649,23 @@ 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_BOTTOMMAP) + WRITEINT32(put, ss->bottommap); + if (diff3 & SD_MIDMAP) + WRITEINT32(put, ss->midmap); + if (diff3 & SD_TOPMAP) + WRITEINT32(put, ss->topmap); // 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 +703,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 +795,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 +817,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 +849,23 @@ 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_BOTTOMMAP) + sectors[i].bottommap = READINT32(get); + if (diff3 & SD_MIDMAP) + sectors[i].midmap = READINT32(get); + if (diff3 & SD_TOPMAP) + sectors[i].topmap = READINT32(get); if (diff & SD_FFLOORS) { @@ -891,6 +924,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) diff --git a/src/p_setup.c b/src/p_setup.c index 92a618b98..50b2e8eda 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -719,6 +719,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; @@ -1477,7 +1478,7 @@ static void P_LoadRawSideDefs2(void *data) { 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 +1508,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) diff --git a/src/p_spec.c b/src/p_spec.c index 87a0bae9c..40be3c7fb 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6769,7 +6769,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. diff --git a/src/r_defs.h b/src/r_defs.h index 7c8f2a73f..f219f0f9e 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -385,6 +385,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; From e171e565ceb794ac50109f8687b77a5609c1c5fb Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 10 Sep 2018 09:03:58 -0400 Subject: [PATCH 3/6] Remove bottommap and topmap from savegame because unused --- src/p_saveg.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 1c9589e8f..42757faf2 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -494,9 +494,7 @@ static void P_NetUnArchivePlayers(void) // diff3 flags #define SD_TAGLIST 0x01 -#define SD_BOTTOMMAP 0x02 -#define SD_MIDMAP 0x04 -#define SD_TOPMAP 0x08 +#define SD_MIDMAP 0x02 #define LD_FLAG 0x01 #define LD_SPECIAL 0x02 @@ -591,12 +589,8 @@ static void P_NetArchiveWorld(void) diff2 |= SD_TAG; if (ss->nexttag != ss->spawn_nexttag || ss->firsttag != ss->spawn_firsttag) diff3 |= SD_TAGLIST; - if (ss->bottommap != ss->spawn_bottommap) - diff3 |= SD_BOTTOMMAP; if (ss->midmap != ss->spawn_midmap) diff3 |= SD_MIDMAP; - if (ss->topmap != ss->spawn_topmap) - diff3 |= SD_TOPMAP; // Check if any of the sector's FOFs differ from how they spawned if (ss->ffloors) @@ -660,12 +654,8 @@ static void P_NetArchiveWorld(void) WRITEINT32(put, ss->firsttag); WRITEINT32(put, ss->nexttag); } - if (diff3 & SD_BOTTOMMAP) - WRITEINT32(put, ss->bottommap); if (diff3 & SD_MIDMAP) WRITEINT32(put, ss->midmap); - if (diff3 & SD_TOPMAP) - WRITEINT32(put, ss->topmap); // 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 @@ -860,12 +850,8 @@ static void P_NetUnArchiveWorld(void) sectors[i].firsttag = READINT32(get); sectors[i].nexttag = READINT32(get); } - if (diff3 & SD_BOTTOMMAP) - sectors[i].bottommap = READINT32(get); if (diff3 & SD_MIDMAP) sectors[i].midmap = READINT32(get); - if (diff3 & SD_TOPMAP) - sectors[i].topmap = READINT32(get); if (diff & SD_FFLOORS) { From 41fe080a68b36df41d0a6161e570e59ad0bb037a Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 12 Sep 2018 21:32:12 -0400 Subject: [PATCH 4/6] 420: Allow Back Y Offset for timing parameter --- src/p_spec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index aa3a81f23..eed083cd9 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2779,8 +2779,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; From 63a3125df2a5f12fcecc28d7d4ccbcd4b6252b2b Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 12 Sep 2018 21:47:53 -0400 Subject: [PATCH 5/6] 420: A parenthesis --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 85790041f..5ccdca671 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2786,7 +2786,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) ((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), + : abs(P_AproxDistance(line->dx, line->dy))>>FRACBITS, (line->flags & ML_EFFECT4)); break; From 714464993ef49e8f6beb3133dce03380e0289c36 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Fri, 14 Sep 2018 08:26:52 -0400 Subject: [PATCH 6/6] 420: Removed unnecessary include (gametic no longer needed) --- src/p_lights.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_lights.c b/src/p_lights.c index 95171155e..8bcdd8ce0 100644 --- a/src/p_lights.c +++ b/src/p_lights.c @@ -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"