"API changes", swirl
you see dat swirl? you see two z^3*i^|z|?
BIN
gfx/heightmap
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 849 KiB After Width: | Height: | Size: 849 KiB |
Before Width: | Height: | Size: 519 KiB After Width: | Height: | Size: 519 KiB |
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 505 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 457 B After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 609 KiB After Width: | Height: | Size: 609 KiB |
Before Width: | Height: | Size: 716 KiB After Width: | Height: | Size: 716 KiB |
BIN
gfx/stage0/water.png
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
gfx/swirl.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
gfx/swirl.xcf
Normal file
BIN
gfx/wasser.png
Before Width: | Height: | Size: 88 KiB |
30
src/enemy.c
|
@ -13,9 +13,11 @@
|
|||
#include "projectile.h"
|
||||
#include "list.h"
|
||||
|
||||
void create_enemy(Enemy **enemies, EnemyDrawRule draw_rule, EnemyLogicRule logic_rule,
|
||||
complex pos, int hp, void *parent, complex args, ...) {
|
||||
void create_enemy_p(Enemy **enemies, complex pos, int hp, EnemyDrawRule draw_rule, EnemyLogicRule logic_rule,
|
||||
complex a1, complex a2, complex a3, complex a4) {
|
||||
Enemy *e = (Enemy *)create_element((void **)enemies, sizeof(Enemy));
|
||||
e->moving = 0;
|
||||
e->dir = 0;
|
||||
|
||||
e->birthtime = global.frames;
|
||||
e->pos = pos;
|
||||
|
@ -23,26 +25,20 @@ void create_enemy(Enemy **enemies, EnemyDrawRule draw_rule, EnemyLogicRule logic
|
|||
|
||||
e->hp = hp;
|
||||
|
||||
e->parent = parent;
|
||||
e->logic_rule = logic_rule;
|
||||
e->draw_rule = draw_rule;
|
||||
|
||||
va_list ap;
|
||||
int i;
|
||||
|
||||
memset(e->args, 0, RULE_ARGC);
|
||||
va_start(ap, args);
|
||||
for(i = 0; i < RULE_ARGC; i++) {
|
||||
e->args[i] = args;
|
||||
args = va_arg(ap, complex);
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
e->args[0] = a1;
|
||||
e->args[1] = a2;
|
||||
e->args[2] = a3;
|
||||
e->args[3] = a4;
|
||||
|
||||
e->logic_rule(e, EVENT_BIRTH);
|
||||
}
|
||||
|
||||
void _delete_enemy(void **enemies, void* enemy) {
|
||||
((Enemy* )enemy)->logic_rule(enemy, EVENT_DEATH);
|
||||
if(((Enemy* )enemy)->hp <= 0)
|
||||
((Enemy* )enemy)->logic_rule(enemy, EVENT_DEATH);
|
||||
del_ref(enemy);
|
||||
|
||||
delete_element((void **)enemies, enemy);
|
||||
|
@ -88,6 +84,10 @@ void Fairy(Enemy *e, int t) {
|
|||
|
||||
glPopMatrix();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
if(e->dir) {
|
||||
glCullFace(GL_BACK);
|
||||
}
|
||||
}
|
||||
|
||||
void process_enemies(Enemy **enemies) {
|
||||
|
|
11
src/enemy.h
|
@ -40,13 +40,16 @@ struct Enemy {
|
|||
|
||||
int hp;
|
||||
|
||||
void *parent;
|
||||
complex args[RULE_ARGC];
|
||||
};
|
||||
|
||||
#define create_enemyg(drule, lrule, pos, hp, par, args) (create_enemy(&global.enemies, drule, lrule, pos, hp, par, args))
|
||||
void create_enemy(Enemy **enemies, EnemyDrawRule draw_rule, EnemyLogicRule logic_rule,
|
||||
complex pos, int hp, void *parent, complex args, ...);
|
||||
#define create_enemy4c(p,h,d,l,a1,a2,a3,a4) create_enemy_p(&global.enemies,p,h,d,l,a1,a2,a3,a4)
|
||||
#define create_enemy3c(p,h,d,l,a1,a2,a3) create_enemy_p(&global.enemies,p,h,d,l,a1,a2,a3,0)
|
||||
#define create_enemy2c(p,h,d,l,a1,a2) create_enemy_p(&global.enemies,p,h,d,l,a1,a2,0,0)
|
||||
#define create_enemy1c(p,h,d,l,a1) create_enemy_p(&global.enemies,p,h,d,l,a1,0,0,0)
|
||||
|
||||
void create_enemy_p(Enemy **enemies, complex pos, int hp, EnemyDrawRule draw_rule, EnemyLogicRule logic_rule,
|
||||
complex a1, complex a2, complex a3, complex a4);
|
||||
void delete_enemy(Enemy **enemies, Enemy* enemy);
|
||||
void draw_enemies(Enemy *enemies);
|
||||
void delete_enemies(Enemy **enemies);
|
||||
|
|
|
@ -33,8 +33,12 @@ void draw_items() {
|
|||
for(p = global.items; p; p = p->next) {
|
||||
switch(p->type){
|
||||
case Power:
|
||||
tex = get_tex("items/power");
|
||||
break;
|
||||
if(global.plr.power < 6) {
|
||||
tex = get_tex("items/power");
|
||||
break;
|
||||
}
|
||||
|
||||
p->type = Point;
|
||||
case Point:
|
||||
tex = get_tex("items/point");
|
||||
break;
|
||||
|
|
|
@ -48,9 +48,9 @@ void create_main_menu(MenuData *m) {
|
|||
|
||||
|
||||
void draw_main_menu_bg(MenuData* menu) {
|
||||
draw_texture(SCREEN_W/2, SCREEN_H/2, "mainmenubgbg");
|
||||
draw_texture(SCREEN_W/2, SCREEN_H/2, "mainmenu/mainmenubgbg");
|
||||
glColor4f(1,1,1,0.6 + 0.1*sin(menu->frames/100.0));
|
||||
draw_texture(SCREEN_W/2, SCREEN_H/2, "mainmenubg");
|
||||
draw_texture(SCREEN_W/2, SCREEN_H/2, "mainmenu/mainmenubg");
|
||||
glColor4f(1,1,1,1);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ void draw_main_menu(MenuData *menu) {
|
|||
draw_main_menu_bg(menu);
|
||||
|
||||
glColor4f(1,1,1,0.7);
|
||||
draw_texture(SCREEN_W/2+40, SCREEN_H/2, "gate");
|
||||
draw_texture(SCREEN_W/2+40, SCREEN_H/2, "mainmenu/gate");
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(0, SCREEN_H-200, 0);
|
||||
|
|
10
src/player.c
|
@ -90,12 +90,14 @@ void player_logic(Player* plr) {
|
|||
switch(plr->cha) {
|
||||
case Youmu:
|
||||
youmu_shot(plr);
|
||||
break;
|
||||
case Marisa:
|
||||
marisa_shot(plr);
|
||||
break;
|
||||
}
|
||||
|
||||
if(plr->deathtime > 0)
|
||||
create_particle("flare", plr->pos, rgb(255,0,0), Shrink, timeout_linear, rarg(10, 4*cexp(I*rand())));
|
||||
create_particle2c("flare", plr->pos, rgb(255,0,0), Shrink, timeout_linear, 10, 4*cexp(I*rand()));
|
||||
|
||||
if(global.frames == plr->deathtime)
|
||||
plr_realdeath(plr);
|
||||
|
@ -112,12 +114,12 @@ void plr_bomb(Player *plr) {
|
|||
|
||||
play_sound("laser1");
|
||||
|
||||
plr->bombs--;
|
||||
|
||||
if(plr->deathtime > 0) {
|
||||
plr->deathtime = -1;
|
||||
plr->bombs /= 2;
|
||||
}
|
||||
|
||||
plr->bombs--;
|
||||
}
|
||||
|
||||
plr->recovery = global.frames + 200;
|
||||
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
void youmu_shot(Player *plr) {
|
||||
if(plr->fire) {
|
||||
if(!(global.frames % 4)) {
|
||||
create_projectile("youmu", plr->pos + 10 - I*20, NULL, linear, rarg(-20I))->type = PlrProj;
|
||||
create_projectile("youmu", plr->pos - 10 - I*20, NULL, linear, rarg(-20I))->type = PlrProj;
|
||||
create_projectile1c("youmu", plr->pos + 10 - I*20, NULL, linear, -20I)->type = PlrProj;
|
||||
create_projectile1c("youmu", plr->pos - 10 - I*20, NULL, linear, -20I)->type = PlrProj;
|
||||
|
||||
if(plr->power >= 2) {
|
||||
float a = 0.20;
|
||||
if(plr->focus > 0) a = 0.06;
|
||||
create_projectile("youmu", plr->pos - 10 - I*20, NULL, linear, rarg(I*-20*cexp(-I*a)))->type = PlrProj;
|
||||
create_projectile("youmu", plr->pos + 10 - I*20, NULL, linear, rarg(I*-20*cexp(I*a)))->type = PlrProj;
|
||||
create_projectile1c("youmu", plr->pos - 10 - I*20, NULL, linear, -20I*cexp(-I*a))->type = PlrProj;
|
||||
create_projectile1c("youmu", plr->pos + 10 - I*20, NULL, linear, -20I*cexp(I*a))->type = PlrProj;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,25 +36,27 @@ void youmu_shot(Player *plr) {
|
|||
ref = add_ref(global.enemies);
|
||||
|
||||
if(ref != -1)
|
||||
create_projectile("hghost", plr->pos, NULL, youmu_homing, rarg(a*cexp(I*rand()), ref))->type = PlrProj;
|
||||
create_projectile2c("hghost", plr->pos, NULL, youmu_homing, a*cexp(I*rand()), ref)->type = PlrProj;
|
||||
}
|
||||
}
|
||||
|
||||
if(plr->shot == YoumuOpposite && plr->slaves == NULL)
|
||||
create_enemy(&plr->slaves, youmu_opposite_draw, youmu_opposite_logic, plr->pos, ENEMY_IMMUNE, plr, 0);
|
||||
create_enemy_p(&plr->slaves, plr->pos, ENEMY_IMMUNE, youmu_opposite_draw, youmu_opposite_logic, add_ref(plr), 0, 0, 0);
|
||||
}
|
||||
|
||||
void youmu_opposite_draw(Enemy *e, int t) {
|
||||
complex pos = e->pos + ((Player *)e->parent)->pos;
|
||||
complex pos = e->pos + ((Player *)REF(e->args[0]))->pos;
|
||||
|
||||
create_particle("flare", pos, NULL, Shrink, timeout, rarg(10, -e->pos+10I));
|
||||
create_particle2c("flare", pos, NULL, Shrink, timeout, 10, -e->pos+10I);
|
||||
}
|
||||
|
||||
void youmu_opposite_logic(Enemy *e, int t) {
|
||||
if(t == EVENT_DEATH)
|
||||
free_ref(e->args[0]);
|
||||
if(t < 0)
|
||||
return;
|
||||
|
||||
Player *plr = (Player *)e->parent;
|
||||
Player *plr = (Player *)REF(e->args[0]);
|
||||
|
||||
if(plr->focus < 15) {
|
||||
e->args[2] = carg(plr->pos - e->pos0);
|
||||
|
@ -65,16 +67,16 @@ void youmu_opposite_logic(Enemy *e, int t) {
|
|||
}
|
||||
|
||||
if(plr->fire && !(global.frames % 4))
|
||||
create_projectile("youmu", e->pos + plr->pos, NULL, linear, rarg(-20*cexp(I*e->args[2])))->type = PlrProj;
|
||||
create_projectile1c("youmu", e->pos + plr->pos, NULL, linear, -21*cexp(I*e->args[2]))->type = PlrProj;
|
||||
|
||||
e->pos0 = e->pos + plr->pos;
|
||||
}
|
||||
|
||||
int youmu_homing(Projectile *p, int t) { // a[0]: velocity, a[1]: target, a[2]: old velocity
|
||||
p->angle = rand();
|
||||
if(t == EVENT_DEATH) {
|
||||
if(t == EVENT_DEATH)
|
||||
free_ref(p->args[1]);
|
||||
}
|
||||
|
||||
|
||||
complex tv = p->args[2];
|
||||
if(REF(p->args[1]) != NULL)
|
||||
|
@ -102,8 +104,8 @@ int mari_laser(Projectile *p, int t) {
|
|||
void marisa_shot(Player *plr) {
|
||||
if(plr->fire) {
|
||||
if(!(global.frames % 4)) {
|
||||
create_projectile("marisa", +10, NULL, mari_laser, rarg(-20I, (complex) add_ref(plr)))->type = PlrProj;
|
||||
create_projectile("marisa", -10, NULL, mari_laser, rarg(-20I, (complex) add_ref(plr)))->type = PlrProj;
|
||||
create_projectile2c("marisa", +10, NULL, mari_laser, -20I, add_ref(plr))->type = PlrProj;
|
||||
create_projectile2c("marisa", -10, NULL, mari_laser, -20I, add_ref(plr))->type = PlrProj;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,44 +26,19 @@ inline Color *rgb(float r, float g, float b) {
|
|||
return rgba(r, g, b, 1.0);
|
||||
}
|
||||
|
||||
complex *rarg(complex arg0, ...) {
|
||||
complex *a = calloc(RULE_ARGC, sizeof(complex));
|
||||
va_list ap;
|
||||
int i;
|
||||
|
||||
memset(a, 0, sizeof(a));
|
||||
|
||||
va_start(ap, arg0);
|
||||
|
||||
a[0] = arg0;
|
||||
for(i = 1; i < RULE_ARGC; i++) {
|
||||
a[i] = (complex)va_arg(ap, complex);
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
Projectile *create_particle(char *name, complex pos, Color *clr, ProjDRule draw, ProjRule rule, complex *a) {
|
||||
Projectile *p = create_projectile_p(&global.particles, get_tex(name), pos, clr, draw, rule, a);
|
||||
Projectile *create_particle4c(char *name, complex pos, Color *clr, ProjDRule draw, ProjRule rule, complex a1, complex a2, complex a3, complex a4) {
|
||||
Projectile *p = create_projectile_p(&global.particles, prefix_get_tex(name, "part/"), pos, clr, draw, rule, a1, a2, a3, a4);
|
||||
|
||||
p->type = Particle;
|
||||
return p;
|
||||
}
|
||||
|
||||
Projectile *create_projectile(char *name, complex pos, Color *clr, ProjRule rule, complex *a) {
|
||||
char *buf = malloc(strlen(name) + 6);
|
||||
strcpy(buf, "proj/");
|
||||
strcat(buf, name);
|
||||
|
||||
Texture *tex = get_tex(buf);
|
||||
free(buf);
|
||||
|
||||
return create_projectile_p(&global.projs, tex, pos, clr, ProjDraw, rule, a);
|
||||
Projectile *create_projectile4c(char *name, complex pos, Color *clr, ProjRule rule, complex a1, complex a2, complex a3, complex a4) {
|
||||
return create_projectile_p(&global.projs, prefix_get_tex(name, "proj/"), pos, clr, ProjDraw, rule, a1, a2, a3, a4);
|
||||
}
|
||||
|
||||
Projectile *create_projectile_p(Projectile **dest, Texture *tex, complex pos, Color *clr,
|
||||
ProjDRule draw, ProjRule rule, complex *args) {
|
||||
ProjDRule draw, ProjRule rule, complex a1, complex a2, complex a3, complex a4) {
|
||||
Projectile *p = create_element((void **)dest, sizeof(Projectile));
|
||||
|
||||
p->birthtime = global.frames;
|
||||
|
@ -75,18 +50,16 @@ Projectile *create_projectile_p(Projectile **dest, Texture *tex, complex pos, Co
|
|||
p->tex = tex;
|
||||
p->type = FairyProj;
|
||||
p->clr = clr;
|
||||
p->parent = NULL;
|
||||
|
||||
memset(p->args, 0, sizeof(p->args));
|
||||
if(args) {
|
||||
memcpy(p->args, args, sizeof(p->args));
|
||||
free(args);
|
||||
}
|
||||
p->args[0] = a1;
|
||||
p->args[1] = a2;
|
||||
p->args[2] = a3;
|
||||
p->args[3] = a4;
|
||||
|
||||
if(dest != &global.particles && clr != NULL) {
|
||||
Color *color = rgba(clr->r, clr->g, clr->b, clr->a);
|
||||
|
||||
create_projectile_p(Pa, tex, pos, color, Shrink, bullet_flare_move, rarg(16, (complex)add_ref(p)));
|
||||
create_projectile_p(&global.particles, tex, pos, color, Shrink, bullet_flare_move, 16, add_ref(p), 0, 0);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -154,7 +127,7 @@ void process_projectiles(Projectile **projs, char collision) {
|
|||
if(proj->type == DeadProj && killed < 2) {
|
||||
killed++;
|
||||
action = ACTION_DESTROY;
|
||||
create_particle("flare", proj->pos, NULL, Fade, timeout, rarg(30));
|
||||
create_particle1c("flare", proj->pos, NULL, Fade, timeout, 30);
|
||||
create_item(proj->pos, 0, BPoint)->auto_collect = 10;
|
||||
}
|
||||
|
||||
|
@ -167,10 +140,9 @@ void process_projectiles(Projectile **projs, char collision) {
|
|||
clr = malloc(sizeof(Color));
|
||||
memcpy(clr, proj->clr, sizeof(Color));
|
||||
}
|
||||
create_projectile_p(Pa, proj->tex, proj->pos, clr, DeathShrink, timeout_linear, rarg(10, 5*cexp(proj->angle*I)));
|
||||
create_projectile_p(&global.particles, proj->tex, proj->pos, clr, DeathShrink, timeout_linear, 10, 5*cexp(proj->angle*I), 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(col == 1 && global.frames - abs(global.plr.recovery) >= 0)
|
||||
plr_death(&global.plr);
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#ifndef PROJECTILE
|
||||
#define PROJECTILE
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <complex.h>
|
||||
#include "resource/texture.h"
|
||||
|
||||
|
@ -19,17 +18,14 @@ typedef struct {
|
|||
float a;
|
||||
} Color;
|
||||
|
||||
struct Projectile;
|
||||
typedef int (*ProjRule)(struct Projectile *p, int t);
|
||||
typedef void (*ProjDRule)(struct Projectile *p, int t);
|
||||
|
||||
#define Pr (&global.projs)
|
||||
#define Pa (&global.particles)
|
||||
|
||||
enum {
|
||||
RULE_ARGC = 4
|
||||
};
|
||||
|
||||
struct Projectile;
|
||||
typedef int (*ProjRule)(struct Projectile *p, int t);
|
||||
typedef void (*ProjDRule)(struct Projectile *p, int t);
|
||||
|
||||
typedef struct Projectile {
|
||||
struct Projectile *next;
|
||||
struct Projectile *prev;
|
||||
|
@ -40,7 +36,6 @@ typedef struct Projectile {
|
|||
long birthtime;
|
||||
|
||||
float angle;
|
||||
void *parent;
|
||||
|
||||
ProjRule rule;
|
||||
ProjDRule draw;
|
||||
|
@ -53,16 +48,20 @@ typedef struct Projectile {
|
|||
complex args[RULE_ARGC];
|
||||
} Projectile;
|
||||
|
||||
void load_projectiles();
|
||||
|
||||
Color *rgba(float r, float g, float b, float a);
|
||||
|
||||
inline complex *rarg(complex arg0, ...);
|
||||
inline Color *rgb(float r, float g, float b);
|
||||
|
||||
Projectile *create_particle(char *name, complex pos, Color *clr, ProjDRule draw, ProjRule rule, complex *a);
|
||||
Projectile *create_projectile(char *name, complex pos, Color *clr, ProjRule rule, complex *a);
|
||||
Projectile *create_projectile_p(Projectile **dest, Texture *tex, complex pos, Color *clr, ProjDRule draw, ProjRule rule, complex *args);
|
||||
#define create_particle3c(n,p,c,d,r,a1,a2,a3) create_particle4c(n,p,c,d,r,a1,a2,a3,0)
|
||||
#define create_particle2c(n,p,c,d,r,a1,a2) create_particle4c(n,p,c,d,r,a1,a2,0,0)
|
||||
#define create_particle1c(n,p,c,d,r,a1) create_particle4c(n,p,c,d,r,a1,0,0,0)
|
||||
|
||||
#define create_projectile3c(n,p,c,r,a1,a2,a3) create_projectile4c(n,p,c,r,a1,a2,a3,0)
|
||||
#define create_projectile2c(n,p,c,r,a1,a2) create_projectile4c(n,p,c,r,a1,a2,0,0)
|
||||
#define create_projectile1c(n,p,c,r,a1) create_projectile4c(n,p,c,r,a1,0,0,0)
|
||||
|
||||
Projectile *create_particle4c(char *name, complex pos, Color *clr, ProjDRule draw, ProjRule rule, complex a1, complex a2, complex a3, complex a4);
|
||||
Projectile *create_projectile4c(char *name, complex pos, Color *clr, ProjRule rule, complex a1, complex a2, complex a3, complex a4);
|
||||
Projectile *create_projectile_p(Projectile **dest, Texture *tex, complex pos, Color *clr, ProjDRule draw, ProjRule rule, complex a1, complex a2, complex a3, complex a4);
|
||||
void delete_projectile(Projectile **dest, Projectile *proj);
|
||||
void delete_projectiles(Projectile **dest);
|
||||
void draw_projectiles(Projectile *projs);
|
||||
|
|
|
@ -80,6 +80,24 @@ Texture *get_tex(char *name) {
|
|||
return res;
|
||||
}
|
||||
|
||||
Texture *prefix_get_tex(char *name, char *prefix) {
|
||||
char *src;
|
||||
|
||||
if((src = strrchr(name, '/')))
|
||||
src++;
|
||||
else
|
||||
src = name;
|
||||
|
||||
char *buf = malloc(strlen(src) + strlen(prefix));
|
||||
strcpy(buf, prefix);
|
||||
strcat(buf, src);
|
||||
|
||||
Texture *tex = get_tex(buf);
|
||||
free(buf);
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
||||
void delete_texture(void **texs, void *tex) {
|
||||
Texture *t = (Texture *)tex;
|
||||
free(t->name);
|
||||
|
|
|
@ -26,6 +26,8 @@ typedef struct Texture {
|
|||
} Texture;
|
||||
|
||||
Texture *get_tex(char *name);
|
||||
Texture *prefix_get_tex(char *name, char *prefix);
|
||||
|
||||
void load_textures();
|
||||
void load_resources();
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ void stage_logic() {
|
|||
|
||||
global.frames++;
|
||||
|
||||
if(!global.dialog)
|
||||
if(!global.dialog && !global.boss)
|
||||
global.timer++;
|
||||
|
||||
calc_fps(&global.fps);
|
||||
|
|
|
@ -8,6 +8,11 @@
|
|||
#ifndef STAGE_H
|
||||
#define STAGE_H
|
||||
|
||||
#define TIMER(ptr) int *__timep = ptr; int _i;
|
||||
#define AT(t) if(*__timep == t)
|
||||
#define FROM_TO(start,end,step) _i = (*__timep - start)/step; if(*__timep >= (start) && *__timep <= (end) && !(*__timep % (step)))
|
||||
|
||||
|
||||
typedef void (*StageRule)(void);
|
||||
|
||||
void stage_loop(StageRule start, StageRule end, StageRule draw, StageRule event);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "../global.h"
|
||||
|
||||
void simpleEnemy(Enemy *e, int t) {
|
||||
if(t == EVENT_DEATH && global.plr.power < 6) {
|
||||
if(t == EVENT_DEATH) {
|
||||
create_item(e->pos, 6*cexp(I*rand()), Power);
|
||||
return;
|
||||
} else if(t < 0) {
|
||||
|
@ -20,7 +20,7 @@ void simpleEnemy(Enemy *e, int t) {
|
|||
}
|
||||
|
||||
if(!(t % 50))
|
||||
create_projectile("ball", e->pos, rgb(0,0,1), linear,rarg(3 + 2I));
|
||||
create_projectile1c("ball", e->pos, rgb(0,0,1), linear, 3 + 2I);
|
||||
|
||||
e->moving = 1;
|
||||
e->dir = creal(e->args[0]) < 0;
|
||||
|
@ -63,7 +63,7 @@ void stage0_draw() {
|
|||
glPushMatrix();
|
||||
glRotatef(60, -1, 0, 0);
|
||||
|
||||
Texture *water = get_tex("wasser");
|
||||
Texture *water = get_tex("stage0/water");
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, water->gltex);
|
||||
|
@ -85,23 +85,6 @@ void stage0_draw() {
|
|||
glVertex3f(-500,3000,0);
|
||||
glEnd();
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
glTranslatef(-global.frames/1000.0,global.frames/200.0, 0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glBindTexture(GL_TEXTURE_2D, get_tex("stage1/border")->gltex);
|
||||
|
||||
// glColor3f(1,0.75,0.75);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2i(0,0);
|
||||
glVertex3f(VIEWPORT_W,0,0);
|
||||
glTexCoord2i(1,0);
|
||||
glVertex3f(VIEWPORT_W,0,1000);
|
||||
glTexCoord2i(1,1);
|
||||
glVertex3f(VIEWPORT_W,3000,1000);
|
||||
glTexCoord2i(0,1);
|
||||
glVertex3f(VIEWPORT_W,3000,0);
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
|
@ -120,40 +103,8 @@ void cirno_intro(Boss *c, int time) {
|
|||
return;
|
||||
}
|
||||
|
||||
// if(!(time % 50))
|
||||
// create_laser(LaserLine, c->pos, 10*cexp(I*carg(global.plr.pos - c->pos)+I*0.1), 30, 200, rgb(1,0,0), NULL, 0);
|
||||
}
|
||||
|
||||
complex lolsin(Laser *l, float t) {
|
||||
complex pos;
|
||||
pos = l->pos0 + (1-t/200)*t*cexp(I*l->args[0])*3 + t*2I;
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
int cirno_pfreeze_frogs(Projectile *p, int t) {
|
||||
if(*((Boss**)p->parent) == NULL || (*(Boss**)p->parent)->current == NULL)
|
||||
return 1;
|
||||
|
||||
int boss_t = (global.frames - (*(Boss**)p->parent)->current->starttime) % 320;
|
||||
|
||||
if(boss_t < 110)
|
||||
linear(p, t);
|
||||
else if(boss_t == 110) {
|
||||
free(p->clr);
|
||||
p->clr = rgb(0.7,0.7,0.7);
|
||||
}
|
||||
|
||||
if(t == 240) {
|
||||
p->pos0 = p->pos;
|
||||
p->args[0] = 2*cexp(I*rand());
|
||||
}
|
||||
|
||||
if(t > 240)
|
||||
linear(p, t-240);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void cirno_perfect_freeze(Boss *c, int time) {
|
||||
if(time == EVENT_BIRTH) {
|
||||
|
@ -169,22 +120,22 @@ void cirno_perfect_freeze(Boss *c, int time) {
|
|||
float g = rand()/(float)RAND_MAX;
|
||||
float b = rand()/(float)RAND_MAX;
|
||||
|
||||
create_projectile("ball", c->pos, rgb(r, g, b), cirno_pfreeze_frogs, rarg(4*cexp(I*rand())))->parent=&global.boss;
|
||||
// create_projectile2c("ball", c->pos, rgb(r, g, b), cirno_pfreeze_frogs, 4*cexp(I*rand()), add_ref(&global.boss))->parent=&global.boss;
|
||||
}
|
||||
|
||||
if(time > 160 && time < 220 && !(time % 7)) {
|
||||
create_projectile("rice", c->pos + 60, rgb(0.3, 0.4, 0.9), linear, rarg(5*cexp(I*carg(global.plr.pos - c->pos))));
|
||||
create_projectile("rice", c->pos - 60, rgb(0.3, 0.4, 0.9), linear, rarg(5*cexp(I*carg(global.plr.pos - c->pos))));
|
||||
create_projectile1c("rice", c->pos + 60, rgb(0.3, 0.4, 0.9), linear, 5*cexp(I*carg(global.plr.pos - c->pos)));
|
||||
create_projectile1c("rice", c->pos - 60, rgb(0.3, 0.4, 0.9), linear, 5*cexp(I*carg(global.plr.pos - c->pos)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void cirno_pfreeze_bg(Boss *c, int time) {
|
||||
glColor4f(0.5,0.5,0.5,1);
|
||||
fill_screen(time/700.0, time/700.0, 1, "cirnobg");
|
||||
fill_screen(time/700.0, time/700.0, 1, "stage0/cirnobg");
|
||||
glColor4f(0.7,0.7,0.7,0.5);
|
||||
fill_screen(-time/700.0 + 0.5, time/700.0+0.5, 0.4, "cirnobg");
|
||||
fill_screen(0, -time/100.0, 0, "snowlayer");
|
||||
fill_screen(-time/700.0 + 0.5, time/700.0+0.5, 0.4, "stage0/cirnobg");
|
||||
fill_screen(0, -time/100.0, 0, "stage0/snowlayer");
|
||||
|
||||
glColor4f(1,1,1,1);
|
||||
}
|
||||
|
@ -199,14 +150,85 @@ Boss *create_cirno() {
|
|||
return cirno;
|
||||
}
|
||||
|
||||
|
||||
void stage0_fairy0(Enemy *e, int time) {
|
||||
TIMER(&time);
|
||||
AT(EVENT_DEATH) {
|
||||
create_item(e->pos, 6*cexp(I*rand()), Power);
|
||||
return;
|
||||
}
|
||||
|
||||
FROM_TO(0, 60, 1)
|
||||
e->pos += 2I;
|
||||
|
||||
AT(60) {
|
||||
int i = 0;
|
||||
for(i = -1; i <= 1; i++)
|
||||
create_projectile1c("ball", e->pos, rgb(0.2, 0.3, 0.5), linear, 4*cexp(I*(carg(global.plr.pos - e->pos) + 0.2*i)));
|
||||
|
||||
e->moving = 1;
|
||||
e->dir = creal(e->args[0]) < 0;
|
||||
|
||||
e->pos0 = e->pos;
|
||||
}
|
||||
|
||||
FROM_TO(70, 900, 1)
|
||||
e->pos = e->pos0 + (0.04*e->args[0] + 0.06I)*_i*_i;
|
||||
}
|
||||
|
||||
void stage0_statfairy1(Enemy *e, int time) {
|
||||
TIMER(&time);
|
||||
AT(EVENT_DEATH) {
|
||||
create_item(e->pos, 6*cexp(I*rand()), Power);
|
||||
create_item(e->pos, 6*cexp(I*rand()), Power);
|
||||
create_item(e->pos, 6*cexp(I*rand()), Point);
|
||||
return;
|
||||
}
|
||||
|
||||
e->pos += e->args[0];
|
||||
|
||||
|
||||
FROM_TO(60,100,2) {
|
||||
e->args[0] = 0.5*e->args[0];
|
||||
create_projectile1c("rice", e->pos, rgb(0.2, 0.4, 0.8), linear, 3*cexp(I*M_PI/10*_i));
|
||||
}
|
||||
|
||||
FROM_TO(90, 500, 60) {
|
||||
int i;
|
||||
for(i = 4; i < 8; i++)
|
||||
create_projectile1c("ball", e->pos, rgb(0.2,0.4,0.8), linear, i*cexp(I*carg(global.plr.pos- e->pos)));
|
||||
}
|
||||
|
||||
FROM_TO(500, 900, 1)
|
||||
e->args[0] += 0.03*e->args[1] - 0.04I;
|
||||
}
|
||||
|
||||
void Swirl(Enemy *e, int t) {
|
||||
glPushMatrix();
|
||||
glTranslatef(creal(e->pos), cimag(e->pos),0);
|
||||
glRotatef(t*15,0,0,1);
|
||||
draw_texture(0,0, "swirl");
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
void stage0_events() {
|
||||
if(global.dialog)
|
||||
return;
|
||||
if(global.timer == 200)
|
||||
global.dialog = test_dialog();
|
||||
if(global.timer == 300)
|
||||
global.boss = create_cirno();
|
||||
if(global.boss == NULL && !(global.timer % 100)) create_enemy(&global.enemies, Fairy, simpleEnemy, 0 + I*100, 3, NULL, 2);
|
||||
|
||||
TIMER(&global.timer);
|
||||
|
||||
FROM_TO(100, 160, 25) {
|
||||
create_enemy1c(VIEWPORT_W/2 + 70, 8, Fairy, stage0_fairy0, 1);
|
||||
create_enemy1c(VIEWPORT_W/2 - 70, 8, Fairy, stage0_fairy0, -1);
|
||||
}
|
||||
|
||||
FROM_TO(240, 300, 30) {
|
||||
create_enemy1c(70 + _i*40, 8, Fairy, stage0_fairy0, -1);
|
||||
create_enemy1c(VIEWPORT_W - (70 + _i*40), 8, Fairy, stage0_fairy0, 1);
|
||||
}
|
||||
|
||||
FROM_TO(400, 460, 50)
|
||||
create_enemy2c(VIEWPORT_W*_i + VIEWPORT_H/3*I, 15, Swirl, stage0_statfairy1, 2-4*_i-0.3I, 1-2*_i);
|
||||
|
||||
// if(!(global.timer % 100))
|
||||
// create_laser(LaserCurve, 300, 300, 60, 500, ((ColorA){0.6,0.6,1,0.4}), lolsin, 0);
|
||||
|
|