Merge remote-tracking branch 'origin/master' into gles2_merge

This commit is contained in:
Rachael Alexanderson 2021-08-18 12:31:47 -04:00
commit 2096fefcee
28 changed files with 60 additions and 60 deletions

View file

@ -791,7 +791,7 @@ void FMapInfoParser::ParseAMColors(bool overlay)
FString color = sc.String;
FString colorName = V_GetColorStringByName(color);
if(!colorName.IsEmpty()) color = colorName;
int colorval = V_GetColorFromString(nullptr, color);
int colorval = V_GetColorFromString(color);
cset.c[i].FromRGB(RPART(colorval), GPART(colorval), BPART(colorval));
colorset = true;
break;

View file

@ -839,11 +839,11 @@ int FColorCVar::ToInt2 (UCVarValue value, ECVarType type)
if (string.IsNotEmpty())
{
ret = V_GetColorFromString (NULL, string);
ret = V_GetColorFromString (string);
}
else
{
ret = V_GetColorFromString (NULL, value.String);
ret = V_GetColorFromString (value.String);
}
}
else

View file

@ -415,19 +415,19 @@ void V_InitFontColors ()
else if (sc.Compare ("Flat:"))
{
sc.MustGetString();
logcolor = V_GetColor (nullptr, sc);
logcolor = V_GetColor (sc);
}
else
{
// Get first color
c = V_GetColor (nullptr, sc);
c = V_GetColor (sc);
tparm.Start[0] = RPART(c);
tparm.Start[1] = GPART(c);
tparm.Start[2] = BPART(c);
// Get second color
sc.MustGetString();
c = V_GetColor (nullptr, sc);
c = V_GetColor (sc);
tparm.End[0] = RPART(c);
tparm.End[1] = GPART(c);
tparm.End[2] = BPART(c);

View file

@ -459,7 +459,7 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s
}
else if (args[i] == TypeColor)
{
params.Push(V_GetColor(nullptr, sc));
params.Push(V_GetColor(sc));
}
else if (args[i] == TypeFont)
{
@ -1028,7 +1028,7 @@ static void ParseOptionMenuBody(FScanner &sc, DOptionMenuDescriptor *desc, int i
}
else if (args[i] == TypeColor)
{
params.Push(V_GetColor(nullptr, sc));
params.Push(V_GetColor(sc));
}
else if (args[i]->isIntCompatible())
{
@ -1274,7 +1274,7 @@ static void ParseImageScrollerBody(FScanner& sc, DImageScrollerDescriptor* desc)
}
else if (args[i] == TypeColor)
{
params.Push(V_GetColor(nullptr, sc));
params.Push(V_GetColor(sc));
}
else if (args[i]->isIntCompatible())
{

View file

@ -1328,7 +1328,7 @@ FxExpression *FxColorCast::Resolve(FCompileContext &ctx)
}
else
{
FxExpression *x = new FxConstant(V_GetColor(nullptr, constval.GetString(), &ScriptPosition), ScriptPosition);
FxExpression *x = new FxConstant(V_GetColor(constval.GetString(), &ScriptPosition), ScriptPosition);
delete this;
return x;
}

View file

@ -49,7 +49,7 @@ static int CastS2I(FString *b) { return (int)b->ToLong(); }
static double CastS2F(FString *b) { return b->ToDouble(); }
static int CastS2N(FString *b) { return b->Len() == 0 ? NAME_None : FName(*b).GetIndex(); }
static void CastN2S(FString *a, int b) { FName name = FName(ENamedName(b)); *a = name.IsValidName() ? name.GetChars() : ""; }
static int CastS2Co(FString *b) { return V_GetColor(nullptr, *b); }
static int CastS2Co(FString *b) { return V_GetColor(*b); }
static void CastCo2S(FString *a, int b) { PalEntry c(b); a->Format("%02x %02x %02x", c.r, c.g, c.b); }
static int CastS2So(FString *b) { return FSoundID(*b); }
static void CastSo2S(FString* a, int b) { *a = soundEngine->GetSoundName(b); }

View file

@ -1826,7 +1826,7 @@ static void DoCast(const VMRegisters &reg, const VMFrame *f, int a, int b, int c
case CAST_S2Co:
ASSERTD(a); ASSERTS(b);
reg.d[a] = V_GetColor(NULL, reg.s[b]);
reg.d[a] = V_GetColor(reg.s[b]);
break;
case CAST_Co2S:

View file

@ -542,7 +542,7 @@ void FMultipatchTextureBuilder::ParsePatch(FScanner &sc, BuildInfo &info, TexPar
if (!sc.CheckNumber())
{
sc.MustGetString();
part.Blend = V_GetColor(NULL, sc);
part.Blend = V_GetColor(sc);
}
else
{

View file

@ -523,7 +523,7 @@ PalEntry averageColor(const uint32_t* data, int size, int maxout)
//
//==========================================================================
int V_GetColorFromString(const uint32_t* palette, const char* cstr, FScriptPosition* sc)
int V_GetColorFromString(const char* cstr, FScriptPosition* sc)
{
int c[3], i, p;
char val[3];
@ -609,10 +609,7 @@ int V_GetColorFromString(const uint32_t* palette, const char* cstr, FScriptPosit
}
}
}
if (palette)
return BestColor(palette, c[0], c[1], c[2]);
else
return MAKERGB(c[0], c[1], c[2]);
return MAKERGB(c[0], c[1], c[2]);
}
//==========================================================================
@ -715,26 +712,26 @@ FString V_GetColorStringByName(const char* name, FScriptPosition* sc)
//
//==========================================================================
int V_GetColor(const uint32_t* palette, const char* str, FScriptPosition* sc)
int V_GetColor(const char* str, FScriptPosition* sc)
{
FString string = V_GetColorStringByName(str, sc);
int res;
if (!string.IsEmpty())
{
res = V_GetColorFromString(palette, string, sc);
res = V_GetColorFromString(string, sc);
}
else
{
res = V_GetColorFromString(palette, str, sc);
res = V_GetColorFromString(str, sc);
}
return res;
}
int V_GetColor(const uint32_t* palette, FScanner& sc)
int V_GetColor(FScanner& sc)
{
FScriptPosition scc = sc;
return V_GetColor(palette, sc.String, &scc);
return V_GetColor(sc.String, &scc);
}
//==========================================================================

View file

@ -22,14 +22,14 @@ void HSVtoRGB (float *r, float *g, float *b, float h, float s, float v);
// Returns the closest color to the one desired. String
// should be of the form "rr gg bb".
int V_GetColorFromString(const uint32_t* palette, const char* colorstring, FScriptPosition* sc = nullptr);
int V_GetColorFromString(const char* colorstring, FScriptPosition* sc = nullptr);
// Scans through the X11R6RGB lump for a matching color
// and returns a color string suitable for V_GetColorFromString.
FString V_GetColorStringByName(const char* name, FScriptPosition* sc = nullptr);
// Tries to get color by name, then by string
int V_GetColor(const uint32_t* palette, const char* str, FScriptPosition* sc = nullptr);
int V_GetColor(const uint32_t* palette, FScanner& sc);
int V_GetColor(const char* str, FScriptPosition* sc = nullptr);
int V_GetColor(FScanner& sc);
PalEntry averageColor(const uint32_t* data, int size, int maxout);
enum

View file

@ -172,10 +172,10 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize,
{
sc.MustGetStringName("=");
sc.MustGetString();
iwad->FgColor = V_GetColor(NULL, sc);
iwad->FgColor = V_GetColor(sc);
sc.MustGetStringName(",");
sc.MustGetString();
iwad->BkColor = V_GetColor(NULL, sc);
iwad->BkColor = V_GetColor(sc);
}
else if (sc.Compare("IgnoreTitlePatches"))
{

View file

@ -1911,10 +1911,10 @@ static FString ParseGameInfo(TArray<FString> &pwads, const char *fn, const char
else if (!nextKey.CompareNoCase("STARTUPCOLORS"))
{
sc.MustGetString();
GameStartupInfo.FgColor = V_GetColor(NULL, sc);
GameStartupInfo.FgColor = V_GetColor(sc);
sc.MustGetStringName(",");
sc.MustGetString();
GameStartupInfo.BkColor = V_GetColor(NULL, sc);
GameStartupInfo.BkColor = V_GetColor(sc);
}
else if (!nextKey.CompareNoCase("STARTUPTYPE"))
{

View file

@ -443,7 +443,7 @@ void FDecalLib::ParseDecal (FScanner &sc)
sc.MustGetString ();
if (!sc.Compare("BloodDefault"))
{
newdecal.ShadeColor = V_GetColor (NULL, sc);
newdecal.ShadeColor = V_GetColor (sc);
}
else
{
@ -458,8 +458,8 @@ void FDecalLib::ParseDecal (FScanner &sc)
case DECAL_COLORS:
uint32_t startcolor, endcolor;
sc.MustGetString (); startcolor = V_GetColor (NULL, sc);
sc.MustGetString (); endcolor = V_GetColor (NULL, sc);
sc.MustGetString (); startcolor = V_GetColor (sc);
sc.MustGetString (); endcolor = V_GetColor (sc);
newdecal.Translation = GenerateTranslation (startcolor, endcolor)->Index;
break;
@ -739,7 +739,7 @@ void FDecalLib::ParseColorchanger (FScanner &sc)
else if (sc.Compare ("Color"))
{
sc.MustGetString ();
goal = V_GetColor (NULL, sc);
goal = V_GetColor (sc);
}
else
{

View file

@ -1015,14 +1015,14 @@ DEFINE_MAP_OPTION(fade, true)
{
parse.ParseAssign();
parse.sc.MustGetString();
info->fadeto = V_GetColor(NULL, parse.sc);
info->fadeto = V_GetColor(parse.sc);
}
DEFINE_MAP_OPTION(outsidefog, true)
{
parse.ParseAssign();
parse.sc.MustGetString();
info->outsidefog = V_GetColor(NULL, parse.sc);
info->outsidefog = V_GetColor(parse.sc);
}
DEFINE_MAP_OPTION(titlepatch, true)
@ -1398,14 +1398,14 @@ DEFINE_MAP_OPTION(hazardcolor, true)
{
parse.ParseAssign();
parse.sc.MustGetString();
info->hazardcolor = V_GetColor(NULL, parse.sc);
info->hazardcolor = V_GetColor(parse.sc);
}
DEFINE_MAP_OPTION(hazardflash, true)
{
parse.ParseAssign();
parse.sc.MustGetString();
info->hazardflash = V_GetColor(NULL, parse.sc);
info->hazardflash = V_GetColor(parse.sc);
}
DEFINE_MAP_OPTION(fogdensity, false)

View file

@ -215,7 +215,7 @@ const char* GameInfoBorders[] =
FString colorName = V_GetColorStringByName(color); \
if(!colorName.IsEmpty()) \
color = colorName; \
gameinfo.key = V_GetColorFromString(NULL, color); \
gameinfo.key = V_GetColorFromString(color); \
}
#define GAMEINFOKEY_BOOL(key, variable) \

View file

@ -183,7 +183,7 @@ void FTeam::ParseTeamDefinition (FScanner &Scan)
case TEAMINFO_PlayerColor:
Scan.MustGetString ();
Team.m_iPlayerColor = V_GetColor (NULL, Scan);
Team.m_iPlayerColor = V_GetColor (Scan);
break;
case TEAMINFO_TextColor:

View file

@ -5728,7 +5728,7 @@ AActor *FLevelLocals::SpawnMapThing (FMapThing *mthing, int position)
{
if (mthing->arg0str != NAME_None)
{
PalEntry color = V_GetColor(nullptr, mthing->arg0str.GetChars());
PalEntry color = V_GetColor(mthing->arg0str.GetChars());
mobj->args[0] = color.r;
mobj->args[1] = color.g;
mobj->args[2] = color.b;

View file

@ -1057,7 +1057,7 @@ class GLDefsParser
auto tex = TexMan.GetGameTexture(flump);
sc.MustGetStringName(",");
sc.MustGetString();
PalEntry color = V_GetColor(NULL, sc.String);
PalEntry color = V_GetColor(sc.String);
//sc.MustGetStringName(",");
//sc.MustGetNumber();
if (sc.CheckString(","))
@ -1671,12 +1671,12 @@ class GLDefsParser
else if (sc.Compare("AddColor"))
{
sc.MustGetString();
tm.AddColor = (tm.AddColor & 0xff000000) | (V_GetColor(NULL, sc) & 0xffffff);
tm.AddColor = (tm.AddColor & 0xff000000) | (V_GetColor(sc) & 0xffffff);
}
else if (sc.Compare("ModulateColor"))
{
sc.MustGetString();
tm.ModulateColor = V_GetColor(NULL, sc) & 0xffffff;
tm.ModulateColor = V_GetColor(sc) & 0xffffff;
if (sc.CheckToken(','))
{
sc.MustGetNumber();
@ -1687,7 +1687,7 @@ class GLDefsParser
else if (sc.Compare("BlendColor"))
{
sc.MustGetString();
tm.BlendColor = V_GetColor(NULL, sc) & 0xffffff;
tm.BlendColor = V_GetColor(sc) & 0xffffff;
sc.MustGetToken(',');
sc.MustGetString();
static const char* opts[] = { "none", "alpha", "screen", "overlay", "hardlight", nullptr };

View file

@ -183,7 +183,7 @@ void RenderModel(FModelRenderer *renderer, float x, float y, float z, FSpriteMod
void RenderHUDModel(FModelRenderer *renderer, DPSprite *psp, float ofsX, float ofsY)
{
AActor * playermo = players[consoleplayer].camera;
FSpriteModelFrame *smf = FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
FSpriteModelFrame *smf = psp->Caller != nullptr ? FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false) : nullptr;
// [BB] No model found for this sprite, so we can't render anything.
if (smf == nullptr)
@ -783,7 +783,7 @@ bool IsHUDModelForPlayerAvailable (player_t * player)
// [MK] check that at least one psprite uses models
for (DPSprite *psp = player->psprites; psp != nullptr && psp->GetID() < PSP_TARGETCENTER; psp = psp->GetNext())
{
FSpriteModelFrame *smf = FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
FSpriteModelFrame *smf = psp->Caller != nullptr ? FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false) : nullptr;
if ( smf != nullptr ) return true;
}
return false;

View file

@ -98,11 +98,11 @@ CCMD (testblend)
{
if ( !(colorstring = V_GetColorStringByName (argv[1])).IsEmpty() )
{
color = V_GetColorFromString (NULL, colorstring);
color = V_GetColorFromString (colorstring);
}
else
{
color = V_GetColorFromString (NULL, argv[1]);
color = V_GetColorFromString (argv[1]);
}
amt = (float)atof (argv[2]);
if (amt > 1.0f)

View file

@ -614,7 +614,7 @@ void HWDrawInfo::PreparePlayerSprites(sector_t * viewsector, area_t in_area)
for (DPSprite *psp = player->psprites; psp != nullptr && psp->GetID() < PSP_TARGETCENTER; psp = psp->GetNext())
{
if (!psp->GetState()) continue;
FSpriteModelFrame *smf = FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false);
FSpriteModelFrame *smf = psp->Caller != nullptr ? FindModelFrame(psp->Caller->GetClass(), psp->GetSprite(), psp->GetFrame(), false) : nullptr;
// This is an 'either-or' proposition. This maybe needs some work to allow overlays with weapon models but as originally implemented this just won't work.
if (smf && !hudModelStep) continue;
if (!smf && hudModelStep) continue;

View file

@ -516,11 +516,11 @@ CCMD (testfade)
{
if ( !(colorstring = V_GetColorStringByName (argv[1])).IsEmpty() )
{
color = V_GetColorFromString (NULL, colorstring);
color = V_GetColorFromString (colorstring);
}
else
{
color = V_GetColorFromString (NULL, argv[1]);
color = V_GetColorFromString (argv[1]);
}
for (auto Level : AllLevels())
{
@ -550,11 +550,11 @@ CCMD (testcolor)
{
if ( !(colorstring = V_GetColorStringByName (argv[1])).IsEmpty() )
{
color = V_GetColorFromString (NULL, colorstring);
color = V_GetColorFromString (colorstring);
}
else
{
color = V_GetColorFromString (NULL, argv[1]);
color = V_GetColorFromString (argv[1]);
}
if (argv.argc() > 2)
{

View file

@ -190,7 +190,7 @@ FxExpression *ParseParameter(FScanner &sc, PClassActor *cls, PType *type)
}
else
{
int c = V_GetColor (NULL, sc);
int c = V_GetColor (sc);
// 0 needs to be the default so we have to mark the color.
v = MAKEARGB(1, RPART(c), GPART(c), BPART(c));
}
@ -884,7 +884,7 @@ static void DispatchScriptProperty(FScanner &sc, PProperty *prop, AActor *defaul
else if (f->Type == TypeColor)
{
if (sc.CheckNumber()) *(int*)addr = sc.Number;
else *(PalEntry*)addr = V_GetColor(nullptr, sc);
else *(PalEntry*)addr = V_GetColor(sc);
}
else if (f->Type->isIntCompatible())
{

View file

@ -326,6 +326,6 @@ int MatchString (const char *in, const char **strings);
double var = params[(no)+1].d;
#define PROP_COLOR_PARM(var, no, scriptpos) \
int var = params[(no)+1].i== 0? params[(no)+2].i : V_GetColor(NULL, params[(no)+2].s, scriptpos);
int var = params[(no)+1].i== 0? params[(no)+2].i : V_GetColor(params[(no)+2].s, scriptpos);
#endif

View file

@ -1291,7 +1291,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, color, C_f, Inventory)
*pBlendColor = MakeSpecialColormap(65535);
return;
}
color = V_GetColor(NULL, name, &bag.ScriptPosition);
color = V_GetColor(name, &bag.ScriptPosition);
}
if (PROP_PARM_COUNT > 2)
{

View file

@ -471,7 +471,7 @@ void ZCCDoomCompiler::DispatchScriptProperty(PProperty *prop, ZCC_PropertyStmt *
}
else if (f->Type == TypeColor && ex->ValueType == TypeString) // colors can also be specified as ints.
{
*(PalEntry*)addr = V_GetColor(nullptr, GetStringConst(ex, ctx), &ex->ScriptPosition);
*(PalEntry*)addr = V_GetColor(GetStringConst(ex, ctx), &ex->ScriptPosition);
}
else if (f->Type->isIntCompatible())
{

View file

@ -948,6 +948,8 @@ OptionMenu "VideoOptions" protected
Slider "$DSPLYMNU_CONTRAST", "vid_contrast", 0.1, 3.0, 0.1
Slider "$DSPLYMNU_SATURATION", "vid_saturation", -3.0, 3.0, 0.25, 2
StaticText " "
Slider "$DSPLYMNU_FOV", "fov", 75.0, 120.0, 0.1, 1
StaticText " "
Option "$DSPLYMNU_SPRITESHADOW", "r_actorspriteshadow", "SpriteShadowModes"
Option "$DSPLYMNU_CUSTOMINVERTMAP", "cl_customizeinvulmap", "OnOff"
ColorPicker "$DSPLYMNU_CUSTOMINVERTC1", "cl_custominvulmapcolor1"

View file

@ -69,7 +69,8 @@ OptionMenu VideoOptionsSimple protected
Slider "$DSPLYMNU_BRIGHTNESS", "vid_brightness", -0.8,0.8, 0.05,2
Slider "$DSPLYMNU_CONTRAST", "vid_contrast", 0.1, 3.0, 0.1
Slider "$DSPLYMNU_SATURATION", "vid_saturation", -3.0, 3.0, 0.25, 2
StaticText " "
Slider "$DSPLYMNU_FOV", "fov", 75.0, 120.0, 0.1, 1
// commenting this out for now, this menu is so general purpose I am not sure it makes sense, but I'm leaving it here just in case
// the "full" menu doesn't have some of the options that are in this one.
//StaticText " "