From be785e963cdb734f46cc59417481119fa29128e8 Mon Sep 17 00:00:00 2001 From: laochailan Date: Sun, 12 Nov 2017 18:20:39 +0100 Subject: [PATCH] started marisa b bomb --- resources/shader/maristar_bombbg.sha | 29 ++++++++++++++++++++++++++++ src/plrmodes/marisa_a.c | 1 + src/plrmodes/marisa_b.c | 12 +++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 resources/shader/maristar_bombbg.sha diff --git a/resources/shader/maristar_bombbg.sha b/resources/shader/maristar_bombbg.sha new file mode 100644 index 00000000..6c34545c --- /dev/null +++ b/resources/shader/maristar_bombbg.sha @@ -0,0 +1,29 @@ +#version 110 + +varying vec4 texc; + +void main(void) { + gl_Position = ftransform(); + gl_FrontColor = gl_Color; + + texc = gl_TextureMatrix[0] * gl_MultiTexCoord0; +} + +%% -- FRAG +#version 110 + +uniform float t; + +uniform sampler2D tex; +uniform vec2 plrpos; +varying vec4 texc; + +void main(void) { + vec2 r = texc.xy-plrpos; + r = vec2(atan(r.y,r.x)/3.1415*4.,length(r)-2.*t*(1.+t)); + r.x+=(1.+r.y)*t*5.; + vec4 texel = texture2D(tex, r); + texel.a = 0.7*t*(1.-t)*4.; + + gl_FragColor = texel; +} diff --git a/src/plrmodes/marisa_a.c b/src/plrmodes/marisa_a.c index 427cc8d3..3d9c3577 100644 --- a/src/plrmodes/marisa_a.c +++ b/src/plrmodes/marisa_a.c @@ -463,6 +463,7 @@ static void marisa_laser_preload(void) { preload_resources(RES_SHADER, flags, "marisa_laser", + "masterspark", NULL); preload_resources(RES_SFX, flags | RESF_OPTIONAL, diff --git a/src/plrmodes/marisa_b.c b/src/plrmodes/marisa_b.c index 866b50bf..a3dcbdd9 100644 --- a/src/plrmodes/marisa_b.c +++ b/src/plrmodes/marisa_b.c @@ -166,9 +166,14 @@ static void marisa_star_bombbg(Player *plr) { if(t > BOMB_RECOVERY/4*3) fade = 1-t/BOMB_RECOVERY*4 + 3; + Shader *s = get_shader("maristar_bombbg"); + glUseProgram(s->prog); + glUniform1f(uniloc(s,"t"), t/BOMB_RECOVERY); + glUniform2f(uniloc(s,"plrpos"), creal(global.plr.pos)/VIEWPORT_W,cimag(global.plr.pos)/VIEWPORT_H); glColor4f(1,1,1,0.6*fade); - fill_screen(0,-t*0.01,1,"marisa_bombbg"); + fill_screen(0,0,1,"marisa_bombbg"); glColor4f(1,1,1,1); + glUseProgram(0); } static void marisa_star_respawn_slaves(Player *plr, short npow) { @@ -225,6 +230,11 @@ static void marisa_star_preload(void) { "proj/marisa", "proj/maristar", "part/maristar_orbit", + "marisa_bombbg", + NULL); + + preload_resources(RES_SHADER, flags, + "maristar_bombbg", NULL); preload_resources(RES_SFX, flags | RESF_OPTIONAL,