summaryrefslogtreecommitdiff
path: root/Gameplay.cpp
diff options
context:
space:
mode:
authorXaviDCR92 <xavi.dcr@gmail.com>2017-09-08 18:39:22 +0200
committerXaviDCR92 <xavi.dcr@gmail.com>2017-09-08 18:39:22 +0200
commit786dccd2bc0946d48b8a2758ef2c607678bc8dd9 (patch)
tree47952d77e5646a993671134b50c16f32ebe35b1c /Gameplay.cpp
parent72d350a37aa67936361ac8a374472b7e0227da61 (diff)
downloadpocketempires-786dccd2bc0946d48b8a2758ef2c607678bc8dd9.tar.gz
Removed Building and GameStructures modules. Restructured SW for Unit and Player, still a lot TODO
Diffstat (limited to 'Gameplay.cpp')
-rw-r--r--Gameplay.cpp59
1 files changed, 30 insertions, 29 deletions
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();
}
}