mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 05:51:20 +00:00
- removed the unused palette parameter from the V_GetColor family of functions.
This commit is contained in:
parent
d64dd1f631
commit
109069f718
24 changed files with 53 additions and 56 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -1826,7 +1826,7 @@ static void DoCast(const VMRegisters ®, 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:
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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,9 +609,6 @@ 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]);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"))
|
||||
{
|
||||
|
|
|
@ -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"))
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue