* Menu.c: bugfix for PLT level list.
* Minor: added whitespace to "sizeof" operand.
This commit is contained in:
parent
baa647ad7c
commit
6adb0a08c8
|
@ -89,7 +89,7 @@ void AircraftInit(void)
|
|||
{
|
||||
static bool firstLoad = true;
|
||||
|
||||
bzero(AircraftData, GAME_MAX_AIRCRAFT * sizeof(TYPE_AIRCRAFT_DATA));
|
||||
bzero(AircraftData, GAME_MAX_AIRCRAFT * sizeof (TYPE_AIRCRAFT_DATA));
|
||||
AircraftIndex = 0;
|
||||
|
||||
AircraftSpr.x = 0;
|
||||
|
@ -113,7 +113,7 @@ void AircraftInit(void)
|
|||
|
||||
memset( AircraftFlightDataIdx_HashTable,
|
||||
AIRCRAFT_INVALID_IDX,
|
||||
sizeof(AircraftFlightDataIdx_HashTable) );
|
||||
sizeof (AircraftFlightDataIdx_HashTable) );
|
||||
|
||||
if (firstLoad != false)
|
||||
{
|
||||
|
@ -121,8 +121,8 @@ void AircraftInit(void)
|
|||
|
||||
LoadMenu( GameFileList,
|
||||
GameFileDest,
|
||||
sizeof(GameFileList) / sizeof(GameFileList[0]),
|
||||
sizeof(GameFileDest) / sizeof(GameFileDest[0]) );
|
||||
sizeof (GameFileList) / sizeof (GameFileList[0]),
|
||||
sizeof (GameFileDest) / sizeof (GameFileDest[0]) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ bool AircraftAddNew( TYPE_FLIGHT_DATA* ptrFlightData,
|
|||
return false;
|
||||
}
|
||||
|
||||
memcpy(ptrAircraft->Target, targets, sizeof(uint16_t) * AIRCRAFT_MAX_TARGETS);
|
||||
memcpy(ptrAircraft->Target, targets, sizeof (uint16_t) * AIRCRAFT_MAX_TARGETS);
|
||||
|
||||
ptrAircraft->TargetIdx = 0;
|
||||
ptrAircraft->Livery = AircraftLiveryFromFlightNumber(ptrFlightData->strFlightNumber[FlightDataIndex]);
|
||||
|
@ -237,7 +237,7 @@ AIRCRAFT_LIVERY AircraftLiveryFromFlightNumber(char* strFlightNumber)
|
|||
int32_t liveryIndex;
|
||||
char strLivery[4];
|
||||
|
||||
memset(strLivery, 0, 4 * sizeof(char) );
|
||||
memset(strLivery, 0, 4 * sizeof (char) );
|
||||
|
||||
strncpy(strLivery, strFlightNumber, 3);
|
||||
|
||||
|
@ -795,7 +795,7 @@ TYPE_ISOMETRIC_POS AircraftGetIsoPos(uint8_t FlightDataIdx)
|
|||
|
||||
void AircraftAddTargets(TYPE_AIRCRAFT_DATA* ptrAircraft, uint16_t* targets)
|
||||
{
|
||||
memcpy(ptrAircraft->Target, targets, sizeof(uint16_t) * AIRCRAFT_MAX_TARGETS);
|
||||
memcpy(ptrAircraft->Target, targets, sizeof (uint16_t) * AIRCRAFT_MAX_TARGETS);
|
||||
ptrAircraft->TargetIdx = 0;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -209,24 +209,29 @@ void FontPrintText(TYPE_FONT * ptrFont, short x, short y, char* str, ...)
|
|||
GfxDrawButton(x, y, PAD_SQUARE);
|
||||
|
||||
x += BUTTON_SIZE;
|
||||
|
||||
line_count += BUTTON_SIZE / ptrFont->char_w;
|
||||
break;
|
||||
|
||||
case CIRCLE_BTN_8BIT:
|
||||
GfxDrawButton(x, y, PAD_CIRCLE);
|
||||
|
||||
x += BUTTON_SIZE;
|
||||
line_count += BUTTON_SIZE / ptrFont->char_w;
|
||||
break;
|
||||
|
||||
case TRIANGLE_BTN_8BIT:
|
||||
GfxDrawButton(x, y, PAD_TRIANGLE);
|
||||
|
||||
x += BUTTON_SIZE;
|
||||
line_count += BUTTON_SIZE / ptrFont->char_w;
|
||||
break;
|
||||
|
||||
case CROSS_BTN_8BIT:
|
||||
GfxDrawButton(x, y, PAD_CROSS);
|
||||
|
||||
x += BUTTON_SIZE;
|
||||
line_count += BUTTON_SIZE / ptrFont->char_w;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -454,14 +454,14 @@ void GameInit(TYPE_GAME_CONFIGURATION* pGameCfg)
|
|||
|
||||
LoadMenu( GameFileList,
|
||||
GameFileDest,
|
||||
sizeof(GameFileList) / sizeof(char*),
|
||||
sizeof(GameFileDest) /sizeof(void*) );
|
||||
sizeof (GameFileList) / sizeof (char*),
|
||||
sizeof (GameFileDest) /sizeof (void*) );
|
||||
}
|
||||
|
||||
LoadMenu( &pGameCfg->PLTPath,
|
||||
GamePltDest,
|
||||
sizeof(char),
|
||||
sizeof(GamePltDest) / sizeof(GamePltDest[0]) );
|
||||
sizeof (char),
|
||||
sizeof (GamePltDest) / sizeof (GamePltDest[0]) );
|
||||
|
||||
GameLoadLevel(pGameCfg->LVLPath);
|
||||
|
||||
|
@ -469,9 +469,9 @@ void GameInit(TYPE_GAME_CONFIGURATION* pGameCfg)
|
|||
|
||||
GameBuildingsInit();
|
||||
|
||||
memset(GameRwy, 0, GAME_MAX_RUNWAYS * sizeof(uint16_t) );
|
||||
memset(GameRwy, 0, GAME_MAX_RUNWAYS * sizeof (uint16_t) );
|
||||
|
||||
memset(GameUsedRwy, 0, GAME_MAX_RUNWAYS * sizeof(uint16_t) );
|
||||
memset(GameUsedRwy, 0, GAME_MAX_RUNWAYS * sizeof (uint16_t) );
|
||||
|
||||
PlayerData[PLAYER_ONE].Active = true;
|
||||
PlayerData[PLAYER_ONE].PadKeyPressed_Callback = &PadOneKeyPressed;
|
||||
|
@ -490,8 +490,8 @@ void GameInit(TYPE_GAME_CONFIGURATION* pGameCfg)
|
|||
PlayerData[PLAYER_ONE].LockTarget = false;
|
||||
PlayerData[PLAYER_ONE].Unboarding = false;
|
||||
|
||||
memset(PlayerData[PLAYER_ONE].UnboardingSequence, 0, GAME_MAX_SEQUENCE_KEYS * sizeof(unsigned short) );
|
||||
memset(PlayerData[PLAYER_ONE].TileData, 0, GAME_MAX_MAP_SIZE * sizeof(TYPE_TILE_DATA));
|
||||
memset(PlayerData[PLAYER_ONE].UnboardingSequence, 0, GAME_MAX_SEQUENCE_KEYS * sizeof (unsigned short) );
|
||||
memset(PlayerData[PLAYER_ONE].TileData, 0, GAME_MAX_MAP_SIZE * sizeof (TYPE_TILE_DATA));
|
||||
|
||||
PlayerData[PLAYER_TWO].Active = TwoPlayersActive? true : false;
|
||||
|
||||
|
@ -513,8 +513,8 @@ void GameInit(TYPE_GAME_CONFIGURATION* pGameCfg)
|
|||
PlayerData[PLAYER_TWO].LockTarget = false;
|
||||
PlayerData[PLAYER_TWO].Unboarding = false;
|
||||
|
||||
memset(PlayerData[PLAYER_TWO].UnboardingSequence, 0, GAME_MAX_SEQUENCE_KEYS * sizeof(unsigned short) );
|
||||
memset(PlayerData[PLAYER_TWO].TileData, 0, GAME_MAX_MAP_SIZE * sizeof(TYPE_TILE_DATA));
|
||||
memset(PlayerData[PLAYER_TWO].UnboardingSequence, 0, GAME_MAX_SEQUENCE_KEYS * sizeof (unsigned short) );
|
||||
memset(PlayerData[PLAYER_TWO].TileData, 0, GAME_MAX_MAP_SIZE * sizeof (TYPE_TILE_DATA));
|
||||
|
||||
// On 2-player mode, one player controls departure flights and
|
||||
// other player controls arrival flights.
|
||||
|
@ -535,7 +535,7 @@ void GameInit(TYPE_GAME_CONFIGURATION* pGameCfg)
|
|||
PlayerData[i].LockTarget = false;
|
||||
PlayerData[i].SelectedAircraft = 0;
|
||||
PlayerData[i].FlightDataPage = 0;
|
||||
memset(&PlayerData[i].Waypoints, 0, sizeof(uint16_t) * PLAYER_MAX_WAYPOINTS);
|
||||
memset(&PlayerData[i].Waypoints, 0, sizeof (uint16_t) * PLAYER_MAX_WAYPOINTS);
|
||||
PlayerData[i].WaypointIdx = 0;
|
||||
PlayerData[i].LastWaypointIdx = 0;
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ void GameBuildingsInit(void)
|
|||
BUILDING_ATC_TOWER_ORIGIN_Y = 20,
|
||||
};
|
||||
|
||||
memset(GameBuildingData, 0, sizeof(TYPE_BUILDING_DATA) );
|
||||
memset(GameBuildingData, 0, sizeof (TYPE_BUILDING_DATA) );
|
||||
|
||||
GameBuildingData[BUILDING_GATE].IsoPos.x = BUILDING_GATE_OFFSET_X;
|
||||
GameBuildingData[BUILDING_GATE].IsoPos.y = BUILDING_GATE_OFFSET_Y;
|
||||
|
@ -845,7 +845,7 @@ void GameGetAircraftTilemap(uint8_t i)
|
|||
|
||||
if (i == 0)
|
||||
{
|
||||
memset(GameAircraftTilemap, FLIGHT_DATA_INVALID_IDX, sizeof(GameAircraftTilemap) );
|
||||
memset(GameAircraftTilemap, FLIGHT_DATA_INVALID_IDX, sizeof (GameAircraftTilemap) );
|
||||
}
|
||||
|
||||
if (FlightData.State[i] == STATE_IDLE)
|
||||
|
@ -1276,7 +1276,7 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer)
|
|||
uint8_t AircraftRenderOrder[GAME_MAX_AIRCRAFT_PER_TILE];
|
||||
short Aircraft_Y_Data[GAME_MAX_AIRCRAFT_PER_TILE];
|
||||
|
||||
memset(AircraftRenderOrder, FLIGHT_DATA_INVALID_IDX, sizeof(AircraftRenderOrder) );
|
||||
memset(AircraftRenderOrder, FLIGHT_DATA_INVALID_IDX, sizeof (AircraftRenderOrder) );
|
||||
|
||||
for (j = 0; j < GAME_MAX_AIRCRAFT_PER_TILE; j++)
|
||||
{
|
||||
|
@ -1284,7 +1284,7 @@ void GameRenderBuildingAircraft(TYPE_PLAYER* ptrPlayer)
|
|||
Aircraft_Y_Data[j] = 0x7FFF;
|
||||
}
|
||||
|
||||
//memset(Aircraft_Y_Data, 0x7F, GAME_MAX_AIRCRAFT_PER_TILE * sizeof(short));
|
||||
//memset(Aircraft_Y_Data, 0x7F, GAME_MAX_AIRCRAFT_PER_TILE * sizeof (short));
|
||||
|
||||
for (j = 0; j < GAME_MAX_AIRCRAFT_PER_TILE; j++)
|
||||
{
|
||||
|
@ -1497,7 +1497,7 @@ void GameLoadLevel(const char* path)
|
|||
|
||||
i = LEVEL_HEADER_SIZE;
|
||||
|
||||
memcpy(GameLevelBuffer, &ptrBuffer[i], GameLevelSize * sizeof(uint16_t)); // 2 bytes per tile
|
||||
memcpy(GameLevelBuffer, &ptrBuffer[i], GameLevelSize * sizeof (uint16_t)); // 2 bytes per tile
|
||||
}
|
||||
|
||||
/* ******************************************************************************************
|
||||
|
@ -1612,7 +1612,7 @@ void GameInitTileUVTable(void)
|
|||
{
|
||||
uint16_t i;
|
||||
|
||||
memset(GameLevelBuffer_UVData, 0, sizeof(GameLevelBuffer_UVData));
|
||||
memset(GameLevelBuffer_UVData, 0, sizeof (GameLevelBuffer_UVData));
|
||||
|
||||
for (i = 0 ; i < GameLevelSize; i++)
|
||||
{
|
||||
|
@ -2099,7 +2099,7 @@ void GameStateSelectTaxiwayRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrF
|
|||
// State exit.
|
||||
ptrPlayer->SelectTaxiwayRunway = false;
|
||||
// Clear waypoints array.
|
||||
memset(ptrPlayer->Waypoints, 0, sizeof(uint16_t) * PLAYER_MAX_WAYPOINTS);
|
||||
memset(ptrPlayer->Waypoints, 0, sizeof (uint16_t) * PLAYER_MAX_WAYPOINTS);
|
||||
ptrPlayer->WaypointIdx = 0;
|
||||
ptrPlayer->LastWaypointIdx = 0;
|
||||
}
|
||||
|
@ -2141,7 +2141,7 @@ void GameStateSelectTaxiwayRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrF
|
|||
Serial_printf("\n");
|
||||
|
||||
// Clear waypoints array.
|
||||
memset(ptrPlayer->Waypoints, 0, sizeof(uint16_t) * PLAYER_MAX_WAYPOINTS);
|
||||
memset(ptrPlayer->Waypoints, 0, sizeof (uint16_t) * PLAYER_MAX_WAYPOINTS);
|
||||
|
||||
// Reset state and auxiliar variables
|
||||
ptrPlayer->WaypointIdx = 0;
|
||||
|
@ -2206,7 +2206,7 @@ void GameStateSelectTaxiwayParking(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptr
|
|||
// State exit.
|
||||
ptrPlayer->SelectTaxiwayParking = false;
|
||||
// Clear waypoints array.
|
||||
memset(ptrPlayer->Waypoints, 0, sizeof(uint16_t) * PLAYER_MAX_WAYPOINTS);
|
||||
memset(ptrPlayer->Waypoints, 0, sizeof (uint16_t) * PLAYER_MAX_WAYPOINTS);
|
||||
ptrPlayer->WaypointIdx = 0;
|
||||
ptrPlayer->LastWaypointIdx = 0;
|
||||
}
|
||||
|
@ -2253,7 +2253,7 @@ void GameStateSelectTaxiwayParking(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptr
|
|||
|
||||
ptrPlayer->SelectTaxiwayParking = false;
|
||||
// Clear waypoints array.
|
||||
memset(ptrPlayer->Waypoints, 0, sizeof(uint16_t) * PLAYER_MAX_WAYPOINTS);
|
||||
memset(ptrPlayer->Waypoints, 0, sizeof (uint16_t) * PLAYER_MAX_WAYPOINTS);
|
||||
ptrPlayer->WaypointIdx = 0;
|
||||
ptrPlayer->LastWaypointIdx = 0;
|
||||
|
||||
|
@ -2303,7 +2303,7 @@ void GameStateSelectRunway(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightDa
|
|||
ptrPlayer->LockTarget = false;
|
||||
ptrPlayer->LockedAircraft = FLIGHT_DATA_INVALID_IDX;
|
||||
|
||||
GameGetSelectedRunwayArray(GameRwy[ptrPlayer->SelectedRunway], ptrPlayer->RwyArray, sizeof(ptrPlayer->RwyArray));
|
||||
GameGetSelectedRunwayArray(GameRwy[ptrPlayer->SelectedRunway], ptrPlayer->RwyArray, sizeof (ptrPlayer->RwyArray));
|
||||
|
||||
CameraMoveToIsoPos(ptrPlayer, IsoPos);
|
||||
|
||||
|
@ -2486,7 +2486,7 @@ void GameSelectAircraftFromList(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
|
|||
ptrPlayer->SelectRunway = true;
|
||||
GameGetRunwayEntryTile(AircraftIdx, &rwyEntryData);
|
||||
|
||||
for (i = 0; GameRwy[i] != 0 && (i < (sizeof(GameRwy) / sizeof(GameRwy[0]))); i++)
|
||||
for (i = 0; GameRwy[i] != 0 && (i < (sizeof (GameRwy) / sizeof (GameRwy[0]))); i++)
|
||||
{
|
||||
if (GameRwy[i] == rwyEntryData.rwyHeader)
|
||||
{
|
||||
|
@ -2626,12 +2626,12 @@ void GameGetSelectedRunwayArray(uint16_t rwyHeader, uint16_t* rwyArray, size_t s
|
|||
static uint8_t i = 0;
|
||||
static DIRECTION dir;
|
||||
|
||||
if (sz != (GAME_MAX_RWY_LENGTH * sizeof(uint16_t) ))
|
||||
if (sz != (GAME_MAX_RWY_LENGTH * sizeof (uint16_t) ))
|
||||
{
|
||||
Serial_printf( "GameGetSelectedRunwayArray: size %d is different"
|
||||
" than expected (%d bytes). Returning...\n",
|
||||
sz,
|
||||
(GAME_MAX_RWY_LENGTH * sizeof(uint16_t) ) );
|
||||
(GAME_MAX_RWY_LENGTH * sizeof (uint16_t) ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2760,7 +2760,7 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
|
|||
ptrFlightData->State[aircraftIndex] = STATE_FINAL;
|
||||
GameScore += SCORE_REWARD_FINAL;
|
||||
|
||||
GameGetSelectedRunwayArray(assignedRwy, rwyArray, sizeof(rwyArray));
|
||||
GameGetSelectedRunwayArray(assignedRwy, rwyArray, sizeof (rwyArray));
|
||||
|
||||
for (i = 0; i < GAME_MAX_RWY_LENGTH; i++)
|
||||
{
|
||||
|
@ -2769,7 +2769,7 @@ void GameAssignRunwaytoAircraft(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFli
|
|||
|
||||
for (i = 0; (i < GAME_MAX_RWY_LENGTH) && (rwyExit == 0); i++)
|
||||
{
|
||||
for (j = 0; j < (sizeof(rwyExitTiles) / sizeof(rwyExitTiles[0])); j++)
|
||||
for (j = 0; j < (sizeof (rwyExitTiles) / sizeof (rwyExitTiles[0])); j++)
|
||||
{
|
||||
if (rwyTiles[i] == rwyExitTiles[j])
|
||||
{
|
||||
|
@ -3331,18 +3331,18 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
|
|||
|
||||
if (SystemContains_u8( GameLevelBuffer[ptrPlayer->Waypoints[i]],
|
||||
AcceptedTiles,
|
||||
sizeof(AcceptedTiles) ) == false)
|
||||
sizeof (AcceptedTiles) ) == false)
|
||||
{
|
||||
// Now try again with mirrored tiles, just in case!
|
||||
|
||||
for (j = 0; j < (sizeof(AcceptedTiles) * sizeof(uint8_t) ); j++)
|
||||
for (j = 0; j < (sizeof (AcceptedTiles) * sizeof (uint8_t) ); j++)
|
||||
{
|
||||
AcceptedTiles[j] |= TILE_MIRROR_FLAG;
|
||||
}
|
||||
|
||||
if (SystemContains_u8( GameLevelBuffer[ptrPlayer->Waypoints[i]],
|
||||
AcceptedTiles,
|
||||
sizeof(AcceptedTiles) ) == false)
|
||||
sizeof (AcceptedTiles) ) == false)
|
||||
{
|
||||
// Both cases have failed. Return from function.
|
||||
return false;
|
||||
|
@ -3350,7 +3350,7 @@ bool GamePathToTile(TYPE_PLAYER* ptrPlayer, TYPE_FLIGHT_DATA* ptrFlightData)
|
|||
|
||||
// Reverse mirror flag.
|
||||
|
||||
for (j = 0; j < (sizeof(AcceptedTiles) * sizeof(uint8_t) ); j++)
|
||||
for (j = 0; j < (sizeof (AcceptedTiles) * sizeof (uint8_t) ); j++)
|
||||
{
|
||||
AcceptedTiles[j] &= ~(TILE_MIRROR_FLAG);
|
||||
}
|
||||
|
@ -3588,7 +3588,7 @@ void GameGenerateUnboardingSequence(TYPE_PLAYER* ptrPlayer)
|
|||
uint8_t i;
|
||||
unsigned short keyTable[] = { PAD_CROSS, PAD_SQUARE, PAD_TRIANGLE };
|
||||
|
||||
memset(ptrPlayer->UnboardingSequence, 0, sizeof(ptrPlayer->UnboardingSequence) );
|
||||
memset(ptrPlayer->UnboardingSequence, 0, sizeof (ptrPlayer->UnboardingSequence) );
|
||||
|
||||
ptrPlayer->UnboardingSequenceIdx = 0;
|
||||
|
||||
|
@ -3597,7 +3597,7 @@ void GameGenerateUnboardingSequence(TYPE_PLAYER* ptrPlayer)
|
|||
// Only medium level implemented. TODO: Implement other levels
|
||||
for (i = 0; i < UNBOARDING_KEY_SEQUENCE_MEDIUM; i++)
|
||||
{
|
||||
uint8_t randIdx = SystemRand(0, (sizeof(keyTable) / sizeof(keyTable[0])) - 1);
|
||||
uint8_t randIdx = SystemRand(0, (sizeof (keyTable) / sizeof (keyTable[0])) - 1);
|
||||
|
||||
ptrPlayer->UnboardingSequence[i] = keyTable[randIdx];
|
||||
|
||||
|
@ -3901,11 +3901,11 @@ void GameRemoveFlight(uint8_t idx, bool successful)
|
|||
else
|
||||
{
|
||||
// GameRwyArray is filled with runway tiles.
|
||||
GameGetSelectedRunwayArray(GameUsedRwy[k], rwyArray, GAME_MAX_RWY_LENGTH * sizeof(uint16_t) );
|
||||
GameGetSelectedRunwayArray(GameUsedRwy[k], rwyArray, GAME_MAX_RWY_LENGTH * sizeof (uint16_t) );
|
||||
|
||||
if (SystemContains_u16( AircraftGetTileFromFlightDataIndex(idx),
|
||||
rwyArray,
|
||||
sizeof(rwyArray) / sizeof(rwyArray[0]) ) != false)
|
||||
sizeof (rwyArray) / sizeof (rwyArray[0]) ) != false)
|
||||
{
|
||||
GameUsedRwy[k] = 0;
|
||||
}
|
||||
|
|
|
@ -266,8 +266,8 @@ void GameGuiInit(void)
|
|||
|
||||
LoadMenu( GameFileList,
|
||||
GameFileDest,
|
||||
sizeof(GameFileList) / sizeof(char*),
|
||||
sizeof(GameFileDest) /sizeof(void*) );
|
||||
sizeof (GameFileList) / sizeof (char*),
|
||||
sizeof (GameFileDest) /sizeof (void*) );
|
||||
}
|
||||
|
||||
PauseRect.x[0] = PAUSE_DIALOG_X;
|
||||
|
|
|
@ -126,8 +126,8 @@ void LoadMenuInit(void)
|
|||
first_load = true;
|
||||
LoadMenuLoadFileList( LoadMenuFiles,
|
||||
LoadMenuDest,
|
||||
sizeof(LoadMenuFiles) / sizeof(char*),
|
||||
sizeof(LoadMenuDest) / sizeof(void*));
|
||||
sizeof (LoadMenuFiles) / sizeof (char*),
|
||||
sizeof (LoadMenuDest) / sizeof (void*));
|
||||
}
|
||||
|
||||
FontSetSize(&SmallFont, SMALL_FONT_SIZE);
|
||||
|
|
|
@ -70,4 +70,4 @@ short MainMenuBtnAni[] =
|
|||
0
|
||||
};
|
||||
|
||||
size_t MainMenuBtnAni_sz = sizeof(MainMenuBtnAni) / sizeof(MainMenuBtnAni[0]);
|
||||
size_t MainMenuBtnAni_sz = sizeof (MainMenuBtnAni) / sizeof (MainMenuBtnAni[0]);
|
||||
|
|
|
@ -173,7 +173,7 @@ void MemCardInit(void)
|
|||
}
|
||||
}
|
||||
|
||||
bzero((TYPE_MEMCARD_ERRORS*)&MemCardErrors, sizeof(TYPE_MEMCARD_ERRORS) );
|
||||
bzero((TYPE_MEMCARD_ERRORS*)&MemCardErrors, sizeof (TYPE_MEMCARD_ERRORS) );
|
||||
}
|
||||
|
||||
void ISR_MemCardDataHandling(void)
|
||||
|
@ -290,7 +290,7 @@ void ISR_MemCardDataHandling(void)
|
|||
|
||||
void MemCardResetBlockData(TYPE_BLOCK_DATA * ptrBlockData)
|
||||
{
|
||||
bzero((TYPE_BLOCK_DATA*)ptrBlockData, sizeof(TYPE_BLOCK_DATA));
|
||||
bzero((TYPE_BLOCK_DATA*)ptrBlockData, sizeof (TYPE_BLOCK_DATA));
|
||||
|
||||
ptrBlockData->BlockCount = FIRST_OR_ONLY_BLOCK;
|
||||
|
||||
|
@ -545,7 +545,7 @@ bool MemCardGetIconFrameInfo(TYPE_BLOCK_DATA * ptrBlockData)
|
|||
Serial_printf("\tIcon %d out of %d\n",i, ptrBlockData->IconNumber);
|
||||
buffer_contents = 0;
|
||||
sector = initial_sector + i;
|
||||
memset(DataBuffer, 0, MEMCARD_SECTOR_SIZE * sizeof(uint8_t) );
|
||||
memset(DataBuffer, 0, MEMCARD_SECTOR_SIZE * sizeof (uint8_t) );
|
||||
|
||||
if (MemCardReadSector(ptrBlockData, sector) == false)
|
||||
{
|
||||
|
@ -946,8 +946,8 @@ TYPE_BLOCK_DATA * MemCardShowMap(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
bzero((GsRectangle*)&MemCardMapDialog, sizeof(GsRectangle));
|
||||
bzero((GsRectangle*)&emptyBlockRect, sizeof(GsRectangle));
|
||||
bzero((GsRectangle*)&MemCardMapDialog, sizeof (GsRectangle));
|
||||
bzero((GsRectangle*)&emptyBlockRect, sizeof (GsRectangle));
|
||||
|
||||
emptyBlockRect.attribute |= ENABLE_TRANS | TRANS_MODE(1);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ typedef enum t_levelId
|
|||
{
|
||||
LEVEL1 = 0,
|
||||
LEVEL2,
|
||||
MAX_LEVELS = LEVEL2
|
||||
MAX_LEVELS
|
||||
}LEVEL_ID;
|
||||
|
||||
typedef struct t_lvlpltdata
|
||||
|
@ -252,8 +252,8 @@ void MainMenuInit(void)
|
|||
|
||||
LoadMenu( MainMenuFiles,
|
||||
MainMenuDest,
|
||||
sizeof(MainMenuFiles) / sizeof(char*) ,
|
||||
sizeof(MainMenuDest) / sizeof(void*) );
|
||||
sizeof (MainMenuFiles) / sizeof (char*) ,
|
||||
sizeof (MainMenuDest) / sizeof (void*) );
|
||||
|
||||
MainMenuBtn[PLAY_BUTTON_INDEX].offset_u = PLAY_BUTTON_U_OFFSET;
|
||||
MainMenuBtn[PLAY_BUTTON_INDEX].offset_v = PLAY_BUTTON_Y_OFFSET;
|
||||
|
@ -300,7 +300,7 @@ void MenuCheatInit(void)
|
|||
{
|
||||
TestCheat.Callback = &MenuTestCheat;
|
||||
memset(TestCheat.Combination,0,CHEAT_ARRAY_SIZE);
|
||||
//memcpy(myarray, (int [5]){a,b,c,d,e}, 5*sizeof(int));
|
||||
//memcpy(myarray, (int [5]){a,b,c,d,e}, 5*sizeof (int));
|
||||
|
||||
memcpy( TestCheat.Combination,
|
||||
(unsigned short[CHEAT_ARRAY_SIZE])
|
||||
|
@ -308,7 +308,7 @@ void MenuCheatInit(void)
|
|||
PAD_TRIANGLE, PAD_TRIANGLE, 0 , 0 ,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0 } ,
|
||||
sizeof(unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
sizeof (unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
|
||||
PadAddCheat(&TestCheat);
|
||||
|
||||
|
@ -321,7 +321,7 @@ void MenuCheatInit(void)
|
|||
PAD_L1, PAD_R1, 0 , 0 ,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0 } ,
|
||||
sizeof(unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
sizeof (unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
|
||||
PadAddCheat(&StackCheckCheat);
|
||||
|
||||
|
@ -334,7 +334,7 @@ void MenuCheatInit(void)
|
|||
PAD_CIRCLE, PAD_CIRCLE, PAD_TRIANGLE , PAD_TRIANGLE ,
|
||||
PAD_L1, PAD_L1, PAD_R1, PAD_R1,
|
||||
PAD_L2, PAD_L2, PAD_R2, PAD_R2 } ,
|
||||
sizeof(unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
sizeof (unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
|
||||
PadAddCheat(&DevMenuCheat);
|
||||
|
||||
|
@ -347,7 +347,7 @@ void MenuCheatInit(void)
|
|||
PAD_CIRCLE, PAD_CIRCLE, PAD_CIRCLE , PAD_CIRCLE ,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0 } ,
|
||||
sizeof(unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
sizeof (unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
|
||||
PadAddCheat(&SerialCheat);
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ void MainMenuRenderLevelList(void)
|
|||
|
||||
GsGPoly4 levelListRect = {0};
|
||||
GsGPoly4 levelListSelectionRect = {0};
|
||||
uint8_t i;
|
||||
LEVEL_ID i;
|
||||
|
||||
levelListRect.x[0] = LEVEL_LIST_RECT_X;
|
||||
levelListRect.x[1] = LEVEL_LIST_RECT_X + LEVEL_LIST_RECT_W;
|
||||
|
@ -506,26 +506,34 @@ void MainMenuRenderLevelList(void)
|
|||
|
||||
levelListSelectionRect.attribute |= ENABLE_TRANS | TRANS_MODE(0);
|
||||
|
||||
for (i = 0; i < (sizeof(MainMenuLevelList) / sizeof(MainMenuLevelList[0])); i++)
|
||||
for (i = LEVEL1; i < MAX_LEVELS; i++)
|
||||
{
|
||||
char baseName[32];
|
||||
uint8_t j;
|
||||
const size_t maxLength = sizeof (baseName) / sizeof (baseName[0]);
|
||||
|
||||
// Update "baseName" with file name + extension.
|
||||
SystemGetFileBasename(MainMenuLevelList[i], baseName, sizeof(baseName) / sizeof(baseName[0]));
|
||||
SystemGetFileBasename(MainMenuLevelList[i], baseName, maxLength);
|
||||
|
||||
FontPrintText(&SmallFont, LEVEL_LIST_TEXT_X, LEVEL_LIST_TEXT_Y + (i << 3), baseName);
|
||||
|
||||
if (i == SelectedLevel)
|
||||
{
|
||||
for (j = 0; j < (sizeof(MainMenuPltList) / sizeof(MainMenuPltList[0])); j++)
|
||||
const char** ptrPltLevelArray;
|
||||
size_t j;
|
||||
|
||||
for (ptrPltLevelArray = MainMenuPltList[i], j = 0; *ptrPltLevelArray != NULL; ptrPltLevelArray++, j++)
|
||||
{
|
||||
if (MainMenuPltList[i][j] != NULL)
|
||||
const char* strPltLevel = *ptrPltLevelArray;
|
||||
|
||||
if (strPltLevel != NULL)
|
||||
{
|
||||
// Update "baseName" with file name + extension.
|
||||
SystemGetFileBasename(MainMenuPltList[i][j], baseName, sizeof(baseName) / sizeof(baseName[0]));
|
||||
SystemGetFileBasename(strPltLevel, baseName, maxLength);
|
||||
|
||||
FontPrintText(&SmallFont, LEVEL_LIST_PLT_TEXT_X, LEVEL_LIST_PLT_TEXT_Y + (j << 3), baseName);
|
||||
FontPrintText( &SmallFont,
|
||||
LEVEL_LIST_PLT_TEXT_X,
|
||||
LEVEL_LIST_PLT_TEXT_Y + (j << 3),
|
||||
baseName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -572,7 +580,7 @@ void MainMenuRestoreInitValues(void)
|
|||
SelectedLevel = LEVEL1;
|
||||
SelectedPlt = 0;
|
||||
|
||||
memset(&GameCfg, 0, sizeof(TYPE_GAME_CONFIGURATION));
|
||||
memset(&GameCfg, 0, sizeof (TYPE_GAME_CONFIGURATION));
|
||||
|
||||
for (i = 0; i < MAIN_MENU_BUTTONS_MAX; i++)
|
||||
{
|
||||
|
@ -656,7 +664,7 @@ void MainMenuButtonHandler(void)
|
|||
{
|
||||
if (isLevelSelected == false)
|
||||
{
|
||||
if (SelectedLevel < MAX_LEVELS)
|
||||
if (SelectedLevel < (MAX_LEVELS - 1))
|
||||
{
|
||||
SelectedLevel++;
|
||||
SelectedPlt = 0;
|
||||
|
|
|
@ -30,7 +30,7 @@ static uint8_t MessageIdx;
|
|||
|
||||
void MessageInit(void)
|
||||
{
|
||||
bzero(tMessageFIFO, sizeof(tMessageFIFO));
|
||||
bzero(tMessageFIFO, sizeof (tMessageFIFO));
|
||||
MessageIdx = NO_MESSAGE;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ bool MessageCreate(TYPE_MESSAGE_DATA* ptrMessage)
|
|||
|
||||
if (m->used == false)
|
||||
{
|
||||
memcpy(m, ptrMessage, sizeof(TYPE_MESSAGE_DATA));
|
||||
memcpy(m, ptrMessage, sizeof (TYPE_MESSAGE_DATA));
|
||||
|
||||
m->used = true;
|
||||
|
||||
|
|
|
@ -459,7 +459,7 @@ void PadInit(void)
|
|||
pad1_cheat_timer = TimerCreate(PAD_CHEAT_TIMEOUT,true /* Repeat flag */,&PadOneCleanCheatArray);
|
||||
pad2_cheat_timer = TimerCreate(PAD_CHEAT_TIMEOUT,true /* Repeat flag */,&PadTwoCleanCheatArray);
|
||||
|
||||
memset(cheatsArray,0, sizeof(cheatsArray));
|
||||
memset(cheatsArray,0, sizeof (cheatsArray));
|
||||
}
|
||||
|
||||
void PadCheatHandler(uint8_t n_pad)
|
||||
|
@ -520,7 +520,7 @@ void PadCheatHandler(uint8_t n_pad)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(available_keys) / sizeof(unsigned short); i++)
|
||||
for (i = 0; i < sizeof (available_keys) / sizeof (unsigned short); i++)
|
||||
{
|
||||
if (pressed_callback(available_keys[i]) != false)
|
||||
{
|
||||
|
@ -575,12 +575,12 @@ bool PadAddCheat(TYPE_CHEAT * cheat)
|
|||
|
||||
void PadOneCleanCheatArray(void)
|
||||
{
|
||||
memset(pad1_cheat_array,0,sizeof(unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
memset(pad1_cheat_array,0,sizeof (unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
}
|
||||
|
||||
void PadTwoCleanCheatArray(void)
|
||||
{
|
||||
memset(pad2_cheat_array,0,sizeof(unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
memset(pad2_cheat_array,0,sizeof (unsigned short) * CHEAT_ARRAY_SIZE);
|
||||
}
|
||||
|
||||
unsigned short* PadGetPlayerOneCheatArray(void)
|
||||
|
|
|
@ -239,7 +239,7 @@ bool PltParserLoadFile(char* strPath, TYPE_FLIGHT_DATA* ptrFlightData)
|
|||
strncpy(tMessage.strMessage, lineBufferPtr, MAX_MESSAGE_STR_SIZE);
|
||||
MessageCreate(&tMessage);
|
||||
|
||||
bzero(&tMessage, sizeof(tMessage));
|
||||
bzero(&tMessage, sizeof (tMessage));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -431,13 +431,13 @@ uint8_t* PltParserGenerateFile(TYPE_PLT_CONFIG* ptrPltConfig)
|
|||
{
|
||||
// Set departure flight
|
||||
|
||||
memcpy(&PltBuffer[i], "DEPARTURE", sizeof("DEPARTURE") * sizeof(uint8_t) );
|
||||
memcpy(&PltBuffer[i], "DEPARTURE", sizeof ("DEPARTURE") * sizeof (uint8_t) );
|
||||
i += strlen("DEPARTURE");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set arrival flight
|
||||
memcpy(&PltBuffer[i], "ARRIVAL", sizeof("ARRIVAL") * sizeof(uint8_t) );
|
||||
memcpy(&PltBuffer[i], "ARRIVAL", sizeof ("ARRIVAL") * sizeof (uint8_t) );
|
||||
i += strlen("ARRIVAL");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -472,7 +472,7 @@ void SystemCheckTimer(bool* timer, uint64_t* last_timer, uint8_t step)
|
|||
bool SystemLoadFileToBuffer(char* fname, uint8_t* buffer, uint32_t szBuffer)
|
||||
{
|
||||
#ifdef SERIAL_INTERFACE
|
||||
uint8_t fileSizeBuffer[sizeof(uint32_t)] = {0};
|
||||
uint8_t fileSizeBuffer[sizeof (uint32_t)] = {0};
|
||||
uint32_t i;
|
||||
#else // SERIAL_INTERFACE
|
||||
FILE *f;
|
||||
|
@ -493,9 +493,9 @@ bool SystemLoadFileToBuffer(char* fname, uint8_t* buffer, uint32_t szBuffer)
|
|||
#ifdef SERIAL_INTERFACE
|
||||
Serial_printf("#%s@", fname);
|
||||
|
||||
SerialRead(fileSizeBuffer, sizeof(uint32_t) );
|
||||
SerialRead(fileSizeBuffer, sizeof (uint32_t) );
|
||||
|
||||
for (i = 0; i < sizeof(uint32_t); i++)
|
||||
for (i = 0; i < sizeof (uint32_t); i++)
|
||||
{
|
||||
size |= fileSizeBuffer[i] << (i << 3); // (i << 3) == (i * 8)
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ bool SystemLoadFileToBuffer(char* fname, uint8_t* buffer, uint32_t szBuffer)
|
|||
|
||||
SerialRead(file_buffer + i, bytes_to_read);
|
||||
|
||||
SerialWrite(ACK_BYTE_STRING, sizeof(uint8_t)); // Write ACK
|
||||
SerialWrite(ACK_BYTE_STRING, sizeof (uint8_t)); // Write ACK
|
||||
}
|
||||
#else // SERIAL_INTERFACE
|
||||
|
||||
|
@ -549,7 +549,7 @@ bool SystemLoadFileToBuffer(char* fname, uint8_t* buffer, uint32_t szBuffer)
|
|||
|
||||
fseek(f, 0, SEEK_SET); //f->pos = 0;
|
||||
|
||||
fread(buffer, sizeof(char), size, f);
|
||||
fread(buffer, sizeof (char), size, f);
|
||||
|
||||
fclose(f);
|
||||
|
||||
|
@ -577,7 +577,7 @@ bool SystemLoadFileToBuffer(char* fname, uint8_t* buffer, uint32_t szBuffer)
|
|||
* ****************************************************************************************/
|
||||
bool SystemLoadFile(char*fname)
|
||||
{
|
||||
return SystemLoadFileToBuffer(fname,file_buffer,sizeof(file_buffer));
|
||||
return SystemLoadFileToBuffer(fname,file_buffer,sizeof (file_buffer));
|
||||
}
|
||||
|
||||
/* ******************************************************************
|
||||
|
@ -605,7 +605,7 @@ uint8_t* SystemGetBufferAddress(void)
|
|||
* *****************************************************************/
|
||||
void SystemClearBuffer(void)
|
||||
{
|
||||
memset(file_buffer, 0, sizeof(file_buffer));
|
||||
memset(file_buffer, 0, sizeof (file_buffer));
|
||||
}
|
||||
|
||||
/* ******************************************************************
|
||||
|
@ -1200,11 +1200,11 @@ void SystemDevMenu(void)
|
|||
}
|
||||
}
|
||||
|
||||
void SystemGetFileBasename(const char* fileName, char* str, size_t sz)
|
||||
void SystemGetFileBasename(const char* fileName, char* str, const size_t sz)
|
||||
{
|
||||
size_t i;
|
||||
size_t j = 0;
|
||||
size_t len = strlen(fileName);
|
||||
const size_t len = strlen(fileName);
|
||||
|
||||
memset(str, 0, sz);
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ unsigned char SystemGetSineValue(void);
|
|||
|
||||
// Fills str with only file name and extension given input file path.
|
||||
// For example: "FOLDER\\FOLDER\\MYFILE.EXT;1" -> "MYFILE.EXT"
|
||||
void SystemGetFileBasename(const char* fileName, char* str, size_t sz);
|
||||
void SystemGetFileBasename(const char* fileName, char* str, const size_t sz);
|
||||
|
||||
/* **************************************
|
||||
* Global Variables *
|
||||
|
|
Loading…
Reference in New Issue