- added the needed properties for Doom64 colors and a little FraggleScript hack to test it with existing maps.

This commit is contained in:
Christoph Oelckers 2017-01-28 19:05:39 +01:00
parent 1d2ae53ecb
commit dbbd797baa
8 changed files with 67 additions and 3 deletions

View file

@ -3875,7 +3875,7 @@ void FParser::SF_SetColor(void)
color.r=intvalue(t_argv[1]);
color.g=intvalue(t_argv[2]);
color.b=intvalue(t_argv[3]);
color.a=0;
color.a = (DFraggleThinker::ActiveThinker->setcolormaterial) ? 255 : 0;
}
else return;
@ -3883,7 +3883,16 @@ void FParser::SF_SetColor(void)
FSSectorTagIterator itr(tagnum);
while ((i = itr.Next()) >= 0)
{
level.sectors[i].ColorMap = GetSpecialLights (color, level.sectors[i].ColorMap->Fade, 0);
if (!DFraggleThinker::ActiveThinker->setcolormaterial)
level.sectors[i].ColorMap = GetSpecialLights(color, level.sectors[i].ColorMap->Fade, 0);
else
{
// little hack for testing the D64 color stuff.
for (int j = 0; j < 4; j++) level.sectors[i].SpecialColors[j] = color;
// simulates 'nocoloredspritelighting' settings.
int v = (color.r + color.g + color.b) / 3;
level.sectors[i].SpecialColors[4] = (255 + v + v) / 3;
}
}
}
}

View file

@ -73,15 +73,18 @@ struct FFsOptions : public FOptionalMapinfoData
{
identifier = "fragglescript";
nocheckposition = false;
setcolormaterial = false;
}
virtual FOptionalMapinfoData *Clone() const
{
FFsOptions *newopt = new FFsOptions;
newopt->identifier = identifier;
newopt->nocheckposition = nocheckposition;
newopt->setcolormaterial = setcolormaterial;
return newopt;
}
bool nocheckposition;
bool setcolormaterial;
};
DEFINE_MAP_OPTION(fs_nocheckposition, false)
@ -99,6 +102,21 @@ DEFINE_MAP_OPTION(fs_nocheckposition, false)
}
}
DEFINE_MAP_OPTION(fs_setcolormaterial, false)
{
FFsOptions *opt = info->GetOptData<FFsOptions>("fragglescript");
if (parse.CheckAssign())
{
parse.sc.MustGetNumber();
opt->setcolormaterial = !!parse.sc.Number;
}
else
{
opt->setcolormaterial = true;
}
}
//-----------------------------------------------------------------------------
//
// Process the lump to strip all unneeded information from it
@ -307,6 +325,7 @@ bool FScriptLoader::ParseInfo(MapData * map)
if (opt != NULL)
{
DFraggleThinker::ActiveThinker->nocheckposition = opt->nocheckposition;
DFraggleThinker::ActiveThinker->setcolormaterial = opt->setcolormaterial;
}
}

View file

@ -695,6 +695,7 @@ public:
TObjPtr<DRunningScript> RunningScripts;
TArray<TObjPtr<AActor> > SpawnedThings;
bool nocheckposition;
bool setcolormaterial;
DFraggleThinker();
void OnDestroy() override;

View file

@ -549,6 +549,11 @@ xx(Lightceilingabsolute)
xx(Gravity)
xx(Lightcolor)
xx(Fadecolor)
xx(Color_Floor)
xx(Color_Ceiling)
xx(Color_Walltop)
xx(Color_Wallbottom)
xx(Color_Sprites)
xx(Desaturation)
xx(SoundSequence)
xx(Silent)

View file

@ -275,6 +275,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sector_t &p, sector_t
("linked_floor", p.e->Linked.Floor.Sectors)
("linked_ceiling", p.e->Linked.Ceiling.Sectors)
("colormap", p.ColorMap, def->ColorMap)
.Array("specialcolors", p.SpecialColors, def->SpecialColors, 5, true)
("gravity", p.gravity, def->gravity)
.Terrain("floorterrain", p.terrainnum[0], &def->terrainnum[0])
.Terrain("ceilingterrain", p.terrainnum[1], &def->terrainnum[1])

View file

@ -1504,6 +1504,7 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
ss->SeqName = NAME_None;
ss->nextsec = -1; //jff 2/26/98 add fields to support locking out
ss->prevsec = -1; // stair retriggering until build completes
memset(ss->SpecialColors, -1, sizeof(ss->SpecialColors));
ss->SetAlpha(sector_t::floor, 1.);
ss->SetAlpha(sector_t::ceiling, 1.);

View file

@ -1307,6 +1307,7 @@ public:
sec->sectornum = index;
sec->damageinterval = 32;
sec->terrainnum[sector_t::ceiling] = sec->terrainnum[sector_t::floor] = -1;
memset(sec->SpecialColors, -1, sizeof(sec->SpecialColors));
if (floordrop) sec->Flags = SECF_FLOORDROP;
// killough 3/7/98: end changes
@ -1459,6 +1460,26 @@ public:
fadecolor = CheckInt(key);
continue;
case NAME_Color_Floor:
sec->SpecialColors[sector_t::floor] = CheckInt(key) || 0xff000000;
break;
case NAME_Color_Ceiling:
sec->SpecialColors[sector_t::ceiling] = CheckInt(key) || 0xff000000;
break;
case NAME_Color_Walltop:
sec->SpecialColors[sector_t::walltop] = CheckInt(key) || 0xff000000;
break;
case NAME_Color_Wallbottom:
sec->SpecialColors[sector_t::wallbottom] = CheckInt(key) || 0xff000000;
break;
case NAME_Color_Sprites:
sec->SpecialColors[sector_t::sprites] = CheckInt(key) || 0xff000000;
break;
case NAME_Desaturation:
desaturation = int(255*CheckFloat(key));
continue;

View file

@ -479,6 +479,7 @@ enum
SECF_UNDERWATERMASK = 32+64,
SECF_DRAWN = 128, // sector has been drawn at least once
SECF_HIDDEN = 256, // Do not draw on textured automap
SECF_SPECIALCOLORSABSOLUTE = 512, // The special colors ignore the light level except for fog density.
};
enum
@ -660,10 +661,15 @@ public:
FSectorPortal *ValidatePortal(int which);
void CheckPortalPlane(int plane);
enum
{
floor,
ceiling
ceiling,
// only used for specialcolors array
walltop,
wallbottom,
sprites
};
struct splane
@ -961,6 +967,7 @@ public:
// [RH] give floor and ceiling even more properties
FDynamicColormap *ColorMap; // [RH] Per-sector colormap
PalEntry SpecialColors[5];
TObjPtr<AActor> SoundTarget;