summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXaviDCR92 <xavi.dcr@gmail.com>2018-07-09 22:33:29 +0200
committerXaviDCR92 <xavi.dcr@gmail.com>2018-07-09 22:33:29 +0200
commit8ed9a3a57ad08bac4e8441b0b87ddc946296a3fd (patch)
tree185528a843f4e38d0cc73d8893f3fed7d5639ada
parentcd78b97bceaf6ecbbab6f89631c15ed712878d4d (diff)
downloadpocketempires-8ed9a3a57ad08bac4e8441b0b87ddc946296a3fd.tar.gz
Fixed "includes/defines/local variables" headers.
-rw-r--r--Camera.cpp44
-rw-r--r--Game.cpp42
-rw-r--r--HumanPlayer.cpp22
-rw-r--r--Menu.cpp40
-rw-r--r--Player.cpp38
-rw-r--r--Sprite.cpp36
-rw-r--r--System.cpp36
-rw-r--r--Unit.cpp36
-rw-r--r--main.cpp43
9 files changed, 193 insertions, 144 deletions
diff --git a/Camera.cpp b/Camera.cpp
index 95b334b..6f0fd53 100644
--- a/Camera.cpp
+++ b/Camera.cpp
@@ -1,33 +1,35 @@
-/* *************************************
+/* *******************************************************************
* Includes
- * *************************************/
+ * ******************************************************************/
#include "Camera.h"
+#include <stdint.h>
-/* *************************************
+/* *******************************************************************
* Defines
- * *************************************/
+ * ******************************************************************/
-/* *************************************
- * Structs and enums
- * *************************************/
+#define SPEED_CALCULATION_TIME ((uint8_t)3)
-enum
-{
- SPEED_CALCULATION_TIME = 3
-};
+/* *******************************************************************
+ * Types definition
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Global variables definition
+ * ******************************************************************/
-/* *************************************
- * Global Variables
- * *************************************/
+/* *******************************************************************
+ * Local variables definition
+ * ******************************************************************/
-/* *************************************
- * Local Variables
- * *************************************/
+/* *******************************************************************
+ * Local prototypes declaration
+ * ******************************************************************/
-/* *************************************
- * Local Prototypes
- * *************************************/
+/* *******************************************************************
+ * Functions definition
+ * ******************************************************************/
/*****************************************************************//**
*
@@ -59,7 +61,7 @@ void Camera::getCoordinates(int16_t* const x, int16_t* const y)
/*****************************************************************//**
*
* \brief Event handler executed when human player presses
- * left arrow button.
+ * left button.
*
*********************************************************************/
void Camera::onLeftBtnPressed(void)
diff --git a/Game.cpp b/Game.cpp
index 2fa2ba2..175d247 100644
--- a/Game.cpp
+++ b/Game.cpp
@@ -1,6 +1,6 @@
-/* **************************************
- * Includes *
- * **************************************/
+/* *******************************************************************
+ * Includes
+ * ******************************************************************/
#include "Game.h"
#include "Sprite.h"
@@ -9,13 +9,13 @@
#include <Gamebuino.h>
#include <Display.h>
-/* **************************************
- * Defines *
- * **************************************/
+/* *******************************************************************
+ * Defines
+ * ******************************************************************/
-/* **************************************
- * Structs and enums *
- * **************************************/
+/* *******************************************************************
+ * Types definition
+ * ******************************************************************/
enum tPauseMenuChoice
{
@@ -25,23 +25,23 @@ enum tPauseMenuChoice
MAX_PAUSE_MENU_CHOICES,
};
-/* **************************************
- * Global variables *
- * **************************************/
+/* *******************************************************************
+ * Global variables definition
+ * ******************************************************************/
-/* **************************************
- * Local variables *
- * **************************************/
+/* *******************************************************************
+ * Local variables definition
+ * ******************************************************************/
-/* **************************************
- * Local prototypes *
- * **************************************/
+/* *******************************************************************
+ * Local prototypes declaration
+ * ******************************************************************/
static enum tPauseMenuChoice GamePause(void);
-/* **************************************
- * Functions definition *
- * **************************************/
+/* *******************************************************************
+ * Functions definition
+ * ******************************************************************/
/*****************************************************************//**
*
diff --git a/HumanPlayer.cpp b/HumanPlayer.cpp
index 766bf7d..c9b60e4 100644
--- a/HumanPlayer.cpp
+++ b/HumanPlayer.cpp
@@ -1,6 +1,6 @@
-/* **************************************
- * Includes *
- * **************************************/
+/* *******************************************************************
+ * Includes
+ * ******************************************************************/
#include "HumanPlayer.h"
#include "System.h"
@@ -16,11 +16,15 @@
* ******************************************************************/
/* *******************************************************************
- * Global variables
+ * Global variables definition
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Local variables definition
* ******************************************************************/
/* *******************************************************************
- * Local variables
+ * Local prototypes declaration
* ******************************************************************/
/* *******************************************************************
@@ -45,7 +49,7 @@ Player(strPlayerName)
*********************************************************************/
void HumanPlayer::buttonHandler(void)
{
- for (uint8_t btn = 0; btn < NUM_BTN; btn++)
+ for (uint8_t u8Btn = 0; u8Btn < NUM_BTN; u8Btn++)
{
/* This array of member functions lists
* button pressed event handlers for each button. */
@@ -68,13 +72,13 @@ void HumanPlayer::buttonHandler(void)
};
/* Member function pointer is valid. */
- if (gb.buttons.pressed(btn))
+ if (gb.buttons.pressed(u8Btn))
{
/* Key has been pressed. Execute both
* HumanPlayer and Camera handlers, if available. */
/* Get pointer to HumanPlayer member function for selected button. */
- void (HumanPlayer::*const pBtnHandler)(void) = apBtnHandlerTable[btn];
+ void (HumanPlayer::*const pBtnHandler)(void) = apBtnHandlerTable[u8Btn];
if (pBtnHandler != NULL)
{
@@ -88,7 +92,7 @@ void HumanPlayer::buttonHandler(void)
}
/* Get pointer to Camera member function for selected button. */
- void (Camera::*const pCameraBtnHandler)(void) = apBtnCameraHandlerTable[btn];
+ void (Camera::*const pCameraBtnHandler)(void) = apBtnCameraHandlerTable[u8Btn];
if (pCameraBtnHandler != NULL)
{
diff --git a/Menu.cpp b/Menu.cpp
index a8c0115..9b19069 100644
--- a/Menu.cpp
+++ b/Menu.cpp
@@ -1,6 +1,6 @@
-/* **************************************
- * Includes *
- * **************************************/
+/* *******************************************************************
+ * Includes
+ * ******************************************************************/
#include "Menu.h"
#include "HumanPlayer.h"
@@ -9,23 +9,31 @@
#include <Gamebuino.h>
#include <Arduino.h>
-/* **************************************
- * Defines *
- * **************************************/
+/* *******************************************************************
+ * Defines
+ * ******************************************************************/
#define GAME_NAME "Pocket Empires"
-/* **************************************
- * Structs and enums *
- * **************************************/
+/* *******************************************************************
+ * Types definition
+ * ******************************************************************/
-/* **************************************
- * Local variables *
- * **************************************/
+/* *******************************************************************
+ * Global variables definition
+ * ******************************************************************/
-/* **************************************
- * Functions definition *
- * **************************************/
+/* *******************************************************************
+ * Local variables definition
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Local prototypes declaration
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Functions definition
+ * ******************************************************************/
/*****************************************************************//**
*
@@ -44,6 +52,8 @@ void MainMenu(void)
MAX_CHOICES
};
+ /* Strings must be individually allocated into
+ * PROGMEM so they can be read correctly by gb.menu(). */
static const char strMainMenuOptions_0[] PROGMEM = "Single player game";
static const char strMainMenuOptions_1[] PROGMEM = "Multiplayer game";
static const char strMainMenuOptions_2[] PROGMEM = "Options";
diff --git a/Player.cpp b/Player.cpp
index ba507a6..b90e9fa 100644
--- a/Player.cpp
+++ b/Player.cpp
@@ -1,25 +1,33 @@
-/* **************************************
- * Includes *
- * **************************************/
+/* *******************************************************************
+ * Includes
+ * ******************************************************************/
#include "Player.h"
#include <string.h>
-/* **************************************
- * Defines *
- * **************************************/
+/* *******************************************************************
+ * Defines
+ * ******************************************************************/
-/* **************************************
- * Structs and enums *
- * **************************************/
+/* *******************************************************************
+ * Types definition
+ * ******************************************************************/
-/* **************************************
- * Local variables *
- * **************************************/
+/* *******************************************************************
+ * Global variables definition
+ * ******************************************************************/
-/* **************************************
- * Functions definition *
- * **************************************/
+/* *******************************************************************
+ * Local variables definition
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Local prototypes declaration
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Functions definition
+ * ******************************************************************/
/*****************************************************************//**
*
diff --git a/Sprite.cpp b/Sprite.cpp
index 3fb3f0a..ea7f9d2 100644
--- a/Sprite.cpp
+++ b/Sprite.cpp
@@ -1,28 +1,32 @@
-/* *************************************
+/* *******************************************************************
* Includes
- * *************************************/
+ * ******************************************************************/
#include "Sprite.h"
-/* *************************************
+/* *******************************************************************
* Defines
- * *************************************/
+ * ******************************************************************/
-/* *************************************
- * Structs and enums
- * *************************************/
+/* *******************************************************************
+ * Types definition
+ * ******************************************************************/
-/* *************************************
- * Global Variables
- * *************************************/
+/* *******************************************************************
+ * Global variables definition
+ * ******************************************************************/
-/* *************************************
- * Local Variables
- * *************************************/
+/* *******************************************************************
+ * Local variables definition
+ * ******************************************************************/
-/* *************************************
- * Local Prototypes
- * *************************************/
+/* *******************************************************************
+ * Local prototypes declaration
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Functions definition
+ * ******************************************************************/
/*****************************************************************//**
*
diff --git a/System.cpp b/System.cpp
index 7961512..512d2b5 100644
--- a/System.cpp
+++ b/System.cpp
@@ -1,13 +1,13 @@
-/* *************************************
+/* *******************************************************************
* Includes
- * *************************************/
+ * ******************************************************************/
#include <Arduino.h>
#include <Gamebuino.h>
-/* *************************************
+/* *******************************************************************
* Defines
- * *************************************/
+ * ******************************************************************/
#define mCHECK_COLLISION(x1, y1, w1, h1, x2, y2, w2, h2) \
(!( ((x1) >= (x2) + (w2)) \
@@ -18,13 +18,13 @@
|| \
((y2) >= (y1) + (h1)) )
-/* *************************************
- * Structs and enums
- * *************************************/
+/* *******************************************************************
+ * Types definition
+ * ******************************************************************/
-/* *************************************
- * Global Variables
- * *************************************/
+/* *******************************************************************
+ * Global variables definition
+ * ******************************************************************/
/*****************************************************************//**
*
@@ -33,13 +33,17 @@
*********************************************************************/
Gamebuino gb;
-/* *************************************
- * Local Variables
- * *************************************/
+/* *******************************************************************
+ * Local variables definition
+ * ******************************************************************/
-/* *************************************
- * Local Prototypes
- * *************************************/
+/* *******************************************************************
+ * Local prototypes declaration
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Functions definition
+ * ******************************************************************/
/*****************************************************************//**
*
diff --git a/Unit.cpp b/Unit.cpp
index 74a2110..ad49f2e 100644
--- a/Unit.cpp
+++ b/Unit.cpp
@@ -1,28 +1,32 @@
-/* *************************************
+/* *******************************************************************
* Includes
- * *************************************/
+ * ******************************************************************/
#include "Unit.h"
-/* *************************************
+/* *******************************************************************
* Defines
- * *************************************/
+ * ******************************************************************/
-/* *************************************
- * Structs and enums
- * *************************************/
+/* *******************************************************************
+ * Types definition
+ * ******************************************************************/
-/* *************************************
- * Global Variables
- * *************************************/
+/* *******************************************************************
+ * Global variables definition
+ * ******************************************************************/
-/* *************************************
- * Local Variables
- * *************************************/
+/* *******************************************************************
+ * Local variables definition
+ * ******************************************************************/
-/* *************************************
- * Local Prototypes
- * *************************************/
+/* *******************************************************************
+ * Local prototypes declaration
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Functions definition
+ * ******************************************************************/
/*****************************************************************//**
*
diff --git a/main.cpp b/main.cpp
index a6f0cc3..6b8f911 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,30 +1,43 @@
-/* **************************************
- * Includes *
- * **************************************/
+/* *******************************************************************
+ * Includes
+ * ******************************************************************/
#include "Menu.h"
#include "System.h"
-/* **************************************
- * Defines *
- * **************************************/
+/* *******************************************************************
+ * Defines
+ * ******************************************************************/
-/* **************************************
- * Global variables *
- * **************************************/
+/* *******************************************************************
+ * Types definition
+ * ******************************************************************/
-/* **************************************
- * Functions definition *
- * **************************************/
+/* *******************************************************************
+ * Global variables definition
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Local variables definition
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Local prototypes declaration
+ * ******************************************************************/
+
+/* *******************************************************************
+ * Functions definition
+ * ******************************************************************/
/*****************************************************************//**
*
- * \brief Initializes the device and game parameters.
+ * \brief Initializes the device and game parameters and
+ * executes the game.
*
- * \return Error code (always 0), but is never returned.
+ * \return Error code (always 0), but must never be returned.
*
*********************************************************************/
-int main()
+int main(void)
{
/* Initialize system and game parameters. */
SystemInit();