Skip to content

Commit

Permalink
Prepared the game for 1.6 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Dantas committed Mar 4, 2013
1 parent ad88120 commit 16062bb
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 18 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
All the changes are documented on the git history, so here's just the major ones

04-03-13 v1.6:
* Gameplay: High scores! Can save and show them during the game.
* Bugs: Game now compiles and runs on MacOSX.

24-02-13 v1.5:
* Interface: Help window explaining controls, statistics showing
misc information about the game.
Expand Down
2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ directories:
/usr/local/bin/ Executable files
/usr/local/share/man/man6/ Man page
/var/games/ Highscore files
~/ User configuration file
~/ User configuration file

5) Advanced Installation
------------------------
Expand Down
3 changes: 2 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ To see more info, run 'yetris --help' and 'yetris --usage'.
z, x Rotates the piece counter-clockwise and clockwise
p Pauses the game
q Quits the game at any time
h Show help window.
r Restart game
h Show help window
F2 Switch statistics
F3 Show high scores
F5 Refresh game based on config file
Expand Down
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Things I must do later
* Save and restore game state
(binary file with info on all major game data structures)
(save with, idk, F10, and restore with --restore commandline)
** I'm actually doing this! Hopefully, will be done on the next version **

* Improve coding style
(document even more and clean stupid hacks on the code)
Expand Down
2 changes: 2 additions & 0 deletions doc/man/yetris.6
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ understanding and easing feature-implementation.

.BR "h " "Show help window"

.BR "r " "Restart game"

.BR "F2 " "Switch statistics"

.BR "F3 " "Show high scores"
Expand Down
41 changes: 25 additions & 16 deletions src/engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ void engine_draw(game_s* g)
engine_draw_info(g);
engine_draw_help();
break;

case HSCORES:
engine_draw_board(&(g->board));
engine_draw_info(g);
Expand Down Expand Up @@ -984,10 +985,12 @@ void engine_draw_gameover()
wnoutrefresh(w->win);
}

/** Tries to refresh all windows onscreen */
void engine_refresh_all_windows()
{
screen_s* s = &(engine.screen);

// NOT USING THIS MACRO NOW
#define fancy_borders_and_refresh(window) \
{ \
if (global.screen_fancy_borders) \
Expand All @@ -998,12 +1001,15 @@ void engine_refresh_all_windows()
}
wnoutrefresh(stdscr);
wnoutrefresh(s->main.win);
/* delwin(s->main.win); */
/* delwin(s->leftmost.win); */
/* delwin(s->middle_left.win); */
/* delwin(s->middle_right.win); */
/* delwin(s->rightmost.win); */
/* engine_windows_init(); */

// FOR NOW IT DELETES AND RECREATES THEM
// IS THERE A BETTER WAY?
delwin(s->main.win);
delwin(s->leftmost.win);
delwin(s->middle_left.win);
delwin(s->middle_right.win);
delwin(s->rightmost.win);
engine_windows_init();

}

Expand All @@ -1013,7 +1019,7 @@ void engine_create_help()
window_s w;

w.width = engine.screen.main.width - engine.screen.main.width/8;
w.height = engine.screen.main.height/2 + 2;
w.height = engine.screen.main.height/2 + 5;
w.x = engine.screen.main.width/2 - w.width/2 /* center */;
w.y = engine.screen.main.height/2 - w.height/2;
w.win = derwin(engine.screen.main.win, w.height, w.width, w.y, w.x);
Expand Down Expand Up @@ -1055,15 +1061,18 @@ void engine_draw_help()
mvwaddstr(w->win, 0, 2, "Controls:\n");
wattrset(w->win, engine_get_color(COLOR_WHITE, COLOR_BLACK, false));
mvwaddstr(w->win, 1, 0,
" Enter Return to the game\n"
" q Quits game at any time\n"
" Left, Right Controls the piece\n"
" Down Soft-drop\n"
" Space Hard-drop\n"
" c Holds the piece\n"
" z, x Rotates piece counter-clockwise and clockwise\n"
" p Pauses/unpauses the game\n"
" r Restarts the game\n");
" Enter Return to the game\n"
" q Quits game at any time\n"
" Left, Right Controls the piece\n"
" Down Soft-drop\n"
" Space Hard-drop\n"
" c Holds the piece\n"
" z, x Rotates piece counter-clockwise and clockwise\n"
" p Pauses/unpauses the game\n"
" r Restart game\n"
" F2 Switch statistics\n"
" F3 Show high scores\n"
" F5 Refresh game based on config file\n");

mvwaddstr(w->win,w->height - 1, 0, "For fun, check config file '~/.yetrisrc.ini'");
wnoutrefresh(w->win);
Expand Down
1 change: 1 addition & 0 deletions src/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ void engine_create_help();
void engine_delete_help();
void engine_draw_line_statistics(game_s* g);
void engine_draw_gameover_animation(game_s* g);
void engine_refresh_all_windows();

void engine_create_hscores_window();
void engine_draw_hscores();
Expand Down
1 change: 1 addition & 0 deletions src/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ void game_over(game_s* g)
timer_stop(&(g->global_timer));
if (global.game_has_game_over_animation)
engine_draw_gameover_animation(g);

hscore_handle(g);
hscore_save();

Expand Down
1 change: 1 addition & 0 deletions src/hscore.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void hscore_handle(game_s* g)
engine_draw_input();
engine_get_hscore_name(name, 10);
engine_delete_input();
engine_refresh_all_windows();

if (is_on_hscore_list(g->score))
{
Expand Down

0 comments on commit 16062bb

Please sign in to comment.