Browse Source

Tower of Truth ~ Theory of Everything

pull/22/merge
laochailan 9 years ago
parent
commit
49fbf4f92a
  1. BIN
      gfx/stage6/baryon_shine.png
  2. BIN
      gfx/stage6/towerwall.png
  3. BIN
      models/towerwall.blend
  4. 197
      models/towerwall.obj
  5. 25
      shader/tower_wall.sha
  6. 78
      src/stages/stage6.c
  7. 1
      src/stages/stage6.h
  8. 107
      src/stages/stage6_events.c

BIN
gfx/stage6/baryon_shine.png

Before

Width: 200  |  Height: 200  |  Size: 24 KiB

BIN
gfx/stage6/towerwall.png

After

Width: 1024  |  Height: 512  |  Size: 185 KiB

BIN
models/towerwall.blend

197
models/towerwall.obj

@ -0,0 +1,197 @@
# Blender v2.63 (sub 17) OBJ File: 'towerwall.blend'
# www.blender.org
v 0.000000 5.000000 -5.000000
v 0.000000 5.000000 5.000000
v 0.975452 4.903926 -5.000000
v 0.975452 4.903926 5.000000
v 1.913417 4.619398 -5.000000
v 1.913417 4.619398 5.000000
v 2.777851 4.157348 -5.000000
v 2.777851 4.157348 5.000000
v 3.535534 3.535534 -5.000000
v 3.535534 3.535534 5.000000
v 4.157348 2.777851 -5.000000
v 4.157348 2.777851 5.000000
v 4.619398 1.913417 -5.000000
v 4.619398 1.913417 5.000000
v 4.903926 0.975452 -5.000000
v 4.903926 0.975452 5.000000
v 5.000000 0.000000 -5.000000
v 5.000000 0.000000 5.000000
v 4.903926 -0.975451 -5.000000
v 4.903926 -0.975451 5.000000
v 4.619398 -1.913416 -5.000000
v 4.619398 -1.913416 5.000000
v 4.157348 -2.777851 -5.000000
v 4.157348 -2.777851 5.000000
v 3.535534 -3.535534 -5.000000
v 3.535534 -3.535534 5.000000
v 2.777851 -4.157348 -5.000000
v 2.777851 -4.157348 5.000000
v 1.913416 -4.619398 -5.000000
v 1.913416 -4.619398 5.000000
v 0.975450 -4.903926 -5.000000
v 0.975450 -4.903926 5.000000
v -0.000002 -5.000000 -5.000000
v -0.000002 -5.000000 5.000000
v -0.975454 -4.903926 -5.000000
v -0.975454 -4.903926 5.000000
v -1.913419 -4.619397 -5.000000
v -1.913419 -4.619397 5.000000
v -2.777853 -4.157347 -5.000000
v -2.777853 -4.157347 5.000000
v -3.535536 -3.535532 -5.000000
v -3.535536 -3.535532 5.000000
v -4.157350 -2.777848 -5.000000
v -4.157350 -2.777848 5.000000
v -4.619399 -1.913413 -5.000000
v -4.619399 -1.913413 5.000000
v -4.903927 -0.975447 -5.000000
v -4.903927 -0.975447 5.000000
v -5.000000 0.000005 -5.000000
v -5.000000 0.000005 5.000000
v -4.903925 0.975457 -5.000000
v -4.903925 0.975457 5.000000
v -4.619395 1.913422 -5.000000
v -4.619395 1.913422 5.000000
v -4.157345 2.777856 -5.000000
v -4.157345 2.777856 5.000000
v -3.535529 3.535539 -5.000000
v -3.535529 3.535539 5.000000
v -2.777846 4.157352 -5.000000
v -2.777846 4.157352 5.000000
v -1.913410 4.619401 -5.000000
v -1.913410 4.619401 5.000000
v -0.975444 4.903928 -5.000000
v -0.975444 4.903928 5.000000
vt 0.621094 0.029297
vt 0.621094 0.962891
vt 0.559570 0.962891
vt 0.559570 0.029297
vt 0.499023 0.962891
vt 0.499023 0.029297
vt 0.437500 0.962891
vt 0.437500 0.029297
vt 0.376953 0.962891
vt 0.376953 0.029297
vt 0.315430 0.962891
vt 0.315430 0.029297
vt 0.254883 0.962891
vt 0.253906 0.029297
vt 0.193359 0.962891
vt 0.193359 0.029297
vt 0.132812 0.962891
vt 0.132812 0.029297
vt 0.071289 0.962891
vt 0.071289 0.029297
vt 0.010742 0.962891
vt 0.009766 0.029297
vt 0.987305 0.029297
vt 0.987305 0.962891
vt 0.925781 0.962891
vt 0.925781 0.029297
vt 0.865234 0.962891
vt 0.865234 0.029297
vt 0.803711 0.962891
vt 0.803711 0.029297
vt 0.743164 0.962891
vt 0.743164 0.029297
vt 0.681641 0.962891
vt 0.681641 0.029297
vn 0.000000 1.000000 0.000000
vn 0.195074 0.980773 0.000000
vn 0.382672 0.923856 0.000000
vn 0.555559 0.831446 0.000000
vn 0.707083 0.707083 0.000000
vn 0.831446 0.555559 0.000000
vn 0.923856 0.382672 0.000000
vn 0.980773 0.195074 0.000000
vn 1.000000 0.000000 0.000000
vn 0.980773 -0.195074 0.000000
vn 0.923856 -0.382672 0.000000
vn 0.831446 -0.555559 0.000000
vn 0.707083 -0.707083 0.000000
vn 0.555559 -0.831446 0.000000
vn 0.382672 -0.923856 0.000000
vn 0.195074 -0.980773 0.000000
vn 0.000000 -1.000000 0.000000
vn -0.195074 -0.980773 0.000000
vn -0.382672 -0.923856 0.000000
vn -0.555559 -0.831446 0.000000
vn -0.707083 -0.707083 0.000000
vn -0.831446 -0.555559 0.000000
vn -0.923856 -0.382672 0.000000
vn -0.980773 -0.195074 0.000000
vn -0.999969 0.000000 0.000000
vn -0.980773 0.195074 0.000000
vn -0.923856 0.382672 0.000000
vn -0.831446 0.555559 0.000000
vn -0.707083 0.707083 0.000000
vn -0.555559 0.831446 0.000000
vn -0.382672 0.923856 0.000000
vn -0.195074 0.980773 0.000000
s 1
f 1/1/1 2/2/1 4/3/2
f 1/1/1 4/3/2 3/4/2
f 3/4/2 4/3/2 6/5/3
f 3/4/2 6/5/3 5/6/3
f 5/6/3 6/5/3 8/7/4
f 5/6/3 8/7/4 7/8/4
f 7/8/4 8/7/4 10/9/5
f 7/8/4 10/9/5 9/10/5
f 9/10/5 10/9/5 12/11/6
f 9/10/5 12/11/6 11/12/6
f 11/12/6 12/11/6 14/13/7
f 11/12/6 14/13/7 13/14/7
f 13/14/7 14/13/7 16/15/8
f 13/14/7 16/15/8 15/16/8
f 15/16/8 16/15/8 18/17/9
f 15/16/8 18/17/9 17/18/9
f 17/18/9 18/17/9 20/19/10
f 17/18/9 20/19/10 19/20/10
f 19/20/10 20/19/10 22/21/11
f 19/20/10 22/21/11 21/22/11
f 21/23/11 22/24/11 24/25/12
f 21/23/11 24/25/12 23/26/12
f 23/26/12 24/25/12 26/27/13
f 23/26/12 26/27/13 25/28/13
f 25/28/13 26/27/13 28/29/14
f 25/28/13 28/29/14 27/30/14
f 27/30/14 28/29/14 30/31/15
f 27/30/14 30/31/15 29/32/15
f 29/32/15 30/31/15 32/33/16
f 29/32/15 32/33/16 31/34/16
f 31/34/16 32/33/16 34/2/17
f 31/34/16 34/2/17 33/1/17
f 33/1/17 34/2/17 36/3/18
f 33/1/17 36/3/18 35/4/18
f 35/4/18 36/3/18 38/5/19
f 35/4/18 38/5/19 37/6/19
f 37/6/19 38/5/19 40/7/20
f 37/6/19 40/7/20 39/8/20
f 39/8/20 40/7/20 42/9/21
f 39/8/20 42/9/21 41/10/21
f 41/10/21 42/9/21 44/11/22
f 41/10/21 44/11/22 43/12/22
f 43/12/22 44/11/22 46/13/23
f 43/12/22 46/13/23 45/14/23
f 45/14/23 46/13/23 48/15/24
f 45/14/23 48/15/24 47/16/24
f 47/16/24 48/15/24 50/17/25
f 47/16/24 50/17/25 49/18/25
f 49/18/25 50/17/25 52/19/26
f 49/18/25 52/19/26 51/20/26
f 51/20/26 52/19/26 54/21/27
f 51/20/26 54/21/27 53/22/27
f 53/23/27 54/24/27 56/25/28
f 53/23/27 56/25/28 55/26/28
f 55/26/28 56/25/28 58/27/29
f 55/26/28 58/27/29 57/28/29
f 57/28/29 58/27/29 60/29/30
f 57/28/29 60/29/30 59/30/30
f 59/30/30 60/29/30 62/31/31
f 59/30/30 62/31/31 61/32/31
f 2/2/1 1/1/1 63/34/32
f 2/2/1 63/34/32 64/33/32
f 61/32/31 62/31/31 64/33/32
f 61/32/31 64/33/32 63/34/32

25
shader/tower_wall.sha

@ -0,0 +1,25 @@
#version 110
varying vec4 TexCoord0;
varying vec4 d;
void main(void) {
d = gl_ModelViewMatrix * gl_Vertex;
gl_Position = gl_ProjectionMatrix * d;
TexCoord0 = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}
%% -- FRAG
#version 110
uniform sampler2D tex;
varying vec4 d;
varying vec4 TexCoord0;
void main(void) {
vec4 texel = texture2D(tex, TexCoord0.xy);
float f = min(1.0, length(d)/3000.0);
gl_FragColor = mix(vec4(1.0), texel, 1.0-f);
}

78
src/stages/stage6.c

@ -14,6 +14,42 @@
#include "global.h"
static Stage3D bgcontext;
static int fall_over;
Vector **stage6_towerwall_pos(Vector pos, float maxrange) {
Vector p = {0, 0, 190};
Vector r = {0, 0, 300};
Vector **list = linear3dpos(pos, maxrange, p, r);
int i;
for(i = 0; list[i] != NULL; i++) {
if((*list[i])[2] > 0)
(*list[i])[1] = -90000;
}
return list;
}
void stage6_towerwall_draw(Vector pos) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, get_tex("stage6/towerwall")->gltex);
if(!tconfig.intval[NO_SHADER])
glUseProgram(get_shader("tower_wall")->prog);
glPushMatrix();
glTranslatef(pos[0], pos[1], pos[2]);
// glRotatef(90, 1,0,0);
glScalef(30,30,30);
draw_model("towerwall");
glPopMatrix();
glUseProgram(0);
glDisable(GL_TEXTURE_2D);
}
Vector **stage6_towertop_pos(Vector pos, float maxrange) {
Vector p = {0, 0, 70};
@ -31,7 +67,7 @@ void stage6_towertop_draw(Vector pos) {
glScalef(28,28,28);
draw_model("towertop");
glPopMatrix();
glDisable(GL_TEXTURE_2D);
}
@ -55,8 +91,36 @@ void stage6_skysphere_draw(Vector pos) {
}
void stage6_draw() {
set_perspective(&bgcontext, 100, 1000);
draw_stage3d(&bgcontext, 30000);
set_perspective(&bgcontext, 100, 9000);
draw_stage3d(&bgcontext, 10000);
if(fall_over) {
int t = global.frames - fall_over;
TIMER(&t);
FROM_TO(0, 240, 1) {
bgcontext.cx[0] += 0.02*cos(180/M_PI*bgcontext.crot[2])*_i;
bgcontext.cx[1] += 0.02*sin(180/M_PI*bgcontext.crot[2])*_i;
}
FROM_TO(150, 1000, 1) {
bgcontext.crot[0] -= 0.02*(global.frames-fall_over-150);
if(bgcontext.crot[0] < 0)
bgcontext.crot[0] = 0;
}
if(t >= 190)
bgcontext.cx[2] -= max(6, 0.05*(global.frames-fall_over-150));
FROM_TO(300, 470,1) {
bgcontext.cx[0] -= 0.01*cos(180/M_PI*bgcontext.crot[2])*_i;
bgcontext.cx[1] -= 0.01*sin(180/M_PI*bgcontext.crot[2])*_i;
}
if(t > 470)
bgcontext.cx[0] += 1-2*frand();
}
float w = 0.002;
float f = 1, g = 1;
@ -76,11 +140,17 @@ void stage6_draw() {
bgcontext.crot[2] += 180/M_PI*g*w;
}
void start_fall_over() { //troll
fall_over = global.frames;
}
void stage6_start() {
init_stage3d(&bgcontext);
fall_over = 0;
add_model(&bgcontext, stage6_skysphere_draw, stage6_skysphere_pos);
add_model(&bgcontext, stage6_towertop_draw, stage6_towertop_pos);
add_model(&bgcontext, stage6_towertop_draw, stage6_towertop_pos);
add_model(&bgcontext, stage6_towerwall_draw, stage6_towerwall_pos);
bgcontext.cx[1] = -230;
bgcontext.crot[0] = 90;

1
src/stages/stage6.h

@ -9,5 +9,6 @@
#define STAGE6_H
void stage6_loop();
void start_fall_over();
#endif

107
src/stages/stage6_events.c

@ -674,16 +674,16 @@ int baryon_explode(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_DEATH) {
free_ref(e->args[1]);
petal_explosion(35, e->pos);
return 1;
}
if(frand() < 0.01) {
GO_TO(e, global.boss->pos + (e->pos0-global.boss->pos)*(1.5+0.2*sin(t*0.05)), 0.04);
if(frand() < 0.02) {
e->hp = 0;
return 1;
}
FROM_TO(10, 20000, 3)
petal_explosion(1, e->pos);
}
return 1;
}
@ -692,16 +692,98 @@ void elly_baryon_explode(Boss *b, int t) {
TIMER(&t);
AT(0)
start_fall_over();
AT(20)
set_baryon_rule(baryon_explode);
FROM_TO(0, 200, 1) {
petal_explosion(1, b->pos + 100*frand()*cexp(2I*M_PI*frand()));
}
AT(200) {
global.shake_view = 10;
petal_explosion(100, b->pos + 100*frand()*cexp(2I*M_PI*frand()));
killall(global.enemies);
}
AT(220) {
global.shake_view = 0;
}
}
void ScaleFadeSub(Projectile *proj, int t) {
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
ScaleFade(proj, t);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glBlendEquation(GL_FUNC_ADD);
}
int theory_proj(Projectile *p, int t) {
if(t < 0)
return 1;
p->pos += p->args[0];
p->angle = carg(p->args[0]);
if(!cimag(p->args[1])) {
float re = creal(p->pos);
float im = cimag(p->pos);
if(re <= 0 || re >= VIEWPORT_W)
p->args[0] = -creal(p->args[0]) + I*cimag(p->args[0]);
else if(im <= 0 || im >= VIEWPORT_H)
p->args[0] = creal(p->args[0]) - I*cimag(p->args[0]);
else
return 1;
FROM_TO(0, 300, 60) {
petal_explosion(10, b->pos + 200*frand()*cexp(2I*M_PI*frand()));
p->args[0] *= 0.4+0.1*global.diff;
switch((int)creal(p->args[1])) {
case 0:
p->tex = get_tex("proj/ball");
break;
case 1:
p->tex = get_tex("proj/bigball");
break;
case 2:
p->tex = get_tex("proj/bullet");
break;
case 3:
p->tex = get_tex("proj/plainball");
break;
}
p->clr->r = cos(p->angle);
p->clr->g = sin(p->angle);
p->clr->b = cos(p->angle+2.1);
p->args[1] += I;
}
AT(200)
killall(global.enemies);
return 1;
}
void elly_theory(Boss *b, int t) {
if(t < 20)
GO_TO(b, VIEWPORT_W/2+300I, 0.05);
TIMER(&t);
FROM_TO(0, 10000, 10)
create_particle2c("stain", b->pos+80*frand()*cexp(2I*M_PI*frand()), rgba(1,0.9,0.9,0.5), ScaleFadeSub, timeout, 60, 1+2*frand())->angle = 2*M_PI*frand();
FROM_TO(0, 10000, 20-2*global.diff)
create_projectile2c("soul", b->pos, rgb(1,0,0), asymptotic, cexp(1.6I*_i), 2)->draw = ProjDrawSub;
FROM_TO_INT(30, 10000, 100, 60, 20) {
int i;
int c = 4*5;
for(i = 0; i < c; i++)
create_projectile2c("crystal", b->pos, rgb(0,0,0), theory_proj, 2*cexp(0.1I*(i%5)+I*M_PI/2*(i/5)+I*_i), (i/5+_i)%4);
}
}
void elly_spellbg_classic(Boss *b, int t) {
@ -725,18 +807,19 @@ void elly_spellbg_modern(Boss *b, int t) {
Boss *create_elly() {
Boss *b = create_boss("Elly", "elly", -200I);
boss_add_attack(b, AT_Move, "Catch the Scythe", 6, 0, elly_intro, NULL);
// boss_add_attack(b, AT_Move, "Catch the Scythe", 6, 0, elly_intro, NULL);
// boss_add_attack(b, AT_Normal, "Frequency", 20, 23000, elly_frequency, NULL);
// boss_add_attack(b, AT_Spellcard, "Newton Sign ~ 2.5 Laws of Movement", 30, 30000, elly_newton, elly_spellbg_classic);
// boss_add_attack(b, AT_Normal, "Frequency2", 20, 23000, elly_frequency2, NULL);
// boss_add_attack(b, AT_Spellcard, "Maxwell Sign ~ Wave Theory", 25, 22000, elly_maxwell, elly_spellbg_classic);
boss_add_attack(b, AT_Move, "Unbound", 6, 10, elly_unbound, NULL);
// boss_add_attack(b, AT_Move, "Unbound", 6, 10, elly_unbound, NULL);
// boss_add_attack(b, AT_Spellcard, "Eigenstate ~ Many-World Interpretation", 30, 30000, elly_eigenstate, elly_spellbg_modern);
// boss_add_attack(b, AT_Normal, "Baryon", 25, 23000, elly_baryonattack, NULL);
// boss_add_attack(b, AT_Spellcard, "Ricci Sign ~ Space Time Curvature", 35, 40000, elly_ricci, elly_spellbg_modern);
// boss_add_attack(b, AT_Normal, "Baryon", 25, 23000, elly_baryonattack2, NULL);
// boss_add_attack(b, AT_Spellcard, "LHC ~ Higgs Boson Uncovered", 35, 40000, elly_lhc, elly_spellbg_modern);
boss_add_attack(b, AT_Move, "Explode", 6, 10, elly_baryon_explode, NULL);
boss_add_attack(b, AT_Move, "Explode", 7, 10, elly_baryon_explode, NULL);
boss_add_attack(b, AT_SurvivalSpell, "Tower of Truth ~ Theory of Everything", 35, 40000, elly_theory, NULL);
start_attack(b, b->attacks);
return b;

Loading…
Cancel
Save