Merge remote-tracking branch 'upstream/master' into stageselect
Conflicts: src/main.c src/menu/mainmenu.c
This commit is contained in:
commit
ef7c536786
15 changed files with 201 additions and 43 deletions
|
@ -44,6 +44,10 @@ set(SRCs
|
|||
stages/stage0.c
|
||||
stages/stage1.c
|
||||
stages/stage1_events.c
|
||||
stages/stage2.c
|
||||
stages/stage2_events.c
|
||||
stages/stage3.c
|
||||
stages/stage3_events.c
|
||||
resource/resource.c
|
||||
resource/texture.c
|
||||
resource/animation.c
|
||||
|
|
74
src/laser.c
74
src/laser.c
|
@ -36,7 +36,7 @@ Laser *create_laser(LaserType type, complex pos, complex pos0, int time, int dea
|
|||
return l;
|
||||
}
|
||||
|
||||
void draw_laser_line(Laser *laser) { // REALLY OLD.
|
||||
void draw_laser_line(Laser *laser) {
|
||||
float width = cabs(laser->pos0);
|
||||
if(global.frames - laser->birthtime < laser->time*3/5.0)
|
||||
width = 2;
|
||||
|
@ -49,7 +49,7 @@ void draw_laser_line(Laser *laser) { // REALLY OLD.
|
|||
glTranslatef(creal(laser->pos), cimag(laser->pos),0);
|
||||
glRotatef(carg(laser->pos0)*180/M_PI,0,0,1);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("lasercurve")->gltex);
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("part/lasercurve")->gltex);
|
||||
|
||||
glColor4fv((float *)laser->color);
|
||||
|
||||
|
@ -67,45 +67,43 @@ void draw_laser_line(Laser *laser) { // REALLY OLD.
|
|||
glPopMatrix();
|
||||
}
|
||||
|
||||
void draw_laser_curve(Laser *laser) {
|
||||
int i;
|
||||
|
||||
Texture *tex = get_tex("lasercurve");
|
||||
void draw_laser_curve(Laser *laser) {
|
||||
Texture *tex = get_tex("part/lasercurve");
|
||||
glBindTexture(GL_TEXTURE_2D, tex->gltex);
|
||||
|
||||
glColor4fv((float *)laser->color);
|
||||
for(i = 0; i < 2; i++) {
|
||||
float t = global.frames - laser->birthtime - laser->time;
|
||||
if(t < 0)
|
||||
t = 0;
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
|
||||
for(; t < global.frames - laser->birthtime && t <= laser->deathtime; t+=0.5) {
|
||||
complex pos = laser->rule(laser,t);
|
||||
glPushMatrix();
|
||||
|
||||
float t1 = t - (global.frames - laser->birthtime - laser->time/2);
|
||||
|
||||
float tail = laser->time/1.9 + (1-i)*3;
|
||||
float t = global.frames - laser->birthtime - laser->time;
|
||||
if(t < 0)
|
||||
t = 0;
|
||||
|
||||
for(; t < global.frames - laser->birthtime && t <= laser->deathtime; t += 0.5) {
|
||||
complex pos = laser->rule(laser,t);
|
||||
glPushMatrix();
|
||||
|
||||
float t1 = t - (global.frames - laser->birthtime - laser->time/2);
|
||||
|
||||
float tail = laser->time/1.9;
|
||||
|
||||
float s = -0.75/pow(tail,2)*(t1-tail)*(t1+tail);
|
||||
s += 0.2*(1-i);
|
||||
|
||||
if(i)
|
||||
glColor4f(1,1,1,1.0/(laser->time)*(t1+laser->time/2));
|
||||
|
||||
glTranslatef(creal(pos), cimag(pos), 0);
|
||||
glScalef(s,s,s);
|
||||
|
||||
float wq = ((float)tex->w)/tex->truew;
|
||||
float hq = ((float)tex->h)/tex->trueh;
|
||||
|
||||
glScalef(tex->w*wq,tex->h*hq,1);
|
||||
draw_quad();
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
glColor4f(1,1,1,1);
|
||||
}
|
||||
float s = -0.75/pow(tail,2)*(t1-tail)*(t1+tail);
|
||||
|
||||
glTranslatef(creal(pos), cimag(pos), 0);
|
||||
|
||||
float wq = ((float)tex->w)/tex->truew;
|
||||
float hq = ((float)tex->h)/tex->trueh;
|
||||
|
||||
glScalef(s*tex->w*wq,s*tex->h*hq,s);
|
||||
draw_quad();
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glColor4f(1,1,1,1);
|
||||
|
||||
}
|
||||
|
||||
void draw_lasers() {
|
||||
|
@ -113,7 +111,7 @@ void draw_lasers() {
|
|||
|
||||
for(laser = global.lasers; laser; laser = laser->next) {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
if(laser->type == LaserLine)
|
||||
if(laser->type == LT_Line)
|
||||
draw_laser_line(laser);
|
||||
else
|
||||
draw_laser_curve(laser);
|
||||
|
@ -130,7 +128,7 @@ void process_lasers() {
|
|||
|
||||
while(laser != NULL) {
|
||||
int c = 0;
|
||||
if(laser->type == LaserLine)
|
||||
if(laser->type == LT_Line)
|
||||
c = collision_laser_line(laser);
|
||||
else
|
||||
c = collision_laser_curve(laser);
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include "projectile.h"
|
||||
|
||||
typedef enum {
|
||||
LaserLine,
|
||||
LaserCurve
|
||||
LT_Line,
|
||||
LT_Curve
|
||||
} LaserType;
|
||||
|
||||
struct Laser;
|
||||
|
|
|
@ -16,6 +16,8 @@ StageInfo stages[] = {
|
|||
|
||||
{stage0_loop, False, "Stage 1", "(insert subtitle here)"},
|
||||
{stage1_loop, False, "Stage 2", "(insert subtitle here)"},
|
||||
{stage2_loop, False, "Stage 3", "(insert subtitle here)"},
|
||||
{stage3_loop, False, "Stage 4", "(insert subtitle here)"},
|
||||
|
||||
{NULL, False, NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -48,5 +48,7 @@ void draw_stage_title(int t, int dur, char *stage, char *subtitle);
|
|||
|
||||
void stage0_loop();
|
||||
void stage1_loop();
|
||||
void stage2_loop();
|
||||
void stage3_loop();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -368,10 +368,9 @@ Boss *create_hina() {
|
|||
return hina;
|
||||
}
|
||||
|
||||
|
||||
void stage1_events() {
|
||||
TIMER(&global.timer);
|
||||
|
||||
|
||||
AT(300) {
|
||||
create_enemy1c(VIEWPORT_W/2-10I, 7000+500*global.diff, BigFairy, stage1_great_circle, 2I);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
#ifndef STAGE1_EVENTS_H
|
||||
#define STAGE1__EVENTSH
|
||||
#define STAGE1_EVENTS_H
|
||||
|
||||
void stage1_events();
|
||||
|
||||
|
|
33
src/stages/stage2.c
Normal file
33
src/stages/stage2.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#include "stage2.h"
|
||||
#include "global.h"
|
||||
#include "stage.h"
|
||||
#include "stageutils.h"
|
||||
#include "stage2_events.h"
|
||||
|
||||
static Stage3D bgcontext;
|
||||
|
||||
void stage2_start() {
|
||||
init_stage3d(&bgcontext);
|
||||
}
|
||||
|
||||
void stage2_end() {
|
||||
free_stage3d(&bgcontext);
|
||||
}
|
||||
|
||||
void stage2_draw() {
|
||||
set_perspective(&bgcontext, 500, 5000);
|
||||
|
||||
draw_stage3d(&bgcontext, 7000);
|
||||
}
|
||||
|
||||
void stage2_loop() {
|
||||
// ShaderRule shaderrules[] = { stage1_fog, stage1_bloom, NULL };
|
||||
stage_loop(stage2_start, stage2_end, stage2_draw, stage2_events, NULL, 5500);
|
||||
}
|
13
src/stages/stage2.h
Normal file
13
src/stages/stage2.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#ifndef STAGE3_H
|
||||
#define STAGE3_H
|
||||
|
||||
void stage2_loop();
|
||||
|
||||
#endif
|
14
src/stages/stage2_events.c
Normal file
14
src/stages/stage2_events.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#include "stage2_events.h"
|
||||
#include "global.h"
|
||||
#include "stage.h"
|
||||
#include "enemy.h"
|
||||
|
||||
void stage2_events() {
|
||||
}
|
13
src/stages/stage2_events.h
Normal file
13
src/stages/stage2_events.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#ifndef STAGE2_EVENTS_H
|
||||
#define STAGE2_EVENTS_H
|
||||
|
||||
void stage2_events();
|
||||
|
||||
#endif
|
33
src/stages/stage3.c
Normal file
33
src/stages/stage3.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#include "stage3.h"
|
||||
#include "global.h"
|
||||
#include "stage.h"
|
||||
#include "stageutils.h"
|
||||
#include "stage3_events.h"
|
||||
|
||||
static Stage3D bgcontext;
|
||||
|
||||
void stage3_start() {
|
||||
init_stage3d(&bgcontext);
|
||||
}
|
||||
|
||||
void stage3_end() {
|
||||
free_stage3d(&bgcontext);
|
||||
}
|
||||
|
||||
void stage3_draw() {
|
||||
set_perspective(&bgcontext, 500, 5000);
|
||||
|
||||
draw_stage3d(&bgcontext, 7000);
|
||||
}
|
||||
|
||||
void stage3_loop() {
|
||||
// ShaderRule shaderrules[] = { stage1_fog, stage1_bloom, NULL };
|
||||
stage_loop(stage3_start, stage3_end, stage3_draw, stage3_events, NULL, 5500);
|
||||
}
|
13
src/stages/stage3.h
Normal file
13
src/stages/stage3.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#ifndef STAGE3_H
|
||||
#define STAGE3_H
|
||||
|
||||
void stage3_loop();
|
||||
|
||||
#endif
|
21
src/stages/stage3_events.c
Normal file
21
src/stages/stage3_events.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#include "stage3_events.h"
|
||||
#include "global.h"
|
||||
#include "stage.h"
|
||||
#include "enemy.h"
|
||||
#include "laser.h"
|
||||
|
||||
void stage3_events() {
|
||||
TIMER(&global.timer);
|
||||
|
||||
FROM_TO(30, 200, 20) {
|
||||
create_laser(LT_Line, VIEWPORT_W/2, 20*cexp(I*0.3*_i), 40, 200, rgb(0.9,0.9,0.0), NULL, 0);
|
||||
}
|
||||
|
||||
}
|
13
src/stages/stage3_events.h
Normal file
13
src/stages/stage3_events.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* This software is licensed under the terms of the MIT-License
|
||||
* See COPYING for further information.
|
||||
* ---
|
||||
* Copyright (C) 2011, Lukas Weber <laochailan@web.de>
|
||||
*/
|
||||
|
||||
#ifndef STAGE3_EVENTS_H
|
||||
#define STAGE3_EVENTS_H
|
||||
|
||||
void stage3_events();
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue