@ -1,11 +1,9 @@
# include <world.h>
# include <world.h>
# include <screen.h>
# include <stdlib.h>
# include <stdlib.h>
# include <string.h>
# include <string.h>
# include <weaponsSystem.h>
# include <weaponsSystem.h>
void drawViewport ( ) {
void drawViewport ( ) {
// box(viewportWin,0,0);
int i ;
int i ;
for ( i = 0 ; i < MAX_ITEMS ; i + + ) {
for ( i = 0 ; i < MAX_ITEMS ; i + + ) {
if ( allItems [ i ] . isAlive ) {
if ( allItems [ i ] . isAlive ) {
@ -55,13 +53,19 @@ void drawScore(){
void drawGameOverWin ( ) {
void drawGameOverWin ( ) {
getmaxyx ( stdscr , scrRows , scrCols ) ;
gameOverWin = newwin ( viewportWinRows / 2 , viewportWinCols / 2 , viewportWinRows / 4 , viewportWinCols / 4 ) ;
gameOverWin = newwin ( scrRows / 2 , scrCols / 2 , scrRows / 4 , scrCols / 4 ) ;
int gameOverWinRows , gameOverWinCols ;
int gameOverWinRows , gameOverWinCols ;
getmaxyx ( gameOverWin , gameOverWinRows , gameOverWinCols ) ;
getmaxyx ( gameOverWin , gameOverWinRows , gameOverWinCols ) ;
mvwprintw ( gameOverWin , 1 , ( gameOverWinCols - strlen ( " GAME OVER " ) ) / 2 , " %s " , " GAME OVER " ) ;
mvwprintw ( gameOverWin , 1 , ( gameOverWinCols - strlen ( " GAME OVER " ) ) / 2 , " %s " , " GAME OVER " ) ;
mvwprintw ( gameOverWin , ( gameOverWinRows / 2 ) - 1 , 1 , " Shots Fired: %i " , allEntities [ 0 ] . projectilesFired ) ;
mvwprintw ( gameOverWin , ( gameOverWinRows / 2 ) - 1 , 1 , " Shots Fired: %i " , allEntities [ 0 ] . projectilesFired ) ;
mvwprintw ( gameOverWin , ( gameOverWinRows / 2 ) , 1 , " Zombies Killed: %i " , allEntities [ 0 ] . killCount ) ;
mvwprintw ( gameOverWin , ( gameOverWinRows / 2 ) - 2 , 1 , " Zombies Killed: %i " , allEntities [ 0 ] . killCount ) ;
if ( allEntities [ 0 ] . projectilesFired ! = 0 ) {
float hitPercent = ( ( ( float ) allEntities [ 0 ] . hitCount / ( float ) allEntities [ 0 ] . projectilesFired ) * 100 ) ;
mvwprintw ( gameOverWin , ( gameOverWinRows / 2 ) , 1 , " Accuracy: %.0f%% " , hitPercent ) ;
}
else {
mvwprintw ( gameOverWin , ( gameOverWinRows / 2 ) , 1 , " Accuracy: N/A " ) ;
}
mvwprintw ( gameOverWin , ( gameOverWinRows ) - 2 , ( gameOverWinCols - strlen ( " Press 'q' to quit or 'r' to restart " ) ) / 2 , " %s " , " Press 'q' to quit or 'r' to restart " ) ;
mvwprintw ( gameOverWin , ( gameOverWinRows ) - 2 , ( gameOverWinCols - strlen ( " Press 'q' to quit or 'r' to restart " ) ) / 2 , " %s " , " Press 'q' to quit or 'r' to restart " ) ;
nodelay ( stdscr , FALSE ) ;
nodelay ( stdscr , FALSE ) ;
box ( gameOverWin , 0 , 0 ) ;
box ( gameOverWin , 0 , 0 ) ;