Merge branch 'master' into gamepad
This commit is contained in:
commit
98225b78fd
6 changed files with 58 additions and 20 deletions
|
@ -70,7 +70,8 @@ enum {
|
|||
GAMEOVER_DEFEAT = 1,
|
||||
GAMEOVER_WIN,
|
||||
GAMEOVER_ABORT,
|
||||
GAMEOVER_REWATCH
|
||||
GAMEOVER_REWATCH,
|
||||
GAMEOVER_RESTART
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
|
13
src/main.c
13
src/main.c
|
@ -101,13 +101,18 @@ int main(int argc, char** argv) {
|
|||
global.diff = atoi(argv[2]);
|
||||
}
|
||||
|
||||
init_player(&global.plr);
|
||||
StageInfo* stg = stage_get(atoi(argv[1]));
|
||||
|
||||
if(stg) {
|
||||
printf("** Entering %s.\n", stg->title);
|
||||
stg->loop();
|
||||
return 1;
|
||||
|
||||
do {
|
||||
global.game_over = 0;
|
||||
init_player(&global.plr);
|
||||
stg->loop();
|
||||
} while(global.game_over == GAMEOVER_RESTART);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("** Invalid stage number. Quitting stage skip mode.\n");
|
||||
|
@ -119,5 +124,5 @@ int main(int argc, char** argv) {
|
|||
printf("-- menu\n");
|
||||
main_menu_loop(&menu);
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,8 @@ void give_up(void *arg) {
|
|||
global.game_over = (MAX_CONTINUES - global.plr.continues)? GAMEOVER_ABORT : GAMEOVER_DEFEAT;
|
||||
}
|
||||
|
||||
void restart_game(void *arg);
|
||||
|
||||
void create_gameover_menu(MenuData *m) {
|
||||
create_menu(m);
|
||||
|
||||
|
@ -41,6 +43,7 @@ void create_gameover_menu(MenuData *m) {
|
|||
int c = MAX_CONTINUES - global.plr.continues;
|
||||
snprintf(s, sizeof(s), "Continue (%i)", c);
|
||||
add_menu_entry(m, s, c? continue_game : NULL, NULL);
|
||||
add_menu_entry(m, "Restart the Game", restart_game, NULL)->transition = TransFadeBlack;
|
||||
add_menu_entry(m, c? "Give up" : "Return to Title", give_up, NULL)->transition = TransFadeBlack;
|
||||
|
||||
if(!c)
|
||||
|
|
|
@ -16,12 +16,17 @@ void return_to_game(void *arg) {
|
|||
void return_to_title(void *arg) {
|
||||
global.game_over = GAMEOVER_ABORT;
|
||||
}
|
||||
|
||||
|
||||
void restart_game(void *arg) {
|
||||
global.game_over = GAMEOVER_RESTART;
|
||||
}
|
||||
|
||||
void create_ingame_menu(MenuData *m) {
|
||||
create_menu(m);
|
||||
m->flags = MF_Abortable | MF_Transient;
|
||||
m->transition = NULL;
|
||||
add_menu_entry(m, "Return to Game", return_to_game, NULL);
|
||||
add_menu_entry(m, "Restart the Game", restart_game, NULL)->transition = TransFadeBlack;
|
||||
add_menu_entry(m, "Return to Title", return_to_title, NULL)->transition = TransFadeBlack;
|
||||
}
|
||||
|
||||
|
@ -86,4 +91,4 @@ void draw_ingame_menu(MenuData *menu) {
|
|||
|
||||
int ingame_menu_loop(MenuData *m) {
|
||||
return menu_loop(m, NULL, draw_ingame_menu, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
void start_story(void *arg) {
|
||||
MenuData m;
|
||||
|
||||
|
||||
init_player(&global.plr);
|
||||
|
||||
troll:
|
||||
|
@ -37,6 +37,10 @@ troll:
|
|||
|
||||
replay_init(&global.replay);
|
||||
|
||||
int chr = global.plr.cha;
|
||||
int sht = global.plr.shot;
|
||||
|
||||
troll2:
|
||||
if(arg)
|
||||
((StageInfo*)arg)->loop();
|
||||
else {
|
||||
|
@ -45,6 +49,17 @@ troll:
|
|||
stages[i].loop();
|
||||
}
|
||||
|
||||
if(global.game_over == GAMEOVER_RESTART) {
|
||||
init_player(&global.plr);
|
||||
replay_destroy(&global.replay);
|
||||
replay_init(&global.replay);
|
||||
global.game_over = 0;
|
||||
init_player(&global.plr);
|
||||
global.plr.cha = chr;
|
||||
global.plr.shot = sht;
|
||||
goto troll2;
|
||||
}
|
||||
|
||||
if(global.replay.active) {
|
||||
switch(tconfig.intval[SAVE_RPY]) {
|
||||
case 0: break;
|
||||
|
|
|
@ -17,7 +17,7 @@ Dialog *stage3_dialog(void) {
|
|||
dadd_msg(d, Left, "Ugh, it's like bugs being attracted by the light...");
|
||||
dadd_msg(d, Right, "That's right! The light makes us strong!");
|
||||
dadd_msg(d, Right, "This place is full of it, so feel my tremendous power!");
|
||||
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
|
@ -169,33 +169,37 @@ int stage3_cornerfairy(Enemy *e, int t) {
|
|||
e->unbombable = True;
|
||||
}
|
||||
|
||||
FROM_TO(0, 60, 1)
|
||||
FROM_TO(0, 120, 1)
|
||||
GO_TO(e, e->args[0], 0.01)
|
||||
|
||||
FROM_TO(60, 120, 1) {
|
||||
GO_TO(e, e->args[1], 0.05)
|
||||
int d = (D_Lunatic - global.diff + 2);
|
||||
FROM_TO(120, 240, 1) {
|
||||
GO_TO(e, e->args[1], 0.025 * min((t - 120) / 42.0, 1))
|
||||
int d = 5; //(D_Lunatic - global.diff + 3);
|
||||
if(!(t % d)) {
|
||||
float i; for(i = -M_PI; i <= M_PI; i += (e->args[2]? 0.3 : 1.0)) {
|
||||
float c = 0.25 + 0.25 * sin(t / 5.0);
|
||||
int i, cnt = 10 + global.diff * 1.5;
|
||||
|
||||
for(i = 0; i < cnt; ++i) {
|
||||
float c = 0.5 + 0.5 * sin(t / 15.0);
|
||||
|
||||
create_projectile2c("thickrice", e->pos, rgb(1.0 - c, 0.6, 0.5 + c), asymptotic,
|
||||
create_projectile2c(cabs(e->args[2])? "wave" : "thickrice", e->pos, cabs(e->args[2])? rgb(0.5 - c*0.2, 0.3 + c*0.7, 1.0) : rgb(1.0 - c*0.5, 0.6, 0.5 + c*0.5), asymptotic,
|
||||
//2*cexp(I*(carg(global.plr.pos - e->pos) + i)),
|
||||
2*cexp(I*(i+carg((VIEWPORT_W+I*VIEWPORT_H)/2 - e->pos))),
|
||||
(global.diff > D_Normal? 2 : 1.5)*cexp(I*((2*i*M_PI/cnt)+carg((VIEWPORT_W+I*VIEWPORT_H)/2 - e->pos))),
|
||||
1.5
|
||||
);
|
||||
|
||||
/*
|
||||
if(global.diff > D_Normal && !(t % 5) && !e->args[2]) {
|
||||
create_projectile2c("flea", e->pos, rgb(1.0, 0.5, 0.5), asymptotic,
|
||||
2*cexp(I*(carg(global.plr.pos - e->pos) + i)),
|
||||
1.5
|
||||
);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AT(180)
|
||||
AT(260)
|
||||
e->hp = 0;
|
||||
|
||||
return 0;
|
||||
|
@ -768,6 +772,9 @@ Boss* stage3_create_boss(void) {
|
|||
void stage3_events(void) {
|
||||
TIMER(&global.timer);
|
||||
|
||||
// AT(0)
|
||||
// global.timer = 4300;
|
||||
|
||||
FROM_TO(160, 300, 10) {
|
||||
tsrand_fill(3);
|
||||
create_enemy1c(VIEWPORT_W/2 + 20 * anfrand(0) + (VIEWPORT_H/4 + 20 * anfrand(1))*I, 200, Swirl, stage3_enterswirl, I * 3 + anfrand(2) * 3);
|
||||
|
@ -786,7 +793,8 @@ void stage3_events(void) {
|
|||
create_enemy1c(VIEWPORT_W/2 + (VIEWPORT_H/3)*I, 10000, BigFairy, stage3_bigfairy, 1);
|
||||
}
|
||||
|
||||
FROM_TO(2400, 2620, 130) {
|
||||
//FROM_TO(2400, 2620, 130) {
|
||||
AT(2400) {
|
||||
double offs = -50;
|
||||
|
||||
complex p1 = 0+0I;
|
||||
|
@ -824,7 +832,8 @@ void stage3_events(void) {
|
|||
create_enemy2c(20 + (VIEWPORT_H+20)*I, 50, Swirl, stage3_bitchswirl, 1, 1);
|
||||
}
|
||||
|
||||
FROM_TO(4330, 4460, 130) {
|
||||
//FROM_TO(4330, 4460, 130) {
|
||||
AT(4330) {
|
||||
double offs = -50;
|
||||
|
||||
complex p1 = 0+0I;
|
||||
|
|
Loading…
Reference in a new issue