Subversion Repositories eduke32

Rev

Rev 7806 | Rev 8488 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7806 Rev 8315
Line 90... Line 90...
90
90
91
    uint32_t const col = r | (g<<8) | (b<<16);
91
    uint32_t const col = r | (g<<8) | (b<<16);
92
92
93
    int mindist = -1;
93
    int mindist = -1;
94
94
95
    int const k = (numclosestcolresults > COLRESULTSIZ) ? (COLRESULTSIZ-4) : (numclosestcolresults-4);
95
    int const k = (numclosestcolresults > COLRESULTSIZ) ? COLRESULTSIZ : numclosestcolresults;
96
96
97
    if (!numclosestcolresults) goto skip;
97
    if (!numclosestcolresults) goto skip;
98
98
99
    if (col == (getclosestcol_results[(numclosestcolresults-1) & (COLRESULTSIZ-1)] & 0x00ffffff))
99
    if (col == (getclosestcol_results[(numclosestcolresults-1) & (COLRESULTSIZ-1)] & 0x00ffffff))
100
        return getclosestcol_results[(numclosestcolresults-1) & (COLRESULTSIZ-1)]>>24;
100
        return getclosestcol_results[(numclosestcolresults-1) & (COLRESULTSIZ-1)]>>24;
101
101
102
    int i;
102
    int i;
103
103
104
    for (i = 0; i < k+4; i+=4)
104
    for (i = 0; i <= k-4; i+=4)
105
    {
105
    {
106
        if (col == (getclosestcol_results[i]   & 0x00ffffff)) { mindist = i; break; }
106
        if (col == (getclosestcol_results[i]   & 0x00ffffff)) { mindist = i; break; }
107
        if (col == (getclosestcol_results[i+1] & 0x00ffffff)) { mindist = i+1; break; }
107
        if (col == (getclosestcol_results[i+1] & 0x00ffffff)) { mindist = i+1; break; }
108
        if (col == (getclosestcol_results[i+2] & 0x00ffffff)) { mindist = i+2; break; }
108
        if (col == (getclosestcol_results[i+2] & 0x00ffffff)) { mindist = i+2; break; }
109
        if (col == (getclosestcol_results[i+3] & 0x00ffffff)) { mindist = i+3; break; }
109
        if (col == (getclosestcol_results[i+3] & 0x00ffffff)) { mindist = i+3; break; }