[Bug 3318] renew Q_IsColorString()

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Sun Aug 19 14:04:18 EDT 2007


http://bugzilla.icculus.org/show_bug.cgi?id=3318





------- Comment #1 from devhc97 at gmail.com  2007-08-19 14:04 EDT -------
Or even better, only use ^A to ^Z !!!

Allow new colors: all RGB color combinations of 0, 128 and 255, such as
RGB(0,255,128), RGB(128,128,255), etc., which makes a total of 27 colors. The
english alphabet has only 26 characters, leaving out the one annoying color:
black. All other colors can be easily read on black background.

#define Q_IsColorString(p) ( *(p) == Q_COLOR_ESCAPE && isalpha( *((p)+1) ) )

void Index2Color( char index, vec4_t color ) {
        int num, tmp;
        int col[3];

        color[3] = 1.0f;

        if( !isalpha( index ) ) {
                color[0] = 1.0f;
                color[1] = 1.0f;
                color[2] = 1.0f;
                return;
        }

        num = ( tolower( index ) - 'a' ) % 26 + 1;

        tmp = num / 3;
        col[2] = num - tmp * 3;
        num = tmp;
        tmp = num / 3;
        col[1] = num - tmp * 3;
        num = tmp;
        tmp = num / 3;
        col[0] = num - tmp * 3;

        color[0] = col[0] / 2.0f;
        color[1] = col[1] / 2.0f;
        color[2] = col[2] / 2.0f;
}


-- 
Configure bugmail: http://bugzilla.icculus.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.



More information about the quake3-bugzilla mailing list