Some important bugfixes.
Added BUILDING_ATC_LOC. Added more levels.
This commit is contained in:
parent
0b60fe23cd
commit
9cbaf49e93
|
@ -163,6 +163,7 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* const ptrFlightData,
|
|||
|
||||
ptrAircraft->IsoPos.z = targets[0] % level_columns;
|
||||
ptrAircraft->IsoPos.z <<= TILE_SIZE_BIT_SHIFT - 2;
|
||||
ptrAircraft->IsoPos.z += 8;
|
||||
ptrAircraft->IsoPos.z = fix16_from_int(ptrAircraft->IsoPos.z);
|
||||
break;
|
||||
|
||||
|
@ -176,6 +177,7 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* const ptrFlightData,
|
|||
|
||||
ptrAircraft->IsoPos.z = targets[0] / level_columns;
|
||||
ptrAircraft->IsoPos.z <<= TILE_SIZE_BIT_SHIFT - 2;
|
||||
ptrAircraft->IsoPos.z += 8;
|
||||
ptrAircraft->IsoPos.z = fix16_from_int(ptrAircraft->IsoPos.z);
|
||||
break;
|
||||
|
||||
|
@ -253,7 +255,7 @@ static AIRCRAFT_LIVERY AircraftLiveryFromFlightNumber(char* strFlightNumber)
|
|||
int32_t liveryIndex;
|
||||
char strLivery[4];
|
||||
|
||||
memset(strLivery, 0, 4 * sizeof (char) );
|
||||
memset(strLivery, 0, ARRAY_SIZE(strLivery) );
|
||||
|
||||
strncpy(strLivery, strFlightNumber, 3);
|
||||
|
||||
|
|
|
@ -28,19 +28,19 @@ long_line_behaviour=1
|
|||
long_line_column=120
|
||||
|
||||
[files]
|
||||
current_page=4
|
||||
current_page=32
|
||||
FILE_NAME_0=29974;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FAircraft.c;0;4
|
||||
FILE_NAME_1=5265;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FCamera.c;0;4
|
||||
FILE_NAME_2=4555;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FEndAnimation.c;0;4
|
||||
FILE_NAME_3=6794;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FFont.c;0;4
|
||||
FILE_NAME_4=29884;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FGame.c;0;4
|
||||
FILE_NAME_5=43334;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FGameGui.c;0;4
|
||||
FILE_NAME_4=40052;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FGame.c;0;4
|
||||
FILE_NAME_5=38072;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FGameGui.c;0;4
|
||||
FILE_NAME_6=3129;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FGfx.c;0;4
|
||||
FILE_NAME_7=14837;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FLoadMenu.c;0;4
|
||||
FILE_NAME_8=717;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2Fmain.c;0;4
|
||||
FILE_NAME_9=745;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMainMenuBtnAni.c;0;4
|
||||
FILE_NAME_10=30632;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMemCard.c;0;4
|
||||
FILE_NAME_11=20468;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMenu.c;0;4
|
||||
FILE_NAME_11=3620;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMenu.c;0;4
|
||||
FILE_NAME_12=3904;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMessage.c;0;4
|
||||
FILE_NAME_13=11137;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FPad.c;0;4
|
||||
FILE_NAME_14=10976;C;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FPltParser.c;0;4
|
||||
|
@ -61,7 +61,7 @@ FILE_NAME_28=424;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FGlobal
|
|||
FILE_NAME_29=630;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FLoadMenu.h;0;4
|
||||
FILE_NAME_30=559;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMainMenuBtnAni.h;0;4
|
||||
FILE_NAME_31=4622;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMemCard.h;0;4
|
||||
FILE_NAME_32=387;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMenu.h;0;4
|
||||
FILE_NAME_32=253;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMenu.h;0;4
|
||||
FILE_NAME_33=806;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMessage.h;0;4
|
||||
FILE_NAME_34=1731;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FPad.h;0;4
|
||||
FILE_NAME_35=762;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FPltParser.h;0;4
|
||||
|
@ -70,7 +70,7 @@ FILE_NAME_37=490;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FSerial
|
|||
FILE_NAME_38=815;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FSfx.h;0;4
|
||||
FILE_NAME_39=4207;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FSystem.h;0;4
|
||||
FILE_NAME_40=1066;C++;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FTimer.h;0;4
|
||||
FILE_NAME_41=3168;Make;0;EUTF-8;1;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMakefile;0;4
|
||||
FILE_NAME_41=2404;Make;0;EUTF-8;1;1;0;%2Fhome%2Fxavier%2FAirport%2FSource%2FMakefile;0;4
|
||||
FILE_NAME_42=319;None;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FLevels%2FLEVEL3.PLT;0;4
|
||||
FILE_NAME_43=319;None;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FLevels%2FEASY.PLT;0;4
|
||||
FILE_NAME_44=319;None;0;EUTF-8;0;1;0;%2Fhome%2Fxavier%2FAirport%2FLevels%2FLEVEL1.PLT;0;4
|
||||
|
|
Binary file not shown.
Binary file not shown.
229
Source/Game.c
229
Source/Game.c
|
@ -441,6 +441,8 @@ void GameInit(const TYPE_GAME_CONFIGURATION* const pGameCfg)
|
|||
loaded = true;
|
||||
|
||||
LOAD_FILES(GameFileList, GameFileDest);
|
||||
|
||||
GameSpawnMinTime = TimerCreate(GAME_MINIMUM_PARKING_SPAWN_TIME, false, GameMinimumSpawnTimeout);
|
||||
}
|
||||
|
||||
LoadMenu( &pGameCfg->PLTPath,
|
||||
|
@ -511,6 +513,7 @@ void GameInit(const TYPE_GAME_CONFIGURATION* const pGameCfg)
|
|||
memset(&PlayerData[i].Waypoints, 0, sizeof (uint16_t) * PLAYER_MAX_WAYPOINTS);
|
||||
PlayerData[i].WaypointIdx = 0;
|
||||
PlayerData[i].LastWaypointIdx = 0;
|
||||
PlayerData[i].RemainingAircraft = 0;
|
||||
}
|
||||
|
||||
aircraftCreated = false;
|
||||
|
@ -535,11 +538,6 @@ void GameInit(const TYPE_GAME_CONFIGURATION* const pGameCfg)
|
|||
GameMouseSpr.g = NORMAL_LUMINANCE;
|
||||
GameMouseSpr.b = NORMAL_LUMINANCE;
|
||||
|
||||
if (GameSpawnMinTime != NULL)
|
||||
{
|
||||
GameSpawnMinTime = TimerCreate(GAME_MINIMUM_PARKING_SPAWN_TIME, false, &GameMinimumSpawnTimeout);
|
||||
}
|
||||
|
||||
spawnMinTimeFlag = false;
|
||||
|
||||
GameScore = 0;
|
||||
|
@ -831,17 +829,14 @@ void GameClock(void)
|
|||
{
|
||||
if (System1SecondTick())
|
||||
{
|
||||
GameMinutes++;
|
||||
|
||||
if (GameMinutes >= 60)
|
||||
if (++GameMinutes >= 60)
|
||||
{
|
||||
GameHour++;
|
||||
GameMinutes = 0;
|
||||
}
|
||||
|
||||
if (GameHour >= 24)
|
||||
{
|
||||
GameHour = 0;
|
||||
if (++GameHour >= 24)
|
||||
{
|
||||
GameHour = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -867,24 +862,27 @@ static void GameClockFlights(const uint8_t i)
|
|||
{
|
||||
if (System1SecondTick())
|
||||
{
|
||||
if ( (FlightData.Minutes[i] == 0)
|
||||
&&
|
||||
(FlightData.Hours[i] > 0) )
|
||||
if (FlightData.State[i] != STATE_IDLE)
|
||||
{
|
||||
FlightData.Minutes[i] = 60;
|
||||
FlightData.Hours[i]--;
|
||||
if (FlightData.RemainingTime[i] != 0)
|
||||
{
|
||||
FlightData.RemainingTime[i]--;
|
||||
}
|
||||
}
|
||||
|
||||
if (FlightData.Minutes[i] > 0)
|
||||
else
|
||||
{
|
||||
FlightData.Minutes[i]--;
|
||||
}
|
||||
if ((FlightData.Minutes[i] == 0)
|
||||
&&
|
||||
FlightData.Hours[i])
|
||||
{
|
||||
FlightData.Minutes[i] = 60;
|
||||
FlightData.Hours[i]--;
|
||||
}
|
||||
|
||||
if ( (FlightData.State[i] != STATE_IDLE)
|
||||
&&
|
||||
(FlightData.RemainingTime[i] > 0) )
|
||||
{
|
||||
FlightData.RemainingTime[i]--;
|
||||
if (FlightData.Minutes[i])
|
||||
{
|
||||
FlightData.Minutes[i]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1150,6 +1148,11 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* const ptrPlayer)
|
|||
BUILDING_ATC_TOWER_V = 0,
|
||||
BUILDING_ATC_TOWER_W = 29,
|
||||
BUILDING_ATC_TOWER_H = 34,
|
||||
|
||||
BUILDING_ATC_LOC_U = 87,
|
||||
BUILDING_ATC_LOC_V = 0,
|
||||
BUILDING_ATC_LOC_W = 10,
|
||||
BUILDING_ATC_LOC_H = 34
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -1171,6 +1174,9 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* const ptrPlayer)
|
|||
|
||||
BUILDING_ATC_TOWER_ORIGIN_X = 12,
|
||||
BUILDING_ATC_TOWER_ORIGIN_Y = 20,
|
||||
|
||||
BUILDING_ATC_LOC_ORIGIN_X = 6,
|
||||
BUILDING_ATC_LOC_ORIGIN_Y = 32
|
||||
};
|
||||
|
||||
static const struct
|
||||
|
@ -1201,6 +1207,13 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* const ptrPlayer)
|
|||
{
|
||||
.IsoPos.x = BUILDING_ATC_LOC_OFFSET_X,
|
||||
.IsoPos.y = BUILDING_ATC_LOC_OFFSET_Y,
|
||||
.orig_x = BUILDING_ATC_LOC_ORIGIN_X,
|
||||
.orig_y = BUILDING_ATC_LOC_ORIGIN_Y,
|
||||
.u = BUILDING_ATC_LOC_U,
|
||||
.v = BUILDING_ATC_LOC_V,
|
||||
.w = BUILDING_ATC_LOC_W,
|
||||
.h = BUILDING_ATC_LOC_H,
|
||||
// z coordinate set to 0 by default.
|
||||
},
|
||||
|
||||
[BUILDING_ILS] =
|
||||
|
@ -1549,83 +1562,82 @@ static void GameAircraftState(const uint8_t i)
|
|||
&&
|
||||
(FlightData.State[i] == STATE_IDLE)
|
||||
&&
|
||||
(FlightData.RemainingTime[i] > 0)
|
||||
&&
|
||||
(spawnMinTimeFlag == false))
|
||||
(FlightData.RemainingTime[i] != 0))
|
||||
{
|
||||
if ( (FlightData.FlightDirection[i] == DEPARTURE)
|
||||
&&
|
||||
(FlightData.Parking[i] != 0) )
|
||||
Serial_printf("Aircraft %d should now start...\n", i);
|
||||
if (spawnMinTimeFlag == false)
|
||||
{
|
||||
uint8_t j;
|
||||
bool bParkingBusy = false;
|
||||
|
||||
for (j = 0; j < FlightData.nAircraft; j++)
|
||||
if ((FlightData.FlightDirection[i] == DEPARTURE)
|
||||
&&
|
||||
FlightData.Parking[i])
|
||||
{
|
||||
if (AircraftFromFlightDataIndex(j)->State != STATE_IDLE)
|
||||
uint8_t j;
|
||||
bool bParkingBusy = false;
|
||||
|
||||
for (j = 0; j < FlightData.nAircraft; j++)
|
||||
{
|
||||
const uint16_t* const targets = AircraftGetTargets(j);
|
||||
|
||||
if (targets != NULL)
|
||||
if (AircraftFromFlightDataIndex(j)->State != STATE_IDLE)
|
||||
{
|
||||
const uint16_t tile = AircraftGetTileFromFlightDataIndex(j);
|
||||
const uint16_t* const targets = AircraftGetTargets(j);
|
||||
|
||||
if (tile == FlightData.Parking[i])
|
||||
if (targets != NULL)
|
||||
{
|
||||
bParkingBusy = true;
|
||||
}
|
||||
else if (SystemContains_u16(FlightData.Parking[i], targets, AIRCRAFT_MAX_TARGETS))
|
||||
{
|
||||
bParkingBusy = true;
|
||||
const uint16_t tile = AircraftGetTileFromFlightDataIndex(j);
|
||||
|
||||
if (tile == FlightData.Parking[i])
|
||||
{
|
||||
bParkingBusy = true;
|
||||
}
|
||||
else if (SystemContains_u16(FlightData.Parking[i], targets, AIRCRAFT_MAX_TARGETS))
|
||||
{
|
||||
bParkingBusy = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bParkingBusy == false)
|
||||
{
|
||||
uint16_t target[2] = {0};
|
||||
// Arrays are copied to AircraftAddNew, so we create a first and only
|
||||
// target which is the parking tile itself, and the second element
|
||||
// is just the NULL character.
|
||||
// Not an ideal solution, but the best one currently available.
|
||||
|
||||
FlightData.State[i] = STATE_PARKED;
|
||||
|
||||
aircraftCreated = true;
|
||||
|
||||
// Create notification request for incoming aircraft
|
||||
GameGuiBubbleShow();
|
||||
|
||||
target[0] = FlightData.Parking[i];
|
||||
|
||||
if (AircraftAddNew(&FlightData, i, target, GameGetParkingDirection(levelBuffer[target[0]])) == false)
|
||||
{
|
||||
Serial_printf("Exceeded maximum aircraft number!\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bParkingBusy == false)
|
||||
else if (FlightData.FlightDirection[i] == ARRIVAL)
|
||||
{
|
||||
uint16_t target[2] = {0};
|
||||
// Arrays are copied to AircraftAddNew, so we create a first and only
|
||||
// target which is the parking tile itself, and the second element
|
||||
// is just the NULL character.
|
||||
// Not an ideal solution, but the best one currently available.
|
||||
|
||||
FlightData.State[i] = STATE_PARKED;
|
||||
const uint32_t idx = SystemRand(SOUND_M1_INDEX, ARRAY_SIZE(ApproachSnds));
|
||||
|
||||
FlightData.State[i] = STATE_APPROACH;
|
||||
aircraftCreated = true;
|
||||
|
||||
// Play chatter sound.
|
||||
SfxPlaySound(&ApproachSnds[idx]);
|
||||
|
||||
// Create notification request for incoming aircraft
|
||||
GameGuiBubbleShow();
|
||||
|
||||
target[0] = FlightData.Parking[i];
|
||||
|
||||
Serial_printf("Target assigned = %d\n", target[0]);
|
||||
|
||||
if (AircraftAddNew(&FlightData, i, target, GameGetParkingDirection(levelBuffer[target[0]])) == false)
|
||||
{
|
||||
Serial_printf("Exceeded maximum aircraft number!\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (FlightData.FlightDirection[i] == ARRIVAL)
|
||||
{
|
||||
const uint32_t idx = SystemRand(SOUND_M1_INDEX, ARRAY_SIZE(ApproachSnds));
|
||||
|
||||
Serial_printf("Flight %d set to STATE_APPROACH.\n", i);
|
||||
FlightData.State[i] = STATE_APPROACH;
|
||||
aircraftCreated = true;
|
||||
|
||||
// Play chatter sound.
|
||||
SfxPlaySound(&ApproachSnds[idx]);
|
||||
|
||||
// Create notification request for incoming aircraft
|
||||
GameGuiBubbleShow();
|
||||
}
|
||||
}
|
||||
else if ( (FlightData.State[i] != STATE_IDLE)
|
||||
&&
|
||||
(FlightData.RemainingTime[i] == 0) )
|
||||
(FlightData.RemainingTime[i] == 0))
|
||||
{
|
||||
// Player(s) lost a flight!
|
||||
GameRemoveFlight(i, false);
|
||||
|
@ -2600,17 +2612,22 @@ static void GameSelectAircraftFromList(TYPE_PLAYER* const ptrPlayer, TYPE_FLIGHT
|
|||
}
|
||||
else if (ptrPlayer->PadKeySinglePress_Callback(PAD_L1))
|
||||
{
|
||||
FL_STATE* ptrAircraftState = &FlightData.State[ptrPlayer->FlightDataSelectedAircraft];
|
||||
FL_STATE* const ptrAircraftState = &FlightData.State[ptrPlayer->FlightDataSelectedAircraft];
|
||||
|
||||
if (*ptrAircraftState == STATE_TAXIING)
|
||||
switch (*ptrAircraftState)
|
||||
{
|
||||
*ptrAircraftState = STATE_USER_STOPPED;
|
||||
}
|
||||
else if ( (*ptrAircraftState == STATE_USER_STOPPED)
|
||||
||
|
||||
(*ptrAircraftState == STATE_AUTO_STOPPED) )
|
||||
{
|
||||
*ptrAircraftState = STATE_TAXIING;
|
||||
case STATE_TAXIING:
|
||||
*ptrAircraftState = STATE_USER_STOPPED;
|
||||
break;
|
||||
|
||||
case STATE_USER_STOPPED:
|
||||
// Fall through.
|
||||
case STATE_AUTO_STOPPED:
|
||||
*ptrAircraftState = STATE_TAXIING;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3767,6 +3784,8 @@ static void GameCreateTakeoffWaypoints(TYPE_PLAYER* const ptrPlayer, TYPE_FLIGHT
|
|||
return;
|
||||
}
|
||||
|
||||
DEBUG_PRINT_VAR(AircraftGetTileFromFlightDataIndex(aircraftIdx));
|
||||
|
||||
for (currentTile = (AircraftGetTileFromFlightDataIndex(aircraftIdx) + rwyStep);
|
||||
((levelBuffer[currentTile] & ~(TILE_MIRROR_FLAG)) != TILE_RWY_START_1)
|
||||
&&
|
||||
|
@ -3786,14 +3805,15 @@ static void GameCreateTakeoffWaypoints(TYPE_PLAYER* const ptrPlayer, TYPE_FLIGHT
|
|||
}
|
||||
|
||||
for ( currentTile = (AircraftGetTileFromFlightDataIndex(aircraftIdx) + rwyStep);
|
||||
(levelBuffer[currentTile] & ~(TILE_MIRROR_FLAG)) != TILE_RWY_EXIT;
|
||||
((levelBuffer[currentTile] & ~(TILE_MIRROR_FLAG)) != TILE_RWY_EXIT)
|
||||
&&
|
||||
((levelBuffer[currentTile] & ~(TILE_MIRROR_FLAG)) != TILE_RWY_EXIT_2);
|
||||
currentTile += rwyStep )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
targets[0] = currentTile;
|
||||
|
||||
AircraftAddTargets(AircraftFromFlightDataIndex(aircraftIdx), targets);
|
||||
}
|
||||
}
|
||||
|
@ -3820,7 +3840,7 @@ static void GameCreateTakeoffWaypoints(TYPE_PLAYER* const ptrPlayer, TYPE_FLIGHT
|
|||
static void GameGetRunwayEntryTile(uint8_t aircraftIdx, TYPE_RWY_ENTRY_DATA* ptrRwyEntry)
|
||||
{
|
||||
// Look for aircraft direction by searching TILE_RWY_EXIT
|
||||
uint16_t currentTile = AircraftGetTileFromFlightDataIndex(aircraftIdx) & (uint16_t)~(TILE_MIRROR_FLAG);
|
||||
const uint16_t currentTile = AircraftGetTileFromFlightDataIndex(aircraftIdx);
|
||||
int16_t step = 0;
|
||||
uint16_t i;
|
||||
|
||||
|
@ -3865,7 +3885,6 @@ static void GameGetRunwayEntryTile(uint8_t aircraftIdx, TYPE_RWY_ENTRY_DATA* ptr
|
|||
ptrRwyEntry->rwyEntryTile = 0;
|
||||
ptrRwyEntry->Direction = NO_DIRECTION;
|
||||
ptrRwyEntry->rwyStep = 0;
|
||||
Serial_printf("GameGetRunwayEntryTile(): could not determine aircraft direction.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3958,7 +3977,7 @@ bool GameInsideLevelFromIsoPos(TYPE_ISOMETRIC_FIX16_POS* ptrIsoPos)
|
|||
*
|
||||
* *******************************************************************************************/
|
||||
|
||||
void GameRemoveFlight(uint8_t idx, bool successful)
|
||||
void GameRemoveFlight(const uint8_t idx, const bool successful)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
|
@ -4019,6 +4038,13 @@ void GameRemoveFlight(uint8_t idx, bool successful)
|
|||
|
||||
if (FlightData.State[idx] != STATE_APPROACH)
|
||||
{
|
||||
if (FlightData.State[idx] == STATE_UNBOARDING)
|
||||
{
|
||||
ptrPlayer->Unboarding = false;
|
||||
ptrPlayer->LockTarget = false;
|
||||
ptrPlayer->LockedAircraft = FLIGHT_DATA_INVALID_IDX;
|
||||
}
|
||||
|
||||
if (AircraftRemove(idx) == false)
|
||||
{
|
||||
Serial_printf("Something went wrong when removing aircraft!\n");
|
||||
|
@ -4106,6 +4132,7 @@ void GameActiveAircraftList(TYPE_PLAYER* const ptrPlayer, TYPE_FLIGHT_DATA* cons
|
|||
// Then, rebuild aircraft list for current player.
|
||||
memset(ptrPlayer->ActiveAircraftList, 0, GAME_MAX_AIRCRAFT);
|
||||
ptrPlayer->ActiveAircraft = 0;
|
||||
ptrPlayer->RemainingAircraft = 0;
|
||||
|
||||
for (i = 0; i < FlightData.nAircraft; i++)
|
||||
{
|
||||
|
@ -4116,6 +4143,10 @@ void GameActiveAircraftList(TYPE_PLAYER* const ptrPlayer, TYPE_FLIGHT_DATA* cons
|
|||
ptrPlayer->ActiveAircraftList[j++] = i;
|
||||
ptrPlayer->ActiveAircraft++;
|
||||
}
|
||||
else if (ptrFlightData->State[i] == STATE_IDLE)
|
||||
{
|
||||
ptrPlayer->RemainingAircraft++;
|
||||
}
|
||||
}
|
||||
|
||||
currentFlightDataIdx = ptrPlayer->ActiveAircraftList[ptrPlayer->SelectedAircraft];
|
||||
|
@ -4162,7 +4193,7 @@ void GameActiveAircraftList(TYPE_PLAYER* const ptrPlayer, TYPE_FLIGHT_DATA* cons
|
|||
*
|
||||
* *******************************************************************************************/
|
||||
|
||||
static void GameRemainingAircraft(uint8_t i)
|
||||
static void GameRemainingAircraft(const uint8_t i)
|
||||
{
|
||||
// Reset iterator when starting from first element.
|
||||
|
||||
|
@ -4171,7 +4202,9 @@ static void GameRemainingAircraft(uint8_t i)
|
|||
FlightData.nRemainingAircraft = FlightData.nAircraft;
|
||||
}
|
||||
|
||||
if (FlightData.Finished[i])
|
||||
if ((FlightData.State[i] != STATE_IDLE)
|
||||
||
|
||||
FlightData.Finished[i])
|
||||
{
|
||||
FlightData.nRemainingAircraft--;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ uint16_t GameGetTileFromIsoPosition(const TYPE_ISOMETRIC_POS* const IsoPos);
|
|||
FL_STATE GameGetFlightDataStateFromIdx(uint8_t FlightDataIdx);
|
||||
uint32_t GameGetScore(void);
|
||||
bool GameInsideLevelFromIsoPos(TYPE_ISOMETRIC_FIX16_POS* ptrIsoPos);
|
||||
void GameRemoveFlight(uint8_t idx, bool successful);
|
||||
void GameRemoveFlight(const uint8_t idx, const bool successful);
|
||||
void GameCalculateRemainingAircraft(void);
|
||||
void GameAircraftCollision(uint8_t AircraftIdx);
|
||||
void GameStopFlight(uint8_t AicraftIdx);
|
||||
|
|
|
@ -385,7 +385,7 @@ bool GameGuiPauseDialog(const TYPE_PLAYER* const ptrPlayer)
|
|||
void GameGuiCalculateNextAircraftTime(TYPE_PLAYER* const ptrPlayer, TYPE_FLIGHT_DATA* const ptrFlightData)
|
||||
{
|
||||
uint8_t i;
|
||||
uint16_t minRemainingTime = 0;
|
||||
uint16_t minRemainingTime = USHRT_MAX;
|
||||
|
||||
for (i = 0; i < GAME_MAX_AIRCRAFT; i++)
|
||||
{
|
||||
|
@ -397,11 +397,9 @@ void GameGuiCalculateNextAircraftTime(TYPE_PLAYER* const ptrPlayer, TYPE_FLIGHT_
|
|||
||
|
||||
(ptrFlightData->Minutes[i] != 0) ) )
|
||||
{
|
||||
uint16_t seconds = (ptrFlightData->Hours[i] * 60) + (ptrFlightData->Minutes[i]);
|
||||
const uint16_t seconds = (ptrFlightData->Hours[i] * 60) + (ptrFlightData->Minutes[i]);
|
||||
|
||||
if ( (minRemainingTime == 0)
|
||||
||
|
||||
(seconds < minRemainingTime) )
|
||||
if (seconds < minRemainingTime)
|
||||
{
|
||||
minRemainingTime = seconds;
|
||||
}
|
||||
|
@ -591,17 +589,29 @@ void GameGuiAircraftList(TYPE_PLAYER* const ptrPlayer, TYPE_FLIGHT_DATA* const p
|
|||
},
|
||||
};
|
||||
|
||||
FontPrintText(&SmallFont,
|
||||
posData.remainingTime.x,
|
||||
posData.remainingTime.y,
|
||||
"Remaining aircraft: %d",
|
||||
ptrFlightData->nRemainingAircraft);
|
||||
if (ptrPlayer->RemainingAircraft
|
||||
&&
|
||||
(ptrPlayer->NextAircraftTime != USHRT_MAX))
|
||||
{
|
||||
FontPrintText(&SmallFont,
|
||||
posData.remainingTime.x,
|
||||
posData.remainingTime.y,
|
||||
"Remaining aircraft: %d",
|
||||
ptrPlayer->RemainingAircraft);
|
||||
|
||||
FontPrintText(&SmallFont,
|
||||
posData.aircraftTime.x,
|
||||
posData.aircraftTime.y,
|
||||
"Next aircraft: %d sec",
|
||||
ptrPlayer->NextAircraftTime);
|
||||
FontPrintText(&SmallFont,
|
||||
posData.aircraftTime.x,
|
||||
posData.aircraftTime.y,
|
||||
"Next aircraft: %d sec",
|
||||
ptrPlayer->NextAircraftTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
FontPrintText(&SmallFont,
|
||||
posData.remainingTime.x,
|
||||
posData.remainingTime.y,
|
||||
"No aircraft left");
|
||||
}
|
||||
|
||||
if (ptrPlayer->ActiveAircraft != 0)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ typedef enum t_fldir
|
|||
|
||||
typedef enum t_flstate
|
||||
{
|
||||
STATE_IDLE = 0,
|
||||
STATE_IDLE,
|
||||
STATE_PARKED,
|
||||
STATE_UNBOARDING,
|
||||
STATE_TAXIING,
|
||||
|
@ -113,11 +113,11 @@ typedef enum t_livery
|
|||
|
||||
typedef enum t_direction
|
||||
{
|
||||
NO_DIRECTION = 0,
|
||||
NO_DIRECTION,
|
||||
DIR_NORTH,
|
||||
DIR_SOUTH,
|
||||
DIR_EAST,
|
||||
DIR_WEST,
|
||||
DIR_WEST
|
||||
}DIRECTION;
|
||||
|
||||
typedef enum t_aircraftAttitude
|
||||
|
@ -171,7 +171,7 @@ typedef struct
|
|||
bool Unboarding;
|
||||
|
||||
// Stores indexes for player-specific active aircraft
|
||||
// Used to relate SelectedAircraft agains FlightData index
|
||||
// Used to relate SelectedAircraft against FlightData index
|
||||
uint8_t ActiveAircraftList[GAME_MAX_AIRCRAFT];
|
||||
// Flight direction to be managed by player (see 2-player mode)
|
||||
FL_DIR FlightDirection;
|
||||
|
@ -212,13 +212,15 @@ typedef struct
|
|||
uint16_t RwyArray[GAME_MAX_RWY_LENGTH];
|
||||
// Remaining time for next aircraft (if any).
|
||||
uint16_t NextAircraftTime;
|
||||
// Number of remaining aircraft in STATE_IDLE.
|
||||
uint16_t RemainingAircraft;
|
||||
|
||||
// Pad callbacks.
|
||||
bool (*const PadKeyPressed_Callback)(unsigned short);
|
||||
bool (*const PadKeyReleased_Callback)(unsigned short);
|
||||
bool (*const PadKeySinglePress_Callback)(unsigned short);
|
||||
bool (*const PadDirectionKeyPressed_Callback)(void);
|
||||
unsigned short (*PadLastKeySinglePressed_Callback)(void);
|
||||
unsigned short (*const PadLastKeySinglePressed_Callback)(void);
|
||||
}TYPE_PLAYER;
|
||||
|
||||
typedef enum t_fontflags
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <string.h>
|
||||
#include <types.h>
|
||||
#include <fixmath.h>
|
||||
#include <limits.h>
|
||||
#include "Serial.h"
|
||||
|
||||
/* *************************************
|
||||
|
|
|
@ -83,9 +83,13 @@ LEVEL_OBJECTS = $(addprefix $(OBJ_LEVELS_DIR)/, \
|
|||
LEVEL1.LVL \
|
||||
LEVEL2.LVL \
|
||||
LEVEL3.LVL \
|
||||
LEVEL18.LVL \
|
||||
XAMI.LVL \
|
||||
LEVEL1.PLT \
|
||||
LEVEL2.PLT \
|
||||
LEVEL3.PLT \
|
||||
LEVEL18.PLT \
|
||||
XAMI.PLT \
|
||||
EASY.PLT \
|
||||
TUTORIA1.PLT)
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
|||
|
||||
TARGET = MapEditor
|
||||
TEMPLATE = app
|
||||
CONFIG += static
|
||||
|
||||
QMAKE_CXXFLAGS += -funsigned-char
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.7.2, 2018-11-25T21:05:26. -->
|
||||
<!-- Written by QtCreator 4.7.2, 2018-11-27T22:49:44. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.12.0 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.12.0 GCC 64bit</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5120.gcc_64_kit</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
|
||||
<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">
|
||||
|
@ -312,7 +312,7 @@
|
|||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">MapEditor.pro</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory">/home/xavier/Airport/Source/MapEditor</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/xavier/Airport/Source/build-MapEditor-Desktop_Qt_5_12_0_GCC_64bit-Debug</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/home/xavier/Airport/Source/build-MapEditor-Desktop_Qt_5_12_0_GCC_64bit-Release</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>
|
||||
|
|
|
@ -482,6 +482,11 @@ void MainWindow::addBuilding(quint8 CurrentBuilding, const int i, const int j)
|
|||
BUILDING_ATC_TOWER_V = 0,
|
||||
BUILDING_ATC_TOWER_W = 29,
|
||||
BUILDING_ATC_TOWER_H = 34,
|
||||
|
||||
BUILDING_ATC_LOC_U = 87,
|
||||
BUILDING_ATC_LOC_V = 0,
|
||||
BUILDING_ATC_LOC_W = 10,
|
||||
BUILDING_ATC_LOC_H = 34
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -503,6 +508,9 @@ void MainWindow::addBuilding(quint8 CurrentBuilding, const int i, const int j)
|
|||
|
||||
BUILDING_ATC_TOWER_ORIGIN_X = 12,
|
||||
BUILDING_ATC_TOWER_ORIGIN_Y = 20,
|
||||
|
||||
BUILDING_ATC_LOC_ORIGIN_X = 6,
|
||||
BUILDING_ATC_LOC_ORIGIN_Y = 32
|
||||
};
|
||||
|
||||
static const struct
|
||||
|
@ -521,7 +529,7 @@ void MainWindow::addBuilding(quint8 CurrentBuilding, const int i, const int j)
|
|||
BUILDING_DATA(BUILDING_HANGAR),
|
||||
BUILDING_DATA(BUILDING_ILS),
|
||||
BUILDING_DATA(BUILDING_ATC_TOWER),
|
||||
NODATA,
|
||||
BUILDING_DATA(BUILDING_ATC_LOC),
|
||||
BUILDING_DATA(BUILDING_TERMINAL),
|
||||
BUILDING_DATA(BUILDING_TERMINAL_2),
|
||||
BUILDING_DATA(BUILDING_GATE)
|
||||
|
@ -575,6 +583,11 @@ void MainWindow::addBuilding(quint8 CurrentBuilding, const int i, const int j)
|
|||
|
||||
cropped = cropped.convertToFormat(QImage::Format_ARGB32); // or maybe other format
|
||||
|
||||
if (CurrentBuilding & TILE_MIRROR_FLAG)
|
||||
{
|
||||
cropped = cropped.mirrored(true, false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < cropped.width(); i++)
|
||||
{
|
||||
for (int j = 0; j < cropped.height(); j++)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[app_settings]
|
||||
last_dir=/home/xavier/Airport/Levels/LEVEL2.LVL
|
||||
last_dir=/home/xavier/Airport/Levels/LEVEL18.LVL
|
||||
window_geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\0\0\0\0\0\0\0\0\x5U\0\0\x2\xdb\0\0\0\xa5\0\0\0\x1d\0\0\x4<\0\0\x2\xa4\0\0\0\0\x2\0\0\0\x5V\0\0\0\0\0\0\0\x1d\0\0\x5U\0\0\x2\xdb)
|
||||
|
|
|
@ -32,13 +32,16 @@ typedef enum t_levelId
|
|||
LEVEL1 = 0,
|
||||
LEVEL2,
|
||||
LEVEL3,
|
||||
LEVEL4,
|
||||
LEVEL5,
|
||||
|
||||
MAX_LEVELS
|
||||
}LEVEL_ID;
|
||||
|
||||
typedef struct t_lvlpltdata
|
||||
{
|
||||
LEVEL_ID levelID;
|
||||
const char** fileNames[];
|
||||
const char* const* fileNames[];
|
||||
}TYPE_LVL_PLT_DATA;
|
||||
|
||||
typedef enum
|
||||
|
@ -156,7 +159,9 @@ static const char* MainMenuLevelList[] =
|
|||
{
|
||||
[LEVEL1] = "DATA\\LEVELS\\LEVEL1.LVL",
|
||||
[LEVEL2] = "DATA\\LEVELS\\LEVEL2.LVL",
|
||||
[LEVEL3] = "DATA\\LEVELS\\LEVEL3.LVL"
|
||||
[LEVEL3] = "DATA\\LEVELS\\LEVEL3.LVL",
|
||||
[LEVEL4] = "DATA\\LEVELS\\XAMI.LVL",
|
||||
[LEVEL5] = "DATA\\LEVELS\\LEVEL18.LVL"
|
||||
};
|
||||
|
||||
static const char** MainMenuPltList[] =
|
||||
|
@ -179,6 +184,18 @@ static const char** MainMenuPltList[] =
|
|||
{
|
||||
"DATA\\LEVELS\\LEVEL3.PLT",
|
||||
NULL
|
||||
},
|
||||
|
||||
[LEVEL4] = (const char*[])
|
||||
{
|
||||
"DATA\\LEVELS\\XAMI.PLT",
|
||||
NULL
|
||||
},
|
||||
|
||||
[LEVEL5] = (const char*[])
|
||||
{
|
||||
"DATA\\LEVELS\\LEVEL18.PLT",
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -542,7 +559,7 @@ static void MainMenuRenderLevelList(void)
|
|||
for (i = LEVEL1; i < MAX_LEVELS; i++)
|
||||
{
|
||||
char baseName[32];
|
||||
const size_t maxLength = sizeof (baseName) / sizeof (baseName[0]);
|
||||
const size_t maxLength = ARRAY_SIZE(baseName);
|
||||
|
||||
// Update "baseName" with file name + extension.
|
||||
SystemGetFileBasename(MainMenuLevelList[i], baseName, maxLength);
|
||||
|
|
|
@ -273,7 +273,7 @@ bool PltParserLoadFile(const char* strPath, TYPE_FLIGHT_DATA* const ptrFlightDat
|
|||
ptrFlightData->Hours[aircraftIndex] = (uint8_t)atoi(strHour);
|
||||
ptrFlightData->Minutes[aircraftIndex] = (uint8_t)atoi(strMinutes);
|
||||
|
||||
Serial_printf("Aircraft %d time set to %.2d:%.2d.\n", aircraftIndex,
|
||||
Serial_printf("Aircraft %d time set to %02d:%02d.\n", aircraftIndex,
|
||||
ptrFlightData->Hours[aircraftIndex],
|
||||
ptrFlightData->Minutes[aircraftIndex] );
|
||||
break;
|
||||
|
@ -312,6 +312,8 @@ bool PltParserLoadFile(const char* strPath, TYPE_FLIGHT_DATA* const ptrFlightDat
|
|||
|
||||
void PltParserResetBuffers(TYPE_FLIGHT_DATA* const ptrFlightData)
|
||||
{
|
||||
bzero(ptrFlightData, sizeof (TYPE_FLIGHT_DATA));
|
||||
#if 0
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; i < GAME_MAX_AIRCRAFT ; i++)
|
||||
|
@ -326,6 +328,7 @@ void PltParserResetBuffers(TYPE_FLIGHT_DATA* const ptrFlightData)
|
|||
memset(ptrFlightData->State,STATE_IDLE,GAME_MAX_AIRCRAFT);
|
||||
memset(ptrFlightData->Parking,0,GAME_MAX_AIRCRAFT);
|
||||
memset(ptrFlightData->Finished,0,GAME_MAX_AIRCRAFT);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t* PltParserGenerateFile(TYPE_PLT_CONFIG* ptrPltConfig)
|
||||
|
|
|
@ -149,7 +149,14 @@ void TimerHandler(void)
|
|||
|
||||
void TimerRestart(TYPE_TIMER* timer)
|
||||
{
|
||||
timer->time = timer->orig_time;
|
||||
if (timer != NULL)
|
||||
{
|
||||
timer->time = timer->orig_time;
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial_printf("TimerRestart: invalid TYPE_TIMER instance\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* *********************************************************************
|
||||
|
|
Loading…
Reference in New Issue