From 84db15759bba8be2c4e11e70d0f9e340628ab351 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sun, 30 Dec 2018 01:35:58 +0100 Subject: [PATCH] Fixed piece rotations to match NES tetris. --- src/test/kc/examples/tetris/tetris-pieces.kc | 56 ++++++++++---------- src/test/kc/examples/tetris/tetris-play.kc | 2 +- src/test/kc/examples/tetris/tetris-render.kc | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/test/kc/examples/tetris/tetris-pieces.kc b/src/test/kc/examples/tetris/tetris-pieces.kc index 5c6c757d9..d2811da8b 100644 --- a/src/test/kc/examples/tetris/tetris-pieces.kc +++ b/src/test/kc/examples/tetris/tetris-pieces.kc @@ -2,24 +2,24 @@ // The T-piece align($40) byte[4*4*4] PIECE_T = { - 1, 1, 1, 0, + 0, 0, 0, 0, + 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, + + 0, 1, 0, 0, + 1, 1, 0, 0, + 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, - 0, 1, 1, 0, - 0, 0, 1, 0, - 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, - 1, 0, 0, 0, - 1, 1, 0, 0, - 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 1, 1, 0, + 0, 1, 0, 0, 0, 0, 0, 0 }; @@ -30,9 +30,9 @@ align($40) byte[4*4*4] PIECE_S = { 1, 1, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, - 1, 1, 0, 0, 0, 1, 0, 0, + 0, 1, 1, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -40,9 +40,9 @@ align($40) byte[4*4*4] PIECE_S = { 1, 1, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, - 1, 1, 0, 0, 0, 1, 0, 0, + 0, 1, 1, 0, + 0, 0, 1, 0, 0, 0, 0, 0 }; @@ -54,9 +54,9 @@ align($40) byte[4*4*4] PIECE_Z = { 0, 1, 1, 0, 0, 0, 0, 0, + 0, 0, 1, 0, + 0, 1, 1, 0, 0, 1, 0, 0, - 1, 1, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -64,9 +64,9 @@ align($40) byte[4*4*4] PIECE_Z = { 0, 1, 1, 0, 0, 0, 0, 0, + 0, 0, 1, 0, + 0, 1, 1, 0, 0, 1, 0, 0, - 1, 1, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0 }; @@ -121,24 +121,24 @@ align($40) byte[4*4*4] PIECE_J = { // The O-piece align($40) byte[4*4*4] PIECE_O = { - 1, 1, 0, 0, - 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 0, + 0, 1, 1, 0, 0, 0, 0, 0, - 1, 1, 0, 0, - 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 0, + 0, 1, 1, 0, 0, 0, 0, 0, - 1, 1, 0, 0, - 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 0, + 0, 1, 1, 0, 0, 0, 0, 0, - 1, 1, 0, 0, - 1, 1, 0, 0, 0, 0, 0, 0, + 0, 1, 1, 0, + 0, 1, 1, 0, 0, 0, 0, 0 }; @@ -173,5 +173,5 @@ word[] PIECES = { (word)PIECE_T, (word)PIECE_S, (word)PIECE_Z, (word)PIECE_J, (w // The chars to use for the different pieces byte[] PIECES_CHARS = { $64, $65, $a5, $65, $64, $64, $a5 }; // The initial X/Y for each piece -byte[] PIECES_START_X = { 4, 4, 4, 4, 4, 3, 4}; -byte[] PIECES_START_Y = { 2, 1, 1, 1, 2, 0, 1}; \ No newline at end of file +byte[] PIECES_START_X = { 4, 4, 4, 4, 4, 4, 4 }; +byte[] PIECES_START_Y = { 1, 1, 1, 1, 2, 1, 1 }; \ No newline at end of file diff --git a/src/test/kc/examples/tetris/tetris-play.kc b/src/test/kc/examples/tetris/tetris-play.kc index 09c5458a1..54fb6bad8 100644 --- a/src/test/kc/examples/tetris/tetris-play.kc +++ b/src/test/kc/examples/tetris/tetris-play.kc @@ -239,7 +239,7 @@ void play_update_score(byte removed) { if(removed!=0){ dword add_bcd = score_add_bcd[removed<<2]; asm { sed } - score_bcd += add_bcd; + score_bcd += add_bcd; asm { cld } } } diff --git a/src/test/kc/examples/tetris/tetris-render.kc b/src/test/kc/examples/tetris/tetris-render.kc index 72489226d..b3f290b84 100644 --- a/src/test/kc/examples/tetris/tetris-render.kc +++ b/src/test/kc/examples/tetris/tetris-render.kc @@ -79,7 +79,7 @@ void render_screen_swap() { void render_score() { const byte ZERO_CHAR = 51; byte SCREEN_SCORE_ROW = $05; - byte SCREEN_SCORE_COL = $1d; + byte SCREEN_SCORE_COL = $21; byte* screen_score_pos; if(render_screen_render==0) { screen_score_pos = PLAYFIELD_SCREEN_1 + 40*SCREEN_SCORE_ROW + SCREEN_SCORE_COL;