* New LEVEL2.LVL was not being displayed correctly as I forgot to include the new tiles on Game.c.

* Some work done on runway exit detection, but still TODO.
* Minor change in LoadMenu.c.
This commit is contained in:
XaviDCR92 2017-12-29 02:57:40 +01:00
parent eb6f4d6d8c
commit fef6629d96
11 changed files with 855 additions and 804 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -127,8 +127,10 @@ enum
TILE_RWY_EXIT,
TILE_TAXIWAY_CORNER_GRASS_2,
TILE_TAXIWAY_4WAY_CROSSING,
TILE_RWY_EXIT_2,
LAST_TILE_TILESET1 = TILE_TAXIWAY_CORNER_GRASS_2
LAST_TILE_TILESET1 = TILE_RWY_EXIT_2
};
enum
@ -259,14 +261,14 @@ static void* GameFileDest[] = { (GsSprite*)&GameTilesetSpr ,
(GsSprite*)&CityBg1Spr ,
(SsVag*)&BeepSnd };
static const char* GamePlt[] = { "cdrom:\\DATA\\LEVELS\\LEVEL1.PLT;1" };
static const char* GamePlt[] = { "cdrom:\\DATA\\LEVELS\\LEVEL2.PLT;1" };
static void* GamePltDest[] = {(TYPE_FLIGHT_DATA*)&FlightData };
static char* GameLevelList[] = {"cdrom:\\DATA\\LEVELS\\LEVEL1.LVL;1"};
static char* GameLevelList[] = {"cdrom:\\DATA\\LEVELS\\LEVEL2.LVL;1"};
static uint16_t GameLevelBuffer[GAME_MAX_MAP_SIZE];
static uint8_t GameLevelColumns;
static uint8_t GameLevelSize;
static uint16_t GameLevelSize;
static char GameLevelTitle[LEVEL_TITLE_SIZE];
@ -472,6 +474,14 @@ void GameInit(void)
PlayerData[PLAYER_ONE].FlightDataPage = 0;
PlayerData[PLAYER_ONE].UnboardingSequenceIdx = 0;
PlayerData[PLAYER_ONE].ShowAircraftData = false;
PlayerData[PLAYER_ONE].SelectRunway = false;
PlayerData[PLAYER_ONE].SelectTaxiwayRunway = false;
PlayerData[PLAYER_ONE].SelectTaxiwayParking = false;
PlayerData[PLAYER_ONE].InvalidPath = false;
PlayerData[PLAYER_ONE].LockTarget = false;
PlayerData[PLAYER_ONE].Unboarding = false;
memset(PlayerData[PLAYER_ONE].UnboardingSequence, 0, GAME_MAX_SEQUENCE_KEYS * sizeof(unsigned short) );
PlayerData[PLAYER_TWO].Active = TwoPlayersActive? true : false;
@ -486,6 +496,14 @@ void GameInit(void)
PlayerData[PLAYER_TWO].PadLastKeySinglePressed_Callback = &PadTwoGetLastKeySinglePressed;
PlayerData[PLAYER_TWO].UnboardingSequenceIdx = 0;
PlayerData[PLAYER_TWO].ShowAircraftData = false;
PlayerData[PLAYER_TWO].SelectRunway = false;
PlayerData[PLAYER_TWO].SelectTaxiwayRunway = false;
PlayerData[PLAYER_TWO].SelectTaxiwayParking = false;
PlayerData[PLAYER_TWO].InvalidPath = false;
PlayerData[PLAYER_TWO].LockTarget = false;
PlayerData[PLAYER_TWO].Unboarding = false;
memset(PlayerData[PLAYER_TWO].UnboardingSequence, 0, GAME_MAX_SEQUENCE_KEYS * sizeof(unsigned short) );
// On 2-player mode, one player controls departure flights and
@ -1236,7 +1254,7 @@ void GameDrawBackground(TYPE_PLAYER* ptrPlayer)
void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer)
{
uint8_t tileNr;
uint16_t tileNr;
uint8_t rows = 0;
uint8_t columns = 0;
uint8_t k;
@ -1462,6 +1480,8 @@ void GameLoadLevel(void)
Serial_printf("Game level title: %s\n",GameLevelTitle);
DEBUG_PRINT_VAR(GameLevelSize);
i += LEVEL_TITLE_SIZE;
memset(GameLevelBuffer, 0, GAME_MAX_MAP_SIZE);
@ -1781,10 +1801,6 @@ void GameRenderLevel(TYPE_PLAYER* ptrPlayer)
||
(CurrentTile == TILE_PARKING_2) ) )
{
//init_timer_value = GetRCnt(2);
//end_timer_value = GetRCnt(2);
ptrTileset->r = NORMAL_LUMINANCE >> 2;
ptrTileset->g = rwy_sine;
ptrTileset->b = NORMAL_LUMINANCE >> 2;
@ -2329,12 +2345,14 @@ void GameStateSelectRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightDa
void GameGetRunwayArray(void)
{
uint8_t i;
uint16_t i;
uint8_t j = 0;
for (i = 0; i < GameLevelSize; i++)
{
if (GameLevelBuffer[i] == TILE_RWY_START_1)
uint8_t tileNr = GameLevelBuffer[i] & ~TILE_MIRROR_FLAG;
if (tileNr == TILE_RWY_START_1)
{
if (SystemContains_u16(i, GameLevelBuffer, GAME_MAX_RUNWAYS) == false)
{
@ -2544,14 +2562,18 @@ void GameGetSelectedRunwayArray(uint16_t rwyHeader, uint16_t* rwyArray, size_t s
case TILE_RWY_START_2:
dir = RWY_DIR_WEST;
break;
case TILE_RWY_START_1 | TILE_MIRROR_FLAG:
dir = RWY_DIR_SOUTH;
break;
case TILE_RWY_START_2 | TILE_MIRROR_FLAG:
dir = RWY_DIR_NORTH;
break;
default:
Serial_printf("Unknown direction for tile %d\n",rwyHeader);
return;
break;
}
}
else
@ -2632,8 +2654,17 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
if (ptrFlightData->State[aircraftIndex] == STATE_APPROACH)
{
uint8_t j;
uint16_t rwyArray[GAME_MAX_RWY_LENGTH];
// TODO: Algorithm is not correct. If TILE_RWY_EXIT is placed further,
// but returns a match earlier than other rwyExitTiles[], invalid targets
// are returned to aircraft. We should check this before proceeding.
uint8_t rwyExitTiles[] = { TILE_RWY_EXIT,
TILE_RWY_EXIT | TILE_MIRROR_FLAG,
TILE_RWY_EXIT_2,
TILE_RWY_EXIT_2 | TILE_MIRROR_FLAG };
ptrFlightData->State[aircraftIndex] = STATE_FINAL;
GameScore += SCORE_REWARD_FINAL;
@ -2642,21 +2673,37 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
for (i = 0; i < GAME_MAX_RWY_LENGTH; i++)
{
rwyTiles[i] = GameLevelBuffer[rwyArray[i]];
dprintf("rwyTiles[%d] = 0x%02X\n", i, rwyTiles[i]);
}
i = SystemIndexOf_U8((uint8_t)TILE_RWY_EXIT, rwyTiles, 0, GAME_MAX_RWY_LENGTH);
for (j = 0; j < (sizeof(rwyExitTiles) / sizeof(rwyExitTiles[0])); j++)
{
i = SystemIndexOf_U8(rwyExitTiles[j], rwyTiles, 0, GAME_MAX_RWY_LENGTH);
DEBUG_PRINT_VAR(i);
if (i != -1)
{
dprintf("Success!\n");
uint8_t nextPos = i + 1;
for (j = 0; j < (sizeof(rwyExitTiles) / sizeof(rwyExitTiles[0])); j++)
{
i = SystemIndexOf_U8(rwyExitTiles[j], rwyTiles, nextPos, GAME_MAX_RWY_LENGTH);
DEBUG_PRINT_VAR(i);
if (i != -1)
{
break;
}
}
break;
}
}
if (i == -1)
{
Serial_printf("ERROR: Could not find TILE_RWY_EXIT for runway header %d.\n", assignedRwy);
return;
}
i = SystemIndexOf_U8((uint8_t)TILE_RWY_EXIT, rwyTiles, i + 1, GAME_MAX_RWY_LENGTH);
if (i == -1)
{
Serial_printf("ERROR: Could not find second TILE_RWY_EXIT for runway header %d.\n", assignedRwy);
Serial_printf("ERROR: Could not find TILE_RWY_EXIT or TILE_RWY_EXIT_2 for runway header %d.\n", assignedRwy);
return;
}

View File

@ -262,21 +262,12 @@ void ISR_LoadMenuVBlank(void)
SystemIncreaseGlobalTimer();
if (SystemIsBusy() != false)
if ( (SystemIsBusy() != false)
||
(GfxIsGPUBusy() != false)
||
(SerialIsBusy() != false) )
{
dprintf("SystemIsBusy...\n");
return;
}
if ((GfxIsGPUBusy() != false))
{
dprintf("(GfxIsGPUBusy() != false)\n");
return;
}
if (SerialIsBusy() != false)
{
dprintf("Serialisbusy\n");
return;
}

View File

@ -76,7 +76,7 @@ SOUND_OBJECTS = $(addprefix $(OBJ_SOUNDS_DIR)/, BELL.VAG \
# Level objects:
SRC_LEVELS_DIR = $(PROJECT_DIR)/Levels
OBJ_LEVELS_DIR = $(CDROM_ROOT)/DATA/LEVELS
LEVEL_OBJECTS = $(addprefix $(OBJ_LEVELS_DIR)/, LEVEL1.LVL LEVEL1.PLT)
LEVEL_OBJECTS = $(addprefix $(OBJ_LEVELS_DIR)/, LEVEL1.LVL LEVEL2.LVL LEVEL2.PLT LEVEL1.PLT)
# Sprite objects:
BMP2TIM = bmp2tim

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.0.3, 2017-12-27T11:30:21. -->
<!-- Written by QtCreator 4.0.3, 2017-12-27T14:24:53. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -62,7 +62,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.7.0 MinGW 32bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.7.0 MinGW 32bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.57.win32_mingw53_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">
@ -291,8 +291,8 @@
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">MapEditor.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory">C:/cygwin/home/Xavier/Airport/Source/MapEditor</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/cygwin/home/Xavier/Airport/Source/build-MapEditor-Desktop_Qt_5_7_0_MinGW_32bit-Debug</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/cygwin/home/Xavier/Airport/Source/MapEditor</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>

View File

@ -1,2 +1,2 @@
[app_settings]
last_dir=C:/cygwin/home/Xavier/Airport/Levels/LEVEL2.LVL
last_dir=C:/cygwin/home/Xavier/Airport/Levels/LEVEL1.LVL

View File

@ -6,3 +6,16 @@ tile3 = "Asphalt"
tile4 = "Runway mid"
tile5 = "Runway start/end 1"
tile6 = "Runway start/end 2"
tile7 = "Parking 1"
tile8 = "Parking 2"
tile9 = "Taxiway crossing, grass border"
tile10 = "Taxiway, grass border"
tile11 = "Taxiway corner, grass border 1"
tile12 = "Water grass border 1"
tile13 = "Water grass border 2"
tile14 = "Runway holding point 1"
tile15 = "Runway holding point 2"
tile16 = "Runway enter/exit, asphalt border 1"
tile17 = "Taxiway corner, grass border 2"
tile18 = "Taxiway 4-way crossing, grass border"
tile19 = "Runway enter/exit, asphalt border 2"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.