struct games_state *rs,
This commit is contained in:
@@ -295,7 +295,7 @@ static void tg_hold(struct games_state *rs,tetris_game *obj)
|
|||||||
/*
|
/*
|
||||||
Perform the action specified by the move.
|
Perform the action specified by the move.
|
||||||
*/
|
*/
|
||||||
static void tg_handle_move(tetris_game *obj, tetris_move move)
|
static void tg_handle_move(struct games_state *rs,tetris_game *obj, tetris_move move)
|
||||||
{
|
{
|
||||||
switch (move) {
|
switch (move) {
|
||||||
case TM_LEFT:
|
case TM_LEFT:
|
||||||
@@ -305,7 +305,7 @@ static void tg_handle_move(tetris_game *obj, tetris_move move)
|
|||||||
tg_move(obj, 1);
|
tg_move(obj, 1);
|
||||||
break;
|
break;
|
||||||
case TM_DROP:
|
case TM_DROP:
|
||||||
tg_down(obj);
|
tg_down(rs,obj);
|
||||||
break;
|
break;
|
||||||
case TM_CLOCK:
|
case TM_CLOCK:
|
||||||
tg_rotate(obj, 1);
|
tg_rotate(obj, 1);
|
||||||
@@ -314,7 +314,7 @@ static void tg_handle_move(tetris_game *obj, tetris_move move)
|
|||||||
tg_rotate(obj, -1);
|
tg_rotate(obj, -1);
|
||||||
break;
|
break;
|
||||||
case TM_HOLD:
|
case TM_HOLD:
|
||||||
tg_hold(obj);
|
tg_hold(rs,obj);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// pass
|
// pass
|
||||||
@@ -420,7 +420,7 @@ bool tg_tick(struct games_state *rs,tetris_game *obj, tetris_move move)
|
|||||||
tg_do_gravity_tick(rs,obj);
|
tg_do_gravity_tick(rs,obj);
|
||||||
|
|
||||||
// Handle input.
|
// Handle input.
|
||||||
tg_handle_move(obj, move);
|
tg_handle_move(rs,obj, move);
|
||||||
|
|
||||||
// Check for cleared lines
|
// Check for cleared lines
|
||||||
lines_cleared = tg_check_lines(obj);
|
lines_cleared = tg_check_lines(obj);
|
||||||
@@ -444,7 +444,7 @@ void tg_init(struct games_state *rs,tetris_game *obj, int rows, int cols)
|
|||||||
obj->lines_remaining = LINES_PER_LEVEL;
|
obj->lines_remaining = LINES_PER_LEVEL;
|
||||||
//srand(time(NULL));
|
//srand(time(NULL));
|
||||||
tg_new_falling(rs,obj);
|
tg_new_falling(rs,obj);
|
||||||
tg_new_falling(ts,obj);
|
tg_new_falling(rs,obj);
|
||||||
obj->stored.typ = -1;
|
obj->stored.typ = -1;
|
||||||
obj->stored.ori = 0;
|
obj->stored.ori = 0;
|
||||||
obj->stored.loc.row = 0;
|
obj->stored.loc.row = 0;
|
||||||
@@ -728,9 +728,9 @@ int tetris(int argc, char **argv)
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
} else {
|
} else {
|
||||||
// Otherwise create new game.
|
// Otherwise create new game.
|
||||||
tg = tg_create(22, 10);
|
tg = tg_create(rs,22, 10);
|
||||||
}*/
|
}*/
|
||||||
tg = tg_create(22, 10);
|
tg = tg_create(rs,22, 10);
|
||||||
|
|
||||||
// NCURSES initialization:
|
// NCURSES initialization:
|
||||||
initscr(); // initialize curses
|
initscr(); // initialize curses
|
||||||
|
|||||||
Reference in New Issue
Block a user