Fix silly t-twist mistake

This commit is contained in:
Dusk 2022-07-16 14:59:59 +02:00
parent 825bf1a499
commit 7da3ce5592
2 changed files with 2 additions and 8 deletions

View File

@ -112,20 +112,17 @@ pub fn tick(self: *Self) State {
if (self.action_list[@enumToInt(Action.Offset.right)].holding) {
if (!self.timer_right_das.started) {
self.timer_right_das.start();
std.debug.print("Starting DAS\n", .{});
}
} else {
// Stop both
self.timer_right_das.stop();
self.timer_right_arr.stop();
std.debug.print("Stopping\n", .{});
}
// ARR
if (self.timer_right_das.finished()) {
if (!self.timer_right_arr.started) {
self.timer_right_arr.start();
std.debug.print("Starting ARR\n", .{});
} else if (self.timer_right_arr.finished()) {
self.timer_right_arr.stop();
self.action_list[@enumToInt(Action.Offset.right)].holding = false;
@ -138,20 +135,17 @@ pub fn tick(self: *Self) State {
if (self.action_list[@enumToInt(Action.Offset.left)].holding) {
if (!self.timer_left_das.started) {
self.timer_left_das.start();
std.debug.print("Starting DAS\n", .{});
}
} else {
// Stop both
self.timer_left_das.stop();
self.timer_left_arr.stop();
std.debug.print("Stopping\n", .{});
}
// ARR
if (self.timer_left_das.finished()) {
if (!self.timer_left_arr.started) {
self.timer_left_arr.start();
std.debug.print("Starting ARR\n", .{});
} else if (self.timer_left_arr.finished()) {
self.timer_left_arr.stop();
self.action_list[@enumToInt(Action.Offset.left)].holding = false;

View File

@ -124,7 +124,7 @@ pub fn kick(grid: Grid, piece: Piece, prev_piece: Piece) Piece {
// Test 1
if (!checkCollision(grid, new_piece)) {
// T TWIST DETECTION
_ = checkTTwist(grid, piece);
_ = checkTTwist(grid, new_piece);
return new_piece;
}
@ -183,7 +183,7 @@ pub fn kick(grid: Grid, piece: Piece, prev_piece: Piece) Piece {
new_piece.row += offset[1];
if (!checkCollision(grid, new_piece)) {
// T TWIST DETECTION
_ = checkTTwist(grid, piece);
_ = checkTTwist(grid, new_piece);
return new_piece;
}
new_piece.col -= offset[0];