diff --git a/space.elf b/space.elf index bd727be..de07199 100755 Binary files a/space.elf and b/space.elf differ diff --git a/space_dbg.elf b/space_dbg.elf index 03658e7..2a173b5 100755 Binary files a/space_dbg.elf and b/space_dbg.elf differ diff --git a/src/Application.cpp b/src/Application.cpp index bc38117..78e29ca 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -67,7 +67,7 @@ int Application::exec() void Application::executeThread(void) { /****************************> Globals <****************************/ - struct SpaceGlobals mySpaceGlobals; + struct SpaceGlobals mySpaceGlobals = {}; //Flag for restarting the entire game. mySpaceGlobals.restart = 1; diff --git a/src/program.h b/src/program.h index b9c857b..40c1947 100755 --- a/src/program.h +++ b/src/program.h @@ -89,8 +89,8 @@ struct SpaceGlobals{ int passwordEntered; int allowInput; -// int displayHowToPlay; -// int firstShotFired; + int displayHowToPlay; + int firstShotFired; }; diff --git a/src/space.c b/src/space.c index 44d382d..97cbebd 100755 --- a/src/space.c +++ b/src/space.c @@ -81,8 +81,9 @@ void p1Shoot(struct SpaceGlobals * mySpaceGlobals) mySpaceGlobals->bullets[xx].m_x = 9*my_sin(theta); // 9 is the desired bullet speed mySpaceGlobals->bullets[xx].m_y = 9*my_cos(theta); // we have to solve for the hypotenuese mySpaceGlobals->bullets[xx].active = 1; -// mySpaceGlobals->firstShotFired = 1; -// mySpaceGlobals->displayHowToPlay = 0; + mySpaceGlobals->firstShotFired = 1; + if (mySpaceGlobals->score >= 1000) + mySpaceGlobals->displayHowToPlay = 0; break; } } @@ -132,9 +133,9 @@ void p1Move(struct SpaceGlobals *mySpaceGlobals) { { increaseScore(mySpaceGlobals, 10); - // if the score is at least 100 and a shot hasn't been fired yet, display a message about shooting -// if (mySpaceGlobals->score >= 100 && !mySpaceGlobals->firstShotFired) -// mySpaceGlobals->displayHowToPlay = 1; + // if the score is at least 50 and a shot hasn't been fired yet, display a message about shooting + if (mySpaceGlobals->score >= 50 && !mySpaceGlobals->firstShotFired) + mySpaceGlobals->displayHowToPlay = 1; } }; @@ -501,12 +502,12 @@ void renderTexts(struct SpaceGlobals *mySpaceGlobals) __os_snprintf(lives, 255, "Lives: %d", mySpaceGlobals->lives); drawString(55, -1, lives); -// if (mySpaceGlobals->displayHowToPlay) -// { -// char nag[255]; -// __os_snprintf(nag, 255, "Touch and hold on the screen to rapid fire!"); -// drawString(30, 17, nag); -// } + if (mySpaceGlobals->displayHowToPlay) + { + char nag[255]; + __os_snprintf(nag, 255, "Touch and hold on the screen to rapid fire!"); + drawString(20, 17, nag); + } } @@ -944,8 +945,8 @@ void addNewEnemies(struct SpaceGlobals *mySpaceGlobals) void totallyRefreshState(struct SpaceGlobals *mySpaceGlobals) { initGameState(mySpaceGlobals); -// mySpaceGlobals->displayHowToPlay = 0; -// mySpaceGlobals->firstShotFired = 0; + mySpaceGlobals->displayHowToPlay = 0; + mySpaceGlobals->firstShotFired = 0; mySpaceGlobals->lives = 3; mySpaceGlobals->playerExplodeFrame = 0; mySpaceGlobals->score = 0;