Special rules for spell practice mode stages

This commit is contained in:
Andrei "Akari" Alexeyev 2017-02-10 23:26:46 +02:00 committed by Martin Herkt
parent 1e6011433c
commit 16cbec9ca1
3 changed files with 37 additions and 14 deletions

View file

@ -76,7 +76,10 @@ void process_items(void) {
r *= 2;
while(item != NULL) {
if(item->type == Power && global.plr.power >= PLR_MAXPOWER) {
if((item->type == Power && global.plr.power >= PLR_MAXPOWER) ||
// just in case we ever have some weird spell that spawns those...
(global.stage->type == STAGE_SPELL && (item->type == Life || item->type == Bomb))
) {
item->type = Point;
}

View file

@ -39,15 +39,23 @@ void create_gameover_menu(MenuData *m) {
m->flags = MF_Transient | MF_AlwaysProcessInput;
m->transition = NULL;
m->context = "Game Over";
char s[64];
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(global.stage->type == STAGE_SPELL) {
m->context = "Spell Failed";
if(!c)
m->cursor = 1;
add_menu_entry(m, "Retry", restart_game, NULL)->transition = TransFadeBlack;
add_menu_entry(m, "Give up", give_up, NULL)->transition = TransFadeBlack;
} else {
m->context = "Game Over";
char s[64];
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)
m->cursor = 1;
}
}

View file

@ -402,11 +402,18 @@ void draw_hud(void) {
draw_text(AL_Center, 0, 0, diff, _fonts.mainmenu);
glPopMatrix();
for(i = 0; i < global.plr.lifes; i++)
draw_texture(16*i,167, "star");
if(global.stage->type == STAGE_SPELL) {
glColor4f(1, 1, 1, 0.7);
draw_text(AL_Left, -6, 167, "N/A", _fonts.standard);
draw_text(AL_Left, -6, 200, "N/A", _fonts.standard);
glColor4f(1, 1, 1, 1.0);
} else {
for(i = 0; i < global.plr.lifes; i++)
draw_texture(16*i,167, "star");
for(i = 0; i < global.plr.bombs; i++)
draw_texture(16*i,200, "star");
for(i = 0; i < global.plr.bombs; i++)
draw_texture(16*i,200, "star");
}
sprintf(buf, "%.2f", global.plr.power / 100.0);
draw_text(AL_Center, 10, 236, buf, _fonts.standard);
@ -699,6 +706,11 @@ void stage_loop(StageRule start, StageRule end, StageRule draw, StageRule event,
}
printf("Random seed: %u\n", seed);
if(info->type == STAGE_SPELL) {
global.plr.lifes = 1;
global.plr.bombs = 0;
}
} else {
if(!global.replay_stage) {
errx(-1, "Attemped to replay a NULL stage");