diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2017-12-29 23:19:43 +0100 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2017-12-29 23:19:43 +0100 |
| commit | 67cfc8b2c23177f036eda97f3423d062ba0c3e90 (patch) | |
| tree | 736dd4c76c30bf0f74ef4bf73f1218219ab26dc0 /Source | |
| parent | 0d1df70f2d1a08fdb6389391ee59afc5fbc6277a (diff) | |
| download | airport-67cfc8b2c23177f036eda97f3423d062ba0c3e90.tar.gz | |
* RWY_DIR and AIRCRAFT_DIRECTION have been joint into a single enum.
* Game.c: new prototypes GameGetParkingDirection() and GameGetRunwayDirection().
* Slight optimizations into GameRenderLevel().
* Added some comment headers into Gfx.c.
Diffstat (limited to 'Source')
35 files changed, 442 insertions, 397 deletions
diff --git a/Source/Aircraft.c b/Source/Aircraft.c index 423eb13..7ecd8af 100644 --- a/Source/Aircraft.c +++ b/Source/Aircraft.c @@ -118,7 +118,8 @@ void AircraftInit(void) bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData,
uint8_t FlightDataIndex,
- uint16_t* targets )
+ uint16_t* targets,
+ DIRECTION direction )
{
TYPE_AIRCRAFT_DATA* ptrAircraft = &AircraftData[AircraftIndex];
uint8_t level_columns = GameGetLevelColumns();
@@ -141,12 +142,9 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData, if (ptrFlightData->FlightDirection[FlightDataIndex] == ARRIVAL)
{
- RWY_DIR rwyDir = GameGetRunwayDirection(ptrAircraft->Target[0]);
- // Calculate direction automatically.
-
- switch (rwyDir)
+ switch (direction)
{ - case RWY_DIR_EAST:
+ case DIR_EAST:
ptrAircraft->IsoPos.x = 0;
ptrAircraft->IsoPos.y = targets[0] / level_columns;
@@ -157,11 +155,9 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData, ptrAircraft->IsoPos.z = targets[0] % level_columns;
ptrAircraft->IsoPos.z <<= TILE_SIZE_BIT_SHIFT - 1;
ptrAircraft->IsoPos.z = fix16_from_int(ptrAircraft->IsoPos.z);
-
- ptrAircraft->Direction = AIRCRAFT_DIR_EAST;
break;
- case RWY_DIR_SOUTH:
+ case DIR_SOUTH:
ptrAircraft->IsoPos.x = targets[0] % level_columns;
ptrAircraft->IsoPos.x <<= TILE_SIZE_BIT_SHIFT;
ptrAircraft->IsoPos.x += TILE_SIZE >> 1; // Adjust to tile center
@@ -172,24 +168,30 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData, ptrAircraft->IsoPos.z = targets[0] / level_columns;
ptrAircraft->IsoPos.z <<= TILE_SIZE_BIT_SHIFT - 1;
ptrAircraft->IsoPos.z = fix16_from_int(ptrAircraft->IsoPos.z);
-
- ptrAircraft->Direction = AIRCRAFT_DIR_SOUTH;
break;
- case RWY_INVALID_DIR:
+ case NO_DIRECTION:
// Fall through
default:
- Serial_printf("Invalid runway direction %d for inbound flight.\n", rwyDir);
+ Serial_printf("Invalid runway direction %d for inbound flight.\n", direction);
return false; }
}
else if (ptrFlightData->FlightDirection[FlightDataIndex] == DEPARTURE)
{
+ if (direction == NO_DIRECTION)
+ {
+ Serial_printf("Invalid direction for outbound flight.\n");
+ return false;
+ }
+
ptrAircraft->IsoPos.x = GameGetXFromTile(ptrFlightData->Parking[FlightDataIndex]);
ptrAircraft->IsoPos.y = GameGetYFromTile(ptrFlightData->Parking[FlightDataIndex]);
ptrAircraft->IsoPos.z = 0;
}
+ ptrAircraft->Direction = direction;
+
ptrAircraft->State = ptrFlightData->State[FlightDataIndex];
AircraftFlightDataIdx_HashTable[FlightDataIndex] = AircraftIndex;
@@ -206,6 +208,8 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData, Serial_printf(" %d", ptrAircraft->Target[i]);
}
+ Serial_printf("\n\tDirection: %d\n", ptrAircraft->Direction);
+
Serial_printf("\nLivery: %d\n", ptrAircraft->Livery );
Serial_printf("Aircraft position: {%d, %d, %d}\n",
@@ -332,23 +336,23 @@ bool AircraftCheckPath(TYPE_AIRCRAFT_DATA* ptrAircraft, TYPE_AIRCRAFT_DATA* ptrO switch (ptrAircraft->Direction)
{
- case AIRCRAFT_DIR_EAST:
+ case DIR_EAST:
nextTile = currentTile + 1;
break;
- case AIRCRAFT_DIR_WEST:
+ case DIR_WEST:
nextTile = currentTile - 1;
break;
- case AIRCRAFT_DIR_NORTH:
+ case DIR_NORTH:
nextTile = currentTile - GameGetLevelColumns();
break;
- case AIRCRAFT_DIR_SOUTH:
+ case DIR_SOUTH:
nextTile = currentTile + GameGetLevelColumns();
break;
- case AIRCRAFT_DIR_NO_DIRECTION:
+ case NO_DIRECTION:
// Fall through
default:
Serial_printf("AircraftCheckPath: Undefined direction\n");
@@ -508,11 +512,13 @@ void AircraftRender(TYPE_PLAYER* ptrPlayer, uint8_t aircraftIdx) }
else if (AircraftSpr.x > X_SCREEN_RESOLUTION)
{ - ArrowSpr.x = X_SCREEN_RESOLUTION - ArrowSpr.w; + ArrowSpr.x = X_SCREEN_RESOLUTION - ArrowSpr.w;
+ ArrowSpr.mx = ArrowSpr.w >> 1;
+ ArrowSpr.my = ArrowSpr.h >> 1;
}
else
{ - ArrowSpr.x = AircraftSpr.x; + ArrowSpr.x = AircraftSpr.x;
}
if (AircraftSpr.y < 0)
@@ -569,7 +575,7 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft) }
else
{
- ptrAircraft->Direction = AIRCRAFT_DIR_EAST;
+ ptrAircraft->Direction = DIR_EAST;
ptrAircraft->IsoPos.x += ptrAircraft->Speed;
}
}
@@ -581,7 +587,7 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft) }
else
{
- ptrAircraft->Direction = AIRCRAFT_DIR_WEST;
+ ptrAircraft->Direction = DIR_WEST;
ptrAircraft->IsoPos.x -= ptrAircraft->Speed;
}
}
@@ -600,7 +606,7 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft) }
else
{
- ptrAircraft->Direction = AIRCRAFT_DIR_SOUTH;
+ ptrAircraft->Direction = DIR_SOUTH;
ptrAircraft->IsoPos.y += ptrAircraft->Speed;
}
}
@@ -612,7 +618,7 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft) }
else
{
- ptrAircraft->Direction = AIRCRAFT_DIR_NORTH;
+ ptrAircraft->Direction = DIR_NORTH;
ptrAircraft->IsoPos.y -= ptrAircraft->Speed;
}
}
@@ -640,23 +646,23 @@ void AircraftDirection(TYPE_AIRCRAFT_DATA* ptrAircraft) // STATE_CLIMBING
switch(ptrAircraft->Direction)
{
- case AIRCRAFT_DIR_EAST:
+ case DIR_EAST:
ptrAircraft->IsoPos.x += ptrAircraft->Speed;
break;
- case AIRCRAFT_DIR_WEST:
+ case DIR_WEST:
ptrAircraft->IsoPos.x -= ptrAircraft->Speed;
break;
- case AIRCRAFT_DIR_NORTH:
+ case DIR_NORTH:
ptrAircraft->IsoPos.y -= ptrAircraft->Speed;
break;
- case AIRCRAFT_DIR_SOUTH:
+ case DIR_SOUTH:
ptrAircraft->IsoPos.y += ptrAircraft->Speed;
break;
- case AIRCRAFT_DIR_NO_DIRECTION:
+ case NO_DIRECTION:
// Fall through
default:
return;
@@ -695,27 +701,27 @@ void AircraftUpdateSpriteFromData(TYPE_AIRCRAFT_DATA* ptrAircraft) switch(ptrAircraft->Direction)
{
- case AIRCRAFT_DIR_NORTH:
+ case DIR_NORTH:
AircraftSpr.v += AircraftSpr.h;
AircraftSpr.attribute |= H_FLIP;
break;
- case AIRCRAFT_DIR_SOUTH:
+ case DIR_SOUTH:
AircraftSpr.v += 0;
AircraftSpr.attribute |= H_FLIP;
break;
- case AIRCRAFT_DIR_EAST:
+ case DIR_EAST:
AircraftSpr.v += 0;
AircraftSpr.attribute &= ~(H_FLIP);
break;
- case AIRCRAFT_DIR_WEST:
+ case DIR_WEST:
AircraftSpr.v += AircraftSpr.h;
AircraftSpr.attribute &= ~(H_FLIP);
break;
- case AIRCRAFT_DIR_NO_DIRECTION:
+ case NO_DIRECTION:
// Fall through
default:
break;
@@ -791,7 +797,7 @@ void AircraftFromFlightDataIndexAddTargets(uint8_t index, uint16_t* targets) AircraftAddTargets(AircraftFromFlightDataIndex(index), targets);
}
-AIRCRAFT_DIRECTION AircraftGetDirection(TYPE_AIRCRAFT_DATA* ptrAircraft)
+DIRECTION AircraftGetDirection(TYPE_AIRCRAFT_DATA* ptrAircraft)
{
return ptrAircraft->Direction;
}
diff --git a/Source/Aircraft.h b/Source/Aircraft.h index 4569044..c9add38 100644 --- a/Source/Aircraft.h +++ b/Source/Aircraft.h @@ -24,9 +24,10 @@ bool AircraftRemove(uint8_t aircraftIdx); uint16_t* AircraftGetTargets(uint8_t index);
bool AircraftMoving(uint8_t index);
uint8_t AircraftGetTargetIdx(uint8_t index);
-AIRCRAFT_DIRECTION AircraftGetDirection(TYPE_AIRCRAFT_DATA* ptrAircraft);
+DIRECTION AircraftGetDirection(TYPE_AIRCRAFT_DATA* ptrAircraft);
bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData,
uint8_t FlightDataIndex,
- uint16_t* targets );
+ uint16_t* targets,
+ DIRECTION direction );
#endif //AIRCRAFT_HEADER__
diff --git a/Source/Camera.c b/Source/Camera.c index 657fcab..f55ee4f 100644 --- a/Source/Camera.c +++ b/Source/Camera.c @@ -1,7 +1,6 @@ /* ************************************* * Includes * *************************************/ - #include "Camera.h" #include "Game.h" #include "System.h" @@ -10,7 +9,6 @@ /* ************************************* * Defines * *************************************/ - #define SPEED_CALCULATION_TIME 3 #define MAX_CAMERA_SPEED 5 #define MIN_CAMERA_SPEED 1 @@ -20,14 +18,12 @@ /* ************************************* * Local Variables * *************************************/ - static int32_t Camera_Max_X_Offset; static int32_t Camera_Max_Y_Offset; /* ************************************* * Local Prototypes * *************************************/ - static void CameraUpdateSpeed(TYPE_PLAYER* ptrPlayer); static bool CameraSpecialConditions(TYPE_PLAYER* ptrPlayer); diff --git a/Source/Camera.h b/Source/Camera.h index aed0bce..9d958ed 100644 --- a/Source/Camera.h +++ b/Source/Camera.h @@ -4,18 +4,15 @@ /* ************************************* * Includes * *************************************/ - #include "Global_Inc.h" #include "GameStructures.h" /* ************************************* * Defines * *************************************/ - /* ************************************* * Global prototypes * *************************************/ - void CameraInit(TYPE_PLAYER* ptrPlayer); void CameraHandler(TYPE_PLAYER* ptrPlayer); void CameraApplyCoordinatesToSprite(TYPE_PLAYER* ptrPlayer, GsSprite * spr); diff --git a/Source/EndAnimation.c b/Source/EndAnimation.c index 582dc17..75edc85 100644 --- a/Source/EndAnimation.c +++ b/Source/EndAnimation.c @@ -1,7 +1,6 @@ /* ************************************* * Includes * *************************************/ - #include "EndAnimation.h" #include "Global_Inc.h" #include "Gfx.h" @@ -10,11 +9,9 @@ /* ************************************* * Defines * *************************************/ - /* ************************************* * Structs and enums * *************************************/ - enum { END_ANIMATION_FADEOUT_STEP = 8, @@ -39,7 +36,6 @@ enum /* ************************************* * Local Prototypes * *************************************/ - static void EndAnimationSquares(void); static void EndAnimationFadeOut(void); static void EndAnimationLine(void); @@ -47,7 +43,6 @@ static void EndAnimationLine(void); /* ************************************* * Local Variables * *************************************/ - static GsRectangle EndAnimationRect; static GsSprite EndAnimationDisplay; diff --git a/Source/EndAnimation.h b/Source/EndAnimation.h index 6e83be8..83a4f02 100644 --- a/Source/EndAnimation.h +++ b/Source/EndAnimation.h @@ -4,19 +4,15 @@ /* ************************************** * Includes * * **************************************/ - /* ************************************** * Defines * * **************************************/ - /* ************************************** * Global Prototypes * * **************************************/ - void EndAnimation(void); /* ************************************** * Global Variables * * **************************************/ - #endif // END_SCREEN_HEADER__ diff --git a/Source/Exe/AIRPORT.elf b/Source/Exe/AIRPORT.elf Binary files differindex 3fc6f3d..6d595ed 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 7513386..869ea12 100644 --- a/Source/Exe/AIRPORT.iso +++ b/Source/Exe/AIRPORT.iso diff --git a/Source/Game.c b/Source/Game.c index 42308f3..4389e5f 100644 --- a/Source/Game.c +++ b/Source/Game.c @@ -43,7 +43,7 @@ typedef struct t_rwyentrydata { - AIRCRAFT_DIRECTION Direction; + DIRECTION Direction; uint16_t rwyEntryTile; int8_t rwyStep; uint16_t rwyHeader; @@ -191,6 +191,8 @@ 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); +static DIRECTION GameGetRunwayDirection(uint16_t rwyHeader); +static DIRECTION GameGetParkingDirection(uint16_t parkingTile); /* ************************************* * Global Variables @@ -1568,7 +1570,7 @@ void GameAircraftState(uint8_t i) Serial_printf("Target assigned = %d\n", target[0]); - if (AircraftAddNew(&FlightData, i, target) == false) + if (AircraftAddNew(&FlightData, i, target, GameGetParkingDirection(GameLevelBuffer[target[0]])) == false) { Serial_printf("Exceeded maximum aircraft number!\n"); return; @@ -1618,7 +1620,6 @@ void GameAircraftState(uint8_t i) * or ptrPlayer->InvalidPath != false. * * ******************************************************************************************/ - void GameRenderLevel(TYPE_PLAYER* ptrPlayer) { uint16_t i; @@ -1632,23 +1633,6 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer) TYPE_ISOMETRIC_POS tileIsoPos; TYPE_CARTESIAN_POS tileCartPos; - //uint16_t init_timer_value = 0; - //uint16_t end_timer_value = 0; - - // Prepare runway to be painted in blue if player is on runway selection mode - if (ptrPlayer->SelectRunway != false) - { - - /*Serial_printf("Runway array:\n"); - - for (j = 0; j < GAME_MAX_RWY_LENGTH; j++) - { - Serial_printf("%d ",ptrPlayer->RwyArray[j]); - } - - Serial_printf("\n");*/ - } - for (i = 0 ; i < GameLevelSize; i++) { // GameLevelBuffer bits explanation: @@ -1660,9 +1644,17 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer) // | | | | | | | | | | | | V Tile, bit 2 // | | | | | | | | | | | V Tile, bit 3 // | | | | | | | | | | V Tile, bit 4 - // | | | | V Tile, bit 5 - // | | V Tile, bit 6 - // | Tile mirror flag + // | | | | | | | | | V Tile, bit 5 + // | | | | | | | | V Tile, bit 6 + // | | | | | | | V Tile mirror flag + // | | | | | | V Building, bit 0 + // | | | | | V Building, bit 1 + // | | | | V Building, bit 2 + // | | | V Building, bit 3 + // | | V Building, bit 4 + // | V Building, bit 5 + // V Building, bit 6 + // Building, bit 7 uint8_t CurrentTile = (uint8_t)(GameLevelBuffer[i] & 0x00FF); @@ -1740,72 +1732,71 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer) ptrTileset->g = NORMAL_LUMINANCE; ptrTileset->b = NORMAL_LUMINANCE; - if ( (ptrPlayer->SelectRunway != false) - && - (i != 0) - && - (SystemContains_u16(i, ptrPlayer->RwyArray, GAME_MAX_RWY_LENGTH) != false) ) - { - - if (used_rwy != false) - { - ptrTileset->r = rwy_sine; - ptrTileset->b = NORMAL_LUMINANCE >> 2; - ptrTileset->g = NORMAL_LUMINANCE >> 2; - } - else - { - ptrTileset->r = NORMAL_LUMINANCE >> 2; - ptrTileset->g = NORMAL_LUMINANCE >> 2; - ptrTileset->b = rwy_sine; - } - } - else if ( ( (ptrPlayer->SelectTaxiwayParking != false) - || - (ptrPlayer->SelectTaxiwayRunway != false) ) - && - (i != 0) ) - { - if (( (SystemContains_u16(i, ptrPlayer->Waypoints, PLAYER_MAX_WAYPOINTS) != false) - || - (i == ptrPlayer->SelectedTile) ) - && - (ptrPlayer->SelectedTile != GAME_INVALID_TILE_SELECTION) ) - { - if (ptrPlayer->InvalidPath != false) - { - ptrTileset->r = rwy_sine; - ptrTileset->b = NORMAL_LUMINANCE >> 2; - ptrTileset->g = NORMAL_LUMINANCE >> 2; - } - else - { - ptrTileset->r = NORMAL_LUMINANCE >> 2; - ptrTileset->g = NORMAL_LUMINANCE >> 2; - ptrTileset->b = rwy_sine; - } - } - else if ( (ptrPlayer->SelectTaxiwayRunway != false) - && - ( (CurrentTile == TILE_RWY_HOLDING_POINT) - || - (CurrentTile == TILE_RWY_HOLDING_POINT_2) ) ) - { - ptrTileset->r = NORMAL_LUMINANCE >> 2; - ptrTileset->g = rwy_sine; - ptrTileset->b = NORMAL_LUMINANCE >> 2; - } - else if ( (ptrPlayer->SelectTaxiwayParking != false) - && - ( (CurrentTile == TILE_PARKING) - || - (CurrentTile == TILE_PARKING_2) ) ) - { - ptrTileset->r = NORMAL_LUMINANCE >> 2; - ptrTileset->g = rwy_sine; - ptrTileset->b = NORMAL_LUMINANCE >> 2; - } - } + if (i != 0) + { + if (ptrPlayer->SelectRunway != false) + { + if (SystemContains_u16(i, ptrPlayer->RwyArray, GAME_MAX_RWY_LENGTH) != false) + { + if (used_rwy != false) + { + ptrTileset->r = rwy_sine; + ptrTileset->b = NORMAL_LUMINANCE >> 2; + ptrTileset->g = NORMAL_LUMINANCE >> 2; + } + else + { + ptrTileset->r = NORMAL_LUMINANCE >> 2; + ptrTileset->g = NORMAL_LUMINANCE >> 2; + ptrTileset->b = rwy_sine; + } + } + } + else if ( (ptrPlayer->SelectTaxiwayParking != false) + || + (ptrPlayer->SelectTaxiwayRunway != false) ) + { + if (( (SystemContains_u16(i, ptrPlayer->Waypoints, PLAYER_MAX_WAYPOINTS) != false) + || + (i == ptrPlayer->SelectedTile) ) + && + (ptrPlayer->SelectedTile != GAME_INVALID_TILE_SELECTION) ) + { + if (ptrPlayer->InvalidPath != false) + { + ptrTileset->r = rwy_sine; + ptrTileset->b = NORMAL_LUMINANCE >> 2; + ptrTileset->g = NORMAL_LUMINANCE >> 2; + } + else + { + ptrTileset->r = NORMAL_LUMINANCE >> 2; + ptrTileset->g = NORMAL_LUMINANCE >> 2; + ptrTileset->b = rwy_sine; + } + } + else if ( (ptrPlayer->SelectTaxiwayRunway != false) + && + ( (CurrentTile == TILE_RWY_HOLDING_POINT) + || + (CurrentTile == TILE_RWY_HOLDING_POINT_2) ) ) + { + ptrTileset->r = NORMAL_LUMINANCE >> 2; + ptrTileset->g = rwy_sine; + ptrTileset->b = NORMAL_LUMINANCE >> 2; + } + else if ( (ptrPlayer->SelectTaxiwayParking != false) + && + ( (CurrentTile == TILE_PARKING) + || + (CurrentTile == TILE_PARKING_2) ) ) + { + ptrTileset->r = NORMAL_LUMINANCE >> 2; + ptrTileset->g = rwy_sine; + ptrTileset->b = NORMAL_LUMINANCE >> 2; + } + } + } if (ptrTileset != NULL) { @@ -1827,8 +1818,6 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer) CurrentTile = aux_id; } - // Serial_printf("Tile %d, attribute 0x%X\n",i,ptrTileset->attribute); - GfxSortSprite(ptrTileset); if (ptrTileset->attribute & H_FLIP) @@ -1836,12 +1825,6 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer) ptrTileset->attribute &= ~(H_FLIP); } } - - /*dprintf("GameRenderLevel execution time = %d\t" - "end_timer_value = 0x%04X\tinit_timer_value = 0x%04X\n", - end_timer_value - init_timer_value, - end_timer_value, - init_timer_value );*/ } /* ******************************************************************* @@ -1858,7 +1841,6 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer) * To be used on GameInit() after PLT file parsing. * * *******************************************************************/ - void GameSetTime(uint8_t hour, uint8_t minutes) { GameHour = hour; @@ -1884,7 +1866,6 @@ void GameSetTime(uint8_t hour, uint8_t minutes) * executed GAME_MAX_AIRCRAFT times on each cycle. * * *******************************************************************/ - void GameActiveAircraft(uint8_t i) { // Reset iterator when i == 0. @@ -2493,36 +2474,74 @@ void GameSelectAircraftFromList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli /* ************************************************************************************************** * - * @name: RWY_DIR GameGetRunwayDirection(uint16_t rwyHeader) + * @name: DIRECTION GameGetParkingDirection(uint16_t parkingTile) * * @author: Xavier Del Campo * - * @brief: - * Depending on runway header, runway direction is returned. + * @return: + * Depending on tile number, parking direction is returned. * * **************************************************************************************************/ -RWY_DIR GameGetRunwayDirection(uint16_t rwyHeader) +DIRECTION GameGetParkingDirection(uint16_t parkingTile) +{ + DEBUG_PRINT_VAR(parkingTile); + DEBUG_PRINT_VAR(TILE_PARKING); + DEBUG_PRINT_VAR(TILE_PARKING | TILE_MIRROR_FLAG); + DEBUG_PRINT_VAR(TILE_PARKING_2); + DEBUG_PRINT_VAR(TILE_PARKING_2 | TILE_MIRROR_FLAG); + switch (parkingTile) + { + case TILE_PARKING: + return DIR_WEST; + + case TILE_PARKING | TILE_MIRROR_FLAG: + return DIR_NORTH; + + case TILE_PARKING_2: + return DIR_EAST; + + case TILE_PARKING_2 | TILE_MIRROR_FLAG: + return DIR_SOUTH; + + default: + break; + } + + return NO_DIRECTION; +} + +/* ************************************************************************************************** + * + * @name: DIRECTION GameGetRunwayDirection(uint16_t rwyHeader) + * + * @author: Xavier Del Campo + * + * @return: + * Depending on tile number, runway direction is returned. + * + * **************************************************************************************************/ +DIRECTION GameGetRunwayDirection(uint16_t rwyHeader) { switch(GameLevelBuffer[rwyHeader]) { case TILE_RWY_START_1: - return RWY_DIR_EAST; + return DIR_EAST; case TILE_RWY_START_2: - return RWY_DIR_WEST; + return DIR_WEST; case TILE_RWY_START_1 | TILE_MIRROR_FLAG: - return RWY_DIR_SOUTH; + return DIR_SOUTH; case TILE_RWY_START_2 | TILE_MIRROR_FLAG: - return RWY_DIR_NORTH; + return DIR_NORTH; default: Serial_printf("Unknown direction for tile %d\n",rwyHeader); break; } - return RWY_INVALID_DIR; + return NO_DIRECTION; } /* ************************************************************************************************** @@ -2555,7 +2574,7 @@ void GameGetSelectedRunwayArray(uint16_t rwyHeader, uint16_t* rwyArray, size_t s { static uint16_t last_tile = 0; static uint8_t i = 0; - static RWY_DIR dir; + static DIRECTION dir; if (sz != (GAME_MAX_RWY_LENGTH * sizeof(uint16_t) )) { @@ -2581,7 +2600,7 @@ void GameGetSelectedRunwayArray(uint16_t rwyHeader, uint16_t* rwyArray, size_t s dir = GameGetRunwayDirection(rwyHeader); - if (dir == RWY_INVALID_DIR) + if (dir == NO_DIRECTION) { return; } @@ -2612,23 +2631,23 @@ void GameGetSelectedRunwayArray(uint16_t rwyHeader, uint16_t* rwyArray, size_t s switch(dir) { - case RWY_DIR_EAST: + case DIR_EAST: last_tile++; break; - case RWY_DIR_WEST: + case DIR_WEST: last_tile--; break; - case RWY_DIR_NORTH: + case DIR_NORTH: last_tile -= GameLevelColumns; break; - case RWY_DIR_SOUTH: + case DIR_SOUTH: last_tile += GameLevelColumns; break; - case RWY_INVALID_DIR: + case NO_DIRECTION: // Fall through default: Serial_printf("Invalid runway direction.\n"); @@ -2731,7 +2750,8 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli if (AircraftAddNew( ptrFlightData, aircraftIndex, - targets ) == false) + targets, + GameGetRunwayDirection(assignedRwy) ) == false) { Serial_printf("Exceeded maximum aircraft number!\n"); return; @@ -3196,21 +3216,6 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData) y_diff = (uint16_t)abs( (ptrPlayer->SelectedTile / GameLevelColumns) - (ptrPlayer->Waypoints[ptrPlayer->LastWaypointIdx] / GameLevelColumns) ); - /*Serial_printf("SelectedTile = %d, ptrPlayer->Waypoints[%d] = %d\n", - ptrPlayer->SelectedTile, - 0, - ptrPlayer->Waypoints[0] ); - - Serial_printf("X = abs(%d - %d)\n", - ptrPlayer->SelectedTile % GameLevelColumns, - (ptrPlayer->Waypoints[0] % GameLevelColumns) ); - - Serial_printf("Y = abs(%d - %d)\n", - ptrPlayer->SelectedTile / GameLevelColumns, - (ptrPlayer->Waypoints[0] / GameLevelColumns) ); - - Serial_printf("Diff = {%d, %d}\n", x_diff, y_diff);*/ - // At this point, we have to update current waypoints list. // ptrPlayer->Waypoints[ptrPlayer->WaypointIdx - 1] points to the last inserted point, // so now we have to determine how many points need to be created. @@ -3610,7 +3615,7 @@ void GameCreateTakeoffWaypoints(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli // Look for aircraft direction by searching TILE_RWY_EXIT //uint16_t currentTile = AircraftGetTileFromFlightDataIndex(aircraftIdx); //uint8_t targetsIdx = 0; - AIRCRAFT_DIRECTION aircraftDir = AircraftGetDirection(AircraftFromFlightDataIndex(aircraftIdx)); + DIRECTION aircraftDir = AircraftGetDirection(AircraftFromFlightDataIndex(aircraftIdx)); int8_t rwyStep = 0; uint16_t currentTile = 0; uint16_t targets[AIRCRAFT_MAX_TARGETS] = {0}; @@ -3618,22 +3623,22 @@ void GameCreateTakeoffWaypoints(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli switch(aircraftDir) { - case AIRCRAFT_DIR_EAST: + case DIR_EAST: //Serial_printf("EAST\n"); rwyStep = 1; break; - case AIRCRAFT_DIR_WEST: + case DIR_WEST: //Serial_printf("WEST\n"); rwyStep = -1; break; - case AIRCRAFT_DIR_NORTH: + case DIR_NORTH: //Serial_printf("NORTH\n"); rwyStep = -GameLevelColumns; break; - case AIRCRAFT_DIR_SOUTH: + case DIR_SOUTH: //Serial_printf("SOUTH\n"); rwyStep = GameLevelColumns; break; @@ -3704,32 +3709,32 @@ void GameGetRunwayEntryTile(uint8_t aircraftIdx, TYPE_RWY_ENTRY_DATA* ptrRwyEntr { if (GameLevelBuffer[currentTile + 1] == TILE_RWY_EXIT) { - ptrRwyEntry->Direction = AIRCRAFT_DIR_EAST; + ptrRwyEntry->Direction = DIR_EAST; ptrRwyEntry->rwyStep = GameLevelColumns; step = -1; } else if (GameLevelBuffer[currentTile - 1] == TILE_RWY_EXIT) { - ptrRwyEntry->Direction = AIRCRAFT_DIR_WEST; + ptrRwyEntry->Direction = DIR_WEST; ptrRwyEntry->rwyStep = -GameLevelColumns; step = 1; } else if (GameLevelBuffer[currentTile + GameLevelColumns] == TILE_RWY_EXIT) { - ptrRwyEntry->Direction = AIRCRAFT_DIR_SOUTH; + ptrRwyEntry->Direction = DIR_SOUTH; ptrRwyEntry->rwyStep = 1; step = GameLevelColumns; } else if (GameLevelBuffer[currentTile - GameLevelColumns] == TILE_RWY_EXIT) { - ptrRwyEntry->Direction = AIRCRAFT_DIR_NORTH; + ptrRwyEntry->Direction = DIR_NORTH; ptrRwyEntry->rwyStep = -1; step = -GameLevelColumns; } else { ptrRwyEntry->rwyEntryTile = 0; - ptrRwyEntry->Direction = AIRCRAFT_DIR_NO_DIRECTION; + ptrRwyEntry->Direction = NO_DIRECTION; ptrRwyEntry->rwyStep = 0; Serial_printf("GameCreateTakeoffWaypoints(): could not determine aircraft direction.\n"); return; diff --git a/Source/Game.h b/Source/Game.h index 1196193..b5a191e 100644 --- a/Source/Game.h +++ b/Source/Game.h @@ -4,14 +4,12 @@ /* ************************************* * Includes * *************************************/ - #include "Global_Inc.h" #include "GameStructures.h" /* ************************************* * Defines * *************************************/ - #define PLAYER_ONE 0 #define PLAYER_TWO 1 #define MAX_PLAYERS (PLAYER_TWO + 1) @@ -23,26 +21,14 @@ /* ************************************* * Structs and enums * *************************************/ - -typedef enum t_rwydir -{ - RWY_DIR_EAST = 0, - RWY_DIR_WEST, - RWY_DIR_NORTH, - RWY_DIR_SOUTH, - RWY_INVALID_DIR, -}RWY_DIR; - /* ************************************* * Global variables * *************************************/ - extern bool GameStartupFlag; /* ************************************* * Global prototypes * *************************************/ - void Game(bool two_players); void GameSetTime(uint8_t hour, uint8_t minutes); bool GameTwoPlayersActive(void); @@ -61,6 +47,5 @@ void GameCalculateRemainingAircraft(void); void GameAircraftCollision(uint8_t AircraftIdx); void GameStopFlight(uint8_t AicraftIdx); void GameResumeFlightFromAutoStop(uint8_t AircraftIdx); -RWY_DIR GameGetRunwayDirection(uint16_t rwyHeader); #endif //GAME_HEADER__ diff --git a/Source/GameGui.c b/Source/GameGui.c index 9ced819..ec40b1a 100644 --- a/Source/GameGui.c +++ b/Source/GameGui.c @@ -562,11 +562,6 @@ void GameGuiAircraftList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData y_offset = (short)(page_aircraft * AIRCRAFT_DATA_FLIGHT_GSGPOLY4_H);
- /*Serial_printf("ptrPlayer->ActiveAircraft = %d\n",ptrPlayer->ActiveAircraft);
- Serial_printf("ptrPlayer->SelectedAircraft = %d\n",ptrPlayer->SelectedAircraft);
- Serial_printf("ptrPlayer->FlightDataPage = %d\n",ptrPlayer->FlightDataPage);
- Serial_printf("y_offset = %d\n",y_offset);*/
-
if (GameTwoPlayersActive() != false)
{
SelectedAircraftGPoly4.y[0] = AIRCRAFT_DATA_FLIGHT_GSGPOLY4_Y0_2PLAYER;
diff --git a/Source/GameStructures.h b/Source/GameStructures.h index 82218a0..115255f 100644 --- a/Source/GameStructures.h +++ b/Source/GameStructures.h @@ -102,12 +102,12 @@ typedef enum t_livery typedef enum t_direction
{
- AIRCRAFT_DIR_NO_DIRECTION = 0,
- AIRCRAFT_DIR_NORTH,
- AIRCRAFT_DIR_SOUTH,
- AIRCRAFT_DIR_EAST,
- AIRCRAFT_DIR_WEST,
-}AIRCRAFT_DIRECTION;
+ NO_DIRECTION = 0,
+ DIR_NORTH,
+ DIR_SOUTH,
+ DIR_EAST,
+ DIR_WEST,
+}DIRECTION;
typedef enum t_aircraftAttitude
{
@@ -120,7 +120,7 @@ typedef enum t_aircraftAttitude typedef struct t_aircraftData
{
AIRCRAFT_LIVERY Livery;
- AIRCRAFT_DIRECTION Direction;
+ DIRECTION Direction;
AIRCRAFT_ATTITUDE Attitude;
FL_STATE State;
// Target tile (used to calculate direction and movement)
diff --git a/Source/Gfx.c b/Source/Gfx.c index 7a89027..42ea352 100644 --- a/Source/Gfx.c +++ b/Source/Gfx.c @@ -17,7 +17,6 @@ #define DOUBLE_BUFFERING_SWAP_Y 256 #define UPLOAD_IMAGE_FLAG 1 #define MAX_LUMINANCE 0xFF -#define ROTATE_BIT_SHIFT 12 #define GPUSTAT (*(volatile unsigned int*)0x1F801814) #define D2_CHCR (*(volatile unsigned int*)0x1F8010A8) @@ -252,41 +251,78 @@ void GfxDrawScene_Fast(void) GsDrawList(); } +/* ********************************************************************** + * + * @name: bool GfxReadyForDMATransfer(void) + * + * @author: Xavier Del Campo + * + * @return: + * true when a DMA transfer can be executed. Returns false otherwise. + * + * **********************************************************************/ bool GfxReadyForDMATransfer(void) { return ( (GPUSTAT & 1<<28) && !(D2_CHCR & 1<<24) ); } +/* ********************************************************************** + * + * @name: void GfxDrawScene(void) + * + * @author: Xavier Del Campo + * + * @brief: + * Renders all queued primitives and performs system-related actions. + * + * **********************************************************************/ void GfxDrawScene(void) { - enum - { - FPS_INFO_X = 16, - FPS_INFO_Y = 16 - }; - - while ( (SystemRefreshNeeded() == false) + while ( (SystemRefreshNeeded() == false) || (GfxIsGPUBusy() != false) ); - //~ FontPrintText(&SmallFont, FPS_INFO_X, FPS_INFO_Y, "%d/%d", SystemGetFPS(), REFRESH_FREQUENCY); - - if (MainMenuGetBCNGWLogo() != NULL) - { - GfxSortSprite(MainMenuGetBCNGWLogo()); - } - GfxDrawScene_Fast(); SystemCyclicHandler(); } +/* ********************************************************************** + * + * @name: void GfxDrawScene_Slow(void) + * + * @author: Xavier Del Campo + * + * @brief: + * Slow, blocking function which ensures GPU is ready again before + * exiting. + * + * @remarks: + * Blocking function. To be used only when absolutely needed. + * + * **********************************************************************/ void GfxDrawScene_Slow(void) { GfxDrawScene(); while (GfxIsGPUBusy() != false); } +/* ********************************************************************** + * + * @name: void GfxSortSprite(GsSprite * spr) + * + * @author: Xavier Del Campo + * + * @brief: + * Reportedly, adds a sprite to primitive list. Internal flags + * (e.g.: 1 Hz flash) are checked and special tasks are performed. + * Also, global_lum is applied to sprite's RGB values. + * + * @remarks: + * It is checked sprite fits into screen beforehand. Use GsSortSprite() + * if you need to skip this check. + * + * **********************************************************************/ void GfxSortSprite(GsSprite * spr) { uint8_t aux_r = spr->r; @@ -298,7 +334,7 @@ void GfxSortSprite(GsSprite * spr) bool has_1hz_flash = spr->attribute & GFX_1HZ_FLASH; bool has_2hz_flash = spr->attribute & GFX_2HZ_FLASH; - if ( (spr->w <= 0) || (spr->h <= 0) ) + if ( (spr->w <= 0) || (spr->h <= 0) ) { // Invalid width or heigth return; @@ -385,16 +421,48 @@ void GfxSortSprite(GsSprite * spr) spr->b = aux_b; } +/* ********************************************************************** + * + * @name: void GfxSortSprite(GsSprite * spr) + * + * @author: Xavier Del Campo + * + * @return: + * Returns global_lum value, a global variable used to dim all drawn + * sprites as needed. + * + * **********************************************************************/ uint8_t GfxGetGlobalLuminance(void) { return global_lum; } +/* ********************************************************************** + * + * @name: void GfxSetGlobalLuminance(uint8_t value) + * + * @author: Xavier Del Campo + * + * @return: + * Sets global_lum value, a global variable used to dim all drawn + * sprites as needed. + * + * **********************************************************************/ void GfxSetGlobalLuminance(uint8_t value) { global_lum = value; } +/* ********************************************************************** + * + * @name: void GfxIncreaseGlobalLuminance(int8_t step) + * + * @author: Xavier Del Campo + * + * @return: + * Increases global_lum in steps given by user, avoiding overflow. + * + * **********************************************************************/ void GfxIncreaseGlobalLuminance(int8_t step) { if ( ( (global_lum + step) < MAX_LUMINANCE ) @@ -409,16 +477,53 @@ void GfxIncreaseGlobalLuminance(int8_t step) } } +/* ********************************************************************** + * + * @name: int GfxRotateFromDegrees(int deg) + * + * @author: Xavier Del Campo + * + * @brief: + * Performs automatic conversion between PSX rotate units and degrees. + * + * @return: + * PSX rotate units to rotate (1 degree == 4096 rotate units). + * + * **********************************************************************/ int GfxRotateFromDegrees(int deg) { return deg << ROTATE_BIT_SHIFT; } +/* ********************************************************************** + * + * @name: bool GfxIsGPUBusy(void) + * + * @author: Xavier Del Campo + * + * @return: + * true if GPU can't be used, false otherwise. + * + * **********************************************************************/ bool GfxIsGPUBusy(void) { return (GsIsDrawing() || gfx_busy || (GfxReadyForDMATransfer() == false) ); } +/* ********************************************************************** + * + * @name: bool GfxSpriteFromFile(char* fname, GsSprite * spr) + * + * @author: Xavier Del Campo + * + * @brief: + * Given input file path, it loads file contents into a GsSprite + * instance. + * + * @return: + * false if an error happened, true otherwise. + * + * **********************************************************************/ bool GfxSpriteFromFile(char* fname, GsSprite * spr) { GsImage gsi; @@ -438,15 +543,23 @@ bool GfxSpriteFromFile(char* fname, GsSprite * spr) gfx_busy = false; - DEBUG_PRINT_VAR(spr->tpage); - DEBUG_PRINT_VAR(spr->u); - DEBUG_PRINT_VAR(spr->v); - DEBUG_PRINT_VAR(spr->w); - DEBUG_PRINT_VAR(spr->h); - return true; } +/* ********************************************************************** + * + * @name: bool GfxCLUTFromFile(char* fname) + * + * @author: Xavier Del Campo + * + * @brief: + * Given input file path, it loads file contents and uploads CLUT + * data into VRAM. + * + * @return: + * false if an error happened, true otherwise. + * + * **********************************************************************/ bool GfxCLUTFromFile(char* fname) { GsImage gsi; @@ -469,6 +582,17 @@ bool GfxCLUTFromFile(char* fname) return true; } +/* ********************************************************************** + * + * @name: bool GfxIsInsideScreenArea(short x, short y, short w, short h) + * + * @author: Xavier Del Campo + * + * @return: + * true if polygon determined by XYWH data is inside screen area, + * false otherwise. + * + * **********************************************************************/ bool GfxIsInsideScreenArea(short x, short y, short w, short h) { if ( ( (x + w) >= 0) @@ -485,6 +609,16 @@ bool GfxIsInsideScreenArea(short x, short y, short w, short h) return false; } +/* ********************************************************************** + * + * @name: bool GfxIsSpriteInsideScreenArea(GsSprite * spr) + * + * @author: Xavier Del Campo + * + * @return: + * true if sprite is inside screen area, false otherwise. + * + * **********************************************************************/ bool GfxIsSpriteInsideScreenArea(GsSprite * spr) { return GfxIsInsideScreenArea(spr->x, spr->y, spr->w, spr->h); diff --git a/Source/Gfx.h b/Source/Gfx.h index 0bbce7b..48cc2db 100644 --- a/Source/Gfx.h +++ b/Source/Gfx.h @@ -22,6 +22,7 @@ #define GFX_1HZ_FLASH (1<<7) #define GFX_2HZ_FLASH (1<<8) #define FULL_LUMINANCE 0xFF +#define ROTATE_BIT_SHIFT 12 // 4096 = 2^12 /* ************************************* * Global prototypes diff --git a/Source/Global_Inc.h b/Source/Global_Inc.h index 9585cc1..cb36f80 100644 --- a/Source/Global_Inc.h +++ b/Source/Global_Inc.h @@ -4,7 +4,6 @@ /* ************************************* * Includes * *************************************/ - #include <psx.h> #include <stdio.h> #include <psxsio.h> diff --git a/Source/LoadMenu.c b/Source/LoadMenu.c index d0d5fc5..e7914a9 100644 --- a/Source/LoadMenu.c +++ b/Source/LoadMenu.c @@ -490,14 +490,14 @@ void LoadMenuLoadFileList( const char* fileList[], void* dest[], //Restore original file path in order to load file strncpy(strCurrentFile, aux_file_name, 100); - if (strncmp(extension,"TIM",3) == 0) + if (strncmp(extension, "TIM", 3) == 0) { if (GfxSpriteFromFile(strCurrentFile, dest[fileLoadedCount]) == false) { Serial_printf("Could not load image file \"%s\"!\n", strCurrentFile); } } - else if (strncmp(extension,"CLT",3) == 0) + else if (strncmp(extension, "CLT", 3) == 0) { if (dest[fileLoadedCount] != NULL) { @@ -509,21 +509,21 @@ void LoadMenuLoadFileList( const char* fileList[], void* dest[], Serial_printf("Could not load CLUT file \"%s\"!\n", strCurrentFile); } } - else if (strncmp(extension,"VAG",3) == 0) + else if (strncmp(extension, "VAG", 3) == 0) { if (SfxUploadSound(strCurrentFile, dest[fileLoadedCount]) == false) { Serial_printf("Could not load sound file \"%s\"!\n", strCurrentFile); } } - else if (strncmp(extension,"FNT",3) == 0) + else if (strncmp(extension, "FNT", 3) == 0) { if (FontLoadImage(strCurrentFile, dest[fileLoadedCount]) == false) { Serial_printf("Could not load font file \"%s\"!\n", strCurrentFile); } } - else if (strncmp(extension,"PLT",3) == 0) + else if (strncmp(extension, "PLT", 3) == 0) { if (PltParserLoadFile(strCurrentFile, dest[fileLoadedCount]) == false) { diff --git a/Source/MainMenuBtnAni.c b/Source/MainMenuBtnAni.c index fd01220..f9d9923 100644 --- a/Source/MainMenuBtnAni.c +++ b/Source/MainMenuBtnAni.c @@ -1,21 +1,17 @@ /* ************************************* * Includes * *************************************/ - #include "MainMenuBtnAni.h" /* ************************************* * Defines * *************************************/ - /* ************************************* * Global prototypes * *************************************/ - /* ************************************* * Global variables * *************************************/ - short MainMenuBtnAni[] = { 0, diff --git a/Source/MainMenuBtnAni.h b/Source/MainMenuBtnAni.h index 8204f02..f4bb763 100644 --- a/Source/MainMenuBtnAni.h +++ b/Source/MainMenuBtnAni.h @@ -5,21 +5,17 @@ /* ************************************* * Includes * *************************************/ - #include "Global_Inc.h" /* ************************************* * Defines * *************************************/ - /* ************************************* * Global prototypes * *************************************/ - /* ************************************* * Global variables * *************************************/ - extern short MainMenuBtnAni[]; extern size_t MainMenuBtnAni_sz; diff --git a/Source/MapEditor/MapEditor.pro.user b/Source/MapEditor/MapEditor.pro.user index 5f8e915..91bb581 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-12-29T02:58:01. -->
+<!-- Written by QtCreator 4.0.3, 2017-12-29T17:58:10. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
diff --git a/Source/MapEditor/mainwindow.cpp b/Source/MapEditor/mainwindow.cpp index 89687eb..ed0bdc9 100644 --- a/Source/MapEditor/mainwindow.cpp +++ b/Source/MapEditor/mainwindow.cpp @@ -12,12 +12,16 @@ MainWindow::MainWindow(QWidget *parent) : {
ui->setupUi(this);
- connect(ui->LoadMap_Btn, SIGNAL(released()), this, SLOT(onLoadMap()));
- connect(ui->CreateMap_Btn, SIGNAL(released()), this, SLOT(onCreateMap()));
- connect(ui->saveMap_Btn, SIGNAL(released()), this, SLOT(onSaveMap(void)));
- connect(gscene, SIGNAL(positionClicked(QPointF)), this, SLOT(onMapItemClicked(QPointF)));
- connect(gscene, SIGNAL(noItemSelected(void)), this, SLOT(onNoItemSelected(void)));
- connect(gscene, SIGNAL(updateSelectedItem(void)), this, SLOT(onListItemSelected(void)));
+ ui->centralWidget->setWindowTitle("Airport Map Editor");
+
+ connect(ui->LoadMap_Btn, SIGNAL(released()), this, SLOT(onLoadMap()));
+ connect(ui->CreateMap_Btn, SIGNAL(released()), this, SLOT(onCreateMap()));
+ connect(ui->saveMap_Btn, SIGNAL(released()), this, SLOT(onSaveMap(void)));
+ connect(ui->showNumbers_Checkbox, SIGNAL(stateChanged(int)), this, SLOT(onShowNumbers(int)));
+
+ connect(gscene, SIGNAL(positionClicked(QPointF)), this, SLOT(onMapItemClicked(QPointF)));
+ connect(gscene, SIGNAL(noItemSelected(void)), this, SLOT(onNoItemSelected(void)));
+ connect(gscene, SIGNAL(updateSelectedItem(void)), this, SLOT(onListItemSelected(void)));
appSettings();
loadTilesetData();
@@ -29,6 +33,11 @@ MainWindow::~MainWindow() delete gscene;
}
+void MainWindow::onShowNumbers(int)
+{
+ onProcessMapFile(map_buffer);
+}
+
void MainWindow::onMapItemClicked(QPointF pos)
{
QPoint realPos;
@@ -314,6 +323,15 @@ void MainWindow::onProcessMapFile(QByteArray data) it->setX(x);
it->setY(y);
+
+ if (ui->showNumbers_Checkbox->isChecked() == true)
+ {
+ QGraphicsTextItem* io = new QGraphicsTextItem();
+ io->setPos(x + (TILE_SIZE / 4), y);
+ io->setPlainText(QString::number(i + (j * level_size)));
+
+ gscene->addItem(io);
+ }
}
}
diff --git a/Source/MapEditor/mainwindow.h b/Source/MapEditor/mainwindow.h index 52bb957..4926772 100644 --- a/Source/MapEditor/mainwindow.h +++ b/Source/MapEditor/mainwindow.h @@ -46,6 +46,7 @@ protected slots: void onNoItemSelected(void);
void onListItemSelected(void);
void onSaveMap(void);
+ void onShowNumbers(int);
};
#endif // MAINWINDOW_H
diff --git a/Source/MapEditor/mainwindow.ui b/Source/MapEditor/mainwindow.ui index 54bcbb4..098a9f8 100644 --- a/Source/MapEditor/mainwindow.ui +++ b/Source/MapEditor/mainwindow.ui @@ -7,7 +7,7 @@ <x>0</x>
<y>0</y>
<width>920</width>
- <height>582</height>
+ <height>605</height>
</rect>
</property>
<property name="windowTitle">
@@ -24,7 +24,38 @@ <bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="3" column="0">
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="showNumbers_Checkbox">
+ <property name="text">
+ <string>Show numbers on map</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="mirror_CheckBox">
+ <property name="text">
+ <string>Mirror tile</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="2">
+ <widget class="QGraphicsView" name="graphicsView">
+ <property name="minimumSize">
+ <size>
+ <width>640</width>
+ <height>480</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="CreateMap_Btn">
@@ -49,16 +80,6 @@ </item>
</layout>
</item>
- <item row="0" column="2">
- <widget class="QGraphicsView" name="graphicsView">
- <property name="minimumSize">
- <size>
- <width>640</width>
- <height>480</height>
- </size>
- </property>
- </widget>
- </item>
<item row="0" column="0">
<widget class="QListWidget" name="listWidget">
<property name="maximumSize">
@@ -69,13 +90,6 @@ </property>
</widget>
</item>
- <item row="1" column="0">
- <widget class="QCheckBox" name="mirror_CheckBox">
- <property name="text">
- <string>Mirror tile</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
diff --git a/Source/MapEditor/settings.ini b/Source/MapEditor/settings.ini index af1583e..dc943fa 100644 --- a/Source/MapEditor/settings.ini +++ b/Source/MapEditor/settings.ini @@ -1,2 +1,2 @@ [app_settings]
-last_dir=C:/cygwin/home/Xavier/Airport/Levels/LEVEL2.LVL
+last_dir=C:/cygwin/home/Xavier/Airport/Levels/LEVEL2_.LVL
diff --git a/Source/Menu.c b/Source/Menu.c index 68c8b86..088d46e 100644 --- a/Source/Menu.c +++ b/Source/Menu.c @@ -124,7 +124,6 @@ static void MenuTestCheat(void); static GsSprite MenuSpr; static GsSprite MenuStarSpr; -static GsSprite BcnGWSpr; static SsVag BellSnd; static SsVag AcceptSnd; static TYPE_CHEAT TestCheat; @@ -138,7 +137,6 @@ static const char* MainMenuFiles[] = { "cdrom:\\DATA\\SPRITES\\MAINMENU.TIM;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" , @@ -154,7 +152,6 @@ static void* MainMenuDest[] = { (GsSprite*)&MenuSpr , (SsVag*)&AcceptSnd , (GsSprite*)&PSXButtons , (GsSprite*)&MenuStarSpr , - (GsSprite*)&BcnGWSpr , #ifndef NO_INTRO (GsSprite*)&PsxDisk , (GsSprite*)&PSXSDKIntroFont , @@ -246,10 +243,6 @@ 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; @@ -321,18 +314,6 @@ void MenuCheatInit(void) PadAddCheat(&SerialCheat); } -GsSprite* MainMenuGetBCNGWLogo(void) -{ - if (BcnGWSpr_set != false) - { - return &BcnGWSpr; - } - else - { - return NULL; - } -} - void MainMenu(void) { MainMenuInit(); @@ -358,15 +339,6 @@ void MainMenu(void) MenuStarSpr.rotate += ROTATE_ONE; - //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) { case PLAY_OPTIONS_LEVEL: @@ -587,6 +559,7 @@ void MainMenuDrawButton(TYPE_MMBtn * btn) MenuSpr.g = NORMAL_LUMINANCE >> 1; MenuSpr.b = NORMAL_LUMINANCE >> 1; } + break; default: diff --git a/Source/Menu.h b/Source/Menu.h index 2c34ff4..6244602 100644 --- a/Source/Menu.h +++ b/Source/Menu.h @@ -4,18 +4,14 @@ /* ************************************* * Includes * *************************************/ - #include "Gfx.h" /* ************************************* * Defines * *************************************/ - /* ************************************* * Global prototypes * *************************************/ - void MainMenu(void); -GsSprite* MainMenuGetBCNGWLogo(void); #endif //MENU_HEADER__ diff --git a/Source/PSXSDKIntro.c b/Source/PSXSDKIntro.c index ce33727..49e663f 100644 --- a/Source/PSXSDKIntro.c +++ b/Source/PSXSDKIntro.c @@ -1,7 +1,6 @@ /* ************************************* * Includes * *************************************/ - #include "PSXSDKIntro.h" #include "System.h" #include "Gfx.h" @@ -10,11 +9,9 @@ /* ************************************* * Defines * *************************************/ - /* ************************************** * Structs and enums * * *************************************/ - enum { PSX_W = 48, @@ -105,7 +102,6 @@ enum /* ************************************* * Local Prototypes * *************************************/ - static void PSXSDKIntroDrawConsole(void); static void PSXSDKIntroRunTimers(void); static void PSXSDKIntroDrawDisk(void); @@ -115,7 +111,6 @@ static void PSXSDKIntroDrawChar(short x, short y, char ch); /* ************************************* * Local variables * *************************************/ - // Events static bool PSXSDKIntroCloseShellEvent; static bool PSXSDKIntroCloseShellEventReminder; @@ -133,7 +128,6 @@ static char* strPSXSDKIntroAuthor = {"BY NEXTVOLUME"}; /* ************************************* * Global variables * *************************************/ - GsSprite PsxDisk; GsSprite PSXSDKIntroFont; GsSprite GPL_Logo; diff --git a/Source/PSXSDKIntro.h b/Source/PSXSDKIntro.h index 8f62606..a0d662d 100644 --- a/Source/PSXSDKIntro.h +++ b/Source/PSXSDKIntro.h @@ -4,23 +4,19 @@ /* ************************************* * Includes * *************************************/ - #include "Global_Inc.h" /* ************************************* * Defines *************************************/ - /* ************************************* * Global prototypes * *************************************/ - void PSXSDKIntro(void); /* ************************************* * Global variables * *************************************/ - extern GsSprite PsxDisk; extern GsSprite PSXSDKIntroFont; extern GsSprite GPL_Logo; diff --git a/Source/Pad.c b/Source/Pad.c index 7704107..f2b9ca8 100644 --- a/Source/Pad.c +++ b/Source/Pad.c @@ -1,7 +1,6 @@ /* ************************************* * Includes * *************************************/ - #include "Pad.h" #include "System.h" #include "Timer.h" @@ -43,7 +42,6 @@ enum }; - /* ************************************* * Local Prototypes * *************************************/ diff --git a/Source/PltParser.c b/Source/PltParser.c index f9fffb0..8bcbc0f 100644 --- a/Source/PltParser.c +++ b/Source/PltParser.c @@ -23,6 +23,7 @@ /* ************************************* * Local Prototypes * *************************************/ + static void PltParserResetBuffers(TYPE_FLIGHT_DATA* ptrFlightData); bool PltParserLoadFile(char* strPath, TYPE_FLIGHT_DATA* ptrFlightData) @@ -92,7 +93,7 @@ bool PltParserLoadFile(char* strPath, TYPE_FLIGHT_DATA* ptrFlightData) int k; dprintf("Buffer: "); - + for (k = 0; k < strlen(buffer); k++) { dprintf("0x%02X ", buffer[k]); diff --git a/Source/PltParser.h b/Source/PltParser.h index 58e3bb1..c622e2c 100644 --- a/Source/PltParser.h +++ b/Source/PltParser.h @@ -4,27 +4,22 @@ /* ************************************* * Includes * *************************************/ - #include "Global_Inc.h" #include "GameStructures.h" /* ************************************* * Defines * *************************************/ - /* ************************************** * Structs and enums * * *************************************/ - /* ************************************* * Global prototypes * *************************************/ - bool PltParserLoadFile(char* strPath, TYPE_FLIGHT_DATA* ptrFlightData); uint8_t* PltParserGenerateFile(TYPE_PLT_CONFIG* ptrPltConfig); /* ************************************* * Global variables * *************************************/ - #endif //PLT_PARSER__ diff --git a/Source/Sfx.c b/Source/Sfx.c index a79a308..48d6bed 100644 --- a/Source/Sfx.c +++ b/Source/Sfx.c @@ -1,13 +1,11 @@ /* ************************************* * Includes * *************************************/ - #include "Sfx.h" /* ************************************* * Defines * *************************************/ - #define MAX_VOLUME SPU_MAXVOL #define SILENT 0 @@ -16,11 +14,9 @@ /* ************************************* * Local Prototypes * *************************************/ - /* ************************************* * Local Variables * *************************************/ - static uint8_t voiceIndex; static uint16_t SfxGlobalVolumeReduction; diff --git a/Source/Sfx.h b/Source/Sfx.h index 30903aa..4c248c7 100644 --- a/Source/Sfx.h +++ b/Source/Sfx.h @@ -4,18 +4,15 @@ /* ************************************* * Includes * *************************************/ - #include "Global_Inc.h" #include "System.h" /* ************************************* * Defines * *************************************/ - /* ************************************* * Structs and enums * *************************************/ - typedef enum t_musicTracks { INTRO_TRACK = 2, @@ -28,7 +25,6 @@ typedef enum t_musicTracks /* ************************************* * Global prototypes * *************************************/ - void SfxPlaySound(SsVag * sound); bool SfxUploadSound(char* file_path, SsVag * vag); void SfxPlayTrack(MUSIC_TRACKS track); diff --git a/Source/System.c b/Source/System.c index 8530d6c..dc54ecb 100644 --- a/Source/System.c +++ b/Source/System.c @@ -1,7 +1,6 @@ /* ************************************* * Includes * *************************************/ - #include "System.h" #include "Pad.h" #include "Menu.h" @@ -13,7 +12,6 @@ /* ************************************* * Defines * *************************************/ - #define FILE_BUFFER_SIZE (128 << 10) // 128 KB #define END_STACK_PATTERN (uint32_t) 0x18022015 @@ -24,7 +22,6 @@ /* ************************************* * Local Prototypes * *************************************/ - static void SystemCheckTimer(bool* timer, uint64_t* last_timer, uint8_t step); static void SystemSetStackPattern(void); static void ISR_RootCounter2(void); @@ -32,7 +29,6 @@ static void ISR_RootCounter2(void); /* ************************************* * Local Variables * *************************************/ - //Buffer to store any kind of files. It supports files up to 128 kB static uint8_t file_buffer[FILE_BUFFER_SIZE]; //Global timer (called by interrupt) @@ -69,7 +65,6 @@ static unsigned char sine_counter; * @remarks: To be called before main loop. * * *******************************************************************/ - void SystemInit(void) { //Reset global timer @@ -134,9 +129,18 @@ void SystemInit(void) static volatile uint16_t u16_0_01seconds_cnt; +/* ******************************************************************* + * + * @name: void ISR_RootCounter2(void) + * + * @author: Xavier Del Campo + * + * @brief: + * Executed on RCnt2 ISR. + * + * *******************************************************************/ void ISR_RootCounter2(void) { - Serial_printf("YO\n"); u16_0_01seconds_cnt++; } @@ -155,7 +159,6 @@ void ISR_RootCounter2(void) * It is recommended to call it once user has pressed any key. * * *******************************************************************/ - void SystemSetRandSeed(void) { if (rand_seed == false) @@ -183,7 +186,6 @@ void SystemSetRandSeed(void) * Reportedly, returns whether rand seed has already been set. * * *******************************************************************/ - bool SystemIsRandSeedSet(void) { return rand_seed; @@ -203,7 +205,6 @@ bool SystemIsRandSeedSet(void) * Returns whether VSync flag has been enabled. * * *******************************************************************/ - bool SystemRefreshNeeded(void) { return refresh_needed; @@ -222,7 +223,6 @@ bool SystemRefreshNeeded(void) * 60 times a second in NTSC mode. * * *******************************************************************/ - void ISR_SystemDefaultVBlank(void) { if (System1SecondTick() != false) @@ -246,7 +246,6 @@ void ISR_SystemDefaultVBlank(void) * Called by Game module in order to calculate frames per second. * * *******************************************************************/ - void SystemAcknowledgeFrame(void) { temp_fps++; @@ -266,7 +265,6 @@ void SystemAcknowledgeFrame(void) * To be called only once, preferibly on SystemCyclic(). * * *******************************************************************/ - void SystemCalculateSine(void) { enum @@ -312,7 +310,6 @@ void SystemCalculateSine(void) * a parabola) function to be used wherever you want. * * *******************************************************************/ - unsigned char SystemGetSineValue(void) { return sine_counter; @@ -331,7 +328,6 @@ unsigned char SystemGetSineValue(void) * Usually called from ISR_SystemDefaultVBlank(). * * *******************************************************************/ - void SystemIncreaseGlobalTimer(void) { global_timer++; @@ -346,7 +342,6 @@ void SystemIncreaseGlobalTimer(void) * @brief: Returns internal global timer value. * * *******************************************************************/ - uint64_t SystemGetGlobalTimer(void) { return global_timer; @@ -361,7 +356,6 @@ uint64_t SystemGetGlobalTimer(void) * @brief: Resets VBlank IRQ flag. * * *******************************************************************/ - void SystemDisableScreenRefresh(void) { refresh_needed = false; @@ -377,7 +371,6 @@ void SystemDisableScreenRefresh(void) * set each second. * * *******************************************************************/ - bool System1SecondTick(void) { return one_second_timer; @@ -393,7 +386,6 @@ bool System1SecondTick(void) * set every 100 milliseconds. * * *******************************************************************/ - bool System100msTick(void) { return hundred_ms_timer; @@ -409,7 +401,6 @@ bool System100msTick(void) * set every 500 milliseconds. * * *******************************************************************/ - bool System500msTick(void) { return five_hundred_ms_timer; @@ -426,7 +417,6 @@ bool System500msTick(void) * @remarks: 1 second, 500 ms and 100 ms ticks get updated here. * * *******************************************************************/ - void SystemRunTimers(void) { static uint64_t last_one_second_tick; @@ -453,7 +443,6 @@ void SystemRunTimers(void) * @brief: Checks if needed time step has been elapsed. If true, flag gets set. * * *******************************************************************************/ - void SystemCheckTimer(bool* timer, uint64_t* last_timer, uint8_t step) { if (*timer != false) @@ -480,7 +469,6 @@ void SystemCheckTimer(bool* timer, uint64_t* last_timer, uint8_t step) * @return: true if file has been loaded successfully, false otherwise. * * ****************************************************************************************/ - bool SystemLoadFileToBuffer(char* fname, uint8_t* buffer, uint32_t szBuffer) { #ifdef SERIAL_INTERFACE @@ -587,7 +575,6 @@ bool SystemLoadFileToBuffer(char* fname, uint8_t* buffer, uint32_t szBuffer) * @return: true if file has been loaded successfully, false otherwise. * * ****************************************************************************************/ - bool SystemLoadFile(char*fname) { return SystemLoadFileToBuffer(fname,file_buffer,sizeof(file_buffer)); @@ -602,7 +589,6 @@ bool SystemLoadFile(char*fname) * @return: Reportedly, returns internal buffer initial address. * * *****************************************************************/ - uint8_t* SystemGetBufferAddress(void) { return file_buffer; @@ -617,7 +603,6 @@ uint8_t* SystemGetBufferAddress(void) * @return: Fills internal buffer with zeros * * *****************************************************************/ - void SystemClearBuffer(void) { memset(file_buffer, 0, sizeof(file_buffer)); @@ -632,7 +617,6 @@ void SystemClearBuffer(void) * @return: halts program execution for n-"cycles" * * *****************************************************************/ - void SystemWaitCycles(uint32_t cycles) { uint64_t currentTime = global_timer; @@ -652,7 +636,6 @@ void SystemWaitCycles(uint32_t cycles) * you will predictable values otherwise! * * *****************************************************************/ - uint32_t SystemRand(uint32_t min, uint32_t max) { if (rand_seed == false) @@ -674,7 +657,6 @@ uint32_t SystemRand(uint32_t min, uint32_t max) * @remarks: emergency mode is set once that a controller is unplugged. * * ***********************************************************************/ - void SystemSetEmergencyMode(bool value) { emergency_mode = value; @@ -689,7 +671,6 @@ void SystemSetEmergencyMode(bool value) * @return: returns emergency mode flag. * * ***********************************************************************/ - bool SystemGetEmergencyMode(void) { return emergency_mode; @@ -704,7 +685,6 @@ bool SystemGetEmergencyMode(void) * @return: returns system busy flag. * * ***********************************************************************/ - volatile bool SystemIsBusy(void) { return system_busy; @@ -721,7 +701,6 @@ volatile bool SystemIsBusy(void) * @return: true if value is contained inside buffer, false otherwise. * * ****************************************************************************/ - bool SystemContains_u8(uint8_t value, uint8_t* buffer, size_t sz) { size_t i = 0; @@ -749,7 +728,6 @@ bool SystemContains_u8(uint8_t value, uint8_t* buffer, size_t sz) * @return: true if value is contained inside buffer, false otherwise. * * ****************************************************************************/ - bool SystemContains_u16(uint16_t value, uint16_t* buffer, size_t sz) { size_t i = 0; @@ -776,7 +754,6 @@ bool SystemContains_u16(uint16_t value, uint16_t* buffer, size_t sz) * @return: true if they are equal, false otherwise. * * ****************************************************************************************/ - bool SystemArrayCompare(unsigned short* arr1, unsigned short* arr2, size_t sz) { size_t i; @@ -801,7 +778,6 @@ bool SystemArrayCompare(unsigned short* arr1, unsigned short* arr2, size_t sz) * @brief: Prints stack usage in percentage via dprintf calls. * * ****************************************************************************************/ - void SystemPrintStackPointerAddress(void) { #ifdef PSXSDK_DEBUG // Used to avoid unused variable warning @@ -835,7 +811,6 @@ void SystemPrintStackPointerAddress(void) * overflow has been caused, and application returns to a safe state. * * ****************************************************************************************/ - void SystemCheckStack(void) { uint32_t * ptrStack = BEGIN_STACK_ADDRESS; @@ -863,7 +838,6 @@ void SystemCheckStack(void) * overflow during execution. * * ****************************************************************************************/ - void SystemSetStackPattern(void) { uint32_t * ptrStack = BEGIN_STACK_ADDRESS; @@ -884,7 +858,6 @@ void SystemSetStackPattern(void) * @return Index for a string "str" inside "array". -1 if it could not be found. * * ****************************************************************************************/ - int32_t SystemIndexOfStringArray(char* str, char** array) { int32_t i; @@ -914,7 +887,6 @@ int32_t SystemIndexOfStringArray(char* str, char** array) * @return Index for a variable "value" inside "array". -1 if it could not be found. * * ****************************************************************************************/ - int32_t SystemIndexOf_U16(uint16_t value, uint16_t* array, uint32_t sz) { int32_t i; @@ -943,7 +915,6 @@ int32_t SystemIndexOf_U16(uint16_t value, uint16_t* array, uint32_t sz) * * ****************************************************************************************/ - int32_t SystemIndexOf_U8(uint8_t value, uint8_t* array, uint32_t from, uint32_t sz) { int32_t i; @@ -968,7 +939,6 @@ int32_t SystemIndexOf_U8(uint8_t value, uint8_t* array, uint32_t from, uint32_t * @return: Frames per second * * ****************************************************************************************/ - volatile uint8_t SystemGetFPS(void) { return fps; @@ -984,7 +954,6 @@ volatile uint8_t SystemGetFPS(void) * * * ****************************************************************************************/ - void SystemCyclicHandler(void) { UpdatePads(); @@ -1016,7 +985,6 @@ void SystemCyclicHandler(void) * e.g.: when reading files from CD-ROM. * * ****************************************************************************************/ - void SystemDisableVBlankInterrupt(void) { I_MASK &= ~(0x0001); @@ -1032,7 +1000,6 @@ void SystemDisableVBlankInterrupt(void) * * * ****************************************************************************************/ - void SystemEnableVBlankInterrupt(void) { I_MASK |= (0x0001); @@ -1048,7 +1015,6 @@ void SystemEnableVBlankInterrupt(void) * located at memory address 0x801A0000 * * ****************************************************************************************/ - void SystemReturnToLoader(void) { Serial_printf("Returning to loader...\n"); @@ -1070,7 +1036,6 @@ void SystemReturnToLoader(void) * top of all drawn primitives for debugging/development purposes. * * ****************************************************************************************/ - void SystemDevMenuToggle(void) { devmenu_flag = devmenu_flag? false: true; @@ -1085,7 +1050,6 @@ void SystemDevMenuToggle(void) * @brief: Enables bit 6 from I_MASK (0x1F801074)/IRQ6 RCNT2 (System clock / 8) * * ****************************************************************************************/ - void SystemEnableRCnt2Interrupt(void) { I_MASK |= 1<<6; @@ -1101,7 +1065,6 @@ void SystemEnableRCnt2Interrupt(void) * @brief: Disables bit 6 from I_MASK (0x1F801074)/IRQ6 RCNT2 (System clock / 8) * * ****************************************************************************************/ - void SystemDisableRCnt2Interrupt(void) { I_MASK &= ~(1<<6); @@ -1116,7 +1079,6 @@ void SystemDisableRCnt2Interrupt(void) * @brief: Shows information on top of all drawn primitives for debugging/development purposes. * * ****************************************************************************************/ - void SystemDevMenu(void) { enum diff --git a/Source/System.h b/Source/System.h index aa5aebe..6938d6a 100644 --- a/Source/System.h +++ b/Source/System.h @@ -4,21 +4,18 @@ /* ************************************** * Includes * * **************************************/ - #include "Global_Inc.h" #include "GameStructures.h" /* ************************************** * Defines * * **************************************/ - #define TIMER_PRESCALER_1_SECOND 10 #define TIMER_PRESCALER_1_MINUTE (TIMER_PRESCALER_1_SECOND * 60) /* ************************************** * Global Prototypes * * **************************************/ - // Calls PSXSDK init routines void SystemInit(void); @@ -136,5 +133,4 @@ unsigned char SystemGetSineValue(void); /* ************************************** * Global Variables * * **************************************/ - #endif //SYSTEM_HEADER__ diff --git a/Source/main.c b/Source/main.c index e025f22..d711c5f 100644 --- a/Source/main.c +++ b/Source/main.c @@ -1,7 +1,6 @@ /* ************************************* * Includes * *************************************/ - #include "Global_Inc.h" #include "Menu.h" #include "System.h" @@ -9,11 +8,19 @@ /* ************************************* * Defines * *************************************/ - /* ************************************* * Local Prototypes * *************************************/ - +/* ********************************************************************************************** + * + * @name: int main(void) + * + * @author: Xavier Del Campo + * + * @brief: + * First function to be executed. + * + * **********************************************************************************************/ int main(void) { //System initialization |
