~sebsite/generic-tetromino-game

Options: Fix going to the next page when there are no useroptions v3 APPLIED

Lorenz (xha): 1
 Options: Fix going to the next page when there are no useroptions

 1 files changed, 16 insertions(+), 5 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sebsite/generic-tetromino-game/patches/39819/mbox | git am -3
Learn more about email & git

[PATCH v3] Options: Fix going to the next page when there are no useroptions Export this patch

---
This should fix it for the controller aswell. I only tried it with the
keyboard previously. Playing with a controller is really 1000 times
better, didn't thought it would be so much more fun ;-)
 main.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/main.c b/main.c
index 32ffee8..d440e23 100644
--- a/main.c
+++ b/main.c
@@ -7697,7 +7697,7 @@ optionsinput(uint8_t inputs)
				|| state.options.pos == 19) {
			if (state.options.page == state.options.userlen / 20 + 1) {
				state.options.page = 0;
			} else {
			} else if (state.options.userlen > 0) {
				++state.options.page;
			}
			draw_options_page();
@@ -7711,8 +7711,12 @@ optionsinput(uint8_t inputs)
		if (state.options.pos == 0) {
			uint8_t pos;
			if (state.options.page == 0) {
				state.options.page = state.options.userlen / 20 + 1;
				pos = MIN(19, state.options.userlen % 20 - 1);
				if (state.options.userlen > 0) {
					state.options.page = state.options.userlen / 20 + 1;
					pos = MIN(19, state.options.userlen % 20 - 1);
				} else {
					pos = OPT_LAST;
				}
			} else {
				--state.options.page;
				pos = state.options.page > 0 ? 19 : OPT_LAST;
@@ -7739,19 +7743,26 @@ optionsinput(uint8_t inputs)
	if (inputs & INPUT_MASK_FLIP_CW) {
		if (state.options.page == state.options.userlen / 20 + 1) {
			state.options.page = 0;
		} else {
		} else if (state.options.userlen > 0) {
			++state.options.page;
		}
		draw_options_page();
		play_sfx(SFX_LVLBLIP, 0);
	}
	if (inputs & INPUT_MASK_FLIP_CCW) {
		uint8_t pos = 0;
		if (state.options.page == 0) {
			state.options.page = state.options.userlen / 20 + 1;
			if (state.options.userlen > 0) {
				state.options.page = state.options.userlen / 20 + 1;
			} else {
				pos = OPT_LAST;
			}
		} else {
			--state.options.page;
		}
		draw_options_page();
		state.options.pos = pos;
		optionsupdate();
		play_sfx(SFX_LVLBLIP, 0);
	}
	if (inputs & INPUT_MASK_START) {
-- 
2.38.4
Thanks!

To gitsrht:~sebsite/generic-tetromino-game
   1b12953..9d76790  main -> main