Game Development Community

Is it just me or did something get lost along the way? ColorUser2-ColorUser5

by John "Mythic" Henry · in Torque 3D Professional · 03/16/2014 (12:58 pm) · 6 replies

guiTypes.h

enum {
      BaseColor = 0,
      ColorHL,
      ColorNA,
      ColorSEL,
      ColorUser0,
      ColorUser1,
      ColorUser2,
      ColorUser3,
      ColorUser4,
      ColorUser5,
   };
   ColorI  mFontColors[10];                        ///< Array of font colors used for drawText with escape characters for changing color mid-string
   ColorI& mFontColor;                             ///< Main font color

But at no place except in initialization is it used again:
ColorUser2 -> ColorUser5
Which are supposed to be reserved for Smurf Name coloring...

aka: gameProfiles.cs
GuiControlProfile ("ChatHudMessageProfile")

// WARNING! Colors 6-9 are reserved for name coloring
....
But for the life of me I seem to be unable to locate the place they are assigned...

#1
03/16/2014 (2:48 pm)
I did alot of digging down into the actual use of those colors
I was working on the chat system MessageVector...
I haven't found where it is checking and using the codes for \c6-\c9
but it is definetly using them and NOT working according to setting
fontColors[6] = "66 81 216";  
   fontColors[7] = "63 238 69";  
   fontColors[8] = "238 63 63";  
   fontColors[9] = "238 63 63";
in a gui profile..

It takes the settings in a message where it sends it through the draw
code, but loses the settings on the second message. SO if I do set
those they only work on the first message then switch to basic colors.

Those are wasted options that I would like to make use of for my own
work, I'm just having a little trouble finding the control over the
\c6 <-> \c9 control codes. It appears to be buried somewhere in the
actual draw code.
#2
03/16/2014 (3:16 pm)
My bad lol...

Gui Control:
maxColorIndex = "9";
was defaulted to 5

I still need to dig in where it matches \c to fontcolor[x] at some point
#3
03/16/2014 (7:29 pm)
It's implemented in Engine/source/gfx/gfxDrawUtil.cpp within this function:
U32 GFXDrawUtil::drawTextN( GFont *font, const Point2I &ptDraw, const UTF16 *in_string, 
                           U32 n, const ColorI *colorTable, const U32 maxColorIndex, F32 rot )
#4
03/17/2014 (12:46 am)
yep, I'd finally found my way there and worked it out. Thanks tho
static U8 remap[15] =
               {
                  0x0, // 0 special null terminator
                  0x0, // 1 ascii start-of-heading??
                  0x1,
                  0x2,
                  0x3,
                  0x4,
                  0x5,
                  0x6,
                  0x0, // 8 special backspace
                  0x0, // 9 special tab
                  0x0, // a special \n
                  0x7,
                  0x8,
                  0x0, // a special \r
                  0x9
               };

Altho that is just where the [ \cx ] is used, the actually assignment
for ColorUser[2-5] is still nowhere to be found.
#5
03/28/2014 (10:05 am)
Found where the colors are being initialized. It's apart of the GuiControlProfile class constructor in Engine/source/gui/core/guiTypes.cpp:
for(U32 i = 0; i < 10; i++)
      mFontColors[i].set(255,0,255,255);
#6
03/28/2014 (11:38 am)
yep, thats initialization, that one is easy.. The tough one is
are they EVER modified again? As far as I can see, they are not.
A bit of UI feature that never got used.