aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorXaviDCR92 <xavi.dcr@gmail.com>2017-08-30 23:29:57 +0200
committerXaviDCR92 <xavi.dcr@gmail.com>2017-08-30 23:29:57 +0200
commit69027a04e3d2eb10708243295dec3655c4ccdca5 (patch)
tree62f03f16d4fab87392757e621b3d394a592b615f /Source
parent0cfdfaf95927f0bc25d34744292c41d0d344c5e2 (diff)
downloadairport-69027a04e3d2eb10708243295dec3655c4ccdca5.tar.gz
* Minor changes (spaces between "if"/"for"... instructions).
+ Added output ELF file with debugging symbols for nocash.
Diffstat (limited to 'Source')
-rw-r--r--Source/Aircraft.c138
-rw-r--r--Source/Camera.c48
-rw-r--r--Source/EndAnimation.c28
-rw-r--r--Source/Exe/AIRPORT.elfbin0 -> 494892 bytes
-rw-r--r--Source/Font.c22
-rw-r--r--Source/Game.c501
-rw-r--r--Source/GameGui.c118
-rw-r--r--Source/Gfx.c66
-rw-r--r--Source/Gfx.h2
-rw-r--r--Source/LoadMenu.c82
-rw-r--r--Source/Makefile5
-rw-r--r--Source/MemCard.c138
-rw-r--r--Source/Menu.c42
-rw-r--r--Source/PSXSDKIntro.c56
-rw-r--r--Source/Pad.c54
-rw-r--r--Source/PltParser.c36
-rw-r--r--Source/Serial.c13
-rw-r--r--Source/Sfx.c10
-rw-r--r--Source/System.c62
-rw-r--r--Source/Timer.c20
20 files changed, 745 insertions, 696 deletions
diff --git a/Source/Aircraft.c b/Source/Aircraft.c
index 27a62d0..bc61403 100644
--- a/Source/Aircraft.c
+++ b/Source/Aircraft.c
@@ -6,6 +6,7 @@
#include "System.h"
#include "Game.h"
#include "Camera.h"
+#include "LoadMenu.h"
/* *************************************
* Defines
@@ -50,11 +51,16 @@ typedef enum t_aircraftSpeeds
static TYPE_AIRCRAFT_DATA AircraftData[GAME_MAX_AIRCRAFT];
static uint8_t AircraftIndex;
static GsSprite AircraftSpr;
+static GsSprite ArrowSpr;
static TYPE_ISOMETRIC_POS AircraftCenterIsoPos;
static TYPE_CARTESIAN_POS AircraftCenterPos;
static char* AircraftLiveryNamesTable[] = {"PHX", NULL};
static AIRCRAFT_LIVERY AircraftLiveryTable[] = {AIRCRAFT_LIVERY_0, AIRCRAFT_LIVERY_UNKNOWN};
+static char* GameFileList[] = { "cdrom:\\DATA\\SPRITES\\ARROW.TIM;1" };
+
+static void* GameFileDest[] = { (GsSprite*)&ArrowSpr };
+
// Used to quickly link FlightData indexes against AircraftData indexes.
static uint8_t AircraftFlightDataIdx_HashTable[GAME_MAX_AIRCRAFT];
@@ -102,6 +108,11 @@ void AircraftInit(void)
memset( AircraftFlightDataIdx_HashTable,
AIRCRAFT_INVALID_IDX,
sizeof(AircraftFlightDataIdx_HashTable) );
+
+ LoadMenu( GameFileList,
+ GameFileDest,
+ sizeof(GameFileList) / sizeof(GameFileList[0]),
+ sizeof(GameFileDest) / sizeof(GameFileDest[0]) );
}
bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData,
@@ -112,7 +123,7 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData,
uint8_t level_columns = GameGetLevelColumns();
uint8_t i;
- if(AircraftIndex >= GAME_MAX_AIRCRAFT)
+ if (AircraftIndex >= GAME_MAX_AIRCRAFT)
{
Serial_printf("Exceeded maximum aircraft capacity!\n");
return false;
@@ -127,7 +138,7 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData,
Serial_printf("ptrAircraft->FlightDataIdx = %d, FlightDataIndex = %d\n", ptrAircraft->FlightDataIdx, FlightDataIndex);
- if(ptrFlightData->FlightDirection[FlightDataIndex] == ARRIVAL)
+ if (ptrFlightData->FlightDirection[FlightDataIndex] == ARRIVAL)
{
ptrAircraft->IsoPos.x = 0;
@@ -140,7 +151,7 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData,
ptrAircraft->IsoPos.z <<= TILE_SIZE_BIT_SHIFT - 1;
ptrAircraft->IsoPos.z = fix16_from_int(ptrAircraft->IsoPos.z);
}
- else if(ptrFlightData->FlightDirection[FlightDataIndex] == DEPARTURE)
+ else if (ptrFlightData->FlightDirection[FlightDataIndex] == DEPARTURE)
{
ptrAircraft->IsoPos.x = GameGetXFromTile(ptrFlightData->Parking[FlightDataIndex]);
ptrAircraft->IsoPos.y = GameGetYFromTile(ptrFlightData->Parking[FlightDataIndex]);
@@ -155,9 +166,9 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData,
Serial_printf("\nAircraft Data:\n");
Serial_printf("\tTargets:");
- for(i = 0; i < AIRCRAFT_MAX_TARGETS; i++)
+ for (i = 0; i < AIRCRAFT_MAX_TARGETS; i++)
{
- if(ptrAircraft->Target[i] == 0)
+ if (ptrAircraft->Target[i] == 0)
{
break;
}
@@ -188,7 +199,7 @@ AIRCRAFT_LIVERY AircraftLiveryFromFlightNumber(char* strFlightNumber)
liveryIndex = SystemIndexOfStringArray(strLivery, AircraftLiveryNamesTable);
- if(liveryIndex == -1)
+ if (liveryIndex == -1)
{
return AIRCRAFT_LIVERY_UNKNOWN;
}
@@ -200,9 +211,9 @@ bool AircraftRemove(uint8_t aircraftIdx)
{
TYPE_AIRCRAFT_DATA* ptrAircraft = AircraftFromFlightDataIndex(aircraftIdx);
- if(ptrAircraft->State != STATE_IDLE)
+ if (ptrAircraft->State != STATE_IDLE)
{
- if(ptrAircraft->FlightDataIdx == aircraftIdx)
+ if (ptrAircraft->FlightDataIdx == aircraftIdx)
{
DEBUG_PRINT_VAR(ptrAircraft->FlightDataIdx);
DEBUG_PRINT_VAR(aircraftIdx);
@@ -219,12 +230,12 @@ void AircraftHandler(void)
{
uint8_t i;
- for(i = 0; i < GAME_MAX_AIRCRAFT; i++)
+ for (i = 0; i < GAME_MAX_AIRCRAFT; i++)
{
TYPE_AIRCRAFT_DATA* ptrAircraft = &AircraftData[i];
uint8_t j;
- if(ptrAircraft->State == STATE_IDLE)
+ if (ptrAircraft->State == STATE_IDLE)
{
continue;
}
@@ -235,26 +246,26 @@ void AircraftHandler(void)
// Check collision against all other aircraft.
- for(j = 0; j < GAME_MAX_AIRCRAFT; j++)
+ for (j = 0; j < GAME_MAX_AIRCRAFT; j++)
{
TYPE_AIRCRAFT_DATA* ptrOtherAircraft = &AircraftData[j];
- if(i == j)
+ if (i == j)
{
continue;
}
- else if(j < i)
+ else if (j < i)
{
// Collision already calculated.
continue;
}
- if(AircraftData[j].State == STATE_IDLE)
+ if (AircraftData[j].State == STATE_IDLE)
{
continue;
}
- if(AircraftCheckCollision(ptrAircraft, ptrOtherAircraft) == true)
+ if (AircraftCheckCollision(ptrAircraft, ptrOtherAircraft) == true)
{
GameAircraftCollision(ptrAircraft->FlightDataIdx);
break;
@@ -312,7 +323,7 @@ void AircraftRender(TYPE_PLAYER* ptrPlayer, uint8_t aircraftIdx)
TYPE_ISOMETRIC_FIX16_POS shadowIsoPos;
TYPE_CARTESIAN_POS shadowCartPos;
- if(ptrAircraft == NULL)
+ if (ptrAircraft == NULL)
{
return;
}
@@ -321,14 +332,14 @@ void AircraftRender(TYPE_PLAYER* ptrPlayer, uint8_t aircraftIdx)
shadowIsoPos.y = ptrAircraft->IsoPos.y;
shadowIsoPos.z = 0;
- if(ptrAircraft->State == STATE_IDLE)
+ if (ptrAircraft->State == STATE_IDLE)
{
return;
}
AircraftUpdateSpriteFromData(ptrAircraft);
- if(ptrAircraft->IsoPos.z > 0)
+ if (ptrAircraft->IsoPos.z > 0)
{
// Draw aircraft shadow
@@ -359,16 +370,16 @@ void AircraftRender(TYPE_PLAYER* ptrPlayer, uint8_t aircraftIdx)
CameraApplyCoordinatesToSprite(ptrPlayer, &AircraftSpr);
- if( (ptrPlayer->FlightDataSelectedAircraft == aircraftIdx)
+ if ( (ptrPlayer->FlightDataSelectedAircraft == aircraftIdx)
&&
(ptrPlayer->ShowAircraftData == true) )
{
static uint8_t aircraft_sine;
static bool aircraft_sine_decrease;
- if(aircraft_sine_decrease == false)
+ if (aircraft_sine_decrease == false)
{
- if(aircraft_sine < 240)
+ if (aircraft_sine < 240)
{
aircraft_sine += 24;
}
@@ -379,7 +390,7 @@ void AircraftRender(TYPE_PLAYER* ptrPlayer, uint8_t aircraftIdx)
}
else
{
- if(aircraft_sine > 24)
+ if (aircraft_sine > 24)
{
aircraft_sine -= 24;
}
@@ -392,6 +403,41 @@ void AircraftRender(TYPE_PLAYER* ptrPlayer, uint8_t aircraftIdx)
AircraftSpr.r = NORMAL_LUMINANCE >> 2;
AircraftSpr.g = NORMAL_LUMINANCE >> 2;
AircraftSpr.b = aircraft_sine;
+
+ if (GfxIsSpriteInsideScreenArea(&AircraftSpr) == false)
+ {
+ // When aircraft can't be shown on screen,
+ // show an arrow indicating its position.
+
+ if (AircraftSpr.x < 0)
+ {
+ ArrowSpr.x = 0;
+ }
+ else if (AircraftSpr.x > X_SCREEN_RESOLUTION)
+ {
+ ArrowSpr.x = X_SCREEN_RESOLUTION - ArrowSpr.w;
+ }
+ else
+ {
+ ArrowSpr.x = AircraftSpr.x;
+ }
+
+ if (AircraftSpr.y < 0)
+ {
+ ArrowSpr.y = 0;
+ }
+ else if (AircraftSpr.y > Y_SCREEN_RESOLUTION)
+ {
+ ArrowSpr.y = Y_SCREEN_RESOLUTION;
+ }
+ else
+ {
+ ArrowSpr.y = AircraftSpr.y;
+ }
+
+ GfxSortSprite(&ArrowSpr);
+ }
+
}
else
{
@@ -407,9 +453,9 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft)
{
TYPE_ISOMETRIC_FIX16_POS targetPos;
- if(ptrAircraft->State != STATE_CLIMBING)
+ if (ptrAircraft->State != STATE_CLIMBING)
{
- if(ptrAircraft->Target[ptrAircraft->TargetIdx] == 0)
+ if (ptrAircraft->Target[ptrAircraft->TargetIdx] == 0)
{
return;
}
@@ -420,11 +466,11 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft)
ptrAircraft->TargetReached = false;
- if(targetPos.y == ptrAircraft->IsoPos.y)
+ if (targetPos.y == ptrAircraft->IsoPos.y)
{
- if(targetPos.x > ptrAircraft->IsoPos.x)
+ if (targetPos.x > ptrAircraft->IsoPos.x)
{
- if(targetPos.x <= (ptrAircraft->IsoPos.x + ptrAircraft->Speed) )
+ if (targetPos.x <= (ptrAircraft->IsoPos.x + ptrAircraft->Speed) )
{
ptrAircraft->TargetReached = true;
}
@@ -434,9 +480,9 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft)
ptrAircraft->IsoPos.x += ptrAircraft->Speed;
}
}
- else if(targetPos.x < ptrAircraft->IsoPos.x)
+ else if (targetPos.x < ptrAircraft->IsoPos.x)
{
- if(targetPos.x >= (ptrAircraft->IsoPos.x - ptrAircraft->Speed) )
+ if (targetPos.x >= (ptrAircraft->IsoPos.x - ptrAircraft->Speed) )
{
ptrAircraft->TargetReached = true;
}
@@ -451,11 +497,11 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft)
ptrAircraft->TargetReached = true;
}
}
- else if(targetPos.x == ptrAircraft->IsoPos.x)
+ else if (targetPos.x == ptrAircraft->IsoPos.x)
{
- if(targetPos.y > ptrAircraft->IsoPos.y)
+ if (targetPos.y > ptrAircraft->IsoPos.y)
{
- if(targetPos.y <= (ptrAircraft->IsoPos.y + ptrAircraft->Speed) )
+ if (targetPos.y <= (ptrAircraft->IsoPos.y + ptrAircraft->Speed) )
{
ptrAircraft->TargetReached = true;
}
@@ -465,9 +511,9 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft)
ptrAircraft->IsoPos.y += ptrAircraft->Speed;
}
}
- else if(targetPos.y < ptrAircraft->IsoPos.y)
+ else if (targetPos.y < ptrAircraft->IsoPos.y)
{
- if(targetPos.y >= (ptrAircraft->IsoPos.y - ptrAircraft->Speed) )
+ if (targetPos.y >= (ptrAircraft->IsoPos.y - ptrAircraft->Speed) )
{
ptrAircraft->TargetReached = true;
}
@@ -483,12 +529,12 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft)
}
}
- if(ptrAircraft->TargetReached == true)
+ if (ptrAircraft->TargetReached == true)
{
ptrAircraft->IsoPos.x = targetPos.x;
ptrAircraft->IsoPos.y = targetPos.y;
- if(ptrAircraft->Target[++ptrAircraft->TargetIdx] == 0)
+ if (ptrAircraft->Target[++ptrAircraft->TargetIdx] == 0)
{
Serial_printf("All targets reached!\n");
ptrAircraft->State = GameTargetsReached(ptrAircraft->Target[0], ptrAircraft->FlightDataIdx);
@@ -525,7 +571,7 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft)
ptrAircraft->IsoPos.z += AircraftSpeedsTable[AIRCRAFT_SPEED_FINAL_Z];
- if(GameInsideLevelFromIsoPos(&ptrAircraft->IsoPos) == true)
+ if (GameInsideLevelFromIsoPos(&ptrAircraft->IsoPos) == true)
{
GameRemoveFlight(ptrAircraft->FlightDataIdx, true);
}
@@ -582,9 +628,9 @@ void AircraftUpdateSpriteFromData(TYPE_AIRCRAFT_DATA* ptrAircraft)
void AircraftAttitude(TYPE_AIRCRAFT_DATA* ptrAircraft)
{
- if(ptrAircraft->State == STATE_FINAL)
+ if (ptrAircraft->State == STATE_FINAL)
{
- if(ptrAircraft->IsoPos.z > 0)
+ if (ptrAircraft->IsoPos.z > 0)
{
ptrAircraft->IsoPos.z -= AircraftSpeedsTable[AIRCRAFT_SPEED_FINAL_Z];
}
@@ -615,7 +661,7 @@ uint16_t AircraftGetTileFromFlightDataIndex(uint8_t index)
{
TYPE_ISOMETRIC_POS isoPos = AircraftGetIsoPos(index);
- if(AircraftFromFlightDataIndex(index)->State != STATE_IDLE)
+ if (AircraftFromFlightDataIndex(index)->State != STATE_IDLE)
{
return GameGetTileFromIsoPosition(&isoPos);
}
@@ -629,14 +675,14 @@ TYPE_AIRCRAFT_DATA* AircraftFromFlightDataIndex(uint8_t index)
{
uint8_t idx;
- if( (index == AIRCRAFT_INVALID_IDX) || (index >= GAME_MAX_AIRCRAFT) )
+ if ( (index == AIRCRAFT_INVALID_IDX) || (index >= GAME_MAX_AIRCRAFT) )
{
return NULL;
}
idx = AircraftFlightDataIdx_HashTable[index];
- if(idx == AIRCRAFT_INVALID_IDX)
+ if (idx == AIRCRAFT_INVALID_IDX)
{
return NULL;
}
@@ -646,11 +692,11 @@ TYPE_AIRCRAFT_DATA* AircraftFromFlightDataIndex(uint8_t index)
/*uint8_t i;
TYPE_AIRCRAFT_DATA* ptrAircraft;
- for(i = 0; i < GAME_MAX_AIRCRAFT; i++)
+ for (i = 0; i < GAME_MAX_AIRCRAFT; i++)
{
ptrAircraft = &AircraftData[i];
- if(ptrAircraft->FlightDataIdx == index)
+ if (ptrAircraft->FlightDataIdx == index)
{
return ptrAircraft;
}
@@ -697,7 +743,7 @@ bool AircraftCheckCollision(TYPE_AIRCRAFT_DATA* ptrRefAircraft, TYPE_AIRCRAFT_DA
#define check_bb_collision(x1,y1,w1,h1,x2,y2,w2,h2) (!( ((x1)>=(x2)+(w2)) || ((x2)>=(x1)+(w1)) || \
((y1)>=(y2)+(h2)) || ((y2)>=(y1)+(h1)) ))
- if(check_bb_collision( ptrRefAircraft->IsoPos.x,
+ if (check_bb_collision( ptrRefAircraft->IsoPos.x,
ptrRefAircraft->IsoPos.y,
AIRCRAFT_SIZE_FIX16,
AIRCRAFT_SIZE_FIX16,
@@ -706,7 +752,7 @@ bool AircraftCheckCollision(TYPE_AIRCRAFT_DATA* ptrRefAircraft, TYPE_AIRCRAFT_DA
AIRCRAFT_SIZE_FIX16,
AIRCRAFT_SIZE_FIX16 ) != 0)
{
- if(ptrRefAircraft->IsoPos.z == ptrOtherAircraft->IsoPos.z)
+ if (ptrRefAircraft->IsoPos.z == ptrOtherAircraft->IsoPos.z)
{
return true;
}
diff --git a/Source/Camera.c b/Source/Camera.c
index 9f4e115..1323d60 100644
--- a/Source/Camera.c
+++ b/Source/Camera.c
@@ -58,80 +58,80 @@ void CameraApplyCoordinatesToRectangle(TYPE_PLAYER* ptrPlayer, GsRectangle * rec
void CameraUpdateSpeed(TYPE_PLAYER* ptrPlayer)
{
- if(ptrPlayer->PadDirectionKeyPressed_Callback() == true)
+ if (ptrPlayer->PadDirectionKeyPressed_Callback() == true)
{
- if(ptrPlayer->PadKeyPressed_Callback(PAD_LEFT) == true)
+ if (ptrPlayer->PadKeyPressed_Callback(PAD_LEFT) == true)
{
- if(ptrPlayer->Camera.X_Speed < 0)
+ if (ptrPlayer->Camera.X_Speed < 0)
{
ptrPlayer->Camera.X_Speed += 2;
}
- else if(ptrPlayer->Camera.X_Speed < MAX_CAMERA_SPEED)
+ else if (ptrPlayer->Camera.X_Speed < MAX_CAMERA_SPEED)
{
ptrPlayer->Camera.X_Speed++;
}
}
- if(ptrPlayer->PadKeyPressed_Callback(PAD_UP) == true)
+ if (ptrPlayer->PadKeyPressed_Callback(PAD_UP) == true)
{
- if(ptrPlayer->Camera.Y_Speed < 0)
+ if (ptrPlayer->Camera.Y_Speed < 0)
{
ptrPlayer->Camera.Y_Speed += 2;
}
- else if(ptrPlayer->Camera.Y_Speed < MAX_CAMERA_SPEED)
+ else if (ptrPlayer->Camera.Y_Speed < MAX_CAMERA_SPEED)
{
ptrPlayer->Camera.Y_Speed++;
}
}
- if(ptrPlayer->PadKeyPressed_Callback(PAD_DOWN) == true)
+ if (ptrPlayer->PadKeyPressed_Callback(PAD_DOWN) == true)
{
- if(ptrPlayer->Camera.Y_Speed > 0)
+ if (ptrPlayer->Camera.Y_Speed > 0)
{
ptrPlayer->Camera.Y_Speed -= 2;
}
- else if(ptrPlayer->Camera.Y_Speed > -MAX_CAMERA_SPEED)
+ else if (ptrPlayer->Camera.Y_Speed > -MAX_CAMERA_SPEED)
{
ptrPlayer->Camera.Y_Speed--;
}
}
- if(ptrPlayer->PadKeyPressed_Callback(PAD_RIGHT) == true)
+ if (ptrPlayer->PadKeyPressed_Callback(PAD_RIGHT) == true)
{
- if(ptrPlayer->Camera.X_Speed > 0)
+ if (ptrPlayer->Camera.X_Speed > 0)
{
ptrPlayer->Camera.X_Speed -= 2;
}
- else if(ptrPlayer->Camera.X_Speed > -MAX_CAMERA_SPEED)
+ else if (ptrPlayer->Camera.X_Speed > -MAX_CAMERA_SPEED)
{
ptrPlayer->Camera.X_Speed--;
}
}
}
- if( (ptrPlayer->PadKeyPressed_Callback(PAD_LEFT) == false)
+ if ( (ptrPlayer->PadKeyPressed_Callback(PAD_LEFT) == false)
&&
(ptrPlayer->PadKeyPressed_Callback(PAD_RIGHT) == false) )
{
- if(ptrPlayer->Camera.X_Speed > 0)
+ if (ptrPlayer->Camera.X_Speed > 0)
{
ptrPlayer->Camera.X_Speed--;
}
- else if(ptrPlayer->Camera.X_Speed < 0)
+ else if (ptrPlayer->Camera.X_Speed < 0)
{
ptrPlayer->Camera.X_Speed++;
}
}
- if( (ptrPlayer->PadKeyPressed_Callback(PAD_UP) == false)
+ if ( (ptrPlayer->PadKeyPressed_Callback(PAD_UP) == false)
&&
(ptrPlayer->PadKeyPressed_Callback(PAD_DOWN) == false) )
{
- if(ptrPlayer->Camera.Y_Speed > 0)
+ if (ptrPlayer->Camera.Y_Speed > 0)
{
ptrPlayer->Camera.Y_Speed--;
}
- else if(ptrPlayer->Camera.Y_Speed < 0)
+ else if (ptrPlayer->Camera.Y_Speed < 0)
{
ptrPlayer->Camera.Y_Speed++;
}
@@ -140,14 +140,14 @@ void CameraUpdateSpeed(TYPE_PLAYER* ptrPlayer)
void CameraHandler(TYPE_PLAYER* ptrPlayer)
{
- if(CameraSpecialConditions(ptrPlayer) == true)
+ if (CameraSpecialConditions(ptrPlayer) == true)
{
ptrPlayer->Camera.X_Speed = 0;
ptrPlayer->Camera.Y_Speed = 0;
return;
}
- if(ptrPlayer->Camera.Speed_Timer < SPEED_CALCULATION_TIME)
+ if (ptrPlayer->Camera.Speed_Timer < SPEED_CALCULATION_TIME)
{
ptrPlayer->Camera.Speed_Timer++;
}
@@ -166,7 +166,7 @@ void CameraHandler(TYPE_PLAYER* ptrPlayer)
bool CameraSpecialConditions(TYPE_PLAYER* ptrPlayer)
{
- if( (ptrPlayer->ShowAircraftData == true)
+ if ( (ptrPlayer->ShowAircraftData == true)
||
(ptrPlayer->SelectRunway == true) )
{
@@ -183,7 +183,7 @@ TYPE_ISOMETRIC_POS CameraGetIsoPos(TYPE_PLAYER* ptrPlayer)
TYPE_ISOMETRIC_POS IsoPos;
TYPE_CARTESIAN_POS CartPos;
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
CartPos.x = CAMERA_INITIAL_X_OFFSET_2PLAYER - ptrPlayer->Camera.X_Offset;
CartPos.y = (Y_SCREEN_RESOLUTION >> 1) - ptrPlayer->Camera.Y_Offset;
@@ -213,7 +213,7 @@ void CameraMoveToIsoPos(TYPE_PLAYER* ptrPlayer, TYPE_ISOMETRIC_POS IsoPos)
CartPos.x,
CartPos.y );*/
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
ptrPlayer->Camera.X_Offset = CAMERA_INITIAL_X_OFFSET_2PLAYER - CartPos.x;
ptrPlayer->Camera.Y_Offset = (Y_SCREEN_RESOLUTION >> 1) - CartPos.y;
diff --git a/Source/EndAnimation.c b/Source/EndAnimation.c
index 5cda332..3907d6e 100644
--- a/Source/EndAnimation.c
+++ b/Source/EndAnimation.c
@@ -59,7 +59,7 @@ void EndAnimation(void)
GfxSetGlobalLuminance(NORMAL_LUMINANCE);
- if(SystemIsRandSeedSet() == false)
+ if (SystemIsRandSeedSet() == false)
{
// Set default end animation
EndAnimationFadeOut();
@@ -94,9 +94,9 @@ void EndAnimationFadeOut(void)
{
uint8_t i;
- while(1)
+ while (1)
{
- if( GfxGetGlobalLuminance() > 0)
+ if ( GfxGetGlobalLuminance() > 0)
{
GfxSetGlobalLuminance(GfxGetGlobalLuminance() - END_ANIMATION_FADEOUT_STEP);
@@ -107,7 +107,7 @@ void EndAnimationFadeOut(void)
{
GsSortCls(0,0,0);
- for(i = 0 ; i < 2 ; i++)
+ for (i = 0 ; i < 2 ; i++)
{
// Draw two frames to ensure black display
GfxDrawScene_Slow();
@@ -148,7 +148,7 @@ void EndAnimationLine(void)
rectIndex += END_ANIMATION_LINE_STEP;
- }while(rectIndex <= (X_SCREEN_RESOLUTION >> 1) );
+ }while (rectIndex <= (X_SCREEN_RESOLUTION >> 1) );
}
@@ -169,7 +169,7 @@ void EndAnimationSquares(void)
memset(sqPos, false , END_ANIMATION_SQUARES_TOTAL);
- for(i = 0; i < END_ANIMATION_SQUARES_TOTAL ; i++)
+ for (i = 0; i < END_ANIMATION_SQUARES_TOTAL ; i++)
{
do
@@ -179,12 +179,12 @@ void EndAnimationSquares(void)
/*Serial_printf("randInd = %d\t",randInd);
Serial_printf("sqPos[randInd] = %d\n", sqPos[randInd]);*/
- if(sqPos[randInd] == false)
+ if (sqPos[randInd] == false)
{
sqPos[randInd] = true;
sqCounter--;
- while(sqPos[maxIndex] == true)
+ while (sqPos[maxIndex] == true)
{
// Lower maximum value for rand() so that it's
// easier to spot new empty index on next iteration.
@@ -195,21 +195,21 @@ void EndAnimationSquares(void)
}
else
{
- if(sqCounter == 0)
+ if (sqCounter == 0)
{
break;
}
}
- }while(1);
+ }while (1);
GfxSortSprite(&EndAnimationDisplay);
- if(sqCounter != 0)
+ if (sqCounter != 0)
{
- for(j = 0; j < END_ANIMATION_SQUARES_TOTAL ; j++)
+ for (j = 0; j < END_ANIMATION_SQUARES_TOTAL ; j++)
{
- if(sqPos[j] == true)
+ if (sqPos[j] == true)
{
EndAnimationRect.x = ((j) << END_ANIMATION_SQUARES_SIZE_BITSHIFT) -
(short)( (j / END_ANIMATION_SQUARES_PER_ROW) *
@@ -225,7 +225,7 @@ void EndAnimationSquares(void)
else
{
// Quick fix: draw a full black rectangle instead of multiple squares
- for(k = 0 ; k < 2 ; k++)
+ for (k = 0 ; k < 2 ; k++)
{
// Draw two frames to ensure black display
GsSortCls(0,0,0);
diff --git a/Source/Exe/AIRPORT.elf b/Source/Exe/AIRPORT.elf
new file mode 100644
index 0000000..347c242
--- /dev/null
+++ b/Source/Exe/AIRPORT.elf
Binary files differ
diff --git a/Source/Font.c b/Source/Font.c
index c00de66..52a8cca 100644
--- a/Source/Font.c
+++ b/Source/Font.c
@@ -28,7 +28,7 @@ static unsigned char _blend_effect_lum;
bool FontLoadImage(char* strPath, TYPE_FONT * ptrFont)
{
- if(GfxSpriteFromFile(strPath, &ptrFont->spr) == false)
+ if (GfxSpriteFromFile(strPath, &ptrFont->spr) == false)
{
return false;
}
@@ -107,16 +107,16 @@ void FontPrintText(TYPE_FONT * ptrFont, short x, short y, char* str, ...)
va_list ap;
- if(ptrFont->flags & FONT_1HZ_FLASH)
+ if (ptrFont->flags & FONT_1HZ_FLASH)
{
- if(Gfx1HzFlash() == false)
+ if (Gfx1HzFlash() == false)
{
return;
}
}
- else if(ptrFont->flags & FONT_2HZ_FLASH)
+ else if (ptrFont->flags & FONT_2HZ_FLASH)
{
- if(Gfx2HzFlash() == false)
+ if (Gfx2HzFlash() == false)
{
return;
}
@@ -129,11 +129,11 @@ void FontPrintText(TYPE_FONT * ptrFont, short x, short y, char* str, ...)
str,
ap );
- for(i = 0; i < result ; i++)
+ for (i = 0; i < result ; i++)
{
char _ch = _internal_text[i];
- if(_ch == '\0')
+ if (_ch == '\0')
{
// End of string
break;
@@ -149,9 +149,9 @@ void FontPrintText(TYPE_FONT * ptrFont, short x, short y, char* str, ...)
y += ptrFont->char_h;
break;
default:
- if( (ptrFont->flags & FONT_WRAP_LINE) && (ptrFont->max_ch_wrap != 0) )
+ if ( (ptrFont->flags & FONT_WRAP_LINE) && (ptrFont->max_ch_wrap != 0) )
{
- if(++line_count >= ptrFont->max_ch_wrap)
+ if (++line_count >= ptrFont->max_ch_wrap)
{
line_count = 0;
x = orig_x;
@@ -168,7 +168,7 @@ void FontPrintText(TYPE_FONT * ptrFont, short x, short y, char* str, ...)
ptrFont->spr.v = (short)( (_ch - ptrFont->init_ch) / ptrFont->char_per_row) * ptrFont->char_h;
ptrFont->spr.v += ptrFont->spr_v; // Add original offset for image
- if(ptrFont->flags & FONT_BLEND_EFFECT)
+ if (ptrFont->flags & FONT_BLEND_EFFECT)
{
ptrFont->spr.r += 8;
ptrFont->spr.g += 8;
@@ -195,7 +195,7 @@ void FontPrintText(TYPE_FONT * ptrFont, short x, short y, char* str, ...)
}
}
- if(ptrFont->flags & FONT_BLEND_EFFECT)
+ if (ptrFont->flags & FONT_BLEND_EFFECT)
{
ptrFont->spr.r = _blend_effect_lum;
ptrFont->spr.g = _blend_effect_lum;
diff --git a/Source/Game.c b/Source/Game.c
index 844f168..102b9f3 100644
--- a/Source/Game.c
+++ b/Source/Game.c
@@ -294,9 +294,9 @@ void Game(bool two_players)
TwoPlayersActive = two_players;
GameInit();
- while(1)
+ while (1)
{
- if(GameExit() == true)
+ if (GameExit() == true)
{
break;
}
@@ -307,7 +307,7 @@ void Game(bool two_players)
GameGraphics();
- if(GameStartupFlag == true)
+ if (GameStartupFlag == true)
{
GameStartupFlag = false;
}
@@ -334,22 +334,25 @@ void Game(bool two_players)
bool GameExit(void)
{
- if(GameFinishedFlag == true)
+ //Serial_printf("GameFinishedFlag...\n");
+ if (GameFinishedFlag == true)
{
// Exit game on level finished.
- if(GameGuiFinishedDialog(&PlayerData[PLAYER_ONE]) == true)
+ if (GameGuiFinishedDialog(&PlayerData[PLAYER_ONE]) == true)
{
return true;
}
}
- if(GamePause() == true)
+ //Serial_printf("GamePause...\n");
+ if (GamePause() == true)
{
// Exit game if player desires to exit.
return true;
}
- if(GameAircraftCollisionFlag == true)
+ //Serial_printf("GameAircraftCollisionFlag...\n");
+ if (GameAircraftCollisionFlag == true)
{
GameGuiAircraftCollision(&PlayerData[PLAYER_ONE]);
return true;
@@ -377,19 +380,19 @@ bool GamePause(void)
uint8_t i;
bool pause_flag = false;
- if(GameStartupFlag == true)
+ if (GameStartupFlag == true)
{
return false;
}
- for(i = 0 ; i < MAX_PLAYERS ; i++)
+ for (i = 0 ; i < MAX_PLAYERS ; i++)
{
ptrPlayer = &PlayerData[i];
// Run player-specific functions for each player
- if(ptrPlayer->Active == true)
+ if (ptrPlayer->Active == true)
{
//Serial_printf("Released callback = 0x%08X\n", ptrPlayer->PadKeySinglePress_Callback);
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_START) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_START) == true)
{
Serial_printf("Player %d set pause_flag to true!\n",i);
pause_flag = true;
@@ -398,7 +401,7 @@ bool GamePause(void)
}
}
- if(pause_flag == true)
+ if (pause_flag == true)
{
// Blocking function:
// * Returns true if player pointed to by ptrPlayer wants to exit game
@@ -431,7 +434,7 @@ void GameInit(void)
GameStartupFlag = true;
- if(firstLoad == true)
+ if (firstLoad == true)
{
firstLoad = false;
@@ -469,7 +472,7 @@ void GameInit(void)
PlayerData[PLAYER_TWO].Active = TwoPlayersActive? true : false;
- if(PlayerData[PLAYER_TWO].Active == true)
+ if (PlayerData[PLAYER_TWO].Active == true)
{
PlayerData[PLAYER_TWO].PadKeyPressed_Callback = &PadTwoKeyPressed;
PlayerData[PLAYER_TWO].PadKeyReleased_Callback = &PadTwoKeyReleased;
@@ -491,7 +494,7 @@ void GameInit(void)
PlayerData[PLAYER_ONE].FlightDirection = DEPARTURE | ARRIVAL;
}
- for(i = 0; i < MAX_PLAYERS ; i++)
+ for (i = 0; i < MAX_PLAYERS ; i++)
{
CameraInit(&PlayerData[i]);
PlayerData[i].ShowAircraftData = false;
@@ -509,7 +512,7 @@ void GameInit(void)
GameAircraftCollisionFlag = false;
GameAircraftCollisionIdx = 0;
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
GameMouseSpr.x = MOUSE_X_2PLAYER;
GameMouseSpr.y = MOUSE_Y_2PLAYER;
@@ -741,7 +744,7 @@ void GameEmergencyMode(void)
.g = ERROR_RECT_G,
.b = ERROR_RECT_B };
- if(SystemGetEmergencyMode() == true)
+ if (SystemGetEmergencyMode() == true)
{
// One of the pads has been disconnected during gameplay
// Show an error screen until it is disconnected again.
@@ -749,9 +752,9 @@ void GameEmergencyMode(void)
GsSortCls(0,0,0);
GsSortRectangle(&errorRct);
- for(i = 0; i < MAX_PLAYERS; i++)
+ for (i = 0; i < MAX_PLAYERS; i++)
{
- if(disconnected_players & (1<<i) )
+ if (disconnected_players & (1<<i) )
{
FontPrintText( &SmallFont,
PAD_DISCONNECTED_TEXT_X,
@@ -763,13 +766,13 @@ void GameEmergencyMode(void)
GfxDrawScene_Slow();
}
- for(i = 0; i < MAX_PLAYERS; i++)
+ for (i = 0; i < MAX_PLAYERS; i++)
{
TYPE_PLAYER* ptrPlayer = &PlayerData[i];
- if(ptrPlayer->Active == true)
+ if (ptrPlayer->Active == true)
{
- if(PadXConnected[i]() == false)
+ if (PadXConnected[i]() == false)
{
enabled = true;
disconnected_players |= 1<<i;
@@ -783,7 +786,7 @@ void GameEmergencyMode(void)
SystemSetEmergencyMode(enabled);
- }while(SystemGetEmergencyMode() == true);
+ }while (SystemGetEmergencyMode() == true);
}
/* ***************************************************************************************
@@ -809,22 +812,22 @@ void GameGetAircraftTilemap(uint8_t i)
uint16_t tileNr;
uint8_t j;
- if(i == 0)
+ if (i == 0)
{
memset(GameAircraftTilemap, FLIGHT_DATA_INVALID_IDX, sizeof(GameAircraftTilemap) );
}
- if(FlightData.State[i] == STATE_IDLE)
+ if (FlightData.State[i] == STATE_IDLE)
{
return;
}
tileNr = AircraftGetTileFromFlightDataIndex(i);
- for(j = 0; j < GAME_MAX_AIRCRAFT_PER_TILE; j++)
+ for (j = 0; j < GAME_MAX_AIRCRAFT_PER_TILE; j++)
{
//DEBUG_PRINT_VAR(GameAircraftTilemap[tileNr][j]);
- if(GameAircraftTilemap[tileNr][j] == FLIGHT_DATA_INVALID_IDX)
+ if (GameAircraftTilemap[tileNr][j] == FLIGHT_DATA_INVALID_IDX)
{
break;
}
@@ -859,7 +862,7 @@ void GameCalculations(void)
// FlightData handling
- for(i = 0; i < FlightData.nAircraft; i++)
+ for (i = 0; i < FlightData.nAircraft; i++)
{
GameFinished(i);
GameClockFlights(i);
@@ -872,10 +875,10 @@ void GameCalculations(void)
AircraftHandler();
GameGuiCalculateSlowScore();
- for(i = 0 ; i < MAX_PLAYERS ; i++)
+ for (i = 0 ; i < MAX_PLAYERS ; i++)
{
// Run player-specific functions for each player
- if(PlayerData[i].Active == true)
+ if (PlayerData[i].Active == true)
{
GamePlayerHandler(&PlayerData[i], &FlightData);
}
@@ -913,7 +916,7 @@ void GamePlayerHandler(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
// to a incorrect instance.
GameActiveAircraftList(ptrPlayer, ptrFlightData);
- if(GameAircraftCollisionFlag == true)
+ if (GameAircraftCollisionFlag == true)
{
TYPE_ISOMETRIC_POS IsoPos = AircraftGetIsoPos(GameAircraftCollisionIdx);
CameraMoveToIsoPos(ptrPlayer, IsoPos);
@@ -945,17 +948,17 @@ void GamePlayerHandler(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
void GameClock(void)
{
- if(System1SecondTick() == true)
+ if (System1SecondTick() == true)
{
GameMinutes++;
- if(GameMinutes >= 60)
+ if (GameMinutes >= 60)
{
GameHour++;
GameMinutes = 0;
}
- if(GameHour >= 24)
+ if (GameHour >= 24)
{
GameHour = 0;
}
@@ -981,9 +984,9 @@ void GameClock(void)
void GameClockFlights(uint8_t i)
{
- if(System1SecondTick() == true)
+ if (System1SecondTick() == true)
{
- if( (FlightData.Minutes[i] == 0)
+ if ( (FlightData.Minutes[i] == 0)
&&
(FlightData.Hours[i] > 0) )
{
@@ -991,12 +994,12 @@ void GameClockFlights(uint8_t i)
FlightData.Hours[i]--;
}
- if(FlightData.Minutes[i] > 0)
+ if (FlightData.Minutes[i] > 0)
{
FlightData.Minutes[i]--;
}
- if( (FlightData.State[i] != STATE_IDLE)
+ if ( (FlightData.State[i] != STATE_IDLE)
&&
(FlightData.RemainingTime[i] > 0) )
{
@@ -1030,14 +1033,14 @@ void GameGraphics(void)
SystemAcknowledgeFrame();
- while( (SystemRefreshNeeded() == false) || (GfxIsGPUBusy() == true) );
+ while ( (SystemRefreshNeeded() == false) || (GfxIsGPUBusy() == true) );
- if(TwoPlayersActive == true)
+ if (TwoPlayersActive == true)
{
split_screen = true;
}
- if(GfxGetGlobalLuminance() < NORMAL_LUMINANCE)
+ if (GfxGetGlobalLuminance() < NORMAL_LUMINANCE)
{
// Fading from black effect on startup.
GfxIncreaseGlobalLuminance(1);
@@ -1045,15 +1048,15 @@ void GameGraphics(void)
GsSortCls(0,0,GfxGetGlobalLuminance() >> 1);
- while(GsIsDrawing());
+ while (GsIsDrawing());
- for(i = 0; i < MAX_PLAYERS ; i++)
+ for (i = 0; i < MAX_PLAYERS ; i++)
{
TYPE_PLAYER* ptrPlayer = &PlayerData[i];
- if(ptrPlayer->Active == true)
+ if (ptrPlayer->Active == true)
{
- if(split_screen == true)
+ if (split_screen == true)
{
GfxSetSplitScreen(i);
}
@@ -1077,17 +1080,17 @@ void GameGraphics(void)
GameGuiDrawUnboardingSequence(ptrPlayer);
- if(split_screen == true)
+ if (split_screen == true)
{
GfxDrawScene_NoSwap();
- while(GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() == true);
}
}
}
// Avoid changing drawing environment twice on 1-player mode
// as it doesn't make any sense.
- if(split_screen == true)
+ if (split_screen == true)
{
GfxDisableSplitScreen();
}
@@ -1100,7 +1103,7 @@ void GameGraphics(void)
GameGuiShowScore();
- if(split_screen == true)
+ if (split_screen == true)
{
GfxDrawScene_NoSwap();
}
@@ -1129,7 +1132,7 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer)
uint8_t columns = 0;
uint8_t k;
- for(tileNr = 0; tileNr < GameLevelSize; tileNr++)
+ for (tileNr = 0; tileNr < GameLevelSize; tileNr++)
{
// Building data is stored in GameLevelBuffer MSB. LSB is dedicated to tile data.
uint8_t CurrentBuilding = (uint8_t)(GameLevelBuffer[tileNr] >> 8);
@@ -1139,7 +1142,7 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer)
memset(AircraftRenderOrder, FLIGHT_DATA_INVALID_IDX, sizeof(AircraftRenderOrder) );
- for(j = 0; j < GAME_MAX_AIRCRAFT_PER_TILE; j++)
+ for (j = 0; j < GAME_MAX_AIRCRAFT_PER_TILE; j++)
{
// Fill with 0x7FFF (maximum 16-bit positive value).
Aircraft_Y_Data[j] = 0x7FFF;
@@ -1147,13 +1150,13 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer)
//memset(Aircraft_Y_Data, 0x7F, GAME_MAX_AIRCRAFT_PER_TILE * sizeof(short));
- for(j = 0; j < GAME_MAX_AIRCRAFT_PER_TILE; j++)
+ for (j = 0; j < GAME_MAX_AIRCRAFT_PER_TILE; j++)
{
uint8_t AircraftIdx = GameAircraftTilemap[tileNr][j];
TYPE_ISOMETRIC_POS aircraftIsoPos = AircraftGetIsoPos(AircraftIdx);
- if(AircraftIdx == FLIGHT_DATA_INVALID_IDX)
+ if (AircraftIdx == FLIGHT_DATA_INVALID_IDX)
{
// No more aircraft on this tile.
break;
@@ -1161,13 +1164,13 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer)
//DEBUG_PRINT_VAR(aircraftIsoPos.y);
- for(k = 0; k < GAME_MAX_AIRCRAFT_PER_TILE; k++)
+ for (k = 0; k < GAME_MAX_AIRCRAFT_PER_TILE; k++)
{
- if(aircraftIsoPos.y < Aircraft_Y_Data[k])
+ if (aircraftIsoPos.y < Aircraft_Y_Data[k])
{
uint8_t idx;
- for(idx = k; idx < (GAME_MAX_AIRCRAFT_PER_TILE - 1); idx++)
+ for (idx = k; idx < (GAME_MAX_AIRCRAFT_PER_TILE - 1); idx++)
{
// Move previous Y values to the right.
Aircraft_Y_Data[idx + 1] = Aircraft_Y_Data[idx];
@@ -1181,16 +1184,16 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer)
}
}
- /*for(k = 0; k < GAME_MAX_AIRCRAFT_PER_TILE; k++)
+ /*for (k = 0; k < GAME_MAX_AIRCRAFT_PER_TILE; k++)
{
Serial_printf("Aircraft_Y_Data[%d] = %d\n", k, Aircraft_Y_Data[k]);
Serial_printf("AircraftRenderOrder[%d] = %d\n", k, AircraftRenderOrder[k]);
}*/
}
- if(CurrentBuilding == BUILDING_NONE)
+ if (CurrentBuilding == BUILDING_NONE)
{
- for(k = 0; k < GAME_MAX_AIRCRAFT_PER_TILE; k++)
+ for (k = 0; k < GAME_MAX_AIRCRAFT_PER_TILE; k++)
{
AircraftRender(ptrPlayer, AircraftRenderOrder[k]);
}
@@ -1228,11 +1231,11 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer)
CameraApplyCoordinatesToSprite(ptrPlayer, &GameBuildingSpr);
- for(k = 0; k < GAME_MAX_AIRCRAFT_PER_TILE; k++)
+ for (k = 0; k < GAME_MAX_AIRCRAFT_PER_TILE; k++)
{
- if(AircraftRenderOrder[k] == FLIGHT_DATA_INVALID_IDX)
+ if (AircraftRenderOrder[k] == FLIGHT_DATA_INVALID_IDX)
{
- if(buildingDrawn == false)
+ if (buildingDrawn == false)
{
GfxSortSprite(&GameBuildingSpr);
@@ -1245,13 +1248,13 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer)
break;
}
- if(Aircraft_Y_Data[k] < buildingIsoPos.y)
+ if (Aircraft_Y_Data[k] < buildingIsoPos.y)
{
AircraftRender(ptrPlayer, AircraftRenderOrder[k]);
}
else
{
- if(buildingDrawn == false)
+ if (buildingDrawn == false)
{
GfxSortSprite(&GameBuildingSpr);
@@ -1266,7 +1269,7 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer)
}
}
- if(columns < (GameLevelColumns - 1) )
+ if (columns < (GameLevelColumns - 1) )
{
columns++;
}
@@ -1305,7 +1308,7 @@ void GameLoadLevel(void)
// Header treatment (magic number, map size, map title...) should be done
// using System's file buffer.
- if(SystemLoadFile(GameLevelList[0]) == false)
+ if (SystemLoadFile(GameLevelList[0]) == false)
{
return;
}
@@ -1322,7 +1325,7 @@ void GameLoadLevel(void)
Serial_printf("Level header: %s\n",LevelHeader);
- if(strncmp(LevelHeader,LEVEL_MAGIC_NUMBER_STRING,LEVEL_MAGIC_NUMBER_SIZE) != 0)
+ if (strncmp(LevelHeader,LEVEL_MAGIC_NUMBER_STRING,LEVEL_MAGIC_NUMBER_SIZE) != 0)
{
Serial_printf("Invalid level header! Read \"%s\" instead of \"ATC\"\n",LevelHeader);
return;
@@ -1334,7 +1337,7 @@ void GameLoadLevel(void)
Serial_printf("Level size: %d\n",GameLevelColumns);
- if( (GameLevelColumns < MIN_MAP_COLUMNS)
+ if ( (GameLevelColumns < MIN_MAP_COLUMNS)
||
(GameLevelColumns > MAX_MAP_COLUMNS) )
{
@@ -1385,9 +1388,9 @@ void GameAircraftState(uint8_t i)
// is just the NULL character.
// Not an ideal solution, but the best one currently available.
- if(FlightData.Finished[i] == false)
+ if (FlightData.Finished[i] == false)
{
- if( (FlightData.Hours[i] == 0)
+ if ( (FlightData.Hours[i] == 0)
&&
(FlightData.Minutes[i] == 0)
&&
@@ -1397,33 +1400,33 @@ void GameAircraftState(uint8_t i)
&&
(spawnMinTimeFlag == false) )
{
- if( (FlightData.FlightDirection[i] == DEPARTURE)
+ if ( (FlightData.FlightDirection[i] == DEPARTURE)
&&
(FlightData.Parking[i] != 0) )
{
uint8_t j;
bool bParkingBusy = false;
- for(j = 0; j < FlightData.nAircraft; j++)
+ for (j = 0; j < FlightData.nAircraft; j++)
{
- if(AircraftFromFlightDataIndex(j)->State != STATE_IDLE)
+ if (AircraftFromFlightDataIndex(j)->State != STATE_IDLE)
{
uint16_t tile = AircraftGetTileFromFlightDataIndex(j);
uint16_t* targets = AircraftGetTargets(j);
- if(tile == FlightData.Parking[i])
+ if (tile == FlightData.Parking[i])
{
bParkingBusy = true;
}
- if(SystemContains_u16(FlightData.Parking[i], targets, AIRCRAFT_MAX_TARGETS) == true)
+ if (SystemContains_u16(FlightData.Parking[i], targets, AIRCRAFT_MAX_TARGETS) == true)
{
bParkingBusy = true;
}
}
}
- if(bParkingBusy == false)
+ if (bParkingBusy == false)
{
FlightData.State[i] = STATE_PARKED;
@@ -1436,14 +1439,14 @@ void GameAircraftState(uint8_t i)
Serial_printf("Target assigned = %d\n", target[0]);
- if(AircraftAddNew(&FlightData, i, target) == false)
+ if (AircraftAddNew(&FlightData, i, target) == false)
{
Serial_printf("Exceeded maximum aircraft number!\n");
return;
}
}
}
- else if(FlightData.FlightDirection[i] == ARRIVAL)
+ else if (FlightData.FlightDirection[i] == ARRIVAL)
{
Serial_printf("Flight %d set to STATE_APPROACH.\n", i);
FlightData.State[i] = STATE_APPROACH;
@@ -1456,7 +1459,7 @@ void GameAircraftState(uint8_t i)
}
}
- if( (FlightData.State[i] != STATE_IDLE)
+ if ( (FlightData.State[i] != STATE_IDLE)
&&
(FlightData.RemainingTime[i] == 0) )
{
@@ -1503,12 +1506,12 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
//uint16_t end_timer_value = 0;
// Prepare runway to be painted in blue if player is on runway selection mode
- if(ptrPlayer->SelectRunway == true)
+ if (ptrPlayer->SelectRunway == true)
{
/*Serial_printf("Runway array:\n");
- for(j = 0; j < GAME_MAX_RWY_LENGTH; j++)
+ for (j = 0; j < GAME_MAX_RWY_LENGTH; j++)
{
Serial_printf("%d ",ptrPlayer->RwyArray[j]);
}
@@ -1516,7 +1519,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
Serial_printf("\n");*/
}
- for(i = 0 ; i < GameLevelSize; i++)
+ for (i = 0 ; i < GameLevelSize; i++)
{
// GameLevelBuffer bits explanation:
// X X X X X X X X X X X X X X X X
@@ -1541,7 +1544,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
tileCartPos = GfxIsometricToCartesian(&tileIsoPos);
// Flipped tiles have bit 7 set.
- if(CurrentTile & TILE_MIRROR_FLAG)
+ if (CurrentTile & TILE_MIRROR_FLAG)
{
flip_id = true;
aux_id = CurrentTile;
@@ -1552,12 +1555,12 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
flip_id = false;
}
- if(CurrentTile <= LAST_TILE_TILESET1)
+ if (CurrentTile <= LAST_TILE_TILESET1)
{
// Draw using GameTilesetSpr
ptrTileset = &GameTilesetSpr;
}
- else if( (CurrentTile > LAST_TILE_TILESET1)
+ else if ( (CurrentTile > LAST_TILE_TILESET1)
&&
(CurrentTile <= LAST_TILE_TILESET2) )
{
@@ -1570,7 +1573,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
continue;
-// if(flip_id == false)
+// if (flip_id == false)
// {
// continue;
// }
@@ -1588,7 +1591,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
CameraApplyCoordinatesToSprite(ptrPlayer, ptrTileset);
- if(columns < (GameLevelColumns - 1) )
+ if (columns < (GameLevelColumns - 1) )
{
columns++;
}
@@ -1598,7 +1601,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
columns = 0;
}
- if(GfxIsSpriteInsideScreenArea(ptrTileset) == false)
+ if (GfxIsSpriteInsideScreenArea(ptrTileset) == false)
{
continue;
}
@@ -1607,14 +1610,14 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
ptrTileset->g = NORMAL_LUMINANCE;
ptrTileset->b = NORMAL_LUMINANCE;
- if( (ptrPlayer->SelectRunway == true)
+ if ( (ptrPlayer->SelectRunway == true)
&&
(i != 0)
&&
(SystemContains_u16(i, ptrPlayer->RwyArray, GAME_MAX_RWY_LENGTH) == true) )
{
- if(used_rwy == true)
+ if (used_rwy == true)
{
ptrTileset->r = rwy_sine;
ptrTileset->b = NORMAL_LUMINANCE >> 2;
@@ -1627,19 +1630,19 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
ptrTileset->b = rwy_sine;
}
}
- else if( ( (ptrPlayer->SelectTaxiwayParking == true)
+ else if ( ( (ptrPlayer->SelectTaxiwayParking == true)
||
(ptrPlayer->SelectTaxiwayRunway == true) )
&&
(i != 0) )
{
- if(( (SystemContains_u16(i, ptrPlayer->Waypoints, PLAYER_MAX_WAYPOINTS) == true)
+ if (( (SystemContains_u16(i, ptrPlayer->Waypoints, PLAYER_MAX_WAYPOINTS) == true)
||
(i == ptrPlayer->SelectedTile) )
&&
(ptrPlayer->SelectedTile != GAME_INVALID_TILE_SELECTION) )
{
- if(ptrPlayer->InvalidPath == true)
+ if (ptrPlayer->InvalidPath == true)
{
ptrTileset->r = rwy_sine;
ptrTileset->b = NORMAL_LUMINANCE >> 2;
@@ -1652,7 +1655,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
ptrTileset->b = rwy_sine;
}
}
- else if( (ptrPlayer->SelectTaxiwayRunway == true)
+ else if ( (ptrPlayer->SelectTaxiwayRunway == true)
&&
( (CurrentTile == TILE_RWY_HOLDING_POINT)
||
@@ -1662,7 +1665,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
ptrTileset->g = rwy_sine;
ptrTileset->b = NORMAL_LUMINANCE >> 2;
}
- else if( (ptrPlayer->SelectTaxiwayParking == true)
+ else if ( (ptrPlayer->SelectTaxiwayParking == true)
&&
( (CurrentTile == TILE_PARKING)
||
@@ -1678,9 +1681,9 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
}
}
- if(ptrTileset != NULL)
+ if (ptrTileset != NULL)
{
- if(flip_id == true)
+ if (flip_id == true)
{
ptrTileset->attribute |= H_FLIP;
}
@@ -1692,7 +1695,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
ptrTileset->mx = ptrTileset->u + (TILE_SIZE >> 1);
ptrTileset->my = ptrTileset->v + (TILE_SIZE_H >> 1);
- if(flip_id == true)
+ if (flip_id == true)
{
flip_id = false;
CurrentTile = aux_id;
@@ -1702,7 +1705,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
GfxSortSprite(ptrTileset);
- if(ptrTileset->attribute & H_FLIP)
+ if (ptrTileset->attribute & H_FLIP)
{
ptrTileset->attribute &= ~(H_FLIP);
}
@@ -1760,12 +1763,12 @@ void GameActiveAircraft(uint8_t i)
{
// Reset iterator when i == 0.
- if(i == 0)
+ if (i == 0)
{
FlightData.ActiveAircraft = 0;
}
- if(FlightData.State[i] != STATE_IDLE)
+ if (FlightData.State[i] != STATE_IDLE)
{
FlightData.ActiveAircraft++;
}
@@ -1796,17 +1799,17 @@ void GameActiveAircraft(uint8_t i)
void GameStateShowAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
{
- if(ptrPlayer->ShowAircraftData == true)
+ if (ptrPlayer->ShowAircraftData == true)
{
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) == true)
{
ptrPlayer->ShowAircraftData = false;
}
}
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_CIRCLE) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_CIRCLE) == true)
{
- if(GameGuiShowAircraftDataSpecialConditions(ptrPlayer) == false)
+ if (GameGuiShowAircraftDataSpecialConditions(ptrPlayer) == false)
{
//Invert ptrPlayer->ShowAircraftData value
ptrPlayer->ShowAircraftData = ptrPlayer->ShowAircraftData ? false : true;
@@ -1841,21 +1844,21 @@ void GameStateLockTarget(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
{
uint8_t AircraftIdx = ptrPlayer->FlightDataSelectedAircraft;
- if(ptrPlayer->LockTarget == true)
+ if (ptrPlayer->LockTarget == true)
{
- if(ptrPlayer->LockedAircraft != FLIGHT_DATA_INVALID_IDX)
+ if (ptrPlayer->LockedAircraft != FLIGHT_DATA_INVALID_IDX)
{
CameraMoveToIsoPos(ptrPlayer, AircraftGetIsoPos(ptrPlayer->LockedAircraft) );
}
}
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_SQUARE) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_SQUARE) == true)
{
- if(ptrPlayer->LockTarget == false)
+ if (ptrPlayer->LockTarget == false)
{
- if(ptrPlayer->ShowAircraftData == true)
+ if (ptrPlayer->ShowAircraftData == true)
{
- if( (ptrFlightData->State[AircraftIdx] != STATE_IDLE)
+ if ( (ptrFlightData->State[AircraftIdx] != STATE_IDLE)
&&
(ptrFlightData->State[AircraftIdx] != STATE_APPROACH) )
{
@@ -1870,9 +1873,9 @@ void GameStateLockTarget(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
ptrPlayer->LockedAircraft = FLIGHT_DATA_INVALID_IDX;
}
}
- else if(ptrPlayer->PadDirectionKeyPressed_Callback() == true)
+ else if (ptrPlayer->PadDirectionKeyPressed_Callback() == true)
{
- if( (ptrPlayer->LockTarget == true)
+ if ( (ptrPlayer->LockTarget == true)
&&
(ptrPlayer->ShowAircraftData == false) )
{
@@ -1913,7 +1916,7 @@ void GameStateSelectTaxiwayRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrF
/*Serial_printf("Camera is pointing to {%d,%d}\n",IsoPos.x, IsoPos.y);*/
- if(ptrPlayer->SelectTaxiwayRunway == true)
+ if (ptrPlayer->SelectTaxiwayRunway == true)
{
// Under this mode, always reset locking target.
ptrPlayer->LockTarget = false;
@@ -1921,12 +1924,12 @@ void GameStateSelectTaxiwayRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrF
ptrPlayer->SelectedTile = GameGetTileFromIsoPosition(&IsoPos);
- if(GamePathToTile(ptrPlayer, ptrFlightData) == false)
+ if (GamePathToTile(ptrPlayer, ptrFlightData) == false)
{
ptrPlayer->InvalidPath = true;
}
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) == true)
{
// State exit.
ptrPlayer->SelectTaxiwayRunway = false;
@@ -1935,13 +1938,13 @@ void GameStateSelectTaxiwayRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrF
ptrPlayer->WaypointIdx = 0;
ptrPlayer->LastWaypointIdx = 0;
}
- else if(ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
+ else if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
{
- if(ptrPlayer->InvalidPath == false)
+ if (ptrPlayer->InvalidPath == false)
{
- for(i = 0; i < PLAYER_MAX_WAYPOINTS; i++)
+ for (i = 0; i < PLAYER_MAX_WAYPOINTS; i++)
{
- if(ptrPlayer->Waypoints[i] == 0)
+ if (ptrPlayer->Waypoints[i] == 0)
{
break;
}
@@ -1965,7 +1968,7 @@ void GameStateSelectTaxiwayRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrF
AircraftFromFlightDataIndexAddTargets(ptrPlayer->FlightDataSelectedAircraft, ptrPlayer->Waypoints);
Serial_printf("Added these targets to aircraft %d:\n", ptrPlayer->FlightDataSelectedAircraft);
- for(i = 0; i < PLAYER_MAX_WAYPOINTS; i++)
+ for (i = 0; i < PLAYER_MAX_WAYPOINTS; i++)
{
Serial_printf("%d ",ptrPlayer->Waypoints[i]);
}
@@ -2021,7 +2024,7 @@ void GameStateSelectTaxiwayParking(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptr
uint8_t i;
uint16_t target_tile;
- if(ptrPlayer->SelectTaxiwayParking == true)
+ if (ptrPlayer->SelectTaxiwayParking == true)
{
// Under this mode, always reset locking target.
ptrPlayer->LockTarget = false;
@@ -2029,12 +2032,12 @@ void GameStateSelectTaxiwayParking(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptr
ptrPlayer->SelectedTile = GameGetTileFromIsoPosition(&IsoPos);
- if(GamePathToTile(ptrPlayer, ptrFlightData) == false)
+ if (GamePathToTile(ptrPlayer, ptrFlightData) == false)
{
ptrPlayer->InvalidPath = true;
}
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) == true)
{
// State exit.
ptrPlayer->SelectTaxiwayParking = false;
@@ -2043,13 +2046,13 @@ void GameStateSelectTaxiwayParking(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptr
ptrPlayer->WaypointIdx = 0;
ptrPlayer->LastWaypointIdx = 0;
}
- else if(ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
+ else if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
{
- if(ptrPlayer->InvalidPath == false)
+ if (ptrPlayer->InvalidPath == false)
{
- for(i = 0; i < PLAYER_MAX_WAYPOINTS; i++)
+ for (i = 0; i < PLAYER_MAX_WAYPOINTS; i++)
{
- if(ptrPlayer->Waypoints[i] == 0)
+ if (ptrPlayer->Waypoints[i] == 0)
{
break;
}
@@ -2068,7 +2071,7 @@ void GameStateSelectTaxiwayParking(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptr
SfxPlaySound(&BeepSnd);
- if( (target_tile == TILE_PARKING)
+ if ( (target_tile == TILE_PARKING)
||
(target_tile == (TILE_PARKING | TILE_MIRROR_FLAG))
||
@@ -2081,7 +2084,7 @@ void GameStateSelectTaxiwayParking(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptr
Serial_printf("Added these targets to aircraft %d:\n", ptrPlayer->FlightDataSelectedAircraft);
- for(i = 0; i < PLAYER_MAX_WAYPOINTS; i++)
+ for (i = 0; i < PLAYER_MAX_WAYPOINTS; i++)
{
Serial_printf("%d ",ptrPlayer->Waypoints[i]);
}
@@ -2131,7 +2134,7 @@ void GameStateSelectRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightDa
GameGetYFromTile_short(GameRwy[ptrPlayer->SelectedRunway]),
0 };
- if(ptrPlayer->SelectRunway == true)
+ if (ptrPlayer->SelectRunway == true)
{
// Under this mode, always reset locking target.
ptrPlayer->LockTarget = false;
@@ -2141,24 +2144,24 @@ void GameStateSelectRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightDa
CameraMoveToIsoPos(ptrPlayer, IsoPos);
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) == true)
{
ptrPlayer->SelectRunway = false;
}
- else if(ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
+ else if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
{
ptrPlayer->SelectRunway = false;
- if(SystemContains_u16(GameRwy[ptrPlayer->SelectedRunway], GameUsedRwy, GAME_MAX_RUNWAYS) == false)
+ if (SystemContains_u16(GameRwy[ptrPlayer->SelectedRunway], GameUsedRwy, GAME_MAX_RUNWAYS) == false)
{
ptrPlayer->SelectRunway = false;
Serial_printf("Player selected runway %d!\n",GameRwy[ptrPlayer->SelectedRunway]);
success = false;
- for(i = 0; i < GAME_MAX_RUNWAYS; i++)
+ for (i = 0; i < GAME_MAX_RUNWAYS; i++)
{
- if(GameUsedRwy[i] == 0)
+ if (GameUsedRwy[i] == 0)
{
GameAssignRunwaytoAircraft(ptrPlayer, ptrFlightData);
success = true;
@@ -2167,29 +2170,29 @@ void GameStateSelectRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightDa
}
}
- if(success == false)
+ if (success == false)
{
Serial_printf("No available runways!\n");
}
}
}
- else if(ptrPlayer->PadKeySinglePress_Callback(PAD_LEFT) == true)
+ else if (ptrPlayer->PadKeySinglePress_Callback(PAD_LEFT) == true)
{
- if(ptrFlightData->State[ptrPlayer->FlightDataSelectedAircraft] == STATE_APPROACH)
+ if (ptrFlightData->State[ptrPlayer->FlightDataSelectedAircraft] == STATE_APPROACH)
{
- if(ptrPlayer->SelectedRunway != 0)
+ if (ptrPlayer->SelectedRunway != 0)
{
ptrPlayer->SelectedRunway--;
}
}
}
- else if(ptrPlayer->PadKeySinglePress_Callback(PAD_RIGHT) == true)
+ else if (ptrPlayer->PadKeySinglePress_Callback(PAD_RIGHT) == true)
{
- if(ptrFlightData->State[ptrPlayer->FlightDataSelectedAircraft] == STATE_APPROACH)
+ if (ptrFlightData->State[ptrPlayer->FlightDataSelectedAircraft] == STATE_APPROACH)
{
- if(ptrPlayer->SelectedRunway < (GAME_MAX_RUNWAYS - 1))
+ if (ptrPlayer->SelectedRunway < (GAME_MAX_RUNWAYS - 1))
{
- if(GameRwy[ptrPlayer->SelectedRunway + 1] != 0)
+ if (GameRwy[ptrPlayer->SelectedRunway + 1] != 0)
{
ptrPlayer->SelectedRunway++;
}
@@ -2219,11 +2222,11 @@ void GameGetRunwayArray(void)
uint8_t i;
uint8_t j = 0;
- for(i = 0; i < GameLevelSize; i++)
+ for (i = 0; i < GameLevelSize; i++)
{
- if(GameLevelBuffer[i] == TILE_RWY_START_1)
+ if (GameLevelBuffer[i] == TILE_RWY_START_1)
{
- if(SystemContains_u16(i, GameLevelBuffer, GAME_MAX_RUNWAYS) == false)
+ if (SystemContains_u16(i, GameLevelBuffer, GAME_MAX_RUNWAYS) == false)
{
GameRwy[j++] = i;
}
@@ -2232,9 +2235,9 @@ void GameGetRunwayArray(void)
Serial_printf("GameRwy = ");
- for(i = 0; i < GAME_MAX_RUNWAYS; i++)
+ for (i = 0; i < GAME_MAX_RUNWAYS; i++)
{
- if(GameRwy[i] == 0)
+ if (GameRwy[i] == 0)
{
break;
}
@@ -2271,11 +2274,11 @@ void GameSelectAircraftFromList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
uint8_t AircraftIdx = ptrPlayer->FlightDataSelectedAircraft;
FL_STATE aircraftState = ptrFlightData->State[AircraftIdx];
- if(ptrPlayer->ShowAircraftData == true)
+ if (ptrPlayer->ShowAircraftData == true)
{
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
{
- if(ptrPlayer->ActiveAircraft != 0)
+ if (ptrPlayer->ActiveAircraft != 0)
{
ptrPlayer->ShowAircraftData = false;
@@ -2319,9 +2322,9 @@ void GameSelectAircraftFromList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
ptrPlayer->SelectRunway = true;
GameGetRunwayEntryTile(AircraftIdx, &rwyEntryData);
- for(i = 0; GameRwy[i] != 0 && (i < (sizeof(GameRwy) / sizeof(GameRwy[0]))); i++)
+ for (i = 0; GameRwy[i] != 0 && (i < (sizeof(GameRwy) / sizeof(GameRwy[0]))); i++)
{
- if(GameRwy[i] == rwyEntryData.rwyHeader)
+ if (GameRwy[i] == rwyEntryData.rwyHeader)
{
break;
}
@@ -2345,15 +2348,15 @@ void GameSelectAircraftFromList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
Serial_printf("aircraftState = %d\n", aircraftState);
Serial_printf("AircraftIdx = %d\n", AircraftIdx);
}
- else if(ptrPlayer->PadKeySinglePress_Callback(PAD_L1) == true)
+ else if (ptrPlayer->PadKeySinglePress_Callback(PAD_L1) == true)
{
FL_STATE* AircraftState = &FlightData.State[ptrPlayer->FlightDataSelectedAircraft];
- if(*AircraftState == STATE_TAXIING)
+ if (*AircraftState == STATE_TAXIING)
{
*AircraftState = STATE_STOPPED;
}
- else if(*AircraftState == STATE_STOPPED)
+ else if (*AircraftState == STATE_STOPPED)
{
*AircraftState = STATE_TAXIING;
}
@@ -2402,7 +2405,7 @@ void GameGetSelectedRunwayArray(uint16_t rwyHeader, uint16_t* rwyArray, size_t s
static uint8_t i = 0;
static RWY_DIR dir;
- if(sz != (GAME_MAX_RWY_LENGTH * sizeof(uint16_t) ))
+ if (sz != (GAME_MAX_RWY_LENGTH * sizeof(uint16_t) ))
{
Serial_printf("GameGetSelectedRunwayArray: size %d is different"
" than expected (%d bytes). Returning...\n",
@@ -2411,7 +2414,7 @@ void GameGetSelectedRunwayArray(uint16_t rwyHeader, uint16_t* rwyArray, size_t s
return;
}
- if(rwyHeader != 0)
+ if (rwyHeader != 0)
{
// This function is called recursively.
// Since 0 is not a valid value (it's not allowed to place
@@ -2446,7 +2449,7 @@ void GameGetSelectedRunwayArray(uint16_t rwyHeader, uint16_t* rwyArray, size_t s
{
// Part two: append tiles to array until runway end is found.
- if( (GameLevelBuffer[last_tile] == TILE_RWY_START_1)
+ if ( (GameLevelBuffer[last_tile] == TILE_RWY_START_1)
||
(GameLevelBuffer[last_tile] == TILE_RWY_START_2)
||
@@ -2518,7 +2521,7 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
Serial_printf("aircraftIndex = %d\n",aircraftIndex);
- if(ptrFlightData->State[aircraftIndex] == STATE_APPROACH)
+ if (ptrFlightData->State[aircraftIndex] == STATE_APPROACH)
{
uint16_t rwyArray[GAME_MAX_RWY_LENGTH];
@@ -2527,14 +2530,14 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
GameGetSelectedRunwayArray(assignedRwy, rwyArray, sizeof(rwyArray));
- for(i = 0; i < GAME_MAX_RWY_LENGTH; i++)
+ for (i = 0; i < GAME_MAX_RWY_LENGTH; i++)
{
rwyTiles[i] = GameLevelBuffer[rwyArray[i]];
}
i = SystemIndexOf_U8((uint8_t)TILE_RWY_EXIT, rwyTiles, 0, GAME_MAX_RWY_LENGTH);
- if(i == -1)
+ if (i == -1)
{
Serial_printf("ERROR: Could not find TILE_RWY_EXIT for runway header %d.\n", assignedRwy);
return;
@@ -2542,7 +2545,7 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
i = SystemIndexOf_U8((uint8_t)TILE_RWY_EXIT, rwyTiles, i + 1, GAME_MAX_RWY_LENGTH);
- if(i == -1)
+ if (i == -1)
{
Serial_printf("ERROR: Could not find second TILE_RWY_EXIT for runway header %d.\n", assignedRwy);
return;
@@ -2553,7 +2556,7 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
targets[0] = assignedRwy;
targets[1] = rwyExit;
- if( AircraftAddNew(ptrFlightData,
+ if ( AircraftAddNew(ptrFlightData,
aircraftIndex,
targets ) == false)
{
@@ -2563,7 +2566,7 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
SfxPlaySound(&TowerFinalSnds[SystemRand(SOUND_M1_INDEX, MAX_RADIO_CHATTER_SOUNDS - 1)]);
}
- else if(ptrFlightData->State[aircraftIndex] == STATE_HOLDING_RWY)
+ else if (ptrFlightData->State[aircraftIndex] == STATE_HOLDING_RWY)
{
TYPE_RWY_ENTRY_DATA rwyEntryData;
uint8_t i;
@@ -2575,7 +2578,7 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
Serial_printf("Added the following targets = ");
- for(i = 0; i < (sizeof(targets) / sizeof(targets[0])); i++)
+ for (i = 0; i < (sizeof(targets) / sizeof(targets[0])); i++)
{
Serial_printf("%d ", targets[i]);
}
@@ -2594,9 +2597,9 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
DEBUG_PRINT_VAR(rwyEntryData.rwyEntryTile);
DEBUG_PRINT_VAR(rwyEntryData.rwyStep);
- while(GameLevelBuffer[i] != TILE_RWY_START_1)
+ while (GameLevelBuffer[i] != TILE_RWY_START_1)
{
- if(i > rwyEntryData.rwyStep)
+ if (i > rwyEntryData.rwyStep)
{
i -= rwyEntryData.rwyStep;
}
@@ -2751,9 +2754,9 @@ FL_STATE GameTargetsReached(uint16_t firstTarget, uint8_t index)
case STATE_FINAL:
FlightData.State[index] = STATE_LANDED;
- for(i = 0; i < GAME_MAX_RUNWAYS; i++)
+ for (i = 0; i < GAME_MAX_RUNWAYS; i++)
{
- if(GameUsedRwy[i] == firstTarget)
+ if (GameUsedRwy[i] == firstTarget)
{
GameUsedRwy[i] = 0;
}
@@ -2761,11 +2764,11 @@ FL_STATE GameTargetsReached(uint16_t firstTarget, uint8_t index)
break;
case STATE_TAXIING:
- if(FlightData.FlightDirection[index] == DEPARTURE)
+ if (FlightData.FlightDirection[index] == DEPARTURE)
{
FlightData.State[index] = STATE_HOLDING_RWY;
}
- else if(FlightData.FlightDirection[index] == ARRIVAL)
+ else if (FlightData.FlightDirection[index] == ARRIVAL)
{
FlightData.State[index] = STATE_UNBOARDING;
}
@@ -2811,12 +2814,12 @@ uint16_t GameGetTileFromIsoPosition(TYPE_ISOMETRIC_POS* IsoPos)
{
uint16_t tile;
- if(IsoPos == NULL)
+ if (IsoPos == NULL)
{
return 0;
}
- if( (IsoPos->x < 0) || (IsoPos->y < 0) )
+ if ( (IsoPos->x < 0) || (IsoPos->y < 0) )
{
return GAME_INVALID_TILE_SELECTION; // Invalid XYZ position
}
@@ -2896,7 +2899,7 @@ void GamePlayerAddWaypoint_Ex(TYPE_PLAYER* ptrPlayer, uint16_t tile)
// "_Ex" function allow selecting a certain tile, whereas the other one
// is a particulare case of "_Ex" for tile = ptrPlayer->SelectedTIle.
- if(ptrPlayer->WaypointIdx >= PLAYER_MAX_WAYPOINTS)
+ if (ptrPlayer->WaypointIdx >= PLAYER_MAX_WAYPOINTS)
{
Serial_printf("No available waypoints for this player!\n");
return;
@@ -2932,15 +2935,15 @@ void GamePlayerAddWaypoint_Ex(TYPE_PLAYER* ptrPlayer, uint16_t tile)
bool GameWaypointCheckExisting(TYPE_PLAYER* ptrPlayer, uint16_t temp_tile)
{
- if(SystemContains_u16(temp_tile, ptrPlayer->Waypoints, PLAYER_MAX_WAYPOINTS) == false)
+ if (SystemContains_u16(temp_tile, ptrPlayer->Waypoints, PLAYER_MAX_WAYPOINTS) == false)
{
- /*for(i = 0; i < FlightData.nAircraft; i++)
+ /*for (i = 0; i < FlightData.nAircraft; i++)
{
- if( (ptrFlightData->State[i] != STATE_IDLE)
+ if ( (ptrFlightData->State[i] != STATE_IDLE)
&&
(AircraftMoving(i) == false) )
{
- if(temp_tile == AircraftGetTileFromFlightDataIndex(i))
+ if (temp_tile == AircraftGetTileFromFlightDataIndex(i))
{
return false; // Check pending!
}
@@ -2997,12 +3000,12 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
uint16_t y_diff;
uint16_t temp_tile;
- if(ptrPlayer->SelectedTile == GAME_INVALID_TILE_SELECTION)
+ if (ptrPlayer->SelectedTile == GAME_INVALID_TILE_SELECTION)
{
return false;
}
- for(i = (ptrPlayer->LastWaypointIdx + 1); i < PLAYER_MAX_WAYPOINTS; i++)
+ for (i = (ptrPlayer->LastWaypointIdx + 1); i < PLAYER_MAX_WAYPOINTS; i++)
{
ptrPlayer->Waypoints[i] = 0;
}
@@ -3036,11 +3039,11 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
temp_tile = ptrPlayer->Waypoints[ptrPlayer->LastWaypointIdx];
- if(x_diff >= y_diff)
+ if (x_diff >= y_diff)
{
- while( (x_diff--) > 0)
+ while ( (x_diff--) > 0)
{
- if( (ptrPlayer->SelectedTile % GameLevelColumns) >
+ if ( (ptrPlayer->SelectedTile % GameLevelColumns) >
(ptrPlayer->Waypoints[ptrPlayer->LastWaypointIdx] % GameLevelColumns) )
{
temp_tile++;
@@ -3050,15 +3053,15 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
temp_tile--;
}
- if(GameWaypointCheckExisting(ptrPlayer, temp_tile) == true)
+ if (GameWaypointCheckExisting(ptrPlayer, temp_tile) == true)
{
return false; // Tile is already included in the list of temporary tiles?
}
}
- while( (y_diff--) > 0)
+ while ( (y_diff--) > 0)
{
- if( (ptrPlayer->SelectedTile / GameLevelColumns) >
+ if ( (ptrPlayer->SelectedTile / GameLevelColumns) >
(ptrPlayer->Waypoints[ptrPlayer->LastWaypointIdx] / GameLevelColumns) )
{
temp_tile += GameLevelColumns;
@@ -3068,7 +3071,7 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
temp_tile -= GameLevelColumns;
}
- if(GameWaypointCheckExisting(ptrPlayer, temp_tile) == true)
+ if (GameWaypointCheckExisting(ptrPlayer, temp_tile) == true)
{
return false; // Tile is already included in the list of temporary tiles?
}
@@ -3076,9 +3079,9 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
}
else
{
- while( (y_diff--) > 0)
+ while ( (y_diff--) > 0)
{
- if( (ptrPlayer->SelectedTile / GameLevelColumns) >
+ if ( (ptrPlayer->SelectedTile / GameLevelColumns) >
(ptrPlayer->Waypoints[ptrPlayer->LastWaypointIdx] / GameLevelColumns) )
{
temp_tile += GameLevelColumns;
@@ -3088,15 +3091,15 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
temp_tile -= GameLevelColumns;
}
- if(GameWaypointCheckExisting(ptrPlayer, temp_tile) == true)
+ if (GameWaypointCheckExisting(ptrPlayer, temp_tile) == true)
{
return false; // Tile is already included in the list of temporary tiles?
}
}
- while( (x_diff--) > 0)
+ while ( (x_diff--) > 0)
{
- if( (ptrPlayer->SelectedTile % GameLevelColumns) >
+ if ( (ptrPlayer->SelectedTile % GameLevelColumns) >
(ptrPlayer->Waypoints[ptrPlayer->LastWaypointIdx] % GameLevelColumns) )
{
temp_tile++;
@@ -3106,7 +3109,7 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
temp_tile--;
}
- if(GameWaypointCheckExisting(ptrPlayer, temp_tile) == true)
+ if (GameWaypointCheckExisting(ptrPlayer, temp_tile) == true)
{
return false; // Tile is already included in the list of temporary tiles?
}
@@ -3115,26 +3118,26 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
// Now at this point, we have prepared our array.
- for(i = 0; i < PLAYER_MAX_WAYPOINTS; i++)
+ for (i = 0; i < PLAYER_MAX_WAYPOINTS; i++)
{
- if(ptrPlayer->Waypoints[i] == 0)
+ if (ptrPlayer->Waypoints[i] == 0)
{
// We have found empty waypoints. Exit loop
break;
}
- if(SystemContains_u8( GameLevelBuffer[ptrPlayer->Waypoints[i]],
+ if (SystemContains_u8( GameLevelBuffer[ptrPlayer->Waypoints[i]],
AcceptedTiles,
sizeof(AcceptedTiles) ) == false)
{
// Now try again with mirrored tiles, just in case!
- for(j = 0; j < (sizeof(AcceptedTiles) * sizeof(uint8_t) ); j++)
+ for (j = 0; j < (sizeof(AcceptedTiles) * sizeof(uint8_t) ); j++)
{
AcceptedTiles[j] |= TILE_MIRROR_FLAG;
}
- if(SystemContains_u8( GameLevelBuffer[ptrPlayer->Waypoints[i]],
+ if (SystemContains_u8( GameLevelBuffer[ptrPlayer->Waypoints[i]],
AcceptedTiles,
sizeof(AcceptedTiles) ) == false)
{
@@ -3144,7 +3147,7 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
// Reverse mirror flag.
- for(j = 0; j < (sizeof(AcceptedTiles) * sizeof(uint8_t) ); j++)
+ for (j = 0; j < (sizeof(AcceptedTiles) * sizeof(uint8_t) ); j++)
{
AcceptedTiles[j] &= ~(TILE_MIRROR_FLAG);
}
@@ -3240,7 +3243,7 @@ bool GameTwoPlayersActive(void)
void GameDrawMouse(TYPE_PLAYER* ptrPlayer)
{
- if( (ptrPlayer->SelectTaxiwayParking == true)
+ if ( (ptrPlayer->SelectTaxiwayParking == true)
||
(ptrPlayer->SelectTaxiwayRunway == true) )
{
@@ -3265,7 +3268,7 @@ void GameDrawMouse(TYPE_PLAYER* ptrPlayer)
FL_STATE GameGetFlightDataStateFromIdx(uint8_t FlightDataIdx)
{
- if(FlightDataIdx >= FlightData.nAircraft)
+ if (FlightDataIdx >= FlightData.nAircraft)
{
return STATE_IDLE; // Error: could cause buffer overrun
}
@@ -3310,9 +3313,9 @@ uint32_t GameGetScore(void)
void GameStateUnboarding(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
{
- if(ptrPlayer->Unboarding == true)
+ if (ptrPlayer->Unboarding == true)
{
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_CIRCLE) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_CIRCLE) == true)
{
ptrPlayer->Unboarding = false;
ptrPlayer->UnboardingSequenceIdx = 0; // Player will need to repeat sequence
@@ -3322,11 +3325,11 @@ void GameStateUnboarding(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
ptrPlayer->LockTarget = true;
ptrPlayer->LockedAircraft = ptrPlayer->FlightDataSelectedAircraft;
- if(ptrPlayer->PadLastKeySinglePressed_Callback() == ptrPlayer->UnboardingSequence[ptrPlayer->UnboardingSequenceIdx])
+ if (ptrPlayer->PadLastKeySinglePressed_Callback() == ptrPlayer->UnboardingSequence[ptrPlayer->UnboardingSequenceIdx])
{
- if(++ptrPlayer->UnboardingSequenceIdx >= UNBOARDING_KEY_SEQUENCE_MEDIUM)
+ if (++ptrPlayer->UnboardingSequenceIdx >= UNBOARDING_KEY_SEQUENCE_MEDIUM)
{
- if(ptrFlightData->Passengers[ptrPlayer->FlightDataSelectedAircraft] > UNBOARDING_PASSENGERS_PER_SEQUENCE)
+ if (ptrFlightData->Passengers[ptrPlayer->FlightDataSelectedAircraft] > UNBOARDING_PASSENGERS_PER_SEQUENCE)
{
// Player has entered correct sequence. Unboard UNBOARDING_PASSENGERS_PER_SEQUENCE passengers.
@@ -3351,7 +3354,7 @@ void GameStateUnboarding(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
SfxPlaySound(&BeepSnd);
}
- else if(ptrPlayer->PadLastKeySinglePressed_Callback() != 0)
+ else if (ptrPlayer->PadLastKeySinglePressed_Callback() != 0)
{
ptrPlayer->UnboardingSequenceIdx = 0; // Player has committed a mistake while entering the sequence. Repeat it!
}
@@ -3389,7 +3392,7 @@ void GameGenerateUnboardingSequence(TYPE_PLAYER* ptrPlayer)
Serial_printf("Key sequence generated: ");
// Only medium level implemented. TODO: Implement other levels
- for(i = 0; i < UNBOARDING_KEY_SEQUENCE_MEDIUM; i++)
+ for (i = 0; i < UNBOARDING_KEY_SEQUENCE_MEDIUM; i++)
{
uint8_t randIdx = SystemRand(0, (sizeof(keyTable) / sizeof(keyTable[0])) - 1);
@@ -3461,7 +3464,7 @@ void GameCreateTakeoffWaypoints(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
return;
}
- for(currentTile = (AircraftGetTileFromFlightDataIndex(aircraftIdx) + rwyStep);
+ for (currentTile = (AircraftGetTileFromFlightDataIndex(aircraftIdx) + rwyStep);
(GameLevelBuffer[currentTile] != TILE_RWY_START_1)
&&
(GameLevelBuffer[currentTile] != TILE_RWY_START_2);
@@ -3470,16 +3473,16 @@ void GameCreateTakeoffWaypoints(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
}
- for(i = 0; i < GAME_MAX_RUNWAYS; i++)
+ for (i = 0; i < GAME_MAX_RUNWAYS; i++)
{
- if(GameUsedRwy[i] == currentTile)
+ if (GameUsedRwy[i] == currentTile)
{
GameUsedRwy[i] = 0;
break;
}
}
- for(currentTile = (AircraftGetTileFromFlightDataIndex(aircraftIdx) + rwyStep);
+ for (currentTile = (AircraftGetTileFromFlightDataIndex(aircraftIdx) + rwyStep);
GameLevelBuffer[currentTile] != TILE_RWY_EXIT;
currentTile += rwyStep )
{
@@ -3517,29 +3520,29 @@ void GameGetRunwayEntryTile(uint8_t aircraftIdx, TYPE_RWY_ENTRY_DATA* ptrRwyEntr
int16_t step = 0;
uint16_t i;
- if( (currentTile >= GameLevelColumns)
+ if ( (currentTile >= GameLevelColumns)
&&
( (currentTile + GameLevelColumns) < GameLevelSize) )
{
- if(GameLevelBuffer[currentTile + 1] == TILE_RWY_EXIT)
+ if (GameLevelBuffer[currentTile + 1] == TILE_RWY_EXIT)
{
ptrRwyEntry->Direction = AIRCRAFT_DIR_EAST;
ptrRwyEntry->rwyStep = GameLevelColumns;
step = -1;
}
- else if(GameLevelBuffer[currentTile - 1] == TILE_RWY_EXIT)
+ else if (GameLevelBuffer[currentTile - 1] == TILE_RWY_EXIT)
{
ptrRwyEntry->Direction = AIRCRAFT_DIR_WEST;
ptrRwyEntry->rwyStep = -GameLevelColumns;
step = 1;
}
- else if(GameLevelBuffer[currentTile + GameLevelColumns] == TILE_RWY_EXIT)
+ else if (GameLevelBuffer[currentTile + GameLevelColumns] == TILE_RWY_EXIT)
{
ptrRwyEntry->Direction = AIRCRAFT_DIR_SOUTH;
ptrRwyEntry->rwyStep = 1;
step = GameLevelColumns;
}
- else if(GameLevelBuffer[currentTile - GameLevelColumns] == TILE_RWY_EXIT)
+ else if (GameLevelBuffer[currentTile - GameLevelColumns] == TILE_RWY_EXIT)
{
ptrRwyEntry->Direction = AIRCRAFT_DIR_NORTH;
ptrRwyEntry->rwyStep = -1;
@@ -3558,7 +3561,7 @@ void GameGetRunwayEntryTile(uint8_t aircraftIdx, TYPE_RWY_ENTRY_DATA* ptrRwyEntr
i = ptrRwyEntry->rwyEntryTile;
- while( (GameLevelBuffer[i] != TILE_RWY_START_1)
+ while ( (GameLevelBuffer[i] != TILE_RWY_START_1)
&&
(GameLevelBuffer[i] != TILE_RWY_START_2)
&&
@@ -3600,22 +3603,22 @@ bool GameInsideLevelFromIsoPos(TYPE_ISOMETRIC_FIX16_POS* ptrIsoPos)
short x = (short)fix16_to_int(ptrIsoPos->x);
short y = (short)fix16_to_int(ptrIsoPos->y);
- if(x < 0)
+ if (x < 0)
{
return true;
}
- if(x > (GameLevelColumns << TILE_SIZE_BIT_SHIFT))
+ if (x > (GameLevelColumns << TILE_SIZE_BIT_SHIFT))
{
return true;
}
- if(y < 0)
+ if (y < 0)
{
return true;
}
- if(y > (GameLevelColumns << TILE_SIZE_BIT_SHIFT) )
+ if (y > (GameLevelColumns << TILE_SIZE_BIT_SHIFT) )
{
return true;
}
@@ -3649,44 +3652,44 @@ void GameRemoveFlight(uint8_t idx, bool successful)
{
uint8_t i;
- for(i = PLAYER_ONE; i < MAX_PLAYERS; i++)
+ for (i = PLAYER_ONE; i < MAX_PLAYERS; i++)
{
TYPE_PLAYER* ptrPlayer = &PlayerData[i];
uint8_t j;
- if(ptrPlayer->Active == false)
+ if (ptrPlayer->Active == false)
{
continue;
}
- if(idx >= FlightData.nAircraft)
+ if (idx >= FlightData.nAircraft)
{
Serial_printf("GameRemoveFlight: index %d exceeds max index %d!\n", idx, FlightData.nAircraft);
return;
}
- if((FlightData.FlightDirection[idx] & ptrPlayer->FlightDirection) == 0)
+ if ((FlightData.FlightDirection[idx] & ptrPlayer->FlightDirection) == 0)
{
continue;
}
- for(j = 0; j < ptrPlayer->ActiveAircraft; j++)
+ for (j = 0; j < ptrPlayer->ActiveAircraft; j++)
{
- if(ptrPlayer->ActiveAircraftList[j] == idx)
+ if (ptrPlayer->ActiveAircraftList[j] == idx)
{
- if(FlightData.State[idx] != STATE_IDLE)
+ if (FlightData.State[idx] != STATE_IDLE)
{
uint8_t k;
memset(ptrPlayer->UnboardingSequence, 0, GAME_MAX_SEQUENCE_KEYS);
ptrPlayer->UnboardingSequenceIdx = 0;
- for(k = 0; k < GAME_MAX_RUNWAYS; k++)
+ for (k = 0; k < GAME_MAX_RUNWAYS; k++)
{
uint16_t* targets = AircraftGetTargets(idx);
uint16_t rwyArray[GAME_MAX_RWY_LENGTH] = {0};
- if(SystemContains_u16(GameUsedRwy[k], targets, AIRCRAFT_MAX_TARGETS) == true)
+ if (SystemContains_u16(GameUsedRwy[k], targets, AIRCRAFT_MAX_TARGETS) == true)
{
GameUsedRwy[k] = 0;
}
@@ -3699,7 +3702,7 @@ void GameRemoveFlight(uint8_t idx, bool successful)
Serial_printf("2\n");
- if(SystemContains_u16( AircraftGetTileFromFlightDataIndex(idx),
+ if (SystemContains_u16( AircraftGetTileFromFlightDataIndex(idx),
rwyArray,
sizeof(rwyArray) / sizeof(rwyArray[0]) ) == true)
{
@@ -3708,9 +3711,9 @@ void GameRemoveFlight(uint8_t idx, bool successful)
}
}
- if(FlightData.State[idx] != STATE_APPROACH)
+ if (FlightData.State[idx] != STATE_APPROACH)
{
- if(AircraftRemove(idx) == false)
+ if (AircraftRemove(idx) == false)
{
Serial_printf("Something went wrong when removing aircraft!\n");
return;
@@ -3724,7 +3727,7 @@ void GameRemoveFlight(uint8_t idx, bool successful)
ptrPlayer->LockTarget = false;
ptrPlayer->LockedAircraft = FLIGHT_DATA_INVALID_IDX;
- if(successful == true)
+ if (successful == true)
{
GameScore += SCORE_REWARD_FINISH_FLIGHT;
}
@@ -3733,7 +3736,7 @@ void GameRemoveFlight(uint8_t idx, bool successful)
GameScore = (GameScore < LOST_FLIGHT_PENALTY)? 0 : (GameScore - LOST_FLIGHT_PENALTY);
}
- if(ptrPlayer->SelectedAircraft >= j)
+ if (ptrPlayer->SelectedAircraft >= j)
{
ptrPlayer->SelectedAircraft--;
}
@@ -3792,9 +3795,9 @@ void GameActiveAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightD
memset(ptrPlayer->ActiveAircraftList, 0, GAME_MAX_AIRCRAFT);
ptrPlayer->ActiveAircraft = 0;
- for(i = 0; i < FlightData.nAircraft; i++)
+ for (i = 0; i < FlightData.nAircraft; i++)
{
- if( (ptrFlightData->State[i] != STATE_IDLE)
+ if ( (ptrFlightData->State[i] != STATE_IDLE)
&&
(ptrFlightData->FlightDirection[i] & ptrPlayer->FlightDirection) )
{
@@ -3805,20 +3808,20 @@ void GameActiveAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightD
currentFlightDataIdx = ptrPlayer->ActiveAircraftList[ptrPlayer->SelectedAircraft];
- if(GameAircraftCreatedFlag == true)
+ if (GameAircraftCreatedFlag == true)
{
GameAircraftCreatedFlag = false;
- if(ptrPlayer->ActiveAircraft > 1)
+ if (ptrPlayer->ActiveAircraft > 1)
{
dprintf("currentFlightDataIdx = %d, lastFlightDataIdx = %d\n",
currentFlightDataIdx,
lastFlightDataIdx );
- if(currentFlightDataIdx != lastFlightDataIdx)
+ if (currentFlightDataIdx != lastFlightDataIdx)
{
- for(ptrPlayer->SelectedAircraft = 0; ptrPlayer->SelectedAircraft < FlightData.nAircraft; ptrPlayer->SelectedAircraft++)
+ for (ptrPlayer->SelectedAircraft = 0; ptrPlayer->SelectedAircraft < FlightData.nAircraft; ptrPlayer->SelectedAircraft++)
{
- if(ptrPlayer->ActiveAircraftList[ptrPlayer->SelectedAircraft] == lastFlightDataIdx)
+ if (ptrPlayer->ActiveAircraftList[ptrPlayer->SelectedAircraft] == lastFlightDataIdx)
{
dprintf("Recalculated ptrPlayer->SelectedAircraft from %d to %d.\n",
currentFlightDataIdx,
@@ -3857,12 +3860,12 @@ void GameRemainingAircraft(uint8_t i)
{
// Reset iterator when starting from first element.
- if(i == 0)
+ if (i == 0)
{
FlightData.nRemainingAircraft = FlightData.nAircraft;
}
- if(FlightData.Finished[i] == true)
+ if (FlightData.Finished[i] == true)
{
FlightData.nRemainingAircraft--;
}
@@ -3890,12 +3893,12 @@ void GameRemainingAircraft(uint8_t i)
void GameFinished(uint8_t i)
{
- if(i == 0)
+ if (i == 0)
{
GameFinishedFlag = true;
}
- if(FlightData.Finished[i] == false)
+ if (FlightData.Finished[i] == false)
{
GameFinishedFlag = false;
}
diff --git a/Source/GameGui.c b/Source/GameGui.c
index 0a0ea72..a4355a2 100644
--- a/Source/GameGui.c
+++ b/Source/GameGui.c
@@ -250,7 +250,7 @@ void GameGuiInit(void)
static bool firstLoad = true;
- if(firstLoad == true)
+ if (firstLoad == true)
{
firstLoad = false;
@@ -306,11 +306,11 @@ bool GameGuiPauseDialog(TYPE_PLAYER* ptrPlayer)
//DrawFBRect(0, 0, X_SCREEN_RESOLUTION, VRAM_H, 0, 0, 0);
- while(GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() == true);
do
{
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
{
return true;
}
@@ -321,39 +321,39 @@ bool GameGuiPauseDialog(TYPE_PLAYER* ptrPlayer)
GfxDrawScene_Slow();
- }while(ptrPlayer->PadKeySinglePress_Callback(PAD_START) == false);
+ }while (ptrPlayer->PadKeySinglePress_Callback(PAD_START) == false);
return false;
}
void GameGuiActiveAircraftPage(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
{
- if(ptrPlayer->ActiveAircraft != 0)
+ if (ptrPlayer->ActiveAircraft != 0)
{
- while(ptrPlayer->ActiveAircraft <= ptrPlayer->SelectedAircraft)
+ while (ptrPlayer->ActiveAircraft <= ptrPlayer->SelectedAircraft)
{
ptrPlayer->SelectedAircraft--;
}
}
- if(ptrPlayer->ActiveAircraft != 0)
+ if (ptrPlayer->ActiveAircraft != 0)
{
- while(ptrPlayer->ActiveAircraft <= (uint8_t)(GAME_GUI_AIRCRAFT_DATA_MAX_PAGE * ptrPlayer->FlightDataPage) )
+ while (ptrPlayer->ActiveAircraft <= (uint8_t)(GAME_GUI_AIRCRAFT_DATA_MAX_PAGE * ptrPlayer->FlightDataPage) )
{
ptrPlayer->FlightDataPage--;
}
}
- while(ptrPlayer->SelectedAircraft > (uint8_t)(GAME_GUI_AIRCRAFT_DATA_MAX_PAGE * (ptrPlayer->FlightDataPage + 1)) )
+ while (ptrPlayer->SelectedAircraft > (uint8_t)(GAME_GUI_AIRCRAFT_DATA_MAX_PAGE * (ptrPlayer->FlightDataPage + 1)) )
{
ptrPlayer->FlightDataPage++;
}
- if(ptrPlayer->ShowAircraftData == true)
+ if (ptrPlayer->ShowAircraftData == true)
{
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_DOWN) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_DOWN) == true)
{
- if( ( (ptrPlayer->SelectedAircraft + 1) < ptrPlayer->ActiveAircraft)
+ if ( ( (ptrPlayer->SelectedAircraft + 1) < ptrPlayer->ActiveAircraft)
&&
( (ptrPlayer->SelectedAircraft + 1) < ( (ptrPlayer->FlightDataPage + 1) * GAME_GUI_AIRCRAFT_DATA_MAX_PAGE) ) )
{
@@ -361,17 +361,17 @@ void GameGuiActiveAircraftPage(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlig
}
}
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_UP) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_UP) == true)
{
- if(ptrPlayer->SelectedAircraft > ( (ptrPlayer->FlightDataPage) * GAME_GUI_AIRCRAFT_DATA_MAX_PAGE) )
+ if (ptrPlayer->SelectedAircraft > ( (ptrPlayer->FlightDataPage) * GAME_GUI_AIRCRAFT_DATA_MAX_PAGE) )
{
ptrPlayer->SelectedAircraft--;
}
}
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_RIGHT) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_RIGHT) == true)
{
- if(ptrPlayer->ActiveAircraft > (GAME_GUI_AIRCRAFT_DATA_MAX_PAGE * (ptrPlayer->FlightDataPage + 1) ) )
+ if (ptrPlayer->ActiveAircraft > (GAME_GUI_AIRCRAFT_DATA_MAX_PAGE * (ptrPlayer->FlightDataPage + 1) ) )
{
ptrPlayer->FlightDataPage++;
ptrPlayer->SelectedAircraft = ptrPlayer->FlightDataPage * GAME_GUI_AIRCRAFT_DATA_MAX_PAGE;
@@ -379,9 +379,9 @@ void GameGuiActiveAircraftPage(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlig
}
}
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_LEFT) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_LEFT) == true)
{
- if(ptrPlayer->FlightDataPage != 0)
+ if (ptrPlayer->FlightDataPage != 0)
{
ptrPlayer->FlightDataPage--;
ptrPlayer->SelectedAircraft = ptrPlayer->FlightDataPage * GAME_GUI_AIRCRAFT_DATA_MAX_PAGE;
@@ -413,7 +413,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
AIRCRAFT_STOP_TEXT_Y = AIRCRAFT_STOP_Y + 4
};
- if(ptrPlayer->ShowAircraftData == true)
+ if (ptrPlayer->ShowAircraftData == true)
{
// Prepare RGB data and (X,Y) coordinates for aircraft
// data list request rectangle.
@@ -434,7 +434,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
AircraftDataGPoly4.attribute |= ENABLE_TRANS | TRANS_MODE(0);
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
AircraftDataGPoly4.x[0] = AIRCRAFT_DATA_GSGPOLY4_X0_2PLAYER;
AircraftDataGPoly4.x[1] = AIRCRAFT_DATA_GSGPOLY4_X1_2PLAYER;
@@ -461,7 +461,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
GsSortGPoly4(&AircraftDataGPoly4);
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
FontPrintText( &SmallFont,
GAME_GUI_REMAINING_AIRCRAFT_X_2PLAYER,
@@ -478,7 +478,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
ptrFlightData->nRemainingAircraft );
}
- if(ptrPlayer->ActiveAircraft != 0)
+ if (ptrPlayer->ActiveAircraft != 0)
{
SelectedAircraftGPoly4.r[0] = AIRCRAFT_DATA_FLIGHT_GSGPOLY4_R0;
SelectedAircraftGPoly4.r[1] = AIRCRAFT_DATA_FLIGHT_GSGPOLY4_R1;
@@ -497,7 +497,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
SelectedAircraftGPoly4.attribute |= ENABLE_TRANS | TRANS_MODE(0);
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
SelectedAircraftGPoly4.x[0] = AIRCRAFT_DATA_FLIGHT_GSGPOLY4_X0_2PLAYER;
SelectedAircraftGPoly4.x[1] = AIRCRAFT_DATA_FLIGHT_GSGPOLY4_X1_2PLAYER;
@@ -521,7 +521,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
Serial_printf("ptrPlayer->FlightDataPage = %d\n",ptrPlayer->FlightDataPage);
Serial_printf("y_offset = %d\n",y_offset);*/
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
SelectedAircraftGPoly4.y[0] = AIRCRAFT_DATA_FLIGHT_GSGPOLY4_Y0_2PLAYER;
SelectedAircraftGPoly4.y[1] = AIRCRAFT_DATA_FLIGHT_GSGPOLY4_Y1_2PLAYER;
@@ -545,13 +545,13 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
PageUpDownSpr.attribute |= GFX_2HZ_FLASH;
- if(ptrPlayer->ActiveAircraft > (GAME_GUI_AIRCRAFT_DATA_MAX_PAGE * (ptrPlayer->FlightDataPage + 1) ) )
+ if (ptrPlayer->ActiveAircraft > (GAME_GUI_AIRCRAFT_DATA_MAX_PAGE * (ptrPlayer->FlightDataPage + 1) ) )
{
orig_pageupdn_u = PageUpDownSpr.u;
PageUpDownSpr.u = orig_pageupdn_u + AIRCRAFT_DATA_FLIGHT_PAGE_UP_U;
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
PageUpDownSpr.x = AIRCRAFT_DATA_FLIGHT_PAGE_UP_X_2PLAYER;
PageUpDownSpr.y = AIRCRAFT_DATA_FLIGHT_PAGE_UP_Y_2PLAYER;
@@ -567,13 +567,13 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
PageUpDownSpr.u = orig_pageupdn_u;
}
- if(ptrPlayer->FlightDataPage != 0)
+ if (ptrPlayer->FlightDataPage != 0)
{
orig_pageupdn_u = PageUpDownSpr.u;
PageUpDownSpr.u = orig_pageupdn_u + AIRCRAFT_DATA_FLIGHT_PAGE_DOWN_U;
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
PageUpDownSpr.x = AIRCRAFT_DATA_FLIGHT_PAGE_DOWN_X_2PLAYER;
PageUpDownSpr.y = AIRCRAFT_DATA_FLIGHT_PAGE_DOWN_Y_2PLAYER;
@@ -593,7 +593,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
GfxDrawButton(AIRCRAFT_LOCK_TARGET_X, AIRCRAFT_LOCK_TARGET_Y, PAD_SQUARE);
- if(ptrPlayer->LockTarget == true)
+ if (ptrPlayer->LockTarget == true)
{
FontPrintText(&SmallFont, AIRCRAFT_LOCK_TARGET_TEXT_X, AIRCRAFT_LOCK_TARGET_TEXT_Y, "Unlock target");
}
@@ -602,12 +602,12 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
FontPrintText(&SmallFont, AIRCRAFT_LOCK_TARGET_TEXT_X, AIRCRAFT_LOCK_TARGET_TEXT_Y, "Lock target");
}
- if(ptrFlightData->State[ptrPlayer->FlightDataSelectedAircraft] == STATE_STOPPED)
+ if (ptrFlightData->State[ptrPlayer->FlightDataSelectedAircraft] == STATE_STOPPED)
{
GfxDrawButton(AIRCRAFT_STOP_X, AIRCRAFT_STOP_Y, PAD_L1);
FontPrintText(&SmallFont, AIRCRAFT_STOP_TEXT_X, AIRCRAFT_STOP_TEXT_Y, "Resume taxiing");
}
- else if(ptrFlightData->State[ptrPlayer->FlightDataSelectedAircraft] == STATE_TAXIING)
+ else if (ptrFlightData->State[ptrPlayer->FlightDataSelectedAircraft] == STATE_TAXIING)
{
GfxDrawButton(AIRCRAFT_STOP_X, AIRCRAFT_STOP_Y, PAD_L1);
FontPrintText(&SmallFont, AIRCRAFT_STOP_TEXT_X, AIRCRAFT_STOP_TEXT_Y, "Stop immediately");
@@ -615,7 +615,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData
}
else
{
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
FontPrintText( &SmallFont,
AIRCRAFT_DATA_GSGPOLY4_X0_2PLAYER +
@@ -642,7 +642,7 @@ void GameGuiBubbleShow(void)
{
static TYPE_TIMER* GameGuiBubbleTimer = NULL;
- if(GameGuiBubbleTimer == NULL)
+ if (GameGuiBubbleTimer == NULL)
{
Serial_printf("Started GameGuiBubbleTimer...\n");
GameGuiBubbleTimer = TimerCreate(50, false, &GameGuiBubbleStop);
@@ -660,13 +660,13 @@ void GameGuiBubble(TYPE_FLIGHT_DATA* ptrFlightData)
{
static bool GameGuiBubbleShowFlagOld;
- if(GameGuiBubbleShowFlag == true)
+ if (GameGuiBubbleShowFlag == true)
{
static TYPE_TIMER* GameGuiBubbleVibrationTimer = NULL;
- if(GameGuiBubbleShowFlagOld == false)
+ if (GameGuiBubbleShowFlagOld == false)
{
- if(GameGuiBubbleVibrationTimer == NULL)
+ if (GameGuiBubbleVibrationTimer == NULL)
{
Serial_printf("Started GameGuiBubbleVibrationTimer...\n");
GameGuiBubbleVibrationTimer = TimerCreate(20, false, &GameGuiBubbleStopVibration);
@@ -680,7 +680,7 @@ void GameGuiBubble(TYPE_FLIGHT_DATA* ptrFlightData)
BubbleSpr.x = BUBBLE_SPRITE_X;
BubbleSpr.y = BUBBLE_SPRITE_Y;
- if(GameGuiBubbleVibrationFlag == true)
+ if (GameGuiBubbleVibrationFlag == true)
{
BubbleSpr.x += SystemRand(BUBBLE_SPRITE_RAND_MIN,BUBBLE_SPRITE_RAND_MAX);
BubbleSpr.y += SystemRand(BUBBLE_SPRITE_RAND_MIN,BUBBLE_SPRITE_RAND_MAX);
@@ -706,7 +706,7 @@ void GameGuiClock(uint8_t hour, uint8_t min)
static char strClock[6]; // HH:MM + \0 (6 characters needed)
- if(GameStartupFlag || System1SecondTick() == true)
+ if (GameStartupFlag || System1SecondTick() == true)
{
memset(strClock, 0, 6);
snprintf(strClock,6,"%02d:%02d",hour, min);
@@ -719,16 +719,16 @@ void GameGuiClock(uint8_t hour, uint8_t min)
void GameGuiShowPassengersLeft(TYPE_PLAYER* ptrPlayer)
{
- if(GameGuiClearPassengersLeft_Flag == true)
+ if (GameGuiClearPassengersLeft_Flag == true)
{
// Reset flag
GameGuiClearPassengersLeft_Flag = false;
ptrPlayer->PassengersLeftSelectedAircraft = 0;
}
- if(ptrPlayer->PassengersLeftSelectedAircraft != 0)
+ if (ptrPlayer->PassengersLeftSelectedAircraft != 0)
{
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
FontPrintText(&SmallFont, 48, Y_SCREEN_RESOLUTION - 64, "%d left", ptrPlayer->PassengersLeftSelectedAircraft);
}
@@ -755,7 +755,7 @@ void GameGuiShowAircraftData(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlight
short AircraftDataRemainingTime_Y;
short orig_DepArr_u = DepArrSpr.u;
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
AircraftDataDirection_X = AIRCRAFT_DATA_DIRECTION_X_2PLAYER;
AircraftDataDirection_Y = AIRCRAFT_DATA_DIRECTION_Y_2PLAYER;
@@ -782,11 +782,11 @@ void GameGuiShowAircraftData(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlight
FontSetFlags(&SmallFont,FONT_NOFLAGS);
- for(i = init_flight ; i < ptrPlayer->ActiveAircraft ; i++)
+ for (i = init_flight ; i < ptrPlayer->ActiveAircraft ; i++)
{
j = i - init_flight;
- if(j >= GAME_GUI_AIRCRAFT_DATA_MAX_PAGE)
+ if (j >= GAME_GUI_AIRCRAFT_DATA_MAX_PAGE)
{
break;
}
@@ -894,7 +894,7 @@ bool GameGuiShowAircraftDataSpecialConditions(TYPE_PLAYER* ptrPlayer)
{
// Aircraft list data cannot be shown under these conditions.
- if( (ptrPlayer->SelectRunway == true)
+ if ( (ptrPlayer->SelectRunway == true)
||
(ptrPlayer->SelectTaxiwayParking == true)
||
@@ -911,11 +911,11 @@ void GameGuiCalculateSlowScore(void)
uint32_t currentScore = GameGetScore();
uint32_t scoreSpeed;
- if(abs(slowScore - currentScore) < SLOW_SCORE_LOW_SPEED_MARGIN)
+ if (abs(slowScore - currentScore) < SLOW_SCORE_LOW_SPEED_MARGIN)
{
scoreSpeed = SLOW_SCORE_LOW_SPEED;
- if(abs(slowScore - currentScore) < SLOW_SCORE_LOW_SPEED)
+ if (abs(slowScore - currentScore) < SLOW_SCORE_LOW_SPEED)
{
slowScore = currentScore;
return;
@@ -947,17 +947,17 @@ void GameGuiDrawUnboardingSequence(TYPE_PLAYER* ptrPlayer)
{
uint8_t i;
- if(ptrPlayer->Unboarding == true)
+ if (ptrPlayer->Unboarding == true)
{
- for(i = ptrPlayer->UnboardingSequenceIdx; i < GAME_MAX_SEQUENCE_KEYS; i++)
+ for (i = ptrPlayer->UnboardingSequenceIdx; i < GAME_MAX_SEQUENCE_KEYS; i++)
{
- if(ptrPlayer->UnboardingSequence[i] == 0)
+ if (ptrPlayer->UnboardingSequence[i] == 0)
{
break;
}
// TODO: Draw above the plane
- if(GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() == true)
{
GfxDrawButton(48 + (16*i), Y_SCREEN_RESOLUTION - 32, ptrPlayer->UnboardingSequence[i]);
}
@@ -982,7 +982,7 @@ bool GameGuiFinishedDialog(TYPE_PLAYER* ptrPlayer)
do
{
- if(ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
{
return true;
}
@@ -992,15 +992,15 @@ bool GameGuiFinishedDialog(TYPE_PLAYER* ptrPlayer)
GsSortGPoly4(&PauseRect);
FontPrintText( &SmallFont,
- AIRCRAFT_DATA_GSGPOLY4_X0 +
- ( (AIRCRAFT_DATA_GSGPOLY4_X1 - AIRCRAFT_DATA_GSGPOLY4_X0) >> 2),
- AIRCRAFT_DATA_GSGPOLY4_Y0 +
- ( (AIRCRAFT_DATA_GSGPOLY4_Y2 - AIRCRAFT_DATA_GSGPOLY4_Y0) >> 1),
- "Level finished!" );
+ AIRCRAFT_DATA_GSGPOLY4_X0 +
+ ( (AIRCRAFT_DATA_GSGPOLY4_X1 - AIRCRAFT_DATA_GSGPOLY4_X0) >> 2),
+ AIRCRAFT_DATA_GSGPOLY4_Y0 +
+ ( (AIRCRAFT_DATA_GSGPOLY4_Y2 - AIRCRAFT_DATA_GSGPOLY4_Y0) >> 1),
+ "Level finished!" );
GfxDrawScene_Slow();
- }while(ptrPlayer->PadKeySinglePress_Callback(PAD_START) == false);
+ }while (ptrPlayer->PadKeySinglePress_Callback(PAD_START) == false);
return false;
}
@@ -1025,7 +1025,7 @@ void GameGuiAircraftCollision(TYPE_PLAYER* ptrPlayer)
GfxDrawScene_Slow();
- }while(ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == false);
+ }while (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == false);
}
void GameGuiBubbleStop(void)
diff --git a/Source/Gfx.c b/Source/Gfx.c
index 8029d14..a7f8aa6 100644
--- a/Source/Gfx.c
+++ b/Source/Gfx.c
@@ -108,13 +108,13 @@ void GfxSwapBuffers(void)
// Consistency check
#if PSXSDK_DEBUG
- if(GsListPos() >= PRIMITIVE_LIST_SIZE)
+ if (GsListPos() >= PRIMITIVE_LIST_SIZE)
{
Serial_printf("Linked list iterator overflow!\n");
- while(1);
+ while (1);
}
- if( (DrawEnv.h != Y_SCREEN_RESOLUTION)
+ if ( (DrawEnv.h != Y_SCREEN_RESOLUTION)
||
( (DrawEnv.w != X_SCREEN_RESOLUTION)
&&
@@ -130,18 +130,18 @@ void GfxSwapBuffers(void)
DEBUG_PRINT_VAR(DrawEnv.x);
DEBUG_PRINT_VAR(DrawEnv.y);
- while(1);
+ while (1);
}
#endif // PSXSDK_DEBUG
- if(DrawEnv.h == Y_SCREEN_RESOLUTION)
+ if (DrawEnv.h == Y_SCREEN_RESOLUTION)
{
- if(DispEnv.y == 0)
+ if (DispEnv.y == 0)
{
DispEnv.y = DOUBLE_BUFFERING_SWAP_Y;
DrawEnv.y = 0;
}
- else if(DispEnv.y == DOUBLE_BUFFERING_SWAP_Y)
+ else if (DispEnv.y == DOUBLE_BUFFERING_SWAP_Y)
{
DispEnv.y = 0;
DrawEnv.y = DOUBLE_BUFFERING_SWAP_Y;
@@ -191,12 +191,12 @@ void GfxDrawScene_Fast(void)
FontPrintText(&SmallFont, FPS_INFO_X, FPS_INFO_Y, "%d/%d", SystemGetFPS(), REFRESH_FREQUENCY);
- if(System1SecondTick() == true)
+ if (System1SecondTick() == true)
{
one_second_show = one_second_show? false:true;
}
- if(System500msTick() == true)
+ if (System500msTick() == true)
{
five_hundred_ms_show = five_hundred_ms_show? false:true;
}
@@ -213,7 +213,7 @@ bool GfxReadyForDMATransfer(void)
void GfxDrawScene(void)
{
- while( (SystemRefreshNeeded() == false)
+ while ( (SystemRefreshNeeded() == false)
||
(GfxIsGPUBusy() == true) );
@@ -225,7 +225,7 @@ void GfxDrawScene(void)
void GfxDrawScene_Slow(void)
{
GfxDrawScene();
- while(GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() == true);
}
void GfxSortSprite(GsSprite * spr)
@@ -239,28 +239,28 @@ void GfxSortSprite(GsSprite * spr)
bool has_1hz_flash = spr->attribute & GFX_1HZ_FLASH;
bool has_2hz_flash = spr->attribute & GFX_2HZ_FLASH;
- if( (spr->w <= 0) || (spr->h <= 0) )
+ if ( (spr->w <= 0) || (spr->h <= 0) )
{
// Invalid width or heigth
return;
}
- if(GfxIsSpriteInsideScreenArea(spr) == false)
+ if (GfxIsSpriteInsideScreenArea(spr) == false)
{
return;
}
- else if(has_2hz_flash && Gfx2HzFlash() == false)
+ else if (has_2hz_flash && Gfx2HzFlash() == false)
{
return;
}
- else if(has_1hz_flash && Gfx1HzFlash() == false)
+ else if (has_1hz_flash && Gfx1HzFlash() == false)
{
return;
}
- if(global_lum != NORMAL_LUMINANCE)
+ if (global_lum != NORMAL_LUMINANCE)
{
- if(spr->r < NORMAL_LUMINANCE - global_lum)
+ if (spr->r < NORMAL_LUMINANCE - global_lum)
{
spr->r = 0;
}
@@ -269,7 +269,7 @@ void GfxSortSprite(GsSprite * spr)
spr->r -= NORMAL_LUMINANCE - global_lum;
}
- if(spr->g < NORMAL_LUMINANCE - global_lum)
+ if (spr->g < NORMAL_LUMINANCE - global_lum)
{
spr->g = 0;
}
@@ -278,7 +278,7 @@ void GfxSortSprite(GsSprite * spr)
spr->g -= NORMAL_LUMINANCE - global_lum;
}
- if(spr->b < NORMAL_LUMINANCE - global_lum)
+ if (spr->b < NORMAL_LUMINANCE - global_lum)
{
spr->b = 0;
}
@@ -288,12 +288,12 @@ void GfxSortSprite(GsSprite * spr)
}
}
- if(has_1hz_flash == true)
+ if (has_1hz_flash == true)
{
spr->attribute &= ~(GFX_1HZ_FLASH);
}
- if(spr->w > MAX_SIZE_FOR_GSSPRITE)
+ if (spr->w > MAX_SIZE_FOR_GSSPRITE)
{
// GsSprites can't be bigger than 256x256, so since display
// resolution is 384x240, it must be split into two primitives.
@@ -316,7 +316,7 @@ void GfxSortSprite(GsSprite * spr)
GsSortSprite(spr);
}
- if(has_1hz_flash == true)
+ if (has_1hz_flash == true)
{
spr->attribute |= GFX_1HZ_FLASH;
}
@@ -338,7 +338,7 @@ void GfxSetGlobalLuminance(uint8_t value)
void GfxIncreaseGlobalLuminance(int8_t step)
{
- if( ( (global_lum + step) < MAX_LUMINANCE )
+ if ( ( (global_lum + step) < MAX_LUMINANCE )
&&
( (global_lum + step) > 0 ) )
{
@@ -364,12 +364,12 @@ bool GfxSpriteFromFile(char* fname, GsSprite * spr)
{
GsImage gsi;
- if(SystemLoadFile(fname) == false)
+ if (SystemLoadFile(fname) == false)
{
return false;
}
- while(GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() == true);
gfx_busy = true;
@@ -392,12 +392,12 @@ bool GfxCLUTFromFile(char* fname)
{
GsImage gsi;
- if(SystemLoadFile(fname) == false)
+ if (SystemLoadFile(fname) == false)
{
return false;
}
- while(GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() == true);
gfx_busy = true;
@@ -412,7 +412,7 @@ bool GfxCLUTFromFile(char* fname)
bool GfxIsInsideScreenArea(short x, short y, short w, short h)
{
- if( ( (x + w) >= 0)
+ if ( ( (x + w) >= 0)
&&
(x < DrawEnv.w)
&&
@@ -453,7 +453,7 @@ void GfxDrawButton(short x, short y, unsigned short btn)
static short orig_u;
static short orig_v;
- if(first_entered == true)
+ if (first_entered == true)
{
first_entered = false;
orig_u = PSXButtons.u;
@@ -582,7 +582,7 @@ void GfxDrawButton(short x, short y, unsigned short btn)
void GfxSaveDisplayData(GsSprite *spr)
{
- while(GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() == true);
MoveImage( DispEnv.x,
DispEnv.y,
@@ -603,7 +603,7 @@ void GfxSaveDisplayData(GsSprite *spr)
spr->g = NORMAL_LUMINANCE;
spr->b = NORMAL_LUMINANCE;
- while(GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() == true);
}
bool Gfx1HzFlash(void)
@@ -618,7 +618,7 @@ bool Gfx2HzFlash(void)
bool GfxTPageOffsetFromVRAMPosition(GsSprite * spr, short x, short y)
{
- if( (x >= VRAM_W) || (x < 0) || (y >= VRAM_H) || (y < 0) )
+ if ( (x >= VRAM_W) || (x < 0) || (y >= VRAM_H) || (y < 0) )
{
return false;
}
@@ -628,7 +628,7 @@ bool GfxTPageOffsetFromVRAMPosition(GsSprite * spr, short x, short y)
spr->u = (x % GFX_TPAGE_WIDTH);
- if(spr->attribute & COLORMODE(COLORMODE_8BPP))
+ if (spr->attribute & COLORMODE(COLORMODE_8BPP))
{
// On 8bpp images, it looks like U offset needs to be multiplied by 2.
spr->u <<= 1;
diff --git a/Source/Gfx.h b/Source/Gfx.h
index 407e8f7..ebc2424 100644
--- a/Source/Gfx.h
+++ b/Source/Gfx.h
@@ -34,7 +34,7 @@ void GfxSetPrimitiveList(void);
// Renders new scene. Use this function unless you know what you are doing!
void GfxDrawScene(void);
-// Blocking version. Calls GfxDrawScene() and then adds a while(GfxIsBusy() )
+// Blocking version. Calls GfxDrawScene() and then adds a while (GfxIsBusy() )
// after it.
void GfxDrawScene_Slow(void);
diff --git a/Source/LoadMenu.c b/Source/LoadMenu.c
index 9595cc5..ef139dc 100644
--- a/Source/LoadMenu.c
+++ b/Source/LoadMenu.c
@@ -121,7 +121,7 @@ void LoadMenuInit(void)
int i;
static bool first_load = false;
- if(first_load == false)
+ if (first_load == false)
{
first_load = true;
LoadMenuLoadFileList( LoadMenuFiles,
@@ -172,7 +172,7 @@ void LoadMenuInit(void)
loadMenuBg.y[3] = Y_SCREEN_RESOLUTION;
// Colour components adjustment (default to zero)
- for(i = 0; i < 4 ; i++)
+ for (i = 0; i < 4 ; i++)
{
loadMenuBg.r[i] = 0;
loadMenuBg.g[i] = 0;
@@ -211,7 +211,7 @@ void LoadMenuInit(void)
LoadMenuBarLines[3].y[0] = LOADING_BAR_Y;
LoadMenuBarLines[3].y[1] = LOADING_BAR_Y + LOADING_BAR_HEIGHT;
- for(i = 0; i < LOADING_BAR_N_LINES ; i++)
+ for (i = 0; i < LOADING_BAR_N_LINES ; i++)
{
LoadMenuBarLines[i].r = 0;
LoadMenuBarLines[i].g = 0;
@@ -249,7 +249,7 @@ void LoadMenuEnd(void)
end_flag = true;
load_menu_running = false;
- while(LoadMenuISRHasEnded() == false);
+ while (LoadMenuISRHasEnded() == false);
Serial_printf("Set default VBlank handler.\n");
SetVBlankHandler(&ISR_SystemDefaultVBlank);
@@ -262,40 +262,40 @@ void ISR_LoadMenuVBlank(void)
SystemIncreaseGlobalTimer();
- if(SystemIsBusy() == true)
+ if (SystemIsBusy() == true)
{
dprintf("SystemIsBusy...\n");
return;
}
- if((GfxIsGPUBusy() == true))
+ if ((GfxIsGPUBusy() == true))
{
dprintf("(GfxIsGPUBusy() == true)\n");
return;
}
- if(SerialIsBusy() == true)
+ if (SerialIsBusy() == true)
{
dprintf("Serialisbusy\n");
return;
}
- /*if( (SystemIsBusy() == true) || (GfxIsGPUBusy() == true) || (SerialIsBusy() == true) )
+ /*if ( (SystemIsBusy() == true) || (GfxIsGPUBusy() == true) || (SerialIsBusy() == true) )
{
return;
}*/
- if(startup_flag == true)
+ if (startup_flag == true)
{
// "Loading..." text
- if(LoadMenuTitleSpr.r < LOADING_TITLE_LUMINANCE_TARGET)
+ if (LoadMenuTitleSpr.r < LOADING_TITLE_LUMINANCE_TARGET)
{
LoadMenuTitleSpr.r += LOADING_TITLE_LUMINANCE_STEP;
LoadMenuTitleSpr.g += LOADING_TITLE_LUMINANCE_STEP;
LoadMenuTitleSpr.b += LOADING_TITLE_LUMINANCE_STEP;
}
- if(loadMenuBg.g[0] < BG_WHITE_TARGET_VALUE)
+ if (loadMenuBg.g[0] < BG_WHITE_TARGET_VALUE)
{
loadMenuBg.r[0] += BG_INCREASE_STEP;
loadMenuBg.r[1] += BG_INCREASE_STEP;
@@ -307,13 +307,13 @@ void ISR_LoadMenuVBlank(void)
loadMenuBg.b[1] += BG_INCREASE_STEP;
}
// Blue background
- if(loadMenuBg.b[2] < BG_BLUE_TARGET_VALUE)
+ if (loadMenuBg.b[2] < BG_BLUE_TARGET_VALUE)
{
loadMenuBg.b[2] += BG_INCREASE_STEP;
loadMenuBg.b[3] += BG_INCREASE_STEP;
}
- if(LoadMenuBarRect.r < LOADING_BAR_LUMINANCE_TARGET)
+ if (LoadMenuBarRect.r < LOADING_BAR_LUMINANCE_TARGET)
{
LoadMenuBarRect.r += LOADING_BAR_LUMINANCE_STEP;
LoadMenuBarRect.g += LOADING_BAR_LUMINANCE_STEP;
@@ -325,9 +325,9 @@ void ISR_LoadMenuVBlank(void)
isr_started = true;
}
- for(i = 0;i < LOADING_BAR_N_LINES ; i++)
+ for (i = 0;i < LOADING_BAR_N_LINES ; i++)
{
- if(LoadMenuBarLines[i].r < LOADING_BAR_LUMINANCE_TARGET)
+ if (LoadMenuBarLines[i].r < LOADING_BAR_LUMINANCE_TARGET)
{
LoadMenuBarLines[i].r += LOADING_BAR_LUMINANCE_STEP;
LoadMenuBarLines[i].g += LOADING_BAR_LUMINANCE_STEP;
@@ -335,7 +335,7 @@ void ISR_LoadMenuVBlank(void)
}
}
- if(LoadMenuPlaneSpr.r < PLANE_LUMINANCE_TARGET_VALUE)
+ if (LoadMenuPlaneSpr.r < PLANE_LUMINANCE_TARGET_VALUE)
{
LoadMenuPlaneSpr.r += PLANE_LUMINANCE_STEP;
LoadMenuPlaneSpr.g += PLANE_LUMINANCE_STEP;
@@ -343,13 +343,13 @@ void ISR_LoadMenuVBlank(void)
}
}
- else if(end_flag == true)
+ else if (end_flag == true)
{
LoadMenuTitleSpr.r -= LOADING_TITLE_LUMINANCE_STEP;
LoadMenuTitleSpr.g -= LOADING_TITLE_LUMINANCE_STEP;
LoadMenuTitleSpr.b -= LOADING_TITLE_LUMINANCE_STEP;
- if(loadMenuBg.g[0] > 0)
+ if (loadMenuBg.g[0] > 0)
{
loadMenuBg.r[0] -= BG_INCREASE_STEP;
loadMenuBg.r[1] -= BG_INCREASE_STEP;
@@ -361,19 +361,19 @@ void ISR_LoadMenuVBlank(void)
loadMenuBg.b[1] -= BG_INCREASE_STEP;
}
- if(loadMenuBg.b[2] > 0)
+ if (loadMenuBg.b[2] > 0)
{
loadMenuBg.b[2] -= BG_INCREASE_STEP;
loadMenuBg.b[3] -= BG_INCREASE_STEP;
}
- if(loadMenuBg.b[2] == 0)
+ if (loadMenuBg.b[2] == 0)
{
end_flag = false;
isr_ended = true;
}
- if(LoadMenuPlaneSpr.r > 0)
+ if (LoadMenuPlaneSpr.r > 0)
{
LoadMenuPlaneSpr.r -= PLANE_LUMINANCE_STEP;
LoadMenuPlaneSpr.g -= PLANE_LUMINANCE_STEP;
@@ -385,16 +385,16 @@ void ISR_LoadMenuVBlank(void)
LoadMenuBarRect.w = LOADING_BAR_WIDTH;
- if(LoadMenuBarRect.r > 0)
+ if (LoadMenuBarRect.r > 0)
{
LoadMenuBarRect.r -= LOADING_BAR_LUMINANCE_STEP;
LoadMenuBarRect.g -= LOADING_BAR_LUMINANCE_STEP;
LoadMenuBarRect.b -= LOADING_BAR_LUMINANCE_STEP;
}
- for(i = 0;i < LOADING_BAR_N_LINES ; i++)
+ for (i = 0;i < LOADING_BAR_N_LINES ; i++)
{
- if(LoadMenuBarLines[i].r > 0)
+ if (LoadMenuBarLines[i].r > 0)
{
LoadMenuBarLines[i].r -= LOADING_BAR_LUMINANCE_STEP;
LoadMenuBarLines[i].g -= LOADING_BAR_LUMINANCE_STEP;
@@ -407,7 +407,7 @@ void ISR_LoadMenuVBlank(void)
GsSortRectangle(&LoadMenuBarRect);
- for(i = 0 ; i < LOADING_BAR_N_LINES ; i++)
+ for (i = 0 ; i < LOADING_BAR_N_LINES ; i++)
{
GsSortLine(&LoadMenuBarLines[i]);
}
@@ -446,11 +446,11 @@ void LoadMenu( char* fileList[],
uint8_t szFileList , uint8_t szDestList)
{
- if(load_menu_running == false)
+ if (load_menu_running == false)
{
LoadMenuInit();
- while(LoadMenuISRHasStarted() == false);
+ while (LoadMenuISRHasStarted() == false);
}
LoadMenuLoadFileList(fileList,dest,szFileList,szDestList);
@@ -465,18 +465,18 @@ void LoadMenuLoadFileList( char* fileList[], void* dest[],
short x_increment;
uint8_t fileLoadedCount;
- if(szFileList != szDestList)
+ if (szFileList != szDestList)
{
Serial_printf("File list size different from dest list size! %d vs %d\n",
szFileList, szDestList);
return;
}
- for(fileLoadedCount = 0; fileLoadedCount < szFileList ; fileLoadedCount++)
+ for (fileLoadedCount = 0; fileLoadedCount < szFileList ; fileLoadedCount++)
{
strCurrentFile = fileList[fileLoadedCount];
- if(strCurrentFile == NULL)
+ if (strCurrentFile == NULL)
{
continue;
}
@@ -502,42 +502,42 @@ void LoadMenuLoadFileList( char* fileList[], void* dest[],
//Restore original file path in order to load file
strncpy(strCurrentFile, aux_file_name, 100);
- if(strncmp(extension,"TIM",3) == 0)
+ if (strncmp(extension,"TIM",3) == 0)
{
- if(GfxSpriteFromFile(strCurrentFile, dest[fileLoadedCount]) == false)
+ if (GfxSpriteFromFile(strCurrentFile, dest[fileLoadedCount]) == false)
{
Serial_printf("Could not load image file \"%s\"!\n", strCurrentFile);
}
}
- else if(strncmp(extension,"CLT",3) == 0)
+ else if (strncmp(extension,"CLT",3) == 0)
{
- if(dest[fileLoadedCount] != NULL)
+ if (dest[fileLoadedCount] != NULL)
{
Serial_printf("WARNING: File %s linked to non-NULL destination pointer!\n", dest[fileLoadedCount]);
}
- if(GfxCLUTFromFile(strCurrentFile) == false)
+ if (GfxCLUTFromFile(strCurrentFile) == false)
{
Serial_printf("Could not load CLUT file \"%s\"!\n", strCurrentFile);
}
}
- else if(strncmp(extension,"VAG",3) == 0)
+ else if (strncmp(extension,"VAG",3) == 0)
{
- if(SfxUploadSound(strCurrentFile, dest[fileLoadedCount]) == false)
+ if (SfxUploadSound(strCurrentFile, dest[fileLoadedCount]) == false)
{
Serial_printf("Could not load sound file \"%s\"!\n", strCurrentFile);
}
}
- else if(strncmp(extension,"FNT",3) == 0)
+ else if (strncmp(extension,"FNT",3) == 0)
{
- if(FontLoadImage(strCurrentFile, dest[fileLoadedCount]) == false)
+ if (FontLoadImage(strCurrentFile, dest[fileLoadedCount]) == false)
{
Serial_printf("Could not load font file \"%s\"!\n", strCurrentFile);
}
}
- else if(strncmp(extension,"PLT",3) == 0)
+ else if (strncmp(extension,"PLT",3) == 0)
{
- if(PltParserLoadFile(strCurrentFile, dest[fileLoadedCount]) == false)
+ if (PltParserLoadFile(strCurrentFile, dest[fileLoadedCount]) == false)
{
Serial_printf("Could not load pilots file \"%s\"!\n", strCurrentFile);
}
diff --git a/Source/Makefile b/Source/Makefile
index 5b49052..edc371b 100644
--- a/Source/Makefile
+++ b/Source/Makefile
@@ -14,7 +14,7 @@ DEFINE += -DNO_INTRO
# Compiler flags
LIBS= -lfixmath
-CC_FLAGS = -Wall -Werror -c -Os -Wfatal-errors
+CC_FLAGS = -Wall -Werror -c -Os -Wfatal-errors -g
# Path definitions
PSXSDK_PATH = /usr/local/psxsdk
@@ -22,7 +22,7 @@ PATH := $(PATH):$(PSXSDK_PATH)/bin/
PROJECT_DIR = ~/$(PROJECT)
#Uncomment this DEFINE below to use Airport together with OpenSend + QPSXSerial toolchain.
-DEFINE += -DSERIAL_INTERFACE
+#DEFINE += -DSERIAL_INTERFACE
# PSXSDK tools definitions
# ELF2EXE:
@@ -137,6 +137,7 @@ tiles:
bmp2tim ../Sprites/DepArr.bmp ../cdimg/DATA/SPRITES/DEPARR.TIM 16 -org=552,240 -mpink
bmp2tim ../Sprites/PageUpDn.bmp ../cdimg/DATA/SPRITES/PAGEUPDN.TIM 16 -org=504,240 -mpink
bmp2tim ../Sprites/Bldngs1.bmp ../cdimg/DATA/SPRITES/BLDNGS1.TIM 16 -org=640,128 -mpink
+ bmp2tim ../Sprites/Arrow.bmp ../cdimg/DATA/SPRITES/ARROW.TIM 16 -org=604,240 -mpink
$(SOUNDS_FOLDER)/%.VAG: $(SOURCE_SOUNDS_FOLDER)/%.wav
wav2vag $^ $@
diff --git a/Source/MemCard.c b/Source/MemCard.c
index 4c20505..09a7de3 100644
--- a/Source/MemCard.c
+++ b/Source/MemCard.c
@@ -161,9 +161,9 @@ void MemCardInit(void)
uint8_t i;
uint8_t j;
- for(j = SLOT_ONE; j <= SLOT_TWO; j++)
+ for (j = SLOT_ONE; j <= SLOT_TWO; j++)
{
- for(i = BLOCK_1; i <= BLOCK_15; i++)
+ for (i = BLOCK_1; i <= BLOCK_15; i++)
{
ptrBlockData = &MemCardData[i - BLOCK_1][j];
@@ -181,7 +181,7 @@ void ISR_MemCardDataHandling(void)
uint8_t i;
- if( (GfxIsGPUBusy() == true) || (SystemIsBusy() == true) )
+ if ( (GfxIsGPUBusy() == true) || (SystemIsBusy() == true) )
{
return;
}
@@ -250,7 +250,7 @@ void ISR_MemCardDataHandling(void)
MemCardProgressBarLines[3].y[0] = MEMCARD_PROGRESS_BAR_Y;
MemCardProgressBarLines[3].y[1] = MEMCARD_PROGRESS_BAR_Y + MEMCARD_PROGRESS_BAR_H;
- for(i = 0; i < MEMCARD_PROGRESS_BAR_N_LINES; i++)
+ for (i = 0; i < MEMCARD_PROGRESS_BAR_N_LINES; i++)
{
MemCardProgressBarLines[i].r = NORMAL_LUMINANCE;
MemCardProgressBarLines[i].g = NORMAL_LUMINANCE;
@@ -273,7 +273,7 @@ void ISR_MemCardDataHandling(void)
GsSortGPoly4(&MemCardRect);
GsSortRectangle(&MemCardProgressBar);
- for(i = 0; i < MEMCARD_PROGRESS_BAR_N_LINES; i++)
+ for (i = 0; i < MEMCARD_PROGRESS_BAR_N_LINES; i++)
{
GsSortLine(&MemCardProgressBarLines[i]);
}
@@ -308,12 +308,12 @@ bool MemCardGetBlockInfo( TYPE_BLOCK_DATA * ptrBlockData,
Serial_printf("MemCardGetBlockStateFileName...\n");
- if(MemCardGetBlockStateFileName(ptrBlockData) == false)
+ if (MemCardGetBlockStateFileName(ptrBlockData) == false)
{
return false;
}
- if(ptrBlockData->BlockCount == EMPTY_BLOCK)
+ if (ptrBlockData->BlockCount == EMPTY_BLOCK)
{
// Stop looking for any other data.
return true;
@@ -321,14 +321,14 @@ bool MemCardGetBlockInfo( TYPE_BLOCK_DATA * ptrBlockData,
Serial_printf("MemCardGetInitialFrameInfo...\n");
- if(MemCardGetInitialFrameInfo(ptrBlockData) == false)
+ if (MemCardGetInitialFrameInfo(ptrBlockData) == false)
{
return false;
}
Serial_printf("MemCardGetIconFrameInfo...\n");
- if(MemCardGetIconFrameInfo(ptrBlockData) == false)
+ if (MemCardGetIconFrameInfo(ptrBlockData) == false)
{
return false;
}
@@ -338,7 +338,7 @@ bool MemCardGetBlockInfo( TYPE_BLOCK_DATA * ptrBlockData,
Serial_printf("MemCardUploadToGPU...\n");
- if(MemCardUploadToGPU(ptrBlockData) == false)
+ if (MemCardUploadToGPU(ptrBlockData) == false)
{
return false;
}
@@ -356,7 +356,7 @@ bool MemCardGetBlockStateFileName(TYPE_BLOCK_DATA * ptrBlockData)
memset(DataBuffer, 0, MEMCARD_SECTOR_SIZE);
- if(MemCardReadSector(ptrBlockData, sector) == false)
+ if (MemCardReadSector(ptrBlockData, sector) == false)
{
return false;
}
@@ -405,7 +405,7 @@ bool MemCardGetBlockStateFileName(TYPE_BLOCK_DATA * ptrBlockData)
// 0Ah-1Eh Filename in ASCII, terminated by 00h (max 20 chars, plus ending 00h)
// File name is only defined on first block of group (allocation state == 0x51)
- if(ptrBlockData->BlockCount == FIRST_OR_ONLY_BLOCK)
+ if (ptrBlockData->BlockCount == FIRST_OR_ONLY_BLOCK)
{
memset(ptrBlockData->FileName, 0 , MEMCARD_FILENAME_SIZE);
@@ -426,7 +426,7 @@ bool MemCardGetInitialFrameInfo(TYPE_BLOCK_DATA * ptrBlockData)
MemCardErrors.Slot = ptrBlockData->Slot;
MemCardErrors.Process = MEMCARD_PROCESS_GET_FILENAME;
- if(ptrBlockData->BlockCount != FIRST_OR_ONLY_BLOCK)
+ if (ptrBlockData->BlockCount != FIRST_OR_ONLY_BLOCK)
{
// Icon data is only stored on first block (if game takes more
// than one block. Skip this step otherwise.
@@ -443,14 +443,14 @@ bool MemCardGetInitialFrameInfo(TYPE_BLOCK_DATA * ptrBlockData)
memset(DataBuffer, 0, MEMCARD_SECTOR_SIZE);
- if(MemCardReadSector(ptrBlockData, sector) == false)
+ if (MemCardReadSector(ptrBlockData, sector) == false)
{
return false;
}
Serial_printf("Magic number: '%c' '%c'\n",DataBuffer[0], DataBuffer[1]);
- if(DataBuffer[0] != 'S' || DataBuffer[1] != 'C')
+ if (DataBuffer[0] != 'S' || DataBuffer[1] != 'C')
{
// Invalid magic number.
Serial_printf("Invalid magic number extracted from slot %d, block %d.\n",
@@ -490,7 +490,7 @@ bool MemCardGetInitialFrameInfo(TYPE_BLOCK_DATA * ptrBlockData)
// 60h-7Fh Icon 16 Color Palette Data (each entry is 16bit CLUT)
- for(i = 0; i < ptrBlockData->IconNumber; i++)
+ for (i = 0; i < ptrBlockData->IconNumber; i++)
{
memcpy(ptrBlockData->CLUT[i],&DataBuffer[0x60], MEMCARD_CLUT_SIZE);
}
@@ -516,7 +516,7 @@ bool MemCardGetIconFrameInfo(TYPE_BLOCK_DATA * ptrBlockData)
case INTERMEDIATE_BLOCK:
case LAST_BLOCK:
- if(ptrReferenceBlock == NULL)
+ if (ptrReferenceBlock == NULL)
{
Serial_printf("No reference memory card block found yet!\n");
return false;
@@ -524,13 +524,13 @@ bool MemCardGetIconFrameInfo(TYPE_BLOCK_DATA * ptrBlockData)
ptrBlockData->IconNumber = ptrReferenceBlock->IconNumber;
- for(i = 0; i < MEMCARD_NUMBER_OF_ICONS; i++)
+ for (i = 0; i < MEMCARD_NUMBER_OF_ICONS; i++)
{
memcpy(ptrBlockData->CLUT[i], ptrReferenceBlock->CLUT[i], MEMCARD_CLUT_SIZE);
memcpy(ptrBlockData->Icons[i], ptrReferenceBlock->Icons[i], MEMCARD_ICON_SIZE);
}
- if(ptrBlockData->BlockCount == LAST_BLOCK)
+ if (ptrBlockData->BlockCount == LAST_BLOCK)
{
// Dereference pointer
ptrReferenceBlock = NULL;
@@ -540,14 +540,14 @@ bool MemCardGetIconFrameInfo(TYPE_BLOCK_DATA * ptrBlockData)
case FIRST_OR_ONLY_BLOCK:
// Icon Frame(s) (Block 1..15, Frame 1..3) (in first block of file only)
- for(i = ICON_FRAME_1; i <= ptrBlockData->IconNumber; i++)
+ for (i = ICON_FRAME_1; i <= ptrBlockData->IconNumber; i++)
{
Serial_printf("\tIcon %d out of %d\n",i, ptrBlockData->IconNumber);
buffer_contents = 0;
sector = initial_sector + i;
memset(DataBuffer, 0, MEMCARD_SECTOR_SIZE * sizeof(uint8_t) );
- if(MemCardReadSector(ptrBlockData, sector) == false)
+ if (MemCardReadSector(ptrBlockData, sector) == false)
{
Serial_printf("Could not read memory sector!\n");
return false;
@@ -555,12 +555,12 @@ bool MemCardGetIconFrameInfo(TYPE_BLOCK_DATA * ptrBlockData)
memcpy(ptrBlockData->Icons[i - 1 /* ICON_FRAME_# - 1 */], DataBuffer, MEMCARD_SECTOR_SIZE);
- for(j = 0; j < MEMCARD_SECTOR_SIZE; j++)
+ for (j = 0; j < MEMCARD_SECTOR_SIZE; j++)
{
buffer_contents |= ptrBlockData->Icons[i - 1][j];
}
- if(buffer_contents == 0)
+ if (buffer_contents == 0)
{
// Icon buffer is empty!
Serial_printf("Invalid icon buffer for slot %d, block %d.\n",
@@ -590,7 +590,7 @@ bool MemCardUploadToGPU(TYPE_BLOCK_DATA * ptrBlockData)
short x_block_offset;
GsImage gs;
- if( (ptrBlockData->IconNumber < 1)
+ if ( (ptrBlockData->IconNumber < 1)
||
(ptrBlockData->IconNumber > MEMCARD_NUMBER_OF_ICONS) )
{
@@ -598,7 +598,7 @@ bool MemCardUploadToGPU(TYPE_BLOCK_DATA * ptrBlockData)
return false;
}
- for(i = 0; i < ptrBlockData->IconNumber; i++)
+ for (i = 0; i < ptrBlockData->IconNumber; i++)
{
gs.pmode = COLORMODE_4BPP;
gs.has_clut = 1;
@@ -635,7 +635,7 @@ bool MemCardUploadToGPU(TYPE_BLOCK_DATA * ptrBlockData)
GsUploadImage(&gs);
- if(i == 0)
+ if (i == 0)
{
ptrBlockData->IconTPoly.attribute = COLORMODE(COLORMODE_4BPP);
ptrBlockData->IconTPoly.tpage = (gs.x / 64) + ((gs.y/256)*16);
@@ -690,7 +690,7 @@ bool MemCardReadSector(TYPE_BLOCK_DATA * ptrBlockData, int sector)
MemCardErrors.Block = ptrBlockData->Block;
MemCardErrors.Slot = ptrBlockData->Slot;
- if( (ptrBlockData->Slot != 0)
+ if ( (ptrBlockData->Slot != 0)
&&
(ptrBlockData->Slot != 1) )
{
@@ -703,7 +703,7 @@ bool MemCardReadSector(TYPE_BLOCK_DATA * ptrBlockData, int sector)
return false;
}
- if((sector < 0) || (sector > MEMCARD_MAXIMUM_SECTOR))
+ if ((sector < 0) || (sector > MEMCARD_MAXIMUM_SECTOR))
{
MemCardErrors.ErrorByte = 'T';
@@ -712,7 +712,7 @@ bool MemCardReadSector(TYPE_BLOCK_DATA * ptrBlockData, int sector)
return false;
}
- while(GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() == true);
result = McReadSector(ptrBlockData->Slot, sector, DataBuffer);
@@ -774,23 +774,23 @@ bool MemCardGetAllData(void)
SetVBlankHandler(&ISR_MemCardDataHandling);
- for(j = SLOT_ONE; j <= SLOT_TWO; j++)
+ for (j = SLOT_ONE; j <= SLOT_TWO; j++)
{
MemCardStatus[j] = McGetStatus(j);
- if(MemCardStatus[j] == MEMCARD_STATUS_UNKNOWN)
+ if (MemCardStatus[j] == MEMCARD_STATUS_UNKNOWN)
{
// Memcard not connected and/or formatted.
continue;
}
- for(i = BLOCK_1; i <= BLOCK_15; i++)
+ for (i = BLOCK_1; i <= BLOCK_15; i++)
{
ProgressBarXOffset = (short)(CurrentReadBlock *
(MEMCARD_PROGRESS_BAR_W /
(MEMCARD_BLOCKS_PER_CARD * MEMCARD_NUMBER_OF_SLOTS) ) );
- if(MemCardGetBlockInfo(&MemCardData[i - BLOCK_1][j], j, i) == false)
+ if (MemCardGetBlockInfo(&MemCardData[i - BLOCK_1][j], j, i) == false)
{
// Return to normal behaviour if anything fails
SetVBlankHandler(&ISR_SystemDefaultVBlank);
@@ -817,13 +817,13 @@ void MemCardIconIndexHandler(void)
{
static uint8_t iconTimer = 0;
- if(System100msTick() == true)
+ if (System100msTick() == true)
{
- if(++iconTimer >= MEMCARD_ICON_INDEX_TIME)
+ if (++iconTimer >= MEMCARD_ICON_INDEX_TIME)
{
iconTimer = 0;
- if(++IconIndex >= MEMCARD_NUMBER_OF_ICONS)
+ if (++IconIndex >= MEMCARD_NUMBER_OF_ICONS)
{
IconIndex = 0;
}
@@ -839,7 +839,7 @@ void MemCardDrawIcon(TYPE_BLOCK_DATA * ptrBlockData, short x, short y)
short orig_clut_x;
static bool first_access = true;
- if(ptrBlockData->BlockCount == EMPTY_BLOCK)
+ if (ptrBlockData->BlockCount == EMPTY_BLOCK)
{
return;
}
@@ -854,14 +854,14 @@ void MemCardDrawIcon(TYPE_BLOCK_DATA * ptrBlockData, short x, short y)
ptrBlockData->IconTPoly.y[2] = y + MEMCARD_BLOCK_IMAGE_H;
ptrBlockData->IconTPoly.y[3] = ptrBlockData->IconTPoly.y[2];
- for(i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
orig_u[i] = ptrBlockData->IconTPoly.u[i];
}
orig_clut_x = ptrBlockData->IconTPoly.cx;
- if(ptrBlockData->IconNumber > IconIndex)
+ if (ptrBlockData->IconNumber > IconIndex)
{
ptrBlockData->IconTPoly.u[0] += MEMCARD_BLOCK_IMAGE_W * IconIndex;
ptrBlockData->IconTPoly.u[1] = ptrBlockData->IconTPoly.u[0] + MEMCARD_BLOCK_IMAGE_W;
@@ -872,9 +872,9 @@ void MemCardDrawIcon(TYPE_BLOCK_DATA * ptrBlockData, short x, short y)
}
- if(first_access == true)
+ if (first_access == true)
{
- if(IconIndex == 0)
+ if (IconIndex == 0)
{
first_access = false;
@@ -918,7 +918,7 @@ void MemCardDrawIcon(TYPE_BLOCK_DATA * ptrBlockData, short x, short y)
GsSortTPoly4(&ptrBlockData->IconTPoly);
- for(i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
ptrBlockData->IconTPoly.u[i] = orig_u[i]; // Restore data
}
@@ -941,7 +941,7 @@ TYPE_BLOCK_DATA * MemCardShowMap(void)
unsigned char orig_b;
GsRectangle MemCardMapDialog;
- if(MemCardGetAllData() == false)
+ if (MemCardGetAllData() == false)
{
return false;
}
@@ -964,40 +964,40 @@ TYPE_BLOCK_DATA * MemCardShowMap(void)
GfxSetGlobalLuminance(NORMAL_LUMINANCE);
- while(1)
+ while (1)
{
- if(PadOneKeyReleased(PAD_TRIANGLE) == true)
+ if (PadOneKeyReleased(PAD_TRIANGLE) == true)
{
break;
}
- else if(PadOneKeyReleased(PAD_CROSS) == true)
+ else if (PadOneKeyReleased(PAD_CROSS) == true)
{
return &MemCardData[selectedBlock - BLOCK_1][selectedSlot];
}
- else if(PadOneKeyReleased(PAD_LEFT) == true)
+ else if (PadOneKeyReleased(PAD_LEFT) == true)
{
- if(selectedSlot == SLOT_TWO)
+ if (selectedSlot == SLOT_TWO)
{
selectedSlot = SLOT_ONE;
}
}
- else if(PadOneKeyReleased(PAD_RIGHT) == true)
+ else if (PadOneKeyReleased(PAD_RIGHT) == true)
{
- if(selectedSlot == SLOT_ONE)
+ if (selectedSlot == SLOT_ONE)
{
selectedSlot = SLOT_TWO;
}
}
- else if(PadOneKeyReleased(PAD_UP) == true)
+ else if (PadOneKeyReleased(PAD_UP) == true)
{
- if(selectedBlock > BLOCK_1)
+ if (selectedBlock > BLOCK_1)
{
selectedBlock--;
}
}
- else if(PadOneKeyReleased(PAD_DOWN) == true)
+ else if (PadOneKeyReleased(PAD_DOWN) == true)
{
- if(selectedBlock < BLOCK_15)
+ if (selectedBlock < BLOCK_15)
{
selectedBlock++;
}
@@ -1012,9 +1012,9 @@ TYPE_BLOCK_DATA * MemCardShowMap(void)
GsSortRectangle(&MemCardMapDialog);
- for(j = SLOT_ONE; j <= SLOT_TWO; j++)
+ for (j = SLOT_ONE; j <= SLOT_TWO; j++)
{
- if(MemCardStatus[j] == MEMCARD_STATUS_UNKNOWN)
+ if (MemCardStatus[j] == MEMCARD_STATUS_UNKNOWN)
{
FontSetFlags(&SmallFont, FONT_NOFLAGS);
@@ -1034,7 +1034,7 @@ TYPE_BLOCK_DATA * MemCardShowMap(void)
continue;
}
- for(i = BLOCK_1; i <= BLOCK_15; i++)
+ for (i = BLOCK_1; i <= BLOCK_15; i++)
{
ptrBlockData = &MemCardData[i - BLOCK_1][j];
@@ -1047,14 +1047,14 @@ TYPE_BLOCK_DATA * MemCardShowMap(void)
y += (short)(MEMCARD_DIALOG_GAP_X * ((i - BLOCK_1) / 3));
y += MEMCARD_DIALOG_GAP_X;
- if(ptrBlockData->BlockCount == EMPTY_BLOCK)
+ if (ptrBlockData->BlockCount == EMPTY_BLOCK)
{
emptyBlockRect.x = x;
emptyBlockRect.y = y;
emptyBlockRect.w = MEMCARD_BLOCK_IMAGE_W;
emptyBlockRect.h = MEMCARD_BLOCK_IMAGE_H;
- if( (i == selectedBlock) && (j == selectedSlot) )
+ if ( (i == selectedBlock) && (j == selectedSlot) )
{
emptyBlockRect.r = FULL_LUMINANCE;
emptyBlockRect.g = FULL_LUMINANCE;
@@ -1083,27 +1083,27 @@ TYPE_BLOCK_DATA * MemCardShowMap(void)
orig_g = ptrBlockData->IconTPoly.g;
orig_b = ptrBlockData->IconTPoly.b;
- if( (i == selectedBlock) && (j == selectedSlot) )
+ if ( (i == selectedBlock) && (j == selectedSlot) )
{
ptrBlockData->IconTPoly.r = FULL_LUMINANCE;
ptrBlockData->IconTPoly.g = FULL_LUMINANCE;
ptrBlockData->IconTPoly.b = FULL_LUMINANCE;
- if(ptrBlockData->BlockCount == FIRST_OR_ONLY_BLOCK)
+ if (ptrBlockData->BlockCount == FIRST_OR_ONLY_BLOCK)
{
FontPrintText( &SmallFont,
MEMCARD_LOAD_DATA_TEXT_X,
MEMCARD_LOAD_DATA_TEXT_Y,
(char*)ptrBlockData->FileName );
}
- else if(ptrBlockData->BlockCount == INTERMEDIATE_BLOCK)
+ else if (ptrBlockData->BlockCount == INTERMEDIATE_BLOCK)
{
FontPrintText( &SmallFont,
MEMCARD_LOAD_DATA_TEXT_X,
MEMCARD_LOAD_DATA_TEXT_Y,
"Intermediate block" );
}
- else if(ptrBlockData->BlockCount == LAST_BLOCK)
+ else if (ptrBlockData->BlockCount == LAST_BLOCK)
{
FontPrintText( &SmallFont,
MEMCARD_LOAD_DATA_TEXT_X,
@@ -1140,26 +1140,26 @@ bool MemCardSaveData(TYPE_BLOCK_DATA * ptrBlockData)
// Always check whether current block is empty or not
- if(ptrBlockData->BlockCount != EMPTY_BLOCK)
+ if (ptrBlockData->BlockCount != EMPTY_BLOCK)
{
- if(strncmp((char*)ptrBlockData->FileName, MEMCARD_GAME_FILENAME, MEMCARD_FILENAME_SIZE) != 0)
+ if (strncmp((char*)ptrBlockData->FileName, MEMCARD_GAME_FILENAME, MEMCARD_FILENAME_SIZE) != 0)
{
// Only our own blocks can be overwritten. NEVER overwrite other game blocks!
Serial_printf("I cannot erase blocks from other games!\n");
return false;
}
}
- else if(ptrBlockData->BlockCount != FIRST_OR_ONLY_BLOCK)
+ else if (ptrBlockData->BlockCount != FIRST_OR_ONLY_BLOCK)
{
Serial_printf("Please select first block of block array.\n");
return false;
}
- else if(ptrBlockData->Data == NULL)
+ else if (ptrBlockData->Data == NULL)
{
Serial_printf("No data on current block!\n");
return false;
}
- else if(ptrBlockData->Block == DIRECTORY_BLOCK)
+ else if (ptrBlockData->Block == DIRECTORY_BLOCK)
{
Serial_printf("Invalid block selected!\n");
return false;
@@ -1169,7 +1169,7 @@ bool MemCardSaveData(TYPE_BLOCK_DATA * ptrBlockData)
sz = MEMCARD_FIRST_OR_LAST_DATA_SIZE;
- for(i = 0; i < sz; i++)
+ for (i = 0; i < sz; i++)
{
McWriteSector(ptrBlockData->Slot, sector + i, &ptrBlockData->Data[i << 7 /* 128 */]);
}
diff --git a/Source/Menu.c b/Source/Menu.c
index 5b47c0b..e764cf3 100644
--- a/Source/Menu.c
+++ b/Source/Menu.c
@@ -304,11 +304,11 @@ void MainMenu(void)
GfxSetGlobalLuminance(NORMAL_LUMINANCE);
- while(1)
+ while (1)
{
MainMenuButtonHandler();
- while(GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() == true);
switch(menuLevel)
{
@@ -318,7 +318,7 @@ void MainMenu(void)
MainMenuDrawButton(&MainMenuBtn[PLAY_BUTTON_INDEX]);
MainMenuDrawButton(&MainMenuBtn[OPTIONS_BUTTON_INDEX]);
- for(cheat_array = PadGetPlayerOneCheatArray(), i = 0; *cheat_array != 0; cheat_array++, i += 16)
+ for (cheat_array = PadGetPlayerOneCheatArray(), i = 0; *cheat_array != 0; cheat_array++, i += 16)
{
GfxDrawButton(i, 220, *cheat_array);
}
@@ -332,7 +332,7 @@ void MainMenu(void)
MainMenuDrawButton(&MainMenuBtn[ONE_PLAYER_BUTTON_INDEX]);
MainMenuDrawButton(&MainMenuBtn[TWO_PLAYER_BUTTON_INDEX]);
- for(cheat_array = PadGetPlayerOneCheatArray(), i = 0; *cheat_array != 0; cheat_array++, i += 16)
+ for (cheat_array = PadGetPlayerOneCheatArray(), i = 0; *cheat_array != 0; cheat_array++, i += 16)
{
GfxDrawButton(i, 220, *cheat_array);
}
@@ -379,15 +379,15 @@ void MainMenuButtonHandler(void)
static uint8_t previous_btn_selected = 0;
uint8_t max_buttons;
- if(PadOneAnyKeyPressed() == true)
+ if (PadOneAnyKeyPressed() == true)
{
- if(SystemIsRandSeedSet() == false)
+ if (SystemIsRandSeedSet() == false)
{
SystemSetRandSeed();
}
}
- if( (PadOneKeySinglePress(PAD_CROSS) == true)
+ if ( (PadOneKeySinglePress(PAD_CROSS) == true)
||
(PadOneKeySinglePress(PAD_TRIANGLE) == true) )
{
@@ -402,7 +402,7 @@ void MainMenuButtonHandler(void)
case ONE_TWO_PLAYERS_LEVEL:
- if( (btn_selected == TWO_PLAYER_BUTTON_INDEX)
+ if ( (btn_selected == TWO_PLAYER_BUTTON_INDEX)
&&
(PadTwoConnected() == false) )
{
@@ -413,7 +413,7 @@ void MainMenuButtonHandler(void)
max_buttons = MAIN_MENU_ONE_TWO_PLAYERS_LEVEL_BUTTONS;
}
- if(PadOneKeySinglePress(PAD_TRIANGLE) == true)
+ if (PadOneKeySinglePress(PAD_TRIANGLE) == true)
{
menuLevel = PLAY_OPTIONS_LEVEL;
MainMenuMinimumBtn = PLAY_BUTTON_INDEX;
@@ -432,14 +432,14 @@ void MainMenuButtonHandler(void)
MainMenuBtn[previous_btn_selected].was_selected = MainMenuBtn[previous_btn_selected].selected;
MainMenuBtn[btn_selected].was_selected = MainMenuBtn[btn_selected].selected;
- if(PadOneKeySinglePress(PAD_LEFT) && (btn_selected > 0) )
+ if (PadOneKeySinglePress(PAD_LEFT) && (btn_selected > 0) )
{
MainMenuBtn[btn_selected].selected = false;
previous_btn_selected = btn_selected;
btn_selected--;
SfxPlaySound(&BellSnd);
}
- else if(PadOneKeySinglePress(PAD_RIGHT)
+ else if (PadOneKeySinglePress(PAD_RIGHT)
&&
(btn_selected < (max_buttons - 1 + MainMenuMinimumBtn) ) )
{
@@ -449,20 +449,20 @@ void MainMenuButtonHandler(void)
SfxPlaySound(&BellSnd);
}
- if(btn_selected < MainMenuMinimumBtn)
+ if (btn_selected < MainMenuMinimumBtn)
{
btn_selected = MainMenuMinimumBtn;
}
- if(btn_selected > (max_buttons - 1 + MainMenuMinimumBtn) )
+ if (btn_selected > (max_buttons - 1 + MainMenuMinimumBtn) )
{
// Avoid overflow when going back in menu navigation
btn_selected = (max_buttons - 1 + MainMenuMinimumBtn);
}
- if(PadOneKeySinglePress(PAD_CROSS) )
+ if (PadOneKeySinglePress(PAD_CROSS) )
{
- if(menuLevel == ONE_TWO_PLAYERS_LEVEL)
+ if (menuLevel == ONE_TWO_PLAYERS_LEVEL)
{
// Start gameplay!
MainMenuBtn[btn_selected].f();
@@ -477,7 +477,7 @@ void MainMenuButtonHandler(void)
- if(menuLevel == ONE_TWO_PLAYERS_LEVEL)
+ if (menuLevel == ONE_TWO_PLAYERS_LEVEL)
{
btn_selected = PLAY_BUTTON_INDEX;
}
@@ -494,14 +494,14 @@ void MainMenuDrawButton(TYPE_MMBtn * btn)
MenuSpr.w = BUTTON_SIZE;
MenuSpr.h = BUTTON_SIZE;
- if(btn->timer < MainMenuBtnAni_sz)
+ if (btn->timer < MainMenuBtnAni_sz)
{
btn->timer++;
}
- if(btn->selected == true)
+ if (btn->selected == true)
{
- if(btn->was_selected == false)
+ if (btn->was_selected == false)
{
btn->timer = 0;
}
@@ -557,7 +557,7 @@ void MainMenuDrawButton(TYPE_MMBtn * btn)
// Exception: turn option dimmer if second player pad isn't connected
- if(PadTwoConnected() == false)
+ if (PadTwoConnected() == false)
{
MenuSpr.r = NORMAL_LUMINANCE >> 1;
MenuSpr.g = NORMAL_LUMINANCE >> 1;
@@ -575,7 +575,7 @@ void MainMenuDrawButton(TYPE_MMBtn * btn)
void MenuTestCheat(void)
{
- if(MemCardShowMap() == false)
+ if (MemCardShowMap() == false)
{
Serial_printf("MemCardShowMap() failed!\n");
return;
diff --git a/Source/PSXSDKIntro.c b/Source/PSXSDKIntro.c
index 8c76723..d73367e 100644
--- a/Source/PSXSDKIntro.c
+++ b/Source/PSXSDKIntro.c
@@ -147,7 +147,7 @@ void PSXSDKIntroDrawChar(short x, short y, char ch)
PSXSDKIntroFont.h = FONT_SIZE;
PSXSDKIntroFont.tpage = FONT_TPAGE;
- if( (ch >= 'A') && (ch <= 'Z') )
+ if ( (ch >= 'A') && (ch <= 'Z') )
{
ch -= 'A'; // Reset offset
@@ -160,7 +160,7 @@ void PSXSDKIntroDrawChar(short x, short y, char ch)
GfxSortSprite(&PSXSDKIntroFont);
}
- if(ch == ' ')
+ if (ch == ' ')
{
return;
}
@@ -181,18 +181,18 @@ void PSXSDKIntro(void)
GfxSetGlobalLuminance(NORMAL_LUMINANCE);
- while(1)
+ while (1)
{
- while(GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() == true);
- if( ( (GfxGetGlobalLuminance() - BG_LUMINANCE_STEP) > 0)
+ if ( ( (GfxGetGlobalLuminance() - BG_LUMINANCE_STEP) > 0)
&&
(PSXSDKIntroClose == true) )
{
GfxIncreaseGlobalLuminance(-BG_LUMINANCE_STEP);
}
- if( (GfxGetGlobalLuminance() <= BG_LUMINANCE_STEP)
+ if ( (GfxGetGlobalLuminance() <= BG_LUMINANCE_STEP)
&&
(PSXSDKIntroClose == true) )
{
@@ -201,13 +201,13 @@ void PSXSDKIntro(void)
GsSortCls(0,0,0);
- for(i = 0; i < strlen(strPSXSDKIntro) ; i++)
+ for (i = 0; i < strlen(strPSXSDKIntro) ; i++)
{
- if( (PSXSDKIntroRandTextEvent == true)
+ if ( (PSXSDKIntroRandTextEvent == true)
&&
(PSXSDKIntroStringEvent == false) )
{
- if(PSXSDKIntroRandTextEventReminder == false)
+ if (PSXSDKIntroRandTextEventReminder == false)
{
PSXSDKIntroRandTextEventReminder = true;
SfxPlaySound(&SpinDiskSnd);
@@ -223,15 +223,15 @@ void PSXSDKIntro(void)
OpenSource_Logo.g = 0;
OpenSource_Logo.b = 0;
}
- else if( (PSXSDKIntroRandTextEvent == true)
+ else if ( (PSXSDKIntroRandTextEvent == true)
&&
(PSXSDKIntroStringEvent == true) )
{
PSXSDKIntroDrawChar(FONT_X + (i << FONT_SIZE_BITSHIFT),FONT_Y,strPSXSDKIntro[i]);
- if(System100msTick() == true)
+ if (System100msTick() == true)
{
- if(GPL_Logo.r < GPL_LOGO_LUMINANCE_TARGET)
+ if (GPL_Logo.r < GPL_LOGO_LUMINANCE_TARGET)
{
GPL_Logo.r += GPL_LOGO_LUMINANCE_STEP;
GPL_Logo.g += GPL_LOGO_LUMINANCE_STEP;
@@ -241,7 +241,7 @@ void PSXSDKIntro(void)
GPL_Logo.x = GPL_LOGO_X;
GPL_Logo.y = GPL_LOGO_Y;
- if(OpenSource_Logo.r < OPEN_SOURCE_LOGO_LUMINANCE_TARGET)
+ if (OpenSource_Logo.r < OPEN_SOURCE_LOGO_LUMINANCE_TARGET)
{
OpenSource_Logo.r += OPEN_SOURCE_LOGO_LUMINANCE_STEP;
OpenSource_Logo.g += OPEN_SOURCE_LOGO_LUMINANCE_STEP;
@@ -257,15 +257,15 @@ void PSXSDKIntro(void)
}
}
- for(i = 0; i < strlen(strPSXSDKIntroAuthor) ; i++)
+ for (i = 0; i < strlen(strPSXSDKIntroAuthor) ; i++)
{
- if( (PSXSDKIntroRandTextEvent == true)
+ if ( (PSXSDKIntroRandTextEvent == true)
&&
(PSXSDKIntroStringEvent == false) )
{
PSXSDKIntroDrawChar(FONT_X2 + (i << FONT_SIZE_BITSHIFT),FONT_Y2,SystemRand('A','Z'));
}
- else if( (PSXSDKIntroRandTextEvent == true)
+ else if ( (PSXSDKIntroRandTextEvent == true)
&&
(PSXSDKIntroStringEvent == true) )
{
@@ -277,9 +277,9 @@ void PSXSDKIntro(void)
PSXSDKIntroDrawDisk();
- if(PSXSDKIntroCloseShellEvent == true)
+ if (PSXSDKIntroCloseShellEvent == true)
{
- if(PSXSDKIntroCloseShellEventReminder == false)
+ if (PSXSDKIntroCloseShellEventReminder == false)
{
PSXSDKIntroCloseShellEventReminder = true;
@@ -325,7 +325,7 @@ void PSXSDKIntroRunTimers(void)
intro_timer++;
- if( (intro_timer >= CLOSE_SHELL_EV_TIM)
+ if ( (intro_timer >= CLOSE_SHELL_EV_TIM)
&&
(PSXSDKIntroCloseShellEvent == false) )
{
@@ -333,7 +333,7 @@ void PSXSDKIntroRunTimers(void)
intro_timer = 0;
}
- if( (intro_timer >= DISK_SPIN_EV_TIM)
+ if ( (intro_timer >= DISK_SPIN_EV_TIM)
&&
(PSXSDKIntroCloseShellEvent == true)
&&
@@ -343,7 +343,7 @@ void PSXSDKIntroRunTimers(void)
intro_timer = 0;
}
- if( (intro_timer >= TEXT_APPEAR_RANDOM_TIM)
+ if ( (intro_timer >= TEXT_APPEAR_RANDOM_TIM)
&&
(PSXSDKIntroCloseShellEvent == true)
&&
@@ -355,7 +355,7 @@ void PSXSDKIntroRunTimers(void)
intro_timer = 0;
}
- if( (intro_timer >= TEXT_APPEAR_STRING_TIM)
+ if ( (intro_timer >= TEXT_APPEAR_STRING_TIM)
&&
(PSXSDKIntroCloseShellEvent == true)
&&
@@ -370,7 +370,7 @@ void PSXSDKIntroRunTimers(void)
intro_timer = 0;
}
- if( (intro_timer >= INTRO_CLOSE_TIM)
+ if ( (intro_timer >= INTRO_CLOSE_TIM)
&&
(PSXSDKIntroCloseShellEvent == true)
&&
@@ -402,21 +402,21 @@ void PSXSDKIntroDrawDisk(void)
PsxDisk.u = DISK_U;
PsxDisk.v = DISK_V;
- if(PSXSDKIntroSpinDiskEvent == true)
+ if (PSXSDKIntroSpinDiskEvent == true)
{
- if(PSXSDKIntroSpinDiskEventReminder == false)
+ if (PSXSDKIntroSpinDiskEventReminder == false)
{
PSXSDKIntroSpinDiskEventReminder = true;
//SfxPlaySound(&SpinDiskSnd);
}
- if(spin_speed < MAX_DISK_SPIN)
+ if (spin_speed < MAX_DISK_SPIN)
{
spin_speed++;
}
- if(spin_rotate < GfxRotateFromDegrees(360) )
+ if (spin_rotate < GfxRotateFromDegrees(360) )
{
spin_rotate += GfxRotateFromDegrees(spin_speed++);
}
@@ -437,7 +437,7 @@ void PSXSDKIntroDrawDisk(void)
void PSXSDKIntroDrawTransCase(void)
{
- /*if(PSXSDKIntroCloseShellEvent == false)
+ /*if (PSXSDKIntroCloseShellEvent == false)
{
PsxDisk.x = READER_X;
PsxDisk.y = READER_Y;
diff --git a/Source/Pad.c b/Source/Pad.c
index 8ea13dc..71b1fdc 100644
--- a/Source/Pad.c
+++ b/Source/Pad.c
@@ -131,7 +131,7 @@ bool PadOneConnected(void)
{
psx_pad_state PadOne = PadOneGetState();
- if( (PadOne.status != PAD_STATUS_OK)
+ if ( (PadOne.status != PAD_STATUS_OK)
&&
(PadOneGetID() == PAD_FLOATING_ID) )
{
@@ -145,7 +145,7 @@ bool PadTwoConnected(void)
{
psx_pad_state PadTwo = PadTwoGetState();
- if( (PadTwo.status != PAD_STATUS_OK)
+ if ( (PadTwo.status != PAD_STATUS_OK)
&&
(PadTwoGetID() == PAD_FLOATING_ID) )
{
@@ -243,14 +243,14 @@ bool PadOneKeyRepeat(unsigned short key, uint8_t time)
{
uint8_t key_index = PadGetKeyIndex(key);
- if(key_index == NUMBER_OF_KEYS)
+ if (key_index == NUMBER_OF_KEYS)
{
return false;
}
pad1_keys_repeat[key_index]++;
- if(pad1_keys_repeat[key_index] >= time)
+ if (pad1_keys_repeat[key_index] >= time)
{
pad1_keys_repeat[key_index] = 0;
return true;
@@ -263,14 +263,14 @@ bool PadTwoKeyRepeat(unsigned short key, uint8_t time)
{
uint8_t key_index = PadGetKeyIndex(key);
- if(key_index == NUMBER_OF_KEYS)
+ if (key_index == NUMBER_OF_KEYS)
{
return false;
}
pad2_keys_repeat[key_index]++;
- if(pad2_keys_repeat[key_index] >= time)
+ if (pad2_keys_repeat[key_index] >= time)
{
pad2_keys_repeat[key_index] = 0;
return true;
@@ -281,7 +281,7 @@ bool PadTwoKeyRepeat(unsigned short key, uint8_t time)
void PadOneVibrationHandler(void)
{
- if(PadOneIsVibrationEnabled() == true)
+ if (PadOneIsVibrationEnabled() == true)
{
pad_enable_vibration(PAD_ONE);
pad_set_vibration(PAD_ONE,pad1_small_vibration_force,pad1_big_vibration_force);
@@ -291,7 +291,7 @@ void PadOneVibrationHandler(void)
void PadTwoVibrationHandler(void)
{
- if(PadTwoIsVibrationEnabled() == true)
+ if (PadTwoIsVibrationEnabled() == true)
{
pad_enable_vibration(PAD_TWO);
pad_set_vibration(PAD_TWO,pad2_small_vibration_force,pad2_big_vibration_force);
@@ -327,11 +327,11 @@ bool UpdatePads(void)
previous_pad1 = pad1;
previous_pad2 = pad2;
- if(PadOneGetType() == PADTYPE_MOUSE)
+ if (PadOneGetType() == PADTYPE_MOUSE)
{
PSX_ReadMouse(&pad1, &adc_mouse);
- if(old_adc_mouse != adc_mouse)
+ if (old_adc_mouse != adc_mouse)
{
Serial_printf("0%04X\n", adc_mouse);
}
@@ -343,17 +343,17 @@ bool UpdatePads(void)
PSX_ReadPad(&pad1,&pad2);
}
- if(PadOneConnected() == false)
+ if (PadOneConnected() == false)
{
both_pads_connected = false;
}
- if(PadTwoConnected() == false)
+ if (PadTwoConnected() == false)
{
both_pads_connected = false;
}
- if(!(previous_pad1 & pad1) )
+ if (!(previous_pad1 & pad1) )
{
pad1_last_key_single_pressed = pad1;
}
@@ -362,7 +362,7 @@ bool UpdatePads(void)
pad1_last_key_single_pressed = 0;
}
- if(!(previous_pad2 & pad2) )
+ if (!(previous_pad2 & pad2) )
{
pad2_last_key_single_pressed = pad2;
}
@@ -501,15 +501,15 @@ void PadCheatHandler(uint8_t n_pad)
return;
}
- for(i = 0; i < PAD_MAX_CHEATS; i++)
+ for (i = 0; i < PAD_MAX_CHEATS; i++)
{
- if(cheatsArray[i] != NULL)
+ if (cheatsArray[i] != NULL)
{
- if(SystemArrayCompare(cheat_array, cheatsArray[i]->Combination, CHEAT_ARRAY_SIZE) == true)
+ if (SystemArrayCompare(cheat_array, cheatsArray[i]->Combination, CHEAT_ARRAY_SIZE) == true)
{
- if(cheatsArray[i]->Callback != NULL)
+ if (cheatsArray[i]->Callback != NULL)
{
- if(clean_callback != NULL)
+ if (clean_callback != NULL)
{
clean_callback();
}
@@ -522,9 +522,9 @@ void PadCheatHandler(uint8_t n_pad)
}
}
- for(i = 0; i < sizeof(available_keys) / sizeof(unsigned short); i++)
+ for (i = 0; i < sizeof(available_keys) / sizeof(unsigned short); i++)
{
- if(pressed_callback(available_keys[i]) == true)
+ if (pressed_callback(available_keys[i]) == true)
{
TimerRestart(timer);
key = available_keys[i];
@@ -532,25 +532,25 @@ void PadCheatHandler(uint8_t n_pad)
}
}
- if(keys_released != 1)
+ if (keys_released != 1)
{
return;
}
// Check for full array (return success = true if an empty array
// element was found.
- for(j = 0; j < CHEAT_ARRAY_SIZE; j++)
+ for (j = 0; j < CHEAT_ARRAY_SIZE; j++)
{
- if(cheat_array[j] == 0)
+ if (cheat_array[j] == 0)
{
success = true;
break;
}
}
- if(success == false)
+ if (success == false)
{
- if(clean_callback != NULL)
+ if (clean_callback != NULL)
{
// Overrun
clean_callback();
@@ -564,7 +564,7 @@ bool PadAddCheat(TYPE_CHEAT * cheat)
{
static uint8_t idx = 0;
- if(idx >= PAD_MAX_CHEATS)
+ if (idx >= PAD_MAX_CHEATS)
{
Serial_printf("Maximum number of cheats exceeded!\n");
return false;
diff --git a/Source/PltParser.c b/Source/PltParser.c
index 9427494..5a07c7b 100644
--- a/Source/PltParser.c
+++ b/Source/PltParser.c
@@ -56,7 +56,7 @@ bool PltParserLoadFile(char* strPath, TYPE_FLIGHT_DATA* ptrFlightData)
char strMinutes[PLT_HOUR_MINUTE_CHARACTERS];
uint8_t* strPltBuffer;
- if(SystemLoadFile(strPath) == false)
+ if (SystemLoadFile(strPath) == false)
{
Serial_printf("Error loading file %s!\n",strPath);
return false;
@@ -72,29 +72,29 @@ bool PltParserLoadFile(char* strPath, TYPE_FLIGHT_DATA* ptrFlightData)
aircraftIndex = 0;
- while(buffer != NULL)
+ while (buffer != NULL)
{
- if(buffer[0] == '#')
+ if (buffer[0] == '#')
{
// Comment line
buffer = strtok_r(NULL,"\n",&pltBufferSavePtr);
continue;
}
- if(first_line_read == false)
+ if (first_line_read == false)
{
// First (non-comment) line should indicate level time
// i.e.: 10:30, or 22:45
first_line_read = true;
- if(strlen(buffer) != PLT_FIRST_LINE_CHARACTERS)
+ if (strlen(buffer) != PLT_FIRST_LINE_CHARACTERS)
{
// Format should always be HH:MM (5 characters)
// Treat any other combination as possible error
return false;
}
- if(buffer[PLT_COLON_POSITION] != ':')
+ if (buffer[PLT_COLON_POSITION] != ':')
{
// Check whether time format is HH:MM
return false;
@@ -102,15 +102,15 @@ bool PltParserLoadFile(char* strPath, TYPE_FLIGHT_DATA* ptrFlightData)
j = 0;
- for(i = 0; i < PLT_FIRST_LINE_CHARACTERS ; i++)
+ for (i = 0; i < PLT_FIRST_LINE_CHARACTERS ; i++)
{
- if(i == PLT_COLON_POSITION)
+ if (i == PLT_COLON_POSITION)
{
j = 0;
buffer = strtok(NULL,"\n");
continue;
}
- else if(i < PLT_COLON_POSITION)
+ else if (i < PLT_COLON_POSITION)
{
strHour[j++] = buffer[i];
}
@@ -134,18 +134,18 @@ bool PltParserLoadFile(char* strPath, TYPE_FLIGHT_DATA* ptrFlightData)
Serial_printf("New line read: %s\n",buffer);
- while(lineBufferPtr != NULL)
+ while (lineBufferPtr != NULL)
{
switch(i)
{
case DEPARTURE_ARRIVAL_INDEX:
- if(strncmp(lineBufferPtr,"DEPARTURE",strlen("DEPARTURE") ) == 0)
+ if (strncmp(lineBufferPtr,"DEPARTURE",strlen("DEPARTURE") ) == 0)
{
ptrFlightData->FlightDirection[aircraftIndex] = DEPARTURE;
Serial_printf("Aircraft %d set to DEPARTURE.\n",aircraftIndex);
}
- else if(strncmp(lineBufferPtr,"ARRIVAL",strlen("ARRIVAL") ) == 0)
+ else if (strncmp(lineBufferPtr,"ARRIVAL",strlen("ARRIVAL") ) == 0)
{
ptrFlightData->FlightDirection[aircraftIndex] = ARRIVAL;
Serial_printf("Aircraft %d set to ARRIVAL.\n",aircraftIndex);
@@ -168,7 +168,7 @@ bool PltParserLoadFile(char* strPath, TYPE_FLIGHT_DATA* ptrFlightData)
break;
case PARKING_INDEX:
- if(ptrFlightData->FlightDirection[aircraftIndex] == DEPARTURE)
+ if (ptrFlightData->FlightDirection[aircraftIndex] == DEPARTURE)
{
ptrFlightData->Parking[aircraftIndex] = atoi(lineBufferPtr);
}
@@ -180,7 +180,7 @@ bool PltParserLoadFile(char* strPath, TYPE_FLIGHT_DATA* ptrFlightData)
break;
case HOURS_MINUTES_INDEX:
- if( strlen(lineBufferPtr) != strlen("HH:MM") )
+ if ( strlen(lineBufferPtr) != strlen("HH:MM") )
{
Serial_printf("Hour minute format is not correct!\n");
break;
@@ -234,7 +234,7 @@ void PltParserResetBuffers(TYPE_FLIGHT_DATA* ptrFlightData)
{
uint8_t i;
- for(i = 0; i < GAME_MAX_AIRCRAFT ; i++)
+ for (i = 0; i < GAME_MAX_AIRCRAFT ; i++)
{
memset(ptrFlightData->strFlightNumber[i],'\0',GAME_MAX_CHARACTERS);
}
@@ -327,7 +327,7 @@ uint8_t* PltParserGenerateFile(TYPE_PLT_CONFIG* ptrPltConfig)
snprintf(auxBuffer, 32, "%d:%d\n", InitialHour, InitialMinutes);
- for(i = 0; auxBuffer[i] != '\0'; i++)
+ for (i = 0; auxBuffer[i] != '\0'; i++)
{
// Transfer contents generated from snprintf to main buffer.
PltBuffer[i] = auxBuffer[i];
@@ -339,11 +339,11 @@ uint8_t* PltParserGenerateFile(TYPE_PLT_CONFIG* ptrPltConfig)
DEBUG_PRINT_VAR(minAircraftTime);
DEBUG_PRINT_VAR(maxAircraftTime);
- for(j = 0; j < nAircraft; j++)
+ for (j = 0; j < nAircraft; j++)
{
uint8_t dep_arr_rand = SystemRand(0,100);
- if(dep_arr_rand < 50)
+ if (dep_arr_rand < 50)
{
// Set departure flight
diff --git a/Source/Serial.c b/Source/Serial.c
index c7b085a..8711245 100644
--- a/Source/Serial.c
+++ b/Source/Serial.c
@@ -43,7 +43,7 @@ void SerialInit(void)
bool SerialRead(uint8_t* ptrArray, size_t nBytes)
{
- if(nBytes == 0)
+ if (nBytes == 0)
{
dprintf("SerialRead: invalid size %d\n", nBytes);
return false;
@@ -53,10 +53,10 @@ bool SerialRead(uint8_t* ptrArray, size_t nBytes)
{
//uint16_t timeout = SERIAL_TX_RX_TIMEOUT;
- while( (SIOCheckInBuffer() == SERIAL_RX_FIFO_EMPTY)); // Wait for RX FIFO not empty
+ while ( (SIOCheckInBuffer() == SERIAL_RX_FIFO_EMPTY)); // Wait for RX FIFO not empty
*(ptrArray++) = SIOReadByte();
- }while(--nBytes);
+ }while (--nBytes);
return true;
}
@@ -65,7 +65,7 @@ bool SerialWrite(void* ptrArray, size_t nBytes)
{
serial_busy = true;
- if(nBytes == 0)
+ if (nBytes == 0)
{
dprintf("SerialWrite: invalid size %d\n", nBytes);
return false;
@@ -75,11 +75,11 @@ bool SerialWrite(void* ptrArray, size_t nBytes)
{
//uint16_t timeout = SERIAL_TX_RX_TIMEOUT;
- while( (SIOCheckOutBuffer() == SERIAL_TX_NOT_READY)); // Wait for TX FIFO empty.
+ while ( (SIOCheckOutBuffer() == SERIAL_TX_NOT_READY)); // Wait for TX FIFO empty.
SIOSendByte(*(uint8_t*)ptrArray++);
- }while(--nBytes);
+ }while (--nBytes);
serial_busy = false;
@@ -108,4 +108,3 @@ void Serial_printf(const char* str, ...)
SerialWrite(internal_buffer, result);
}
#endif // SERIAL_INTERFACE
-
diff --git a/Source/Sfx.c b/Source/Sfx.c
index fc6b11c..905cefb 100644
--- a/Source/Sfx.c
+++ b/Source/Sfx.c
@@ -30,7 +30,7 @@ static uint16_t SfxCddaVolumeReduction;
void SfxPlaySound(SsVag * sound)
{
- if(sound->data_size != 0)
+ if (sound->data_size != 0)
{
SsPlayVag(sound, sound->cur_voice, MAX_VOLUME - SfxGlobalVolumeReduction, MAX_VOLUME - SfxGlobalVolumeReduction);
}
@@ -40,12 +40,12 @@ bool SfxUploadSound(char* file_path, SsVag * vag)
{
static size_t SPUBytesUsed;
- if(SystemLoadFile(file_path) == false)
+ if (SystemLoadFile(file_path) == false)
{
return false;
}
- if(voiceIndex < NUMBER_OF_VOICES)
+ if (voiceIndex < NUMBER_OF_VOICES)
{
SsReadVag(vag,SystemGetBufferAddress());
@@ -59,7 +59,7 @@ bool SfxUploadSound(char* file_path, SsVag * vag)
SPUBytesUsed += vag->data_size;
- if(SPUBytesUsed != 0)
+ if (SPUBytesUsed != 0)
{
enum
{
@@ -102,7 +102,7 @@ void SfxStopMusic(void)
CDVol>>=1;
SsCdVol(CDVol,CDVol);
- while(SystemGetGlobalTimer() < (timer + time_step) );
+ while (SystemGetGlobalTimer() < (timer + time_step) );
timer = SystemGetGlobalTimer();
}
diff --git a/Source/System.c b/Source/System.c
index 7488028..001a01d 100644
--- a/Source/System.c
+++ b/Source/System.c
@@ -158,7 +158,7 @@ void ISR_RootCounter2(void)
void SystemSetRandSeed(void)
{
- if(rand_seed == false)
+ if (rand_seed == false)
{
rand_seed = true;
//Set random seed using global timer as reference
@@ -225,7 +225,7 @@ bool SystemRefreshNeeded(void)
void ISR_SystemDefaultVBlank(void)
{
- if(System1SecondTick() == true)
+ if (System1SecondTick() == true)
{
fps = temp_fps;
temp_fps = 0;
@@ -277,9 +277,9 @@ void SystemCalculateSine(void)
static bool sine_decrease = false;
- if(sine_decrease == false)
+ if (sine_decrease == false)
{
- if(sine_counter < SINE_EFFECT_MAX)
+ if (sine_counter < SINE_EFFECT_MAX)
{
sine_counter += SINE_EFFECT_STEP;
}
@@ -290,7 +290,7 @@ void SystemCalculateSine(void)
}
else
{
- if(sine_counter > SINE_EFFECT_STEP)
+ if (sine_counter > SINE_EFFECT_STEP)
{
sine_counter -= SINE_EFFECT_STEP;
}
@@ -456,12 +456,12 @@ void SystemRunTimers(void)
void SystemCheckTimer(bool* timer, uint64_t* last_timer, uint8_t step)
{
- if(*timer == true)
+ if (*timer == true)
{
*timer = false;
}
- if(global_timer >= (*last_timer + step) )
+ if (global_timer >= (*last_timer + step) )
{
*timer = true;
*last_timer = global_timer;
@@ -492,9 +492,9 @@ bool SystemLoadFileToBuffer(char* fname, uint8_t* buffer, uint32_t szBuffer)
int32_t size = 0;
// Wait for possible previous operation from the GPU before entering this section.
- while( (SystemIsBusy() == true) || (GfxIsGPUBusy() == true) );
+ while ( (SystemIsBusy() == true) || (GfxIsGPUBusy() == true) );
- if(fname == NULL)
+ if (fname == NULL)
{
Serial_printf("SystemLoadFile: NULL fname!\n");
return false;
@@ -507,20 +507,20 @@ bool SystemLoadFileToBuffer(char* fname, uint8_t* buffer, uint32_t szBuffer)
SerialRead(fileSizeBuffer, sizeof(uint32_t) );
- for(i = 0; i < sizeof(uint32_t); i++)
+ for (i = 0; i < sizeof(uint32_t); i++)
{
size |= fileSizeBuffer[i] << (i << 3); // (i << 3) == (i * 8)
}
SerialWrite(ACK_BYTE_STRING, 1);
- for(i = 0; i < size; i += SERIAL_DATA_PACKET_SIZE)
+ for (i = 0; i < size; i += SERIAL_DATA_PACKET_SIZE)
{
uint32_t bytes_to_read;
// Read actual EXE data into proper RAM address.
- if( (i + SERIAL_DATA_PACKET_SIZE) >= size)
+ if ( (i + SERIAL_DATA_PACKET_SIZE) >= size)
{
bytes_to_read = size - i;
}
@@ -541,7 +541,7 @@ bool SystemLoadFileToBuffer(char* fname, uint8_t* buffer, uint32_t szBuffer)
f = fopen(fname, "r");
- if(f == NULL)
+ if (f == NULL)
{
Serial_printf("SystemLoadFile: file could not be found!\n");
//File couldn't be found
@@ -552,7 +552,7 @@ bool SystemLoadFileToBuffer(char* fname, uint8_t* buffer, uint32_t szBuffer)
size = ftell(f);
- if(size > szBuffer)
+ if (size > szBuffer)
{
Serial_printf("SystemLoadFile: Exceeds file buffer size (%d bytes)\n",size);
//Bigger than 128 kB (buffer's max size)
@@ -637,7 +637,7 @@ void SystemWaitCycles(uint32_t cycles)
{
uint64_t currentTime = global_timer;
- while(global_timer < (currentTime + cycles) );
+ while (global_timer < (currentTime + cycles) );
}
/* ******************************************************************
@@ -655,7 +655,7 @@ void SystemWaitCycles(uint32_t cycles)
uint32_t SystemRand(uint32_t min, uint32_t max)
{
- if(rand_seed == false)
+ if (rand_seed == false)
{
Serial_printf("Warning: calling rand() before srand()\n");
}
@@ -726,9 +726,9 @@ bool SystemContains_u8(uint8_t value, uint8_t* buffer, size_t sz)
{
size_t i = 0;
- for(i = 0; i < sz; i++)
+ for (i = 0; i < sz; i++)
{
- if(buffer[i] == value)
+ if (buffer[i] == value)
{
return true;
}
@@ -754,9 +754,9 @@ bool SystemContains_u16(uint16_t value, uint16_t* buffer, size_t sz)
{
size_t i = 0;
- for(i = 0; i < sz; i++)
+ for (i = 0; i < sz; i++)
{
- if(buffer[i] == value)
+ if (buffer[i] == value)
{
return true;
}
@@ -781,9 +781,9 @@ bool SystemArrayCompare(unsigned short* arr1, unsigned short* arr2, size_t sz)
{
size_t i;
- for(i = 0; i < sz; i++)
+ for (i = 0; i < sz; i++)
{
- if(arr1[i] != arr2[i])
+ if (arr1[i] != arr2[i])
{
return false;
}
@@ -844,11 +844,11 @@ void SystemCheckStack(void)
ptrStack -= STACK_SIZE;
data = (*ptrStack);
- if(data != END_STACK_PATTERN)
+ if (data != END_STACK_PATTERN)
{
Serial_printf("Stack overflow?\n");
- while(1);
+ while (1);
}
}
@@ -889,11 +889,11 @@ int32_t SystemIndexOfStringArray(char* str, char** array)
{
int32_t i;
- for(i = 0; array[i] != NULL; i++)
+ for (i = 0; array[i] != NULL; i++)
{
Serial_printf("String to find: %s\nEntry: %s\n", str, array[i]);
- if(strcmp(str, array[i]) == 0)
+ if (strcmp(str, array[i]) == 0)
{
Serial_printf("Match! Returning index %d...\n", i);
return i;
@@ -919,9 +919,9 @@ int32_t SystemIndexOf_U16(uint16_t value, uint16_t* array, uint32_t sz)
{
int32_t i;
- for(i = 0; i < sz; i++)
+ for (i = 0; i < sz; i++)
{
- if(value == array[i])
+ if (value == array[i])
{
return i;
}
@@ -948,9 +948,9 @@ int32_t SystemIndexOf_U8(uint8_t value, uint8_t* array, uint32_t from, uint32_t
{
int32_t i;
- for(i = from; i < sz; i++)
+ for (i = from; i < sz; i++)
{
- if(value == array[i])
+ if (value == array[i])
{
return i;
}
@@ -1163,7 +1163,7 @@ void SystemDevMenu(void)
DEVMENU_ROOTCNT2_TEXT_Y = DEVMENU_PAD2_RAW_DATA_TEXT_Y + DEVMENU_TEXT_GAP,
};
- if(devmenu_flag == true)
+ if (devmenu_flag == true)
{
GsRectangle devMenuBg = { .x = DEVMENU_BG_X,
.y = DEVMENU_BG_Y,
diff --git a/Source/Timer.c b/Source/Timer.c
index 841979e..d49e698 100644
--- a/Source/Timer.c
+++ b/Source/Timer.c
@@ -46,15 +46,15 @@ TYPE_TIMER* TimerCreate(uint32_t t, bool rf, void (*timer_callback)(void) )
bool success = false;
uint8_t i;
- if(t == 0)
+ if (t == 0)
{
Serial_printf("Cannot create timer with time == 0!\n");
return NULL;
}
- for(i = 0; i < MAX_TIMERS; i++)
+ for (i = 0; i < MAX_TIMERS; i++)
{
- if(timer_array[i].busy == false)
+ if (timer_array[i].busy == false)
{
timer_array[i].Timeout_Callback = timer_callback;
timer_array[i].time = t;
@@ -66,7 +66,7 @@ TYPE_TIMER* TimerCreate(uint32_t t, bool rf, void (*timer_callback)(void) )
}
}
- if(success == false)
+ if (success == false)
{
Serial_printf("Could not find any free timer!\n");
return NULL;
@@ -89,7 +89,7 @@ void TimerReset(void)
{
uint8_t i;
- for(i = 0; i < MAX_TIMERS; i++)
+ for (i = 0; i < MAX_TIMERS; i++)
{
TimerRemove(&timer_array[i]);
}
@@ -111,19 +111,19 @@ void TimerHandler(void)
{
uint8_t i;
- for(i = 0; i < MAX_TIMERS; i++)
+ for (i = 0; i < MAX_TIMERS; i++)
{
- if(timer_array[i].busy == true)
+ if (timer_array[i].busy == true)
{
- if(System100msTick() == true)
+ if (System100msTick() == true)
{
timer_array[i].time--;
- if(timer_array[i].time == 0)
+ if (timer_array[i].time == 0)
{
timer_array[i].Timeout_Callback();
- if(timer_array[i].repeat_flag == true)
+ if (timer_array[i].repeat_flag == true)
{
timer_array[i].time = timer_array[i].orig_time;
}