| ffcmike |
05-05-2012 12:32 AM |
I think it's somewhat inefficient to be obtaining colour and shadow values via a public function for every time a nick is drawn, especially if they're being re-drawn every frame (in itself an avoidable bad practise).
I just have arrays set to read from directly:
PHP Code:
function onCreated(){
this.apv = {
{64,0,0},
{128,64,64},
{133,62,62},
{138,59,59},
{143,57,57},
{148,54,54},
{153,52,52},
{158,49,49},
{163,47,47},
{168,44,44},
{173,41,41},
{178,39,39},
{183,36,36},
{188,34,34},
{194,31,31},
{199,29,29},
{204,26,26},
{209,24,24},
{214,21,21},
{219,18,18},
{224,16,16},
{229,13,13},
{234,11,11},
{239,8,8},
{244,6,6},
{249,3,3},
{255,0,0},
{255,10,10},
{255,21,21},
{255,31,31},
{255,42,42},
{255,53,53},
{255,63,63},
{255,74,74},
{255,85,85},
{255,95,95},
{255,106,106},
{255,116,116},
{255,127,127},
{255,138,138},
{255,148,148},
{255,159,159},
{255,170,170},
{255,180,180},
{255,191,191},
{255,201,201},
{255,212,212},
{255,223,223},
{255,233,233},
{255,244,244},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{230,255,230},
{205,255,205},
{179,255,179},
{154,255,154},
{128,255,128},
{128,255,128},
{116,255,140},
{103,255,153},
{90,255,166},
{77,255,178},
{64,255,191},
{52,255,204},
{39,255,216},
{26,255,229},
{13,255,242},
{0,247,255},
{0,238,255},
{0,229,255},
{0,220,255},
{0,212,255},
{0,203,255},
{0,194,255},
{0,185,255},
{0,176,255},
{0,168,255},
{0,159,255},
{0,150,255},
{0,141,255},
{0,132,255},
{0,124,255},
{0,115,255},
{0,106,255},
{0,97,255},
{0,88,255},
{0,80,255},
{0,71,255},
{0,62,255},
{0,53,255},
{0,44,255},
{0,36,255},
{0,27,255},
{0,18,255},
{0,9,255},
{0,0,255},
{231,199,0}
};
this.aps = {
{255,255,0},
{255,255,64},
{255,255,62},
{255,255,59},
{255,255,57},
{255,255,54},
{255,255,52},
{255,255,49},
{255,255,47},
{255,255,44},
{255,255,41},
{255,255,39},
{255,255,36},
{255,255,34},
{0,0,31},
{0,0,29},
{0,0,26},
{0,0,24},
{0,0,21},
{0,0,18},
{0,0,16},
{0,0,13},
{0,0,11},
{0,0,8},
{0,0,6},
{0,0,3},
{0,0,0},
{0,0,10},
{0,0,21},
{0,0,31},
{0,0,42},
{0,0,53},
{0,0,63},
{0,0,74},
{0,0,85},
{0,0,95},
{0,0,106},
{0,0,116},
{0,0,127},
{0,0,138},
{0,0,148},
{0,0,159},
{0,0,170},
{0,0,180},
{0,0,191},
{0,0,201},
{0,0,212},
{0,0,223},
{0,0,233},
{0,0,244},
{0,0,255},
{0,0,255},
{0,0,255},
{0,0,255},
{0,0,255},
{0,0,255},
{0,0,230},
{0,0,205},
{0,0,179},
{0,0,154},
{0,0,128},
{0,0,128},
{0,0,140},
{0,0,153},
{0,0,166},
{0,0,178},
{0,0,191},
{0,0,204},
{0,0,216},
{0,0,229},
{0,0,242},
{0,0,255},
{0,0,255},
{0,0,255},
{0,0,255},
{0,0,255},
{0,0,255},
{0,0,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,255},
{255,255,0}
};
}
On pre-wipe Classic it was being calculated by:
PHP Code:
function getAlignmentColor(value) {
if (value<=0) return {64,0,0};
if (value<=26) return {128+int(127*(value-1)/25),64-int(64*(value-1)/25),64-int(64*(value-1)/25)};
if (value<=49) return {255,int(255*(value-26)/24),int(255*(value-26)/24)};
if (value<=55) return {255,255,255};
if (value<=60) return {255-int(127*(value-55)/5),255,255-int(127*(value-55)/5)};
if (value<=70) return {128-int(128*(value-61)/10),255,128+int(127*(value-61)/10)};
if (value<=99) return {0,255-int(255*(value-70)/29),255};
return {231,199,0};
}
function getAlignmentShadow(value) {
temp.c = getAlignmentColor(value);
if (value == 100)
temp.c = {255,255,0};
else
temp.c[0] = temp.c[1] = 255 * !(temp.c[0]>191.25 || temp.c[1]>191.25);
return temp.c;
}
|