~sebsite/generic-tetromino-game

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

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

Lorenz (xha) <me@xha.li>
Details
Message ID
<20230318073340.2627-1-me@xha.li>
DKIM signature
pass
Download raw message
Patch: +16 -5
---
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
Details
Message ID
<CRANFC7DHG4K.3SNJXNR5CRV6W@notmylaptop>
In-Reply-To
<20230318073340.2627-1-me@xha.li> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To gitsrht:~sebsite/generic-tetromino-game
   1b12953..9d76790  main -> main
Reply to thread Export thread (mbox)