- increased the snd_channels default and minimum.

The values were still 8 and 32 respectively which applied to hardware from last decade, but for modern mods these are simply too low. New values are 64 as minimum and 128 as default.

- added script access to a sector's colormap and specialcolors fields. (Writing only through dedicated functions because these fields are render state which may need to trigger some form of refresh if the renderer changes.)
This commit is contained in:
Christoph Oelckers 2017-03-16 10:37:55 +01:00
parent 889a2ae6aa
commit 005e6871f9
6 changed files with 59 additions and 8 deletions

View file

@ -3891,11 +3891,11 @@ void FParser::SF_SetColor(void)
else
{
// little hack for testing the D64 color stuff.
for (int j = 0; j < 4; j++) level.sectors[i].SpecialColors[j] = color;
for (int j = 0; j < 4; j++) level.sectors[i].SetSpecialColor(j, color);
// simulates 'nocoloredspritelighting' settings.
int v = (color.r + color.g + color.b) / 3;
v = (255 + v + v) / 3;
level.sectors[i].SpecialColors[sector_t::sprites] = PalEntry(255, v, v, v);
level.sectors[i].SetSpecialColor(sector_t::sprites, v, v, v);
}
}
}

View file

@ -845,6 +845,35 @@ DEFINE_ACTION_FUNCTION(_Sector, SetFade)
//
//=====================================================================================
void sector_t::SetSpecialColor(int slot, int r, int g, int b)
{
SpecialColors[slot] = PalEntry(255, r, g, b);
}
void sector_t::SetSpecialColor(int slot, PalEntry rgb)
{
rgb.a = 255;
SpecialColors[slot] = rgb;
}
DEFINE_ACTION_FUNCTION(_Sector, SetSpecialColor)
{
PARAM_SELF_STRUCT_PROLOGUE(sector_t);
PARAM_INT(num);
PARAM_COLOR(color);
if (num >= 0 && num < 5)
{
color.a = 255;
self->SetSpecialColor(num, color);
}
return 0;
}
//=====================================================================================
//
//
//=====================================================================================
void sector_t::SetFogDensity(int dens)
{
Colormap.FogDensity = dens;
@ -2414,6 +2443,7 @@ DEFINE_ACTION_FUNCTION(_Secplane, PointToDist)
DEFINE_FIELD_X(Sector, sector_t, floorplane)
DEFINE_FIELD_X(Sector, sector_t, ceilingplane)
DEFINE_FIELD_X(Sector, sector_t, Colormap)
DEFINE_FIELD_X(Sector, sector_t, SpecialColors)
DEFINE_FIELD_X(Sector, sector_t, SoundTarget)
DEFINE_FIELD_X(Sector, sector_t, special)
DEFINE_FIELD_X(Sector, sector_t, lightlevel)

View file

@ -640,6 +640,8 @@ public:
void SetColor(int r, int g, int b, int desat);
void SetFade(int r, int g, int b);
void SetFogDensity(int dens);
void SetSpecialColor(int num, int r, int g, int b);
void SetSpecialColor(int num, PalEntry rgb);
void ClosestPoint(const DVector2 &pos, DVector2 &out) const;
int GetFloorLight () const;
int GetCeilingLight () const;

View file

@ -135,7 +135,10 @@ uint8_t *S_SoundCurve;
int S_SoundCurveSize;
FBoolCVar noisedebug ("noise", false, 0); // [RH] Print sound debugging info?
CVAR (Int, snd_channels, 32, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // number of channels available
CUSTOM_CVAR (Int, snd_channels, 128, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // number of channels available
{
if (self < 64) self = 64;
}
CVAR (Bool, snd_flipstereo, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
// CODE --------------------------------------------------------------------

View file

@ -1642,7 +1642,7 @@ OptionMenu SoundOptions
StaticText " "
Option "$SNDMNU_UNDERWATERREVERB", "snd_waterreverb", "OnOff"
Option "$SNDMNU_RANDOMIZEPITCHES", "snd_pitched", "OnOff"
Slider "$SNDMNU_CHANNELS", "snd_channels", 8, 256, 8, 0
Slider "$SNDMNU_CHANNELS", "snd_channels", 64, 256, 8, 0
StaticText " "
ifoption(fmodex)

View file

@ -199,10 +199,20 @@ struct SecSpecial play
int Flags;
}
struct FColormap
{
Color LightColor;
Color FadeColor;
uint8 Desaturation;
uint8 BlendFactor;
uint16 FogDensity;
}
struct Sector native play
{
//FDynamicColormap *ColorMap;
native readonly FColormap ColorMap;
native readonly Color SpecialColors[5];
native Actor SoundTarget;
@ -228,7 +238,11 @@ struct Sector native play
enum EPlane
{
floor,
ceiling
ceiling,
// only used for specialcolors array
walltop,
wallbottom,
sprites
};
enum EInterpolationType
@ -324,8 +338,6 @@ struct Sector native play
native void RemoveForceField();
native static Sector PointInSector(Vector2 pt);
native void SetColor(color c, int desat = 0);
native void SetFade(color c);
native bool PlaneMoving(int pos);
native int GetFloorLight();
@ -360,10 +372,14 @@ struct Sector native play
native void ChangeFlags(int pos, int And, int Or);
native int GetPlaneLight(int pos);
native void SetPlaneLight(int pos, int level);
native void SetColor(color c, int desat = 0);
native void SetFade(color c);
native void SetFogDensity(int dens);
native double GetGlowHeight(int pos);
native color GetGlowColor(int pos);
native void SetGlowHeight(int pos, double height);
native void SetGlowColor(int pos, color color);
native void SetSpecialColor(int pos, color color);
native TextureID GetTexture(int pos);
native void SetTexture(int pos, TextureID tex, bool floorclip = true);