*************/
void IntroScreen(); //Show introduction screen and menu
int CheckCollision(); //See if Pacman and Ghosts collided
-void CheckScreenSize(); //Make sure resolution is at least 32x29
+void CheckScreenSize(); //Make sure resolution is at least 33x29
void CreateWindows(int y, int x, int y0, int x0); //Make ncurses windows
void Delay(); //Slow down game for better control
void DrawWindow(); //Refresh display
int Food = 0; //Number of pellets left in level
int Level[29][28] = { 0 }; //Main level array
int LevelNumber = 0; //What level number are we on?
+int HiPoints = 0; //Highscore
+int HiLevelNumber = 0; //Level number reached by hiscore
int GhostsInARow = 0; //Keep track of how many points to give for eating ghosts
int tleft = 0; //How long left for invincibility
InitCurses(); //Must be called to start ncurses
CheckScreenSize(); //Make sure screen is big enough
- CreateWindows(29, 28, 1, 1); //Create the main and status windows
+ CreateWindows(30, 28, 1, 1); //Create the main and status windows
curses_initialized = true;
(void)atexit(Cleanup);
//Make sure the window is big enough
int h, w; getmaxyx(stdscr, h, w);
- if((h < 32) || (w < 29)) {
+ if((h < 33) || (w < 29)) {
endwin();
fprintf(stderr, "\nSorry.\n");
- fprintf(stderr, "To play Pacman for Console, your console window must be at least 29x32\n");
+ fprintf(stderr, "To play Pacman for Console, your console window must be at least 29x33\n");
fprintf(stderr, "Please resize your window/resolution and re-run the game.\n\n");
exit(0);
}
int GameOverScreen() {
char chr = ' ';
int a, b;
+
+ if (Points > HiPoints) {
+ HiPoints = Points;
+ HiLevelNumber = LevelNumber;
+ }
+
for(a = 0; a < 29; a++) for(b = 0; b < 28; b++) {
mvwaddch(win, a, b, chr);
}
void CreateWindows(int y, int x, int y0, int x0) {
//Create two new windows, for status bar and for main level
win = newwin(y, x, y0, x0);
- status = newwin(3, 27, 29, 1);
+ status = newwin(4, 27, 29, 1);
}
/****************************************************************
//Display level number and score
wattron(status, COLOR_PAIR(Normal));
- mvwprintw(status, 2, 2, "Level: %d Score: %d ", LevelNumber, Points);
+ mvwprintw(status, 2, 3, "Level: %02d Score: %06d ", LevelNumber, Points);
+ if (HiPoints > 0) {
+ wattron(status, COLOR_PAIR(Pacman));
+ mvwprintw(status, 3, 0, "Hi Level: %02d Score: %06d",
+ HiLevelNumber, HiPoints);
+ }
wrefresh(status); //Update status window