-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding filesaving and restoring functionality, bugfixes, and a bunch
more This is a big one. * utils.h and utils.c created so game driver and unit tests can share same helper functions (DRY) * sleep_millis and print_board_state moved to utils * created debug flags for debug window in game, and made this and several other things into CMake options * options like DEBUG_T_WIN moved to CMake * changed gamesave function to save board in MUCH easier to parse format * used inih library to write parser for saved game states. * wrote tests for parser to verify correct functionality * added first saved game state to ./test/files/ for unit testing purposes - this way I can run tests against actual saved game states. * broke up check_and_spawn_new_piece with new function check_and_clear_rows to make testing easier, and keep function length under 1 pg * wrote first test for check_and_clear_rows * clearing rows now works in-game! * fixed bug where highest row would be changed to whatever the highest row of the last active_piece was * fixed check_game_over condition in tg_tick() to prevent exiting when game *isn't* over * updated issues with piece positioning that was causing weird in-game rotations
- Loading branch information
Showing
18 changed files
with
581 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef UTILS_H | ||
#define UTILS_H | ||
|
||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
|
||
#include <time.h> // sleep, timespec | ||
#include <sys/time.h> | ||
|
||
#include <assert.h> | ||
#include <ncurses.h> | ||
|
||
#include "ini.h" | ||
|
||
#include "tetris.h" | ||
#include "display.h" | ||
|
||
|
||
bool restore_game_state(TetrisGame *tg, const char* filename, FILE *gamelog); | ||
|
||
|
||
void reconstruct_board_from_str_row(TetrisBoard *tb, const char *name, const char *value); | ||
void print_board_state(TetrisBoard tb, FILE *file); | ||
|
||
void sleep_millis(uint16_t millis); | ||
|
||
|
||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.