# HG changeset patch # User nenolod # Date 1162446743 28800 # Node ID 37b53a5a9aa43f39a23179a2f0807885fa7ababc # Parent 6048abdac7d121c4cf658b0034ac23d734fd29fb [svn] - allow waves to be drawn with a custom value instead of just 255 diff -r 6048abdac7d1 -r 37b53a5a9aa4 ChangeLog --- a/ChangeLog Wed Nov 01 20:50:58 2006 -0800 +++ b/ChangeLog Wed Nov 01 21:52:23 2006 -0800 @@ -1,3 +1,15 @@ +2006-11-02 04:50:58 +0000 William Pitcock + revision [364] + - add value replace filter, replaces a range of values with a different value + - add preset which demonstrates how this can be abused + + trunk/src/paranormal/builtins.c | 2 + trunk/src/paranormal/general.c | 38 +++++++++++ + trunk/src/paranormal/presets/Makefile | 3 + trunk/src/paranormal/presets/nenolod_-_value_replace_fun.pnv | 31 ++++++++ + 4 files changed, 73 insertions(+), 1 deletion(-) + + 2006-11-01 21:19:36 +0000 William Pitcock revision [362] - add value invert filter diff -r 6048abdac7d1 -r 37b53a5a9aa4 src/paranormal/wave.c --- a/src/paranormal/wave.c Wed Nov 01 20:50:58 2006 -0800 +++ b/src/paranormal/wave.c Wed Nov 01 21:52:23 2006 -0800 @@ -11,6 +11,7 @@ { {"channels", "Which sound channels to use: negative = channel 1, \npositive = channel 2, " "zero = both (two wave-forms.)", OPT_TYPE_INT, {ival: -1} }, + {"value", "The colour value to use.", OPT_TYPE_INT, {ival: 255} }, { 0 } }; @@ -20,6 +21,7 @@ { int i; int channel = ( opts[0].val.ival < 0 ) ? 0 : 1; + guchar value = (opts[1].val.ival < 0 || opts[1].val.ival > 255) ? 255 : opts[1].val.ival; for (i=0; iwidth; i++) { @@ -29,7 +31,7 @@ - CAP (pn_sound_data->pcm_data[channel] [i*512/pn_image_data->width]>>8, (pn_image_data->height>>1)-1))] - = 0xff; + = value; } /*both channels, at 1/4 and 3/4 of the screen*/ @@ -38,13 +40,13 @@ CAP( (pn_sound_data->pcm_data[0] [i*512/pn_image_data->width]>>9), (pn_image_data->height>>2)-1))] - = 0xff; + = value; pn_image_data->surface[0][PN_IMG_INDEX( i, 3*(pn_image_data->height>>2) - CAP( (pn_sound_data->pcm_data[1] [i*512/pn_image_data->width]>>9), (pn_image_data->height>>2)-1))] - = 0xff; + = value; } } } @@ -63,6 +65,7 @@ { {"channels", "Which sound channels to use: negative = channel 1, \npositive = channel 2, " "zero = both (two wave-forms.)", OPT_TYPE_INT, {ival: -1} }, + {"value", "The colour value to use.", OPT_TYPE_INT, {ival: 255} }, { 0 } }; @@ -72,6 +75,7 @@ { int i; int channel = ( opts[0].val.ival < 0 ) ? 0 : 1; + guchar value = (opts[1].val.ival < 0 || opts[1].val.ival > 255) ? 255 : opts[1].val.ival; for (i=0; iheight; i++) { if ( opts[0].val.ival ) { @@ -79,20 +83,20 @@ - CAP (pn_sound_data->pcm_data[channel] [i*512/pn_image_data->height]>>8, (pn_image_data->width>>1)-1), i)] - = 0xff; + = value; } else { pn_image_data->surface[0][PN_IMG_INDEX ((pn_image_data->width>>2) - CAP (pn_sound_data->pcm_data[0] [i*512/pn_image_data->height]>>9, (pn_image_data->width>>2)-1), i)] - = 0xff; + = value; pn_image_data->surface[0][PN_IMG_INDEX ((3*pn_image_data->width>>2) -CAP (pn_sound_data->pcm_data[1] [i*512/pn_image_data->height]>>9, (pn_image_data->width>>2)-1), i)] - = 0xff; + = value; } } } @@ -216,6 +220,7 @@ { { "base_radius", " ", OPT_TYPE_FLOAT, { fval: 0 } }, + {"value", "The colour value to use.", OPT_TYPE_INT, {ival: 255} }, { 0 } }; @@ -224,6 +229,7 @@ gpointer data) { int i, x, y; + guchar value = (opts[1].val.ival < 0 || opts[1].val.ival > 255) ? 255 : opts[1].val.ival; for(i=0; i<360; i++) { @@ -236,7 +242,7 @@ pn_image_data->surface[0][PN_IMG_INDEX (CAPHILO(x,pn_image_data->width,0), CAPHILO(y,pn_image_data->height,0))] - = 0xff; + = value; } };