From 875fdd1d9c8e82f2ae63543e22b009fb9603c888 Mon Sep 17 00:00:00 2001 From: Tom Gilbert Date: Mon, 1 Nov 1999 13:35:33 +0000 Subject: [PATCH] Sun Nov 1 22:06:12 GMT 1999 (gilbertt) Nothing spectacular: Fixed some issues with a couple of cloak-anims Added SineWave. Unless I'm feeling wacky sometime, that just about does it for cloak-anims. Enough is enough ;-) Next step is to change most of them from global arrays to mallocs, to reduce memory consumption somewhat (currently around 270Kb non-shared on my box) SVN revision: 1096 --- ChangeLog | 10 ++ epplets/E-ScreenShoot.c | 8 ++ epplets/cloak.c | 242 +++++++++++++++++++++------------------- epplets/cloak.h | 1 + 4 files changed, 149 insertions(+), 112 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9426780..90d625c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Sun Nov 1 22:06:12 GMT 1999 +(gilbertt) + +Nothing spectacular: + Fixed some issues with a couple of cloak-anims + Added SineWave. Unless I'm feeling wacky sometime, that just about + does it for cloak-anims. Enough is enough ;-) + +------------------------------------------------------------------------------- + Sun Oct 31 21:36:50 GMT 1999 (gilbertt) diff --git a/epplets/E-ScreenShoot.c b/epplets/E-ScreenShoot.c index 622f80f..bc576e0 100644 --- a/epplets/E-ScreenShoot.c +++ b/epplets/E-ScreenShoot.c @@ -201,6 +201,12 @@ cloak_draw (void *data) Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER"); break; } + case 14: + { + draw_sine (); + Epplet_timer (cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER"); + break; + } default: { blank_buf (); @@ -434,6 +440,8 @@ create_epplet_layout (void) (void *) (&(cloak_anims[12]))); Epplet_add_popup_entry (p, "Banner", NULL, cb_cloak_anim, (void *) (&(cloak_anims[13]))); + Epplet_add_popup_entry (p, "SineWave", NULL, cb_cloak_anim, + (void *) (&(cloak_anims[14]))); col_p = Epplet_create_popup (); Epplet_add_popup_entry (col_p, "Flame Colors", NULL, NULL, NULL); diff --git a/epplets/cloak.c b/epplets/cloak.c index 525111d..cb1eb20 100644 --- a/epplets/cloak.c +++ b/epplets/cloak.c @@ -28,7 +28,7 @@ static void fade_buf (int percent); static void scroll_buf (void); /* Raster's flame colors */ -/* Look, even US spelling ;-) */ +/* Look, even US spelling of colours ;-) */ int colors[] = { 120, 0, 169, 217, 152, 249, @@ -175,6 +175,30 @@ fade_buf (int percentage) } } +/* Scrolls buf along one to the left */ +static void +scroll_buf (void) +{ + int x, y; + unsigned char *rgb, *rptr; + + for (y = 0; y < 40; y++) + { + rgb = Epplet_get_rgb_pointer (buf); + rptr = rgb + (y * 40 * 3); + for (x = 0; x < 39; x++) + { + rptr[0] = rptr[3]; + rptr[1] = rptr[4]; + rptr[2] = rptr[5]; + rptr += 3; + } + rptr[0] = 0; + rptr[1] = 0; + rptr[2] = 0; + } +} + /* RasterFire :) */ void draw_flame (void) @@ -260,7 +284,6 @@ void draw_radar (void) { int i; - char *ptr; unsigned int tempX = 0; unsigned int tempY = 0; static int setup = 0; @@ -286,13 +309,8 @@ draw_radar (void) tempX = 19 + radar_r[i] * cos (radar_x[i]) / 3; tempY = 19 + radar_r[i] * sin (radar_x[i]) / 3; - ptr = - (buf)->im->rgb_data + ((buf)->im->rgb_width * 3 * (tempY)) + - (3 * tempX); - ptr[0] = (unsigned char) 55; - ptr[1] = (unsigned char) 255; - ptr[2] = (unsigned char) 75; + set_col_pixel (tempX, tempY, 255, 55, 255, 75); } } @@ -788,6 +806,24 @@ draw_atoms (void) aa_pixel (atom_x[i], atom_y[i], 255, 255, 255, 0); } } + +void draw_sine(void) +{ + static double x=0; + static int setup=0; + + if(!setup) + { + blank_buf(); + setup=1; + } + else + scroll_buf(); + + set_col_pixel(39,19+14*sin(x),255,115,255,165); + x+= 0.3; +} + /* ************************* */ /* Utility drawing functions */ /* ************************* */ @@ -1038,43 +1074,40 @@ set_pixel (int x, int y, unsigned char c) return; ptr = (buf)->im->rgb_data + ((buf)->im->rgb_width * 3 * (y)) + (3 * x); - ptr[0] = c; - ptr[1] = c; - ptr[2] = c; + ptr[0] = ptr[1] = ptr[2] = c; } */ -/* 19 x 132 */ -static char enlighten[19][172] = { - "....+@@@@@@@@@@.............+@+..@#.............#@..........................................................................................................................", - "....@$$$$$$$$$$.............@$@..$%.............%$..........&@................................................................&@............................................", - "....@$*@@@@@@@@.............@$@..@#.............%$.........@$@...............................................................@$@............................................", - "....@$%.....................@$@.................%$.........@$@...............................................................@$@............................................", - "....@$%..........+@++=%=#...@$@..@#....&%%#.@#..%$.#%%&...#=$=@....@%%=+....@#.&%%@....@#.&%=+.+=%=+.....#=%%#....#@.#%%&+..#=$=@...........................................", - "....@$%..........@$=$$$$$@..@$@..$%...*$$$$%$%..%$%$$$$-+.%$$$$..+-$$$$$@...$%-$$$$%...$%-$$$-#-$$$-+...%$$$$$%...%$=$$$$-+.%$$$$...........................................", - "....@$*@@@@@@@+..@$$&..&$*..@$@..$%..=$%+.&$$%..%$-#.+%$&.#=$=@..-$&..#*$#..$$%+.#-$+..$$%+.%$$%+.%$=..=$%+.+=$=..%$-#.+%$&.#=$=@...........................................", - "....@$$$$$$$$$@..@$%....*$..@$@..$%..$*....&$%..%$@...+$%..@$@..@$&....+$%..$$....&$@..$$....$-....$%..$*.....*$..%$@...+$%..@$@............................................", - "....@$*@@@@@@@+..@$@....%$..@$@..$%.@$&....+$%..%$.....$%..@$@..=$@@@@@@*-..$%....@$@..$%....$%....$%.#$=@@@@@=$#.%$.....$%..@$@............................................", - "....@$%..........@$@....%$..@$@..$%.@$@.....$%..%$.....$%..@$@..%$$$$$$$$$..$%....@$@..$%....$%....$%.@$$$$$$$$$@.%$.....$%..@$@............................................", - "....@$%..........@$@....%$..@$@..$%.@$@.....$%..%$.....$%..@$@..%$@@@@@@@@..$%....@$@..$%....$%....$%.@$=@@@@@@@+.%$.....$%..@$@............................................", - "....@$%..........@$@....%$..@$@..$%.+$=....@$%..%$.....$%..@$@..=$#.....#...$%....@$@..$%....$%....$%.#$=.....++..%$.....$%..@$@............................................", - "....@$%..........@$@....%$..@$@..$%..*$@..+-$%..%$.....$%..@$@..#$*....+$*..$%....@$@..$%....$%....$%..-$+....*$+.%$.....$%..@$@............................................", - "....@$-%%%%%%%%#.@$@....%$..@$@..$%..+$$*%$$$%..%$.....$%..@$%@..%$-&@=-$#..$%....@$@..$%....$%....$%..@$$=@&*$=..%$.....$%..@$%@...........................................", - "....@$$$$$$$$$$@.@$@....%$..@$@..$%...+%$$*+$%..%$.....$%...-$$#..=$$$$-@...$%....@$@..$%....$%....$%...@-$$$$=...%$.....$%...-$$#..........................................", - ".....................................@.....+$=...............@@+....@@#...................................#@@..................@@+..........................................", - ".....................................$-....%$@..............................................................................................................................", - ".....................................=$-%%-$%...............................................................................................................................", - "......................................&*$$-=................................................................................................................................" -}; - - /* Do *not* flame me for doing it this way... */ /* I know !!! */ /* ;-) */ void draw_text (void) { +/* 19 x 132 */ + char enlighten[19][172] = { + "....+@@@@@@@@@@.............+@+..@#.............#@..................................................................................", + "....@$$$$$$$$$$.............@$@..$%.............%$..........&@................................................................&@....", + "....@$*@@@@@@@@.............@$@..@#.............%$.........@$@...............................................................@$@....", + "....@$%.....................@$@.................%$.........@$@...............................................................@$@....", + "....@$%..........+@++=%=#...@$@..@#....&%%#.@#..%$.#%%&...#=$=@....@%%=+....@#.&%%@....@#.&%=+.+=%=+.....#=%%#....#@.#%%&+..#=$=@...", + "....@$%..........@$=$$$$$@..@$@..$%...*$$$$%$%..%$%$$$$-+.%$$$$..+-$$$$$@...$%-$$$$%...$%-$$$-#-$$$-+...%$$$$$%...%$=$$$$-+.%$$$$...", + "....@$*@@@@@@@+..@$$&..&$*..@$@..$%..=$%+.&$$%..%$-#.+%$&.#=$=@..-$&..#*$#..$$%+.#-$+..$$%+.%$$%+.%$=..=$%+.+=$=..%$-#.+%$&.#=$=@...", + "....@$$$$$$$$$@..@$%....*$..@$@..$%..$*....&$%..%$@...+$%..@$@..@$&....+$%..$$....&$@..$$....$-....$%..$*.....*$..%$@...+$%..@$@....", + "....@$*@@@@@@@+..@$@....%$..@$@..$%.@$&....+$%..%$.....$%..@$@..=$@@@@@@*-..$%....@$@..$%....$%....$%.#$=@@@@@=$#.%$.....$%..@$@....", + "....@$%..........@$@....%$..@$@..$%.@$@.....$%..%$.....$%..@$@..%$$$$$$$$$..$%....@$@..$%....$%....$%.@$$$$$$$$$@.%$.....$%..@$@....", + "....@$%..........@$@....%$..@$@..$%.@$@.....$%..%$.....$%..@$@..%$@@@@@@@@..$%....@$@..$%....$%....$%.@$=@@@@@@@+.%$.....$%..@$@....", + "....@$%..........@$@....%$..@$@..$%.+$=....@$%..%$.....$%..@$@..=$#.....#...$%....@$@..$%....$%....$%.#$=.....++..%$.....$%..@$@....", + "....@$%..........@$@....%$..@$@..$%..*$@..+-$%..%$.....$%..@$@..#$*....+$*..$%....@$@..$%....$%....$%..-$+....*$+.%$.....$%..@$@....", + "....@$-%%%%%%%%#.@$@....%$..@$@..$%..+$$*%$$$%..%$.....$%..@$%@..%$-&@=-$#..$%....@$@..$%....$%....$%..@$$=@&*$=..%$.....$%..@$%@...", + "....@$$$$$$$$$$@.@$@....%$..@$@..$%...+%$$*+$%..%$.....$%...-$$#..=$$$$-@...$%....@$@..$%....$%....$%...@-$$$$=...%$.....$%...-$$#..", + ".....................................@.....+$=...............@@+....@@#...................................#@@..................@@+..", + ".....................................$-....%$@......................................................................................", + ".....................................=$-%%-$%.......................................................................................", + "......................................&*$$-=........................................................................................" + }; + static int setup = 0; static int i = 0, j = 0, y = 0; unsigned char b = 0; @@ -1090,62 +1123,71 @@ draw_text (void) scroll_buf (); } - for (i = y; i < (y + 19); i++) + if (j > 132) { - switch (enlighten[i - y][j]) + /* Do nothing this time */ + ; + } + else + { + + for (i = y; i < (y + 19); i++) { - case '.': - { - b = 0; - break; - } - case '@': - { - b = 85; - break; - } - case '$': - { - b = 255; - break; - } - case '-': - { - b = 224; - break; - } - case '=': - { - b = 141; - break; - } - case '#': - { - b = 56; - break; - } - case '+': - { - b = 28; - break; - } - case '*': - { - b = 98; - break; - } - case '%': - { - b = 70; - break; - } - case '&': - { - b = 113; - break; - } + switch (enlighten[i - y][j]) + { + case '.': + { + b = 0; + break; + } + case '@': + { + b = 85; + break; + } + case '$': + { + b = 255; + break; + } + case '-': + { + b = 224; + break; + } + case '=': + { + b = 141; + break; + } + case '#': + { + b = 56; + break; + } + case '+': + { + b = 28; + break; + } + case '*': + { + b = 98; + break; + } + case '%': + { + b = 70; + break; + } + case '&': + { + b = 113; + break; + } + } + set_col_pixel (39, i, b, 136, 221, 221); } - set_col_pixel (39, i, b, 136, 221, 221); } ++j; @@ -1155,27 +1197,3 @@ draw_text (void) y = (rand () % 14) + 4; } } - -/* Scrolls buf along one */ -static void -scroll_buf (void) -{ - int x, y; - unsigned char *rgb, *rptr; - - for (y = 0; y < 40; y++) - { - rgb = Epplet_get_rgb_pointer (buf); - rptr = rgb + (y * 40 * 3); - for (x = 0; x < 39; x++) - { - rptr[0] = rptr[3]; - rptr[1] = rptr[4]; - rptr[2] = rptr[5]; - rptr += 3; - } - rptr[0] = 0; - rptr[1] = 0; - rptr[2] = 0; - } -} diff --git a/epplets/cloak.h b/epplets/cloak.h index a0e475f..270c310 100644 --- a/epplets/cloak.h +++ b/epplets/cloak.h @@ -20,3 +20,4 @@ void draw_colorwarp (void); void draw_ball(void); void draw_atoms(void); void draw_text(void); +void draw_sine(void);