void Effects_TV_Init(void) { int i; tv_effect.start_line = SMS_RES_Y / 2; for (i = 0; i != TV_EFFECT_COLORS_MAX; i++) tv_effect.colors[i] = makecol16(i * 16, i * 16, i * 16); }
/* makeacol_depth: * Converts R, G, B, and A values (ranging 0-255) to whatever pixel format * is required by the specified color depth. */ int makeacol_depth(int color_depth, int r, int g, int b, int a) { switch (color_depth) { case 8: return makecol8(r, g, b); case 15: return makecol15(r, g, b); case 16: return makecol16(r, g, b); case 24: return makecol24(r, g, b); case 32: return makeacol32(r, g, b, a); } return 0; }
void render_plasma(int time) { int pcolor,ptmpr,ptmpg,ptmpb; float pval; //float PT = ((float) time); for (int y = 0; y < SCREEN_H; y++) { short *line = ((short*)buffer->line[y]); //float PY = (((float)y / SCREEN_H ) *AL_PI); for (int x = 0; x < SCREEN_W; x++) { //float PX = (((float)x / SCREEN_W ) *AL_PI); //really old version //hsv_to_rgb((sin(((float)x/32)+(sin((float)y)/10)+((float)time/10)) * 180)+180, //(cos(time-sqrt((((float)x/2)-(SCREEN_W/2))+(((float)x/5)-(SCREEN_W/2))*(((float)y/10)-(SCREEN_H/2))+(((float)y/9)-(SCREEN_H/2))))*0.5f)+0.5f, //(sin(time+sqrt((((float)x/6)-(SCREEN_W/2))+(((float)x/6)-(SCREEN_W/2))*(((float)y/6)-(SCREEN_H/2))+(((float)y/6)-(SCREEN_H/2))))*0.5f)+0.5f, //&ptmp[0],&ptmp[1],&ptmp[2]); //not so old version //pval = (( //sinf(PX*10+PT) + //sinf(10 * (PX*sinf(PT/2)+PY*cosf(PT/33))+time) + //sinf(sqrtf(100*(powf(PX +0.5f*sinf(PT / 5),2) + powf(PY +0.5f*sinf(PT / 3),2))+1)+time) //)); //ptmpr = (int)(sinf(pval*AL_PI)*255) & 0xFF; //ptmpg = (int)(cosf(pval*AL_PI)*255) & 0xFF; //ptmpb = 0; //pcolor = makecol16(ptmpr,ptmpg,ptmpb); //line[x] = pcolor; float value = sinf(dist(x + time, y, 400, 300) / 8.0) + sinf(dist(x, y, 200, 150) / 8.0) + sinf(dist(x, y + time / 7, 600, 150) / 7.0) + sinf(dist(x, y, 600, 200) / 8.0); int color = (4 + value) * 32; pcolor = makecol16(color, color * 2, 255 - color); line[x] = pcolor; } } }
int convert_color_to_allegro<IndexedTraits, 16>(color_t color, const Palette* palette) { color_t c = palette->getEntry(color); return makecol16(rgba_getr(c), rgba_getg(c), rgba_getb(c)); }
int convert_color_to_allegro<GrayscaleTraits, 16>(color_t c, const Palette* palette) { return makecol16(graya_getv(c), graya_getv(c), graya_getv(c)); }
int convert_color_to_allegro<RgbTraits, 16>(color_t c, const Palette* palette) { return makecol16(rgba_getr(c), rgba_getg(c), rgba_getb(c)); }