diff --git a/Minecraft.Client/Common/App_structs.h b/Minecraft.Client/Common/App_structs.h index 74a4e825..a146ab88 100644 --- a/Minecraft.Client/Common/App_structs.h +++ b/Minecraft.Client/Common/App_structs.h @@ -65,7 +65,7 @@ typedef struct // In-Menu sensitivity unsigned char ucMenuSensitivity; unsigned char ucInterfaceOpacity; - unsigned char ucPad02; // 1 byte padding + unsigned char ucPad02; // 1 BYTE padding unsigned char ucFov; // Adding another bitmask flag for more settings for 1.8.2 diff --git a/Minecraft.Client/Common/C4JMemoryPool.h b/Minecraft.Client/Common/C4JMemoryPool.h index e1e795ec..ed767250 100644 --- a/Minecraft.Client/Common/C4JMemoryPool.h +++ b/Minecraft.Client/Common/C4JMemoryPool.h @@ -153,7 +153,7 @@ public: virtual void* Alloc(size_t size) { - size = Align(size, 4); // 4 byte align the memory + size = Align(size, 4); // 4 BYTE align the memory assert((m_currentOffset + size) < m_totalSize); // make sure we haven't ran out of space void* returnMem = &m_pMemory[m_currentOffset]; // grab the return memory m_currentOffset += size; diff --git a/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp b/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp index 2b785998..eb51b0e4 100644 --- a/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp +++ b/Minecraft.Client/Common/DLC/DLCGameRulesHeader.cpp @@ -34,7 +34,7 @@ void DLCGameRulesHeader::addData(PBYTE pbData, DWORD dwBytes) // Init values. int version_number; - byte compression_type; + BYTE compression_type; wstring texturepackid; // Read Datastream. diff --git a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp index f574b2d5..c092d901 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleManager.cpp +++ b/Minecraft.Client/Common/GameRules/GameRuleManager.cpp @@ -104,7 +104,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack) { DLCGameRulesHeader *dlcHeader = static_cast(pack->getFile(DLCManager::e_DLCType_GameRulesHeader, i)); DWORD dSize; - byte *dData = dlcHeader->getData(dSize); + BYTE *dData = dlcHeader->getData(dSize); LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(pack); // = loadGameRules(dData, dSize); //, strings); @@ -123,7 +123,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack) DLCGameRulesFile *dlcFile = static_cast(pack->getFile(DLCManager::e_DLCType_GameRules, i)); DWORD dSize; - byte *dData = dlcFile->getData(dSize); + BYTE *dData = dlcFile->getData(dSize); LevelGenerationOptions *createdLevelGenerationOptions = new LevelGenerationOptions(pack); // = loadGameRules(dData, dSize); //, strings); @@ -137,7 +137,7 @@ void GameRuleManager::loadGameRules(DLCPack *pack) } } -LevelGenerationOptions *GameRuleManager::loadGameRules(byte *dIn, UINT dSize) +LevelGenerationOptions *GameRuleManager::loadGameRules(BYTE *dIn, UINT dSize) { LevelGenerationOptions *lgo = new LevelGenerationOptions(); lgo->setGrSource( new JustGrSource() ); @@ -148,7 +148,7 @@ LevelGenerationOptions *GameRuleManager::loadGameRules(byte *dIn, UINT dSize) } // 4J-JEV: Reverse of saveGameRules. -void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT dSize) +void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, BYTE *dIn, UINT dSize) { app.DebugPrintf("GameRuleManager::LoadingGameRules:\n"); @@ -235,7 +235,7 @@ void GameRuleManager::loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT } // 4J-JEV: Reverse of loadGameRules. -void GameRuleManager::saveGameRules(byte **dOut, UINT *dSize) +void GameRuleManager::saveGameRules(BYTE **dOut, UINT *dSize) { if (m_currentGameRuleDefinitions == nullptr && m_currentLevelGenerationOptions == nullptr) @@ -368,7 +368,7 @@ void GameRuleManager::writeRuleFile(DataOutputStream *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, BYTE *dIn, UINT dSize, StringTable *strings) //(DLCGameRulesFile *dlcFile, StringTable *strings) { bool levelGenAdded = false; bool gameRulesAdded = false; diff --git a/Minecraft.Client/Common/GameRules/GameRuleManager.h b/Minecraft.Client/Common/GameRules/GameRuleManager.h index 3f446e84..e16e6a71 100644 --- a/Minecraft.Client/Common/GameRules/GameRuleManager.h +++ b/Minecraft.Client/Common/GameRules/GameRuleManager.h @@ -40,10 +40,10 @@ public: void loadGameRules(DLCPack *); - LevelGenerationOptions *loadGameRules(byte *dIn, UINT dSize); - void loadGameRules(LevelGenerationOptions *lgo, byte *dIn, UINT dSize); + LevelGenerationOptions *loadGameRules(BYTE *dIn, UINT dSize); + void loadGameRules(LevelGenerationOptions *lgo, BYTE *dIn, UINT dSize); - void saveGameRules(byte **dOut, UINT *dSize); + void saveGameRules(BYTE **dOut, UINT *dSize); private: LevelGenerationOptions *readHeader(DLCGameRulesHeader *grh); @@ -51,7 +51,7 @@ private: void writeRuleFile(DataOutputStream *dos); public: - bool readRuleFile(LevelGenerationOptions *lgo, byte *dIn, UINT dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings); + bool readRuleFile(LevelGenerationOptions *lgo, BYTE *dIn, UINT dSize, StringTable *strings); //(DLCGameRulesFile *dlcFile, StringTable *strings); private: void readAttributes(DataInputStream *dis, vector *tagsAndAtts, GameRuleDefinition *rule); diff --git a/Minecraft.Client/Common/Network/SessionInfo.h b/Minecraft.Client/Common/Network/SessionInfo.h index 4e091c87..ac939ac6 100644 --- a/Minecraft.Client/Common/Network/SessionInfo.h +++ b/Minecraft.Client/Common/Network/SessionInfo.h @@ -16,9 +16,9 @@ typedef struct _GameSessionData char szPlayers[MINECRAFT_NET_MAX_PLAYERS][XUSER_NAME_SIZE]; // 128 bytes ( 8*16) unsigned int m_uiGameHostSettings; // 4 bytes unsigned int texturePackParentId; // 4 bytes - unsigned char subTexturePackId; // 1 byte + unsigned char subTexturePackId; // 1 BYTE - bool isJoinable; // 1 byte + bool isJoinable; // 1 BYTE _GameSessionData() { @@ -40,12 +40,12 @@ typedef struct _GameSessionData GameSessionUID players[MINECRAFT_NET_MAX_PLAYERS]; // 64 bytes ( 8*8 ) on xbox, 192 ( 24*8) on PS3 unsigned int m_uiGameHostSettings; // 4 bytes unsigned int texturePackParentId; // 4 bytes - unsigned char subTexturePackId; // 1 byte + unsigned char subTexturePackId; // 1 BYTE - bool isJoinable; // 1 byte + bool isJoinable; // 1 BYTE - unsigned char playerCount; // 1 byte - bool isReadyToJoin; // 1 byte + unsigned char playerCount; // 1 BYTE + bool isReadyToJoin; // 1 BYTE _GameSessionData() { diff --git a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp index 4ed27824..fb7c3b6e 100644 --- a/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp +++ b/Minecraft.Client/Common/Network/Sony/SQRNetworkPlayer.cpp @@ -207,7 +207,7 @@ bool SQRNetworkPlayer::HasSmallIdConfirmed() return ( m_flags & SNP_FLAG_SMALLID_CONFIRMED ); } -// To confirm to the host that we are ready, send a single byte with our small id. +// To confirm to the host that we are ready, send a single BYTE with our small id. void SQRNetworkPlayer::ConfirmReady() { SendInternal(&m_ISD, sizeof(InitSendData), e_flag_AckNotRequested); diff --git a/Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h b/Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h index de70398d..b1290726 100644 --- a/Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h +++ b/Minecraft.Client/Common/Network/Sony/sceRemoteStorage/header/sceRemoteStorage.h @@ -97,12 +97,12 @@ int32_t sceRemoteStorageGetStatus(const SceRemoteStorageStatusReqParams & params /// Gets section of data from a file specified. /// /// Gets section of data from a file specified. The amount of data requested can be of any size. To request this information the name of file, the number of bytes and -/// the byte to start reading along with a buffer to store such data must be provided. +/// the BYTE to start reading along with a buffer to store such data must be provided. /// Metadata information of the file, as description or visibility, will be provided only in the case the first amount of bytes for the file are requested (offset = 0). /// This method does make use of the callback to inform the user of success termination. The SceRemoteStorageData pointer must be a pointer to a valid /// location in memory until the callback is called as the output information will be stored in such location. /// -/// @param params The structure containing the file name to read, the start byte to start reading and the amount of bytes to read. +/// @param params The structure containing the file name to read, the start BYTE to start reading and the amount of bytes to read. /// @param status The structure where the output information will be stored. The memory location being pointed must be valid until the callback gets called. /// /// @retval SCE_REMOTE_STORAGE_SUCCESS The operation was successfully registered on the thread. diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index 2623679f..b6546098 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -1300,7 +1300,7 @@ bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, return _override; } -void IUIScene_CreativeMenu::BuildFirework(vector > *list, byte type, int color, int sulphur, bool flicker, bool trail, int fadeColor/*= -1*/) +void IUIScene_CreativeMenu::BuildFirework(vector > *list, BYTE type, int color, int sulphur, bool flicker, bool trail, int fadeColor/*= -1*/) { ///////////////////////////////// // Create firecharge @@ -1361,7 +1361,7 @@ void IUIScene_CreativeMenu::BuildFirework(vector > *lis expTags->add(expTag); fireTag->put(FireworksItem::TAG_EXPLOSIONS, expTags); - fireTag->putByte(FireworksItem::TAG_FLIGHT, static_cast(sulphur)); + fireTag->putByte(FireworksItem::TAG_FLIGHT, static_cast(sulphur)); itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag); diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h index 864fb560..d6cd94d0 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h @@ -137,5 +137,5 @@ protected: EToolTipItem &buttonBack ); - static void BuildFirework(vector > *list, byte type, int color, int sulphur, bool flicker, bool trail, int fadeColor = -1); + static void BuildFirework(vector > *list, BYTE type, int color, int sulphur, bool flicker, bool trail, int fadeColor = -1); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index c1f1bac5..e332bf9b 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -2128,7 +2128,7 @@ size_t UIController::RegisterForCallbackId(UIScene *scene) { EnterCriticalSection(&m_registeredCallbackScenesCS); size_t newId = GetTickCount(); - newId &= 0xFFFFFF; // Chop off the top byte, we don't need any more accuracy than that + newId &= 0xFFFFFF; // Chop off the top BYTE, we don't need any more accuracy than that newId |= (scene->getSceneType() << 24); // Add in the scene's type to help keep this unique m_registeredCallbackScenes[newId] = scene; LeaveCriticalSection(&m_registeredCallbackScenesCS); diff --git a/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp b/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp index 9dcbe45b..9d90804f 100644 --- a/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp @@ -36,7 +36,7 @@ UIScene_FurnaceMenu::UIScene_FurnaceMenu(int iPad, void *_initData, UILayer *par m_slotListIngredient.addSlots(FurnaceMenu::INGREDIENT_SLOT, 1); m_slotListResult.addSlots(FurnaceMenu::RESULT_SLOT, 1); - app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_FORGING); + app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_FURNACE); delete initData; } diff --git a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h index 464c83a0..2d8d3417 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h @@ -13,7 +13,7 @@ private: typedef struct _PlayerInfo { - byte m_smallId; + BYTE m_smallId; char m_voiceStatus; short m_colorState; wstring m_name; diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index cb33fdc1..55f1f62c 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -566,8 +566,8 @@ void C_4JProfile::Initialise(DWORD dwTitleID, { for (int i = 0; i < 4; i++) { - profileData[i] = new byte[iGameDefinedDataSizeX4 / 4]; - ZeroMemory(profileData[i], sizeof(byte) * iGameDefinedDataSizeX4 / 4); + profileData[i] = new BYTE[iGameDefinedDataSizeX4 / 4]; + ZeroMemory(profileData[i], sizeof(BYTE) * iGameDefinedDataSizeX4 / 4); // Set some sane initial values! GAME_SETTINGS* pGameSettings = static_cast(profileData[i]); diff --git a/Minecraft.Client/GameRenderer.cpp b/Minecraft.Client/GameRenderer.cpp index 4fbd1c20..6cf60a24 100644 --- a/Minecraft.Client/GameRenderer.cpp +++ b/Minecraft.Client/GameRenderer.cpp @@ -61,7 +61,7 @@ C4JThread* GameRenderer::m_updateThread; C4JThread::EventArray* GameRenderer::m_updateEvents; bool GameRenderer::nearThingsToDo = false; bool GameRenderer::updateRunning = false; -vector GameRenderer::m_deleteStackByte; +vector GameRenderer::m_deleteStackByte; vector GameRenderer::m_deleteStackSparseLightStorage; vector GameRenderer::m_deleteStackCompressedTileStorage; vector GameRenderer::m_deleteStackSparseDataStorage; @@ -1224,7 +1224,7 @@ void GameRenderer::renderLevel(float a) #ifdef MULTITHREAD_ENABLE // Request that an item be deleted, when it is safe to do so -void GameRenderer::AddForDelete(byte *deleteThis) +void GameRenderer::AddForDelete(BYTE *deleteThis) { EnterCriticalSection(&m_csDeleteStack); m_deleteStackByte.push_back(deleteThis); @@ -2010,9 +2010,9 @@ void GameRenderer::setupClearColor(float a) float clearness = EnchantmentHelper::getOxygenBonus(player) * 0.2f; unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Water_Clear_Colour ); - byte redComponent = ((colour>>16)&0xFF); - byte greenComponent = ((colour>>8)&0xFF); - byte blueComponent = ((colour)&0xFF); + BYTE redComponent = ((colour>>16)&0xFF); + BYTE greenComponent = ((colour>>8)&0xFF); + BYTE blueComponent = ((colour)&0xFF); fr = static_cast(redComponent)/256 + clearness;//0.02f; fg = static_cast(greenComponent)/256 + clearness;//0.02f; @@ -2021,9 +2021,9 @@ void GameRenderer::setupClearColor(float a) else if (t != 0 && Tile::tiles[t]->material == Material::lava) { unsigned int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Under_Lava_Clear_Colour ); - byte redComponent = ((colour>>16)&0xFF); - byte greenComponent = ((colour>>8)&0xFF); - byte blueComponent = ((colour)&0xFF); + BYTE redComponent = ((colour>>16)&0xFF); + BYTE greenComponent = ((colour>>8)&0xFF); + BYTE blueComponent = ((colour)&0xFF); fr = static_cast(redComponent)/256;//0.6f; fg = static_cast(greenComponent)/256;//0.1f; diff --git a/Minecraft.Client/GameRenderer.h b/Minecraft.Client/GameRenderer.h index c379106e..fdff0457 100644 --- a/Minecraft.Client/GameRenderer.h +++ b/Minecraft.Client/GameRenderer.h @@ -180,12 +180,12 @@ public: static bool nearThingsToDo; static bool updateRunning; #endif - static vector m_deleteStackByte; + static vector m_deleteStackByte; static vector m_deleteStackSparseLightStorage; static vector m_deleteStackCompressedTileStorage; static vector m_deleteStackSparseDataStorage; static CRITICAL_SECTION m_csDeleteStack; - static void AddForDelete(byte *deleteThis); + static void AddForDelete(BYTE *deleteThis); static void AddForDelete(SparseLightStorage *deleteThis); static void AddForDelete(CompressedTileStorage *deleteThis); static void AddForDelete(SparseDataStorage *deleteThis); diff --git a/Minecraft.Client/LevelRenderer.h b/Minecraft.Client/LevelRenderer.h index 37e0b813..bc46cc97 100644 --- a/Minecraft.Client/LevelRenderer.h +++ b/Minecraft.Client/LevelRenderer.h @@ -240,7 +240,7 @@ public: void setGlobalChunkFlag(int index, unsigned char flag, unsigned char shift = 0); void clearGlobalChunkFlag(int x, int y, int z, Level *level, unsigned char flag, unsigned char shift = 0); - // Get/set whole byte of flags + // Get/set whole BYTE of flags unsigned char getGlobalChunkFlags(int x, int y, int z, Level *level); void setGlobalChunkFlags(int x, int y, int z, Level *level, unsigned char flags); diff --git a/Minecraft.Client/Minimap.cpp b/Minecraft.Client/Minimap.cpp index 4f6ccd6b..1110e7ed 100644 --- a/Minecraft.Client/Minimap.cpp +++ b/Minecraft.Client/Minimap.cpp @@ -52,12 +52,12 @@ Minimap::Minimap(Font *font, Options *options, Textures *textures, bool optimise void Minimap::reloadColours() { ColourTable *colourTable = Minecraft::GetInstance()->getColourTable(); - // 4J note that this code has been extracted pretty much as it was in Minimap::render, although with some byte order changes + // 4J note that this code has been extracted pretty much as it was in Minimap::render, although with some BYTE order changes for( int i = 0; i < (14 * 4); i++ ) // 14 material colours currently, 4 brightnesses of each { if (i / 4 == 0) { - // 4J - changed byte order to save having to reorder later + // 4J - changed BYTE order to save having to reorder later #ifdef __ORBIS__ LUT[i] = 0; #else @@ -78,7 +78,7 @@ void Minimap::reloadColours() int g = ((color >> 8) & 0xff) * br / 255; int b = ((color) & 0xff) * br / 255; - // 4J - changed byte order to save having to reorder later + // 4J - changed BYTE order to save having to reorder later #if ( defined _DURANGO || defined _WIN64 || __PSVITA__ ) LUT[i] = 255 << 24 | b << 16 | g << 8 | r; #elif defined _XBOX diff --git a/Minecraft.Client/MultiPlayerChunkCache.cpp b/Minecraft.Client/MultiPlayerChunkCache.cpp index 62361ce3..4bddccb0 100644 --- a/Minecraft.Client/MultiPlayerChunkCache.cpp +++ b/Minecraft.Client/MultiPlayerChunkCache.cpp @@ -196,7 +196,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z) // 4J - changed to use new methods for lighting chunk->setSkyLightDataAllBright(); - // Arrays::fill(chunk->skyLight->data, (byte) 255); + // Arrays::fill(chunk->skyLight->data, (BYTE) 255); } chunk->loaded = true; diff --git a/Minecraft.Client/PlayerChunkMap.cpp b/Minecraft.Client/PlayerChunkMap.cpp index bcc3f6ba..5c3a2e85 100644 --- a/Minecraft.Client/PlayerChunkMap.cpp +++ b/Minecraft.Client/PlayerChunkMap.cpp @@ -312,8 +312,8 @@ bool PlayerChunkMap::PlayerChunk::broadcastChanges(bool allowRegionUpdate) } 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 - broadcast(std::make_shared(pos.x, pos.z, changedTiles, static_cast(changes), level)); + // 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(std::make_shared(pos.x, pos.z, changedTiles, static_cast(changes), level)); for (int i = 0; i < changes; i++) { int x = pos.x * 16 + ((changedTiles[i] >> 12) & 15); diff --git a/Minecraft.Client/PlayerConnection.cpp b/Minecraft.Client/PlayerConnection.cpp index 1fb7c398..8acbacd0 100644 --- a/Minecraft.Client/PlayerConnection.cpp +++ b/Minecraft.Client/PlayerConnection.cpp @@ -1266,7 +1266,7 @@ void PlayerConnection::handleSetCreativeModeSlot(shared_ptrx = centreXC; data->z = centreZC; - data->dimension = static_cast(player->level->dimension->id); + data->dimension = static_cast(player->level->dimension->id); data->setDirty(); } diff --git a/Minecraft.Client/PlayerList.cpp b/Minecraft.Client/PlayerList.cpp index ba82ec6a..89eb8ef7 100644 --- a/Minecraft.Client/PlayerList.cpp +++ b/Minecraft.Client/PlayerList.cpp @@ -264,8 +264,8 @@ bool PlayerList::placeNewPlayer(Connection *connection, shared_ptr playerConnection->send(std::make_shared(L"", player->entityId, level->getLevelData()->getGenerator(), level->getSeed(), player->gameMode->getGameModeForPlayer()->getId(), - static_cast(level->dimension->id), static_cast(level->getMaxBuildHeight()), - static_cast(maxPlayersForPacket), + static_cast(level->dimension->id), static_cast(level->getMaxBuildHeight()), + static_cast(maxPlayersForPacket), level->difficulty, TelemetryManager->GetMultiplayerInstanceID(), static_cast(playerIndex), level->useNewSeaLevel(), diff --git a/Minecraft.Client/ServerChunkCache.cpp b/Minecraft.Client/ServerChunkCache.cpp index eb1b284b..e96e63a2 100644 --- a/Minecraft.Client/ServerChunkCache.cpp +++ b/Minecraft.Client/ServerChunkCache.cpp @@ -757,7 +757,7 @@ bool ServerChunkCache::save(bool force, ProgressListener *progressListener) } LevelChunk *chunk = nullptr; - byte workingThreads; + BYTE workingThreads; bool chunkSet = false; // Created a roughly sorted list to match the order that the files were created in McRegionChunkStorage::McRegionChunkStorage. diff --git a/Minecraft.Client/ServerLevel.cpp b/Minecraft.Client/ServerLevel.cpp index 5c0aa7f6..7ccd8122 100644 --- a/Minecraft.Client/ServerLevel.cpp +++ b/Minecraft.Client/ServerLevel.cpp @@ -1100,7 +1100,7 @@ bool ServerLevel::addGlobalEntity(shared_ptr e) return false; } -void ServerLevel::broadcastEntityEvent(shared_ptr e, byte event) +void ServerLevel::broadcastEntityEvent(shared_ptr e, BYTE event) { shared_ptr p = std::make_shared(e->entityId, event); server->getLevel(dimension->id)->getTracker()->broadcastAndSend(e, p); diff --git a/Minecraft.Client/ServerLevel.h b/Minecraft.Client/ServerLevel.h index 77a5cb78..e5e22595 100644 --- a/Minecraft.Client/ServerLevel.h +++ b/Minecraft.Client/ServerLevel.h @@ -106,7 +106,7 @@ protected: public: shared_ptr getEntity(int id); virtual bool addGlobalEntity(shared_ptr e); - void broadcastEntityEvent(shared_ptr e, byte event); + void broadcastEntityEvent(shared_ptr e, BYTE event); virtual shared_ptr explode(shared_ptr 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); diff --git a/Minecraft.Client/Tesselator.cpp b/Minecraft.Client/Tesselator.cpp index 2ed4374b..828e0f37 100644 --- a/Minecraft.Client/Tesselator.cpp +++ b/Minecraft.Client/Tesselator.cpp @@ -313,7 +313,7 @@ void Tesselator::color(int r, int g, int b, int a) col = (r << 24) | (g << 16) | (b << 8) | (a); } -void Tesselator::color(byte r, byte g, byte b) +void Tesselator::color(BYTE r, BYTE g, BYTE b) { color(r & 0xff, g & 0xff, b & 0xff); } @@ -349,7 +349,7 @@ void Tesselator::vertexUV(float x, float y, float z, float u, float v) // 4 - not axis aligned, use uv stored in the vertex data 4 on from this one // ll is an 8-bit (4 bit per u/v) index into the current lighting texture // -// For quads that don't have axis aligned UVs (ie have a code for 4 in i as described above) the 8 byte vertex +// For quads that don't have axis aligned UVs (ie have a code for 4 in i as described above) the 8 BYTE vertex // is followed by a further 8 bytes which have explicit UVs defined for each vertex: // // 0000 0000 uuuu vvvv (vertex 0) @@ -799,7 +799,7 @@ void Tesselator::vertex(float x, float y, float z) int16_t u2 = ((int16_t*)&_tex2)[0]; int16_t v2 = ((int16_t*)&_tex2)[1]; #if defined _XBOX_ONE || defined __ORBIS__ - // Optimisation - pack the second UVs into a single short (they could actually go in a byte), which frees up a short to store the x offset for this chunk in the vertex itself. + // Optimisation - pack the second UVs into a single short (they could actually go in a BYTE), which frees up a short to store the x offset for this chunk in the vertex itself. // This means that when rendering chunks, we don't need to update the vertex constants that specify the location for a chunk, when only the x offset has changed. pShortData[6] = ( u2 << 8 ) | v2; pShortData[7] = -xoo; @@ -1000,15 +1000,15 @@ void Tesselator::normal(float x, float y, float z) #ifdef __PS3__ _normal = _ConvertF32toX11Y11Z10N(x,y,z); #elif __PSVITA__ - // AP - casting a negative value to 'byte' on Vita results in zero. changed to a signed 8 value + // AP - casting a negative value to 'BYTE' on Vita results in zero. changed to a signed 8 value int8_t xx = (int8_t) (x * 127); int8_t yy = (int8_t) (y * 127); int8_t zz = (int8_t) (z * 127); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); #else - byte xx = static_cast(x * 127); - byte yy = static_cast(y * 127); - byte zz = static_cast(z * 127); + BYTE xx = static_cast(x * 127); + BYTE yy = static_cast(y * 127); + BYTE zz = static_cast(z * 127); _normal = (xx & 0xff) | ((yy & 0xff) << 8) | ((zz & 0xff) << 16); #endif } diff --git a/Minecraft.Client/Tesselator.h b/Minecraft.Client/Tesselator.h index 4166727a..f377aba4 100644 --- a/Minecraft.Client/Tesselator.h +++ b/Minecraft.Client/Tesselator.h @@ -121,7 +121,7 @@ public: 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, int a); - void color(byte r, byte g, byte b); + void color(BYTE r, BYTE g, BYTE b); void vertexUV(float x, float y, float z, float u, float v); void vertex(float x, float y, float z); void color(int c); diff --git a/Minecraft.Client/Texture.cpp b/Minecraft.Client/Texture.cpp index 4a3a9d9d..6f853ac5 100644 --- a/Minecraft.Client/Texture.cpp +++ b/Minecraft.Client/Texture.cpp @@ -271,10 +271,10 @@ void Texture::writeAsBMP(const wstring &name) // Write the header outStream->writeShort((short)0x424d); // 0x0000: ID - 'BM' int byteSize = width * height * 4 + 54; - outStream->writeByte((byte)(byteSize >> 0)); // 0x0002: Raw file size - outStream->writeByte((byte)(byteSize >> 8)); - outStream->writeByte((byte)(byteSize >> 16)); - outStream->writeByte((byte)(byteSize >> 24)); + outStream->writeByte((BYTE)(byteSize >> 0)); // 0x0002: Raw file size + outStream->writeByte((BYTE)(byteSize >> 8)); + outStream->writeByte((BYTE)(byteSize >> 16)); + outStream->writeByte((BYTE)(byteSize >> 24)); outStream->writeInt(0); // 0x0006: Reserved outStream->writeByte(54); // 0x000A: Start of pixel data outStream->writeByte(0); @@ -284,31 +284,31 @@ void Texture::writeAsBMP(const wstring &name) outStream->writeByte(0); outStream->writeByte(0); outStream->writeByte(0); - outStream->writeByte((byte)(width >> 0)); // 0x0012: Image width, in pixels - outStream->writeByte((byte)(width >> 8)); - outStream->writeByte((byte)(width >> 16)); - outStream->writeByte((byte)(width >> 24)); - outStream->writeByte((byte)(height >> 0)); // 0x0016: Image height, in pixels - outStream->writeByte((byte)(height >> 8)); - outStream->writeByte((byte)(height >> 16)); - outStream->writeByte((byte)(height >> 24)); + outStream->writeByte((BYTE)(width >> 0)); // 0x0012: Image width, in pixels + outStream->writeByte((BYTE)(width >> 8)); + outStream->writeByte((BYTE)(width >> 16)); + outStream->writeByte((BYTE)(width >> 24)); + outStream->writeByte((BYTE)(height >> 0)); // 0x0016: Image height, in pixels + outStream->writeByte((BYTE)(height >> 8)); + outStream->writeByte((BYTE)(height >> 16)); + outStream->writeByte((BYTE)(height >> 24)); outStream->writeByte(1); // 0x001A: Number of color planes, must be 1 outStream->writeByte(0); outStream->writeByte(32); // 0x001C: Bit depth (32bpp) outStream->writeByte(0); outStream->writeInt(0); // 0x001E: Compression mode (BI_RGB, uncompressed) int bufSize = width * height * 4; - outStream->writeInt((byte)(bufSize >> 0)); // 0x0022: Raw size of bitmap data - outStream->writeInt((byte)(bufSize >> 8)); - outStream->writeInt((byte)(bufSize >> 16)); - outStream->writeInt((byte)(bufSize >> 24)); + outStream->writeInt((BYTE)(bufSize >> 0)); // 0x0022: Raw size of bitmap data + outStream->writeInt((BYTE)(bufSize >> 8)); + outStream->writeInt((BYTE)(bufSize >> 16)); + outStream->writeInt((BYTE)(bufSize >> 24)); outStream->writeInt(0); // 0x0026: Horizontal 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); // 0x0032: Number of important colors, 0 for all // Pixels follow in inverted Y order - byte[] bytes = new byte[width * height * 4]; + BYTE[] bytes = new BYTE[width * height * 4]; data.position(0); data.get(bytes); for (int y = height - 1; y >= 0; y--) @@ -337,7 +337,7 @@ void Texture::writeAsPNG(const wstring &filename) #if 0 BufferedImage *image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); ByteBuffer *buffer = this->getData(); - byte[] bytes = new byte[width * height * 4]; + BYTE[] bytes = new BYTE[width * height * 4]; buffer.position(0); buffer.get(bytes); @@ -531,10 +531,10 @@ void Texture::transferFromBuffer(intArray buffer) { int texel = column + x * 4; data[0]->position(0); - data[0]->put(texel + byteRemap[0], static_cast((buffer[texel >> 2] >> 24) & 0xff)); - data[0]->put(texel + byteRemap[1], static_cast((buffer[texel >> 2] >> 16) & 0xff)); - data[0]->put(texel + byteRemap[2], static_cast((buffer[texel >> 2] >> 8) & 0xff)); - data[0]->put(texel + byteRemap[3], static_cast((buffer[texel >> 2] >> 0) & 0xff)); + data[0]->put(texel + byteRemap[0], static_cast((buffer[texel >> 2] >> 24) & 0xff)); + data[0]->put(texel + byteRemap[1], static_cast((buffer[texel >> 2] >> 16) & 0xff)); + data[0]->put(texel + byteRemap[2], static_cast((buffer[texel >> 2] >> 8) & 0xff)); + data[0]->put(texel + byteRemap[3], static_cast((buffer[texel >> 2] >> 0) & 0xff)); } } } @@ -590,10 +590,10 @@ void Texture::transferFromImage(BufferedImage *image) // Pull ARGB bytes into either RGBA or BGRA depending on format - tempBytes[byteIndex + byteRemap[0]] = static_cast((tempPixels[intIndex] >> 24) & 0xff); - tempBytes[byteIndex + byteRemap[1]] = static_cast((tempPixels[intIndex] >> 16) & 0xff); - tempBytes[byteIndex + byteRemap[2]] = static_cast((tempPixels[intIndex] >> 8) & 0xff); - tempBytes[byteIndex + byteRemap[3]] = static_cast((tempPixels[intIndex] >> 0) & 0xff); + tempBytes[byteIndex + byteRemap[0]] = static_cast((tempPixels[intIndex] >> 24) & 0xff); + tempBytes[byteIndex + byteRemap[1]] = static_cast((tempPixels[intIndex] >> 16) & 0xff); + tempBytes[byteIndex + byteRemap[2]] = static_cast((tempPixels[intIndex] >> 8) & 0xff); + tempBytes[byteIndex + byteRemap[3]] = static_cast((tempPixels[intIndex] >> 0) & 0xff); } } @@ -642,10 +642,10 @@ void Texture::transferFromImage(BufferedImage *image) // Pull ARGB bytes into either RGBA or BGRA depending on format - tempBytes[byteIndex + byteRemap[0]] = static_cast((tempData[intIndex] >> 24) & 0xff); - tempBytes[byteIndex + byteRemap[1]] = static_cast((tempData[intIndex] >> 16) & 0xff); - tempBytes[byteIndex + byteRemap[2]] = static_cast((tempData[intIndex] >> 8) & 0xff); - tempBytes[byteIndex + byteRemap[3]] = static_cast((tempData[intIndex] >> 0) & 0xff); + tempBytes[byteIndex + byteRemap[0]] = static_cast((tempData[intIndex] >> 24) & 0xff); + tempBytes[byteIndex + byteRemap[1]] = static_cast((tempData[intIndex] >> 16) & 0xff); + tempBytes[byteIndex + byteRemap[2]] = static_cast((tempData[intIndex] >> 8) & 0xff); + tempBytes[byteIndex + byteRemap[3]] = static_cast((tempData[intIndex] >> 0) & 0xff); } } } @@ -677,10 +677,10 @@ void Texture::transferFromImage(BufferedImage *image) // Pull ARGB bytes into either RGBA or BGRA depending on format - tempBytes[byteIndex + byteRemap[0]] = static_cast((col >> 24) & 0xff); - tempBytes[byteIndex + byteRemap[1]] = static_cast((col >> 16) & 0xff); - tempBytes[byteIndex + byteRemap[2]] = static_cast((col >> 8) & 0xff); - tempBytes[byteIndex + byteRemap[3]] = static_cast((col >> 0) & 0xff); + tempBytes[byteIndex + byteRemap[0]] = static_cast((col >> 24) & 0xff); + tempBytes[byteIndex + byteRemap[1]] = static_cast((col >> 16) & 0xff); + tempBytes[byteIndex + byteRemap[2]] = static_cast((col >> 8) & 0xff); + tempBytes[byteIndex + byteRemap[3]] = static_cast((col >> 0) & 0xff); } } @@ -839,7 +839,7 @@ void Texture::updateOnGPU() // 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); ByteBuffer *oldBuffer = data[0]; - data[0] = new ByteBuffer(data[0]->getSize(), (byte*) newData); + data[0] = new ByteBuffer(data[0]->getSize(), (BYTE*) newData); delete oldBuffer; newData += width * height * 4; #else @@ -858,7 +858,7 @@ void Texture::updateOnGPU() // the ram based buffer to it any more inside RenderManager.TextureDataUpdate RenderManager.TextureDataUpdate(0, 0,levelWidth,levelHeight,data[level]->getBuffer(),level); ByteBuffer *oldBuffer = data[level]; - data[level] = new ByteBuffer(data[level]->getSize(), (byte*) newData); + data[level] = new ByteBuffer(data[level]->getSize(), (BYTE*) newData); delete oldBuffer; newData += levelWidth * levelHeight * 4; #else diff --git a/Minecraft.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index ba7c0282..691ca1c6 100644 --- a/Minecraft.Client/Textures.cpp +++ b/Minecraft.Client/Textures.cpp @@ -725,15 +725,15 @@ void Textures::loadTexture(BufferedImage *img, int id, bool blur, bool clamp) int b = (rawPixels[i]) & 0xff; #ifdef _XBOX - newPixels[i * 4 + 0] = (byte) a; - newPixels[i * 4 + 1] = (byte) r; - newPixels[i * 4 + 2] = (byte) g; - newPixels[i * 4 + 3] = (byte) b; + newPixels[i * 4 + 0] = (BYTE) a; + newPixels[i * 4 + 1] = (BYTE) r; + newPixels[i * 4 + 2] = (BYTE) g; + newPixels[i * 4 + 3] = (BYTE) b; #else - newPixels[i * 4 + 0] = static_cast(r); - newPixels[i * 4 + 1] = static_cast(g); - newPixels[i * 4 + 2] = static_cast(b); - newPixels[i * 4 + 3] = static_cast(a); + newPixels[i * 4 + 0] = static_cast(r); + newPixels[i * 4 + 1] = static_cast(g); + newPixels[i * 4 + 2] = static_cast(b); + newPixels[i * 4 + 3] = static_cast(a); #endif } // 4J - now creating a buffer of the size we require dynamically @@ -901,10 +901,10 @@ void Textures::replaceTexture(intArray rawPixels, int w, int h, int id) b = bb; } - newPixels[i * 4 + 0] = static_cast(r); - newPixels[i * 4 + 1] = static_cast(g); - newPixels[i * 4 + 2] = static_cast(b); - newPixels[i * 4 + 3] = static_cast(a); + newPixels[i * 4 + 0] = static_cast(r); + newPixels[i * 4 + 1] = static_cast(g); + newPixels[i * 4 + 2] = static_cast(b); + newPixels[i * 4 + 3] = static_cast(a); } ByteBuffer *pixels = MemoryTracker::createByteBuffer(w * h * 4); // 4J - now creating dynamically pixels->put(newPixels); diff --git a/Minecraft.Client/TileRenderer.cpp b/Minecraft.Client/TileRenderer.cpp index 17973849..bc9a91a0 100644 --- a/Minecraft.Client/TileRenderer.cpp +++ b/Minecraft.Client/TileRenderer.cpp @@ -2771,9 +2771,9 @@ bool TileRenderer::tesselateDustInWorld( Tile* tt, int x, int y, int z ) unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMin ); 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)); - byte 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)); + BYTE 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)); + BYTE blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( (data-1)/14.0f)); colour = redComponent<<16 | greenComponent<<8 | blueComponent; } diff --git a/Minecraft.Client/TrackedEntity.cpp b/Minecraft.Client/TrackedEntity.cpp index a4d017d6..5f64f982 100644 --- a/Minecraft.Client/TrackedEntity.cpp +++ b/Minecraft.Client/TrackedEntity.cpp @@ -152,7 +152,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ) { teleportDelay = 0; - packet = std::make_shared(e->entityId, xn, yn, zn, static_cast(yRotn), static_cast(xRotn)); + packet = std::make_shared(e->entityId, xn, yn, zn, static_cast(yRotn), static_cast(xRotn)); // printf("%d: New teleport rot %d\n",e->entityId,yRotn); yRotp = yRotn; xRotp = xRotn; @@ -205,7 +205,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl ( za >= -16 ) && ( za <= 15 ) && ( ya >= -32 ) && ( ya <= 31 ) ) { - // use the packet with small packet with rotation if we can - 5 bits each for x & z, and 6 for y - still a byte less than the alternative + // use the packet with small packet with rotation if we can - 5 bits each for x & z, and 6 for y - still a BYTE less than the alternative packet = std::make_shared(e->entityId, static_cast(xa), static_cast(ya), static_cast(za), 0, 0); c1b++; } @@ -291,7 +291,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl if (rot) { // 4J: Changed this to use deltas - broadcast(std::make_shared(e->entityId, static_cast(yRota), static_cast(xRota))); + broadcast(std::make_shared(e->entityId, static_cast(yRota), static_cast(xRota))); yRotp = yRotn; xRotp = xRotn; } @@ -308,7 +308,7 @@ void TrackedEntity::tick(EntityTracker *tracker, vector > *pl int yHeadRot = Mth::floor(e->getYHeadRot() * 256 / 360); if (abs(yHeadRot - yHeadRotp) >= TOLERANCE_LEVEL) { - broadcast(std::make_shared(e->entityId, static_cast(yHeadRot))); + broadcast(std::make_shared(e->entityId, static_cast(yHeadRot))); yHeadRotp = yHeadRot; } diff --git a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp index 8717d616..85f07232 100644 --- a/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp +++ b/Minecraft.Client/Windows64/Network/WinsockNetLayer.cpp @@ -403,7 +403,7 @@ bool WinsockNetLayer::JoinGame(const char* ip, int port) Sleep(200); continue; } - // rejectBuf[0] = packet id (255), rejectBuf[1..4] = 4-byte big-endian reason + // rejectBuf[0] = packet id (255), rejectBuf[1..4] = 4-BYTE big-endian reason int reason = ((rejectBuf[1] & 0xff) << 24) | ((rejectBuf[2] & 0xff) << 16) | ((rejectBuf[3] & 0xff) << 8) | (rejectBuf[4] & 0xff); Minecraft::GetInstance()->connectionDisconnected(ProfileManager.GetPrimaryPad(), (DisconnectPacket::eDisconnectReason)reason); @@ -728,7 +728,7 @@ void WinsockNetLayer::ClearSocketForSmallId(BYTE smallId) LeaveCriticalSection(&s_smallIdToSocketLock); } -// Send reject handshake: sentinel 0xFF + DisconnectPacket wire format (1 byte id 255 + 4 byte big-endian reason). Then caller closes socket. +// Send reject handshake: sentinel 0xFF + DisconnectPacket wire format (1 BYTE id 255 + 4 BYTE big-endian reason). Then caller closes socket. static void SendRejectWithReason(SOCKET clientSocket, DisconnectPacket::eDisconnectReason reason) { BYTE buf[6]; diff --git a/Minecraft.Client/Windows64/Sentient/DynamicConfigurations.h b/Minecraft.Client/Windows64/Sentient/DynamicConfigurations.h index 61b206eb..37d52e3c 100644 --- a/Minecraft.Client/Windows64/Sentient/DynamicConfigurations.h +++ b/Minecraft.Client/Windows64/Sentient/DynamicConfigurations.h @@ -51,7 +51,7 @@ private: static size_t s_currentConfigSize; static size_t s_dataWrittenSize; - static byte *s_dataWritten; + static BYTE *s_dataWritten; public: static void Tick(); diff --git a/Minecraft.Client/Windows64/Sentient/TelemetryEnum.h b/Minecraft.Client/Windows64/Sentient/TelemetryEnum.h index 5a5a709f..103a25ce 100644 --- a/Minecraft.Client/Windows64/Sentient/TelemetryEnum.h +++ b/Minecraft.Client/Windows64/Sentient/TelemetryEnum.h @@ -231,5 +231,5 @@ enum ETelemetryChallenges eTelemetryTutorial_FireworksMenu, eTelemetryTutorial_BeaconMenu - // Sent over network as a byte + // Sent over network as a BYTE }; \ No newline at end of file diff --git a/Minecraft.Client/Windows64/Windows64_Xuid.h b/Minecraft.Client/Windows64/Windows64_Xuid.h index f5fd62b9..1d621329 100644 --- a/Minecraft.Client/Windows64/Windows64_Xuid.h +++ b/Minecraft.Client/Windows64/Windows64_Xuid.h @@ -84,7 +84,7 @@ namespace Win64Xuid if (readBytes == 0) return false; - // Compatibility: earlier experiments may have written raw 8-byte uid.dat. + // Compatibility: earlier experiments may have written raw 8-BYTE uid.dat. if (readBytes == sizeof(uint64_t)) { uint64_t raw = 0; diff --git a/Minecraft.Client/stdafx.h b/Minecraft.Client/stdafx.h index 85ac4019..83faf1de 100644 --- a/Minecraft.Client/stdafx.h +++ b/Minecraft.Client/stdafx.h @@ -21,7 +21,7 @@ // #endif #ifdef _WINDOWS64 -#define _HAS_STD_BYTE 0 // solve (std::)'byte' ambiguity with windows headers +#define _HAS_STD_BYTE 0 // solve (std::)'BYTE' ambiguity with windows headers #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define NOMINMAX // Exclude min/max macros from Windows headers // Windows Header Files: diff --git a/Minecraft.World/AddEntityPacket.h b/Minecraft.World/AddEntityPacket.h index d40a8437..4b689de3 100644 --- a/Minecraft.World/AddEntityPacket.h +++ b/Minecraft.World/AddEntityPacket.h @@ -36,7 +36,7 @@ public: int xa, ya, za; int type; int data; - byte yRot,xRot; // 4J added + BYTE yRot,xRot; // 4J added private: void _init(shared_ptr e, int type, int data, int xp, int yp, int zp, int yRotp, int xRotp ); diff --git a/Minecraft.World/AddMobPacket.cpp b/Minecraft.World/AddMobPacket.cpp index d5ccfe08..284d0a24 100644 --- a/Minecraft.World/AddMobPacket.cpp +++ b/Minecraft.World/AddMobPacket.cpp @@ -29,7 +29,7 @@ AddMobPacket::AddMobPacket(shared_ptr mob, int yRotp, int xRotp, i { id = mob->entityId; - type = static_cast(EntityIO::getId(mob)); + type = static_cast(EntityIO::getId(mob)); // 4J Stu - We should add entities at their "last sent" position so that the relative update packets // put them in the correct place x = xp;//Mth::floor(mob->x * 32); @@ -39,9 +39,9 @@ AddMobPacket::AddMobPacket(shared_ptr mob, int yRotp, int xRotp, i yRot = yRotp; xRot = xRotp; yHeadRot = yHeadRotp; - // yRot = (byte) (mob->yRot * 256 / 360); - // xRot = (byte) (mob->xRot * 256 / 360); - // yHeadRot = (byte) (mob->yHeadRot * 256 / 360); + // yRot = (BYTE) (mob->yRot * 256 / 360); + // xRot = (BYTE) (mob->xRot * 256 / 360); + // yHeadRot = (BYTE) (mob->yHeadRot * 256 / 360); // From SetEntityMotionpacket double m = 3.9; diff --git a/Minecraft.World/AddMobPacket.h b/Minecraft.World/AddMobPacket.h index 9f7c1e1c..5aab7c4f 100644 --- a/Minecraft.World/AddMobPacket.h +++ b/Minecraft.World/AddMobPacket.h @@ -13,7 +13,7 @@ public: int type; int x, y, z; int xd, yd, zd; - byte yRot, xRot, yHeadRot; + BYTE yRot, xRot, yHeadRot; private: shared_ptr entityData; diff --git a/Minecraft.World/AddPlayerPacket.cpp b/Minecraft.World/AddPlayerPacket.cpp index fbee1fc5..fde0a06e 100644 --- a/Minecraft.World/AddPlayerPacket.cpp +++ b/Minecraft.World/AddPlayerPacket.cpp @@ -45,8 +45,8 @@ AddPlayerPacket::AddPlayerPacket(shared_ptr player, PlayerUID xuid, Play yRot = yRotp; xRot = xRotp; yHeadRot = yHeadRotp; // 4J Added - // yRot = (byte) (player->yRot * 256 / 360); - // xRot = (byte) (player->xRot * 256 / 360); + // yRot = (BYTE) (player->yRot * 256 / 360); + // xRot = (BYTE) (player->xRot * 256 / 360); //printf("%d: New add player (%f,%f,%f) : (%d,%d,%d) : xRot %d, yRot %d\n",id,player->x,player->y,player->z,x,y,z,xRot,yRot); @@ -117,7 +117,7 @@ void AddPlayerPacket::handle(PacketListener *listener) int AddPlayerPacket::getEstimatedSize() { - int iSize= sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(BYTE) + sizeof(BYTE) +sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) + sizeof(int) + sizeof(BYTE) + sizeof(unsigned int) + sizeof(byte); + int iSize= sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) + sizeof(int) + sizeof(int) + sizeof(BYTE) + sizeof(BYTE) +sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) + sizeof(int) + sizeof(BYTE) + sizeof(unsigned int) + sizeof(BYTE); if( entityData != nullptr ) { diff --git a/Minecraft.World/AddPlayerPacket.h b/Minecraft.World/AddPlayerPacket.h index af90c97d..88ceaff3 100644 --- a/Minecraft.World/AddPlayerPacket.h +++ b/Minecraft.World/AddPlayerPacket.h @@ -25,7 +25,7 @@ public: DWORD m_skinId; // 4J Added DWORD m_capeId; // 4J Added unsigned int m_uiGamePrivileges; // 4J Added - byte yHeadRot; // 4J Added + BYTE yHeadRot; // 4J Added AddPlayerPacket(); ~AddPlayerPacket(); diff --git a/Minecraft.World/Animal.cpp b/Minecraft.World/Animal.cpp index d789aa5d..1777b2f7 100644 --- a/Minecraft.World/Animal.cpp +++ b/Minecraft.World/Animal.cpp @@ -433,7 +433,7 @@ bool Animal::canMate(shared_ptr partner) return isInLove() && partner->isInLove(); } -void Animal::handleEntityEvent(byte id) +void Animal::handleEntityEvent(BYTE id) { if (id == EntityEvent::IN_LOVE_HEARTS) { diff --git a/Minecraft.World/Animal.h b/Minecraft.World/Animal.h index 100f974e..2ce0aabb 100644 --- a/Minecraft.World/Animal.h +++ b/Minecraft.World/Animal.h @@ -66,7 +66,7 @@ public: bool isInLove(); void resetLove(); virtual bool canMate(shared_ptr partner); - virtual void handleEntityEvent(byte id); + virtual void handleEntityEvent(BYTE id); // 4J added for determining whether animals are enclosed or not private: diff --git a/Minecraft.World/ArrayWithLength.h b/Minecraft.World/ArrayWithLength.h index ab491aa8..1cb2647d 100644 --- a/Minecraft.World/ArrayWithLength.h +++ b/Minecraft.World/ArrayWithLength.h @@ -84,7 +84,7 @@ class ClipChunk; typedef arrayWithLength doubleArray; typedef array2DWithLength coords2DArray; -typedef arrayWithLength byteArray; +typedef arrayWithLength byteArray; typedef arrayWithLength charArray; typedef arrayWithLength shortArray; typedef arrayWithLength intArray; diff --git a/Minecraft.World/Arrays.h b/Minecraft.World/Arrays.h index 6241a984..4583ab1d 100644 --- a/Minecraft.World/Arrays.h +++ b/Minecraft.World/Arrays.h @@ -15,9 +15,9 @@ public: static void fill(BiomeArray arr, unsigned int from, unsigned int to, Biome *value) { assert(from >=0); assert( from <= to ); assert( to <= arr.length ); std::fill( arr.data+from, arr.data+to, value ); } - static void fill(byteArray arr, unsigned int from, unsigned int to, byte value) + static void fill(byteArray arr, unsigned int from, unsigned int to, BYTE value) { assert(from >=0); assert( from <= to ); assert( to <= arr.length ); std::fill( arr.data+from, arr.data+to, value ); } - static void fill(byteArray arr, byte value) + static void fill(byteArray arr, BYTE value) { std::fill( arr.data, arr.data+arr.length, value ); } }; diff --git a/Minecraft.World/Arrow.cpp b/Minecraft.World/Arrow.cpp index ae30c057..11293cdb 100644 --- a/Minecraft.World/Arrow.cpp +++ b/Minecraft.World/Arrow.cpp @@ -123,7 +123,7 @@ Arrow::Arrow(Level *level, shared_ptr mob, float power) : Entity( void Arrow::defineSynchedData() { - entityData->define(ID_FLAGS, static_cast(0)); + entityData->define(ID_FLAGS, static_cast(0)); } @@ -463,11 +463,11 @@ void Arrow::addAdditonalSaveData(CompoundTag *tag) tag->putShort(L"xTile", static_cast(xTile)); tag->putShort(L"yTile", static_cast(yTile)); tag->putShort(L"zTile", static_cast(zTile)); - tag->putByte(L"inTile", static_cast(lastTile)); - tag->putByte(L"inData", static_cast(lastData)); - tag->putByte(L"shake", static_cast(shakeTime)); - tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); - tag->putByte(L"pickup", static_cast(pickup)); + tag->putByte(L"inTile", static_cast(lastTile)); + tag->putByte(L"inData", static_cast(lastData)); + tag->putByte(L"shake", static_cast(shakeTime)); + tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); + tag->putByte(L"pickup", static_cast(pickup)); tag->putDouble(L"damage", baseDamage); } @@ -549,19 +549,19 @@ bool Arrow::isAttackable() void Arrow::setCritArrow(bool critArrow) { - byte flags = entityData->getByte(ID_FLAGS); + BYTE flags = entityData->getByte(ID_FLAGS); if (critArrow) { - entityData->set(ID_FLAGS, static_cast(flags | FLAG_CRIT)); + entityData->set(ID_FLAGS, static_cast(flags | FLAG_CRIT)); } else { - entityData->set(ID_FLAGS, static_cast(flags & ~FLAG_CRIT)); + entityData->set(ID_FLAGS, static_cast(flags & ~FLAG_CRIT)); } } bool Arrow::isCritArrow() { - byte flags = entityData->getByte(ID_FLAGS); + BYTE flags = entityData->getByte(ID_FLAGS); return (flags & FLAG_CRIT) != 0; } diff --git a/Minecraft.World/AwardStatPacket.cpp b/Minecraft.World/AwardStatPacket.cpp index b2950a0e..62623faf 100644 --- a/Minecraft.World/AwardStatPacket.cpp +++ b/Minecraft.World/AwardStatPacket.cpp @@ -16,7 +16,7 @@ AwardStatPacket::AwardStatPacket(int statId, int count) { this->statId = statId; - this->m_paramData.data = (byte *) new int(count); + this->m_paramData.data = (BYTE *) new int(count); this->m_paramData.length = sizeof(int); } diff --git a/Minecraft.World/BasicTree.cpp b/Minecraft.World/BasicTree.cpp index fc08a5f7..54138e3b 100644 --- a/Minecraft.World/BasicTree.cpp +++ b/Minecraft.World/BasicTree.cpp @@ -3,7 +3,7 @@ #include "net.minecraft.world.level.tile.h" #include "BasicTree.h" -byte BasicTree::axisConversionArray[] = { 2, 0, 0, 1, 2, 1 }; +BYTE BasicTree::axisConversionArray[] = { 2, 0, 0, 1, 2, 1 }; BasicTree::~BasicTree() { @@ -134,7 +134,7 @@ void BasicTree::prepare() } -void BasicTree::crossection(int x, int y, int z, float radius, byte direction, int material) +void BasicTree::crossection(int x, int y, int z, float radius, BYTE direction, int material) { PIXBeginNamedEvent(0, "BasicTree crossection"); // Create a circular cross section. @@ -148,8 +148,8 @@ void BasicTree::crossection(int x, int y, int z, float radius, byte direction, i // direction is the direction the cross section is pointed, 0 for x, 1 for y, 2 for z // material is the index number for the material to use int rad = static_cast(radius + 0.618); - byte secidx1 = axisConversionArray[direction]; - byte secidx2 = axisConversionArray[direction + 3]; + BYTE secidx1 = axisConversionArray[direction]; + BYTE secidx2 = axisConversionArray[direction + 3]; int center[] = { x, y, z }; int position[] = { 0, 0, 0 }; int offset1 = -rad; @@ -234,7 +234,7 @@ void BasicTree::foliageCluster(int x, int y, int z) while (cury >= y) { radius = foliageShape(cury - y); - crossection(x, cury, z, radius, (byte) 1, Tile::leaves_Id); + crossection(x, cury, z, radius, (BYTE) 1, Tile::leaves_Id); cury--; } PIXEndNamedEvent(); @@ -248,8 +248,8 @@ void BasicTree::limb(int *start, int *end, int material) // Populate delta, the difference between start and end for all three axies. // Set primidx to the index with the largest overall distance traveled. int delta[] = { 0, 0, 0 }; - byte idx = 0; - byte primidx = 0; + BYTE idx = 0; + BYTE primidx = 0; while (idx < 3) { delta[idx] = end[idx] - start[idx]; @@ -262,8 +262,8 @@ void BasicTree::limb(int *start, int *end, int material) // If the largest distance is zero, don't bother to do anything else. if (delta[primidx] == 0) return; // set up the other two axis indices. - byte secidx1 = axisConversionArray[primidx]; - byte secidx2 = axisConversionArray[primidx + 3]; + BYTE secidx1 = axisConversionArray[primidx]; + BYTE secidx2 = axisConversionArray[primidx + 3]; // primsign is digit 1 or -1 depending on whether the limb is headed // along the positive or negative primidx axis. char primsign; @@ -389,8 +389,8 @@ int BasicTree::checkLine(int *start, int *end) // If the first block searched is lava, return 0 int delta[] = { 0, 0, 0 }; - byte idx = 0; - byte primidx = 0; + BYTE idx = 0; + BYTE primidx = 0; while (idx < 3) { delta[idx] = end[idx] - start[idx]; @@ -403,11 +403,11 @@ int BasicTree::checkLine(int *start, int *end) // If the largest distance is zero, don't bother to do anything else. if (delta[primidx] == 0) return -1; // set up the other two axis indices. - byte secidx1 = axisConversionArray[primidx]; - byte secidx2 = axisConversionArray[primidx + 3]; + BYTE secidx1 = axisConversionArray[primidx]; + BYTE secidx2 = axisConversionArray[primidx + 3]; // primsign is digit 1 or -1 depending on whether the limb is headed // along the positive or negative primidx axis. - char primsign; // 4J Stu - Was byte, but we use in a sum below and byte=unsigned char so we were setting endoffset incorrectly + char primsign; // 4J Stu - Was BYTE, but we use in a sum below and BYTE=unsigned char so we were setting endoffset incorrectly if (delta[primidx] > 0) primsign = 1; else primsign = -1; // Initilize the per-step movement for the non-primary axies. diff --git a/Minecraft.World/BasicTree.h b/Minecraft.World/BasicTree.h index feb14581..0bdc9af5 100644 --- a/Minecraft.World/BasicTree.h +++ b/Minecraft.World/BasicTree.h @@ -23,7 +23,7 @@ private: // the index for the y axis. // Using this method, the secondary axis will always be horizontal (x or z), // and the tertiary always vertical (y), if possible. - static byte axisConversionArray[]; + static BYTE axisConversionArray[]; // Set up the pseudorandom number generator Random *rnd; @@ -49,7 +49,7 @@ private: int **foliageCoords; int foliageCoordsLength; void prepare(); - void crossection(int x, int y, int z, float radius, byte direction, int material); + void crossection(int x, int y, int z, float radius, BYTE direction, int material); float treeShape(int y); float foliageShape(int y); void foliageCluster(int x, int y, int z); diff --git a/Minecraft.World/BeachBiome.cpp b/Minecraft.World/BeachBiome.cpp index 475f8468..d56fbc20 100644 --- a/Minecraft.World/BeachBiome.cpp +++ b/Minecraft.World/BeachBiome.cpp @@ -8,8 +8,8 @@ BeachBiome::BeachBiome(int id) : Biome(id) // remove default mob spawn settings friendlies.clear(); friendlies_chicken.clear(); // 4J added - topMaterial = static_cast(Tile::sand_Id); - material = static_cast(Tile::sand_Id); + topMaterial = static_cast(Tile::sand_Id); + material = static_cast(Tile::sand_Id); decorator->treeCount = -999; decorator->deadBushCount = 0; diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index 9e3bc4c5..43c83ff5 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -86,8 +86,8 @@ Biome::Biome(int id) : id(id) color = 0; // snowCovered = false; // 4J - this isn't set by the java game any more so removing to save confusion - topMaterial = static_cast(Tile::grass_Id); - material = static_cast(Tile::dirt_Id); + topMaterial = static_cast(Tile::grass_Id); + material = static_cast(Tile::dirt_Id); leafColor = 0x4EE031; _hasRain = true; depth = 0.1f; diff --git a/Minecraft.World/Biome.h b/Minecraft.World/Biome.h index f7de3166..d87bd36a 100644 --- a/Minecraft.World/Biome.h +++ b/Minecraft.World/Biome.h @@ -52,8 +52,8 @@ public: public: wstring m_name; int color; - byte topMaterial; - byte material; + BYTE topMaterial; + BYTE material; int leafColor; float depth; float scale; diff --git a/Minecraft.World/BiomeSource.cpp b/Minecraft.World/BiomeSource.cpp index 89422677..05dfd4b3 100644 --- a/Minecraft.World/BiomeSource.cpp +++ b/Minecraft.World/BiomeSource.cpp @@ -264,7 +264,7 @@ void BiomeSource::getBiomeIndexBlock(byteArray& biomeIndices, int x, int z, int intArray result = zoomedLayer->getArea(x, z, w, h); for (int i = 0; i < w * h; i++) { - biomeIndices[i] = static_cast(result[i]); + biomeIndices[i] = static_cast(result[i]); } } diff --git a/Minecraft.World/Blaze.cpp b/Minecraft.World/Blaze.cpp index ec72dfcb..86670ec1 100644 --- a/Minecraft.World/Blaze.cpp +++ b/Minecraft.World/Blaze.cpp @@ -42,7 +42,7 @@ void Blaze::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_FLAGS_ID, static_cast(0)); + entityData->define(DATA_FLAGS_ID, static_cast(0)); } int Blaze::getAmbientSound() @@ -207,7 +207,7 @@ bool Blaze::isCharged() void Blaze::setCharged(bool value) { - byte flags = entityData->getByte(DATA_FLAGS_ID); + BYTE flags = entityData->getByte(DATA_FLAGS_ID); if (value) { flags |= 0x1; diff --git a/Minecraft.World/BlockRegionUpdatePacket.cpp b/Minecraft.World/BlockRegionUpdatePacket.cpp index b91cf4f8..09a7938c 100644 --- a/Minecraft.World/BlockRegionUpdatePacket.cpp +++ b/Minecraft.World/BlockRegionUpdatePacket.cpp @@ -12,7 +12,7 @@ #define BLOCK_REGION_UPDATE_FULLCHUNK 0x01 -#define BLOCK_REGION_UPDATE_ZEROHEIGHT 0x02 // added so we can still send a byte for ys, which really needs the range 0-256 +#define BLOCK_REGION_UPDATE_ZEROHEIGHT 0x02 // added so we can still send a BYTE for ys, which really needs the range 0-256 BlockRegionUpdatePacket::~BlockRegionUpdatePacket() { @@ -89,7 +89,7 @@ BlockRegionUpdatePacket::BlockRegionUpdatePacket(int x, int y, int z, int xs, in void BlockRegionUpdatePacket::read(DataInputStream *dis) //throws IOException { - byte chunkFlags = dis->readByte(); + BYTE chunkFlags = dis->readByte(); x = dis->readInt(); y = dis->readShort(); z = dis->readInt(); @@ -154,7 +154,7 @@ void BlockRegionUpdatePacket::read(DataInputStream *dis) //throws IOException void BlockRegionUpdatePacket::write(DataOutputStream *dos) // throws IOException { - byte chunkFlags = 0; + BYTE chunkFlags = 0; if(bIsFullChunk) chunkFlags |= BLOCK_REGION_UPDATE_FULLCHUNK; if(ys == 0) chunkFlags |= BLOCK_REGION_UPDATE_ZEROHEIGHT; diff --git a/Minecraft.World/BlockReplacements.cpp b/Minecraft.World/BlockReplacements.cpp index f60d9e2a..3fb6a1a9 100644 --- a/Minecraft.World/BlockReplacements.cpp +++ b/Minecraft.World/BlockReplacements.cpp @@ -8,7 +8,7 @@ void BlockReplacements::staticCtor() { for (int i = 0; i < 256; i++) { - byte b = static_cast(i); + BYTE b = static_cast(i); if (b != 0 && Tile::tiles[b & 0xff] == nullptr) { b = 0; diff --git a/Minecraft.World/BrewingStandTileEntity.cpp b/Minecraft.World/BrewingStandTileEntity.cpp index 3d081bae..d84f9bb5 100644 --- a/Minecraft.World/BrewingStandTileEntity.cpp +++ b/Minecraft.World/BrewingStandTileEntity.cpp @@ -330,7 +330,7 @@ void BrewingStandTileEntity::save(CompoundTag *base) if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } diff --git a/Minecraft.World/BufferedOutputStream.cpp b/Minecraft.World/BufferedOutputStream.cpp index 4f9edbf6..cdfc2c89 100644 --- a/Minecraft.World/BufferedOutputStream.cpp +++ b/Minecraft.World/BufferedOutputStream.cpp @@ -34,7 +34,7 @@ void BufferedOutputStream::close() stream->close(); } -//Writes len bytes from the specified byte array starting at offset off to this buffered output stream. +//Writes len bytes from the specified BYTE array starting at offset off to this buffered output stream. //Ordinarily this method stores bytes from the given array into this stream's buffer, flushing the buffer to the //underlying output stream as needed. If the requested length is at least as large as this stream's buffer, however, //then this method will flush the buffer and write the bytes directly to the underlying output stream. @@ -72,14 +72,14 @@ void BufferedOutputStream::write(byteArray b) write( b, 0, b.length ); } -//Writes the specified byte to this buffered output stream. +//Writes the specified BYTE to this buffered output stream. //Overrides: //write in class FilterOutputStream //Parameters: -//b - the byte to be written. +//b - the BYTE to be written. void BufferedOutputStream::write(unsigned int b) { - buf[count++] = static_cast(b); + buf[count++] = static_cast(b); if( count == buf.length ) { flush(); diff --git a/Minecraft.World/ByteArrayInputStream.cpp b/Minecraft.World/ByteArrayInputStream.cpp index 29f6fc26..a08171f3 100644 --- a/Minecraft.World/ByteArrayInputStream.cpp +++ b/Minecraft.World/ByteArrayInputStream.cpp @@ -7,7 +7,7 @@ // The buffer's mark is set to the specified offset. // Parameters: // buf - the input buffer. -// offset - the offset in the buffer of the first byte to read. +// offset - the offset in the buffer of the first BYTE to read. // length - the maximum number of bytes to read from the buffer. ByteArrayInputStream::ByteArrayInputStream(byteArray buf, unsigned int offset, unsigned int length) : pos(offset), mark(offset) @@ -37,11 +37,11 @@ ByteArrayInputStream::ByteArrayInputStream(byteArray buf) this->buf = buf; } -// Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. -// If no byte is available because the end of the stream has been reached, the value -1 is returned. +// Reads the next BYTE of data from this input stream. The value BYTE is returned as an int in the range 0 to 255. +// If no BYTE is available because the end of the stream has been reached, the value -1 is returned. // This read method cannot block. // Returns: -// the next byte of data, or -1 if the end of the stream has been reached. +// the next BYTE of data, or -1 if the end of the stream has been reached. int ByteArrayInputStream::read() { if (pos >= count) @@ -57,11 +57,11 @@ int ByteArrayInputStream::read() // Reads some number of bytes from the input stream and stores them into the buffer array b. // The number of bytes actually read is returned as an integer. This method blocks until input data is available, // end of file is detected, or an exception is thrown. -// If the length of b is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. -// If no byte is available because the stream is at the end of the file, the value -1 is returned; otherwise, -// at least one byte is read and stored into b. +// If the length of b is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one BYTE. +// If no BYTE is available because the stream is at the end of the file, the value -1 is returned; otherwise, +// at least one BYTE is read and stored into b. // -// The first byte read is stored into element b[0], the next one into b[1], and so on. The number of bytes read is, +// The first BYTE read is stored into element b[0], the next one into b[1], and so on. The number of bytes read is, // at most, equal to the length of b. Let k be the number of bytes actually read; these bytes will be stored in elements b[0] through b[k-1], // leaving elements b[k] through b[b.length-1] unaffected. // diff --git a/Minecraft.World/ByteArrayOutputStream.cpp b/Minecraft.World/ByteArrayOutputStream.cpp index 9173941f..5c9c41de 100644 --- a/Minecraft.World/ByteArrayOutputStream.cpp +++ b/Minecraft.World/ByteArrayOutputStream.cpp @@ -2,14 +2,14 @@ #include "ByteArrayOutputStream.h" -// Creates a new byte array output stream. The buffer capacity is initially 32 bytes, though its size increases if necessary. +// Creates a new BYTE array output stream. The buffer capacity is initially 32 bytes, though its size increases if necessary. ByteArrayOutputStream::ByteArrayOutputStream() { count = 0; buf = byteArray(32); } -// Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes. +// Creates a new BYTE array output stream, with a buffer capacity of the specified size, in bytes. // Parameters: // size - the initial size. ByteArrayOutputStream::ByteArrayOutputStream(unsigned int size) @@ -26,9 +26,9 @@ ByteArrayOutputStream::~ByteArrayOutputStream() } } -// Writes the specified byte to this byte array output stream. +// Writes the specified BYTE to this BYTE array output stream. // Parameters: -// b - the byte to be written. +// b - the BYTE to be written. void ByteArrayOutputStream::write(unsigned int b) { // If we will fill the buffer we need to make it bigger @@ -37,18 +37,18 @@ void ByteArrayOutputStream::write(unsigned int b) buf.resize(buf.length * 2); } - buf[count] = (byte)b; + buf[count] = (BYTE)b; count++; } -// Writes b.length bytes from the specified byte array to this output stream. +// Writes b.length bytes from the specified BYTE array to this output stream. // The general contract for write(b) is that it should have exactly the same effect as the call write(b, 0, b.length). void ByteArrayOutputStream::write(byteArray b) { write(b, 0, b.length); } -// Writes len bytes from the specified byte array starting at offset off to this byte array output stream. +// Writes len bytes from the specified BYTE array starting at offset off to this BYTE array output stream. // Parameters: // b - the data. // off - the start offset in the data. @@ -88,9 +88,9 @@ void ByteArrayOutputStream::close() { } -// Creates a newly allocated byte array. Its size is the current size of this output stream and the valid contents of the buffer have been copied into it. +// Creates a newly allocated BYTE array. Its size is the current size of this output stream and the valid contents of the buffer have been copied into it. // Returns: -// the current contents of this output stream, as a byte array. +// the current contents of this output stream, as a BYTE array. byteArray ByteArrayOutputStream::toByteArray() { byteArray out(count); diff --git a/Minecraft.World/ByteArrayTag.h b/Minecraft.World/ByteArrayTag.h index 4d53c63e..b134c53f 100644 --- a/Minecraft.World/ByteArrayTag.h +++ b/Minecraft.World/ByteArrayTag.h @@ -28,7 +28,7 @@ public: dis->readFully(data); } - byte getId() { return TAG_Byte_Array; } + BYTE getId() { return TAG_Byte_Array; } wstring toString() { diff --git a/Minecraft.World/ByteBuffer.cpp b/Minecraft.World/ByteBuffer.cpp index 57b30dbd..a934804a 100644 --- a/Minecraft.World/ByteBuffer.cpp +++ b/Minecraft.World/ByteBuffer.cpp @@ -7,25 +7,25 @@ ByteBuffer::ByteBuffer( unsigned int capacity ) : Buffer( capacity ) { hasBackingArray = false; - buffer = new byte[capacity]; - memset( buffer,0,sizeof(byte)*capacity); + buffer = new BYTE[capacity]; + memset( buffer,0,sizeof(BYTE)*capacity); byteOrder = BIGENDIAN; } -//Allocates a new direct byte buffer. +//Allocates a new direct BYTE buffer. //The new buffer's position will be zero, its limit will be its capacity, and its mark will be undefined. Whether or not it has a backing array is unspecified. // //Parameters: //capacity - The new buffer's capacity, in bytes //Returns: -//The new byte buffer +//The new BYTE buffer ByteBuffer *ByteBuffer::allocateDirect(int capacity) { return new ByteBuffer(capacity); } -ByteBuffer::ByteBuffer( unsigned int capacity, byte *backingArray ) : Buffer( capacity ) +ByteBuffer::ByteBuffer( unsigned int capacity, BYTE *backingArray ) : Buffer( capacity ) { hasBackingArray = true; buffer = backingArray; @@ -37,36 +37,36 @@ ByteBuffer::~ByteBuffer() delete[] buffer; } -//Wraps a byte array into a buffer. -//The new buffer will be backed by the given byte array; that is, modifications to the buffer will cause the array +//Wraps a BYTE array into a buffer. +//The new buffer will be backed by the given BYTE array; that is, modifications to the buffer will cause the array //to be modified and vice versa. The new buffer's capacity and limit will be array.length, its position will be zero, //and its mark will be undefined. Its backing array will be the given array, and its array offset will be zero. // //Parameters: //array - The array that will back this buffer //Returns: -//The new byte buffer +//The new BYTE buffer ByteBuffer *ByteBuffer::wrap(byteArray &b) { return new ByteBuffer( b.length, b.data ); } -//Allocates a new byte buffer. +//Allocates a new BYTE buffer. //The new buffer's position will be zero, its limit will be its capacity, and its mark will be undefined. //It will have a backing array, and its array offset will be zero. // //Parameters: //capacity - The new buffer's capacity, in bytes //Returns: -//The new byte buffer +//The new BYTE buffer ByteBuffer *ByteBuffer::allocate(unsigned int capacity) { return new ByteBuffer( capacity ); } -//Modifies this buffer's byte order. +//Modifies this buffer's BYTE order. //Parameters: -//bo - The new byte order, either BIGENDIAN or LITTLEENDIAN +//bo - The new BYTE order, either BIGENDIAN or LITTLEENDIAN void ByteBuffer::order(ByteOrder bo) { byteOrder = bo; @@ -85,7 +85,7 @@ ByteBuffer *ByteBuffer::flip() } // 4J Added so we can write this to a file -byte *ByteBuffer::getBuffer() +BYTE *ByteBuffer::getBuffer() { return buffer; } @@ -97,11 +97,11 @@ int ByteBuffer::getSize() } // End 4J -//Absolute get method. Reads the byte at the given index. +//Absolute get method. Reads the BYTE at the given index. //Parameters: -//index - The index from which the byte will be read +//index - The index from which the BYTE will be read //Returns: -//The byte at the given index +//The BYTE at the given index //Throws: //IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit BYTE ByteBuffer::get(int index) @@ -114,7 +114,7 @@ BYTE ByteBuffer::get(int index) //Relative get method for reading an int value. //Reads the next four bytes at this buffer's current position, composing them into an int value according to the -//current byte order, and then increments the position by four. +//current BYTE order, and then increments the position by four. // //Returns: //The int value at the buffer's current position @@ -143,7 +143,7 @@ int ByteBuffer::getInt() } //Absolute get method for reading an int value. -//Reads four bytes at the given index, composing them into a int value according to the current byte order. +//Reads four bytes at the given index, composing them into a int value according to the current BYTE order. // //Parameters: //index - The index from which the bytes will be read @@ -171,7 +171,7 @@ int ByteBuffer::getInt(unsigned int index) } //Relative get method for reading a long value. -//Reads the next eight bytes at this buffer's current position, composing them into a long value according to the current byte order, +//Reads the next eight bytes at this buffer's current position, composing them into a long value according to the current BYTE order, //and then increments the position by eight. // //Returns: @@ -206,7 +206,7 @@ int64_t ByteBuffer::getLong() //Relative get method for reading a short value. //Reads the next two bytes at this buffer's current position, composing them into a short value according to the current -//byte order, and then increments the position by two. +//BYTE order, and then increments the position by two. // //Returns: //The short value at the buffer's current position @@ -243,17 +243,17 @@ void ByteBuffer::getShortArray(shortArray &s) } //Absolute put method (optional operation). -//Writes the given byte into this buffer at the given index. +//Writes the given BYTE into this buffer at the given index. // //Parameters: -//index - The index at which the byte will be written -//b - The byte value to be written +//index - The index at which the BYTE will be written +//b - The BYTE value to be written //Returns: //This buffer //Throws: //IndexOutOfBoundsException - If index is negative or not smaller than the buffer's limit //ReadOnlyBufferException - If this buffer is read-only -ByteBuffer *ByteBuffer::put(int index, byte b) +ByteBuffer *ByteBuffer::put(int index, BYTE b) { assert( index < m_limit ); assert( index >= 0 ); @@ -264,7 +264,7 @@ ByteBuffer *ByteBuffer::put(int index, byte b) //Relative put method for writing an int value (optional operation). -//Writes four bytes containing the given int value, in the current byte order, into this buffer at the current position, +//Writes four bytes containing the given int value, in the current BYTE order, into this buffer at the current position, //and then increments the position by four. // //Parameters: @@ -296,7 +296,7 @@ ByteBuffer *ByteBuffer::putInt(int value) } //Absolute put method for writing an int value (optional operation). -//Writes four bytes containing the given int value, in the current byte order, into this buffer at the given index. +//Writes four bytes containing the given int value, in the current BYTE order, into this buffer at the given index. // //Parameters: //index - The index at which the bytes will be written @@ -326,7 +326,7 @@ ByteBuffer *ByteBuffer::putInt(unsigned int index, int value) } //Relative put method for writing a short value (optional operation). -//Writes two bytes containing the given short value, in the current byte order, into this buffer at the current position, +//Writes two bytes containing the given short value, in the current BYTE order, into this buffer at the current position, //and then increments the position by two. // //Parameters: @@ -366,7 +366,7 @@ ByteBuffer *ByteBuffer::putShortArray(shortArray &s) } //Relative put method for writing a long value (optional operation). -//Writes eight bytes containing the given long value, in the current byte order, into this buffer at the current position, +//Writes eight bytes containing the given long value, in the current BYTE order, into this buffer at the current position, //and then increments the position by eight. // //Parameters: @@ -404,7 +404,7 @@ ByteBuffer *ByteBuffer::putLong(int64_t value) } //Relative bulk put method (optional operation). -//This method transfers the entire content of the given source byte array into this buffer. +//This method transfers the entire content of the given source BYTE array into this buffer. //An invocation of this method of the form dst.put(a) behaves in exactly the same way as the invocation // // dst.put(a, 0, a.length) @@ -427,7 +427,7 @@ byteArray ByteBuffer::array() return byteArray( buffer, m_capacity ); } -//Creates a view of this byte buffer as an int buffer. +//Creates a view of this BYTE buffer as an int buffer. //The content of the new buffer will start at this buffer's current position. Changes to this buffer's content //will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent. // @@ -439,11 +439,11 @@ byteArray ByteBuffer::array() //A new int buffer IntBuffer *ByteBuffer::asIntBuffer() { - // TODO 4J Stu - Is it safe to just cast our byte array pointer to another type? + // TODO 4J Stu - Is it safe to just cast our BYTE array pointer to another type? return new IntBuffer( (m_limit-m_position)/4, (int *) (buffer+m_position) ); } -//Creates a view of this byte buffer as a float buffer. +//Creates a view of this BYTE buffer as a float buffer. //The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be //visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent. // @@ -455,7 +455,7 @@ IntBuffer *ByteBuffer::asIntBuffer() //A new float buffer FloatBuffer *ByteBuffer::asFloatBuffer() { - // TODO 4J Stu - Is it safe to just cast our byte array pointer to another type? + // TODO 4J Stu - Is it safe to just cast our BYTE array pointer to another type? return new FloatBuffer( (m_limit-m_position)/4, (float *) (buffer+m_position) ); } @@ -464,9 +464,9 @@ FloatBuffer *ByteBuffer::asFloatBuffer() #ifdef __PS3__ // we're using the RSX now to upload textures to vram, so we need th main ram textures allocated from io space ByteBuffer_IO::ByteBuffer_IO( unsigned int capacity ) - : ByteBuffer(capacity, (byte*)RenderManager.allocIOMem(capacity, 64)) + : ByteBuffer(capacity, (BYTE*)RenderManager.allocIOMem(capacity, 64)) { - memset( buffer,0,sizeof(byte)*capacity); + memset( buffer,0,sizeof(BYTE)*capacity); byteOrder = BIGENDIAN; } diff --git a/Minecraft.World/ByteBuffer.h b/Minecraft.World/ByteBuffer.h index 56ac0b96..9947aba9 100644 --- a/Minecraft.World/ByteBuffer.h +++ b/Minecraft.World/ByteBuffer.h @@ -9,29 +9,29 @@ class FloatBuffer; class ByteBuffer : public Buffer { protected: - byte *buffer; + BYTE *buffer; ByteOrder byteOrder; public: ByteBuffer(unsigned int capacity); static ByteBuffer *allocateDirect(int capacity); - ByteBuffer( unsigned int capacity, byte *backingArray ); + ByteBuffer( unsigned int capacity, BYTE *backingArray ); virtual ~ByteBuffer(); static ByteBuffer *wrap(byteArray &b); static ByteBuffer *allocate(unsigned int capacity); void order(ByteOrder a); ByteBuffer *flip(); - byte *getBuffer(); + BYTE *getBuffer(); int getSize(); int getInt(); int getInt(unsigned int index); void get(byteArray) {} // 4J - TODO - byte get(int index); + BYTE get(int index); int64_t getLong(); short getShort(); void getShortArray(shortArray &s); - ByteBuffer *put(int index, byte b); + ByteBuffer *put(int index, BYTE b); ByteBuffer *putInt(int value); ByteBuffer *putInt(unsigned int index, int value); ByteBuffer *putShort(short value); diff --git a/Minecraft.World/ByteTag.h b/Minecraft.World/ByteTag.h index ef236472..372ff131 100644 --- a/Minecraft.World/ByteTag.h +++ b/Minecraft.World/ByteTag.h @@ -4,14 +4,14 @@ class ByteTag : public Tag { public: - byte data; + BYTE data; ByteTag(const wstring &name) : Tag(name) {} - ByteTag(const wstring &name, byte data) : Tag(name) {this->data = data; } + ByteTag(const wstring &name, BYTE data) : Tag(name) {this->data = data; } void write(DataOutput *dos) { dos->writeByte(data); } void load(DataInput *dis, int tagDepth) { data = dis->readByte(); } - byte getId() { return TAG_Byte; } + BYTE getId() { return TAG_Byte; } wstring toString() { static wchar_t buf[32]; diff --git a/Minecraft.World/CanyonFeature.cpp b/Minecraft.World/CanyonFeature.cpp index d25def53..54f357b7 100644 --- a/Minecraft.World/CanyonFeature.cpp +++ b/Minecraft.World/CanyonFeature.cpp @@ -141,12 +141,12 @@ void CanyonFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArray bloc { if (yy < 10) { - blocks[p] = static_cast(Tile::lava_Id); + blocks[p] = static_cast(Tile::lava_Id); } else { - blocks[p] = static_cast(0); - if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = (byte) level->getBiome(xx + xOffs * 16, zz + zOffs * 16)->topMaterial; + blocks[p] = static_cast(0); + if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = (BYTE) level->getBiome(xx + xOffs * 16, zz + zOffs * 16)->topMaterial; } } } diff --git a/Minecraft.World/ChestTileEntity.cpp b/Minecraft.World/ChestTileEntity.cpp index ba277e24..a33ddc30 100644 --- a/Minecraft.World/ChestTileEntity.cpp +++ b/Minecraft.World/ChestTileEntity.cpp @@ -157,7 +157,7 @@ void ChestTileEntity::save(CompoundTag *base) if (items->data[i] != nullptr) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", static_cast(i)); items->data[i]->save(tag); listTag->add(tag); } diff --git a/Minecraft.World/ChunkTilesUpdatePacket.cpp b/Minecraft.World/ChunkTilesUpdatePacket.cpp index de5abea1..b04fa57d 100644 --- a/Minecraft.World/ChunkTilesUpdatePacket.cpp +++ b/Minecraft.World/ChunkTilesUpdatePacket.cpp @@ -24,7 +24,7 @@ ChunkTilesUpdatePacket::ChunkTilesUpdatePacket() count = 0; } -ChunkTilesUpdatePacket::ChunkTilesUpdatePacket(int xc, int zc, shortArray positions, byte count, Level *level) +ChunkTilesUpdatePacket::ChunkTilesUpdatePacket(int xc, int zc, shortArray positions, BYTE count, Level *level) { shouldDelay = true; this->xc = xc; @@ -42,8 +42,8 @@ ChunkTilesUpdatePacket::ChunkTilesUpdatePacket(int xc, int zc, shortArray positi int y = (positions[i]) & 255; this->positions[i] = positions[i]; - blocks[i] = static_cast(levelChunk->getTile(x, y, z)); - data[i] = static_cast(levelChunk->getData(x, y, z)); + blocks[i] = static_cast(levelChunk->getTile(x, y, z)); + data[i] = static_cast(levelChunk->getData(x, y, z)); } levelIdx = ( ( level->dimension->id == 0 ) ? 0 : ( (level->dimension->id == -1) ? 1 : 2 ) ); } diff --git a/Minecraft.World/ChunkTilesUpdatePacket.h b/Minecraft.World/ChunkTilesUpdatePacket.h index 7cbc3c65..45cf607f 100644 --- a/Minecraft.World/ChunkTilesUpdatePacket.h +++ b/Minecraft.World/ChunkTilesUpdatePacket.h @@ -12,12 +12,12 @@ public: shortArray positions; byteArray blocks; byteArray data; - byte count; // 4J Was int but never has a value higher than 10 + BYTE count; // 4J Was int but never has a value higher than 10 int levelIdx; ChunkTilesUpdatePacket(); ~ChunkTilesUpdatePacket(); - ChunkTilesUpdatePacket(int xc, int zc, shortArray positions, byte count, Level *level); + ChunkTilesUpdatePacket(int xc, int zc, shortArray positions, BYTE count, Level *level); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); diff --git a/Minecraft.World/ComplexItemDataPacket.cpp b/Minecraft.World/ComplexItemDataPacket.cpp index 98eeb9de..767d1e98 100644 --- a/Minecraft.World/ComplexItemDataPacket.cpp +++ b/Minecraft.World/ComplexItemDataPacket.cpp @@ -47,7 +47,7 @@ void ComplexItemDataPacket::write(DataOutputStream *dos) //throws IOException dos->writeShort(itemId); dos->writeUnsignedShort(data.length); - byteArray ba( (byte*)data.data, data.length ); + byteArray ba( (BYTE*)data.data, data.length ); dos->write(ba); } diff --git a/Minecraft.World/CompoundTag.h b/Minecraft.World/CompoundTag.h index 8f4d045d..7aecb9aa 100644 --- a/Minecraft.World/CompoundTag.h +++ b/Minecraft.World/CompoundTag.h @@ -67,7 +67,7 @@ public: return ret; } - byte getId() + BYTE getId() { return TAG_Compound; } @@ -77,7 +77,7 @@ public: tags[name] = tag->setName(name); } - void putByte(const wstring &name, byte value) + void putByte(const wstring &name, BYTE value) { tags[name] = (new ByteTag(name,value)); } @@ -129,7 +129,7 @@ public: void putBoolean(const wstring &name, bool val) { - putByte(name, val?static_cast(1):0); + putByte(name, val?static_cast(1):0); } Tag *get(const wstring &name) @@ -144,9 +144,9 @@ public: return tags.find(name) != tags.end(); } - byte getByte(const wstring &name) + BYTE getByte(const wstring &name) { - if (tags.find(name) == tags.end()) return (byte)0; + if (tags.find(name) == tags.end()) return (BYTE)0; return static_cast(tags[name])->data; } diff --git a/Minecraft.World/CompressedTileStorage.cpp b/Minecraft.World/CompressedTileStorage.cpp index b093f804..cd966cd7 100644 --- a/Minecraft.World/CompressedTileStorage.cpp +++ b/Minecraft.World/CompressedTileStorage.cpp @@ -143,7 +143,7 @@ CompressedTileStorage::CompressedTileStorage(bool isEmpty) #endif } -bool CompressedTileStorage::isRenderChunkEmpty(int y) // y == 0, 16, 32... 112 (representing a 16 byte range) +bool CompressedTileStorage::isRenderChunkEmpty(int y) // y == 0, 16, 32... 112 (representing a 16 BYTE range) { int block; unsigned char *localIndicesAndData = indicesAndData; @@ -170,7 +170,7 @@ bool CompressedTileStorage::isSameAs(CompressedTileStorage *other) return false; } - // Attempt to compare as much as we can in 64-byte chunks (8 groups of 8 bytes) + // Attempt to compare as much as we can in 64-BYTE chunks (8 groups of 8 bytes) int quickCount = allocatedSize / 64; int64_t *pOld = (int64_t *)indicesAndData; int64_t *pNew = (int64_t *)other->indicesAndData; @@ -199,7 +199,7 @@ bool CompressedTileStorage::isSameAs(CompressedTileStorage *other) pNew += 8; } - // Now test anything remaining just byte at a time + // Now test anything remaining just BYTE at a time unsigned char *pucOld = (unsigned char *)pOld; unsigned char *pucNew = (unsigned char *)pNew; for( int i = 0; i < allocatedSize - (quickCount * 64); i++ ) @@ -378,7 +378,7 @@ void CompressedTileStorage::setData(byteArray dataIn, unsigned int inOffset) else { _blockIndices[i] = INDEX_TYPE_0_OR_8_BIT; - memToAlloc = ( memToAlloc + 3 ) & 0xfffc; // Make sure we are 4-byte aligned for 8-bit storage + memToAlloc = ( memToAlloc + 3 ) & 0xfffc; // Make sure we are 4-BYTE aligned for 8-bit storage memToAlloc += 64; // type8++; } @@ -1005,7 +1005,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) else { _blockIndices[i] = INDEX_TYPE_0_OR_8_BIT; - memToAlloc = ( memToAlloc + 3 ) & 0xfffc; // Make sure we are 4-byte aligned for 8-bit storage + memToAlloc = ( memToAlloc + 3 ) & 0xfffc; // Make sure we are 4-BYTE aligned for 8-bit storage memToAlloc += 64; } } @@ -1046,7 +1046,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) memToAlloc += 48; break; case INDEX_TYPE_0_OR_8_BIT: - memToAlloc = ( memToAlloc + 3 ) & 0xfffc; // Make sure we are 4-byte aligned for 8-bit storage + memToAlloc = ( memToAlloc + 3 ) & 0xfffc; // Make sure we are 4-BYTE aligned for 8-bit storage memToAlloc += 64; break; // Note that INDEX_TYPE_8_BIT|INDEX_TYPE_0_BIT_FLAG not in here as it doesn't need any further allocation @@ -1178,7 +1178,7 @@ void CompressedTileStorage::compress(int upgradeBlock/*=-1*/) } else { - usDataOffset = (usDataOffset + 3 ) & 0xfffc; // Make sure offset is 4 byte aligned + usDataOffset = (usDataOffset + 3 ) & 0xfffc; // Make sure offset is 4 BYTE aligned XMemCpy( pucData + usDataOffset, unpacked_data, 64 ); newIndices[i] |= ( usDataOffset & INDEX_OFFSET_MASK) << INDEX_OFFSET_SHIFT; usDataOffset += 64; diff --git a/Minecraft.World/CompressedTileStorage.h b/Minecraft.World/CompressedTileStorage.h index 3d433547..38c01ea1 100644 --- a/Minecraft.World/CompressedTileStorage.h +++ b/Minecraft.World/CompressedTileStorage.h @@ -25,8 +25,8 @@ // Some notes on the logic of all of this... // (1) Large numbers of blocks in the world really don't need to be stored at a full 8 bits per tile. // In a worst-case scenario, all planes would be 256 bytes and we'd have to store offsets of up to 32704 ( 64 x 511). This would require 15 bits per offset to store, but since in all cases -// the data can be stored with a 2 byte alignment, we can store offsets divided by 2, freeing up 2 bits to store the type of index for each plane. This allows us to encode 4 types, but we really have -// 5 types (0, 1, 2, 4 or 8 bits per tile). Since the 8-bit per tile planes are likely to be very rare, we can free up an extra bit in those by making their offset 4-byte aligned, and +// the data can be stored with a 2 BYTE alignment, we can store offsets divided by 2, freeing up 2 bits to store the type of index for each plane. This allows us to encode 4 types, but we really have +// 5 types (0, 1, 2, 4 or 8 bits per tile). Since the 8-bit per tile planes are likely to be very rare, we can free up an extra bit in those by making their offset 4-BYTE aligned, and // then use the extra bit to determine whether its a 0 or 8-bit per tile index. In the 0 bit case, we can use the bits used for the offset to store the actual tile value represented throughout the plane. // (2) The compression is done per 4x4x4 block rather than planes like the lighting, as that gives many more regions that have a small number of tile types than per plane, and can therefore // be compressed using less bits per tile. This is at the expense of a larger index, and more overhead from storing the tile types in each block (since there are more blocks than planes). However diff --git a/Minecraft.World/ConsoleSaveFileConverter.cpp b/Minecraft.World/ConsoleSaveFileConverter.cpp index f7d8d0ee..0c8b6658 100644 --- a/Minecraft.World/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/ConsoleSaveFileConverter.cpp @@ -10,7 +10,7 @@ void ConsoleSaveFileConverter::ProcessSimpleFile(ConsoleSaveFile *sourceSave, Fi DWORD numberOfBytesRead = 0; DWORD numberOfBytesWritten = 0; - byte *data = new byte[sourceFileEntry->getFileSize()]; + BYTE *data = new BYTE[sourceFileEntry->getFileSize()]; // Read from source sourceSave->readFile(sourceFileEntry, data, sourceFileEntry->getFileSize(), &numberOfBytesRead); diff --git a/Minecraft.World/ConsoleSaveFileInputStream.cpp b/Minecraft.World/ConsoleSaveFileInputStream.cpp index db997918..ab8322d5 100644 --- a/Minecraft.World/ConsoleSaveFileInputStream.cpp +++ b/Minecraft.World/ConsoleSaveFileInputStream.cpp @@ -20,12 +20,12 @@ ConsoleSaveFileInputStream::ConsoleSaveFileInputStream(ConsoleSaveFile *saveFile m_saveFile->setFilePointer( m_file, 0, nullptr, FILE_BEGIN ); } -//Reads a byte of data from this input stream. This method blocks if no input is yet available. +//Reads a BYTE of data from this input stream. This method blocks if no input is yet available. //Returns: -//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() { - byte byteRead = 0; + BYTE byteRead = 0; DWORD numberOfBytesRead; BOOL result = m_saveFile->readFile( diff --git a/Minecraft.World/ConsoleSaveFileOriginal.cpp b/Minecraft.World/ConsoleSaveFileOriginal.cpp index 42a65e03..122d11c5 100644 --- a/Minecraft.World/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/ConsoleSaveFileOriginal.cpp @@ -172,7 +172,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const wstring &fileName, LPVOID Compression::getCompression()->SetDecompressionType(SAVE_FILE_PLATFORM_LOCAL); // and then set the decompression back to the local machine's standard type } - // Only ReAlloc if we need to (we might already have enough) and align to 512 byte boundaries + // Only ReAlloc if we need to (we might already have enough) and align to 512 BYTE boundaries DWORD currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; DWORD desiredSize = decompSize; @@ -249,7 +249,7 @@ void ConsoleSaveFileOriginal::deleteFile( FileEntry *file ) const int bufferSize = 4096; int amountToRead = bufferSize; - byte buffer[bufferSize]; + BYTE buffer[bufferSize]; DWORD bufferDataSize = 0; @@ -497,12 +497,12 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt const DWORD bufferSize = 4096; DWORD amountToRead = bufferSize; //assert( nNumberOfBytesToWrite <= bufferSize ); - static byte buffer1[bufferSize]; - static byte buffer2[bufferSize]; + static BYTE buffer1[bufferSize]; + static BYTE buffer2[bufferSize]; DWORD buffer1Size = 0; DWORD buffer2Size = 0; - // Only ReAlloc if we need to (we might already have enough) and align to 512 byte boundaries + // Only ReAlloc if we need to (we might already have enough) and align to 512 BYTE boundaries DWORD currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; DWORD desiredSize = header.GetFileSize() + nNumberOfBytesToWrite; @@ -551,7 +551,7 @@ void ConsoleSaveFileOriginal::MoveDataBeyond(FileEntry *file, DWORD nNumberOfByt uintptr_t uiFromStart = (uintptr_t)spaceStartOffset; uintptr_t uiFromEnd = (uintptr_t)beginEndOfDataOffset; - // Round both of these values to get 4096 byte chunks that we will need to at least partially move + // Round both of these values to get 4096 BYTE chunks that we will need to at least partially move uintptr_t uiFromStartChunk = uiFromStart & ~static_cast(4095); uintptr_t uiFromEndChunk = (uiFromEnd - 1 ) & ~static_cast(4095); @@ -689,11 +689,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 // directly from the save data. StorageManager.SetSaveData(pvSaveMem,fileSize); - byte *compData = (byte *)pvSaveMem; + BYTE *compData = (BYTE *)pvSaveMem; #else // Attempt to allocate the required memory // We do not own this, it belongs to the StorageManager - byte *compData = static_cast(StorageManager.AllocateSaveData(compLength)); + BYTE *compData = static_cast(StorageManager.AllocateSaveData(compLength)); #ifdef __PSVITA__ // AP - make sure we always allocate just what is needed so it will only SAVE what is needed. @@ -731,7 +731,7 @@ void ConsoleSaveFileOriginal::Flush(bool autosave, bool updateThumbnail ) compLength = compLength+8; // Attempt to allocate the required memory - compData = static_cast(StorageManager.AllocateSaveData(compLength)); + compData = static_cast(StorageManager.AllocateSaveData(compLength)); } #endif diff --git a/Minecraft.World/ConsoleSaveFileOutputStream.cpp b/Minecraft.World/ConsoleSaveFileOutputStream.cpp index 8d05ee60..27768259 100644 --- a/Minecraft.World/ConsoleSaveFileOutputStream.cpp +++ b/Minecraft.World/ConsoleSaveFileOutputStream.cpp @@ -31,14 +31,14 @@ ConsoleSaveFileOutputStream::ConsoleSaveFileOutputStream(ConsoleSaveFile *saveFi m_saveFile->setFilePointer( m_file, 0, nullptr, FILE_BEGIN ); } -//Writes the specified byte to this file output stream. Implements the write method of OutputStream. +//Writes the specified BYTE to this file output stream. Implements the write method of OutputStream. //Parameters: -//b - the byte to be written. +//b - the BYTE to be written. void ConsoleSaveFileOutputStream::write(unsigned int b) { DWORD numberOfBytesWritten; - byte value = static_cast(b); + BYTE value = static_cast(b); BOOL result = m_saveFile->writeFile( m_file, @@ -57,7 +57,7 @@ void ConsoleSaveFileOutputStream::write(unsigned int b) } } -//Writes b.length bytes from the specified byte array to this file output stream. +//Writes b.length bytes from the specified BYTE array to this file output stream. //Parameters: //b - the data. void ConsoleSaveFileOutputStream::write(byteArray b) @@ -81,7 +81,7 @@ void ConsoleSaveFileOutputStream::write(byteArray b) } } -//Writes len bytes from the specified byte array starting at offset off to this file output stream. +//Writes len bytes from the specified BYTE array starting at offset off to this file output stream. //Parameters: //b - the data. //off - the start offset in the data. diff --git a/Minecraft.World/Creeper.cpp b/Minecraft.World/Creeper.cpp index 0cd6b534..f6a45f16 100644 --- a/Minecraft.World/Creeper.cpp +++ b/Minecraft.World/Creeper.cpp @@ -81,8 +81,8 @@ void Creeper::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_SWELL_DIR, static_cast(-1)); - entityData->define(DATA_IS_POWERED, static_cast(0)); + entityData->define(DATA_SWELL_DIR, static_cast(-1)); + entityData->define(DATA_IS_POWERED, static_cast(0)); } void Creeper::addAdditonalSaveData(CompoundTag *entityTag) @@ -90,13 +90,13 @@ void Creeper::addAdditonalSaveData(CompoundTag *entityTag) Monster::addAdditonalSaveData(entityTag); if (entityData->getByte(DATA_IS_POWERED) == 1) entityTag->putBoolean(L"powered", true); entityTag->putShort(L"Fuse", static_cast(maxSwell)); - entityTag->putByte(L"ExplosionRadius", static_cast(explosionRadius)); + entityTag->putByte(L"ExplosionRadius", static_cast(explosionRadius)); } void Creeper::readAdditionalSaveData(CompoundTag *tag) { Monster::readAdditionalSaveData(tag); - entityData->set(DATA_IS_POWERED, static_cast(tag->getBoolean(L"powered") ? 1 : 0)); + entityData->set(DATA_IS_POWERED, static_cast(tag->getBoolean(L"powered") ? 1 : 0)); if (tag->contains(L"Fuse")) maxSwell = tag->getShort(L"Fuse"); if (tag->contains(L"ExplosionRadius")) explosionRadius = tag->getByte(L"ExplosionRadius"); } @@ -182,11 +182,11 @@ int Creeper::getSwellDir() void Creeper::setSwellDir(int dir) { - entityData->set(DATA_SWELL_DIR, static_cast(dir)); + entityData->set(DATA_SWELL_DIR, static_cast(dir)); } void Creeper::thunderHit(const LightningBolt *lightningBolt) { Monster::thunderHit(lightningBolt); - entityData->set(DATA_IS_POWERED, static_cast(1)); + entityData->set(DATA_IS_POWERED, static_cast(1)); } diff --git a/Minecraft.World/CustomLevelSource.cpp b/Minecraft.World/CustomLevelSource.cpp index 7281d298..0e299d97 100644 --- a/Minecraft.World/CustomLevelSource.cpp +++ b/Minecraft.World/CustomLevelSource.cpp @@ -204,11 +204,11 @@ void CustomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) // 4J - this comparison used to just be with 0.0f but is now varied by block above if (yc * CHUNK_HEIGHT + y < mapHeight) { - tileId = static_cast(Tile::stone_Id); + tileId = static_cast(Tile::stone_Id); } else if (yc * CHUNK_HEIGHT + y < waterHeight) { - tileId = static_cast(Tile::calmWater_Id); + tileId = static_cast(Tile::calmWater_Id); } // 4J - more extra code to make sure that the column at the edge of the world is just water & rock, to match the infinite sea that @@ -266,8 +266,8 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi int run = -1; - byte top = b->topMaterial; - byte material = b->material; + BYTE top = b->topMaterial; + BYTE material = b->material; LevelGenerationOptions *lgo = app.getLevelGenerationOptions(); if(lgo != nullptr) @@ -290,7 +290,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y <= 1 + random->nextInt(2)) // 4J - changed to make the bedrock not have bits you can get stuck in // if (y <= 0 + random->nextInt(5)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); } else { @@ -307,7 +307,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (runDepth <= 0) { top = 0; - material = static_cast(Tile::stone_Id); + material = static_cast(Tile::stone_Id); } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { @@ -321,8 +321,8 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y < waterHeight && top == 0) { - if (temp < 0.15f) top = static_cast(Tile::ice_Id); - else top = static_cast(Tile::calmWater_Id); + if (temp < 0.15f) top = static_cast(Tile::ice_Id); + else top = static_cast(Tile::calmWater_Id); } run = runDepth; @@ -339,7 +339,7 @@ void CustomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (run == 0 && material == Tile::sand_Id) { run = random->nextInt(4); - material = static_cast(Tile::sandStone_Id); + material = static_cast(Tile::sandStone_Id); } } } @@ -368,7 +368,7 @@ LevelChunk *CustomLevelSource::getChunk(int xOffs, int zOffs) // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int blocksSize = Level::maxBuildHeight * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + BYTE *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/DataInput.h b/Minecraft.World/DataInput.h index f61eceb5..8a80b6bd 100644 --- a/Minecraft.World/DataInput.h +++ b/Minecraft.World/DataInput.h @@ -7,7 +7,7 @@ public: virtual int read(byteArray b) = 0; virtual int read(byteArray b, unsigned int offset, unsigned int length) = 0; virtual bool readBoolean() = 0; - virtual byte readByte() = 0; + virtual BYTE readByte() = 0; virtual unsigned char readUnsignedByte() = 0; virtual bool readFully(byteArray a) = 0; virtual double readDouble() = 0; diff --git a/Minecraft.World/DataInputStream.cpp b/Minecraft.World/DataInputStream.cpp index 0cd21a7e..bb13d4e3 100644 --- a/Minecraft.World/DataInputStream.cpp +++ b/Minecraft.World/DataInputStream.cpp @@ -10,8 +10,8 @@ DataInputStream::DataInputStream(InputStream *in) : stream( in ) { } -//Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. -//If no byte is available because the end of the stream has been reached, the value -1 is returned. +//Reads the next BYTE of data from this input stream. The value BYTE is returned as an int in the range 0 to 255. +//If no BYTE is available because the end of the stream has been reached, the value -1 is returned. //This method blocks until input data is available, the end of the stream is detected, or an exception is thrown. //This method simply performs in.read() and returns the result. int DataInputStream::read() @@ -23,10 +23,10 @@ int DataInputStream::read() //The number of bytes actually read is returned as an integer. This method blocks until input data is available, //end of file is detected, or an exception is thrown. //If b is null, a NullPointerException is thrown. If the length of b is zero, then no bytes are read and 0 is returned; -//otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is at end of file, -//the value -1 is returned; otherwise, at least one byte is read and stored into b. +//otherwise, there is an attempt to read at least one BYTE. If no BYTE is available because the stream is at end of file, +//the value -1 is returned; otherwise, at least one BYTE is read and stored into b. // -//The first byte read is stored into element b[0], the next one into b[1], and so on. The number of bytes read is, at most, +//The first BYTE read is stored into element b[0], the next one into b[1], and so on. The number of bytes read is, at most, //equal to the length of b. Let k be the number of bytes actually read; these bytes will be stored in elements b[0] through b[k-1], //leaving elements b[k] through b[b.length-1] unaffected. // @@ -49,10 +49,10 @@ int DataInputStream::read(byteArray b) //but a smaller number may be read, possibly zero. The number of bytes actually read is returned as an integer. //This method blocks until input data is available, end of file is detected, or an exception is thrown. // -//If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. -//If no byte is available because the stream is at end of file, the value -1 is returned; otherwise, at least one byte is read and stored into b. +//If len is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one BYTE. +//If no BYTE is available because the stream is at end of file, the value -1 is returned; otherwise, at least one BYTE is read and stored into b. // -//The first byte read is stored into element b[off], the next one into b[off+1], and so on. The number of bytes read is, +//The first BYTE read is stored into element b[off], the next one into b[off+1], and so on. The number of bytes read is, //at most, equal to len. Let k be the number of bytes actually read; these bytes will be stored in elements b[off] through b[off+k-1], //leaving elements b[off+k] through b[off+len-1] unaffected. // @@ -77,8 +77,8 @@ void DataInputStream::close() stream->close(); } -//Reads one input byte and returns true if that byte is nonzero, false if that byte is zero. This method is suitable for reading -//the byte written by the writeBoolean method of interface DataOutput. +//Reads one input BYTE and returns true if that BYTE is nonzero, false if that BYTE is zero. This method is suitable for reading +//the BYTE written by the writeBoolean method of interface DataOutput. //Returns: //the boolean value read. bool DataInputStream::readBoolean() @@ -86,13 +86,13 @@ bool DataInputStream::readBoolean() return stream->read() != 0; } -//Reads and returns one input byte. The byte is treated as a signed value in the range -128 through 127, inclusive. -//This method is suitable for reading the byte written by the writeByte method of interface DataOutput. +//Reads and returns one input BYTE. The BYTE is treated as a signed value in the range -128 through 127, inclusive. +//This method is suitable for reading the BYTE written by the writeByte method of interface DataOutput. //Returns: //the 8-bit value read. -byte DataInputStream::readByte() +BYTE DataInputStream::readByte() { - return static_cast(stream->read()); + return static_cast(stream->read()); } unsigned char DataInputStream::readUnsignedByte() @@ -100,7 +100,7 @@ unsigned char DataInputStream::readUnsignedByte() return static_cast(stream->read()); } -//Reads two input bytes and returns a char value. Let a be the first byte read and b be the second byte. The value returned is: +//Reads two input bytes and returns a char value. Let a be the first BYTE read and b be the second BYTE. The value returned is: //(char)((a << 8) | (b & 0xff)) // //This method is suitable for reading bytes written by the writeChar method of interface DataOutput. @@ -119,7 +119,7 @@ wchar_t DataInputStream::readChar() //b.length bytes of input data are available, in which case a normal return is made. //End of file is detected, in which case an EOFException is thrown. //An I/O error occurs, in which case an IOException other than EOFException is thrown. -//If b is null, a NullPointerException is thrown. If b.length is zero, then no bytes are read. Otherwise, the first byte read is +//If b is null, a NullPointerException is thrown. If b.length is zero, then no bytes are read. Otherwise, the first BYTE read is //stored into element b[0], the next one into b[1], and so on. If an exception is thrown from this method, then it may be that some but //not all bytes of b have been updated with data from the input stream. // @@ -244,7 +244,7 @@ int64_t DataInputStream::readLong() return bits; } -//Reads two input bytes and returns a short value. Let a be the first byte read and b be the second byte. The value returned is: +//Reads two input bytes and returns a short value. Let a be the first BYTE read and b be the second BYTE. The value returned is: //(short)((a << 8) | (b & 0xff)) // //This method is suitable for reading the bytes written by the writeShort method of interface DataOutput. @@ -268,25 +268,25 @@ unsigned short DataInputStream::readUnsignedShort() //of a Unicode character string encoded in modified UTF-8 format; this string of characters is then returned as a String. //First, two bytes are read and used to construct an unsigned 16-bit integer in exactly the manner of the readUnsignedShort method . //This integer value is called the UTF length and specifies the number of additional bytes to be read. These bytes are then converted -//to characters by considering them in groups. The length of each group is computed from the value of the first byte of the group. -//The byte following a group, if any, is the first byte of the next group. +//to characters by considering them in groups. The length of each group is computed from the value of the first BYTE of the group. +//The BYTE following a group, if any, is the first BYTE of the next group. // -//If the first byte of a group matches the bit pattern 0xxxxxxx (where x means "may be 0 or 1"), then the group consists of just that byte. -//The byte is zero-extended to form a character. +//If the first BYTE of a group matches the bit pattern 0xxxxxxx (where x means "may be 0 or 1"), then the group consists of just that BYTE. +//The BYTE is zero-extended to form a character. // -//If the first byte of a group matches the bit pattern 110xxxxx, then the group consists of that byte a and a second byte b. -//If there is no byte b (because byte a was the last of the bytes to be read), or if byte b does not match the bit pattern 10xxxxxx, +//If the first BYTE of a group matches the bit pattern 110xxxxx, then the group consists of that BYTE a and a second BYTE b. +//If there is no BYTE b (because BYTE a was the last of the bytes to be read), or if BYTE b does not match the bit pattern 10xxxxxx, //then a UTFDataFormatException is thrown. Otherwise, the group is converted to the character: // //(char)(((a& 0x1F) << 6) | (b & 0x3F)) // -//If the first byte of a group matches the bit pattern 1110xxxx, then the group consists of that byte a and two more bytes b and c. -//If there is no byte c (because byte a was one of the last two of the bytes to be read), or either byte b or byte c does not match the bit +//If the first BYTE of a group matches the bit pattern 1110xxxx, then the group consists of that BYTE a and two more bytes b and c. +//If there is no BYTE c (because BYTE a was one of the last two of the bytes to be read), or either BYTE b or BYTE c does not match the bit //pattern 10xxxxxx, then a UTFDataFormatException is thrown. Otherwise, the group is converted to the character: // // (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F)) // -//If the first byte of a group matches the pattern 1111xxxx or the pattern 10xxxxxx, then a UTFDataFormatException is thrown. +//If the first BYTE of a group matches the pattern 1111xxxx or the pattern 10xxxxxx, then a UTFDataFormatException is thrown. //If end of file is encountered at any time during this entire process, then an EOFException is thrown. // //After every group has been converted to a character by this process, the characters are gathered, in the same order in which their @@ -334,11 +334,11 @@ wstring DataInputStream::readUTF() // 11110000 = 0xF0 // Match only highest four bits // Matching patterns: - // 10xxxxxx = 0x80 // ERROR, or second/third byte + // 10xxxxxx = 0x80 // ERROR, or second/third BYTE // 1111xxxx = 0xF0 //ERROR - // 0xxxxxxx = 0x00 // One byte UTF - // 110xxxxx = 0xC0 // Two byte UTF - // 1110xxxx = 0xE0 // Three byte UTF + // 0xxxxxxx = 0x00 // One BYTE UTF + // 110xxxxx = 0xC0 // Two BYTE UTF + // 1110xxxx = 0xE0 // Three BYTE UTF if( ( (firstByte & 0xC0 ) == 0x80 ) || ( (firstByte & 0xF0) == 0xF0) ) { // TODO 4J Stu - UTFDataFormatException @@ -346,14 +346,14 @@ wstring DataInputStream::readUTF() } else if( (firstByte & 0x80) == 0x00 ) { - // One byte UTF + // One BYTE UTF wchar_t readChar = static_cast(firstByte); outputString.push_back( readChar ); continue; } else if( (firstByte & 0xE0) == 0xC0 ) { - // Two byte UTF + // Two BYTE UTF // No more bytes to read if( !(currentByteIndex < UTFLength) ) @@ -365,13 +365,13 @@ wstring DataInputStream::readUTF() int secondByte = stream->read(); currentByteIndex++; - // No second byte + // No second BYTE if( secondByte == -1 ) { // TODO 4J Stu - EOFException break; } - // Incorrect second byte pattern + // Incorrect second BYTE pattern else if( (secondByte & 0xC0 ) != 0x80 ) { // TODO 4J Stu - UTFDataFormatException @@ -384,7 +384,7 @@ wstring DataInputStream::readUTF() } else if( (firstByte & 0xF0) == 0xE0 ) { - // Three byte UTF + // Three BYTE UTF // No more bytes to read if( !(currentByteIndex < UTFLength) ) @@ -396,7 +396,7 @@ wstring DataInputStream::readUTF() int secondByte = stream->read(); currentByteIndex++; - // No second byte + // No second BYTE if( secondByte == -1 ) { // TODO 4J Stu - EOFException @@ -413,13 +413,13 @@ wstring DataInputStream::readUTF() int thirdByte = stream->read(); currentByteIndex++; - // No third byte + // No third BYTE if( thirdByte == -1 ) { // TODO 4J Stu - EOFException break; } - // Incorrect second or third byte pattern + // Incorrect second or third BYTE pattern else if( ( (secondByte & 0xC0 ) != 0x80 ) || ( (thirdByte & 0xC0 ) != 0x80 ) ) { // TODO 4J Stu - UTFDataFormatException @@ -451,11 +451,11 @@ int DataInputStream::readUTFChar() // 11110000 = 0xF0 // Match only highest four bits // Matching patterns: - // 10xxxxxx = 0x80 // ERROR, or second/third byte + // 10xxxxxx = 0x80 // ERROR, or second/third BYTE // 1111xxxx = 0xF0 //ERROR - // 0xxxxxxx = 0x00 // One byte UTF - // 110xxxxx = 0xC0 // Two byte UTF - // 1110xxxx = 0xE0 // Three byte UTF + // 0xxxxxxx = 0x00 // One BYTE UTF + // 110xxxxx = 0xC0 // Two BYTE UTF + // 1110xxxx = 0xE0 // Three BYTE UTF if( ( (firstByte & 0xC0 ) == 0x80 ) || ( (firstByte & 0xF0) == 0xF0) ) { // TODO 4J Stu - UTFDataFormatException @@ -463,21 +463,21 @@ int DataInputStream::readUTFChar() } else if( (firstByte & 0x80) == 0x00 ) { - // One byte UTF + // One BYTE UTF returnValue = firstByte; } else if( (firstByte & 0xE0) == 0xC0 ) { - // Two byte UTF + // Two BYTE UTF int secondByte = stream->read(); - // No second byte + // No second BYTE if( secondByte == -1 ) { // TODO 4J Stu - EOFException return returnValue; } - // Incorrect second byte pattern + // Incorrect second BYTE pattern else if( (secondByte & 0xC0 ) != 0x80 ) { // TODO 4J Stu - UTFDataFormatException @@ -488,11 +488,11 @@ int DataInputStream::readUTFChar() } else if( (firstByte & 0xF0) == 0xE0 ) { - // Three byte UTF + // Three BYTE UTF int secondByte = stream->read(); - // No second byte + // No second BYTE if( secondByte == -1 ) { // TODO 4J Stu - EOFException @@ -501,13 +501,13 @@ int DataInputStream::readUTFChar() int thirdByte = stream->read(); - // No third byte + // No third BYTE if( thirdByte == -1 ) { // TODO 4J Stu - EOFException return returnValue; } - // Incorrect second or third byte pattern + // Incorrect second or third BYTE pattern else if( ( (secondByte & 0xC0 ) != 0x80 ) || ( (thirdByte & 0xC0 ) != 0x80 ) ) { // TODO 4J Stu - UTFDataFormatException diff --git a/Minecraft.World/DataInputStream.h b/Minecraft.World/DataInputStream.h index 67604c28..c6ed6dcc 100644 --- a/Minecraft.World/DataInputStream.h +++ b/Minecraft.World/DataInputStream.h @@ -16,7 +16,7 @@ public: virtual int read(byteArray b, unsigned int offset, unsigned int length); virtual void close(); virtual bool readBoolean(); - virtual byte readByte(); + virtual BYTE readByte(); virtual unsigned char readUnsignedByte(); virtual unsigned short readUnsignedShort(); virtual wchar_t readChar(); diff --git a/Minecraft.World/DataLayer.cpp b/Minecraft.World/DataLayer.cpp index f3916320..18ed1019 100644 --- a/Minecraft.World/DataLayer.cpp +++ b/Minecraft.World/DataLayer.cpp @@ -40,10 +40,10 @@ void DataLayer::set(int x, int y, int z, int val) if (part == 0) { - data[slot] = static_cast((data[slot] & 0xf0) | (val & 0xf)); + data[slot] = static_cast((data[slot] & 0xf0) | (val & 0xf)); } else { - data[slot] = static_cast((data[slot] & 0x0f) | ((val & 0xf) << 4)); + data[slot] = static_cast((data[slot] & 0x0f) | ((val & 0xf) << 4)); } } @@ -54,7 +54,7 @@ bool DataLayer::isValid() void DataLayer::setAll(int br) { - byte val = static_cast(br & (br << 4)); + BYTE val = static_cast(br & (br << 4)); for (unsigned int i = 0; i < data.length; i++) { data[i] = val; diff --git a/Minecraft.World/DataOutput.h b/Minecraft.World/DataOutput.h index 7ebf96da..c0e6ce3a 100644 --- a/Minecraft.World/DataOutput.h +++ b/Minecraft.World/DataOutput.h @@ -6,7 +6,7 @@ public: virtual void write(unsigned int b) = 0; virtual void write(byteArray b) = 0; virtual void write(byteArray b, unsigned int offset, unsigned int length) = 0; - virtual void writeByte(byte a) = 0; + virtual void writeByte(BYTE a) = 0; virtual void writeDouble(double a) = 0; virtual void writeFloat(float a) = 0; virtual void writeInt(int a) = 0; diff --git a/Minecraft.World/DataOutputStream.cpp b/Minecraft.World/DataOutputStream.cpp index 1a3931cf..1653c3f1 100644 --- a/Minecraft.World/DataOutputStream.cpp +++ b/Minecraft.World/DataOutputStream.cpp @@ -17,11 +17,11 @@ void DataOutputStream::deleteChildStream() delete stream; } -//Writes the specified byte (the low eight bits of the argument b) to the underlying output stream. +//Writes the specified BYTE (the low eight bits of the argument b) to the underlying output stream. //If no exception is thrown, the counter written is incremented by 1. //Implements the write method of OutputStream. //Parameters: -//b - the byte to be written. +//b - the BYTE to be written. void DataOutputStream::write(unsigned int b) { stream->write( b ); @@ -34,7 +34,7 @@ void DataOutputStream::flush() stream->flush(); } -//Writes b.length bytes from the specified byte array to this output stream. +//Writes b.length bytes from the specified BYTE array to this output stream. //The general contract for write(b) is that it should have exactly the same effect as the call write(b, 0, b.length). //Parameters: //b - the data. @@ -43,7 +43,7 @@ void DataOutputStream::write(byteArray b) write(b, 0, b.length); } -//Writes len bytes from the specified byte array starting at offset off to the underlying output stream. +//Writes len bytes from the specified BYTE array starting at offset off to the underlying output stream. //If no exception is thrown, the counter written is incremented by len. //Parameters: //b - the data. @@ -63,17 +63,17 @@ void DataOutputStream::close() stream->close(); } -//Writes out a byte to the underlying output stream as a 1-byte value. If no exception is thrown, the counter written is incremented by 1. +//Writes out a BYTE to the underlying output stream as a 1-BYTE value. If no exception is thrown, the counter written is incremented by 1. //Parameters: -//v - a byte value to be written. -void DataOutputStream::writeByte(byte a) +//v - a BYTE value to be written. +void DataOutputStream::writeByte(BYTE a) { stream->write( a ); } //Converts the double argument to a long using the doubleToLongBits method in class Double, -//and then writes that long value to the underlying output stream as an 8-byte quantity, -//high byte first. If no exception is thrown, the counter written is incremented by 8. +//and then writes that long value to the underlying output stream as an 8-BYTE quantity, +//high BYTE first. If no exception is thrown, the counter written is incremented by 8. //Parameters: //v - a double value to be written. void DataOutputStream::writeDouble(double a) @@ -86,7 +86,7 @@ void DataOutputStream::writeDouble(double a) } //Converts the float argument to an int using the floatToIntBits method in class Float, -//and then writes that int value to the underlying output stream as a 4-byte quantity, high byte first. +//and then writes that int value to the underlying output stream as a 4-BYTE quantity, high BYTE first. //If no exception is thrown, the counter written is incremented by 4. //Parameters: //v - a float value to be written. @@ -99,7 +99,7 @@ void DataOutputStream::writeFloat(float a) written += 4; } -//Writes an int to the underlying output stream as four bytes, high byte first. If no exception is thrown, the counter written is incremented by 4. +//Writes an int to the underlying output stream as four bytes, high BYTE first. If no exception is thrown, the counter written is incremented by 4. //Parameters: //v - an int to be written. void DataOutputStream::writeInt(int a) @@ -112,7 +112,7 @@ void DataOutputStream::writeInt(int a) written += 4; } -//Writes a long to the underlying output stream as eight bytes, high byte first. +//Writes a long to the underlying output stream as eight bytes, high BYTE first. //In no exception is thrown, the counter written is incremented by 8. //Parameters: //v - a long to be written. @@ -130,7 +130,7 @@ void DataOutputStream::writeLong(int64_t a) written += 4; } -//Writes a short to the underlying output stream as two bytes, high byte first. +//Writes a short to the underlying output stream as two bytes, high BYTE first. //If no exception is thrown, the counter written is incremented by 2. //Parameters: //v - a short to be written. @@ -150,7 +150,7 @@ void DataOutputStream::writeUnsignedShort(unsigned short a) written += 2; } -//Writes a char to the underlying output stream as a 2-byte value, high byte first. +//Writes a char to the underlying output stream as a 2-BYTE value, high BYTE first. //If no exception is thrown, the counter written is incremented by 2. //Parameters: //v - a char value to be written. @@ -177,14 +177,14 @@ void DataOutputStream::writeChars(const wstring& str) // Incrementing handled by the writeChar function } -//Writes a boolean to the underlying output stream as a 1-byte value. -//The value true is written out as the value (byte)1; the value false is written out as the value (byte)0. +//Writes a boolean to the underlying output stream as a 1-BYTE value. +//The value true is written out as the value (BYTE)1; the value false is written out as the value (BYTE)0. //If no exception is thrown, the counter written is incremented by 1. //Parameters: //v - a boolean value to be written. void DataOutputStream::writeBoolean(bool b) { - stream->write( b ? static_cast(1) : static_cast(0) ); + stream->write( b ? static_cast(1) : static_cast(0) ); // TODO 4J Stu - Error handling? written += 1; } @@ -227,15 +227,15 @@ void DataOutputStream::writeUTF(const wstring& str) byteArray bytearr(utflen+2); - bytearr[count++] = static_cast((utflen >> 8) & 0xFF); - bytearr[count++] = static_cast((utflen >> 0) & 0xFF); + bytearr[count++] = static_cast((utflen >> 8) & 0xFF); + bytearr[count++] = static_cast((utflen >> 0) & 0xFF); int i=0; for (i=0; i= 0x0001) && (c <= 0x007F))) break; - bytearr[count++] = static_cast(c); + bytearr[count++] = static_cast(c); } for (;i < strlen; i++) @@ -243,19 +243,19 @@ void DataOutputStream::writeUTF(const wstring& str) c = str.at(i); if ((c >= 0x0001) && (c <= 0x007F)) { - bytearr[count++] = static_cast(c); + bytearr[count++] = static_cast(c); } else if (c > 0x07FF) { - bytearr[count++] = static_cast(0xE0 | ((c >> 12) & 0x0F)); - bytearr[count++] = static_cast(0x80 | ((c >> 6) & 0x3F)); - bytearr[count++] = static_cast(0x80 | ((c >> 0) & 0x3F)); + bytearr[count++] = static_cast(0xE0 | ((c >> 12) & 0x0F)); + bytearr[count++] = static_cast(0x80 | ((c >> 6) & 0x3F)); + bytearr[count++] = static_cast(0x80 | ((c >> 0) & 0x3F)); } else { - bytearr[count++] = static_cast(0xC0 | ((c >> 6) & 0x1F)); - bytearr[count++] = static_cast(0x80 | ((c >> 0) & 0x3F)); + bytearr[count++] = static_cast(0xC0 | ((c >> 6) & 0x1F)); + bytearr[count++] = static_cast(0x80 | ((c >> 0) & 0x3F)); } } write(bytearr, 0, utflen+2); diff --git a/Minecraft.World/DataOutputStream.h b/Minecraft.World/DataOutputStream.h index 7ecfcd44..4bacbf37 100644 --- a/Minecraft.World/DataOutputStream.h +++ b/Minecraft.World/DataOutputStream.h @@ -22,7 +22,7 @@ public: virtual void write(byteArray b); virtual void write(byteArray b, unsigned int offset, unsigned int length); virtual void close(); - virtual void writeByte(byte a); + virtual void writeByte(BYTE a); virtual void writeDouble(double a); virtual void writeFloat(float a); virtual void writeInt(int a); diff --git a/Minecraft.World/DirectoryLevelStorage.cpp b/Minecraft.World/DirectoryLevelStorage.cpp index c557e37a..072253e1 100644 --- a/Minecraft.World/DirectoryLevelStorage.cpp +++ b/Minecraft.World/DirectoryLevelStorage.cpp @@ -19,7 +19,7 @@ _MapDataMappings::_MapDataMappings() #ifndef _DURANGO ZeroMemory(xuids,sizeof(PlayerUID)*MAXIMUM_MAP_SAVE_DATA); #endif - ZeroMemory(dimensions,sizeof(byte)*(MAXIMUM_MAP_SAVE_DATA/4)); + ZeroMemory(dimensions,sizeof(BYTE)*(MAXIMUM_MAP_SAVE_DATA/4)); } int _MapDataMappings::getDimension(int id) @@ -84,7 +84,7 @@ _MapDataMappings_old::_MapDataMappings_old() #ifndef _DURANGO ZeroMemory(xuids,sizeof(PlayerUID)*MAXIMUM_MAP_SAVE_DATA); #endif - ZeroMemory(dimensions,sizeof(byte)*(MAXIMUM_MAP_SAVE_DATA/8)); + ZeroMemory(dimensions,sizeof(BYTE)*(MAXIMUM_MAP_SAVE_DATA/8)); } int _MapDataMappings_old::getDimension(int id) diff --git a/Minecraft.World/DirectoryLevelStorage.h b/Minecraft.World/DirectoryLevelStorage.h index 6d305ba3..2a95d1e8 100644 --- a/Minecraft.World/DirectoryLevelStorage.h +++ b/Minecraft.World/DirectoryLevelStorage.h @@ -36,7 +36,7 @@ class ConsoleSaveFile; typedef struct _MapDataMappings { PlayerUID xuids[MAXIMUM_MAP_SAVE_DATA]; - byte dimensions[MAXIMUM_MAP_SAVE_DATA/4]; + BYTE dimensions[MAXIMUM_MAP_SAVE_DATA/4]; _MapDataMappings(); int getDimension(int id); @@ -47,7 +47,7 @@ typedef struct _MapDataMappings typedef struct _MapDataMappings_old { PlayerUID xuids[MAXIMUM_MAP_SAVE_DATA]; - byte dimensions[MAXIMUM_MAP_SAVE_DATA/8]; + BYTE dimensions[MAXIMUM_MAP_SAVE_DATA/8]; _MapDataMappings_old(); int getDimension(int id); diff --git a/Minecraft.World/DispenserTileEntity.cpp b/Minecraft.World/DispenserTileEntity.cpp index b1d8ecde..f6b3a78f 100644 --- a/Minecraft.World/DispenserTileEntity.cpp +++ b/Minecraft.World/DispenserTileEntity.cpp @@ -189,7 +189,7 @@ void DispenserTileEntity::save(CompoundTag *base) if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } diff --git a/Minecraft.World/DoubleTag.h b/Minecraft.World/DoubleTag.h index 60e5808a..f122695c 100644 --- a/Minecraft.World/DoubleTag.h +++ b/Minecraft.World/DoubleTag.h @@ -12,7 +12,7 @@ public: void write(DataOutput *dos) { dos->writeDouble(data); } void load(DataInput *dis, int tagDepth) { data = dis->readDouble(); } - byte getId() { return TAG_Double; } + BYTE getId() { return TAG_Double; } wstring toString() { static wchar_t buf[32]; diff --git a/Minecraft.World/DungeonFeature.cpp b/Minecraft.World/DungeonFeature.cpp index 8c9abbe5..48774679 100644 --- a/Minecraft.World/DungeonFeature.cpp +++ b/Minecraft.World/DungeonFeature.cpp @@ -142,12 +142,12 @@ void DungeonFeature::addTunnel(int xOffs, int zOffs, byteArray blocks, double xC { if (yy < 10) { - blocks[p] = static_cast(Tile::lava_Id); + blocks[p] = static_cast(Tile::lava_Id); } else { - blocks[p] = static_cast(0); - if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = static_cast(Tile::grass_Id); + blocks[p] = static_cast(0); + if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = static_cast(Tile::grass_Id); } } } diff --git a/Minecraft.World/DurangoStats.cpp b/Minecraft.World/DurangoStats.cpp index 7302d9ed..f27edc97 100644 --- a/Minecraft.World/DurangoStats.cpp +++ b/Minecraft.World/DurangoStats.cpp @@ -193,7 +193,7 @@ byteArray DsItemEvent::createParamBlob(eAcquisitionMethod eMethod, int itemId, i { byteArray output; Param param = { eMethod, itemId, itemAux, itemCount }; - output.data = (byte *) new Param(param); + output.data = (BYTE *) new Param(param); output.length = sizeof(Param); return output; } @@ -292,7 +292,7 @@ byteArray DsMobKilled::createParamBlob(shared_ptr player, shared_ptrdistanceTo(player->x, player->y, player->z), 0/*not needed*/ }; - output.data = (byte*) new Param(param); + output.data = (BYTE*) new Param(param); output.length = sizeof(Param); return output; } @@ -307,7 +307,7 @@ byteArray DsMobKilled::createParamBlob(shared_ptr player, shared_ptrdistanceTo(player->x, player->y, player->z), 0/*not needed*/ }; - output.data = (byte*) new Param(param); + output.data = (BYTE*) new Param(param); output.length = sizeof(Param); return output; } @@ -346,7 +346,7 @@ byteArray DsMobInteract::createParamBlob(eInteract interactionId, int entityId) { byteArray output; Param param = { interactionId, EntityIO::eTypeToIoid(static_cast(entityId)) }; - output.data = (byte*) new Param(param); + output.data = (BYTE*) new Param(param); output.length = sizeof(Param); return output; } @@ -394,7 +394,7 @@ byteArray DsTravel::createParamBlob(eMethod method, int distance) { byteArray output; Param param = { method, distance }; - output.data = (byte*) new Param(param); + output.data = (BYTE*) new Param(param); output.length = sizeof(Param); return output; } @@ -508,7 +508,7 @@ byteArray DsItemUsed::createParamBlob(int itemId, int aux, int count, int health { byteArray output; Param param = { itemId, aux, count, health, hunger }; - output.data = (byte*) new Param(param); + output.data = (BYTE*) new Param(param); output.length = sizeof(Param); return output; } @@ -595,7 +595,7 @@ byteArray DsAchievement::createSmallParamBlob(eAward award) { byteArray output; SmallParam param = { award }; - output.data = (byte*) new SmallParam(param); + output.data = (BYTE*) new SmallParam(param); output.length = sizeof(SmallParam); return output; } @@ -604,7 +604,7 @@ byteArray DsAchievement::createLargeParamBlob(eAward award, int count) { byteArray output; LargeParam param = { award, count }; - output.data = (byte*) new LargeParam(param); + output.data = (BYTE*) new LargeParam(param); output.length = sizeof(LargeParam); return output; } @@ -632,7 +632,7 @@ byteArray DsChangedDimension::createParamBlob(int fromDimId, int toDimId) { byteArray output; Param param = { fromDimId, toDimId }; - output.data = (byte*) new Param(param); + output.data = (BYTE*) new Param(param); output.length = sizeof(Param); return output; } @@ -663,7 +663,7 @@ byteArray DsEnteredBiome::createParamBlob(int biomeId) { byteArray output; Param param = { biomeId }; - output.data = (byte*) new Param(param); + output.data = (BYTE*) new Param(param); output.length = sizeof(Param); return output; } diff --git a/Minecraft.World/EmptyLevelChunk.cpp b/Minecraft.World/EmptyLevelChunk.cpp index 4a19e875..4355018c 100644 --- a/Minecraft.World/EmptyLevelChunk.cpp +++ b/Minecraft.World/EmptyLevelChunk.cpp @@ -189,7 +189,7 @@ int EmptyLevelChunk::getBlocksAndData(byteArray data, int x0, int y0, int z0, in } - Arrays::fill(data, p, p + len, (byte) 0); + Arrays::fill(data, p, p + len, (BYTE) 0); return len; } diff --git a/Minecraft.World/EmptyMapItem.cpp b/Minecraft.World/EmptyMapItem.cpp index 9c46938a..b9f8b94f 100644 --- a/Minecraft.World/EmptyMapItem.cpp +++ b/Minecraft.World/EmptyMapItem.cpp @@ -19,7 +19,7 @@ shared_ptr EmptyMapItem::use(shared_ptr itemInstance //int scale = MapItemSavedData.MAP_SIZE * 2 * (1 << data.scale); //data.x = (int) (Math.round(player.x / scale) * scale); //data.z = (int) (Math.round(player.z / scale) * scale); - //data.dimension = (byte) level.dimension.id; + //data.dimension = (BYTE) level.dimension.id; //data.setDirty(); diff --git a/Minecraft.World/EndTag.h b/Minecraft.World/EndTag.h index 2815a577..bdc018a2 100644 --- a/Minecraft.World/EndTag.h +++ b/Minecraft.World/EndTag.h @@ -10,7 +10,7 @@ public: void load(DataInput *dis, int tagDepth) {}; void write(DataOutput *dos) {}; - byte getId() { return TAG_End; } + BYTE getId() { return TAG_End; } wstring toString() { return wstring( L"END" ); } Tag *copy() diff --git a/Minecraft.World/EnderMan.cpp b/Minecraft.World/EnderMan.cpp index da469a3a..b558dab0 100644 --- a/Minecraft.World/EnderMan.cpp +++ b/Minecraft.World/EnderMan.cpp @@ -67,9 +67,9 @@ void EnderMan::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_CARRY_ITEM_ID, static_cast(0)); - entityData->define(DATA_CARRY_ITEM_DATA, static_cast(0)); - entityData->define(DATA_CREEPY, static_cast(0)); + entityData->define(DATA_CARRY_ITEM_ID, static_cast(0)); + entityData->define(DATA_CARRY_ITEM_DATA, static_cast(0)); + entityData->define(DATA_CREEPY, static_cast(0)); } void EnderMan::addAdditonalSaveData(CompoundTag *tag) @@ -385,7 +385,7 @@ void EnderMan::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) // 4J Brought forward from 1.2.3 to help fix Enderman behaviour void EnderMan::setCarryingTile(int carryingTile) { - entityData->set(DATA_CARRY_ITEM_ID, static_cast(carryingTile & 0xff)); + entityData->set(DATA_CARRY_ITEM_ID, static_cast(carryingTile & 0xff)); } int EnderMan::getCarryingTile() @@ -395,7 +395,7 @@ int EnderMan::getCarryingTile() void EnderMan::setCarryingData(int carryingData) { - entityData->set(DATA_CARRY_ITEM_DATA, static_cast(carryingData & 0xff)); + entityData->set(DATA_CARRY_ITEM_DATA, static_cast(carryingData & 0xff)); } int EnderMan::getCarryingData() @@ -440,5 +440,5 @@ bool EnderMan::isCreepy() void EnderMan::setCreepy(bool creepy) { - entityData->set(DATA_CREEPY, static_cast(creepy ? 1 : 0)); + entityData->set(DATA_CREEPY, static_cast(creepy ? 1 : 0)); } \ No newline at end of file diff --git a/Minecraft.World/Entity.cpp b/Minecraft.World/Entity.cpp index 83f626e6..7f6f4e29 100644 --- a/Minecraft.World/Entity.cpp +++ b/Minecraft.World/Entity.cpp @@ -373,7 +373,7 @@ Entity::Entity(Level *level, bool useSmallId) // 4J - added useSmallId parameter if( entityData ) { - entityData->define(DATA_SHARED_FLAGS_ID, static_cast(0)); + entityData->define(DATA_SHARED_FLAGS_ID, static_cast(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. } @@ -1727,7 +1727,7 @@ void Entity::lerpMotion(double xd, double yd, double zd) this->zd = zd; } -void Entity::handleEntityEvent(byte eventId) +void Entity::handleEntityEvent(BYTE eventId) { } @@ -1836,14 +1836,14 @@ void Entity::setSharedFlag(int flag, bool value) { if( entityData ) { - byte currentValue = entityData->getByte(DATA_SHARED_FLAGS_ID); + BYTE currentValue = entityData->getByte(DATA_SHARED_FLAGS_ID); if (value) { - entityData->set(DATA_SHARED_FLAGS_ID, static_cast(currentValue | (1 << flag))); + entityData->set(DATA_SHARED_FLAGS_ID, static_cast(currentValue | (1 << flag))); } else { - entityData->set(DATA_SHARED_FLAGS_ID, static_cast(currentValue & ~(1 << flag))); + entityData->set(DATA_SHARED_FLAGS_ID, static_cast(currentValue & ~(1 << flag))); } } } diff --git a/Minecraft.World/Entity.h b/Minecraft.World/Entity.h index a738c2ba..6f6025f4 100644 --- a/Minecraft.World/Entity.h +++ b/Minecraft.World/Entity.h @@ -329,7 +329,7 @@ public: virtual void handleInsidePortal(); virtual int getDimensionChangingDelay(); virtual void lerpMotion(double xd, double yd, double zd); - virtual void handleEntityEvent(byte eventId); + virtual void handleEntityEvent(BYTE eventId); virtual void animateHurt(); virtual ItemInstanceArray getEquipmentSlots(); // ItemInstance[] virtual void setEquippedSlot(int slot, shared_ptr item); // 4J Stu - Brought forward change from 1.3 to fix #64688 - Customer Encountered: TU7: Content: Art: Aura of enchanted item is not displayed for other players in online game diff --git a/Minecraft.World/EntityEventPacket.cpp b/Minecraft.World/EntityEventPacket.cpp index e92d7692..02ba8fe4 100644 --- a/Minecraft.World/EntityEventPacket.cpp +++ b/Minecraft.World/EntityEventPacket.cpp @@ -12,7 +12,7 @@ EntityEventPacket::EntityEventPacket() eventId = 0; } -EntityEventPacket::EntityEventPacket(int entityId, byte eventId) +EntityEventPacket::EntityEventPacket(int entityId, BYTE eventId) { this->entityId = entityId; this->eventId = eventId; diff --git a/Minecraft.World/EntityEventPacket.h b/Minecraft.World/EntityEventPacket.h index 2b32dc29..59c8e778 100644 --- a/Minecraft.World/EntityEventPacket.h +++ b/Minecraft.World/EntityEventPacket.h @@ -7,10 +7,10 @@ class EntityEventPacket : public Packet, public enable_shared_from_thisdefine(DATA_ID_HORSE_FLAGS, 0); - entityData->define(DATA_ID_TYPE, static_cast(0)); + entityData->define(DATA_ID_TYPE, static_cast(0)); entityData->define(DATA_ID_TYPE_VARIANT, 0); entityData->define(DATA_ID_OWNER_NAME, L""); entityData->define(DATA_ID_ARMOR, 0); @@ -108,7 +108,7 @@ void EntityHorse::defineSynchedData() void EntityHorse::setType(int i) { - entityData->set(DATA_ID_TYPE, static_cast(i)); + entityData->set(DATA_ID_TYPE, static_cast(i)); clearLayeredTextureInfo(); } @@ -1463,7 +1463,7 @@ void EntityHorse::addAdditonalSaveData(CompoundTag *tag) { CompoundTag *compoundTag = new CompoundTag(); - compoundTag->putByte(L"Slot", static_cast(i)); + compoundTag->putByte(L"Slot", static_cast(i)); stack->save(compoundTag); listTag->add(compoundTag); @@ -1766,7 +1766,7 @@ void EntityHorse::spawnTamingParticles(bool success) } } -void EntityHorse::handleEntityEvent(byte id) +void EntityHorse::handleEntityEvent(BYTE id) { if (id == EntityEvent::TAMING_SUCCEEDED) { diff --git a/Minecraft.World/EntityHorse.h b/Minecraft.World/EntityHorse.h index 6a71a3bc..a40b05b5 100644 --- a/Minecraft.World/EntityHorse.h +++ b/Minecraft.World/EntityHorse.h @@ -319,7 +319,7 @@ protected: virtual void spawnTamingParticles(bool success); public: - virtual void handleEntityEvent(byte id); + virtual void handleEntityEvent(BYTE id); virtual void positionRider(); private: diff --git a/Minecraft.World/ExperienceOrb.cpp b/Minecraft.World/ExperienceOrb.cpp index cc4b12bc..4f9e7a03 100644 --- a/Minecraft.World/ExperienceOrb.cpp +++ b/Minecraft.World/ExperienceOrb.cpp @@ -176,7 +176,7 @@ bool ExperienceOrb::hurt(DamageSource *source, float damage) void ExperienceOrb::addAdditonalSaveData(CompoundTag *entityTag) { - entityTag->putShort(L"Health", static_cast(health)); + entityTag->putShort(L"Health", static_cast(health)); entityTag->putShort(L"Age", static_cast(age)); entityTag->putShort(L"Value", static_cast(value)); } diff --git a/Minecraft.World/FallingTile.cpp b/Minecraft.World/FallingTile.cpp index 0ff776fd..25cdd228 100644 --- a/Minecraft.World/FallingTile.cpp +++ b/Minecraft.World/FallingTile.cpp @@ -212,10 +212,10 @@ void FallingTile::causeFallDamage(float distance) void FallingTile::addAdditonalSaveData(CompoundTag *tag) { - tag->putByte(L"Tile", static_cast(tile)); + tag->putByte(L"Tile", static_cast(tile)); tag->putInt(L"TileID", tile); - tag->putByte(L"Data", static_cast(data)); - tag->putByte(L"Time", static_cast(time)); + tag->putByte(L"Data", static_cast(data)); + tag->putByte(L"Time", static_cast(time)); tag->putBoolean(L"DropItem", dropItem); tag->putBoolean(L"HurtEntities", hurtEntities); tag->putFloat(L"FallHurtAmount", fallDamageAmount); diff --git a/Minecraft.World/FastNoise.cpp b/Minecraft.World/FastNoise.cpp index 399c427f..92213116 100644 --- a/Minecraft.World/FastNoise.cpp +++ b/Minecraft.World/FastNoise.cpp @@ -15,10 +15,10 @@ FastNoise::FastNoise(Random *random, int levels) void FastNoise::init(Random *random, int levels) { this->levels = levels; - noiseMaps = new byte *[levels]; + noiseMaps = new BYTE *[levels]; for (int i = 0; i < levels; i++) { - noiseMaps[i] = new byte[0x100000]; + noiseMaps[i] = new BYTE[0x100000]; random->nextBytes(noiseMaps[i],0x100000); } } @@ -44,7 +44,7 @@ doubleArray FastNoise::getRegion(doubleArray buffer, double x, double y, double int BB = 21771; for (int i = 0; i < levels; i++) { - byte *map = noiseMaps[i]; + BYTE *map = noiseMaps[i]; int pp = 0; for (int zp = 0; zp < zSize; zp++) diff --git a/Minecraft.World/FastNoise.h b/Minecraft.World/FastNoise.h index f41c32e8..d8b4005c 100644 --- a/Minecraft.World/FastNoise.h +++ b/Minecraft.World/FastNoise.h @@ -3,7 +3,7 @@ class FastNoise { private: - byte **noiseMaps; + BYTE **noiseMaps; int levels; public: diff --git a/Minecraft.World/FileInputStream.cpp b/Minecraft.World/FileInputStream.cpp index 7c34a22f..f437dab8 100644 --- a/Minecraft.World/FileInputStream.cpp +++ b/Minecraft.World/FileInputStream.cpp @@ -55,12 +55,12 @@ FileInputStream::~FileInputStream() CloseHandle( m_fileHandle ); } -//Reads a byte of data from this input stream. This method blocks if no input is yet available. +//Reads a BYTE of data from this input stream. This method blocks if no input is yet available. //Returns: -//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() { - byte byteRead = 0; + BYTE byteRead = 0; DWORD numberOfBytesRead; BOOL bSuccess = ReadFile( diff --git a/Minecraft.World/FileOutputStream.cpp b/Minecraft.World/FileOutputStream.cpp index 58a0ecd9..f3ed728a 100644 --- a/Minecraft.World/FileOutputStream.cpp +++ b/Minecraft.World/FileOutputStream.cpp @@ -54,14 +54,14 @@ FileOutputStream::~FileOutputStream() CloseHandle( m_fileHandle ); } -//Writes the specified byte to this file output stream. Implements the write method of OutputStream. +//Writes the specified BYTE to this file output stream. Implements the write method of OutputStream. //Parameters: -//b - the byte to be written. +//b - the BYTE to be written. void FileOutputStream::write(unsigned int b) { DWORD numberOfBytesWritten; - byte value = static_cast(b); + BYTE value = static_cast(b); BOOL result = WriteFile( m_fileHandle, // handle to file @@ -81,7 +81,7 @@ void FileOutputStream::write(unsigned int b) } } -//Writes b.length bytes from the specified byte array to this file output stream. +//Writes b.length bytes from the specified BYTE array to this file output stream. //Parameters: //b - the data. void FileOutputStream::write(byteArray b) @@ -106,7 +106,7 @@ void FileOutputStream::write(byteArray b) } } -//Writes len bytes from the specified byte array starting at offset off to this file output stream. +//Writes len bytes from the specified BYTE array starting at offset off to this file output stream. //Parameters: //b - the data. //off - the start offset in the data. diff --git a/Minecraft.World/Fireball.cpp b/Minecraft.World/Fireball.cpp index b520f436..0ad2f60b 100644 --- a/Minecraft.World/Fireball.cpp +++ b/Minecraft.World/Fireball.cpp @@ -300,8 +300,8 @@ void Fireball::addAdditonalSaveData(CompoundTag *tag) tag->putShort(L"xTile", static_cast(xTile)); tag->putShort(L"yTile", static_cast(yTile)); tag->putShort(L"zTile", static_cast(zTile)); - tag->putByte(L"inTile", static_cast(lastTile)); - tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); + tag->putByte(L"inTile", static_cast(lastTile)); + tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); tag->put(L"direction", newDoubleList(3, xd, yd, zd)); } diff --git a/Minecraft.World/FireworksChargeItem.cpp b/Minecraft.World/FireworksChargeItem.cpp index 8b12c98c..5eec4533 100644 --- a/Minecraft.World/FireworksChargeItem.cpp +++ b/Minecraft.World/FireworksChargeItem.cpp @@ -110,7 +110,7 @@ const unsigned int FIREWORKS_CHARGE_COLOUR_NAME[] = void FireworksChargeItem::appendHoverText(CompoundTag *expTag, vector *lines) { // shape - byte type = expTag->getByte(FireworksItem::TAG_E_TYPE); + BYTE type = expTag->getByte(FireworksItem::TAG_E_TYPE); if (type >= FireworksItem::TYPE_MIN && type <= FireworksItem::TYPE_MAX) { lines->push_back(HtmlString(app.GetString(FIREWORKS_CHARGE_TYPE_NAME[type]))); diff --git a/Minecraft.World/FireworksItem.h b/Minecraft.World/FireworksItem.h index afc6cb59..05664200 100644 --- a/Minecraft.World/FireworksItem.h +++ b/Minecraft.World/FireworksItem.h @@ -15,14 +15,14 @@ public: static const wstring TAG_E_COLORS; static const wstring TAG_E_FADECOLORS; - static const byte TYPE_SMALL = 0; - static const byte TYPE_BIG = 1; - static const byte TYPE_STAR = 2; - static const byte TYPE_CREEPER = 3; - static const byte TYPE_BURST = 4; + static const BYTE TYPE_SMALL = 0; + static const BYTE TYPE_BIG = 1; + static const BYTE TYPE_STAR = 2; + static const BYTE TYPE_CREEPER = 3; + static const BYTE TYPE_BURST = 4; - static const byte TYPE_MIN = TYPE_SMALL; - static const byte TYPE_MAX = TYPE_BURST; + static const BYTE TYPE_MIN = TYPE_SMALL; + static const BYTE TYPE_MAX = TYPE_BURST; FireworksItem(int id); diff --git a/Minecraft.World/FireworksRecipe.cpp b/Minecraft.World/FireworksRecipe.cpp index c4a9ca80..7a79ab52 100644 --- a/Minecraft.World/FireworksRecipe.cpp +++ b/Minecraft.World/FireworksRecipe.cpp @@ -144,7 +144,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l } fireTag->put(FireworksItem::TAG_EXPLOSIONS, expTags); - fireTag->putByte(FireworksItem::TAG_FLIGHT, static_cast(sulphurCount)); + fireTag->putByte(FireworksItem::TAG_FLIGHT, static_cast(sulphurCount)); itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag); resultItem->setTag(itemTag); @@ -160,7 +160,7 @@ bool FireworksRecipe::matches(shared_ptr craftSlots, Level *l CompoundTag *itemTag = new CompoundTag(); CompoundTag *expTag = new CompoundTag(FireworksItem::TAG_EXPLOSION); - byte type = 0; + BYTE type = 0; vector colors; for (int slot = 0; slot < craftSlots->getContainerSize(); slot++) diff --git a/Minecraft.World/FireworksRocketEntity.cpp b/Minecraft.World/FireworksRocketEntity.cpp index d3897e4f..45daa2ca 100644 --- a/Minecraft.World/FireworksRocketEntity.cpp +++ b/Minecraft.World/FireworksRocketEntity.cpp @@ -115,7 +115,7 @@ void FireworksRocketEntity::tick() } } -void FireworksRocketEntity::handleEntityEvent(byte eventId) +void FireworksRocketEntity::handleEntityEvent(BYTE eventId) { if (eventId == EntityEvent::FIREWORKS_EXPLODE && level->isClientSide) { diff --git a/Minecraft.World/FireworksRocketEntity.h b/Minecraft.World/FireworksRocketEntity.h index 025a2778..6fc2fc37 100644 --- a/Minecraft.World/FireworksRocketEntity.h +++ b/Minecraft.World/FireworksRocketEntity.h @@ -28,7 +28,7 @@ public: virtual void lerpMotion(double xd, double yd, double zd); virtual void tick(); - virtual void handleEntityEvent(byte eventId); + virtual void handleEntityEvent(BYTE eventId); virtual void addAdditonalSaveData(CompoundTag *tag); virtual void readAdditionalSaveData(CompoundTag *tag); virtual float getShadowHeightOffs(); diff --git a/Minecraft.World/FishingHook.cpp b/Minecraft.World/FishingHook.cpp index ba0876d9..6c425ca0 100644 --- a/Minecraft.World/FishingHook.cpp +++ b/Minecraft.World/FishingHook.cpp @@ -380,9 +380,9 @@ void FishingHook::addAdditonalSaveData(CompoundTag *tag) tag->putShort(L"xTile", static_cast(xTile)); tag->putShort(L"yTile", static_cast(yTile)); tag->putShort(L"zTile", static_cast(zTile)); - tag->putByte(L"inTile", static_cast(lastTile)); - tag->putByte(L"shake", static_cast(shakeTime)); - tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); + tag->putByte(L"inTile", static_cast(lastTile)); + tag->putByte(L"shake", static_cast(shakeTime)); + tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); } void FishingHook::readAdditionalSaveData(CompoundTag *tag) diff --git a/Minecraft.World/FlatLevelSource.cpp b/Minecraft.World/FlatLevelSource.cpp index 9ea1ed36..855cd51e 100644 --- a/Minecraft.World/FlatLevelSource.cpp +++ b/Minecraft.World/FlatLevelSource.cpp @@ -55,7 +55,7 @@ void FlatLevelSource::prepareHeights(byteArray blocks) { block = Tile::grass_Id; } - blocks[xc << 11 | zc << 7 | yc] = static_cast(block); + blocks[xc << 11 | zc << 7 | yc] = static_cast(block); } } } @@ -70,7 +70,7 @@ LevelChunk *FlatLevelSource::getChunk(int xOffs, int zOffs) { // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int chunksSize = Level::genDepth * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + BYTE *tileData = static_cast(XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,chunksSize); byteArray blocks = byteArray(tileData,chunksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/FloatTag.h b/Minecraft.World/FloatTag.h index cc687da8..4aed70bc 100644 --- a/Minecraft.World/FloatTag.h +++ b/Minecraft.World/FloatTag.h @@ -12,7 +12,7 @@ public: void write(DataOutput *dos) { dos->writeFloat(data); } void load(DataInput *dis, int tagDepth) { data = dis->readFloat(); } - byte getId() { return TAG_Float; } + BYTE getId() { return TAG_Float; } wstring toString() { static wchar_t buf[32]; diff --git a/Minecraft.World/FurnaceTileEntity.cpp b/Minecraft.World/FurnaceTileEntity.cpp index 901235c0..05b43a5a 100644 --- a/Minecraft.World/FurnaceTileEntity.cpp +++ b/Minecraft.World/FurnaceTileEntity.cpp @@ -149,7 +149,7 @@ void FurnaceTileEntity::save(CompoundTag *base) if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } diff --git a/Minecraft.World/Ghast.cpp b/Minecraft.World/Ghast.cpp index 738a42da..3d8b54bf 100644 --- a/Minecraft.World/Ghast.cpp +++ b/Minecraft.World/Ghast.cpp @@ -72,7 +72,7 @@ void Ghast::defineSynchedData() { FlyingMob::defineSynchedData(); - entityData->define(DATA_IS_CHARGING, static_cast(0)); + entityData->define(DATA_IS_CHARGING, static_cast(0)); } void Ghast::registerAttributes() @@ -175,8 +175,8 @@ void Ghast::serverAiStep() if (!level->isClientSide) { - byte old = entityData->getByte(DATA_IS_CHARGING); - byte current = static_cast(charge > 10 ? 1 : 0); + BYTE old = entityData->getByte(DATA_IS_CHARGING); + BYTE current = static_cast(charge > 10 ? 1 : 0); if (old != current) { entityData->set(DATA_IS_CHARGING, current); diff --git a/Minecraft.World/HangingEntity.cpp b/Minecraft.World/HangingEntity.cpp index 1fdab534..42a8d2d1 100644 --- a/Minecraft.World/HangingEntity.cpp +++ b/Minecraft.World/HangingEntity.cpp @@ -262,7 +262,7 @@ void HangingEntity::push(double xa, double ya, double za) void HangingEntity::addAdditonalSaveData(CompoundTag *tag) { - tag->putByte(L"Direction", static_cast(dir)); + tag->putByte(L"Direction", static_cast(dir)); tag->putInt(L"TileX", xTile); tag->putInt(L"TileY", yTile); tag->putInt(L"TileZ", zTile); @@ -271,16 +271,16 @@ void HangingEntity::addAdditonalSaveData(CompoundTag *tag) switch (dir) { case Direction::NORTH: - tag->putByte(L"Dir", (byte) 0); + tag->putByte(L"Dir", (BYTE) 0); break; case Direction::WEST: - tag->putByte(L"Dir", (byte) 1); + tag->putByte(L"Dir", (BYTE) 1); break; case Direction::SOUTH: - tag->putByte(L"Dir", (byte) 2); + tag->putByte(L"Dir", (BYTE) 2); break; case Direction::EAST: - tag->putByte(L"Dir", (byte) 3); + tag->putByte(L"Dir", (BYTE) 3); break; } } diff --git a/Minecraft.World/HellDimension.cpp b/Minecraft.World/HellDimension.cpp index a765fd6f..a8b70d03 100644 --- a/Minecraft.World/HellDimension.cpp +++ b/Minecraft.World/HellDimension.cpp @@ -19,9 +19,9 @@ void HellDimension::init() Vec3 *HellDimension::getFogColor(float td, float a) const { int colour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Nether_Fog_Colour ); - byte redComponent = ((colour>>16)&0xFF); - byte greenComponent = ((colour>>8)&0xFF); - byte blueComponent = ((colour)&0xFF); + BYTE redComponent = ((colour>>16)&0xFF); + BYTE greenComponent = ((colour>>8)&0xFF); + BYTE blueComponent = ((colour)&0xFF); float rr = static_cast(redComponent)/256;//0.2f; float gg = static_cast(greenComponent)/256;//0.03f; diff --git a/Minecraft.World/HellFlatLevelSource.cpp b/Minecraft.World/HellFlatLevelSource.cpp index c4ba062c..141aabcb 100644 --- a/Minecraft.World/HellFlatLevelSource.cpp +++ b/Minecraft.World/HellFlatLevelSource.cpp @@ -38,7 +38,7 @@ void HellFlatLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) block = Tile::netherRack_Id; } - blocks[xc << 11 | zc << 7 | yc] = static_cast(block); + blocks[xc << 11 | zc << 7 | yc] = static_cast(block); } } } @@ -60,7 +60,7 @@ void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks) { if( z - random->nextInt( 4 ) <= 0 || xOffs < -(m_XZSize/2) ) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); blockSet = true; } } @@ -68,7 +68,7 @@ void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks) { if( x - random->nextInt( 4 ) <= 0 || zOffs < -(m_XZSize/2)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); blockSet = true; } } @@ -76,7 +76,7 @@ void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks) { if( z + random->nextInt(4) >= 15 || xOffs > (m_XZSize/2)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); blockSet = true; } } @@ -84,7 +84,7 @@ void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks) { if( x + random->nextInt(4) >= 15 || zOffs > (m_XZSize/2) ) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); blockSet = true; } } @@ -93,11 +93,11 @@ void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks) if (y >= Level::genDepthMinusOne - random->nextInt(5)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); } else if (y <= 0 + random->nextInt(5)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); } } } @@ -115,7 +115,7 @@ LevelChunk *HellFlatLevelSource::getChunk(int xOffs, int zOffs) // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int chunksSize = Level::genDepth * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + BYTE *tileData = static_cast(XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,chunksSize); byteArray blocks = byteArray(tileData,chunksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/HellRandomLevelSource.cpp b/Minecraft.World/HellRandomLevelSource.cpp index 26127dde..c3f82798 100644 --- a/Minecraft.World/HellRandomLevelSource.cpp +++ b/Minecraft.World/HellRandomLevelSource.cpp @@ -104,7 +104,7 @@ void HellRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray block tileId = Tile::netherRack_Id; } - blocks[offs] = static_cast(tileId); + blocks[offs] = static_cast(tileId); offs += step; val += vala; } @@ -147,8 +147,8 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks int run = -1; - byte top = (byte) Tile::netherRack_Id; - byte material = (byte) Tile::netherRack_Id; + BYTE top = (BYTE) Tile::netherRack_Id; + BYTE material = (BYTE) Tile::netherRack_Id; for (int y = Level::genDepthMinusOne; y >= 0; y--) { @@ -160,7 +160,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks { if( z - random->nextInt( 4 ) <= 0 || xOffs < -(m_XZSize/2) ) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); blockSet = true; } } @@ -168,7 +168,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks { if( x - random->nextInt( 4 ) <= 0 || zOffs < -(m_XZSize/2)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); blockSet = true; } } @@ -176,7 +176,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks { if( z + random->nextInt(4) >= 15 || xOffs > (m_XZSize/2)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); blockSet = true; } } @@ -184,7 +184,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks { if( x + random->nextInt(4) >= 15 || zOffs > (m_XZSize/2) ) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); blockSet = true; } } @@ -193,7 +193,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks if (y >= Level::genDepthMinusOne - random->nextInt(5) || y <= 0 + random->nextInt(5)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); } else { @@ -210,20 +210,20 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks if (runDepth <= 0) { top = 0; - material = static_cast(Tile::netherRack_Id); + material = static_cast(Tile::netherRack_Id); } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { - top = static_cast(Tile::netherRack_Id); - material = static_cast(Tile::netherRack_Id); - if (gravel) top = static_cast(Tile::gravel_Id); - if (gravel) material = static_cast(Tile::netherRack_Id); + top = static_cast(Tile::netherRack_Id); + material = static_cast(Tile::netherRack_Id); + if (gravel) top = static_cast(Tile::gravel_Id); + if (gravel) material = static_cast(Tile::netherRack_Id); if (sand) { // 4J Stu - Make some nether wart spawn outside of the nether fortresses if(random->nextInt(16) == 0) { - top = static_cast(Tile::netherStalk_Id); + top = static_cast(Tile::netherStalk_Id); // Place the nether wart on top of the soul sand y += 1; @@ -234,13 +234,13 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks } else { - top = static_cast(Tile::soulsand_Id); + top = static_cast(Tile::soulsand_Id); } } - if (sand) material = static_cast(Tile::soulsand_Id); + if (sand) material = static_cast(Tile::soulsand_Id); } - if (y < waterHeight && top == 0) top = static_cast(Tile::calmLava_Id); + if (y < waterHeight && top == 0) top = static_cast(Tile::calmLava_Id); run = runDepth; // 4J Stu - If sand, then allow adding nether wart at heights below the water level @@ -273,7 +273,7 @@ LevelChunk *HellRandomLevelSource::getChunk(int xOffs, int zOffs) // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int blocksSize = Level::genDepth * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + BYTE *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/HopperTileEntity.cpp b/Minecraft.World/HopperTileEntity.cpp index e44232dc..dffe107b 100644 --- a/Minecraft.World/HopperTileEntity.cpp +++ b/Minecraft.World/HopperTileEntity.cpp @@ -49,7 +49,7 @@ void HopperTileEntity::save(CompoundTag *base) if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } diff --git a/Minecraft.World/IntArrayTag.h b/Minecraft.World/IntArrayTag.h index 64a4d004..6a4f1113 100644 --- a/Minecraft.World/IntArrayTag.h +++ b/Minecraft.World/IntArrayTag.h @@ -46,7 +46,7 @@ public: } } - byte getId() { return TAG_Int_Array; } + BYTE getId() { return TAG_Int_Array; } wstring toString() { diff --git a/Minecraft.World/IntTag.h b/Minecraft.World/IntTag.h index 1f55c5f2..47d78eba 100644 --- a/Minecraft.World/IntTag.h +++ b/Minecraft.World/IntTag.h @@ -11,7 +11,7 @@ public: void write(DataOutput *dos) { dos->writeInt(data); } void load(DataInput *dis, int tagDepth) { data = dis->readInt(); } - byte getId() { return TAG_Int; } + BYTE getId() { return TAG_Int; } wstring toString() { static wchar_t buf[32]; diff --git a/Minecraft.World/Inventory.cpp b/Minecraft.World/Inventory.cpp index ad0fc3ec..558483d2 100644 --- a/Minecraft.World/Inventory.cpp +++ b/Minecraft.World/Inventory.cpp @@ -515,7 +515,7 @@ ListTag *Inventory::save(ListTag *listTag) if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } @@ -525,7 +525,7 @@ ListTag *Inventory::save(ListTag *listTag) if (armor[i] != nullptr) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i + 100)); + tag->putByte(L"Slot", static_cast(i + 100)); armor[i]->save(tag); listTag->add(tag); } diff --git a/Minecraft.World/ItemEntity.cpp b/Minecraft.World/ItemEntity.cpp index 5dc1db6e..a2c6c1e7 100644 --- a/Minecraft.World/ItemEntity.cpp +++ b/Minecraft.World/ItemEntity.cpp @@ -204,7 +204,7 @@ bool ItemEntity::hurt(DamageSource *source, float damage) void ItemEntity::addAdditonalSaveData(CompoundTag *entityTag) { - entityTag->putShort(L"Health", static_cast(health)); + entityTag->putShort(L"Health", static_cast(health)); entityTag->putShort(L"Age", static_cast(age)); if (getItem() != nullptr) entityTag->putCompound(L"Item", getItem()->save(new CompoundTag())); } diff --git a/Minecraft.World/ItemFrame.cpp b/Minecraft.World/ItemFrame.cpp index f5988b9f..8f47279a 100644 --- a/Minecraft.World/ItemFrame.cpp +++ b/Minecraft.World/ItemFrame.cpp @@ -38,7 +38,7 @@ ItemFrame::ItemFrame(Level *level, int xTile, int yTile, int zTile, int dir) : H void ItemFrame::defineSynchedData() { getEntityData()->defineNULL(DATA_ITEM, nullptr); - getEntityData()->define(DATA_ROTATION, static_cast(0)); + getEntityData()->define(DATA_ROTATION, static_cast(0)); } bool ItemFrame::shouldRenderAtSqrDistance(double distance) @@ -107,7 +107,7 @@ int ItemFrame::getRotation() void ItemFrame::setRotation(int rotation) { - getEntityData()->set(DATA_ROTATION, static_cast(rotation % 4)); + getEntityData()->set(DATA_ROTATION, static_cast(rotation % 4)); } void ItemFrame::addAdditonalSaveData(CompoundTag *tag) @@ -115,7 +115,7 @@ void ItemFrame::addAdditonalSaveData(CompoundTag *tag) if (getItem() != nullptr) { tag->putCompound(L"Item", getItem()->save(new CompoundTag())); - tag->putByte(L"ItemRotation", static_cast(getRotation())); + tag->putByte(L"ItemRotation", static_cast(getRotation())); tag->putFloat(L"ItemDropChance", dropChance); } HangingEntity::addAdditonalSaveData(tag); diff --git a/Minecraft.World/ItemInstance.cpp b/Minecraft.World/ItemInstance.cpp index 9b64c041..97128707 100644 --- a/Minecraft.World/ItemInstance.cpp +++ b/Minecraft.World/ItemInstance.cpp @@ -146,7 +146,7 @@ shared_ptr ItemInstance::useTimeDepleted(Level *level, shared_ptr< CompoundTag *ItemInstance::save(CompoundTag *compoundTag) { compoundTag->putShort(L"id", static_cast(id)); - compoundTag->putByte(L"Count", static_cast(count)); + compoundTag->putByte(L"Count", static_cast(count)); compoundTag->putShort(L"Damage", static_cast(auxValue)); if (tag != nullptr) compoundTag->put(L"tag", tag->copy()); return compoundTag; @@ -729,7 +729,7 @@ void ItemInstance::enchant(const Enchantment *enchantment, int level) ListTag *list = static_cast *>(tag->get(L"ench")); CompoundTag *ench = new CompoundTag(); ench->putShort((wchar_t *)TAG_ENCH_ID, static_cast(enchantment->id)); - ench->putShort((wchar_t *)TAG_ENCH_LEVEL, static_cast(level)); + ench->putShort((wchar_t *)TAG_ENCH_LEVEL, static_cast(level)); list->add(ench); } diff --git a/Minecraft.World/LargeCaveFeature.cpp b/Minecraft.World/LargeCaveFeature.cpp index c70f1156..8e4205d0 100644 --- a/Minecraft.World/LargeCaveFeature.cpp +++ b/Minecraft.World/LargeCaveFeature.cpp @@ -144,12 +144,12 @@ void LargeCaveFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArray b { if (yy < 10) { - blocks[p] = static_cast(Tile::lava_Id); + blocks[p] = static_cast(Tile::lava_Id); } else { - blocks[p] = static_cast(0); - if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = (byte) level->getBiome(xx + xOffs * 16, zz + zOffs * 16)->topMaterial; + blocks[p] = static_cast(0); + if (hasGrass && blocks[p - 1] == Tile::dirt_Id) blocks[p - 1] = (BYTE) level->getBiome(xx + xOffs * 16, zz + zOffs * 16)->topMaterial; } } } diff --git a/Minecraft.World/LargeHellCaveFeature.cpp b/Minecraft.World/LargeHellCaveFeature.cpp index 9472c855..3d0bf227 100644 --- a/Minecraft.World/LargeHellCaveFeature.cpp +++ b/Minecraft.World/LargeHellCaveFeature.cpp @@ -138,7 +138,7 @@ void LargeHellCaveFeature::addTunnel(int64_t seed, int xOffs, int zOffs, byteArr int block = blocks[p]; if (block == Tile::netherRack_Id || block == Tile::dirt_Id || block == Tile::grass_Id) { - blocks[p] = static_cast(0); + blocks[p] = static_cast(0); } } p--; diff --git a/Minecraft.World/Level.cpp b/Minecraft.World/Level.cpp index 161f4e56..290f26bf 100644 --- a/Minecraft.World/Level.cpp +++ b/Minecraft.World/Level.cpp @@ -90,7 +90,7 @@ DWORD Level::tlsIdxLightCache = TlsAlloc(); void Level::enableLightingCache() { - // Allocate 16K (needs 32K for large worlds) for a 16x16x16x4 byte cache of results, plus 128K required for toCheck array. Rounding up to 256 to keep as multiple of alignement - aligning to 128K boundary for possible cache locking. + // Allocate 16K (needs 32K for large worlds) for a 16x16x16x4 BYTE cache of results, plus 128K required for toCheck array. Rounding up to 256 to keep as multiple of alignement - aligning to 128K boundary for possible cache locking. void *cache = static_cast(XPhysicalAlloc(256 * 1024, MAXULONG_PTR, 128 * 1024, PAGE_READWRITE | MEM_LARGE_PAGES)); TlsSetValue(tlsIdxLightCache,cache); } @@ -4380,7 +4380,7 @@ bool Level::mayInteract(shared_ptr player, int xt, int yt, int zt, int c } -void Level::broadcastEntityEvent(shared_ptr e, byte event) +void Level::broadcastEntityEvent(shared_ptr e, BYTE event) { } diff --git a/Minecraft.World/Level.h b/Minecraft.World/Level.h index b56aebf6..cd84c71e 100644 --- a/Minecraft.World/Level.h +++ b/Minecraft.World/Level.h @@ -480,7 +480,7 @@ public: void setSpawnPos(Pos *spawnPos); void ensureAdded(shared_ptr entity); virtual bool mayInteract(shared_ptr player, int xt, int yt, int zt, int content); - virtual void broadcastEntityEvent(shared_ptr e, byte event); + virtual void broadcastEntityEvent(shared_ptr e, BYTE event); ChunkSource *getChunkSource(); virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1); LevelStorage *getLevelStorage(); diff --git a/Minecraft.World/LevelChunk.cpp b/Minecraft.World/LevelChunk.cpp index 584e3df1..c7c4aa94 100644 --- a/Minecraft.World/LevelChunk.cpp +++ b/Minecraft.World/LevelChunk.cpp @@ -531,7 +531,7 @@ void LevelChunk::recalcHeightmapOnly() blocks = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT?upperBlocks : lowerBlocks; } #endif - heightmap[z << 4 | x] = static_cast(y); + heightmap[z << 4 | x] = static_cast(y); if (y < min) min = y; } @@ -588,7 +588,7 @@ void LevelChunk::recalcHeightmap() blocks = (y-1) >= Level::COMPRESSED_CHUNK_SECTION_HEIGHT?upperBlocks : lowerBlocks; } #endif - heightmap[z << 4 | x] = static_cast(y); + heightmap[z << 4 | x] = static_cast(y); if (y < min) min = y; if (y < lowestHeightmap) lowestHeightmap = y; @@ -811,7 +811,7 @@ void LevelChunk::recalcHeight(int x, int yStart, int z) if (y == yOld) return; // level->lightColumnChanged(x, z, y, yOld); // 4J - this call moved below & corrected - see comment further down - heightmap[z << 4 | x] = static_cast(y); + heightmap[z << 4 | x] = static_cast(y); if (y < minHeight) { @@ -919,7 +919,7 @@ int LevelChunk::getTile(int x, int y, int z) bool LevelChunk::setTileAndData(int x, int y, int z, int _tile, int _data) { - byte tile = static_cast(_tile); + BYTE tile = static_cast(_tile); // Optimisation brought forward from 1.8.2, change from int to unsigned char & this special value changed from -999 to 255 int slot = z << 4 | x; @@ -2072,7 +2072,7 @@ void LevelChunk::reloadBiomes() for(unsigned int z = 0; z < 16; ++z) { Biome *biome = biomeSource->getBiome((this->x << 4) + x, (this->z << 4) + z); - biomes[(z << 4) | x] = static_cast((biome->id) & 0xff); + biomes[(z << 4) | x] = static_cast((biome->id) & 0xff); } } } @@ -2084,7 +2084,7 @@ Biome *LevelChunk::getBiome(int x, int z, BiomeSource *biomeSource) { Biome *biome = biomeSource->getBiome((this->x << 4) + x, (this->z << 4) + z); value = biome->id; - biomes[(z << 4) | x] = static_cast(value & 0xff); + biomes[(z << 4) | x] = static_cast(value & 0xff); } if (Biome::biomes[value] == nullptr) { @@ -2171,14 +2171,14 @@ void LevelChunk::updateBiomeFlags(int x, int z) } } -// Get a byte array of length 16384 ( 128 x 16 x 16 x 0.5 ), containing data. Ordering same as java version if originalOrder set; +// Get a BYTE array of length 16384 ( 128 x 16 x 16 x 0.5 ), containing data. Ordering same as java version if originalOrder set; void LevelChunk::getDataData(byteArray data) { lowerData->getData(data,0); if(data.length > Level::COMPRESSED_CHUNK_SECTION_TILES/2) upperData->getData(data,Level::COMPRESSED_CHUNK_SECTION_TILES/2); } -// Set data to data passed in input byte array of length 16384. This data must be in original (java version) order if originalOrder set. +// Set data to data passed in input BYTE array of length 16384. This data must be in original (java version) order if originalOrder set. void LevelChunk::setDataData(byteArray data) { if( lowerData == nullptr ) lowerData = new SparseDataStorage(); @@ -2187,21 +2187,21 @@ void LevelChunk::setDataData(byteArray data) if(data.length > Level::COMPRESSED_CHUNK_SECTION_TILES/2) upperData->setData(data,Level::COMPRESSED_CHUNK_SECTION_TILES/2); } -// Get a byte array of length 16384 ( 128 x 16 x 16 x 0.5 ), containing sky light data. Ordering same as java version if originalOrder set; +// Get a BYTE array of length 16384 ( 128 x 16 x 16 x 0.5 ), containing sky light data. Ordering same as java version if originalOrder set; void LevelChunk::getSkyLightData(byteArray data) { lowerSkyLight->getData(data,0); if(data.length > Level::COMPRESSED_CHUNK_SECTION_TILES/2) upperSkyLight->getData(data,Level::COMPRESSED_CHUNK_SECTION_TILES/2); } -// Get a byte array of length 16384 ( 128 x 16 x 16 x 0.5 ), containing block light data. Ordering same as java version if originalOrder set; +// Get a BYTE array of length 16384 ( 128 x 16 x 16 x 0.5 ), containing block light data. Ordering same as java version if originalOrder set; void LevelChunk::getBlockLightData(byteArray data) { lowerBlockLight->getData(data,0); if(data.length > Level::COMPRESSED_CHUNK_SECTION_TILES/2) upperBlockLight->getData(data,Level::COMPRESSED_CHUNK_SECTION_TILES/2); } -// Set sky light data to data passed in input byte array of length 16384. This data must be in original (java version) order if originalOrder set. +// Set sky light data to data passed in input BYTE array of length 16384. This data must be in original (java version) order if originalOrder set. void LevelChunk::setSkyLightData(byteArray data) { if( lowerSkyLight == nullptr ) lowerSkyLight = new SparseLightStorage(true); @@ -2210,7 +2210,7 @@ void LevelChunk::setSkyLightData(byteArray data) if(data.length > Level::COMPRESSED_CHUNK_SECTION_TILES/2) upperSkyLight->setData(data,Level::COMPRESSED_CHUNK_SECTION_TILES/2); } -// Set block light data to data passed in input byte array of length 16384. This data must be in original (java version) order if originalOrder set. +// Set block light data to data passed in input BYTE array of length 16384. This data must be in original (java version) order if originalOrder set. void LevelChunk::setBlockLightData(byteArray data) { if( lowerBlockLight == nullptr ) lowerBlockLight = new SparseLightStorage(false); diff --git a/Minecraft.World/LevelChunk.h b/Minecraft.World/LevelChunk.h index bd2b3b91..db8180c6 100644 --- a/Minecraft.World/LevelChunk.h +++ b/Minecraft.World/LevelChunk.h @@ -75,10 +75,10 @@ private: SparseLightStorage *lowerBlockLight; // 0 - 127 SparseLightStorage *upperBlockLight; // 128 - 255 public: - void getSkyLightData(byteArray data); // Get a byte array of length 16384 ( 128 x 16 x 16 x 0.5 ), containing sky light data. Ordering same as java version. - void getBlockLightData(byteArray data); // Get a byte array of length 16384 ( 128 x 16 x 16 x 0.5 ), containing block light data. Ordering same as java version. - void setSkyLightData(byteArray data); // Set sky light data to data passed in input byte array of length 16384. This data must be in original (java version) order - void setBlockLightData(byteArray data); // Set block light data to data passed in input byte array of length 16384. This data must be in original (java version) order + void getSkyLightData(byteArray data); // Get a BYTE array of length 16384 ( 128 x 16 x 16 x 0.5 ), containing sky light data. Ordering same as java version. + void getBlockLightData(byteArray data); // Get a BYTE array of length 16384 ( 128 x 16 x 16 x 0.5 ), containing block light data. Ordering same as java version. + void setSkyLightData(byteArray data); // Set sky light data to data passed in input BYTE array of length 16384. This data must be in original (java version) order + void setBlockLightData(byteArray data); // Set block light data to data passed in input BYTE array of length 16384. This data must be in original (java version) order void setSkyLightDataAllBright(); // Set sky light data to be all fully lit bool isLowerBlockStorageCompressed(); int isLowerBlockLightStorageCompressed(); diff --git a/Minecraft.World/ListTag.h b/Minecraft.World/ListTag.h index f6e1c6a0..f9a3a196 100644 --- a/Minecraft.World/ListTag.h +++ b/Minecraft.World/ListTag.h @@ -6,7 +6,7 @@ template class ListTag : public Tag { private: vector list; - byte type; + BYTE type; public: ListTag() : Tag(L"") {} @@ -41,7 +41,7 @@ public: } } - byte getId() { return TAG_List; } + BYTE getId() { return TAG_List; } wstring toString() { diff --git a/Minecraft.World/LivingEntity.cpp b/Minecraft.World/LivingEntity.cpp index 47f9edaa..aec15aa4 100644 --- a/Minecraft.World/LivingEntity.cpp +++ b/Minecraft.World/LivingEntity.cpp @@ -132,8 +132,8 @@ LivingEntity::~LivingEntity() void LivingEntity::defineSynchedData() { entityData->define(DATA_EFFECT_COLOR_ID, 0); - entityData->define(DATA_EFFECT_AMBIENCE_ID, static_cast(0)); - entityData->define(DATA_ARROW_COUNT_ID, static_cast(0)); + entityData->define(DATA_EFFECT_AMBIENCE_ID, static_cast(0)); + entityData->define(DATA_ARROW_COUNT_ID, static_cast(0)); entityData->define(DATA_HEALTH_ID, 1.0f); } @@ -519,7 +519,7 @@ void LivingEntity::tickEffects() { if (activeEffects.empty()) { - entityData->set(DATA_EFFECT_AMBIENCE_ID, static_cast(0)); + entityData->set(DATA_EFFECT_AMBIENCE_ID, static_cast(0)); entityData->set(DATA_EFFECT_COLOR_ID, 0); setInvisible(false); setWeakened(false); @@ -532,7 +532,7 @@ void LivingEntity::tickEffects() values.push_back(it.second); } int colorValue = PotionBrewing::getColorValue(&values); - entityData->set(DATA_EFFECT_AMBIENCE_ID, PotionBrewing::areAllEffectsAmbient(&values) ? static_cast(1) : static_cast(0)); + entityData->set(DATA_EFFECT_AMBIENCE_ID, PotionBrewing::areAllEffectsAmbient(&values) ? static_cast(1) : static_cast(0)); values.clear(); entityData->set(DATA_EFFECT_COLOR_ID, colorValue); setInvisible(hasEffect(MobEffect::invisibility->id)); @@ -1156,7 +1156,7 @@ int LivingEntity::getArrowCount() void LivingEntity::setArrowCount(int count) { - entityData->set(DATA_ARROW_COUNT_ID, static_cast(count)); + entityData->set(DATA_ARROW_COUNT_ID, static_cast(count)); } int LivingEntity::getCurrentSwingDuration() @@ -1186,7 +1186,7 @@ void LivingEntity::swing() } } -void LivingEntity::handleEntityEvent(byte id) +void LivingEntity::handleEntityEvent(BYTE id) { if (id == EntityEvent::HURT) { diff --git a/Minecraft.World/LivingEntity.h b/Minecraft.World/LivingEntity.h index ecc819df..3db1b3f5 100644 --- a/Minecraft.World/LivingEntity.h +++ b/Minecraft.World/LivingEntity.h @@ -218,7 +218,7 @@ private: public: virtual void swing(); - virtual void handleEntityEvent(byte id); + virtual void handleEntityEvent(BYTE id); protected: virtual void outOfWorld(); diff --git a/Minecraft.World/LongTag.h b/Minecraft.World/LongTag.h index 36ed4de9..0da2d074 100644 --- a/Minecraft.World/LongTag.h +++ b/Minecraft.World/LongTag.h @@ -11,7 +11,7 @@ public: void write(DataOutput *dos) { dos->writeLong(data); } void load(DataInput *dis, int tagDepth) { data = dis->readLong(); } - byte getId() { return TAG_Long; } + BYTE getId() { return TAG_Long; } wstring toString() { static wchar_t buf[32]; diff --git a/Minecraft.World/MapItem.cpp b/Minecraft.World/MapItem.cpp index 61c203e3..b7f521b8 100644 --- a/Minecraft.World/MapItem.cpp +++ b/Minecraft.World/MapItem.cpp @@ -74,7 +74,7 @@ shared_ptr MapItem::getSavedData(shared_ptr item mapItemSavedData->x = Math::round(static_cast(level->getLevelData()->getXSpawn()) / scale) * scale; mapItemSavedData->z = Math::round(level->getLevelData()->getZSpawn() / scale) * scale; #endif - mapItemSavedData->dimension = static_cast(level->dimension->id); + mapItemSavedData->dimension = static_cast(level->dimension->id); mapItemSavedData->setDirty(); @@ -236,8 +236,8 @@ void MapItem::update(Level *level, shared_ptr player, shared_ptrcolors[x + z * w]; - byte newColor = static_cast(col * 4 + br); + BYTE oldColor = data->colors[x + z * w]; + BYTE newColor = static_cast(col * 4 + br); if (oldColor != newColor) { if (yd0 > z) yd0 = z; @@ -335,7 +335,7 @@ void MapItem::onCraftedBy(shared_ptr itemInstance, Level *level, s // 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->z = centreZC; - data->dimension = static_cast(level->dimension->id); + data->dimension = static_cast(level->dimension->id); data->setDirty(); } diff --git a/Minecraft.World/MapItemSavedData.cpp b/Minecraft.World/MapItemSavedData.cpp index 358b9c7e..36f65b51 100644 --- a/Minecraft.World/MapItemSavedData.cpp +++ b/Minecraft.World/MapItemSavedData.cpp @@ -332,10 +332,10 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr size || yd > size) { - if (xd <= -size) x = static_cast(size * 2 + 2.5); - if (yd <= -size) y = static_cast(size * 2 + 2.5); - if (xd >= size) x = static_cast(size * 2 + 1); - if (yd >= size) y = static_cast(size * 2 + 1); + if (xd <= -size) x = static_cast(size * 2 + 2.5); + if (yd <= -size) y = static_cast(size * 2 + 2.5); + if (xd >= size) x = static_cast(size * 2 + 1); + if (yd >= size) y = static_cast(size * 2 + 1); } #endif //decorations.push_back(new MapDecoration(4, x, y, 0)); @@ -369,10 +369,10 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr size || yd > size) { - if (xd <= -size) x = static_cast(size * 2 + 2.5); - if (yd <= -size) y = static_cast(size * 2 + 2.5); - if (xd >= size) x = static_cast(size * 2 + 1); - if (yd >= size) y = static_cast(size * 2 + 1); + if (xd <= -size) x = static_cast(size * 2 + 2.5); + if (yd <= -size) y = static_cast(size * 2 + 2.5); + if (xd >= size) x = static_cast(size * 2 + 1); + if (yd >= size) y = static_cast(size * 2 + 1); } #endif //decorations.push_back(new MapDecoration(7, x, y, 0)); @@ -401,10 +401,10 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr size || yd > size) { - if (xd <= -size) x = (byte) (size * 2 + 2.5); - if (yd <= -size) y = (byte) (size * 2 + 2.5); - if (xd >= size) x = (byte) (size * 2 + 1); - if (yd >= size) y = (byte) (size * 2 + 1); + if (xd <= -size) x = (BYTE) (size * 2 + 2.5); + if (yd <= -size) y = (BYTE) (size * 2 + 2.5); + if (xd >= size) x = (BYTE) (size * 2 + 1); + if (yd >= size) y = (BYTE) (size * 2 + 1); } #endif //decorations.push_back(new MapDecoration(7, x, y, 0)); @@ -457,10 +457,10 @@ void MapItemSavedData::tickCarriedBy(shared_ptr player, shared_ptr(size * 2 + 2.5); - if (yd <= -size) y = static_cast(size * 2 + 2.5); - if (xd >= size) x = static_cast(size * 2 + 1); - if (yd >= size) y = static_cast(size * 2 + 1); + if (xd <= -size) x = static_cast(size * 2 + 2.5); + if (yd <= -size) y = static_cast(size * 2 + 2.5); + if (xd >= size) x = static_cast(size * 2 + 1); + if (yd >= size) y = static_cast(size * 2 + 1); } #endif @@ -592,8 +592,8 @@ void MapItemSavedData::mergeInMapData(shared_ptr dataToAdd) for (int z = 0; z < h; z++) { - byte oldColor = colors[x + z * w]; - byte newColor = dataToAdd->colors[x + z * w]; + BYTE oldColor = colors[x + z * w]; + BYTE newColor = dataToAdd->colors[x + z * w]; if (oldColor == 0 && oldColor != newColor) { if (yd0 > z) yd0 = z; diff --git a/Minecraft.World/MapItemSavedData.h b/Minecraft.World/MapItemSavedData.h index 21322644..639dc4d2 100644 --- a/Minecraft.World/MapItemSavedData.h +++ b/Minecraft.World/MapItemSavedData.h @@ -61,7 +61,7 @@ public: public: int x, z; char dimension; - byte scale; + BYTE scale; byteArray colors; vector > carriedBy; diff --git a/Minecraft.World/MerchantRecipeList.cpp b/Minecraft.World/MerchantRecipeList.cpp index b1498389..a952793a 100644 --- a/Minecraft.World/MerchantRecipeList.cpp +++ b/Minecraft.World/MerchantRecipeList.cpp @@ -90,7 +90,7 @@ MerchantRecipe *MerchantRecipeList::getMatchingRecipeFor(shared_ptrwriteByte(static_cast(m_recipes.size() & 0xff)); + stream->writeByte(static_cast(m_recipes.size() & 0xff)); for (size_t i = 0; i < m_recipes.size(); i++) { MerchantRecipe *r = m_recipes.at(i); diff --git a/Minecraft.World/Minecart.cpp b/Minecraft.World/Minecart.cpp index f6c4bb76..041cda8d 100644 --- a/Minecraft.World/Minecart.cpp +++ b/Minecraft.World/Minecart.cpp @@ -95,7 +95,7 @@ void Minecart::defineSynchedData() entityData->define(DATA_ID_DAMAGE, 0.0f); entityData->define(DATA_ID_DISPLAY_TILE, 0); entityData->define(DATA_ID_DISPLAY_OFFSET, 6); - entityData->define(DATA_ID_CUSTOM_DISPLAY, static_cast(0)); + entityData->define(DATA_ID_CUSTOM_DISPLAY, static_cast(0)); } @@ -1015,7 +1015,7 @@ bool Minecart::hasCustomDisplay() void Minecart::setCustomDisplay(bool value) { - getEntityData()->set(DATA_ID_CUSTOM_DISPLAY, static_cast(value ? 1 : 0)); + getEntityData()->set(DATA_ID_CUSTOM_DISPLAY, static_cast(value ? 1 : 0)); } void Minecart::setCustomName(const wstring &name) diff --git a/Minecraft.World/MinecartContainer.cpp b/Minecraft.World/MinecartContainer.cpp index 0e0fd3ac..fa3ad5d7 100644 --- a/Minecraft.World/MinecartContainer.cpp +++ b/Minecraft.World/MinecartContainer.cpp @@ -188,7 +188,7 @@ void MinecartContainer::addAdditonalSaveData(CompoundTag *base) if (items[i] != nullptr) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", static_cast(i)); items[i]->save(tag); listTag->add(tag); } diff --git a/Minecraft.World/MinecartFurnace.cpp b/Minecraft.World/MinecartFurnace.cpp index fa005eca..3b48989b 100644 --- a/Minecraft.World/MinecartFurnace.cpp +++ b/Minecraft.World/MinecartFurnace.cpp @@ -37,7 +37,7 @@ int MinecartFurnace::getType() void MinecartFurnace::defineSynchedData() { Minecart::defineSynchedData(); - entityData->define(DATA_ID_FUEL, static_cast(0)); + entityData->define(DATA_ID_FUEL, static_cast(0)); } void MinecartFurnace::tick() @@ -160,11 +160,11 @@ void MinecartFurnace::setHasFuel(bool fuel) { if (fuel) { - entityData->set(DATA_ID_FUEL, static_cast(entityData->getByte(DATA_ID_FUEL) | 1)); + entityData->set(DATA_ID_FUEL, static_cast(entityData->getByte(DATA_ID_FUEL) | 1)); } else { - entityData->set(DATA_ID_FUEL, static_cast(entityData->getByte(DATA_ID_FUEL) & ~1)); + entityData->set(DATA_ID_FUEL, static_cast(entityData->getByte(DATA_ID_FUEL) & ~1)); } } diff --git a/Minecraft.World/MinecartSpawner.cpp b/Minecraft.World/MinecartSpawner.cpp index 8dd54d01..a6993763 100644 --- a/Minecraft.World/MinecartSpawner.cpp +++ b/Minecraft.World/MinecartSpawner.cpp @@ -10,7 +10,7 @@ MinecartSpawner::MinecartMobSpawner::MinecartMobSpawner(MinecartSpawner *parent) void MinecartSpawner::MinecartMobSpawner::broadcastEvent(int id) { - m_parent->level->broadcastEntityEvent(m_parent->shared_from_this(), static_cast(id)); + m_parent->level->broadcastEntityEvent(m_parent->shared_from_this(), static_cast(id)); } Level *MinecartSpawner::MinecartMobSpawner::getLevel() @@ -78,7 +78,7 @@ void MinecartSpawner::addAdditonalSaveData(CompoundTag *tag) spawner->save(tag); } -void MinecartSpawner::handleEntityEvent(byte eventId) +void MinecartSpawner::handleEntityEvent(BYTE eventId) { spawner->onEventTriggered(eventId); } diff --git a/Minecraft.World/MinecartSpawner.h b/Minecraft.World/MinecartSpawner.h index a0b7944f..16c6d434 100644 --- a/Minecraft.World/MinecartSpawner.h +++ b/Minecraft.World/MinecartSpawner.h @@ -39,7 +39,7 @@ protected: virtual void addAdditonalSaveData(CompoundTag *tag); public: - virtual void handleEntityEvent(byte eventId); + virtual void handleEntityEvent(BYTE eventId); virtual void tick(); virtual BaseMobSpawner *getSpawner(); }; \ No newline at end of file diff --git a/Minecraft.World/MinecartTNT.cpp b/Minecraft.World/MinecartTNT.cpp index 18681aa4..82b4c551 100644 --- a/Minecraft.World/MinecartTNT.cpp +++ b/Minecraft.World/MinecartTNT.cpp @@ -114,7 +114,7 @@ void MinecartTNT::activateMinecart(int xt, int yt, int zt, bool state) } } -void MinecartTNT::handleEntityEvent(byte eventId) +void MinecartTNT::handleEntityEvent(BYTE eventId) { if (eventId == EVENT_PRIME) { diff --git a/Minecraft.World/MinecartTNT.h b/Minecraft.World/MinecartTNT.h index 8637803c..42c21acd 100644 --- a/Minecraft.World/MinecartTNT.h +++ b/Minecraft.World/MinecartTNT.h @@ -9,7 +9,7 @@ public: static Entity *create(Level *level) { return new MinecartTNT(level); } private: - static const byte EVENT_PRIME = 10; + static const BYTE EVENT_PRIME = 10; int fuse; @@ -30,7 +30,7 @@ protected: public: virtual void activateMinecart(int xt, int yt, int zt, bool state); - virtual void handleEntityEvent(byte eventId); + virtual void handleEntityEvent(BYTE eventId); virtual void primeFuse(); virtual int getFuse(); virtual bool isPrimed(); diff --git a/Minecraft.World/Mob.cpp b/Minecraft.World/Mob.cpp index 17671112..54a77527 100644 --- a/Minecraft.World/Mob.cpp +++ b/Minecraft.World/Mob.cpp @@ -155,7 +155,7 @@ void Mob::ate() void Mob::defineSynchedData() { LivingEntity::defineSynchedData(); - entityData->define(DATA_CUSTOM_NAME_VISIBLE, static_cast(0)); + entityData->define(DATA_CUSTOM_NAME_VISIBLE, static_cast(0)); entityData->define(DATA_CUSTOM_NAME, L""); } @@ -865,7 +865,7 @@ bool Mob::hasCustomName() void Mob::setCustomNameVisible(bool visible) { - entityData->set(DATA_CUSTOM_NAME_VISIBLE, visible ? static_cast(1) : static_cast(0)); + entityData->set(DATA_CUSTOM_NAME_VISIBLE, visible ? static_cast(1) : static_cast(0)); } bool Mob::isCustomNameVisible() diff --git a/Minecraft.World/MobEffectInstance.cpp b/Minecraft.World/MobEffectInstance.cpp index 117311c3..fd162447 100644 --- a/Minecraft.World/MobEffectInstance.cpp +++ b/Minecraft.World/MobEffectInstance.cpp @@ -172,8 +172,8 @@ bool MobEffectInstance::equals(MobEffectInstance *instance) CompoundTag *MobEffectInstance::save(CompoundTag *tag) { - tag->putByte(L"Id", static_cast(getId())); - tag->putByte(L"Amplifier", static_cast(getAmplifier())); + tag->putByte(L"Id", static_cast(getId())); + tag->putByte(L"Amplifier", static_cast(getAmplifier())); tag->putInt(L"Duration", getDuration()); tag->putBoolean(L"Ambient", isAmbient()); return tag; diff --git a/Minecraft.World/MobEffectInstance.h b/Minecraft.World/MobEffectInstance.h index 5d9e68f6..4b0f26e8 100644 --- a/Minecraft.World/MobEffectInstance.h +++ b/Minecraft.World/MobEffectInstance.h @@ -5,11 +5,11 @@ class Mob; class MobEffectInstance { private: - // sent as byte + // sent as BYTE int id; // sent as short int duration; - // sent as byte + // sent as BYTE int amplifier; bool splash; bool ambient; diff --git a/Minecraft.World/MushroomIslandBiome.cpp b/Minecraft.World/MushroomIslandBiome.cpp index 91bd8097..2c02c2a3 100644 --- a/Minecraft.World/MushroomIslandBiome.cpp +++ b/Minecraft.World/MushroomIslandBiome.cpp @@ -13,7 +13,7 @@ MushroomIslandBiome::MushroomIslandBiome(int id) : Biome(id) decorator->mushroomCount = 1; decorator->hugeMushrooms = 1; - topMaterial = static_cast(Tile::mycel_Id); + topMaterial = static_cast(Tile::mycel_Id); enemies.clear(); friendlies.clear(); diff --git a/Minecraft.World/MusicTileEntity.cpp b/Minecraft.World/MusicTileEntity.cpp index 7f2f2888..0aa4c64c 100644 --- a/Minecraft.World/MusicTileEntity.cpp +++ b/Minecraft.World/MusicTileEntity.cpp @@ -33,7 +33,7 @@ void MusicTileEntity::load(CompoundTag *tag) void MusicTileEntity::tune() { - note = static_cast((note + 1) % 25); + note = static_cast((note + 1) % 25); setChanged(); } diff --git a/Minecraft.World/MusicTileEntity.h b/Minecraft.World/MusicTileEntity.h index a4941ff1..1ae70a0b 100644 --- a/Minecraft.World/MusicTileEntity.h +++ b/Minecraft.World/MusicTileEntity.h @@ -10,7 +10,7 @@ public: static TileEntity *create() { return new MusicTileEntity(); } public: - byte note; + BYTE note; bool on; diff --git a/Minecraft.World/NbtIo.cpp b/Minecraft.World/NbtIo.cpp index 7e566114..4b40f3ad 100644 --- a/Minecraft.World/NbtIo.cpp +++ b/Minecraft.World/NbtIo.cpp @@ -16,7 +16,7 @@ CompoundTag *NbtIo::readCompressed(InputStream *in) void NbtIo::writeCompressed(CompoundTag *tag, OutputStream *out) { // 4J - this was using a try/finally block - // 4J Stu - Buffer output in 1024 byte chunks so that we can allocate properly in the save file + // 4J Stu - Buffer output in 1024 BYTE chunks so that we can allocate properly in the save file BufferedOutputStream bos = BufferedOutputStream( out, 1024 ); DataOutputStream dos = DataOutputStream(&bos); // 4J - was new GZIPOutputStream as well NbtIo::write(tag, &dos); diff --git a/Minecraft.World/Ocelot.cpp b/Minecraft.World/Ocelot.cpp index 75c6e0f0..53849aec 100644 --- a/Minecraft.World/Ocelot.cpp +++ b/Minecraft.World/Ocelot.cpp @@ -57,7 +57,7 @@ void Ocelot::defineSynchedData() { TamableAnimal::defineSynchedData(); - entityData->define(DATA_TYPE_ID, static_cast(0)); + entityData->define(DATA_TYPE_ID, static_cast(0)); } void Ocelot::serverAiMobStep() @@ -279,7 +279,7 @@ int Ocelot::getCatType() void Ocelot::setCatType(int type) { - entityData->set(DATA_TYPE_ID, static_cast(type)); + entityData->set(DATA_TYPE_ID, static_cast(type)); } bool Ocelot::canSpawn() @@ -350,12 +350,12 @@ MobGroupData *Ocelot::finalizeMobSpawn(MobGroupData *groupData, int extraData /* void Ocelot::setSittingOnTile(bool val) { - byte current = entityData->getByte(DATA_FLAGS_ID); - entityData->set(DATA_FLAGS_ID, val ? static_cast(current | 0x02) : static_cast(current & ~0x02) ); + BYTE current = entityData->getByte(DATA_FLAGS_ID); + entityData->set(DATA_FLAGS_ID, val ? static_cast(current | 0x02) : static_cast(current & ~0x02) ); } bool Ocelot::isSittingOnTile() { - byte current = entityData->getByte(DATA_FLAGS_ID); + BYTE current = entityData->getByte(DATA_FLAGS_ID); return (current & 0x02) > 0; } \ No newline at end of file diff --git a/Minecraft.World/OldChunkStorage.cpp b/Minecraft.World/OldChunkStorage.cpp index 15b4c734..a3ba13d4 100644 --- a/Minecraft.World/OldChunkStorage.cpp +++ b/Minecraft.World/OldChunkStorage.cpp @@ -527,10 +527,10 @@ LevelChunk *OldChunkStorage::load(Level *level, CompoundTag *tag) delete [] levelChunk->heightmap.data; levelChunk->heightmap = tag->getByteArray(L"HeightMap"); - // 4J - TerrainPopulated was a bool (java), then changed to be a byte bitfield, then replaced with TerrainPopulatedShort to store a wider bitfield + // 4J - TerrainPopulated was a bool (java), then changed to be a BYTE bitfield, then replaced with TerrainPopulatedShort to store a wider bitfield if( tag->get(L"TerrainPopulated") ) { - // Java bool type or byte bitfield + // Java bool type or BYTE bitfield levelChunk->terrainPopulated = tag->getByte(L"TerrainPopulated"); if( levelChunk->terrainPopulated >= 1 ) levelChunk->terrainPopulated = LevelChunk::sTerrainPopulatedAllNeighbours | LevelChunk::sTerrainPostPostProcessed; // Convert from old bool type to new bitfield } diff --git a/Minecraft.World/Ozelot.cpp b/Minecraft.World/Ozelot.cpp index 3c05f357..789827db 100644 --- a/Minecraft.World/Ozelot.cpp +++ b/Minecraft.World/Ozelot.cpp @@ -60,7 +60,7 @@ void Ozelot::defineSynchedData() { TamableAnimal::defineSynchedData(); - entityData->define(DATA_TYPE_ID, (byte) TYPE_OZELOT); + entityData->define(DATA_TYPE_ID, (BYTE) TYPE_OZELOT); } void Ozelot::serverAiMobStep() @@ -294,7 +294,7 @@ int Ozelot::getCatType() void Ozelot::setCatType(int type) { - entityData->set(DATA_TYPE_ID, (byte) type); + entityData->set(DATA_TYPE_ID, (BYTE) type); } bool Ozelot::canSpawn() diff --git a/Minecraft.World/Pig.cpp b/Minecraft.World/Pig.cpp index b8c87dcb..f279e014 100644 --- a/Minecraft.World/Pig.cpp +++ b/Minecraft.World/Pig.cpp @@ -75,7 +75,7 @@ bool Pig::canBeControlledByRider() void Pig::defineSynchedData() { Animal::defineSynchedData(); - entityData->define(DATA_SADDLE_ID, static_cast(0)); + entityData->define(DATA_SADDLE_ID, static_cast(0)); } void Pig::addAdditonalSaveData(CompoundTag *tag) @@ -158,11 +158,11 @@ void Pig::setSaddle(bool value) { if (value) { - entityData->set(DATA_SADDLE_ID, static_cast(1)); + entityData->set(DATA_SADDLE_ID, static_cast(1)); } else { - entityData->set(DATA_SADDLE_ID, static_cast(0)); + entityData->set(DATA_SADDLE_ID, static_cast(0)); } } diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index 00c7148e..ff68c714 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -175,7 +175,7 @@ void Player::defineSynchedData() { LivingEntity::defineSynchedData(); - entityData->define(DATA_PLAYER_FLAGS_ID, static_cast(0)); + entityData->define(DATA_PLAYER_FLAGS_ID, static_cast(0)); entityData->define(DATA_PLAYER_ABSORPTION_ID, static_cast(0)); entityData->define(DATA_SCORE_ID, (int) 0); } @@ -591,7 +591,7 @@ void Player::completeUsingItem() } } -void Player::handleEntityEvent(byte id) +void Player::handleEntityEvent(BYTE id) { if (id == EntityEvent::USE_ITEM_COMPLETE) { @@ -2025,14 +2025,14 @@ bool Player::getPlayerFlag(int flag) void Player::setPlayerFlag(int flag, bool value) { - byte currentValue = entityData->getByte(DATA_PLAYER_FLAGS_ID); + BYTE currentValue = entityData->getByte(DATA_PLAYER_FLAGS_ID); if (value) { - entityData->set(DATA_PLAYER_FLAGS_ID, static_cast(currentValue | (1 << flag))); + entityData->set(DATA_PLAYER_FLAGS_ID, static_cast(currentValue | (1 << flag))); } else { - entityData->set(DATA_PLAYER_FLAGS_ID, static_cast(currentValue & ~(1 << flag))); + entityData->set(DATA_PLAYER_FLAGS_ID, static_cast(currentValue & ~(1 << flag))); } } diff --git a/Minecraft.World/Player.h b/Minecraft.World/Player.h index 2e223a1e..f06b233d 100644 --- a/Minecraft.World/Player.h +++ b/Minecraft.World/Player.h @@ -168,7 +168,7 @@ protected: virtual void completeUsingItem(); public: - virtual void handleEntityEvent(byte id); + virtual void handleEntityEvent(BYTE id); protected: bool isImmobile(); diff --git a/Minecraft.World/PlayerAbilitiesPacket.cpp b/Minecraft.World/PlayerAbilitiesPacket.cpp index d02f164c..fd9291fa 100644 --- a/Minecraft.World/PlayerAbilitiesPacket.cpp +++ b/Minecraft.World/PlayerAbilitiesPacket.cpp @@ -25,7 +25,7 @@ PlayerAbilitiesPacket::PlayerAbilitiesPacket(Abilities *abilities) void PlayerAbilitiesPacket::read(DataInputStream *dis) { - byte bitfield = dis->readByte(); + BYTE bitfield = dis->readByte(); setInvulnerable((bitfield & FLAG_INVULNERABLE) > 0); setFlying((bitfield & FLAG_FLYING) > 0); @@ -37,7 +37,7 @@ void PlayerAbilitiesPacket::read(DataInputStream *dis) void PlayerAbilitiesPacket::write(DataOutputStream *dos) { - byte bitfield = 0; + BYTE bitfield = 0; if (isInvulnerable()) bitfield |= FLAG_INVULNERABLE; if (isFlying()) bitfield |= FLAG_FLYING; diff --git a/Minecraft.World/PlayerEnderChestContainer.cpp b/Minecraft.World/PlayerEnderChestContainer.cpp index 33ebcbd4..8d0c48e9 100644 --- a/Minecraft.World/PlayerEnderChestContainer.cpp +++ b/Minecraft.World/PlayerEnderChestContainer.cpp @@ -41,7 +41,7 @@ ListTag *PlayerEnderChestContainer::createTag() if (item != nullptr) { CompoundTag *tag = new CompoundTag(); - tag->putByte(L"Slot", static_cast(i)); + tag->putByte(L"Slot", static_cast(i)); item->save(tag); items->add(tag); } diff --git a/Minecraft.World/PreLoginPacket.cpp b/Minecraft.World/PreLoginPacket.cpp index ddcfe197..678901cc 100644 --- a/Minecraft.World/PreLoginPacket.cpp +++ b/Minecraft.World/PreLoginPacket.cpp @@ -94,7 +94,7 @@ void PreLoginPacket::write(DataOutputStream *dos) //throws IOException dos->writeByte(m_friendsOnlyBits); dos->writeInt(m_ugcPlayersVersion); - dos->writeByte(static_cast(m_dwPlayerCount)); + dos->writeByte(static_cast(m_dwPlayerCount)); for(DWORD i = 0; i < m_dwPlayerCount; ++i) { dos->writePlayerUID( m_playerXuids[i] ); diff --git a/Minecraft.World/PrimedTnt.cpp b/Minecraft.World/PrimedTnt.cpp index 39b3ea73..dddc64b6 100644 --- a/Minecraft.World/PrimedTnt.cpp +++ b/Minecraft.World/PrimedTnt.cpp @@ -105,7 +105,7 @@ void PrimedTnt::explode() void PrimedTnt::addAdditonalSaveData(CompoundTag *entityTag) { - entityTag->putByte(L"Fuse", static_cast(life)); + entityTag->putByte(L"Fuse", static_cast(life)); } void PrimedTnt::readAdditionalSaveData(CompoundTag *tag) diff --git a/Minecraft.World/Random.cpp b/Minecraft.World/Random.cpp index 89903da8..e4a339b3 100644 --- a/Minecraft.World/Random.cpp +++ b/Minecraft.World/Random.cpp @@ -30,11 +30,11 @@ int Random::next(int bits) return static_cast(seed >> (48 - bits)); } -void Random::nextBytes(byte *bytes, unsigned int count) +void Random::nextBytes(BYTE *bytes, unsigned int count) { for(unsigned int i = 0; i < count; i++ ) { - bytes[i] = static_cast(next(8)); + bytes[i] = static_cast(next(8)); } } diff --git a/Minecraft.World/Random.h b/Minecraft.World/Random.h index cfb6af26..9092aaa4 100644 --- a/Minecraft.World/Random.h +++ b/Minecraft.World/Random.h @@ -12,7 +12,7 @@ public: Random(); Random(int64_t seed); void setSeed(int64_t s); - void nextBytes(byte *bytes, unsigned int count); + void nextBytes(BYTE *bytes, unsigned int count); double nextDouble(); double nextGaussian(); int nextInt(); diff --git a/Minecraft.World/RandomLevelSource.cpp b/Minecraft.World/RandomLevelSource.cpp index a0e7a94b..301faae8 100644 --- a/Minecraft.World/RandomLevelSource.cpp +++ b/Minecraft.World/RandomLevelSource.cpp @@ -315,11 +315,11 @@ void RandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks) // 4J - this comparison used to just be with 0.0f but is now varied by block above if ((val += vala) > comp) { - tileId = static_cast(Tile::stone_Id); + tileId = static_cast(Tile::stone_Id); } else if (yc * CHUNK_HEIGHT + y < waterHeight) { - tileId = static_cast(Tile::calmWater_Id); + tileId = static_cast(Tile::calmWater_Id); } // 4J - more extra code to make sure that the column at the edge of the world is just water & rock, to match the infinite sea that @@ -381,8 +381,8 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi int run = -1; - byte top = b->topMaterial; - byte material = b->material; + BYTE top = b->topMaterial; + BYTE material = b->material; LevelGenerationOptions *lgo = app.getLevelGenerationOptions(); if(lgo != nullptr) @@ -397,7 +397,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y <= 1 + random->nextInt(2)) // 4J - changed to make the bedrock not have bits you can get stuck in // if (y <= 0 + random->nextInt(5)) { - blocks[offs] = static_cast(Tile::unbreakable_Id); + blocks[offs] = static_cast(Tile::unbreakable_Id); } else { @@ -414,7 +414,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (runDepth <= 0) { top = 0; - material = static_cast(Tile::stone_Id); + material = static_cast(Tile::stone_Id); } else if (y >= waterHeight - 4 && y <= waterHeight + 1) { @@ -428,8 +428,8 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (y < waterHeight && top == 0) { - if (temp < 0.15f) top = static_cast(Tile::ice_Id); - else top = static_cast(Tile::calmWater_Id); + if (temp < 0.15f) top = static_cast(Tile::ice_Id); + else top = static_cast(Tile::calmWater_Id); } run = runDepth; @@ -445,7 +445,7 @@ void RandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks, Bi if (run == 0 && material == Tile::sand_Id) { run = random->nextInt(4); - material = static_cast(Tile::sandStone_Id); + material = static_cast(Tile::sandStone_Id); } } } @@ -469,7 +469,7 @@ LevelChunk *RandomLevelSource::getChunk(int xOffs, int zOffs) // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed int blocksSize = Level::genDepth * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + BYTE *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/RedStoneDustTile.cpp b/Minecraft.World/RedStoneDustTile.cpp index e348406b..d3e86f20 100644 --- a/Minecraft.World/RedStoneDustTile.cpp +++ b/Minecraft.World/RedStoneDustTile.cpp @@ -335,9 +335,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 maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_RedstoneDustLitMax ); - byte 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)); - byte blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( (data-1)/14.0f)); + BYTE 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)); + BYTE blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( (data-1)/14.0f)); colour = redComponent<<16 | greenComponent<<8 | blueComponent; } diff --git a/Minecraft.World/RegionFile.cpp b/Minecraft.World/RegionFile.cpp index 175ea6c1..83d5d1d7 100644 --- a/Minecraft.World/RegionFile.cpp +++ b/Minecraft.World/RegionFile.cpp @@ -57,10 +57,10 @@ RegionFile::RegionFile(ConsoleSaveFile *saveFile, File *path) //if ((GetFileSize(file,nullptr) & 0xfff) != 0) if ((fileEntry->getFileSize() & 0xfff) != 0) { - //byte zero = 0; + //BYTE zero = 0; DWORD numberOfBytesWritten = 0; DWORD bytesToWrite = 0x1000 - (fileEntry->getFileSize() & 0xfff); - byte *zeroBytes = new byte[ bytesToWrite ]; + BYTE *zeroBytes = new BYTE[ bytesToWrite ]; ZeroMemory(zeroBytes, bytesToWrite); /* the file size is not a multiple of 4KB, grow it */ @@ -207,7 +207,7 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was DWORD numberOfBytesRead = 0; - // 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a byte, then length-1 bytes of data + // 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a BYTE, then length-1 bytes of data // We store length and decompression length as ints, then length bytes of xbox LZX compressed data m_saveFile->readFile(fileEntry,&length,4,&numberOfBytesRead); @@ -233,8 +233,8 @@ DataInputStream *RegionFile::getChunkDataInputStream(int x, int z) // TODO - was } MemSect(50); - byte *data = new byte[length]; - byte *decomp = new byte[decompLength]; + BYTE *data = new BYTE[length]; + BYTE *decomp = new BYTE[decompLength]; MemSect(0); readDecompLength = decompLength; m_saveFile->readFile(fileEntry,data,length,&numberOfBytesRead); @@ -273,10 +273,10 @@ DataOutputStream *RegionFile::getChunkDataOutputStream(int x, int z) } /* write a chunk at (x,z) with length bytes of data to disk */ -void RegionFile::write(int x, int z, byte *data, int length) // TODO - was synchronized +void RegionFile::write(int x, int z, BYTE *data, int length) // TODO - was synchronized { // 4J Stu - Do the compression here so that we know how much space we need to store the compressed data - byte *compData = new byte[length + 2048]; // presuming compression is going to make this smaller... UPDATE - for some really small things this isn't the case. Added 2K on here to cover those. + BYTE *compData = new BYTE[length + 2048]; // presuming compression is going to make this smaller... UPDATE - for some really small things this isn't the case. Added 2K on here to cover those. unsigned int compLength = length; Compression::getCompression()->CompressLZXRLE(compData,&compLength,data,length); @@ -403,13 +403,13 @@ void RegionFile::write(int x, int z, byte *data, int length) // TODO - was sync } /* write a chunk data to the region file at specified sector number */ -void RegionFile::write(int sectorNumber, byte *data, int length, unsigned int compLength) +void RegionFile::write(int sectorNumber, BYTE *data, int length, unsigned int compLength) { DWORD numberOfBytesWritten = 0; //SetFilePointer(file,sectorNumber * SECTOR_BYTES,0,FILE_BEGIN); m_saveFile->setFilePointer( fileEntry, sectorNumber * SECTOR_BYTES, nullptr, FILE_BEGIN ); - // 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a byte, then length-1 bytes of data + // 4J - this differs a bit from the java file format. Java has length stored as an int, then a type as a BYTE, then length-1 bytes of data // We store length and decompression length as ints, then length bytes of xbox LZX compressed data // 4J Stu - We need to do the compression at a level above this, where it is checking for free space @@ -451,7 +451,7 @@ void RegionFile::insertInitialSectors() { m_saveFile->setFilePointer( fileEntry, 0, nullptr, FILE_BEGIN ); DWORD numberOfBytesWritten = 0; - byte zeroBytes[ SECTOR_BYTES ]; + BYTE zeroBytes[ SECTOR_BYTES ]; ZeroMemory(zeroBytes, SECTOR_BYTES); /* we need to write the chunk offset table */ diff --git a/Minecraft.World/RegionFile.h b/Minecraft.World/RegionFile.h index 520ca6a1..1b7196f4 100644 --- a/Minecraft.World/RegionFile.h +++ b/Minecraft.World/RegionFile.h @@ -71,11 +71,11 @@ public: /* write a chunk at (x,z) with length bytes of data to disk */ protected: - void write(int x, int z, byte *data, int length); + void write(int x, int z, BYTE *data, int length); /* write a chunk data to the region file at specified sector number */ private: - void write(int sectorNumber, byte *data, int length, unsigned int compLength); + void write(int sectorNumber, BYTE *data, int length, unsigned int compLength); void zero(int sectorNumber, int length); // 4J added /* is this an invalid chunk coordinate? */ diff --git a/Minecraft.World/RemoveMobEffectPacket.cpp b/Minecraft.World/RemoveMobEffectPacket.cpp index 7e2d7c84..ff0d8d0c 100644 --- a/Minecraft.World/RemoveMobEffectPacket.cpp +++ b/Minecraft.World/RemoveMobEffectPacket.cpp @@ -13,7 +13,7 @@ RemoveMobEffectPacket::RemoveMobEffectPacket() RemoveMobEffectPacket::RemoveMobEffectPacket(int entityId, MobEffectInstance *effect) { this->entityId = entityId; - this->effectId = static_cast(effect->getId() & 0xff); + this->effectId = static_cast(effect->getId() & 0xff); } void RemoveMobEffectPacket::read(DataInputStream *dis) diff --git a/Minecraft.World/ServerAuthDataPacket.h b/Minecraft.World/ServerAuthDataPacket.h index c56844d1..b4c02489 100644 --- a/Minecraft.World/ServerAuthDataPacket.h +++ b/Minecraft.World/ServerAuthDataPacket.h @@ -7,13 +7,13 @@ class ServerAuthDataPacket : public Packet #if 0 private String serverId; private PublicKey publicKey; - private byte[] nonce = new byte[]{}; + private BYTE[] nonce = new BYTE[]{}; public ServerAuthDataPacket() { // Needed } - public ServerAuthDataPacket(final String serverId, final PublicKey publicKey, final byte[] nonce) { + public ServerAuthDataPacket(final String serverId, final PublicKey publicKey, final BYTE[] nonce) { this.serverId = serverId; this.publicKey = publicKey; this.nonce = nonce; @@ -51,7 +51,7 @@ class ServerAuthDataPacket : public Packet return publicKey; } - public byte[] getNonce() { + public BYTE[] getNonce() { return nonce; } #endif diff --git a/Minecraft.World/SharedKeyPacket.h b/Minecraft.World/SharedKeyPacket.h index 4f50ad5c..3e3821ce 100644 --- a/Minecraft.World/SharedKeyPacket.h +++ b/Minecraft.World/SharedKeyPacket.h @@ -5,8 +5,8 @@ class SharedKeyPacket : public Packet { #if 0 - private byte[] keybytes = new byte[]{}; - private byte[] nonce = new byte[]{}; + private BYTE[] keybytes = new BYTE[]{}; + private BYTE[] nonce = new BYTE[]{}; private SecretKey secretKey; @@ -14,7 +14,7 @@ class SharedKeyPacket : public Packet // Needed } - public SharedKeyPacket(final SecretKey secretKey, final PublicKey publicKey, final byte[] nonce) { + public SharedKeyPacket(final SecretKey secretKey, final PublicKey publicKey, final BYTE[] nonce) { this.secretKey = secretKey; this.keybytes = Crypt.encryptUsingKey(publicKey, secretKey.getEncoded()); this.nonce = Crypt.encryptUsingKey(publicKey, nonce); @@ -53,7 +53,7 @@ class SharedKeyPacket : public Packet return getSecretKey(null); } - public byte[] getNonce(PrivateKey privateKey) { + public BYTE[] getNonce(PrivateKey privateKey) { if (privateKey == null) { return nonce; } diff --git a/Minecraft.World/Sheep.cpp b/Minecraft.World/Sheep.cpp index f06308f4..1c5af6ce 100644 --- a/Minecraft.World/Sheep.cpp +++ b/Minecraft.World/Sheep.cpp @@ -99,8 +99,8 @@ void Sheep::defineSynchedData() { Animal::defineSynchedData(); - // sheared and color share a byte - entityData->define(DATA_WOOL_ID, static_cast(0)); //was new Byte((byte), 0) + // sheared and color share a BYTE + entityData->define(DATA_WOOL_ID, static_cast(0)); //was new Byte((BYTE), 0) } void Sheep::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) @@ -117,7 +117,7 @@ int Sheep::getDeathLoot() return Tile::wool_Id; } -void Sheep::handleEntityEvent(byte id) +void Sheep::handleEntityEvent(BYTE id) { if (id == EntityEvent::EAT_GRASS) { @@ -196,7 +196,7 @@ void Sheep::addAdditonalSaveData(CompoundTag *tag) { Animal::addAdditonalSaveData(tag); tag->putBoolean(L"Sheared", isSheared()); - tag->putByte(L"Color", static_cast(getColor())); + tag->putByte(L"Color", static_cast(getColor())); } void Sheep::readAdditionalSaveData(CompoundTag *tag) @@ -233,8 +233,8 @@ int Sheep::getColor() void Sheep::setColor(int color) { - byte current = entityData->getByte(DATA_WOOL_ID); - entityData->set(DATA_WOOL_ID, static_cast((current & 0xf0) | (color & 0x0f))); + BYTE current = entityData->getByte(DATA_WOOL_ID); + entityData->set(DATA_WOOL_ID, static_cast((current & 0xf0) | (color & 0x0f))); } bool Sheep::isSheared() @@ -244,14 +244,14 @@ bool Sheep::isSheared() void Sheep::setSheared(bool value) { - byte current = entityData->getByte(DATA_WOOL_ID); + BYTE current = entityData->getByte(DATA_WOOL_ID); if (value) { - entityData->set(DATA_WOOL_ID, static_cast(current | 0x10)); + entityData->set(DATA_WOOL_ID, static_cast(current | 0x10)); } else { - entityData->set(DATA_WOOL_ID, static_cast(current & ~0x10)); + entityData->set(DATA_WOOL_ID, static_cast(current & ~0x10)); } } diff --git a/Minecraft.World/Sheep.h b/Minecraft.World/Sheep.h index 16ecfb4c..3760989e 100644 --- a/Minecraft.World/Sheep.h +++ b/Minecraft.World/Sheep.h @@ -53,7 +53,7 @@ public: virtual int getDeathLoot(); public: - virtual void handleEntityEvent(byte id); + virtual void handleEntityEvent(BYTE id); public: float getHeadEatPositionScale(float a); diff --git a/Minecraft.World/ShortTag.h b/Minecraft.World/ShortTag.h index cbe0b55f..e00dfd9c 100644 --- a/Minecraft.World/ShortTag.h +++ b/Minecraft.World/ShortTag.h @@ -11,7 +11,7 @@ public: void write(DataOutput *dos) { dos->writeShort(data); } void load(DataInput *dis, int tagDepth) { data = dis->readShort(); } - byte getId() { return TAG_Short; } + BYTE getId() { return TAG_Short; } wstring toString() { static wchar_t buf[32]; diff --git a/Minecraft.World/SignUpdatePacket.cpp b/Minecraft.World/SignUpdatePacket.cpp index 10cc223e..f84577a4 100644 --- a/Minecraft.World/SignUpdatePacket.cpp +++ b/Minecraft.World/SignUpdatePacket.cpp @@ -62,8 +62,8 @@ int SignUpdatePacket::getEstimatedSize() l+=sizeof(int); l+=sizeof(short); l+=sizeof(int); - l+=sizeof(byte); - l+=sizeof(byte); + l+=sizeof(BYTE); + l+=sizeof(BYTE); for (int i = 0; i < MAX_SIGN_LINES; i++) l += static_cast(lines[i].length()); diff --git a/Minecraft.World/Skeleton.cpp b/Minecraft.World/Skeleton.cpp index cc325b97..b88a8916 100644 --- a/Minecraft.World/Skeleton.cpp +++ b/Minecraft.World/Skeleton.cpp @@ -63,7 +63,7 @@ void Skeleton::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_TYPE_ID, static_cast(TYPE_DEFAULT)); + entityData->define(DATA_TYPE_ID, static_cast(TYPE_DEFAULT)); } bool Skeleton::useNewAi() @@ -311,7 +311,7 @@ int Skeleton::getSkeletonType() void Skeleton::setSkeletonType(int type) { - entityData->set(DATA_TYPE_ID, static_cast(type)); + entityData->set(DATA_TYPE_ID, static_cast(type)); fireImmune = type == TYPE_WITHER; if (type == TYPE_WITHER) @@ -340,7 +340,7 @@ void Skeleton::readAdditionalSaveData(CompoundTag *tag) void Skeleton::addAdditonalSaveData(CompoundTag *entityTag) { Monster::addAdditonalSaveData(entityTag); - entityTag->putByte(L"SkeletonType", static_cast(getSkeletonType())); + entityTag->putByte(L"SkeletonType", static_cast(getSkeletonType())); } void Skeleton::setEquippedSlot(int slot, shared_ptr item) diff --git a/Minecraft.World/Slime.cpp b/Minecraft.World/Slime.cpp index de76ef06..c10feb78 100644 --- a/Minecraft.World/Slime.cpp +++ b/Minecraft.World/Slime.cpp @@ -47,12 +47,12 @@ void Slime::defineSynchedData() { Mob::defineSynchedData(); - entityData->define(ID_SIZE, static_cast(1)); + entityData->define(ID_SIZE, static_cast(1)); } void Slime::setSize(int size) { - entityData->set(ID_SIZE, static_cast(size)); + entityData->set(ID_SIZE, static_cast(size)); setSize(0.6f * size, 0.6f * size); setPos(x, y, z); getAttribute(SharedMonsterAttributes::MAX_HEALTH)->setBaseValue(size * size); diff --git a/Minecraft.World/Socket.cpp b/Minecraft.World/Socket.cpp index 41ac3702..44aeaa58 100644 --- a/Minecraft.World/Socket.cpp +++ b/Minecraft.World/Socket.cpp @@ -11,7 +11,7 @@ // link, the end (0 or 1) is passed as a parameter to the ctor. CRITICAL_SECTION Socket::s_hostQueueLock[2]; -std::queue Socket::s_hostQueue[2]; +std::queue Socket::s_hostQueue[2]; Socket::SocketOutputStreamLocal *Socket::s_hostOutStream[2]; Socket::SocketInputStreamLocal *Socket::s_hostInStream[2]; ServerConnection *Socket::s_serverConnection = nullptr; @@ -29,7 +29,7 @@ void Socket::Initialise(ServerConnection *serverConnection) if(TryEnterCriticalSection(&s_hostQueueLock[i])) { // Clear the queue - std::queue empty; + std::queue empty; std::swap( s_hostQueue[i], empty ); LeaveCriticalSection(&s_hostQueueLock[i]); } @@ -264,7 +264,7 @@ Socket::SocketInputStreamLocal::SocketInputStreamLocal(int queueIdx) m_queueIdx = queueIdx; } -// Try and get an input byte, blocking until one is available +// Try and get an input BYTE, blocking until one is available int Socket::SocketInputStreamLocal::read() { while(m_streamOpen && ShutdownManager::ShouldRun(ShutdownManager::eConnectionReadThreads)) @@ -273,7 +273,7 @@ int Socket::SocketInputStreamLocal::read() { if( s_hostQueue[m_queueIdx].size() ) { - byte retval = s_hostQueue[m_queueIdx].front(); + BYTE retval = s_hostQueue[m_queueIdx].front(); s_hostQueue[m_queueIdx].pop(); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); return retval; @@ -319,7 +319,7 @@ void Socket::SocketInputStreamLocal::close() { m_streamOpen = false; EnterCriticalSection(&s_hostQueueLock[m_queueIdx]); - std::queue empty; + std::queue empty; std::swap(s_hostQueue[m_queueIdx], empty); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); } @@ -339,7 +339,7 @@ void Socket::SocketOutputStreamLocal::write(unsigned int b) return; } EnterCriticalSection(&s_hostQueueLock[m_queueIdx]); - s_hostQueue[m_queueIdx].push(static_cast(b)); + s_hostQueue[m_queueIdx].push(static_cast(b)); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); } @@ -368,7 +368,7 @@ void Socket::SocketOutputStreamLocal::close() { m_streamOpen = false; EnterCriticalSection(&s_hostQueueLock[m_queueIdx]); - std::queue empty; + std::queue empty; std::swap(s_hostQueue[m_queueIdx], empty); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); } @@ -382,7 +382,7 @@ Socket::SocketInputStreamNetwork::SocketInputStreamNetwork(Socket *socket, int q m_socket = socket; } -// Try and get an input byte, blocking until one is available +// Try and get an input BYTE, blocking until one is available int Socket::SocketInputStreamNetwork::read() { while(m_streamOpen && ShutdownManager::ShouldRun(ShutdownManager::eConnectionReadThreads)) @@ -391,7 +391,7 @@ int Socket::SocketInputStreamNetwork::read() { if( m_socket->m_queueNetwork[m_queueIdx].size() ) { - byte retval = m_socket->m_queueNetwork[m_queueIdx].front(); + BYTE retval = m_socket->m_queueNetwork[m_queueIdx].front(); m_socket->m_queueNetwork[m_queueIdx].pop(); LeaveCriticalSection(&m_socket->m_queueLockNetwork[m_queueIdx]); return retval; @@ -451,8 +451,8 @@ void Socket::SocketOutputStreamNetwork::write(unsigned int b) { if( m_streamOpen != true ) return; byteArray barray; - byte bb; - bb = static_cast(b); + BYTE bb; + bb = static_cast(b); barray.data = &bb; barray.length = 1; write(barray, 0, 1); diff --git a/Minecraft.World/Socket.h b/Minecraft.World/Socket.h index c4ec9fc8..823d98d0 100644 --- a/Minecraft.World/Socket.h +++ b/Minecraft.World/Socket.h @@ -93,12 +93,12 @@ private: // For local connections between the host player and the server static CRITICAL_SECTION s_hostQueueLock[2]; - static std::queue s_hostQueue[2]; + static std::queue s_hostQueue[2]; static SocketOutputStreamLocal *s_hostOutStream[2]; static SocketInputStreamLocal *s_hostInStream[2]; // For network connections - std::queue m_queueNetwork[2]; // For input data + std::queue m_queueNetwork[2]; // For input data CRITICAL_SECTION m_queueLockNetwork[2]; // For input data SocketInputStreamNetwork *m_inputStream[2]; SocketOutputStreamNetwork *m_outputStream[2]; diff --git a/Minecraft.World/SparseDataStorage.cpp b/Minecraft.World/SparseDataStorage.cpp index 556000fd..01855cdc 100644 --- a/Minecraft.World/SparseDataStorage.cpp +++ b/Minecraft.World/SparseDataStorage.cpp @@ -162,7 +162,7 @@ void SparseDataStorage::setData(byteArray dataIn, unsigned int inOffset) //int shift = 4 * part; const unsigned char *pucIn = &dataIn[ (y >> 1) + inOffset]; - for( int xz = 0; xz < 128; xz++ ) // 128 ( 16 x 16 x 0.5 ) in loop as packing 2 values into each destination byte + for( int xz = 0; xz < 128; xz++ ) // 128 ( 16 x 16 x 0.5 ) in loop as packing 2 values into each destination BYTE { *pucOut = ( ( *pucIn ) >> ( part * 4 ) ) & 15; pucIn += 64; @@ -209,7 +209,7 @@ void SparseDataStorage::getData(byteArray retArray, unsigned int retOffset) const int shift = 4 * part; unsigned char *pucOut = &retArray.data[ (y >> 1) + + retOffset]; const unsigned char *pucIn = &data[ planeIndices[ y ] * 128 ]; - for( int xz = 0; xz < 128; xz++ ) // 128 in loop (16 x 16 x 0.5) as input data is being treated in pairs of nybbles that are packed in the same byte + for( int xz = 0; xz < 128; xz++ ) // 128 in loop (16 x 16 x 0.5) as input data is being treated in pairs of nybbles that are packed in the same BYTE { unsigned char value = (*pucIn) & 15; *pucOut |= ( value << shift ); @@ -238,8 +238,8 @@ int SparseDataStorage::get(int x, int y, int z) else { const int planeIndex = x * 16 + z; // Index within this xz plane - const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte) - const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte + const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per BYTE) + const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the BYTE const int retval = ( data[ planeIndices[y] * 128 + byteIndex ] >> shift ) & 15; return retval; @@ -271,8 +271,8 @@ void SparseDataStorage::set(int x, int y, int z, int val) // Either data was already allocated, or we've just done that. Now store our value into the right place. const int planeIndex = x * 16 + z; // Index within this xz plane - const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte) - const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte + const int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per BYTE) + const int shift = ( planeIndex & 1 ) * 4; // Bit shift within the BYTE const int mask = 0xf0 >> shift; const int idx = planeIndices[y] * 128 + byteIndex; diff --git a/Minecraft.World/SparseLightStorage.cpp b/Minecraft.World/SparseLightStorage.cpp index a80f9c97..11de6a14 100644 --- a/Minecraft.World/SparseLightStorage.cpp +++ b/Minecraft.World/SparseLightStorage.cpp @@ -166,7 +166,7 @@ void SparseLightStorage::setData(byteArray dataIn, unsigned int inOffset) //int shift = 4 * part; unsigned char *pucIn = &dataIn[ (y >> 1) + inOffset]; - for( int xz = 0; xz < 128; xz++ ) // 128 ( 16 x 16 x 0.5 ) in loop as packing 2 values into each destination byte + for( int xz = 0; xz < 128; xz++ ) // 128 ( 16 x 16 x 0.5 ) in loop as packing 2 values into each destination BYTE { *pucOut = ( ( *pucIn ) >> ( part * 4 ) ) & 15; pucIn += 64; @@ -224,7 +224,7 @@ void SparseLightStorage::getData(byteArray retArray, unsigned int retOffset) int shift = 4 * part; unsigned char *pucOut = &retArray.data[ (y >> 1) + retOffset]; unsigned char *pucIn = &data[ planeIndices[ y ] * 128 ]; - for( int xz = 0; xz < 128; xz++ ) // 128 in loop (16 x 16 x 0.5) as input data is being treated in pairs of nybbles that are packed in the same byte + for( int xz = 0; xz < 128; xz++ ) // 128 in loop (16 x 16 x 0.5) as input data is being treated in pairs of nybbles that are packed in the same BYTE { unsigned char value = (*pucIn) & 15; *pucOut |= ( value << shift ); @@ -257,8 +257,8 @@ int SparseLightStorage::get(int x, int y, int z) else { int planeIndex = x * 16 + z; // Index within this xz plane - int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte) - int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte + int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per BYTE) + int shift = ( planeIndex & 1 ) * 4; // Bit shift within the BYTE int retval = ( data[ planeIndices[y] * 128 + byteIndex ] >> shift ) & 15; return retval; @@ -294,8 +294,8 @@ void SparseLightStorage::set(int x, int y, int z, int val) // Either data was already allocated, or we've just done that. Now store our value into the right place. int planeIndex = x * 16 + z; // Index within this xz plane - int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per byte) - int shift = ( planeIndex & 1 ) * 4; // Bit shift within the byte + int byteIndex = planeIndex / 2; // Byte index within the plane (2 tiles stored per BYTE) + int shift = ( planeIndex & 1 ) * 4; // Bit shift within the BYTE int mask = 0xf0 >> shift; int idx = planeIndices[y] * 128 + byteIndex; diff --git a/Minecraft.World/Spider.cpp b/Minecraft.World/Spider.cpp index 5d7bdd2c..ff5c24ea 100644 --- a/Minecraft.World/Spider.cpp +++ b/Minecraft.World/Spider.cpp @@ -31,7 +31,7 @@ void Spider::defineSynchedData() { Monster::defineSynchedData(); - entityData->define(DATA_FLAGS_ID, static_cast(0)); + entityData->define(DATA_FLAGS_ID, static_cast(0)); } void Spider::tick() @@ -172,7 +172,7 @@ bool Spider::isClimbing() void Spider::setClimbing(bool value) { - byte flags = entityData->getByte(DATA_FLAGS_ID); + BYTE flags = entityData->getByte(DATA_FLAGS_ID); if (value) { flags |= 0x1; diff --git a/Minecraft.World/StemTile.cpp b/Minecraft.World/StemTile.cpp index 476b643c..328d4c27 100644 --- a/Minecraft.World/StemTile.cpp +++ b/Minecraft.World/StemTile.cpp @@ -128,9 +128,9 @@ int StemTile::getColor(int data) unsigned int minColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMin ); unsigned int maxColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Tile_StemMax ); - byte 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)); - byte blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( data/7.0f)); + BYTE 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)); + BYTE blueComponent = ((minColour)&0xFF) + (( (maxColour)&0xFF - (minColour)&0xFF)*( data/7.0f)); colour = redComponent<<16 | greenComponent<<8 | blueComponent; return colour; diff --git a/Minecraft.World/StringTag.h b/Minecraft.World/StringTag.h index 36b60368..1b28b3fc 100644 --- a/Minecraft.World/StringTag.h +++ b/Minecraft.World/StringTag.h @@ -18,7 +18,7 @@ public: data = dis->readUTF(); } - byte getId() { return TAG_String; } + BYTE getId() { return TAG_String; } wstring toString() { diff --git a/Minecraft.World/SynchedEntityData.cpp b/Minecraft.World/SynchedEntityData.cpp index 67b9597b..81b8bc8e 100644 --- a/Minecraft.World/SynchedEntityData.cpp +++ b/Minecraft.World/SynchedEntityData.cpp @@ -25,7 +25,7 @@ void SynchedEntityData::define(int id, int value) m_isEmpty = false; } -void SynchedEntityData::define(int id, byte value) +void SynchedEntityData::define(int id, BYTE value) { MemSect(17); checkId(id); @@ -94,7 +94,7 @@ void SynchedEntityData::checkId(int id) #endif } -byte SynchedEntityData::getByte(int id) +BYTE SynchedEntityData::getByte(int id) { return itemsById[id]->getValue_byte(); } @@ -144,7 +144,7 @@ void SynchedEntityData::set(int id, int value) } } -void SynchedEntityData::set(int id, byte value) +void SynchedEntityData::set(int id, BYTE value) { shared_ptr dataItem = itemsById[id]; @@ -362,7 +362,7 @@ vector > *SynchedEntityData::unpack(Data { case TYPE_BYTE: { - byte dataRead = input->readByte(); + BYTE dataRead = input->readByte(); item = std::make_shared(itemType, itemId, dataRead); } break; @@ -492,7 +492,7 @@ int SynchedEntityData::getSizeInBytes() size += static_cast(dataItem->getValue_wstring().length()) + 2; // Estimate, assuming all ascii chars break; case TYPE_ITEMINSTANCE: - // short + byte + short + // short + BYTE + short size += 2 + 1 + 2; // Estimate, assuming all ascii chars break; default: @@ -514,7 +514,7 @@ SynchedEntityData::DataItem::DataItem(int type, int id, int value) : type( type this->dirty = true; } -SynchedEntityData::DataItem::DataItem(int type, int id, byte value) : type( type ), id( id ) +SynchedEntityData::DataItem::DataItem(int type, int id, BYTE value) : type( type ), id( id ) { this->value_byte = value; this->dirty = true; @@ -554,7 +554,7 @@ void SynchedEntityData::DataItem::setValue(int value) this->value_int = value; } -void SynchedEntityData::DataItem::setValue(byte value) +void SynchedEntityData::DataItem::setValue(BYTE value) { this->value_byte = value; } @@ -594,7 +594,7 @@ float SynchedEntityData::DataItem::getValue_float() return value_float; } -byte SynchedEntityData::DataItem::getValue_byte() +BYTE SynchedEntityData::DataItem::getValue_byte() { return value_byte; } diff --git a/Minecraft.World/SynchedEntityData.h b/Minecraft.World/SynchedEntityData.h index 69d0f248..a57cb2b0 100644 --- a/Minecraft.World/SynchedEntityData.h +++ b/Minecraft.World/SynchedEntityData.h @@ -16,7 +16,7 @@ public: // 4J - there used to be one "value" type here of general type Object, just storing the different (used) varieties // here separately for us union { - byte value_byte; + BYTE value_byte; int value_int; short value_short; float value_float; @@ -27,7 +27,7 @@ public: public: // 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, BYTE value); DataItem(int type, int id, int value); DataItem(int type, int id, const wstring& value); DataItem(int type, int id, shared_ptr itemInstance); @@ -35,13 +35,13 @@ public: DataItem(int type, int id, float value); int getId(); - void setValue(byte value); + void setValue(BYTE value); void setValue(int value); void setValue(short value); void setValue(float value); void setValue(const wstring& value); void setValue(shared_ptr value); - byte getValue_byte(); + BYTE getValue_byte(); int getValue_int(); short getValue_short(); float getValue_float(); @@ -84,7 +84,7 @@ 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 // 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, BYTE value); void define(int id, const wstring& value); void define(int id, int value); void define(int id, short value); @@ -92,7 +92,7 @@ public: void defineNULL(int id, void *pVal); void checkId(int id); // 4J - added to contain common code from overloaded define functions above - byte getByte(int id); + BYTE getByte(int id); short getShort(int id); int getInteger(int id); float getFloat(int id); @@ -100,7 +100,7 @@ public: shared_ptr getItemInstance(int id); Pos *getPos(int id); // 4J - using overloads rather than template here - void set(int id, byte value); + void set(int id, BYTE value); void set(int id, int value); void set(int id, short value); void set(int id, float value); diff --git a/Minecraft.World/System.h b/Minecraft.World/System.h index 1d48b408..0fc71a7e 100644 --- a/Minecraft.World/System.h +++ b/Minecraft.World/System.h @@ -15,7 +15,7 @@ class System template static void arraycopy(arrayWithLength src, unsigned int srcPos, arrayWithLength *dst, unsigned int dstPos, unsigned int length); public: - ArrayCopyFunctionDeclaration(byte) + ArrayCopyFunctionDeclaration(BYTE) ArrayCopyFunctionDeclaration(Node *) ArrayCopyFunctionDeclaration(Biome *) ArrayCopyFunctionDeclaration(int) diff --git a/Minecraft.World/Tag.cpp b/Minecraft.World/Tag.cpp index eafdc9e8..2eac1575 100644 --- a/Minecraft.World/Tag.cpp +++ b/Minecraft.World/Tag.cpp @@ -108,7 +108,7 @@ Tag *Tag::readNamedTag(DataInput *dis, int tagDepth) return new EndTag(); } - byte type = dis->readByte(); + BYTE type = dis->readByte(); if (type == 0) { depth--; return new EndTag(); @@ -129,7 +129,7 @@ Tag *Tag::readNamedTag(DataInput *dis, int tagDepth) return new EndTag(); } // short length = dis.readShort(); - // byte[] bytes = new byte[length]; + // BYTE[] bytes = new BYTE[length]; // dis.readFully(bytes); tag->load(dis, tagDepth); @@ -142,7 +142,7 @@ void Tag::writeNamedTag(Tag *tag, DataOutput *dos) dos->writeByte(tag->getId()); if (tag->getId() == Tag::TAG_End) return; - // byte[] bytes = tag.getName().getBytes("UTF-8"); + // BYTE[] bytes = tag.getName().getBytes("UTF-8"); // dos.writeShort(bytes.length); // dos.write(bytes); dos->writeUTF(tag->getName()); @@ -150,7 +150,7 @@ void Tag::writeNamedTag(Tag *tag, DataOutput *dos) tag->write(dos); } -Tag *Tag::newTag(byte type, const wstring &name) +Tag *Tag::newTag(BYTE type, const wstring &name) { switch (type) { @@ -182,7 +182,7 @@ Tag *Tag::newTag(byte type, const wstring &name) return nullptr; } -const wchar_t *Tag::getTagName(byte type) +const wchar_t *Tag::getTagName(BYTE type) { switch (type) { diff --git a/Minecraft.World/Tag.h b/Minecraft.World/Tag.h index cfb125aa..bcdf220b 100644 --- a/Minecraft.World/Tag.h +++ b/Minecraft.World/Tag.h @@ -7,18 +7,18 @@ using namespace std; class Tag { public: - static const byte TAG_End = 0; - static const byte TAG_Byte = 1; - static const byte TAG_Short = 2; - static const byte TAG_Int = 3; - static const byte TAG_Long = 4; - static const byte TAG_Float = 5; - static const byte TAG_Double = 6; - static const byte TAG_Byte_Array = 7; - static const byte TAG_String = 8; - static const byte TAG_List = 9; - static const byte TAG_Compound = 10; - static const byte TAG_Int_Array = 11; + static const BYTE TAG_End = 0; + static const BYTE TAG_Byte = 1; + static const BYTE TAG_Short = 2; + static const BYTE TAG_Int = 3; + static const BYTE TAG_Long = 4; + static const BYTE TAG_Float = 5; + static const BYTE TAG_Double = 6; + static const BYTE TAG_Byte_Array = 7; + static const BYTE TAG_String = 8; + static const BYTE TAG_List = 9; + static const BYTE TAG_Compound = 10; + static const BYTE TAG_Int_Array = 11; static const int MAX_DEPTH = 512; private: wstring name; @@ -30,7 +30,7 @@ public: virtual void write(DataOutput *dos) = 0; virtual void load(DataInput *dis, int tagDepth) = 0; virtual wstring toString() = 0; - virtual byte getId() = 0; + virtual BYTE getId() = 0; void print(ostream out); void print(char *prefix, wostream out); wstring getName(); @@ -38,8 +38,8 @@ public: static Tag *readNamedTag(DataInput *dis); static Tag *readNamedTag(DataInput *dis, int tagDepth); static void writeNamedTag(Tag *tag, DataOutput *dos); - static Tag *newTag(byte type, const wstring &name); - static const wchar_t *getTagName(byte type); + static Tag *newTag(BYTE type, const wstring &name); + static const wchar_t *getTagName(BYTE type); virtual ~Tag() {} virtual bool equals(Tag *obj); // 4J Brought forward from 1.2 virtual Tag *copy() = 0; // 4J Brought foward from 1.2 diff --git a/Minecraft.World/TamableAnimal.cpp b/Minecraft.World/TamableAnimal.cpp index 1fb41df3..b9702f91 100644 --- a/Minecraft.World/TamableAnimal.cpp +++ b/Minecraft.World/TamableAnimal.cpp @@ -19,7 +19,7 @@ TamableAnimal::~TamableAnimal() void TamableAnimal::defineSynchedData() { Animal::defineSynchedData(); - entityData->define(DATA_FLAGS_ID, static_cast(0)); + entityData->define(DATA_FLAGS_ID, static_cast(0)); entityData->define(DATA_OWNERUUID_ID, L""); } @@ -87,7 +87,7 @@ void TamableAnimal::spawnTamingParticles(bool success) } } -void TamableAnimal::handleEntityEvent(byte id) +void TamableAnimal::handleEntityEvent(BYTE id) { if (id == EntityEvent::TAMING_SUCCEEDED) { @@ -110,14 +110,14 @@ bool TamableAnimal::isTame() void TamableAnimal::setTame(bool value) { - byte current = entityData->getByte(DATA_FLAGS_ID); + BYTE current = entityData->getByte(DATA_FLAGS_ID); if (value) { - entityData->set(DATA_FLAGS_ID, static_cast(current | 0x04)); + entityData->set(DATA_FLAGS_ID, static_cast(current | 0x04)); } else { - entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x04)); + entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x04)); } } @@ -128,14 +128,14 @@ bool TamableAnimal::isSitting() void TamableAnimal::setSitting(bool value) { - byte current = entityData->getByte(DATA_FLAGS_ID); + BYTE current = entityData->getByte(DATA_FLAGS_ID); if (value) { - entityData->set(DATA_FLAGS_ID, static_cast(current | 0x01)); + entityData->set(DATA_FLAGS_ID, static_cast(current | 0x01)); } else { - entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x01)); + entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x01)); } } diff --git a/Minecraft.World/TamableAnimal.h b/Minecraft.World/TamableAnimal.h index 7d17a43c..ad6e4757 100644 --- a/Minecraft.World/TamableAnimal.h +++ b/Minecraft.World/TamableAnimal.h @@ -27,7 +27,7 @@ protected: virtual void spawnTamingParticles(bool success); public: - virtual void handleEntityEvent(byte id); + virtual void handleEntityEvent(BYTE id); virtual bool isTame(); virtual void setTame(bool value); virtual bool isSitting(); diff --git a/Minecraft.World/TeleportEntityPacket.cpp b/Minecraft.World/TeleportEntityPacket.cpp index ccac5e51..3ad77440 100644 --- a/Minecraft.World/TeleportEntityPacket.cpp +++ b/Minecraft.World/TeleportEntityPacket.cpp @@ -23,11 +23,11 @@ TeleportEntityPacket::TeleportEntityPacket(shared_ptr e) x = Mth::floor(e->x * 32); y = Mth::floor(e->y * 32); z = Mth::floor(e->z * 32); - yRot = static_cast(e->yRot * 256 / 360); - xRot = static_cast(e->xRot * 256 / 360); + yRot = static_cast(e->yRot * 256 / 360); + xRot = static_cast(e->xRot * 256 / 360); } -TeleportEntityPacket::TeleportEntityPacket(int id, int x, int y, int z, byte yRot, byte xRot) +TeleportEntityPacket::TeleportEntityPacket(int id, int x, int y, int z, BYTE yRot, BYTE xRot) { this->id = id; this->x = x; diff --git a/Minecraft.World/TeleportEntityPacket.h b/Minecraft.World/TeleportEntityPacket.h index 38e09286..d7032ec5 100644 --- a/Minecraft.World/TeleportEntityPacket.h +++ b/Minecraft.World/TeleportEntityPacket.h @@ -8,11 +8,11 @@ class TeleportEntityPacket : public Packet, public enable_shared_from_this e); - TeleportEntityPacket(int id, int x, int y, int z, byte yRot, byte xRot); + TeleportEntityPacket(int id, int x, int y, int z, BYTE yRot, BYTE xRot); virtual void read(DataInputStream *dis); virtual void write(DataOutputStream *dos); diff --git a/Minecraft.World/TheEndBiome.cpp b/Minecraft.World/TheEndBiome.cpp index d54efb36..0dc22150 100644 --- a/Minecraft.World/TheEndBiome.cpp +++ b/Minecraft.World/TheEndBiome.cpp @@ -14,8 +14,8 @@ TheEndBiome::TheEndBiome(int id) : Biome(id) ambientFriendlies.clear(); enemies.push_back(new MobSpawnerData(eTYPE_ENDERMAN, 10, 4, 4)); - topMaterial = static_cast(Tile::dirt_Id); - material = static_cast(Tile::dirt_Id); + topMaterial = static_cast(Tile::dirt_Id); + material = static_cast(Tile::dirt_Id); decorator = new TheEndBiomeDecorator(this); } diff --git a/Minecraft.World/TheEndLevelRandomLevelSource.cpp b/Minecraft.World/TheEndLevelRandomLevelSource.cpp index 3b42f8ca..6b45c393 100644 --- a/Minecraft.World/TheEndLevelRandomLevelSource.cpp +++ b/Minecraft.World/TheEndLevelRandomLevelSource.cpp @@ -90,7 +90,7 @@ void TheEndLevelRandomLevelSource::prepareHeights(int xOffs, int zOffs, byteArra } else { } - blocks[offs] = static_cast(tileId); + blocks[offs] = static_cast(tileId); offs += step; val += vala; } @@ -119,8 +119,8 @@ void TheEndLevelRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray int runDepth = 1; int run = -1; - byte top = (byte) Tile::endStone_Id; - byte material = (byte) Tile::endStone_Id; + BYTE top = (BYTE) Tile::endStone_Id; + BYTE material = (BYTE) Tile::endStone_Id; for (int y = Level::genDepthMinusOne; y >= 0; y--) { @@ -139,7 +139,7 @@ void TheEndLevelRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray if (runDepth <= 0) { top = 0; - material = static_cast(Tile::endStone_Id); + material = static_cast(Tile::endStone_Id); } run = runDepth; @@ -169,7 +169,7 @@ LevelChunk *TheEndLevelRandomLevelSource::getChunk(int xOffs, int zOffs) BiomeArray biomes; // 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed unsigned int blocksSize = Level::genDepth * 16 * 16; - byte *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); + BYTE *tileData = static_cast(XPhysicalAlloc(blocksSize, MAXULONG_PTR, 4096, PAGE_READWRITE)); XMemSet128(tileData,0,blocksSize); byteArray blocks = byteArray(tileData,blocksSize); // byteArray blocks = byteArray(16 * level->depth * 16); diff --git a/Minecraft.World/Throwable.cpp b/Minecraft.World/Throwable.cpp index 08e40aa6..66302ba9 100644 --- a/Minecraft.World/Throwable.cpp +++ b/Minecraft.World/Throwable.cpp @@ -270,9 +270,9 @@ void Throwable::addAdditonalSaveData(CompoundTag *tag) tag->putShort(L"xTile", static_cast(xTile)); tag->putShort(L"yTile", static_cast(yTile)); tag->putShort(L"zTile", static_cast(zTile)); - tag->putByte(L"inTile", static_cast(lastTile)); - tag->putByte(L"shake", static_cast(shakeTime)); - tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); + tag->putByte(L"inTile", static_cast(lastTile)); + tag->putByte(L"shake", static_cast(shakeTime)); + tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); if (ownerName.empty() && (owner != nullptr) && owner->instanceof(eTYPE_PLAYER) ) { diff --git a/Minecraft.World/TileEntityDataPacket.cpp b/Minecraft.World/TileEntityDataPacket.cpp index a30f7873..78a91a2c 100644 --- a/Minecraft.World/TileEntityDataPacket.cpp +++ b/Minecraft.World/TileEntityDataPacket.cpp @@ -50,7 +50,7 @@ void TileEntityDataPacket::write(DataOutputStream *dos) dos->writeInt(x); dos->writeShort(y); dos->writeInt(z); - dos->writeByte(static_cast(type)); + dos->writeByte(static_cast(type)); writeNbt(tag, dos); } diff --git a/Minecraft.World/UpdateAttributesPacket.cpp b/Minecraft.World/UpdateAttributesPacket.cpp index e80ebe4e..45a0bc2a 100644 --- a/Minecraft.World/UpdateAttributesPacket.cpp +++ b/Minecraft.World/UpdateAttributesPacket.cpp @@ -46,7 +46,7 @@ void UpdateAttributesPacket::read(DataInputStream *dis) { eMODIFIER_ID id = static_cast(dis->readInt()); double amount = dis->readDouble(); - byte operation = dis->readByte(); + BYTE operation = dis->readByte(); modifiers.insert(new AttributeModifier(id, /*L"Unknown synced attribute modifier",*/ amount, operation)); } diff --git a/Minecraft.World/Villager.cpp b/Minecraft.World/Villager.cpp index d0bbc799..fa5c091c 100644 --- a/Minecraft.World/Villager.cpp +++ b/Minecraft.World/Villager.cpp @@ -686,7 +686,7 @@ int Villager::getPurchaseCost(int itemId, Random *random) return minMax.first + random->nextInt(minMax.second - minMax.first); } -void Villager::handleEntityEvent(byte id) +void Villager::handleEntityEvent(BYTE id) { if (id == EntityEvent::LOVE_HEARTS) { diff --git a/Minecraft.World/Villager.h b/Minecraft.World/Villager.h index d8aeb15a..3867cfd7 100644 --- a/Minecraft.World/Villager.h +++ b/Minecraft.World/Villager.h @@ -87,7 +87,7 @@ public: void setLastHurtByMob(shared_ptr mob); void die(DamageSource *source); - void handleEntityEvent(byte id); + void handleEntityEvent(BYTE id); private: void addParticlesAroundSelf(ePARTICLE_TYPE particle); diff --git a/Minecraft.World/VillagerGolem.cpp b/Minecraft.World/VillagerGolem.cpp index 09508bfc..54efa9f8 100644 --- a/Minecraft.World/VillagerGolem.cpp +++ b/Minecraft.World/VillagerGolem.cpp @@ -53,7 +53,7 @@ VillagerGolem::VillagerGolem(Level *level) : Golem(level) void VillagerGolem::defineSynchedData() { Golem::defineSynchedData(); - entityData->define(DATA_FLAGS_ID, static_cast(0)); + entityData->define(DATA_FLAGS_ID, static_cast(0)); } bool VillagerGolem::useNewAi() @@ -155,7 +155,7 @@ bool VillagerGolem::doHurtTarget(shared_ptr target) return hurt; } -void VillagerGolem::handleEntityEvent(byte id) +void VillagerGolem::handleEntityEvent(BYTE id) { if (id == EntityEvent::START_ATTACKING) { @@ -231,14 +231,14 @@ bool VillagerGolem::isPlayerCreated() void VillagerGolem::setPlayerCreated(bool value) { - byte current = entityData->getByte(DATA_FLAGS_ID); + BYTE current = entityData->getByte(DATA_FLAGS_ID); if (value) { - entityData->set(DATA_FLAGS_ID, static_cast(current | 0x01)); + entityData->set(DATA_FLAGS_ID, static_cast(current | 0x01)); } else { - entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x01)); + entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x01)); } } diff --git a/Minecraft.World/VillagerGolem.h b/Minecraft.World/VillagerGolem.h index 55b6cae2..ab43feba 100644 --- a/Minecraft.World/VillagerGolem.h +++ b/Minecraft.World/VillagerGolem.h @@ -41,7 +41,7 @@ public: virtual void addAdditonalSaveData(CompoundTag *tag); virtual void readAdditionalSaveData(CompoundTag *tag); virtual bool doHurtTarget(shared_ptr target); - virtual void handleEntityEvent(byte id); + virtual void handleEntityEvent(BYTE id); virtual shared_ptr getVillage(); virtual int getAttackAnimationTick(); virtual void offerFlower(bool offer); diff --git a/Minecraft.World/Witch.cpp b/Minecraft.World/Witch.cpp index 375c8388..4384456e 100644 --- a/Minecraft.World/Witch.cpp +++ b/Minecraft.World/Witch.cpp @@ -43,7 +43,7 @@ void Witch::defineSynchedData() { Monster::defineSynchedData(); - getEntityData()->define(DATA_USING_ITEM, static_cast(0)); + getEntityData()->define(DATA_USING_ITEM, static_cast(0)); } int Witch::getAmbientSound() @@ -63,7 +63,7 @@ int Witch::getDeathSound() void Witch::setUsingItem(bool isUsing) { - getEntityData()->set(DATA_USING_ITEM, isUsing ? static_cast(1) : static_cast(0)); + getEntityData()->set(DATA_USING_ITEM, isUsing ? static_cast(1) : static_cast(0)); } bool Witch::isUsingItem() @@ -153,7 +153,7 @@ void Witch::aiStep() Monster::aiStep(); } -void Witch::handleEntityEvent(byte id) +void Witch::handleEntityEvent(BYTE id) { if (id == EntityEvent::WITCH_HAT_MAGIC) { diff --git a/Minecraft.World/Witch.h b/Minecraft.World/Witch.h index 256f358f..4c9b80ad 100644 --- a/Minecraft.World/Witch.h +++ b/Minecraft.World/Witch.h @@ -37,7 +37,7 @@ protected: public: virtual bool useNewAi(); virtual void aiStep(); - virtual void handleEntityEvent(byte id); + virtual void handleEntityEvent(BYTE id); protected: virtual float getDamageAfterMagicAbsorb(DamageSource *damageSource, float damage); diff --git a/Minecraft.World/WitherSkull.cpp b/Minecraft.World/WitherSkull.cpp index ccde41d4..41e3b9eb 100644 --- a/Minecraft.World/WitherSkull.cpp +++ b/Minecraft.World/WitherSkull.cpp @@ -111,7 +111,7 @@ bool WitherSkull::hurt(DamageSource *source, float damage) void WitherSkull::defineSynchedData() { - entityData->define(DATA_DANGEROUS, static_cast(0)); + entityData->define(DATA_DANGEROUS, static_cast(0)); } bool WitherSkull::isDangerous() @@ -121,7 +121,7 @@ bool WitherSkull::isDangerous() void WitherSkull::setDangerous(bool value) { - entityData->set(DATA_DANGEROUS, value ? static_cast(1) : static_cast(0)); + entityData->set(DATA_DANGEROUS, value ? static_cast(1) : static_cast(0)); } bool WitherSkull::shouldBurn() diff --git a/Minecraft.World/Wolf.cpp b/Minecraft.World/Wolf.cpp index 5545138a..06b03a70 100644 --- a/Minecraft.World/Wolf.cpp +++ b/Minecraft.World/Wolf.cpp @@ -100,8 +100,8 @@ void Wolf::defineSynchedData() { TamableAnimal::defineSynchedData(); entityData->define(DATA_HEALTH_ID, getHealth()); - entityData->define(DATA_INTERESTED_ID, static_cast(0)); - entityData->define(DATA_COLLAR_COLOR, static_cast(ColoredTile::getTileDataForItemAuxValue(DyePowderItem::RED))); + entityData->define(DATA_INTERESTED_ID, static_cast(0)); + entityData->define(DATA_COLLAR_COLOR, static_cast(ColoredTile::getTileDataForItemAuxValue(DyePowderItem::RED))); } void Wolf::playStepSound(int xt, int yt, int zt, int t) @@ -114,7 +114,7 @@ void Wolf::addAdditonalSaveData(CompoundTag *tag) TamableAnimal::addAdditonalSaveData(tag); tag->putBoolean(L"Angry", isAngry()); - tag->putByte(L"CollarColor", static_cast(getCollarColor())); + tag->putByte(L"CollarColor", static_cast(getCollarColor())); } void Wolf::readAdditionalSaveData(CompoundTag *tag) @@ -438,7 +438,7 @@ bool Wolf::mobInteract(shared_ptr player) return TamableAnimal::mobInteract(player); } -void Wolf::handleEntityEvent(byte id) +void Wolf::handleEntityEvent(BYTE id) { if (id == EntityEvent::SHAKE_WETNESS) { @@ -485,14 +485,14 @@ bool Wolf::isAngry() void Wolf::setAngry(bool value) { - byte current = entityData->getByte(DATA_FLAGS_ID); + BYTE current = entityData->getByte(DATA_FLAGS_ID); if (value) { - entityData->set(DATA_FLAGS_ID, static_cast(current | 0x02)); + entityData->set(DATA_FLAGS_ID, static_cast(current | 0x02)); } else { - entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x02)); + entityData->set(DATA_FLAGS_ID, static_cast(current & ~0x02)); } } @@ -503,7 +503,7 @@ int Wolf::getCollarColor() void Wolf::setCollarColor(int color) { - entityData->set(DATA_COLLAR_COLOR, static_cast(color & 0xF)); + entityData->set(DATA_COLLAR_COLOR, static_cast(color & 0xF)); } // 4J-PB added for tooltips @@ -536,11 +536,11 @@ void Wolf::setIsInterested(bool value) { if (value) { - entityData->set(DATA_INTERESTED_ID, static_cast(1)); + entityData->set(DATA_INTERESTED_ID, static_cast(1)); } else { - entityData->set(DATA_INTERESTED_ID, static_cast(0)); + entityData->set(DATA_INTERESTED_ID, static_cast(0)); } } diff --git a/Minecraft.World/Wolf.h b/Minecraft.World/Wolf.h index edfd3814..47fad115 100644 --- a/Minecraft.World/Wolf.h +++ b/Minecraft.World/Wolf.h @@ -63,7 +63,7 @@ public: virtual bool doHurtTarget(shared_ptr target); virtual void setTame(bool value); virtual bool mobInteract(shared_ptr player); - virtual void handleEntityEvent(byte id); + virtual void handleEntityEvent(BYTE id); float getTailAngle(); virtual bool isFood(shared_ptr item); virtual int getMaxSpawnClusterSize(); diff --git a/Minecraft.World/Zombie.cpp b/Minecraft.World/Zombie.cpp index f982d847..c829f920 100644 --- a/Minecraft.World/Zombie.cpp +++ b/Minecraft.World/Zombie.cpp @@ -68,9 +68,9 @@ void Zombie::defineSynchedData() { Monster::defineSynchedData(); - getEntityData()->define(DATA_BABY_ID, static_cast(0)); - getEntityData()->define(DATA_VILLAGER_ID, static_cast(0)); - getEntityData()->define(DATA_CONVERTING_ID, static_cast(0)); + getEntityData()->define(DATA_BABY_ID, static_cast(0)); + getEntityData()->define(DATA_VILLAGER_ID, static_cast(0)); + getEntityData()->define(DATA_CONVERTING_ID, static_cast(0)); } int Zombie::getArmorValue() @@ -87,12 +87,12 @@ bool Zombie::useNewAi() bool Zombie::isBaby() { - return getEntityData()->getByte(DATA_BABY_ID) == static_cast(1); + return getEntityData()->getByte(DATA_BABY_ID) == static_cast(1); } void Zombie::setBaby(bool baby) { - getEntityData()->set(DATA_BABY_ID, (byte) (baby ? 1 : 0)); + getEntityData()->set(DATA_BABY_ID, (BYTE) (baby ? 1 : 0)); updateSize(baby); if (level != nullptr && !level->isClientSide) @@ -108,12 +108,12 @@ void Zombie::setBaby(bool baby) bool Zombie::isVillager() { - return getEntityData()->getByte(DATA_VILLAGER_ID) == static_cast(1); + return getEntityData()->getByte(DATA_VILLAGER_ID) == static_cast(1); } void Zombie::setVillager(bool villager) { - getEntityData()->set(DATA_VILLAGER_ID, static_cast(villager ? 1 : 0)); + getEntityData()->set(DATA_VILLAGER_ID, static_cast(villager ? 1 : 0)); } void Zombie::aiStep() @@ -426,7 +426,7 @@ bool Zombie::mobInteract(shared_ptr player) void Zombie::startConverting(int time) { villagerConversionTime = time; - getEntityData()->set(DATA_CONVERTING_ID, static_cast(1)); + getEntityData()->set(DATA_CONVERTING_ID, static_cast(1)); removeEffect(MobEffect::weakness->id); addEffect(new MobEffectInstance(MobEffect::damageBoost->id, time, min(level->difficulty - 1, 0))); @@ -434,7 +434,7 @@ void Zombie::startConverting(int time) level->broadcastEntityEvent(shared_from_this(), EntityEvent::ZOMBIE_CONVERTING); } -void Zombie::handleEntityEvent(byte id) +void Zombie::handleEntityEvent(BYTE id) { if (id == EntityEvent::ZOMBIE_CONVERTING) { @@ -453,7 +453,7 @@ bool Zombie::removeWhenFarAway() bool Zombie::isConverting() { - return getEntityData()->getByte(DATA_CONVERTING_ID) == static_cast(1); + return getEntityData()->getByte(DATA_CONVERTING_ID) == static_cast(1); } void Zombie::finishConversion() diff --git a/Minecraft.World/Zombie.h b/Minecraft.World/Zombie.h index f788ea63..f8214a4e 100644 --- a/Minecraft.World/Zombie.h +++ b/Minecraft.World/Zombie.h @@ -87,7 +87,7 @@ protected: virtual void startConverting(int time); public: - virtual void handleEntityEvent(byte id); + virtual void handleEntityEvent(BYTE id); protected: virtual bool removeWhenFarAway(); diff --git a/Minecraft.World/stdafx.h b/Minecraft.World/stdafx.h index 5b663ed7..b0b59aab 100644 --- a/Minecraft.World/stdafx.h +++ b/Minecraft.World/stdafx.h @@ -5,7 +5,7 @@ #pragma once #ifdef _WINDOWS64 -#define _HAS_STD_BYTE 0 // solve (std::)'byte' ambiguity with windows headers +#define _HAS_STD_BYTE 0 // solve (std::)'BYTE' ambiguity with windows headers #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: #include diff --git a/Minecraft.World/x64headers/extraX64.h b/Minecraft.World/x64headers/extraX64.h index 4af047b5..581b9427 100644 --- a/Minecraft.World/x64headers/extraX64.h +++ b/Minecraft.World/x64headers/extraX64.h @@ -11,8 +11,6 @@ #define MULTITHREAD_ENABLE -typedef unsigned char byte; - const int XUSER_INDEX_ANY = 255; const int XUSER_INDEX_FOCUS = 254; @@ -418,7 +416,7 @@ const int QNET_SENDDATA_SEQUENTIAL = 0; struct XRNM_SEND_BUFFER { DWORD dwDataSize; - byte *pbyData; + BYTE *pbyData; }; const int D3DBLEND_CONSTANTALPHA = 0;