~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 v2] when pressing right or left during the soft drop, cancel it.

Lorenz (xha) <me@xha.li>
Details
Message ID
<20230609160755.18727-1-me@xha.li>
DKIM signature
missing
Download raw message
Patch: +6 -1
this replicates the behavior of nes tetris.
---
 main.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c
index 07e9959..d13edcd 100644
--- a/main.c
+++ b/main.c
@@ -7608,7 +7608,12 @@ gameinput(const uint8_t inputs[static 4][2], uint8_t i)
				}
			} else if ((held & INPUT_MASK_DOWN) != 0
					&& g->softdrop > 0) {
				++g->softdrop;
				if  (pressed & (INPUT_MASK_RIGHT | INPUT_MASK_LEFT)) {
					/* cancel softdrop when left or right is pressed */
					g->softdrop = 0;
				} else {
					++g->softdrop;
				}
			} else if (pressed & INPUT_MASK_UP) {
				/* TODO */
			} else {
-- 
2.41.0
Details
Message ID
<CT9GGYQ6VED6.28KK6BRF025ND@notmylaptop>
In-Reply-To
<20230609160755.18727-1-me@xha.li> (view parent)
DKIM signature
missing
Download raw message
So I tested this, and this isn't entirely correct. In NES Tetris,
pressing left or right when holding down cancels the softdrop, but also
doesn't shift the piece (even if left/right is held down). Not sure how
easy/difficult this will be to implement, feel free to restructure some
stuff if it makes things cleaner.
Reply to thread Export thread (mbox)