MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Script_SetColor

Function Script_SetColor

code/ui/ui_shared.cpp:2164–2205  ·  view source on GitHub ↗

================= Script_SetColor ================= */

Source from the content-addressed store, hash-verified

2162=================
2163*/
2164qboolean Script_SetColor(itemDef_t *item, const char **args)
2165{
2166 const char *name;
2167 int i;
2168 float f;
2169 vec4_t *out;
2170
2171 // expecting type of color to set and 4 args for the color
2172 if (String_Parse(args, &name))
2173 {
2174 out = NULL;
2175 if (Q_stricmp(name, "backcolor") == 0)
2176 {
2177 out = &item->window.backColor;
2178 item->window.flags |= WINDOW_BACKCOLORSET;
2179 }
2180 else if (Q_stricmp(name, "forecolor") == 0)
2181 {
2182 out = &item->window.foreColor;
2183 item->window.flags |= WINDOW_FORECOLORSET;
2184 }
2185 else if (Q_stricmp(name, "bordercolor") == 0)
2186 {
2187 out = &item->window.borderColor;
2188 }
2189
2190 if (out)
2191 {
2192 for (i = 0; i < 4; i++)
2193 {
2194// if (!Float_Parse(args, &f))
2195 if (COM_ParseFloat( args, &f))
2196 {
2197 return qtrue;
2198 }
2199 (*out)[i] = f;
2200 }
2201 }
2202 }
2203
2204 return qtrue;
2205}
2206
2207/*
2208=================

Callers

nothing calls this directly

Calls 3

Q_stricmpFunction · 0.85
String_ParseFunction · 0.70
COM_ParseFloatFunction · 0.50

Tested by

no test coverage detected