From 786dccd2bc0946d48b8a2758ef2c607678bc8dd9 Mon Sep 17 00:00:00 2001 From: XaviDCR92 Date: Fri, 8 Sep 2017 18:39:22 +0200 Subject: Removed Building and GameStructures modules. Restructured SW for Unit and Player, still a lot TODO --- Gameplay.cpp | 59 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 29 deletions(-) (limited to 'Gameplay.cpp') diff --git a/Gameplay.cpp b/Gameplay.cpp index c406834..55c22d5 100644 --- a/Gameplay.cpp +++ b/Gameplay.cpp @@ -1,18 +1,19 @@ /* ************************************** * Includes * * **************************************/ - + #include "Gameplay.h" #include "MouseSpr.c" +#include "Pad.h" /* ************************************** * Defines * * **************************************/ - + /* ************************************** * Global variables * * **************************************/ - + Player GamePlayers[GAME_MAX_PLAYERS]; /* ************************************** @@ -22,8 +23,8 @@ Player GamePlayers[GAME_MAX_PLAYERS]; static const char PauseMenuOption_0[] PROGMEM = "Resume"; static const char PauseMenuOption_1[] PROGMEM = "Quit"; static TYPE_SPRITE MouseSpr; - -static const char * const PauseMenuOptions[] PROGMEM = {PauseMenuOption_0, + +static const char* const PauseMenuOptions[] PROGMEM = {PauseMenuOption_0, PauseMenuOption_1 }; /* ************************************** @@ -75,50 +76,50 @@ const byte TowerSpr[] PROGMEM = {16,32, void GameInit(void) { uint8_t i; - - for(i = 0; i < GAME_MAX_PLAYERS; i++) + + for (i = 0; i < GAME_MAX_PLAYERS; i++) { GamePlayers[i].Init(); } - + MouseSpr.Data = MouseSprData; MouseSpr.color = GFX_INVERT; MouseSpr.rotation = NOROT; MouseSpr.flip = NOFLIP; MouseSpr.x = (X_SCREEN_RESOLUTION >> 1) - 4; MouseSpr.y = (Y_SCREEN_RESOLUTION >> 1) - 4; - + GfxInit(); - + GameLoop(); } bool GamePause(void) { - if(PadButtonReleased(PAD_C) == true) + if (PadButtonReleased(PAD_C) == true) { //int8_t menu(const char* const* items, uint8_t length); uint8_t choice = gb.menu(PauseMenuOptions, 2); - - if(choice != 0) + + if (choice != 0) { return true; } } - + return false; } void GameCalculations(void) { uint8_t i; - - for(i = 0; i < GAME_MAX_PLAYERS; i++) + + for (i = 0; i < GAME_MAX_PLAYERS; i++) { GamePlayers[i].Handler(); } - - if(PadAnyKeyPressed() == true) + + if (PadAnyKeyPressed() == true) { SystemSetRandSeed(); } @@ -127,32 +128,32 @@ void GameCalculations(void) void GameGraphics(void) { uint8_t i; - + //GfxClearScreen(); - - for(i = 0; i < GAME_MAX_PLAYERS; i++) + + for (i = 0; i < GAME_MAX_PLAYERS; i++) { GamePlayers[i].DrawHandler(); } - + GfxDrawSprite(&MouseSpr); } void GameLoop(void) { - while(1) + while (1) { - if(GamePause() == true) + if (GamePause() == true) { return; } - + GameCalculations(); - - while(GfxRefreshNeeded() == false); - + + while (GfxRefreshNeeded() == false); + GameGraphics(); - + SystemIncreaseGlobalTimer(); } } -- cgit v1.2.3