Author SHA1 Message Date
ThePixelMoonandGitHub 87c9733e09 Merge pull request #80 from zukrmn/fix/linux-compiler-warnings
fix: resolve high-severity Linux compiler warnings
2026-03-07 03:23:05 +02:00
zukrmn e3fc6ebe52 fix: resolve high-severity Linux compiler warnings 2026-03-06 22:57:02 +00:00
Leah AndersonandGitHub 41314fa873 Merge pull request #72 from MrShrekThird/dev
Update CONTRIBUTING.md
2026-03-06 11:41:18 -07:00
MrShrekThirdandGitHub 04cadcf953 Removed README.md link lol 2026-03-06 18:37:31 +00:00
MrShrekThirdandGitHub daf43609ca Update CONTRIBUTING.md with README link
Added a note to visit README.md for compilation instructions.
2026-03-06 18:25:52 +00:00
MrShrekThirdandGitHub 42e84f9f4a Update CONTRIBUTING.md
Removed outdated and redundant compilation instructions.
2026-03-06 18:19:13 +00:00
JuiceyDevandGitHub dc57bf5634 Merge pull request #62 from 4jcraft/fix/byte-typealias
fix: remove `byte` type alias
2026-03-06 18:40:36 +01:00
JuiceyDevandGitHub a875a6ef98 Merge pull request #69 from 4jcraft/refactor/optional-llvm-toolchain
refactor(build): make `lld` optional and recommend clang/llvm in README
2026-03-06 18:35:19 +01:00
Tropical 0dd1654dec docs: undo accidental comment replacement 2026-03-06 05:13:40 -06:00
Tropical b8c4e96409 fix: more replacement mistakes 2026-03-06 05:09:17 -06:00
Tropical 6c56d884e5 fix: undo some mistakes 2026-03-06 05:06:27 -06:00
Tropical 15af35eef2 fix: remove byte type alias 2026-03-06 05:03:37 -06:00
205 changed files with 696 additions and 700 deletions
-8
View File
@@ -24,11 +24,3 @@ Simple rules for publishing code:
Make sure your code compiles before making a pull request! and make sure that it's readable Make sure your code compiles before making a pull request! and make sure that it's readable
Remember ALL your changes will be licensed under GNU General Public License V3.0. Remember ALL your changes will be licensed under GNU General Public License V3.0.
## Compiling the project:
> [!NOTE]
> The project is currently in a non-compilable state (as of 3/3/2026)
1. Install CMake, Make, GCC (>= 15.0), G++ (>= 15.0).
2. Create a new directory named build after cloning the repository.
3. Enter the new directory and run `cmake ..` and then run `make`
@@ -104,7 +104,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
{ {
DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i); DLCGameRulesHeader *dlcHeader = (DLCGameRulesHeader *)pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i);
DWORD dSize; DWORD dSize;
byte *dData = dlcHeader->getData(dSize); uint8_t *dData = dlcHeader->getData(dSize);
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(); LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
// = loadGameRules(dData, dSize); //, strings); // = loadGameRules(dData, dSize); //, strings);
@@ -126,7 +126,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i); DLCGameRulesFile *dlcFile = (DLCGameRulesFile *)pack->getFile(DLCManager::e_DLCType_GameRules, i);
DWORD dSize; DWORD dSize;
byte *dData = dlcFile->getData(dSize); uint8_t *dData = dlcFile->getData(dSize);
LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(); LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions();
// = loadGameRules(dData, dSize); //, strings); // = loadGameRules(dData, dSize); //, strings);
@@ -142,7 +142,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack)
} }
} }
LevelGenerationOptions *GameRuleManager::loadGameRules(byte *dIn, UINT dSize) LevelGenerationOptions *GameRuleManager::loadGameRules(uint8_t *dIn, UINT dSize)
{ {
LevelGenerationOptions *lgo = new LevelGenerationOptions(); LevelGenerationOptions *lgo = new LevelGenerationOptions();
lgo->setGrSource( new JustGrSource() ); lgo->setGrSource( new JustGrSource() );
@@ -153,7 +153,7 @@ LevelGenerationOptions *GameRuleManager::loadGameRules(byte *dIn, UINT dSize)
} }
// 4J-JEV: Reverse of saveGameRules. // 4J-JEV: Reverse of saveGameRules.
void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT dSize) void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize)
{ {
app.DebugPrintf("GameRuleManager::LoadingGameRules:\n"); app.DebugPrintf("GameRuleManager::LoadingGameRules:\n");
@@ -240,7 +240,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT
} }
// 4J-JEV: Reverse of loadGameRules. // 4J-JEV: Reverse of loadGameRules.
void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize) void GameRuleManager::saveGameRules(uint8_t **dOut, UINT *dSize)
{ {
if (m_currentGameRuleDefinitions == NULL && if (m_currentGameRuleDefinitions == NULL &&
m_currentLevelGenerationOptions == NULL) m_currentLevelGenerationOptions == NULL)
@@ -373,7 +373,7 @@ void GameRuleManager::writeRuleFile(DataOutputStream *dos)
m_currentGameRuleDefinitions->write(dos); m_currentGameRuleDefinitions->write(dos);
} }
bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings) bool GameRuleManager::readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings)
{ {
bool levelGenAdded = false; bool levelGenAdded = false;
bool gameRulesAdded = false; bool gameRulesAdded = false;
@@ -40,10 +40,10 @@ public:
void loadGameRules(DLCPack *); void loadGameRules(DLCPack *);
LevelGenerationOptions *loadGameRules(byte *dIn, UINT dSize); LevelGenerationOptions *loadGameRules(uint8_t *dIn, UINT dSize);
void loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT dSize); void loadGameRules(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize);
void saveGameRules(byte **dOut, UINT *dSize); void saveGameRules(uint8_t **dOut, UINT *dSize);
private: private:
LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh); LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh);
@@ -51,7 +51,7 @@ private:
void writeRuleFile(DataOutputStream *dos); void writeRuleFile(DataOutputStream *dos);
public: public:
bool readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings); bool readRuleFile(LevelGenerationOptions *lgo, uint8_t *dIn, UINT dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings);
private: private:
void readAttributes(DataInputStream *dis, vector<wstring> *tagsAndAtts, GameRuleDefinition *rule); void readAttributes(DataInputStream *dis, vector<wstring> *tagsAndAtts, GameRuleDefinition *rule);
+2 -2
View File
@@ -406,8 +406,8 @@ void C_4JProfile::Initialise( DWORD dwTitleID,
{ {
for( int i = 0; i < 4; i++ ) for( int i = 0; i < 4; i++ )
{ {
profileData[i] = new byte[iGameDefinedDataSizeX4/4]; profileData[i] = new uint8_t[iGameDefinedDataSizeX4/4];
ZeroMemory(profileData[i],sizeof(byte)*iGameDefinedDataSizeX4/4); ZeroMemory(profileData[i],sizeof(uint8_t)*iGameDefinedDataSizeX4/4);
// Set some sane initial values! // Set some sane initial values!
GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)profileData[i]; GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)profileData[i];
+1
View File
@@ -49,6 +49,7 @@ void GameMode::render(float a)
bool GameMode::useItem(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, bool bTestUseOnly) bool GameMode::useItem(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, bool bTestUseOnly)
{ {
return false;
} }
void GameMode::initPlayer(shared_ptr<Player> player) void GameMode::initPlayer(shared_ptr<Player> player)
+1 -1
View File
@@ -995,7 +995,7 @@ bool ServerLevel::addGlobalEntity(shared_ptr<Entity> e)
return false; return false;
} }
void ServerLevel::broadcastEntityEvent(shared_ptr<Entity> e, byte event) void ServerLevel::broadcastEntityEvent(shared_ptr<Entity> e, uint8_t event)
{ {
shared_ptr<Packet> p = shared_ptr<EntityEventPacket>( new EntityEventPacket(e->entityId, event) ); shared_ptr<Packet> p = shared_ptr<EntityEventPacket>( new EntityEventPacket(e->entityId, event) );
server->getLevel(dimension->id)->getTracker()->broadcastAndSend(e, p); server->getLevel(dimension->id)->getTracker()->broadcastAndSend(e, p);
+1 -1
View File
@@ -98,7 +98,7 @@ protected:
public: public:
shared_ptr<Entity> getEntity(int id); shared_ptr<Entity> getEntity(int id);
virtual bool addGlobalEntity(shared_ptr<Entity> e); virtual bool addGlobalEntity(shared_ptr<Entity> e);
void broadcastEntityEvent(shared_ptr<Entity> e, byte event); void broadcastEntityEvent(shared_ptr<Entity> e, uint8_t event);
virtual shared_ptr<Explosion> explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks); virtual shared_ptr<Explosion> explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks);
virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1); virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1);
@@ -194,7 +194,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z)
// 4J - changed to use new methods for lighting // 4J - changed to use new methods for lighting
chunk->setSkyLightDataAllBright(); chunk->setSkyLightDataAllBright();
// Arrays::fill(chunk->skyLight->data, (byte) 255); // Arrays::fill(chunk->skyLight->data, (uint8_t) 255);
} }
chunk->loaded = true; chunk->loaded = true;
+1 -1
View File
@@ -342,7 +342,7 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate)
else else
{ {
// 4J As we only get here if changes is less than MAX_CHANGES_BEFORE_RESEND (10) we only need to send a byte value in the packet // 4J As we only get here if changes is less than MAX_CHANGES_BEFORE_RESEND (10) we only need to send a byte value in the packet
broadcast( shared_ptr<ChunkTilesUpdatePacket>( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, (byte)changes, level) ) ); broadcast( shared_ptr<ChunkTilesUpdatePacket>( new ChunkTilesUpdatePacket(pos.x, pos.z, changedTiles, (uint8_t)changes, level) ) );
for (int i = 0; i < changes; i++) for (int i = 0; i < changes; i++)
{ {
int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15); int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15);
@@ -1205,7 +1205,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptr<SetCreativeModeSlotP
// 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map // 4J-PB - for Xbox maps, we'll centre them on the origin of the world, since we can fit the whole world in our map
data->x = centreXC; data->x = centreXC;
data->z = centreZC; data->z = centreZC;
data->dimension = (byte) player->level->dimension->id; data->dimension = (uint8_t) player->level->dimension->id;
data->setDirty(); data->setDirty();
} }
+1 -1
View File
@@ -210,7 +210,7 @@ void PlayerList::placeNewPlayer(Connection *connection, shared_ptr<ServerPlayer>
addPlayerToReceiving( player ); addPlayerToReceiving( player );
playerConnection->send( shared_ptr<LoginPacket>( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), playerConnection->send( shared_ptr<LoginPacket>( new LoginPacket(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(),
(byte) level->dimension->id, (byte) level->getMaxBuildHeight(), (byte) getMaxPlayers(), (uint8_t) level->dimension->id, (uint8_t) level->getMaxBuildHeight(), (uint8_t) getMaxPlayers(),
level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), (BYTE)playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(), level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), (BYTE)playerIndex, level->useNewSeaLevel(), player->getAllPlayerGamePrivileges(),
level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ) ); level->getLevelData()->getXZSize(), level->getLevelData()->getHellScale() ) ) );
playerConnection->send( shared_ptr<SetSpawnPositionPacket>( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) ); playerConnection->send( shared_ptr<SetSpawnPositionPacket>( new SetSpawnPositionPacket(spawnPos->x, spawnPos->y, spawnPos->z) ) );
@@ -687,7 +687,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener)
} }
LevelChunk *chunk = NULL; LevelChunk *chunk = NULL;
byte workingThreads; uint8_t workingThreads;
bool chunkSet = false; bool chunkSet = false;
// Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage. // Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage.
@@ -386,8 +386,8 @@ void DurangoStatsDebugger::retrieveStats(int iPad)
// ----------------------------------------- // // ----------------------------------------- //
byte runningThreads = 0; uint8_t runningThreads = 0;
byte *r_runningThreads = &runningThreads; uint8_t *r_runningThreads = &runningThreads;
if (xuid.toString().compare(L"") == 0) if (xuid.toString().compare(L"") == 0)
{ {
@@ -282,7 +282,7 @@ void ChatIntegrationLayer::OnOutgoingChatPacketReady(
__in Microsoft::Xbox::GameChat::ChatPacketEventArgs^ args __in Microsoft::Xbox::GameChat::ChatPacketEventArgs^ args
) )
{ {
byte *bytes; uint8_t *bytes;
int byteCount; int byteCount;
GetBufferBytes(args->PacketBuffer, &bytes); GetBufferBytes(args->PacketBuffer, &bytes);
@@ -300,7 +300,7 @@ void ChatIntegrationLayer::OnOutgoingChatPacketReady(
void ChatIntegrationLayer::OnIncomingChatMessage( void ChatIntegrationLayer::OnIncomingChatMessage(
unsigned int sessionAddress, unsigned int sessionAddress,
Platform::Array<byte>^ message Platform::Array<uint8_t>^ message
) )
{ {
// To integrate the Chat DLL in your game, change the following code to use your game's network layer. // To integrate the Chat DLL in your game, change the following code to use your game's network layer.
@@ -797,7 +797,7 @@ void ChatIntegrationLayer::GetBufferBytes( __in Windows::Storage::Streams::IBuff
srcBufferByteAccess->Buffer(ppOut); srcBufferByteAccess->Buffer(ppOut);
} }
Windows::Storage::Streams::IBuffer^ ChatIntegrationLayer::ArrayToBuffer( __in Platform::Array<byte>^ array ) Windows::Storage::Streams::IBuffer^ ChatIntegrationLayer::ArrayToBuffer( __in Platform::Array<uint8_t>^ array )
{ {
Windows::Storage::Streams::DataWriter^ writer = ref new Windows::Storage::Streams::DataWriter(); Windows::Storage::Streams::DataWriter^ writer = ref new Windows::Storage::Streams::DataWriter();
writer->WriteBytes(array); writer->WriteBytes(array);
@@ -94,7 +94,7 @@ public:
/// <param name="uniqueRemoteConsoleIdentifier">A unique ID for the remote console</param> /// <param name="uniqueRemoteConsoleIdentifier">A unique ID for the remote console</param>
void OnIncomingChatMessage( void OnIncomingChatMessage(
unsigned int sessionAddress, unsigned int sessionAddress,
Platform::Array<byte>^ message Platform::Array<uint8_t>^ message
); );
/// <summary> /// <summary>
@@ -217,7 +217,7 @@ public:
private: private:
void GetBufferBytes( __in Windows::Storage::Streams::IBuffer^ buffer, __out byte** ppOut ); void GetBufferBytes( __in Windows::Storage::Streams::IBuffer^ buffer, __out byte** ppOut );
Windows::Storage::Streams::IBuffer^ ArrayToBuffer( __in Platform::Array<byte>^ array ); Windows::Storage::Streams::IBuffer^ ArrayToBuffer( __in Platform::Array<uint8_t>^ array );
Concurrency::critical_section m_lock; Concurrency::critical_section m_lock;
Microsoft::Xbox::GameChat::ChatManager^ m_chatManager; Microsoft::Xbox::GameChat::ChatManager^ m_chatManager;
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize; static size_t s_currentConfigSize;
static size_t s_dataWrittenSize; static size_t s_dataWrittenSize;
static byte *s_dataWritten; static uint8_t *s_dataWritten;
public: public:
static void Tick(); static void Tick();
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize; static size_t s_currentConfigSize;
static size_t s_dataWrittenSize; static size_t s_dataWrittenSize;
static byte *s_dataWritten; static uint8_t *s_dataWritten;
public: public:
static void Tick(); static void Tick();
@@ -451,7 +451,7 @@ int SonyRemoteStorage_PS3::LoadCompressCallback(void *pParam,bool bIsCorrupt, bo
// We add 4 bytes to the start so that we can signal compressed data // We add 4 bytes to the start so that we can signal compressed data
// And another 4 bytes to store the decompressed data size // And another 4 bytes to store the decompressed data size
unsigned int compLength = origFilesize+8; unsigned int compLength = origFilesize+8;
byte *compData = (byte *)malloc( compLength ); uint8_t *compData = (uint8_t *)malloc( compLength );
Compression::UseDefaultThreadStorage(); Compression::UseDefaultThreadStorage();
Compression::getCompression()->Compress(compData+8,&compLength,pOrigSaveData,origFilesize); Compression::getCompression()->Compress(compData+8,&compLength,pOrigSaveData,origFilesize);
ZeroMemory(compData,8); ZeroMemory(compData,8);
@@ -777,7 +777,7 @@ crc_basic<Bits>::process_byte
unsigned char byte unsigned char byte
) )
{ {
process_bits( (rft_in_ ? detail::reflector<CHAR_BIT>::reflect(byte) process_bits( (rft_in_ ? detail::reflector<CHAR_BIT>::reflect(uint8_t)
: byte), CHAR_BIT ); : byte), CHAR_BIT );
} }
@@ -938,7 +938,7 @@ BOOST_CRC_OPTIMAL_NAME::process_byte
unsigned char byte unsigned char byte
) )
{ {
process_bytes( &byte, sizeof(byte) ); process_bytes( &byte, sizeof(uint8_t) );
} }
template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
@@ -1004,7 +1004,7 @@ BOOST_CRC_OPTIMAL_NAME::operator ()
unsigned char byte unsigned char byte
) )
{ {
process_byte( byte ); process_byte( uint8_t );
} }
template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly, template < std::size_t Bits, BOOST_CRC_PARM_TYPE TruncPoly,
@@ -20,9 +20,9 @@ public:
unsigned int minColour = ms_pTileData->stemTile_minColour; unsigned int minColour = ms_pTileData->stemTile_minColour;
unsigned int maxColour = ms_pTileData->stemTile_maxColour; unsigned int maxColour = ms_pTileData->stemTile_maxColour;
byte redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( data/7.0f)); uint8_t redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( data/7.0f));
byte greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( data/7.0f)); uint8_t greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( data/7.0f));
byte blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( data/7.0f)); uint8_t blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( data/7.0f));
colour = redComponent<<16 | greenComponent<<8 | blueComponent; colour = redComponent<<16 | greenComponent<<8 | blueComponent;
return colour; return colour;
@@ -360,7 +360,7 @@ void Tesselator_SPU::color(int r, int g, int b, int a)
col = (r << 24) | (g << 16) | (b << 8) | (a); col = (r << 24) | (g << 16) | (b << 8) | (a);
} }
void Tesselator_SPU::color(byte r, byte g, byte b) void Tesselator_SPU::color(uint8_t r, uint8_t g, uint8_t b)
{ {
color(r & 0xff, g & 0xff, b & 0xff); color(r & 0xff, g & 0xff, b & 0xff);
} }
@@ -723,9 +723,9 @@ void Tesselator_SPU::noColor()
void Tesselator_SPU::normal(float x, float y, float z) void Tesselator_SPU::normal(float x, float y, float z)
{ {
hasNormal = true; hasNormal = true;
byte xx = (byte) (x * 127); uint8_t xx = (uint8_t) (x * 127);
byte yy = (byte) (y * 127); uint8_t yy = (uint8_t) (y * 127);
byte zz = (byte) (z * 127); uint8_t zz = (uint8_t) (z * 127);
_normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16);
} }
@@ -154,7 +154,7 @@ public:
void color(float r, float g, float b, float a); void color(float r, float g, float b, float a);
void color(int r, int g, int b); void color(int r, int g, int b);
void color(int r, int g, int b, int a); void color(int r, int g, int b, int a);
void color(byte r, byte g, byte b); void color(uint8_t r, uint8_t g, uint8_t b);
void vertexUV(float x, float y, float z, float u, float v); void vertexUV(float x, float y, float z, float u, float v);
void vertex(float x, float y, float z); void vertex(float x, float y, float z);
void color(int c); void color(int c);
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize; static size_t s_currentConfigSize;
static size_t s_dataWrittenSize; static size_t s_dataWrittenSize;
static byte *s_dataWritten; static uint8_t *s_dataWritten;
public: public:
static void Tick(); static void Tick();
@@ -599,7 +599,7 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
compressor and decompressor must use exactly the same dictionary (see compressor and decompressor must use exactly the same dictionary (see
inflateSetDictionary). inflateSetDictionary).
The dictionary should consist of strings (byte sequences) that are likely The dictionary should consist of strings (uint8_t sequences) that are likely
to be encountered later in the data to be compressed, with the most commonly to be encountered later in the data to be compressed, with the most commonly
used strings preferably put towards the end of the dictionary. Using a used strings preferably put towards the end of the dictionary. Using a
dictionary is most useful when the data to be compressed is short and can be dictionary is most useful when the data to be compressed is short and can be
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize; static size_t s_currentConfigSize;
static size_t s_dataWrittenSize; static size_t s_dataWrittenSize;
static byte *s_dataWritten; static uint8_t *s_dataWritten;
public: public:
static void Tick(); static void Tick();
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize; static size_t s_currentConfigSize;
static size_t s_dataWrittenSize; static size_t s_dataWrittenSize;
static byte *s_dataWritten; static uint8_t *s_dataWritten;
public: public:
static void Tick(); static void Tick();
@@ -11,7 +11,7 @@ bool MinecraftDynamicConfigurations::s_bUpdatedConfigs[MinecraftDynamicConfigura
MinecraftDynamicConfigurations::EDynamic_Configs MinecraftDynamicConfigurations::s_eCurrentConfig = MinecraftDynamicConfigurations::eDynamic_Config_Max; MinecraftDynamicConfigurations::EDynamic_Configs MinecraftDynamicConfigurations::s_eCurrentConfig = MinecraftDynamicConfigurations::eDynamic_Config_Max;
size_t MinecraftDynamicConfigurations::s_currentConfigSize = 0; size_t MinecraftDynamicConfigurations::s_currentConfigSize = 0;
size_t MinecraftDynamicConfigurations::s_dataWrittenSize = 0; size_t MinecraftDynamicConfigurations::s_dataWrittenSize = 0;
byte *MinecraftDynamicConfigurations::s_dataWritten = NULL; uint8_t *MinecraftDynamicConfigurations::s_dataWritten = NULL;
void MinecraftDynamicConfigurations::Tick() void MinecraftDynamicConfigurations::Tick()
{ {
@@ -90,7 +90,7 @@ void MinecraftDynamicConfigurations::GetSizeCompletedCallback(HRESULT taskResult
{ {
if( HRESULT_SUCCEEDED(taskResult) ) if( HRESULT_SUCCEEDED(taskResult) )
{ {
s_dataWritten = new byte[s_currentConfigSize]; s_dataWritten = new uint8_t[s_currentConfigSize];
HRESULT hr = Sentient::SenDynamicConfigGetBytes( HRESULT hr = Sentient::SenDynamicConfigGetBytes(
s_eCurrentConfig, s_eCurrentConfig,
s_currentConfigSize, s_currentConfigSize,
@@ -51,7 +51,7 @@ private:
static size_t s_currentConfigSize; static size_t s_currentConfigSize;
static size_t s_dataWrittenSize; static size_t s_dataWrittenSize;
static byte *s_dataWritten; static uint8_t *s_dataWritten;
public: public:
static void Tick(); static void Tick();
+2 -2
View File
@@ -136,7 +136,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
) )
{ {
teleportDelay = 0; teleportDelay = 0;
packet = shared_ptr<TeleportEntityPacket>( new TeleportEntityPacket(e->entityId, xn, yn, zn, (byte) yRotn, (byte) xRotn) ); packet = shared_ptr<TeleportEntityPacket>( new TeleportEntityPacket(e->entityId, xn, yn, zn, (uint8_t) yRotn, (uint8_t) xRotn) );
// printf("%d: New teleport rot %d\n",e->entityId,yRotn); // printf("%d: New teleport rot %d\n",e->entityId,yRotn);
yRotp = yRotn; yRotp = yRotn;
xRotp = xRotn; xRotp = xRotn;
@@ -262,7 +262,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector<shared_ptr<Player> > *pl
int yHeadRot = Mth::floor(e->getYHeadRot() * 256 / 360); int yHeadRot = Mth::floor(e->getYHeadRot() * 256 / 360);
if (abs(yHeadRot - yHeadRotp) >= TOLERANCE_LEVEL) if (abs(yHeadRot - yHeadRotp) >= TOLERANCE_LEVEL)
{ {
broadcast(shared_ptr<RotateHeadPacket>(new RotateHeadPacket(e->entityId, (byte) yHeadRot))); broadcast(shared_ptr<RotateHeadPacket>(new RotateHeadPacket(e->entityId, (uint8_t) yHeadRot)));
yHeadRotp = yHeadRot; yHeadRotp = yHeadRot;
} }
@@ -2598,9 +2598,9 @@ bool TileRenderer::tesselateDustInWorld( Tile* tt, int x, int y, int z )
unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMin ); unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMin );
unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMax ); unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMax );
byte redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( (data-1)/14.0f)); uint8_t redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( (data-1)/14.0f));
byte greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( (data-1)/14.0f)); uint8_t greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( (data-1)/14.0f));
byte blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( (data-1)/14.0f)); uint8_t blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( (data-1)/14.0f));
colour = redComponent<<16 | greenComponent<<8 | blueComponent; colour = redComponent<<16 | greenComponent<<8 | blueComponent;
} }
+17 -17
View File
@@ -57,7 +57,7 @@ C4JThread* GameRenderer::m_updateThread;
C4JThread::EventArray* GameRenderer::m_updateEvents; C4JThread::EventArray* GameRenderer::m_updateEvents;
bool GameRenderer::nearThingsToDo = false; bool GameRenderer::nearThingsToDo = false;
bool GameRenderer::updateRunning = false; bool GameRenderer::updateRunning = false;
vector<byte *> GameRenderer::m_deleteStackByte; vector<uint8_t *> GameRenderer::m_deleteStackByte;
vector<SparseLightStorage *> GameRenderer::m_deleteStackSparseLightStorage; vector<SparseLightStorage *> GameRenderer::m_deleteStackSparseLightStorage;
vector<CompressedTileStorage *> GameRenderer::m_deleteStackCompressedTileStorage; vector<CompressedTileStorage *> GameRenderer::m_deleteStackCompressedTileStorage;
vector<SparseDataStorage *> GameRenderer::m_deleteStackSparseDataStorage; vector<SparseDataStorage *> GameRenderer::m_deleteStackSparseDataStorage;
@@ -1112,7 +1112,7 @@ void GameRenderer::renderLevel(float a)
#ifdef MULTITHREAD_ENABLE #ifdef MULTITHREAD_ENABLE
// Request that an item be deleted, when it is safe to do so // Request that an item be deleted, when it is safe to do so
void GameRenderer::AddForDelete(byte *deleteThis) void GameRenderer::AddForDelete(uint8_t *deleteThis)
{ {
EnterCriticalSection(&m_csDeleteStack); EnterCriticalSection(&m_csDeleteStack);
m_deleteStackByte.push_back(deleteThis); m_deleteStackByte.push_back(deleteThis);
@@ -1869,9 +1869,9 @@ void GameRenderer::setupClearColor(float a)
{ {
unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Water_Clear_Colour ); unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Water_Clear_Colour );
byte redComponent = ((colour>>16)&0xFF); uint8_t redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF); uint8_t greenComponent = ((colour>>8)&0xFF);
byte blueComponent = ((colour)&0xFF); uint8_t blueComponent = ((colour)&0xFF);
fr = (float)redComponent/256;//0.02f; fr = (float)redComponent/256;//0.02f;
fg = (float)greenComponent/256;//0.02f; fg = (float)greenComponent/256;//0.02f;
@@ -1881,9 +1881,9 @@ void GameRenderer::setupClearColor(float a)
{ {
unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Lava_Clear_Colour ); unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Lava_Clear_Colour );
byte redComponent = ((colour>>16)&0xFF); uint8_t redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF); uint8_t greenComponent = ((colour>>8)&0xFF);
byte blueComponent = ((colour)&0xFF); uint8_t blueComponent = ((colour)&0xFF);
fr = (float)redComponent/256;//0.6f; fr = (float)redComponent/256;//0.6f;
fg = (float)greenComponent/256;//0.1f; fg = (float)greenComponent/256;//0.1f;
@@ -2025,9 +2025,9 @@ void GameRenderer::setupFog(int i, float alpha)
glFogf(GL_FOG_DENSITY, 0.1f); // was 0.06 glFogf(GL_FOG_DENSITY, 0.1f); // was 0.06
unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_In_Cloud_Fog_Colour ); unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_In_Cloud_Fog_Colour );
byte redComponent = ((colour>>16)&0xFF); uint8_t redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF); uint8_t greenComponent = ((colour>>8)&0xFF);
byte blueComponent = ((colour)&0xFF); uint8_t blueComponent = ((colour)&0xFF);
float rr = (float)redComponent/256;//1.0f; float rr = (float)redComponent/256;//1.0f;
float gg = (float)greenComponent/256;//1.0f; float gg = (float)greenComponent/256;//1.0f;
@@ -2057,9 +2057,9 @@ void GameRenderer::setupFog(int i, float alpha)
} }
unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Water_Fog_Colour ); unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Water_Fog_Colour );
byte redComponent = ((colour>>16)&0xFF); uint8_t redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF); uint8_t greenComponent = ((colour>>8)&0xFF);
byte blueComponent = ((colour)&0xFF); uint8_t blueComponent = ((colour)&0xFF);
float rr = (float)redComponent/256;//0.4f; float rr = (float)redComponent/256;//0.4f;
float gg = (float)greenComponent/256;//0.4f; float gg = (float)greenComponent/256;//0.4f;
@@ -2082,9 +2082,9 @@ void GameRenderer::setupFog(int i, float alpha)
glFogf(GL_FOG_DENSITY, 2.0f); // was 0.06 glFogf(GL_FOG_DENSITY, 2.0f); // was 0.06
unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Lava_Fog_Colour ); unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Lava_Fog_Colour );
byte redComponent = ((colour>>16)&0xFF); uint8_t redComponent = ((colour>>16)&0xFF);
byte greenComponent = ((colour>>8)&0xFF); uint8_t greenComponent = ((colour>>8)&0xFF);
byte blueComponent = ((colour)&0xFF); uint8_t blueComponent = ((colour)&0xFF);
float rr = (float)redComponent/256;//0.4f; float rr = (float)redComponent/256;//0.4f;
float gg = (float)greenComponent/256;//0.3f; float gg = (float)greenComponent/256;//0.3f;
+2 -2
View File
@@ -156,12 +156,12 @@ public:
static bool nearThingsToDo; static bool nearThingsToDo;
static bool updateRunning; static bool updateRunning;
#endif #endif
static vector<byte *> m_deleteStackByte; static vector<uint8_t *> m_deleteStackByte;
static vector<SparseLightStorage *> m_deleteStackSparseLightStorage; static vector<SparseLightStorage *> m_deleteStackSparseLightStorage;
static vector<CompressedTileStorage *> m_deleteStackCompressedTileStorage; static vector<CompressedTileStorage *> m_deleteStackCompressedTileStorage;
static vector<SparseDataStorage *> m_deleteStackSparseDataStorage; static vector<SparseDataStorage *> m_deleteStackSparseDataStorage;
static CRITICAL_SECTION m_csDeleteStack; static CRITICAL_SECTION m_csDeleteStack;
static void AddForDelete(byte *deleteThis); static void AddForDelete(uint8_t *deleteThis);
static void AddForDelete(SparseLightStorage *deleteThis); static void AddForDelete(SparseLightStorage *deleteThis);
static void AddForDelete(CompressedTileStorage *deleteThis); static void AddForDelete(CompressedTileStorage *deleteThis);
static void AddForDelete(SparseDataStorage *deleteThis); static void AddForDelete(SparseDataStorage *deleteThis);
+4 -4
View File
@@ -329,7 +329,7 @@ void Tesselator::color(int r, int g, int b, int a)
col = (r << 24) | (g << 16) | (b << 8) | (a); col = (r << 24) | (g << 16) | (b << 8) | (a);
} }
void Tesselator::color(byte r, byte g, byte b) void Tesselator::color(uint8_t r, uint8_t g, uint8_t b)
{ {
color(r & 0xff, g & 0xff, b & 0xff); color(r & 0xff, g & 0xff, b & 0xff);
} }
@@ -1043,9 +1043,9 @@ void Tesselator::normal(float x, float y, float z)
int8_t zz = (int8_t) (z * 127); int8_t zz = (int8_t) (z * 127);
_normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16);
#else #else
byte xx = (byte) (x * 127); uint8_t xx = (uint8_t) (x * 127);
byte yy = (byte) (y * 127); uint8_t yy = (uint8_t) (y * 127);
byte zz = (byte) (z * 127); uint8_t zz = (uint8_t) (z * 127);
_normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16);
#endif #endif
} }
+1 -1
View File
@@ -138,7 +138,7 @@ public:
void color(float r, float g, float b, float a); void color(float r, float g, float b, float a);
void color(int r, int g, int b); void color(int r, int g, int b);
void color(int r, int g, int b, int a); void color(int r, int g, int b, int a);
void color(byte r, byte g, byte b); void color(uint8_t r, uint8_t g, uint8_t b);
void vertexUV(float x, float y, float z, float u, float v); void vertexUV(float x, float y, float z, float u, float v);
void vertex(float x, float y, float z); void vertex(float x, float y, float z);
void color(int c); void color(int c);
+36 -36
View File
@@ -269,10 +269,10 @@ void Texture::writeAsBMP(const wstring &name)
// Write the header // Write the header
outStream->writeShort((short)0x424d); // 0x0000: ID - 'BM' outStream->writeShort((short)0x424d); // 0x0000: ID - 'BM'
int byteSize = width * height * 4 + 54; int byteSize = width * height * 4 + 54;
outStream->writeByte((byte)(byteSize >> 0)); // 0x0002: Raw file size outStream->writeByte((uint8_t)(byteSize >> 0)); // 0x0002: Raw file size
outStream->writeByte((byte)(byteSize >> 8)); outStream->writeByte((uint8_t)(byteSize >> 8));
outStream->writeByte((byte)(byteSize >> 16)); outStream->writeByte((uint8_t)(byteSize >> 16));
outStream->writeByte((byte)(byteSize >> 24)); outStream->writeByte((uint8_t)(byteSize >> 24));
outStream->writeInt(0); // 0x0006: Reserved outStream->writeInt(0); // 0x0006: Reserved
outStream->writeByte(54); // 0x000A: Start of pixel data outStream->writeByte(54); // 0x000A: Start of pixel data
outStream->writeByte(0); outStream->writeByte(0);
@@ -282,31 +282,31 @@ void Texture::writeAsBMP(const wstring &name)
outStream->writeByte(0); outStream->writeByte(0);
outStream->writeByte(0); outStream->writeByte(0);
outStream->writeByte(0); outStream->writeByte(0);
outStream->writeByte((byte)(width >> 0)); // 0x0012: Image width, in pixels outStream->writeByte((uint8_t)(width >> 0)); // 0x0012: Image width, in pixels
outStream->writeByte((byte)(width >> 8)); outStream->writeByte((uint8_t)(width >> 8));
outStream->writeByte((byte)(width >> 16)); outStream->writeByte((uint8_t)(width >> 16));
outStream->writeByte((byte)(width >> 24)); outStream->writeByte((uint8_t)(width >> 24));
outStream->writeByte((byte)(height >> 0)); // 0x0016: Image height, in pixels outStream->writeByte((uint8_t)(height >> 0)); // 0x0016: Image height, in pixels
outStream->writeByte((byte)(height >> 8)); outStream->writeByte((uint8_t)(height >> 8));
outStream->writeByte((byte)(height >> 16)); outStream->writeByte((uint8_t)(height >> 16));
outStream->writeByte((byte)(height >> 24)); outStream->writeByte((uint8_t)(height >> 24));
outStream->writeByte(1); // 0x001A: Number of color planes, must be 1 outStream->writeByte(1); // 0x001A: Number of color planes, must be 1
outStream->writeByte(0); outStream->writeByte(0);
outStream->writeByte(32); // 0x001C: Bit depth (32bpp) outStream->writeByte(32); // 0x001C: Bit depth (32bpp)
outStream->writeByte(0); outStream->writeByte(0);
outStream->writeInt(0); // 0x001E: Compression mode (BI_RGB, uncompressed) outStream->writeInt(0); // 0x001E: Compression mode (BI_RGB, uncompressed)
int bufSize = width * height * 4; int bufSize = width * height * 4;
outStream->writeInt((byte)(bufSize >> 0)); // 0x0022: Raw size of bitmap data outStream->writeInt((uint8_t)(bufSize >> 0)); // 0x0022: Raw size of bitmap data
outStream->writeInt((byte)(bufSize >> 8)); outStream->writeInt((uint8_t)(bufSize >> 8));
outStream->writeInt((byte)(bufSize >> 16)); outStream->writeInt((uint8_t)(bufSize >> 16));
outStream->writeInt((byte)(bufSize >> 24)); outStream->writeInt((uint8_t)(bufSize >> 24));
outStream->writeInt(0); // 0x0026: Horizontal resolution in ppm outStream->writeInt(0); // 0x0026: Horizontal resolution in ppm
outStream->writeInt(0); // 0x002A: Vertical resolution in ppm outStream->writeInt(0); // 0x002A: Vertical resolution in ppm
outStream->writeInt(0); // 0x002E: Palette size (0 to match bit depth) outStream->writeInt(0); // 0x002E: Palette size (0 to match bit depth)
outStream->writeInt(0); // 0x0032: Number of important colors, 0 for all outStream->writeInt(0); // 0x0032: Number of important colors, 0 for all
// Pixels follow in inverted Y order // Pixels follow in inverted Y order
byte[] bytes = new byte[width * height * 4]; byte[] bytes = new uint8_t[width * height * 4];
data.position(0); data.position(0);
data.get(bytes); data.get(bytes);
for (int y = height - 1; y >= 0; y--) for (int y = height - 1; y >= 0; y--)
@@ -335,7 +335,7 @@ void Texture::writeAsPNG(const wstring &filename)
#if 0 #if 0
BufferedImage *image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); BufferedImage *image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
ByteBuffer *buffer = this->getData(); ByteBuffer *buffer = this->getData();
byte[] bytes = new byte[width * height * 4]; byte[] bytes = new uint8_t[width * height * 4];
buffer.position(0); buffer.position(0);
buffer.get(bytes); buffer.get(bytes);
@@ -529,10 +529,10 @@ void Texture::transferFromBuffer(intArray buffer)
{ {
int texel = column + x * 4; int texel = column + x * 4;
data[0]->position(0); data[0]->position(0);
data[0]->put(texel + byteRemap[0], (byte)((buffer[texel >> 2] >> 24) & 0xff)); data[0]->put(texel + byteRemap[0], (uint8_t)((buffer[texel >> 2] >> 24) & 0xff));
data[0]->put(texel + byteRemap[1], (byte)((buffer[texel >> 2] >> 16) & 0xff)); data[0]->put(texel + byteRemap[1], (uint8_t)((buffer[texel >> 2] >> 16) & 0xff));
data[0]->put(texel + byteRemap[2], (byte)((buffer[texel >> 2] >> 8) & 0xff)); data[0]->put(texel + byteRemap[2], (uint8_t)((buffer[texel >> 2] >> 8) & 0xff));
data[0]->put(texel + byteRemap[3], (byte)((buffer[texel >> 2] >> 0) & 0xff)); data[0]->put(texel + byteRemap[3], (uint8_t)((buffer[texel >> 2] >> 0) & 0xff));
} }
} }
} }
@@ -588,10 +588,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format // Pull ARGB bytes into either RGBA or BGRA depending on format
tempBytes[byteIndex + byteRemap[0]] = (byte)((tempPixels[intIndex] >> 24) & 0xff); tempBytes[byteIndex + byteRemap[0]] = (uint8_t)((tempPixels[intIndex] >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = (byte)((tempPixels[intIndex] >> 16) & 0xff); tempBytes[byteIndex + byteRemap[1]] = (uint8_t)((tempPixels[intIndex] >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = (byte)((tempPixels[intIndex] >> 8) & 0xff); tempBytes[byteIndex + byteRemap[2]] = (uint8_t)((tempPixels[intIndex] >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = (byte)((tempPixels[intIndex] >> 0) & 0xff); tempBytes[byteIndex + byteRemap[3]] = (uint8_t)((tempPixels[intIndex] >> 0) & 0xff);
} }
} }
@@ -640,10 +640,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format // Pull ARGB bytes into either RGBA or BGRA depending on format
tempBytes[byteIndex + byteRemap[0]] = (byte)((tempData[intIndex] >> 24) & 0xff); tempBytes[byteIndex + byteRemap[0]] = (uint8_t)((tempData[intIndex] >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = (byte)((tempData[intIndex] >> 16) & 0xff); tempBytes[byteIndex + byteRemap[1]] = (uint8_t)((tempData[intIndex] >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = (byte)((tempData[intIndex] >> 8) & 0xff); tempBytes[byteIndex + byteRemap[2]] = (uint8_t)((tempData[intIndex] >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = (byte)((tempData[intIndex] >> 0) & 0xff); tempBytes[byteIndex + byteRemap[3]] = (uint8_t)((tempData[intIndex] >> 0) & 0xff);
} }
} }
} }
@@ -675,10 +675,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format // Pull ARGB bytes into either RGBA or BGRA depending on format
tempBytes[byteIndex + byteRemap[0]] = (byte)((col >> 24) & 0xff); tempBytes[byteIndex + byteRemap[0]] = (uint8_t)((col >> 24) & 0xff);
tempBytes[byteIndex + byteRemap[1]] = (byte)((col >> 16) & 0xff); tempBytes[byteIndex + byteRemap[1]] = (uint8_t)((col >> 16) & 0xff);
tempBytes[byteIndex + byteRemap[2]] = (byte)((col >> 8) & 0xff); tempBytes[byteIndex + byteRemap[2]] = (uint8_t)((col >> 8) & 0xff);
tempBytes[byteIndex + byteRemap[3]] = (byte)((col >> 0) & 0xff); tempBytes[byteIndex + byteRemap[3]] = (uint8_t)((col >> 0) & 0xff);
} }
} }
@@ -828,7 +828,7 @@ void Texture::updateOnGPU()
// the ram based buffer to it any more inside RenderManager.TextureDataUpdate // the ram based buffer to it any more inside RenderManager.TextureDataUpdate
unsigned char *newData = RenderManager.TextureData(width,height,data[0]->getBuffer(),0,C4JRender::TEXTURE_FORMAT_RxGyBzAw); unsigned char *newData = RenderManager.TextureData(width,height,data[0]->getBuffer(),0,C4JRender::TEXTURE_FORMAT_RxGyBzAw);
ByteBuffer *oldBuffer = data[0]; ByteBuffer *oldBuffer = data[0];
data[0] = new ByteBuffer(data[0]->getSize(), (byte*) newData); data[0] = new ByteBuffer(data[0]->getSize(), (uint8_t*) newData);
delete oldBuffer; delete oldBuffer;
newData += width * height * 4; newData += width * height * 4;
#else #else
@@ -847,7 +847,7 @@ void Texture::updateOnGPU()
// the ram based buffer to it any more inside RenderManager.TextureDataUpdate // the ram based buffer to it any more inside RenderManager.TextureDataUpdate
RenderManager.TextureDataUpdate(0, 0,levelWidth,levelHeight,data[level]->getBuffer(),level); RenderManager.TextureDataUpdate(0, 0,levelWidth,levelHeight,data[level]->getBuffer(),level);
ByteBuffer *oldBuffer = data[level]; ByteBuffer *oldBuffer = data[level];
data[level] = new ByteBuffer(data[level]->getSize(), (byte*) newData); data[level] = new ByteBuffer(data[level]->getSize(), (uint8_t*) newData);
delete oldBuffer; delete oldBuffer;
newData += levelWidth * levelHeight * 4; newData += levelWidth * levelHeight * 4;
#else #else
+12 -12
View File
@@ -555,15 +555,15 @@ void Textures::loadTexture(BufferedImage *img, int id, bool blur, bool clamp)
int b = (rawPixels[i]) & 0xff; int b = (rawPixels[i]) & 0xff;
#ifdef _XBOX #ifdef _XBOX
newPixels[i * 4 + 0] = (byte) a; newPixels[i * 4 + 0] = (uint8_t) a;
newPixels[i * 4 + 1] = (byte) r; newPixels[i * 4 + 1] = (uint8_t) r;
newPixels[i * 4 + 2] = (byte) g; newPixels[i * 4 + 2] = (uint8_t) g;
newPixels[i * 4 + 3] = (byte) b; newPixels[i * 4 + 3] = (uint8_t) b;
#else #else
newPixels[i * 4 + 0] = (byte) r; newPixels[i * 4 + 0] = (uint8_t) r;
newPixels[i * 4 + 1] = (byte) g; newPixels[i * 4 + 1] = (uint8_t) g;
newPixels[i * 4 + 2] = (byte) b; newPixels[i * 4 + 2] = (uint8_t) b;
newPixels[i * 4 + 3] = (byte) a; newPixels[i * 4 + 3] = (uint8_t) a;
#endif #endif
} }
// 4J - now creating a buffer of the size we require dynamically // 4J - now creating a buffer of the size we require dynamically
@@ -731,10 +731,10 @@ void Textures::replaceTexture(intArray rawPixels, int w, int h, int id)
b = bb; b = bb;
} }
newPixels[i * 4 + 0] = (byte) r; newPixels[i * 4 + 0] = (uint8_t) r;
newPixels[i * 4 + 1] = (byte) g; newPixels[i * 4 + 1] = (uint8_t) g;
newPixels[i * 4 + 2] = (byte) b; newPixels[i * 4 + 2] = (uint8_t) b;
newPixels[i * 4 + 3] = (byte) a; newPixels[i * 4 + 3] = (uint8_t) a;
} }
ByteBuffer *pixels = MemoryTracker::createByteBuffer(w * h * 4); // 4J - now creating dynamically ByteBuffer *pixels = MemoryTracker::createByteBuffer(w * h * 4); // 4J - now creating dynamically
pixels->put(newPixels); pixels->put(newPixels);
+3 -3
View File
@@ -181,9 +181,9 @@ void FallingTile::causeFallDamage(float distance)
void FallingTile::addAdditonalSaveData(CompoundTag *tag) void FallingTile::addAdditonalSaveData(CompoundTag *tag)
{ {
tag->putByte(L"Tile", (byte) tile); tag->putByte(L"Tile", (uint8_t) tile);
tag->putByte(L"Data", (byte) data); tag->putByte(L"Data", (uint8_t) data);
tag->putByte(L"Time", (byte) time); tag->putByte(L"Time", (uint8_t) time);
tag->putBoolean(L"DropItem", dropItem); tag->putBoolean(L"DropItem", dropItem);
tag->putBoolean(L"HurtEntities", hurtEntities); tag->putBoolean(L"HurtEntities", hurtEntities);
tag->putFloat(L"FallHurtAmount", fallDamageAmount); tag->putFloat(L"FallHurtAmount", fallDamageAmount);
+3 -3
View File
@@ -353,9 +353,9 @@ void RedStoneDustTile::animateTick(Level *level, int x, int y, int z, Random *ra
unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMin ); unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMin );
unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMax ); unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMax );
byte redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( (data-1)/14.0f)); uint8_t redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( (data-1)/14.0f));
byte greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( (data-1)/14.0f)); uint8_t greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( (data-1)/14.0f));
byte blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( (data-1)/14.0f)); uint8_t blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( (data-1)/14.0f));
colour = redComponent<<16 | greenComponent<<8 | blueComponent; colour = redComponent<<16 | greenComponent<<8 | blueComponent;
} }
+3 -3
View File
@@ -126,9 +126,9 @@ int StemTile::getColor(int data)
unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMin ); unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMin );
unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMax ); unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMax );
byte redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( data/7.0f)); uint8_t redComponent = ((minColour>>16)&0xFF) + (( (maxColour>>16)&0xFF - (minColour>>16)&0xFF)*( data/7.0f));
byte greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( data/7.0f)); uint8_t greenComponent = ((minColour>>8)&0xFF) + (( (maxColour>>8)&0xFF - (minColour>>8)&0xFF)*( data/7.0f));
byte blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( data/7.0f)); uint8_t blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( data/7.0f));
colour = redComponent<<16 | greenComponent<<8 | blueComponent; colour = redComponent<<16 | greenComponent<<8 | blueComponent;
return colour; return colour;
@@ -308,7 +308,7 @@ void BrewingStandTileEntity::save(CompoundTag *base)
if (items[i] != NULL) if (items[i] != NULL)
{ {
CompoundTag *tag = new CompoundTag(); CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i); tag->putByte(L"Slot", (uint8_t) i);
items[i]->save(tag); items[i]->save(tag);
listTag->add(tag); listTag->add(tag);
} }
@@ -121,7 +121,7 @@ void ChestTileEntity::save(CompoundTag *base)
if (items->data[i] != NULL) if (items->data[i] != NULL)
{ {
CompoundTag *tag = new CompoundTag(); CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i); tag->putByte(L"Slot", (uint8_t) i);
items->data[i]->save(tag); items->data[i]->save(tag);
listTag->add(tag); listTag->add(tag);
} }
@@ -174,7 +174,7 @@ void DispenserTileEntity::save(CompoundTag *base)
if (items->data[i] != NULL) if (items->data[i] != NULL)
{ {
CompoundTag *tag = new CompoundTag(); CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i); tag->putByte(L"Slot", (uint8_t) i);
items->data[i]->save(tag); items->data[i]->save(tag);
listTag->add(tag); listTag->add(tag);
} }
@@ -129,7 +129,7 @@ void FurnaceTileEntity::save(CompoundTag *base)
if ((*items)[i] != NULL) if ((*items)[i] != NULL)
{ {
CompoundTag *tag = new CompoundTag(); CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i); tag->putByte(L"Slot", (uint8_t) i);
(*items)[i]->save(tag); (*items)[i]->save(tag);
listTag->add(tag); listTag->add(tag);
} }
@@ -33,7 +33,7 @@ void MusicTileEntity::load(CompoundTag *tag)
void MusicTileEntity::tune() void MusicTileEntity::tune()
{ {
note = (byte) ((note + 1) % 25); note = (uint8_t) ((note + 1) % 25);
setChanged(); setChanged();
} }
@@ -10,7 +10,7 @@ public:
static TileEntity *create() { return new MusicTileEntity(); } static TileEntity *create() { return new MusicTileEntity(); }
public: public:
byte note; uint8_t note;
bool on; bool on;
+1 -1
View File
@@ -21,7 +21,7 @@ template <class T> void System::arraycopy(arrayWithLength<T> src, unsigned int s
ArrayCopyFunctionDefinition(Node *) ArrayCopyFunctionDefinition(Node *)
ArrayCopyFunctionDefinition(Biome *) ArrayCopyFunctionDefinition(Biome *)
void System::arraycopy(arrayWithLength<byte> src, unsigned int srcPos, arrayWithLength<byte> *dst, unsigned int dstPos, unsigned int length) void System::arraycopy(arrayWithLength<uint8_t> src, unsigned int srcPos, arrayWithLength<uint8_t> *dst, unsigned int dstPos, unsigned int length)
{ {
assert( srcPos >=0 && srcPos <= src.length); assert( srcPos >=0 && srcPos <= src.length);
assert( srcPos + length <= src.length ); assert( srcPos + length <= src.length );
+1 -1
View File
@@ -15,7 +15,7 @@ class System
template <class T> static void arraycopy(arrayWithLength<T> src, unsigned int srcPos, arrayWithLength<T> *dst, unsigned int dstPos, unsigned int length); template <class T> static void arraycopy(arrayWithLength<T> src, unsigned int srcPos, arrayWithLength<T> *dst, unsigned int dstPos, unsigned int length);
public: public:
ArrayCopyFunctionDeclaration(byte) ArrayCopyFunctionDeclaration(uint8_t)
ArrayCopyFunctionDeclaration(Node *) ArrayCopyFunctionDeclaration(Node *)
ArrayCopyFunctionDeclaration(Biome *) ArrayCopyFunctionDeclaration(Biome *)
ArrayCopyFunctionDeclaration(int) ArrayCopyFunctionDeclaration(int)
+1 -1
View File
@@ -403,7 +403,7 @@ const int QNET_SENDDATA_SEQUENTIAL = 0;
struct XRNM_SEND_BUFFER struct XRNM_SEND_BUFFER
{ {
DWORD dwDataSize; DWORD dwDataSize;
byte *pbyData; uint8_t *pbyData;
}; };
const int D3DBLEND_CONSTANTALPHA = 0; const int D3DBLEND_CONSTANTALPHA = 0;
+2 -2
View File
@@ -475,7 +475,7 @@ ListTag<CompoundTag> *Inventory::save(ListTag<CompoundTag> *listTag)
if (items[i] != NULL) if (items[i] != NULL)
{ {
CompoundTag *tag = new CompoundTag(); CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i); tag->putByte(L"Slot", (uint8_t) i);
items[i]->save(tag); items[i]->save(tag);
listTag->add(tag); listTag->add(tag);
} }
@@ -485,7 +485,7 @@ ListTag<CompoundTag> *Inventory::save(ListTag<CompoundTag> *listTag)
if (armor[i] != NULL) if (armor[i] != NULL)
{ {
CompoundTag *tag = new CompoundTag(); CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) (i + 100)); tag->putByte(L"Slot", (uint8_t) (i + 100));
armor[i]->save(tag); armor[i]->save(tag);
listTag->add(tag); listTag->add(tag);
} }
@@ -85,7 +85,7 @@ MerchantRecipe *MerchantRecipeList::getMatchingRecipeFor(shared_ptr<ItemInstance
void MerchantRecipeList::writeToStream(DataOutputStream *stream) void MerchantRecipeList::writeToStream(DataOutputStream *stream)
{ {
stream->writeByte((byte) (m_recipes.size() & 0xff)); stream->writeByte((uint8_t) (m_recipes.size() & 0xff));
for (int i = 0; i < m_recipes.size(); i++) for (int i = 0; i < m_recipes.size(); i++)
{ {
MerchantRecipe *r = m_recipes.at(i); MerchantRecipe *r = m_recipes.at(i);
+5 -5
View File
@@ -340,7 +340,7 @@ Entity::Entity(Level *level, bool useSmallId) // 4J - added useSmallId parameter
// resetPos(); // resetPos();
setPos(0, 0, 0); setPos(0, 0, 0);
entityData->define(DATA_SHARED_FLAGS_ID, (byte) 0); entityData->define(DATA_SHARED_FLAGS_ID, (uint8_t) 0);
entityData->define(DATA_AIR_SUPPLY_ID, TOTAL_AIR_SUPPLY); // 4J Stu - Brought forward from 1.2.3 to fix 38654 - Gameplay: Player will take damage when air bubbles are present if resuming game from load/autosave underwater. entityData->define(DATA_AIR_SUPPLY_ID, TOTAL_AIR_SUPPLY); // 4J Stu - Brought forward from 1.2.3 to fix 38654 - Gameplay: Player will take damage when air bubbles are present if resuming game from load/autosave underwater.
// 4J Stu - We cannot call virtual functions in ctors, as at this point the object // 4J Stu - We cannot call virtual functions in ctors, as at this point the object
@@ -1677,7 +1677,7 @@ void Entity::lerpMotion(double xd, double yd, double zd)
this->zd = zd; this->zd = zd;
} }
void Entity::handleEntityEvent(byte eventId) void Entity::handleEntityEvent(uint8_t eventId)
{ {
} }
@@ -1781,14 +1781,14 @@ bool Entity::getSharedFlag(int flag)
void Entity::setSharedFlag(int flag, bool value) void Entity::setSharedFlag(int flag, bool value)
{ {
byte currentValue = entityData->getByte(DATA_SHARED_FLAGS_ID); uint8_t currentValue = entityData->getByte(DATA_SHARED_FLAGS_ID);
if (value) if (value)
{ {
entityData->set(DATA_SHARED_FLAGS_ID, (byte) (currentValue | (1 << flag))); entityData->set(DATA_SHARED_FLAGS_ID, (uint8_t) (currentValue | (1 << flag)));
} }
else else
{ {
entityData->set(DATA_SHARED_FLAGS_ID, (byte) (currentValue & ~(1 << flag))); entityData->set(DATA_SHARED_FLAGS_ID, (uint8_t) (currentValue & ~(1 << flag)));
} }
} }
+1 -1
View File
@@ -303,7 +303,7 @@ public:
virtual Vec3 *getLookAngle(); virtual Vec3 *getLookAngle();
virtual void handleInsidePortal(); virtual void handleInsidePortal();
virtual void lerpMotion(double xd, double yd, double zd); virtual void lerpMotion(double xd, double yd, double zd);
virtual void handleEntityEvent(byte eventId); virtual void handleEntityEvent(uint8_t eventId);
virtual void animateHurt(); virtual void animateHurt();
virtual void prepareCustomTextures(); virtual void prepareCustomTextures();
virtual ItemInstanceArray getEquipmentSlots(); // ItemInstance[] virtual ItemInstanceArray getEquipmentSlots(); // ItemInstance[]
+5 -5
View File
@@ -236,7 +236,7 @@ void HangingEntity::push(double xa, double ya, double za)
void HangingEntity::addAdditonalSaveData(CompoundTag *tag) void HangingEntity::addAdditonalSaveData(CompoundTag *tag)
{ {
tag->putByte(L"Direction", (byte) dir); tag->putByte(L"Direction", (uint8_t) dir);
tag->putInt(L"TileX", xTile); tag->putInt(L"TileX", xTile);
tag->putInt(L"TileY", yTile); tag->putInt(L"TileY", yTile);
tag->putInt(L"TileZ", zTile); tag->putInt(L"TileZ", zTile);
@@ -245,16 +245,16 @@ void HangingEntity::addAdditonalSaveData(CompoundTag *tag)
switch (dir) switch (dir)
{ {
case Direction::NORTH: case Direction::NORTH:
tag->putByte(L"Dir", (byte) 0); tag->putByte(L"Dir", (uint8_t) 0);
break; break;
case Direction::WEST: case Direction::WEST:
tag->putByte(L"Dir", (byte) 1); tag->putByte(L"Dir", (uint8_t) 1);
break; break;
case Direction::SOUTH: case Direction::SOUTH:
tag->putByte(L"Dir", (byte) 2); tag->putByte(L"Dir", (uint8_t) 2);
break; break;
case Direction::EAST: case Direction::EAST:
tag->putByte(L"Dir", (byte) 3); tag->putByte(L"Dir", (uint8_t) 3);
break; break;
} }
} }
+1 -1
View File
@@ -202,7 +202,7 @@ bool ItemEntity::hurt(DamageSource *source, int damage)
void ItemEntity::addAdditonalSaveData(CompoundTag *entityTag) void ItemEntity::addAdditonalSaveData(CompoundTag *entityTag)
{ {
entityTag->putShort(L"Health", (byte) health); entityTag->putShort(L"Health", (uint8_t) health);
entityTag->putShort(L"Age", (short) age); entityTag->putShort(L"Age", (short) age);
if (getItem() != NULL) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag())); if (getItem() != NULL) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag()));
} }
+1 -1
View File
@@ -1591,7 +1591,7 @@ shared_ptr<ItemInstance> Mob::getArmor(int pos)
//return equipment[pos + 1]; //return equipment[pos + 1];
} }
void Mob::handleEntityEvent(byte id) void Mob::handleEntityEvent(uint8_t id)
{ {
if (id == EntityEvent::HURT) if (id == EntityEvent::HURT)
{ {
+1 -1
View File
@@ -324,7 +324,7 @@ public:
virtual int getMaxSpawnClusterSize(); virtual int getMaxSpawnClusterSize();
virtual shared_ptr<ItemInstance> getCarriedItem(); virtual shared_ptr<ItemInstance> getCarriedItem();
virtual shared_ptr<ItemInstance> getArmor(int pos); virtual shared_ptr<ItemInstance> getArmor(int pos);
virtual void handleEntityEvent(byte id); virtual void handleEntityEvent(uint8_t id);
virtual bool isSleeping(); virtual bool isSleeping();
virtual Icon *getItemInHandIcon(shared_ptr<ItemInstance> item, int layer); virtual Icon *getItemInHandIcon(shared_ptr<ItemInstance> item, int layer);
virtual bool shouldRender(Vec3 *c); virtual bool shouldRender(Vec3 *c);
+10 -10
View File
@@ -116,7 +116,7 @@ Arrow::Arrow(Level *level, shared_ptr<Mob> mob, float power) : Entity( level )
void Arrow::defineSynchedData() void Arrow::defineSynchedData()
{ {
entityData->define(ID_FLAGS, (byte) 0); entityData->define(ID_FLAGS, (uint8_t) 0);
} }
@@ -432,11 +432,11 @@ void Arrow::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile); tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile); tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile); tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (byte) lastTile); tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"inData", (byte) lastData); tag->putByte(L"inData", (uint8_t) lastData);
tag->putByte(L"shake", (byte) shakeTime); tag->putByte(L"shake", (uint8_t) shakeTime);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0)); tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
tag->putByte(L"pickup", (byte) pickup); tag->putByte(L"pickup", (uint8_t) pickup);
tag->putDouble(L"damage", baseDamage); tag->putDouble(L"damage", baseDamage);
} }
@@ -513,19 +513,19 @@ bool Arrow::isAttackable()
void Arrow::setCritArrow(bool critArrow) void Arrow::setCritArrow(bool critArrow)
{ {
byte flags = entityData->getByte(ID_FLAGS); uint8_t flags = entityData->getByte(ID_FLAGS);
if (critArrow) if (critArrow)
{ {
entityData->set(ID_FLAGS, (byte) (flags | FLAG_CRIT)); entityData->set(ID_FLAGS, (uint8_t) (flags | FLAG_CRIT));
} }
else else
{ {
entityData->set(ID_FLAGS, (byte) (flags & ~FLAG_CRIT)); entityData->set(ID_FLAGS, (uint8_t) (flags & ~FLAG_CRIT));
} }
} }
bool Arrow::isCritArrow() bool Arrow::isCritArrow()
{ {
byte flags = entityData->getByte(ID_FLAGS); uint8_t flags = entityData->getByte(ID_FLAGS);
return (flags & FLAG_CRIT) != 0; return (flags & FLAG_CRIT) != 0;
} }
+2 -2
View File
@@ -44,7 +44,7 @@ void Blaze::defineSynchedData()
{ {
Monster::defineSynchedData(); Monster::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (byte) 0); entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
} }
int Blaze::getAmbientSound() int Blaze::getAmbientSound()
@@ -209,7 +209,7 @@ bool Blaze::isCharged()
void Blaze::setCharged(bool value) void Blaze::setCharged(bool value)
{ {
byte flags = entityData->getByte(DATA_FLAGS_ID); uint8_t flags = entityData->getByte(DATA_FLAGS_ID);
if (value) if (value)
{ {
flags |= 0x1; flags |= 0x1;
+5 -5
View File
@@ -63,8 +63,8 @@ void Creeper::defineSynchedData()
{ {
Monster::defineSynchedData(); Monster::defineSynchedData();
entityData->define(DATA_SWELL_DIR, (byte) -1); entityData->define(DATA_SWELL_DIR, (uint8_t) -1);
entityData->define(DATA_IS_POWERED, (byte) 0); entityData->define(DATA_IS_POWERED, (uint8_t) 0);
} }
void Creeper::addAdditonalSaveData(CompoundTag *entityTag) void Creeper::addAdditonalSaveData(CompoundTag *entityTag)
@@ -76,7 +76,7 @@ void Creeper::addAdditonalSaveData(CompoundTag *entityTag)
void Creeper::readAdditionalSaveData(CompoundTag *tag) void Creeper::readAdditionalSaveData(CompoundTag *tag)
{ {
Monster::readAdditionalSaveData(tag); Monster::readAdditionalSaveData(tag);
entityData->set(DATA_IS_POWERED, (byte) (tag->getBoolean(L"powered") ? 1 : 0)); entityData->set(DATA_IS_POWERED, (uint8_t) (tag->getBoolean(L"powered") ? 1 : 0));
} }
void Creeper::tick() void Creeper::tick()
@@ -159,11 +159,11 @@ int Creeper::getSwellDir()
void Creeper::setSwellDir(int dir) void Creeper::setSwellDir(int dir)
{ {
entityData->set(DATA_SWELL_DIR, (byte) dir); entityData->set(DATA_SWELL_DIR, (uint8_t) dir);
} }
void Creeper::thunderHit(const LightningBolt *lightningBolt) void Creeper::thunderHit(const LightningBolt *lightningBolt)
{ {
Monster::thunderHit(lightningBolt); Monster::thunderHit(lightningBolt);
entityData->set(DATA_IS_POWERED, (byte) 1); entityData->set(DATA_IS_POWERED, (uint8_t) 1);
} }
+6 -6
View File
@@ -63,9 +63,9 @@ void EnderMan::defineSynchedData()
{ {
Monster::defineSynchedData(); Monster::defineSynchedData();
entityData->define(DATA_CARRY_ITEM_ID, (byte) 0); entityData->define(DATA_CARRY_ITEM_ID, (uint8_t) 0);
entityData->define(DATA_CARRY_ITEM_DATA, (byte) 0); entityData->define(DATA_CARRY_ITEM_DATA, (uint8_t) 0);
entityData->define(DATA_CREEPY, (byte) 0); entityData->define(DATA_CREEPY, (uint8_t) 0);
} }
void EnderMan::addAdditonalSaveData(CompoundTag *tag) void EnderMan::addAdditonalSaveData(CompoundTag *tag)
@@ -368,7 +368,7 @@ void EnderMan::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel)
// 4J Brought forward from 1.2.3 to help fix Enderman behaviour // 4J Brought forward from 1.2.3 to help fix Enderman behaviour
void EnderMan::setCarryingTile(int carryingTile) void EnderMan::setCarryingTile(int carryingTile)
{ {
entityData->set(DATA_CARRY_ITEM_ID, (byte) (carryingTile & 0xff)); entityData->set(DATA_CARRY_ITEM_ID, (uint8_t) (carryingTile & 0xff));
} }
int EnderMan::getCarryingTile() int EnderMan::getCarryingTile()
@@ -378,7 +378,7 @@ int EnderMan::getCarryingTile()
void EnderMan::setCarryingData(int carryingData) void EnderMan::setCarryingData(int carryingData)
{ {
entityData->set(DATA_CARRY_ITEM_DATA, (byte) (carryingData & 0xff)); entityData->set(DATA_CARRY_ITEM_DATA, (uint8_t) (carryingData & 0xff));
} }
int EnderMan::getCarryingData() int EnderMan::getCarryingData()
@@ -406,5 +406,5 @@ bool EnderMan::isCreepy()
void EnderMan::setCreepy(bool creepy) void EnderMan::setCreepy(bool creepy)
{ {
entityData->set(DATA_CREEPY, (byte)(creepy ? 1 : 0)); entityData->set(DATA_CREEPY, (uint8_t)(creepy ? 1 : 0));
} }
@@ -175,7 +175,7 @@ bool ExperienceOrb::hurt(DamageSource *source, int damage)
void ExperienceOrb::addAdditonalSaveData(CompoundTag *entityTag) void ExperienceOrb::addAdditonalSaveData(CompoundTag *entityTag)
{ {
entityTag->putShort(L"Health", (byte) health); entityTag->putShort(L"Health", (uint8_t) health);
entityTag->putShort(L"Age", (short) age); entityTag->putShort(L"Age", (short) age);
entityTag->putShort(L"Value", (short) value); entityTag->putShort(L"Value", (short) value);
} }
+2 -2
View File
@@ -320,8 +320,8 @@ void Fireball::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile); tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile); tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile); tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (byte) lastTile); tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0)); tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
tag->put(L"direction", this->newDoubleList(3, this->xd, this->yd, this->zd)); tag->put(L"direction", this->newDoubleList(3, this->xd, this->yd, this->zd));
} }
@@ -381,9 +381,9 @@ void FishingHook::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile); tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile); tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile); tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (byte) lastTile); tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"shake", (byte) shakeTime); tag->putByte(L"shake", (uint8_t) shakeTime);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0)); tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
} }
void FishingHook::readAdditionalSaveData(CompoundTag *tag) void FishingHook::readAdditionalSaveData(CompoundTag *tag)
+4 -4
View File
@@ -66,7 +66,7 @@ void Ghast::defineSynchedData()
{ {
FlyingMob::defineSynchedData(); FlyingMob::defineSynchedData();
entityData->define(DATA_IS_CHARGING, (byte) 0); entityData->define(DATA_IS_CHARGING, (uint8_t) 0);
} }
int Ghast::getMaxHealth() int Ghast::getMaxHealth()
@@ -77,7 +77,7 @@ int Ghast::getMaxHealth()
void Ghast::tick() void Ghast::tick()
{ {
FlyingMob::tick(); FlyingMob::tick();
byte current = entityData->getByte(DATA_IS_CHARGING); uint8_t current = entityData->getByte(DATA_IS_CHARGING);
// this->textureName = current == 1 ? L"/mob/ghast_fire.png" : L"/mob/ghast.png"; // 4J replaced with following line // this->textureName = current == 1 ? L"/mob/ghast_fire.png" : L"/mob/ghast.png"; // 4J replaced with following line
this->textureIdx = current == 1 ? TN_MOB_GHAST_FIRE : TN_MOB_GHAST; this->textureIdx = current == 1 ? TN_MOB_GHAST_FIRE : TN_MOB_GHAST;
} }
@@ -174,8 +174,8 @@ void Ghast::serverAiStep()
if (!level->isClientSide) if (!level->isClientSide)
{ {
byte old = entityData->getByte(DATA_IS_CHARGING); uint8_t old = entityData->getByte(DATA_IS_CHARGING);
byte current = (byte) (charge > 10 ? 1 : 0); uint8_t current = (uint8_t) (charge > 10 ? 1 : 0);
if (old != current) if (old != current)
{ {
entityData->set(DATA_IS_CHARGING, current); entityData->set(DATA_IS_CHARGING, current);
+3 -3
View File
@@ -36,7 +36,7 @@ ItemFrame::ItemFrame(Level *level, int xTile, int yTile, int zTile, int dir) : H
void ItemFrame::defineSynchedData() void ItemFrame::defineSynchedData()
{ {
getEntityData()->defineNULL(DATA_ITEM, NULL); getEntityData()->defineNULL(DATA_ITEM, NULL);
getEntityData()->define(DATA_ROTATION, (byte) 0); getEntityData()->define(DATA_ROTATION, (uint8_t) 0);
} }
void ItemFrame::dropItem() void ItemFrame::dropItem()
@@ -79,7 +79,7 @@ int ItemFrame::getRotation()
void ItemFrame::setRotation(int rotation) void ItemFrame::setRotation(int rotation)
{ {
getEntityData()->set(DATA_ROTATION, (byte) (rotation % 4)); getEntityData()->set(DATA_ROTATION, (uint8_t) (rotation % 4));
} }
void ItemFrame::addAdditonalSaveData(CompoundTag *tag) void ItemFrame::addAdditonalSaveData(CompoundTag *tag)
@@ -87,7 +87,7 @@ void ItemFrame::addAdditonalSaveData(CompoundTag *tag)
if (getItem() != NULL) if (getItem() != NULL)
{ {
tag->putCompound(L"Item", getItem()->save(new CompoundTag())); tag->putCompound(L"Item", getItem()->save(new CompoundTag()));
tag->putByte(L"ItemRotation", (byte) getRotation()); tag->putByte(L"ItemRotation", (uint8_t) getRotation());
//tag->putFloat(L"ItemDropChance", dropChance); //tag->putFloat(L"ItemDropChance", dropChance);
} }
HangingEntity::addAdditonalSaveData(tag); HangingEntity::addAdditonalSaveData(tag);
+4 -4
View File
@@ -128,7 +128,7 @@ bool Minecart::makeStepSound()
void Minecart::defineSynchedData() void Minecart::defineSynchedData()
{ {
entityData->define(DATA_ID_FUEL, (byte) 0); entityData->define(DATA_ID_FUEL, (uint8_t) 0);
entityData->define(DATA_ID_HURT, 0); entityData->define(DATA_ID_HURT, 0);
entityData->define(DATA_ID_HURTDIR, 1); entityData->define(DATA_ID_HURTDIR, 1);
entityData->define(DATA_ID_DAMAGE, 0); entityData->define(DATA_ID_DAMAGE, 0);
@@ -861,7 +861,7 @@ void Minecart::addAdditonalSaveData(CompoundTag *base)
if ( (*items)[i] != NULL) if ( (*items)[i] != NULL)
{ {
CompoundTag *tag = new CompoundTag(); CompoundTag *tag = new CompoundTag();
tag->putByte(L"Slot", (byte) i); tag->putByte(L"Slot", (uint8_t) i);
(*items)[i]->save(tag); (*items)[i]->save(tag);
listTag->add(tag); listTag->add(tag);
} }
@@ -1158,11 +1158,11 @@ void Minecart::setHasFuel(bool fuel)
{ {
if (fuel) if (fuel)
{ {
entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) | 1)); entityData->set(DATA_ID_FUEL, (uint8_t) (entityData->getByte(DATA_ID_FUEL) | 1));
} }
else else
{ {
entityData->set(DATA_ID_FUEL, (byte) (entityData->getByte(DATA_ID_FUEL) & ~1)); entityData->set(DATA_ID_FUEL, (uint8_t) (entityData->getByte(DATA_ID_FUEL) & ~1));
} }
} }
+2 -2
View File
@@ -60,7 +60,7 @@ void Ozelot::defineSynchedData()
{ {
TamableAnimal::defineSynchedData(); TamableAnimal::defineSynchedData();
entityData->define(DATA_TYPE_ID, (byte) TYPE_OZELOT); entityData->define(DATA_TYPE_ID, (uint8_t) TYPE_OZELOT);
} }
void Ozelot::serverAiMobStep() void Ozelot::serverAiMobStep()
@@ -294,7 +294,7 @@ int Ozelot::getCatType()
void Ozelot::setCatType(int type) void Ozelot::setCatType(int type)
{ {
entityData->set(DATA_TYPE_ID, (byte) type); entityData->set(DATA_TYPE_ID, (uint8_t) type);
} }
bool Ozelot::canSpawn() bool Ozelot::canSpawn()
+3 -3
View File
@@ -64,7 +64,7 @@ bool Pig::canBeControlledByRider()
void Pig::defineSynchedData() void Pig::defineSynchedData()
{ {
Animal::defineSynchedData(); Animal::defineSynchedData();
entityData->define(DATA_SADDLE_ID, (byte) 0); entityData->define(DATA_SADDLE_ID, (uint8_t) 0);
} }
void Pig::addAdditonalSaveData(CompoundTag *tag) void Pig::addAdditonalSaveData(CompoundTag *tag)
@@ -142,11 +142,11 @@ void Pig::setSaddle(bool value)
{ {
if (value) if (value)
{ {
entityData->set(DATA_SADDLE_ID, (byte) 1); entityData->set(DATA_SADDLE_ID, (uint8_t) 1);
} }
else else
{ {
entityData->set(DATA_SADDLE_ID, (byte) 0); entityData->set(DATA_SADDLE_ID, (uint8_t) 0);
} }
} }
+1 -1
View File
@@ -101,7 +101,7 @@ void PrimedTnt::explode()
void PrimedTnt::addAdditonalSaveData(CompoundTag *entityTag) void PrimedTnt::addAdditonalSaveData(CompoundTag *entityTag)
{ {
entityTag->putByte(L"Fuse", (byte) life); entityTag->putByte(L"Fuse", (uint8_t) life);
} }
void PrimedTnt::readAdditionalSaveData(CompoundTag *tag) void PrimedTnt::readAdditionalSaveData(CompoundTag *tag)
+8 -8
View File
@@ -100,7 +100,7 @@ void Sheep::defineSynchedData()
Animal::defineSynchedData(); Animal::defineSynchedData();
// sheared and color share a byte // sheared and color share a byte
entityData->define(DATA_WOOL_ID, ((byte) 0)); //was new Byte((byte), 0) entityData->define(DATA_WOOL_ID, ((uint8_t) 0)); //was new Byte((uint8_t), 0)
} }
void Sheep::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) void Sheep::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel)
@@ -117,7 +117,7 @@ int Sheep::getDeathLoot()
return Tile::cloth_Id; return Tile::cloth_Id;
} }
void Sheep::handleEntityEvent(byte id) void Sheep::handleEntityEvent(uint8_t id)
{ {
if (id == EntityEvent::EAT_GRASS) if (id == EntityEvent::EAT_GRASS)
{ {
@@ -195,7 +195,7 @@ void Sheep::addAdditonalSaveData(CompoundTag *tag)
{ {
Animal::addAdditonalSaveData(tag); Animal::addAdditonalSaveData(tag);
tag->putBoolean(L"Sheared", isSheared()); tag->putBoolean(L"Sheared", isSheared());
tag->putByte(L"Color", (byte) getColor()); tag->putByte(L"Color", (uint8_t) getColor());
} }
void Sheep::readAdditionalSaveData(CompoundTag *tag) void Sheep::readAdditionalSaveData(CompoundTag *tag)
@@ -227,8 +227,8 @@ int Sheep::getColor()
void Sheep::setColor(int color) void Sheep::setColor(int color)
{ {
byte current = entityData->getByte(DATA_WOOL_ID); uint8_t current = entityData->getByte(DATA_WOOL_ID);
entityData->set(DATA_WOOL_ID, (byte) ((current & 0xf0) | (color & 0x0f))); entityData->set(DATA_WOOL_ID, (uint8_t) ((current & 0xf0) | (color & 0x0f)));
} }
bool Sheep::isSheared() bool Sheep::isSheared()
@@ -238,14 +238,14 @@ bool Sheep::isSheared()
void Sheep::setSheared(bool value) void Sheep::setSheared(bool value)
{ {
byte current = entityData->getByte(DATA_WOOL_ID); uint8_t current = entityData->getByte(DATA_WOOL_ID);
if (value) if (value)
{ {
entityData->set(DATA_WOOL_ID, (byte) (current | 0x10)); entityData->set(DATA_WOOL_ID, (uint8_t) (current | 0x10));
} }
else else
{ {
entityData->set(DATA_WOOL_ID, (byte) (current & ~0x10)); entityData->set(DATA_WOOL_ID, (uint8_t) (current & ~0x10));
} }
} }
+1 -1
View File
@@ -52,7 +52,7 @@ public:
virtual int getDeathLoot(); virtual int getDeathLoot();
public: public:
virtual void handleEntityEvent(byte id); virtual void handleEntityEvent(uint8_t id);
public: public:
float getHeadEatPositionScale(float a); float getHeadEatPositionScale(float a);
+2 -2
View File
@@ -47,12 +47,12 @@ void Slime::defineSynchedData()
{ {
Mob::defineSynchedData(); Mob::defineSynchedData();
entityData->define(ID_SIZE, (byte) 1); entityData->define(ID_SIZE, (uint8_t) 1);
} }
void Slime::setSize(int size) void Slime::setSize(int size)
{ {
entityData->set(ID_SIZE, (byte) size); entityData->set(ID_SIZE, (uint8_t) size);
Mob::setSize(0.6f * size, 0.6f * size); Mob::setSize(0.6f * size, 0.6f * size);
this->setPos(x, y, z); this->setPos(x, y, z);
setHealth(getMaxHealth()); setHealth(getMaxHealth());
+2 -2
View File
@@ -31,7 +31,7 @@ void Spider::defineSynchedData()
{ {
Monster::defineSynchedData(); Monster::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (byte) 0); entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
} }
void Spider::tick() void Spider::tick()
@@ -179,7 +179,7 @@ bool Spider::isClimbing()
void Spider::setClimbing(bool value) void Spider::setClimbing(bool value)
{ {
byte flags = entityData->getByte(DATA_FLAGS_ID); uint8_t flags = entityData->getByte(DATA_FLAGS_ID);
if (value) if (value)
{ {
flags |= 0x1; flags |= 0x1;
+1 -1
View File
@@ -701,7 +701,7 @@ int Villager::getPurchaseCost(int itemId, Random *random)
return minMax.first + random->nextInt(minMax.second - minMax.first); return minMax.first + random->nextInt(minMax.second - minMax.first);
} }
void Villager::handleEntityEvent(byte id) void Villager::handleEntityEvent(uint8_t id)
{ {
if (id == EntityEvent::LOVE_HEARTS) if (id == EntityEvent::LOVE_HEARTS)
{ {
+1 -1
View File
@@ -86,7 +86,7 @@ public:
void setLastHurtByMob(shared_ptr<Mob> mob); void setLastHurtByMob(shared_ptr<Mob> mob);
void die(DamageSource *source); void die(DamageSource *source);
void handleEntityEvent(byte id); void handleEntityEvent(uint8_t id);
private: private:
void addParticlesAroundSelf(ePARTICLE_TYPE particle); void addParticlesAroundSelf(ePARTICLE_TYPE particle);
@@ -56,7 +56,7 @@ VillagerGolem::VillagerGolem(Level *level) : Golem(level)
void VillagerGolem::defineSynchedData() void VillagerGolem::defineSynchedData()
{ {
Golem::defineSynchedData(); Golem::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (byte) 0); entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
} }
bool VillagerGolem::useNewAi() bool VillagerGolem::useNewAi()
@@ -143,7 +143,7 @@ bool VillagerGolem::doHurtTarget(shared_ptr<Entity> target)
return hurt; return hurt;
} }
void VillagerGolem::handleEntityEvent(byte id) void VillagerGolem::handleEntityEvent(uint8_t id)
{ {
if (id == EntityEvent::START_ATTACKING) if (id == EntityEvent::START_ATTACKING)
{ {
@@ -219,14 +219,14 @@ bool VillagerGolem::isPlayerCreated()
void VillagerGolem::setPlayerCreated(bool value) void VillagerGolem::setPlayerCreated(bool value)
{ {
byte current = entityData->getByte(DATA_FLAGS_ID); uint8_t current = entityData->getByte(DATA_FLAGS_ID);
if (value) if (value)
{ {
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x01)); entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x01));
} }
else else
{ {
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x01)); entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x01));
} }
} }
@@ -44,7 +44,7 @@ public:
virtual void addAdditonalSaveData(CompoundTag *tag); virtual void addAdditonalSaveData(CompoundTag *tag);
virtual void readAdditionalSaveData(CompoundTag *tag); virtual void readAdditionalSaveData(CompoundTag *tag);
virtual bool doHurtTarget(shared_ptr<Entity> target); virtual bool doHurtTarget(shared_ptr<Entity> target);
virtual void handleEntityEvent(byte id); virtual void handleEntityEvent(uint8_t id);
virtual shared_ptr<Village> getVillage(); virtual shared_ptr<Village> getVillage();
virtual int getAttackAnimationTick(); virtual int getAttackAnimationTick();
virtual void offerFlower(bool offer); virtual void offerFlower(bool offer);
+11 -11
View File
@@ -91,8 +91,8 @@ void Wolf::defineSynchedData()
{ {
TamableAnimal::defineSynchedData(); TamableAnimal::defineSynchedData();
entityData->define(DATA_HEALTH_ID, getHealth()); entityData->define(DATA_HEALTH_ID, getHealth());
entityData->define(DATA_INTERESTED_ID, (byte)0); entityData->define(DATA_INTERESTED_ID, (uint8_t)0);
entityData->define(DATA_COLLAR_COLOR, (byte) ClothTile::getTileDataForItemAuxValue(DyePowderItem::RED)); entityData->define(DATA_COLLAR_COLOR, (uint8_t) ClothTile::getTileDataForItemAuxValue(DyePowderItem::RED));
} }
bool Wolf::makeStepSound() bool Wolf::makeStepSound()
@@ -118,7 +118,7 @@ void Wolf::addAdditonalSaveData(CompoundTag *tag)
TamableAnimal::addAdditonalSaveData(tag); TamableAnimal::addAdditonalSaveData(tag);
tag->putBoolean(L"Angry", isAngry()); tag->putBoolean(L"Angry", isAngry());
tag->putByte(L"CollarColor", (byte) getCollarColor()); tag->putByte(L"CollarColor", (uint8_t) getCollarColor());
} }
void Wolf::readAdditionalSaveData(CompoundTag *tag) void Wolf::readAdditionalSaveData(CompoundTag *tag)
@@ -424,7 +424,7 @@ bool Wolf::interact(shared_ptr<Player> player)
return TamableAnimal::interact(player); return TamableAnimal::interact(player);
} }
void Wolf::handleEntityEvent(byte id) void Wolf::handleEntityEvent(uint8_t id)
{ {
if (id == EntityEvent::SHAKE_WETNESS) if (id == EntityEvent::SHAKE_WETNESS)
{ {
@@ -471,14 +471,14 @@ bool Wolf::isAngry()
void Wolf::setAngry(bool value) void Wolf::setAngry(bool value)
{ {
byte current = entityData->getByte(DATA_FLAGS_ID); uint8_t current = entityData->getByte(DATA_FLAGS_ID);
if (value) if (value)
{ {
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x02)); entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x02));
} }
else else
{ {
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x02)); entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x02));
} }
} }
@@ -489,7 +489,7 @@ int Wolf::getCollarColor()
void Wolf::setCollarColor(int color) void Wolf::setCollarColor(int color)
{ {
entityData->set(DATA_COLLAR_COLOR, (byte) (color & 0xF)); entityData->set(DATA_COLLAR_COLOR, (uint8_t) (color & 0xF));
} }
// 4J-PB added for tooltips // 4J-PB added for tooltips
@@ -520,15 +520,15 @@ shared_ptr<AgableMob> Wolf::getBreedOffspring(shared_ptr<AgableMob> target)
void Wolf::setIsInterested(bool value) void Wolf::setIsInterested(bool value)
{ {
//byte current = entityData->getByte(DATA_INTERESTED_ID); //uint8_t current = entityData->getByte(DATA_INTERESTED_ID);
if (value) if (value)
{ {
entityData->set(DATA_INTERESTED_ID, (byte) 1); entityData->set(DATA_INTERESTED_ID, (uint8_t) 1);
} }
else else
{ {
entityData->set(DATA_INTERESTED_ID, (byte) 0); entityData->set(DATA_INTERESTED_ID, (uint8_t) 0);
} }
} }
+1 -1
View File
@@ -63,7 +63,7 @@ public:
virtual bool hurt(DamageSource *source, int dmg); virtual bool hurt(DamageSource *source, int dmg);
virtual bool doHurtTarget(shared_ptr<Entity> target); virtual bool doHurtTarget(shared_ptr<Entity> target);
virtual bool interact(shared_ptr<Player> player); virtual bool interact(shared_ptr<Player> player);
virtual void handleEntityEvent(byte id); virtual void handleEntityEvent(uint8_t id);
float getTailAngle(); float getTailAngle();
virtual bool isFood(shared_ptr<ItemInstance> item); virtual bool isFood(shared_ptr<ItemInstance> item);
virtual int getMaxSpawnClusterSize(); virtual int getMaxSpawnClusterSize();
+10 -10
View File
@@ -55,9 +55,9 @@ void Zombie::defineSynchedData()
{ {
Monster::defineSynchedData(); Monster::defineSynchedData();
getEntityData()->define(DATA_BABY_ID, (byte) 0); getEntityData()->define(DATA_BABY_ID, (uint8_t) 0);
getEntityData()->define(DATA_VILLAGER_ID, (byte) 0); getEntityData()->define(DATA_VILLAGER_ID, (uint8_t) 0);
getEntityData()->define(DATA_CONVERTING_ID, (byte) 0); getEntityData()->define(DATA_CONVERTING_ID, (uint8_t) 0);
} }
float Zombie::getWalkingSpeedModifier() float Zombie::getWalkingSpeedModifier()
@@ -87,23 +87,23 @@ bool Zombie::useNewAi()
bool Zombie::isBaby() bool Zombie::isBaby()
{ {
return getEntityData()->getByte(DATA_BABY_ID) == (byte) 1; return getEntityData()->getByte(DATA_BABY_ID) == (uint8_t) 1;
} }
void Zombie::setBaby(bool baby) void Zombie::setBaby(bool baby)
{ {
getEntityData()->set(DATA_BABY_ID, (byte) 1); getEntityData()->set(DATA_BABY_ID, (uint8_t) 1);
updateSize(isBaby()); updateSize(isBaby());
} }
bool Zombie::isVillager() bool Zombie::isVillager()
{ {
return getEntityData()->getByte(DATA_VILLAGER_ID) == (byte) 1; return getEntityData()->getByte(DATA_VILLAGER_ID) == (uint8_t) 1;
} }
void Zombie::setVillager(bool villager) void Zombie::setVillager(bool villager)
{ {
getEntityData()->set(DATA_VILLAGER_ID, (byte) (villager ? 1 : 0)); getEntityData()->set(DATA_VILLAGER_ID, (uint8_t) (villager ? 1 : 0));
} }
void Zombie::aiStep() void Zombie::aiStep()
@@ -292,7 +292,7 @@ bool Zombie::interact(shared_ptr<Player> player)
void Zombie::startConverting(int time) void Zombie::startConverting(int time)
{ {
villagerConversionTime = time; villagerConversionTime = time;
getEntityData()->set(DATA_CONVERTING_ID, (byte) 1); getEntityData()->set(DATA_CONVERTING_ID, (uint8_t) 1);
removeEffect(MobEffect::weakness->id); removeEffect(MobEffect::weakness->id);
addEffect(new MobEffectInstance(MobEffect::damageBoost->id, time, min(level->difficulty - 1, 0))); addEffect(new MobEffectInstance(MobEffect::damageBoost->id, time, min(level->difficulty - 1, 0)));
@@ -300,7 +300,7 @@ void Zombie::startConverting(int time)
level->broadcastEntityEvent(shared_from_this(), EntityEvent::ZOMBIE_CONVERTING); level->broadcastEntityEvent(shared_from_this(), EntityEvent::ZOMBIE_CONVERTING);
} }
void Zombie::handleEntityEvent(byte id) void Zombie::handleEntityEvent(uint8_t id)
{ {
if (id == EntityEvent::ZOMBIE_CONVERTING) if (id == EntityEvent::ZOMBIE_CONVERTING)
{ {
@@ -314,7 +314,7 @@ void Zombie::handleEntityEvent(byte id)
bool Zombie::isConverting() bool Zombie::isConverting()
{ {
return getEntityData()->getByte(DATA_CONVERTING_ID) == (byte) 1; return getEntityData()->getByte(DATA_CONVERTING_ID) == (uint8_t) 1;
} }
void Zombie::finishConversion() void Zombie::finishConversion()
+1 -1
View File
@@ -72,7 +72,7 @@ protected:
void startConverting(int time); void startConverting(int time);
public: public:
void handleEntityEvent(byte id); void handleEntityEvent(uint8_t id);
bool isConverting(); bool isConverting();
protected: protected:
@@ -24,7 +24,7 @@ void SynchedEntityData::define(int id, int value)
m_isEmpty = false; m_isEmpty = false;
} }
void SynchedEntityData::define(int id, byte value) void SynchedEntityData::define(int id, uint8_t value)
{ {
MemSect(17); MemSect(17);
checkId(id); checkId(id);
@@ -82,7 +82,7 @@ void SynchedEntityData::checkId(int id)
#endif #endif
} }
byte SynchedEntityData::getByte(int id) uint8_t SynchedEntityData::getByte(int id)
{ {
return itemsById[id]->getValue_byte(); return itemsById[id]->getValue_byte();
} }
@@ -133,7 +133,7 @@ void SynchedEntityData::set(int id, int value)
} }
} }
void SynchedEntityData::set(int id, byte value) void SynchedEntityData::set(int id, uint8_t value)
{ {
shared_ptr<DataItem> dataItem = itemsById[id]; shared_ptr<DataItem> dataItem = itemsById[id];
@@ -331,7 +331,7 @@ vector<shared_ptr<SynchedEntityData::DataItem> > *SynchedEntityData::unpack(Data
{ {
case TYPE_BYTE: case TYPE_BYTE:
{ {
byte dataRead = input->readByte(); uint8_t dataRead = input->readByte();
item = shared_ptr<DataItem>( new DataItem(itemType, itemId, dataRead) ); item = shared_ptr<DataItem>( new DataItem(itemType, itemId, dataRead) );
} }
break; break;
@@ -462,7 +462,7 @@ SynchedEntityData::DataItem::DataItem(int type, int id, int value) : type( type
this->dirty = true; this->dirty = true;
} }
SynchedEntityData::DataItem::DataItem(int type, int id, byte value) : type( type ), id( id ) SynchedEntityData::DataItem::DataItem(int type, int id, uint8_t value) : type( type ), id( id )
{ {
this->value_byte = value; this->value_byte = value;
this->dirty = true; this->dirty = true;
@@ -496,7 +496,7 @@ void SynchedEntityData::DataItem::setValue(int value)
this->value_int = value; this->value_int = value;
} }
void SynchedEntityData::DataItem::setValue(byte value) void SynchedEntityData::DataItem::setValue(uint8_t value)
{ {
this->value_byte = value; this->value_byte = value;
} }
@@ -526,7 +526,7 @@ short SynchedEntityData::DataItem::getValue_short()
return value_short; return value_short;
} }
byte SynchedEntityData::DataItem::getValue_byte() uint8_t SynchedEntityData::DataItem::getValue_byte()
{ {
return value_byte; return value_byte;
} }
+7 -7
View File
@@ -15,7 +15,7 @@ public:
const int id; const int id;
// 4J - there used to be one "value" type here of general type Object, just storing the different (used) varieties // 4J - there used to be one "value" type here of general type Object, just storing the different (used) varieties
// here separately for us // here separately for us
byte value_byte; uint8_t value_byte;
int value_int; int value_int;
short value_short; short value_short;
wstring value_wstring; wstring value_wstring;
@@ -24,19 +24,19 @@ public:
public: public:
// There was one type here that took a generic Object type, using overloading here instead // There was one type here that took a generic Object type, using overloading here instead
DataItem(int type, int id, byte value); DataItem(int type, int id, uint8_t value);
DataItem(int type, int id, int value); DataItem(int type, int id, int value);
DataItem(int type, int id, const wstring& value); DataItem(int type, int id, const wstring& value);
DataItem(int type, int id, shared_ptr<ItemInstance> itemInstance); DataItem(int type, int id, shared_ptr<ItemInstance> itemInstance);
DataItem(int type, int id, short value); DataItem(int type, int id, short value);
int getId(); int getId();
void setValue(byte value); void setValue(uint8_t value);
void setValue(int value); void setValue(int value);
void setValue(short value); void setValue(short value);
void setValue(const wstring& value); void setValue(const wstring& value);
void setValue(shared_ptr<ItemInstance> value); void setValue(shared_ptr<ItemInstance> value);
byte getValue_byte(); uint8_t getValue_byte();
int getValue_int(); int getValue_int();
short getValue_short(); short getValue_short();
wstring getValue_wstring(); wstring getValue_wstring();
@@ -79,14 +79,14 @@ public:
// 4J - this function used to be a template, but there's only 3 varieties of use I've found so just hard-coding now, as // 4J - this function used to be a template, but there's only 3 varieties of use I've found so just hard-coding now, as
// the original had some automatic Class to type sort of conversion that's a real pain for us to actually do // the original had some automatic Class to type sort of conversion that's a real pain for us to actually do
void define(int id, byte value); void define(int id, uint8_t value);
void define(int id, const wstring& value); void define(int id, const wstring& value);
void define(int id, int value); void define(int id, int value);
void define(int id, short value); void define(int id, short value);
void defineNULL(int id, void *pVal); void defineNULL(int id, void *pVal);
void checkId(int id); // 4J - added to contain common code from overloaded define functions above void checkId(int id); // 4J - added to contain common code from overloaded define functions above
byte getByte(int id); uint8_t getByte(int id);
short getShort(int id); short getShort(int id);
int getInteger(int id); int getInteger(int id);
float getFloat(int id); float getFloat(int id);
@@ -94,7 +94,7 @@ public:
shared_ptr<ItemInstance> getItemInstance(int id); shared_ptr<ItemInstance> getItemInstance(int id);
Pos *getPos(int id); Pos *getPos(int id);
// 4J - using overloads rather than template here // 4J - using overloads rather than template here
void set(int id, byte value); void set(int id, uint8_t value);
void set(int id, int value); void set(int id, int value);
void set(int id, short value); void set(int id, short value);
void set(int id, const wstring& value); void set(int id, const wstring& value);
+8 -8
View File
@@ -19,7 +19,7 @@ TamableAnimal::~TamableAnimal()
void TamableAnimal::defineSynchedData() void TamableAnimal::defineSynchedData()
{ {
Animal::defineSynchedData(); Animal::defineSynchedData();
entityData->define(DATA_FLAGS_ID, (byte) 0); entityData->define(DATA_FLAGS_ID, (uint8_t) 0);
entityData->define(DATA_OWNERUUID_ID, L""); entityData->define(DATA_OWNERUUID_ID, L"");
} }
@@ -86,7 +86,7 @@ void TamableAnimal::spawnTamingParticles(bool success)
} }
} }
void TamableAnimal::handleEntityEvent(byte id) void TamableAnimal::handleEntityEvent(uint8_t id)
{ {
if (id == EntityEvent::TAMING_SUCCEEDED) if (id == EntityEvent::TAMING_SUCCEEDED)
{ {
@@ -109,14 +109,14 @@ bool TamableAnimal::isTame()
void TamableAnimal::setTame(bool value) void TamableAnimal::setTame(bool value)
{ {
byte current = entityData->getByte(DATA_FLAGS_ID); uint8_t current = entityData->getByte(DATA_FLAGS_ID);
if (value) if (value)
{ {
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x04)); entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x04));
} }
else else
{ {
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x04)); entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x04));
} }
} }
@@ -127,14 +127,14 @@ bool TamableAnimal::isSitting()
void TamableAnimal::setSitting(bool value) void TamableAnimal::setSitting(bool value)
{ {
byte current = entityData->getByte(DATA_FLAGS_ID); uint8_t current = entityData->getByte(DATA_FLAGS_ID);
if (value) if (value)
{ {
entityData->set(DATA_FLAGS_ID, (byte) (current | 0x01)); entityData->set(DATA_FLAGS_ID, (uint8_t) (current | 0x01));
} }
else else
{ {
entityData->set(DATA_FLAGS_ID, (byte) (current & ~0x01)); entityData->set(DATA_FLAGS_ID, (uint8_t) (current & ~0x01));
} }
} }
+1 -1
View File
@@ -26,7 +26,7 @@ protected:
virtual void spawnTamingParticles(bool success); virtual void spawnTamingParticles(bool success);
public: public:
virtual void handleEntityEvent(byte id); virtual void handleEntityEvent(uint8_t id);
virtual bool isTame(); virtual bool isTame();
virtual void setTame(bool value); virtual void setTame(bool value);
virtual bool isSitting(); virtual bool isSitting();
+3 -3
View File
@@ -260,9 +260,9 @@ void Throwable::addAdditonalSaveData(CompoundTag *tag)
tag->putShort(L"xTile", (short) xTile); tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile); tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile); tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (byte) lastTile); tag->putByte(L"inTile", (uint8_t) lastTile);
tag->putByte(L"shake", (byte) shakeTime); tag->putByte(L"shake", (uint8_t) shakeTime);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0)); tag->putByte(L"inGround", (uint8_t) (inGround ? 1 : 0));
} }
void Throwable::readAdditionalSaveData(CompoundTag *tag) void Throwable::readAdditionalSaveData(CompoundTag *tag)
@@ -10,7 +10,7 @@ void ConsoleSaveFileConverter::ProcessSimpleFile(ConsoleSaveFile *sourceSave, Fi
DWORD numberOfBytesRead = 0; DWORD numberOfBytesRead = 0;
DWORD numberOfBytesWritten = 0; DWORD numberOfBytesWritten = 0;
byte *data = new byte[sourceFileEntry->getFileSize()]; uint8_t *data = new uint8_t[sourceFileEntry->getFileSize()];
// Read from source // Read from source
sourceSave->readFile(sourceFileEntry, data, sourceFileEntry->getFileSize(), &numberOfBytesRead); sourceSave->readFile(sourceFileEntry, data, sourceFileEntry->getFileSize(), &numberOfBytesRead);
@@ -102,7 +102,7 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile *sourceSave, ConsoleS
{ {
FileEntry *sourceFe = sourceSave->createFile( sourcePlayerDatPath ); FileEntry *sourceFe = sourceSave->createFile( sourcePlayerDatPath );
FileEntry *targetFe = targetSave->createFile( targetPlayerDatPath ); FileEntry *targetFe = targetSave->createFile( targetPlayerDatPath );
printf("Processing player dat file %s\n", playerFiles->at(fileIdx)->data.filename); wprintf(L"Processing player dat file %ls\n", playerFiles->at(fileIdx)->data.filename);
ProcessSimpleFile(sourceSave, sourceFe, targetSave, targetFe); ProcessSimpleFile(sourceSave, sourceFe, targetSave, targetFe);
targetFe->data.lastModifiedTime = sourceFe->data.lastModifiedTime; targetFe->data.lastModifiedTime = sourceFe->data.lastModifiedTime;
@@ -25,7 +25,7 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile
//the next byte of data, or -1 if the end of the file is reached. //the next byte of data, or -1 if the end of the file is reached.
int ConsoleSaveFileInputStream::read() int ConsoleSaveFileInputStream::read()
{ {
byte byteRead = static_cast<byte>(0); uint8_t byteRead = static_cast<uint8_t>(0);
DWORD numberOfBytesRead; DWORD numberOfBytesRead;
BOOL result = m_saveFile->readFile( BOOL result = m_saveFile->readFile(
@@ -243,7 +243,7 @@ void ConsoleSaveFileOriginal::deleteFile( FileEntry *file )
const int bufferSize = 4096; const int bufferSize = 4096;
int amountToRead = bufferSize; int amountToRead = bufferSize;
byte buffer[bufferSize]; uint8_t buffer[bufferSize];
DWORD bufferDataSize = 0; DWORD bufferDataSize = 0;
@@ -474,8 +474,8 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt
const DWORD bufferSize = 4096; const DWORD bufferSize = 4096;
DWORD amountToRead = bufferSize; DWORD amountToRead = bufferSize;
//assert( nNumberOfBytesToWrite <= bufferSize ); //assert( nNumberOfBytesToWrite <= bufferSize );
static byte buffer1[bufferSize]; static uint8_t buffer1[bufferSize];
static byte buffer2[bufferSize]; static uint8_t buffer2[bufferSize];
DWORD buffer1Size = 0; DWORD buffer1Size = 0;
DWORD buffer2Size = 0; DWORD buffer2Size = 0;
@@ -666,11 +666,11 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail )
// On PS3, don't compress the data as we can't really afford the extra memory this requires for the output buffer. Instead we'll be writing // On PS3, don't compress the data as we can't really afford the extra memory this requires for the output buffer. Instead we'll be writing
// directly from the save data. // directly from the save data.
StorageManager.SetSaveData(pvSaveMem,fileSize); StorageManager.SetSaveData(pvSaveMem,fileSize);
byte *compData = (byte *)pvSaveMem; uint8_t *compData = (uint8_t *)pvSaveMem;
#else #else
// Attempt to allocate the required memory // Attempt to allocate the required memory
// We do not own this, it belongs to the StorageManager // We do not own this, it belongs to the StorageManager
byte *compData = (byte *)StorageManager.AllocateSaveData( compLength ); uint8_t *compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
#ifdef __PSVITA__ #ifdef __PSVITA__
// AP - make sure we always allocate just what is needed so it will only SAVE what is needed. // AP - make sure we always allocate just what is needed so it will only SAVE what is needed.
@@ -708,7 +708,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail )
compLength = compLength+8; compLength = compLength+8;
// Attempt to allocate the required memory // Attempt to allocate the required memory
compData = (byte *)StorageManager.AllocateSaveData( compLength ); compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
} }
#endif #endif
@@ -38,7 +38,7 @@ void ConsoleSaveFileOutputStream::write(unsigned int b)
{ {
DWORD numberOfBytesWritten; DWORD numberOfBytesWritten;
byte value = (byte) b; uint8_t value = (uint8_t) b;
BOOL result = m_saveFile->writeFile( BOOL result = m_saveFile->writeFile(
m_file, m_file,
@@ -641,7 +641,7 @@ void ConsoleSaveFileSplit::deleteFile( FileEntry *file )
const int bufferSize = 4096; const int bufferSize = 4096;
int amountToRead = bufferSize; int amountToRead = bufferSize;
byte buffer[bufferSize]; uint8_t buffer[bufferSize];
DWORD bufferDataSize = 0; DWORD bufferDataSize = 0;
@@ -1044,8 +1044,8 @@ void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesT
const DWORD bufferSize = 4096; const DWORD bufferSize = 4096;
DWORD amountToRead = bufferSize; DWORD amountToRead = bufferSize;
//assert( nNumberOfBytesToWrite <= bufferSize ); //assert( nNumberOfBytesToWrite <= bufferSize );
static byte buffer1[bufferSize]; static uint8_t buffer1[bufferSize];
static byte buffer2[bufferSize]; static uint8_t buffer2[bufferSize];
DWORD buffer1Size = 0; DWORD buffer1Size = 0;
DWORD buffer2Size = 0; DWORD buffer2Size = 0;
@@ -1352,7 +1352,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail)
// Attempt to allocate the required memory // Attempt to allocate the required memory
// We do not own this, it belongs to the StorageManager // We do not own this, it belongs to the StorageManager
byte *compData = (byte *)StorageManager.AllocateSaveData( compLength ); uint8_t *compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
// If we failed to allocate then compData will be NULL // If we failed to allocate then compData will be NULL
// Pre-calculate the compressed data size so that we can attempt to allocate a smaller buffer // Pre-calculate the compressed data size so that we can attempt to allocate a smaller buffer
@@ -1379,7 +1379,7 @@ void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail)
compLength = compLength+8; compLength = compLength+8;
// Attempt to allocate the required memory // Attempt to allocate the required memory
compData = (byte *)StorageManager.AllocateSaveData( compLength ); compData = (uint8_t *)StorageManager.AllocateSaveData( compLength );
} }
if(compData != NULL) if(compData != NULL)
+1 -1
View File
@@ -84,7 +84,7 @@ ssize_t ReadFile(int fd, void* buffer, size_t byteRead, DWORD* numberOfBytesRead
//the next byte of data, or -1 if the end of the file is reached. //the next byte of data, or -1 if the end of the file is reached.
int FileInputStream::read() int FileInputStream::read()
{ {
byte byteRead = static_cast<byte>(0); uint8_t byteRead = static_cast<uint8_t>(0);
DWORD numberOfBytesRead; DWORD numberOfBytesRead;
BOOL bSuccess = ReadFile( BOOL bSuccess = ReadFile(
@@ -74,7 +74,7 @@ FileOutputStream::~FileOutputStream()
//b - the byte to be written. //b - the byte to be written.
void FileOutputStream::write(unsigned int b) void FileOutputStream::write(unsigned int b)
{ {
byte value = (byte) b; uint8_t value = (uint8_t) b;
#if defined(_WIN32) #if defined(_WIN32)
BOOL result = WriteFile( BOOL result = WriteFile(
@@ -86,7 +86,7 @@ void FileOutputStream::write(unsigned int b)
); );
#else // LINUX #else // LINUX
int fileDescriptor = (int)(intptr_t)(m_fileHandle); int fileDescriptor = (int)(intptr_t)(m_fileHandle);
ssize_t numberOfBytesWritten = ::write(fileDescriptor, NULL, 1); ssize_t numberOfBytesWritten = ::write(fileDescriptor, &value, 1);
int result = static_cast<int>(numberOfBytesWritten); int result = static_cast<int>(numberOfBytesWritten);
#endif // _WIN32 #endif // _WIN32
@@ -115,7 +115,7 @@ void FileOutputStream::write(byteArray b)
); );
#else // Linux #else // Linux
int fileDescriptor = (int)(intptr_t)(m_fileHandle); int fileDescriptor = (int)(intptr_t)(m_fileHandle);
ssize_t numberOfBytesWritten = ::write(fileDescriptor, NULL, 1); ssize_t numberOfBytesWritten = ::write(fileDescriptor, static_cast<const void*>(b.data), b.length);
int result = static_cast<int>(numberOfBytesWritten); int result = static_cast<int>(numberOfBytesWritten);
#endif // _WIN32 #endif // _WIN32
+1 -1
View File
@@ -25,7 +25,7 @@ public:
dis->readFully(data); dis->readFully(data);
} }
byte getId() { return TAG_Byte_Array; } uint8_t getId() { return TAG_Byte_Array; }
wstring toString() wstring toString()
{ {
+3 -3
View File
@@ -4,14 +4,14 @@
class ByteTag : public Tag class ByteTag : public Tag
{ {
public: public:
byte data; uint8_t data;
ByteTag(const wstring &name) : Tag(name) {} ByteTag(const wstring &name) : Tag(name) {}
ByteTag(const wstring &name, byte data) : Tag(name) {this->data = data; } ByteTag(const wstring &name, uint8_t data) : Tag(name) {this->data = data; }
void write(DataOutput *dos) { dos->writeByte(data); } void write(DataOutput *dos) { dos->writeByte(data); }
void load(DataInput *dis) { data = dis->readByte(); } void load(DataInput *dis) { data = dis->readByte(); }
byte getId() { return TAG_Byte; } uint8_t getId() { return TAG_Byte; }
wstring toString() wstring toString()
{ {
static wchar_t buf[32]; static wchar_t buf[32];
+6 -6
View File
@@ -55,7 +55,7 @@ public:
return ret; return ret;
} }
byte getId() uint8_t getId()
{ {
return TAG_Compound; return TAG_Compound;
} }
@@ -65,7 +65,7 @@ public:
tags[name] = tag->setName(wstring( name )); tags[name] = tag->setName(wstring( name ));
} }
void putByte(const wchar_t * name, byte value) void putByte(const wchar_t * name, uint8_t value)
{ {
tags[name] = (new ByteTag(name,value)); tags[name] = (new ByteTag(name,value));
} }
@@ -117,7 +117,7 @@ public:
void putBoolean(const wchar_t * string, bool val) void putBoolean(const wchar_t * string, bool val)
{ {
putByte(string, val?static_cast<byte>(1):static_cast<byte>(0)); putByte(string, val?static_cast<uint8_t>(1):static_cast<uint8_t>(0));
} }
Tag *get(const wchar_t *name) Tag *get(const wchar_t *name)
@@ -132,9 +132,9 @@ public:
return tags.find(name) != tags.end(); return tags.find(name) != tags.end();
} }
byte getByte(const wchar_t * name) uint8_t getByte(const wchar_t * name)
{ {
if (tags.find(name) == tags.end()) return (byte)0; if (tags.find(name) == tags.end()) return (uint8_t)0;
return ((ByteTag *) tags[name])->data; return ((ByteTag *) tags[name])->data;
} }
@@ -200,7 +200,7 @@ public:
bool getBoolean(const wchar_t *string) bool getBoolean(const wchar_t *string)
{ {
return getByte(string) != static_cast<byte>(0); return getByte(string) != static_cast<uint8_t>(0);
} }
void remove(const wstring &name) void remove(const wstring &name)
+1 -1
View File
@@ -12,7 +12,7 @@ public:
void write(DataOutput *dos) { dos->writeDouble(data); } void write(DataOutput *dos) { dos->writeDouble(data); }
void load(DataInput *dis) { data = dis->readDouble(); } void load(DataInput *dis) { data = dis->readDouble(); }
byte getId() { return TAG_Double; } uint8_t getId() { return TAG_Double; }
wstring toString() wstring toString()
{ {
static wchar_t buf[32]; static wchar_t buf[32];
+1 -1
View File
@@ -10,7 +10,7 @@ public:
void load(DataInput *dis) {}; void load(DataInput *dis) {};
void write(DataOutput *dos) {}; void write(DataOutput *dos) {};
byte getId() { return TAG_End; } uint8_t getId() { return TAG_End; }
wstring toString() { return wstring( L"END" ); } wstring toString() { return wstring( L"END" ); }
Tag *copy() Tag *copy()
+1 -1
View File
@@ -12,7 +12,7 @@ public:
void write(DataOutput *dos) { dos->writeFloat(data); } void write(DataOutput *dos) { dos->writeFloat(data); }
void load(DataInput *dis) { data = dis->readFloat(); } void load(DataInput *dis) { data = dis->readFloat(); }
byte getId() { return TAG_Float; } uint8_t getId() { return TAG_Float; }
wstring toString() wstring toString()
{ {
static wchar_t buf[32]; static wchar_t buf[32];
+1 -1
View File
@@ -38,7 +38,7 @@ public:
} }
} }
byte getId() { return TAG_Int_Array; } uint8_t getId() { return TAG_Int_Array; }
wstring toString() wstring toString()
{ {

Some files were not shown because too many files have changed in this diff Show More