Big fairies + additive blending

This commit is contained in:
laochailan 2012-04-04 17:19:53 +02:00
parent bc5cc48230
commit 6555180fb9
11 changed files with 2172 additions and 34 deletions

BIN
gfx/ani_2_2_15_bigfairy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

2030
gfx/bigfairy.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

BIN
gfx/part/boss_shadow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -10,13 +10,13 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="142.0984"
height="194.25841"
width="85.901924"
height="124.20792"
id="svg2"
version="1.1"
inkscape:version="0.48.2 r9819"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="boss_shadow.svg"
inkscape:export-filename="/home/laochailan/src/taisei/gfx/boss_shadow.png"
inkscape:export-filename="/home/laochailan/src/taisei/gfx/part/boss_shadow.png"
inkscape:export-xdpi="63.336391"
inkscape:export-ydpi="63.336391">
<defs
@ -49,28 +49,52 @@
gradientUnits="userSpaceOnUse" />
<filter
inkscape:collect="always"
id="filter3771"
x="-0.21404542"
width="1.4280908"
y="-0.19566779"
height="1.3913356"
id="filter3875"
x="-0.12116958"
width="1.2423393"
y="-0.07761886"
height="1.1552377"
color-interpolation-filters="sRGB">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="8.1532399"
id="feGaussianBlur3773" />
stdDeviation="4.693446"
id="feGaussianBlur3877" />
</filter>
<filter
inkscape:collect="always"
id="filter3879"
x="-0.10204622"
width="1.2040924"
y="-0.082100816"
height="1.1642016"
color-interpolation-filters="sRGB">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="3.8011579"
id="feGaussianBlur3881" />
</filter>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3755"
id="radialGradient3904"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1,0,0,1.2429379,0,-37.739609)"
cx="281.58002"
cy="155.34673"
fx="281.58002"
fy="155.34673"
r="44.699249" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
pagecolor="#575757"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="1.979899"
inkscape:cx="40.235115"
inkscape:cy="98.15668"
inkscape:zoom="2.8"
inkscape:cx="-54.278924"
inkscape:cy="81.683214"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
@ -79,7 +103,7 @@
fit-margin-right="5"
fit-margin-bottom="5"
inkscape:window-width="1920"
inkscape:window-height="1038"
inkscape:window-height="1061"
inkscape:window-x="0"
inkscape:window-y="-1"
inkscape:window-maximized="1" />
@ -91,7 +115,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@ -99,22 +123,28 @@
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-216.32577,-52.9972)">
transform="translate(-243.16124,-107.88892)">
<path
style="opacity:0.31203009;fill:#ffffff;stroke:none;filter:url(#filter3771)"
d="m 306.07622,77.564976 c 6.84137,34.491504 33.23485,67.100274 26.76904,100.005094 -14.4197,73.38251 -86.54842,45.31614 -91.4188,0 -4.11926,-38.32737 16.79182,-66.33334 23.23351,-99.500018 18.38995,30.041138 27.72185,15.873402 41.41625,-0.505076 z"
style="opacity:0.31203009;fill:#ffffff;stroke:none;filter:url(#filter3875)"
d="m 298.57622,78.636405 c 8.98423,29.134365 26.80628,64.243135 20.34047,97.147955 -14.4197,73.38251 -62.97699,46.38756 -67.84737,1.07142 -4.11926,-38.32737 15.0061,-62.40476 25.01922,-97.714299 -6.03582,75.972449 -12.9941,100.083289 8.83573,100.780509 28.12712,0.89835 6.05819,-53.63575 13.65195,-101.285585 z"
id="path3765"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csscc" />
sodipodi:nodetypes="csscsc"
transform="matrix(0.62229821,0,0,0.69115418,108.50959,66.324384)"
inkscape:export-filename="/home/laochailan/src/taisei/gfx/part/path2985.png"
inkscape:export-xdpi="63"
inkscape:export-ydpi="63" />
<path
sodipodi:type="arc"
style="opacity:0.63533834;fill:url(#radialGradient3761);fill-opacity:1;stroke:none"
style="opacity:0.63533834;fill:url(#radialGradient3761);fill-opacity:1;stroke:none;filter:url(#filter3879)"
id="path2985"
sodipodi:cx="281.58002"
sodipodi:cy="155.34673"
sodipodi:rx="44.699249"
sodipodi:ry="55.558392"
d="m 326.27927,155.34673 c 0,30.68405 -20.01254,55.55839 -44.69925,55.55839 -24.68672,0 -44.69925,-24.87434 -44.69925,-55.55839 0,-30.68406 20.01253,-55.558396 44.69925,-55.558396 24.68671,0 44.69925,24.874336 44.69925,55.558396 z"
transform="matrix(0.79661018,0,0,0.77727273,62.321273,53.540312)" />
d="m 326.27927,155.34673 a 44.699249,55.558392 0 1 1 -89.3985,0 44.699249,55.558392 0 1 1 89.3985,0 z"
transform="matrix(0.40712568,0,0,0.3254824,174.02914,153.72447)"
inkscape:export-xdpi="63"
inkscape:export-ydpi="63" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -61,7 +61,7 @@ if(WIN32)
set(SRCs ${SRCs} taisei_err.c)
endif()
add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")
add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}" -Wall)
set(LIBs ${LIBs}
${SDL_LIBRARY}

View file

@ -69,6 +69,72 @@ void draw_enemies(Enemy *enemies) {
e->draw_rule(e, global.frames - e->birthtime);
}
int enemy_flare(Projectile *p, int t) { // a[0] timeout, a[1] velocity, a[2] ref to enemy
if(t >= creal(p->args[0]) || REF(p->args[2]) == NULL) {
return ACTION_DESTROY;
} if(t == EVENT_DEATH) {
free_ref(p->args[2]);
return 1;
} else if(t < 0) {
return 1;
}
p->pos += p->args[1];
return 1;
}
void EnemyFlareShrink(Projectile *p, int t) {
Enemy *e = (Enemy *)REF(p->args[2]);
if(e == NULL)
return;
glPushMatrix();
float s = 2.0-t/p->args[0]*2;
glTranslatef(creal(e->pos + p->pos), cimag(e->pos + p->pos), 0);
glRotatef(p->angle*180/M_PI+90, 0, 0, 1);
glScalef(s, s, 1);
if(p->clr)
glColor4fv((float *)p->clr);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
draw_texture_p(0, 0, p->tex);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPopMatrix();
glColor3f(1,1,1);
}
void BigFairy(Enemy *e, int t) {
if(!(t % 5)) {
complex offset = (frand()-0.5)*30 + (frand()-0.5)*20I;
create_particle3c("lasercurve", offset, rgb(0,0.2,0.3), EnemyFlareShrink, enemy_flare, 50, (-50I-offset)/50.0, add_ref(e));
}
glPushMatrix();
glTranslatef(creal(e->pos), cimag(e->pos), 0);
float s = sin((float)(global.frames-e->birthtime)/10.f)/6 + 0.8;
glPushMatrix();
glRotatef(global.frames*10,0,0,1);
glScalef(s, s, s);
draw_texture(0,0,"fairy_circle");
glPopMatrix();
if(e->dir) {
glCullFace(GL_FRONT);
glScalef(-1,1,1);
}
draw_animation(0, 0, e->moving, "bigfairy");
glPopMatrix();
glCullFace(GL_BACK);
}
void Fairy(Enemy *e, int t) {
glEnable(GL_TEXTURE_2D);
@ -82,7 +148,6 @@ void Fairy(Enemy *e, int t) {
draw_texture(0,0,"fairy_circle");
glPopMatrix();
glColor4f(1,1,1,1);
glPushMatrix();
if(e->dir) {
glCullFace(GL_FRONT);

View file

@ -59,4 +59,9 @@ void process_enemies(Enemy **enemies);
void Fairy(Enemy*, int t);
void Swirl(Enemy*, int t);
void BigFairy(Enemy*, int t);
int enemy_flare(Projectile *p, int t);
void EnemyFlareShrink(Projectile *p, int t);
#endif

View file

@ -337,7 +337,10 @@ void Petal(Projectile *p, int t) {
if(p->clr)
glColor4fv((float *)p->clr);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
draw_texture_p(0,0, p->tex);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if(p->clr)
glColor4f(1,1,1,1);
glPopMatrix();
@ -348,6 +351,6 @@ void Petal(Projectile *p, int t) {
void petal_explosion(int n, complex pos) {
int i;
for(i = 0; i < n; i++) {
create_particle4c("petal", pos, rgb(1,1,1), Petal, linear, (3+13*frand())*cexp(I*M_PI*2*frand()), 0, frand() + frand()*I, frand() + 360I*frand());
create_particle4c("petal", pos, rgba(0.6,1-frand()*0.4,0.5,1-0.5*frand()), Petal, asymptotic, (3+5*frand())*cexp(I*M_PI*2*frand()), 5, frand() + frand()*I, frand() + 360I*frand());
}
}

View file

@ -149,8 +149,12 @@ void stage_draw(StageRule bgdraw, ShaderRule *shaderrules, int time) {
glPushMatrix();
glTranslatef(creal(global.boss->pos), cimag(global.boss->pos), 0);
glColor3f(0.2,0.35,0.6);
draw_texture(0,0,"boss_shadow");
if(!(global.frames % 5)) {
complex offset = (frand()-0.5)*50 + (frand()-0.5)*20I;
create_particle3c("boss_shadow", -20I, rgba(0.2,0.35,0.5,0.5), EnemyFlareShrink, enemy_flare, 50, (-100I-offset)/(50.0+frand()*10), add_ref(global.boss));
}
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glColor3f(1,1,1);
glRotatef(global.frames*4.0, 0, 0, -1);
@ -158,6 +162,7 @@ void stage_draw(StageRule bgdraw, ShaderRule *shaderrules, int time) {
glScalef(f,f,f);
draw_texture(0,0,"boss_circle");
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPopMatrix();
}
@ -167,14 +172,14 @@ void stage_draw(StageRule bgdraw, ShaderRule *shaderrules, int time) {
draw_items();
draw_projectiles(global.projs);
draw_projectiles(global.particles);
draw_enemies(global.enemies);
draw_lasers();
if(global.boss)
draw_boss(global.boss);
draw_projectiles(global.particles);
if(global.dialog)
draw_dialog(global.dialog);

View file

@ -511,7 +511,7 @@ void stage0_events() {
// big fairies, circle + projectile toss
FROM_TO(400, 460, 50)
create_enemy2c(VIEWPORT_W*_i + VIEWPORT_H/3*I, 1500, Fairy, stage0_circletoss, 2-4*_i-0.3I, 1-2*_i);
create_enemy2c(VIEWPORT_W*_i + VIEWPORT_H/3*I, 1500, BigFairy, stage0_circletoss, 2-4*_i-0.3I, 1-2*_i);
// swirl, sine pass
@ -531,7 +531,7 @@ void stage0_events() {
// circle - multi burst combo
FROM_TO(1700, 2300, 300)
create_enemy2c(VIEWPORT_W/2, 1400, Fairy, stage0_circle, VIEWPORT_W/4 + VIEWPORT_W/2*frand()+200I, 3-6*(frand()>0.5)+frand()*2I);
create_enemy2c(VIEWPORT_W/2, 1400, BigFairy, stage0_circle, VIEWPORT_W/4 + VIEWPORT_W/2*frand()+200I, 3-6*(frand()>0.5)+frand()*2I);
FROM_TO(2000, 2500, 200) {
int i, t = global.diff + 1;
@ -558,7 +558,7 @@ void stage0_events() {
create_enemy2c(VIEWPORT_W*_i + VIEWPORT_H/3*I, 1700, Fairy, stage0_circletoss, 2-4*_i-0.3I, 1-2*_i);
AT(4200)
create_enemy2c(VIEWPORT_W/2.0, 1800, Fairy, stage0_tritoss, 2I, -2.6I);
create_enemy2c(VIEWPORT_W/2.0, 1800, BigFairy, stage0_tritoss, 2I, -2.6I);
AT(5000)
global.boss = create_cirno();