diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2017-12-26 22:18:37 +0100 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2017-12-26 22:18:37 +0100 |
| commit | 4eaa6c091f97ca3455b2ae48a5f68867c0f7768e (patch) | |
| tree | 79ae89ae5b7399c774ae6fcb792c109a725e1af8 | |
| parent | f06d582d63b1f91e48ecb17a11987217144c5c79 (diff) | |
* Slight optimization: all comparations against true are now compared against != false.
+ Added a provisional background during gameplay (still WIP).
* Map editor now allows creating a map.
56 files changed, 860 insertions, 619 deletions
diff --git a/Bin/AIRPORT.bin b/Bin/AIRPORT.bin Binary files differindex d432dcd..e434b5e 100644 --- a/Bin/AIRPORT.bin +++ b/Bin/AIRPORT.bin diff --git a/Documentation/VRAM distribution Gameplay.bmp b/Documentation/VRAM distribution Gameplay.bmp Binary files differindex e7be06c..d59504a 100644 --- a/Documentation/VRAM distribution Gameplay.bmp +++ b/Documentation/VRAM distribution Gameplay.bmp diff --git a/Levels/LEVEL1.PLT b/Levels/LEVEL1.PLT index 7ef4900..c59806c 100644 --- a/Levels/LEVEL1.PLT +++ b/Levels/LEVEL1.PLT @@ -6,30 +6,27 @@ #For example: 14:55 #Aircraft arrival (or departure) must be set relative to initial time, in HH:MM format. -#ARRIVAL;PHX1802;100;00:10;0;360 -#ARRIVAL;PHX2015;100;00:10;0;360 -#ARRIVAL;PHX2016;100;00:40;0;360 -#ARRIVAL;PHX2017;100;00:50;0;360 -#ARRIVAL;PHX2018;100;01:40;0;360 -#ARRIVAL;PHX2019;100;01:20;0;360 -#ARRIVAL;PHX2020;100;02:00;0;360 -#ARRIVAL;PHX2021;100;00:05;0;360 -#ARRIVAL;PHX2022;100;00:15;0;360 -#ARRIVAL;PHX2023;100;00:45;0;360 -#ARRIVAL;PHX2024;100;01:45;0;360 -#ARRIVAL;PHX2025;100;01:20;0;360 -#ARRIVAL;PHX2026;100;01:10;0;360 -#DEPARTURE;PHX1000;100;00:05;19;180 -#DEPARTURE;PHX1001;100;00:15;19;180 -#DEPARTURE;PHX1002;100;00:30;19;180 -#DEPARTURE;PHX1003;100;00:45;19;180 -#DEPARTURE;PHX1004;100;01:10;19;180 -#DEPARTURE;PHX1280;100;01:30;19;180 -#DEPARTURE;PHX1332;100;00:50;21;180 -#DEPARTURE;PHX1333;100;01:00;19;180 -#DEPARTURE;PHX1334;100;01:15;21;180 -#DEPARTURE;PHX1336;100;01:20;21;180 -#ARRIVAL;PHX2026;120;00:05;0;360 -#ARRIVAL;PHX2026;80;00:10;0;360 -DEPARTURE;PHX2026;80;00:05;19;180 -DEPARTURE;PHX2026;80;00:05;21;180 +ARRIVAL;PHX1802;100;00:10;0;360 +ARRIVAL;PHX2015;100;00:10;0;360 +ARRIVAL;PHX2016;100;00:40;0;360 +ARRIVAL;PHX2017;100;00:50;0;360 +ARRIVAL;PHX2018;100;01:40;0;360 +ARRIVAL;PHX2019;100;01:20;0;360 +ARRIVAL;PHX2020;100;02:00;0;360 +ARRIVAL;PHX2021;100;00:05;0;360 +ARRIVAL;PHX2022;100;00:15;0;360 +ARRIVAL;PHX2023;100;00:45;0;360 +ARRIVAL;PHX2024;100;01:45;0;360 +ARRIVAL;PHX2025;100;01:20;0;360 +ARRIVAL;PHX2026;100;01:10;0;360 +DEPARTURE;PHX1000;100;00:05;19;180 +DEPARTURE;PHX1001;100;00:15;19;180 +DEPARTURE;PHX1002;100;00:30;19;180 +DEPARTURE;PHX1003;100;00:45;19;180 +DEPARTURE;PHX1004;100;01:10;19;180 +DEPARTURE;PHX1280;100;01:30;19;180 +DEPARTURE;PHX1332;100;00:50;21;180 +DEPARTURE;PHX1333;100;01:00;19;180 +DEPARTURE;PHX1334;100;01:15;21;180 +ARRIVAL;PHX2026;120;00:05;0;360 +ARRIVAL;PHX2026;80;00:10;0;360 diff --git a/Source/Aircraft.c b/Source/Aircraft.c index 057f7e8..0150405 100644 --- a/Source/Aircraft.c +++ b/Source/Aircraft.c @@ -264,12 +264,12 @@ void AircraftHandler(void) // other aircraft.
// WARNING: only STATE_TAXIING can be used to automatically stop an aircraft
// when calling GameStopFlight() or GameResumeFlightFromAutoStop().
- collision_warning = AircraftCheckPath(ptrAircraft, ptrOtherAircraft);
+ collision_warning |= AircraftCheckPath(ptrAircraft, ptrOtherAircraft);
}
if (j > i)
{
- if (AircraftCheckCollision(ptrAircraft, ptrOtherAircraft) == true)
+ if (AircraftCheckCollision(ptrAircraft, ptrOtherAircraft) != false)
{
GameAircraftCollision(ptrAircraft->FlightDataIdx);
break;
@@ -282,7 +282,7 @@ void AircraftHandler(void) }
- if (collision_warning == true)
+ if (collision_warning != false)
{
GameStopFlight(ptrAircraft->FlightDataIdx);
}
@@ -436,7 +436,7 @@ void AircraftRender(TYPE_PLAYER* ptrPlayer, uint8_t aircraftIdx) if ( (ptrPlayer->FlightDataSelectedAircraft == aircraftIdx)
&&
- (ptrPlayer->ShowAircraftData == true) )
+ (ptrPlayer->ShowAircraftData != false) )
{
static uint8_t aircraft_sine;
static bool aircraft_sine_decrease;
@@ -593,7 +593,7 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft) }
}
- if (ptrAircraft->TargetReached == true)
+ if (ptrAircraft->TargetReached != false)
{
ptrAircraft->IsoPos.x = targetPos.x;
ptrAircraft->IsoPos.y = targetPos.y;
diff --git a/Source/Aircraft.h b/Source/Aircraft.h index 0fb141c..4569044 100644 --- a/Source/Aircraft.h +++ b/Source/Aircraft.h @@ -1,5 +1,5 @@ -#ifndef __AIRCRAFT_HEADER__
-#define __AIRCRAFT_HEADER__
+#ifndef AIRCRAFT_HEADER__
+#define AIRCRAFT_HEADER__
/* *************************************
* Includes
@@ -29,4 +29,4 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData, uint8_t FlightDataIndex,
uint16_t* targets );
-#endif //__AIRCRAFT_HEADER__
+#endif //AIRCRAFT_HEADER__
diff --git a/Source/Camera.c b/Source/Camera.c index 1323d60..657fcab 100644 --- a/Source/Camera.c +++ b/Source/Camera.c @@ -58,9 +58,9 @@ void CameraApplyCoordinatesToRectangle(TYPE_PLAYER* ptrPlayer, GsRectangle * rec void CameraUpdateSpeed(TYPE_PLAYER* ptrPlayer) { - if (ptrPlayer->PadDirectionKeyPressed_Callback() == true) + if (ptrPlayer->PadDirectionKeyPressed_Callback() != false) { - if (ptrPlayer->PadKeyPressed_Callback(PAD_LEFT) == true) + if (ptrPlayer->PadKeyPressed_Callback(PAD_LEFT) != false) { if (ptrPlayer->Camera.X_Speed < 0) { @@ -72,7 +72,7 @@ void CameraUpdateSpeed(TYPE_PLAYER* ptrPlayer) } } - if (ptrPlayer->PadKeyPressed_Callback(PAD_UP) == true) + if (ptrPlayer->PadKeyPressed_Callback(PAD_UP) != false) { if (ptrPlayer->Camera.Y_Speed < 0) { @@ -84,7 +84,7 @@ void CameraUpdateSpeed(TYPE_PLAYER* ptrPlayer) } } - if (ptrPlayer->PadKeyPressed_Callback(PAD_DOWN) == true) + if (ptrPlayer->PadKeyPressed_Callback(PAD_DOWN) != false) { if (ptrPlayer->Camera.Y_Speed > 0) { @@ -96,7 +96,7 @@ void CameraUpdateSpeed(TYPE_PLAYER* ptrPlayer) } } - if (ptrPlayer->PadKeyPressed_Callback(PAD_RIGHT) == true) + if (ptrPlayer->PadKeyPressed_Callback(PAD_RIGHT) != false) { if (ptrPlayer->Camera.X_Speed > 0) { @@ -140,7 +140,7 @@ void CameraUpdateSpeed(TYPE_PLAYER* ptrPlayer) void CameraHandler(TYPE_PLAYER* ptrPlayer) { - if (CameraSpecialConditions(ptrPlayer) == true) + if (CameraSpecialConditions(ptrPlayer) != false) { ptrPlayer->Camera.X_Speed = 0; ptrPlayer->Camera.Y_Speed = 0; @@ -166,9 +166,9 @@ void CameraHandler(TYPE_PLAYER* ptrPlayer) bool CameraSpecialConditions(TYPE_PLAYER* ptrPlayer) { - if ( (ptrPlayer->ShowAircraftData == true) + if ( (ptrPlayer->ShowAircraftData != false) || - (ptrPlayer->SelectRunway == true) ) + (ptrPlayer->SelectRunway != false) ) { // Camera cannot be handled when these states are activated @@ -183,7 +183,7 @@ TYPE_ISOMETRIC_POS CameraGetIsoPos(TYPE_PLAYER* ptrPlayer) TYPE_ISOMETRIC_POS IsoPos; TYPE_CARTESIAN_POS CartPos; - if (GameTwoPlayersActive() == true) + if (GameTwoPlayersActive() != false) { 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() != false) { 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/Camera.h b/Source/Camera.h index 1294e2a..aed0bce 100644 --- a/Source/Camera.h +++ b/Source/Camera.h @@ -1,5 +1,5 @@ -#ifndef __CAM_HEADER__ -#define __CAM_HEADER__ +#ifndef CAM_HEADER__ +#define CAM_HEADER__ /* ************************************* * Includes @@ -23,4 +23,4 @@ void CameraApplyCoordinatesToRectangle(TYPE_PLAYER* ptrPlayer, GsRectangle * rec TYPE_ISOMETRIC_POS CameraGetIsoPos(TYPE_PLAYER* ptrPlayer); void CameraMoveToIsoPos(TYPE_PLAYER* ptrPlayer, TYPE_ISOMETRIC_POS IsoPos); -#endif //__CAM_HEADER__ +#endif //CAM_HEADER__ diff --git a/Source/EndAnimation.c b/Source/EndAnimation.c index c60bf30..582dc17 100644 --- a/Source/EndAnimation.c +++ b/Source/EndAnimation.c @@ -184,7 +184,7 @@ void EndAnimationSquares(void) sqPos[randInd] = true; sqCounter--; - while (sqPos[maxIndex] == true) + while (sqPos[maxIndex] != false) { // Lower maximum value for rand() so that it's // easier to spot new empty index on next iteration. @@ -209,7 +209,7 @@ void EndAnimationSquares(void) { for (j = 0; j < END_ANIMATION_SQUARES_TOTAL ; j++) { - if (sqPos[j] == true) + if (sqPos[j] != false) { EndAnimationRect.x = ((j) << END_ANIMATION_SQUARES_SIZE_BITSHIFT) - (short)( (j / END_ANIMATION_SQUARES_PER_ROW) * diff --git a/Source/EndAnimation.h b/Source/EndAnimation.h index 3ac015b..6e83be8 100644 --- a/Source/EndAnimation.h +++ b/Source/EndAnimation.h @@ -1,5 +1,5 @@ -#ifndef __END_SCREEN_HEADER__ -#define __END_SCREEN_HEADER__ +#ifndef END_SCREEN_HEADER__ +#define END_SCREEN_HEADER__ /* ************************************** * Includes * @@ -19,4 +19,4 @@ void EndAnimation(void); * Global Variables * * **************************************/ -#endif // __END_SCREEN_HEADER__ +#endif // END_SCREEN_HEADER__ diff --git a/Source/Exe/AIRPORT.elf b/Source/Exe/AIRPORT.elf Binary files differindex 507f737..6efa846 100644 --- a/Source/Exe/AIRPORT.elf +++ b/Source/Exe/AIRPORT.elf diff --git a/Source/Exe/AIRPORT.iso b/Source/Exe/AIRPORT.iso Binary files differindex 51ad22b..c726800 100644 --- a/Source/Exe/AIRPORT.iso +++ b/Source/Exe/AIRPORT.iso diff --git a/Source/Font.h b/Source/Font.h index e066d63..ca6be3c 100644 --- a/Source/Font.h +++ b/Source/Font.h @@ -1,5 +1,5 @@ -#ifndef __FONT_HEADER__
-#define __FONT_HEADER__
+#ifndef FONT_HEADER__
+#define FONT_HEADER__
/* *************************************
* Includes
@@ -35,4 +35,4 @@ void FontSetSpacing(TYPE_FONT* ptrFont, short spacing); TYPE_FONT RadioFont;
TYPE_FONT SmallFont;
-#endif //__FONT_HEADER__
+#endif //FONT_HEADER__
diff --git a/Source/Game.c b/Source/Game.c index 8b23031..7d041a4 100644 --- a/Source/Game.c +++ b/Source/Game.c @@ -188,6 +188,7 @@ static void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer); static void GameBuildingsInit(void); static void GameGetAircraftTilemap(uint8_t i); static bool GameWaypointCheckExisting(TYPE_PLAYER* ptrPlayer, uint16_t temp_tile); +static void GameDrawBackground(TYPE_PLAYER* ptrPlayer); /* ************************************* * Global Variables @@ -206,6 +207,7 @@ static GsSprite GameTileset2Spr; static GsSprite GamePlaneSpr; static GsSprite GameMouseSpr; static GsSprite GameBuildingSpr; +static GsSprite CityBg1Spr; static uint16_t GameRwy[GAME_MAX_RUNWAYS]; @@ -242,6 +244,7 @@ static const char* GameFileList[] = { "cdrom:\\DATA\\SPRITES\\TILESET1.TIM;1" , "cdrom:\\DATA\\SOUNDS\\RCPM1A1.VAG;1" , "cdrom:\\DATA\\SOUNDS\\RCTM1F1.VAG;1" , "cdrom:\\DATA\\SOUNDS\\TAKEOFF1.VAG;1" , + "cdrom:\\DATA\\SPRITES\\CITYBG1.TIM;1" , "cdrom:\\DATA\\SOUNDS\\BEEP.VAG;1" }; static void* GameFileDest[] = { (GsSprite*)&GameTilesetSpr , @@ -253,6 +256,7 @@ static void* GameFileDest[] = { (GsSprite*)&GameTilesetSpr , (SsVag*)&ApproachSnds[SOUND_W1_INDEX] , (SsVag*)&TowerFinalSnds[SOUND_M1_INDEX] , (SsVag*)&TakeoffSnd , + (GsSprite*)&CityBg1Spr , (SsVag*)&BeepSnd }; static const char* GamePlt[] = { "cdrom:\\DATA\\LEVELS\\LEVEL1.PLT;1" }; @@ -296,7 +300,7 @@ void Game(bool two_players) while (1) { - if (GameExit() == true) + if (GameExit() != false) { break; } @@ -307,7 +311,7 @@ void Game(bool two_players) GameGraphics(); - if (GameStartupFlag == true) + if (GameStartupFlag != false) { GameStartupFlag = false; } @@ -335,24 +339,24 @@ void Game(bool two_players) bool GameExit(void) { //Serial_printf("GameFinishedFlag...\n"); - if (GameFinishedFlag == true) + if (GameFinishedFlag != false) { // Exit game on level finished. - if (GameGuiFinishedDialog(&PlayerData[PLAYER_ONE]) == true) + if (GameGuiFinishedDialog(&PlayerData[PLAYER_ONE]) != false) { return true; } } //Serial_printf("GamePause...\n"); - if (GamePause() == true) + if (GamePause() != false) { // Exit game if player desires to exit. return true; } //Serial_printf("GameAircraftCollisionFlag...\n"); - if (GameAircraftCollisionFlag == true) + if (GameAircraftCollisionFlag != false) { GameGuiAircraftCollision(&PlayerData[PLAYER_ONE]); return true; @@ -380,7 +384,7 @@ bool GamePause(void) uint8_t i; bool pause_flag = false; - if (GameStartupFlag == true) + if (GameStartupFlag != false) { return false; } @@ -389,10 +393,10 @@ bool GamePause(void) { ptrPlayer = &PlayerData[i]; // Run player-specific functions for each player - if (ptrPlayer->Active == true) + if (ptrPlayer->Active != false) { //Serial_printf("Released callback = 0x%08X\n", ptrPlayer->PadKeySinglePress_Callback); - if (ptrPlayer->PadKeySinglePress_Callback(PAD_START) == true) + if (ptrPlayer->PadKeySinglePress_Callback(PAD_START) != false) { Serial_printf("Player %d set pause_flag to true!\n",i); pause_flag = true; @@ -401,7 +405,7 @@ bool GamePause(void) } } - if (pause_flag == true) + if (pause_flag != false) { // Blocking function: // * Returns true if player pointed to by ptrPlayer wants to exit game @@ -434,7 +438,7 @@ void GameInit(void) GameStartupFlag = true; - if (firstLoad == true) + if (firstLoad != false) { firstLoad = false; @@ -472,7 +476,7 @@ void GameInit(void) PlayerData[PLAYER_TWO].Active = TwoPlayersActive? true : false; - if (PlayerData[PLAYER_TWO].Active == true) + if (PlayerData[PLAYER_TWO].Active != false) { PlayerData[PLAYER_TWO].PadKeyPressed_Callback = &PadTwoKeyPressed; PlayerData[PLAYER_TWO].PadKeyReleased_Callback = &PadTwoKeyReleased; @@ -512,7 +516,7 @@ void GameInit(void) GameAircraftCollisionFlag = false; GameAircraftCollisionIdx = 0; - if (GameTwoPlayersActive() == true) + if (GameTwoPlayersActive() != false) { GameMouseSpr.x = MOUSE_X_2PLAYER; GameMouseSpr.y = MOUSE_Y_2PLAYER; @@ -546,7 +550,7 @@ void GameInit(void) LoadMenuEnd(); - //GfxSetGlobalLuminance(0); + GfxSetGlobalLuminance(0); track = SystemRand(GAMEPLAY_FIRST_TRACK, GAMEPLAY_LAST_TRACK); @@ -744,7 +748,7 @@ void GameEmergencyMode(void) .g = ERROR_RECT_G, .b = ERROR_RECT_B }; - if (SystemGetEmergencyMode() == true) + if (SystemGetEmergencyMode() != false) { // One of the pads has been disconnected during gameplay // Show an error screen until it is disconnected again. @@ -770,7 +774,7 @@ void GameEmergencyMode(void) { TYPE_PLAYER* ptrPlayer = &PlayerData[i]; - if (ptrPlayer->Active == true) + if (ptrPlayer->Active != false) { if (PadXConnected[i]() == false) { @@ -786,7 +790,7 @@ void GameEmergencyMode(void) SystemSetEmergencyMode(enabled); - }while (SystemGetEmergencyMode() == true); + }while (SystemGetEmergencyMode() != false); } /* *************************************************************************************** @@ -878,7 +882,7 @@ void GameCalculations(void) for (i = 0 ; i < MAX_PLAYERS ; i++) { // Run player-specific functions for each player - if (PlayerData[i].Active == true) + if (PlayerData[i].Active != false) { GamePlayerHandler(&PlayerData[i], &FlightData); } @@ -916,7 +920,7 @@ void GamePlayerHandler(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData) // to a incorrect instance. GameActiveAircraftList(ptrPlayer, ptrFlightData); - if (GameAircraftCollisionFlag == true) + if (GameAircraftCollisionFlag != false) { TYPE_ISOMETRIC_POS IsoPos = AircraftGetIsoPos(GameAircraftCollisionIdx); CameraMoveToIsoPos(ptrPlayer, IsoPos); @@ -948,7 +952,7 @@ void GamePlayerHandler(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData) void GameClock(void) { - if (System1SecondTick() == true) + if (System1SecondTick() != false) { GameMinutes++; @@ -984,7 +988,7 @@ void GameClock(void) void GameClockFlights(uint8_t i) { - if (System1SecondTick() == true) + if (System1SecondTick() != false) { if ( (FlightData.Minutes[i] == 0) && @@ -1033,9 +1037,9 @@ void GameGraphics(void) SystemAcknowledgeFrame(); - while ( (SystemRefreshNeeded() == false) || (GfxIsGPUBusy() == true) ); + while ( (SystemRefreshNeeded() == false) || (GfxIsGPUBusy() != false) ); - if (TwoPlayersActive == true) + if (TwoPlayersActive != false) { split_screen = true; } @@ -1046,7 +1050,7 @@ void GameGraphics(void) GfxIncreaseGlobalLuminance(1); } - GsSortCls(0,0,GfxGetGlobalLuminance() >> 1); + //~ GsSortCls(0,0,GfxGetGlobalLuminance() >> 1); while (GsIsDrawing()); @@ -1054,9 +1058,9 @@ void GameGraphics(void) { TYPE_PLAYER* ptrPlayer = &PlayerData[i]; - if (ptrPlayer->Active == true) + if (ptrPlayer->Active != false) { - if (split_screen == true) + if (split_screen != false) { GfxSetSplitScreen(i); } @@ -1065,7 +1069,11 @@ void GameGraphics(void) // only if 2-player mode is active. Else, render // the whole screen as usual. - // Ground tiles must be rendered first. + // Render background first. + + GameDrawBackground(ptrPlayer); + + // Then ground tiles must be rendered. GameRenderLevel(ptrPlayer); @@ -1080,17 +1088,17 @@ void GameGraphics(void) GameGuiDrawUnboardingSequence(ptrPlayer); - if (split_screen == true) + if (split_screen != false) { GfxDrawScene_NoSwap(); - while (GfxIsGPUBusy() == true); + while (GfxIsGPUBusy() != false); } } } // Avoid changing drawing environment twice on 1-player mode // as it doesn't make any sense. - if (split_screen == true) + if (split_screen != false) { GfxDisableSplitScreen(); } @@ -1103,7 +1111,7 @@ void GameGraphics(void) GameGuiShowScore(); - if (split_screen == true) + if (split_screen != false) { GfxDrawScene_NoSwap(); } @@ -1113,10 +1121,111 @@ void GameGraphics(void) /* ******************************************************************* * - * @name: void GameGraphics(void) + * @name: void GameDrawBackground(void) + * + * @author: Xavier Del Campo + * + * @brief: + * Draws the background used for main gameplay. + * + * @remarks: + * Must be called before rendering anything else on screen! + * + * *******************************************************************/ + +void GameDrawBackground(TYPE_PLAYER* ptrPlayer) +{ + enum + { + BG_POLY4_R0 = 0, + BG_POLY4_G0 = BG_POLY4_R0, + BG_POLY4_B0 = BG_POLY4_R0, + + BG_POLY4_R1 = BG_POLY4_R0, + BG_POLY4_G1 = BG_POLY4_R1, + BG_POLY4_B1 = BG_POLY4_R1, + + BG_POLY4_R2 = 40, + BG_POLY4_G2 = BG_POLY4_R2, + BG_POLY4_B2 = BG_POLY4_R2, + + BG_POLY4_R3 = BG_POLY4_R2, + BG_POLY4_G3 = BG_POLY4_R3, + BG_POLY4_B3 = BG_POLY4_R3, + }; + + enum + { + CITY_BG_X = 0, + CITY_BG_Y = Y_SCREEN_RESOLUTION >> 1, + + CITY_BG_R = 40, + CITY_BG_G = 40, + CITY_BG_B = 40, + }; + + GsGPoly4 BgPoly4 = {.x[0] = 0, + .x[1] = X_SCREEN_RESOLUTION, + .x[2] = 0, + .x[3] = X_SCREEN_RESOLUTION, + + .y[0] = 0, + .y[1] = 0, + .y[2] = Y_SCREEN_RESOLUTION, + .y[3] = Y_SCREEN_RESOLUTION, + + .r[0] = BG_POLY4_R0, + .g[0] = BG_POLY4_G0, + .b[0] = BG_POLY4_B0, + + .r[1] = BG_POLY4_R1, + .g[1] = BG_POLY4_G1, + .b[1] = BG_POLY4_B1, + + .r[2] = BG_POLY4_R2, + .g[2] = BG_POLY4_G2, + .b[2] = BG_POLY4_B2, + + .r[3] = BG_POLY4_R3, + .g[3] = BG_POLY4_G3, + .b[3] = BG_POLY4_B3 }; + + short x; + bool reverse = false; + + GsSortGPoly4(&BgPoly4); + + for (x = CITY_BG_X; x < X_SCREEN_RESOLUTION; x += CityBg1Spr.w) + { + CityBg1Spr.x = x; + CityBg1Spr.y = CITY_BG_Y; + + CityBg1Spr.r = CITY_BG_R; + CityBg1Spr.g = CITY_BG_G; + CityBg1Spr.b = CITY_BG_B; + + CityBg1Spr.attribute = reverse? CityBg1Spr.attribute | H_FLIP : CityBg1Spr.attribute & ~(H_FLIP); + reverse = reverse? true: false; // Revert "reverse" flag. + + CameraApplyCoordinatesToSprite(ptrPlayer, &CityBg1Spr); + + // Restore original Y value. + CityBg1Spr.y = CITY_BG_Y; + + GfxSortSprite(&CityBg1Spr); + } +} + +/* ******************************************************************* + * + * @name: void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer) * * @author: Xavier Del Campo * + * @param: + * TYPE_PLAYER* ptrPlayer: + * Pointer to player data structure. + * * @brief: * Determines rendering order depending on building/aircraft * isometric position data. @@ -1419,7 +1528,7 @@ void GameAircraftState(uint8_t i) bParkingBusy = true; } - if (SystemContains_u16(FlightData.Parking[i], targets, AIRCRAFT_MAX_TARGETS) == true) + if (SystemContains_u16(FlightData.Parking[i], targets, AIRCRAFT_MAX_TARGETS) != false) { bParkingBusy = true; } @@ -1486,7 +1595,7 @@ void GameAircraftState(uint8_t i) * * @remarks: * Tiles are usually rendered with normal RGB values unless parking/runway is busy - * or ptrPlayer->InvalidPath == true. + * or ptrPlayer->InvalidPath != false. * * ******************************************************************************************/ @@ -1507,7 +1616,7 @@ 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 != false) { /*Serial_printf("Runway array:\n"); @@ -1611,14 +1720,14 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer) ptrTileset->g = NORMAL_LUMINANCE; ptrTileset->b = NORMAL_LUMINANCE; - if ( (ptrPlayer->SelectRunway == true) + if ( (ptrPlayer->SelectRunway != false) && (i != 0) && - (SystemContains_u16(i, ptrPlayer->RwyArray, GAME_MAX_RWY_LENGTH) == true) ) + (SystemContains_u16(i, ptrPlayer->RwyArray, GAME_MAX_RWY_LENGTH) != false) ) { - if (used_rwy == true) + if (used_rwy != false) { ptrTileset->r = rwy_sine; ptrTileset->b = NORMAL_LUMINANCE >> 2; @@ -1631,19 +1740,19 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer) ptrTileset->b = rwy_sine; } } - else if ( ( (ptrPlayer->SelectTaxiwayParking == true) + else if ( ( (ptrPlayer->SelectTaxiwayParking != false) || - (ptrPlayer->SelectTaxiwayRunway == true) ) + (ptrPlayer->SelectTaxiwayRunway != false) ) && (i != 0) ) { - if (( (SystemContains_u16(i, ptrPlayer->Waypoints, PLAYER_MAX_WAYPOINTS) == true) + if (( (SystemContains_u16(i, ptrPlayer->Waypoints, PLAYER_MAX_WAYPOINTS) != false) || (i == ptrPlayer->SelectedTile) ) && (ptrPlayer->SelectedTile != GAME_INVALID_TILE_SELECTION) ) { - if (ptrPlayer->InvalidPath == true) + if (ptrPlayer->InvalidPath != false) { ptrTileset->r = rwy_sine; ptrTileset->b = NORMAL_LUMINANCE >> 2; @@ -1656,7 +1765,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer) ptrTileset->b = rwy_sine; } } - else if ( (ptrPlayer->SelectTaxiwayRunway == true) + else if ( (ptrPlayer->SelectTaxiwayRunway != false) && ( (CurrentTile == TILE_RWY_HOLDING_POINT) || @@ -1666,7 +1775,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer) ptrTileset->g = rwy_sine; ptrTileset->b = NORMAL_LUMINANCE >> 2; } - else if ( (ptrPlayer->SelectTaxiwayParking == true) + else if ( (ptrPlayer->SelectTaxiwayParking != false) && ( (CurrentTile == TILE_PARKING) || @@ -1684,7 +1793,7 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer) if (ptrTileset != NULL) { - if (flip_id == true) + if (flip_id != false) { ptrTileset->attribute |= H_FLIP; } @@ -1696,7 +1805,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 != false) { flip_id = false; CurrentTile = aux_id; @@ -1800,15 +1909,15 @@ void GameActiveAircraft(uint8_t i) void GameStateShowAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData) { - if (ptrPlayer->ShowAircraftData == true) + if (ptrPlayer->ShowAircraftData != false) { - if (ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) == true) + if (ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) != false) { ptrPlayer->ShowAircraftData = false; } } - if (ptrPlayer->PadKeySinglePress_Callback(PAD_CIRCLE) == true) + if (ptrPlayer->PadKeySinglePress_Callback(PAD_CIRCLE) != false) { if (GameGuiShowAircraftDataSpecialConditions(ptrPlayer) == false) { @@ -1845,7 +1954,7 @@ void GameStateLockTarget(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData { uint8_t AircraftIdx = ptrPlayer->FlightDataSelectedAircraft; - if (ptrPlayer->LockTarget == true) + if (ptrPlayer->LockTarget != false) { if (ptrPlayer->LockedAircraft != FLIGHT_DATA_INVALID_IDX) { @@ -1853,11 +1962,11 @@ void GameStateLockTarget(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData } } - if (ptrPlayer->PadKeySinglePress_Callback(PAD_SQUARE) == true) + if (ptrPlayer->PadKeySinglePress_Callback(PAD_SQUARE) != false) { if (ptrPlayer->LockTarget == false) { - if (ptrPlayer->ShowAircraftData == true) + if (ptrPlayer->ShowAircraftData != false) { if ( (ptrFlightData->State[AircraftIdx] != STATE_IDLE) && @@ -1874,9 +1983,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() != false) { - if ( (ptrPlayer->LockTarget == true) + if ( (ptrPlayer->LockTarget != false) && (ptrPlayer->ShowAircraftData == false) ) { @@ -1917,7 +2026,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 != false) { // Under this mode, always reset locking target. ptrPlayer->LockTarget = false; @@ -1930,7 +2039,7 @@ void GameStateSelectTaxiwayRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrF ptrPlayer->InvalidPath = true; } - if (ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) == true) + if (ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) != false) { // State exit. ptrPlayer->SelectTaxiwayRunway = false; @@ -1939,7 +2048,7 @@ 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) != false) { if (ptrPlayer->InvalidPath == false) { @@ -2025,7 +2134,7 @@ void GameStateSelectTaxiwayParking(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptr uint8_t i; uint16_t target_tile; - if (ptrPlayer->SelectTaxiwayParking == true) + if (ptrPlayer->SelectTaxiwayParking != false) { // Under this mode, always reset locking target. ptrPlayer->LockTarget = false; @@ -2038,7 +2147,7 @@ void GameStateSelectTaxiwayParking(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptr ptrPlayer->InvalidPath = true; } - if (ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) == true) + if (ptrPlayer->PadKeySinglePress_Callback(PAD_TRIANGLE) != false) { // State exit. ptrPlayer->SelectTaxiwayParking = false; @@ -2047,7 +2156,7 @@ 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) != false) { if (ptrPlayer->InvalidPath == false) { @@ -2135,7 +2244,7 @@ void GameStateSelectRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightDa GameGetYFromTile_short(GameRwy[ptrPlayer->SelectedRunway]), 0 }; - if (ptrPlayer->SelectRunway == true) + if (ptrPlayer->SelectRunway != false) { // Under this mode, always reset locking target. ptrPlayer->LockTarget = false; @@ -2145,11 +2254,11 @@ 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) != false) { ptrPlayer->SelectRunway = false; } - else if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true) + else if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) != false) { ptrPlayer->SelectRunway = false; @@ -2177,7 +2286,7 @@ void GameStateSelectRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightDa } } } - else if (ptrPlayer->PadKeySinglePress_Callback(PAD_LEFT) == true) + else if (ptrPlayer->PadKeySinglePress_Callback(PAD_LEFT) != false) { if (ptrFlightData->State[ptrPlayer->FlightDataSelectedAircraft] == STATE_APPROACH) { @@ -2187,7 +2296,7 @@ void GameStateSelectRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightDa } } } - else if (ptrPlayer->PadKeySinglePress_Callback(PAD_RIGHT) == true) + else if (ptrPlayer->PadKeySinglePress_Callback(PAD_RIGHT) != false) { if (ptrFlightData->State[ptrPlayer->FlightDataSelectedAircraft] == STATE_APPROACH) { @@ -2275,9 +2384,9 @@ 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 != false) { - if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true) + if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) != false) { if (ptrPlayer->ActiveAircraft != 0) { @@ -2346,7 +2455,7 @@ void GameSelectAircraftFromList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli } } } - else if (ptrPlayer->PadKeySinglePress_Callback(PAD_L1) == true) + else if (ptrPlayer->PadKeySinglePress_Callback(PAD_L1) != false) { FL_STATE* ptrAircraftState = &FlightData.State[ptrPlayer->FlightDataSelectedAircraft]; @@ -3053,7 +3162,7 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData) temp_tile--; } - if (GameWaypointCheckExisting(ptrPlayer, temp_tile) == true) + if (GameWaypointCheckExisting(ptrPlayer, temp_tile) != false) { return false; // Tile is already included in the list of temporary tiles? } @@ -3071,7 +3180,7 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData) temp_tile -= GameLevelColumns; } - if (GameWaypointCheckExisting(ptrPlayer, temp_tile) == true) + if (GameWaypointCheckExisting(ptrPlayer, temp_tile) != false) { return false; // Tile is already included in the list of temporary tiles? } @@ -3091,7 +3200,7 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData) temp_tile -= GameLevelColumns; } - if (GameWaypointCheckExisting(ptrPlayer, temp_tile) == true) + if (GameWaypointCheckExisting(ptrPlayer, temp_tile) != false) { return false; // Tile is already included in the list of temporary tiles? } @@ -3109,7 +3218,7 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData) temp_tile--; } - if (GameWaypointCheckExisting(ptrPlayer, temp_tile) == true) + if (GameWaypointCheckExisting(ptrPlayer, temp_tile) != false) { return false; // Tile is already included in the list of temporary tiles? } @@ -3243,9 +3352,9 @@ bool GameTwoPlayersActive(void) void GameDrawMouse(TYPE_PLAYER* ptrPlayer) { - if ( (ptrPlayer->SelectTaxiwayParking == true) + if ( (ptrPlayer->SelectTaxiwayParking != false) || - (ptrPlayer->SelectTaxiwayRunway == true) ) + (ptrPlayer->SelectTaxiwayRunway != false) ) { GfxSortSprite(&GameMouseSpr); } @@ -3313,9 +3422,9 @@ uint32_t GameGetScore(void) void GameStateUnboarding(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData) { - if (ptrPlayer->Unboarding == true) + if (ptrPlayer->Unboarding != false) { - if (ptrPlayer->PadKeySinglePress_Callback(PAD_CIRCLE) == true) + if (ptrPlayer->PadKeySinglePress_Callback(PAD_CIRCLE) != false) { ptrPlayer->Unboarding = false; ptrPlayer->UnboardingSequenceIdx = 0; // Player will need to repeat sequence @@ -3689,7 +3798,7 @@ void GameRemoveFlight(uint8_t idx, bool successful) 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) != false) { GameUsedRwy[k] = 0; } @@ -3700,7 +3809,7 @@ void GameRemoveFlight(uint8_t idx, bool successful) if (SystemContains_u16( AircraftGetTileFromFlightDataIndex(idx), rwyArray, - sizeof(rwyArray) / sizeof(rwyArray[0]) ) == true) + sizeof(rwyArray) / sizeof(rwyArray[0]) ) != false) { GameUsedRwy[k] = 0; } @@ -3726,7 +3835,7 @@ void GameRemoveFlight(uint8_t idx, bool successful) ptrPlayer->LockedAircraft = FLIGHT_DATA_INVALID_IDX; } - if (successful == true) + if (successful != false) { GameScore += SCORE_REWARD_FINISH_FLIGHT; } @@ -3810,7 +3919,7 @@ void GameActiveAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightD currentFlightDataIdx = ptrPlayer->ActiveAircraftList[ptrPlayer->SelectedAircraft]; - if (GameAircraftCreatedFlag == true) + if (GameAircraftCreatedFlag != false) { GameAircraftCreatedFlag = false; @@ -3862,12 +3971,13 @@ void GameRemainingAircraft(uint8_t i) { // Reset iterator when starting from first element. + if (i == 0) { FlightData.nRemainingAircraft = FlightData.nAircraft; } - if (FlightData.Finished[i] == true) + if (FlightData.Finished[i] != false) { FlightData.nRemainingAircraft--; } diff --git a/Source/Game.h b/Source/Game.h index d6bbaf7..d02f6bc 100644 --- a/Source/Game.h +++ b/Source/Game.h @@ -1,5 +1,5 @@ -#ifndef __GAME_HEADER__ -#define __GAME_HEADER__ +#ifndef GAME_HEADER__ +#define GAME_HEADER__ /* ************************************* * Includes @@ -48,4 +48,4 @@ void GameCalculateRemainingAircraft(void); void GameAircraftCollision(uint8_t AircraftIdx); void GameStopFlight(uint8_t AicraftIdx); void GameResumeFlightFromAutoStop(uint8_t AircraftIdx); -#endif //__GAME_HEADER__ +#endif //GAME_HEADER__ diff --git a/Source/GameGui.c b/Source/GameGui.c index c846029..437ccbc 100644 --- a/Source/GameGui.c +++ b/Source/GameGui.c @@ -218,6 +218,16 @@ static void* GameFileDest[] = {(GsSprite*)&BubbleSpr , static uint32_t slowScore; // It will update slowly to actual score value
+/* ***************************************************************************************
+ *
+ * @name: void GameGuiInit(void)
+ *
+ * @author: Xavier Del Campo
+ *
+ * @brief:
+ * Reportedly, GameGui module initialization.
+ *
+ * ***************************************************************************************/
void GameGuiInit(void)
{
enum
@@ -250,7 +260,7 @@ void GameGuiInit(void) static bool firstLoad = true;
- if (firstLoad == true)
+ if (firstLoad != false)
{
firstLoad = false;
@@ -298,6 +308,20 @@ void GameGuiInit(void) FontSetSpacing(&RadioFont, RADIO_FONT_SPACING);
}
+/* ***************************************************************************************
+ *
+ * @name: void GameGuiInit(void)
+ *
+ * @author: Xavier Del Campo
+ *
+ * @brief:
+ * Checks for pause event (player presses START button). If true, it traps the game
+ * on a while loop, waiting for user action.
+ *
+ * @remarks:
+ * Blocking function!
+ *
+ * ***************************************************************************************/
bool GameGuiPauseDialog(TYPE_PLAYER* ptrPlayer)
{
GfxSaveDisplayData(&SecondDisplay);
@@ -306,11 +330,11 @@ bool GameGuiPauseDialog(TYPE_PLAYER* ptrPlayer) //DrawFBRect(0, 0, X_SCREEN_RESOLUTION, VRAM_H, 0, 0, 0);
- while (GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() != false);
do
{
- if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) != false)
{
return true;
}
@@ -326,6 +350,18 @@ bool GameGuiPauseDialog(TYPE_PLAYER* ptrPlayer) return false;
}
+/* **********************************************************************************************
+ *
+ * @name: void GameGuiActiveAircraftPage(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
+ *
+ * @author: Xavier Del Campo
+ *
+ * @brief:
+ * Updates ptrPlayer->SelectedAircraft and ptrPlayer->FlightDataPage when new aircraft are
+ * added/removed. On the other hand, it also updates ptrPlayer->SelectedAircraft depending on
+ * user interaction.
+ *
+ * **********************************************************************************************/
void GameGuiActiveAircraftPage(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
{
if (ptrPlayer->ActiveAircraft != 0)
@@ -344,14 +380,14 @@ void GameGuiActiveAircraftPage(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlig }
}
- 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 != false)
{
- if (ptrPlayer->PadKeySinglePress_Callback(PAD_DOWN) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_DOWN) != false)
{
if ( ( (ptrPlayer->SelectedAircraft + 1) < ptrPlayer->ActiveAircraft)
&&
@@ -361,7 +397,7 @@ void GameGuiActiveAircraftPage(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlig }
}
- if (ptrPlayer->PadKeySinglePress_Callback(PAD_UP) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_UP) != false)
{
if (ptrPlayer->SelectedAircraft > ( (ptrPlayer->FlightDataPage) * GAME_GUI_AIRCRAFT_DATA_MAX_PAGE) )
{
@@ -369,7 +405,7 @@ void GameGuiActiveAircraftPage(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlig }
}
- if (ptrPlayer->PadKeySinglePress_Callback(PAD_RIGHT) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_RIGHT) != false)
{
if (ptrPlayer->ActiveAircraft > (GAME_GUI_AIRCRAFT_DATA_MAX_PAGE * (ptrPlayer->FlightDataPage + 1) ) )
{
@@ -379,7 +415,7 @@ void GameGuiActiveAircraftPage(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlig }
}
- if (ptrPlayer->PadKeySinglePress_Callback(PAD_LEFT) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_LEFT) != false)
{
if (ptrPlayer->FlightDataPage != 0)
{
@@ -391,6 +427,16 @@ void GameGuiActiveAircraftPage(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlig }
}
+/* **********************************************************************************************
+ *
+ * @name: void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
+ *
+ * @author: Xavier Del Campo
+ *
+ * @brief:
+ * Draws aircraft list for current player when ptrPlayer->ShowAircraftData state is active.
+ *
+ * **********************************************************************************************/
void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
{
short y_offset;
@@ -413,7 +459,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 != false)
{
// Prepare RGB data and (X,Y) coordinates for aircraft
// data list request rectangle.
@@ -434,7 +480,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData AircraftDataGPoly4.attribute |= ENABLE_TRANS | TRANS_MODE(0);
- if (GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() != false)
{
AircraftDataGPoly4.x[0] = AIRCRAFT_DATA_GSGPOLY4_X0_2PLAYER;
AircraftDataGPoly4.x[1] = AIRCRAFT_DATA_GSGPOLY4_X1_2PLAYER;
@@ -461,7 +507,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData GsSortGPoly4(&AircraftDataGPoly4);
- if (GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() != false)
{
FontPrintText( &SmallFont,
GAME_GUI_REMAINING_AIRCRAFT_X_2PLAYER,
@@ -497,7 +543,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData SelectedAircraftGPoly4.attribute |= ENABLE_TRANS | TRANS_MODE(0);
- if (GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() != false)
{
SelectedAircraftGPoly4.x[0] = AIRCRAFT_DATA_FLIGHT_GSGPOLY4_X0_2PLAYER;
SelectedAircraftGPoly4.x[1] = AIRCRAFT_DATA_FLIGHT_GSGPOLY4_X1_2PLAYER;
@@ -521,7 +567,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() != false)
{
SelectedAircraftGPoly4.y[0] = AIRCRAFT_DATA_FLIGHT_GSGPOLY4_Y0_2PLAYER;
SelectedAircraftGPoly4.y[1] = AIRCRAFT_DATA_FLIGHT_GSGPOLY4_Y1_2PLAYER;
@@ -551,7 +597,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData PageUpDownSpr.u = orig_pageupdn_u + AIRCRAFT_DATA_FLIGHT_PAGE_UP_U;
- if (GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() != false)
{
PageUpDownSpr.x = AIRCRAFT_DATA_FLIGHT_PAGE_UP_X_2PLAYER;
PageUpDownSpr.y = AIRCRAFT_DATA_FLIGHT_PAGE_UP_Y_2PLAYER;
@@ -573,7 +619,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData PageUpDownSpr.u = orig_pageupdn_u + AIRCRAFT_DATA_FLIGHT_PAGE_DOWN_U;
- if (GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() != false)
{
PageUpDownSpr.x = AIRCRAFT_DATA_FLIGHT_PAGE_DOWN_X_2PLAYER;
PageUpDownSpr.y = AIRCRAFT_DATA_FLIGHT_PAGE_DOWN_Y_2PLAYER;
@@ -593,7 +639,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 != false)
{
FontPrintText(&SmallFont, AIRCRAFT_LOCK_TARGET_TEXT_X, AIRCRAFT_LOCK_TARGET_TEXT_Y, "Unlock target");
}
@@ -615,7 +661,7 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData }
else
{
- if (GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() != false)
{
FontPrintText( &SmallFont,
AIRCRAFT_DATA_GSGPOLY4_X0_2PLAYER +
@@ -638,6 +684,16 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData }
+/* **********************************************************************************************
+ *
+ * @name: void GameGuiBubbleShow(void)
+ *
+ * @author: Xavier Del Campo
+ *
+ * @brief:
+ * Handler for GameGuiBubbleTimer.
+ *
+ * **********************************************************************************************/
void GameGuiBubbleShow(void)
{
static TYPE_TIMER* GameGuiBubbleTimer = NULL;
@@ -660,7 +716,7 @@ void GameGuiBubble(TYPE_FLIGHT_DATA* ptrFlightData) {
static bool GameGuiBubbleShowFlagOld;
- if (GameGuiBubbleShowFlag == true)
+ if (GameGuiBubbleShowFlag != false)
{
static TYPE_TIMER* GameGuiBubbleVibrationTimer = NULL;
@@ -680,7 +736,7 @@ void GameGuiBubble(TYPE_FLIGHT_DATA* ptrFlightData) BubbleSpr.x = BUBBLE_SPRITE_X;
BubbleSpr.y = BUBBLE_SPRITE_Y;
- if (GameGuiBubbleVibrationFlag == true)
+ if (GameGuiBubbleVibrationFlag != false)
{
BubbleSpr.x += SystemRand(BUBBLE_SPRITE_RAND_MIN,BUBBLE_SPRITE_RAND_MAX);
BubbleSpr.y += SystemRand(BUBBLE_SPRITE_RAND_MIN,BUBBLE_SPRITE_RAND_MAX);
@@ -706,7 +762,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() != false)
{
memset(strClock, 0, 6);
snprintf(strClock,6,"%02d:%02d",hour, min);
@@ -719,7 +775,7 @@ void GameGuiClock(uint8_t hour, uint8_t min) void GameGuiShowPassengersLeft(TYPE_PLAYER* ptrPlayer)
{
- if (GameGuiClearPassengersLeft_Flag == true)
+ if (GameGuiClearPassengersLeft_Flag != false)
{
// Reset flag
GameGuiClearPassengersLeft_Flag = false;
@@ -728,7 +784,7 @@ void GameGuiShowPassengersLeft(TYPE_PLAYER* ptrPlayer) if (ptrPlayer->PassengersLeftSelectedAircraft != 0)
{
- if (GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() != false)
{
FontPrintText(&SmallFont, 48, Y_SCREEN_RESOLUTION - 64, "%d left", ptrPlayer->PassengersLeftSelectedAircraft);
}
@@ -755,7 +811,7 @@ void GameGuiShowAircraftData(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlight short AircraftDataRemainingTime_Y;
short orig_DepArr_u = DepArrSpr.u;
- if (GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() != false)
{
AircraftDataDirection_X = AIRCRAFT_DATA_DIRECTION_X_2PLAYER;
AircraftDataDirection_Y = AIRCRAFT_DATA_DIRECTION_Y_2PLAYER;
@@ -896,11 +952,11 @@ bool GameGuiShowAircraftDataSpecialConditions(TYPE_PLAYER* ptrPlayer) {
// Aircraft list data cannot be shown under these conditions.
- if ( (ptrPlayer->SelectRunway == true)
+ if ( (ptrPlayer->SelectRunway != false)
||
- (ptrPlayer->SelectTaxiwayParking == true)
+ (ptrPlayer->SelectTaxiwayParking != false)
||
- (ptrPlayer->SelectTaxiwayRunway == true) )
+ (ptrPlayer->SelectTaxiwayRunway != false) )
{
return true;
}
@@ -949,7 +1005,7 @@ void GameGuiDrawUnboardingSequence(TYPE_PLAYER* ptrPlayer) {
uint8_t i;
- if (ptrPlayer->Unboarding == true)
+ if (ptrPlayer->Unboarding != false)
{
for (i = ptrPlayer->UnboardingSequenceIdx; i < GAME_MAX_SEQUENCE_KEYS; i++)
{
@@ -959,7 +1015,7 @@ void GameGuiDrawUnboardingSequence(TYPE_PLAYER* ptrPlayer) }
// TODO: Draw above the plane
- if (GameTwoPlayersActive() == true)
+ if (GameTwoPlayersActive() != false)
{
GfxDrawButton(48 + (16*i), Y_SCREEN_RESOLUTION - 32, ptrPlayer->UnboardingSequence[i]);
}
@@ -984,7 +1040,7 @@ bool GameGuiFinishedDialog(TYPE_PLAYER* ptrPlayer) do
{
- if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == true)
+ if (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) != false)
{
return true;
}
@@ -1030,6 +1086,16 @@ void GameGuiAircraftCollision(TYPE_PLAYER* ptrPlayer) }while (ptrPlayer->PadKeySinglePress_Callback(PAD_CROSS) == false);
}
+/* **********************************************************************************************
+ *
+ * @name: void GameGuiBubbleStop(void)
+ *
+ * @author: Xavier Del Campo
+ *
+ * @brief:
+ * Callback executed when bubble must not be shown because of bubble timer timeout.
+ *
+ * **********************************************************************************************/
void GameGuiBubbleStop(void)
{
Serial_printf("GameGuiBubbleStop\n");
diff --git a/Source/GameGui.h b/Source/GameGui.h index 9b28d03..84542b8 100644 --- a/Source/GameGui.h +++ b/Source/GameGui.h @@ -1,5 +1,5 @@ -#ifndef __GAME_GUI_HEADER__
-#define __GAME_GUI_HEADER__
+#ifndef GAME_GUI_HEADER__
+#define GAME_GUI_HEADER__
/* *************************************
* Includes
@@ -39,4 +39,4 @@ bool GameGuiFinishedDialog(TYPE_PLAYER* ptrPlayer); void GameGuiAircraftCollision(TYPE_PLAYER* ptrPlayer);
void GameGuiBubbleShow(void);
-#endif //__GAME_GUI_HEADER__
+#endif //GAME_GUI_HEADER__
diff --git a/Source/GameStructures.h b/Source/GameStructures.h index 9c43163..5b847e7 100644 --- a/Source/GameStructures.h +++ b/Source/GameStructures.h @@ -1,5 +1,5 @@ -#ifndef __GAME_STRUCTURES__HEADER__
-#define __GAME_STRUCTURES__HEADER__
+#ifndef GAME_STRUCTURES__HEADER__
+#define GAME_STRUCTURES__HEADER__
/* *************************************
* Defines
@@ -254,4 +254,4 @@ typedef struct t_PltConfig uint8_t maxLostFlights;
}TYPE_PLT_CONFIG;
-#endif // __GAME_STRUCTURES__HEADER__
+#endif // GAME_STRUCTURES__HEADER__
diff --git a/Source/Gfx.c b/Source/Gfx.c index 798151c..7a89027 100644 --- a/Source/Gfx.c +++ b/Source/Gfx.c @@ -7,6 +7,7 @@ #include "Camera.h" #include "Pad.h" #include "Game.h" +#include "Menu.h" /* ************************************* * Defines @@ -103,6 +104,17 @@ static uint8_t global_lum; static bool five_hundred_ms_show; static bool one_second_show; +/* ********************************************************************** + * + * @name: void GfxSwapBuffers(void) + * + * @author: Xavier Del Campo + * + * @brief: + * Does double buffering by swapping drawing and display environments. + * + * + * **********************************************************************/ void GfxSwapBuffers(void) { // Consistency check @@ -152,7 +164,16 @@ void GfxSwapBuffers(void) } } - +/* ********************************************************************** + * + * @name: void GfxInitDrawEnv(void) + * + * @author: Xavier Del Campo + * + * @brief: + * Initialization of drawing environment. + * + * **********************************************************************/ void GfxInitDrawEnv(void) { DrawEnv.x = 0; @@ -164,6 +185,16 @@ void GfxInitDrawEnv(void) GsSetDrawEnv(&DrawEnv); } +/* ********************************************************************** + * + * @name: void GfxInitDispEnv(void) + * + * @author: Xavier Del Campo + * + * @brief: + * Initialization of display environment. + * + * **********************************************************************/ void GfxInitDispEnv(void) { DispEnv.x = 0; @@ -172,23 +203,46 @@ void GfxInitDispEnv(void) GsSetDispEnv(&DispEnv); } +/* ********************************************************************** + * + * @name: void GfxSetPrimitiveList(void) + * + * @author: Xavier Del Campo + * + * @brief: + * Sets pointer to a buffer to be used as primitive list (only + * used internally by PSXSDK). + * + * **********************************************************************/ void GfxSetPrimitiveList(void) { GsSetList(prim_list); } +/* ********************************************************************** + * + * @name: void GfxDrawScene_Fast(void) + * + * @author: Xavier Del Campo + * + * @brief: + * Draws current primitive list into screen without waiting for + * GPU to finish. Also, routinary checks and functionalities are + * executed. + * + * **********************************************************************/ void GfxDrawScene_Fast(void) { SystemDevMenu(); FontSetFlags(&SmallFont, FONT_NOFLAGS); - if (System1SecondTick() == true) + if (System1SecondTick() != false) { one_second_show = one_second_show? false:true; } - if (System500msTick() == true) + if (System500msTick() != false) { five_hundred_ms_show = five_hundred_ms_show? false:true; } @@ -213,9 +267,14 @@ void GfxDrawScene(void) while ( (SystemRefreshNeeded() == false) || - (GfxIsGPUBusy() == true) ); + (GfxIsGPUBusy() != false) ); + + //~ FontPrintText(&SmallFont, FPS_INFO_X, FPS_INFO_Y, "%d/%d", SystemGetFPS(), REFRESH_FREQUENCY); - FontPrintText(&SmallFont, FPS_INFO_X, FPS_INFO_Y, "%d/%d", SystemGetFPS(), REFRESH_FREQUENCY); + if (MainMenuGetBCNGWLogo() != NULL) + { + GfxSortSprite(MainMenuGetBCNGWLogo()); + } GfxDrawScene_Fast(); @@ -225,7 +284,7 @@ void GfxDrawScene(void) void GfxDrawScene_Slow(void) { GfxDrawScene(); - while (GfxIsGPUBusy() == true); + while (GfxIsGPUBusy() != false); } void GfxSortSprite(GsSprite * spr) @@ -288,7 +347,7 @@ void GfxSortSprite(GsSprite * spr) } } - if (has_1hz_flash == true) + if (has_1hz_flash != false) { spr->attribute &= ~(GFX_1HZ_FLASH); } @@ -316,7 +375,7 @@ void GfxSortSprite(GsSprite * spr) GsSortSprite(spr); } - if (has_1hz_flash == true) + if (has_1hz_flash != false) { spr->attribute |= GFX_1HZ_FLASH; } @@ -369,7 +428,7 @@ bool GfxSpriteFromFile(char* fname, GsSprite * spr) return false; } - while (GfxIsGPUBusy() == true); + while (GfxIsGPUBusy() != false); gfx_busy = true; @@ -397,7 +456,7 @@ bool GfxCLUTFromFile(char* fname) return false; } - while (GfxIsGPUBusy() == true); + while (GfxIsGPUBusy() != false); gfx_busy = true; @@ -453,7 +512,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 != false) { first_entered = false; orig_u = PSXButtons.u; @@ -582,7 +641,7 @@ void GfxDrawButton(short x, short y, unsigned short btn) void GfxSaveDisplayData(GsSprite *spr) { - while (GfxIsGPUBusy() == true); + while (GfxIsGPUBusy() != false); MoveImage( DispEnv.x, DispEnv.y, @@ -603,7 +662,7 @@ void GfxSaveDisplayData(GsSprite *spr) spr->g = NORMAL_LUMINANCE; spr->b = NORMAL_LUMINANCE; - while (GfxIsGPUBusy() == true); + while (GfxIsGPUBusy() != false); } bool Gfx1HzFlash(void) diff --git a/Source/Gfx.h b/Source/Gfx.h index ebc2424..0bbce7b 100644 --- a/Source/Gfx.h +++ b/Source/Gfx.h @@ -1,5 +1,5 @@ -#ifndef __GFX_HEADER__ -#define __GFX_HEADER__ +#ifndef GFX_HEADER__ +#define GFX_HEADER__ /* ************************************* * Includes @@ -118,4 +118,4 @@ void GfxDevMenuEnable(void); extern GsSprite PSXButtons; -#endif //__GFX_HEADER__ +#endif //GFX_HEADER__ diff --git a/Source/Global_Inc.h b/Source/Global_Inc.h index c2b09d6..9585cc1 100644 --- a/Source/Global_Inc.h +++ b/Source/Global_Inc.h @@ -1,5 +1,5 @@ -#ifndef __GLOBAL_INC__H__ -#define __GLOBAL_INC__H__ +#ifndef GLOBAL_INC__H__ +#define GLOBAL_INC__H__ /* ************************************* * Includes @@ -18,8 +18,7 @@ * Defines * *************************************/ -#ifdef SERIAL_INTERFACE -#else // SERIAL_INTERFACE +#ifndef SERIAL_INTERFACE #define Serial_printf dprintf @@ -29,20 +28,24 @@ #define DEBUG_PRINT_VAR(var) Serial_printf(#var " = %d\n", var); #ifndef bool - typedef enum - { - false = 0, - true = 1 - }bool; +typedef enum t_bool +{ + false = 0, + true = 1 +}bool; #endif #if (PSXSDK_VERSION != 0x0599) #error "Wrong PSXSDK version! Please use version 0.5.99." #endif -/* Test for GCC > 5.2.0 */ +/* Test for GCC == 5.2.0 */ #if ( (__GNUC__ != 5) || (__GNUC_MINOR__ != 2) || (__GNUC_PATCHLEVEL__ != 0) ) +#define STR_HELPER(x) #x +#define STR(x) STR_HELPER(x) +#pragma message ( "******** You are using GCC version number: " STR(__GNUC__) \ + "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__) " ********") #error "Wrong GCC version! Please use version 5.2.0." #endif -#endif // __GLOBAL_INC__H__ +#endif // GLOBAL_INC__H__ diff --git a/Source/LoadMenu.c b/Source/LoadMenu.c index 52bd093..246edc3 100644 --- a/Source/LoadMenu.c +++ b/Source/LoadMenu.c @@ -262,30 +262,30 @@ void ISR_LoadMenuVBlank(void) SystemIncreaseGlobalTimer(); - if (SystemIsBusy() == true) + if (SystemIsBusy() != false) { dprintf("SystemIsBusy...\n"); return; } - if ((GfxIsGPUBusy() == true)) + if ((GfxIsGPUBusy() != false)) { - dprintf("(GfxIsGPUBusy() == true)\n"); + dprintf("(GfxIsGPUBusy() != false)\n"); return; } - if (SerialIsBusy() == true) + if (SerialIsBusy() != false) { dprintf("Serialisbusy\n"); return; } - /*if ( (SystemIsBusy() == true) || (GfxIsGPUBusy() == true) || (SerialIsBusy() == true) ) + /*if ( (SystemIsBusy() != false) || (GfxIsGPUBusy() != false) || (SerialIsBusy() != false) ) { return; }*/ - if (startup_flag == true) + if (startup_flag != false) { // "Loading..." text if (LoadMenuTitleSpr.r < LOADING_TITLE_LUMINANCE_TARGET) @@ -343,7 +343,7 @@ void ISR_LoadMenuVBlank(void) } } - else if (end_flag == true) + else if (end_flag != false) { LoadMenuTitleSpr.r -= LOADING_TITLE_LUMINANCE_STEP; LoadMenuTitleSpr.g -= LOADING_TITLE_LUMINANCE_STEP; diff --git a/Source/LoadMenu.h b/Source/LoadMenu.h index 2d1d5f7..314fb0e 100644 --- a/Source/LoadMenu.h +++ b/Source/LoadMenu.h @@ -1,5 +1,5 @@ -#ifndef __LOAD_MENU_HEADER__ -#define __LOAD_MENU_HEADER__ +#ifndef LOAD_MENU_HEADER__ +#define LOAD_MENU_HEADER__ /* ************************************* * Includes @@ -21,4 +21,4 @@ void LoadMenu( const char* fileList[], void LoadMenuEnd(void); -#endif //__LOAD_MENU_HEADER__ +#endif //LOAD_MENU_HEADER__ diff --git a/Source/MainMenuBtnAni.h b/Source/MainMenuBtnAni.h index bd27b75..8204f02 100644 --- a/Source/MainMenuBtnAni.h +++ b/Source/MainMenuBtnAni.h @@ -1,5 +1,5 @@ -#ifndef __MAINMENUBTN_HEADER__ -#define __MAINMENUBTN_HEADER__ +#ifndef MAINMENUBTN_HEADER__ +#define MAINMENUBTN_HEADER__ /* ************************************* @@ -23,4 +23,4 @@ extern short MainMenuBtnAni[]; extern size_t MainMenuBtnAni_sz; -#endif // __MAINMENUBTN_HEADER__ +#endif // MAINMENUBTN_HEADER__ diff --git a/Source/Makefile b/Source/Makefile index c876f60..f60f46a 100644 --- a/Source/Makefile +++ b/Source/Makefile @@ -102,6 +102,8 @@ SPRITE_OBJECTS = $(addprefix $(OBJ_SPRITES_PATH)/, PSXDISK.TIM \ PAGEUPDN.TIM \ BLDNGS1.TIM \ ARROW.TIM \ + BCNGW.TIM \ + CITYBG1.TIM \ MENUSTAR.TIM ) SPRITE_OBJECTS += $(addprefix $(OBJ_FONTS_PATH)/, INTROFNT.TIM \ diff --git a/Source/MapEditor/MapEditor.pro b/Source/MapEditor/MapEditor.pro index 8f56728..cce1ab2 100644 --- a/Source/MapEditor/MapEditor.pro +++ b/Source/MapEditor/MapEditor.pro @@ -13,9 +13,11 @@ TEMPLATE = app SOURCES += main.cpp\
- mainwindow.cpp
+ mainwindow.cpp \
+ mygraphicsscene.cpp
-HEADERS += mainwindow.h
+HEADERS += mainwindow.h \
+ mygraphicsscene.h
FORMS += mainwindow.ui
diff --git a/Source/MapEditor/MapEditor.pro.user b/Source/MapEditor/MapEditor.pro.user index c9d463f..0b066e2 100644 --- a/Source/MapEditor/MapEditor.pro.user +++ b/Source/MapEditor/MapEditor.pro.user @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.0.3, 2017-06-11T04:34:23. -->
+<!-- Written by QtCreator 4.0.3, 2017-11-08T21:06:54. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@@ -66,7 +66,7 @@ <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
- <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/cygwin/home/Xavier/Airport/Source/MapEditor</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/cygwin/home/Xavier/Airport/Source/build-MapEditor-Desktop_Qt_5_7_0_MinGW_32bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@@ -292,7 +292,7 @@ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">MapEditor.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
- <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/cygwin/home/Xavier/Airport/Source/MapEditor</value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/cygwin/home/Xavier/Airport/Source/build-MapEditor-Desktop_Qt_5_7_0_MinGW_32bit-Debug</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
diff --git a/Source/MapEditor/mainwindow.cpp b/Source/MapEditor/mainwindow.cpp index 2632429..ef0dfc6 100644 --- a/Source/MapEditor/mainwindow.cpp +++ b/Source/MapEditor/mainwindow.cpp @@ -1,14 +1,18 @@ #include "mainwindow.h"
#include <QPainter>
#include <QGraphicsScene>
+#include <QGraphicsPixmapItem>
+#include <QInputDialog>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
- ui(new Ui::MainWindow)
+ ui(new Ui::MainWindow),
+ gscene(new MyGraphicsScene)
{
ui->setupUi(this);
- connect(ui->LoadMap_Btn, SIGNAL(released()), this, SLOT(onLoadMap()));
+ connect(ui->LoadMap_Btn, SIGNAL(released()), this, SLOT(onLoadMap()));
+ connect(ui->CreateMap_Btn, SIGNAL(released()), this, SLOT(onCreateMap()));
appSettings();
}
@@ -16,6 +20,72 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow()
{
delete ui;
+ delete gscene;
+}
+
+void MainWindow::onCreateMap(void)
+{
+ bool ok;
+ QStringList items;
+
+ items << "8";
+ items << "16";
+ items << "24";
+
+ QString size = QInputDialog::getItem(this, tr("Create new map"),
+ tr("Select map size:"), items, 0, false, &ok);
+
+ if ( (ok == false) || (size.isEmpty() == true) )
+ {
+ return;
+ }
+
+ QByteArray data;
+
+ data.append("ATC");
+
+ if (size == "8")
+ {
+ data.append((char)0x08);
+ }
+ else if (size == "16")
+ {
+ data.append((char)0x10);
+ }
+ else if (size == "24")
+ {
+ data.append((char)0x18);
+ }
+
+ data.append("Default airport");
+
+ for (int i = (data.count() - 1); i < 0x3F; i++)
+ {
+ data.append(0xFF);
+ }
+
+ qDebug() << data.count();
+
+ int size_int = size.toInt(&ok, 10);
+
+ if (ok == false)
+ {
+ qDebug() << "Invalid map size.";
+ return;
+ }
+
+ for (int i = 0; i < size_int; i++)
+ {
+ for (int j = 0; j < size_int; j++)
+ {
+ data.append((char)0); // Building data
+ data.append((char)0); // Terrain data
+ }
+ }
+
+ qDebug() << "Created default map. Bytes: " + QString::number(data.count());
+
+ onProcessMapFile(data);
}
void MainWindow::onLoadMap(void)
@@ -32,8 +102,110 @@ void MainWindow::onLoadMap(void) return;
}
- QDataStream txt(&f);
+ QByteArray data = f.readAll();
+ onProcessMapFile(data);
+}
+
+void MainWindow::onProcessMapFile(QByteArray data)
+{
+ QDataStream ds(&data, QIODevice::ReadWrite);
+
+ char header[3];
+
+ ds.readRawData(header, 3);
+
+ if (strncmp(header, "ATC", 3) != 0)
+ {
+ qDebug() << "Incorrect header";
+ return;
+ }
+
+ char ch;
+
+ ds.readRawData(&ch, sizeof(char));
+
+ int level_size = ch;
+ qDebug() << level_size;
+ qDebug() << data.count();
+
+ QPixmap tile1("..\\..\\Sprites\\TILESET1.bmp");
+
+ int expected_filesize = (0x3F + (level_size * level_size));
+
+ if (data.count() < expected_filesize)
+ {
+ qDebug() << "Invalid count. Expected " + QString::number(expected_filesize, 10);
+ return;
+ }
+
+ ds.skipRawData(0x3B);
+
+ gscene->clear();
+ gscene->clearFocus();
+
+ for (int j = 0; j < level_size; j++)
+ {
+ for (int i = 0; i < level_size; i++)
+ {
+ int u;
+ int v;
+ char byte[2];
+ ds.readRawData(byte, 2);
+ quint8 CurrentTile = byte[1];
+
+ if (CurrentTile & 0x80)
+ {
+ u = (int)((CurrentTile & 0x7F) % 4) * 64;
+ v = (int)((CurrentTile & 0x7F) / 4) * 48;
+ }
+ else
+ {
+ u = (int)(CurrentTile % 4) * 64;
+ v = (int)(CurrentTile / 4) * 48;
+ }
+
+ QImage cropped = tile1.copy(u, v, 64, 48).toImage();
+
+ if (CurrentTile & 0x80)
+ {
+ cropped = cropped.mirrored(true, false);
+ }
+
+ qDebug() << CurrentTile;
+
+ cropped = cropped.convertToFormat(QImage::Format_ARGB32); // or maybe other format
+
+ for (int i = 0; i < cropped.width(); i++)
+ {
+ for (int j = 0; j < cropped.height(); j++)
+ {
+ QColor rgb = cropped.pixel(i, j);
+
+ if (rgb == QColor(Qt::magenta))
+ {
+ cropped.setPixel(i, j, qRgba(0,0,0,0));
+ }
+ }
+ }
+
+ QGraphicsPixmapItem* it = gscene->addPixmap(QPixmap::fromImage(cropped));
+ int x;
+ int y;
+
+ x = (i * 64) - (i * 32);
+ x -= (j * 32);
+
+ y = (j * 16);
+ y += i * 16;
+
+ it->setX(x);
+ it->setY(y);
+ }
+ }
+
+ ui->graphicsView->setScene(gscene);
+ ui->graphicsView->show();
}
bool MainWindow::checkFile(QFile& f)
@@ -54,21 +226,6 @@ bool MainWindow::checkFile(QFile& f) _last_dir = d.absolutePath();
- QPixmap pix;
-
- if(pix.load("C:\\cygwin\\home\\Xavier\\Airport\\Sprites\\Tileset1.bmp") == false)
- {
- qDebug() << "Error loading bitmap.";
- }
-
- QPainter p;
-
- p.begin(&pix);
-
- p.setWindow(ui->widget->geometry());
-
- p.drawPixmap(ui->widget->x(), ui->widget->y(), pix);
-
return true;
}
diff --git a/Source/MapEditor/mainwindow.h b/Source/MapEditor/mainwindow.h index b05c6f5..d9c04d8 100644 --- a/Source/MapEditor/mainwindow.h +++ b/Source/MapEditor/mainwindow.h @@ -6,6 +6,7 @@ #include <QSettings>
#include <QDebug>
+#include "mygraphicsscene.h"
#include "ui_mainwindow.h"
namespace Ui {
@@ -26,10 +27,12 @@ private: bool checkFile(QFile &f);
void appSettings(void);
QString _last_dir;
+ MyGraphicsScene *gscene;
protected slots:
void onLoadMap(void);
-
+ void onCreateMap(void);
+ void onProcessMapFile(QByteArray data);
};
#endif // MAINWINDOW_H
diff --git a/Source/MapEditor/mainwindow.ui b/Source/MapEditor/mainwindow.ui index a23ee45..f715053 100644 --- a/Source/MapEditor/mainwindow.ui +++ b/Source/MapEditor/mainwindow.ui @@ -24,41 +24,42 @@ <bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
+ <item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
- <widget class="QPushButton" name="LoadMap_Btn">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <widget class="QPushButton" name="CreateMap_Btn">
+ <property name="text">
+ <string>Create map</string>
</property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="LoadMap_Btn">
<property name="text">
<string>Load map</string>
</property>
</widget>
</item>
<item>
- <widget class="QPushButton" name="SaveMap_Btn">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
+ <widget class="QPushButton" name="pushButton_3">
<property name="text">
- <string>Save Map</string>
+ <string>PushButton</string>
</property>
</widget>
</item>
</layout>
</item>
- <item row="2" column="0">
+ <item row="0" column="0">
<widget class="QTreeWidget" name="treeWidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="maximumSize">
<size>
- <width>320</width>
+ <width>16777215</width>
<height>16777215</height>
</size>
</property>
@@ -69,8 +70,8 @@ </column>
</widget>
</item>
- <item row="2" column="1">
- <widget class="QWidget" name="widget" native="true"/>
+ <item row="0" column="1">
+ <widget class="QGraphicsView" name="graphicsView"/>
</item>
</layout>
</widget>
diff --git a/Source/MapEditor/mygraphicsscene.cpp b/Source/MapEditor/mygraphicsscene.cpp new file mode 100644 index 0000000..391931e --- /dev/null +++ b/Source/MapEditor/mygraphicsscene.cpp @@ -0,0 +1,20 @@ +#include "mygraphicsscene.h" +#include <QDebug> + +MyGraphicsScene::MyGraphicsScene() +{ + +} + +void MyGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent) +{ + QGraphicsItem *it = this->itemAt(mouseEvent->scenePos(), QTransform()); + if (it != NULL) + { + + } + else + { + // No items selected + } +} diff --git a/Source/MapEditor/mygraphicsscene.h b/Source/MapEditor/mygraphicsscene.h new file mode 100644 index 0000000..300cc9c --- /dev/null +++ b/Source/MapEditor/mygraphicsscene.h @@ -0,0 +1,17 @@ +#ifndef MYGRAPHICSSCENE_H +#define MYGRAPHICSSCENE_H + +#include <QGraphicsScene> +#include <QGraphicsSceneMouseEvent> + +class MyGraphicsScene : public QGraphicsScene +{ +public: + MyGraphicsScene(); + +private: + void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent); + +}; + +#endif // MYGRAPHICSSCENE_H diff --git a/Source/MapEditor/release/moc_mainwindow.cpp b/Source/MapEditor/release/moc_mainwindow.cpp deleted file mode 100644 index 59ffe7e..0000000 --- a/Source/MapEditor/release/moc_mainwindow.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/****************************************************************************
-** Meta object code from reading C++ file 'mainwindow.h'
-**
-** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../mainwindow.h"
-#include <QtCore/qbytearray.h>
-#include <QtCore/qmetatype.h>
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'mainwindow.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 67
-#error "This file was generated using the moc from 5.7.0. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-QT_BEGIN_MOC_NAMESPACE
-struct qt_meta_stringdata_MainWindow_t {
- QByteArrayData data[3];
- char stringdata0[22];
-};
-#define QT_MOC_LITERAL(idx, ofs, len) \
- Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
- qptrdiff(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs \
- - idx * sizeof(QByteArrayData)) \
- )
-static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = {
- {
-QT_MOC_LITERAL(0, 0, 10), // "MainWindow"
-QT_MOC_LITERAL(1, 11, 9), // "onLoadMap"
-QT_MOC_LITERAL(2, 21, 0) // ""
-
- },
- "MainWindow\0onLoadMap\0"
-};
-#undef QT_MOC_LITERAL
-
-static const uint qt_meta_data_MainWindow[] = {
-
- // content:
- 7, // revision
- 0, // classname
- 0, 0, // classinfo
- 1, 14, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
- 0, 0, // constructors
- 0, // flags
- 0, // signalCount
-
- // slots: name, argc, parameters, tag, flags
- 1, 0, 19, 2, 0x09 /* Protected */,
-
- // slots: parameters
- QMetaType::Void,
-
- 0 // eod
-};
-
-void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
-{
- if (_c == QMetaObject::InvokeMetaMethod) {
- MainWindow *_t = static_cast<MainWindow *>(_o);
- Q_UNUSED(_t)
- switch (_id) {
- case 0: _t->onLoadMap(); break;
- default: ;
- }
- }
- Q_UNUSED(_a);
-}
-
-const QMetaObject MainWindow::staticMetaObject = {
- { &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow.data,
- qt_meta_data_MainWindow, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
-};
-
-
-const QMetaObject *MainWindow::metaObject() const
-{
- return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
-}
-
-void *MainWindow::qt_metacast(const char *_clname)
-{
- if (!_clname) return Q_NULLPTR;
- if (!strcmp(_clname, qt_meta_stringdata_MainWindow.stringdata0))
- return static_cast<void*>(const_cast< MainWindow*>(this));
- return QMainWindow::qt_metacast(_clname);
-}
-
-int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QMainWindow::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- if (_id < 1)
- qt_static_metacall(this, _c, _id, _a);
- _id -= 1;
- } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
- if (_id < 1)
- *reinterpret_cast<int*>(_a[0]) = -1;
- _id -= 1;
- }
- return _id;
-}
-QT_END_MOC_NAMESPACE
diff --git a/Source/MapEditor/ui_mainwindow.h b/Source/MapEditor/ui_mainwindow.h deleted file mode 100644 index 47ec5ac..0000000 --- a/Source/MapEditor/ui_mainwindow.h +++ /dev/null @@ -1,128 +0,0 @@ -/********************************************************************************
-** Form generated from reading UI file 'mainwindow.ui'
-**
-** Created by: Qt User Interface Compiler version 5.7.0
-**
-** WARNING! All changes made in this file will be lost when recompiling UI file!
-********************************************************************************/
-
-#ifndef UI_MAINWINDOW_H
-#define UI_MAINWINDOW_H
-
-#include <QtCore/QVariant>
-#include <QtWidgets/QAction>
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QButtonGroup>
-#include <QtWidgets/QGridLayout>
-#include <QtWidgets/QHBoxLayout>
-#include <QtWidgets/QHeaderView>
-#include <QtWidgets/QMainWindow>
-#include <QtWidgets/QMenuBar>
-#include <QtWidgets/QPushButton>
-#include <QtWidgets/QStatusBar>
-#include <QtWidgets/QToolBar>
-#include <QtWidgets/QTreeWidget>
-#include <QtWidgets/QWidget>
-
-QT_BEGIN_NAMESPACE
-
-class Ui_MainWindow
-{
-public:
- QWidget *centralWidget;
- QGridLayout *gridLayout;
- QHBoxLayout *horizontalLayout;
- QPushButton *LoadMap_Btn;
- QPushButton *SaveMap_Btn;
- QTreeWidget *treeWidget;
- QWidget *widget;
- QMenuBar *menuBar;
- QToolBar *mainToolBar;
- QStatusBar *statusBar;
-
- void setupUi(QMainWindow *MainWindow)
- {
- if (MainWindow->objectName().isEmpty())
- MainWindow->setObjectName(QStringLiteral("MainWindow"));
- MainWindow->resize(501, 380);
- centralWidget = new QWidget(MainWindow);
- centralWidget->setObjectName(QStringLiteral("centralWidget"));
- QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- sizePolicy.setHorizontalStretch(0);
- sizePolicy.setVerticalStretch(0);
- sizePolicy.setHeightForWidth(centralWidget->sizePolicy().hasHeightForWidth());
- centralWidget->setSizePolicy(sizePolicy);
- centralWidget->setAutoFillBackground(true);
- gridLayout = new QGridLayout(centralWidget);
- gridLayout->setSpacing(6);
- gridLayout->setContentsMargins(11, 11, 11, 11);
- gridLayout->setObjectName(QStringLiteral("gridLayout"));
- horizontalLayout = new QHBoxLayout();
- horizontalLayout->setSpacing(6);
- horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
- LoadMap_Btn = new QPushButton(centralWidget);
- LoadMap_Btn->setObjectName(QStringLiteral("LoadMap_Btn"));
- QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Fixed);
- sizePolicy1.setHorizontalStretch(0);
- sizePolicy1.setVerticalStretch(0);
- sizePolicy1.setHeightForWidth(LoadMap_Btn->sizePolicy().hasHeightForWidth());
- LoadMap_Btn->setSizePolicy(sizePolicy1);
-
- horizontalLayout->addWidget(LoadMap_Btn);
-
- SaveMap_Btn = new QPushButton(centralWidget);
- SaveMap_Btn->setObjectName(QStringLiteral("SaveMap_Btn"));
- sizePolicy1.setHeightForWidth(SaveMap_Btn->sizePolicy().hasHeightForWidth());
- SaveMap_Btn->setSizePolicy(sizePolicy1);
-
- horizontalLayout->addWidget(SaveMap_Btn);
-
-
- gridLayout->addLayout(horizontalLayout, 0, 0, 1, 1);
-
- treeWidget = new QTreeWidget(centralWidget);
- treeWidget->setObjectName(QStringLiteral("treeWidget"));
- treeWidget->setMaximumSize(QSize(320, 16777215));
-
- gridLayout->addWidget(treeWidget, 2, 0, 1, 1);
-
- widget = new QWidget(centralWidget);
- widget->setObjectName(QStringLiteral("widget"));
-
- gridLayout->addWidget(widget, 2, 1, 1, 1);
-
- MainWindow->setCentralWidget(centralWidget);
- menuBar = new QMenuBar(MainWindow);
- menuBar->setObjectName(QStringLiteral("menuBar"));
- menuBar->setGeometry(QRect(0, 0, 501, 21));
- MainWindow->setMenuBar(menuBar);
- mainToolBar = new QToolBar(MainWindow);
- mainToolBar->setObjectName(QStringLiteral("mainToolBar"));
- MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar);
- statusBar = new QStatusBar(MainWindow);
- statusBar->setObjectName(QStringLiteral("statusBar"));
- MainWindow->setStatusBar(statusBar);
-
- retranslateUi(MainWindow);
-
- QMetaObject::connectSlotsByName(MainWindow);
- } // setupUi
-
- void retranslateUi(QMainWindow *MainWindow)
- {
- MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
- LoadMap_Btn->setText(QApplication::translate("MainWindow", "Load map", 0));
- SaveMap_Btn->setText(QApplication::translate("MainWindow", "Save Map", 0));
- QTreeWidgetItem *___qtreewidgetitem = treeWidget->headerItem();
- ___qtreewidgetitem->setText(0, QApplication::translate("MainWindow", "Items", 0));
- } // retranslateUi
-
-};
-
-namespace Ui {
- class MainWindow: public Ui_MainWindow {};
-} // namespace Ui
-
-QT_END_NAMESPACE
-
-#endif // UI_MAINWINDOW_H
diff --git a/Source/MemCard.c b/Source/MemCard.c index cd8add0..0f49952 100644 --- a/Source/MemCard.c +++ b/Source/MemCard.c @@ -181,7 +181,7 @@ void ISR_MemCardDataHandling(void) uint8_t i;
- if ( (GfxIsGPUBusy() == true) || (SystemIsBusy() == true) )
+ if ( (GfxIsGPUBusy() != false) || (SystemIsBusy() != false) )
{
return;
}
@@ -712,7 +712,7 @@ bool MemCardReadSector(TYPE_BLOCK_DATA * ptrBlockData, int sector) return false;
}
- while (GfxIsGPUBusy() == true);
+ while (GfxIsGPUBusy() != false);
result = McReadSector(ptrBlockData->Slot, sector, DataBuffer);
@@ -817,7 +817,7 @@ void MemCardIconIndexHandler(void) {
static uint8_t iconTimer = 0;
- if (System100msTick() == true)
+ if (System100msTick() != false)
{
if (++iconTimer >= MEMCARD_ICON_INDEX_TIME)
{
@@ -872,7 +872,7 @@ void MemCardDrawIcon(TYPE_BLOCK_DATA * ptrBlockData, short x, short y) }
- if (first_access == true)
+ if (first_access != false)
{
if (IconIndex == 0)
{
@@ -966,36 +966,36 @@ TYPE_BLOCK_DATA * MemCardShowMap(void) while (1)
{
- if (PadOneKeyReleased(PAD_TRIANGLE) == true)
+ if (PadOneKeyReleased(PAD_TRIANGLE) != false)
{
break;
}
- else if (PadOneKeyReleased(PAD_CROSS) == true)
+ else if (PadOneKeyReleased(PAD_CROSS) != false)
{
return &MemCardData[selectedBlock - BLOCK_1][selectedSlot];
}
- else if (PadOneKeyReleased(PAD_LEFT) == true)
+ else if (PadOneKeyReleased(PAD_LEFT) != false)
{
if (selectedSlot == SLOT_TWO)
{
selectedSlot = SLOT_ONE;
}
}
- else if (PadOneKeyReleased(PAD_RIGHT) == true)
+ else if (PadOneKeyReleased(PAD_RIGHT) != false)
{
if (selectedSlot == SLOT_ONE)
{
selectedSlot = SLOT_TWO;
}
}
- else if (PadOneKeyReleased(PAD_UP) == true)
+ else if (PadOneKeyReleased(PAD_UP) != false)
{
if (selectedBlock > BLOCK_1)
{
selectedBlock--;
}
}
- else if (PadOneKeyReleased(PAD_DOWN) == true)
+ else if (PadOneKeyReleased(PAD_DOWN) != false)
{
if (selectedBlock < BLOCK_15)
{
diff --git a/Source/MemCard.h b/Source/MemCard.h index 77c3f33..4289621 100644 --- a/Source/MemCard.h +++ b/Source/MemCard.h @@ -1,5 +1,5 @@ -#ifndef __MEMCARD_HEADER__
-#define __MEMCARD_HEADER__
+#ifndef MEMCARD_HEADER__
+#define MEMCARD_HEADER__
/* *************************************
* Includes
@@ -144,4 +144,4 @@ bool MemCardSaveData(TYPE_BLOCK_DATA * ptrBlockData); extern TYPE_BLOCK_DATA MemCardData[MEMCARD_BLOCKS_PER_CARD][MEMCARD_NUMBER_OF_SLOTS];
-#endif //__MEMCARD_HEADER__
+#endif //MEMCARD_HEADER__
diff --git a/Source/Menu.c b/Source/Menu.c index bd12ac2..68c8b86 100644 --- a/Source/Menu.c +++ b/Source/Menu.c @@ -124,18 +124,21 @@ static void MenuTestCheat(void); static GsSprite MenuSpr; static GsSprite MenuStarSpr; +static GsSprite BcnGWSpr; static SsVag BellSnd; static SsVag AcceptSnd; static TYPE_CHEAT TestCheat; static TYPE_CHEAT StackCheckCheat; static TYPE_CHEAT DevMenuCheat; static TYPE_CHEAT SerialCheat; +static volatile bool BcnGWSpr_set; static const char* MainMenuFiles[] = { "cdrom:\\DATA\\SPRITES\\MAINMENU.TIM;1" , "cdrom:\\DATA\\SOUNDS\\BELL.VAG;1" , "cdrom:\\DATA\\SOUNDS\\ACCEPT.VAG;1" , "cdrom:\\DATA\\SPRITES\\BUTTONS.TIM;1" , "cdrom:\\DATA\\SPRITES\\MENUSTAR.TIM;1" , + "cdrom:\\DATA\\SPRITES\\BCNGW.TIM;1" , #ifndef NO_INTRO "cdrom:\\DATA\\SPRITES\\PSXDISK.TIM;1" , "cdrom:\\DATA\\FONTS\\INTROFNT.TIM;1" , @@ -151,6 +154,7 @@ static void* MainMenuDest[] = { (GsSprite*)&MenuSpr , (SsVag*)&AcceptSnd , (GsSprite*)&PSXButtons , (GsSprite*)&MenuStarSpr , + (GsSprite*)&BcnGWSpr , #ifndef NO_INTRO (GsSprite*)&PsxDisk , (GsSprite*)&PSXSDKIntroFont , @@ -242,12 +246,18 @@ void MainMenuInit(void) MainMenuBtn[TWO_PLAYER_BUTTON_INDEX].f = &TwoPlayerMenu; MainMenuBtn[TWO_PLAYER_BUTTON_INDEX].i = TWO_PLAYER_BUTTON_INDEX; + // BcnGWSpr.x = X_SCREEN_RESOLUTION - (BcnGWSpr.w << 1); + // BcnGWSpr.y = Y_SCREEN_RESOLUTION - BcnGWSpr.h; + // BcnGWSpr_set = true; + menuLevel = PLAY_OPTIONS_LEVEL; MainMenuMinimumBtn = PLAY_BUTTON_INDEX; MenuStarSpr.x = MENU_STAR_X; MenuStarSpr.y = MENU_STAR_Y; + MenuStarSpr.mx = MenuStarSpr.w >> 1; + MenuStarSpr.my = MenuStarSpr.h >> 1; MenuStarSpr.rotate = 0; MenuCheatInit(); @@ -311,6 +321,18 @@ void MenuCheatInit(void) PadAddCheat(&SerialCheat); } +GsSprite* MainMenuGetBCNGWLogo(void) +{ + if (BcnGWSpr_set != false) + { + return &BcnGWSpr; + } + else + { + return NULL; + } +} + void MainMenu(void) { MainMenuInit(); @@ -336,7 +358,14 @@ void MainMenu(void) MenuStarSpr.rotate += ROTATE_ONE; - GfxSortSprite(&MenuStarSpr); + //DEBUG_PRINT_VAR(MenuStarSpr.x); + //DEBUG_PRINT_VAR(MenuStarSpr.y); + //DEBUG_PRINT_VAR(MenuStarSpr.w); + //DEBUG_PRINT_VAR(MenuStarSpr.h); + //DEBUG_PRINT_VAR(MenuStarSpr.tpage); + //DEBUG_PRINT_VAR(MenuStarSpr.u); + //DEBUG_PRINT_VAR(MenuStarSpr.v); + //GfxSortSprite(&MenuStarSpr); switch(menuLevel) { @@ -391,7 +420,7 @@ void MainMenuButtonHandler(void) static uint8_t previous_btn_selected = 0; uint8_t max_buttons; - if (PadOneAnyKeyPressed() == true) + if (PadOneAnyKeyPressed() != false) { if (SystemIsRandSeedSet() == false) { @@ -399,9 +428,9 @@ void MainMenuButtonHandler(void) } } - if ( (PadOneKeySinglePress(PAD_CROSS) == true) + if ( (PadOneKeySinglePress(PAD_CROSS) != false) || - (PadOneKeySinglePress(PAD_TRIANGLE) == true) ) + (PadOneKeySinglePress(PAD_TRIANGLE) != false) ) { SfxPlaySound(&AcceptSnd); } @@ -425,7 +454,7 @@ void MainMenuButtonHandler(void) max_buttons = MAIN_MENU_ONE_TWO_PLAYERS_LEVEL_BUTTONS; } - if (PadOneKeySinglePress(PAD_TRIANGLE) == true) + if (PadOneKeySinglePress(PAD_TRIANGLE) != false) { menuLevel = PLAY_OPTIONS_LEVEL; MainMenuMinimumBtn = PLAY_BUTTON_INDEX; @@ -508,7 +537,7 @@ void MainMenuDrawButton(TYPE_MMBtn * btn) btn->timer++; } - if (btn->selected == true) + if (btn->selected != false) { if (btn->was_selected == false) { diff --git a/Source/Menu.h b/Source/Menu.h index 83dabf0..2c34ff4 100644 --- a/Source/Menu.h +++ b/Source/Menu.h @@ -1,10 +1,12 @@ -#ifndef __MENU_HEADER__ -#define __MENU_HEADER__ +#ifndef MENU_HEADER__ +#define MENU_HEADER__ /* ************************************* * Includes * *************************************/ +#include "Gfx.h" + /* ************************************* * Defines * *************************************/ @@ -14,5 +16,6 @@ * *************************************/ void MainMenu(void); +GsSprite* MainMenuGetBCNGWLogo(void); -#endif //__MENU_HEADER__ +#endif //MENU_HEADER__ diff --git a/Source/PSXSDKIntro.c b/Source/PSXSDKIntro.c index 941cea4..ce33727 100644 --- a/Source/PSXSDKIntro.c +++ b/Source/PSXSDKIntro.c @@ -183,18 +183,18 @@ void PSXSDKIntro(void) while (1) { - while (GfxIsGPUBusy() == true); + while (GfxIsGPUBusy() != false); if ( ( (GfxGetGlobalLuminance() - BG_LUMINANCE_STEP) > 0) && - (PSXSDKIntroClose == true) ) + (PSXSDKIntroClose != false) ) { GfxIncreaseGlobalLuminance(-BG_LUMINANCE_STEP); } if ( (GfxGetGlobalLuminance() <= BG_LUMINANCE_STEP) && - (PSXSDKIntroClose == true) ) + (PSXSDKIntroClose != false) ) { break; } @@ -203,7 +203,7 @@ void PSXSDKIntro(void) for (i = 0; i < strlen(strPSXSDKIntro) ; i++) { - if ( (PSXSDKIntroRandTextEvent == true) + if ( (PSXSDKIntroRandTextEvent != false) && (PSXSDKIntroStringEvent == false) ) { @@ -223,13 +223,13 @@ void PSXSDKIntro(void) OpenSource_Logo.g = 0; OpenSource_Logo.b = 0; } - else if ( (PSXSDKIntroRandTextEvent == true) + else if ( (PSXSDKIntroRandTextEvent != false) && - (PSXSDKIntroStringEvent == true) ) + (PSXSDKIntroStringEvent != false) ) { PSXSDKIntroDrawChar(FONT_X + (i << FONT_SIZE_BITSHIFT),FONT_Y,strPSXSDKIntro[i]); - if (System100msTick() == true) + if (System100msTick() != false) { if (GPL_Logo.r < GPL_LOGO_LUMINANCE_TARGET) { @@ -259,15 +259,15 @@ void PSXSDKIntro(void) for (i = 0; i < strlen(strPSXSDKIntroAuthor) ; i++) { - if ( (PSXSDKIntroRandTextEvent == true) + if ( (PSXSDKIntroRandTextEvent != false) && (PSXSDKIntroStringEvent == false) ) { PSXSDKIntroDrawChar(FONT_X2 + (i << FONT_SIZE_BITSHIFT),FONT_Y2,SystemRand('A','Z')); } - else if ( (PSXSDKIntroRandTextEvent == true) + else if ( (PSXSDKIntroRandTextEvent != false) && - (PSXSDKIntroStringEvent == true) ) + (PSXSDKIntroStringEvent != false) ) { PSXSDKIntroDrawChar(FONT_X2 + (i << FONT_SIZE_BITSHIFT),FONT_Y2,strPSXSDKIntroAuthor[i]); } @@ -277,7 +277,7 @@ void PSXSDKIntro(void) PSXSDKIntroDrawDisk(); - if (PSXSDKIntroCloseShellEvent == true) + if (PSXSDKIntroCloseShellEvent != false) { if (PSXSDKIntroCloseShellEventReminder == false) { @@ -335,7 +335,7 @@ void PSXSDKIntroRunTimers(void) if ( (intro_timer >= DISK_SPIN_EV_TIM) && - (PSXSDKIntroCloseShellEvent == true) + (PSXSDKIntroCloseShellEvent != false) && (PSXSDKIntroSpinDiskEvent == false) ) { @@ -345,9 +345,9 @@ void PSXSDKIntroRunTimers(void) if ( (intro_timer >= TEXT_APPEAR_RANDOM_TIM) && - (PSXSDKIntroCloseShellEvent == true) + (PSXSDKIntroCloseShellEvent != false) && - (PSXSDKIntroSpinDiskEvent == true) + (PSXSDKIntroSpinDiskEvent != false) && (PSXSDKIntroRandTextEvent == false) ) { @@ -357,11 +357,11 @@ void PSXSDKIntroRunTimers(void) if ( (intro_timer >= TEXT_APPEAR_STRING_TIM) && - (PSXSDKIntroCloseShellEvent == true) + (PSXSDKIntroCloseShellEvent != false) && - (PSXSDKIntroSpinDiskEvent == true) + (PSXSDKIntroSpinDiskEvent != false) && - (PSXSDKIntroRandTextEvent == true) + (PSXSDKIntroRandTextEvent != false) && (PSXSDKIntroStringEvent == false) ) { @@ -372,13 +372,13 @@ void PSXSDKIntroRunTimers(void) if ( (intro_timer >= INTRO_CLOSE_TIM) && - (PSXSDKIntroCloseShellEvent == true) + (PSXSDKIntroCloseShellEvent != false) && - (PSXSDKIntroSpinDiskEvent == true) + (PSXSDKIntroSpinDiskEvent != false) && - (PSXSDKIntroRandTextEvent == true) + (PSXSDKIntroRandTextEvent != false) && - (PSXSDKIntroStringEvent == true) ) + (PSXSDKIntroStringEvent != false) ) { PSXSDKIntroClose = true; intro_timer = 0; @@ -402,7 +402,7 @@ void PSXSDKIntroDrawDisk(void) PsxDisk.u = DISK_U; PsxDisk.v = DISK_V; - if (PSXSDKIntroSpinDiskEvent == true) + if (PSXSDKIntroSpinDiskEvent != false) { if (PSXSDKIntroSpinDiskEventReminder == false) { diff --git a/Source/PSXSDKIntro.h b/Source/PSXSDKIntro.h index 9290c4c..8f62606 100644 --- a/Source/PSXSDKIntro.h +++ b/Source/PSXSDKIntro.h @@ -1,5 +1,5 @@ -#ifndef __PSXSDK_INTRO_HEADER__ -#define __PSXSDK_INTRO_HEADER__ +#ifndef PSXSDK_INTRO_HEADER__ +#define PSXSDK_INTRO_HEADER__ /* ************************************* * Includes @@ -28,4 +28,4 @@ extern GsSprite OpenSource_Logo; extern SsVag TrayClSnd; extern SsVag SpinDiskSnd; -#endif //__PSXSDK_INTRO_HEADER__ +#endif //PSXSDK_INTRO_HEADER__ diff --git a/Source/Pad.c b/Source/Pad.c index 0f7fe82..7704107 100644 --- a/Source/Pad.c +++ b/Source/Pad.c @@ -172,46 +172,46 @@ bool PadOneAnyKeyPressed(void) bool PadOneDirectionKeyPressed(void) { - return ( (PadOneKeyPressed(PAD_UP) == true) + return ( (PadOneKeyPressed(PAD_UP) != false) || - (PadOneKeyPressed(PAD_LEFT) == true) + (PadOneKeyPressed(PAD_LEFT) != false) || - (PadOneKeyPressed(PAD_RIGHT) == true) + (PadOneKeyPressed(PAD_RIGHT) != false) || - (PadOneKeyPressed(PAD_DOWN) == true) ); + (PadOneKeyPressed(PAD_DOWN) != false) ); } bool PadOneDirectionKeyReleased(void) { - return ( (PadOneKeyReleased(PAD_UP) == true) + return ( (PadOneKeyReleased(PAD_UP) != false) || - (PadOneKeyReleased(PAD_LEFT) == true) + (PadOneKeyReleased(PAD_LEFT) != false) || - (PadOneKeyReleased(PAD_RIGHT) == true) + (PadOneKeyReleased(PAD_RIGHT) != false) || - (PadOneKeyReleased(PAD_DOWN) == true) ); + (PadOneKeyReleased(PAD_DOWN) != false) ); } bool PadTwoDirectionKeyReleased(void) { - return ( (PadTwoKeyReleased(PAD_UP) == true) + return ( (PadTwoKeyReleased(PAD_UP) != false) || - (PadTwoKeyReleased(PAD_LEFT) == true) + (PadTwoKeyReleased(PAD_LEFT) != false) || - (PadTwoKeyReleased(PAD_RIGHT) == true) + (PadTwoKeyReleased(PAD_RIGHT) != false) || - (PadTwoKeyReleased(PAD_DOWN) == true) ); + (PadTwoKeyReleased(PAD_DOWN) != false) ); } bool PadTwoDirectionKeyPressed(void) { - return ( (PadTwoKeyPressed(PAD_UP) == true) + return ( (PadTwoKeyPressed(PAD_UP) != false) || - (PadTwoKeyPressed(PAD_LEFT) == true) + (PadTwoKeyPressed(PAD_LEFT) != false) || - (PadTwoKeyPressed(PAD_RIGHT) == true) + (PadTwoKeyPressed(PAD_RIGHT) != false) || - (PadTwoKeyPressed(PAD_DOWN) == true) ); + (PadTwoKeyPressed(PAD_DOWN) != false) ); } bool PadTwoAnyKeyPressed(void) @@ -281,7 +281,7 @@ bool PadTwoKeyRepeat(unsigned short key, uint8_t time) void PadOneVibrationHandler(void) { - if (PadOneIsVibrationEnabled() == true) + if (PadOneIsVibrationEnabled() != false) { 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() != false) { pad_enable_vibration(PAD_TWO); pad_set_vibration(PAD_TWO,pad2_small_vibration_force,pad2_big_vibration_force); @@ -505,7 +505,7 @@ void PadCheatHandler(uint8_t n_pad) { 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) != false) { if (cheatsArray[i]->Callback != NULL) { @@ -524,7 +524,7 @@ void PadCheatHandler(uint8_t n_pad) for (i = 0; i < sizeof(available_keys) / sizeof(unsigned short); i++) { - if (pressed_callback(available_keys[i]) == true) + if (pressed_callback(available_keys[i]) != false) { TimerRestart(timer); key = available_keys[i]; diff --git a/Source/Pad.h b/Source/Pad.h index c09ec9d..8ef04eb 100644 --- a/Source/Pad.h +++ b/Source/Pad.h @@ -1,5 +1,5 @@ -#ifndef __PAD_HEADER__ -#define __PAD_HEADER__ +#ifndef PAD_HEADER__ +#define PAD_HEADER__ /* ************************************* * Includes @@ -68,4 +68,4 @@ unsigned short* PadGetPlayerOneCheatArray(void); // Experimental (to be removed) unsigned short* PadOneGetAddress(void); -#endif //__PAD_HEADER__ +#endif //PAD_HEADER__ diff --git a/Source/PltParser.c b/Source/PltParser.c index ad7cf76..f9fffb0 100644 --- a/Source/PltParser.c +++ b/Source/PltParser.c @@ -89,14 +89,26 @@ bool PltParserLoadFile(char* strPath, TYPE_FLIGHT_DATA* ptrFlightData) if (strlen(buffer) != PLT_FIRST_LINE_CHARACTERS) { + int k; + + dprintf("Buffer: "); + + for (k = 0; k < strlen(buffer); k++) + { + dprintf("0x%02X ", buffer[k]); + } // Format should always be HH:MM (5 characters) // Treat any other combination as possible error + Serial_printf( "Invalid first line length: %d, expected %d characters.\n", + strlen(buffer), + PLT_FIRST_LINE_CHARACTERS ); return false; } if (buffer[PLT_COLON_POSITION] != ':') { // Check whether time format is HH:MM + Serial_printf("Invalid hour/minute format: %s\n", buffer); return false; } diff --git a/Source/PltParser.h b/Source/PltParser.h index 8762ff4..58e3bb1 100644 --- a/Source/PltParser.h +++ b/Source/PltParser.h @@ -1,5 +1,5 @@ -#ifndef __PLT_PARSER__ -#define __PLT_PARSER__ +#ifndef PLT_PARSER__ +#define PLT_PARSER__ /* ************************************* * Includes @@ -27,4 +27,4 @@ uint8_t* PltParserGenerateFile(TYPE_PLT_CONFIG* ptrPltConfig); * Global variables * *************************************/ -#endif //__PLT_PARSER__ +#endif //PLT_PARSER__ diff --git a/Source/Serial.h b/Source/Serial.h index 30ad901..c74ae86 100644 --- a/Source/Serial.h +++ b/Source/Serial.h @@ -1,5 +1,5 @@ -#ifndef __SERIAL_HEADER__ -#define __SERIAL_HEADER__ +#ifndef SERIAL_HEADER__ +#define SERIAL_HEADER__ /* ************************************* * Includes @@ -30,4 +30,4 @@ volatile bool SerialIsBusy(void); void Serial_printf(const char* str, ...); #endif // SERIAL_INTERFACE -#endif // __SERIAL_HEADER__ +#endif // SERIAL_HEADER__ diff --git a/Source/Sfx.h b/Source/Sfx.h index 1d4e8c0..30903aa 100644 --- a/Source/Sfx.h +++ b/Source/Sfx.h @@ -1,5 +1,5 @@ -#ifndef __SFX_HEADER__ -#define __SFX_HEADER__ +#ifndef SFX_HEADER__ +#define SFX_HEADER__ /* ************************************* * Includes @@ -34,4 +34,4 @@ bool SfxUploadSound(char* file_path, SsVag * vag); void SfxPlayTrack(MUSIC_TRACKS track); void SfxStopMusic(void); -#endif //__SFX_HEADER__ +#endif //SFX_HEADER__ diff --git a/Source/System.c b/Source/System.c index 4cc7266..8530d6c 100644 --- a/Source/System.c +++ b/Source/System.c @@ -225,7 +225,7 @@ bool SystemRefreshNeeded(void) void ISR_SystemDefaultVBlank(void) { - if (System1SecondTick() == true) + if (System1SecondTick() != false) { fps = temp_fps; temp_fps = 0; @@ -456,7 +456,7 @@ void SystemRunTimers(void) void SystemCheckTimer(bool* timer, uint64_t* last_timer, uint8_t step) { - if (*timer == true) + if (*timer != false) { *timer = false; } @@ -492,7 +492,7 @@ 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() != false) || (GfxIsGPUBusy() != false) ); if (fname == NULL) { @@ -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 != false) { GsRectangle devMenuBg = { .x = DEVMENU_BG_X, .y = DEVMENU_BG_Y, diff --git a/Source/System.h b/Source/System.h index 306bd5f..aa5aebe 100644 --- a/Source/System.h +++ b/Source/System.h @@ -1,5 +1,5 @@ -#ifndef __SYSTEM_HEADER__ -#define __SYSTEM_HEADER__ +#ifndef SYSTEM_HEADER__ +#define SYSTEM_HEADER__ /* ************************************** * Includes * @@ -137,4 +137,4 @@ unsigned char SystemGetSineValue(void); * Global Variables * * **************************************/ -#endif //__SYSTEM_HEADER__ +#endif //SYSTEM_HEADER__ diff --git a/Source/Timer.c b/Source/Timer.c index 85ae267..abbb9c7 100644 --- a/Source/Timer.c +++ b/Source/Timer.c @@ -113,9 +113,9 @@ void TimerHandler(void) for (i = 0; i < MAX_TIMERS; i++) { - if (timer_array[i].busy == true) + if (timer_array[i].busy != false) { - if (System100msTick() == true) + if (System100msTick() != false) { timer_array[i].time--; @@ -123,7 +123,7 @@ void TimerHandler(void) { timer_array[i].Timeout_Callback(); - if (timer_array[i].repeat_flag == true) + if (timer_array[i].repeat_flag != false) { timer_array[i].time = timer_array[i].orig_time; } diff --git a/Source/Timer.h b/Source/Timer.h index 6b11d9a..323221d 100644 --- a/Source/Timer.h +++ b/Source/Timer.h @@ -1,5 +1,5 @@ -#ifndef __TIMER_HEADER__ -#define __TIMER_HEADER__ +#ifndef TIMER_HEADER__ +#define TIMER_HEADER__ /* ************************************** * Includes * @@ -27,10 +27,10 @@ void TimerReset(void); // To be called every cycle (i.e.: inside GfxDrawScene() ). void TimerHandler(void); -// Sets timer remaining time to initial value. +// Sets timer remaining time to its initial value. void TimerRestart(TYPE_TIMER* timer); // Flushes a timer pointed to by timer. void TimerRemove(TYPE_TIMER* timer); -#endif // __TIMER_HEADER__ +#endif // TIMER_HEADER__ diff --git a/Sprites/BCNGW.bmp b/Sprites/BCNGW.bmp Binary files differnew file mode 100644 index 0000000..88ba2d4 --- /dev/null +++ b/Sprites/BCNGW.bmp diff --git a/Sprites/BCNGW.flags b/Sprites/BCNGW.flags new file mode 100644 index 0000000..48cded9 --- /dev/null +++ b/Sprites/BCNGW.flags @@ -0,0 +1 @@ +16 -org=896,0 diff --git a/Sprites/CITYBG1.bmp b/Sprites/CITYBG1.bmp Binary files differnew file mode 100644 index 0000000..8b315f8 --- /dev/null +++ b/Sprites/CITYBG1.bmp diff --git a/Sprites/CITYBG1.flags b/Sprites/CITYBG1.flags new file mode 100644 index 0000000..7bde953 --- /dev/null +++ b/Sprites/CITYBG1.flags @@ -0,0 +1 @@ +16 -org=896,0 -mpink diff --git a/Sprites/MENUSTAR.flags b/Sprites/MENUSTAR.flags index 9f09293..a5c3965 100644 --- a/Sprites/MENUSTAR.flags +++ b/Sprites/MENUSTAR.flags @@ -1 +1 @@ -4 -org=800,287 -mpink +4 -org=800,288 -mpink diff --git a/cdimg/DATA/LEVELS/LEVEL1.PLT b/cdimg/DATA/LEVELS/LEVEL1.PLT index 7ef4900..c59806c 100644 --- a/cdimg/DATA/LEVELS/LEVEL1.PLT +++ b/cdimg/DATA/LEVELS/LEVEL1.PLT @@ -6,30 +6,27 @@ #For example: 14:55 #Aircraft arrival (or departure) must be set relative to initial time, in HH:MM format. -#ARRIVAL;PHX1802;100;00:10;0;360 -#ARRIVAL;PHX2015;100;00:10;0;360 -#ARRIVAL;PHX2016;100;00:40;0;360 -#ARRIVAL;PHX2017;100;00:50;0;360 -#ARRIVAL;PHX2018;100;01:40;0;360 -#ARRIVAL;PHX2019;100;01:20;0;360 -#ARRIVAL;PHX2020;100;02:00;0;360 -#ARRIVAL;PHX2021;100;00:05;0;360 -#ARRIVAL;PHX2022;100;00:15;0;360 -#ARRIVAL;PHX2023;100;00:45;0;360 -#ARRIVAL;PHX2024;100;01:45;0;360 -#ARRIVAL;PHX2025;100;01:20;0;360 -#ARRIVAL;PHX2026;100;01:10;0;360 -#DEPARTURE;PHX1000;100;00:05;19;180 -#DEPARTURE;PHX1001;100;00:15;19;180 -#DEPARTURE;PHX1002;100;00:30;19;180 -#DEPARTURE;PHX1003;100;00:45;19;180 -#DEPARTURE;PHX1004;100;01:10;19;180 -#DEPARTURE;PHX1280;100;01:30;19;180 -#DEPARTURE;PHX1332;100;00:50;21;180 -#DEPARTURE;PHX1333;100;01:00;19;180 -#DEPARTURE;PHX1334;100;01:15;21;180 -#DEPARTURE;PHX1336;100;01:20;21;180 -#ARRIVAL;PHX2026;120;00:05;0;360 -#ARRIVAL;PHX2026;80;00:10;0;360 -DEPARTURE;PHX2026;80;00:05;19;180 -DEPARTURE;PHX2026;80;00:05;21;180 +ARRIVAL;PHX1802;100;00:10;0;360 +ARRIVAL;PHX2015;100;00:10;0;360 +ARRIVAL;PHX2016;100;00:40;0;360 +ARRIVAL;PHX2017;100;00:50;0;360 +ARRIVAL;PHX2018;100;01:40;0;360 +ARRIVAL;PHX2019;100;01:20;0;360 +ARRIVAL;PHX2020;100;02:00;0;360 +ARRIVAL;PHX2021;100;00:05;0;360 +ARRIVAL;PHX2022;100;00:15;0;360 +ARRIVAL;PHX2023;100;00:45;0;360 +ARRIVAL;PHX2024;100;01:45;0;360 +ARRIVAL;PHX2025;100;01:20;0;360 +ARRIVAL;PHX2026;100;01:10;0;360 +DEPARTURE;PHX1000;100;00:05;19;180 +DEPARTURE;PHX1001;100;00:15;19;180 +DEPARTURE;PHX1002;100;00:30;19;180 +DEPARTURE;PHX1003;100;00:45;19;180 +DEPARTURE;PHX1004;100;01:10;19;180 +DEPARTURE;PHX1280;100;01:30;19;180 +DEPARTURE;PHX1332;100;00:50;21;180 +DEPARTURE;PHX1333;100;01:00;19;180 +DEPARTURE;PHX1334;100;01:15;21;180 +ARRIVAL;PHX2026;120;00:05;0;360 +ARRIVAL;PHX2026;80;00:10;0;360 diff --git a/cdimg/DATA/SPRITES/MENUSTAR.TIM b/cdimg/DATA/SPRITES/MENUSTAR.TIM Binary files differindex f0a442a..3d8abba 100644 --- a/cdimg/DATA/SPRITES/MENUSTAR.TIM +++ b/cdimg/DATA/SPRITES/MENUSTAR.TIM |
