diff --git a/src/p_setup.c b/src/p_setup.c index 5d7fd3179..cc5ee3cc8 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1469,7 +1469,7 @@ static void P_LoadRawSideDefs2(void *data) 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. - sec->extra_colormap = sec->spawn_extra_colormap = R_CreateColormap(msd->toptexture, msd->midtexture, + sd->colormap_data = R_CreateColormap(msd->toptexture, msd->midtexture, msd->bottomtexture); sd->toptexture = sd->midtexture = sd->bottomtexture = 0; break; diff --git a/src/p_spec.c b/src/p_spec.c index fd02803cc..cc4dfb9e1 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3260,8 +3260,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (line->flags & ML_EFFECT3) // relative calc { extracolormap_t *exc = R_AddColormaps( - (line->flags & ML_TFERLINE) ? line->backsector->extra_colormap : sectors[secnum].extra_colormap, // use back colormap instead of target sector - line->frontsector->extra_colormap, + (line->flags & ML_TFERLINE) && line->sidenum[1] != 0xFFFF ? + sides[line->sidenum[1]].colormap_data : sectors[secnum].extra_colormap, // use back colormap instead of target sector + sides[line->sidenum[0]].colormap_data, line->flags & ML_EFFECT1, // subtract R line->flags & ML_NOCLIMB, // subtract G line->flags & ML_EFFECT2, // subtract B @@ -3289,7 +3290,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } else if (line->flags & ML_DONTPEGBOTTOM) // alternate alpha (by texture offsets) { - extracolormap_t *exc = R_CopyColormap(line->frontsector->extra_colormap, false); + extracolormap_t *exc = R_CopyColormap(sides[line->sidenum[0]].colormap_data, false); exc->rgba = R_GetRgbaRGB(exc->rgba) + R_PutRgbaA(max(min(sides[line->sidenum[0]].textureoffset >> FRACBITS, 25), 0)); exc->fadergba = R_GetRgbaRGB(exc->fadergba) + R_PutRgbaA(max(min(sides[line->sidenum[0]].rowoffset >> FRACBITS, 25), 0)); @@ -3303,7 +3304,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) Z_Free(exc); } else - sectors[secnum].extra_colormap = line->frontsector->extra_colormap; + sectors[secnum].extra_colormap = sides[line->sidenum[0]].colormap_data; } break; @@ -6817,7 +6818,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].extra_colormap = sectors[s].spawn_extra_colormap = lines[i].frontsector->extra_colormap; + sectors[s].extra_colormap = sectors[s].spawn_extra_colormap = sides[lines[i].sidenum[0]].colormap_data; break; #ifdef ESLOPE // Slope copy specials. Handled here for sanity. diff --git a/src/r_defs.h b/src/r_defs.h index 63ca29aa1..1f2afdb99 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -476,6 +476,8 @@ typedef struct INT16 repeatcnt; // # of times to repeat midtexture char *text; // a concatination of all top, bottom, and mid texture names, for linedef specials that require a string. + + extracolormap_t *colormap_data; // storage for colormaps; not applied to sectors. } side_t; //