From 249d37e7223b66f4f11612fc6ce94bff00d9122d Mon Sep 17 00:00:00 2001 From: Semphris Date: Mon, 6 Feb 2023 16:43:41 -0500 Subject: [PATCH] Add option to skip holes in Neverputt This adds an option to skip the hole in the pause menu, which avoids having to manually spend attempts to skip a hole. Skipping sets the score of all players to the maximum amount (including for players who already finished) and shows the scoreboard. --- putt/hole.c | 14 ++++++++++++++ putt/hole.h | 1 + putt/st_all.c | 8 +++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/putt/hole.c b/putt/hole.c index 881fa5cad..20f6743d0 100644 --- a/putt/hole.c +++ b/putt/hole.c @@ -368,6 +368,20 @@ void hole_stop(void) } } +void hole_skip(void) +{ + int maxscore = (score_v[hole][0] > 12 - 3) ? score_v[hole][0] + 3 : 12; + int i; + + for (i = 1; i <= party; i++) + { + score_v[hole][i] = maxscore; + stat_v[i] = 1; + } + + done = party; +} + void hole_fall(void) { audio_play(AUD_PENALTY, 1.0f); diff --git a/putt/hole.h b/putt/hole.h index aa106ac34..d9d63998d 100644 --- a/putt/hole.h +++ b/putt/hole.h @@ -31,6 +31,7 @@ int hole_next(void); int hole_move(void); void hole_goal(void); void hole_stop(void); +void hole_skip(void); void hole_fall(void); void hole_song(void); diff --git a/putt/st_all.c b/putt/st_all.c index 08bc8c78a..0b6c7055c 100644 --- a/putt/st_all.c +++ b/putt/st_all.c @@ -596,6 +596,7 @@ static struct state *st_quit; #define PAUSE_CONTINUE 1 #define PAUSE_QUIT 2 +#define PAUSE_SKIP 3 int goto_pause(struct state *s) { @@ -618,6 +619,10 @@ static int pause_action(int i) case PAUSE_CONTINUE: return goto_state(st_continue ? st_continue : &st_title); + case PAUSE_SKIP: + hole_skip(); + return goto_state(&st_score); + case PAUSE_QUIT: return goto_state(st_quit); } @@ -638,7 +643,8 @@ static int pause_enter(struct state *st, struct state *prev) if ((jd = gui_harray(id))) { gui_state(jd, _("Quit"), GUI_SML, PAUSE_QUIT, 0); - gui_start(jd, _("Continue"), GUI_SML, PAUSE_CONTINUE, 1); + gui_state(jd, _("Skip"), GUI_SML, PAUSE_SKIP, 1); + gui_start(jd, _("Continue"), GUI_SML, PAUSE_CONTINUE, 2); } gui_pulse(td, 1.2f);