Skip to content

Commit

Permalink
hooked up the per-level colormaps with the hardware renderer.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Oct 29, 2023
1 parent e12f2ce commit 12bc9db
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/g_level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1822,11 +1822,8 @@ void FLevelLocals::Init()
}
}

if (strnicmp (info->CustomColorMap.GetChars(), "COLORMAP", 8) != 0)
{
flags3 |= LEVEL3_HAS_CUSTOM_COLORMAP;
}

globalcolormap = R_ColormapNumForName(info->CustomColorMap.GetChars());
airsupply = info->airsupply*TICRATE;
outsidefog = info->outsidefog;
WallVertLight = info->WallVertLight*2;
Expand Down
1 change: 1 addition & 0 deletions src/g_levellocals.h
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ struct FLevelLocals
double sky1pos, sky2pos;
float hw_sky1pos, hw_sky2pos;
bool skystretch;
uint32_t globalcolormap;

int total_secrets;
int found_secrets;
Expand Down
1 change: 0 additions & 1 deletion src/gamedata/g_mapinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ enum ELevelFlags : unsigned int
LEVEL3_AVOIDMELEE = 0x00020000, // global flag needed for proper MBF support.
LEVEL3_NOJUMPDOWN = 0x00040000, // only for MBF21. Inverse of MBF's dog_jumping flag.
LEVEL3_LIGHTCREATED = 0x00080000, // a light had been created in the last frame
LEVEL3_HAS_CUSTOM_COLORMAP = 0x00100000, // custom colormap property from dsda-doom
};


Expand Down
2 changes: 1 addition & 1 deletion src/gamedata/r_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ struct sector_t
int sky; // MBF sky transfer info.
int validcount; // if == validcount, already checked

uint32_t bottommap, midmap, topmap; // killough 4/4/98: dynamic colormaps
uint32_t selfmap, bottommap, midmap, topmap; // killough 4/4/98: dynamic colormaps
// [RH] these can also be blend values if
// the alpha mask is non-zero

Expand Down
1 change: 1 addition & 0 deletions src/p_saveg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sector_t &p, sector_t
//("bottommap", p.bottommap)
//("midmap", p.midmap)
//("topmap", p.topmap)
//("selfmap", p.selfmap) // todo: if this becomes changeable we need a colormap serializer.
("damageamount", p.damageamount, def->damageamount)
("damageinterval", p.damageinterval, def->damageinterval)
("leakydamage", p.leakydamage, def->leakydamage)
Expand Down
2 changes: 2 additions & 0 deletions src/rendering/2d/v_blend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ FVector4 V_CalcBlend(sector_t* viewsector, PalEntry* modulateColor)
auto s = viewsector->heightsec;
blendv = s->floorplane.PointOnSide(vpp) < 0 ? s->bottommap : s->ceilingplane.PointOnSide(vpp) < 0 ? s->topmap : s->midmap;
}
else if (viewsector->selfmap != 0) blendv = viewsector->selfmap;
else blendv = viewsector->Level->globalcolormap;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/rendering/swrenderer/r_swrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ void FSoftwareRenderer::SetColormap(FLevelLocals *Level)
NormalLight.Maps = realcolormaps.Maps;
NormalLight.ChangeColor(PalEntry(255, 255, 255), 0);
NormalLight.ChangeFade(Level->fadeto);
if(Level->info->flags3 & LEVEL3_HAS_CUSTOM_COLORMAP)
if(Level->globalcolormap != 0) // this deliberately ignores the translated value and goes directly to the source.
{
SetDefaultColormap(Level->info->CustomColorMap.GetChars());
}
Expand Down

0 comments on commit 12bc9db

Please sign in to comment.