diff --git a/.github/banner.png b/.github/banner.png index efe99482..a0c9fe2c 100644 Binary files a/.github/banner.png and b/.github/banner.png differ diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 32e60413..4b0d82e7 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: branches: - - 'main' + - 'TU24-Dev' paths: - '**' - '!.gitignore' @@ -17,7 +17,7 @@ permissions: packages: write concurrency: - group: nightly-tu30 + group: nightly-tu24 cancel-in-progress: true jobs: @@ -96,8 +96,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: nightly-tu30 - name: Project Zenith TU30-Dev + tag_name: nightly-tu24 + name: Project Zenith TU24-Dev body: ${{ env.RELEASE_BODY }} files: | artifacts/* @@ -136,7 +136,7 @@ jobs: # image_tag="nightly-test" # fi echo "owner=$owner" >> "$GITHUB_OUTPUT" - echo "image=ghcr.io/$owner/minecraft-tu30dev-dedicated-server" >> "$GITHUB_OUTPUT" + echo "image=ghcr.io/$owner/minecraft-tu24dev-dedicated-server" >> "$GITHUB_OUTPUT" echo "image_tag=$image_tag" >> "$GITHUB_OUTPUT" - name: Extract Docker metadata diff --git a/Minecraft.Client/AbstractTexturePack.cpp b/Minecraft.Client/AbstractTexturePack.cpp index afdbcde6..a3c67727 100644 --- a/Minecraft.Client/AbstractTexturePack.cpp +++ b/Minecraft.Client/AbstractTexturePack.cpp @@ -10,7 +10,7 @@ AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &na // 4J init textureId = -1; m_colourTable = nullptr; - m_structureTable = nullptr; + this->file = file; this->fallback = fallback; @@ -359,20 +359,6 @@ void AbstractTexturePack::loadHTMLColourTableFromXuiScene(HXUIOBJ hObj) } #endif -void AbstractTexturePack::loadStructureTable() -{ - if(app.hasArchiveFile(L"Structures.bin")) - { - byteArray structures = app.getArchiveFile(L"Structures.bin"); - - if(m_structureTable != nullptr) - delete m_structureTable; - - m_structureTable = new StructureTable(structures.data, structures.length); - delete [] structures.data; - } -} - void AbstractTexturePack::loadUI() { loadColourTable(); diff --git a/Minecraft.Client/AbstractTexturePack.h b/Minecraft.Client/AbstractTexturePack.h index 33bba153..6386ecf1 100644 --- a/Minecraft.Client/AbstractTexturePack.h +++ b/Minecraft.Client/AbstractTexturePack.h @@ -28,7 +28,6 @@ protected: TexturePack *fallback; ColourTable *m_colourTable; - StructureTable *m_structureTable; protected: BufferedImage *iconImage; @@ -82,7 +81,6 @@ protected: public: virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L""); virtual void loadColourTable(); - virtual void loadStructureTable(); virtual void loadUI(); virtual void unloadUI(); virtual wstring getXuiRootPath(); @@ -91,6 +89,5 @@ public: virtual unsigned int getDLCParentPackId(); virtual unsigned char getDLCSubPackId(); virtual ColourTable *getColourTable() { return m_colourTable; } - virtual StructureTable *getStructureTable() { return m_structureTable; } virtual ArchiveFile *getArchiveFile() { return nullptr; } }; diff --git a/Minecraft.Client/AchievementScreen.h b/Minecraft.Client/AchievementScreen.h index bc7e658e..0b4bc209 100644 --- a/Minecraft.Client/AchievementScreen.h +++ b/Minecraft.Client/AchievementScreen.h @@ -6,13 +6,13 @@ class StatsCounter; class AchievementScreen : public Screen { private: - static constexpr int BIGMAP_X = 16; - static constexpr int BIGMAP_Y = 17; - static constexpr int BIGMAP_WIDTH = 224; - static constexpr int BIGMAP_HEIGHT = 155; + static const int BIGMAP_X = 16; + static const int BIGMAP_Y = 17; + static const int BIGMAP_WIDTH = 224; + static const int BIGMAP_HEIGHT = 155; // number of pixels per achievement - static constexpr int ACHIEVEMENT_COORD_SCALE = 24; + static const int ACHIEVEMENT_COORD_SCALE = 24; static constexpr int EDGE_VALUE_X = Achievements::ACHIEVEMENT_WIDTH_POSITION * ACHIEVEMENT_COORD_SCALE; static constexpr int EDGE_VALUE_Y = Achievements::ACHIEVEMENT_HEIGHT_POSITION * ACHIEVEMENT_COORD_SCALE; diff --git a/Minecraft.Client/Chunk.cpp b/Minecraft.Client/Chunk.cpp index cce6046a..e0c7e4d9 100644 --- a/Minecraft.Client/Chunk.cpp +++ b/Minecraft.Client/Chunk.cpp @@ -203,7 +203,7 @@ void Chunk::rebuild() int r = 1; - int lists = levelRenderer->getGlobalIndexForChunk(this->x,this->y,this->z,level) * 3; + int lists = levelRenderer->getGlobalIndexForChunk(this->x,this->y,this->z,level) * 2; lists += levelRenderer->chunkLists; PIXEndNamedEvent(); @@ -227,7 +227,7 @@ void Chunk::rebuild() if( sourceChunk == nullptr ) { // Level chunk not loaded yet - treat as empty - for (int currentLayer = 0; currentLayer < 3; currentLayer++) + for (int currentLayer = 0; currentLayer < 2; currentLayer++) { levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY0, currentLayer); RenderManager.CBuffClear(lists + currentLayer); @@ -404,7 +404,7 @@ void Chunk::rebuild() if( empty ) { // 4J - added - clear any renderer data associated with this - for (int currentLayer = 0; currentLayer < 3; currentLayer++) + for (int currentLayer = 0; currentLayer < 2; currentLayer++) { levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY0, currentLayer); RenderManager.CBuffClear(lists + currentLayer); @@ -446,7 +446,7 @@ void Chunk::rebuild() bounds.boundingBox[4] = SIZE+g; bounds.boundingBox[5] = XZSIZE+g; } - for (int currentLayer = 0; currentLayer < 3; currentLayer++) + for (int currentLayer = 0; currentLayer < 2; currentLayer++) { bool renderNextLayer = false; bool rendered = false; @@ -561,20 +561,12 @@ void Chunk::rebuild() levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY0, currentLayer); RenderManager.CBuffClear(lists + currentLayer); } - if((currentLayer==0)&&(!renderNextLayer)) { - levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY1 | LevelRenderer::CHUNK_FLAG_NOTSKYLIT); + levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_EMPTY1); RenderManager.CBuffClear(lists + 1); - RenderManager.CBuffClear(lists + 2); break; } - // TODO CHECK THIS. With == 2 the game was cleaning the layer 2 when it shouldn't have - if((currentLayer==1)&&(!renderNextLayer)) - { - levelRenderer->setGlobalChunkFlag(this->x, this->y, this->z, level, LevelRenderer::CHUNK_FLAG_NOTSKYLIT); - RenderManager.CBuffClear(lists + 2); - } } // 4J MGH - added this to take the bound from the value calc'd in the tesselator @@ -700,8 +692,7 @@ void Chunk::rebuild() #endif // 4J - These removed items are now also removed from globalRenderableTileEntities -/* - // @Patoke: this is now unused in favour of the new render layer + if( LevelChunk::touchedSky ) { levelRenderer->clearGlobalChunkFlag(x, y, z, level, LevelRenderer::CHUNK_FLAG_NOTSKYLIT); @@ -710,7 +701,6 @@ void Chunk::rebuild() { levelRenderer->setGlobalChunkFlag(x, y, z, level, LevelRenderer::CHUNK_FLAG_NOTSKYLIT); } -*/ levelRenderer->setGlobalChunkFlag(x, y, z, level, LevelRenderer::CHUNK_FLAG_COMPILED); PIXEndNamedEvent(); @@ -775,7 +765,7 @@ void Chunk::rebuild_SPU() Region region(level, x0 - r, y0 - r, z0 - r, x1 + r, y1 + r, z1 + r, r); TileRenderer tileRenderer(®ion); - int lists = levelRenderer->getGlobalIndexForChunk(this->x,this->y,this->z,level) * 3; + int lists = levelRenderer->getGlobalIndexForChunk(this->x,this->y,this->z,level) * 2; lists += levelRenderer->chunkLists; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -800,7 +790,7 @@ void Chunk::rebuild_SPU() bounds.boundingBox[5] = SIZE+g; } - for (int currentLayer = 0; currentLayer < 3; currentLayer++) + for (int currentLayer = 0; currentLayer < 2; currentLayer++) { bool rendered = false; @@ -1066,11 +1056,11 @@ void Chunk::reset() // printf("\t\t [dec] refcount %d at %d, %d, %d\n",refCount,x,y,z); if( refCount == 0 ) { - int lists = levelRenderer->getGlobalIndexForChunk(x, y, z, level) * 3; + int lists = levelRenderer->getGlobalIndexForChunk(x, y, z, level) * 2; if(lists >= 0) { lists += levelRenderer->chunkLists; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 2; i++) { // 4J - added - clear any renderer data associated with this unused list RenderManager.CBuffClear(lists + i); diff --git a/Minecraft.Client/Common/App_Defines.h b/Minecraft.Client/Common/App_Defines.h index 80688990..fac503ec 100644 --- a/Minecraft.Client/Common/App_Defines.h +++ b/Minecraft.Client/Common/App_Defines.h @@ -104,8 +104,6 @@ enum EGameHostOptionWorldSize #define GAMESETTING_ANIMATEDCHARACTER 0x00008000 #define GAMESETTING_PS3EULAREAD 0x00010000 #define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000 -#define GAMESETTING_CAVESOUNDS 0x00100000 -#define GAMESETTING_CLASSICCRAFTING 0x00200000 #define GAMESETTING_OLDSWINGANIMATION 0x04000000 diff --git a/Minecraft.Client/Common/App_enums.h b/Minecraft.Client/Common/App_enums.h index 1d49fa19..51e84c65 100644 --- a/Minecraft.Client/Common/App_enums.h +++ b/Minecraft.Client/Common/App_enums.h @@ -180,9 +180,7 @@ enum eGameSetting // PSVita eGameSetting_PSVita_NetworkModeAdhoc, - // TU25 - eGameSetting_CaveSounds, - eGameSetting_ClassicCrafting, + }; @@ -508,10 +506,38 @@ enum eMinecraftColour eTextColor_EnchantDisabled, eTextColor_RenamedItemTitle, - // TU30 - eMinecraftColour_BlockLight_OverworldDimension, - eMinecraftColour_BlockLight_HellDimension, - eMinecraftColour_BlockLight_EndDimension, + //eHTMLColor_0 = 0x000000, //r:0 , g: 0, b: 0, i: 0 + //eHTMLColor_1 = 0x0000aa, //r:0 , g: 0, b: aa, i: 1 // blue, quite dark + //eHTMLColor_2 = 0x109e10, // Changed by request of Dave //0x00aa00, //r:0 , g: aa, b: 0, i: 2 // green + //eHTMLColor_3 = 0x109e9e, // Changed by request of Dave //0x00aaaa, //r:0 , g: aa, b: aa, i: 3 // cyan + //eHTMLColor_4 = 0xaa0000, //r:aa , g: 0, b: 0, i: 4 // red + //eHTMLColor_5 = 0xaa00aa, //r:aa , g: 0, b: aa, i: 5 // purple + //eHTMLColor_6 = 0xffaa00, //r:ff , g: aa, b: 0, i: 6 // orange + //eHTMLColor_7 = 0xaaaaaa, //r:aa , g: aa, b: aa, i: 7 // light gray + //eHTMLColor_8 = 0x555555, //r:55 , g: 55, b: 55, i: 8 // gray + //eHTMLColor_9 = 0x5555ff, //r:55 , g: 55, b: ff, i: 9 // blue + //eHTMLColor_a = 0x55ff55, //r:55 , g: ff, b: 55, i: a // green + //eHTMLColor_b = 0x55ffff, //r:55 , g: ff, b: ff, i: b // cyan + //eHTMLColor_c = 0xff5555, //r:ff , g: 55, b: 55, i: c // red pink + //eHTMLColor_d = 0xff55ff, //r:ff , g: 55, b: ff, i: d // bright pink + //eHTMLColor_e = 0xffff55, //r:ff , g: ff, b: 55, i: e // yellow + //eHTMLColor_f = 0xffffff, //r:ff , g: ff, b: ff, i: f + //eHTMLColor_0_dark = 0x000000, //r:0 , g: 0, b: 0, i: 10 + //eHTMLColor_1_dark = 0x00002a, //r:0 , g: 0, b: 2a, i: 11 + //eHTMLColor_2_dark = 0x002a00, //r:0 , g: 2a, b: 0, i: 12 + //eHTMLColor_3_dark = 0x002a2a, //r:0 , g: 2a, b: 2a, i: 13 + //eHTMLColor_4_dark = 0x2a0000, //r:2a , g: 0, b: 0, i: 14 + //eHTMLColor_5_dark = 0x2a002a, //r:2a , g: 0, b: 2a, i: 15 + //eHTMLColor_6_dark = 0x2a2a00, //r:2a , g: 2a, b: 0, i: 16 + //eHTMLColor_7_dark = 0x2a2a2a, //r:2a , g: 2a, b: 2a, i: 17 // dark gray + //eHTMLColor_8_dark = 0x151515, //r:15 , g: 15, b: 15, i: 18 + //eHTMLColor_9_dark = 0x15153f, //r:15 , g: 15, b: 3f, i: 19 + //eHTMLColor_a_dark = 0x153f15, //r:15 , g: 3f, b: 15, i: 1a + //eHTMLColor_b_dark = 0x153f3f, //r:15 , g: 3f, b: 3f, i: 1b + //eHTMLColor_c_dark = 0x3f1515, //r:3f , g: 15, b: 15, i: 1c // brown + //eHTMLColor_d_dark = 0x3f153f, //r:3f , g: 15, b: 3f, i: 1d + //eHTMLColor_e_dark = 0x3f3f15, //r:3f , g: 3f, b: 15, i: 1e + //eHTMLColor_f_dark = 0x3f3f3f, //r:3f , g: 3f, b: 3f, i: 1f eMinecraftColour_COUNT, }; @@ -586,32 +612,6 @@ enum _eTerrainFeatureType eTerrainFeature_Count }; -enum eMinecraftStructureFeature -{ - eMinecraftStructureFeature_NOT_SET = 0, - eMinecraftStructureFeature_VillageFeature, - eMinecraftStructureFeature_Count -}; - -enum eMinecraftStructurePiece -{ - eMinecraftStructurePiece_NOT_SET = 0, - eMinecraftStructurePiece_DesertPyramidPiece, - eMinecraftStructurePiece_SimpleHouse, - eMinecraftStructurePiece_SmallTemple, - eMinecraftStructurePiece_BookHouse, - eMinecraftStructurePiece_SmallHut, - eMinecraftStructurePiece_PigHouse, - eMinecraftStructurePiece_DoubleFarmland, - eMinecraftStructurePiece_Farmland, - eMinecraftStructurePiece_Smithy, - eMinecraftStructurePiece_TwoRoomHouse , - eMinecraftStructurePiece_LightPost, - eMinecraftStructurePiece_Well, - eMinecraftStructurePiece_Count -}; - - // 4J Stu - Whend adding new options you should consider whether having them on should disable achievements, and if so add them to the CanRecordStatsAndAchievements function // 4J Stu - These options are now saved in save data, so new options can ONLY be added to the end enum eGameHostOption diff --git a/Minecraft.Client/Common/Colours/ColourTable.cpp b/Minecraft.Client/Common/Colours/ColourTable.cpp index d5ec416a..07326b8c 100644 --- a/Minecraft.Client/Common/Colours/ColourTable.cpp +++ b/Minecraft.Client/Common/Colours/ColourTable.cpp @@ -4,7 +4,7 @@ unordered_map ColourTable::s_colourNamesMap; -const wchar_t* ColourTable::ColourTableElements[eMinecraftColour_COUNT] = +const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] = { L"NOTSET", @@ -315,16 +315,10 @@ const wchar_t* ColourTable::ColourTableElements[eMinecraftColour_COUNT] = L"HTMLColor_T3", L"HTMLColor_Black", L"HTMLColor_White", - L"Color_EnchantText", L"Color_EnchantTextFocus", L"Color_EnchantTextDisabled", L"Color_RenamedItemTitle", - - // TU30 - L"BlockLight_OverworldDimension", - L"BlockLight_HellDimension", - L"BlockLight_EndDimension", }; void ColourTable::staticCtor() diff --git a/Minecraft.Client/Common/Colours/ColourTable.h b/Minecraft.Client/Common/Colours/ColourTable.h index e8c1ede2..af99a8ed 100644 --- a/Minecraft.Client/Common/Colours/ColourTable.h +++ b/Minecraft.Client/Common/Colours/ColourTable.h @@ -5,7 +5,7 @@ class ColourTable private: unsigned int m_colourValues[eMinecraftColour_COUNT]; - static const wchar_t* ColourTableElements[eMinecraftColour_COUNT]; + static const wchar_t *ColourTableElements[eMinecraftColour_COUNT]; static unordered_map s_colourNamesMap; public: diff --git a/Minecraft.Client/Common/Consoles_App.cpp b/Minecraft.Client/Common/Consoles_App.cpp index 62a7d856..cfd37a1f 100644 --- a/Minecraft.Client/Common/Consoles_App.cpp +++ b/Minecraft.Client/Common/Consoles_App.cpp @@ -482,10 +482,7 @@ bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,shared_ptr player, else initData->bSplitscreen=false; - if(app.GetGameSettings(iPad,eGameSetting_ClassicCrafting)) - success = ui.NavigateToScene(iPad,eUIScene_ClassicCraftingMenu, initData); - else - success = ui.NavigateToScene(iPad,eUIScene_Crafting3x3Menu, initData); + success = ui.NavigateToScene(iPad,eUIScene_Crafting3x3Menu, initData); return success; } @@ -913,20 +910,16 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con app.SetGameHostOption(eGameHostOption_NaturalRegeneration, 1 ); app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1 ); - // TU25 - SetGameSettings(iPad,eGameSetting_CaveSounds, 1); - SetGameSettings(iPad,eGameSetting_ClassicCrafting, 0); - - // New - SetGameSettings(iPad,eGameSetting_GraphicsMode, 2); - SetGameSettings(iPad,eGameSetting_OldSwingAnimation, 0); - // 4J-PB - leave these in, or remove from everywhere they are referenced! // Although probably best to leave in unless we split the profile settings into platform specific classes - having different meaning per platform for the same bitmask could get confusing //#ifdef __PS3__ // PS3DEC13 SetGameSettings(iPad,eGameSetting_PS3_EULA_Read,0); // EULA not read + // New + SetGameSettings(iPad,eGameSetting_GraphicsMode,2); + SetGameSettings(iPad,eGameSetting_OldSwingAnimation,0); + // PS3 1.05 - added Greek // 4J-JEV: We cannot change these in-game, as they could affect localised strings and font. @@ -1082,10 +1075,6 @@ int CMinecraftApp::OldProfileVersionCallback(LPVOID pParam,unsigned char *pucDat // Added a bitmask in TU13 to enable/disable display of the Mash-up pack worlds in the saves list pGameSettings->uiMashUpPackWorldsDisplay = 0xFFFFFFFF; - // TU25 - pGameSettings->uiBitmaskValues|=GAMESETTING_CAVESOUNDS; //eGameSetting_CaveSounds - on - pGameSettings->uiBitmaskValues|=GAMESETTING_CLASSICCRAFTING; //eGameSetting_ClassicCrafting - off - // PS3 1.05 - added Greek pGameSettings->ucLanguage = MINECRAFT_LANGUAGE_DEFAULT; // use the system language } @@ -1384,10 +1373,6 @@ void CMinecraftApp::ApplyGameSettingsChanged(int iPad) ActionGameSettings(iPad,eGameSetting_PS3_EULA_Read); - // TU25 - ActionGameSettings(iPad,eGameSetting_CaveSounds); - ActionGameSettings(iPad,eGameSetting_ClassicCrafting); - ActionGameSettings(iPad,eGameSetting_OldSwingAnimation); ActionGameSettings(iPad,eGameSetting_GraphicsMode); } @@ -1624,12 +1609,6 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal) case eGameSetting_PSVita_NetworkModeAdhoc: //nothing to do here break; - case eGameSetting_CaveSounds: - //nothing to do here - break; - case eGameSetting_ClassicCrafting: - //nothing to do here - break; case eGameSetting_OldSwingAnimation: //nothing to do here break; @@ -2386,40 +2365,8 @@ void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucV } break; - // TU25 - case eGameSetting_CaveSounds: - if((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_CAVESOUNDS)!=(ucVal & 0x01)<<18) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_CAVESOUNDS; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_CAVESOUNDS; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_ClassicCrafting: - if((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_CLASSICCRAFTING)!=(ucVal & 0x01)<<19) - { - if(ucVal==1) - { - GameSettingsA[iPad]->uiBitmaskValues|=GAMESETTING_CLASSICCRAFTING; - } - else - { - GameSettingsA[iPad]->uiBitmaskValues&=~GAMESETTING_CLASSICCRAFTING; - } - ActionGameSettings(iPad,eVal); - GameSettingsA[iPad]->bSettingsChanged=true; - } - break; - case eGameSetting_OldSwingAnimation: - if((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_OLDSWINGANIMATION)!=(ucVal & 0x01)<<26) + if(((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_OLDSWINGANIMATION) != 0) != ((ucVal & 0x01) != 0)) { if(ucVal==1) { @@ -2432,6 +2379,7 @@ void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucV ActionGameSettings(iPad,eVal); GameSettingsA[iPad]->bSettingsChanged=true; } + break; case eGameSetting_GraphicsMode: if(GameSettingsA[iPad]->ucGraphicsMode != ucVal) @@ -2578,16 +2526,8 @@ unsigned char CMinecraftApp::GetGameSettings(int iPad,eGameSetting eVal) case eGameSetting_PSVita_NetworkModeAdhoc: return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PSVITANETWORKMODEADHOC)>>17; - - // TU25 - case eGameSetting_CaveSounds: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_CAVESOUNDS)>>18; - case eGameSetting_ClassicCrafting: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_CLASSICCRAFTING)>>19; - - // New case eGameSetting_OldSwingAnimation: - return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_OLDSWINGANIMATION)>>26; + return (GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_OLDSWINGANIMATION) >> 26; break; case eGameSetting_GraphicsMode: return GameSettingsA[iPad]->ucGraphicsMode; @@ -3728,7 +3668,7 @@ void CMinecraftApp::HandleXuiActions(void) else { #if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ - if(UIScene_LoadCreateJoinMenu::isSaveTransferRunning()) + if(UIScene_LoadOrJoinMenu::isSaveTransferRunning()) { // the save transfer is still in progress, delay jumping back to the main menu until we've cleaned up SetAction(i,eAppAction_EthernetDisconnected); @@ -5776,8 +5716,8 @@ void CMinecraftApp::HandleDLC(DLCPack *pack) char szPath[] = "DLCDrive:\\"; char szFullFilename[256]; - strcpy_s(szFullFilename,szPath); - strcat_s(szFullFilename, "*"); + strcpy(szFullFilename,szPath); + strcat(szFullFilename,"*"); // Start the find and check for failure. hFind = FindFirstFile( szFullFilename, &wfd ); @@ -5791,8 +5731,8 @@ void CMinecraftApp::HandleDLC(DLCPack *pack) // Display each file and ask for the next. do { - strcpy_s(szFullFilename,szPath); - strcat_s(szFullFilename,wfd.cFileName); + strcpy(szFullFilename,szPath); + strcat(szFullFilename,wfd.cFileName); if(( GetFileAttributes( szFullFilename ) & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) { @@ -7103,8 +7043,8 @@ HRESULT CMinecraftApp::RegisterMojangData(WCHAR *pXuidName, PlayerUID xuid, WCHA ZeroMemory(pMojangData,sizeof(MOJANG_DATA)); pMojangData->eXuid=eTempXuid; - wcsncpy_s( pMojangData->wchSkin, pSkin, MAX_CAPENAME_SIZE); - wcsncpy_s( pMojangData->wchCape, pCape, MAX_CAPENAME_SIZE); + wcsncpy( pMojangData->wchSkin, pSkin, MAX_CAPENAME_SIZE); + wcsncpy( pMojangData->wchCape, pCape, MAX_CAPENAME_SIZE); MojangData[xuid]=pMojangData; } @@ -7300,7 +7240,7 @@ HRESULT CMinecraftApp::RegisterDLCData(char *pchDLCName, unsigned int uiSortInde pDLCData->iConfig = app.GetiConfigFromName(pchDLCName); pDLCData->uiSortIndex=uiSortIndex; pDLCData->eDLCType = app.GetDLCTypeFromName(pchDLCName); - strcpy_s(pDLCData->chImageURL,pchImageURL); + strcpy(pDLCData->chImageURL,pchImageURL); //bool bIsTrialDLC = app.GetTrialFromName(pchDLCName); switch(pDLCData->eDLCType) @@ -7308,14 +7248,14 @@ HRESULT CMinecraftApp::RegisterDLCData(char *pchDLCName, unsigned int uiSortInde case e_DLC_TexturePacks: { char *pchName=(char *)malloc(strlen(pchDLCName)+1); - strcpy_s(pchName,pchDLCName); + strcpy(pchName,pchDLCName); DLCTextures_PackID[pDLCData->iConfig]=pchName; } break; case e_DLC_MashupPacks: { char *pchName=(char *)malloc(strlen(pchDLCName)+1); - strcpy_s(pchName,pchDLCName); + strcpy(pchName,pchDLCName); DLCTextures_PackID[pDLCData->iConfig]=pchName; } break; @@ -7806,7 +7746,7 @@ void CMinecraftApp::AddLevelToBannedLevelList(int iPad, PlayerUID xuid, char *ps #else memcpy(&pBannedListData->xuid, &xuid, sizeof(PlayerUID)); #endif - strcpy_s(pBannedListData->pszLevelName,pszLevelName); + strcpy(pBannedListData->pszLevelName,pszLevelName); m_vBannedListA[iPad]->push_back(pBannedListData); if (bWriteToTMS) @@ -7926,7 +7866,7 @@ void CMinecraftApp::AddCreditText(LPCWSTR lpStr) pCreditStruct->m_iStringID[0]=NO_TRANSLATED_STRING; pCreditStruct->m_iStringID[1]=NO_TRANSLATED_STRING; pCreditStruct->m_Text=new WCHAR [wcslen(lpStr)+1]; - wcscpy_s((WCHAR*)pCreditStruct->m_Text, wcslen(lpStr) + 1, lpStr); + wcscpy((WCHAR *)pCreditStruct->m_Text,lpStr); vDLCCredits.push_back(pCreditStruct); } @@ -8533,7 +8473,7 @@ unsigned int CMinecraftApp::CreateImageTextData(PBYTE bTextMetadata, int64_t see int iTextMetadataBytes = 0; if(hasSeed) { - strcpy_s((char*)bTextMetadata, 8, "4J_SEED"); + strcpy((char *)bTextMetadata,"4J_SEED"); _i64toa_s(seed,(char *)&bTextMetadata[8],42,10); // get the length @@ -8543,7 +8483,7 @@ unsigned int CMinecraftApp::CreateImageTextData(PBYTE bTextMetadata, int64_t see } // Save the host options that this world was last played with - strcpy_s((char *)&bTextMetadata[iTextMetadataBytes], 15, "4J_HOSTOPTIONS"); + strcpy((char *)&bTextMetadata[iTextMetadataBytes],"4J_HOSTOPTIONS"); _itoa_s(uiHostOptions,(char *)&bTextMetadata[iTextMetadataBytes+15],9,16); iTextMetadataBytes += 15; @@ -8551,7 +8491,7 @@ unsigned int CMinecraftApp::CreateImageTextData(PBYTE bTextMetadata, int64_t see ++iTextMetadataBytes; // Add a null terminator at the end of the host options value // Save the texture pack id - strcpy_s((char *)&bTextMetadata[iTextMetadataBytes], 15, "4J_TEXTUREPACK"); + strcpy((char *)&bTextMetadata[iTextMetadataBytes],"4J_TEXTUREPACK"); _itoa_s(uiTexturePackId,(char *)&bTextMetadata[iTextMetadataBytes+15],9,16); iTextMetadataBytes += 15; @@ -9079,7 +9019,7 @@ int CMinecraftApp::TMSPPFileReturned(LPVOID pParam,int iPad,int iUserData,C4JSto { #if defined(_XBOX) || defined(_WINDOWS64) char szFile[MAX_TMSFILENAME_SIZE]; - wcstombs_s(nullptr, szFile, MAX_TMSFILENAME_SIZE, pCurrent->wchFilename, _TRUNCATE); + wcstombs(szFile,pCurrent->wchFilename,MAX_TMSFILENAME_SIZE); if(strcmp(szFilename,szFile)==0) @@ -9592,7 +9532,7 @@ int CMinecraftApp::TexturePackDialogReturned(void* pParam, int iPad, C4JStorage: strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); #ifdef __ORBIS__ - strcpy_s(chName, chKeyName); + strcpy(chName, chKeyName); #else sprintf(chName, "%s-%s", app.GetCommerceCategory(), chKeyName); #endif @@ -10323,7 +10263,7 @@ enum ETitleUpdateTexturePacks }; #ifdef _WINDOWS64 -wstring titleUpdateTexturePackRoot = L"Data/DLC"; +wstring titleUpdateTexturePackRoot = L"Data/DLC/"; #elif defined(__ORBIS__) wstring titleUpdateTexturePackRoot = L"/app0/orbis/CU/DLC/"; #elif defined(__PSVITA__) diff --git a/Minecraft.Client/Common/DLC/DLCSkinFile.cpp b/Minecraft.Client/Common/DLC/DLCSkinFile.cpp index dbcc93bb..f7ef2ad0 100644 --- a/Minecraft.Client/Common/DLC/DLCSkinFile.cpp +++ b/Minecraft.Client/Common/DLC/DLCSkinFile.cpp @@ -116,7 +116,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring #ifdef __PS3__ // 4J Stu - The Xbox version used swscanf_s which isn't available in GCC. - swscanf_s(value.c_str(), L"%10ls%f%f%f%f%f%f%f%f", wchBodyPart, + swscanf(value.c_str(), L"%10ls%f%f%f%f%f%f%f%f", wchBodyPart, #else swscanf_s(value.c_str(), L"%9ls%f%f%f%f%f%f%f%f", wchBodyPart,10, #endif @@ -161,7 +161,7 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring case DLCManager::e_DLCParamType_Anim: #ifdef __PS3__ // 4J Stu - The Xbox version used swscanf_s which isn't available in GCC. - swscanf_s(value.c_str(), L"%X", &m_uiAnimOverrideBitmask); + swscanf(value.c_str(), L"%X", &m_uiAnimOverrideBitmask); #else swscanf_s(value.c_str(), L"%X", &m_uiAnimOverrideBitmask,sizeof(unsigned int)); #endif diff --git a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h index 03639f75..712a29ab 100644 --- a/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h +++ b/Minecraft.Client/Common/GameRules/ConsoleGenerateStructure.h @@ -37,6 +37,6 @@ public: virtual int getMinY(); EStructurePiece GetType() { return static_cast(0); } - void addAdditionalSaveData(DataOutputStream *dos) {} - void readAdditonalSaveData(DataInputStream *dis) {} + void addAdditonalSaveData(CompoundTag *tag) {} + void readAdditonalSaveData(CompoundTag *tag) {} }; \ No newline at end of file diff --git a/Minecraft.Client/Common/Media/MediaWindows64.arc b/Minecraft.Client/Common/Media/MediaWindows64.arc index 3f0adfef..a2d9925f 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64.arc and b/Minecraft.Client/Common/Media/MediaWindows64.arc differ diff --git a/Minecraft.Client/Common/Media/languages.loc b/Minecraft.Client/Common/Media/languages.loc index d13ffcc1..73691542 100644 Binary files a/Minecraft.Client/Common/Media/languages.loc and b/Minecraft.Client/Common/Media/languages.loc differ diff --git a/Minecraft.Client/Common/Media/media.txt b/Minecraft.Client/Common/Media/media.txt index 26b8d3dd..2e10707b 100644 --- a/Minecraft.Client/Common/Media/media.txt +++ b/Minecraft.Client/Common/Media/media.txt @@ -2,6 +2,4 @@ splashes.txt HTMLColours.col Graphics\SaveChest.png Graphics\MinecraftIcon.png -Graphics\CreateWorldIcon.png -Graphics\TexturePackIcon.png -Graphics\TutorialIcon.png \ No newline at end of file +Graphics\TexturePackIcon.png \ No newline at end of file diff --git a/Minecraft.Client/Common/Media/movies720.txt b/Minecraft.Client/Common/Media/movies720.txt index 5b2c336b..524fcee0 100644 --- a/Minecraft.Client/Common/Media/movies720.txt +++ b/Minecraft.Client/Common/Media/movies720.txt @@ -49,7 +49,6 @@ JoinMenu720.swf LanguagesMenu720.swf LanguagesMenuSplit720.swf LoadOrJoinMenu720.swf -LoadCreateJoinMenu720.swf LaunchMoreOptionsMenu720.swf LeaderboardMenu720.swf LoadMenu720.swf diff --git a/Minecraft.Client/Common/Tutorial/Tutorial.cpp b/Minecraft.Client/Common/Tutorial/Tutorial.cpp index 38f6911b..6f879ca9 100644 --- a/Minecraft.Client/Common/Tutorial/Tutorial.cpp +++ b/Minecraft.Client/Common/Tutorial/Tutorial.cpp @@ -437,7 +437,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) int coalOreItems[] = {Tile::coalOre_Id}; if(!isHintCompleted(e_Tutorial_Hint_Coal_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Coal_Ore, this, coalOreItems, 1 ) ); - int treeTrunkItems[] = {Tile::treeTrunk_Id,Tile::newTreeTrunk_Id}; + int treeTrunkItems[] = {Tile::treeTrunk_Id}; if(!isHintCompleted(e_Tutorial_Hint_Tree_Trunk)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tree_Trunk, this, treeTrunkItems, 1 ) ); int leavesItems[] = {Tile::leaves_Id}; @@ -511,8 +511,8 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) int woodSlabItems[] = {Tile::woodSlabHalf_Id, Tile::woodSlab_Id}; if(!isHintCompleted(e_Tutorial_Hint_Stone_Slab)) { - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, 2, -1, LogTile::BIRCH_TRUNK ) ); - addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, 2, -1, LogTile::DARK_TRUNK ) ); + addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, 2, -1, TreeTile::BIRCH_TRUNK ) ); + addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, 2, -1, TreeTile::DARK_TRUNK ) ); } int redBrickItems[] = {Tile::redBrick_Id}; @@ -563,13 +563,13 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) int signItems[] = {Tile::sign_Id, Tile::wallSign_Id}; if(!isHintCompleted(e_Tutorial_Hint_Sign)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sign, this, signItems, 2, Item::sign_Id ) ); - int doorWoodItems[] = {Tile::door_wood_Id,Tile::door_spruce_Id,Tile::door_birch_Id,Tile::door_jungle_Id,Tile::door_acacia_Id,Tile::door_dark_oak_Id}; + int doorWoodItems[] = {Tile::door_wood_Id}; if(!isHintCompleted(e_Tutorial_Hint_Door_Wood)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Door_Wood, this, doorWoodItems, 1, Item::door_wood->id ) ); int ladderItems[] = {Tile::ladder_Id}; if(!isHintCompleted(e_Tutorial_Hint_Ladder)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Ladder, this, ladderItems, 1 ) ); - int stairsStoneItems[] = {Tile::stairs_stone_Id,Tile::stairs_bricks_Id,Tile::stairs_stoneBrick_Id,Tile::stairs_wood_Id,Tile::stairs_sprucewood_Id,Tile::stairs_birchwood_Id,Tile::stairs_acaciawood_Id,Tile::stairs_darkoakwood_Id,Tile::stairs_netherBricks_Id,Tile::stairs_sandstone_Id,Tile::stairs_quartz_Id}; + int stairsStoneItems[] = {Tile::stairs_stone_Id,Tile::stairs_bricks_Id,Tile::stairs_stoneBrick_Id,Tile::stairs_wood_Id,Tile::stairs_sprucewood_Id,Tile::stairs_birchwood_Id,Tile::stairs_netherBricks_Id,Tile::stairs_sandstone_Id,Tile::stairs_quartz_Id}; if(!isHintCompleted(e_Tutorial_Hint_Stairs_Stone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stairs_Stone, this, stairsStoneItems, 9 ) ); int railItems[] = {Tile::rail_Id}; @@ -635,7 +635,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) int redstoneRepeaterItems[] = {Tile::diode_on_Id, Tile::diode_off_Id}; if(!isHintCompleted(e_Tutorial_Hint_Redstone_Repeater)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Redstone_Repeater, this, redstoneRepeaterItems, 2, Item::repeater_Id ) ); - int trapdoorItems[] = {Tile::trapdoor_Id,Tile::iron_trapdoor_Id}; + int trapdoorItems[] = {Tile::trapdoor_Id}; if(!isHintCompleted(e_Tutorial_Hint_Trapdoor)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Trapdoor, this, trapdoorItems, 1 ) ); int pistonItems[] = {Tile::pistonBase_Id}; @@ -665,7 +665,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) int vineItems[] = {Tile::vine_Id}; if(!isHintCompleted(e_Tutorial_Hint_Vine)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Vine, this, vineItems, 1 ) ); - int fenceGateItems[] = {Tile::fenceGate_Id,Tile::spruceFenceGate_Id,Tile::birchFenceGate_Id,Tile::jungleFenceGate_Id,Tile::acaciaFenceGate_Id,Tile::darkOakFenceGate_Id}; + int fenceGateItems[] = {Tile::fenceGate_Id}; if(!isHintCompleted(e_Tutorial_Hint_Fence_Gate)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Fence_Gate, this, fenceGateItems, 1 ) ); int mycelItems[] = {Tile::mycel_Id}; @@ -772,7 +772,7 @@ Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad ) int redstoneBlockItems[] = {Tile::redstoneBlock_Id}; if(!isHintCompleted(e_Tutorial_Hint_RedstoneBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_RedstoneBlock, this, redstoneBlockItems, 1 ) ); - int daylightDetectorItems[] = {Tile::daylightDetector_Id,Tile::daylightDetectorInverted_Id}; + int daylightDetectorItems[] = {Tile::daylightDetector_Id}; if(!isHintCompleted(e_Tutorial_Hint_DaylightDetector)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_DaylightDetector, this, daylightDetectorItems, 1 ) ); int dropperItems[] = {Tile::dropper_Id}; diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h index 1d54b9cb..6710e18f 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h @@ -43,8 +43,6 @@ protected: eSectionInventoryUsing, eSectionInventoryInventory, eSectionInventoryArmor, - eSectionInventoryCraftingGrid, - eSectionInventoryCraftingResult, eSectionInventoryMax, eSectionTrapUsing, @@ -119,12 +117,6 @@ protected: eSectionFireworksResult, eSectionFireworksIngredients, eSectionFireworksMax, - - eSectionClassicCraftingHotbar, - eSectionClassicCraftingInventory, - eSectionClassicCraftingResult, - eSectionClassicCraftingGrid, - eSectionClassicCraftingMax, }; AbstractContainerMenu* m_menu; diff --git a/Minecraft.Client/Common/UI/IUIScene_ClassicCraftingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_ClassicCraftingMenu.cpp deleted file mode 100644 index c31dff86..00000000 --- a/Minecraft.Client/Common/UI/IUIScene_ClassicCraftingMenu.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include "stdafx.h" - -#include "IUIScene_ClassicCraftingMenu.h" -#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" - -IUIScene_AbstractContainerMenu::ESceneSection IUIScene_ClassicCraftingMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ) -{ - ESceneSection newSection = eSection; - int xOffset = 0; - int yOffset = 0; - - // Find the new section if there is one - switch( eSection ) - { - case eSectionClassicCraftingGrid: - if(eTapDirection == eTapStateDown) - { - newSection = eSectionClassicCraftingInventory; - xOffset = -1; - } - else if(eTapDirection == eTapStateUp) - { - newSection = eSectionClassicCraftingHotbar; - xOffset = -1; - } - else if(eTapDirection == eTapStateLeft) - { - newSection = eSectionClassicCraftingResult; - } - else if(eTapDirection == eTapStateRight) - { - newSection = eSectionClassicCraftingResult; - } - break; - case eSectionClassicCraftingResult: - if(eTapDirection == eTapStateDown) - { - newSection = eSectionClassicCraftingInventory; - xOffset = -7; - } - else if(eTapDirection == eTapStateUp) - { - newSection = eSectionClassicCraftingHotbar; - xOffset = -7; - } - else if(eTapDirection == eTapStateLeft) - { - newSection = eSectionClassicCraftingGrid; - yOffset = -1; - *piTargetX = getSectionColumns(eSectionClassicCraftingGrid); - } - else if(eTapDirection == eTapStateRight) - { - newSection = eSectionClassicCraftingGrid; - yOffset = -1; - *piTargetX = 0; - } - break; - case eSectionClassicCraftingInventory: - if(eTapDirection == eTapStateDown) - { - newSection = eSectionClassicCraftingHotbar; - } - else if(eTapDirection == eTapStateUp) - { - if(*piTargetX < 6) - { - newSection = eSectionClassicCraftingGrid; - xOffset = 1; - } - else - { - newSection = eSectionClassicCraftingResult; - } - } - break; - case eSectionClassicCraftingHotbar: - if(eTapDirection == eTapStateDown) - { - if(*piTargetX < 6) - { - newSection = eSectionClassicCraftingGrid; - xOffset = 1; - } - else - { - newSection = eSectionClassicCraftingResult; - } - } - else if(eTapDirection == eTapStateUp) - { - newSection = eSectionClassicCraftingInventory; - } - break; - default: - assert( false ); - break; - } - - updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset, yOffset); - - return newSection; -} - -int IUIScene_ClassicCraftingMenu::getSectionStartOffset(ESceneSection eSection) -{ - int offset = 0; - - switch( eSection ) - { - case eSectionClassicCraftingHotbar: - offset = CraftingMenu::INV_SLOT_START + 27; - break; - case eSectionClassicCraftingInventory: - offset = CraftingMenu::INV_SLOT_START; - break; - case eSectionClassicCraftingGrid: - offset = CraftingMenu::CRAFT_SLOT_START; - break; - case eSectionClassicCraftingResult: - offset = CraftingMenu::RESULT_SLOT; - break; - default: - assert( false ); - break; - } - - return offset; -} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_ClassicCraftingMenu.h b/Minecraft.Client/Common/UI/IUIScene_ClassicCraftingMenu.h deleted file mode 100644 index 061d66f8..00000000 --- a/Minecraft.Client/Common/UI/IUIScene_ClassicCraftingMenu.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "IUIScene_AbstractContainerMenu.h" - -class IUIScene_ClassicCraftingMenu : public virtual IUIScene_AbstractContainerMenu -{ -protected: - virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ); - int getSectionStartOffset(ESceneSection eSection); -}; \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index 90872034..c03cdbaa 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -53,18 +53,14 @@ void IUIScene_CreativeMenu::staticCtor() ITEM(Tile::emeraldOre_Id) ITEM(Tile::netherQuartz_Id) ITEM(Tile::unbreakable_Id) - ITEM_AUX(Tile::wood_Id,LogTile::OAK_TRUNK) - ITEM_AUX(Tile::wood_Id,LogTile::DARK_TRUNK) - ITEM_AUX(Tile::wood_Id,LogTile::BIRCH_TRUNK) - ITEM_AUX(Tile::wood_Id,LogTile::JUNGLE_TRUNK) - ITEM_AUX(Tile::wood_Id,LogTile::ACACIA_TRUNK) - ITEM_AUX(Tile::wood_Id,LogTile::DARK_OAK_TRUNK) - ITEM_AUX(Tile::treeTrunk_Id, LogTile::OAK_TRUNK) - ITEM_AUX(Tile::treeTrunk_Id, LogTile::DARK_TRUNK) - ITEM_AUX(Tile::treeTrunk_Id, LogTile::BIRCH_TRUNK) - ITEM_AUX(Tile::treeTrunk_Id, LogTile::JUNGLE_TRUNK) - ITEM_AUX(Tile::newTreeTrunk_Id, 0) // acacia - ITEM_AUX(Tile::newTreeTrunk_Id, 1) // dark oak + ITEM_AUX(Tile::wood_Id,0) + ITEM_AUX(Tile::wood_Id,TreeTile::DARK_TRUNK) + ITEM_AUX(Tile::wood_Id,TreeTile::BIRCH_TRUNK) + ITEM_AUX(Tile::wood_Id,TreeTile::JUNGLE_TRUNK) + ITEM_AUX(Tile::treeTrunk_Id, 0) + ITEM_AUX(Tile::treeTrunk_Id, TreeTile::DARK_TRUNK) + ITEM_AUX(Tile::treeTrunk_Id, TreeTile::BIRCH_TRUNK) + ITEM_AUX(Tile::treeTrunk_Id, TreeTile::JUNGLE_TRUNK) ITEM(Tile::gravel_Id) ITEM(Tile::redBrick_Id) ITEM(Tile::mossyCobblestone_Id) @@ -77,11 +73,6 @@ void IUIScene_CreativeMenu::staticCtor() ITEM(Tile::glowstone_Id) ITEM(Tile::fence_Id) ITEM(Tile::netherFence_Id) - ITEM(Tile::spruce_fence_Id) - ITEM(Tile::birch_fence_Id) - ITEM(Tile::jungle_fence_Id) - ITEM(Tile::acacia_fence_Id) - ITEM(Tile::dark_oak_fence_Id) ITEM(Tile::ironFence_Id) ITEM_AUX(Tile::cobbleWall_Id, WallTile::TYPE_NORMAL) ITEM_AUX(Tile::cobbleWall_Id, WallTile::TYPE_MOSSY) @@ -98,30 +89,17 @@ void IUIScene_CreativeMenu::staticCtor() ITEM_AUX(Tile::quartzBlock_Id,QuartzBlockTile::TYPE_CHISELED) ITEM_AUX(Tile::quartzBlock_Id,QuartzBlockTile::TYPE_LINES_Y) ITEM(Tile::trapdoor_Id) - ITEM(Tile::iron_trapdoor_Id) ITEM(Tile::fenceGate_Id) - ITEM(Tile::spruceFenceGate_Id) - ITEM(Tile::birchFenceGate_Id) - ITEM(Tile::jungleFenceGate_Id) - ITEM(Tile::acaciaFenceGate_Id) - ITEM(Tile::darkOakFenceGate_Id) ITEM(Item::door_wood_Id) ITEM(Item::door_iron_Id) - ITEM(Item::door_spruce_Id) - ITEM(Item::door_birch_Id) - ITEM(Item::door_jungle_Id) - ITEM(Item::door_acacia_Id) - ITEM(Item::door_dark_oak_Id) ITEM_AUX(Tile::stoneSlabHalf_Id,StoneSlabTile::STONE_SLAB) ITEM_AUX(Tile::stoneSlabHalf_Id,StoneSlabTile::SAND_SLAB) // AP - changed oak slab to be wood because it wouldn't burn // ITEM_AUX(Tile::stoneSlabHalf_Id,StoneSlabTile::WOOD_SLAB) ITEM_AUX(Tile::woodSlabHalf_Id,0) - ITEM_AUX(Tile::woodSlabHalf_Id,LogTile::DARK_TRUNK) - ITEM_AUX(Tile::woodSlabHalf_Id,LogTile::BIRCH_TRUNK) - ITEM_AUX(Tile::woodSlabHalf_Id,LogTile::JUNGLE_TRUNK) - ITEM_AUX(Tile::woodSlabHalf_Id,LogTile::ACACIA_TRUNK) - ITEM_AUX(Tile::woodSlabHalf_Id,LogTile::DARK_OAK_TRUNK) + ITEM_AUX(Tile::woodSlabHalf_Id,TreeTile::DARK_TRUNK) + ITEM_AUX(Tile::woodSlabHalf_Id,TreeTile::BIRCH_TRUNK) + ITEM_AUX(Tile::woodSlabHalf_Id,TreeTile::JUNGLE_TRUNK) ITEM_AUX(Tile::stoneSlabHalf_Id,StoneSlabTile::COBBLESTONE_SLAB) ITEM_AUX(Tile::stoneSlabHalf_Id,StoneSlabTile::BRICK_SLAB) ITEM_AUX(Tile::stoneSlabHalf_Id,StoneSlabTile::SMOOTHBRICK_SLAB) @@ -131,8 +109,6 @@ void IUIScene_CreativeMenu::staticCtor() ITEM(Tile::stairs_birchwood_Id) ITEM(Tile::stairs_sprucewood_Id) ITEM(Tile::stairs_junglewood_Id) - ITEM(Tile::stairs_acaciawood_Id) - ITEM(Tile::stairs_darkoakwood_Id) ITEM(Tile::stairs_stone_Id) ITEM(Tile::stairs_bricks_Id) ITEM(Tile::stairs_stoneBrick_Id) @@ -233,39 +209,6 @@ void IUIScene_CreativeMenu::staticCtor() ITEM_AUX(Tile::woolCarpet_Id,15) // Black ITEM_AUX(Tile::woolCarpet_Id,13) // Green ITEM_AUX(Tile::woolCarpet_Id,12) // Brown - ITEM_AUX(Tile::stained_glass_Id,14) // Red - ITEM_AUX(Tile::stained_glass_Id,1) // Orange - ITEM_AUX(Tile::stained_glass_Id,4) // Yellow - ITEM_AUX(Tile::stained_glass_Id,5) // Lime - ITEM_AUX(Tile::stained_glass_Id,3) // Light Blue - ITEM_AUX(Tile::stained_glass_Id,9) // Cyan - ITEM_AUX(Tile::stained_glass_Id,11) // Blue - ITEM_AUX(Tile::stained_glass_Id,10) // Purple - ITEM_AUX(Tile::stained_glass_Id,2) // Magenta - ITEM_AUX(Tile::stained_glass_Id,6) // Pink - ITEM_AUX(Tile::stained_glass_Id,0) // White - ITEM_AUX(Tile::stained_glass_Id,8) // Light Gray - ITEM_AUX(Tile::stained_glass_Id,7) // Gray - ITEM_AUX(Tile::stained_glass_Id,15) // Black - ITEM_AUX(Tile::stained_glass_Id,13) // Green - ITEM_AUX(Tile::stained_glass_Id,12) // Brown - - ITEM_AUX(Tile::stained_glass_pane_Id,14) // Red - ITEM_AUX(Tile::stained_glass_pane_Id,1) // Orange - ITEM_AUX(Tile::stained_glass_pane_Id,4) // Yellow - ITEM_AUX(Tile::stained_glass_pane_Id,5) // Lime - ITEM_AUX(Tile::stained_glass_pane_Id,3) // Light Blue - ITEM_AUX(Tile::stained_glass_pane_Id,9) // Cyan - ITEM_AUX(Tile::stained_glass_pane_Id,11) // Blue - ITEM_AUX(Tile::stained_glass_pane_Id,10) // Purple - ITEM_AUX(Tile::stained_glass_pane_Id,2) // Magenta - ITEM_AUX(Tile::stained_glass_pane_Id,6) // Pink - ITEM_AUX(Tile::stained_glass_pane_Id,0) // White - ITEM_AUX(Tile::stained_glass_pane_Id,8) // Light Gray - ITEM_AUX(Tile::stained_glass_pane_Id,7) // Gray - ITEM_AUX(Tile::stained_glass_pane_Id,15) // Black - ITEM_AUX(Tile::stained_glass_pane_Id,13) // Green - ITEM_AUX(Tile::stained_glass_pane_Id,12) // Brown #ifndef _CONTENT_PACKAGE DEF(eCreativeInventory_ArtToolsDecorations) diff --git a/Minecraft.Client/Common/UI/IUIScene_HUD.h b/Minecraft.Client/Common/UI/IUIScene_HUD.h index b38adab4..0f643dd3 100644 --- a/Minecraft.Client/Common/UI/IUIScene_HUD.h +++ b/Minecraft.Client/Common/UI/IUIScene_HUD.h @@ -30,10 +30,6 @@ protected: bool m_bRegenEffectEnabled; int m_iFoodSaturation; - //TODO TU25 - bool m_showQuickSelect; - bool m_showCrosshair; - unsigned int m_uiSelectedItemOpacityCountDown; wstring m_displayName; @@ -83,11 +79,6 @@ protected: virtual void SetSelectedLabel(const wstring &label) = 0; virtual void ShowDisplayName(bool show) = 0; - //TODO TU25 - virtual void ShowQuickSelect(bool show) = 0; - virtual void ShowCrosshair(bool show) = 0; - virtual void ShowGameModePlayers(bool show) = 0; - virtual void SetGameModePlayerState(bool bEnabled) = 0; public: void updateFrameTick(); void renderPlayerHealth(); diff --git a/Minecraft.Client/Common/UI/IUIScene_InventoryMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_InventoryMenu.cpp index 932af638..d34245ba 100644 --- a/Minecraft.Client/Common/UI/IUIScene_InventoryMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_InventoryMenu.cpp @@ -6,139 +6,49 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_InventoryMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ) { - Minecraft *pMinecraft = Minecraft::GetInstance(); + ESceneSection newSection = eSection; - ESceneSection newSection = eSection; - int xOffset = 0; - int yOffset = 0; - - //auto containerData = this->m_containerData; - - switch( eSection ) - { - case eSectionInventoryInventory: - if(eTapDirection == eTapStateDown) - { - newSection = eSectionInventoryUsing; - } - else if(eTapDirection == eTapStateUp) - { - if (app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting) && *piTargetX >= 3) - { - if (*piTargetX < 7) { - newSection = eSectionInventoryCraftingGrid; - xOffset = 5; - } else { - newSection = eSectionInventoryCraftingResult; - } - } - else - { - newSection = eSectionInventoryArmor; - } - } - break; - - case eSectionInventoryUsing: - if(eTapDirection == eTapStateUp) - { - newSection = eSectionInventoryInventory; - } - else if(eTapDirection == eTapStateDown) - { - if (app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting) && *piTargetX >= 3) - { - if (*piTargetX < 7) { - newSection = eSectionInventoryCraftingGrid; - xOffset = 5; - } else { - newSection = eSectionInventoryCraftingResult; - } - } - else - { - newSection = eSectionInventoryArmor; - } - } - break; - - case eSectionInventoryArmor: - if(eTapDirection == eTapStateDown) - { - newSection = eSectionInventoryInventory; - } - else if(eTapDirection == eTapStateUp) - { - newSection = eSectionInventoryUsing; - } - else if(eTapDirection == eTapStateLeft && app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting)) - { - newSection = eSectionInventoryCraftingResult; - } - else if(eTapDirection == eTapStateRight && app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting)) - { - newSection = eSectionInventoryCraftingGrid; - xOffset = 1; - yOffset = 1; - } - break; - case eSectionInventoryCraftingGrid: - if (app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting)) - { - if(eTapDirection == eTapStateUp) - { - newSection = eSectionInventoryUsing; - xOffset = -5; - } - else if(eTapDirection == eTapStateDown) - { - newSection = eSectionInventoryInventory; - xOffset = -5; - } - else if(eTapDirection == eTapStateLeft) - { - newSection = eSectionInventoryArmor; - yOffset = -1; - } - else if(eTapDirection == eTapStateRight) - { - newSection = eSectionInventoryCraftingResult; - } - } - break; - - case eSectionInventoryCraftingResult: - if (app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting)) - { - if(eTapDirection == eTapStateUp) - { - newSection = eSectionInventoryUsing; - xOffset = -8; - } - else if(eTapDirection == eTapStateDown) - { - newSection = eSectionInventoryInventory; - xOffset = -8; - } - else if(eTapDirection == eTapStateLeft) - { - newSection = eSectionInventoryCraftingGrid; - //*piTargetX = containerData->getSectionColumns(eSectionInventoryCraftingGrid); - } - else if(eTapDirection == eTapStateRight) - { - newSection = eSectionInventoryArmor; - } - } - break; + // Find the new section if there is one + switch( eSection ) + { + case eSectionInventoryArmor: + if(eTapDirection == eTapStateDown) + { + newSection = eSectionInventoryInventory; + } + else if(eTapDirection == eTapStateUp) + { + newSection = eSectionInventoryUsing; + } + break; + case eSectionInventoryInventory: + if(eTapDirection == eTapStateDown) + { + newSection = eSectionInventoryUsing; + } + else if(eTapDirection == eTapStateUp) + { + newSection = eSectionInventoryArmor; + } + break; + case eSectionInventoryUsing: + if(eTapDirection == eTapStateDown) + { + newSection = eSectionInventoryArmor; + } + else if(eTapDirection == eTapStateUp) + { + newSection = eSectionInventoryInventory; + } + break; default: assert( false ); break; - } + } - IUIScene_AbstractContainerMenu::updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset, yOffset); + updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, 0); - return newSection; + return newSection; } int IUIScene_InventoryMenu::getSectionStartOffset(ESceneSection eSection) @@ -155,12 +65,6 @@ int IUIScene_InventoryMenu::getSectionStartOffset(ESceneSection eSection) case eSectionInventoryUsing: offset = InventoryMenu::INV_SLOT_START + 27; break; - case eSectionInventoryCraftingGrid: - offset = InventoryMenu::CRAFT_SLOT_START; - break; - case eSectionInventoryCraftingResult: - offset = InventoryMenu::RESULT_SLOT; - break; default: assert( false ); break; diff --git a/Minecraft.Client/Common/UI/UI.h b/Minecraft.Client/Common/UI/UI.h index ea894c42..a7c416f8 100644 --- a/Minecraft.Client/Common/UI/UI.h +++ b/Minecraft.Client/Common/UI/UI.h @@ -24,7 +24,6 @@ #include "UIControl_Progress.h" #include "UIControl_TexturePackList.h" #include "UIControl_LeaderboardList.h" -#include "UIControl_LeftIconButtonList.h" #include "UIControl_SaveList.h" #include "UIControl_PlayerList.h" #include "UIControl_BitmapIcon.h" @@ -70,7 +69,7 @@ #include "UIScene_MainMenu.h" #include "UIScene_LoadMenu.h" #include "UIScene_JoinMenu.h" -#include "UIScene_LoadCreateJoinMenu.h" +#include "UIScene_LoadOrJoinMenu.h" #include "UIScene_CreateWorldMenu.h" #include "UIScene_LaunchMoreOptionsMenu.h" #include "UIScene_FullscreenProgress.h" @@ -110,7 +109,6 @@ #include "UIScene_BeaconMenu.h" #include "UIScene_FireworksMenu.h" -#include "UIScene_ClassicCraftingMenu.h" #include "UIScene_CraftingMenu.h" #include "UIScene_SignEntryMenu.h" diff --git a/Minecraft.Client/Common/UI/UIControl.h b/Minecraft.Client/Common/UI/UIControl.h index 47324c53..8445af0f 100644 --- a/Minecraft.Client/Common/UI/UIControl.h +++ b/Minecraft.Client/Common/UI/UIControl.h @@ -8,34 +8,28 @@ public: enum eUIControlType { eNoControl, - eBitmapIcon, eButton, - eButtonList, //Removed in TU25 + eButtonList, eCheckBox, - eCheckboxButtonList, //New TU25 eCursor, - eDLCButtonList, //eDLCList + eDLCList, eDynamicLabel, eEnchantmentBook, eEnchantmentButton, eHTMLLabel, eLabel, - eLayerIconButtonList, //New TU25 eLeaderboardList, - eLeftIconButtonList, //New TU25 - eLobbyButtonList, //New TU25 - eMinecraftHorse, eMinecraftPlayer, - eMultiList, //New TU25 - ePlayerButtonList, //ePlayerList + eMinecraftHorse, + ePlayerList, ePlayerSkinPreview, eProgress, eSaveList, - eScoreboardButtonList, //New TU25 eSlider, eSlotList, eTextInput, eTexturePackList, + eBitmapIcon, eTouchControl, }; protected: diff --git a/Minecraft.Client/Common/UI/UIControl_DLCList.cpp b/Minecraft.Client/Common/UI/UIControl_DLCList.cpp index a5db189b..39f8ff39 100644 --- a/Minecraft.Client/Common/UI/UIControl_DLCList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_DLCList.cpp @@ -4,7 +4,7 @@ bool UIControl_DLCList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) { - UIControl::setControlType(UIControl::eDLCButtonList); + UIControl::setControlType(UIControl::eDLCList); bool success = UIControl_ButtonList::setupControl(scene,parent,controlName); //SlotList specific initialisers diff --git a/Minecraft.Client/Common/UI/UIControl_LeftIconButtonList.cpp b/Minecraft.Client/Common/UI/UIControl_LeftIconButtonList.cpp deleted file mode 100644 index d6b3a381..00000000 --- a/Minecraft.Client/Common/UI/UIControl_LeftIconButtonList.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "StdAfx.h" - -#include "UI.h" -#include "UIControl_LeftIconButtonList.h" - -UIControl_LeftIconButtonList::UIControl_LeftIconButtonList() -{ - //UIControl_ButtonList::UIControl_ButtonList(this); //? -} - -bool UIControl_LeftIconButtonList::setupControl(UIScene* scene, IggyValuePath* parent, const std::string& controlName) -{ - bool success = UIControl_Base::setupControl(scene, parent, controlName); - - m_addNewItemFastName = UIControl::registerFastName(L"addNewItem"); - m_setTextureNameFastName = UIControl::registerFastName(L"SetTextureName"); - m_useIggyIconsFastName = UIControl::registerFastName(L"UseIggyIcons"); - - return success; -} - -void UIControl_LeftIconButtonList::AddNewItem(int index, const std::wstring& label, const std::wstring& textureName) -{ - IggyDataValue result; - - IggyDataValue value[3]; - value[0].type = IGGY_DATATYPE_number; - value[0].number = index; - - IggyStringUTF16 stringVal; - stringVal.string = (IggyUTF16*)textureName.c_str(); - stringVal.length = textureName.length(); - value[1].type = IGGY_DATATYPE_string_UTF16; - value[1].string16 = stringVal; - - IggyStringUTF16 stringVal2; - stringVal2.string = (IggyUTF16*)textureName.c_str(); - stringVal2.length = textureName.length(); - value[2].type = IGGY_DATATYPE_string_UTF16; - value[2].string16 = stringVal2; - - IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_addNewItemFastName, 3, value); - -// UIControl_List::addElement(1, -1); -} - -void UIControl_LeftIconButtonList::SetItem(int index, const std::wstring& label, const std::wstring& textureName) -{ -// UIControl_List::SetItemLabel(index, &label, 1); - - IggyDataValue result; - - IggyDataValue value[3]; - value[0].type = IGGY_DATATYPE_number; - value[0].number = index; - - IggyStringUTF16 stringVal; - stringVal.string = (IggyUTF16*)textureName.c_str(); - stringVal.length = textureName.length(); - value[1].type = IGGY_DATATYPE_string_UTF16; - value[1].string16 = stringVal; - - IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_setTextureNameFastName, 2, value); -} - -void UIControl_LeftIconButtonList::SetTextureName(int index, const std::wstring& textureName) -{ - IggyDataValue result; - - IggyDataValue value[2]; - value[0].type = IGGY_DATATYPE_number; - value[0].number = index; - - IggyStringUTF16 stringVal; - stringVal.string = (IggyUTF16*)textureName.c_str(); - stringVal.length = textureName.length(); - - value[1].type = IGGY_DATATYPE_string_UTF16; - value[1].string16 = stringVal; - - IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_setTextureNameFastName, 2, value); -} - -void UIControl_LeftIconButtonList::UseIggyIcons() -{ - IggyDataValue result; - - IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_useIggyIconsFastName, 0, nullptr); -} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_LeftIconButtonList.h b/Minecraft.Client/Common/UI/UIControl_LeftIconButtonList.h deleted file mode 100644 index cc032148..00000000 --- a/Minecraft.Client/Common/UI/UIControl_LeftIconButtonList.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "UIControl_Base.h" - -class UIControl_LeftIconButtonList : public UIControl_ButtonList -{ -public: - UIControl_LeftIconButtonList(); - - virtual bool setupControl(UIScene* scene, IggyValuePath* parent, const std::string& controlName); - - void AddNewItem(int index, const std::wstring& label, const std::wstring& textureName); - void SetItem(int index, const std::wstring& label, const std::wstring& textureName); - void SetTextureName(int index, const std::wstring& textureName); - void UseIggyIcons(); - -private: - int m_addNewItemFastName; - int m_setTextureNameFastName; - int m_useIggyIconsFastName; -}; diff --git a/Minecraft.Client/Common/UI/UIControl_List.h b/Minecraft.Client/Common/UI/UIControl_List.h deleted file mode 100644 index ac536871..00000000 --- a/Minecraft.Client/Common/UI/UIControl_List.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include "UIControl_Base.h" - -class UIControl_List : public UIControl_Base -{ -protected: - IggyName m_removeAllItemsFunc, m_funcHighlightItem, m_funcRemoveItem, m_funcCanTouchFocus, m_funcSetTouchFocus, m_funcCanTouchTrigger, m_funcEnableItem, m_funcSetItemLabel, m_funcGetItemLabel; - - int m_itemCount; - int m_iCurrentSelection; - -public: - UIControl_List(); - ~UIControl_List(); - - bool setupControl(UIScene* scene, IggyValuePath* parent, const std::string& controlName); - - void init(int id); - virtual void ReInit(); - - void clearList(); - - void removeItem(int index); - - int getItemCount() - { - return m_itemCount; - } - - void setCurrentSelection(int iSelection); - int getCurrentSelection(); - - void updateChildFocus(int iChild); - - void SetTouchFocus(S32 iX, S32 iY, bool bRepeat); - bool CanTouchTrigger(S32 iX, S32 iY); - - void addElement(eUIControlType type, int index); -}; diff --git a/Minecraft.Client/Common/UI/UIControl_MultiList.cpp b/Minecraft.Client/Common/UI/UIControl_MultiList.cpp deleted file mode 100644 index 9daa0260..00000000 --- a/Minecraft.Client/Common/UI/UIControl_MultiList.cpp +++ /dev/null @@ -1,164 +0,0 @@ -#include "UI.h" -#include "UIControl_MultiList.h" - -UIControl_MultiList::UIControl_MultiList() -{ - m_min = 0; - m_max = 100; - m_current = 0; -} - -bool UIControl_MultiList::setupControl(UIScene* scene, IggyValuePath* parent, const std::string& controlName) -{ - UIControl::setControlType(UIControl::eMultiList); - bool success = UIControl_List::setupControl(scene, parent, controlName); - - m_funcAddNewItemLabel = registerFastName(L"addNewItem_Label"); - m_funcAddNewItemButton = registerFastName(L"addNewItem_Button"); - m_funcAddNewItemCheckBox = registerFastName(L"addNewItem_CheckBox"); - m_funcAddNewItemSlider = registerFastName(L"addNewItem_Slider"); - m_funcAddNewItemTextInput = registerFastName(L"addNewItem_TextInput"); - m_funcSetCheckBox = registerFastName(L"SetCheckBox"); - m_funcGetCheckBox = registerFastName(L"GetCheckBox"); - m_funcSetSliderValue = registerFastName(L"SetSliderValue"); - m_funcGetSliderValue = registerFastName(L"GetSliderValue"); - - return success; -} - -void UIControl_MultiList::AddNewLabel(UIString label) -{ - m_label = label; - - IggyDataValue result; - - IggyDataValue value[1]; - IggyStringUTF16 stringVal; - stringVal.string = (IggyUTF16*)label.c_str(); - stringVal.length = (S32)label.length(); - value[0].type = IGGY_DATATYPE_string_UTF16; - value[0].string16 = stringVal; - - auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcAddNewItemLabel, 1, value); - - UIControl_List::addElement(UIControl::eLabel, -1); -} - -void UIControl_MultiList::AddNewButton(UIString label, int id) -{ - IggyDataValue result; - - IggyDataValue value[2]; - IggyStringUTF16 stringVal; - stringVal.string = (IggyUTF16*)label.c_str(); - stringVal.length = (S32)label.length(); - value[0].type = IGGY_DATATYPE_string_UTF16; - value[0].string16 = stringVal; - - value[1].type = IGGY_DATATYPE_number; - value[1].number = id; - - auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcAddNewItemButton, 2, value); - - UIControl_List::addElement(UIControl::eButton, id); -} - -void UIControl_MultiList::AddNewCheckbox(UIString label, int id, bool checked) -{ - IggyDataValue result; - IggyDataValue value[3]; - value[0].type = IGGY_DATATYPE_string_UTF16; - IggyStringUTF16 stringVal; - - stringVal.string = (IggyUTF16*)label.c_str(); - stringVal.length = label.length(); - value[0].string16 = stringVal; - - value[1].type = IGGY_DATATYPE_number; - value[1].number = id; - - value[2].type = IGGY_DATATYPE_boolean; - value[2].boolval = checked; - - auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcAddNewItemCheckBox, 3, value); - - UIControl_List::addElement(UIControl::eCheckBox, id); -} - -void UIControl_MultiList::AddNewSlider(UIString label, int id, int min, int max, int current) -{ - m_label = label; - m_id = id; - m_min = min; - m_max = max; - m_current = current; - - IggyDataValue result; - - IggyDataValue value[5]; - value[0].type = IGGY_DATATYPE_string_UTF16; - - IggyStringUTF16 stringVal; - stringVal.string = (IggyUTF16*)label.c_str(); - stringVal.length = label.length(); - value[0].string16 = stringVal; - - value[1].type = IGGY_DATATYPE_number; - value[1].number = (int)id; - - value[2].type = IGGY_DATATYPE_number; - value[2].number = (int)min; - - value[3].type = IGGY_DATATYPE_number; - value[3].number = (int)max; - - value[4].type = IGGY_DATATYPE_number; - value[4].number = (int)current; - - auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcAddNewItemSlider, 5, value); - - UIControl_List::addElement(UIControl::eSlider, id); -} - -void UIControl_MultiList::AddNewTextInput(UIString label, int id) -{ - m_label = label; - m_id = id; - - IggyDataValue result; - IggyDataValue value[2]; - value[0].type = IGGY_DATATYPE_string_UTF16; - IggyStringUTF16 stringVal; - - stringVal.string = (IggyUTF16*)label.c_str(); - stringVal.length = label.length(); - value[0].string16 = stringVal; - - value[1].type = IGGY_DATATYPE_number; - value[1].number = id; - IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_initFunc, 2, value); - - UIControl_List::addElement(UIControl::eTextInput, id); -} - -void UIControl_MultiList::IsCheckbox(UIString label, int id, bool checked) -{ -} - -void UIControl_MultiList::SetCheckbox(UIString label, int id, bool checked) -{ - //return UIControl_List::istype(a1, 2, a2); -} - -void UIControl_MultiList::GetCheckbox(UIString label, int id, bool checked) -{ -} - -void UIControl_MultiList::SetSliderValue(UIString label, int id, bool checked) -{ -} - -void UIControl_MultiList::GetSliderValue(UIString label, int id, bool checked) -{ -} - diff --git a/Minecraft.Client/Common/UI/UIControl_MultiList.h b/Minecraft.Client/Common/UI/UIControl_MultiList.h deleted file mode 100644 index 988a3d84..00000000 --- a/Minecraft.Client/Common/UI/UIControl_MultiList.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include "UIControl_List.h" - -class UIControl_MultiList : public UIControl_List -{ -protected: - IggyName m_funcAddNewItemLabel, m_funcAddNewItemButton, m_funcAddNewItemCheckBox, m_funcAddNewItemSlider, m_funcAddNewItemTextInput; - IggyName m_funcGetCheckBox, m_funcGetSliderValue; - IggyName m_funcSetCheckBox, m_funcSetSliderValue; - - int m_itemCount; - int m_iCurrentSelection; - int m_min, m_max; - int m_current; - -public: - UIControl_MultiList(); - - bool setupControl(UIScene* scene, IggyValuePath* parent, const std::string& controlName); - - void AddNewLabel(UIString label); // IDA says no id here - void AddNewButton(UIString label, int id); - void AddNewCheckbox(UIString label, int id, bool checked); - void AddNewSlider(UIString label, int id, int min, int max, int current); - void AddNewTextInput(UIString label, int id); - void IsCheckbox(UIString label, int id, bool checked); - void SetCheckbox(UIString label, int id, bool checked); - void GetCheckbox(UIString label, int id, bool checked); - void SetSliderValue(UIString label, int id, bool checked); - void GetSliderValue(UIString label, int id, bool checked); -}; diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerList.cpp b/Minecraft.Client/Common/UI/UIControl_PlayerList.cpp index 6d16b660..0703919f 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_PlayerList.cpp @@ -4,7 +4,7 @@ bool UIControl_PlayerList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) { - UIControl::setControlType(UIControl::ePlayerButtonList); + UIControl::setControlType(UIControl::ePlayerList); bool success = UIControl_ButtonList::setupControl(scene,parent,controlName); //SlotList specific initialisers diff --git a/Minecraft.Client/Common/UI/UIControl_Slider.cpp b/Minecraft.Client/Common/UI/UIControl_Slider.cpp index 1dc46ba1..a53d8575 100644 --- a/Minecraft.Client/Common/UI/UIControl_Slider.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Slider.cpp @@ -18,9 +18,6 @@ bool UIControl_Slider::setupControl(UIScene *scene, IggyValuePath *parent, const //Slider specific initialisers m_funcSetRelativeSliderPos = registerFastName(L"SetRelativeSliderPos"); m_funcGetRealWidth = registerFastName(L"GetRealWidth"); - //TU25 - m_funcChangeState = registerFastName(L"ChangeState"); - m_funcSetSliderValue = registerFastName(L"SetSliderValue"); return success; } @@ -91,7 +88,7 @@ void UIControl_Slider::setFocus(bool hasFocus) IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; value[0].number = hasFocus ? 0.0f : 1.0f; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcChangeState , 1 , value ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetGreyedOut , 1 , value ); } } @@ -144,7 +141,7 @@ void UIControl_Slider::SetSliderValue(int iValue) IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; value[0].number = iValue; - IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetSliderValue , 1 , value ); + IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcSetRelativeSliderPos , 1 , value ); } void UIControl_Slider::MoveSliderValue(int delta) diff --git a/Minecraft.Client/Common/UI/UIControl_Slider.h b/Minecraft.Client/Common/UI/UIControl_Slider.h index f7c91144..2b076c64 100644 --- a/Minecraft.Client/Common/UI/UIControl_Slider.h +++ b/Minecraft.Client/Common/UI/UIControl_Slider.h @@ -16,9 +16,7 @@ private: // 4J-TomK - function for setting slider position on touch IggyName m_funcSetRelativeSliderPos; IggyName m_funcGetRealWidth; - // TU25 - IggyName m_funcChangeState; - IggyName m_funcSetSliderValue; + IggyName m_funcSetGreyedOut; public: UIControl_Slider(); diff --git a/Minecraft.Client/Common/UI/UIControl_list.cpp b/Minecraft.Client/Common/UI/UIControl_list.cpp deleted file mode 100644 index 2bc992a9..00000000 --- a/Minecraft.Client/Common/UI/UIControl_list.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#include "UI.h" -#include "UIControl_List.h" - -UIControl_List::UIControl_List() : UIControl_Base() -{ - //elementCount = 0; -} - -UIControl_List::~UIControl_List() -{ -} - -bool UIControl_List::setupControl(UIScene* scene, IggyValuePath* parent, const std::string& controlName) -{ - //UIControl::setControlType(UIControl::eButtonList); - - bool success = UIControl_Base::setupControl(scene, parent, controlName); - - m_removeAllItemsFunc = registerFastName(L"removeAllItems"); - m_funcHighlightItem = registerFastName(L"HighlightItem"); - m_funcRemoveItem = registerFastName(L"RemoveItem"); - m_funcSetTouchFocus = registerFastName(L"SetTouchFocus"); - m_funcCanTouchFocus = registerFastName(L"CanTouchFocus"); - m_funcCanTouchTrigger = registerFastName(L"CanTouchTrigger"); - m_funcEnableItem = registerFastName(L"EnableItem"); - m_funcSetItemLabel = registerFastName(L"SetItemLabel"); - m_funcGetItemLabel = registerFastName(L"GetItemLabel"); - - return success; -} - -void UIControl_List::init(int id) -{ - m_id = id; - - IggyDataValue result; - - IggyDataValue value[1]; - value[0].type = IGGY_DATATYPE_number; - value[0].number = id; - - auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_initFunc, 1, value); -} - -void UIControl_List::ReInit() -{ - UIControl_Base::ReInit(); - init(m_id); - - m_itemCount = 0; - m_iCurrentSelection = 0; -} - -void UIControl_List::clearList() -{ - IggyDataValue result; - - auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_removeAllItemsFunc, 0, nullptr); - - m_itemCount = 0; -} - -void UIControl_List::removeItem(int index) -{ - IggyDataValue result; - - IggyDataValue value[1]; - value[0].type = IGGY_DATATYPE_number; - value[0].number = index; - - IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcRemoveItem, 1, value); - - --m_itemCount; -} - -void UIControl_List::setCurrentSelection(int iSelection) -{ - IggyDataValue result; - - IggyDataValue value[1]; - value[0].type = IGGY_DATATYPE_number; - value[0].number = iSelection; - - auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcHighlightItem, 1, value); -} - -int UIControl_List::getCurrentSelection() -{ - return m_iCurrentSelection; -} - -void UIControl_List::updateChildFocus(int iChild) -{ - m_iCurrentSelection = iChild; -} - -void UIControl_List::SetTouchFocus(S32 iX, S32 iY, bool bRepeat) -{ - IggyDataValue result; - - IggyDataValue value[3]; - value[0].type = IGGY_DATATYPE_number; - value[0].number = iX; - value[1].type = IGGY_DATATYPE_number; - value[1].number = iY; - value[2].type = IGGY_DATATYPE_boolean; - value[2].boolval = bRepeat; - - auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetTouchFocus, 3, value); -} - -bool UIControl_List::CanTouchTrigger(S32 iX, S32 iY) -{ - IggyDataValue result; - - IggyDataValue value[2]; - value[0].type = IGGY_DATATYPE_number; - value[0].number = iX; - value[1].type = IGGY_DATATYPE_number; - value[1].number = iY; - - auto out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcCanTouchTrigger, 2, value); - - S32 bCanTouchTrigger = false; - - if (result.type == IGGY_DATATYPE_boolean) - bCanTouchTrigger = (bool)result.boolval; - - return bCanTouchTrigger; -} - -void UIControl_List::addElement(eUIControlType type, int index) -{ - //if (index < 0) index = m_elementCount; - - //m_elementCount++; - - UIControl::setControlType(type); - //m_elements.push_back(index); -} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 15ac0bd7..1055e0e5 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -952,15 +952,8 @@ void UIController::tickInput() { // ButtonList manages focus internally via Flash — // pass mouse coords so it can highlight the right item. - S32 adjustedMouseY = static_cast(sceneMouseY); - if (pScene->getSceneType() == eUIScene_LoadCreateJoinMenu) - { - const S32 visibleRows = 7.0f; - const F32 rowHeight = (visibleRows > 0.0f) ? (static_cast(ch) / visibleRows) : 0.0f; - if (rowHeight > 0.0f) - adjustedMouseY -= rowHeight; - } - static_cast(ctrl)->SetTouchFocus(static_cast(sceneMouseX), static_cast(adjustedMouseY), false); + static_cast(ctrl)->SetTouchFocus( + static_cast(sceneMouseX), static_cast(sceneMouseY), false); hitControlId = -1; hitArea = INT_MAX; hitCtrl = nullptr; @@ -1919,7 +1912,7 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUI #if 0 // Disable since we don't use this // If you're navigating to the multigamejoinload, and the player hasn't seen the updates message yet, display it now // display this message the first 3 times - if((scene==eUIScene_LoadCreateJoinMenu) && (bSeenUpdateTextThisSession==false) && ( app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplayUpdateMessage)!=0)) + if((scene==eUIScene_LoadOrJoinMenu) && (bSeenUpdateTextThisSession==false) && ( app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplayUpdateMessage)!=0)) { scene=eUIScene_NewUpdateMessage; bSeenUpdateTextThisSession=true; @@ -1934,7 +1927,6 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUI case eUIScene_PauseMenu: case eUIScene_Crafting2x2Menu: case eUIScene_Crafting3x3Menu: - case eUIScene_ClassicCraftingMenu: case eUIScene_FurnaceMenu: case eUIScene_ContainerMenu: case eUIScene_LargeContainerMenu: @@ -2141,7 +2133,7 @@ size_t UIController::RegisterForCallbackId(UIScene *scene) { EnterCriticalSection(&m_registeredCallbackScenesCS); size_t newId = GetTickCount64(); - 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/UIEnums.h b/Minecraft.Client/Common/UI/UIEnums.h index d3c60419..45aff87d 100644 --- a/Minecraft.Client/Common/UI/UIEnums.h +++ b/Minecraft.Client/Common/UI/UIEnums.h @@ -44,7 +44,6 @@ enum EUIScene eUIScene_MainMenu, eUIScene_FullscreenProgress, eUIScene_PauseMenu, - eUIScene_ClassicCraftingMenu, eUIScene_Crafting2x2Menu, eUIScene_Crafting3x3Menu, eUIScene_FurnaceMenu, @@ -69,7 +68,7 @@ enum EUIScene eUIScene_DeathMenu, eUIComponent_TutorialPopup, eUIScene_CreateWorldMenu, - eUIScene_LoadCreateJoinMenu, + eUIScene_LoadOrJoinMenu, eUIScene_JoinMenu, eUIScene_SignEntryMenu, eUIScene_InGameInfoMenu, diff --git a/Minecraft.Client/Common/UI/UILayer.cpp b/Minecraft.Client/Common/UI/UILayer.cpp index 4efcc1d9..e1c388f5 100644 --- a/Minecraft.Client/Common/UI/UILayer.cpp +++ b/Minecraft.Client/Common/UI/UILayer.cpp @@ -243,9 +243,6 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData) case eUIScene_Crafting3x3Menu: newScene = new UIScene_CraftingMenu(iPad, initData, this); break; - case eUIScene_ClassicCraftingMenu: - newScene = new UIScene_ClassicCraftingMenu(iPad, initData, this); - break; case eUIScene_TradingMenu: newScene = new UIScene_TradingMenu(iPad, initData, this); break; @@ -370,8 +367,8 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData) case eUIScene_MainMenu: newScene = new UIScene_MainMenu(iPad, initData, this); break; - case eUIScene_LoadCreateJoinMenu: - newScene = new UIScene_LoadCreateJoinMenu(iPad, initData, this); + case eUIScene_LoadOrJoinMenu: + newScene = new UIScene_LoadOrJoinMenu(iPad, initData, this); break; case eUIScene_LoadMenu: newScene = new UIScene_LoadMenu(iPad, initData, this); @@ -738,7 +735,6 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */) break; case eUIScene_Crafting2x2Menu: case eUIScene_Crafting3x3Menu: - case eUIScene_ClassicCraftingMenu: case eUIScene_FurnaceMenu: case eUIScene_ContainerMenu: case eUIScene_LargeContainerMenu: diff --git a/Minecraft.Client/Common/UI/UIScene.h b/Minecraft.Client/Common/UI/UIScene.h index df08e297..ca089d39 100644 --- a/Minecraft.Client/Common/UI/UIScene.h +++ b/Minecraft.Client/Common/UI/UIScene.h @@ -245,9 +245,7 @@ protected: virtual void handlePress(F64 controlId, F64 childId) {} virtual void handleFocusChange(F64 controlId, F64 childId) {} virtual void handleInitFocus(F64 controlId, F64 childId) {} - virtual void handleCheckboxElementToggled(F64 controlId, F64 idk, bool selected) {} virtual void handleCheckboxToggled(F64 controlId, bool selected) {} - virtual void handleSliderElementMove(F64 sliderId, F64 currentValue, F64 idk) {} virtual void handleSliderMove(F64 sliderId, F64 currentValue) {} virtual void handleAnimationEnd() {} virtual void handleSelectionChanged(F64 selectedId) {} diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp index bf0e04ef..c5dc0554 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -292,7 +292,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg } else { - swscanf_s(static_cast(region->name),L"slot_%d",&slotId); + swscanf(static_cast(region->name),L"slot_%d",&slotId); if (slotId == -1) { app.DebugPrintf("This is not the control we are looking for\n"); diff --git a/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp index 72b1ce6f..af668ea3 100644 --- a/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp @@ -329,7 +329,7 @@ void UIScene_BeaconMenu::customDraw(IggyCustomDrawCallbackRegion *region) shared_ptr item = nullptr; int slotId = -1; - swscanf_s(static_cast(region->name),L"slot_%d",&slotId); + swscanf(static_cast(region->name),L"slot_%d",&slotId); if(slotId >= 0 && slotId >= m_menu->getSize() ) { diff --git a/Minecraft.Client/Common/UI/UIScene_ClassicCraftingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ClassicCraftingMenu.cpp deleted file mode 100644 index b7a5b5cc..00000000 --- a/Minecraft.Client/Common/UI/UIScene_ClassicCraftingMenu.cpp +++ /dev/null @@ -1,222 +0,0 @@ -#include "stdafx.h" -#include "UI.h" -#include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h" -#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" -#include "..\..\Minecraft.h" -#include "..\..\LocalPlayer.h" -#include "UIScene_ClassicCraftingMenu.h" - -UIScene_ClassicCraftingMenu::UIScene_ClassicCraftingMenu(int iPad, void *_initData, UILayer *parentLayer) : UIScene_AbstractContainerMenu(iPad, parentLayer) -{ - // Setup all the Iggy references we need for this scene - initialiseMovie(); - - CraftingPanelScreenInput* initData = static_cast(_initData); - - m_labelTitle.init(app.GetString(IDS_HOW_TO_PLAY_MENU_CRAFTING)); - - Minecraft *pMinecraft = Minecraft::GetInstance(); - if( pMinecraft->localgameModes[m_iPad] != nullptr ) - { - TutorialMode *gameMode = static_cast(pMinecraft->localgameModes[m_iPad]); - m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); - gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_3x3Crafting_Menu, this); - } - - //TODO: Add Fireworks check -// m_labelTitle.init(app.GetString(IDS_HOW_TO_PLAY_MENU_FIREWORKS)); -// FireworksMenu *m_menu = new FireworksMenu(initData->player->inventory, initData->player->level, initData->x, initData->y, initData->z); - - CraftingMenu *m_menu = new CraftingMenu(initData->player->inventory, initData->player->level, initData->x, initData->y, initData->z); - - Initialize( initData->iPad, m_menu, true, CraftingMenu::INV_SLOT_START, eSectionClassicCraftingHotbar, eSectionClassicCraftingMax ); - - m_slotListResult.addSlots(CraftingMenu::RESULT_SLOT, 1); - m_slotListCrafting.addSlots(CraftingMenu::CRAFT_SLOT_START, 9); - - app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_CRAFTING); - - delete initData; -} - -wstring UIScene_ClassicCraftingMenu::getMoviePath() -{ - if(app.GetLocalPlayerCount() > 1) - return L"ClassicCraftingMenuSplit"; - else - return L"ClassicCraftingMenu"; -} - -void UIScene_ClassicCraftingMenu::handleReload() -{ - Initialize( m_iPad, m_menu, true, CraftingMenu::INV_SLOT_START, eSectionClassicCraftingHotbar, eSectionClassicCraftingMax ); - - m_slotListResult.addSlots(CraftingMenu::RESULT_SLOT, 1); - m_slotListCrafting.addSlots(CraftingMenu::CRAFT_SLOT_START, 9); -} - -int UIScene_ClassicCraftingMenu::getSectionColumns(ESceneSection eSection) -{ - int cols = 0; - switch( eSection ) - { - case eSectionClassicCraftingHotbar: - cols = 9; - break; - case eSectionClassicCraftingInventory: - cols = 9; - break; - case eSectionClassicCraftingGrid: - cols = 3; - break; - case eSectionClassicCraftingResult: - cols = 1; - break; - default: - assert( false ); - break; - } - return cols; -} - -int UIScene_ClassicCraftingMenu::getSectionRows(ESceneSection eSection) -{ - int rows = 0; - switch( eSection ) - { - case eSectionClassicCraftingHotbar: - rows = 1; - break; - case eSectionClassicCraftingInventory: - rows = 3; - break; - case eSectionClassicCraftingGrid: - rows = 3; - break; - case eSectionClassicCraftingResult: - rows = 1; - break; - default: - assert( false ); - break; - } - return rows; -} - -void UIScene_ClassicCraftingMenu::GetPositionOfSection( ESceneSection eSection, UIVec2D* pPosition ) -{ - switch( eSection ) - { - case eSectionClassicCraftingHotbar: - pPosition->x = m_slotListHotbar.getXPos(); - pPosition->y = m_slotListHotbar.getYPos(); - break; - case eSectionClassicCraftingInventory: - pPosition->x = m_slotListInventory.getXPos(); - pPosition->y = m_slotListInventory.getYPos(); - break; - case eSectionClassicCraftingGrid: - pPosition->x = m_slotListCrafting.getXPos(); - pPosition->y = m_slotListCrafting.getYPos(); - break; - case eSectionClassicCraftingResult: - pPosition->x = m_slotListResult.getXPos(); - pPosition->y = m_slotListResult.getYPos(); - break; - default: - assert( false ); - break; - } -} - -void UIScene_ClassicCraftingMenu::GetItemScreenData( ESceneSection eSection, int iItemIndex, UIVec2D* pPosition, UIVec2D* pSize ) -{ - UIVec2D sectionSize; - switch( eSection ) - { - case eSectionClassicCraftingHotbar: - sectionSize.x = m_slotListHotbar.getWidth(); - sectionSize.y = m_slotListHotbar.getHeight(); - break; - case eSectionClassicCraftingInventory: - sectionSize.x = m_slotListInventory.getWidth(); - sectionSize.y = m_slotListInventory.getHeight(); - break; - case eSectionClassicCraftingGrid: - sectionSize.x = m_slotListCrafting.getWidth(); - sectionSize.y = m_slotListCrafting.getHeight(); - break; - case eSectionClassicCraftingResult: - sectionSize.x = m_slotListResult.getWidth(); - sectionSize.y = m_slotListResult.getHeight(); - break; - default: - assert( false ); - break; - } - - int rows = getSectionRows(eSection); - int cols = getSectionColumns(eSection); - - pSize->x = sectionSize.x / cols; - pSize->y = sectionSize.y / rows; - - int itemCol = iItemIndex % cols; - int itemRow = iItemIndex / cols; - - pPosition->x = itemCol * pSize->x; - pPosition->y = itemRow * pSize->y; -} - -void UIScene_ClassicCraftingMenu::setSectionSelectedSlot(ESceneSection eSection, int x, int y) -{ - int cols = getSectionColumns(eSection); - - int index = (y * cols) + x; - - UIControl_SlotList *slotList = nullptr; - switch( eSection ) - { - case eSectionClassicCraftingHotbar: - slotList = &m_slotListHotbar; - break; - case eSectionClassicCraftingInventory: - slotList = &m_slotListInventory; - break; - case eSectionClassicCraftingGrid: - slotList = &m_slotListCrafting; - break; - case eSectionClassicCraftingResult: - slotList = &m_slotListResult; - break; - default: - assert( false ); - break; - } - - slotList->setHighlightSlot(index); -} - -UIControl *UIScene_ClassicCraftingMenu::getSection(ESceneSection eSection) -{ - UIControl *control = nullptr; - switch( eSection ) - { - case eSectionClassicCraftingHotbar: - control = &m_slotListHotbar; - break; - case eSectionClassicCraftingInventory: - control = &m_slotListInventory; - break; - case eSectionClassicCraftingGrid: - control = &m_slotListCrafting; - break; - case eSectionClassicCraftingResult: - control = &m_slotListResult; - break; - default: - assert( false ); - break; - } - return control; -} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_ClassicCraftingMenu.h b/Minecraft.Client/Common/UI/UIScene_ClassicCraftingMenu.h deleted file mode 100644 index 97e72a62..00000000 --- a/Minecraft.Client/Common/UI/UIScene_ClassicCraftingMenu.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include "UIScene_AbstractContainerMenu.h" -#include "IUIScene_ClassicCraftingMenu.h" - -class InventoryMenu; - -class UIScene_ClassicCraftingMenu : public UIScene_AbstractContainerMenu, public IUIScene_ClassicCraftingMenu -{ -public: - UIScene_ClassicCraftingMenu(int iPad, void *initData, UILayer *parentLayer); - - virtual EUIScene getSceneType() { return eUIScene_ClassicCraftingMenu;} - -protected: - UIControl_SlotList m_slotListCrafting, m_slotListResult; - UIControl_Label m_labelTitle, m_labelInventory; - - UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene_AbstractContainerMenu) - UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlMainPanel ) - UI_MAP_ELEMENT( m_slotListCrafting, "CraftingList") - UI_MAP_ELEMENT( m_slotListResult, "Result") - UI_MAP_ELEMENT( m_labelTitle, "TitleLabel") - UI_END_MAP_CHILD_ELEMENTS() - UI_END_MAP_ELEMENTS_AND_NAMES() - - virtual wstring getMoviePath(); - virtual void handleReload(); - - virtual int getSectionColumns(ESceneSection eSection); - virtual int getSectionRows(ESceneSection eSection); - virtual void GetPositionOfSection( ESceneSection eSection, UIVec2D* pPosition ); - virtual void GetItemScreenData( ESceneSection eSection, int iItemIndex, UIVec2D* pPosition, UIVec2D* pSize ); - virtual void handleSectionClick(ESceneSection eSection) {} - virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y); - - virtual UIControl *getSection(ESceneSection eSection); -}; \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp index cf97f162..c76462de 100644 --- a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp @@ -532,7 +532,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region) float alpha = 1.0f; bool decorations = true; bool inventoryItem = false; - swscanf_s(static_cast(region->name),L"slot_%d",&slotId); + swscanf(static_cast(region->name),L"slot_%d",&slotId); if (slotId == -1) { app.DebugPrintf("This is not the control we are looking for\n"); diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp index 64dc60c0..de125607 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp @@ -34,13 +34,6 @@ int UIScene_CreateWorldMenu::m_iDifficultyTitleSettingA[4]= IDS_DIFFICULTY_TITLE_HARD }; -int UIScene_CreateWorldMenu::m_iGamemodeTitleSettingA[3]= -{ - IDS_SURVIVAL, - IDS_CREATIVE, - IDS_ADVENTURE -}; - UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILayer *parentLayer) : IUIScene_StartGame(iPad, parentLayer) { // Setup all the Iggy references we need for this scene @@ -55,6 +48,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay m_editWorldName.init(m_worldName, eControl_EditWorldName); + m_buttonGamemode.init(app.GetString(IDS_GAMEMODE_SURVIVAL),eControl_GameModeToggle); m_buttonMoreOptions.init(app.GetString(IDS_MORE_OPTIONS),eControl_MoreOptions); m_buttonCreateWorld.init(app.GetString(IDS_CREATE_NEW_WORLD),eControl_NewWorld); @@ -67,9 +61,6 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty)); - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[0])); - m_sliderGamemode.init(TempString,eControl_GameModeToggle,0,2,0); - m_MoreOptionsParams.bGenerateOptions=TRUE; m_MoreOptionsParams.bStructures=TRUE; m_MoreOptionsParams.bFlatWorld=FALSE; @@ -466,6 +457,25 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) #endif } break; + case eControl_GameModeToggle: + switch(m_iGameModeId) + { + case 0: // Creative + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_CREATIVE)); + m_iGameModeId = GameType::CREATIVE->getId(); + m_bGameModeCreative = true; + break; + case 1: // Adventure + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_ADVENTURE)); + m_iGameModeId = GameType::ADVENTURE->getId(); + m_bGameModeCreative = false; + break; + case 2: // Survival + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_SURVIVAL)); + m_iGameModeId = GameType::SURVIVAL->getId(); + m_bGameModeCreative = false; + }; + break; case eControl_MoreOptions: ui.NavigateToScene(m_iPad, eUIScene_LaunchMoreOptionsMenu, &m_MoreOptionsParams); break; @@ -647,29 +657,6 @@ void UIScene_CreateWorldMenu::handleSliderMove(F64 sliderId, F64 currentValue) app.SetGameSettings(m_iPad,eGameSetting_Difficulty,value); swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value])); m_sliderDifficulty.setLabel(TempString); - break; - case eControl_GameModeToggle: - m_sliderGamemode.handleSliderMove(value); - - if (value == 1) - { - m_bGameModeCreative=true; - m_iGameModeId = GameType::CREATIVE->getId(); - } - else if (value == 2) - { - m_bGameModeCreative=false; - m_iGameModeId = GameType::ADVENTURE->getId(); - } - else - { - m_bGameModeCreative=false; - m_iGameModeId = GameType::SURVIVAL->getId(); - } - - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[value])); - m_sliderGamemode.setLabel(TempString); - break; } } diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h index 8b877e0e..75bfe602 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h @@ -17,16 +17,16 @@ private: }; static int m_iDifficultyTitleSettingA[4]; - static int m_iGamemodeTitleSettingA[3]; + wstring m_worldName; wstring m_seed; UIControl m_controlMainPanel; UIControl_Label m_labelWorldName; - UIControl_Button m_buttonMoreOptions, m_buttonCreateWorld; + UIControl_Button m_buttonGamemode, m_buttonMoreOptions, m_buttonCreateWorld; UIControl_TextInput m_editWorldName; - UIControl_Slider m_sliderGamemode, m_sliderDifficulty; + UIControl_Slider m_sliderDifficulty; UIControl_CheckBox m_checkboxOnline; UIControl_BitmapIcon m_bitmapIcon, m_bitmapComparison; @@ -37,10 +37,10 @@ private: UI_MAP_ELEMENT( m_labelWorldName, "WorldName") UI_MAP_ELEMENT( m_editWorldName, "EditWorldName") UI_MAP_ELEMENT( m_texturePackList, "TexturePackSelector") + UI_MAP_ELEMENT( m_buttonGamemode, "GameModeToggle") UI_MAP_ELEMENT( m_checkboxOnline, "CheckboxOnline") UI_MAP_ELEMENT( m_buttonMoreOptions, "MoreOptions") UI_MAP_ELEMENT( m_buttonCreateWorld, "NewWorld") - UI_MAP_ELEMENT( m_sliderGamemode, "GameModeToggle") UI_MAP_ELEMENT( m_sliderDifficulty, "Difficulty") UI_END_MAP_CHILD_ELEMENTS() UI_END_MAP_ELEMENTS_AND_NAMES() diff --git a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp index 25191a25..550757e3 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp @@ -142,7 +142,7 @@ void UIScene_DebugOverlay::customDraw(IggyCustomDrawCallbackRegion *region) if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; int itemId = -1; - swscanf_s(static_cast(region->name),L"item_%d",&itemId); + swscanf(static_cast(region->name),L"item_%d",&itemId); if (itemId == -1 || itemId > Item::ITEM_NUM_COUNT || Item::items[itemId] == nullptr) { app.DebugPrintf("This is not the control we are looking for\n"); diff --git a/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp index 525be3d0..f90c4b12 100644 --- a/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp @@ -264,7 +264,7 @@ void UIScene_EnchantingMenu::customDraw(IggyCustomDrawCallbackRegion *region) else { int slotId = -1; - swscanf_s(static_cast(region->name),L"slot_Button%d",&slotId); + swscanf(static_cast(region->name),L"slot_Button%d",&slotId); if(slotId >= 0) { // Setup GDraw, normal game render states and matrices diff --git a/Minecraft.Client/Common/UI/UIScene_HUD.cpp b/Minecraft.Client/Common/UI/UIScene_HUD.cpp index e5ba07f2..bc134f73 100644 --- a/Minecraft.Client/Common/UI/UIScene_HUD.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HUD.cpp @@ -24,7 +24,6 @@ UIScene_HUD::UIScene_HUD(int iPad, void *initData, UILayer *parentLayer) : UISce m_labelChatText[i].init(L""); } m_labelJukebox.init(L""); - m_labelGameModeSplash.init(L""); addTimer(0, 100); } @@ -150,10 +149,9 @@ void UIScene_HUD::tick() m_ticksWithNoBoss = 0; SetDragonHealth(BossMobGuiInfo::healthProgress[idx]); SetDragonLabel(BossMobGuiInfo::name[idx]); - if (!m_showDragonHealth) - { + + if (!m_showDragonHealth) ShowDragonHealth(true); - } } } } @@ -164,7 +162,7 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return; int slot = -1; - swscanf_s(static_cast(region->name),L"slot_%d",&slot); + swscanf(static_cast(region->name),L"slot_%d",&slot); if (slot == -1) { app.DebugPrintf("This is not the control we are looking for\n"); @@ -265,7 +263,6 @@ void UIScene_HUD::handleReload() m_labelChatText[i].init(L""); } m_labelJukebox.init(L""); - m_labelGameModeSplash.init(L""); int iGuiScale; if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) @@ -610,6 +607,7 @@ void UIScene_HUD::HideSelectedLabel() IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHideSelectedLabel , 0 , nullptr ); } + void UIScene_HUD::SetRidingHorse(bool ridingHorse, bool bIsJumpable, int maxHorseHealth) { if(m_bRidingHorse != ridingHorse || maxHorseHealth != m_iHorseMaxHealth) @@ -776,7 +774,6 @@ void UIScene_HUD::handleTimerComplete(int id) { Gui *pGui = pMinecraft->gui; //DWORD messagesToDisplay = min( CHAT_LINES_COUNT, pGui->getMessagesCount(m_iPad) ); - DWORD totalMessages = pGui->getMessagesCount(m_iPad); DWORD messagesToDisplay = min(CHAT_LINES_COUNT, totalMessages); DWORD maxScroll = max(0, totalMessages - messagesToDisplay); @@ -907,38 +904,4 @@ void UIScene_HUD::handleGameTick() updateFrameTick(); } -} - -//TODO TU25 -void UIScene_HUD::ShowGameModePlayers(bool show) {} -void UIScene_HUD::SetGameModePlayerState(bool bEnabled) {} -void UIScene_HUD::ShowQuickSelect(bool show) -{ - if(show != m_showQuickSelect) - { - app.DebugPrintf("ShowQuickSelect to %s\n", show?"TRUE":"FALSE"); - m_showQuickSelect = show; - - IggyDataValue result; - IggyDataValue value[1]; - value[0].type = IGGY_DATATYPE_boolean; - value[0].boolval = show; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcShowQuickSelect , 1 , value ); - } -} -void UIScene_HUD::ShowCrosshair(bool show) -{ - if(show != m_showCrosshair) - { - app.DebugPrintf("ShowCrosshair to %s\n", show?"TRUE":"FALSE"); - m_showCrosshair = show; - - IggyDataValue result; - IggyDataValue value[1]; - value[0].type = IGGY_DATATYPE_boolean; - value[0].boolval = show; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcShowCrosshair , 1 , value ); - } -} -//void UIScene_HUD::ShowPulser(bool show) {} -//void UIScene_HUD::SetPulserText(bool bEnabled) {} \ No newline at end of file +} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_HUD.h b/Minecraft.Client/Common/UI/UIScene_HUD.h index d03dd81b..04468c8e 100644 --- a/Minecraft.Client/Common/UI/UIScene_HUD.h +++ b/Minecraft.Client/Common/UI/UIScene_HUD.h @@ -13,7 +13,6 @@ private: protected: UIControl_Label m_labelChatText[CHAT_LINES_COUNT]; UIControl_Label m_labelJukebox; - UIControl_Label m_labelGameModeSplash; UIControl m_controlLabelBackground[CHAT_LINES_COUNT]; UIControl_Label m_labelDisplayName; @@ -26,9 +25,6 @@ protected: IggyName m_funcRepositionHud, m_funcSetDisplayName, m_funcSetTooltipsEnabled; IggyName m_funcSetRidingHorse, m_funcSetHorseHealth, m_funcSetHorseJumpBarProgress; IggyName m_funcSetHealthAbsorb; - IggyName m_funcSetGamemodePlayerState, m_funcShowGamemodePlayers; - IggyName m_funcShowQuickSelect; - IggyName m_funcShowCrosshair; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT(m_labelChatText[0],"Label1") UI_MAP_ELEMENT(m_labelChatText[1],"Label2") @@ -54,8 +50,6 @@ protected: UI_MAP_ELEMENT(m_labelJukebox,"Jukebox") - UI_MAP_ELEMENT(m_labelGameModeSplash,"GameModeSplash") //TODO TU25 - UI_MAP_ELEMENT(m_labelDisplayName,"LabelGamertag") UI_MAP_NAME(m_funcLoadHud, L"LoadHud") @@ -95,12 +89,6 @@ protected: UI_MAP_NAME(m_funcSetHorseJumpBarProgress, L"SetHorseJumpBarProgress") UI_MAP_NAME(m_funcSetHealthAbsorb, L"SetHealthAbsorb") - - //TU 25 - UI_MAP_NAME(m_funcSetGamemodePlayerState, L"ShowGameModePlayers") - UI_MAP_NAME(m_funcShowGamemodePlayers, L"SetGameModePlayerState") - UI_MAP_NAME(m_funcShowQuickSelect, L"ShowQuickSelect") - UI_MAP_NAME(m_funcShowCrosshair, L"ShowCrosshair") UI_END_MAP_ELEMENTS_AND_NAMES() public: @@ -171,15 +159,9 @@ private: void SetHealthAbsorb(int healthAbsorb); - //TODO TU25 - void ShowQuickSelect(bool show); - void ShowCrosshair(bool show); public: void SetSelectedLabel(const wstring &label); void ShowDisplayName(bool show); - //TODO TU25 - void ShowGameModePlayers(bool show); - void SetGameModePlayerState(bool bEnabled); void handleGameTick(); diff --git a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.h b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.h index 3386872f..3f9ace3a 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.h @@ -77,7 +77,7 @@ public: virtual void handleFocusChange(F64 controlId, F64 childId); virtual void handleInitFocus(F64 controlId, F64 childId); - virtual EUIScene getSceneType() { return eUIScene_LoadCreateJoinMenu;} + virtual EUIScene getSceneType() { return eUIScene_LoadOrJoinMenu;} // Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden virtual bool hidesLowerScenes() { return true; } diff --git a/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp index 2369618f..4e217c77 100644 --- a/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InventoryMenu.cpp @@ -25,19 +25,6 @@ UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer InventoryScreenInput *initData = static_cast(_initData); - if (app.GetGameSettings(iPad,eGameSetting_ClassicCrafting)) - { - m_slotListCrafting.addSlots(InventoryMenu::CRAFT_SLOT_START, 4); - m_slotListResult.addSlots(InventoryMenu::RESULT_SLOT, 1); - m_labelCrafting.init(app.GetString(IDS_HOW_TO_PLAY_MENU_CRAFTING)); - - this->m_bIsClassicCrafting = true; - } - else - this->m_bIsClassicCrafting = false; - - SetClassicCrafting(this->m_bIsClassicCrafting); - Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[initData->iPad] != nullptr ) { @@ -50,17 +37,16 @@ UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer initData->player->awardStat(GenericStats::openInventory(),GenericStats::param_openInventory()); - if (this->m_bIsClassicCrafting) - Initialize( initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, initData->bNavigateBack ); - else - Initialize( initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryCraftingGrid, initData->bNavigateBack ); + Initialize( initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, initData->bNavigateBack ); m_slotListArmor.addSlots(InventoryMenu::ARMOR_SLOT_START, InventoryMenu::ARMOR_SLOT_END - InventoryMenu::ARMOR_SLOT_START); if(initData) delete initData; for(unsigned int i = 0; i < MobEffect::NUM_EFFECTS; ++i) + { m_bEffectTime[i] = 0; + } updateEffectsDisplay(); addTimer(INVENTORY_UPDATE_EFFECTS_TIMER_ID,INVENTORY_UPDATE_EFFECTS_TIMER_TIME); @@ -69,27 +55,25 @@ UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer wstring UIScene_InventoryMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) + { return L"InventoryMenuSplit"; + } else + { return L"InventoryMenu"; + } } void UIScene_InventoryMenu::handleReload() { Initialize( m_iPad, m_menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, m_bNavigateBack ); - SetClassicCrafting(this->m_bIsClassicCrafting); - m_slotListArmor.addSlots(InventoryMenu::ARMOR_SLOT_START, InventoryMenu::ARMOR_SLOT_END - InventoryMenu::ARMOR_SLOT_START); - if (this->m_bIsClassicCrafting) - { - m_slotListCrafting.addSlots(InventoryMenu::CRAFT_SLOT_START, 4); - m_slotListResult.addSlots(InventoryMenu::RESULT_SLOT, 1); - } - for(unsigned int i = 0; i < MobEffect::NUM_EFFECTS; ++i) + { m_bEffectTime[i] = 0; + } } int UIScene_InventoryMenu::getSectionColumns(ESceneSection eSection) @@ -106,12 +90,6 @@ int UIScene_InventoryMenu::getSectionColumns(ESceneSection eSection) case eSectionInventoryUsing: cols = 9; break; - case eSectionInventoryCraftingGrid: - cols = 2; - break; - case eSectionInventoryCraftingResult: - cols = 1; - break; default: assert( false ); break; @@ -133,12 +111,6 @@ int UIScene_InventoryMenu::getSectionRows(ESceneSection eSection) case eSectionInventoryUsing: rows = 1; break; - case eSectionInventoryCraftingGrid: - rows = 2; - break; - case eSectionInventoryCraftingResult: - rows = 1; - break; default: assert( false ); break; @@ -162,14 +134,6 @@ void UIScene_InventoryMenu::GetPositionOfSection( ESceneSection eSection, UIVec2 pPosition->x = m_slotListHotbar.getXPos(); pPosition->y = m_slotListHotbar.getYPos(); break; - case eSectionInventoryCraftingGrid: - pPosition->x = m_slotListCrafting.getXPos(); - pPosition->y = m_slotListCrafting.getYPos(); - break; - case eSectionInventoryCraftingResult: - pPosition->x = m_slotListResult.getXPos(); - pPosition->y = m_slotListResult.getYPos(); - break; default: assert( false ); break; @@ -194,14 +158,6 @@ void UIScene_InventoryMenu::GetItemScreenData( ESceneSection eSection, int iItem sectionSize.x = m_slotListHotbar.getWidth(); sectionSize.y = m_slotListHotbar.getHeight(); break; - case eSectionInventoryCraftingGrid: - sectionSize.x = m_slotListCrafting.getWidth(); - sectionSize.y = m_slotListCrafting.getHeight(); - break; - case eSectionInventoryCraftingResult: - sectionSize.x = m_slotListResult.getWidth(); - sectionSize.y = m_slotListResult.getHeight(); - break; default: assert( false ); break; @@ -238,15 +194,6 @@ void UIScene_InventoryMenu::setSectionSelectedSlot(ESceneSection eSection, int x case eSectionInventoryUsing: slotList = &m_slotListHotbar; break; - case eSectionInventoryCraftingGrid: - slotList = &m_slotListCrafting; - break; - case eSectionInventoryCraftingResult: - slotList = &m_slotListResult; - break; - default: - assert( false ); - break; } slotList->setHighlightSlot(index); @@ -266,15 +213,6 @@ UIControl *UIScene_InventoryMenu::getSection(ESceneSection eSection) case eSectionInventoryUsing: control = &m_slotListHotbar; break; - case eSectionInventoryCraftingGrid: - control = &m_slotListCrafting; - break; - case eSectionInventoryCraftingResult: - control = &m_slotListResult; - break; - default: - assert( false ); - break; } return control; } @@ -296,7 +234,9 @@ void UIScene_InventoryMenu::customDraw(IggyCustomDrawCallbackRegion *region) ui.endCustomDraw(region); } else + { UIScene_AbstractContainerMenu::customDraw(region); + } } void UIScene_InventoryMenu::handleTimerComplete(int id) @@ -390,19 +330,3 @@ void UIScene_InventoryMenu::updateEffectsDisplay() delete activeEffects; } - -void UIScene_InventoryMenu::SetClassicCrafting(bool m_bIsClassicCrafting) -{ - IggyDataValue result; - IggyDataValue arg; - arg.type = IGGY_DATATYPE_boolean; - arg.boolval = m_bIsClassicCrafting; - - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetClassicCrafting , 1 , &arg ); - - if (!m_bIsClassicCrafting) - { - m_slotListArmor.UpdateControl(); - m_playerPreview.UpdateControl(); - } -} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_InventoryMenu.h b/Minecraft.Client/Common/UI/UIScene_InventoryMenu.h index 34bf2cf7..fb8d57a2 100644 --- a/Minecraft.Client/Common/UI/UIScene_InventoryMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_InventoryMenu.h @@ -12,32 +12,20 @@ class UIScene_InventoryMenu : public UIScene_AbstractContainerMenu, public IUISc friend class UIControl_MinecraftPlayer; private: int m_bEffectTime[MobEffect::NUM_EFFECTS]; - int m_bIsClassicCrafting; - - void updateEffectsDisplay(); - void SetClassicCrafting(bool m_bIsClassicCrafting); - public: UIScene_InventoryMenu(int iPad, void *initData, UILayer *parentLayer); - virtual EUIScene getSceneType() { return eUIScene_InventoryMenu; } + virtual EUIScene getSceneType() { return eUIScene_InventoryMenu;} protected: - UIControl_SlotList m_slotListArmor, m_slotListCrafting, m_slotListResult; + UIControl_SlotList m_slotListArmor; UIControl_MinecraftPlayer m_playerPreview; - UIControl_Label m_labelCrafting; - - IggyName m_funcSetClassicCrafting, m_funcUpdateEffects, m_funcAddEffect; - + IggyName m_funcUpdateEffects, m_funcAddEffect; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene_AbstractContainerMenu) UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlMainPanel ) UI_MAP_ELEMENT( m_slotListArmor, "armorList") UI_MAP_ELEMENT( m_playerPreview, "iggy_player") - UI_MAP_ELEMENT( m_slotListCrafting, "craftingList") - UI_MAP_ELEMENT( m_slotListResult, "Result") - UI_MAP_ELEMENT( m_labelCrafting, "craftingLabel") - UI_MAP_NAME( m_funcSetClassicCrafting, L"SetClassicCrafting") UI_MAP_NAME( m_funcUpdateEffects, L"UpdateEffects") UI_MAP_NAME( m_funcAddEffect, L"AddEffect") UI_END_MAP_CHILD_ELEMENTS() @@ -57,4 +45,7 @@ protected: virtual void customDraw(IggyCustomDrawCallbackRegion *region); virtual void handleTimerComplete(int id); + +private: + void updateEffectsDisplay(); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index dd469856..122290b4 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp @@ -816,7 +816,7 @@ int UIScene_JoinMenu::EditServerKeyboardCallback(LPVOID lpParam, bool bRes) wchar_t wDefaultName[64] = {}; if (pClass->m_selectedSession->displayLabel) - wcsncpy_s(wDefaultName, pClass->m_selectedSession->displayLabel, 63); + wcsncpy(wDefaultName, pClass->m_selectedSession->displayLabel, 63); UIKeyboardInitData kbData; kbData.title = L"Server Name"; diff --git a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index b805f5fe..8d50cbe2 100644 --- a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -58,30 +58,29 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini // 4J-PB - to stop an offline game being able to select the online flag if(ProfileManager.IsSignedInLive(m_params->iPad) == false) { - //m_checkboxes[eLaunchCheckbox_Online].SetEnable(false); + m_checkboxes[eLaunchCheckbox_Online].SetEnable(false); } if ( m_params->bOnlineSettingChangedBySystem && !m_bMultiplayerAllowed ) { // 4J-JEV: Disable and uncheck these boxes if they can't play multiplayer. -/* m_checkboxes[eLaunchCheckbox_Online].SetEnable(false); m_checkboxes[eLaunchCheckbox_InviteOnly].SetEnable(false); m_checkboxes[eLaunchCheckbox_AllowFoF].SetEnable(false); -*/ + bOnlineGame = bInviteOnly = bAllowFriendsOfFriends = false; } else if(!m_params->bOnlineGame) { - //m_checkboxes[eLaunchCheckbox_InviteOnly].SetEnable(false); - //m_checkboxes[eLaunchCheckbox_AllowFoF].SetEnable(false); + m_checkboxes[eLaunchCheckbox_InviteOnly].SetEnable(false); + m_checkboxes[eLaunchCheckbox_AllowFoF].SetEnable(false); } // Init cheats m_bUpdateCheats = false; // Update cheat checkboxes UpdateCheats(); -/* + m_checkboxes[eLaunchCheckbox_Online].init(app.GetString(IDS_ONLINE_GAME),eLaunchCheckbox_Online,bOnlineGame); m_checkboxes[eLaunchCheckbox_InviteOnly].init(app.GetString(IDS_INVITE_ONLY),eLaunchCheckbox_InviteOnly,bInviteOnly); m_checkboxes[eLaunchCheckbox_AllowFoF].init(app.GetString(IDS_ALLOWFRIENDSOFFRIENDS),eLaunchCheckbox_AllowFoF,bAllowFriendsOfFriends); @@ -102,28 +101,12 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini m_checkboxes[eLaunchCheckbox_TileDrops].init(app.GetString(IDS_TILE_DROPS), eLaunchCheckbox_TileDrops, m_params->bDoTileDrops); m_checkboxes[eLaunchCheckbox_NaturalRegeneration].init(app.GetString(IDS_NATURAL_REGEN), eLaunchCheckbox_NaturalRegeneration, m_params->bNaturalRegeneration); m_checkboxes[eLaunchCheckbox_DayLightCycle].init(app.GetString(IDS_DAYLIGHT_CYCLE), eLaunchCheckbox_DayLightCycle, m_params->bDoDaylightCycle); -*/ - m_labelGameOptions.init(app.GetString(IDS_GAME_OPTIONS)); - m_worldOptionsList.AddNewLabel(app.GetString(IDS_CREATE_NEW_WORLD_SEED)); - m_worldOptionsList.AddNewLabel(app.GetString(IDS_CREATE_NEW_WORLD_RANDOM_SEED)); - m_worldOptionsList.AddNewTextInput(app.GetString(IDS_GAMEOPTION_SEED), eControl_EditSeed); + m_labelGameOptions.init( app.GetString(IDS_GAME_OPTIONS) ); + m_labelSeed.init(app.GetString(IDS_CREATE_NEW_WORLD_SEED)); + m_labelRandomSeed.init(app.GetString(IDS_CREATE_NEW_WORLD_RANDOM_SEED)); + m_editSeed.init(m_params->seed, eControl_EditSeed); - m_worldOptionsList.AddNewLabel(app.GetString(IDS_WORLD_SIZE)); - m_worldOptionsList.AddNewSlider(app.GetString(m_iWorldSizeTitleA[m_params->worldSize]), eControl_WorldSize, 0, 3, m_params->worldSize); - - m_worldOptionsList.AddNewCheckbox(app.GetString(IDS_GENERATE_STRUCTURES), eLaunchCheckbox_Structures, m_params->bStructures); - m_worldOptionsList.AddNewCheckbox(app.GetString(IDS_BONUS_CHEST), eLaunchCheckbox_BonusChest, m_params->bBonusChest); - m_worldOptionsList.AddNewCheckbox(app.GetString(IDS_SUPERFLAT_WORLD), eLaunchCheckbox_FlatWorld, m_params->bFlatWorld); - m_worldOptionsList.AddNewButton(L"Customize Superflat", 22); - - //m_worldOptionsList.AddNewCheckbox(app.GetString(IDS_RESET_NETHER), eLaunchCheckbox_ResetNether, m_params->bResetNether); - m_worldOptionsList.AddNewCheckbox(app.GetString(IDS_DISABLE_SAVING), eLaunchCheckbox_DisableSaving, m_params->bDisableSaving); - m_worldOptionsList.AddNewCheckbox(app.GetString(IDS_TRUST_PLAYERS), eLaunchCheckbox_TrustSystem, m_params->bTrust); - m_worldOptionsList.AddNewCheckbox(app.GetString(IDS_FIRE_SPREADS), eLaunchCheckbox_FireSpreads, m_params->bFireSpreads); - m_worldOptionsList.AddNewCheckbox(app.GetString(IDS_TNT_EXPLODES), eLaunchCheckbox_TNT, m_params->bTNT); - -/* #ifdef _LARGE_WORLDS m_labelWorldSize.init(app.GetString(IDS_WORLD_SIZE)); m_sliderWorldSize.init(app.GetString(m_iWorldSizeTitleA[m_params->worldSize]),eControl_WorldSize,0,3,m_params->worldSize); @@ -140,7 +123,12 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini m_checkboxes[eLaunchCheckbox_WorldResizeType].init(app.GetString(IDS_INCREASE_WORLD_SIZE_OVERWRITE_EDGES),eLaunchCheckbox_WorldResizeType,m_params->newWorldSizeOverwriteEdges); } #endif -*/ + + // Only the Xbox 360 needs a reset nether + // 4J-PB - PS3 needs it now + // #ifndef _XBOX + // if(!m_params->bGenerateOptions) removeControl( &m_checkboxes[eLaunchCheckbox_ResetNether], false ); + // #endif m_tabIndex = m_params->bGenerateOptions ? TAB_WORLD_OPTIONS : TAB_GAME_OPTIONS; @@ -173,6 +161,14 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini addTimer(GAME_CREATE_ONLINE_TIMER_ID,GAME_CREATE_ONLINE_TIMER_TIME); +#ifdef __PSVITA__ + // initialise vita tab controls with ids + m_TouchTabWorld.init(ETouchInput_TabWorld); + m_TouchTabGame.init(ETouchInput_TabGame); + + ui.TouchBoxRebuild(this); +#endif + m_bIgnoreInput = false; } @@ -199,7 +195,11 @@ void UIScene_LaunchMoreOptionsMenu::updateTooltips() void UIScene_LaunchMoreOptionsMenu::updateComponents() { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); +//#ifdef _LARGE_WORLDS +// m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); +//#else m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false); +//#endif } wstring UIScene_LaunchMoreOptionsMenu::getMoviePath() @@ -215,14 +215,14 @@ void UIScene_LaunchMoreOptionsMenu::tick() if (bMultiplayerAllowed != m_bMultiplayerAllowed) { - //m_checkboxes[ eLaunchCheckbox_Online].SetEnable(bMultiplayerAllowed); - //m_checkboxes[eLaunchCheckbox_InviteOnly].SetEnable(bMultiplayerAllowed); - //m_checkboxes[ eLaunchCheckbox_AllowFoF].SetEnable(bMultiplayerAllowed); + m_checkboxes[ eLaunchCheckbox_Online].SetEnable(bMultiplayerAllowed); + m_checkboxes[eLaunchCheckbox_InviteOnly].SetEnable(bMultiplayerAllowed); + m_checkboxes[ eLaunchCheckbox_AllowFoF].SetEnable(bMultiplayerAllowed); if (bMultiplayerAllowed) { - //m_checkboxes[ eLaunchCheckbox_Online].setChecked(true); - //m_checkboxes[eLaunchCheckbox_AllowFoF].setChecked(true); + m_checkboxes[ eLaunchCheckbox_Online].setChecked(true); + m_checkboxes[eLaunchCheckbox_AllowFoF].setChecked(true); } m_bMultiplayerAllowed = bMultiplayerAllowed; @@ -244,6 +244,14 @@ void UIScene_LaunchMoreOptionsMenu::tick() void UIScene_LaunchMoreOptionsMenu::handleDestroy() { +#ifdef __PSVITA__ + app.DebugPrintf("missing InputManager.DestroyKeyboard on Vita !!!!!!\n"); +#endif + + // so shut down the keyboard if it is displayed +#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO) + InputManager.DestroyKeyboard(); +#endif } void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) @@ -266,6 +274,21 @@ void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, } break; case ACTION_MENU_OK: +#ifdef __ORBIS__ + case ACTION_MENU_TOUCHPAD_PRESS: +#endif + // 4J-JEV: Inform user why their game must be offline. +#if defined _XBOX_ONE + { + UIControl_CheckBox *checkboxOnline = &m_checkboxes[eLaunchCheckbox_Online]; + if ( pressed && controlHasFocus( checkboxOnline->getId()) && !checkboxOnline->IsEnabled() ) + { + UINT uiIDA[1] = { IDS_CONFIRM_OK }; + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); + } + } +#endif + case ACTION_MENU_UP: case ACTION_MENU_DOWN: case ACTION_MENU_LEFT: @@ -291,7 +314,32 @@ void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, } } -#ifdef _WINDOWS64 +#ifdef __PSVITA__ +void UIScene_LaunchMoreOptionsMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased) +{ + if(bPressed) + { + switch(iId) + { + case ETouchInput_TabWorld: + case ETouchInput_TabGame: + // Toggle tab index + int iNewTabIndex = (iId == ETouchInput_TabWorld) ? 0 : 1; + if(m_tabIndex != iNewTabIndex) + { + m_tabIndex = iNewTabIndex; + updateTooltips(); + IggyDataValue result; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcChangeTab , 0 , nullptr ); + } + ui.TouchBoxRebuild(this); + break; + } + } +} +#endif + +#if defined(__PSVITA__) || defined(_WINDOWS64) UIControl* UIScene_LaunchMoreOptionsMenu::GetMainPanel() { if(m_tabIndex == 0) @@ -301,7 +349,7 @@ UIControl* UIScene_LaunchMoreOptionsMenu::GetMainPanel() } #endif -void UIScene_LaunchMoreOptionsMenu::handleCheckboxElementToggled(F64 controlId, F64 idk, bool selected) +void UIScene_LaunchMoreOptionsMenu::handleCheckboxToggled(F64 controlId, bool selected) { //CD - Added for audio ui.PlayUISFX(eSFX_Press); @@ -458,17 +506,46 @@ void UIScene_LaunchMoreOptionsMenu::handleFocusChange(F64 controlId, F64 childId #endif }; - UpdateDescriptionText(stringId); + wstring wsText=app.GetString(stringId); + EHTMLFontSize size = eHTMLSize_Normal; + if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) + { + size = eHTMLSize_Splitscreen; + } + wchar_t startTags[64]; + swprintf(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); + wsText = startTags + wsText; + + if (m_tabIndex == TAB_WORLD_OPTIONS) + m_labelDescription_WorldOptions.setLabel(wsText); + else + m_labelDescription_GameOptions.setLabel(wsText); } -/* -void UIScene_LaunchMoreOptionsMenu::handleGainFocus(F64 controlId, F64 childId) +void UIScene_LaunchMoreOptionsMenu::handleTimerComplete(int id) { - UpdateDescriptionText(stringId); -} -*/ + /*switch(id) //4J-JEV: Moved this over to the tick. + { + case GAME_CREATE_ONLINE_TIMER_ID: + { + bool bMultiplayerAllowed + = ProfileManager.IsSignedInLive(m_params->iPad) + && ProfileManager.AllowedToPlayMultiplayer(m_params->iPad); -void UIScene_LaunchMoreOptionsMenu::handleTimerComplete(int id) {} + if (bMultiplayerAllowed != m_bMultiplayerAllowed) + { + m_checkboxes[ eLaunchCheckbox_Online].SetEnable(bMultiplayerAllowed); + m_checkboxes[eLaunchCheckbox_InviteOnly].SetEnable(bMultiplayerAllowed); + m_checkboxes[ eLaunchCheckbox_AllowFoF].SetEnable(bMultiplayerAllowed); + + m_checkboxes[eLaunchCheckbox_Online].setChecked(bMultiplayerAllowed); + + m_bMultiplayerAllowed = bMultiplayerAllowed; + } + } + break; + };*/ +} int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,bool bRes) { @@ -481,6 +558,15 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,b Win64_GetKeyboardText(pchText, 128); pClass->m_editSeed.setLabel(reinterpret_cast(pchText)); pClass->m_params->seed = static_cast(reinterpret_cast(pchText)); +#else +#ifdef __PSVITA__ + uint16_t pchText[2048] = {}; +#else + uint16_t pchText[128] = {}; +#endif + InputManager.GetText(pchText); + pClass->m_editSeed.setLabel((wchar_t *)pchText); + pClass->m_params->seed = (wchar_t *)pchText; #endif } return 0; @@ -526,6 +612,24 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) kbData.lpParam = this; ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData); } +#else + m_bIgnoreInput=true; +#ifdef __PS3__ + int language = XGetLanguage(); + switch(language) + { + case XC_LANGUAGE_JAPANESE: + case XC_LANGUAGE_KOREAN: + case XC_LANGUAGE_TCHINESE: + InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default); + break; + default: + InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Alphabet_Extended); + break; + } +#else + InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD_SEED),m_editSeed.getLabel(),(DWORD)0,60,&UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default); +#endif #endif } break; @@ -533,7 +637,7 @@ void UIScene_LaunchMoreOptionsMenu::handlePress(F64 controlId, F64 childId) } -void UIScene_LaunchMoreOptionsMenu::handleSliderElementMove(F64 sliderId, F64 currentValue, F64 idk) +void UIScene_LaunchMoreOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValue) { int value = static_cast(currentValue); switch(static_cast(sliderId)) @@ -563,10 +667,10 @@ void UIScene_LaunchMoreOptionsMenu::UpdateCheats() { bool cheatsOn = m_params->bHostPrivileges; - //m_checkboxes[eLaunchCheckbox_KeepInventory].SetEnable(cheatsOn); - //m_checkboxes[eLaunchCheckbox_MobSpawning].SetEnable(cheatsOn); - //m_checkboxes[eLaunchCheckbox_MobGriefing].SetEnable(cheatsOn); - //m_checkboxes[eLaunchCheckbox_DayLightCycle].SetEnable(cheatsOn); + m_checkboxes[eLaunchCheckbox_KeepInventory].SetEnable(cheatsOn); + m_checkboxes[eLaunchCheckbox_MobSpawning].SetEnable(cheatsOn); + m_checkboxes[eLaunchCheckbox_MobGriefing].SetEnable(cheatsOn); + m_checkboxes[eLaunchCheckbox_DayLightCycle].SetEnable(cheatsOn); if (!cheatsOn) { @@ -576,10 +680,10 @@ void UIScene_LaunchMoreOptionsMenu::UpdateCheats() m_params->bDoMobSpawning = true; m_params->bDoDaylightCycle = true; - //m_checkboxes[eLaunchCheckbox_KeepInventory].setChecked(m_params->bKeepInventory); - //m_checkboxes[eLaunchCheckbox_MobSpawning].setChecked(m_params->bDoMobSpawning); - //m_checkboxes[eLaunchCheckbox_MobGriefing].setChecked(m_params->bMobGriefing); - //m_checkboxes[eLaunchCheckbox_DayLightCycle].setChecked(m_params->bDoDaylightCycle); + m_checkboxes[eLaunchCheckbox_KeepInventory].setChecked(m_params->bKeepInventory); + m_checkboxes[eLaunchCheckbox_MobSpawning].setChecked(m_params->bDoMobSpawning); + m_checkboxes[eLaunchCheckbox_MobGriefing].setChecked(m_params->bMobGriefing); + m_checkboxes[eLaunchCheckbox_DayLightCycle].setChecked(m_params->bDoDaylightCycle); } } @@ -587,24 +691,6 @@ void UIScene_LaunchMoreOptionsMenu::UpdateOnline() { bool bOnline = m_params->bOnlineGame; - //m_checkboxes[eLaunchCheckbox_InviteOnly].SetEnable(bOnline); - //m_checkboxes[eLaunchCheckbox_AllowFoF].SetEnable(bOnline); -} - -void UIScene_LaunchMoreOptionsMenu::UpdateDescriptionText(int stringId) -{ - wstring wsText=app.GetString(stringId); - EHTMLFontSize size = eHTMLSize_Normal; - if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) - { - size = eHTMLSize_Splitscreen; - } - wchar_t startTags[64]; - swprintf(startTags,64,L"",app.GetHTMLColour(eHTMLColor_White)); - wsText = startTags + wsText; - - if (m_tabIndex == TAB_WORLD_OPTIONS) - m_labelDescription_WorldOptions.setLabel(wsText); - else - m_labelDescription_GameOptions.setLabel(wsText); + m_checkboxes[eLaunchCheckbox_InviteOnly].SetEnable(bOnline); + m_checkboxes[eLaunchCheckbox_AllowFoF].SetEnable(bOnline); } \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h index e930987f..caf9a71f 100644 --- a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h @@ -1,7 +1,6 @@ #pragma once #include "UIScene.h" -#include "UIControl_MultiList.h" class UIScene_LaunchMoreOptionsMenu : public UIScene { @@ -55,15 +54,14 @@ private: UIControl m_controlWorldPanel, m_controlGamePanel; #endif UIControl m_gameOptions, m_worldOptions; - UIControl_MultiList m_worldOptionsList, m_gameOptionsList; + UIControl_CheckBox m_checkboxes[eLaunchCheckboxes_Count]; UIControl_Label m_labelWorldOptions, m_labelGameOptions, m_labelDescription; UIControl_HTMLLabel m_labelDescription_GameOptions, m_labelDescription_WorldOptions; UIControl_Label m_labelSeed, m_labelRandomSeed, m_labelWorldSize, m_labelWorldResize; UIControl_TextInput m_editSeed; - UIControl_Slider m_sliderWorldSize, m_sliderWorldResize; - + UIControl_Slider m_sliderWorldSize; + UIControl_Slider m_sliderWorldResize; IggyName m_funcSetMenuType, m_funcChangeTab, m_funcSetDescription; - UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_labelGameOptions, "LabelGame") UI_MAP_ELEMENT( m_labelWorldOptions, "LabelWorld") @@ -74,6 +72,19 @@ private: UI_MAP_ELEMENT( m_TouchTabGame, "TouchTabGame" ) #endif UI_MAP_ELEMENT( m_labelDescription_GameOptions, "Description_GameOptions") + + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_Online], "CheckboxOnline") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_InviteOnly], "CheckboxInviteOnly") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_AllowFoF], "CheckboxAllowFoF") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_PVP], "CheckboxPVP") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_HostPrivileges], "CheckboxHostPrivileges") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_DayLightCycle], "CheckboxDayLightCycle") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_KeepInventory], "CheckboxKeepInventory") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_MobSpawning], "CheckboxMobSpawning") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_MobGriefing], "CheckboxMobGriefing") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_MobLoot], "CheckboxMobLoot") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_TileDrops], "CheckboxTileDrops") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_NaturalRegeneration], "CheckboxNaturalRegeneration") UI_END_MAP_CHILD_ELEMENTS() UI_MAP_ELEMENT(m_worldOptions, "WorldOptions") @@ -81,8 +92,28 @@ private: #ifdef __PSVITA__ UI_MAP_ELEMENT( m_TouchTabWorld, "TouchTabWorld" ) #endif - UI_MAP_ELEMENT(m_worldOptionsList, "WorldOptionsList") - UI_MAP_ELEMENT(m_labelDescription_WorldOptions, "Description_WorldOptions") + UI_MAP_ELEMENT( m_labelDescription_WorldOptions, "Description_WorldOptions") + + UI_MAP_ELEMENT( m_labelSeed, "Seed") + UI_MAP_ELEMENT( m_editSeed, "EditSeed") + UI_MAP_ELEMENT( m_labelRandomSeed, "RandomSeed") + UI_MAP_ELEMENT( m_labelWorldSize, "WorldSize") + UI_MAP_ELEMENT( m_sliderWorldSize, "WorldSizeSlider") + + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_Structures], "CheckboxStructures") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_BonusChest], "CheckboxBonusChest") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_FlatWorld], "CheckboxFlatWorld") + + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_ResetNether], "CheckboxResetNether") + + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_DisableSaving], "CheckboxDisableSaving") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_TrustSystem], "CheckboxTrustSystem") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_FireSpreads], "CheckboxFireSpreads") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_TNT], "CheckboxTNT") + + UI_MAP_ELEMENT( m_labelWorldResize, "ResizeLabel") + UI_MAP_ELEMENT( m_sliderWorldResize, "ChangeWorldSizeSlider") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_WorldResizeType], "CheckboxResizeType") UI_END_MAP_CHILD_ELEMENTS() UI_MAP_NAME( m_funcChangeTab, L"ChangeTab") @@ -119,10 +150,10 @@ public: virtual void handleTimerComplete(int id); static int KeyboardCompleteSeedCallback(LPVOID lpParam,const bool bRes); virtual void handlePress(F64 controlId, F64 childId); - virtual void handleSliderElementMove(F64 sliderId, F64 currentValue, F64 idk); + virtual void handleSliderMove(F64 sliderId, F64 currentValue); protected: - void handleCheckboxElementToggled(F64 controlId, F64 idk, bool selected); + void handleCheckboxToggled(F64 controlId, bool selected); private: bool m_bUpdateCheats; // If true, update cheats on next tick @@ -131,8 +162,6 @@ private: bool m_bUpdateOnline; // If true, update online settings on next tick void UpdateOnline(); - void UpdateDescriptionText(int stringId); - #ifdef __PSVITA__ virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased); #endif //__PSVITA__ diff --git a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp index 6d1c6499..ed0b3151 100644 --- a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp @@ -964,7 +964,7 @@ int UIScene_LeaderboardsMenu::SetLeaderboardTitleIcons() void UIScene_LeaderboardsMenu::customDraw(IggyCustomDrawCallbackRegion *region) { int slotId = -1; - swscanf_s(static_cast(region->name),L"slot_%d",&slotId); + swscanf(static_cast(region->name),L"slot_%d",&slotId); if (slotId == -1) { //app.DebugPrintf("This is not the control we are looking for\n"); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp deleted file mode 100644 index 2919a180..00000000 --- a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp +++ /dev/null @@ -1,6111 +0,0 @@ -#include "stdafx.h" -#include "UI.h" -#include "UIScene_LoadCreateJoinMenu.h" - -// By Rockefort O Rockefeler - -#include "../../../Minecraft.World/StringHelpers.h" -#include "../../../Minecraft.World/net.minecraft.world.item.h" -#include "../../../Minecraft.World/net.minecraft.world.level.h" -#include "../../../Minecraft.World/net.minecraft.world.level.chunk.storage.h" -#include "../../../Minecraft.World/ConsoleSaveFile.h" -#include "../../../Minecraft.World/ConsoleSaveFileOriginal.h" -#include "../../ProgressRenderer.h" -#include "../../MinecraftServer.h" -#include "../../TexturePackRepository.h" -#include "../../TexturePack.h" -#include "../Network/SessionInfo.h" - -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) -#include "Common\Network\Sony\SonyHttp.h" -#include "Common\Network\Sony\SonyRemoteStorage.h" -#include "DLCTexturePack.h" -#endif - -#if defined(__ORBIS__) || defined(__PSVITA__) -#include -#endif - -#ifdef __PSVITA__ -#include "message_dialog.h" -#endif - -#ifdef _WINDOWS64 -#include "../../../Minecraft.World/NbtIo.h" -#include "../../../Minecraft.World/compression.h" -#include "../../Windows64/KeyboardMouseInput.h" -#include "UISplitScreenHelpers.h" -#include - -static wstring GetPreferredLevelGenSaveTitle(LevelGenerationOptions* levelGen) -{ - if (levelGen == nullptr) - return L""; - - if (levelGen->isTutorial()) - return app.GetString(IDS_TUTORIALSAVENAME); - - LPCWSTR displayName = levelGen->getDisplayName(); - if (displayName != nullptr && displayName[0] != L'\0') - return displayName; - - wstring defaultSaveName = levelGen->getDefaultSaveName(); - if (!defaultSaveName.empty()) - return defaultSaveName; - - LPCWSTR worldName = levelGen->getWorldName(); - if (worldName != nullptr && worldName[0] != L'\0') - return worldName; - - return L""; -} - -static void TrySetButtonListIcon(UIControl_SaveList& list, int itemIndex, const wchar_t* fileName, const wchar_t* textureName) -{ - wstring wsName = wstring(L"Graphics\\") + fileName; - byteArray baIcon = app.getArchiveFile(wsName); - - ui.registerSubstitutionTexture(textureName, baIcon.data, baIcon.length); - list.setTextureName(itemIndex, textureName); -} - -static wstring ReadLevelNameFromSaveFile(const wstring& filePath) -{ - HANDLE hFile = CreateFileW(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); - if (hFile == INVALID_HANDLE_VALUE) return L""; - - DWORD fileSize = GetFileSize(hFile, nullptr); - if (fileSize < 12 || fileSize == INVALID_FILE_SIZE) - { - CloseHandle(hFile); - return L""; - } - - std::vector rawData(fileSize); - DWORD bytesRead = 0; - - if (!ReadFile(hFile, rawData.data(), fileSize, &bytesRead, nullptr) || bytesRead != fileSize) - { - CloseHandle(hFile); - return L""; - } - - CloseHandle(hFile); - - std::vector decompressedData; - uint8_t* saveData = nullptr; - unsigned int saveSize = 0; - - if (*reinterpret_cast(rawData.data()) == 0) - { - // Compressed format: bytes 0-3=0, bytes 4-7=decompressed size, bytes 8+=compressed data - unsigned int decompSize = *reinterpret_cast(rawData.data() + 4); - if (decompSize == 0 || decompSize > 128 * 1024 * 1024) - { - return L""; - } - decompressedData.resize(decompSize); - Compression::getCompression()->Decompress(decompressedData.data(), &decompSize, rawData.data() + 8, fileSize - 8); - - saveData = decompressedData.data(); - saveSize = decompSize; - } - else - { - saveData = rawData.data(); - saveSize = fileSize; - } - - wstring result = L""; - if (saveSize >= 12) - { - unsigned int headerOffset = *reinterpret_cast(saveData); - unsigned int numEntries = *reinterpret_cast(saveData + 4); - const unsigned int entrySize = sizeof(FileEntrySaveData); - - if (headerOffset < saveSize && numEntries > 0 && numEntries < 10000 && - headerOffset + numEntries * entrySize <= saveSize) - { - auto* table = reinterpret_cast(saveData + headerOffset); - for (unsigned int i = 0; i < numEntries; i++) - { - if (wcscmp(table[i].filename, L"level.dat") == 0) - { - unsigned int off = table[i].startOffset; - unsigned int len = table[i].length; - if (off >= 12 && off + len <= saveSize && len > 0 && len < 4 * 1024 * 1024) - { - byteArray ba; - ba.data = saveData + off; - ba.length = len; - - std::unique_ptr root(NbtIo::decompress(ba)); - if (root != nullptr) - { - CompoundTag* dataTag = root->getCompound(L"Data"); - if (dataTag != nullptr) - result = dataTag->getString(L"LevelName"); - } - } - break; - } - } - } - } - - // "world" is the engine default — it means no real name was ever set, so - // return empty to let the caller fall back to the save filename (timestamp). - if (result == L"world") result = L""; - return result; -} -#endif - -#ifdef SONY_REMOTE_STORAGE_DOWNLOAD -unsigned long UIScene_LoadCreateJoinMenu::m_ulFileSize = 0L; -wstring UIScene_LoadCreateJoinMenu::m_wstrStageText = L""; -bool UIScene_LoadCreateJoinMenu::m_bSaveTransferRunning = false; -#endif - -#define JOIN_LOAD_ONLINE_TIMER_ID 0 -#define JOIN_LOAD_ONLINE_TIMER_TIME 100 - -#ifdef _XBOX -#define CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID 3 -#define CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME 50 -#endif - -#ifdef _XBOX_ONE -UIScene_LoadCreateJoinMenu::ESaveTransferFiles UIScene_LoadCreateJoinMenu::s_eSaveTransferFile; -unsigned long UIScene_LoadCreateJoinMenu::s_ulFileSize = 0L; -byteArray UIScene_LoadCreateJoinMenu::s_transferData = byteArray(); -wstring UIScene_LoadCreateJoinMenu::m_wstrStageText = L""; - -#ifdef _DEBUG_MENUS_ENABLED -C4JStorage::SAVETRANSFER_FILE_DETAILS UIScene_LoadCreateJoinMenu::m_debugTransferDetails; -#endif -#endif - -UIScene_LoadCreateJoinMenu::UIScene_LoadCreateJoinMenu(int iPad, void* initData, UILayer* parentLayer) : UIScene(iPad, parentLayer) -{ - constexpr uint64_t MAXIMUM_SAVE_STORAGE = 4LL * 1024LL * 1024LL * 1024LL; - - // Setup all the Iggy references we need for this scene - initialiseMovie(); - - app.SetLiveLinkRequired(true); - - m_iRequestingThumbnailId = 0; - m_iSaveInfoC = 0; - - m_bIgnoreInput = false; - m_bShowingPartyGamesOnly = false; - m_bInParty = false; - - m_activeTab = eTab_Load; - m_bPendingSaveSizeBarRefresh = false; - m_bPendingJoinTabAvailabilityRefresh = false; - m_bPendingJoinVisualRefresh = false; - m_bRebuildingJoinVisual = false; -#ifdef _WINDOWS64 - m_lastHoverMouseX = -1; - m_lastHoverMouseY = -1; - m_mouseHoverTracked = false; - m_hoverBaseIndexLoad = 0; - m_hoverBaseIndexCreate = 0; - m_hoverBaseIndexJoin = 0; -#endif - - m_currentSessions = nullptr; - - m_iState = e_SavesIdle; - - //m_bRetrievingSaveInfo=false; - - m_buttonListSaves.init(eControl_SavesList); - m_buttonListNewGames.init(eControl_NewGamesList); - m_buttonListGames.init(eControl_GamesList); - - m_labelSavesListTitle.init(L"Load"); - m_labelCreateListTitle.init(IDS_TOOLTIPS_CREATE); - m_labelJoinListTitle.init(L"Join"); - - m_bHasNoGamesLabel = false; - - m_controlSavesTimer.setVisible(true); - m_controlNewGameTimer.setVisible(false); - m_controlJoinTimer.setVisible(false); - -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) - m_spaceIndicatorSaves.init(L"", eControl_SpaceIndicator, 0, MAXIMUM_SAVE_STORAGE); -#endif - - m_bUpdateSaveSize = false; - m_bAllLoaded = false; - m_bRetrievingSaveThumbnails = false; - m_bSaveThumbnailReady = false; - m_bExitScene = false; - - m_pSaveDetails = nullptr; - m_bSavesDisplayed = false; - m_saveDetails = nullptr; - m_iSaveDetailsCount = 0; - - m_iTexturePacksNotInstalled = 0; - - m_bCopying = false; - m_bCopyingCancelled = false; - -#ifndef _XBOX_ONE - m_bSaveTransferCancelled = false; - m_bSaveTransferInProgress = false; -#endif - - m_eAction = eAction_None; - - m_bMultiplayerAllowed = ProfileManager.IsSignedInLive(m_iPad) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); - -#ifdef _XBOX_ONE - // 4J-PB - in order to buy the skin packs & texture packs, we need the signed offer ids for them, which we get in the availability info - // we need to retrieve this info though, so do it here - app.AddDLCRequest(e_Marketplace_Content); // content is skin packs, texture packs and mash-up packs -#endif - - int iLB = -1; - -#ifdef _XBOX - - XPARTY_USER_LIST partyList; - if ((XPartyGetUserList(&partyList) != XPARTY_E_NOT_IN_PARTY) && (partyList.dwUserCount > 1)) - m_bInParty = true; - else - m_bInParty = false; -#endif - -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) || defined(_DURANGO) || defined(_WINDOWS64) - // Always clear the saves when we enter this menu - StorageManager.ClearSavesInfo(); - -#endif - // block input if we're waiting for DLC to install, and wipe the saves list. The end of dlc mounting custom message will fill the list again - if (app.StartInstallDLCProcess(m_iPad) == true || app.DLCInstallPending()) - // if we're waiting for DLC to mount, don't fill the save list. The custom message on end of dlc mounting will do that - m_bIgnoreInput = true; - else - Initialise(); - -#ifdef __PSVITA__ - if (CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) - g_NetworkManager.startAdhocMatching(); // create the client matching context and clear out the friends list -#endif - - UpdateGamesList(); - - g_NetworkManager.SetSessionsUpdatedCallback(&UpdateGamesListCallback, this); - - m_initData = new JoinMenuInitData(); - - // 4J Stu - Fix for #12530 -TCR 001 BAS Game Stability: Title will crash if the player disconnects while starting a new world and then opts to play the tutorial once they have been returned to the Main Menu. - - MinecraftServer::resetFlags(); - - // If we're not ignoring input, then we aren't still waiting for the DLC to mount, and can now check for corrupt dlc. Otherwise this will happen when the dlc has finished mounting. - - if (!m_bIgnoreInput) - - app.m_dlcManager.checkForCorruptDLCAndAlert(); - - // 4J-PB - Only Xbox will not have trial DLC patched into the game - -#ifdef _XBOX - - // 4J-PB - there may be texture packs we don't have, so use the info from TMS for this - - DLC_INFO* pDLCInfo = nullptr; - - // first pass - look to see if there are any that are not in the list - - bool bTexturePackAlreadyListed; - - bool bNeedToGetTPD = false; - - Minecraft* pMinecraft = Minecraft::GetInstance(); - - int texturePacksCount = pMinecraft->skins->getTexturePackCount(); - - for (unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) - { - bTexturePackAlreadyListed = false; - -#if defined(__PS3__) || defined(__ORBIS__) - char* pchDLCName = app.GetDLCInfoTextures(i); - pDLCInfo = app.GetDLCInfo(pchDLCName); -#else - ULONGLONG ull = app.GetDLCInfoTexturesFullOffer(i); - pDLCInfo = app.GetDLCInfoForFullOfferID(ull); -#endif - - for (unsigned int i = 0; i < texturePacksCount; ++i) - { - TexturePack* tp = pMinecraft->skins->getTexturePackByIndex(i); - - if (pDLCInfo&& pDLCInfo->iConfig == tp->getDLCParentPackId()) - bTexturePackAlreadyListed = true; - } - - if (bTexturePackAlreadyListed == false) - { - // some missing - bNeedToGetTPD = true; - m_iTexturePacksNotInstalled++; - } - } - - if (bNeedToGetTPD == true) - { - // add a TMS request for them - app.DebugPrintf("+++ Adding TMSPP request for texture pack data\n"); - app.AddTMSPPFileTypeRequest(e_DLC_TexturePackData); - - m_iConfigA = new int [m_iTexturePacksNotInstalled]; - m_iTexturePacksNotInstalled = 0; - - for (unsigned int i = 0; i < app.GetDLCInfoTexturesOffersCount(); ++i) - { - bTexturePackAlreadyListed = false; - -#if defined(__PS3__) || defined(__ORBIS__) - char* pchDLCName = app.GetDLCInfoTextures(i); - pDLCInfo = app.GetDLCInfo(pchDLCName); -#else - ULONGLONG ull = app.GetDLCInfoTexturesFullOffer(i); - pDLCInfo = app.GetDLCInfoForFullOfferID(ull); -#endif - - for (unsigned int i = 0; i < texturePacksCount; ++i) - { - TexturePack* tp = pMinecraft->skins->getTexturePackByIndex(i); - if (pDLCInfo->iConfig == tp->getDLCParentPackId()) - bTexturePackAlreadyListed = true; - } - - if (bTexturePackAlreadyListed == false) - m_iConfigA[m_iTexturePacksNotInstalled++] = pDLCInfo->iConfig; - } - } - - addTimer(CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID, CHECKFORAVAILABLETEXTUREPACKS_TIMER_TIME); -#endif - -#ifdef SONY_REMOTE_STORAGE_DOWNLOAD - m_eSaveTransferState = eSaveTransfer_Idle; -#endif -} - - -UIScene_LoadCreateJoinMenu::~UIScene_LoadCreateJoinMenu() -{ - g_NetworkManager.SetSessionsUpdatedCallback(nullptr, nullptr); - app.SetLiveLinkRequired(false); - - if (m_currentSessions) - { - for (const auto& it : *m_currentSessions) - delete it; - - delete m_currentSessions; - - m_currentSessions = nullptr; - } - -#if TO_BE_IMPLEMENTED - // Reset the background downloading, in case we changed it by attempting to download a texture pack - XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); -#endif - - if (m_saveDetails) - { - for (int i = 0; i < m_iSaveDetailsCount; ++i) - delete m_saveDetails[i].pbThumbnailData; - - delete [] m_saveDetails; - } -} - -void UIScene_LoadCreateJoinMenu::updateTooltips() -{ -#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ - if (m_eSaveTransferState != eSaveTransfer_Idle) - return; -#endif - - int iRB = -1; - int iY = -1; - int iLB = -1; - int iX = -1; - int iLS = IDS_TOOLTIPS_NAVIGATE; - - if ((m_activeTab == eTab_Load) && (m_pSaveDetails != nullptr) && (m_pSaveDetails->iSaveC > 0) && (m_buttonListSaves. - getItemCount() > 0)) - { - if (StorageManager.GetSaveDisabled()) - iY = IDS_TOOLTIPS_DELETESAVE; - else if (StorageManager.EnoughSpaceForAMinSaveGame()) - iY = IDS_TOOLTIPS_SAVEOPTIONS; - else - iY = IDS_TOOLTIPS_DELETESAVE; - } - else if (DoesMashUpWorldHaveFocus()) - iY = IDS_TOOLTIPS_HIDE; - -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - if (m_iPad == ProfileManager.GetPrimaryPad()) - iY = IDS_TOOLTIPS_GAME_INVITES; -#endif - - if (ProfileManager.IsFullVersion() == false) - iRB = -1; - else if (StorageManager.GetSaveDisabled()) - { -#ifdef _XBOX - iX = IDS_TOOLTIPS_SELECTDEVICE; -#endif - } - else - { -#if defined _XBOX_ONE - if (ProfileManager.IsSignedInLive(m_iPad)) - iX = IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD; -#elif defined SONY_REMOTE_STORAGE_DOWNLOAD - bool bSignedInLive = ProfileManager.IsSignedInLive(m_iPad); - if (bSignedInLive) - iX = IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD; -#else - iX = IDS_TOOLTIPS_CHANGEDEVICE; -#endif - } - - ui.SetTooltips(DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK, iX, iY, -1, -1, iLB, iRB, iLS, -1, -1, - true); -} - - -void UIScene_LoadCreateJoinMenu::updateComponents() -{ - m_parentLayer->showComponent(m_iPad, eUIComponent_Panorama, true); - m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, false); -} - -UIControl* UIScene_LoadCreateJoinMenu::GetMainPanel() -{ - // This movie does not reliably expose a root "MainPanel" value path in all - // forks/builds. Mouse hover hit-testing in UIController depends on the main - // panel for offsets and descendant filtering, so return the currently-active - // tab container instead of the phantom root panel. - switch (m_activeTab) - { - case eTab_Load: - return &m_controlLoadGame; - case eTab_Create: - return &m_controlNewGame; - case eTab_Join: - return &m_controlJoinGame; - default: - return nullptr; - } -} - -void UIScene_LoadCreateJoinMenu::handleDestroy() -{ -#ifdef __PSVITA__ - app.DebugPrintf("missing InputManager.DestroyKeyboard on Vita !!!!!!\n"); -#endif - - // shut down the keyboard if it is displayed - -#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO) - - InputManager.DestroyKeyboard(); - -#endif -} - -void UIScene_LoadCreateJoinMenu::handleLoseFocus() -{ - // Kill load online timer - killTimer(JOIN_LOAD_ONLINE_TIMER_ID); -} - -void UIScene_LoadCreateJoinMenu::handleGainFocus(bool navBack) - -{ - UIScene::handleGainFocus(navBack); - updateTooltips(); - SyncMovieTab(); - m_bPendingSaveSizeBarRefresh = true; - m_bPendingJoinTabAvailabilityRefresh = true; - addTimer(JOIN_LOAD_ONLINE_TIMER_ID,JOIN_LOAD_ONLINE_TIMER_TIME); - - if (navBack) - - { - app.SetLiveLinkRequired(true); - - m_bMultiplayerAllowed = ProfileManager.IsSignedInLive(m_iPad) && ProfileManager. - AllowedToPlayMultiplayer(m_iPad); - - m_bIgnoreInput = false; - - if (app.StartInstallDLCProcess(m_iPad) == false) - - m_bIgnoreInput = false; - - else - - { - m_bIgnoreInput = true; - - m_buttonListSaves.clearList(); - - m_controlSavesTimer.setVisible(true); - } - - if (m_bMultiplayerAllowed) - - { -#if TO_BE_IMPLEMENTED - - HXUICLASS hClassFullscreenProgress = XuiFindClass(L"CScene_FullscreenProgress"); - - HXUICLASS hClassConnectingProgress = XuiFindClass(L"CScene_ConnectingProgress"); - - if (XuiIsInstanceOf(hSceneFrom, hClassFullscreenProgress) || XuiIsInstanceOf( - hSceneFrom, hClassConnectingProgress)) - - { - UpdateGamesList(); - } - -#endif - } - - else - - { - m_buttonListGames.clearList(); - - m_controlJoinTimer.setVisible(false); - -#if TO_BE_IMPLEMENTED - - m_SavesList.InitFocus(m_iPad); - -#endif - } - - if (app.GetCorruptSaveDeleted()) - - { - m_iState = e_SavesRepopulateAfterDelete; - - app.SetCorruptSaveDeleted(false); - } - } -} - - -// -void UIScene_LoadCreateJoinMenu::Initialise() - -{ - m_iSaveListIndex = 0; - - m_iGameListIndex = 0; - -#ifdef _WINDOWS64 - - m_addServerPhase = eAddServer_Idle; - -#endif - - m_iDefaultButtonsC = 0; - - m_iMashUpButtonsC = 0; - - // Check if we're in the trial version - - if (ProfileManager.IsFullVersion() == false) - - { - AddDefaultButtons(); - -#if TO_BE_IMPLEMENTED - - m_pSavesList->SetCurSelVisible(0); - -#endif - } - - else if (StorageManager.GetSaveDisabled()) - - { -#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) - - GetSaveInfo(); - m_controlSavesTimer.setVisible(true); - -#else - -#if TO_BE_IMPLEMENTED - - if (StorageManager.GetSaveDeviceSelected(m_iPad)) - -#endif - - { - // saving is disabled, but we should still be able to load from a selected save device - - GetSaveInfo(); - m_controlSavesTimer.setVisible(true); - } - -#if TO_BE_IMPLEMENTED - - else - - { - AddDefaultButtons(); - - m_controlSavesTimer.setVisible(false); - } - -#endif - -#endif // __PS3__ || __ORBIS - } - - else - - { - // 4J-PB - we need to check that there is enough space left to create a copy of the save (for a rename) - - bool bCanRename = StorageManager.EnoughSpaceForAMinSaveGame(); - - GetSaveInfo(); - m_controlSavesTimer.setVisible(true); - } - - m_bIgnoreInput = true; - - app.m_dlcManager.checkForCorruptDLCAndAlert(); -} - -int UIScene_LoadCreateJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam, PBYTE pbThumbnail, DWORD dwThumbnailBytes) -{ - auto pClass = static_cast(lpParam); - - app.DebugPrintf("Received data for save thumbnail\n"); - - if(pbThumbnail && dwThumbnailBytes) - { - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = new BYTE[dwThumbnailBytes]; - memcpy(pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData, pbThumbnail, dwThumbnailBytes); - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].dwThumbnailSize = dwThumbnailBytes; - } - else - { - app.DebugPrintf("Save thumbnail data is nullptr, or has size 0\n"); - - wstring wsName = L"Graphics/MinecraftIcon.png"; - byteArray baIcon = app.getArchiveFile(wsName); - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = baIcon.data; - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].dwThumbnailSize = baIcon.length; - } - pClass->m_bSaveThumbnailReady = true; - - return 0; -} - -int UIScene_LoadCreateJoinMenu::LoadSaveCallback(LPVOID lpParam, bool bRes) -{ - //UIScene_LoadCreateJoinMenu *pClass= (UIScene_LoadCreateJoinMenu *)lpParam; - // Get the save data now - - if (bRes) - app.DebugPrintf("Loaded save OK\n"); - - return 0; -} - -void UIScene_LoadCreateJoinMenu::handleTimerComplete(int id) - -{ - switch (id) - - { - case JOIN_LOAD_ONLINE_TIMER_ID: - { -#ifdef _XBOX - - XPARTY_USER_LIST partyList; - - if ((XPartyGetUserList(&partyList) != XPARTY_E_NOT_IN_PARTY) && (partyList.dwUserCount > 1)) - - { - m_bInParty = true; - } - - else - - { - m_bInParty = false; - } - -#endif - - bool bMultiplayerAllowed = ProfileManager.IsSignedInLive(m_iPad) && ProfileManager. - AllowedToPlayMultiplayer(m_iPad); - - if (bMultiplayerAllowed != m_bMultiplayerAllowed) - - { - if (bMultiplayerAllowed) - - { - // m_CheckboxOnline.SetEnable(TRUE); - - // m_CheckboxPrivate.SetEnable(TRUE); - } - - else - - { - m_bInParty = false; - - m_buttonListGames.clearList(); - - m_controlJoinTimer.setVisible(false); - - m_bHasNoGamesLabel = false; - } - - m_bMultiplayerAllowed = bMultiplayerAllowed; - } - } - - break; - - // 4J-PB - Only Xbox will not have trial DLC patched into the game - -#ifdef _XBOX - - case CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID: { - - -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - - for (int i = 0; i < m_iTexturePacksNotInstalled; i++) - - { - if (m_iConfigA[i] != -1) - - { - DLC_INFO* pDLCInfo = app.GetDLCInfoFromTPackID(m_iConfigA[i]); - - if (pDLCInfo) - - { - // retrieve the image - if we haven't already - - wstring textureName = filenametowstring(pDLCInfo->chImageURL); - - if (hasRegisteredSubstitutionTexture(textureName) == false) - - { - PBYTE pbImageData; - - int iImageDataBytes = 0; - - SonyHttp::getDataFromURL(pDLCInfo->chImageURL, (void**)&pbImageData, &iImageDataBytes); - - if (iImageDataBytes != 0) - - { - // set the image - - registerSubstitutionTexture(textureName, pbImageData, iImageDataBytes, true); - - m_iConfigA[i] = -1; - } - } - } - } - } - - bool bAllDone = true; - - for (int i = 0; i < m_iTexturePacksNotInstalled; i++) - - { - if (m_iConfigA[i] != -1) - - { - bAllDone = false; - } - } - - if (bAllDone) - - { - // kill this timer - - killTimer(CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID); - } - -#endif - - } - - break; - -#endif - } -} - - -void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool& handled) - -{ - if (m_bIgnoreInput) - return; - - // if we're retrieving save info, ignore key presses - - if (!m_bSavesDisplayed) - return; - - ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); - - auto openSaveOptions = [&]() -> bool - { - if (!pressed || repeat || !ProfileManager.IsFullVersion() || m_activeTab != eTab_Load) - return false; - - if ((m_pSaveDetails != nullptr) && - (m_pSaveDetails->iSaveC > 0) && - (m_buttonListSaves.getItemCount() > 0) && - (m_iSaveListIndex >= 0) && - (m_iSaveListIndex < m_buttonListSaves.getItemCount())) - { - m_bIgnoreInput = true; - - if (StorageManager.EnoughSpaceForAMinSaveGame() && !StorageManager.GetSaveDisabled()) - { - UINT uiIDA[3]; - uiIDA[0] = IDS_CONFIRM_CANCEL; - uiIDA[1] = IDS_TITLE_RENAMESAVE; - uiIDA[2] = IDS_TOOLTIPS_DELETESAVE; - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVEOPTIONS, IDS_TEXT_SAVEOPTIONS, uiIDA, 3, iPad, - &UIScene_LoadCreateJoinMenu::SaveOptionsDialogReturned, this); - } - else - { - UINT uiIDA[2]; - uiIDA[0] = IDS_CONFIRM_CANCEL; - uiIDA[1] = IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad, - &UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned, this); - } - - ui.PlayUISFX(eSFX_Press); - return true; - } - - return false; - }; - - auto hideFocusedMashupWorld = [&]() -> bool - { - if (!pressed || repeat || !ProfileManager.IsFullVersion() || !DoesMashUpWorldHaveFocus()) - return false; - - const int lGenID = m_iNewGameListIndex - m_iDefaultButtonsC; - if ((lGenID < 0) || (lGenID >= static_cast(m_generators.size()))) - return false; - - LevelGenerationOptions* levelGen = m_generators.at(lGenID); - if (!levelGen || levelGen->isTutorial() || !levelGen->requiresTexturePack()) - return false; - - const int oldIndex = m_iNewGameListIndex; - m_bIgnoreInput = true; - app.HideMashupPackWorld(m_iPad, levelGen->getRequiredTexturePackId()); - AddDefaultButtons(); - - if (m_buttonListNewGames.getItemCount() <= 0) - m_iNewGameListIndex = 0; - else if (oldIndex >= m_buttonListNewGames.getItemCount()) - m_iNewGameListIndex = m_buttonListNewGames.getItemCount() - 1; - else if (oldIndex >= 0) - m_iNewGameListIndex = oldIndex; - - if (m_buttonListNewGames.getItemCount() > 0) - m_buttonListNewGames.setCurrentSelection(m_iNewGameListIndex); - - updateTooltips(); - m_iState = e_SavesIdle; - ui.PlayUISFX(eSFX_Press); - m_bIgnoreInput = false; - return true; - }; - - switch (key) - - { - case ACTION_MENU_CANCEL: - - if (pressed) - - { -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - - m_bExitScene = true; - -#else - - navigateBack(); - -#endif - - handled = true; - } - - break; - - case ACTION_MENU_X: - -#if TO_BE_IMPLEMENTED - - // Change device - - // Fix for #12531 - TCR 001: BAS Game Stability: When a player selects to change a storage - - // device, and repeatedly backs out of the SD screen, disconnects from LIVE, and then selects a SD, the title crashes. - - m_bIgnoreInput = true; - - StorageManager.SetSaveDevice(&CScene_MultiGameJoinLoad::DeviceSelectReturned, this, true); - - ui.PlayUISFX(eSFX_Press); - -#endif - - // Save Transfer - -#ifdef _XBOX_ONE - - if (ProfileManager.IsSignedInLive(m_iPad)) - { - UIScene_LoadCreateJoinMenu::s_ulFileSize = 0; - LaunchSaveTransfer(); - } - -#endif - -#ifdef SONY_REMOTE_STORAGE_DOWNLOAD - - { - bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); - - if (bSignedInLive) - LaunchSaveTransfer(); - } -#endif - -#ifdef _WINDOWS64 - - // Right click on a save opens save options. In Create, it hides mash-up worlds. - if (hideFocusedMashupWorld()) - handled = true; - else if (openSaveOptions()) - handled = true; -#endif - break; - - case ACTION_MENU_Y: -#ifdef _WINDOWS64 - if (hideFocusedMashupWorld()) - { - handled = true; - break; - } - - if (openSaveOptions()) - { - handled = true; - break; - } -#endif - -#if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) - - m_eAction = eAction_ViewInvites; - - if (pressed && iPad == ProfileManager.GetPrimaryPad()) - - { - - - -#ifdef __ORBIS__ - - // Check if PSN is unavailable because of age restriction - - int npAvailability = ProfileManager.getNPAvailability(iPad); - - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - - { - UINT uiIDA[1]; - - uiIDA[0] = IDS_OK; - - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); - - break; - } - -#endif - - // are we offline? - - if (!ProfileManager.IsSignedInLive(iPad)) - - { - // get them to sign in to online - - UINT uiIDA[2]; - - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - - uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; - - ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, - ProfileManager.GetPrimaryPad(), &UIScene_LoadCreateJoinMenu::MustSignInReturnedPSN, - this); - } - - else - - { - - - -#ifdef __ORBIS__ - - SQRNetworkManager_Orbis::RecvInviteGUI(); - -#elif defined __PSVITA__ - - SQRNetworkManager_Vita::RecvInviteGUI(); - -#else - - int ret = sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, - SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, - SYS_MEMORY_CONTAINER_ID_INVALID); - - app.DebugPrintf("sceNpBasicRecvMessageCustom return %d ( %08x )\n", ret, ret); - -#endif - - } - - } - -#elif defined(_DURANGO) - - if (getControlFocus() == eControl_GamesList && m_buttonListGames.getItemCount() > 0) - - { - DWORD nIndex = m_buttonListGames.getCurrentSelection(); - - FriendSessionInfo* pSelectedSession = m_currentSessions->at(nIndex); - - PlayerUID uid = pSelectedSession->searchResult.m_playerXuids[0]; - - if (uid != INVALID_XUID) - ProfileManager.ShowProfileCard(ProfileManager.GetLockedProfile(), uid); - - ui.PlayUISFX(eSFX_Press); - } - -#endif // __PS3__ || __ORBIS__ - - break; - - case ACTION_MENU_RIGHT_SCROLL: - { - if (pressed && !repeat) - - { - ui.PlayUISFX(eSFX_Focus); - - if (m_activeTab == eTab_Load) - SetActiveTab(eTab_Create, true); - - else if (m_activeTab == eTab_Create) - SetActiveTab(eTab_Join, true); - - else - SetActiveTab(eTab_Load, true); - - handled = true; - - break; - } - if (hideFocusedMashupWorld()) - - handled = true; - } - - break; - - case ACTION_MENU_LEFT_SCROLL: - - if (pressed && !repeat) - - { - ui.PlayUISFX(eSFX_Focus); - - if (m_activeTab == eTab_Load) - SetActiveTab(eTab_Join, true); - - else if (m_activeTab == eTab_Create) - SetActiveTab(eTab_Load, true); - - else - SetActiveTab(eTab_Create, true); - - handled = true; - - break; - } - -#ifdef _XBOX - - if (m_bInParty) - - { - m_bShowingPartyGamesOnly = !m_bShowingPartyGamesOnly; - - UpdateGamesList(); - - CXuiSceneBase::PlayUISFX(eSFX_Press); - } - -#endif - - break; - - case ACTION_MENU_LEFT: - - if (pressed && !repeat) - { - ui.PlayUISFX(eSFX_Focus); - if (m_activeTab == eTab_Load) - SetActiveTab(eTab_Join, true); - else if (m_activeTab == eTab_Create) - SetActiveTab(eTab_Load, true); - else - SetActiveTab(eTab_Create, true); - } - - handled = true; - - break; - - case ACTION_MENU_RIGHT: - - if (pressed && !repeat) - { - ui.PlayUISFX(eSFX_Focus); - if (m_activeTab == eTab_Load) - SetActiveTab(eTab_Create, true); - else if (m_activeTab == eTab_Create) - SetActiveTab(eTab_Join, true); - else - SetActiveTab(eTab_Load, true); - } - - handled = true; - - break; - - case ACTION_MENU_OK: - -#ifdef __ORBIS__ - - case ACTION_MENU_TOUCHPAD_PRESS: - -#endif - - case ACTION_MENU_UP: - - case ACTION_MENU_DOWN: - - case ACTION_MENU_PAGEUP: - - case ACTION_MENU_PAGEDOWN: - - sendInputToMovie(key, repeat, pressed, released); - - handled = true; - - break; - - case ACTION_MENU_OTHER_STICK_UP: - - sendInputToMovie(ACTION_MENU_UP, repeat, pressed, released); - - handled = true; - - break; - - case ACTION_MENU_OTHER_STICK_DOWN: - - sendInputToMovie(ACTION_MENU_DOWN, repeat, pressed, released); - - handled = true; - - break; - } -} - -void UIScene_LoadCreateJoinMenu::handleFocusChange(F64 controlId, F64 childId) - -{ - constexpr int visibleRows = 7; - - if (m_bRebuildingJoinVisual && static_cast(controlId) == eControl_GamesList) - return; - - if (static_cast(controlId) == eControl_GamesList && m_activeTab != eTab_Join) - return; - - if (static_cast(controlId) == eControl_NewGamesList && m_activeTab != eTab_Create) - return; - - if (static_cast(controlId) == eControl_SavesList && m_activeTab != eTab_Load) - return; - - const ELoadCreateJoinTab oldTab = m_activeTab; - switch (static_cast(controlId)) - - { - case eControl_TabLoad: - - m_activeTab = eTab_Load; - - break; - - case eControl_TabCreate: - - m_activeTab = eTab_Create; - - break; - - case eControl_TabJoin: - - m_activeTab = eTab_Join; - - break; - - case eControl_GamesList: - - m_activeTab = eTab_Join; - - m_iGameListIndex = childId; - -#ifdef _WINDOWS64 - - m_iGameListIndex -= 1; - -#endif - - m_buttonListGames.updateChildFocus(static_cast(childId)); - - if (childId < m_hoverBaseIndexJoin) - m_hoverBaseIndexJoin = static_cast(childId); - else if (childId >= m_hoverBaseIndexJoin + visibleRows) - m_hoverBaseIndexJoin = static_cast(childId) - visibleRows + 1; - - { - const int maxJoinBase = (m_buttonListGames.getItemCount() - visibleRows > 0) - ? (m_buttonListGames.getItemCount() - visibleRows) - : 0; - if (m_hoverBaseIndexJoin < 0) - m_hoverBaseIndexJoin = 0; - else if (m_hoverBaseIndexJoin > maxJoinBase) - m_hoverBaseIndexJoin = maxJoinBase; - } - - break; - - case eControl_SavesList: - - m_activeTab = eTab_Load; - - m_iSaveListIndex = childId; - - m_bUpdateSaveSize = true; - - if (childId < m_hoverBaseIndexLoad) - m_hoverBaseIndexLoad = static_cast(childId); - else if (childId >= m_hoverBaseIndexLoad + visibleRows) - m_hoverBaseIndexLoad = static_cast(childId) - visibleRows + 1; - - { - const int maxLoadBase = (m_buttonListSaves.getItemCount() - visibleRows > 0) - ? (m_buttonListSaves.getItemCount() - visibleRows) - : 0; - if (m_hoverBaseIndexLoad < 0) - m_hoverBaseIndexLoad = 0; - else if (m_hoverBaseIndexLoad > maxLoadBase) - m_hoverBaseIndexLoad = maxLoadBase; - } - - break; - - case eControl_NewGamesList: - - m_activeTab = eTab_Create; - - m_iNewGameListIndex = childId; - - m_buttonListNewGames.updateChildFocus(static_cast(childId)); - - if (childId < m_hoverBaseIndexCreate) - m_hoverBaseIndexCreate = static_cast(childId); - else if (childId >= m_hoverBaseIndexCreate + visibleRows) - m_hoverBaseIndexCreate = static_cast(childId) - visibleRows + 1; - - { - const int maxCreateBase = (m_buttonListNewGames.getItemCount() - visibleRows > 0) - ? (m_buttonListNewGames.getItemCount() - visibleRows) - : 0; - if (m_hoverBaseIndexCreate < 0) - m_hoverBaseIndexCreate = 0; - else if (m_hoverBaseIndexCreate > maxCreateBase) - m_hoverBaseIndexCreate = maxCreateBase; - } - - break; - } - - updateTooltips(); - if (m_activeTab != oldTab) - { - SetActiveTab(m_activeTab, false); - m_bPendingSaveSizeBarRefresh = true; - m_bPendingJoinTabAvailabilityRefresh = true; - } -} - - -void UIScene_LoadCreateJoinMenu::handleInitFocus(F64 controlId, F64 childId) - -{ - app.DebugPrintf(app.USER_SR, "UIScene_LoadCreateJoinMenu::handleInitFocus - %d , %d\n", static_cast(controlId), - static_cast(childId)); - - SetActiveTab(m_activeTab, false); - m_bPendingSaveSizeBarRefresh = true; - m_bPendingJoinTabAvailabilityRefresh = true; -} - - -void UIScene_LoadCreateJoinMenu::UpdateGamesListCallback(LPVOID pParam) - -{ - if (pParam != nullptr) - - { - auto pScene = static_cast(pParam); - - pScene->UpdateGamesList(); - } -} - - -void UIScene_LoadCreateJoinMenu::tick() - -{ - UIScene::tick(); - -#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined _WINDOWS64 || defined __PSVITA__) - - if (m_bExitScene) // navigate forward or back - - if (!m_bRetrievingSaveThumbnails) - - // need to wait for any callback retrieving thumbnail to complete - - navigateBack(); - - // Stop loading thumbnails if we navigate forwards - - if (hasFocus(m_iPad)) - - { -#ifdef SONY_REMOTE_STORAGE_DOWNLOAD - - // if the loadOrJoin menu has focus again, we can clear the saveTransfer flag now. Added so we can delay the ehternet disconnect till it's cleaned up - - if (m_eSaveTransferState == eSaveTransfer_Idle) - - m_bSaveTransferRunning = false; - -#endif - -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) - - if (m_bUpdateSaveSize) - - { - if ((m_activeTab == eTab_Load) && (m_pSaveDetails != nullptr) && (m_pSaveDetails->iSaveC > 0) && - DoesSavesListHaveFocus() && (m_buttonListSaves.getItemCount() > 0) && (m_iSaveListIndex >= 0) && ( - m_iSaveListIndex < m_buttonListSaves.getItemCount())) - - m_spaceIndicatorSaves.selectSave(m_iSaveListIndex); - - else - - m_spaceIndicatorSaves.selectSave(-1); - - UpdateSaveSizeBarVisibility(); - - m_bUpdateSaveSize = false; - } - - if (m_bPendingSaveSizeBarRefresh) - { - UpdateSaveSizeBarVisibility(); - m_bPendingSaveSizeBarRefresh = false; - } - - if (m_bPendingJoinTabAvailabilityRefresh) - { - UpdateJoinTabAvailability(); - m_bPendingJoinTabAvailabilityRefresh = false; - } - -#endif - - // Display the saves if we have them - - if (!m_bSavesDisplayed) - - { - m_pSaveDetails = StorageManager.ReturnSavesInfo(); - - if (m_pSaveDetails != nullptr) - - { - //CD - Fix - Adding define for ORBIS/XBOXONE - -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) - - m_spaceIndicatorSaves.reset(); - -#endif - - AddDefaultButtons(); - - m_bSavesDisplayed = true; - - UpdateGamesList(); - m_bIgnoreInput = false; - - if (m_saveDetails != nullptr) - - { - for (unsigned int i = 0; i < m_iSaveDetailsCount; ++i) - - if (m_saveDetails[i].pbThumbnailData != nullptr) - - delete m_saveDetails[i].pbThumbnailData; - - delete m_saveDetails; - } - - m_saveDetails = new SaveListDetails[m_pSaveDetails->iSaveC]; - - m_iSaveDetailsCount = m_pSaveDetails->iSaveC; - -#ifdef _WINDOWS64 - - // Sort index array by lastWriteTime - - auto sortedIdx = new int[m_pSaveDetails->iSaveC]; - - for (int si = 0; si < m_pSaveDetails->iSaveC; ++si) - sortedIdx[si] = si; - - for (int si = 1; si < m_pSaveDetails->iSaveC; ++si) - - { - int key = sortedIdx[si]; - - int sj = si - 1; - - while (sj >= 0 && - CompareFileTime(&m_pSaveDetails->SaveInfoA[sortedIdx[sj]].lastWriteTime, - &m_pSaveDetails->SaveInfoA[key].lastWriteTime) < 0) - - { - sortedIdx[sj + 1] = sortedIdx[sj]; - - --sj; - } - - sortedIdx[sj + 1] = key; - } - -#endif - - for (unsigned int i = 0; i < m_pSaveDetails->iSaveC; ++i) - { -#if defined(_XBOX_ONE) - - m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].totalSize); -#elif defined(_WINDOWS64) - int origIdx = sortedIdx[i]; - - wchar_t wFilename[MAX_SAVEFILENAME_LENGTH]; - ZeroMemory(wFilename, sizeof(wFilename)); - mbstowcs_s(nullptr, wFilename, MAX_SAVEFILENAME_LENGTH, m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveFilename, _TRUNCATE); - - wchar_t wSaveTitle[MAX_DISPLAYNAME_LENGTH]; - ZeroMemory(wSaveTitle, sizeof(wSaveTitle)); - mbstowcs_s(nullptr, wSaveTitle, MAX_DISPLAYNAME_LENGTH, m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveTitle, _TRUNCATE); - - wstring filePath = wstring(L"Data/Saves/") + wstring(wFilename) + std::wstring(wSaveTitle) + L".ms"; - - HANDLE hFile = CreateFileW(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); - DWORD fileSize = 0; - - if (hFile != INVALID_HANDLE_VALUE) - { - fileSize = GetFileSize(hFile, nullptr); - - if (fileSize < 12 || fileSize == INVALID_FILE_SIZE) - fileSize = 0; - - CloseHandle(hFile); - } - - m_spaceIndicatorSaves.addSave(fileSize); -#elif defined(__ORBIS__) - m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].blocksUsed * (32 * 1024)); -#endif -#ifdef _DURANGO - m_buttonListSaves.addItem(m_pSaveDetails->SaveInfoA[i].UTF16SaveTitle, L""); - - m_saveDetails[i].saveId = i; - memcpy(m_saveDetails[i].UTF16SaveName, m_pSaveDetails->SaveInfoA[i].UTF16SaveTitle, 128); - memcpy(m_saveDetails[i].UTF16SaveFilename, m_pSaveDetails->SaveInfoA[i].UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH); -#else -#ifdef _WINDOWS64 - { - wstring levelName = ReadLevelNameFromSaveFile(filePath); - - if (!levelName.empty()) - { - m_buttonListSaves.addItem(levelName, wstring(L"")); - wcstombs_s(nullptr, m_saveDetails[i].UTF8SaveName, 127, levelName.c_str(), _TRUNCATE); - m_saveDetails[i].UTF8SaveName[127] = '\0'; - } - else - { - m_buttonListSaves.addItem(m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveTitle, L""); - memcpy(m_saveDetails[i].UTF8SaveName, m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveTitle, 128); - } - m_saveDetails[i].saveId = origIdx; - memcpy(m_saveDetails[i].UTF8SaveFilename, m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH); - } -#else - m_buttonListSaves.addItem(m_pSaveDetails->SaveInfoA[i].UTF8SaveTitle, L""); - memcpy(m_saveDetails[i].UTF8SaveName, m_pSaveDetails->SaveInfoA[i].UTF8SaveTitle, 128); - m_saveDetails[i].saveId = i; - memcpy(m_saveDetails[i].UTF8SaveFilename, m_pSaveDetails->SaveInfoA[i].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH); -#endif -#endif - } -#ifdef _WINDOWS64 - delete[] sortedIdx; -#endif - m_controlSavesTimer.setVisible(false); - updateTooltips(); - // set focus on the first button - } - } - - if (!m_bExitScene && m_bSavesDisplayed && !m_bRetrievingSaveThumbnails && !m_bAllLoaded) - { - if (m_iRequestingThumbnailId < m_buttonListSaves.getItemCount()) - { - m_bRetrievingSaveThumbnails = true; - app.DebugPrintf("Requesting the first thumbnail\n"); - // set the save to load - PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); -#ifdef _WINDOWS64 - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[m_saveDetails[m_iRequestingThumbnailId].saveId],&LoadSaveDataThumbnailReturned,this); -#else - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturned,this); -#endif - - if (eLoadStatus != C4JStorage::ESaveGame_GetSaveThumbnail) - { - // something went wrong - m_bRetrievingSaveThumbnails = false; - m_bAllLoaded = true; - } - } - } - - else if (m_bSavesDisplayed && m_bSaveThumbnailReady) - { - m_bSaveThumbnailReady = false; - - // check we're not waiting to exit the scene - if (!m_bExitScene) - { - // convert to utf16 - uint16_t u16Message[MAX_SAVEFILENAME_LENGTH]; -#ifdef _DURANGO - - // Already utf16 on durango - memcpy(u16Message, m_saveDetails[m_iRequestingThumbnailId].UTF16SaveFilename, MAX_SAVEFILENAME_LENGTH); -#elif defined(_WINDOWS64) - int result = ::MultiByteToWideChar( - CP_UTF8, // convert from UTF-8 - MB_ERR_INVALID_CHARS, // error on invalid chars - m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename, // source UTF-8 string - MAX_SAVEFILENAME_LENGTH, // total length of source UTF-8 string, - // in CHAR's (= bytes), including end-of-string \0 - (wchar_t *)u16Message, // destination buffer - MAX_SAVEFILENAME_LENGTH // size of destination buffer, in WCHAR's - ); -#else -#ifdef __PS3 - size_t srcmax, dstmax; -#else - uint32_t srcmax, dstmax; - uint32_t srclen, dstlen; -#endif - srcmax = MAX_SAVEFILENAME_LENGTH; - dstmax = MAX_SAVEFILENAME_LENGTH; -#if defined(__PS3__) - - L10nResult lres = UTF8stoUTF16s((uint8_t*)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename, - &srcmax, u16Message, &dstmax); -#else - - SceCesUcsContext context; - - sceCesUcsContextInit(&context); - - sceCesUtf8StrToUtf16Str(&context, (uint8_t*)m_saveDetails[m_iRequestingThumbnailId].UTF8SaveFilename, - srcmax, &srclen, u16Message, dstmax, &dstlen); - -#endif -#endif - if (m_saveDetails[m_iRequestingThumbnailId].pbThumbnailData) - { - registerSubstitutionTexture((wchar_t *)u16Message,m_saveDetails[m_iRequestingThumbnailId].pbThumbnailData,m_saveDetails[m_iRequestingThumbnailId].dwThumbnailSize); - } - - m_buttonListSaves.setTextureName(m_iRequestingThumbnailId, (wchar_t*)u16Message); - - ++m_iRequestingThumbnailId; - if (m_iRequestingThumbnailId < m_buttonListSaves.getItemCount()) - { - app.DebugPrintf("Requesting another thumbnail\n"); - // set the save to load - PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); -#ifdef _WINDOWS64 - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[m_saveDetails[m_iRequestingThumbnailId].saveId],&LoadSaveDataThumbnailReturned,this); -#else - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iRequestingThumbnailId],&LoadSaveDataThumbnailReturned,this); -#endif - - if (eLoadStatus != C4JStorage::ESaveGame_GetSaveThumbnail) - { - // something went wrong - m_bRetrievingSaveThumbnails = false; - m_bAllLoaded = true; - } - } - else - { - m_bRetrievingSaveThumbnails = false; - m_bAllLoaded = true; - } - } - else - { - // stop retrieving thumbnails, and exit - m_bRetrievingSaveThumbnails = false; - } - } - } - - switch (m_iState) - - { - case e_SavesIdle: - - break; - - case e_SavesRepopulate: - - m_bIgnoreInput = false; - - m_iState = e_SavesIdle; - - m_bAllLoaded = false; - - m_bRetrievingSaveThumbnails = false; - - m_iRequestingThumbnailId = 0; - - GetSaveInfo(); - - break; - - case e_SavesRepopulateAfterMashupHide: - - m_bIgnoreInput = false; - - m_iRequestingThumbnailId = 0; - - m_bAllLoaded = false; - - m_bRetrievingSaveThumbnails = false; - - m_bSavesDisplayed = false; - - m_iSaveInfoC = 0; - - m_buttonListSaves.clearList(); - - GetSaveInfo(); - - m_iState = e_SavesIdle; - - break; - - case e_SavesRepopulateAfterDelete: - - case e_SavesRepopulateAfterTransferDownload: - - m_bIgnoreInput = false; - - m_iRequestingThumbnailId = 0; - - m_bAllLoaded = false; - - m_bRetrievingSaveThumbnails = false; - - m_bSavesDisplayed = false; - - m_iSaveInfoC = 0; - - m_buttonListSaves.clearList(); - - StorageManager.ClearSavesInfo(); - - GetSaveInfo(); - - m_iState = e_SavesIdle; - - break; - } - -#else - - if (!m_bSavesDisplayed) - - { - AddDefaultButtons(); - - m_bSavesDisplayed = true; - - m_controlSavesTimer.setVisible(false); - } - -#endif - -#ifdef _XBOX_ONE - - if (g_NetworkManager.ShouldMessageForFullSession()) - - { - UINT uiIDA[1]; - - uiIDA[0] = IDS_CONFIRM_OK; - - ui.RequestErrorMessage(IDS_CONNECTION_FAILED, IDS_IN_PARTY_SESSION_FULL, uiIDA, 1, - ProfileManager.GetPrimaryPad()); - } - -#endif - - // SAVE TRANSFERS - -#ifdef __ORBIS__ - - // check the status of the PSPlus common dialog - - switch (sceNpCommerceDialogUpdateStatus()) - - { - case SCE_COMMON_DIALOG_STATUS_FINISHED: - { - SceNpCommerceDialogResult Result; - - sceNpCommerceDialogGetResult(&Result); - - sceNpCommerceDialogTerminate(); - - if (Result.authorized) - - { - // they just became a PSPlus member - - ProfileManager.PsPlusUpdate(ProfileManager.GetPrimaryPad(), &Result); - } - - else {} - - // 4J-JEV: Fix for PS4 #5148 - [ONLINE] If the user attempts to join a game when they do not have Playstation Plus, the title will lose all functionality. - - m_bIgnoreInput = false; - } - - break; - - default: - - break; - } - -#endif -} - -void UIScene_LoadCreateJoinMenu::GetSaveInfo() - -{ - unsigned int uiSaveC = 0; - - // This will return with the number retrieved in uiSaveC - - if (app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) - - { -#ifdef __ORBIS__ - - // We need to make sure this is non-null so that we have an idea of free space - - m_pSaveDetails = StorageManager.ReturnSavesInfo(); - - if (m_pSaveDetails == nullptr) - - { - C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo(m_iPad, nullptr, this, "save"); - } - -#endif - - uiSaveC = 0; - -#ifdef _XBOX - - File savesDir(L"GAME:\\Saves"); - -#else - - File savesDir(L"Saves"); - -#endif - - if (savesDir.exists()) - - { - m_saves = savesDir.listFiles(); - - uiSaveC = static_cast(m_saves->size()); - } - - // add the New Game and Tutorial after the saves list is retrieved, if there are any saves - - // Add two for New Game and Tutorial - - unsigned int listItems = uiSaveC; - - AddDefaultButtons(); - - for (unsigned int i = 0; i < listItems; i++) - - { - wstring wName = m_saves->at(i)->getName(); - - auto name = new wchar_t[wName.size() + 1]; - - for (unsigned int j = 0; j < wName.size(); ++j) - - name[j] = wName[j]; - - name[wName.size()] = 0; - - m_buttonListSaves.addItem(name, L""); - } - - m_bSavesDisplayed = true; - - m_bAllLoaded = true; - - m_bIgnoreInput = false; - } - - else - - { - // clear the saves list - - m_bSavesDisplayed = false; // we're blocking the exit from this scene until complete - - m_buttonListSaves.clearList(); - - m_iSaveInfoC = 0; - - m_controlSavesTimer.setVisible(true); - - m_pSaveDetails = StorageManager.ReturnSavesInfo(); - - if (m_pSaveDetails == nullptr) - - { - char savename[] = "save"; - C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo(m_iPad, nullptr, this, savename); - } - -#if TO_BE_IMPLEMENTED - - if (eSGIStatus == C4JStorage::ESGIStatus_NoSaves) - - { - uiSaveC = 0; - - m_controlSavesTimer.setVisible(false); - - m_SavesList.SetEnable(TRUE); - } - -#endif - } -} - - -void UIScene_LoadCreateJoinMenu::UpdateGamesList() - -{ - // If we're ignoring input scene isn't active so do nothing - - if (m_bIgnoreInput) - return; - - // If a texture pack is loading, or will be loading, then ignore this ( we are going to be destroyed anyway) - - if (Minecraft::GetInstance()->skins->getSelected()->isLoadingData() || (Minecraft::GetInstance()->skins-> - needsUIUpdate() || ui.IsReloadingSkin())) - return; - - // if we're retrieving save info, don't show the list yet as we will be ignoring press events - - if (!m_bSavesDisplayed) - - return; - - m_controlJoinTimer.setVisible(false); - - // if the saves list has focus, then we should show the Delete Save tooltip - - // if the games list has focus, then we should show the View Gamercard tooltip - - int iRB = -1; - - int iY = -1; - - int iX = -1; - - vector* newSessions = g_NetworkManager.GetSessionList(m_iPad, 1, m_bShowingPartyGamesOnly); - - if (m_currentSessions != nullptr && m_currentSessions->size() == newSessions->size()) - - { - bool same = true; - - for (size_t i = 0; i < newSessions->size(); i++) - - if (memcmp(&(*m_currentSessions)[i]->sessionId, &(*newSessions)[i]->sessionId, sizeof(SessionID)) != 0 || - - wcscmp((*m_currentSessions)[i]->displayLabel ? (*m_currentSessions)[i]->displayLabel : L"", - - (*newSessions)[i]->displayLabel ? (*newSessions)[i]->displayLabel : L"") != 0) - - { - same = false; - - break; - } - - if (same) - - { - for (auto& it : *newSessions) - - delete it; - - delete newSessions; - - return; - } - } - - if (m_currentSessions) - - { - for (auto& it : *m_currentSessions) - - delete it; - - delete m_currentSessions; - } - - m_currentSessions = newSessions; - - unsigned int filteredListSize = static_cast(m_currentSessions->size()); - - BOOL gamesListHasFocus = DoesGamesListHaveFocus(); - - if (filteredListSize > 0) - - { -#if TO_BE_IMPLEMENTED - - if (!m_pGamesList->IsEnabled()) - - { - m_pGamesList->SetEnable(TRUE); - - m_pGamesList->SetCurSel(0); - } - -#endif - - m_bHasNoGamesLabel = false; - - m_controlJoinTimer.setVisible(false); - } - - else - - { -#if TO_BE_IMPLEMENTED - - m_pGamesList->SetEnable(FALSE); - -#endif - - m_controlJoinTimer.setVisible(false); - -#if TO_BE_IMPLEMENTED - - if (gamesListHasFocus) - m_pGamesList->InitFocus(m_iPad); - -#endif - } - - if (m_activeTab == eTab_Join) - { - RebuildJoinGamesListVisual(true); - m_bPendingJoinVisualRefresh = false; - } - else - m_bPendingJoinVisualRefresh = true; - - updateTooltips(); - - m_bPendingJoinTabAvailabilityRefresh = true; -} - -void UIScene_LoadCreateJoinMenu::AddDefaultButtons() - -{ - // hidden pack entries need a full rebuild or the list can duplicate - // create list uses its own index path do not reuse load index here - // keep all mashup worlds available in create on legacy evolved - app.EnableMashupPackWorlds(m_iPad); - - m_iDefaultButtonsC = 0; - - m_iMashUpButtonsC = 0; - - m_iNewGameListIndex = 0; - - m_buttonListNewGames.clearList(); - - m_generators.clear(); - - m_buttonListNewGames.addItem(app.GetString(IDS_CREATE_NEW_WORLD)); - -#ifdef _WINDOWS64 - TrySetButtonListIcon( - m_buttonListNewGames, - m_buttonListNewGames.getItemCount() - 1, - L"CreateWorldIcon.png", - L"CreateWorldIcon"); -#endif - - m_iDefaultButtonsC++; - - int i = 0; - - for (LevelGenerationOptions* levelGen : *app.getLevelGenerators()) - - { - // retrieve the save icon from the texture pack, if there is one - - unsigned int uiTexturePackID = levelGen->getRequiredTexturePackId(); - - if (uiTexturePackID != 0) - - { - unsigned int uiMashUpWorldsBitmask = app.GetMashupPackWorlds(m_iPad); - - if ((uiMashUpWorldsBitmask & (1 << (uiTexturePackID - 1024))) == 0) - - // this world is hidden, so skip - - continue; - } - - // 4J-JEV: For debug. Ignore worlds with no name. - - LPCWSTR wstr = levelGen->getWorldName(); - - m_buttonListNewGames.addItem(wstr); - - m_generators.push_back(levelGen); - -#ifdef _WINDOWS64 - if (levelGen->isTutorial()) - TrySetButtonListIcon( - m_buttonListNewGames, - m_buttonListNewGames.getItemCount() - 1, - L"TutorialIcon.png", - L"TutorialIcon"); -#endif - - if (uiTexturePackID != 0) - - { - // increment the count of the mash-up pack worlds in the save list - - m_iMashUpButtonsC++; - - TexturePack* tp = Minecraft::GetInstance()->skins->getTexturePackById(levelGen->getRequiredTexturePackId()); - - DWORD dwImageBytes; - - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); - - if (dwImageBytes > 0 && pbImageData) - - { - wchar_t imageName[64]; - const int slotIndex = m_buttonListNewGames.getItemCount() - 1; - - swprintf(imageName, 64, L"tpack_small_slot%08x", slotIndex); - - registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); - - m_buttonListNewGames.setTextureName(m_buttonListNewGames.getItemCount() - 1, imageName); - } - } - - ++i; - } - - m_iDefaultButtonsC += i; -} - - -bool UIScene_LoadCreateJoinMenu::DoesSavesListHaveFocus() - -{ - return (m_activeTab == eTab_Load) && m_buttonListSaves.hasFocus(); -} - - -bool UIScene_LoadCreateJoinMenu::DoesMashUpWorldHaveFocus() - -{ - if (!m_buttonListNewGames.hasFocus()) - - return false; - - const int lGenID = m_iNewGameListIndex - m_iDefaultButtonsC; - - if (lGenID < 0 || lGenID >= static_cast(m_generators.size())) - - return false; - - LevelGenerationOptions* levelGen = m_generators.at(lGenID); - - return levelGen && !levelGen->isTutorial() && levelGen->requiresTexturePack(); -} - - -bool UIScene_LoadCreateJoinMenu::DoesGamesListHaveFocus() - -{ - return (m_activeTab == eTab_Join) && m_buttonListGames.hasFocus(); -} - - -bool UIScene_LoadCreateJoinMenu::DoesNewGamesListHaveFocus() - -{ - return (m_activeTab == eTab_Create) && m_buttonListNewGames.hasFocus(); -} - -int UIScene_LoadCreateJoinMenu::GetMovieTabFromFocus() - -{ - if (DoesGamesListHaveFocus()) - - return 2; - - if (m_buttonListNewGames.hasFocus()) - - return 1; - - if (m_buttonListSaves.hasFocus()) - - return 0; - - return 0; -} - -void UIScene_LoadCreateJoinMenu::SyncMovieTab() - -{ - SetMovieTab(GetMovieTabFromFocus()); -} - -void UIScene_LoadCreateJoinMenu::SetMovieTab(int tab) - -{ - if (getMovie() == nullptr) - - return; - - IggyDataValue result; - - IggyDataValue value[1]; - - value[0].type = IGGY_DATATYPE_number; - - value[0].number = static_cast(tab); - - IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetActiveTab, 1, value); -} - -void UIScene_LoadCreateJoinMenu::SetActiveTab(ELoadCreateJoinTab tab, bool setFocus) - -{ - const bool enteringJoin = (m_activeTab != eTab_Join) && (tab == eTab_Join); - m_activeTab = tab; - - if (m_activeTab == eTab_Join && !m_bRebuildingJoinVisual && (enteringJoin || m_bPendingJoinVisualRefresh)) - { - RebuildJoinGamesListVisual(true); - m_bPendingJoinVisualRefresh = false; - } - - SetMovieTab(tab); - - ApplyTabVisibility(setFocus); -} - - -void UIScene_LoadCreateJoinMenu::ApplyTabVisibility(bool setFocus) - -{ - // keep load create and join logic split here or focus gets weird - - const bool showLoad = (m_activeTab == eTab_Load); - - const bool showCreate = (m_activeTab == eTab_Create); - - const bool showJoin = (m_activeTab == eTab_Join); - - m_controlLoadGame.setVisible(showLoad); - - m_buttonListSaves.setVisible(showLoad); - - m_controlNewGame.setVisible(showCreate); - - m_buttonListNewGames.setVisible(showCreate); - - m_controlJoinGame.setVisible(showJoin); - - m_buttonListGames.setVisible(showJoin); - - if (setFocus) - - { - if (showLoad) - - SetFocusToElement(eControl_SavesList); - - else if (showCreate) - - SetFocusToElement(eControl_NewGamesList); - - else if (showJoin) - - SetFocusToElement(eControl_GamesList); - } - - updateTooltips(); -} - - -void UIScene_LoadCreateJoinMenu::RebuildJoinGamesListVisual(bool syncFocus) - -{ - if (m_bRebuildingJoinVisual) - return; - - m_bRebuildingJoinVisual = true; - - FriendSessionInfo* pSelectedSession = nullptr; - - if (DoesGamesListHaveFocus() && m_buttonListGames.getItemCount() > 0) - { - unsigned int nIndex = m_buttonListGames.getCurrentSelection(); - -#ifdef _WINDOWS64 - if (m_currentSessions != nullptr && nIndex > 0 && (nIndex - 1) < m_currentSessions->size()) - pSelectedSession = m_currentSessions->at(nIndex - 1); -#else - - if (m_currentSessions != nullptr && nIndex < m_currentSessions->size()) - pSelectedSession = m_currentSessions->at(nIndex); -#endif - } - - SessionID selectedSessionId; - - ZeroMemory(&selectedSessionId, sizeof(SessionID)); - if (pSelectedSession != nullptr) - selectedSessionId = pSelectedSession->sessionId; - - m_buttonListGames.clearList(); - -#ifdef _WINDOWS64 - // Always add the "Add Server" button as the first entry in the games list - m_buttonListGames.addItem(wstring(L"Add Server")); - TrySetButtonListIcon( - m_buttonListGames, - m_buttonListGames.getItemCount() - 1, - L"MinecraftIcon.png", - L"MinecraftIcon"); -#endif - - if (m_currentSessions == nullptr || m_currentSessions->empty()) - { - m_buttonListGames.setCurrentSelection(0); - if (syncFocus) - m_buttonListGames.updateChildFocus(0); - m_bRebuildingJoinVisual = false; - return; - } - - unsigned int sessionIndex = 0; - - m_buttonListGames.setCurrentSelection(0); - - for (FriendSessionInfo* sessionInfo : *m_currentSessions) - { - wchar_t textureName[64] = L"\0"; - if (sessionInfo->data.texturePackParentId != 0) - { - Minecraft* pMinecraft = Minecraft::GetInstance(); - TexturePack* tp = pMinecraft->skins->getTexturePackById(sessionInfo->data.texturePackParentId); - DWORD dwImageBytes = 0; - PBYTE pbImageData = nullptr; - - if (tp == nullptr) - { - DWORD dwBytes = 0; - PBYTE pbData = nullptr; - app.GetTPD(sessionInfo->data.texturePackParentId, &pbData, &dwBytes); - app.GetFileFromTPD(eTPDFileType_Icon, pbData, dwBytes, &pbImageData, &dwImageBytes); - - if (dwImageBytes > 0 && pbImageData) - { - swprintf(textureName, 64, L"%ls", sessionInfo->displayLabel); - registerSubstitutionTexture(textureName, pbImageData, dwImageBytes); - } - } - - else - { - pbImageData = tp->getPackIcon(dwImageBytes); - if (dwImageBytes > 0 && pbImageData) - { - swprintf(textureName, 64, L"%ls", sessionInfo->displayLabel); - registerSubstitutionTexture(textureName, pbImageData, dwImageBytes); - } - } - } - - else - { - Minecraft* pMinecraft = Minecraft::GetInstance(); - TexturePack* tp = pMinecraft->skins->getTexturePackByIndex(0); - DWORD dwImageBytes; - PBYTE pbImageData = tp->getPackIcon(dwImageBytes); - if (dwImageBytes > 0 && pbImageData) - { - swprintf(textureName, 64, L"%ls", sessionInfo->displayLabel); - registerSubstitutionTexture(textureName, pbImageData, dwImageBytes); - } - } - - m_buttonListGames.addItem(sessionInfo->displayLabel, textureName); - - if (memcmp(&selectedSessionId, &sessionInfo->sessionId, sizeof(SessionID)) == 0) - { -#ifdef _WINDOWS64 - - m_buttonListGames.setCurrentSelection(sessionIndex + 1); -#else - m_buttonListGames.setCurrentSelection(sessionIndex); -#endif - } - - ++sessionIndex; - } - - if (syncFocus) - m_buttonListGames.updateChildFocus(m_buttonListGames.getCurrentSelection()); - - m_bRebuildingJoinVisual = false; -} - -void UIScene_LoadCreateJoinMenu::UpdateJoinTabAvailability() -{ - if (getMovie() == nullptr) - return; - - IggyDataValue result; - - IggyDataValue value[1]; - - value[0].type = IGGY_DATATYPE_boolean; - - value[0].boolval = false; - - IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetMatchesAvailable, 1, value); -} - -void UIScene_LoadCreateJoinMenu::UpdateSaveSizeBarVisibility() -{ - if (getMovie() == nullptr) - return; - - const bool showSaveSizeBar = (m_activeTab == eTab_Load); - - IggyDataValue result; - - IggyDataValue value[1]; - - value[0].type = IGGY_DATATYPE_boolean; - - value[0].boolval = showSaveSizeBar; - - IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcShowSaveSizeBar, 1, value); -} - -wstring UIScene_LoadCreateJoinMenu::getMoviePath() -{ - return L"LoadCreateJoinMenu"; -} - - -int UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam, bool bRes) -{ - // 4J HEG - No reason to set value if keyboard was cancelled - auto pClass = static_cast(lpParam); - - pClass->m_bIgnoreInput = false; - - if (bRes) - { - uint16_t ui16Text[128] = {}; - Win64_GetKeyboardText(ui16Text, 128); - - // check the name is valid - if (ui16Text[0] != 0) - { - int displayIdx = pClass->m_iSaveListIndex; - auto pSaveInfo = &pClass->m_pSaveDetails->SaveInfoA[pClass->m_saveDetails[displayIdx].saveId]; - StorageManager.RenameSaveData(pSaveInfo, ui16Text, &UIScene_LoadCreateJoinMenu::RenameSaveDataReturned, pClass); - } - else - { - pClass->m_bIgnoreInput = false; - pClass->updateTooltips(); - } - } - else - { - pClass->m_bIgnoreInput = false; - pClass->updateTooltips(); - } - - return 0; -} - -void UIScene_LoadCreateJoinMenu::handlePress(F64 controlId, F64 childId) -{ - switch (static_cast(controlId)) - { - case eControl_TabLoad: - - ui.PlayUISFX(eSFX_Press); - SetActiveTab(eTab_Load, true); - return; - - case eControl_TabCreate: - ui.PlayUISFX(eSFX_Press); - SetActiveTab(eTab_Create, true); - return; - - case eControl_TabJoin: - ui.PlayUISFX(eSFX_Press); - SetActiveTab(eTab_Join, true); - return; - - case eControl_NewGamesList: - { - m_bIgnoreInput = true; - - ui.PlayUISFX(eSFX_Press); - - if (static_cast(childId) == 0) - - { - app.SetTutorialMode(false); - - m_controlJoinTimer.setVisible(false); - - app.SetCorruptSaveDeleted(false); - - auto params = new CreateWorldMenuInitData(); - - params->iPad = m_iPad; - - ui.NavigateToScene(m_iPad, eUIScene_CreateWorldMenu, params); - } - - else - - { - int lGenID = static_cast(childId) - 1; - - if (lGenID < static_cast(m_generators.size())) - - { - LevelGenerationOptions* levelGen = m_generators.at(lGenID); - - app.SetTutorialMode(levelGen->isTutorial()); - - app.SetAutosaveTimerTime(); - - if (levelGen->isTutorial()) - - LoadLevelGen(levelGen); - - else - { - auto params = new LoadMenuInitData(); - - params->iPad = m_iPad; - params->iSaveGameInfoIndex = -1; - params->levelGen = levelGen; - params->saveDetails = nullptr; - - ui.NavigateToScene(m_iPad, eUIScene_LoadMenu, params); - } - } - } - } - - break; - - case eControl_SavesList: - { - m_bIgnoreInput = true; - - ui.PlayUISFX(eSFX_Press); - - int saveIndex = static_cast(childId); - - if (app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) - - LoadSaveFromDisk(m_saves->at(saveIndex)); - - else - { - auto params = new LoadMenuInitData(); - params->iPad = m_iPad; - params->iSaveGameInfoIndex = m_saveDetails[saveIndex].saveId; - params->levelGen = nullptr; - params->saveDetails = &m_saveDetails[saveIndex]; - - ui.NavigateToScene(m_iPad, eUIScene_LoadMenu, params); - } - } - - break; - - case eControl_GamesList: - { -#ifdef _WINDOWS64 - if (static_cast(childId) == ADD_SERVER_BUTTON_INDEX) - { - ui.PlayUISFX(eSFX_Press); - BeginAddServer(); - - break; - } -#endif - m_bIgnoreInput = true; - m_eAction = eAction_JoinGame; - - ui.PlayUISFX(eSFX_Press); - - int nIndex = static_cast(childId); - -#ifdef _WINDOWS64 - nIndex -= 1; -#endif - m_iGameListIndex = nIndex; - - CheckAndJoinGame(nIndex); - } - break; - } -} - -void UIScene_LoadCreateJoinMenu::LoadLevelGen(LevelGenerationOptions* levelGen) -{ - // Load data from disc - - //File saveFile( L"Tutorial\\Tutorial" ); - - //LoadSaveFromDisk(&saveFile); - - // clear out the app's terrain features list - app.ClearTerrainFeaturePosition(); - - StorageManager.ResetSaveData(); - - // Make our next save default to the name of the level - const wstring preferredSaveTitle = GetPreferredLevelGenSaveTitle(levelGen); - StorageManager.SetSaveTitle(preferredSaveTitle.empty() - ? levelGen->getDefaultSaveName().c_str() - : preferredSaveTitle.c_str()); - - bool isClientSide = false; - - bool isPrivate = false; - - // TODO int maxPlayers = MINECRAFT_NET_MAX_PLAYERS; - - int maxPlayers = 8; - - if (app.GetTutorialMode()) - { - isClientSide = false; - - maxPlayers = 4; - } - - g_NetworkManager.HostGame(0, isClientSide, isPrivate, maxPlayers, 0); - - auto param = new NetworkGameInitData(); - - param->seed = 0; - param->saveData = nullptr; - param->settings = app.GetGameHostOption(eGameHostOption_Tutorial); - param->levelGen = levelGen; - param->levelName = preferredSaveTitle; - - if (levelGen->requiresTexturePack()) - { - param->texturePackId = levelGen->getRequiredTexturePackId(); - - Minecraft* pMinecraft = Minecraft::GetInstance(); - pMinecraft->skins->selectTexturePackById(param->texturePackId); - - //pMinecraft->skins->updateUI(); - } - -#ifndef _XBOX - g_NetworkManager.FakeLocalPlayerJoined(); -#endif - - auto loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); - - auto completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground = TRUE; - completionData->bShowLogo = TRUE; - completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; - completionData->iPad = DEFAULT_XUI_MENU_USER; - - loadingParams->completionData = completionData; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); -} - -void UIScene_LoadCreateJoinMenu::LoadSaveFromDisk(File* saveFile, - ESavePlatform savePlatform /*= SAVE_FILE_PLATFORM_LOCAL*/) -{ - // we'll only be coming in here when the tutorial is loaded now - StorageManager.ResetSaveData(); - - // Make our next save default to the name of the level - StorageManager.SetSaveTitle(saveFile->getName().c_str()); - - int64_t fileSize = saveFile->length(); - FileInputStream fis(*saveFile); - - byteArray ba(static_cast(fileSize)); - - fis.read(ba); - fis.close(); - - bool isClientSide = false; - bool isPrivate = false; - - int maxPlayers = MINECRAFT_NET_MAX_PLAYERS; - - if (app.GetTutorialMode()) - { - isClientSide = false; - - maxPlayers = 4; - } - - app.SetGameHostOption(eGameHostOption_GameType, GameType::CREATIVE->getId()); - - g_NetworkManager.HostGame(0, isClientSide, isPrivate, maxPlayers, 0); - - auto saveData = new LoadSaveDataThreadParam(ba.data, ba.length, saveFile->getName()); - auto param = new NetworkGameInitData(); - - param->seed = 0; - param->saveData = saveData; - param->settings = app.GetGameHostOption(eGameHostOption_All); - param->savePlatform = savePlatform; - -#ifndef _XBOX - g_NetworkManager.FakeLocalPlayerJoined(); -#endif - - auto loadingParams = new LoadingInputParams(); - - loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = static_cast(param); - - auto completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground = TRUE; - completionData->bShowLogo = TRUE; - completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; - completionData->iPad = DEFAULT_XUI_MENU_USER; - - loadingParams->completionData = completionData; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); -} - -void UIScene_LoadCreateJoinMenu::HandleDLCMountingComplete() -{ - Initialise(); -} - -void UIScene_LoadCreateJoinMenu::CheckAndJoinGame(int gameIndex) -{ - if (m_buttonListGames.getItemCount() > 0 && gameIndex < m_currentSessions->size()) - { -#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - - // 4J-PB - is the player allowed to join games? - bool noUGC = false; - bool bContentRestricted = false; - - // we're online, since we are joining a game - - ProfileManager.GetChatAndContentRestrictions(m_iPad, true, &noUGC, &bContentRestricted, nullptr); - -#ifdef __ORBIS__ - - // 4J Stu - On PS4 we don't restrict playing multiplayer based on chat restriction, so remove this check - - noUGC = false; - - bool bPlayStationPlus = true; - - int iPadWithNoPlaystationPlus = 0; - - bool isSignedInLive = true; - - int iPadNotSignedInLive = -1; - - for (unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - - { - if (InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i)) - - { - if (isSignedInLive && !ProfileManager.IsSignedInLive(i)) - - { - // Record the first non signed in live pad - - iPadNotSignedInLive = i; - } - - isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i); - - if (ProfileManager.HasPlayStationPlus(i) == false) - - { - bPlayStationPlus = false; - - break; - } - } - } - -#endif - -#ifdef __PSVITA__ - - if (CGameNetworkManager::usingAdhocMode()) - - { - bContentRestricted = false; - - noUGC = false; - } - -#endif - - if (noUGC) - - { - - - - // not allowed to join - -#ifndef __PSVITA__ - - UINT uiIDA[1]; - - uiIDA[0] = IDS_CONFIRM_OK; - - // Not allowed to play online - - ui.RequestAlertMessage(IDS_ONLINE_GAME, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, m_iPad, nullptr, this); - -#else - - // Not allowed to play online - - ProfileManager.ShowSystemMessage(SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, 0); - -#endif - - m_bIgnoreInput = false; - - return; - - } - - else if (bContentRestricted) - - { - ui.RequestContentRestrictedMessageBox(); - - m_bIgnoreInput = false; - - return; - } - -#ifdef __ORBIS__ - - // If this is an online game but not all players are signed in to Live, stop! - - else if (!isSignedInLive) - - { - UINT uiIDA[1]; - - uiIDA[0] = IDS_CONFIRM_OK; - - // Check if PSN is unavailable because of age restriction - - int npAvailability = ProfileManager.getNPAvailability(iPadNotSignedInLive); - - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - - { - m_bIgnoreInput = false; - - // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK - - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, - iPadNotSignedInLive); - } - - else - - { - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPadNotSignedInLive, - &UIScene_LoadCreateJoinMenu::MustSignInReturnedPSN, this); - } - - return; - } - - else if (bPlayStationPlus == false) - - { - if (ProfileManager.RequestingPlaystationPlus(iPadWithNoPlaystationPlus)) - - { - // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). - - UINT uiIDA[1]; - - uiIDA[0] = IDS_OK; - - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, - ProfileManager.GetPrimaryPad(), nullptr, nullptr); - - return; - } - - // PS Plus upsell - - // 4J-PB - we're not allowed to show the text Playstation Plus - have to call the upsell all the time! - - // upsell psplus - - int32_t iResult = sceNpCommerceDialogInitialize(); - - SceNpCommerceDialogParam param; - - sceNpCommerceDialogParamInitialize(¶m); - - param.mode = SCE_NP_COMMERCE_DIALOG_MODE_PLUS; - - param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; - - param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus); - - iResult = sceNpCommerceDialogOpen(¶m); - - // UINT uiIDA[2]; - - // uiIDA[0]=IDS_CONFIRM_OK; - - // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; - - // ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadCreateJoinMenu::PSPlusReturned,this, app.GetStringTable(),nullptr,0,false); - - m_bIgnoreInput = false; - - return; - } - -#endif - -#endif - - m_initData->iPad = 0; - - m_initData->selectedSession = m_currentSessions->at(gameIndex); - -#ifdef _WINDOWS64 - - { - int serverDbCount = 0; - - FILE* dbFile = fopen("servers.db", "rb"); - - if (dbFile) - - { - char magic[4] = {}; - - if (fread(magic, 1, 4, dbFile) == 4 && memcmp(magic, "MCSV", 4) == 0) - - { - uint32_t version = 0, count = 0; - - fread(&version, sizeof(uint32_t), 1, dbFile); - - fread(&count, sizeof(uint32_t), 1, dbFile); - - if (version == 1) - - serverDbCount = static_cast(count); - } - - fclose(dbFile); - } - - int lanCount = static_cast(m_currentSessions->size()) - serverDbCount; - - if (gameIndex >= lanCount && lanCount >= 0) - - m_initData->serverIndex = gameIndex - lanCount; - - else - - m_initData->serverIndex = -1; - } - -#endif - - if (m_initData->selectedSession->data.texturePackParentId != 0) - - { - int texturePacksCount = Minecraft::GetInstance()->skins->getTexturePackCount(); - - bool bHasTexturePackInstalled = false; - - for (int i = 0; i < texturePacksCount; i++) - - { - TexturePack* tp = Minecraft::GetInstance()->skins->getTexturePackByIndex(i); - - if (tp->getDLCParentPackId() == m_initData->selectedSession->data.texturePackParentId) - - { - bHasTexturePackInstalled = true; - - break; - } - } - - if (bHasTexturePackInstalled == false) - - { -#ifdef _XBOX - - ULONGLONG ullOfferID_Full; - - app.GetDLCFullOfferIDForPackID(m_initData->selectedSession->data.texturePackParentId, &ullOfferID_Full); - - TelemetryManager-> - RecordUpsellPresented(m_iPad, eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); - -#endif - - UINT uiIDA[2]; - - uiIDA[0] = IDS_TEXTUREPACK_FULLVERSION; - - //uiIDA[1]=IDS_TEXTURE_PACK_TRIALVERSION; - - uiIDA[1] = IDS_CONFIRM_CANCEL; - - ui.RequestAlertMessage( - IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, m_iPad, - &UIScene_LoadCreateJoinMenu::TexturePackDialogReturned, this); - - return; - } - -#ifdef __PSVITA__ - - if (CGameNetworkManager::usingAdhocMode() && !SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) - - { - // not connected to adhoc anymore, must have connected back to PSN to buy texture pack so sign in again - - SQRNetworkManager_AdHoc_Vita::AttemptAdhocSignIn(&UIScene_LoadCreateJoinMenu::SignInAdhocReturned, - this); - - return; - } - -#endif - } - - m_controlJoinTimer.setVisible(false); - -#ifdef _XBOX - - XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); - -#endif - - m_bIgnoreInput = true; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_JoinMenu, m_initData); - } -} - - -#ifdef SONY_REMOTE_STORAGE_DOWNLOAD - -void UIScene_LoadCreateJoinMenu::LoadSaveFromCloud() - -{ - wchar_t wFileName[128]; - - mbstowcs(wFileName, app.getRemoteStorage()->getLocalFilename(), - strlen(app.getRemoteStorage()->getLocalFilename()) + 1); // plus null - - File cloudFile(wFileName); - - StorageManager.ResetSaveData(); - - // Make our next save default to the name of the level - - wchar_t wSaveName[128]; - - mbstowcs(wSaveName, app.getRemoteStorage()->getSaveNameUTF8(), - strlen(app.getRemoteStorage()->getSaveNameUTF8()) + 1); // plus null - - StorageManager.SetSaveTitle(wSaveName); - - int64_t fileSize = cloudFile.length(); - - FileInputStream fis(cloudFile); - - byteArray ba(fileSize); - - fis.read(ba); - - fis.close(); - - bool isClientSide = false; - - bool isPrivate = false; - - int maxPlayers = MINECRAFT_NET_MAX_PLAYERS; - - if (app.GetTutorialMode()) - - { - isClientSide = false; - - maxPlayers = 4; - } - - app.SetGameHostOption(eGameHostOption_All, app.getRemoteStorage()->getSaveHostOptions()); - - g_NetworkManager.HostGame(0, isClientSide, isPrivate, maxPlayers, 0); - - LoadSaveDataThreadParam* saveData = new LoadSaveDataThreadParam(ba.data, ba.length, cloudFile.getName()); - - NetworkGameInitData* param = new NetworkGameInitData(); - - param->seed = app.getRemoteStorage()->getSaveSeed(); - - param->saveData = saveData; - - param->settings = app.GetGameHostOption(eGameHostOption_All); - - param->savePlatform = app.getRemoteStorage()->getSavePlatform(); - - param->texturePackId = app.getRemoteStorage()->getSaveTexturePack(); - - -#ifndef _XBOX - -g_NetworkManager.FakeLocalPlayerJoined(); - -#endif - - -LoadingInputParams* loadingParams = new LoadingInputParams(); - -loadingParams->func=&CGameNetworkManager::RunNetworkGameThreadProc; - -loadingParams->lpParam= (LPVOID)param; - - -UIFullscreenProgressCompletionData* completionData = new UIFullscreenProgressCompletionData(); - -completionData->bShowBackground=TRUE; - -completionData->bShowLogo=TRUE; - -completionData->type= e_ProgressCompletion_CloseAllPlayersUIScenes; - -completionData->iPad= DEFAULT_XUI_MENU_USER; - -loadingParams->completionData= completionData; - - -ui.NavigateToScene (ProfileManager.GetPrimaryPad(), eUIScene_FullscreenProgress, loadingParams); - -} - - -#endif //SONY_REMOTE_STORAGE_DOWNLOAD - -int UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - auto* pClass = static_cast(pParam); - // results switched for this dialog - - if(result==C4JStorage::EMessage_ResultDecline) - { - if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) - pClass->m_bIgnoreInput=false; - else - { - int displayIdx = pClass->m_iSaveListIndex; - - if (pClass->m_saveDetails && displayIdx >= 0 && pClass->m_saveDetails[displayIdx].UTF8SaveFilename[0]) - { - auto pSaveInfo = &pClass->m_pSaveDetails->SaveInfoA[pClass->m_saveDetails[displayIdx].saveId]; - StorageManager.DeleteSaveData(pSaveInfo, &UIScene_LoadCreateJoinMenu::DeleteSaveDataReturned, (LPVOID)pClass->GetCallbackUniqueId()); - } - - pClass->m_controlSavesTimer.setVisible( true ); - } - } - else - pClass->m_bIgnoreInput=false; - - return 0; -} - -int UIScene_LoadCreateJoinMenu::DeleteSaveDataReturned(LPVOID lpParam, bool bRes) -{ - ui.EnterCallbackIdCriticalSection(); - - auto pClass = static_cast(ui.GetSceneFromCallbackId((size_t)lpParam)); - if (pClass) - { - if (bRes) - - // wipe the list and repopulate it - pClass->m_iState = e_SavesRepopulateAfterDelete; - else - pClass->m_bIgnoreInput = false; - - pClass->updateTooltips(); - } - - ui.LeaveCallbackIdCriticalSection(); - - return 0; -} - -int UIScene_LoadCreateJoinMenu::RenameSaveDataReturned(LPVOID lpParam, bool bRes) -{ - auto pClass = static_cast(lpParam); - - if (bRes) - pClass->m_iState = e_SavesRepopulate; - else - pClass->m_bIgnoreInput = false; - - pClass->updateTooltips(); - - return 0; -} - -#ifdef __ORBIS__ -void UIScene_LoadCreateJoinMenu::LoadRemoteFileFromDisk(char* remoteFilename) -{ - wchar_t wSaveName[128]; - mbstowcs(wSaveName, remoteFilename, strlen(remoteFilename)+1); // plus null - - // processConsoleSave(wSaveName, L"ProcessedSave.bin"); - - // File remoteFile(L"ProcessedSave.bin"); - File remoteFile(wSaveName); - LoadSaveFromDisk(&remoteFile, SAVE_FILE_PLATFORM_PS3); -} -#endif - -int UIScene_LoadCreateJoinMenu::SaveOptionsDialogReturned(void* pParam, int iPad, C4JStorage::EMessageResult result) - -{ - auto pClass = static_cast(pParam); - - // results switched for this dialog - - // EMessage_ResultAccept means cancel - - switch (result) - - { - case C4JStorage::EMessage_ResultDecline: // rename - - { - pClass->m_bIgnoreInput = true; - -#ifdef _WINDOWS64 - - { - wchar_t wSaveName[128]; - - ZeroMemory(wSaveName, 128 * sizeof(wchar_t)); - - mbstowcs_s(nullptr, wSaveName, 128, pClass->m_saveDetails[pClass->m_iSaveListIndex].UTF8SaveName, - _TRUNCATE); - - UIKeyboardInitData kbData; - - kbData.title = app.GetString(IDS_RENAME_WORLD_TITLE); - - kbData.defaultText = wSaveName; - - kbData.maxChars = 25; - - kbData.callback = &UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback; - - kbData.lpParam = pClass; - - kbData.pcMode = g_KBMInput.IsKBMActive(); - - ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData); - } - -#elif defined _DURANGO - - // bring up a keyboard - - InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE), - (pClass->m_saveDetails[pClass->m_iSaveListIndex]).UTF16SaveName, (DWORD)0, 25, - &UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback, pClass, - C_4JInput::EKeyboardMode_Default); - -#else - - // bring up a keyboard - - wchar_t wSaveName[128]; - - //CD - Fix - We must memset the SaveName - - ZeroMemory(wSaveName, 128 * sizeof(wchar_t)); - - mbstowcs(wSaveName, pClass->m_saveDetails[pClass->m_iSaveListIndex].UTF8SaveName, - strlen(pClass->m_saveDetails->UTF8SaveName) + 1); // plus null - - LPWSTR ptr = wSaveName; - - InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE), wSaveName, (DWORD)0, 25, - &UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback, pClass, - C_4JInput::EKeyboardMode_Default); - -#endif - } - - break; - - case C4JStorage::EMessage_ResultThirdOption: // delete - - - { - // delete the save game - - // Have to ask the player if they are sure they want to delete this game - - UINT uiIDA[2]; - - uiIDA[0] = IDS_CONFIRM_CANCEL; - - uiIDA[1] = IDS_CONFIRM_OK; - - ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad, - &UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned, pClass); - } - - break; - -#ifdef SONY_REMOTE_STORAGE_UPLOAD - - case C4JStorage::EMessage_ResultFourthOption: // upload to cloud - - { - UINT uiIDA[2]; - - uiIDA[0] = IDS_CONFIRM_OK; - - uiIDA[1] = IDS_CONFIRM_CANCEL; - - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_TEXT, uiIDA, 2, iPad, - &UIScene_LoadCreateJoinMenu::SaveTransferDialogReturned, pClass); - } - - break; - -#endif // SONY_REMOTE_STORAGE_UPLOAD - -#if defined _XBOX_ONE || defined __ORBIS__ - - case C4JStorage::EMessage_ResultFourthOption: // copy save - - { - UINT uiIDA[2]; - - uiIDA[0] = IDS_CONFIRM_OK; - - uiIDA[1] = IDS_CONFIRM_CANCEL; - - ui.RequestAlertMessage(IDS_COPYSAVE, IDS_TEXT_COPY_SAVE, uiIDA, 2, iPad, - &UIScene_LoadCreateJoinMenu::CopySaveDialogReturned, pClass); - } - - break; - -#endif - - case C4JStorage::EMessage_Cancelled: - - default: - { - // reset the tooltips - - pClass->updateTooltips(); - - pClass->m_bIgnoreInput = false; - } - - break; - } - - return 0; -} - - -#if defined (__PSVITA__) - - -int UIScene_LoadCreateJoinMenu::SignInAdhocReturned(void* pParam, bool bContinue, int iPad) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - - pClass->m_bIgnoreInput = false; - - return 0; -} - - -int UIScene_LoadCreateJoinMenu::MustSignInTexturePack(void* pParam, int iPad, C4JStorage::EMessageResult result) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - - if (result == C4JStorage::EMessage_ResultAccept) - - { - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadCreateJoinMenu::MustSignInReturnedTexturePack, pClass); - } - - else - - { - pClass->m_bIgnoreInput = false; - } - - return 0; -} - - -int UIScene_LoadCreateJoinMenu::MustSignInReturnedTexturePack(void* pParam, bool bContinue, int iPad) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - - int commerceState = app.GetCommerceState(); - - while (commerceState != CConsoleMinecraftApp::eCommerce_State_Offline && - - commerceState != CConsoleMinecraftApp::eCommerce_State_Online && - - commerceState != CConsoleMinecraftApp::eCommerce_State_Error) - - { - Sleep(10); - - commerceState = app.GetCommerceState(); - } - - if (bContinue == true) - - { - SONYDLC* pSONYDLCInfo = app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); - - if (pSONYDLCInfo != nullptr) - - { - char chName[42]; - - char chKeyName[20]; - - char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; - - memset(chSkuID, 0, SCE_NP_COMMERCE2_SKU_ID_LEN); - - // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. - - // So we assume the first sku for the product is the one we want - - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char - - memset(chKeyName, 0, sizeof(chKeyName)); - - strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); - - -#ifdef __ORBIS__ - -strcpy(chName, chKeyName); - -#else - -sprintf(chName, "%s-%s", app.GetCommerceCategory(), chKeyName); - -#endif - -app.GetDLCSkuIDFromProductList(chName, chSkuID); - -// 4J-PB - need to check for an empty store - - if(app.CheckForEmptyStore (iPad)==false) - - { - - if(app.DLCAlreadyPurchased(chSkuID)) - - { - - app.DownloadAlreadyPurchased(chSkuID); - - } - - else - - { - - app.Checkout(chSkuID); - - } - - } - - } - - } - -pClass->m_bIgnoreInput=false; - - return 0; - -} - - -#endif - - -int UIScene_LoadCreateJoinMenu::TexturePackDialogReturned(void* pParam, int iPad, C4JStorage::EMessageResult result) - -{ - auto pClass = static_cast(pParam); - - // Exit with or without saving - - if (result == C4JStorage::EMessage_ResultAccept) - - { - // we need to enable background downloading for the DLC - - XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); - -#if defined __PSVITA__ || defined __PS3__ || defined __ORBIS__ - -#ifdef __PSVITA__ - - if (!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && CGameNetworkManager::usingAdhocMode()) - - { - // get them to sign in to online - - UINT uiIDA[2]; - - uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - - uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; - - ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 2, - ProfileManager.GetPrimaryPad(), &UIScene_LoadCreateJoinMenu::MustSignInTexturePack, - pClass); - - return; - } - -#endif - - SONYDLC* pSONYDLCInfo = app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); - - if (pSONYDLCInfo != nullptr) - - { - char chName[42]; - - char chKeyName[20]; - - char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; - - memset(chSkuID, 0, SCE_NP_COMMERCE2_SKU_ID_LEN); - - // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. - - // So we assume the first sku for the product is the one we want - - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char - - memset(chKeyName, 0, sizeof(chKeyName)); - - strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); - -#ifdef __ORBIS__ - - strcpy(chName, chKeyName); - -#else - - sprintf(chName, "%s-%s", app.GetCommerceCategory(), chKeyName); - -#endif - - app.GetDLCSkuIDFromProductList(chName, chSkuID); - - // 4J-PB - need to check for an empty store - - if (app.CheckForEmptyStore(iPad) == false) - - { - if (app.DLCAlreadyPurchased(chSkuID)) - - { - app.DownloadAlreadyPurchased(chSkuID); - } - - else - - { - app.Checkout(chSkuID); - } - } - - } - -#endif - -#if defined _XBOX_ONE - - if (ProfileManager.IsSignedIn(iPad)) - - { - if (ProfileManager.IsSignedInLive(iPad)) - - { - wstring ProductId; - - app.GetDLCFullOfferIDForPackID(pClass->m_initData->selectedSession->data.texturePackParentId, - ProductId); - - StorageManager.InstallOffer(1, (WCHAR*)ProductId.c_str(), nullptr, nullptr); - } - - else - - { - // 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no active network connection user is unable to convert from Trial to Full texture pack and is not messaged why. - - UINT uiIDA[1] = {IDS_CONFIRM_OK}; - - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); - } - } - -#endif - } - - pClass->m_bIgnoreInput = false; - - return 0; -} - - -#if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ - -int UIScene_LoadCreateJoinMenu::MustSignInReturnedPSN(void* pParam, int iPad, C4JStorage::EMessageResult result) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - - if (result == C4JStorage::EMessage_ResultAccept) - - { - - - -#if defined(__PS3__) - -SQRNetworkManager_PS3::AttemptPSNSignIn (&UIScene_LoadCreateJoinMenu::PSN_SignInReturned, pClass); - -#elif defined __PSVITA__ - -SQRNetworkManager_Vita::AttemptPSNSignIn (&UIScene_LoadCreateJoinMenu::PSN_SignInReturned, pClass); - -#else - -SQRNetworkManager_Orbis::AttemptPSNSignIn (&UIScene_LoadCreateJoinMenu::PSN_SignInReturned, pClass, false, iPad); - -#endif - -} - - else - - { - - pClass->m_bIgnoreInput = false; - - } - - - - return 0; - -} - - - -int UIScene_LoadCreateJoinMenu::PSN_SignInReturned(void* pParam, bool bContinue, int iPad) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - - if (bContinue == true) - - { - switch (pClass->m_eAction) - - { - case eAction_ViewInvites: - - // Check if we're signed in to LIVE - - if (ProfileManager.IsSignedInLive(iPad)) - - { - - - -#if defined(__PS3__) - -int ret = sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, - SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, - SYS_MEMORY_CONTAINER_ID_INVALID); - -app.DebugPrintf ("sceNpBasicRecvMessageCustom return %d ( %08x )\n", ret, ret); - -#elif defined __PSVITA__ - -SQRNetworkManager_Vita::RecvInviteGUI(); - -#else - -SQRNetworkManager_Orbis::RecvInviteGUI(); - -#endif - -} - - break; - - case eAction_JoinGame : - - pClass->CheckAndJoinGame (pClass->m_iGameListIndex); - - break; - - } - - } - - else - - { - - pClass->m_bIgnoreInput = false; - - } - - return 0; - -} - -#endif - - -#ifdef SONY_REMOTE_STORAGE_DOWNLOAD - - -void UIScene_LoadCreateJoinMenu::LaunchSaveTransfer() - -{ - LoadingInputParams* loadingParams = new LoadingInputParams(); - - loadingParams->func = &UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc; - - loadingParams->lpParam = (LPVOID)this; - - UIFullscreenProgressCompletionData* completionData = new UIFullscreenProgressCompletionData(); - - completionData->bShowBackground = TRUE; - - completionData->bShowLogo = TRUE; - - completionData->type = e_ProgressCompletion_NavigateBackToScene; - - completionData->iPad = DEFAULT_XUI_MENU_USER; - - loadingParams->completionData = completionData; - - loadingParams->cancelFunc = &UIScene_LoadCreateJoinMenu::CancelSaveTransferCallback; - - loadingParams->m_cancelFuncParam = this; - - loadingParams->cancelText = IDS_TOOLTIPS_CANCEL; - - ui.NavigateToScene(m_iPad, eUIScene_FullscreenProgress, loadingParams); -} - -int UIScene_LoadCreateJoinMenu::CreateDummySaveDataCallback(LPVOID lpParam, bool bRes) -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)lpParam; - - if (bRes) - pClass->m_eSaveTransferState = eSaveTransfer_GetSavesInfo; - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("CreateDummySaveDataCallback failed\n"); - } - - return 0; -} - - -int UIScene_LoadCreateJoinMenu::CrossSaveGetSavesInfoCallback(LPVOID lpParam, SAVE_DETAILS* pSaveDetails, bool bRes) -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)lpParam; - - if (bRes) - pClass->m_eSaveTransferState = eSaveTransfer_GetFileData; - - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("CrossSaveGetSavesInfoCallback failed\n"); - } - - return 0; -} - -int UIScene_LoadCreateJoinMenu::LoadCrossSaveDataCallback(void* pParam, bool bIsCorrupt, bool bIsOwner) -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - - if (bIsCorrupt == false && bIsOwner) - pClass->m_eSaveTransferState = eSaveTransfer_CreatingNewSave; - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("LoadCrossSaveDataCallback failed \n"); - } - - return 0; -} - -int UIScene_LoadCreateJoinMenu::CrossSaveFinishedCallback(void* pParam, int iPad, C4JStorage::EMessageResult result) -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - pClass->m_eSaveTransferState = eSaveTransfer_Idle; - - return 0; -} - -int UIScene_LoadCreateJoinMenu::CrossSaveDeleteOnErrorReturned(LPVOID lpParam, bool bRes) -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)lpParam; - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - - return 0; -} - -int UIScene_LoadCreateJoinMenu::RemoteSaveNotFoundCallback(void* pParam, int iPad, C4JStorage::EMessageResult result) -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - pClass->m_eSaveTransferState = eSaveTransfer_Idle; - - return 0; -} - -// MGH - added this global to force the delete of the previous data, for the remote storage saves -// need to speak to Chris why this is necessary -bool g_bForceVitaSaveWipe = false; - -int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc(LPVOID lpParameter) -{ - m_bSaveTransferRunning = true; - -#ifdef __PS3__ - StorageManager.SetSaveTransferInProgress (true); -#endif - - Compression::UseDefaultThreadStorage(); - - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)lpParameter; - - pClass->m_saveTransferDownloadCancelled=false; - - m_bSaveTransferRunning=true; - - bool bAbortCalled = false; - - Minecraft* pMinecraft = Minecraft::GetInstance(); - - bool bSaveFileCreated = false; - - wchar_t wSaveName[128]; - - // get the save file size - pMinecraft->progressRenderer->progressStagePercentage (0); - pMinecraft->progressRenderer->progressStart (IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD); - pMinecraft->progressRenderer->progressStage (IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD); - - ConsoleSaveFile* pSave = nullptr; - - pClass->m_eSaveTransferState= eSaveTransfer_GetRemoteSaveInfo; - - while(pClass->m_eSaveTransferState!=eSaveTransfer_Idle) - - { - - switch(pClass->m_eSaveTransferState) - - { - - case eSaveTransfer_Idle: - - break; - - case eSaveTransfer_GetRemoteSaveInfo: - - app.DebugPrintf("UIScene_LoadCreateJoinMenu getSaveInfo\n"); - - app.getRemoteStorage()->getSaveInfo(); - - pClass->m_eSaveTransferState = eSaveTransfer_GettingRemoteSaveInfo; - - break; - - case eSaveTransfer_GettingRemoteSaveInfo: - - if(pClass->m_saveTransferDownloadCancelled) - - { - - pClass->m_eSaveTransferState = eSaveTransfer_Error; - - break; - - } - - if(app.getRemoteStorage()->waitingForSaveInfo() == false) - - { - - if(app.getRemoteStorage()->saveIsAvailable()) - - { - - if(app.getRemoteStorage()->saveVersionSupported()) - - { - - pClass->m_eSaveTransferState = eSaveTransfer_CreateDummyFile; - - } - - else - - { - - // must be a newer version of the save in the cloud that we don't support yet - - UINT uiIDA[1]; - - uiIDA[0]=IDS_CONFIRM_OK; - - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_WRONG_VERSION, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); - - } - - } - - else - - { - - // no save available, inform the user about the functionality - - UINT uiIDA[1]; - - uiIDA[0]=IDS_CONFIRM_OK; - - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_NOT_AVAILABLE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); - - } - - } - - break; - - case eSaveTransfer_CreateDummyFile: - { - - StorageManager.ResetSaveData(); - - byte *compData = (byte *)StorageManager.AllocateSaveData( app.getRemoteStorage()->getSaveFilesize() ); - - // Make our next save default to the name of the level - - const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); - - mbstowcs(wSaveName, pNameUTF8, strlen(pNameUTF8)+1); // plus null - - StorageManager.SetSaveTitle(wSaveName); - - PBYTE pbThumbnailData=nullptr; - - DWORD dwThumbnailDataSize=0; - - PBYTE pbDataSaveImage=nullptr; - - DWORD dwDataSizeSaveImage=0; - - StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); - - if(app.getRemoteStorage()->getThumbnailData() != nullptr && app.getRemoteStorage()->getThumbnailDataSize() > 0) - { - dwThumbnailDataSize = app.getRemoteStorage()->getThumbnailDataSize(); - pbThumbnailData = new BYTE[dwThumbnailDataSize]; - memcpy(pbThumbnailData, app.getRemoteStorage()->getThumbnailData(), dwThumbnailDataSize); - } - else - StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); - - BYTE bTextMetadata[88]; - - ZeroMemory(bTextMetadata, 88); - - unsigned int hostOptions = app.getRemoteStorage()->getSaveHostOptions(); -#ifdef __ORBIS__ -app.SetGameHostOption(hostOptions, eGameHostOption_WorldSize, e_worldSize_Classic); -// force the classic world size on, otherwise it's unknown and we can't expand -#endif - -int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, - hostOptions, app.getRemoteStorage()->getSaveTexturePack()); - - -// set the icon and save image - -StorageManager.SetSaveImages(pbThumbnailData, dwThumbnailDataSize, pbDataSaveImage, dwDataSizeSaveImage, bTextMetadata, - iTextMetadataBytes); - - -app.getRemoteStorage() -> waitForStorageManagerIdle(); - -C4JStorage::ESaveGameState saveState = StorageManager.SaveSaveData( - &UIScene_LoadCreateJoinMenu::CreateDummySaveDataCallback, lpParameter); - - if(saveState== C4JStorage::ESaveGame_Save) - - { - - pClass->m_eSaveTransferState = eSaveTransfer_CreatingDummyFile; - - } - - else - - { - - app.DebugPrintf("Failed to create dummy save file\n"); - - pClass->m_eSaveTransferState = eSaveTransfer_Error; - - } - - } - - break; - - case eSaveTransfer_CreatingDummyFile : - - break; - - case eSaveTransfer_GetSavesInfo : - -{ - // we can't cancel here, we need the saves info so we can delete the file - - if (pClass->m_saveTransferDownloadCancelled) - - { - WCHAR wcTemp[256]; - - swprintf(wcTemp, 256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" - - m_wstrStageText = wcTemp; - - pMinecraft->progressRenderer->progressStage(m_wstrStageText); - } - - app.getRemoteStorage()->waitForStorageManagerIdle(); - - app.DebugPrintf("CALL GetSavesInfo B\n"); - - C4JStorage::ESaveGameState eSGIStatus = StorageManager.GetSavesInfo( - pClass->m_iPad, &UIScene_LoadCreateJoinMenu::CrossSaveGetSavesInfoCallback, pClass, "save"); - - pClass->m_eSaveTransferState = eSaveTransfer_GettingSavesInfo; -} - - break; - - case eSaveTransfer_GettingSavesInfo : - - if(pClass->m_saveTransferDownloadCancelled) - - { - - WCHAR wcTemp[256]; - - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" - - m_wstrStageText=wcTemp; - - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - - } - - break; - - - case eSaveTransfer_GetFileData : - -{ - bSaveFileCreated = true; - - StorageManager.GetSaveUniqueFileDir(pClass->m_downloadedUniqueFilename); - - if (pClass->m_saveTransferDownloadCancelled) - - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - - break; - } - - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - - int idx = pClass->m_iSaveListIndex; - - app.getRemoteStorage()->waitForStorageManagerIdle(); - - bool bGettingOK = app.getRemoteStorage()->getSaveData(pClass->m_downloadedUniqueFilename, SaveTransferReturned, - pClass); - - if (bGettingOK) - - { - pClass->m_eSaveTransferState = eSaveTransfer_GettingFileData; - } - - else - - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - - app.DebugPrintf("app.getRemoteStorage()->getSaveData failed\n"); - } -} - - - case eSaveTransfer_GettingFileData : - -{ - WCHAR wcTemp[256]; - - int dataProgress = app.getRemoteStorage()->getDataProgress(); - - pMinecraft->progressRenderer->progressStagePercentage(dataProgress); - - //swprintf(wcTemp, 256, L"Downloading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); - - swprintf(wcTemp, 256, app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA), dataProgress); - - m_wstrStageText = wcTemp; - - pMinecraft->progressRenderer->progressStage(m_wstrStageText); - - if (pClass->m_saveTransferDownloadCancelled && bAbortCalled == false) - - { - app.getRemoteStorage()->abort(); - - bAbortCalled = true; - } -} - - break; - - case eSaveTransfer_FileDataRetrieved : - - pClass->m_eSaveTransferState= eSaveTransfer_LoadSaveFromDisc; - - break; - - case eSaveTransfer_LoadSaveFromDisc : - -{ - if (pClass->m_saveTransferDownloadCancelled) - - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - - break; - } - - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - - int saveInfoIndex = -1; - - for (int i = 0; i < pSaveDetails->iSaveC; i++) - - { - if (strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, pClass->m_downloadedUniqueFilename) == 0) - - { - //found it - - saveInfoIndex = i; - } - } - - if (saveInfoIndex == -1) - - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - - app.DebugPrintf("CrossSaveGetSavesInfoCallback failed - couldn't find save\n"); - } - - else - - { - - - -#ifdef __PS3__ - -// ignore the CRC on PS3 - -C4JStorage::ESaveGameState eLoadStatus = StorageManager.LoadSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex], - &LoadCrossSaveDataCallback, pClass, true); - -#else - -C4JStorage::ESaveGameState eLoadStatus = StorageManager.LoadSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex], - &LoadCrossSaveDataCallback, pClass); - -#endif - -if(eLoadStatus== C4JStorage::ESaveGame_Load) - - { - - pClass->m_eSaveTransferState = eSaveTransfer_LoadingSaveFromDisc; - - } - - else - - { - - pClass->m_eSaveTransferState = eSaveTransfer_Error; - - } - - } - - } - - break; - - case eSaveTransfer_LoadingSaveFromDisc : - - - break; - - case eSaveTransfer_CreatingNewSave : - -{ - unsigned int fileSize = StorageManager.GetSaveSize(); - - byteArray ba(fileSize); - - StorageManager.GetSaveData(ba.data, &fileSize); - - assert(ba.length == fileSize); - - StorageManager.ResetSaveData(); - - { - PBYTE pbThumbnailData = nullptr; - - DWORD dwThumbnailDataSize = 0; - - PBYTE pbDataSaveImage = nullptr; - - DWORD dwDataSizeSaveImage = 0; - - StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); - - if (app.getRemoteStorage()->getThumbnailData() != nullptr && app.getRemoteStorage()->getThumbnailDataSize() > 0) - { - dwThumbnailDataSize = app.getRemoteStorage()->getThumbnailDataSize(); - pbThumbnailData = new BYTE[dwThumbnailDataSize]; - memcpy(pbThumbnailData, app.getRemoteStorage()->getThumbnailData(), dwThumbnailDataSize); - } - else - { - StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData, &dwThumbnailDataSize); - } - - BYTE bTextMetadata[88]; - - ZeroMemory(bTextMetadata, 88); - - unsigned int remoteHostOptions = app.getRemoteStorage()->getSaveHostOptions(); - - app.SetGameHostOption(eGameHostOption_All, remoteHostOptions); - - int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, - remoteHostOptions, - app.getRemoteStorage()->getSaveTexturePack()); - - // set the icon and save image - - StorageManager.SetSaveImages(pbThumbnailData, dwThumbnailDataSize, pbDataSaveImage, dwDataSizeSaveImage, - bTextMetadata, iTextMetadataBytes); - } - - -#ifdef SPLIT_SAVES - -ConsoleSaveFileOriginal oldFormatSave(wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform()); - -pSave=new ConsoleSaveFileSplit (&oldFormatSave, false, pMinecraft->progressRenderer); - - -pMinecraft->progressRenderer->progressStage (IDS_SAVETRANSFER_STAGE_SAVING); - -pSave->Flush (false,false); - -pClass->m_eSaveTransferState= eSaveTransfer_Saving; - -#else - -pSave=new ConsoleSaveFileOriginal(wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform()); - -pClass->m_eSaveTransferState= eSaveTransfer_Converting; - -pMinecraft->progressRenderer->progressStage (IDS_SAVETRANSFER_STAGE_CONVERTING); - -#endif - -delete ba.data; - - } - - break; - - case eSaveTransfer_Converting : - -{ - pSave->ConvertToLocalPlatform(); // check if we need to convert this file from PS3->PS4 - - pClass->m_eSaveTransferState = eSaveTransfer_Saving; - - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - - StorageManager.SetSaveTitle(wSaveName); - - StorageManager.SetSaveUniqueFilename(pClass->m_downloadedUniqueFilename); - - app.getRemoteStorage()->waitForStorageManagerIdle(); - // we need to wait for the save system to be idle here, as Flush doesn't check for it. - - pSave->Flush(false, false); -} - - break; - - case eSaveTransfer_Saving : - -{ - - - -// On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete - -// the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving. - -#if defined(_DURANGO) || defined(__ORBIS__) - -while(StorageManager.GetSaveState()!= C4JStorage::ESaveGame_Idle) - - { - - Sleep(10); - - StorageManager.Tick(); - - } - -#endif - - -delete pSave; - - -pMinecraft->progressRenderer->progressStage (IDS_PROGRESS_SAVING_TO_DISC); - -pClass->m_eSaveTransferState= eSaveTransfer_Succeeded; - - } - - break; - - - case eSaveTransfer_Succeeded : - -{ - // if we've arrived here, the save has been created successfully - - pClass->m_iState = e_SavesRepopulate; - - pClass->updateTooltips(); - - UINT uiIDA[1]; - - uiIDA[0] = IDS_CONFIRM_OK; - - app.getRemoteStorage()->waitForStorageManagerIdle(); - // wait for everything to complete before we hand control back to the player - - ui.RequestErrorMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA, 1, - ProfileManager.GetPrimaryPad(), CrossSaveFinishedCallback, pClass); - - pClass->m_eSaveTransferState = eSaveTransfer_Finished; -} - - break; - - - case eSaveTransfer_Cancelled : // this is no longer used - -{ - assert(0); //pClass->m_eSaveTransferState = eSaveTransfer_Idle; -} - - break; - - case eSaveTransfer_Error : - -{ - if (bSaveFileCreated) - - { - if (pClass->m_saveTransferDownloadCancelled) - - { - WCHAR wcTemp[256]; - - swprintf(wcTemp, 256, app.GetString(IDS_CANCEL)); - // MGH - should change this string to "cancelling download" - - m_wstrStageText = wcTemp; - - pMinecraft->progressRenderer->progressStage(m_wstrStageText); - - pMinecraft->progressRenderer->progressStage(m_wstrStageText); - } - - // if the save file has already been created we have to delete it again if there's been an error - - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - - int saveInfoIndex = -1; - - for (int i = 0; i < pSaveDetails->iSaveC; i++) - - { - if (strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, pClass->m_downloadedUniqueFilename) == 0) - - { - //found it - - saveInfoIndex = i; - } - } - - if (saveInfoIndex == -1) - - { - app.DebugPrintf("eSaveTransfer_Error failed - couldn't find save\n"); - - assert(0); - - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - } - - else - - { - // delete the save file - - app.getRemoteStorage()->waitForStorageManagerIdle(); - - C4JStorage::ESaveGameState eDeleteStatus = StorageManager.DeleteSaveData( - &pSaveDetails->SaveInfoA[saveInfoIndex], UIScene_LoadCreateJoinMenu::CrossSaveDeleteOnErrorReturned, - pClass); - - if (eDeleteStatus == C4JStorage::ESaveGame_Delete) - - { - pClass->m_eSaveTransferState = eSaveTransfer_ErrorDeletingSave; - } - - else - - { - app.DebugPrintf("StorageManager.DeleteSaveData failed!!\n"); - - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - } - } - } - - else - - { - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - } -} - - break; - - - case eSaveTransfer_ErrorDeletingSave : - - break; - - case eSaveTransfer_ErrorMesssage : - -{ - app.getRemoteStorage()->waitForStorageManagerIdle(); - // wait for everything to complete before we hand control back to the player - - if (pClass->m_saveTransferDownloadCancelled) - - { - pClass->m_eSaveTransferState = eSaveTransfer_Idle; - } - - else - - { - UINT uiIDA[1]; - - uiIDA[0] = IDS_CONFIRM_OK; - - UINT errorMessage = IDS_SAVE_TRANSFER_DOWNLOADFAILED; - - if (!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) - - { - errorMessage = IDS_ERROR_NETWORK; // show "A network error has occurred." - -#ifdef __ORBIS__ - -if(!ProfileManager.isSignedInPSN (ProfileManager.GetPrimaryPad())) - - { - - errorMessage = IDS_PRO_NOTONLINE_TEXT; // show "not signed into PSN" - - } - -#endif - -#ifdef __VITA__ - -if(!ProfileManager.IsSignedInPSN (ProfileManager.GetPrimaryPad())) - - { - - errorMessage = IDS_PRO_NOTONLINE_TEXT; // show "not signed into PSN" - - } - -#endif - - -} - -ui.RequestErrorMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA, 1, ProfileManager.GetPrimaryPad(), - CrossSaveFinishedCallback, pClass); - -pClass->m_eSaveTransferState= eSaveTransfer_Finished; - - } - - if(bSaveFileCreated) // save file has been created, then deleted. - -pClass->m_iState=e_SavesRepopulateAfterDelete; - - else - -pClass->m_iState=e_SavesRepopulate; - -pClass->updateTooltips(); - - } - - break; - - case eSaveTransfer_Finished : {} - -// waiting to dismiss the dialog - - break; - - } - -Sleep (50); - - } - -m_bSaveTransferRunning=false; - -#ifdef __PS3__ - -StorageManager.SetSaveTransferInProgress (false); - -#endif - -return 0; - - -} - - - -void UIScene_LoadCreateJoinMenu::SaveTransferReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)lpParam; - - if (s == SonyRemoteStorage::e_getDataSucceeded) - - { - pClass->m_eSaveTransferState = eSaveTransfer_FileDataRetrieved; - } - - else - - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - - app.DebugPrintf("SaveTransferReturned failed with error code : 0x%08x\n", error_code); - } -} - -ConsoleSaveFile* UIScene_LoadCreateJoinMenu::SonyCrossSaveConvert() - -{ - return nullptr; -} - - -void UIScene_LoadCreateJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)lpParam; - - pClass->m_saveTransferDownloadCancelled = true; - - ui.SetTooltips(DEFAULT_XUI_MENU_USER, -1, -1, -1, -1, -1, -1, -1, -1); - // MGH - added - remove the "cancel" tooltip, so the player knows it's underway (really needs a "cancelling" message) -} - - -#endif - - -#ifdef SONY_REMOTE_STORAGE_UPLOAD - - -void UIScene_LoadCreateJoinMenu::LaunchSaveUpload() - -{ - LoadingInputParams* loadingParams = new LoadingInputParams(); - - loadingParams->func = &UIScene_LoadCreateJoinMenu::UploadSonyCrossSaveThreadProc; - - loadingParams->lpParam = (LPVOID)this; - - UIFullscreenProgressCompletionData* completionData = new UIFullscreenProgressCompletionData(); - - completionData->bShowBackground = TRUE; - - completionData->bShowLogo = TRUE; - - completionData->type = e_ProgressCompletion_NavigateBackToScene; - - completionData->iPad = DEFAULT_XUI_MENU_USER; - - loadingParams->completionData = completionData; - - // 4J-PB - Waiting for Sony to fix canceling a save upload - - loadingParams->cancelFunc = &UIScene_LoadCreateJoinMenu::CancelSaveUploadCallback; - - loadingParams->m_cancelFuncParam = this; - - loadingParams->cancelText = IDS_TOOLTIPS_CANCEL; - - ui.NavigateToScene(m_iPad, eUIScene_FullscreenProgress, loadingParams); -} - - -int UIScene_LoadCreateJoinMenu::CrossSaveUploadFinishedCallback(void* pParam, int iPad, - C4JStorage::EMessageResult result) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - - pClass->m_eSaveUploadState = eSaveUpload_Idle; - - return 0; -} - - -int UIScene_LoadCreateJoinMenu::UploadSonyCrossSaveThreadProc(LPVOID lpParameter) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)lpParameter; - - pClass->m_saveTransferUploadCancelled = false; - - bool bAbortCalled = false; - - Minecraft* pMinecraft = Minecraft::GetInstance(); - - // get the save file size - - pMinecraft->progressRenderer->progressStagePercentage(0); - - pMinecraft->progressRenderer->progressStart(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD); - - pMinecraft->progressRenderer->progressStage(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD); - - PSAVE_DETAILS pSaveDetails = StorageManager.ReturnSavesInfo(); - - int idx = pClass->m_iSaveListIndex; - - bool bSettingOK = app.getRemoteStorage()->setSaveData(&pSaveDetails->SaveInfoA[idx], SaveUploadReturned, pClass); - - if (bSettingOK) - - { - pClass->m_eSaveUploadState = eSaveUpload_UploadingFileData; - - pMinecraft->progressRenderer->progressStagePercentage(0); - } - - else - - { - pClass->m_eSaveUploadState = eSaveUpload_Error; - } - - while (pClass->m_eSaveUploadState != eSaveUpload_Idle) - - { - switch (pClass->m_eSaveUploadState) - - { - case eSaveUpload_Idle: - - break; - - case eSaveUpload_UploadingFileData: - { - WCHAR wcTemp[256]; - - int dataProgress = app.getRemoteStorage()->getDataProgress(); - - pMinecraft->progressRenderer->progressStagePercentage(dataProgress); - - //swprintf(wcTemp, 256, L"Uploading data : %d", dataProgress);//app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,pClass->m_ulFileSize); - - swprintf(wcTemp, 256, app.GetString(IDS_SAVETRANSFER_STAGE_PUT_DATA), dataProgress); - - m_wstrStageText = wcTemp; - - pMinecraft->progressRenderer->progressStage(m_wstrStageText); - - // 4J-PB - Waiting for Sony to fix canceling a save upload - - if (pClass->m_saveTransferUploadCancelled && bAbortCalled == false) - - { - // we only really want to be able to cancel during the download of data, if it's taking a long time - - app.getRemoteStorage()->abort(); - - bAbortCalled = true; - } - } - - break; - - case eSaveUpload_FileDataUploaded: - { - UINT uiIDA[1]; - - uiIDA[0] = IDS_CONFIRM_OK; - - ui.RequestErrorMessage(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA, 1, - ProfileManager.GetPrimaryPad(), CrossSaveUploadFinishedCallback, pClass); - - pClass->m_eSaveUploadState = esaveUpload_Finished; - } - - break; - - case eSaveUpload_Cancelled: // this is no longer used - - assert(0); // pClass->m_eSaveUploadState = eSaveUpload_Idle; - - break; - - case eSaveUpload_Error: - { - if (pClass->m_saveTransferUploadCancelled) - - { - pClass->m_eSaveUploadState = eSaveUpload_Idle; - } - - else - - { - UINT uiIDA[1]; - - uiIDA[0] = IDS_CONFIRM_OK; - - ui.RequestErrorMessage(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA, 1, - ProfileManager.GetPrimaryPad(), CrossSaveUploadFinishedCallback, pClass); - - pClass->m_eSaveUploadState = esaveUpload_Finished; - } - } - - break; - - case esaveUpload_Finished: - - // waiting for dialog to be dismissed - - break; - } - - Sleep(50); - } - - return 0; -} - - -void UIScene_LoadCreateJoinMenu::SaveUploadReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)lpParam; - - if (pClass->m_saveTransferUploadCancelled) - - { - UINT uiIDA[1] = {IDS_CONFIRM_OK}; - - ui.RequestErrorMessage(IDS_CANCEL_UPLOAD_TITLE, IDS_CANCEL_UPLOAD_TEXT, uiIDA, 1, - ProfileManager.GetPrimaryPad(), CrossSaveUploadFinishedCallback, pClass); - - pClass->m_eSaveUploadState = esaveUpload_Finished; - } - - else - - { - if (s == SonyRemoteStorage::e_setDataSucceeded) - - pClass->m_eSaveUploadState = eSaveUpload_FileDataUploaded; - - else if (!pClass->m_saveTransferUploadCancelled) - - pClass->m_eSaveUploadState = eSaveUpload_Error; - } -} - - -void UIScene_LoadCreateJoinMenu::CancelSaveUploadCallback(LPVOID lpParam) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)lpParam; - - pClass->m_saveTransferUploadCancelled = true; - - app.DebugPrintf("m_saveTransferUploadCancelled = true\n"); - - ui.SetTooltips(DEFAULT_XUI_MENU_USER, -1, -1, -1, -1, -1, -1, -1, -1); - // MGH - added - remove the "cancel" tooltip, so the player knows it's underway (really needs a "cancelling" message) - - pClass->m_bIgnoreInput = true; -} - - -int UIScene_LoadCreateJoinMenu::SaveTransferDialogReturned(void* pParam, int iPad, C4JStorage::EMessageResult result) - -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - - // results switched for this dialog - - if (result == C4JStorage::EMessage_ResultAccept) - - { - // upload the save - - pClass->LaunchSaveUpload(); - - pClass->m_bIgnoreInput = false; - } - - else - - { - pClass->m_bIgnoreInput = false; - } - - return 0; -} - -#endif // SONY_REMOTE_STORAGE_UPLOAD - - -#if defined _XBOX_ONE - -void UIScene_LoadCreateJoinMenu::LaunchSaveTransfer() - -{ - SaveTransferStateContainer* stateContainer = new SaveTransferStateContainer(); - - stateContainer->m_iProgress = 0; - - stateContainer->m_bSaveTransferInProgress = false; - - stateContainer->m_bSaveTransferCancelled = false; - - stateContainer->m_iPad = m_iPad; - - stateContainer->m_eSaveTransferState = C4JStorage::eSaveTransfer_Idle; - - stateContainer->m_pClass = this; - - LoadingInputParams* loadingParams = new LoadingInputParams(); - - loadingParams->func = &UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc; - - loadingParams->lpParam = (LPVOID)stateContainer; - - UIFullscreenProgressCompletionData* completionData = new UIFullscreenProgressCompletionData(); - - completionData->bShowBackground = TRUE; - - completionData->bShowLogo = TRUE; - - completionData->type = e_ProgressCompletion_NavigateBackToScene; - - completionData->iPad = DEFAULT_XUI_MENU_USER; - - completionData->bRequiresUserAction = TRUE; - - loadingParams->completionData = completionData; - - loadingParams->cancelFunc = &UIScene_LoadCreateJoinMenu::CancelSaveTransferCallback; - - loadingParams->m_cancelFuncParam = stateContainer; - - loadingParams->cancelText = IDS_TOOLTIPS_CANCEL; - - ui.NavigateToScene(m_iPad, eUIScene_FullscreenProgress, loadingParams); -} - - -int UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc(LPVOID lpParameter) - -{ - Compression::UseDefaultThreadStorage(); - - SaveTransferStateContainer* pStateContainer = (SaveTransferStateContainer*)lpParameter; - - Minecraft* pMinecraft = Minecraft::GetInstance(); - - ConsoleSaveFile* pSave = nullptr; - - while (StorageManager.SaveTransferClearState() != C4JStorage::eSaveTransfer_Idle) - - { - Sleep(5); - } - - pStateContainer->m_bSaveTransferInProgress = true; - - UIScene_LoadCreateJoinMenu::s_eSaveTransferFile = eSaveTransferFile_Marker; - - RequestFileSize(pStateContainer, L"completemarker"); - - while ((pStateContainer->m_eSaveTransferState != C4JStorage::eSaveTransfer_Idle) && pStateContainer-> - m_bSaveTransferInProgress && !pStateContainer->m_bSaveTransferCancelled) - - { - switch (pStateContainer->m_eSaveTransferState) - - { - case C4JStorage::eSaveTransfer_Idle: - - break; - - case C4JStorage::eSaveTransfer_FileSizeRetrieved: - - switch (UIScene_LoadCreateJoinMenu::s_eSaveTransferFile) - - { - case eSaveTransferFile_Marker: - - if (UIScene_LoadCreateJoinMenu::s_ulFileSize == 0) - - { - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_NONE_FOUND); - - pStateContainer->m_eSaveTransferState = C4JStorage::eSaveTransfer_Idle; - } - - else - - { - RequestFileData(pStateContainer, L"completemarker"); - } - - break; - - case eSaveTransferFile_Metadata: - - RequestFileData(pStateContainer, L"metadata"); - - break; - - case eSaveTransferFile_SaveData: - - RequestFileData(pStateContainer, L"savedata"); - - break; - }; - - break; - - case C4JStorage::eSaveTransfer_GettingFileData: - - break; - - case C4JStorage::eSaveTransfer_FileDataRetrieved: - - switch (UIScene_LoadCreateJoinMenu::s_eSaveTransferFile) - - { - case eSaveTransferFile_Marker: - - // MGH - the marker file now contains the save file version number - - // if the version is higher than we handle, cancel the download. - - if (UIScene_LoadCreateJoinMenu::s_transferData[0] > SAVE_FILE_VERSION_NUMBER) - - { - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_NONE_FOUND); - - pStateContainer->m_eSaveTransferState = C4JStorage::eSaveTransfer_Idle; - } - - else - - { - UIScene_LoadCreateJoinMenu::s_eSaveTransferFile = eSaveTransferFile_Metadata; - - RequestFileSize(pStateContainer, L"metadata"); - } - - break; - - case eSaveTransferFile_Metadata: - { - ByteArrayInputStream bais(UIScene_LoadCreateJoinMenu::s_transferData); - - DataInputStream dis(&bais); - - wstring saveTitle = dis.readUTF(); - - StorageManager.SetSaveTitle(saveTitle.c_str()); - - wstring saveUniqueName = dis.readUTF(); - - // 4J Stu - Don't set this any more. We added it so that we could share the ban list data for this save - - // However if the player downloads the same save multiple times, it will overwrite the previous version - - // with that filname, and they could have made changes to it. - - //StorageManager.SetSaveUniqueFilename((wchar_t *)saveUniqueName.c_str()); - - int thumbnailSize = dis.readInt(); - - if (thumbnailSize > 0) - - { - byteArray ba(thumbnailSize); - - dis.readFully(ba); - - // retrieve the seed value from the image metadata, we need to change to host options, then set it back again - - bool bHostOptionsRead = false; - - unsigned int uiHostOptions = 0; - - DWORD dwTexturePack; - - int64_t seedVal; - - char szSeed[50]; - - ZeroMemory(szSeed, 50); - - app.GetImageTextData(ba.data, ba.length, (unsigned char*)&szSeed, uiHostOptions, - bHostOptionsRead, dwTexturePack); - - sscanf_s(szSeed, "%I64d", &seedVal); - - app.SetGameHostOption(uiHostOptions, eGameHostOption_WorldSize, e_worldSize_Classic); - // force the classic world size on, otherwise it's unknown and we can't expand - - BYTE bTextMetadata[88]; - - ZeroMemory(bTextMetadata, 88); - - int iTextMetadataBytes = app.CreateImageTextData( - bTextMetadata, seedVal, true, uiHostOptions, dwTexturePack); - - // set the icon and save image - - StorageManager.SetSaveImages(ba.data, ba.length, nullptr, 0, bTextMetadata, iTextMetadataBytes); - - delete ba.data; - } - - UIScene_LoadCreateJoinMenu::s_transferData = byteArray(); - - UIScene_LoadCreateJoinMenu::s_eSaveTransferFile = eSaveTransferFile_SaveData; - - RequestFileSize(pStateContainer, L"savedata"); - } - - break; - - case eSaveTransferFile_SaveData: { - - -#ifdef SPLIT_SAVES - -if(!pStateContainer->m_bSaveTransferCancelled) - - { - - ConsoleSaveFileOriginal oldFormatSave( L"Temp name", UIScene_LoadCreateJoinMenu::s_transferData.data, UIScene_LoadCreateJoinMenu::s_transferData.length, false, SAVE_FILE_PLATFORM_X360 ); - - pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer ); - - - - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - - if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); - - } - -pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Saving; - - -#else - -pSave=new ConsoleSaveFileOriginal(wSaveName, m_transferData.data, m_transferData.length, false, - SAVE_FILE_PLATFORM_X360); - -pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Converting; - -#endif - -delete UIScene_LoadCreateJoinMenu::s_transferData.data; - -UIScene_LoadCreateJoinMenu::s_transferData= byteArray(); - - } - - break; - - }; - - -pStateContainer->m_iProgress=0; - - break; - - case C4JStorage::eSaveTransfer_Converting : - -#if 0 - -pSave->ConvertToLocalPlatform(); - - -pMinecraft->progressRenderer->progressStage (IDS_SAVETRANSFER_STAGE_SAVING); - - if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush (false,false); - - -pStateContainer->m_iProgress+=1; - - if(pStateContainer->m_iProgress==101) - - { - - pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Saving; - - pStateContainer->m_iProgress=0; - - break; - - } - -pMinecraft->progressRenderer->progressStagePercentage (pStateContainer->m_iProgress); - -#endif - -break; - - case C4JStorage::eSaveTransfer_Saving : - -// On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete - -// the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving. - -#if defined(_DURANGO) || defined(__ORBIS__) - -pMinecraft->progressRenderer->progressStage (IDS_PROGRESS_SAVING_TO_DISC); - - - while(StorageManager.GetSaveState()!= C4JStorage::ESaveGame_Idle) - - { - - Sleep(10); - - - // 4J Stu - DO NOT tick this here. The main thread should be the only place ticking the StorageManager. You WILL get crashes. - - //StorageManager.Tick(); - - } - -#endif - - -delete pSave; - - -#ifdef _XBOX_ONE - -pMinecraft->progressRenderer->progressStage (IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE); - -#endif - - -pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - - -// wipe the list and repopulate it - - if(!pStateContainer->m_bSaveTransferCancelled) pStateContainer->m_pClass->m_iState= -e_SavesRepopulateAfterTransferDownload; - - -//pClass->m_iProgress+=1; - -//if(pClass->m_iProgress==101) - -//{ - -// pClass->m_iProgress=0; - -// pClass->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - -// pMinecraft->progressRenderer->progressStage( IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE ); - - -// break; - -//} - -//pMinecraft->progressRenderer->progressStagePercentage(pClass->m_iProgress); - - - break; - - } - -Sleep (50); - - } - - - - if(pStateContainer->m_bSaveTransferCancelled) - - { - - WCHAR wcTemp[256]; - - - - pStateContainer->m_bSaveTransferCancelled=false; - - swprintf(wcTemp,app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLED)); - - m_wstrStageText=wcTemp; - - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - - - - } - - - -pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - -pStateContainer->m_bSaveTransferInProgress=false; - - - delete pStateContainer; - - - return 0; - -} - - - -void UIScene_LoadCreateJoinMenu::RequestFileSize(SaveTransferStateContainer* pClass, wchar_t* filename) - -{ - Minecraft* pMinecraft = Minecraft::GetInstance(); - - // get the save file size - - pMinecraft->progressRenderer->progressStart(IDS_SAVETRANSFER_TITLE_GET); - - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_GET_DETAILS); - - -#ifdef _DEBUG_MENUS_ENABLED - -if(app.GetLoadSavesFromFolderEnabled()) - - { - - ZeroMemory(&m_debugTransferDetails, sizeof(C4JStorage::SAVETRANSFER_FILE_DETAILS)); - - - - File targetFile( wstring(L"FakeTMSPP\\").append(filename) ); - - if(targetFile.exists()) m_debugTransferDetails.ulFileLen = targetFile.length(); - - - - SaveTransferReturned(pClass,&m_debugTransferDetails); - - } - - else - -#endif - -{ - - do - - { - - pMinecraft->progressRenderer->progressStart(IDS_SAVETRANSFER_TITLE_GET); - - pMinecraft->progressRenderer->progressStage( IDS_SAVETRANSFER_STAGE_GET_DETAILS ); - - Sleep(1); - - pClass->m_eSaveTransferState=StorageManager.SaveTransferGetDetails(pClass->m_iPad,C4JStorage::eGlobalStorage_TitleUser,filename,&UIScene_LoadCreateJoinMenu::SaveTransferReturned,pClass); - - } - - while(pClass->m_eSaveTransferState == C4JStorage::eSaveTransfer_Busy && !pClass->m_bSaveTransferCancelled ); - - } - -} - - - -void UIScene_LoadCreateJoinMenu::RequestFileData(SaveTransferStateContainer* pClass, wchar_t* filename) - -{ - Minecraft* pMinecraft = Minecraft::GetInstance(); - - WCHAR wcTemp[256]; - - pMinecraft->progressRenderer->progressStagePercentage(0); - - swprintf(wcTemp, app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA), 0, UIScene_LoadCreateJoinMenu::s_ulFileSize); - - m_wstrStageText = wcTemp; - - pMinecraft->progressRenderer->progressStage(m_wstrStageText); - - -#ifdef _DEBUG_MENUS_ENABLED -if(app.GetLoadSavesFromFolderEnabled()) - { - File targetFile( wstring(L"FakeTMSPP\\").append(filename) ); - - if(targetFile.exists()) - { - - HANDLE hSaveFile = CreateFile( targetFile.getPath().c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, nullptr); - - m_debugTransferDetails.pbData = new BYTE[m_debugTransferDetails.ulFileLen]; - - DWORD numberOfBytesRead = 0; - - ReadFile( hSaveFile,m_debugTransferDetails.pbData,m_debugTransferDetails.ulFileLen,&numberOfBytesRead,nullptr); - - assert(numberOfBytesRead == m_debugTransferDetails.ulFileLen); - - CloseHandle(hSaveFile); - - SaveTransferReturned(pClass,&m_debugTransferDetails); - } - } - else -#endif -{ - do - { - pMinecraft->progressRenderer->progressStart(IDS_SAVETRANSFER_TITLE_GET); - pMinecraft->progressRenderer->progressStage( -1 ); - Sleep(1); - pClass->m_eSaveTransferState=StorageManager.SaveTransferGetData(pClass->m_iPad,C4JStorage::eGlobalStorage_TitleUser,filename,&UIScene_LoadCreateJoinMenu::SaveTransferReturned,&UIScene_LoadCreateJoinMenu::SaveTransferUpdateProgress,pClass,pClass); - } - while(pClass->m_eSaveTransferState == C4JStorage::eSaveTransfer_Busy && !pClass->m_bSaveTransferCancelled ); - } -} - -int UIScene_LoadCreateJoinMenu::SaveTransferReturned(LPVOID lpParam, C4JStorage::SAVETRANSFER_FILE_DETAILS* pSaveTransferDetails) -{ - SaveTransferStateContainer* pClass = (SaveTransferStateContainer*)lpParam; - app.DebugPrintf("Save Transfer - size is %d\n", pSaveTransferDetails->ulFileLen); - - // if the file data is null, then assume this is the file size retrieval - - if (pSaveTransferDetails->pbData == nullptr) - { - pClass->m_eSaveTransferState = C4JStorage::eSaveTransfer_FileSizeRetrieved; - UIScene_LoadCreateJoinMenu::s_ulFileSize = pSaveTransferDetails->ulFileLen; - } - - else - { - delete UIScene_LoadCreateJoinMenu::s_transferData.data; - - UIScene_LoadCreateJoinMenu::s_transferData = byteArray(pSaveTransferDetails->pbData, UIScene_LoadCreateJoinMenu::s_ulFileSize); - pClass->m_eSaveTransferState = C4JStorage::eSaveTransfer_FileDataRetrieved; - } - - return 0; -} - -int UIScene_LoadCreateJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam, unsigned long ulBytesReceived) -{ - WCHAR wcTemp[256]; - - SaveTransferStateContainer* pClass = (SaveTransferStateContainer*)lpParam; - - Minecraft* pMinecraft = Minecraft::GetInstance(); - - if (pClass->m_bSaveTransferCancelled) // was cancelled - - { - pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING); - - swprintf(wcTemp, app.GetString(IDS_SAVE_TRANSFER_DOWNLOAD_CANCELLING)); - - m_wstrStageText = wcTemp; - - pMinecraft->progressRenderer->progressStage(m_wstrStageText); - } - - else - { - unsigned int uiProgress = (unsigned int)(((float)ulBytesReceived / float( - UIScene_LoadCreateJoinMenu::s_ulFileSize)) * 100.0f); - - pMinecraft->progressRenderer->progressStagePercentage(uiProgress); - - swprintf(wcTemp, app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA), ((float)(ulBytesReceived)) / 1024000.0f, - ((float)UIScene_LoadCreateJoinMenu::s_ulFileSize) / 1024000.0f); - - m_wstrStageText = wcTemp; - - pMinecraft->progressRenderer->progressStage(m_wstrStageText); - } - - return 0; -} - -void UIScene_LoadCreateJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) -{ - SaveTransferStateContainer* pClass = (SaveTransferStateContainer*)lpParam; - - if (!pClass->m_bSaveTransferCancelled) - { - StorageManager.CancelSaveTransfer(UIScene_LoadCreateJoinMenu::CancelSaveTransferCompleteCallback, pClass); - pClass->m_bSaveTransferCancelled = true; - } - - //pClass->m_bSaveTransferInProgress=false; -} - -int UIScene_LoadCreateJoinMenu::CancelSaveTransferCompleteCallback(LPVOID lpParam) -{ - SaveTransferStateContainer* pClass = (SaveTransferStateContainer*)lpParam; - - // change the state to idle to get the download thread to terminate - pClass->m_eSaveTransferState = C4JStorage::eSaveTransfer_Idle; - - return 0; -} - -int UIScene_LoadCreateJoinMenu::NeedSyncMessageReturned(void* pParam, int iPad, C4JStorage::EMessageResult result) -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - LoadMenuInitData* params = (LoadMenuInitData*)pParam; - - if (result == C4JStorage::EMessage_ResultAccept) - { - // navigate to the settings scene - ui.NavigateToScene(pClass->m_iPad, eUIScene_LoadMenu, pClass->m_loadMenuInitData); - } - else - { - delete pClass->m_loadMenuInitData; - pClass->m_bIgnoreInput = false; - } - - return 0; -} -#endif - -#ifdef _XBOX_ONE -void UIScene_LoadCreateJoinMenu::HandleDLCLicenseChange() -{ - // may have installed Halloween on this menu - app.StartInstallDLCProcess(m_iPad); -} - -#endif - -#if defined _XBOX_ONE || defined __ORBIS__ - -int UIScene_LoadCreateJoinMenu::CopySaveDialogReturned(void* pParam, int iPad, C4JStorage::EMessageResult result) -{ - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - - if (result == C4JStorage::EMessage_ResultAccept) - { - LoadingInputParams* loadingParams = new LoadingInputParams(); - - void* uniqueId = (LPVOID)pClass->GetCallbackUniqueId(); - - loadingParams->func = &UIScene_LoadCreateJoinMenu::CopySaveThreadProc; - loadingParams->lpParam = uniqueId; - loadingParams->waitForThreadToDelete = true; - - UIFullscreenProgressCompletionData* completionData = new UIFullscreenProgressCompletionData(); - - completionData->bShowBackground = TRUE; - completionData->bShowLogo = TRUE; - completionData->type = e_ProgressCompletion_NavigateBackToScene; - completionData->iPad = DEFAULT_XUI_MENU_USER; - - loadingParams->completionData = completionData; - loadingParams->cancelFunc = &UIScene_LoadCreateJoinMenu::CancelCopySaveCallback; - loadingParams->m_cancelFuncParam = uniqueId; - loadingParams->cancelText = IDS_TOOLTIPS_CANCEL; - - ui.NavigateToScene(iPad, eUIScene_FullscreenProgress, loadingParams); - } - else - pClass->m_bIgnoreInput = false; - - return 0; -} - -int UIScene_LoadCreateJoinMenu::CopySaveThreadProc(LPVOID lpParameter) -{ - Minecraft* pMinecraft = Minecraft::GetInstance(); - pMinecraft->progressRenderer->progressStart(IDS_PROGRESS_COPYING_SAVE); - pMinecraft->progressRenderer->progressStage(-1); - - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParameter); - if (pClass) - { - pClass->m_bCopying = true; - pClass->m_bCopyingCancelled = false; - ui.LeaveCallbackIdCriticalSection(); - - // Copy save data takes two callbacks - one for completion, and one for progress. The progress callback also lets us cancel the operation, if we return false. - StorageManager.CopySaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex], - UIScene_LoadCreateJoinMenu::CopySaveDataReturned, - UIScene_LoadCreateJoinMenu::CopySaveDataProgress, lpParameter); - - bool bContinue = true; - do - { - Sleep(100); - ui.EnterCallbackIdCriticalSection(); - - pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParameter); - - if (pClass) - bContinue = pClass->m_bCopying; - - else - bContinue = false; - - ui.LeaveCallbackIdCriticalSection(); - } - while (bContinue); - } - - else - ui.LeaveCallbackIdCriticalSection(); - - return 0; -} - -int UIScene_LoadCreateJoinMenu::CopySaveDataReturned(LPVOID lpParam, bool success, C4JStorage::ESaveGameState stat) -{ - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); - - if (pClass) - { - if (success) - { - pClass->m_bCopying = false; - // wipe the list and repopulate it - pClass->m_iState = e_SavesRepopulateAfterDelete; - - ui.LeaveCallbackIdCriticalSection(); - } - else - { - - -#ifdef __ORBIS__ - -UINT uiIDA[1]; - -// you cancelled the save on exit after choosing exit and save? You go back to the Exit choices then. -uiIDA [0]=IDS_OK; - - if(stat== C4JStorage::ESaveGame_CopyCompleteFailLocalStorage) - { - ui.LeaveCallbackIdCriticalSection(); - ui.RequestErrorMessage(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_LOCAL, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam); - } - else if(stat== C4JStorage::ESaveGame_CopyCompleteFailQuota) - { - ui.LeaveCallbackIdCriticalSection(); - ui.RequestErrorMessage(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_QUOTA, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam); - } - else - { - pClass->m_bCopying = false; - ui.LeaveCallbackIdCriticalSection(); - } -#else -pClass->m_bCopying=false; -ui.LeaveCallbackIdCriticalSection(); -#endif -} - } - - else -ui.LeaveCallbackIdCriticalSection(); - - return 0; -} - -bool UIScene_LoadCreateJoinMenu::CopySaveDataProgress(LPVOID lpParam, int percent) -{ - bool bContinue = false; - - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); - - if (pClass) - bContinue = !pClass->m_bCopyingCancelled; - - ui.LeaveCallbackIdCriticalSection(); - - Minecraft* pMinecraft = Minecraft::GetInstance(); - pMinecraft->progressRenderer->progressStagePercentage(percent); - - return bContinue; -} - -void UIScene_LoadCreateJoinMenu::CancelCopySaveCallback(LPVOID lpParam) -{ - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); - - if (pClass) - pClass->m_bCopyingCancelled = true; - - ui.LeaveCallbackIdCriticalSection(); -} - -int UIScene_LoadCreateJoinMenu::CopySaveErrorDialogFinishedCallback(void* pParam, int iPad, - C4JStorage::EMessageResult result) -{ - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)pParam); - - if (pClass) - pClass->m_bCopying = false; - - ui.LeaveCallbackIdCriticalSection(); - - return 0; -} - -#endif // _XBOX_ONE - -#ifdef _WINDOWS64 -// adding servers bellow -void UIScene_LoadCreateJoinMenu::BeginAddServer() -{ - m_addServerPhase = eAddServer_IP; - m_addServerIP.clear(); - m_addServerPort.clear(); - - UIKeyboardInitData kbData; - - kbData.title = L"Server Address"; - kbData.defaultText = L""; - kbData.maxChars = 128; - kbData.callback = &UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback; - kbData.lpParam = this; - kbData.pcMode = g_KBMInput.IsKBMActive(); - - ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData); -} - -void UIScene_LoadCreateJoinMenu::AppendServerToFile(const wstring& ip, const wstring& port, const wstring& name) -{ - char narrowIP[256] = {}; - char narrowPort[16] = {}; - char narrowName[256] = {}; - - wcstombs(narrowIP, ip.c_str(), sizeof(narrowIP) - 1); - wcstombs(narrowPort, port.c_str(), sizeof(narrowPort) - 1); - wcstombs(narrowName, name.c_str(), sizeof(narrowName) - 1); - - uint16_t portNum = static_cast(atoi(narrowPort)); - - struct ServerEntry - { - std::string ip; - uint16_t port; - std::string name; - }; - - std::vector entries; - - FILE* file = fopen("servers.db", "rb"); - - if (file) - { - char magic[4] = {}; - - if (fread(magic, 1, 4, file) == 4 && memcmp(magic, "MCSV", 4) == 0) - { - uint32_t version = 0, count = 0; - fread(&version, sizeof(uint32_t), 1, file); - fread(&count, sizeof(uint32_t), 1, file); - - if (version == 1) - for (uint32_t s = 0; s < count; s++) - { - uint16_t ipLen = 0, p = 0, nameLen = 0; - - if (fread(&ipLen, sizeof(uint16_t), 1, file) != 1) - break; - - if (ipLen == 0 || ipLen > 256) - break; - - char ipBuf[257] = {}; - - if (fread(ipBuf, 1, ipLen, file) != ipLen) - break; - - if (fread(&p, sizeof(uint16_t), 1, file) != 1) - break; - - if (fread(&nameLen, sizeof(uint16_t), 1, file) != 1) - break; - - if (nameLen > 256) - break; - - char nameBuf[257] = {}; - if (nameLen > 0 && fread(nameBuf, 1, nameLen, file) != nameLen) - break; - - entries.push_back({std::string(ipBuf), p, std::string(nameBuf)}); - } - } - - fclose(file); - } - - entries.push_back({std::string(narrowIP), portNum, std::string(narrowName)}); - - file = fopen("servers.db", "wb"); - if (file) - { - fwrite("MCSV", 1, 4, file); - - uint32_t version = 1; - uint32_t count = static_cast(entries.size()); - - fwrite(&version, sizeof(uint32_t), 1, file); - fwrite(&count, sizeof(uint32_t), 1, file); - - for (size_t i = 0; i < entries.size(); i++) - { - uint16_t ipLen = static_cast(entries[i].ip.length()); - fwrite(&ipLen, sizeof(uint16_t), 1, file); - fwrite(entries[i].ip.c_str(), 1, ipLen, file); - fwrite(&entries[i].port, sizeof(uint16_t), 1, file); - uint16_t nameLen = static_cast(entries[i].name.length()); - fwrite(&nameLen, sizeof(uint16_t), 1, file); - fwrite(entries[i].name.c_str(), 1, nameLen, file); - } - - fclose(file); - } -} - -int UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback(LPVOID lpParam, bool bRes) -{ - auto pClass = static_cast(lpParam); - if (!bRes) - { - pClass->m_addServerPhase = eAddServer_Idle; - pClass->m_bIgnoreInput = false; - - return 0; - } - - uint16_t ui16Text[128] = {}; - - Win64_GetKeyboardText(ui16Text, 128); - - wchar_t wBuf[128] = {}; - - for (int k = 0; k < 127 && ui16Text[k]; k++) - wBuf[k] = static_cast(ui16Text[k]); - - if (wBuf[0] == 0) - { - pClass->m_addServerPhase = eAddServer_Idle; - pClass->m_bIgnoreInput = false; - - return 0; - } - - switch (pClass->m_addServerPhase) - { - case eAddServer_IP: - { - pClass->m_addServerIP = wBuf; - - pClass->m_addServerPhase = eAddServer_Port; - - UIKeyboardInitData kbData; - - kbData.title = L"Server Port"; - kbData.defaultText = L"25565"; - kbData.maxChars = 6; - kbData.callback = &UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback; - kbData.lpParam = pClass; - kbData.pcMode = g_KBMInput.IsKBMActive(); - - ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData); - - break; - } - - case eAddServer_Port: - { - pClass->m_addServerPort = wBuf; - - pClass->m_addServerPhase = eAddServer_Name; - - UIKeyboardInitData kbData; - - kbData.title = L"Server Name"; - kbData.defaultText = L"Minecraft Server"; - kbData.maxChars = 64; - kbData.callback = &UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback; - kbData.lpParam = pClass; - kbData.pcMode = g_KBMInput.IsKBMActive(); - - ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData); - break; - } - - case eAddServer_Name: - { - wstring name = wBuf; - pClass->AppendServerToFile(pClass->m_addServerIP, pClass->m_addServerPort, name); - pClass->m_addServerPhase = eAddServer_Idle; - pClass->m_bIgnoreInput = false; - g_NetworkManager.ForceFriendsSessionRefresh(); - break; - } - - default: - pClass->m_addServerPhase = eAddServer_Idle; - pClass->m_bIgnoreInput = false; - break; - } - - return 0; -} -#endif // _WINDOWS64 diff --git a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h deleted file mode 100644 index 1ea7a75a..00000000 --- a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.h +++ /dev/null @@ -1,388 +0,0 @@ -#pragma once - -#include "UIScene.h" - -class LevelGenerationOptions; -class C4JThread; - -#if defined __PS3__ || defined __ORBIS__ || defined(__PSVITA__) -#define SONY_REMOTE_STORAGE_DOWNLOAD -#endif -#if defined __PS3__ || __PSVITA__ -#define SONY_REMOTE_STORAGE_UPLOAD -#endif - -class UIScene_LoadCreateJoinMenu : public UIScene -{ -private: - enum EControls - { - eControl_SavesList, - eControl_NewGamesList, - eControl_GamesList, - eControl_TabLoad, - eControl_TabCreate, - eControl_TabJoin, -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) - eControl_SpaceIndicator, -#endif - }; - - enum ELoadCreateJoinTab - { - eTab_Load = 0, - eTab_Create, - eTab_Join, - }; - - enum EState - { - e_SavesIdle, - e_SavesRepopulate, - e_SavesRepopulateAfterMashupHide, - e_SavesRepopulateAfterDelete, - e_SavesRepopulateAfterTransferDownload, - }; - - enum eActions - { - eAction_None=0, - eAction_ViewInvites, - eAction_JoinGame, - }; - eActions m_eAction; - - static const int JOIN_LOAD_CREATE_BUTTON_INDEX = 0; - - SaveListDetails *m_saveDetails; - int m_iSaveDetailsCount; - -protected: - UIControl m_controlMainPanel; - UIControl m_controlLoadGame; - UIControl m_controlLoadGamePanel; - UIControl m_controlNewGame; - UIControl m_controlNewGamePanel; - UIControl m_controlJoinGame; - UIControl m_controlJoinGamePanel; - UIControl_SaveList m_buttonListSaves; - UIControl_SaveList m_buttonListNewGames; - UIControl_SaveList m_buttonListGames; - UIControl_Label m_labelSavesListTitle, m_labelCreateListTitle, m_labelJoinListTitle, m_labelNoGames; - UIControl m_controlSavesTimer, m_controlNewGameTimer, m_controlJoinTimer; -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) - UIControl_SpaceIndicatorBar m_spaceIndicatorSaves; -#endif - - IggyName m_funcSetActiveTab, m_funcSetMatchesAvailable, m_funcShowSaveSizeBar; - bool m_hasMainPanel; - bool m_hasNewGameList; - bool m_hasNoGamesLabel; - bool m_hasTabButtons; - ELoadCreateJoinTab m_activeTab; - IggyValuePath m_loadGamePath; - IggyValuePath m_newGamePath; - IggyValuePath m_joinGamePath; - bool m_hasLoadGamePath; - bool m_hasNewGamePath; - bool m_hasJoinGamePath; - -private: - UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) - UI_MAP_ELEMENT( m_controlLoadGame, "LoadGame") - UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlLoadGame ) - UI_MAP_ELEMENT( m_buttonListSaves, "LoadGameList") - UI_MAP_ELEMENT( m_controlSavesTimer, "LoadGameTimer") -#if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) - UI_MAP_ELEMENT( m_spaceIndicatorSaves, "SaveSizeBar") -#endif - UI_END_MAP_CHILD_ELEMENTS() - - UI_MAP_ELEMENT( m_controlNewGame, "NewGame") - UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlNewGame ) - UI_MAP_ELEMENT( m_buttonListNewGames, "NewGameList") - UI_MAP_ELEMENT( m_controlNewGameTimer, "NewGameTimer") - UI_END_MAP_CHILD_ELEMENTS() - - UI_MAP_ELEMENT( m_controlJoinGame, "JoinGame") - UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlJoinGame ) - UI_MAP_ELEMENT( m_buttonListGames, "JoinGameGamesList") - UI_MAP_ELEMENT( m_controlJoinTimer, "JoinGamesTimer") - UI_END_MAP_CHILD_ELEMENTS() - - UI_MAP_ELEMENT( m_labelSavesListTitle, "LoadGameTabTitle") - UI_MAP_ELEMENT( m_labelCreateListTitle, "NewGameTabTitle") - UI_MAP_ELEMENT( m_labelJoinListTitle, "JoinGameTabTitle") - UI_MAP_NAME( m_funcSetActiveTab, L"SetActiveTab") - UI_MAP_NAME( m_funcSetMatchesAvailable, L"SetMatchesAvailable") - UI_MAP_NAME( m_funcShowSaveSizeBar, L"ShowSaveSizeBar") - UI_END_MAP_ELEMENTS_AND_NAMES() - - int m_iDefaultButtonsC; - int m_iMashUpButtonsC; - int m_iState; - - vector *m_currentSessions; - vector m_generators; - vector *m_saves; - - bool m_bIgnoreInput; - bool m_bAllLoaded; - bool m_bRetrievingSaveThumbnails; - bool m_bSaveThumbnailReady; - bool m_bShowingPartyGamesOnly; - bool m_bInParty; - JoinMenuInitData *m_initData; - bool m_bMultiplayerAllowed; - int m_iTexturePacksNotInstalled; - int m_iRequestingThumbnailId; - SAVE_DETAILS *m_pSaveDetails; - bool m_bSavesDisplayed; - bool m_bExitScene; - bool m_bCopying; - bool m_bCopyingCancelled; - int m_iSaveInfoC; - int m_iSaveListIndex; - int m_iGameListIndex; - //int *m_iConfigA; // track the texture packs that we don't have installed -#ifndef _XBOX_ONE - bool m_bSaveTransferInProgress; - bool m_bSaveTransferCancelled; -#endif - bool m_bUpdateSaveSize; - bool m_bPendingSaveSizeBarRefresh; - bool m_bPendingJoinTabAvailabilityRefresh; - bool m_bPendingJoinVisualRefresh; - bool m_bRebuildingJoinVisual; -bool m_bHasNoGamesLabel; -int m_iNewGameListIndex; -#ifdef _WINDOWS64 - int m_lastHoverMouseX; - int m_lastHoverMouseY; - bool m_mouseHoverTracked; - int m_hoverBaseIndexLoad; - int m_hoverBaseIndexCreate; - int m_hoverBaseIndexJoin; -#endif - -public: - UIScene_LoadCreateJoinMenu(int iPad, void *initData, UILayer *parentLayer); - virtual ~UIScene_LoadCreateJoinMenu(); - - virtual void updateTooltips(); - virtual void updateComponents(); - virtual UIControl* GetMainPanel(); - - virtual void handleDestroy(); - virtual void handleLoseFocus(); - virtual void handleGainFocus(bool navBack); - virtual void handleTimerComplete(int id); - // INPUT - virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); - virtual void handleFocusChange(F64 controlId, F64 childId); - virtual void handleInitFocus(F64 controlId, F64 childId); - - virtual EUIScene getSceneType() { return eUIScene_LoadCreateJoinMenu; } - - static void UpdateGamesListCallback(LPVOID pParam); -#ifdef _XBOX_ONE - void HandleDLCLicenseChange(); -#endif - virtual void tick(); - -private: - void Initialise(); - void GetSaveInfo(); - void UpdateGamesList(); - void AddDefaultButtons(); - bool DoesSavesListHaveFocus(); - bool DoesMashUpWorldHaveFocus(); - bool DoesGamesListHaveFocus(); - bool DoesNewGamesListHaveFocus(); - int GetMovieTabFromFocus(); - void SyncMovieTab(); - void SetMovieTab(int tab); - void SetActiveTab(ELoadCreateJoinTab tab, bool setFocus); - void ApplyTabVisibility(bool setFocus); - void RebuildJoinGamesListVisual(bool syncFocus); - void UpdateJoinTabAvailability(); - void UpdateSaveSizeBarVisibility(); - -protected: - // TODO: This should be pure virtual in this class - virtual wstring getMoviePath(); - -public: - static int LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); - static int LoadSaveCallback(LPVOID lpParam,bool bRes); - static int DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int SaveOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int DeleteSaveDataReturned(LPVOID lpParam,bool bRes); - static int RenameSaveDataReturned(LPVOID lpParam,bool bRes); - static int KeyboardCompleteWorldNameCallback(LPVOID lpParam,bool bRes); -#ifdef __PSVITA__ - static int MustSignInTexturePack(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int MustSignInReturnedTexturePack(void *pParam,bool bContinue, int iPad); - static int SignInAdhocReturned(void *pParam,bool bContinue, int iPad); -#endif - -protected: - void handlePress(F64 controlId, F64 childId); - void LoadLevelGen(LevelGenerationOptions *levelGen); - void LoadSaveFromDisk(File *saveFile, ESavePlatform savePlatform = SAVE_FILE_PLATFORM_LOCAL); -#if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) - void LoadSaveFromCloud(); -#endif -public: - virtual void HandleDLCMountingComplete(); - -#ifdef __ORBIS__ - void LoadRemoteFileFromDisk(char* remoteFilename); -#endif - -private: - void CheckAndJoinGame(int gameIndex); - -#ifdef _WINDOWS64 - static const int ADD_SERVER_BUTTON_INDEX = 0; - enum eAddServerPhase { eAddServer_Idle, eAddServer_IP, eAddServer_Port, eAddServer_Name }; - eAddServerPhase m_addServerPhase; - wstring m_addServerIP; - wstring m_addServerPort; - void BeginAddServer(); - void AppendServerToFile(const wstring& ip, const wstring& port, const wstring& name); - static int AddServerKeyboardCallback(LPVOID lpParam, bool bRes); -#endif - -#if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) - static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int PSN_SignInReturned(void *pParam,bool bContinue, int iPad); - static void remoteStorageGetSaveCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code); -#endif - -#ifdef __ORBIS__ - //static int PSPlusReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); -#endif -#ifdef _XBOX_ONE - typedef struct _SaveTransferStateContainer - { - int m_iProgress; - bool m_bSaveTransferInProgress; - bool m_bSaveTransferCancelled; - int m_iPad; - C4JStorage::eSaveTransferState m_eSaveTransferState; - UIScene_LoadCreateJoinMenu *m_pClass; - } SaveTransferStateContainer; - enum ESaveTransferFiles - { - eSaveTransferFile_Marker, - eSaveTransferFile_Metadata, - eSaveTransferFile_SaveData, - }; - static ESaveTransferFiles s_eSaveTransferFile; - static unsigned long s_ulFileSize; - static byteArray s_transferData; - static wstring m_wstrStageText; - LoadMenuInitData *m_loadMenuInitData; - -#ifdef _DEBUG_MENUS_ENABLED - static C4JStorage::SAVETRANSFER_FILE_DETAILS m_debugTransferDetails; -#endif - - void LaunchSaveTransfer(); - static int DownloadXbox360SaveThreadProc( LPVOID lpParameter ); - static void RequestFileSize( SaveTransferStateContainer *pClass, wchar_t *filename ); - static void RequestFileData( SaveTransferStateContainer *pClass, wchar_t *filename ); - static int SaveTransferReturned(LPVOID lpParam,C4JStorage::SAVETRANSFER_FILE_DETAILS *pSaveTransferDetails); - static int SaveTransferUpdateProgress(LPVOID lpParam,unsigned long ulBytesReceived); - static void CancelSaveTransferCallback(LPVOID lpParam); - static int NeedSyncMessageReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int CancelSaveTransferCompleteCallback(LPVOID lpParam); - -#endif - -#ifdef SONY_REMOTE_STORAGE_DOWNLOAD - enum eSaveTransferState - { - eSaveTransfer_Idle, - eSaveTransfer_Busy, - eSaveTransfer_GetRemoteSaveInfo, - eSaveTransfer_GettingRemoteSaveInfo, - eSaveTransfer_CreateDummyFile, - eSaveTransfer_CreatingDummyFile, - eSaveTransfer_GettingFileSize, - eSaveTransfer_FileSizeRetrieved, - eSaveTransfer_GetFileData, - eSaveTransfer_GettingFileData, - eSaveTransfer_FileDataRetrieved, - eSaveTransfer_GetSavesInfo, - eSaveTransfer_GettingSavesInfo, - eSaveTransfer_LoadSaveFromDisc, - eSaveTransfer_LoadingSaveFromDisc, - eSaveTransfer_CreatingNewSave, - eSaveTransfer_Converting, - eSaveTransfer_Saving, - eSaveTransfer_Succeeded, - eSaveTransfer_Cancelled, - eSaveTransfer_Error, - eSaveTransfer_ErrorDeletingSave, - eSaveTransfer_ErrorMesssage, - eSaveTransfer_Finished, - - }; - eSaveTransferState m_eSaveTransferState; - static unsigned long m_ulFileSize; - static wstring m_wstrStageText; - static bool m_bSaveTransferRunning; - int m_iProgress; - char m_downloadedUniqueFilename[64];//SCE_SAVE_DATA_DIRNAME_DATA_MAXSIZE]; - bool m_saveTransferDownloadCancelled; - void LaunchSaveTransfer(); - static int CreateDummySaveDataCallback(LPVOID lpParam,bool bRes); - static int CrossSaveGetSavesInfoCallback(LPVOID lpParam, SAVE_DETAILS *pSaveDetails,bool bRes); - static int LoadCrossSaveDataCallback(void *pParam,bool bIsCorrupt, bool bIsOwner); - static int CrossSaveFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int CrossSaveDeleteOnErrorReturned(LPVOID lpParam,bool bRes); - static int RemoteSaveNotFoundCallback(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int DownloadSonyCrossSaveThreadProc( LPVOID lpParameter ); - static void SaveTransferReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code); - static ConsoleSaveFile* SonyCrossSaveConvert(); - - static void CancelSaveTransferCallback(LPVOID lpParam); -public: - static bool isSaveTransferRunning() { return m_bSaveTransferRunning; } -private: -#endif - -#ifdef SONY_REMOTE_STORAGE_UPLOAD - enum eSaveUploadState - { - eSaveUpload_Idle, - eSaveUpload_UploadingFileData, - eSaveUpload_FileDataUploaded, - eSaveUpload_Cancelled, - eSaveUpload_Error, - esaveUpload_Finished - }; - - eSaveUploadState m_eSaveUploadState; - bool m_saveTransferUploadCancelled; - - void LaunchSaveUpload(); - static int UploadSonyCrossSaveThreadProc( LPVOID lpParameter ); - static void SaveUploadReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code); - static void CancelSaveUploadCallback(LPVOID lpParam); - static int SaveTransferDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int CrossSaveUploadFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result); -#endif - -#if defined _XBOX_ONE || defined __ORBIS__ - static int CopySaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); - static int CopySaveThreadProc( LPVOID lpParameter ); - static int CopySaveDataReturned( LPVOID lpParameter, bool success, C4JStorage::ESaveGameState state ); - static bool CopySaveDataProgress(LPVOID lpParam, int percent); - static void CancelCopySaveCallback(LPVOID lpParam); - static int CopySaveErrorDialogFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result); -#endif -}; \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp index 194e2210..32555771 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp @@ -32,13 +32,6 @@ int UIScene_LoadMenu::m_iDifficultyTitleSettingA[4]= IDS_DIFFICULTY_TITLE_HARD }; -int UIScene_LoadMenu::m_iGamemodeTitleSettingA[3]= -{ - IDS_SURVIVAL, - IDS_CREATIVE, - IDS_ADVENTURE -}; - int UIScene_LoadMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { UIScene_LoadMenu *pClass= static_cast(ui.GetSceneFromCallbackId((size_t)lpParam)); @@ -84,6 +77,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye m_labelSeed.init(L""); m_labelCreatedMode.init(app.GetString(IDS_CREATED_IN_SURVIVAL)); + m_buttonGamemode.init(app.GetString(IDS_GAMEMODE_SURVIVAL),eControl_GameMode); m_buttonMoreOptions.init(app.GetString(IDS_MORE_OPTIONS),eControl_MoreOptions); m_buttonLoadWorld.init(app.GetString(IDS_LOAD),eControl_LoadWorld); m_texturePackList.init(app.GetString(IDS_DLC_MENU_TEXTUREPACKS), eControl_TexturePackList); @@ -96,9 +90,6 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)])); m_sliderDifficulty.init(TempString,eControl_Difficulty,0,3,app.GetGameSettings(m_iPad,eGameSetting_Difficulty)); - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[0])); - m_sliderGamemode.init(TempString,eControl_GameModeToggle,0,2,0); - m_MoreOptionsParams.bGenerateOptions=FALSE; m_MoreOptionsParams.bPVP = TRUE; m_MoreOptionsParams.bTrust = TRUE; @@ -446,7 +437,7 @@ void UIScene_LoadMenu::tick() if( m_bThumbnailGetFailed ) { // On Durango, this can happen if a save is still not been synchronised (user cancelled, or some error). Return back to give them a choice to pick another save. - ui.NavigateBack(m_iPad, false, eUIScene_LoadCreateJoinMenu); + ui.NavigateBack(m_iPad, false, eUIScene_LoadOrJoinMenu); return; } @@ -538,28 +529,26 @@ void UIScene_LoadMenu::tick() m_labelCreatedMode.setLabel( app.GetString(IDS_CREATED_IN_SURVIVAL) ); } - switch (app.GetGameHostOption(uiHostOptions, eGameHostOption_GameType)) + switch(app.GetGameHostOption(uiHostOptions,eGameHostOption_GameType)) { case 1: // Creative - m_sliderGamemode.setLabel(app.GetString(IDS_GAMEMODE_CREATIVE)); - m_bGameModeCreative = true; + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_CREATIVE)); + m_bGameModeCreative=true; m_iGameModeId = GameType::CREATIVE->getId(); break; case 2: // Adventure - m_sliderGamemode.setLabel(app.GetString(IDS_GAMEMODE_ADVENTURE)); - m_bGameModeCreative = false; + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_ADVENTURE)); + m_bGameModeCreative=false; m_iGameModeId = GameType::ADVENTURE->getId(); break; case 0: // Survival default: - m_sliderGamemode.setLabel(app.GetString(IDS_GAMEMODE_SURVIVAL)); - m_bGameModeCreative = false; + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_SURVIVAL)); + m_bGameModeCreative=false; m_iGameModeId = GameType::SURVIVAL->getId(); break; }; - m_sliderGamemode.SetSliderValue(m_iGameModeId); - bool bGameSetting_Online=(app.GetGameSettings(m_iPad,eGameSetting_Online)!=0); if(app.GetGameHostOption(uiHostOptions,eGameHostOption_FriendsOfFriends) && !(m_bMultiplayerAllowed && bGameSetting_Online)) { @@ -717,6 +706,26 @@ void UIScene_LoadMenu::handlePress(F64 controlId, F64 childId) switch(static_cast(controlId)) { + case eControl_GameMode: + switch(m_iGameModeId) + { + case 0: // Survival + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_CREATIVE)); + m_iGameModeId = GameType::CREATIVE->getId(); + m_bGameModeCreative = true; + break; + case 1: // Creative + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_ADVENTURE)); + m_iGameModeId = GameType::ADVENTURE->getId(); + m_bGameModeCreative = false; + break; + case 2: // Adventure + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_SURVIVAL)); + m_iGameModeId = GameType::SURVIVAL->getId(); + m_bGameModeCreative = false; + break; + }; + break; case eControl_MoreOptions: ui.NavigateToScene(m_iPad, eUIScene_LaunchMoreOptionsMenu, &m_MoreOptionsParams); break; @@ -953,28 +962,6 @@ void UIScene_LoadMenu::handleSliderMove(F64 sliderId, F64 currentValue) swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[value])); m_sliderDifficulty.setLabel(TempString); break; - case eControl_GameModeToggle: - m_sliderGamemode.handleSliderMove(value); - - if (value == 1) - { - m_bGameModeCreative=true; - m_iGameModeId = GameType::CREATIVE->getId(); - } - else if (value == 2) - { - m_bGameModeCreative=false; - m_iGameModeId = GameType::ADVENTURE->getId(); - } - else - { - m_bGameModeCreative=false; - m_iGameModeId = GameType::SURVIVAL->getId(); - } - - swprintf( (WCHAR *)TempString, 256, L"%ls: %ls", app.GetString( IDS_SLIDER_GAMEMODE ),app.GetString(m_iGamemodeTitleSettingA[value])); - m_sliderGamemode.setLabel(TempString); - break; } } diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadMenu.h index 8faf02ee..53d66d55 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.h @@ -7,7 +7,7 @@ class UIScene_LoadMenu : public IUIScene_StartGame private: enum EControls { - eControl_GameModeToggle, + eControl_GameMode, eControl_Difficulty, eControl_MoreOptions, eControl_LoadWorld, @@ -16,12 +16,11 @@ private: }; static int m_iDifficultyTitleSettingA[4]; - static int m_iGamemodeTitleSettingA[3]; UIControl m_controlMainPanel; UIControl_Label m_labelGameName, m_labelSeed, m_labelCreatedMode; - UIControl_Button m_buttonMoreOptions, m_buttonLoadWorld; - UIControl_Slider m_sliderGamemode, m_sliderDifficulty; + UIControl_Button m_buttonGamemode, m_buttonMoreOptions, m_buttonLoadWorld; + UIControl_Slider m_sliderDifficulty; UIControl_BitmapIcon m_bitmapIcon; UIControl_CheckBox m_checkboxOnline; @@ -33,7 +32,7 @@ private: UI_MAP_ELEMENT( m_labelCreatedMode, "CreatedMode") UI_MAP_ELEMENT( m_labelSeed, "Seed") UI_MAP_ELEMENT( m_texturePackList, "TexturePackSelector") - UI_MAP_ELEMENT( m_sliderGamemode, "GameModeToggle") + UI_MAP_ELEMENT( m_buttonGamemode, "GameModeToggle") UI_MAP_ELEMENT( m_checkboxOnline, "CheckboxOnline") UI_MAP_ELEMENT( m_buttonMoreOptions, "MoreOptions") UI_MAP_ELEMENT( m_buttonLoadWorld, "LoadSettings") diff --git a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenuTest.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp similarity index 51% rename from Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenuTest.cpp rename to Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index 767df71e..c5652f64 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenuTest.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "UI.h" -#include "UIScene_LoadCreateJoinMenu.h" +#include "UIScene_LoadOrJoinMenu.h" #include "..\..\..\Minecraft.World\StringHelpers.h" #include "..\..\..\Minecraft.World\net.minecraft.world.item.h" @@ -31,83 +31,62 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) { - // Check for a worldname.txt sidecar written by the rename feature first - size_t slashPos = filePath.rfind(L'\\'); - if (slashPos != wstring::npos) - { - wstring sidecarPath = filePath.substr(0, slashPos + 1) + L"worldname.txt"; - FILE *fr = nullptr; - if (_wfopen_s(&fr, sidecarPath.c_str(), L"r") == 0 && fr) - { - char buf[128] = {}; - if (fgets(buf, sizeof(buf), fr)) - { - int len = static_cast(strlen(buf)); - while (len > 0 && (buf[len-1] == '\n' || buf[len-1] == '\r' || buf[len-1] == ' ')) - buf[--len] = '\0'; - fclose(fr); - if (len > 0) - { - wchar_t wbuf[128] = {}; - mbstowcs(wbuf, buf, 127); - return wstring(wbuf); - } - } - else fclose(fr); - } - } - HANDLE hFile = CreateFileW(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); if (hFile == INVALID_HANDLE_VALUE) return L""; DWORD fileSize = GetFileSize(hFile, nullptr); - if (fileSize < 12 || fileSize == INVALID_FILE_SIZE) { CloseHandle(hFile); return L""; } - - unsigned char *rawData = new unsigned char[fileSize]; - DWORD bytesRead = 0; - if (!ReadFile(hFile, rawData, fileSize, &bytesRead, nullptr) || bytesRead != fileSize) + if (fileSize < 12 || fileSize == INVALID_FILE_SIZE) { CloseHandle(hFile); - delete[] rawData; return L""; } + + std::vector rawData(fileSize); + DWORD bytesRead = 0; + + if (!ReadFile(hFile, rawData.data(), fileSize, &bytesRead, nullptr) || bytesRead != fileSize) + { + CloseHandle(hFile); + return L""; + } + CloseHandle(hFile); - unsigned char *saveData = nullptr; - unsigned int saveSize = 0; - bool freeSaveData = false; + std::vector decompressedData; + uint8_t* saveData = nullptr; + unsigned int saveSize = 0; - if (*(unsigned int*)rawData == 0) + if (*reinterpret_cast(rawData.data()) == 0) { // Compressed format: bytes 0-3=0, bytes 4-7=decompressed size, bytes 8+=compressed data - unsigned int decompSize = *(unsigned int*)(rawData + 4); + unsigned int decompSize = *reinterpret_cast(rawData.data() + 4); if (decompSize == 0 || decompSize > 128 * 1024 * 1024) { - delete[] rawData; return L""; } - saveData = new unsigned char[decompSize]; - Compression::getCompression()->Decompress(saveData, &decompSize, rawData + 8, fileSize - 8); - saveSize = decompSize; - freeSaveData = true; + decompressedData.resize(decompSize); + Compression::getCompression()->Decompress(decompressedData.data(), &decompSize, rawData.data() + 8, fileSize - 8); + + saveData = decompressedData.data(); + saveSize = decompSize; } else { - saveData = rawData; + saveData = rawData.data(); saveSize = fileSize; } wstring result = L""; if (saveSize >= 12) { - unsigned int headerOffset = *(unsigned int*)saveData; - unsigned int numEntries = *(unsigned int*)(saveData + 4); + unsigned int headerOffset = *reinterpret_cast(saveData); + unsigned int numEntries = *reinterpret_cast(saveData + 4); const unsigned int entrySize = sizeof(FileEntrySaveData); if (headerOffset < saveSize && numEntries > 0 && numEntries < 10000 && headerOffset + numEntries * entrySize <= saveSize) { - FileEntrySaveData *table = (FileEntrySaveData *)(saveData + headerOffset); + auto* table = reinterpret_cast(saveData + headerOffset); for (unsigned int i = 0; i < numEntries; i++) { if (wcscmp(table[i].filename, L"level.dat") == 0) @@ -117,15 +96,15 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) if (off >= 12 && off + len <= saveSize && len > 0 && len < 4 * 1024 * 1024) { byteArray ba; - ba.data = (BYTE*)(saveData + off); + ba.data = saveData + off; ba.length = len; - CompoundTag *root = NbtIo::decompress(ba); + + std::unique_ptr root(NbtIo::decompress(ba)); if (root != nullptr) { - CompoundTag *dataTag = root->getCompound(L"Data"); + CompoundTag* dataTag = root->getCompound(L"Data"); if (dataTag != nullptr) result = dataTag->getString(L"LevelName"); - delete root; } } break; @@ -134,10 +113,8 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) } } - if (freeSaveData) delete[] saveData; - delete[] rawData; - // "world" is the engine default - it means no real name was ever set, - // so return empty to let the caller fall back to the save filename (timestamp). + // "world" is the engine default — it means no real name was ever set, so + // return empty to let the caller fall back to the save filename (timestamp). if (result == L"world") result = L""; return result; } @@ -145,9 +122,9 @@ static wstring ReadLevelNameFromSaveFile(const wstring& filePath) #ifdef SONY_REMOTE_STORAGE_DOWNLOAD -unsigned long UIScene_LoadCreateJoinMenu::m_ulFileSize=0L; -wstring UIScene_LoadCreateJoinMenu::m_wstrStageText=L""; -bool UIScene_LoadCreateJoinMenu::m_bSaveTransferRunning = false; +unsigned long UIScene_LoadOrJoinMenu::m_ulFileSize=0L; +wstring UIScene_LoadOrJoinMenu::m_wstrStageText=L""; +bool UIScene_LoadOrJoinMenu::m_bSaveTransferRunning = false; #endif @@ -160,19 +137,19 @@ bool UIScene_LoadCreateJoinMenu::m_bSaveTransferRunning = false; #endif #ifdef _XBOX_ONE -UIScene_LoadCreateJoinMenu::ESaveTransferFiles UIScene_LoadCreateJoinMenu::s_eSaveTransferFile; -unsigned long UIScene_LoadCreateJoinMenu::s_ulFileSize=0L; -byteArray UIScene_LoadCreateJoinMenu::s_transferData = byteArray(); -wstring UIScene_LoadCreateJoinMenu::m_wstrStageText=L""; +UIScene_LoadOrJoinMenu::ESaveTransferFiles UIScene_LoadOrJoinMenu::s_eSaveTransferFile; +unsigned long UIScene_LoadOrJoinMenu::s_ulFileSize=0L; +byteArray UIScene_LoadOrJoinMenu::s_transferData = byteArray(); +wstring UIScene_LoadOrJoinMenu::m_wstrStageText=L""; #ifdef _DEBUG_MENUS_ENABLED -C4JStorage::SAVETRANSFER_FILE_DETAILS UIScene_LoadCreateJoinMenu::m_debugTransferDetails; +C4JStorage::SAVETRANSFER_FILE_DETAILS UIScene_LoadOrJoinMenu::m_debugTransferDetails; #endif #endif -int UIScene_LoadCreateJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) +int UIScene_LoadOrJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { - UIScene_LoadCreateJoinMenu *pClass= static_cast(lpParam); + UIScene_LoadOrJoinMenu *pClass= static_cast(lpParam); app.DebugPrintf("Received data for save thumbnail\n"); @@ -184,18 +161,21 @@ int UIScene_LoadCreateJoinMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBY } else { - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = nullptr; - pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].dwThumbnailSize = 0; app.DebugPrintf("Save thumbnail data is nullptr, or has size 0\n"); + + wstring wsName = L"Graphics\\MinecraftIcon.png"; + byteArray baIcon = app.getArchiveFile(wsName); + pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].pbThumbnailData = baIcon.data; + pClass->m_saveDetails[pClass->m_iRequestingThumbnailId].dwThumbnailSize = baIcon.length; } pClass->m_bSaveThumbnailReady = true; return 0; } -int UIScene_LoadCreateJoinMenu::LoadSaveCallback(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::LoadSaveCallback(LPVOID lpParam,bool bRes) { - //UIScene_LoadCreateJoinMenu *pClass= (UIScene_LoadCreateJoinMenu *)lpParam; + //UIScene_LoadOrJoinMenu *pClass= (UIScene_LoadOrJoinMenu *)lpParam; // Get the save data now if(bRes) { @@ -204,7 +184,7 @@ int UIScene_LoadCreateJoinMenu::LoadSaveCallback(LPVOID lpParam,bool bRes) return 0; } -UIScene_LoadCreateJoinMenu::UIScene_LoadCreateJoinMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) +UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { constexpr uint64_t MAXIMUM_SAVE_STORAGE = 4LL * 1024LL * 1024LL * 1024LL; @@ -221,17 +201,15 @@ UIScene_LoadCreateJoinMenu::UIScene_LoadCreateJoinMenu(int iPad, void *initData, m_iState=e_SavesIdle; //m_bRetrievingSaveInfo=false; - m_buttonListLoad.init(eControl_LoadList); - m_buttonListJoin.init(eControl_JoinList); + m_buttonListSaves.init(eControl_SavesList); + m_buttonListGames.init(eControl_GamesList); - m_labelLoadListTitle.init( IDS_LOAD ); - m_labelNewListTitle.init( IDS_TOOLTIPS_CREATE ); - m_labelJoinListTitle.init( L"Join" ); -// m_labelNoGames.init( IDS_NO_GAMES_FOUND ); -// m_labelNoGames.setVisible( false ); - m_controlLoadTimer.setVisible( false ); - m_controlNewTimer.setVisible( false ); - m_controlJoinTimer.setVisible( false ); + m_labelSavesListTitle.init( IDS_START_GAME ); + m_labelJoinListTitle.init( IDS_JOIN_GAME ); + m_labelNoGames.init( IDS_NO_GAMES_FOUND ); + m_labelNoGames.setVisible( false ); + m_controlSavesTimer.setVisible( true ); + m_controlJoinTimer.setVisible( true ); #if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) m_spaceIndicatorSaves.init(L"",eControl_SpaceIndicator,0, MAXIMUM_SAVE_STORAGE); @@ -247,21 +225,21 @@ UIScene_LoadCreateJoinMenu::UIScene_LoadCreateJoinMenu(int iPad, void *initData, m_saveDetails = nullptr; m_iSaveDetailsCount = 0; m_iTexturePacksNotInstalled = 0; - m_bCopying = false; - m_bCopyingCancelled = false; + m_bCopying = false; + m_bCopyingCancelled = false; #ifndef _XBOX_ONE m_bSaveTransferCancelled=false; m_bSaveTransferInProgress=false; #endif - m_eAction = eAction_None; + m_eAction = eAction_None; m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); #ifdef _XBOX_ONE - // 4J-PB - in order to buy the skin packs & texture packs, we need the signed offer ids for them, which we get in the availability info - // we need to retrieve this info though, so do it here - app.AddDLCRequest(e_Marketplace_Content); // content is skin packs, texture packs and mash-up packs + // 4J-PB - in order to buy the skin packs & texture packs, we need the signed offer ids for them, which we get in the availability info + // we need to retrieve this info though, so do it here + app.AddDLCRequest(e_Marketplace_Content); // content is skin packs, texture packs and mash-up packs #endif int iLB = -1; @@ -298,7 +276,7 @@ UIScene_LoadCreateJoinMenu::UIScene_LoadCreateJoinMenu(int iPad, void *initData, #ifdef __PSVITA__ if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) { - g_NetworkManager.startAdhocMatching(); // create the client matching context and clear out the friends list + g_NetworkManager.startAdhocMatching(); // create the client matching context and clear out the friends list } #endif @@ -399,7 +377,7 @@ UIScene_LoadCreateJoinMenu::UIScene_LoadCreateJoinMenu(int iPad, void *initData, } -UIScene_LoadCreateJoinMenu::~UIScene_LoadCreateJoinMenu() +UIScene_LoadOrJoinMenu::~UIScene_LoadOrJoinMenu() { g_NetworkManager.SetSessionsUpdatedCallback( nullptr, nullptr ); app.SetLiveLinkRequired( false ); @@ -427,14 +405,14 @@ UIScene_LoadCreateJoinMenu::~UIScene_LoadCreateJoinMenu() } } -void UIScene_LoadCreateJoinMenu::updateTooltips() +void UIScene_LoadOrJoinMenu::updateTooltips() { #if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ - if(m_eSaveTransferState!=eSaveTransfer_Idle) - { - // we're in a full screen progress for the save download here, so don't change the tooltips - return; - } + if(m_eSaveTransferState!=eSaveTransfer_Idle) + { + // we're in a full screen progress for the save download here, so don't change the tooltips + return; + } #endif // update the tooltips @@ -444,7 +422,7 @@ void UIScene_LoadCreateJoinMenu::updateTooltips() int iY = -1; int iLB = -1; int iX=-1; - if (DoesGamesListHaveFocus() && m_buttonListJoin.getItemCount() > 0) + if (DoesGamesListHaveFocus() && m_buttonListGames.getItemCount() > 0) { iY = IDS_TOOLTIPS_VIEW_GAMERCARD; } @@ -469,11 +447,11 @@ void UIScene_LoadCreateJoinMenu::updateTooltips() } } } - else if(DoesMashUpWorldHaveFocus()) - { - // If it's a mash-up pack world, give the Hide option - iRB=IDS_TOOLTIPS_HIDE; - } + else if(DoesMashUpWorldHaveFocus()) + { + // If it's a mash-up pack world, give the Hide option + iRB=IDS_TOOLTIPS_HIDE; + } if(m_bInParty) { @@ -498,22 +476,22 @@ void UIScene_LoadCreateJoinMenu::updateTooltips() else { #if defined _XBOX_ONE - if(ProfileManager.IsSignedInLive( m_iPad )) - { - // Is there a save from 360 on TMS? - iX=IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD; - } + if(ProfileManager.IsSignedInLive( m_iPad )) + { + // Is there a save from 360 on TMS? + iX=IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD; + } #elif defined SONY_REMOTE_STORAGE_DOWNLOAD // Is there a save from PS3 or PSVita available? - // Sony asked that this be displayed at all times so users are aware of the functionality. We'll display some text when there's no save available + // Sony asked that this be displayed at all times so users are aware of the functionality. We'll display some text when there's no save available //if(app.getRemoteStorage()->saveIsAvailable()) - { - bool bSignedInLive = ProfileManager.IsSignedInLive(m_iPad); - if(bSignedInLive) - { - iX=IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD; - } - } + { + bool bSignedInLive = ProfileManager.IsSignedInLive(m_iPad); + if(bSignedInLive) + { + iX=IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD; + } + } #else iX = IDS_TOOLTIPS_CHANGEDEVICE; #endif @@ -523,16 +501,16 @@ void UIScene_LoadCreateJoinMenu::updateTooltips() } // -void UIScene_LoadCreateJoinMenu::Initialise() +void UIScene_LoadOrJoinMenu::Initialise() { m_iSaveListIndex = 0; - m_iGameListIndex = 0; + m_iGameListIndex = 0; #ifdef _WINDOWS64 - m_addServerPhase = eAddServer_Idle; + m_addServerPhase = eAddServer_Idle; #endif m_iDefaultButtonsC = 0; - m_iMashUpButtonsC=0; + m_iMashUpButtonsC=0; // Check if we're in the trial version if(ProfileManager.IsFullVersion()==false) @@ -565,7 +543,7 @@ void UIScene_LoadCreateJoinMenu::Initialise() else { AddDefaultButtons(); - m_controlLoadTimer.setVisible( false ); + m_controlSavesTimer.setVisible( false ); } #endif #endif // __PS3__ || __ORBIS @@ -582,25 +560,25 @@ void UIScene_LoadCreateJoinMenu::Initialise() app.m_dlcManager.checkForCorruptDLCAndAlert(); } -void UIScene_LoadCreateJoinMenu::updateComponents() +void UIScene_LoadOrJoinMenu::updateComponents() { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); } -void UIScene_LoadCreateJoinMenu::handleDestroy() +void UIScene_LoadOrJoinMenu::handleDestroy() { #ifdef __PSVITA__ - app.DebugPrintf("missing InputManager.DestroyKeyboard on Vita !!!!!!\n"); + app.DebugPrintf("missing InputManager.DestroyKeyboard on Vita !!!!!!\n"); #endif - // shut down the keyboard if it is displayed + // shut down the keyboard if it is displayed #if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO) - InputManager.DestroyKeyboard(); + InputManager.DestroyKeyboard(); #endif } -void UIScene_LoadCreateJoinMenu::handleGainFocus(bool navBack) +void UIScene_LoadOrJoinMenu::handleGainFocus(bool navBack) { UIScene::handleGainFocus(navBack); @@ -627,8 +605,8 @@ void UIScene_LoadCreateJoinMenu::handleGainFocus(bool navBack) else { m_bIgnoreInput=true; - m_buttonListLoad.clearList(); - m_controlLoadTimer.setVisible(true); + m_buttonListSaves.clearList(); + m_controlSavesTimer.setVisible(true); } if( m_bMultiplayerAllowed ) @@ -646,9 +624,9 @@ void UIScene_LoadCreateJoinMenu::handleGainFocus(bool navBack) } else { - m_buttonListJoin.clearList(); + m_buttonListGames.clearList(); m_controlJoinTimer.setVisible(true); - //m_labelNoGames.setVisible(false); + m_labelNoGames.setVisible(false); #if TO_BE_IMPLEMENTED m_SavesList.InitFocus(m_iPad); #endif @@ -665,18 +643,18 @@ void UIScene_LoadCreateJoinMenu::handleGainFocus(bool navBack) } } -void UIScene_LoadCreateJoinMenu::handleLoseFocus() +void UIScene_LoadOrJoinMenu::handleLoseFocus() { // Kill load online timer killTimer(JOIN_LOAD_ONLINE_TIMER_ID); } -wstring UIScene_LoadCreateJoinMenu::getMoviePath() +wstring UIScene_LoadOrJoinMenu::getMoviePath() { - return L"LoadCreateJoinMenu"; + return L"LoadOrJoinMenu"; } -void UIScene_LoadCreateJoinMenu::tick() +void UIScene_LoadOrJoinMenu::tick() { UIScene::tick(); @@ -693,9 +671,9 @@ void UIScene_LoadCreateJoinMenu::tick() if(hasFocus(m_iPad)) { #ifdef SONY_REMOTE_STORAGE_DOWNLOAD - // if the loadCreateJoin menu has focus again, we can clear the saveTransfer flag now. Added so we can delay the ehternet disconnect till it's cleaned up - if(m_eSaveTransferState == eSaveTransfer_Idle) - m_bSaveTransferRunning = false; + // if the loadCreateJoin menu has focus again, we can clear the saveTransfer flag now. Added so we can delay the ehternet disconnect till it's cleaned up + if(m_eSaveTransferState == eSaveTransfer_Idle) + m_bSaveTransferRunning = false; #endif #if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) if(m_bUpdateSaveSize) @@ -741,14 +719,14 @@ void UIScene_LoadCreateJoinMenu::tick() m_iSaveDetailsCount = m_pSaveDetails->iSaveC; #ifdef _WINDOWS64 - // Build sorted index array (newest-first by filename timestamp YYYYMMDDHHMMSS) + // Sort index array by lastWriteTime int *sortedIdx = new int[m_pSaveDetails->iSaveC]; for (int si = 0; si < (int)m_pSaveDetails->iSaveC; ++si) sortedIdx[si] = si; for (int si = 1; si < (int)m_pSaveDetails->iSaveC; ++si) { int key = sortedIdx[si]; int sj = si - 1; - while (sj >= 0 && strcmp(m_pSaveDetails->SaveInfoA[sortedIdx[sj]].UTF8SaveFilename, m_pSaveDetails->SaveInfoA[key].UTF8SaveFilename) < 0) + while (sj >= 0 && CompareFileTime(&m_pSaveDetails->SaveInfoA[sortedIdx[sj]].lastWriteTime, &m_pSaveDetails->SaveInfoA[key].lastWriteTime) < 0) { sortedIdx[sj + 1] = sortedIdx[sj]; --sj; @@ -762,10 +740,16 @@ void UIScene_LoadCreateJoinMenu::tick() m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].totalSize); #elif defined(_WINDOWS64) int origIdx = sortedIdx[i]; + wchar_t wFilename[MAX_SAVEFILENAME_LENGTH]; ZeroMemory(wFilename, sizeof(wFilename)); - mbstowcs(wFilename, m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); - wstring filePath = wstring(L"Windows64\\GameHDD\\") + wstring(wFilename) + wstring(L"\\saveData.ms"); + mbstowcs_s(nullptr, wFilename, MAX_SAVEFILENAME_LENGTH, m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveFilename, _TRUNCATE); + + wchar_t wSaveTitle[MAX_DISPLAYNAME_LENGTH]; + ZeroMemory(wSaveTitle, sizeof(wSaveTitle)); + mbstowcs_s(nullptr, wSaveTitle, MAX_DISPLAYNAME_LENGTH, m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveTitle, _TRUNCATE); + + wstring filePath = wstring(L"Data/Saves") + wstring(wFilename) + std::wstring(wSaveTitle) + L".ms"; HANDLE hFile = CreateFileW(filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, nullptr); DWORD fileSize = 0; @@ -780,7 +764,7 @@ void UIScene_LoadCreateJoinMenu::tick() m_spaceIndicatorSaves.addSave(m_pSaveDetails->SaveInfoA[i].blocksUsed * (32 * 1024) ); #endif #ifdef _DURANGO - m_buttonListLoad.AddNewItem(1, m_pSaveDetails->SaveInfoA[i].UTF16SaveTitle, L""); + m_buttonListSaves.addItem(m_pSaveDetails->SaveInfoA[i].UTF16SaveTitle, L""); m_saveDetails[i].saveId = i; memcpy(m_saveDetails[i].UTF16SaveName, m_pSaveDetails->SaveInfoA[i].UTF16SaveTitle, 128); @@ -792,20 +776,20 @@ void UIScene_LoadCreateJoinMenu::tick() if (!levelName.empty()) { - m_buttonListLoad.AddNewItem(1, levelName, wstring(L"")); - wcstombs(m_saveDetails[i].UTF8SaveName, levelName.c_str(), 127); + m_buttonListSaves.addItem(levelName, wstring(L"")); + wcstombs_s(nullptr, m_saveDetails[i].UTF8SaveName, 127, levelName.c_str(), _TRUNCATE); m_saveDetails[i].UTF8SaveName[127] = '\0'; } else { - m_buttonListLoad.AddNewItem(1, levelName, L""); + m_buttonListSaves.addItem(m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveTitle, L""); memcpy(m_saveDetails[i].UTF8SaveName, m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveTitle, 128); } m_saveDetails[i].saveId = origIdx; memcpy(m_saveDetails[i].UTF8SaveFilename, m_pSaveDetails->SaveInfoA[origIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH); } #else - m_buttonListLoad.AddNewItem(1, m_pSaveDetails->SaveInfoA[i].UTF8SaveTitle, L""); + m_buttonListSaves.addItem(m_pSaveDetails->SaveInfoA[i].UTF8SaveTitle, L""); memcpy(m_saveDetails[i].UTF8SaveName, m_pSaveDetails->SaveInfoA[i].UTF8SaveTitle, 128); m_saveDetails[i].saveId = i; memcpy(m_saveDetails[i].UTF8SaveFilename, m_pSaveDetails->SaveInfoA[i].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH); @@ -815,16 +799,16 @@ void UIScene_LoadCreateJoinMenu::tick() #ifdef _WINDOWS64 delete[] sortedIdx; #endif - m_controlLoadTimer.setVisible( false ); + m_controlSavesTimer.setVisible( false ); // set focus on the first button - } + } } if(!m_bExitScene && m_bSavesDisplayed && !m_bRetrievingSaveThumbnails && !m_bAllLoaded) { - if( m_iRequestingThumbnailId < (m_buttonListLoad.getItemCount() - m_iDefaultButtonsC )) + if( m_iRequestingThumbnailId < (m_buttonListSaves.getItemCount() - m_iDefaultButtonsC )) { m_bRetrievingSaveThumbnails = true; app.DebugPrintf("Requesting the first thumbnail\n"); @@ -889,10 +873,10 @@ void UIScene_LoadCreateJoinMenu::tick() { registerSubstitutionTexture((wchar_t *)u16Message,m_saveDetails[m_iRequestingThumbnailId].pbThumbnailData,m_saveDetails[m_iRequestingThumbnailId].dwThumbnailSize); } - m_buttonListLoad.SetTextureName(m_iRequestingThumbnailId + m_iDefaultButtonsC, (wchar_t *)u16Message); + m_buttonListSaves.setTextureName(m_iRequestingThumbnailId + m_iDefaultButtonsC, (wchar_t *)u16Message); ++m_iRequestingThumbnailId; - if( m_iRequestingThumbnailId < (m_buttonListLoad.getItemCount() - m_iDefaultButtonsC )) + if( m_iRequestingThumbnailId < (m_buttonListSaves.getItemCount() - m_iDefaultButtonsC )) { app.DebugPrintf("Requesting another thumbnail\n"); // set the save to load @@ -935,26 +919,26 @@ void UIScene_LoadCreateJoinMenu::tick() m_iRequestingThumbnailId = 0; GetSaveInfo(); break; - case e_SavesRepopulateAfterMashupHide: + case e_SavesRepopulateAfterMashupHide: m_bIgnoreInput = false; m_iRequestingThumbnailId = 0; m_bAllLoaded=false; m_bRetrievingSaveThumbnails=false; m_bSavesDisplayed=false; m_iSaveInfoC=0; - m_buttonListLoad.clearList(); + m_buttonListSaves.clearList(); GetSaveInfo(); m_iState=e_SavesIdle; - break; + break; case e_SavesRepopulateAfterDelete: - case e_SavesRepopulateAfterTransferDownload: + case e_SavesRepopulateAfterTransferDownload: m_bIgnoreInput = false; m_iRequestingThumbnailId = 0; m_bAllLoaded=false; m_bRetrievingSaveThumbnails=false; m_bSavesDisplayed=false; m_iSaveInfoC=0; - m_buttonListLoad.clearList(); + m_buttonListSaves.clearList(); StorageManager.ClearSavesInfo(); GetSaveInfo(); m_iState=e_SavesIdle; @@ -965,53 +949,53 @@ void UIScene_LoadCreateJoinMenu::tick() { AddDefaultButtons(); m_bSavesDisplayed=true; - m_controlLoadTimer.setVisible( false ); + m_controlSavesTimer.setVisible( false ); } #endif #ifdef _XBOX_ONE - if(g_NetworkManager.ShouldMessageForFullSession()) - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage( IDS_CONNECTION_FAILED, IDS_IN_PARTY_SESSION_FULL, uiIDA,1,ProfileManager.GetPrimaryPad()); - } + if(g_NetworkManager.ShouldMessageForFullSession()) + { + UINT uiIDA[1]; + uiIDA[0]=IDS_CONFIRM_OK; + ui.RequestErrorMessage( IDS_CONNECTION_FAILED, IDS_IN_PARTY_SESSION_FULL, uiIDA,1,ProfileManager.GetPrimaryPad()); + } #endif // SAVE TRANSFERS #ifdef __ORBIS__ - // check the status of the PSPlus common dialog - switch (sceNpCommerceDialogUpdateStatus()) - { - case SCE_COMMON_DIALOG_STATUS_FINISHED: - { - SceNpCommerceDialogResult Result; - sceNpCommerceDialogGetResult(&Result); - sceNpCommerceDialogTerminate(); + // check the status of the PSPlus common dialog + switch (sceNpCommerceDialogUpdateStatus()) + { + case SCE_COMMON_DIALOG_STATUS_FINISHED: + { + SceNpCommerceDialogResult Result; + sceNpCommerceDialogGetResult(&Result); + sceNpCommerceDialogTerminate(); - if(Result.authorized) - { - // they just became a PSPlus member - ProfileManager.PsPlusUpdate(ProfileManager.GetPrimaryPad(), &Result); + if(Result.authorized) + { + // they just became a PSPlus member + ProfileManager.PsPlusUpdate(ProfileManager.GetPrimaryPad(), &Result); - } - else - { + } + else + { - } + } - // 4J-JEV: Fix for PS4 #5148 - [ONLINE] If the user attempts to join a game when they do not have Playstation Plus, the title will lose all functionality. - m_bIgnoreInput = false; - } - break; - default: - break; - } + // 4J-JEV: Fix for PS4 #5148 - [ONLINE] If the user attempts to join a game when they do not have Playstation Plus, the title will lose all functionality. + m_bIgnoreInput = false; + } + break; + default: + break; + } #endif } -void UIScene_LoadCreateJoinMenu::GetSaveInfo() +void UIScene_LoadOrJoinMenu::GetSaveInfo() { unsigned int uiSaveC=0; @@ -1020,7 +1004,7 @@ void UIScene_LoadCreateJoinMenu::GetSaveInfo() if(app.DebugSettingsOn() && app.GetLoadSavesFromFolderEnabled()) { #ifdef __ORBIS__ - // We need to make sure this is non-null so that we have an idea of free space + // We need to make sure this is non-null so that we have an idea of free space m_pSaveDetails=StorageManager.ReturnSavesInfo(); if(m_pSaveDetails==nullptr) { @@ -1057,7 +1041,7 @@ void UIScene_LoadCreateJoinMenu::GetSaveInfo() name[j] = wName[j]; } name[wName.size()] = 0; - m_buttonListLoad.AddNewItem(1, name,L""); + m_buttonListSaves.addItem(name,L""); } m_bSavesDisplayed = true; m_bAllLoaded = true; @@ -1067,9 +1051,9 @@ void UIScene_LoadCreateJoinMenu::GetSaveInfo() { // clear the saves list m_bSavesDisplayed = false; // we're blocking the exit from this scene until complete - m_buttonListLoad.clearList(); + m_buttonListSaves.clearList(); m_iSaveInfoC=0; - m_controlLoadTimer.setVisible(true); + m_controlSavesTimer.setVisible(true); m_pSaveDetails=StorageManager.ReturnSavesInfo(); if(m_pSaveDetails==nullptr) @@ -1082,7 +1066,7 @@ void UIScene_LoadCreateJoinMenu::GetSaveInfo() if(eSGIStatus==C4JStorage::ESGIStatus_NoSaves) { uiSaveC=0; - m_controlLoadTimer.setVisible( false ); + m_controlSavesTimer.setVisible( false ); m_SavesList.SetEnable(TRUE); } #endif @@ -1091,13 +1075,13 @@ void UIScene_LoadCreateJoinMenu::GetSaveInfo() return; } -void UIScene_LoadCreateJoinMenu::AddDefaultButtons() +void UIScene_LoadOrJoinMenu::AddDefaultButtons() { m_iDefaultButtonsC = 0; - m_iMashUpButtonsC=0; - m_generators.clear(); + m_iMashUpButtonsC=0; + m_generators.clear(); - m_buttonListLoad.AddNewItem(1, app.GetString(IDS_CREATE_NEW_WORLD), L"test"); + m_buttonListSaves.addItem(app.GetString(IDS_CREATE_NEW_WORLD)); m_iDefaultButtonsC++; int i = 0; @@ -1107,26 +1091,26 @@ void UIScene_LoadCreateJoinMenu::AddDefaultButtons() // retrieve the save icon from the texture pack, if there is one unsigned int uiTexturePackID=levelGen->getRequiredTexturePackId(); - if(uiTexturePackID!=0) - { - unsigned int uiMashUpWorldsBitmask=app.GetMashupPackWorlds(m_iPad); + if(uiTexturePackID!=0) + { + unsigned int uiMashUpWorldsBitmask=app.GetMashupPackWorlds(m_iPad); - if((uiMashUpWorldsBitmask & (1<<(uiTexturePackID-1024)))==0) - { - // this world is hidden, so skip - continue; - } - } + if((uiMashUpWorldsBitmask & (1<<(uiTexturePackID-1024)))==0) + { + // this world is hidden, so skip + continue; + } + } - // 4J-JEV: For debug. Ignore worlds with no name. - LPCWSTR wstr = levelGen->getWorldName(); - m_buttonListLoad.AddNewItem(1, wstr, L"test" ); - m_generators.push_back(levelGen); + // 4J-JEV: For debug. Ignore worlds with no name. + LPCWSTR wstr = levelGen->getWorldName(); + m_buttonListSaves.addItem( wstr ); + m_generators.push_back(levelGen); if(uiTexturePackID!=0) { - // increment the count of the mash-up pack worlds in the save list - m_iMashUpButtonsC++; + // increment the count of the mash-up pack worlds in the save list + m_iMashUpButtonsC++; TexturePack *tp = Minecraft::GetInstance()->skins->getTexturePackById(levelGen->getRequiredTexturePackId()); DWORD dwImageBytes; PBYTE pbImageData = tp->getPackIcon(dwImageBytes); @@ -1136,7 +1120,7 @@ void UIScene_LoadCreateJoinMenu::AddDefaultButtons() wchar_t imageName[64]; swprintf(imageName,64,L"tpack%08x",tp->getId()); registerSubstitutionTexture(imageName, pbImageData, dwImageBytes); - m_buttonListLoad.SetTextureName( m_buttonListLoad.getItemCount() - 1, imageName ); + m_buttonListSaves.setTextureName( m_buttonListSaves.getItemCount() - 1, imageName ); } } @@ -1145,7 +1129,7 @@ void UIScene_LoadCreateJoinMenu::AddDefaultButtons() m_iDefaultButtonsC += i; } -void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) +void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { if(m_bIgnoreInput) return; @@ -1178,75 +1162,75 @@ void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, boo #endif // Save Transfer #ifdef _XBOX_ONE - if(ProfileManager.IsSignedInLive( m_iPad )) - { - UIScene_LoadCreateJoinMenu::s_ulFileSize=0; - LaunchSaveTransfer(); - } + if(ProfileManager.IsSignedInLive( m_iPad )) + { + UIScene_LoadOrJoinMenu::s_ulFileSize=0; + LaunchSaveTransfer(); + } #endif #ifdef SONY_REMOTE_STORAGE_DOWNLOAD - { - bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); - if(bSignedInLive) - { - LaunchSaveTransfer(); - } - } + { + bool bSignedInLive = ProfileManager.IsSignedInLive(iPad); + if(bSignedInLive) + { + LaunchSaveTransfer(); + } + } #endif #ifdef _WINDOWS64 - // Right click on a save opens save options (same as RB / ACTION_MENU_RIGHT_SCROLL) - if(pressed && !repeat && ProfileManager.IsFullVersion() && !StorageManager.GetSaveDisabled()) - { - if(DoesSavesListHaveFocus() && (m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC)) - { - m_bIgnoreInput = true; - if(StorageManager.EnoughSpaceForAMinSaveGame()) - { - UINT uiIDA[3]; - uiIDA[0]=IDS_CONFIRM_CANCEL; - uiIDA[1]=IDS_TITLE_RENAMESAVE; - uiIDA[2]=IDS_TOOLTIPS_DELETESAVE; - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVEOPTIONS, IDS_TEXT_SAVEOPTIONS, uiIDA, 3, iPad,&UIScene_LoadCreateJoinMenu::SaveOptionsDialogReturned,this); - } - else - { - UINT uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_CANCEL; - uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned,this); - } - ui.PlayUISFX(eSFX_Press); - } - else if(DoesMashUpWorldHaveFocus() && (m_iSaveListIndex != JOIN_LOAD_CREATE_BUTTON_INDEX)) - { - LevelGenerationOptions *levelGen = m_generators.at(m_iSaveListIndex - 1); - if(!levelGen->isTutorial() && levelGen->requiresTexturePack()) - { - m_bIgnoreInput = true; - app.HideMashupPackWorld(m_iPad, levelGen->getRequiredTexturePackId()); - m_iState = e_SavesRepopulateAfterMashupHide; - } - ui.PlayUISFX(eSFX_Press); - } - } + // Right click on a save opens save options (same as RB / ACTION_MENU_RIGHT_SCROLL) + if(pressed && !repeat && ProfileManager.IsFullVersion() && !StorageManager.GetSaveDisabled()) + { + if(DoesSavesListHaveFocus() && (m_iDefaultButtonsC > 0) && (m_iSaveListIndex >= m_iDefaultButtonsC)) + { + m_bIgnoreInput = true; + if(StorageManager.EnoughSpaceForAMinSaveGame()) + { + UINT uiIDA[3]; + uiIDA[0]=IDS_CONFIRM_CANCEL; + uiIDA[1]=IDS_TITLE_RENAMESAVE; + uiIDA[2]=IDS_TOOLTIPS_DELETESAVE; + ui.RequestAlertMessage(IDS_TOOLTIPS_SAVEOPTIONS, IDS_TEXT_SAVEOPTIONS, uiIDA, 3, iPad,&UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned,this); + } + else + { + UINT uiIDA[2]; + uiIDA[0]=IDS_CONFIRM_CANCEL; + uiIDA[1]=IDS_CONFIRM_OK; + ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this); + } + ui.PlayUISFX(eSFX_Press); + } + else if(DoesMashUpWorldHaveFocus() && (m_iSaveListIndex != JOIN_LOAD_CREATE_BUTTON_INDEX)) + { + LevelGenerationOptions *levelGen = m_generators.at(m_iSaveListIndex - 1); + if(!levelGen->isTutorial() && levelGen->requiresTexturePack()) + { + m_bIgnoreInput = true; + app.HideMashupPackWorld(m_iPad, levelGen->getRequiredTexturePackId()); + m_iState = e_SavesRepopulateAfterMashupHide; + } + ui.PlayUISFX(eSFX_Press); + } + } #endif break; case ACTION_MENU_Y: #if defined(__PS3__) || defined(__PSVITA__) || defined(__ORBIS__) - m_eAction = eAction_ViewInvites; + m_eAction = eAction_ViewInvites; if(pressed && iPad == ProfileManager.GetPrimaryPad()) { #ifdef __ORBIS__ - // Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPad); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - UINT uiIDA[1]; - uiIDA[0] = IDS_OK; - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); + // Check if PSN is unavailable because of age restriction + int npAvailability = ProfileManager.getNPAvailability(iPad); + if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) + { + UINT uiIDA[1]; + uiIDA[0] = IDS_OK; + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); - break; - } + break; + } #endif // are we offline? @@ -1256,7 +1240,7 @@ void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, boo UINT uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(), &UIScene_LoadCreateJoinMenu::MustSignInReturnedPSN, this); + ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(), &UIScene_LoadOrJoinMenu::MustSignInReturnedPSN, this); } else { @@ -1271,9 +1255,9 @@ void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, boo } } #elif defined(_DURANGO) - if(getControlFocus() == eControl_JoinList && m_buttonListJoin.getItemCount() > 0) + if(getControlFocus() == eControl_GamesList && m_buttonListGames.getItemCount() > 0) { - DWORD nIndex = m_buttonListJoin.getCurrentSelection(); + DWORD nIndex = m_buttonListGames.getCurrentSelection(); FriendSessionInfo *pSelectedSession = m_currentSessions->at( nIndex ); PlayerUID uid = pSelectedSession->searchResult.m_playerXuids[0]; @@ -1299,7 +1283,7 @@ void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, boo UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned,this); + ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this); } else { @@ -1321,7 +1305,7 @@ void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, boo numOptions = 4; uiIDA[3]=IDS_COPYSAVE; #endif - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVEOPTIONS, IDS_TEXT_SAVEOPTIONS, uiIDA, numOptions, iPad,&UIScene_LoadCreateJoinMenu::SaveOptionsDialogReturned,this); + ui.RequestAlertMessage(IDS_TOOLTIPS_SAVEOPTIONS, IDS_TEXT_SAVEOPTIONS, uiIDA, numOptions, iPad,&UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned,this); } else { @@ -1330,36 +1314,36 @@ void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, boo UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2,iPad,&UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned,this); + ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2,iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this); } } ui.PlayUISFX(eSFX_Press); } } - else if(DoesMashUpWorldHaveFocus()) - { - // hiding a mash-up world - if((m_iSaveListIndex != JOIN_LOAD_CREATE_BUTTON_INDEX)) - { - LevelGenerationOptions *levelGen = m_generators.at(m_iSaveListIndex - 1); + else if(DoesMashUpWorldHaveFocus()) + { + // hiding a mash-up world + if((m_iSaveListIndex != JOIN_LOAD_CREATE_BUTTON_INDEX)) + { + LevelGenerationOptions *levelGen = m_generators.at(m_iSaveListIndex - 1); - if(!levelGen->isTutorial()) - { - if(levelGen->requiresTexturePack()) - { - unsigned int uiPackID=levelGen->getRequiredTexturePackId(); + if(!levelGen->isTutorial()) + { + if(levelGen->requiresTexturePack()) + { + unsigned int uiPackID=levelGen->getRequiredTexturePackId(); - m_bIgnoreInput = true; - app.HideMashupPackWorld(m_iPad,uiPackID); + m_bIgnoreInput = true; + app.HideMashupPackWorld(m_iPad,uiPackID); - // update the saves list - m_iState = e_SavesRepopulateAfterMashupHide; - } - } - } - ui.PlayUISFX(eSFX_Press); + // update the saves list + m_iState = e_SavesRepopulateAfterMashupHide; + } + } + } + ui.PlayUISFX(eSFX_Press); - } + } break; case ACTION_MENU_LEFT_SCROLL: #ifdef _XBOX @@ -1377,7 +1361,7 @@ void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, boo // if we are on the saves menu, check there are games in the games list to move to if(DoesSavesListHaveFocus()) { - if( m_buttonListJoin.getItemCount() > 0) + if( m_buttonListGames.getItemCount() > 0) { sendInputToMovie(key, repeat, pressed, released); } @@ -1411,15 +1395,14 @@ void UIScene_LoadCreateJoinMenu::handleInput(int iPad, int key, bool repeat, boo } } -int UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bool bRes) { // 4J HEG - No reason to set value if keyboard was cancelled - UIScene_LoadCreateJoinMenu *pClass=static_cast(lpParam); - pClass->m_bIgnoreInput=false; + UIScene_LoadOrJoinMenu *pClass=static_cast(lpParam); + pClass->m_bIgnoreInput=false; if (bRes) { - uint16_t ui16Text[128]; - ZeroMemory(ui16Text, 128 * sizeof(uint16_t) ); + uint16_t ui16Text[128] = {}; #ifdef _WINDOWS64 Win64_GetKeyboardText(ui16Text, 128); #else @@ -1429,42 +1412,9 @@ int UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam // check the name is valid if(ui16Text[0]!=0) { -#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined(__PSVITA__)) - // open the save and overwrite the metadata - StorageManager.RenameSaveData(pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC, ui16Text,&UIScene_LoadCreateJoinMenu::RenameSaveDataReturned,pClass); -#elif defined(_WINDOWS64) - { - int listPos = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; - - // Convert the ui16Text input to a wide string - wchar_t wNewName[128] = {}; - for (int k = 0; k < 127 && ui16Text[k]; k++) - wNewName[k] = static_cast(ui16Text[k]); - - // Convert to narrow for storage and in-memory update - char narrowName[128] = {}; - wcstombs(narrowName, wNewName, 127); - - // Build the sidecar path: Windows64\GameHDD\{folder}\worldname.txt - wchar_t wFilename[MAX_SAVEFILENAME_LENGTH] = {}; - mbstowcs(wFilename, pClass->m_saveDetails[listPos].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); - wstring sidecarPath = wstring(L"Windows64\\GameHDD\\") + wstring(wFilename) + wstring(L"\\worldname.txt"); - - FILE *fw = nullptr; - if (_wfopen_s(&fw, sidecarPath.c_str(), L"w") == 0 && fw) - { - fputs(narrowName, fw); - fclose(fw); - } - - // Update the in-memory display name so the list reflects it immediately - strncpy_s(pClass->m_saveDetails[listPos].UTF8SaveName, narrowName, 127); - pClass->m_saveDetails[listPos].UTF8SaveName[127] = '\0'; - - // Reuse the existing callback to trigger the list repopulate - UIScene_LoadCreateJoinMenu::RenameSaveDataReturned(pClass, true); - } -#endif + int displayIdx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; + auto pSaveInfo = &pClass->m_pSaveDetails->SaveInfoA[pClass->m_saveDetails[displayIdx].saveId]; + StorageManager.RenameSaveData(pSaveInfo, ui16Text, &UIScene_LoadOrJoinMenu::RenameSaveDataReturned, pClass); } else { @@ -1481,48 +1431,48 @@ int UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam return 0; } -void UIScene_LoadCreateJoinMenu::handleInitFocus(F64 controlId, F64 childId) +void UIScene_LoadOrJoinMenu::handleInitFocus(F64 controlId, F64 childId) { - app.DebugPrintf(app.USER_SR, "UIScene_LoadCreateJoinMenu::handleInitFocus - %d , %d\n", static_cast(controlId), static_cast(childId)); + app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleInitFocus - %d , %d\n", static_cast(controlId), static_cast(childId)); } -void UIScene_LoadCreateJoinMenu::handleFocusChange(F64 controlId, F64 childId) +void UIScene_LoadOrJoinMenu::handleFocusChange(F64 controlId, F64 childId) { - app.DebugPrintf(app.USER_SR, "UIScene_LoadCreateJoinMenu::handleFocusChange - %d , %d\n", static_cast(controlId), static_cast(childId)); + app.DebugPrintf(app.USER_SR, "UIScene_LoadOrJoinMenu::handleFocusChange - %d , %d\n", static_cast(controlId), static_cast(childId)); - switch(static_cast(controlId)) - { - case eControl_JoinList: - m_iGameListIndex = childId; + switch(static_cast(controlId)) + { + case eControl_GamesList: + m_iGameListIndex = childId; #ifdef _WINDOWS64 - // Offset past the "Add Server" button so m_iGameListIndex is a session index - m_iGameListIndex -= 1; + // Offset past the "Add Server" button so m_iGameListIndex is a session index + m_iGameListIndex -= 1; #endif - m_buttonListJoin.updateChildFocus( static_cast(childId) ); - break; - case eControl_LoadList: - m_iSaveListIndex = childId; + m_buttonListGames.updateChildFocus( static_cast(childId) ); + break; + case eControl_SavesList: + m_iSaveListIndex = childId; m_bUpdateSaveSize = true; - break; - }; + break; + }; updateTooltips(); } #ifdef SONY_REMOTE_STORAGE_DOWNLOAD -void UIScene_LoadCreateJoinMenu::remoteStorageGetSaveCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) +void UIScene_LoadOrJoinMenu::remoteStorageGetSaveCallback(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { app.DebugPrintf("remoteStorageGetCallback err : 0x%08x\n", error_code); assert(error_code == 0); - ((UIScene_LoadCreateJoinMenu*)lpParam)->LoadSaveFromCloud(); + ((UIScene_LoadOrJoinMenu*)lpParam)->LoadSaveFromCloud(); } #endif -void UIScene_LoadCreateJoinMenu::handlePress(F64 controlId, F64 childId) +void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) { switch(static_cast(controlId)) { - case eControl_LoadList: + case eControl_SavesList: { m_bIgnoreInput=true; @@ -1572,14 +1522,14 @@ void UIScene_LoadCreateJoinMenu::handlePress(F64 controlId, F64 childId) { #ifdef __ORBIS__ // check if this is a damaged save - PSAVE_INFO pSaveInfo = &m_pSaveDetails->SaveInfoA[((int)childId)-m_iDefaultButtonsC]; - if(pSaveInfo->thumbnailData == nullptr && pSaveInfo->modifiedTime == 0) // no thumbnail data and time of zero and zero blocks useset for corrupt files + PSAVE_INFO pSaveInfo = &m_pSaveDetails->SaveInfoA[((int)childId)-m_iDefaultButtonsC]; + if(pSaveInfo->thumbnailData == nullptr && pSaveInfo->modifiedTime == 0) // no thumbnail data and time of zero and zero blocks useset for corrupt files { // give the option to delete the save UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned,this); + ui.RequestAlertMessage(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this); } else @@ -1623,7 +1573,7 @@ void UIScene_LoadCreateJoinMenu::handlePress(F64 controlId, F64 childId) } } break; - case eControl_JoinList: + case eControl_GamesList: { #ifdef _WINDOWS64 if (static_cast(childId) == ADD_SERVER_BUTTON_INDEX) @@ -1635,238 +1585,238 @@ void UIScene_LoadCreateJoinMenu::handlePress(F64 controlId, F64 childId) #endif m_bIgnoreInput=true; - m_eAction = eAction_JoinGame; + m_eAction = eAction_JoinGame; //CD - Added for audio ui.PlayUISFX(eSFX_Press); - { - int nIndex = static_cast(childId); + { + int nIndex = static_cast(childId); #ifdef _WINDOWS64 - // Offset by 1 because the "Add Server" button is at index 0 - nIndex -= 1; + // Offset by 1 because the "Add Server" button is at index 0 + nIndex -= 1; #endif - m_iGameListIndex = nIndex; - CheckAndJoinGame(nIndex); - } + m_iGameListIndex = nIndex; + CheckAndJoinGame(nIndex); + } break; } } } -void UIScene_LoadCreateJoinMenu::CheckAndJoinGame(int gameIndex) +void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) { - if( m_buttonListJoin.getItemCount() > 0 && gameIndex < m_currentSessions->size() ) - { + if( m_buttonListGames.getItemCount() > 0 && gameIndex < m_currentSessions->size() ) + { #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) - // 4J-PB - is the player allowed to join games? - bool noUGC=false; - bool bContentRestricted=false; + // 4J-PB - is the player allowed to join games? + bool noUGC=false; + bool bContentRestricted=false; - // we're online, since we are joining a game - ProfileManager.GetChatAndContentRestrictions(m_iPad,true,&noUGC,&bContentRestricted,nullptr); + // we're online, since we are joining a game + ProfileManager.GetChatAndContentRestrictions(m_iPad,true,&noUGC,&bContentRestricted,nullptr); #ifdef __ORBIS__ - // 4J Stu - On PS4 we don't restrict playing multiplayer based on chat restriction, so remove this check - noUGC = false; + // 4J Stu - On PS4 we don't restrict playing multiplayer based on chat restriction, so remove this check + noUGC = false; - bool bPlayStationPlus=true; - int iPadWithNoPlaystationPlus=0; - bool isSignedInLive = true; - int iPadNotSignedInLive = -1; - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - if( InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i) ) - { - if (isSignedInLive && !ProfileManager.IsSignedInLive(i)) - { - // Record the first non signed in live pad - iPadNotSignedInLive = i; - } + bool bPlayStationPlus=true; + int iPadWithNoPlaystationPlus=0; + bool isSignedInLive = true; + int iPadNotSignedInLive = -1; + for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) + { + if( InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i) ) + { + if (isSignedInLive && !ProfileManager.IsSignedInLive(i)) + { + // Record the first non signed in live pad + iPadNotSignedInLive = i; + } - isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i); - if(ProfileManager.HasPlayStationPlus(i)==false) - { - bPlayStationPlus=false; - break; - } - } - } + isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i); + if(ProfileManager.HasPlayStationPlus(i)==false) + { + bPlayStationPlus=false; + break; + } + } + } #endif #ifdef __PSVITA__ - if( CGameNetworkManager::usingAdhocMode() ) - { - bContentRestricted = false; - noUGC = false; - } + if( CGameNetworkManager::usingAdhocMode() ) + { + bContentRestricted = false; + noUGC = false; + } #endif - if(noUGC) - { - // not allowed to join + if(noUGC) + { + // not allowed to join #ifndef __PSVITA__ - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - // Not allowed to play online - ui.RequestAlertMessage(IDS_ONLINE_GAME, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, m_iPad,nullptr,this); + UINT uiIDA[1]; + uiIDA[0]=IDS_CONFIRM_OK; + // Not allowed to play online + ui.RequestAlertMessage(IDS_ONLINE_GAME, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, m_iPad,nullptr,this); #else - // Not allowed to play online - ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, 0 ); + // Not allowed to play online + ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, 0 ); #endif - m_bIgnoreInput=false; - return; - } - else if(bContentRestricted) - { - ui.RequestContentRestrictedMessageBox(); + m_bIgnoreInput=false; + return; + } + else if(bContentRestricted) + { + ui.RequestContentRestrictedMessageBox(); - m_bIgnoreInput=false; - return; - } + m_bIgnoreInput=false; + return; + } #ifdef __ORBIS__ - // If this is an online game but not all players are signed in to Live, stop! - else if (!isSignedInLive) - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; + // If this is an online game but not all players are signed in to Live, stop! + else if (!isSignedInLive) + { + UINT uiIDA[1]; + uiIDA[0]=IDS_CONFIRM_OK; - // Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPadNotSignedInLive); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - m_bIgnoreInput = false; - // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK - ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive); - } - else - { - ui.RequestErrorMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA,1,iPadNotSignedInLive, &UIScene_LoadCreateJoinMenu::MustSignInReturnedPSN, this); - } - return; - } - else if(bPlayStationPlus==false) - { + // Check if PSN is unavailable because of age restriction + int npAvailability = ProfileManager.getNPAvailability(iPadNotSignedInLive); + if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) + { + m_bIgnoreInput = false; + // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive); + } + else + { + ui.RequestErrorMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA,1,iPadNotSignedInLive, &UIScene_LoadOrJoinMenu::MustSignInReturnedPSN, this); + } + return; + } + else if(bPlayStationPlus==false) + { - if(ProfileManager.RequestingPlaystationPlus(iPadWithNoPlaystationPlus)) - { - // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). - UINT uiIDA[1]; - uiIDA[0]=IDS_OK; - ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); - return; - } + if(ProfileManager.RequestingPlaystationPlus(iPadWithNoPlaystationPlus)) + { + // MGH - added this so we don't try and upsell when we don't know if the player has PS Plus yet (if it can't connect to the PS Plus server). + UINT uiIDA[1]; + uiIDA[0]=IDS_OK; + ui.RequestAlertMessage(IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, nullptr); + return; + } - // PS Plus upsell - // 4J-PB - we're not allowed to show the text Playstation Plus - have to call the upsell all the time! - // upsell psplus - int32_t iResult=sceNpCommerceDialogInitialize(); + // PS Plus upsell + // 4J-PB - we're not allowed to show the text Playstation Plus - have to call the upsell all the time! + // upsell psplus + int32_t iResult=sceNpCommerceDialogInitialize(); - SceNpCommerceDialogParam param; - sceNpCommerceDialogParamInitialize(¶m); - param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; - param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; - param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus); + SceNpCommerceDialogParam param; + sceNpCommerceDialogParamInitialize(¶m); + param.mode=SCE_NP_COMMERCE_DIALOG_MODE_PLUS; + param.features = SCE_NP_PLUS_FEATURE_REALTIME_MULTIPLAY; + param.userId = ProfileManager.getUserID(iPadWithNoPlaystationPlus); - iResult=sceNpCommerceDialogOpen(¶m); + iResult=sceNpCommerceDialogOpen(¶m); - // UINT uiIDA[2]; - // uiIDA[0]=IDS_CONFIRM_OK; - // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; - // ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadCreateJoinMenu::PSPlusReturned,this, app.GetStringTable(),nullptr,0,false); + // UINT uiIDA[2]; + // uiIDA[0]=IDS_CONFIRM_OK; + // uiIDA[1]=IDS_PLAYSTATIONPLUS_SIGNUP; + // ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_PLAYSTATIONPLUS, uiIDA,2,ProfileManager.GetPrimaryPad(),&UIScene_LoadOrJoinMenu::PSPlusReturned,this, app.GetStringTable(),nullptr,0,false); - m_bIgnoreInput=false; - return; - } + m_bIgnoreInput=false; + return; + } #endif #endif - m_initData->iPad = 0;; - m_initData->selectedSession = m_currentSessions->at( gameIndex ); + m_initData->iPad = 0;; + m_initData->selectedSession = m_currentSessions->at( gameIndex ); #ifdef _WINDOWS64 - { + { - int serverDbCount = 0; - FILE* dbFile = fopen("servers.db", "rb"); - if (dbFile) - { - char magic[4] = {}; - if (fread(magic, 1, 4, dbFile) == 4 && memcmp(magic, "MCSV", 4) == 0) - { - uint32_t version = 0, count = 0; - fread(&version, sizeof(uint32_t), 1, dbFile); - fread(&count, sizeof(uint32_t), 1, dbFile); - if (version == 1) - serverDbCount = static_cast(count); - } - fclose(dbFile); - } - int lanCount = static_cast(m_currentSessions->size()) - serverDbCount; - if (gameIndex >= lanCount && lanCount >= 0) - m_initData->serverIndex = gameIndex - lanCount; - else - m_initData->serverIndex = -1; - } + int serverDbCount = 0; + FILE* dbFile = fopen("servers.db", "rb"); + if (dbFile) + { + char magic[4] = {}; + if (fread(magic, 1, 4, dbFile) == 4 && memcmp(magic, "MCSV", 4) == 0) + { + uint32_t version = 0, count = 0; + fread(&version, sizeof(uint32_t), 1, dbFile); + fread(&count, sizeof(uint32_t), 1, dbFile); + if (version == 1) + serverDbCount = static_cast(count); + } + fclose(dbFile); + } + int lanCount = static_cast(m_currentSessions->size()) - serverDbCount; + if (gameIndex >= lanCount && lanCount >= 0) + m_initData->serverIndex = gameIndex - lanCount; + else + m_initData->serverIndex = -1; + } #endif - if(m_initData->selectedSession->data.texturePackParentId!=0) - { - int texturePacksCount = Minecraft::GetInstance()->skins->getTexturePackCount(); - bool bHasTexturePackInstalled=false; + if(m_initData->selectedSession->data.texturePackParentId!=0) + { + int texturePacksCount = Minecraft::GetInstance()->skins->getTexturePackCount(); + bool bHasTexturePackInstalled=false; - for(int i=0;iskins->getTexturePackByIndex(i); - if(tp->getDLCParentPackId()==m_initData->selectedSession->data.texturePackParentId) - { - bHasTexturePackInstalled=true; - break; - } - } + for(int i=0;iskins->getTexturePackByIndex(i); + if(tp->getDLCParentPackId()==m_initData->selectedSession->data.texturePackParentId) + { + bHasTexturePackInstalled=true; + break; + } + } - if(bHasTexturePackInstalled==false) - { + if(bHasTexturePackInstalled==false) + { #ifdef _XBOX - ULONGLONG ullOfferID_Full; - app.GetDLCFullOfferIDForPackID(m_initData->selectedSession->data.texturePackParentId,&ullOfferID_Full); + ULONGLONG ullOfferID_Full; + app.GetDLCFullOfferIDForPackID(m_initData->selectedSession->data.texturePackParentId,&ullOfferID_Full); - TelemetryManager->RecordUpsellPresented(m_iPad, eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); + TelemetryManager->RecordUpsellPresented(m_iPad, eSet_UpsellID_Texture_DLC, ullOfferID_Full & 0xFFFFFFFF); #endif - UINT uiIDA[2]; + UINT uiIDA[2]; - uiIDA[0]=IDS_TEXTUREPACK_FULLVERSION; - //uiIDA[1]=IDS_TEXTURE_PACK_TRIALVERSION; - uiIDA[1]=IDS_CONFIRM_CANCEL; + uiIDA[0]=IDS_TEXTUREPACK_FULLVERSION; + //uiIDA[1]=IDS_TEXTURE_PACK_TRIALVERSION; + uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestAlertMessage(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, m_iPad,&UIScene_LoadCreateJoinMenu::TexturePackDialogReturned,this); + ui.RequestAlertMessage(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, m_iPad,&UIScene_LoadOrJoinMenu::TexturePackDialogReturned,this); - return; - } + return; + } #ifdef __PSVITA__ - if(CGameNetworkManager::usingAdhocMode() && !SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) - { - // not connected to adhoc anymore, must have connected back to PSN to buy texture pack so sign in again - SQRNetworkManager_AdHoc_Vita::AttemptAdhocSignIn(&UIScene_LoadCreateJoinMenu::SignInAdhocReturned, this); - return; - } + if(CGameNetworkManager::usingAdhocMode() && !SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) + { + // not connected to adhoc anymore, must have connected back to PSN to buy texture pack so sign in again + SQRNetworkManager_AdHoc_Vita::AttemptAdhocSignIn(&UIScene_LoadOrJoinMenu::SignInAdhocReturned, this); + return; + } #endif - } - m_controlJoinTimer.setVisible( false ); + } + m_controlJoinTimer.setVisible( false ); #ifdef _XBOX - XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); + XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); #endif - m_bIgnoreInput=true; - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_JoinMenu,m_initData); - } + m_bIgnoreInput=true; + ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_JoinMenu,m_initData); + } } -void UIScene_LoadCreateJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) +void UIScene_LoadOrJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) { // Load data from disc //File saveFile( L"Tutorial\\Tutorial" ); @@ -1925,16 +1875,16 @@ void UIScene_LoadCreateJoinMenu::LoadLevelGen(LevelGenerationOptions *levelGen) ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); } -void UIScene_LoadCreateJoinMenu::UpdateGamesListCallback(LPVOID pParam) +void UIScene_LoadOrJoinMenu::UpdateGamesListCallback(LPVOID pParam) { if(pParam != nullptr) { - UIScene_LoadCreateJoinMenu *pScene = static_cast(pParam); + UIScene_LoadOrJoinMenu *pScene = static_cast(pParam); pScene->UpdateGamesList(); } } -void UIScene_LoadCreateJoinMenu::UpdateGamesList() +void UIScene_LoadOrJoinMenu::UpdateGamesList() { // If we're ignoring input scene isn't active so do nothing if (m_bIgnoreInput) return; @@ -1950,9 +1900,9 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() FriendSessionInfo *pSelectedSession = nullptr; - if(DoesGamesListHaveFocus() && m_buttonListJoin.getItemCount() > 0) + if(DoesGamesListHaveFocus() && m_buttonListGames.getItemCount() > 0) { - unsigned int nIndex = m_buttonListJoin.getCurrentSelection(); + unsigned int nIndex = m_buttonListGames.getCurrentSelection(); #ifdef _WINDOWS64 // Offset past the "Add Server" button if (nIndex > 0) @@ -1963,7 +1913,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() } SessionID selectedSessionId; - ZeroMemory(&selectedSessionId,sizeof(SessionID)); + ZeroMemory(&selectedSessionId,sizeof(SessionID)); if( pSelectedSession != nullptr )selectedSessionId = pSelectedSession->sessionId; pSelectedSession = nullptr; @@ -1977,7 +1927,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() vector* newSessions = g_NetworkManager.GetSessionList( m_iPad, 1, m_bShowingPartyGamesOnly ); - if (m_currentSessions != NULL && m_currentSessions->size() == newSessions->size()) + if (m_currentSessions != nullptr && m_currentSessions->size() == newSessions->size()) { bool same = true; for (size_t i = 0; i < newSessions->size(); i++) @@ -2008,7 +1958,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() m_currentSessions = newSessions; // Update the xui list displayed - unsigned int xuiListSize = m_buttonListJoin.getItemCount(); + unsigned int xuiListSize = m_buttonListGames.getItemCount(); unsigned int filteredListSize = static_cast(m_currentSessions->size()); BOOL gamesListHasFocus = DoesGamesListHaveFocus(); @@ -2022,7 +1972,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() m_pGamesList->SetCurSel( 0 ); } #endif - //m_labelNoGames.setVisible( false ); + m_labelNoGames.setVisible( false ); m_controlJoinTimer.setVisible( false ); } else @@ -2031,7 +1981,7 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() m_pGamesList->SetEnable(FALSE); #endif m_controlJoinTimer.setVisible( false ); - //m_labelNoGames.setVisible( true ); + m_labelNoGames.setVisible( true ); #if TO_BE_IMPLEMENTED if( gamesListHasFocus ) m_pGamesList->InitFocus(m_iPad); @@ -2039,18 +1989,18 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() } // clear out the games list and re-fill - m_buttonListJoin.clearList(); + m_buttonListGames.clearList(); #ifdef _WINDOWS64 // Always add the "Add Server" button as the first entry in the games list - m_buttonListJoin.AddNewItem(3, wstring(L"Add Server"), L"test"); + m_buttonListGames.addItem(wstring(L"Add Server")); #endif if( filteredListSize > 0 ) { // Reset the focus to the selected session if it still exists unsigned int sessionIndex = 0; - m_buttonListJoin.setCurrentSelection(0); + m_buttonListGames.setCurrentSelection(0); for( FriendSessionInfo *sessionInfo : *m_currentSessions ) { @@ -2107,15 +2057,15 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() } } - m_buttonListJoin.AddNewItem( 3, sessionInfo->displayLabel, textureName ); + m_buttonListGames.addItem( sessionInfo->displayLabel, textureName ); if(memcmp( &selectedSessionId, &sessionInfo->sessionId, sizeof(SessionID) ) == 0) { #ifdef _WINDOWS64 // Offset past the "Add Server" button - m_buttonListJoin.setCurrentSelection(sessionIndex + 1); + m_buttonListGames.setCurrentSelection(sessionIndex + 1); #else - m_buttonListJoin.setCurrentSelection(sessionIndex); + m_buttonListGames.setCurrentSelection(sessionIndex); #endif break; } @@ -2123,52 +2073,52 @@ void UIScene_LoadCreateJoinMenu::UpdateGamesList() } } - updateTooltips(); + updateTooltips(); } -void UIScene_LoadCreateJoinMenu::HandleDLCMountingComplete() +void UIScene_LoadOrJoinMenu::HandleDLCMountingComplete() { Initialise(); } -bool UIScene_LoadCreateJoinMenu::DoesSavesListHaveFocus() +bool UIScene_LoadOrJoinMenu::DoesSavesListHaveFocus() { - if( m_buttonListLoad.hasFocus() ) - { - // check it's not the first or second element (new world or tutorial) - if(m_iSaveListIndex > (m_iDefaultButtonsC-1)) - { - return true; - } - } - return false; + if( m_buttonListSaves.hasFocus() ) + { + // check it's not the first or second element (new world or tutorial) + if(m_iSaveListIndex > (m_iDefaultButtonsC-1)) + { + return true; + } + } + return false; } -bool UIScene_LoadCreateJoinMenu::DoesMashUpWorldHaveFocus() +bool UIScene_LoadOrJoinMenu::DoesMashUpWorldHaveFocus() { - if(m_buttonListLoad.hasFocus()) - { - // check it's not the first or second element (new world or tutorial) - if(m_iSaveListIndex > (m_iDefaultButtonsC - 1)) - { - return false; - } + if(m_buttonListSaves.hasFocus()) + { + // check it's not the first or second element (new world or tutorial) + if(m_iSaveListIndex > (m_iDefaultButtonsC - 1)) + { + return false; + } - if(m_iSaveListIndex > (m_iDefaultButtonsC - 1 - m_iMashUpButtonsC)) - { - return true; - } - else return false; - } - else return false; + if(m_iSaveListIndex > (m_iDefaultButtonsC - 1 - m_iMashUpButtonsC)) + { + return true; + } + else return false; + } + else return false; } -bool UIScene_LoadCreateJoinMenu::DoesGamesListHaveFocus() +bool UIScene_LoadOrJoinMenu::DoesGamesListHaveFocus() { - return m_buttonListJoin.hasFocus(); + return m_buttonListGames.hasFocus(); } -void UIScene_LoadCreateJoinMenu::handleTimerComplete(int id) +void UIScene_LoadOrJoinMenu::handleTimerComplete(int id) { switch(id) { @@ -2192,15 +2142,15 @@ void UIScene_LoadCreateJoinMenu::handleTimerComplete(int id) { if( bMultiplayerAllowed ) { - // m_CheckboxOnline.SetEnable(TRUE); - // m_CheckboxPrivate.SetEnable(TRUE); + // m_CheckboxOnline.SetEnable(TRUE); + // m_CheckboxPrivate.SetEnable(TRUE); } else { m_bInParty = false; - m_buttonListJoin.clearList(); + m_buttonListGames.clearList(); m_controlJoinTimer.setVisible( true ); - //m_labelNoGames.setVisible( false ); + m_labelNoGames.setVisible( false ); } m_bMultiplayerAllowed = bMultiplayerAllowed; @@ -2265,7 +2215,7 @@ void UIScene_LoadCreateJoinMenu::handleTimerComplete(int id) } -void UIScene_LoadCreateJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform savePlatform /*= SAVE_FILE_PLATFORM_LOCAL*/) +void UIScene_LoadOrJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform savePlatform /*= SAVE_FILE_PLATFORM_LOCAL*/) { // we'll only be coming in here when the tutorial is loaded now @@ -2280,8 +2230,6 @@ void UIScene_LoadCreateJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform fis.read(ba); fis.close(); - - bool isClientSide = false; bool isPrivate = false; int maxPlayers = MINECRAFT_NET_MAX_PLAYERS; @@ -2323,7 +2271,7 @@ void UIScene_LoadCreateJoinMenu::LoadSaveFromDisk(File *saveFile, ESavePlatform } #ifdef SONY_REMOTE_STORAGE_DOWNLOAD -void UIScene_LoadCreateJoinMenu::LoadSaveFromCloud() +void UIScene_LoadOrJoinMenu::LoadSaveFromCloud() { wchar_t wFileName[128]; @@ -2356,7 +2304,7 @@ void UIScene_LoadCreateJoinMenu::LoadSaveFromCloud() maxPlayers = 4; } - app.SetGameHostOption(eGameHostOption_All, app.getRemoteStorage()->getSaveHostOptions() ); + app.SetGameHostOption(eGameHostOption_All, app.getRemoteStorage()->getSaveHostOptions() ); g_NetworkManager.HostGame(0,isClientSide,isPrivate,maxPlayers,0); @@ -2367,7 +2315,7 @@ void UIScene_LoadCreateJoinMenu::LoadSaveFromCloud() param->saveData = saveData; param->settings = app.GetGameHostOption( eGameHostOption_All ); param->savePlatform = app.getRemoteStorage()->getSavePlatform(); - param->texturePackId = app.getRemoteStorage()->getSaveTexturePack(); + param->texturePackId = app.getRemoteStorage()->getSaveTexturePack(); #ifndef _XBOX g_NetworkManager.FakeLocalPlayerJoined(); @@ -2389,38 +2337,13 @@ void UIScene_LoadCreateJoinMenu::LoadSaveFromCloud() #endif //SONY_REMOTE_STORAGE_DOWNLOAD -#ifdef _WINDOWS64 -static bool Win64_DeleteSaveDirectory(const wchar_t* wPath) +int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - wchar_t wSearch[MAX_PATH]; - swprintf_s(wSearch, MAX_PATH, L"%s\\*", wPath); - WIN32_FIND_DATAW fd; - HANDLE hFind = FindFirstFileW(wSearch, &fd); - if (hFind != INVALID_HANDLE_VALUE) - { - do - { - if (wcscmp(fd.cFileName, L".") == 0 || wcscmp(fd.cFileName, L"..") == 0) continue; - wchar_t wChild[MAX_PATH]; - swprintf_s(wChild, MAX_PATH, L"%s\\%s", wPath, fd.cFileName); - if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - Win64_DeleteSaveDirectory(wChild); - else - DeleteFileW(wChild); - } while (FindNextFileW(hFind, &fd)); - FindClose(hFind); - } - return RemoveDirectoryW(wPath) != 0; -} -#endif // _WINDOWS64 - -int UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) -{ - UIScene_LoadCreateJoinMenu* pClass = static_cast(pParam); + auto* pClass = static_cast(pParam); // results switched for this dialog - // Check that we have a valid save selected (can get a bad index if the save list has been refreshed) - bool validSelection= pClass->m_iDefaultButtonsC != 0 && pClass->m_iSaveListIndex >= pClass->m_iDefaultButtonsC; + // Check that we have a valid save selected (can get a bad index if the save list has been refreshed) + bool validSelection= pClass->m_iDefaultButtonsC != 0 && pClass->m_iSaveListIndex >= pClass->m_iDefaultButtonsC; if(result==C4JStorage::EMessage_ResultDecline && validSelection) { @@ -2430,25 +2353,15 @@ int UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C } else { -#ifdef _WINDOWS64 + int displayIdx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; + + if (pClass->m_saveDetails && displayIdx >= 0 && pClass->m_saveDetails[displayIdx].UTF8SaveFilename[0]) { - // Use m_saveDetails (sorted display order) so the correct folder is targeted - int displayIdx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; - bool bSuccess = false; - if (pClass->m_saveDetails && displayIdx >= 0 && pClass->m_saveDetails[displayIdx].UTF8SaveFilename[0]) - { - wchar_t wFilename[MAX_SAVEFILENAME_LENGTH] = {}; - mbstowcs_s(nullptr, wFilename, MAX_SAVEFILENAME_LENGTH, pClass->m_saveDetails[displayIdx].UTF8SaveFilename, MAX_SAVEFILENAME_LENGTH - 1); - wchar_t wFolderPath[MAX_PATH] = {}; - swprintf_s(wFolderPath, MAX_PATH, L"Windows64\\GameHDD\\%s", wFilename); - bSuccess = Win64_DeleteSaveDirectory(wFolderPath); - } - UIScene_LoadCreateJoinMenu::DeleteSaveDataReturned((LPVOID)pClass->GetCallbackUniqueId(), bSuccess); + auto pSaveInfo = &pClass->m_pSaveDetails->SaveInfoA[pClass->m_saveDetails[displayIdx].saveId]; + StorageManager.DeleteSaveData(pSaveInfo, &UIScene_LoadOrJoinMenu::DeleteSaveDataReturned, (LPVOID)pClass->GetCallbackUniqueId()); } -#else - StorageManager.DeleteSaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC], UIScene_LoadCreateJoinMenu::DeleteSaveDataReturned, (LPVOID)pClass->GetCallbackUniqueId()); -#endif - pClass->m_controlLoadTimer.setVisible( true ); + + pClass->m_controlSavesTimer.setVisible( true ); } } else @@ -2459,30 +2372,30 @@ int UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned(void *pParam,int iPad,C return 0; } -int UIScene_LoadCreateJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(LPVOID lpParam,bool bRes) { - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadCreateJoinMenu* pClass = static_cast(ui.GetSceneFromCallbackId((size_t)lpParam)); + ui.EnterCallbackIdCriticalSection(); + UIScene_LoadOrJoinMenu* pClass = static_cast(ui.GetSceneFromCallbackId((size_t)lpParam)); - if(pClass) - { - if(bRes) - { - // wipe the list and repopulate it - pClass->m_iState=e_SavesRepopulateAfterDelete; - } - else pClass->m_bIgnoreInput=false; + if(pClass) + { + if(bRes) + { + // wipe the list and repopulate it + pClass->m_iState=e_SavesRepopulateAfterDelete; + } + else pClass->m_bIgnoreInput=false; - pClass->updateTooltips(); - } - ui.LeaveCallbackIdCriticalSection(); + pClass->updateTooltips(); + } + ui.LeaveCallbackIdCriticalSection(); return 0; } -int UIScene_LoadCreateJoinMenu::RenameSaveDataReturned(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::RenameSaveDataReturned(LPVOID lpParam,bool bRes) { - UIScene_LoadCreateJoinMenu* pClass = static_cast(lpParam); + UIScene_LoadOrJoinMenu* pClass = static_cast(lpParam); if(bRes) { @@ -2498,23 +2411,23 @@ int UIScene_LoadCreateJoinMenu::RenameSaveDataReturned(LPVOID lpParam,bool bRes) #ifdef __ORBIS__ -void UIScene_LoadCreateJoinMenu::LoadRemoteFileFromDisk(char* remoteFilename) +void UIScene_LoadOrJoinMenu::LoadRemoteFileFromDisk(char* remoteFilename) { wchar_t wSaveName[128]; mbstowcs(wSaveName, remoteFilename, strlen(remoteFilename)+1); // plus null - // processConsoleSave(wSaveName, L"ProcessedSave.bin"); + // processConsoleSave(wSaveName, L"ProcessedSave.bin"); - // File remoteFile(L"ProcessedSave.bin"); + // File remoteFile(L"ProcessedSave.bin"); File remoteFile(wSaveName); LoadSaveFromDisk(&remoteFile, SAVE_FILE_PLATFORM_PS3); } #endif -int UIScene_LoadCreateJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) +int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadCreateJoinMenu* pClass = static_cast(pParam); + UIScene_LoadOrJoinMenu* pClass = static_cast(pParam); // results switched for this dialog // EMessage_ResultAccept means cancel @@ -2522,24 +2435,24 @@ int UIScene_LoadCreateJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad, { case C4JStorage::EMessage_ResultDecline: // rename { - pClass->m_bIgnoreInput=true; + pClass->m_bIgnoreInput=true; #ifdef _WINDOWS64 { wchar_t wSaveName[128]; - ZeroMemory(wSaveName, 128 * sizeof(wchar_t)); + ZeroMemory(wSaveName, sizeof(wSaveName)); mbstowcs_s(nullptr, wSaveName, 128, pClass->m_saveDetails[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC].UTF8SaveName, _TRUNCATE); UIKeyboardInitData kbData; kbData.title = app.GetString(IDS_RENAME_WORLD_TITLE); kbData.defaultText = wSaveName; kbData.maxChars = 25; - kbData.callback = &UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback; + kbData.callback = &UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback; kbData.lpParam = pClass; kbData.pcMode = g_KBMInput.IsKBMActive(); ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData); } #elif defined _DURANGO // bring up a keyboard - InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE), (pClass->m_saveDetails[pClass->m_iSaveListIndex-pClass->m_iDefaultButtonsC]).UTF16SaveName,(DWORD)0,25,&UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback,pClass,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE), (pClass->m_saveDetails[pClass->m_iSaveListIndex-pClass->m_iDefaultButtonsC]).UTF16SaveName,(DWORD)0,25,&UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback,pClass,C_4JInput::EKeyboardMode_Default); #else // bring up a keyboard wchar_t wSaveName[128]; @@ -2547,7 +2460,7 @@ int UIScene_LoadCreateJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad, ZeroMemory(wSaveName, 128 * sizeof(wchar_t) ); mbstowcs(wSaveName, pClass->m_saveDetails[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC].UTF8SaveName, strlen(pClass->m_saveDetails->UTF8SaveName)+1); // plus null LPWSTR ptr = wSaveName; - InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE),wSaveName,(DWORD)0,25,&UIScene_LoadCreateJoinMenu::KeyboardCompleteWorldNameCallback,pClass,C_4JInput::EKeyboardMode_Default); + InputManager.RequestKeyboard(app.GetString(IDS_RENAME_WORLD_TITLE),wSaveName,(DWORD)0,25,&UIScene_LoadOrJoinMenu::KeyboardCompleteWorldNameCallback,pClass,C_4JInput::EKeyboardMode_Default); #endif } break; @@ -2559,29 +2472,29 @@ int UIScene_LoadCreateJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad, UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadCreateJoinMenu::DeleteSaveDialogReturned,pClass); + ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,pClass); } break; #ifdef SONY_REMOTE_STORAGE_UPLOAD case C4JStorage::EMessage_ResultFourthOption: // upload to cloud { - UINT uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_OK; - uiIDA[1]=IDS_CONFIRM_CANCEL; + UINT uiIDA[2]; + uiIDA[0]=IDS_CONFIRM_OK; + uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_TEXT, uiIDA, 2, iPad,&UIScene_LoadCreateJoinMenu::SaveTransferDialogReturned,pClass); + ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_TEXT, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::SaveTransferDialogReturned,pClass); } break; #endif // SONY_REMOTE_STORAGE_UPLOAD #if defined _XBOX_ONE || defined __ORBIS__ case C4JStorage::EMessage_ResultFourthOption: // copy save { - UINT uiIDA[2]; - uiIDA[0]=IDS_CONFIRM_OK; - uiIDA[1]=IDS_CONFIRM_CANCEL; + UINT uiIDA[2]; + uiIDA[0]=IDS_CONFIRM_OK; + uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestAlertMessage(IDS_COPYSAVE, IDS_TEXT_COPY_SAVE, uiIDA, 2, iPad,&UIScene_LoadCreateJoinMenu::CopySaveDialogReturned,pClass); + ui.RequestAlertMessage(IDS_COPYSAVE, IDS_TEXT_COPY_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::CopySaveDialogReturned,pClass); } break; #endif @@ -2601,91 +2514,91 @@ int UIScene_LoadCreateJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad, #if defined (__PSVITA__) -int UIScene_LoadCreateJoinMenu::SignInAdhocReturned(void *pParam,bool bContinue, int iPad) +int UIScene_LoadOrJoinMenu::SignInAdhocReturned(void *pParam,bool bContinue, int iPad) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - pClass->m_bIgnoreInput = false; - return 0; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; + pClass->m_bIgnoreInput = false; + return 0; } -int UIScene_LoadCreateJoinMenu::MustSignInTexturePack(void *pParam,int iPad,C4JStorage::EMessageResult result) +int UIScene_LoadOrJoinMenu::MustSignInTexturePack(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - if(result==C4JStorage::EMessage_ResultAccept) - { - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadCreateJoinMenu::MustSignInReturnedTexturePack, pClass); - } - else - { - pClass->m_bIgnoreInput = false; - } + if(result==C4JStorage::EMessage_ResultAccept) + { + SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack, pClass); + } + else + { + pClass->m_bIgnoreInput = false; + } - return 0; + return 0; } -int UIScene_LoadCreateJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bContinue, int iPad) +int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bContinue, int iPad) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - int commerceState = app.GetCommerceState(); - while( commerceState != CConsoleMinecraftApp::eCommerce_State_Offline && - commerceState != CConsoleMinecraftApp::eCommerce_State_Online && - commerceState != CConsoleMinecraftApp::eCommerce_State_Error) - { - Sleep(10); - commerceState = app.GetCommerceState(); - } + int commerceState = app.GetCommerceState(); + while( commerceState != CConsoleMinecraftApp::eCommerce_State_Offline && + commerceState != CConsoleMinecraftApp::eCommerce_State_Online && + commerceState != CConsoleMinecraftApp::eCommerce_State_Error) + { + Sleep(10); + commerceState = app.GetCommerceState(); + } - if(bContinue==true) - { - SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); - if(pSONYDLCInfo!=nullptr) - { - char chName[42]; - char chKeyName[20]; - char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; + if(bContinue==true) + { + SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); + if(pSONYDLCInfo!=nullptr) + { + char chName[42]; + char chKeyName[20]; + char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; - memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); - // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. - // So we assume the first sku for the product is the one we want - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char - memset(chKeyName, 0, sizeof(chKeyName)); - strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); + memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); + // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. + // So we assume the first sku for the product is the one we want + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char + memset(chKeyName, 0, sizeof(chKeyName)); + strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); #ifdef __ORBIS__ - strcpy_s(chName, chKeyName); + strcpy_s(chName, chKeyName); #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); + sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif - app.GetDLCSkuIDFromProductList(chName,chSkuID); - // 4J-PB - need to check for an empty store - if(app.CheckForEmptyStore(iPad)==false) - { - if(app.DLCAlreadyPurchased(chSkuID)) - { - app.DownloadAlreadyPurchased(chSkuID); - } - else - { - app.Checkout(chSkuID); - } - } - } - } - pClass->m_bIgnoreInput = false; + app.GetDLCSkuIDFromProductList(chName,chSkuID); + // 4J-PB - need to check for an empty store + if(app.CheckForEmptyStore(iPad)==false) + { + if(app.DLCAlreadyPurchased(chSkuID)) + { + app.DownloadAlreadyPurchased(chSkuID); + } + else + { + app.Checkout(chSkuID); + } + } + } + } + pClass->m_bIgnoreInput = false; return 0; } #endif -int UIScene_LoadCreateJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) +int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadCreateJoinMenu *pClass = static_cast(pParam); + UIScene_LoadOrJoinMenu *pClass = static_cast(pParam); // Exit with or without saving if(result==C4JStorage::EMessage_ResultAccept) @@ -2695,70 +2608,70 @@ int UIScene_LoadCreateJoinMenu::TexturePackDialogReturned(void *pParam,int iPad, #if defined __PSVITA__ || defined __PS3__ || defined __ORBIS__ #ifdef __PSVITA__ - if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && CGameNetworkManager::usingAdhocMode()) - { - // get them to sign in to online - UINT uiIDA[2]; - uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_LoadCreateJoinMenu::MustSignInTexturePack,pClass); - return; - } + if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && CGameNetworkManager::usingAdhocMode()) + { + // get them to sign in to online + UINT uiIDA[2]; + uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; + uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; + ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_LoadOrJoinMenu::MustSignInTexturePack,pClass); + return; + } #endif - SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); - if(pSONYDLCInfo!=nullptr) - { - char chName[42]; - char chKeyName[20]; - char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; + SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); + if(pSONYDLCInfo!=nullptr) + { + char chName[42]; + char chKeyName[20]; + char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; - memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); - // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. - // So we assume the first sku for the product is the one we want - // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char - memset(chKeyName, 0, sizeof(chKeyName)); - strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); + memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); + // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. + // So we assume the first sku for the product is the one we want + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a nullptr terminating char + memset(chKeyName, 0, sizeof(chKeyName)); + strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); #ifdef __ORBIS__ - strcpy_s(chName, chKeyName); + strcpy_s(chName, chKeyName); #else - sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); + sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif - app.GetDLCSkuIDFromProductList(chName,chSkuID); - // 4J-PB - need to check for an empty store - if(app.CheckForEmptyStore(iPad)==false) - { - if(app.DLCAlreadyPurchased(chSkuID)) - { - app.DownloadAlreadyPurchased(chSkuID); - } - else - { - app.Checkout(chSkuID); - } - } - } + app.GetDLCSkuIDFromProductList(chName,chSkuID); + // 4J-PB - need to check for an empty store + if(app.CheckForEmptyStore(iPad)==false) + { + if(app.DLCAlreadyPurchased(chSkuID)) + { + app.DownloadAlreadyPurchased(chSkuID); + } + else + { + app.Checkout(chSkuID); + } + } + } #endif #if defined _XBOX_ONE - if(ProfileManager.IsSignedIn(iPad)) - { - if (ProfileManager.IsSignedInLive(iPad)) - { - wstring ProductId; - app.GetDLCFullOfferIDForPackID(pClass->m_initData->selectedSession->data.texturePackParentId,ProductId); + if(ProfileManager.IsSignedIn(iPad)) + { + if (ProfileManager.IsSignedInLive(iPad)) + { + wstring ProductId; + app.GetDLCFullOfferIDForPackID(pClass->m_initData->selectedSession->data.texturePackParentId,ProductId); - StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),nullptr,nullptr); - } - else - { - // 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no active network connection user is unable to convert from Trial to Full texture pack and is not messaged why. - UINT uiIDA[1] = { IDS_CONFIRM_OK }; - ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); - } - } + StorageManager.InstallOffer(1,(WCHAR *)ProductId.c_str(),nullptr,nullptr); + } + else + { + // 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no active network connection user is unable to convert from Trial to Full texture pack and is not messaged why. + UINT uiIDA[1] = { IDS_CONFIRM_OK }; + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, iPad); + } + } #endif } @@ -2767,68 +2680,68 @@ int UIScene_LoadCreateJoinMenu::TexturePackDialogReturned(void *pParam,int iPad, } #if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__ -int UIScene_LoadCreateJoinMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) +int UIScene_LoadOrJoinMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - if(result==C4JStorage::EMessage_ResultAccept) - { + if(result==C4JStorage::EMessage_ResultAccept) + { #if defined(__PS3__) - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_LoadCreateJoinMenu::PSN_SignInReturned, pClass); + SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::PSN_SignInReturned, pClass); #elif defined __PSVITA__ - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadCreateJoinMenu::PSN_SignInReturned, pClass); + SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::PSN_SignInReturned, pClass); #else - SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_LoadCreateJoinMenu::PSN_SignInReturned, pClass, false, iPad); + SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::PSN_SignInReturned, pClass, false, iPad); #endif - } - else - { - pClass->m_bIgnoreInput = false; - } + } + else + { + pClass->m_bIgnoreInput = false; + } return 0; } -int UIScene_LoadCreateJoinMenu::PSN_SignInReturned(void *pParam,bool bContinue, int iPad) +int UIScene_LoadOrJoinMenu::PSN_SignInReturned(void *pParam,bool bContinue, int iPad) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - if(bContinue==true) - { - switch(pClass->m_eAction) - { - case eAction_ViewInvites: - // Check if we're signed in to LIVE - if(ProfileManager.IsSignedInLive(iPad)) - { + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; + if(bContinue==true) + { + switch(pClass->m_eAction) + { + case eAction_ViewInvites: + // Check if we're signed in to LIVE + if(ProfileManager.IsSignedInLive(iPad)) + { #if defined(__PS3__) - int ret = sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, SYS_MEMORY_CONTAINER_ID_INVALID); - app.DebugPrintf("sceNpBasicRecvMessageCustom return %d ( %08x )\n", ret, ret); + int ret = sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, SYS_MEMORY_CONTAINER_ID_INVALID); + app.DebugPrintf("sceNpBasicRecvMessageCustom return %d ( %08x )\n", ret, ret); #elif defined __PSVITA__ - SQRNetworkManager_Vita::RecvInviteGUI(); + SQRNetworkManager_Vita::RecvInviteGUI(); #else - SQRNetworkManager_Orbis::RecvInviteGUI(); + SQRNetworkManager_Orbis::RecvInviteGUI(); #endif - } - break; - case eAction_JoinGame: - pClass->CheckAndJoinGame(pClass->m_iGameListIndex); - break; - } - } - else - { - pClass->m_bIgnoreInput = false; - } + } + break; + case eAction_JoinGame: + pClass->CheckAndJoinGame(pClass->m_iGameListIndex); + break; + } + } + else + { + pClass->m_bIgnoreInput = false; + } return 0; } #endif #ifdef SONY_REMOTE_STORAGE_DOWNLOAD -void UIScene_LoadCreateJoinMenu::LaunchSaveTransfer() +void UIScene_LoadOrJoinMenu::LaunchSaveTransfer() { LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc; + loadingParams->func = &UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc; loadingParams->lpParam = (LPVOID)this; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); @@ -2838,113 +2751,110 @@ void UIScene_LoadCreateJoinMenu::LaunchSaveTransfer() completionData->iPad = DEFAULT_XUI_MENU_USER; loadingParams->completionData = completionData; - loadingParams->cancelFunc=&UIScene_LoadCreateJoinMenu::CancelSaveTransferCallback; - loadingParams->m_cancelFuncParam=this; + loadingParams->cancelFunc=&UIScene_LoadOrJoinMenu::CancelSaveTransferCallback; + loadingParams->m_cancelFuncParam=this; loadingParams->cancelText=IDS_TOOLTIPS_CANCEL; ui.NavigateToScene(m_iPad,eUIScene_FullscreenProgress, loadingParams); } - - - -int UIScene_LoadCreateJoinMenu::CreateDummySaveDataCallback(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::CreateDummySaveDataCallback(LPVOID lpParam,bool bRes) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) lpParam; - if(bRes) - { - pClass->m_eSaveTransferState = eSaveTransfer_GetSavesInfo; - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("CreateDummySaveDataCallback failed\n"); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; + if(bRes) + { + pClass->m_eSaveTransferState = eSaveTransfer_GetSavesInfo; + } + else + { + pClass->m_eSaveTransferState = eSaveTransfer_Error; + app.DebugPrintf("CreateDummySaveDataCallback failed\n"); - } - return 0; + } + return 0; } -int UIScene_LoadCreateJoinMenu::CrossSaveGetSavesInfoCallback(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, bool bRes) +int UIScene_LoadOrJoinMenu::CrossSaveGetSavesInfoCallback(LPVOID lpParam, SAVE_DETAILS *pSaveDetails, bool bRes) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) lpParam; - if(bRes) - { - pClass->m_eSaveTransferState = eSaveTransfer_GetFileData; - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("CrossSaveGetSavesInfoCallback failed\n"); - } - return 0; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; + if(bRes) + { + pClass->m_eSaveTransferState = eSaveTransfer_GetFileData; + } + else + { + pClass->m_eSaveTransferState = eSaveTransfer_Error; + app.DebugPrintf("CrossSaveGetSavesInfoCallback failed\n"); + } + return 0; } -int UIScene_LoadCreateJoinMenu::LoadCrossSaveDataCallback( void *pParam,bool bIsCorrupt, bool bIsOwner ) +int UIScene_LoadOrJoinMenu::LoadCrossSaveDataCallback( void *pParam,bool bIsCorrupt, bool bIsOwner ) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) pParam; - if(bIsCorrupt == false && bIsOwner) - { - pClass->m_eSaveTransferState = eSaveTransfer_CreatingNewSave; - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("LoadCrossSaveDataCallback failed \n"); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) pParam; + if(bIsCorrupt == false && bIsOwner) + { + pClass->m_eSaveTransferState = eSaveTransfer_CreatingNewSave; + } + else + { + pClass->m_eSaveTransferState = eSaveTransfer_Error; + app.DebugPrintf("LoadCrossSaveDataCallback failed \n"); - } - return 0; + } + return 0; } -int UIScene_LoadCreateJoinMenu::CrossSaveFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) +int UIScene_LoadOrJoinMenu::CrossSaveFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) pParam; - pClass->m_eSaveTransferState = eSaveTransfer_Idle; - return 0; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) pParam; + pClass->m_eSaveTransferState = eSaveTransfer_Idle; + return 0; } -int UIScene_LoadCreateJoinMenu::CrossSaveDeleteOnErrorReturned(LPVOID lpParam,bool bRes) +int UIScene_LoadOrJoinMenu::CrossSaveDeleteOnErrorReturned(LPVOID lpParam,bool bRes) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) lpParam; - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - return 0; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; + pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; + return 0; } -int UIScene_LoadCreateJoinMenu::RemoteSaveNotFoundCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) +int UIScene_LoadOrJoinMenu::RemoteSaveNotFoundCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) pParam; - pClass->m_eSaveTransferState = eSaveTransfer_Idle; - return 0; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) pParam; + pClass->m_eSaveTransferState = eSaveTransfer_Idle; + return 0; } // MGH - added this global to force the delete of the previous data, for the remote storage saves -// need to speak to Chris why this is necessary +// need to speak to Chris why this is necessary bool g_bForceVitaSaveWipe = false; -int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter ) +int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter ) { - m_bSaveTransferRunning = true; + m_bSaveTransferRunning = true; #ifdef __PS3__ - StorageManager.SetSaveTransferInProgress(true); + StorageManager.SetSaveTransferInProgress(true); #endif Compression::UseDefaultThreadStorage(); - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) lpParameter; - pClass->m_saveTransferDownloadCancelled = false; - m_bSaveTransferRunning = true; - bool bAbortCalled = false; - Minecraft *pMinecraft=Minecraft::GetInstance(); - bool bSaveFileCreated = false; - wchar_t wSaveName[128]; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParameter; + pClass->m_saveTransferDownloadCancelled = false; + m_bSaveTransferRunning = true; + bool bAbortCalled = false; + Minecraft *pMinecraft=Minecraft::GetInstance(); + bool bSaveFileCreated = false; + wchar_t wSaveName[128]; // get the save file size - pMinecraft->progressRenderer->progressStagePercentage(0); + pMinecraft->progressRenderer->progressStagePercentage(0); pMinecraft->progressRenderer->progressStart(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD); pMinecraft->progressRenderer->progressStage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD ); - ConsoleSaveFile* pSave = nullptr; + ConsoleSaveFile* pSave = nullptr; - pClass->m_eSaveTransferState = eSaveTransfer_GetRemoteSaveInfo; + pClass->m_eSaveTransferState = eSaveTransfer_GetRemoteSaveInfo; while(pClass->m_eSaveTransferState!=eSaveTransfer_Idle) @@ -2953,137 +2863,137 @@ int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParame { case eSaveTransfer_Idle: break; - case eSaveTransfer_GetRemoteSaveInfo: - app.DebugPrintf("UIScene_LoadCreateJoinMenu getSaveInfo\n"); - app.getRemoteStorage()->getSaveInfo(); - pClass->m_eSaveTransferState = eSaveTransfer_GettingRemoteSaveInfo; - break; - case eSaveTransfer_GettingRemoteSaveInfo: - if(pClass->m_saveTransferDownloadCancelled) - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - break; - } - if(app.getRemoteStorage()->waitingForSaveInfo() == false) - { - if(app.getRemoteStorage()->saveIsAvailable()) - { - if(app.getRemoteStorage()->saveVersionSupported()) - { - pClass->m_eSaveTransferState = eSaveTransfer_CreateDummyFile; - } - else - { - // must be a newer version of the save in the cloud that we don't support yet - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_WRONG_VERSION, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); - } - } - else - { - // no save available, inform the user about the functionality - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_NOT_AVAILABLE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); - } - } - break; - case eSaveTransfer_CreateDummyFile: - { - StorageManager.ResetSaveData(); - BYTE *compData = (BYTE *)StorageManager.AllocateSaveData( app.getRemoteStorage()->getSaveFilesize() ); - // Make our next save default to the name of the level - const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); - mbstowcs(wSaveName, pNameUTF8, strlen(pNameUTF8)+1); // plus null - StorageManager.SetSaveTitle(wSaveName); - PBYTE pbThumbnailData=nullptr; - DWORD dwThumbnailDataSize=0; + case eSaveTransfer_GetRemoteSaveInfo: + app.DebugPrintf("UIScene_LoadOrJoinMenu getSaveInfo\n"); + app.getRemoteStorage()->getSaveInfo(); + pClass->m_eSaveTransferState = eSaveTransfer_GettingRemoteSaveInfo; + break; + case eSaveTransfer_GettingRemoteSaveInfo: + if(pClass->m_saveTransferDownloadCancelled) + { + pClass->m_eSaveTransferState = eSaveTransfer_Error; + break; + } + if(app.getRemoteStorage()->waitingForSaveInfo() == false) + { + if(app.getRemoteStorage()->saveIsAvailable()) + { + if(app.getRemoteStorage()->saveVersionSupported()) + { + pClass->m_eSaveTransferState = eSaveTransfer_CreateDummyFile; + } + else + { + // must be a newer version of the save in the cloud that we don't support yet + UINT uiIDA[1]; + uiIDA[0]=IDS_CONFIRM_OK; + ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_WRONG_VERSION, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); + } + } + else + { + // no save available, inform the user about the functionality + UINT uiIDA[1]; + uiIDA[0]=IDS_CONFIRM_OK; + ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_NOT_AVAILABLE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); + } + } + break; + case eSaveTransfer_CreateDummyFile: + { + StorageManager.ResetSaveData(); + BYTE *compData = (BYTE *)StorageManager.AllocateSaveData( app.getRemoteStorage()->getSaveFilesize() ); + // Make our next save default to the name of the level + const char* pNameUTF8 = app.getRemoteStorage()->getSaveNameUTF8(); + mbstowcs(wSaveName, pNameUTF8, strlen(pNameUTF8)+1); // plus null + StorageManager.SetSaveTitle(wSaveName); + PBYTE pbThumbnailData=nullptr; + DWORD dwThumbnailDataSize=0; - PBYTE pbDataSaveImage=nullptr; - DWORD dwDataSizeSaveImage=0; + PBYTE pbDataSaveImage=nullptr; + DWORD dwDataSizeSaveImage=0; - StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t - StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that + StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t + StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that - BYTE bTextMetadata[88]; - ZeroMemory(bTextMetadata,88); - unsigned int hostOptions = app.getRemoteStorage()->getSaveHostOptions(); + BYTE bTextMetadata[88]; + ZeroMemory(bTextMetadata,88); + unsigned int hostOptions = app.getRemoteStorage()->getSaveHostOptions(); #ifdef __ORBIS__ - app.SetGameHostOption(hostOptions, eGameHostOption_WorldSize, e_worldSize_Classic); // force the classic world size on, otherwise it's unknown and we can't expand + app.SetGameHostOption(hostOptions, eGameHostOption_WorldSize, e_worldSize_Classic); // force the classic world size on, otherwise it's unknown and we can't expand #endif - int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, hostOptions, app.getRemoteStorage()->getSaveTexturePack() ); + int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, hostOptions, app.getRemoteStorage()->getSaveTexturePack() ); - // set the icon and save image - StorageManager.SetSaveImages(pbThumbnailData,dwThumbnailDataSize,pbDataSaveImage,dwDataSizeSaveImage,bTextMetadata,iTextMetadataBytes); + // set the icon and save image + StorageManager.SetSaveImages(pbThumbnailData,dwThumbnailDataSize,pbDataSaveImage,dwDataSizeSaveImage,bTextMetadata,iTextMetadataBytes); - app.getRemoteStorage()->waitForStorageManagerIdle(); - C4JStorage::ESaveGameState saveState = StorageManager.SaveSaveData( &UIScene_LoadCreateJoinMenu::CreateDummySaveDataCallback, lpParameter ); - if(saveState == C4JStorage::ESaveGame_Save) - { - pClass->m_eSaveTransferState = eSaveTransfer_CreatingDummyFile; - } - else - { - app.DebugPrintf("Failed to create dummy save file\n"); - pClass->m_eSaveTransferState = eSaveTransfer_Error; - } - } - break; - case eSaveTransfer_CreatingDummyFile: - break; - case eSaveTransfer_GetSavesInfo: - { - // we can't cancel here, we need the saves info so we can delete the file - if(pClass->m_saveTransferDownloadCancelled) - { - WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" - m_wstrStageText=wcTemp; - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - } + app.getRemoteStorage()->waitForStorageManagerIdle(); + C4JStorage::ESaveGameState saveState = StorageManager.SaveSaveData( &UIScene_LoadOrJoinMenu::CreateDummySaveDataCallback, lpParameter ); + if(saveState == C4JStorage::ESaveGame_Save) + { + pClass->m_eSaveTransferState = eSaveTransfer_CreatingDummyFile; + } + else + { + app.DebugPrintf("Failed to create dummy save file\n"); + pClass->m_eSaveTransferState = eSaveTransfer_Error; + } + } + break; + case eSaveTransfer_CreatingDummyFile: + break; + case eSaveTransfer_GetSavesInfo: + { + // we can't cancel here, we need the saves info so we can delete the file + if(pClass->m_saveTransferDownloadCancelled) + { + WCHAR wcTemp[256]; + swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" + m_wstrStageText=wcTemp; + pMinecraft->progressRenderer->progressStage( m_wstrStageText ); + } - app.getRemoteStorage()->waitForStorageManagerIdle(); - app.DebugPrintf("CALL GetSavesInfo B\n"); - C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(pClass->m_iPad,&UIScene_LoadCreateJoinMenu::CrossSaveGetSavesInfoCallback,pClass,"save"); - pClass->m_eSaveTransferState = eSaveTransfer_GettingSavesInfo; - } - break; - case eSaveTransfer_GettingSavesInfo: - if(pClass->m_saveTransferDownloadCancelled) - { - WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" - m_wstrStageText=wcTemp; - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - } - break; + app.getRemoteStorage()->waitForStorageManagerIdle(); + app.DebugPrintf("CALL GetSavesInfo B\n"); + C4JStorage::ESaveGameState eSGIStatus= StorageManager.GetSavesInfo(pClass->m_iPad,&UIScene_LoadOrJoinMenu::CrossSaveGetSavesInfoCallback,pClass,"save"); + pClass->m_eSaveTransferState = eSaveTransfer_GettingSavesInfo; + } + break; + case eSaveTransfer_GettingSavesInfo: + if(pClass->m_saveTransferDownloadCancelled) + { + WCHAR wcTemp[256]; + swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" + m_wstrStageText=wcTemp; + pMinecraft->progressRenderer->progressStage( m_wstrStageText ); + } + break; - case eSaveTransfer_GetFileData: - { - bSaveFileCreated = true; - StorageManager.GetSaveUniqueFileDir(pClass->m_downloadedUniqueFilename); + case eSaveTransfer_GetFileData: + { + bSaveFileCreated = true; + StorageManager.GetSaveUniqueFileDir(pClass->m_downloadedUniqueFilename); - if(pClass->m_saveTransferDownloadCancelled) - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - break; - } - PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - int idx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; - app.getRemoteStorage()->waitForStorageManagerIdle(); - bool bGettingOK = app.getRemoteStorage()->getSaveData(pClass->m_downloadedUniqueFilename, SaveTransferReturned, pClass); - if(bGettingOK) - { - pClass->m_eSaveTransferState = eSaveTransfer_GettingFileData; - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("app.getRemoteStorage()->getSaveData failed\n"); + if(pClass->m_saveTransferDownloadCancelled) + { + pClass->m_eSaveTransferState = eSaveTransfer_Error; + break; + } + PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); + int idx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; + app.getRemoteStorage()->waitForStorageManagerIdle(); + bool bGettingOK = app.getRemoteStorage()->getSaveData(pClass->m_downloadedUniqueFilename, SaveTransferReturned, pClass); + if(bGettingOK) + { + pClass->m_eSaveTransferState = eSaveTransfer_GettingFileData; + } + else + { + pClass->m_eSaveTransferState = eSaveTransfer_Error; + app.DebugPrintf("app.getRemoteStorage()->getSaveData failed\n"); - } - } + } + } case eSaveTransfer_GettingFileData: { @@ -3096,89 +3006,89 @@ int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParame swprintf(wcTemp,256, app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),dataProgress); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - if(pClass->m_saveTransferDownloadCancelled && bAbortCalled == false) - { - app.getRemoteStorage()->abort(); - bAbortCalled = true; - } + if(pClass->m_saveTransferDownloadCancelled && bAbortCalled == false) + { + app.getRemoteStorage()->abort(); + bAbortCalled = true; + } } break; case eSaveTransfer_FileDataRetrieved: - pClass->m_eSaveTransferState = eSaveTransfer_LoadSaveFromDisc; - break; - case eSaveTransfer_LoadSaveFromDisc: - { - if(pClass->m_saveTransferDownloadCancelled) - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - break; - } + pClass->m_eSaveTransferState = eSaveTransfer_LoadSaveFromDisc; + break; + case eSaveTransfer_LoadSaveFromDisc: + { + if(pClass->m_saveTransferDownloadCancelled) + { + pClass->m_eSaveTransferState = eSaveTransfer_Error; + break; + } - PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - int saveInfoIndex = -1; - for(int i=0;iiSaveC;i++) - { - if(strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, pClass->m_downloadedUniqueFilename) == 0) - { - //found it - saveInfoIndex = i; - } - } - if(saveInfoIndex == -1) - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("CrossSaveGetSavesInfoCallback failed - couldn't find save\n"); - } - else - { + PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); + int saveInfoIndex = -1; + for(int i=0;iiSaveC;i++) + { + if(strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, pClass->m_downloadedUniqueFilename) == 0) + { + //found it + saveInfoIndex = i; + } + } + if(saveInfoIndex == -1) + { + pClass->m_eSaveTransferState = eSaveTransfer_Error; + app.DebugPrintf("CrossSaveGetSavesInfoCallback failed - couldn't find save\n"); + } + else + { #ifdef __PS3__ - // ignore the CRC on PS3 - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex],&LoadCrossSaveDataCallback,pClass, true); + // ignore the CRC on PS3 + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex],&LoadCrossSaveDataCallback,pClass, true); #else - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex],&LoadCrossSaveDataCallback,pClass); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex],&LoadCrossSaveDataCallback,pClass); #endif - if(eLoadStatus == C4JStorage::ESaveGame_Load) - { - pClass->m_eSaveTransferState = eSaveTransfer_LoadingSaveFromDisc; - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_Error; - } - } - } - break; - case eSaveTransfer_LoadingSaveFromDisc: + if(eLoadStatus == C4JStorage::ESaveGame_Load) + { + pClass->m_eSaveTransferState = eSaveTransfer_LoadingSaveFromDisc; + } + else + { + pClass->m_eSaveTransferState = eSaveTransfer_Error; + } + } + } + break; + case eSaveTransfer_LoadingSaveFromDisc: - break; + break; case eSaveTransfer_CreatingNewSave: - { - unsigned int fileSize = StorageManager.GetSaveSize(); - byteArray ba(fileSize); - StorageManager.GetSaveData(ba.data, &fileSize); - assert(ba.length == fileSize); + { + unsigned int fileSize = StorageManager.GetSaveSize(); + byteArray ba(fileSize); + StorageManager.GetSaveData(ba.data, &fileSize); + assert(ba.length == fileSize); StorageManager.ResetSaveData(); - { - PBYTE pbThumbnailData=nullptr; - DWORD dwThumbnailDataSize=0; + { + PBYTE pbThumbnailData=nullptr; + DWORD dwThumbnailDataSize=0; - PBYTE pbDataSaveImage=nullptr; - DWORD dwDataSizeSaveImage=0; + PBYTE pbDataSaveImage=nullptr; + DWORD dwDataSizeSaveImage=0; - StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t - StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that + StorageManager.GetDefaultSaveImage(&pbDataSaveImage, &dwDataSizeSaveImage); // Get the default save thumbnail (as set by SetDefaultImages) for use on saving games t + StorageManager.GetDefaultSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); // Get the default save image (as set by SetDefaultImages) for use on saving games that - BYTE bTextMetadata[88]; - ZeroMemory(bTextMetadata,88); - unsigned int remoteHostOptions = app.getRemoteStorage()->getSaveHostOptions(); - app.SetGameHostOption(eGameHostOption_All, remoteHostOptions ); - int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, remoteHostOptions, app.getRemoteStorage()->getSaveTexturePack() ); + BYTE bTextMetadata[88]; + ZeroMemory(bTextMetadata,88); + unsigned int remoteHostOptions = app.getRemoteStorage()->getSaveHostOptions(); + app.SetGameHostOption(eGameHostOption_All, remoteHostOptions ); + int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, remoteHostOptions, app.getRemoteStorage()->getSaveTexturePack() ); - // set the icon and save image - StorageManager.SetSaveImages(pbThumbnailData,dwThumbnailDataSize,pbDataSaveImage,dwDataSizeSaveImage,bTextMetadata,iTextMetadataBytes); - } + // set the icon and save image + StorageManager.SetSaveImages(pbThumbnailData,dwThumbnailDataSize,pbDataSaveImage,dwDataSizeSaveImage,bTextMetadata,iTextMetadataBytes); + } #ifdef SPLIT_SAVES @@ -3191,195 +3101,195 @@ int UIScene_LoadCreateJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParame #else pSave = new ConsoleSaveFileOriginal( wSaveName, ba.data, ba.length, false, app.getRemoteStorage()->getSavePlatform() ); pClass->m_eSaveTransferState = eSaveTransfer_Converting; - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_CONVERTING); + pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_CONVERTING); #endif delete ba.data; } - break; + break; case eSaveTransfer_Converting: - { + { pSave->ConvertToLocalPlatform(); // check if we need to convert this file from PS3->PS4 pClass->m_eSaveTransferState = eSaveTransfer_Saving; pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - StorageManager.SetSaveTitle(wSaveName); - StorageManager.SetSaveUniqueFilename(pClass->m_downloadedUniqueFilename); + StorageManager.SetSaveTitle(wSaveName); + StorageManager.SetSaveUniqueFilename(pClass->m_downloadedUniqueFilename); - app.getRemoteStorage()->waitForStorageManagerIdle(); // we need to wait for the save system to be idle here, as Flush doesn't check for it. + app.getRemoteStorage()->waitForStorageManagerIdle(); // we need to wait for the save system to be idle here, as Flush doesn't check for it. pSave->Flush(false, false); - } + } break; case eSaveTransfer_Saving: - { - // On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete - // the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving. + { + // On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete + // the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving. #if defined(_DURANGO) || defined(__ORBIS__) - while(StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle ) - { - Sleep(10); - StorageManager.Tick(); - } + while(StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle ) + { + Sleep(10); + StorageManager.Tick(); + } #endif - delete pSave; + delete pSave; - pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); - pClass->m_eSaveTransferState = eSaveTransfer_Succeeded; - } + pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); + pClass->m_eSaveTransferState = eSaveTransfer_Succeeded; + } break; - case eSaveTransfer_Succeeded: - { - // if we've arrived here, the save has been created successfully - pClass->m_iState=e_SavesRepopulate; - pClass->updateTooltips(); - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - app.getRemoteStorage()->waitForStorageManagerIdle(); // wait for everything to complete before we hand control back to the player - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); - pClass->m_eSaveTransferState = eSaveTransfer_Finished; - } - break; + case eSaveTransfer_Succeeded: + { + // if we've arrived here, the save has been created successfully + pClass->m_iState=e_SavesRepopulate; + pClass->updateTooltips(); + UINT uiIDA[1]; + uiIDA[0]=IDS_CONFIRM_OK; + app.getRemoteStorage()->waitForStorageManagerIdle(); // wait for everything to complete before we hand control back to the player + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); + pClass->m_eSaveTransferState = eSaveTransfer_Finished; + } + break; - case eSaveTransfer_Cancelled: // this is no longer used - { - assert(0); //pClass->m_eSaveTransferState = eSaveTransfer_Idle; - } - break; + case eSaveTransfer_Cancelled: // this is no longer used + { + assert(0); //pClass->m_eSaveTransferState = eSaveTransfer_Idle; + } + break; case eSaveTransfer_Error: - { - if(bSaveFileCreated) - { - if(pClass->m_saveTransferDownloadCancelled) - { - WCHAR wcTemp[256]; - swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" - m_wstrStageText=wcTemp; - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - pMinecraft->progressRenderer->progressStage( m_wstrStageText ); - } - // if the save file has already been created we have to delete it again if there's been an error - PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); - int saveInfoIndex = -1; - for(int i=0;iiSaveC;i++) - { - if(strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, pClass->m_downloadedUniqueFilename) == 0) - { - //found it - saveInfoIndex = i; - } - } - if(saveInfoIndex == -1) - { - app.DebugPrintf("eSaveTransfer_Error failed - couldn't find save\n"); - assert(0); - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - } - else - { - // delete the save file - app.getRemoteStorage()->waitForStorageManagerIdle(); - C4JStorage::ESaveGameState eDeleteStatus = StorageManager.DeleteSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex],UIScene_LoadCreateJoinMenu::CrossSaveDeleteOnErrorReturned,pClass); - if(eDeleteStatus == C4JStorage::ESaveGame_Delete) - { - pClass->m_eSaveTransferState = eSaveTransfer_ErrorDeletingSave; - } - else - { - app.DebugPrintf("StorageManager.DeleteSaveData failed!!\n"); - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - } - } - } - else - { - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; - } - } + { + if(bSaveFileCreated) + { + if(pClass->m_saveTransferDownloadCancelled) + { + WCHAR wcTemp[256]; + swprintf(wcTemp,256, app.GetString(IDS_CANCEL)); // MGH - should change this string to "cancelling download" + m_wstrStageText=wcTemp; + pMinecraft->progressRenderer->progressStage( m_wstrStageText ); + pMinecraft->progressRenderer->progressStage( m_wstrStageText ); + } + // if the save file has already been created we have to delete it again if there's been an error + PSAVE_DETAILS pSaveDetails=StorageManager.ReturnSavesInfo(); + int saveInfoIndex = -1; + for(int i=0;iiSaveC;i++) + { + if(strcmp(pSaveDetails->SaveInfoA[i].UTF8SaveFilename, pClass->m_downloadedUniqueFilename) == 0) + { + //found it + saveInfoIndex = i; + } + } + if(saveInfoIndex == -1) + { + app.DebugPrintf("eSaveTransfer_Error failed - couldn't find save\n"); + assert(0); + pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; + } + else + { + // delete the save file + app.getRemoteStorage()->waitForStorageManagerIdle(); + C4JStorage::ESaveGameState eDeleteStatus = StorageManager.DeleteSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex],UIScene_LoadOrJoinMenu::CrossSaveDeleteOnErrorReturned,pClass); + if(eDeleteStatus == C4JStorage::ESaveGame_Delete) + { + pClass->m_eSaveTransferState = eSaveTransfer_ErrorDeletingSave; + } + else + { + app.DebugPrintf("StorageManager.DeleteSaveData failed!!\n"); + pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; + } + } + } + else + { + pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; + } + } break; - case eSaveTransfer_ErrorDeletingSave: - break; - case eSaveTransfer_ErrorMesssage: - { - app.getRemoteStorage()->waitForStorageManagerIdle(); // wait for everything to complete before we hand control back to the player - if(pClass->m_saveTransferDownloadCancelled) - { - pClass->m_eSaveTransferState = eSaveTransfer_Idle; - } - else - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - UINT errorMessage = IDS_SAVE_TRANSFER_DOWNLOADFAILED; - if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) - { - errorMessage = IDS_ERROR_NETWORK; // show "A network error has occurred." + case eSaveTransfer_ErrorDeletingSave: + break; + case eSaveTransfer_ErrorMesssage: + { + app.getRemoteStorage()->waitForStorageManagerIdle(); // wait for everything to complete before we hand control back to the player + if(pClass->m_saveTransferDownloadCancelled) + { + pClass->m_eSaveTransferState = eSaveTransfer_Idle; + } + else + { + UINT uiIDA[1]; + uiIDA[0]=IDS_CONFIRM_OK; + UINT errorMessage = IDS_SAVE_TRANSFER_DOWNLOADFAILED; + if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) + { + errorMessage = IDS_ERROR_NETWORK; // show "A network error has occurred." #ifdef __ORBIS__ - if(!ProfileManager.isSignedInPSN(ProfileManager.GetPrimaryPad())) - { - errorMessage = IDS_PRO_NOTONLINE_TEXT; // show "not signed into PSN" - } + if(!ProfileManager.isSignedInPSN(ProfileManager.GetPrimaryPad())) + { + errorMessage = IDS_PRO_NOTONLINE_TEXT; // show "not signed into PSN" + } #endif #ifdef __VITA__ - if(!ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) - { - errorMessage = IDS_PRO_NOTONLINE_TEXT; // show "not signed into PSN" - } + if(!ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) + { + errorMessage = IDS_PRO_NOTONLINE_TEXT; // show "not signed into PSN" + } #endif - } - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); - pClass->m_eSaveTransferState = eSaveTransfer_Finished; - } - if(bSaveFileCreated) // save file has been created, then deleted. - pClass->m_iState=e_SavesRepopulateAfterDelete; - else - pClass->m_iState=e_SavesRepopulate; - pClass->updateTooltips(); - } - break; - case eSaveTransfer_Finished: - { - } - // waiting to dismiss the dialog - break; + } + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); + pClass->m_eSaveTransferState = eSaveTransfer_Finished; + } + if(bSaveFileCreated) // save file has been created, then deleted. + pClass->m_iState=e_SavesRepopulateAfterDelete; + else + pClass->m_iState=e_SavesRepopulate; + pClass->updateTooltips(); + } + break; + case eSaveTransfer_Finished: + { + } + // waiting to dismiss the dialog + break; } Sleep(50); } - m_bSaveTransferRunning = false; + m_bSaveTransferRunning = false; #ifdef __PS3__ - StorageManager.SetSaveTransferInProgress(false); + StorageManager.SetSaveTransferInProgress(false); #endif return 0; } -void UIScene_LoadCreateJoinMenu::SaveTransferReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) +void UIScene_LoadOrJoinMenu::SaveTransferReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) lpParam; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; if(s == SonyRemoteStorage::e_getDataSucceeded) - { + { pClass->m_eSaveTransferState = eSaveTransfer_FileDataRetrieved; - } + } else - { + { pClass->m_eSaveTransferState = eSaveTransfer_Error; - app.DebugPrintf("SaveTransferReturned failed with error code : 0x%08x\n", error_code); - } + app.DebugPrintf("SaveTransferReturned failed with error code : 0x%08x\n", error_code); + } } -ConsoleSaveFile* UIScene_LoadCreateJoinMenu::SonyCrossSaveConvert() +ConsoleSaveFile* UIScene_LoadOrJoinMenu::SonyCrossSaveConvert() { return nullptr; } -void UIScene_LoadCreateJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) +void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) lpParam; - pClass->m_saveTransferDownloadCancelled = true; - ui.SetTooltips( DEFAULT_XUI_MENU_USER, -1, -1, -1, -1,-1,-1,-1,-1); // MGH - added - remove the "cancel" tooltip, so the player knows it's underway (really needs a "cancelling" message) + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; + pClass->m_saveTransferDownloadCancelled = true; + ui.SetTooltips( DEFAULT_XUI_MENU_USER, -1, -1, -1, -1,-1,-1,-1,-1); // MGH - added - remove the "cancel" tooltip, so the player knows it's underway (really needs a "cancelling" message) } #endif @@ -3388,10 +3298,10 @@ void UIScene_LoadCreateJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) #ifdef SONY_REMOTE_STORAGE_UPLOAD -void UIScene_LoadCreateJoinMenu::LaunchSaveUpload() +void UIScene_LoadOrJoinMenu::LaunchSaveUpload() { LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &UIScene_LoadCreateJoinMenu::UploadSonyCrossSaveThreadProc; + loadingParams->func = &UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc; loadingParams->lpParam = (LPVOID)this; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); @@ -3402,32 +3312,32 @@ void UIScene_LoadCreateJoinMenu::LaunchSaveUpload() loadingParams->completionData = completionData; // 4J-PB - Waiting for Sony to fix canceling a save upload - loadingParams->cancelFunc=&UIScene_LoadCreateJoinMenu::CancelSaveUploadCallback; - loadingParams->m_cancelFuncParam = this; + loadingParams->cancelFunc=&UIScene_LoadOrJoinMenu::CancelSaveUploadCallback; + loadingParams->m_cancelFuncParam = this; loadingParams->cancelText=IDS_TOOLTIPS_CANCEL; ui.NavigateToScene(m_iPad,eUIScene_FullscreenProgress, loadingParams); } -int UIScene_LoadCreateJoinMenu::CrossSaveUploadFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) +int UIScene_LoadOrJoinMenu::CrossSaveUploadFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) pParam; - pClass->m_eSaveUploadState = eSaveUpload_Idle; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) pParam; + pClass->m_eSaveUploadState = eSaveUpload_Idle; - return 0; + return 0; } -int UIScene_LoadCreateJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter ) +int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter ) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) lpParameter; - pClass->m_saveTransferUploadCancelled = false; - bool bAbortCalled = false; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParameter; + pClass->m_saveTransferUploadCancelled = false; + bool bAbortCalled = false; Minecraft *pMinecraft=Minecraft::GetInstance(); // get the save file size - pMinecraft->progressRenderer->progressStagePercentage(0); + pMinecraft->progressRenderer->progressStagePercentage(0); pMinecraft->progressRenderer->progressStart(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD); pMinecraft->progressRenderer->progressStage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD ); @@ -3435,15 +3345,15 @@ int UIScene_LoadCreateJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParamete int idx = pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC; bool bSettingOK = app.getRemoteStorage()->setSaveData(&pSaveDetails->SaveInfoA[idx], SaveUploadReturned, pClass); - if(bSettingOK) + if(bSettingOK) { pClass->m_eSaveUploadState = eSaveUpload_UploadingFileData; pMinecraft->progressRenderer->progressStagePercentage(0); } else - { + { pClass->m_eSaveUploadState = eSaveUpload_Error; - } + } while(pClass->m_eSaveUploadState!=eSaveUpload_Idle) { @@ -3463,43 +3373,43 @@ int UIScene_LoadCreateJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParamete m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); // 4J-PB - Waiting for Sony to fix canceling a save upload - if(pClass->m_saveTransferUploadCancelled && bAbortCalled == false) - { - // we only really want to be able to cancel during the download of data, if it's taking a long time - app.getRemoteStorage()->abort(); - bAbortCalled = true; - } + if(pClass->m_saveTransferUploadCancelled && bAbortCalled == false) + { + // we only really want to be able to cancel during the download of data, if it's taking a long time + app.getRemoteStorage()->abort(); + bAbortCalled = true; + } } break; - case eSaveUpload_FileDataUploaded: - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); - pClass->m_eSaveUploadState = esaveUpload_Finished; - } - break; - case eSaveUpload_Cancelled: // this is no longer used - assert(0);// pClass->m_eSaveUploadState = eSaveUpload_Idle; - break; - case eSaveUpload_Error: - { - if(pClass->m_saveTransferUploadCancelled) - { - pClass->m_eSaveUploadState = eSaveUpload_Idle; - } - else - { - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); - pClass->m_eSaveUploadState = esaveUpload_Finished; - } - } + case eSaveUpload_FileDataUploaded: + { + UINT uiIDA[1]; + uiIDA[0]=IDS_CONFIRM_OK; + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); + pClass->m_eSaveUploadState = esaveUpload_Finished; + } + break; + case eSaveUpload_Cancelled: // this is no longer used + assert(0);// pClass->m_eSaveUploadState = eSaveUpload_Idle; + break; + case eSaveUpload_Error: + { + if(pClass->m_saveTransferUploadCancelled) + { + pClass->m_eSaveUploadState = eSaveUpload_Idle; + } + else + { + UINT uiIDA[1]; + uiIDA[0]=IDS_CONFIRM_OK; + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); + pClass->m_eSaveUploadState = esaveUpload_Finished; + } + } + break; + case esaveUpload_Finished: + // waiting for dialog to be dismissed break; - case esaveUpload_Finished: - // waiting for dialog to be dismissed - break; } Sleep(50); } @@ -3508,68 +3418,68 @@ int UIScene_LoadCreateJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParamete } -void UIScene_LoadCreateJoinMenu::SaveUploadReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) +void UIScene_LoadOrJoinMenu::SaveUploadReturned(LPVOID lpParam, SonyRemoteStorage::Status s, int error_code) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) lpParam; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; - if(pClass->m_saveTransferUploadCancelled) - { - UINT uiIDA[1] = { IDS_CONFIRM_OK }; - ui.RequestErrorMessage( IDS_CANCEL_UPLOAD_TITLE, IDS_CANCEL_UPLOAD_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), CrossSaveUploadFinishedCallback, pClass ); - pClass->m_eSaveUploadState=esaveUpload_Finished; - } - else + if(pClass->m_saveTransferUploadCancelled) { - if(s == SonyRemoteStorage::e_setDataSucceeded) - pClass->m_eSaveUploadState = eSaveUpload_FileDataUploaded; - else if ( !pClass->m_saveTransferUploadCancelled ) - pClass->m_eSaveUploadState = eSaveUpload_Error; - } + UINT uiIDA[1] = { IDS_CONFIRM_OK }; + ui.RequestErrorMessage( IDS_CANCEL_UPLOAD_TITLE, IDS_CANCEL_UPLOAD_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), CrossSaveUploadFinishedCallback, pClass ); + pClass->m_eSaveUploadState=esaveUpload_Finished; + } + else + { + if(s == SonyRemoteStorage::e_setDataSucceeded) + pClass->m_eSaveUploadState = eSaveUpload_FileDataUploaded; + else if ( !pClass->m_saveTransferUploadCancelled ) + pClass->m_eSaveUploadState = eSaveUpload_Error; + } } -void UIScene_LoadCreateJoinMenu::CancelSaveUploadCallback(LPVOID lpParam) +void UIScene_LoadOrJoinMenu::CancelSaveUploadCallback(LPVOID lpParam) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu *) lpParam; - pClass->m_saveTransferUploadCancelled = true; - app.DebugPrintf("m_saveTransferUploadCancelled = true\n"); - ui.SetTooltips( DEFAULT_XUI_MENU_USER, -1, -1, -1, -1,-1,-1,-1,-1); // MGH - added - remove the "cancel" tooltip, so the player knows it's underway (really needs a "cancelling" message) + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParam; + pClass->m_saveTransferUploadCancelled = true; + app.DebugPrintf("m_saveTransferUploadCancelled = true\n"); + ui.SetTooltips( DEFAULT_XUI_MENU_USER, -1, -1, -1, -1,-1,-1,-1,-1); // MGH - added - remove the "cancel" tooltip, so the player knows it's underway (really needs a "cancelling" message) - pClass->m_bIgnoreInput = true; + pClass->m_bIgnoreInput = true; } -int UIScene_LoadCreateJoinMenu::SaveTransferDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) +int UIScene_LoadOrJoinMenu::SaveTransferDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; - // results switched for this dialog - if(result==C4JStorage::EMessage_ResultAccept) - { - // upload the save - pClass->LaunchSaveUpload(); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; + // results switched for this dialog + if(result==C4JStorage::EMessage_ResultAccept) + { + // upload the save + pClass->LaunchSaveUpload(); - pClass->m_bIgnoreInput=false; - } - else - { - pClass->m_bIgnoreInput=false; - } - return 0; + pClass->m_bIgnoreInput=false; + } + else + { + pClass->m_bIgnoreInput=false; + } + return 0; } #endif // SONY_REMOTE_STORAGE_UPLOAD #if defined _XBOX_ONE -void UIScene_LoadCreateJoinMenu::LaunchSaveTransfer() +void UIScene_LoadOrJoinMenu::LaunchSaveTransfer() { - SaveTransferStateContainer *stateContainer = new SaveTransferStateContainer(); - stateContainer->m_iProgress = 0; - stateContainer->m_bSaveTransferInProgress = false; - stateContainer->m_bSaveTransferCancelled = false; - stateContainer->m_iPad = m_iPad; - stateContainer->m_eSaveTransferState = C4JStorage::eSaveTransfer_Idle; - stateContainer->m_pClass = this; + SaveTransferStateContainer *stateContainer = new SaveTransferStateContainer(); + stateContainer->m_iProgress = 0; + stateContainer->m_bSaveTransferInProgress = false; + stateContainer->m_bSaveTransferCancelled = false; + stateContainer->m_iPad = m_iPad; + stateContainer->m_eSaveTransferState = C4JStorage::eSaveTransfer_Idle; + stateContainer->m_pClass = this; LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc; + loadingParams->func = &UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc; loadingParams->lpParam = (LPVOID)stateContainer; UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); @@ -3580,7 +3490,7 @@ void UIScene_LoadCreateJoinMenu::LaunchSaveTransfer() completionData->bRequiresUserAction=TRUE; loadingParams->completionData = completionData; - loadingParams->cancelFunc=&UIScene_LoadCreateJoinMenu::CancelSaveTransferCallback; + loadingParams->cancelFunc=&UIScene_LoadOrJoinMenu::CancelSaveTransferCallback; loadingParams->m_cancelFuncParam=stateContainer; loadingParams->cancelText=IDS_TOOLTIPS_CANCEL; @@ -3589,22 +3499,22 @@ void UIScene_LoadCreateJoinMenu::LaunchSaveTransfer() -int UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) +int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) { Compression::UseDefaultThreadStorage(); - SaveTransferStateContainer *pStateContainer = (SaveTransferStateContainer *) lpParameter; + SaveTransferStateContainer *pStateContainer = (SaveTransferStateContainer *) lpParameter; Minecraft *pMinecraft=Minecraft::GetInstance(); ConsoleSaveFile* pSave = nullptr; - while(StorageManager.SaveTransferClearState()!=C4JStorage::eSaveTransfer_Idle) - { - Sleep(5); - } + while(StorageManager.SaveTransferClearState()!=C4JStorage::eSaveTransfer_Idle) + { + Sleep(5); + } pStateContainer->m_bSaveTransferInProgress=true; - UIScene_LoadCreateJoinMenu::s_eSaveTransferFile = eSaveTransferFile_Marker; + UIScene_LoadOrJoinMenu::s_eSaveTransferFile = eSaveTransferFile_Marker; RequestFileSize( pStateContainer, L"completemarker" ); while((pStateContainer->m_eSaveTransferState!=C4JStorage::eSaveTransfer_Idle) && pStateContainer->m_bSaveTransferInProgress && !pStateContainer->m_bSaveTransferCancelled) @@ -3614,18 +3524,18 @@ int UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParamete case C4JStorage::eSaveTransfer_Idle: break; case C4JStorage::eSaveTransfer_FileSizeRetrieved: - switch(UIScene_LoadCreateJoinMenu::s_eSaveTransferFile) + switch(UIScene_LoadOrJoinMenu::s_eSaveTransferFile) { case eSaveTransferFile_Marker: - if(UIScene_LoadCreateJoinMenu::s_ulFileSize == 0) - { - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_NONE_FOUND); - pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - } - else - { - RequestFileData( pStateContainer, L"completemarker" ); - } + if(UIScene_LoadOrJoinMenu::s_ulFileSize == 0) + { + pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_NONE_FOUND); + pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; + } + else + { + RequestFileData( pStateContainer, L"completemarker" ); + } break; case eSaveTransferFile_Metadata: RequestFileData( pStateContainer, L"metadata" ); @@ -3639,25 +3549,25 @@ int UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParamete break; case C4JStorage::eSaveTransfer_FileDataRetrieved: - switch(UIScene_LoadCreateJoinMenu::s_eSaveTransferFile) + switch(UIScene_LoadOrJoinMenu::s_eSaveTransferFile) { case eSaveTransferFile_Marker: - // MGH - the marker file now contains the save file version number - // if the version is higher than we handle, cancel the download. - if(UIScene_LoadCreateJoinMenu::s_transferData[0] > SAVE_FILE_VERSION_NUMBER) - { - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_NONE_FOUND); - pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - } - else + // MGH - the marker file now contains the save file version number + // if the version is higher than we handle, cancel the download. + if(UIScene_LoadOrJoinMenu::s_transferData[0] > SAVE_FILE_VERSION_NUMBER) { - UIScene_LoadCreateJoinMenu::s_eSaveTransferFile = eSaveTransferFile_Metadata; - RequestFileSize( pStateContainer, L"metadata" ); - } + pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_NONE_FOUND); + pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; + } + else + { + UIScene_LoadOrJoinMenu::s_eSaveTransferFile = eSaveTransferFile_Metadata; + RequestFileSize( pStateContainer, L"metadata" ); + } break; case eSaveTransferFile_Metadata: { - ByteArrayInputStream bais(UIScene_LoadCreateJoinMenu::s_transferData); + ByteArrayInputStream bais(UIScene_LoadOrJoinMenu::s_transferData); DataInputStream dis(&bais); wstring saveTitle = dis.readUTF(); @@ -3665,9 +3575,9 @@ int UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParamete wstring saveUniqueName = dis.readUTF(); - // 4J Stu - Don't set this any more. We added it so that we could share the ban list data for this save - // However if the player downloads the same save multiple times, it will overwrite the previous version - // with that filname, and they could have made changes to it. + // 4J Stu - Don't set this any more. We added it so that we could share the ban list data for this save + // However if the player downloads the same save multiple times, it will overwrite the previous version + // with that filname, and they could have made changes to it. //StorageManager.SetSaveUniqueFilename((wchar_t *)saveUniqueName.c_str()); int thumbnailSize = dis.readInt(); @@ -3678,54 +3588,54 @@ int UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParamete - // retrieve the seed value from the image metadata, we need to change to host options, then set it back again - bool bHostOptionsRead = false; - unsigned int uiHostOptions = 0; - DWORD dwTexturePack; - int64_t seedVal; + // retrieve the seed value from the image metadata, we need to change to host options, then set it back again + bool bHostOptionsRead = false; + unsigned int uiHostOptions = 0; + DWORD dwTexturePack; + int64_t seedVal; - char szSeed[50]; - ZeroMemory(szSeed,50); - app.GetImageTextData(ba.data,ba.length,(unsigned char *)&szSeed,uiHostOptions,bHostOptionsRead,dwTexturePack); - sscanf_s(szSeed, "%I64d", &seedVal); + char szSeed[50]; + ZeroMemory(szSeed,50); + app.GetImageTextData(ba.data,ba.length,(unsigned char *)&szSeed,uiHostOptions,bHostOptionsRead,dwTexturePack); + sscanf_s(szSeed, "%I64d", &seedVal); - app.SetGameHostOption(uiHostOptions, eGameHostOption_WorldSize, e_worldSize_Classic); // force the classic world size on, otherwise it's unknown and we can't expand + app.SetGameHostOption(uiHostOptions, eGameHostOption_WorldSize, e_worldSize_Classic); // force the classic world size on, otherwise it's unknown and we can't expand - BYTE bTextMetadata[88]; - ZeroMemory(bTextMetadata,88); + BYTE bTextMetadata[88]; + ZeroMemory(bTextMetadata,88); - int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, seedVal, true, uiHostOptions, dwTexturePack); - // set the icon and save image - StorageManager.SetSaveImages(ba.data, ba.length, nullptr, 0, bTextMetadata, iTextMetadataBytes); + int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, seedVal, true, uiHostOptions, dwTexturePack); + // set the icon and save image + StorageManager.SetSaveImages(ba.data, ba.length, nullptr, 0, bTextMetadata, iTextMetadataBytes); delete ba.data; } - UIScene_LoadCreateJoinMenu::s_transferData = byteArray(); - UIScene_LoadCreateJoinMenu::s_eSaveTransferFile = eSaveTransferFile_SaveData; + UIScene_LoadOrJoinMenu::s_transferData = byteArray(); + UIScene_LoadOrJoinMenu::s_eSaveTransferFile = eSaveTransferFile_SaveData; RequestFileSize( pStateContainer, L"savedata" ); } break; case eSaveTransferFile_SaveData: { #ifdef SPLIT_SAVES - if(!pStateContainer->m_bSaveTransferCancelled) - { - ConsoleSaveFileOriginal oldFormatSave( L"Temp name", UIScene_LoadCreateJoinMenu::s_transferData.data, UIScene_LoadCreateJoinMenu::s_transferData.length, false, SAVE_FILE_PLATFORM_X360 ); - pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer ); + if(!pStateContainer->m_bSaveTransferCancelled) + { + ConsoleSaveFileOriginal oldFormatSave( L"Temp name", UIScene_LoadOrJoinMenu::s_transferData.data, UIScene_LoadOrJoinMenu::s_transferData.length, false, SAVE_FILE_PLATFORM_X360 ); + pSave = new ConsoleSaveFileSplit( &oldFormatSave, false, pMinecraft->progressRenderer ); - pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); - if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); - } + pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_STAGE_SAVING); + if(!pStateContainer->m_bSaveTransferCancelled) pSave->Flush(false,false); + } pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Saving; #else pSave = new ConsoleSaveFileOriginal( wSaveName, m_transferData.data, m_transferData.length, false, SAVE_FILE_PLATFORM_X360 ); pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Converting; #endif - delete UIScene_LoadCreateJoinMenu::s_transferData.data; - UIScene_LoadCreateJoinMenu::s_transferData = byteArray(); + delete UIScene_LoadOrJoinMenu::s_transferData.data; + UIScene_LoadOrJoinMenu::s_transferData = byteArray(); } break; }; @@ -3753,13 +3663,13 @@ int UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParamete // On Durango/Orbis, we need to wait for all the asynchronous saving processes to complete before destroying the levels, as that will ultimately delete // the directory level storage & therefore the ConsoleSaveSplit instance, which needs to be around until all the sub files have completed saving. #if defined(_DURANGO) || defined(__ORBIS__) - pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); + pMinecraft->progressRenderer->progressStage(IDS_PROGRESS_SAVING_TO_DISC); - while(StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle ) + while(StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle ) { Sleep(10); - // 4J Stu - DO NOT tick this here. The main thread should be the only place ticking the StorageManager. You WILL get crashes. + // 4J Stu - DO NOT tick this here. The main thread should be the only place ticking the StorageManager. You WILL get crashes. //StorageManager.Tick(); } #endif @@ -3767,22 +3677,22 @@ int UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParamete delete pSave; #ifdef _XBOX_ONE - pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE); + pMinecraft->progressRenderer->progressStage(IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE); #endif pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - // wipe the list and repopulate it - if(!pStateContainer->m_bSaveTransferCancelled) pStateContainer->m_pClass->m_iState=e_SavesRepopulateAfterTransferDownload; + // wipe the list and repopulate it + if(!pStateContainer->m_bSaveTransferCancelled) pStateContainer->m_pClass->m_iState=e_SavesRepopulateAfterTransferDownload; //pClass->m_iProgress+=1; //if(pClass->m_iProgress==101) //{ - // pClass->m_iProgress=0; - // pClass->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; - // pMinecraft->progressRenderer->progressStage( IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE ); + // pClass->m_iProgress=0; + // pClass->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; + // pMinecraft->progressRenderer->progressStage( IDS_SAVE_TRANSFER_DOWNLOAD_AND_CONVERT_COMPLETE ); - // break; + // break; //} //pMinecraft->progressRenderer->progressStagePercentage(pClass->m_iProgress); @@ -3805,12 +3715,12 @@ int UIScene_LoadCreateJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParamete pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; pStateContainer->m_bSaveTransferInProgress=false; - delete pStateContainer; + delete pStateContainer; return 0; } -void UIScene_LoadCreateJoinMenu::RequestFileSize( SaveTransferStateContainer *pClass, wchar_t *filename ) +void UIScene_LoadOrJoinMenu::RequestFileSize( SaveTransferStateContainer *pClass, wchar_t *filename ) { Minecraft *pMinecraft=Minecraft::GetInstance(); @@ -3832,24 +3742,24 @@ void UIScene_LoadCreateJoinMenu::RequestFileSize( SaveTransferStateContainer *pC #endif { do - { - pMinecraft->progressRenderer->progressStart(IDS_SAVETRANSFER_TITLE_GET); - pMinecraft->progressRenderer->progressStage( IDS_SAVETRANSFER_STAGE_GET_DETAILS ); - Sleep(1); - pClass->m_eSaveTransferState=StorageManager.SaveTransferGetDetails(pClass->m_iPad,C4JStorage::eGlobalStorage_TitleUser,filename,&UIScene_LoadCreateJoinMenu::SaveTransferReturned,pClass); - } - while(pClass->m_eSaveTransferState == C4JStorage::eSaveTransfer_Busy && !pClass->m_bSaveTransferCancelled ); + { + pMinecraft->progressRenderer->progressStart(IDS_SAVETRANSFER_TITLE_GET); + pMinecraft->progressRenderer->progressStage( IDS_SAVETRANSFER_STAGE_GET_DETAILS ); + Sleep(1); + pClass->m_eSaveTransferState=StorageManager.SaveTransferGetDetails(pClass->m_iPad,C4JStorage::eGlobalStorage_TitleUser,filename,&UIScene_LoadOrJoinMenu::SaveTransferReturned,pClass); + } + while(pClass->m_eSaveTransferState == C4JStorage::eSaveTransfer_Busy && !pClass->m_bSaveTransferCancelled ); } } -void UIScene_LoadCreateJoinMenu::RequestFileData( SaveTransferStateContainer *pClass, wchar_t *filename ) +void UIScene_LoadOrJoinMenu::RequestFileData( SaveTransferStateContainer *pClass, wchar_t *filename ) { Minecraft *pMinecraft=Minecraft::GetInstance(); WCHAR wcTemp[256]; pMinecraft->progressRenderer->progressStagePercentage(0); - swprintf(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,UIScene_LoadCreateJoinMenu::s_ulFileSize); + swprintf(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),0,UIScene_LoadOrJoinMenu::s_ulFileSize); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); @@ -3877,17 +3787,17 @@ void UIScene_LoadCreateJoinMenu::RequestFileData( SaveTransferStateContainer *pC #endif { do - { - pMinecraft->progressRenderer->progressStart(IDS_SAVETRANSFER_TITLE_GET); - pMinecraft->progressRenderer->progressStage( -1 ); - Sleep(1); - pClass->m_eSaveTransferState=StorageManager.SaveTransferGetData(pClass->m_iPad,C4JStorage::eGlobalStorage_TitleUser,filename,&UIScene_LoadCreateJoinMenu::SaveTransferReturned,&UIScene_LoadCreateJoinMenu::SaveTransferUpdateProgress,pClass,pClass); - } - while(pClass->m_eSaveTransferState == C4JStorage::eSaveTransfer_Busy && !pClass->m_bSaveTransferCancelled ); + { + pMinecraft->progressRenderer->progressStart(IDS_SAVETRANSFER_TITLE_GET); + pMinecraft->progressRenderer->progressStage( -1 ); + Sleep(1); + pClass->m_eSaveTransferState=StorageManager.SaveTransferGetData(pClass->m_iPad,C4JStorage::eGlobalStorage_TitleUser,filename,&UIScene_LoadOrJoinMenu::SaveTransferReturned,&UIScene_LoadOrJoinMenu::SaveTransferUpdateProgress,pClass,pClass); + } + while(pClass->m_eSaveTransferState == C4JStorage::eSaveTransfer_Busy && !pClass->m_bSaveTransferCancelled ); } } -int UIScene_LoadCreateJoinMenu::SaveTransferReturned(LPVOID lpParam,C4JStorage::SAVETRANSFER_FILE_DETAILS *pSaveTransferDetails) +int UIScene_LoadOrJoinMenu::SaveTransferReturned(LPVOID lpParam,C4JStorage::SAVETRANSFER_FILE_DETAILS *pSaveTransferDetails) { SaveTransferStateContainer* pClass = (SaveTransferStateContainer *) lpParam; app.DebugPrintf("Save Transfer - size is %d\n",pSaveTransferDetails->ulFileLen); @@ -3896,19 +3806,19 @@ int UIScene_LoadCreateJoinMenu::SaveTransferReturned(LPVOID lpParam,C4JStorage:: if(pSaveTransferDetails->pbData==nullptr) { pClass->m_eSaveTransferState=C4JStorage::eSaveTransfer_FileSizeRetrieved; - UIScene_LoadCreateJoinMenu::s_ulFileSize=pSaveTransferDetails->ulFileLen; + UIScene_LoadOrJoinMenu::s_ulFileSize=pSaveTransferDetails->ulFileLen; } else { - delete UIScene_LoadCreateJoinMenu::s_transferData.data; - UIScene_LoadCreateJoinMenu::s_transferData = byteArray(pSaveTransferDetails->pbData, UIScene_LoadCreateJoinMenu::s_ulFileSize); + delete UIScene_LoadOrJoinMenu::s_transferData.data; + UIScene_LoadOrJoinMenu::s_transferData = byteArray(pSaveTransferDetails->pbData, UIScene_LoadOrJoinMenu::s_ulFileSize); pClass->m_eSaveTransferState=C4JStorage::eSaveTransfer_FileDataRetrieved; } return 0; } -int UIScene_LoadCreateJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsigned long ulBytesReceived) +int UIScene_LoadOrJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsigned long ulBytesReceived) { WCHAR wcTemp[256]; @@ -3924,10 +3834,10 @@ int UIScene_LoadCreateJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsign } else { - unsigned int uiProgress=(unsigned int)(((float)ulBytesReceived/float(UIScene_LoadCreateJoinMenu::s_ulFileSize))*100.0f); + unsigned int uiProgress=(unsigned int)(((float)ulBytesReceived/float(UIScene_LoadOrJoinMenu::s_ulFileSize))*100.0f); pMinecraft->progressRenderer->progressStagePercentage(uiProgress); - swprintf(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),((float)(ulBytesReceived))/1024000.0f,((float)UIScene_LoadCreateJoinMenu::s_ulFileSize)/1024000.0f); + swprintf(wcTemp,app.GetString(IDS_SAVETRANSFER_STAGE_GET_DATA),((float)(ulBytesReceived))/1024000.0f,((float)UIScene_LoadOrJoinMenu::s_ulFileSize)/1024000.0f); m_wstrStageText=wcTemp; pMinecraft->progressRenderer->progressStage( m_wstrStageText ); } @@ -3935,20 +3845,20 @@ int UIScene_LoadCreateJoinMenu::SaveTransferUpdateProgress(LPVOID lpParam,unsign return 0; } -void UIScene_LoadCreateJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) +void UIScene_LoadOrJoinMenu::CancelSaveTransferCallback(LPVOID lpParam) { SaveTransferStateContainer* pClass = (SaveTransferStateContainer *) lpParam; if(!pClass->m_bSaveTransferCancelled) { - StorageManager.CancelSaveTransfer(UIScene_LoadCreateJoinMenu::CancelSaveTransferCompleteCallback,pClass); + StorageManager.CancelSaveTransfer(UIScene_LoadOrJoinMenu::CancelSaveTransferCompleteCallback,pClass); pClass->m_bSaveTransferCancelled=true; } //pClass->m_bSaveTransferInProgress=false; } -int UIScene_LoadCreateJoinMenu::CancelSaveTransferCompleteCallback(LPVOID lpParam) +int UIScene_LoadOrJoinMenu::CancelSaveTransferCompleteCallback(LPVOID lpParam) { SaveTransferStateContainer* pClass = (SaveTransferStateContainer *) lpParam; // change the state to idle to get the download thread to terminate @@ -3956,9 +3866,9 @@ int UIScene_LoadCreateJoinMenu::CancelSaveTransferCompleteCallback(LPVOID lpPara return 0; } -int UIScene_LoadCreateJoinMenu::NeedSyncMessageReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) +int UIScene_LoadOrJoinMenu::NeedSyncMessageReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadCreateJoinMenu *pClass = (UIScene_LoadCreateJoinMenu *)pParam; + UIScene_LoadOrJoinMenu *pClass = (UIScene_LoadOrJoinMenu *)pParam; LoadMenuInitData *params = (LoadMenuInitData *)pParam; if( result == C4JStorage::EMessage_ResultAccept ) @@ -3980,183 +3890,183 @@ int UIScene_LoadCreateJoinMenu::NeedSyncMessageReturned(void *pParam,int iPad,C4 #ifdef _XBOX_ONE -void UIScene_LoadCreateJoinMenu::HandleDLCLicenseChange() +void UIScene_LoadOrJoinMenu::HandleDLCLicenseChange() { - // may have installed Halloween on this menu - app.StartInstallDLCProcess(m_iPad); + // may have installed Halloween on this menu + app.StartInstallDLCProcess(m_iPad); } #endif #if defined _XBOX_ONE || defined __ORBIS__ -int UIScene_LoadCreateJoinMenu::CopySaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) +int UIScene_LoadOrJoinMenu::CopySaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)pParam; + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; - if(result==C4JStorage::EMessage_ResultAccept) - { + if(result==C4JStorage::EMessage_ResultAccept) + { - LoadingInputParams *loadingParams = new LoadingInputParams(); - void *uniqueId = (LPVOID)pClass->GetCallbackUniqueId(); - loadingParams->func = &UIScene_LoadCreateJoinMenu::CopySaveThreadProc; - loadingParams->lpParam = uniqueId; - loadingParams->waitForThreadToDelete = true; + LoadingInputParams *loadingParams = new LoadingInputParams(); + void *uniqueId = (LPVOID)pClass->GetCallbackUniqueId(); + loadingParams->func = &UIScene_LoadOrJoinMenu::CopySaveThreadProc; + loadingParams->lpParam = uniqueId; + loadingParams->waitForThreadToDelete = true; - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_NavigateBackToScene; - completionData->iPad = DEFAULT_XUI_MENU_USER; - loadingParams->completionData = completionData; + UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); + completionData->bShowBackground=TRUE; + completionData->bShowLogo=TRUE; + completionData->type = e_ProgressCompletion_NavigateBackToScene; + completionData->iPad = DEFAULT_XUI_MENU_USER; + loadingParams->completionData = completionData; - loadingParams->cancelFunc=&UIScene_LoadCreateJoinMenu::CancelCopySaveCallback; - loadingParams->m_cancelFuncParam=uniqueId; - loadingParams->cancelText=IDS_TOOLTIPS_CANCEL; + loadingParams->cancelFunc=&UIScene_LoadOrJoinMenu::CancelCopySaveCallback; + loadingParams->m_cancelFuncParam=uniqueId; + loadingParams->cancelText=IDS_TOOLTIPS_CANCEL; - ui.NavigateToScene(iPad,eUIScene_FullscreenProgress, loadingParams); - } - else - { - pClass->m_bIgnoreInput=false; - } + ui.NavigateToScene(iPad,eUIScene_FullscreenProgress, loadingParams); + } + else + { + pClass->m_bIgnoreInput=false; + } return 0; } -int UIScene_LoadCreateJoinMenu::CopySaveThreadProc( LPVOID lpParameter ) +int UIScene_LoadOrJoinMenu::CopySaveThreadProc( LPVOID lpParameter ) { - Minecraft *pMinecraft=Minecraft::GetInstance(); - pMinecraft->progressRenderer->progressStart(IDS_PROGRESS_COPYING_SAVE); - pMinecraft->progressRenderer->progressStage( -1 ); + Minecraft *pMinecraft=Minecraft::GetInstance(); + pMinecraft->progressRenderer->progressStart(IDS_PROGRESS_COPYING_SAVE); + pMinecraft->progressRenderer->progressStage( -1 ); - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParameter); - if( pClass ) - { - pClass->m_bCopying = true; - pClass->m_bCopyingCancelled = false; - ui.LeaveCallbackIdCriticalSection(); - // Copy save data takes two callbacks - one for completion, and one for progress. The progress callback also lets us cancel the operation, if we return false. - StorageManager.CopySaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC],UIScene_LoadCreateJoinMenu::CopySaveDataReturned,UIScene_LoadCreateJoinMenu::CopySaveDataProgress,lpParameter); + ui.EnterCallbackIdCriticalSection(); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParameter); + if( pClass ) + { + pClass->m_bCopying = true; + pClass->m_bCopyingCancelled = false; + ui.LeaveCallbackIdCriticalSection(); + // Copy save data takes two callbacks - one for completion, and one for progress. The progress callback also lets us cancel the operation, if we return false. + StorageManager.CopySaveData(&pClass->m_pSaveDetails->SaveInfoA[pClass->m_iSaveListIndex - pClass->m_iDefaultButtonsC],UIScene_LoadOrJoinMenu::CopySaveDataReturned,UIScene_LoadOrJoinMenu::CopySaveDataProgress,lpParameter); - bool bContinue = true; - do - { - Sleep(100); - ui.EnterCallbackIdCriticalSection(); - pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParameter); - if( pClass ) - { - bContinue = pClass->m_bCopying; - } - else - { - bContinue = false; - } - ui.LeaveCallbackIdCriticalSection(); - } while( bContinue ); - } - else - { - ui.LeaveCallbackIdCriticalSection(); - } + bool bContinue = true; + do + { + Sleep(100); + ui.EnterCallbackIdCriticalSection(); + pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParameter); + if( pClass ) + { + bContinue = pClass->m_bCopying; + } + else + { + bContinue = false; + } + ui.LeaveCallbackIdCriticalSection(); + } while( bContinue ); + } + else + { + ui.LeaveCallbackIdCriticalSection(); + } - return 0; + return 0; } -int UIScene_LoadCreateJoinMenu::CopySaveDataReturned(LPVOID lpParam, bool success, C4JStorage::ESaveGameState stat) +int UIScene_LoadOrJoinMenu::CopySaveDataReturned(LPVOID lpParam, bool success, C4JStorage::ESaveGameState stat) { - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); + ui.EnterCallbackIdCriticalSection(); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); - if(pClass) - { - if(success) - { - pClass->m_bCopying = false; - // wipe the list and repopulate it - pClass->m_iState=e_SavesRepopulateAfterDelete; - ui.LeaveCallbackIdCriticalSection(); - } - else - { + if(pClass) + { + if(success) + { + pClass->m_bCopying = false; + // wipe the list and repopulate it + pClass->m_iState=e_SavesRepopulateAfterDelete; + ui.LeaveCallbackIdCriticalSection(); + } + else + { #ifdef __ORBIS__ - UINT uiIDA[1]; - // you cancelled the save on exit after choosing exit and save? You go back to the Exit choices then. - uiIDA[0]=IDS_OK; + UINT uiIDA[1]; + // you cancelled the save on exit after choosing exit and save? You go back to the Exit choices then. + uiIDA[0]=IDS_OK; - if( stat == C4JStorage::ESaveGame_CopyCompleteFailLocalStorage ) - { - ui.LeaveCallbackIdCriticalSection(); - ui.RequestErrorMessage(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_LOCAL, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam); - } - else if( stat == C4JStorage::ESaveGame_CopyCompleteFailQuota ) - { - ui.LeaveCallbackIdCriticalSection(); - ui.RequestErrorMessage(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_QUOTA, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam); - } - else - { - pClass->m_bCopying = false; - ui.LeaveCallbackIdCriticalSection(); - } + if( stat == C4JStorage::ESaveGame_CopyCompleteFailLocalStorage ) + { + ui.LeaveCallbackIdCriticalSection(); + ui.RequestErrorMessage(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_LOCAL, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam); + } + else if( stat == C4JStorage::ESaveGame_CopyCompleteFailQuota ) + { + ui.LeaveCallbackIdCriticalSection(); + ui.RequestErrorMessage(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_QUOTA, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam); + } + else + { + pClass->m_bCopying = false; + ui.LeaveCallbackIdCriticalSection(); + } #else - pClass->m_bCopying = false; - ui.LeaveCallbackIdCriticalSection(); + pClass->m_bCopying = false; + ui.LeaveCallbackIdCriticalSection(); #endif - } - } - else - { - ui.LeaveCallbackIdCriticalSection(); - } - return 0; + } + } + else + { + ui.LeaveCallbackIdCriticalSection(); + } + return 0; } -bool UIScene_LoadCreateJoinMenu::CopySaveDataProgress(LPVOID lpParam, int percent) +bool UIScene_LoadOrJoinMenu::CopySaveDataProgress(LPVOID lpParam, int percent) { - bool bContinue = false; - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); - if( pClass ) - { - bContinue = !pClass->m_bCopyingCancelled; - } - ui.LeaveCallbackIdCriticalSection(); - Minecraft *pMinecraft=Minecraft::GetInstance(); - pMinecraft->progressRenderer->progressStagePercentage(percent); + bool bContinue = false; + ui.EnterCallbackIdCriticalSection(); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); + if( pClass ) + { + bContinue = !pClass->m_bCopyingCancelled; + } + ui.LeaveCallbackIdCriticalSection(); + Minecraft *pMinecraft=Minecraft::GetInstance(); + pMinecraft->progressRenderer->progressStagePercentage(percent); - return bContinue; + return bContinue; } -void UIScene_LoadCreateJoinMenu::CancelCopySaveCallback(LPVOID lpParam) +void UIScene_LoadOrJoinMenu::CancelCopySaveCallback(LPVOID lpParam) { - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); - if( pClass ) - { - pClass->m_bCopyingCancelled = true; - } - ui.LeaveCallbackIdCriticalSection(); + ui.EnterCallbackIdCriticalSection(); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); + if( pClass ) + { + pClass->m_bCopyingCancelled = true; + } + ui.LeaveCallbackIdCriticalSection(); } -int UIScene_LoadCreateJoinMenu::CopySaveErrorDialogFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) +int UIScene_LoadOrJoinMenu::CopySaveErrorDialogFinishedCallback(void *pParam,int iPad,C4JStorage::EMessageResult result) { - ui.EnterCallbackIdCriticalSection(); - UIScene_LoadCreateJoinMenu* pClass = (UIScene_LoadCreateJoinMenu*)ui.GetSceneFromCallbackId((size_t)pParam); - if( pClass ) - { - pClass->m_bCopying = false; - } - ui.LeaveCallbackIdCriticalSection(); + ui.EnterCallbackIdCriticalSection(); + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)pParam); + if( pClass ) + { + pClass->m_bCopying = false; + } + ui.LeaveCallbackIdCriticalSection(); - return 0; + return 0; } #endif // _XBOX_ONE #ifdef _WINDOWS64 // adding servers bellow -void UIScene_LoadCreateJoinMenu::BeginAddServer() +void UIScene_LoadOrJoinMenu::BeginAddServer() { m_addServerPhase = eAddServer_IP; m_addServerIP.clear(); @@ -4166,15 +4076,15 @@ void UIScene_LoadCreateJoinMenu::BeginAddServer() kbData.title = L"Server Address"; kbData.defaultText = L""; kbData.maxChars = 128; - kbData.callback = &UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback; + kbData.callback = &UIScene_LoadOrJoinMenu::AddServerKeyboardCallback; kbData.lpParam = this; kbData.pcMode = g_KBMInput.IsKBMActive(); ui.NavigateToScene(m_iPad, eUIScene_Keyboard, &kbData); } -int UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback(LPVOID lpParam, bool bRes) +int UIScene_LoadOrJoinMenu::AddServerKeyboardCallback(LPVOID lpParam, bool bRes) { - UIScene_LoadCreateJoinMenu *pClass = static_cast(lpParam); + UIScene_LoadOrJoinMenu *pClass = static_cast(lpParam); if (!bRes) { @@ -4183,12 +4093,12 @@ int UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback(LPVOID lpParam, bool b return 0; } - uint16_t ui16Text[256]; - ZeroMemory(ui16Text, sizeof(ui16Text)); - Win64_GetKeyboardText(ui16Text, 256); + uint16_t ui16Text[128] = {}; - wchar_t wBuf[256] = {}; - for (int k = 0; k < 255 && ui16Text[k]; k++) + Win64_GetKeyboardText(ui16Text, 128); + + wchar_t wBuf[128] = {}; + for (int k = 0; k < 127 && ui16Text[k]; k++) wBuf[k] = static_cast(ui16Text[k]); if (wBuf[0] == 0) @@ -4209,7 +4119,7 @@ int UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback(LPVOID lpParam, bool b kbData.title = L"Server Port"; kbData.defaultText = L"25565"; kbData.maxChars = 6; - kbData.callback = &UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback; + kbData.callback = &UIScene_LoadOrJoinMenu::AddServerKeyboardCallback; kbData.lpParam = pClass; kbData.pcMode = g_KBMInput.IsKBMActive(); ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData); @@ -4224,7 +4134,7 @@ int UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback(LPVOID lpParam, bool b kbData.title = L"Server Name"; kbData.defaultText = L"Minecraft Server"; kbData.maxChars = 64; - kbData.callback = &UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback; + kbData.callback = &UIScene_LoadOrJoinMenu::AddServerKeyboardCallback; kbData.lpParam = pClass; kbData.pcMode = g_KBMInput.IsKBMActive(); ui.NavigateToScene(pClass->m_iPad, eUIScene_Keyboard, &kbData); @@ -4249,14 +4159,14 @@ int UIScene_LoadCreateJoinMenu::AddServerKeyboardCallback(LPVOID lpParam, bool b return 0; } -void UIScene_LoadCreateJoinMenu::AppendServerToFile(const wstring& ip, const wstring& port, const wstring& name) +void UIScene_LoadOrJoinMenu::AppendServerToFile(const wstring& ip, const wstring& port, const wstring& name) { char narrowIP[256] = {}; char narrowPort[16] = {}; char narrowName[256] = {}; - wcstombs(narrowIP, ip.c_str(), sizeof(narrowIP) - 1); - wcstombs(narrowPort, port.c_str(), sizeof(narrowPort) - 1); - wcstombs(narrowName, name.c_str(), sizeof(narrowName) - 1); + wcstombs_s(nullptr, narrowIP, sizeof(narrowIP), ip.c_str(), _TRUNCATE); + wcstombs_s(nullptr, narrowPort, sizeof(narrowPort), port.c_str(), _TRUNCATE); + wcstombs_s(nullptr, narrowName, sizeof(narrowName), name.c_str(), _TRUNCATE); uint16_t portNum = static_cast(atoi(narrowPort)); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenuTest.h b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h similarity index 89% rename from Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenuTest.h rename to Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h index f44ec79d..76a7ed43 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenuTest.h +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h @@ -13,14 +13,13 @@ class LevelGenerationOptions; #endif -class UIScene_LoadCreateJoinMenu : public UIScene +class UIScene_LoadOrJoinMenu : public UIScene { private: enum EControls { - eControl_LoadList, //eControl_CreateList - eControl_NewList, - eControl_JoinList, //eControl_GamesList + eControl_SavesList, + eControl_GamesList, #if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) eControl_SpaceIndicator, #endif @@ -49,26 +48,25 @@ private: int m_iSaveDetailsCount; protected: - UIControl_LeftIconButtonList m_buttonListLoad, m_buttonListNew, m_buttonListJoin; - UIControl_Label m_labelLoadListTitle, m_labelNewListTitle, m_labelJoinListTitle; - UIControl m_controlLoadTimer, m_controlNewTimer, m_controlJoinTimer; + UIControl_SaveList m_buttonListSaves; + UIControl_SaveList m_buttonListGames; + UIControl_Label m_labelSavesListTitle, m_labelJoinListTitle, m_labelNoGames; + UIControl m_controlSavesTimer, m_controlJoinTimer; #if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) UIControl_SpaceIndicatorBar m_spaceIndicatorSaves; #endif private: - UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) - UI_MAP_ELEMENT( m_buttonListLoad, "LoadGameList") - UI_MAP_ELEMENT( m_buttonListNew, "NewGameList") - UI_MAP_ELEMENT( m_buttonListJoin, "JoinGameGamesList") + UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) + UI_MAP_ELEMENT( m_buttonListSaves, "SavesList") + UI_MAP_ELEMENT( m_buttonListGames, "JoinList") - UI_MAP_ELEMENT( m_labelLoadListTitle, "LoadGameTabTitle") - UI_MAP_ELEMENT( m_labelNewListTitle, "NewGameTabTitle") - UI_MAP_ELEMENT( m_labelJoinListTitle, "JoinGameTabTitle") + UI_MAP_ELEMENT( m_labelSavesListTitle, "SavesListTitle") + UI_MAP_ELEMENT( m_labelJoinListTitle, "JoinListTitle") + UI_MAP_ELEMENT( m_labelNoGames, "NoGames") - UI_MAP_ELEMENT( m_controlLoadTimer, "LoadGameTimer") - UI_MAP_ELEMENT( m_controlNewTimer, "NewGameTimer") - UI_MAP_ELEMENT( m_controlJoinTimer, "JoinGamesTimer") + UI_MAP_ELEMENT( m_controlSavesTimer, "SavesTimer") + UI_MAP_ELEMENT( m_controlJoinTimer, "JoinTimer") #if defined(_XBOX_ONE) || defined(__ORBIS__) || defined(_WINDOWS64) UI_MAP_ELEMENT( m_spaceIndicatorSaves, "SaveSizeBar") @@ -109,8 +107,8 @@ private: bool m_bUpdateSaveSize; public: - UIScene_LoadCreateJoinMenu(int iPad, void *initData, UILayer *parentLayer); - virtual ~UIScene_LoadCreateJoinMenu(); + UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer *parentLayer); + virtual ~UIScene_LoadOrJoinMenu(); virtual void updateTooltips(); virtual void updateComponents(); @@ -124,7 +122,7 @@ public: virtual void handleFocusChange(F64 controlId, F64 childId); virtual void handleInitFocus(F64 controlId, F64 childId); - virtual EUIScene getSceneType() { return eUIScene_LoadCreateJoinMenu;} + virtual EUIScene getSceneType() { return eUIScene_LoadOrJoinMenu;} static void UpdateGamesListCallback(LPVOID pParam); #ifdef _XBOX_ONE @@ -206,7 +204,7 @@ private: bool m_bSaveTransferCancelled; int m_iPad; C4JStorage::eSaveTransferState m_eSaveTransferState; - UIScene_LoadCreateJoinMenu *m_pClass; + UIScene_LoadOrJoinMenu *m_pClass; } SaveTransferStateContainer; enum ESaveTransferFiles { diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp index b95ae7da..a2fc43e3 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp @@ -806,7 +806,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadCreateJoinMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); } else { @@ -869,7 +869,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadCreateJoinMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); #endif } } @@ -883,7 +883,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadCreateJoinMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); #endif } } @@ -1471,7 +1471,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadCreateJoinMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); #endif } else @@ -1543,7 +1543,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadCreateJoinMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); #endif } } diff --git a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp index 7695a363..7ef2a316 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp @@ -1221,7 +1221,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); #ifdef __ORBIS__ - strcpy_s(chName, chKeyName); + strcpy(chName, chKeyName); #else sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif @@ -1298,7 +1298,7 @@ int UIScene_PauseMenu::BuyTexturePack_SignInReturned(void *pParam,bool bContinue strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); #ifdef __ORBIS__ - strcpy_s(chName, chKeyName); + strcpy(chName, chKeyName); #else sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp index 974dbf7f..6d447749 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp @@ -14,9 +14,6 @@ UIScene_SettingsAudioMenu::UIScene_SettingsAudioMenu(int iPad, void *initData, U swprintf( TempString, 256, L"%ls: %d%%", app.GetString( IDS_SLIDER_SOUND ),app.GetGameSettings(m_iPad,eGameSetting_SoundFXVolume)); m_sliderSound.init(TempString,eControl_Sound,0,100,app.GetGameSettings(m_iPad,eGameSetting_SoundFXVolume)); - swprintf( TempString, 256, L"%ls", app.GetString( IDS_CHECKBOX_CAVESOUNDS )); - m_checkboxCaveSounds.init(TempString, eControl_CaveSounds,(app.GetGameSettings(m_iPad,eGameSetting_CaveSounds)!=0)); - doHorizontalResizeCheck(); if(app.GetLocalPlayerCount()>1) @@ -75,9 +72,6 @@ void UIScene_SettingsAudioMenu::handleInput(int iPad, int key, bool repeat, bool case ACTION_MENU_CANCEL: if(pressed) { - // check the checkboxes - app.SetGameSettings(m_iPad,eGameSetting_CaveSounds,m_checkboxCaveSounds.IsChecked()?1:0); - navigateBack(); } break; @@ -120,13 +114,3 @@ void UIScene_SettingsAudioMenu::handleSliderMove(F64 sliderId, F64 currentValue) break; } } - -void UIScene_SettingsAudioMenu::handleCheckboxToggled(F64 controlId, bool selected) -{ - switch(static_cast(controlId)) - { - case eControl_CaveSounds: - app.SetGameSettings(m_iPad, eGameSetting_CaveSounds, selected ? 1 : 0); - break; - } -} \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.h b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.h index b3e75ec1..6c48b22b 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.h @@ -8,16 +8,13 @@ private: enum EControls { eControl_Music, - eControl_Sound, - eControl_CaveSounds + eControl_Sound }; UIControl_Slider m_sliderMusic, m_sliderSound; // Sliders - UIControl_CheckBox m_checkboxCaveSounds; // Checkboxes UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_sliderMusic, "Music") UI_MAP_ELEMENT( m_sliderSound, "Sound") - UI_MAP_ELEMENT( m_checkboxCaveSounds, "CheckboxCaveSounds") UI_END_MAP_ELEMENTS_AND_NAMES() public: @@ -38,5 +35,4 @@ public: virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); virtual void handleSliderMove(F64 sliderId, F64 currentValue); - virtual void handleCheckboxToggled(F64 controlId, bool selected); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp index a0c1fc1d..b9f952d0 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -43,7 +43,7 @@ int UIScene_SettingsGraphicsMenu::m_iGraphicsModeTitleSettingA[4]= int UIScene_SettingsGraphicsMenu::LevelToDistance(int level) { - static const int table[5] = {2,4,8,16,32}; + static const int table[4] = {2,4,8,16}; if(level < 0) level = 0; if(level > 4) level = 4; return table[level]; @@ -51,7 +51,7 @@ int UIScene_SettingsGraphicsMenu::LevelToDistance(int level) int UIScene_SettingsGraphicsMenu::DistanceToLevel(int dist) { - static const int table[5] = {2,4,8,16,32}; + static const int table[4] = {2,4,8,16}; for(int i = 0; i < 5; i++){ if(table[i] == dist) return i; @@ -63,26 +63,6 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD { // Setup all the Iggy references we need for this scene initialiseMovie(); - - m_labelGeneralOptions.init( L"General" ); //IDS_GENERAL - m_labelQualityOptions.init( L"Quality" ); //IDS_QUALITY - - IggyDataValue result; - - IggyDataValue value[1]; - value[0].type = IGGY_DATATYPE_number; - value[0].number = 0; - - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetMenuType , 1 , value ); - - m_tabIndex = TAB_GENERAL_OPTIONS; - -/* - swprintf(TempString, 256, L"%ls: %d", app.GetString( IDS_SLIDER_RENDERDISTANCE ),app.GetGameSettings(m_iPad,eGameSetting_RenderDistance)); - m_sliderRenderDistance.init(TempString,eControl_RenderDistance,0,3,DistanceToLevel(app.GetGameSettings(m_iPad,eGameSetting_RenderDistance))); -*/ - -/* Minecraft* pMinecraft = Minecraft::GetInstance(); m_bNotInGame=(Minecraft::GetInstance()->level==nullptr); @@ -111,6 +91,7 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD int currentGraphics = app.GetGameSettings(m_iPad, eGameSetting_GraphicsMode); swprintf(TempString, 256, L"%ls %ls", app.GetString( IDS_GRAPHICS ),app.GetString(m_iGraphicsModeTitleSettingA[app.GetGameSettings(m_iPad,eGameSetting_GraphicsMode)])); + m_sliderGraphicsMode.init(TempString, eControl_GraphicsMode, 0, 3, currentGraphics); doHorizontalResizeCheck(); @@ -145,23 +126,27 @@ UIScene_SettingsGraphicsMenu::UIScene_SettingsGraphicsMenu(int iPad, void *initD app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); #endif } -*/ +} + +UIScene_SettingsGraphicsMenu::~UIScene_SettingsGraphicsMenu() +{ +} + +wstring UIScene_SettingsGraphicsMenu::getMoviePath() +{ + if(app.GetLocalPlayerCount() > 1) + { + return L"SettingsGraphicsMenuSplit"; + } + else + { + return L"SettingsGraphicsMenu"; + } } void UIScene_SettingsGraphicsMenu::updateTooltips() { - int changeTabTooltip = -1; - - // Set tooltip for change tab (only two tabs) - if (m_tabIndex == TAB_QUALITY_OPTIONS) - changeTabTooltip = IDS_GENERAL_OPTIONS; - else - changeTabTooltip = IDS_QUALITY_OPTIONS; - - // If there's a change tab tooltip, left bumper symbol should show but not the text (-2) - int lb = changeTabTooltip == -1 ? -1 : -2; - - ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK, -1, -1, -1, -1, lb, changeTabTooltip); + ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK); } void UIScene_SettingsGraphicsMenu::updateComponents() @@ -182,67 +167,40 @@ void UIScene_SettingsGraphicsMenu::updateComponents() } } -wstring UIScene_SettingsGraphicsMenu::getMoviePath() -{ - return L"SettingsGraphicsMenu"; -} - void UIScene_SettingsGraphicsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { - if (isDirectEditBlocking()) return; - ui.AnimateKeyPress(iPad, key, repeat, pressed, released); switch(key) { case ACTION_MENU_CANCEL: if(pressed) { - /* // check the checkboxes app.SetGameSettings(m_iPad,eGameSetting_Clouds,m_checkboxClouds.IsChecked()?1:0); app.SetGameSettings(m_iPad,eGameSetting_BedrockFog,m_checkboxBedrockFog.IsChecked()?1:0); app.SetGameSettings(m_iPad,eGameSetting_CustomSkinAnim,m_checkboxCustomSkinAnim.IsChecked()?1:0); - */ + navigateBack(); handled = true; } break; + case ACTION_MENU_OK: +#ifdef __ORBIS__ + case ACTION_MENU_TOUCHPAD_PRESS: +#endif + sendInputToMovie(key, repeat, pressed, released); + break; case ACTION_MENU_UP: case ACTION_MENU_DOWN: case ACTION_MENU_LEFT: case ACTION_MENU_RIGHT: - case ACTION_MENU_PAGEUP: - case ACTION_MENU_PAGEDOWN: - case ACTION_MENU_OTHER_STICK_UP: - case ACTION_MENU_OTHER_STICK_DOWN: sendInputToMovie(key, repeat, pressed, released); - handled = true; //test - break; - case ACTION_MENU_LEFT_SCROLL: - case ACTION_MENU_RIGHT_SCROLL: - if(pressed) - { - // Toggle tab index - m_tabIndex = m_tabIndex == 0 ? 1 : 0; - updateTooltips(); - IggyDataValue result; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcChangeTab , 0 , nullptr ); - } break; } } -UIControl* UIScene_SettingsGraphicsMenu::GetMainPanel() -{ - if(m_tabIndex == 0 ) - return &m_generalOptions; - else - return &m_qualityOptions; -} - void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentValue) { -/* WCHAR TempString[256]; const int value = static_cast(currentValue); switch(static_cast(sliderId)) @@ -304,5 +262,4 @@ void UIScene_SettingsGraphicsMenu::handleSliderMove(F64 sliderId, F64 currentVal } break; } -*/ -} \ No newline at end of file +} diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h index a5737d76..279007c6 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.h @@ -1,64 +1,60 @@ #pragma once #include "UIScene.h" -#include "UIControl_Label.h" -#include "UIControl_HTMLLabel.h" +#include "Common/UI/UIControl_CheckBox.h" +#include "Common/UI/UIControl_Slider.h" class UIScene_SettingsGraphicsMenu : public UIScene { private: - static const int TAB_GENERAL_OPTIONS = 0; - static const int TAB_QUALITY_OPTIONS = 1; - enum EControls { - eLaunchCheckboxes_Count, - eControl_Count + eControl_Clouds, + eControl_BedrockFog, + eControl_CustomSkinAnim, + eControl_Gamma, + eControl_FOV, + eControl_InterfaceOpacity, + eControl_RenderDistance, + eControl_GraphicsMode }; static int m_iGraphicsModeTitleSettingA[4]; - UIControl m_qualityOptions, m_generalOptions; - UIControl_Label m_labelQualityOptions, m_labelGeneralOptions; - IggyName m_funcSetMenuType, m_funcChangeTab; + UIControl_CheckBox m_checkboxClouds, m_checkboxBedrockFog, m_checkboxCustomSkinAnim; // Checkboxes + UIControl_Slider m_sliderRenderDistance, m_sliderGamma, m_sliderFOV, m_sliderInterfaceOpacity, m_sliderGraphicsMode; // Sliders UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) - UI_MAP_ELEMENT( m_labelQualityOptions, "LabelQuality") - UI_MAP_ELEMENT( m_labelGeneralOptions, "LabelGeneral") - - UI_MAP_ELEMENT(m_qualityOptions, "QualityOptions") - UI_BEGIN_MAP_CHILD_ELEMENTS(m_qualityOptions) - UI_END_MAP_CHILD_ELEMENTS() - - UI_MAP_ELEMENT( m_generalOptions, "GeneralOptions") - UI_BEGIN_MAP_CHILD_ELEMENTS(m_generalOptions) - UI_END_MAP_CHILD_ELEMENTS() - - UI_MAP_NAME( m_funcChangeTab, L"ChangeTab") - UI_MAP_NAME( m_funcSetMenuType, L"SetMenuType") + UI_MAP_ELEMENT( m_checkboxClouds, "Clouds") + UI_MAP_ELEMENT( m_checkboxBedrockFog, "BedrockFog") + UI_MAP_ELEMENT( m_checkboxCustomSkinAnim, "CustomSkinAnim") + UI_MAP_ELEMENT( m_sliderRenderDistance, "RenderDistance") + UI_MAP_ELEMENT( m_sliderGamma, "Gamma") + UI_MAP_ELEMENT(m_sliderFOV, "FOV") + UI_MAP_ELEMENT( m_sliderInterfaceOpacity, "InterfaceOpacity") + UI_MAP_ELEMENT( m_sliderGraphicsMode, "GraphicsMode") UI_END_MAP_ELEMENTS_AND_NAMES() bool m_bNotInGame; - int m_tabIndex; public: UIScene_SettingsGraphicsMenu(int iPad, void *initData, UILayer *parentLayer); + virtual ~UIScene_SettingsGraphicsMenu(); + + virtual EUIScene getSceneType() { return eUIScene_SettingsGraphicsMenu;} virtual void updateTooltips(); virtual void updateComponents(); - virtual EUIScene getSceneType() { return eUIScene_SettingsGraphicsMenu;} - protected: + // TODO: This should be pure virtual in this class virtual wstring getMoviePath(); public: // INPUT virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); + virtual void handleSliderMove(F64 sliderId, F64 currentValue); static int LevelToDistance(int dist); static int DistanceToLevel(int dist); - -private: - virtual UIControl* GetMainPanel(); }; \ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp index 89a19a27..873564f6 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp @@ -15,7 +15,6 @@ UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void *initData, UILayer m_checkboxDisplayAnimatedCharacter.init(app.GetString(IDS_CHECKBOX_ANIMATED_CHARACTER),eControl_DisplayAnimatedCharacter,(app.GetGameSettings(m_iPad,eGameSetting_AnimatedCharacter)!=0)); m_checkboxSplitscreen.init(app.GetString(IDS_CHECKBOX_VERTICAL_SPLIT_SCREEN),eControl_Splitscreen,(app.GetGameSettings(m_iPad,eGameSetting_SplitScreenVertical)!=0)); m_checkboxShowSplitscreenGamertags.init(app.GetString(IDS_CHECKBOX_DISPLAY_SPLITSCREENGAMERTAGS),eControl_ShowSplitscreenGamertags,(app.GetGameSettings(m_iPad,eGameSetting_DisplaySplitscreenGamertags)!=0)); - m_checkboxShowClassicCrafting.init(IDS_CHECKBOX_CLASSICCRAFTING, eControl_ShowClassicCrafting,(app.GetGameSettings(m_iPad,eGameSetting_ClassicCrafting)!=0)); WCHAR TempString[256]; @@ -103,7 +102,6 @@ void UIScene_SettingsUIMenu::handleInput(int iPad, int key, bool repeat, bool pr app.SetGameSettings(m_iPad,eGameSetting_DisplayHUD,m_checkboxDisplayHUD.IsChecked()?1:0); app.SetGameSettings(m_iPad,eGameSetting_DisplayHand,m_checkboxDisplayHand.IsChecked()?1:0); app.SetGameSettings(m_iPad,eGameSetting_DisplaySplitscreenGamertags,m_checkboxShowSplitscreenGamertags.IsChecked()?1:0); - app.SetGameSettings(m_iPad,eGameSetting_ClassicCrafting,m_checkboxShowClassicCrafting.IsChecked()?1:0); app.SetGameSettings(m_iPad,eGameSetting_DeathMessages,m_checkboxDisplayDeathMessages.IsChecked()?1:0); app.SetGameSettings(m_iPad,eGameSetting_AnimatedCharacter,m_checkboxDisplayAnimatedCharacter.IsChecked()?1:0); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.h b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.h index a7635fec..8968bbe7 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.h @@ -13,12 +13,11 @@ private: eControl_DisplayAnimatedCharacter, eControl_Splitscreen, eControl_ShowSplitscreenGamertags, - eControl_ShowClassicCrafting, eControl_UISize, eControl_UISizeSplitscreen }; - UIControl_CheckBox m_checkboxDisplayHUD, m_checkboxDisplayHand, m_checkboxDisplayDeathMessages, m_checkboxDisplayAnimatedCharacter, m_checkboxSplitscreen, m_checkboxShowSplitscreenGamertags, m_checkboxShowClassicCrafting; // Checkboxes + UIControl_CheckBox m_checkboxDisplayHUD, m_checkboxDisplayHand, m_checkboxDisplayDeathMessages, m_checkboxDisplayAnimatedCharacter, m_checkboxSplitscreen, m_checkboxShowSplitscreenGamertags; // Checkboxes UIControl_Slider m_sliderUISize, m_sliderUISizeSplitscreen; // Sliders UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_checkboxDisplayHUD, "DisplayHUD") @@ -27,7 +26,6 @@ private: UI_MAP_ELEMENT( m_checkboxDisplayAnimatedCharacter, "DisplayAnimatedCharacter") UI_MAP_ELEMENT( m_checkboxSplitscreen, "Splitscreen") UI_MAP_ELEMENT( m_checkboxShowSplitscreenGamertags, "ShowSplitscreenGamertags") - UI_MAP_ELEMENT( m_checkboxShowClassicCrafting, "ShowClassicCrafting") UI_MAP_ELEMENT( m_sliderUISize, "UISize") UI_MAP_ELEMENT( m_sliderUISizeSplitscreen, "UISizeSplitscreen") diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index 1a9d0cb1..52fa87d5 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -599,7 +599,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) void UIScene_SkinSelectMenu::customDraw(IggyCustomDrawCallbackRegion *region) { int characterId = -1; - swscanf_s(static_cast(region->name),L"Character%d",&characterId); + swscanf(static_cast(region->name),L"Character%d",&characterId); if (characterId == -1) { app.DebugPrintf("Invalid character to render found\n"); @@ -1583,7 +1583,7 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); #ifdef __ORBIS__ - strcpy_s(chName, chKeyName); + strcpy(chName, chKeyName); #else sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); #endif diff --git a/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp index 4bdf000a..bb9e30af 100644 --- a/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp @@ -159,7 +159,7 @@ void UIScene_TradingMenu::customDraw(IggyCustomDrawCallbackRegion *region) shared_ptr item = nullptr; int slotId = -1; - swscanf_s(static_cast(region->name),L"slot_%d",&slotId); + swscanf(static_cast(region->name),L"slot_%d",&slotId); if(slotId < MerchantMenu::USE_ROW_SLOT_END) { diff --git a/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp b/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp index 4a1bd5d3..4126c559 100644 --- a/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp +++ b/Minecraft.Client/Common/XUI/XUI_MainMenu.cpp @@ -1271,7 +1271,7 @@ HRESULT CScene_Main::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled ) { XuiKillTimer(m_hObj,DLC_INSTALLED_TIMER_ID); m_Timer.SetShow(FALSE); - app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_LoadCreateJoinMenu); + app.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_LoadOrJoinMenu); } } diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/colours.col b/Minecraft.Client/Common/res/TitleUpdate/res/colours.col index 28b5ebf0..ebdcf7a9 100644 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/colours.col and b/Minecraft.Client/Common/res/TitleUpdate/res/colours.col differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml b/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml index 4eb5a5f4..6c45b660 100644 --- a/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml +++ b/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml @@ -296,9 +296,4 @@ if __name__=="__main__": notecolors() - - - - - \ No newline at end of file diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/items.png b/Minecraft.Client/Common/res/TitleUpdate/res/items.png index 6513a386..5456083c 100644 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/items.png and b/Minecraft.Client/Common/res/TitleUpdate/res/items.png differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/terrain.png b/Minecraft.Client/Common/res/TitleUpdate/res/terrain.png index 8d9a79c9..0246b41d 100644 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/terrain.png and b/Minecraft.Client/Common/res/TitleUpdate/res/terrain.png differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel2.png b/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel2.png index 4035ebd1..32f489ec 100644 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel2.png and b/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel2.png differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel3.png b/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel3.png index 322f67e5..02d73af2 100644 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel3.png and b/Minecraft.Client/Common/res/TitleUpdate/res/terrainMipMapLevel3.png differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/barrier.png b/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/barrier.png deleted file mode 100644 index f426e273..00000000 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/barrier.png and /dev/null differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/barrier.txt b/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/barrier.txt deleted file mode 100644 index a67a4022..00000000 --- a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/barrier.txt +++ /dev/null @@ -1,3 +0,0 @@ -0, -1, - diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel2.png b/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel2.png deleted file mode 100644 index 07fa00b2..00000000 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel2.png and /dev/null differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel3.png b/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel3.png deleted file mode 100644 index 65079544..00000000 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel3.png and /dev/null differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel4.png b/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel4.png deleted file mode 100644 index 2ba1c3c8..00000000 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel4.png and /dev/null differ diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel5.png b/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel5.png deleted file mode 100644 index be1749e1..00000000 Binary files a/Minecraft.Client/Common/res/TitleUpdate/res/textures/blocks/waterMipMapLevel5.png and /dev/null differ diff --git a/Minecraft.Client/DLCTexturePack.cpp b/Minecraft.Client/DLCTexturePack.cpp index fc5f4add..c6457511 100644 --- a/Minecraft.Client/DLCTexturePack.cpp +++ b/Minecraft.Client/DLCTexturePack.cpp @@ -233,21 +233,6 @@ void DLCTexturePack::loadColourTable() #endif } -void DLCTexturePack::loadStructureTable() -{ - if(app.hasArchiveFile(L"Structures.bin")) - { - byteArray structures = app.getArchiveFile(L"Structures.bin"); - - if(m_structureTable != nullptr) - delete m_structureTable; - - m_structureTable = new StructureTable(structures.data, structures.length); - - delete [] structures.data; - } -} - void DLCTexturePack::loadData() { int mountIndex = m_dlcInfoPack->GetDLCMountIndex(); diff --git a/Minecraft.Client/DLCTexturePack.h b/Minecraft.Client/DLCTexturePack.h index 9fa32de6..227617e6 100644 --- a/Minecraft.Client/DLCTexturePack.h +++ b/Minecraft.Client/DLCTexturePack.h @@ -53,7 +53,6 @@ public: virtual wstring getAnimationString(const wstring &textureName, const wstring &path); virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L""); virtual void loadColourTable(); - virtual void loadStructureTable(); virtual bool hasData() { return m_bHasLoadedData; } virtual bool isLoadingData() { return m_bLoadingData; } diff --git a/Minecraft.Client/DefaultTexturePack.cpp b/Minecraft.Client/DefaultTexturePack.cpp index a9ddcfb5..d2712404 100644 --- a/Minecraft.Client/DefaultTexturePack.cpp +++ b/Minecraft.Client/DefaultTexturePack.cpp @@ -11,7 +11,6 @@ DefaultTexturePack::DefaultTexturePack() : AbstractTexturePack(0, nullptr, L"Min loadName(); // 4J-PB - added so the PS3 can have localised texture names' loadDescription(); loadColourTable(); - loadStructureTable(); } void DefaultTexturePack::loadIcon() diff --git a/Minecraft.Client/EntityRenderDispatcher.cpp b/Minecraft.Client/EntityRenderDispatcher.cpp index c3d9bce1..01972e56 100644 --- a/Minecraft.Client/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/EntityRenderDispatcher.cpp @@ -163,7 +163,6 @@ EntityRenderDispatcher::EntityRenderDispatcher() renderers[eTYPE_BOAT] = new BoatRenderer(); renderers[eTYPE_FISHINGHOOK] = new FishingHookRenderer(); -// renderers[eTYPE_FISHINGHOOK] = new FishingHookRenderer(this); //TU25 renderers[eTYPE_HORSE] = new HorseRenderer(new ModelHorse(), .75f); diff --git a/Minecraft.Client/EntityRenderer.cpp b/Minecraft.Client/EntityRenderer.cpp index 30de2d28..fa41dfa6 100644 --- a/Minecraft.Client/EntityRenderer.cpp +++ b/Minecraft.Client/EntityRenderer.cpp @@ -29,107 +29,6 @@ EntityRenderer::~EntityRenderer() delete tileRenderer; } -// TU25 -/* -bool EntityRenderer::shouldRender(shared_ptr entity, Culler* culler, double x, double y, double z) -{ - if (entity->shouldRenderAt(x, y, z)) - { - if (entity->ignoreFrustumCheck) - return true; - - AABB* boundingBox = entity->getBoundingBox(); - - return culler->isVisible(boundingBox); - } - - return false; -} - -void EntityRenderer::renderName(shared_ptr entity, double x, double y, double z) -{ - if (!this->shouldShowName(entity)) - return; - - wstring nameTag = entity->getDisplayName(); - - if (!msg.empty()) - { - Font* msg = this->getFont(); - - if (font != nullptr) - { - float dist = entity->distanceToSqr(entityRenderDispatcher->cameraEntity); - - if (dist < 64.0f * 64.0f) - renderNameTags(entity, nameTag, x, y, z, 64); - } - } -} - -bool EntityRenderer::shouldShowName(shared_ptr entity) -{ - if (!entity) - return false; - - if (entity->shouldShowName()) - { - if (entity->hasCustomName()) - return true; - } - - return false; -} - -int EntityRenderer::renderNameTags(shared_ptr entity, double x, double y, double z, const wstring& name, float opacity, double distance, int color) -{ -// if (!this->entityRenderDispatcher->allowNameTagRendering()) -// return 0; - - Font* font = getFont(); - - if (font == nullptr) - return 0; - - float fScale = 0.02666667f; - - glPushMatrix(); - glTranslatef((float)x, (float)y + entity->getHeadHeight() + 0.5f, (float)z); - glNormal3f(0.0f, 1.0f, 0.0f); - - glRotatef(-this->entityRenderDispatcher->playerRotY, 0.0f, 1.0f, 0.0f); - glRotatef(this->entityRenderDispatcher->playerRotX, 1.0f, 0.0f, 0.0f); - - glScalef(-fScale, -fScale, fScale); - - glDisable(GL_LIGHTING); - glDepthMask(false); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - Tesselator* t = Tesselator::getInstance(); - int width = font->width(name) / 2; - - glDisable(GL_TEXTURE_2D); - t->begin(); - t->color(0.0f, 0.0f, 0.0f, 0.25f * opacity); - t->vertex(-width - 1, -1, 0.0f); - t->vertex(-width - 1, 8, 0.0f); - t->vertex(width + 1, 8, 0.0f); - t->vertex(width + 1, -1, 0.0f); - t->end(); - glEnable(GL_TEXTURE_2D); - - font->draw(name, -width, 0, color); - - glEnable(GL_LIGHTING); - glDisable(GL_BLEND); - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - glPopMatrix(); - - return 1; -} -*/ void EntityRenderer::bindTexture(shared_ptr entity) { bindTexture(getTextureLocation(entity)); diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index 7736f572..bb38465d 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -637,6 +637,7 @@ void C_4JProfile::Initialise(DWORD dwTitleID, pGameSettings->uiBitmaskValues |= (GAMESETTING_UISIZE & 0x00000800); // uisize 2 pGameSettings->uiBitmaskValues |= (GAMESETTING_UISIZE_SPLITSCREEN & 0x00004000); // splitscreen ui size 3 pGameSettings->uiBitmaskValues |= GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on + pGameSettings->uiBitmaskValues |= GAMESETTING_OLDSWINGANIMATION; //eGameSetting_OldSwingAnimation - off // TU12 // favorite skins added, but only set in TU12 - set to FFs @@ -657,12 +658,6 @@ void C_4JProfile::Initialise(DWORD dwTitleID, // PS Vita - network mode added pGameSettings->uiBitmaskValues &= ~GAMESETTING_PSVITANETWORKMODEADHOC; //eGameSetting_PSVita_NetworkModeAdhoc - off - // TU 25 - pGameSettings->uiBitmaskValues |= GAMESETTING_CAVESOUNDS; //eGameSetting_CaveSounds - on - pGameSettings->uiBitmaskValues |= GAMESETTING_CLASSICCRAFTING; //eGameSetting_ClassicCrafting - off - - // New - pGameSettings->uiBitmaskValues |= GAMESETTING_OLDSWINGANIMATION; //eGameSetting_OldSwingAnimation - off // Tutorials for most menus, and a few other things pGameSettings->ucTutorialCompletion[0] = 0xFF; diff --git a/Minecraft.Client/FishingHookRenderer.cpp b/Minecraft.Client/FishingHookRenderer.cpp index aaa9fed0..d587ddb8 100644 --- a/Minecraft.Client/FishingHookRenderer.cpp +++ b/Minecraft.Client/FishingHookRenderer.cpp @@ -1,42 +1,34 @@ #include "stdafx.h" #include "FishingHookRenderer.h" #include "EntityRenderDispatcher.h" +#include "Options.h" #include "..\Minecraft.World\net.minecraft.world.entity.projectile.h" #include "..\Minecraft.World\net.minecraft.world.entity.player.h" #include "..\Minecraft.World\Vec3.h" #include "..\Minecraft.World\Mth.h" +#include "MultiPlayerLocalPlayer.h" ResourceLocation FishingHookRenderer::PARTICLE_LOCATION = ResourceLocation(TN_PARTICLES); -// TU25 -/* -FishingHookRenderer::FishingHookRenderer(EntityRenderDispatcher* dispatcher) : EntityRenderer() -{ - this->entityRenderDispatcher = dispatcher; -} -*/ - void FishingHookRenderer::render(shared_ptr _hook, double x, double y, double z, float rot, float a) { // 4J - dynamic cast required because we aren't using templates/generics in our version shared_ptr hook = dynamic_pointer_cast(_hook); - if (hook == nullptr) - return; - glPushMatrix(); glTranslatef(static_cast(x), static_cast(y), static_cast(z)); glEnable(GL_RESCALE_NORMAL); glScalef(1 / 2.0f, 1 / 2.0f, 1 / 2.0f); - - bindTexture(hook); //TODO: Remove + int xi = 1; + int yi = 2; + bindTexture(hook); // 4J was L"/particles.png" Tesselator *t = Tesselator::getInstance(); - float u0 = 8.0f / 128.0f; - float u1 = 16.0f / 128.0f; - float v0 = 16.0f / 128.0f; - float v1 = 24.0f / 128.0f; + float u0 = (xi * 8 + 0) / 128.0f; + float u1 = (xi * 8 + 8) / 128.0f; + float v0 = (yi * 8 + 0) / 128.0f; + float v1 = (yi * 8 + 8) / 128.0f; float r = 1.0f; @@ -56,6 +48,7 @@ void FishingHookRenderer::render(shared_ptr _hook, double x, double y, d glDisable(GL_RESCALE_NORMAL); glPopMatrix(); + if (hook->owner != nullptr) { float swing = hook->owner->getAttackAnim(a); @@ -71,11 +64,7 @@ void FishingHookRenderer::render(shared_ptr _hook, double x, double y, d double xp = hook->owner->xo + (hook->owner->x - hook->owner->xo) * a + vv->x; double yp = hook->owner->yo + (hook->owner->y - hook->owner->yo) * a + vv->y; double zp = hook->owner->zo + (hook->owner->z - hook->owner->zo) * a + vv->z; - - double yOffset = hook->owner->getHeadHeight(); - double sneakOffset = 0.0; - if (hook->owner->isSneaking()) - sneakOffset = -0.1875; + double yOffset = hook->owner == dynamic_pointer_cast(Minecraft::GetInstance()->player) ? 0 : hook->owner->getHeadHeight(); // 4J-PB - changing this to be per player //if (this->entityRenderDispatcher->options->thirdPersonView) @@ -84,13 +73,13 @@ void FishingHookRenderer::render(shared_ptr _hook, double x, double y, d float rr = (float) (hook->owner->yBodyRotO + (hook->owner->yBodyRot - hook->owner->yBodyRotO) * a) * PI / 180; double ss = Mth::sin((float) rr); double cc = Mth::cos((float) rr); - xp = hook->owner->xo + (hook->owner->x - hook->owner->xo) * a - cc * 0.35 - ss * 0.80; - yp = hook->owner->yo + yOffset + (hook->owner->y - hook->owner->yo) * a - 0.45 + sneakOffset; - zp = hook->owner->zo + (hook->owner->z - hook->owner->zo) * a - ss * 0.35 + cc * 0.80; + xp = hook->owner->xo + (hook->owner->x - hook->owner->xo) * a - cc * 0.35 - ss * 0.85; + yp = hook->owner->yo + yOffset + (hook->owner->y - hook->owner->yo) * a - 0.45; + zp = hook->owner->zo + (hook->owner->z - hook->owner->zo) * a - ss * 0.35 + cc * 0.85; } double xh = hook->xo + (hook->x - hook->xo) * a; - double yh = hook->yo + (hook->y - hook->yo) * a + 0.25; + double yh = hook->yo + (hook->y - hook->yo) * a + 4 / 16.0f; double zh = hook->zo + (hook->z - hook->zo) * a; double xa = static_cast(xp - xh); @@ -99,25 +88,17 @@ void FishingHookRenderer::render(shared_ptr _hook, double x, double y, d glDisable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); - t->begin(GL_LINE_STRIP); t->color(0x000000); - int steps = 16; for (int i = 0; i <= steps; i++) { - float aa = static_cast(i) / static_cast(steps); - t->vertex( - static_cast(x + xa * aa), - static_cast(y + ya * (aa * aa + aa) * 0.5 + 0.25f), - static_cast(z + za * aa) - ); + float aa = i / static_cast(steps); + t->vertex(static_cast(x + xa * aa), static_cast(y + ya * (aa * aa + aa) * 0.5 + 4 / 16.0f), static_cast(z + za * aa)); } t->end(); glEnable(GL_LIGHTING); glEnable(GL_TEXTURE_2D); - - //EntityRenderer::render(_hook, x, y, z, rot, a); // TU25 } } diff --git a/Minecraft.Client/FishingHookRenderer.h b/Minecraft.Client/FishingHookRenderer.h index daa80fa2..8c58ea9b 100644 --- a/Minecraft.Client/FishingHookRenderer.h +++ b/Minecraft.Client/FishingHookRenderer.h @@ -5,8 +5,8 @@ class FishingHookRenderer : public EntityRenderer { private: static ResourceLocation PARTICLE_LOCATION; + public: -// FishingHookRenderer(EntityRenderDispatcher* dispatcher); // TU25 virtual void render(shared_ptr _hook, double x, double y, double z, float rot, float a); virtual ResourceLocation *getTextureLocation(shared_ptr mob); }; \ No newline at end of file diff --git a/Minecraft.Client/GameRenderer.cpp b/Minecraft.Client/GameRenderer.cpp index acf7572c..393d4b44 100644 --- a/Minecraft.Client/GameRenderer.cpp +++ b/Minecraft.Client/GameRenderer.cpp @@ -876,11 +876,6 @@ void GameRenderer::updateLightTexture(float a) Level *level = player->level; - int dimColor = level->dimension->getBlockLightColour(); - float dimB = (float)((dimColor >> 16) & 0xFF) / 255.0f; - float dimG = (float)((dimColor >> 8) & 0xFF) / 255.0f; - float dimR = (float)(dimColor & 0xFF) / 255.0f; - const float skyDarken1 = level->getSkyDarken(1.0f); const float skyWeight = skyDarken1 * 0.65f + 0.35f; const float darken = skyDarken1 * 0.95f + 0.05f; @@ -892,10 +887,6 @@ void GameRenderer::updateLightTexture(float a) const __m256 vSkyWeight = _mm256_set1_ps(skyWeight); const __m256 vBlockMult = _mm256_set1_ps(blockMult); - const __m256 vDimR = _mm256_set1_ps(dimR); - const __m256 vDimG = _mm256_set1_ps(dimG); - const __m256 vDimB = _mm256_set1_ps(dimB); - const bool skyFlash = level->skyFlashTime < 0; const bool isEnd = level->dimension->id == 1; @@ -906,7 +897,8 @@ void GameRenderer::updateLightTexture(float a) for (int i = 0; i < 256; i += 8) { alignas(32) float sRamp[8], bRamp[8]; - for(int k=0; k<8; ++k) { + for(int k=0; k<8; ++k) + { sRamp[k] = level->dimension->brightnessRamp[(i + k) / 16]; bRamp[k] = level->dimension->brightnessRamp[(i + k) % 16]; } @@ -925,13 +917,9 @@ void GameRenderer::updateLightTexture(float a) __m256 vGb_base = _mm256_mul_ps(vBlock, _mm256_add_ps(_mm256_mul_ps(_mm256_add_ps(_mm256_mul_ps(vBlock, _mm256_set1_ps(0.6f)), _mm256_set1_ps(0.4f)), _mm256_set1_ps(0.6f)), _mm256_set1_ps(0.4f))); __m256 vBb_base = _mm256_mul_ps(vBlock, _mm256_add_ps(_mm256_mul_ps(_mm256_mul_ps(vBlock, vBlock), _mm256_set1_ps(0.6f)), _mm256_set1_ps(0.4f))); - __m256 vRb = _mm256_mul_ps(vRb_base, vDimR); - __m256 vGb = _mm256_mul_ps(vGb_base, vDimG); - __m256 vBb = _mm256_mul_ps(vBb_base, vDimB); - - __m256 vR = _mm256_add_ps(vRs, vRb); - __m256 vG = _mm256_add_ps(vGs, vGb); - __m256 vB = _mm256_add_ps(vBs, vBb); + __m256 vR = _mm256_add_ps(vRs, vRb_base); + __m256 vG = _mm256_add_ps(vGs, vGb_base); + __m256 vB = _mm256_add_ps(vBs, vBb_base); vR = _mm256_add_ps(_mm256_mul_ps(vR, v096), v003); vG = _mm256_add_ps(_mm256_mul_ps(vG, v096), v003); @@ -946,9 +934,9 @@ void GameRenderer::updateLightTexture(float a) if (isEnd) { - vR = _mm256_add_ps(_mm256_set1_ps(0.22f), _mm256_mul_ps(vRb, _mm256_set1_ps(0.75f))); - vG = _mm256_add_ps(_mm256_set1_ps(0.28f), _mm256_mul_ps(vGb, _mm256_set1_ps(0.75f))); - vB = _mm256_add_ps(_mm256_set1_ps(0.25f), _mm256_mul_ps(vBb, _mm256_set1_ps(0.75f))); + vR = _mm256_add_ps(_mm256_set1_ps(0.22f), _mm256_mul_ps(vRb_base, _mm256_set1_ps(0.75f))); + vG = _mm256_add_ps(_mm256_set1_ps(0.28f), _mm256_mul_ps(vGb_base, _mm256_set1_ps(0.75f))); + vB = _mm256_add_ps(_mm256_set1_ps(0.25f), _mm256_mul_ps(vBb_base, _mm256_set1_ps(0.75f))); } if (hasNV) @@ -997,9 +985,9 @@ void GameRenderer::updateLightTexture(float a) const float gs = sky * skyWeight; const float bs = sky; - const float rb = block * dimR; - const float gb = (block * ((block * 0.6f + 0.4f) * 0.6f + 0.4f)) * dimG; - const float bb = (block * ((block * block) * 0.6f + 0.4f)) * dimB; + const float rb = block; + const float gb = block * ((block * 0.6f + 0.4f) * 0.6f + 0.4f); + const float bb = block * ((block * block) * 0.6f + 0.4f); float _r = (rs + rb); float _g = (gs + gb); @@ -1640,33 +1628,34 @@ void GameRenderer::renderLevel(float a, int64_t until) // 4J - have changed this fancy rendering option to work with our command buffers. The original used to use frame buffer flags to disable // writing to colour when doing the z-only pass, but that value gets obliterated by our command buffers. Using alpha blend function instead // to achieve the same effect. - if (mc->options->ambientOcclusion) - { - GL11::glShadeModel(GL11::GL_SMOOTH); - } - - PIXBeginNamedEvent(0,"Fancy second pass - writing z"); - glBlendFunc(GL_ZERO, GL_ONE); - glEnable(GL_CULL_FACE); - levelRenderer->render(cameraEntity, 2, a, updateChunks); - PIXEndNamedEvent(); - - PIXBeginNamedEvent(0, "Fancy second pass - actual render"); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - levelRenderer->render(cameraEntity, 2, a, updateChunks); // 4J - chanaged, used to be renderSameAsLast but we don't support that anymore - PIXEndNamedEvent(); - if (mc->options->fancyGraphics) { + if (mc->options->ambientOcclusion) + { + GL11::glShadeModel(GL11::GL_SMOOTH); + } + + glBlendFunc(GL_ZERO, GL_ONE); + PIXBeginNamedEvent(0,"Fancy second pass - writing z"); + int visibleWaterChunks = levelRenderer->render(cameraEntity, 1, a, updateChunks); + PIXEndNamedEvent(); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + if (visibleWaterChunks > 0) + { + PIXBeginNamedEvent(0,"Fancy second pass - actual rendering"); + levelRenderer->render(cameraEntity, 1, a, updateChunks); // 4J - chanaged, used to be renderSameAsLast but we don't support that anymore + PIXEndNamedEvent(); + } + GL11::glShadeModel(GL11::GL_FLAT); } - - // @Patoke todo: implement, this is really important for rendering of order independent alpha objects - // RenderManager.BeginOrderIndependentAlpha(); - - PIXBeginNamedEvent(0, "Second pass level rendering"); - levelRenderer->render(cameraEntity, 1, a, updateChunks); - PIXEndNamedEvent(); + else + { + PIXBeginNamedEvent(0,"Second pass level render"); + levelRenderer->render(cameraEntity, 1, a, updateChunks); + PIXEndNamedEvent(); + } // 4J - added - have split out translucent particle rendering so that it happens after the water is rendered, primarily for fireworks PIXBeginNamedEvent(0,"Particle render (translucent)"); @@ -1678,8 +1667,6 @@ void GameRenderer::renderLevel(float a, int64_t until) particleEngine->render(cameraEntity, a, ParticleEngine::TRANSLUCENT_LIST); PIXEndNamedEvent(); turnOffLightLayer(a); // 4J - brought forward from 1.8.2 - // @Patoke todo: implement - // RenderManager.EndOrderIndependentAlpha(); ////////////////////////// End of 4J added section glDepthMask(true); @@ -2096,7 +2083,7 @@ void GameRenderer::setupClearColor(float a) float sg = static_cast(skyColor->y); float sb = static_cast(skyColor->z); - Vec3 *fogColor = level->getFogColor(player, a); + Vec3 *fogColor = level->getFogColor(a); fr = static_cast(fogColor->x); fg = static_cast(fogColor->y); fb = static_cast(fogColor->z); @@ -2143,7 +2130,7 @@ void GameRenderer::setupClearColor(float a) int t = Camera::getBlockAt(mc->level, player, a); - constexpr float INV_256 = 0.00390625f; + const float INV_256 = 0.00390625f; if (isInClouds) { @@ -2329,8 +2316,7 @@ void GameRenderer::setupFog(int i, float alpha) glFogf(GL_FOG_END, distance); } - Biome *biome = mc->level->getBiome(static_cast(player->x), static_cast(player->z)); - if (biome->isFoggy()) + if (mc->level->dimension->isFoggyAt(static_cast(player->x), static_cast(player->z))) { glFogf(GL_FOG_START, distance * 0.05f); glFogf(GL_FOG_END, min(distance, 16 * 16 * .75f) * .5f); diff --git a/Minecraft.Client/Gui.cpp b/Minecraft.Client/Gui.cpp index aeae9bf2..898de197 100644 --- a/Minecraft.Client/Gui.cpp +++ b/Minecraft.Client/Gui.cpp @@ -1076,7 +1076,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { int renderDistance = app.GetGameSettings(iPad, eGameSetting_RenderDistance); - lines.push_back(L"Minecraft LCE TU30 " + minecraft->fpsString); + lines.push_back(L"Minecraft LCE TU24 " + minecraft->fpsString); lines.push_back(L"Seed: " + std::to_wstring(minecraft->level->getLevelData()->getSeed())); lines.push_back(minecraft->gatherStats1()); // Time to autosave lines.push_back(L"Render Distance: " + std::to_wstring(renderDistance)); diff --git a/Minecraft.Client/ItemFrameRenderer.cpp b/Minecraft.Client/ItemFrameRenderer.cpp index 220386b4..55354aac 100644 --- a/Minecraft.Client/ItemFrameRenderer.cpp +++ b/Minecraft.Client/ItemFrameRenderer.cpp @@ -73,7 +73,7 @@ void ItemFrameRenderer::drawFrame(shared_ptr itemFrame) tileRenderer->clearFixedShape(); glPopMatrix(); - tileRenderer->setFixedTexture(Tile::wood->getTexture(Facing::UP, LogTile::BIRCH_TRUNK)); + tileRenderer->setFixedTexture(Tile::wood->getTexture(Facing::UP, TreeTile::BIRCH_TRUNK)); // Bottom glPushMatrix(); diff --git a/Minecraft.Client/LevelRenderer.cpp b/Minecraft.Client/LevelRenderer.cpp index 0d5e24d5..c5ba7ced 100644 --- a/Minecraft.Client/LevelRenderer.cpp +++ b/Minecraft.Client/LevelRenderer.cpp @@ -718,28 +718,24 @@ void LevelRenderer::resortChunks(int xc, int yc, int zc) _mm_store_si128((__m128i*)resMax, vYMax); for(int i = 0; i < 4; i++) { - if (resMin[i] < yMinChunk) yMinChunk = resMin[i]; - if (resMax[i] > yMaxChunk) yMaxChunk = resMax[i]; + if (resMin[i] < yMinChunk) + yMinChunk = resMin[i]; + if (resMax[i] > yMaxChunk) + yMaxChunk = resMax[i]; } + } +#endif for (int y = 0; y < yChunks; y++) { int yy = y * CHUNK_SIZE; - if (yy < yMinChunk) yMinChunk = yy; - if (yy > yMaxChunk) yMaxChunk = yy; + if (yy < yMinChunk) + yMinChunk = yy; + if (yy > yMaxChunk) + yMaxChunk = yy; + chunks[playerIndex][(z * yChunks + y) * xChunks + x].chunk->setPos(xx, yy, zz); } - } -#endif - for (int y = 0; y < yChunks; y++) - { - int yy = y * CHUNK_SIZE; - if (yy < yMinChunk) yMinChunk = yy; - if (yy > yMaxChunk) yMaxChunk = yy; - - Chunk *chunk = chunks[playerIndex][(z * yChunks + y) * xChunks + x].chunk; - chunk->setPos(xx, yy, zz); - } } } nonStackDirtyChunksAdded(); @@ -873,7 +869,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) if( ( globalChunkFlags[pClipChunk->globalIdx] & emptyFlag ) == emptyFlag ) continue; // Check that this particular layer isn't empty // List can be calculated directly from the chunk's global idex - int list = pClipChunk->globalIdx * 3 + layer; + int list = pClipChunk->globalIdx * 2 + layer; list += chunkLists; if(RenderManager.CBuffCall(list, first)) @@ -898,7 +894,7 @@ int LevelRenderer::renderChunks(int from, int to, int layer, double alpha) if( !(globalChunkFlags[pClipChunk->globalIdx] & LevelRenderer::CHUNK_FLAG_CUT_OUT) ) continue; // Does this chunk contain any cut out geometry // List can be calculated directly from the chunk's global idex - int list = pClipChunk->globalIdx * 3 + layer; + int list = pClipChunk->globalIdx * 2 + layer; list += chunkLists; if(RenderManager.CBuffCallCutOut(list, first)) diff --git a/Minecraft.Client/LevelRenderer.h b/Minecraft.Client/LevelRenderer.h index e3a796eb..b33ae5d5 100644 --- a/Minecraft.Client/LevelRenderer.h +++ b/Minecraft.Client/LevelRenderer.h @@ -45,11 +45,11 @@ private: static ResourceLocation END_SKY_LOCATION; public: - static constexpr int CHUNK_XZSIZE = 16; + static const int CHUNK_XZSIZE = 16; #ifdef _LARGE_WORLDS - static constexpr int CHUNK_SIZE = 16; + static const int CHUNK_SIZE = 16; #else - static constexpr int CHUNK_SIZE = 16; + static const int CHUNK_SIZE = 16; #endif static constexpr int CHUNK_Y_COUNT = Level::maxBuildHeight / CHUNK_SIZE; #if defined _WINDOWS64 @@ -221,10 +221,10 @@ public: // This is the TOTAL area of columns of chunks to be allocated for render round the players. So for one player, it would be a region of // sqrt(PLAYER_RENDER_AREA) x sqrt(PLAYER_RENDER_AREA) #ifdef _LARGE_WORLDS - static constexpr int PLAYER_VIEW_DISTANCE = 18; // Straight line distance from centre to extent of visible world + static const int PLAYER_VIEW_DISTANCE = 18; // Straight line distance from centre to extent of visible world static constexpr int PLAYER_RENDER_AREA = (PLAYER_VIEW_DISTANCE * PLAYER_VIEW_DISTANCE * 4); #else - static constexpr int PLAYER_RENDER_AREA = 400; + static const int PLAYER_RENDER_AREA = 400; #endif static int getDimensionIndexFromId(int id); @@ -275,7 +275,7 @@ public: static const int FORCE_DIRTY_CHUNK_CHECK_PERIOD_MS = 125; // decreased from 250 to 125 - updated by detectiveren #ifdef _LARGE_WORLDS - static constexpr int MAX_CONCURRENT_CHUNK_REBUILDS = 8; // increased from 4 to 8 - updated by detectiveren + static const int MAX_CONCURRENT_CHUNK_REBUILDS = 8; // increased from 4 to 8 - updated by detectiveren static constexpr int MAX_CHUNK_REBUILD_THREADS = MAX_CONCURRENT_CHUNK_REBUILDS - 1; static Chunk permaChunk[MAX_CONCURRENT_CHUNK_REBUILDS]; static C4JThread *rebuildThreads[MAX_CHUNK_REBUILD_THREADS]; diff --git a/Minecraft.Client/Minecraft.cpp b/Minecraft.Client/Minecraft.cpp index bd4756a8..60592c97 100644 --- a/Minecraft.Client/Minecraft.cpp +++ b/Minecraft.Client/Minecraft.cpp @@ -1514,7 +1514,7 @@ void Minecraft::run_middle() if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CRAFTING) || g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CRAFTING_ALT)) { - if((ui.IsSceneInStack(i, eUIScene_Crafting2x2Menu) || ui.IsSceneInStack(i, eUIScene_Crafting3x3Menu) || ui.IsSceneInStack(i, eUIScene_CreativeMenu) || ui.IsSceneInStack(i, eUIScene_ClassicCraftingMenu) || isClosableByEitherKey) && !isEditing) + if((ui.IsSceneInStack(i, eUIScene_Crafting2x2Menu) || ui.IsSceneInStack(i, eUIScene_Crafting3x3Menu) || ui.IsSceneInStack(i, eUIScene_CreativeMenu) || isClosableByEitherKey) && !isEditing) ui.CloseUIScenes(i); else localplayers[i]->ullButtonsPressed|=1LL<getItem()->id) { - // Equip - case Item::helmet_leather_Id: - case Item::chestplate_leather_Id: - case Item::leggings_leather_Id: - case Item::boots_leather_Id: - case Item::helmet_chain_Id: - case Item::chestplate_chain_Id: - case Item::leggings_chain_Id: - case Item::boots_chain_Id: - case Item::helmet_iron_Id: - case Item::chestplate_iron_Id: - case Item::leggings_iron_Id: - case Item::boots_iron_Id: - case Item::helmet_gold_Id: - case Item::chestplate_gold_Id: - case Item::leggings_gold_Id: - case Item::boots_gold_Id: - case Item::helmet_diamond_Id: - case Item::chestplate_diamond_Id: - case Item::leggings_diamond_Id: - case Item::boots_diamond_Id: - { - if ((player->getArmor(Mob::getEquipmentSlotForItem(itemInstance) - 1)) == nullptr) - { - *piUse=IDS_TOOLTIPS_EQUIP; - } - } - break; - // food case Item::potatoBaked_Id: case Item::potato_Id: @@ -2786,22 +2757,12 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) case Tile::furnace_Id: case Tile::furnace_lit_Id: case Tile::door_wood_Id: - case Tile::door_spruce_Id: - case Tile::door_birch_Id: - case Tile::door_jungle_Id: - case Tile::door_acacia_Id: - case Tile::door_dark_oak_Id: case Tile::dispenser_Id: case Tile::lever_Id: case Tile::button_stone_Id: case Tile::button_wood_Id: case Tile::trapdoor_Id: case Tile::fenceGate_Id: - case Tile::spruceFenceGate_Id: - case Tile::birchFenceGate_Id: - case Tile::jungleFenceGate_Id: - case Tile::acaciaFenceGate_Id: - case Tile::darkOakFenceGate_Id: case Tile::beacon_Id: *piAction=IDS_TOOLTIPS_MINE; *piUse=IDS_TOOLTIPS_USE; @@ -3847,11 +3808,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures) else { ui.PlayUISFX(eSFX_Press); - - if(app.GetGameSettings(iPad,eGameSetting_ClassicCrafting)) - app.LoadInventoryMenu(iPad,player); - else - app.LoadCrafting2x2Menu(iPad,player); + app.LoadCrafting2x2Menu(iPad,player); } } @@ -4746,7 +4703,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const */ Minecraft *minecraft; - // 4J - was new Minecraft(frame, canvas, nullptr, 854, 480, fullScreen); + // 4J - was new Minecraft(frame, canvas, NULL, 854, 480, fullScreen); // Logical width is proportional to the real screen aspect ratio so that // the ortho projection and HUD layout match the viewport without stretching. extern int g_iScreenWidth; @@ -4844,7 +4801,6 @@ void Minecraft::main() User::staticCtor(); Tutorial::staticCtor(); ColourTable::staticCtor(); - StructureTable::staticCtor(); app.loadDefaultGameRules(); #ifdef _LARGE_WORLDS @@ -5314,20 +5270,6 @@ ColourTable *Minecraft::getColourTable() return colours; } -StructureTable *Minecraft::getStructureTable() -{ - TexturePack *selected = skins->getSelected(); - - StructureTable *structures = selected->getStructureTable(); - - if (structures == nullptr) - { - structures = skins->getDefault()->getStructureTable(); - } - - return structures; -} - #if defined __ORBIS__ int Minecraft::MustSignInReturnedPSN(void *pParam, int iPad, C4JStorage::EMessageResult result) { diff --git a/Minecraft.Client/Minecraft.h b/Minecraft.Client/Minecraft.h index 0851e9bd..2c5203d8 100644 --- a/Minecraft.Client/Minecraft.h +++ b/Minecraft.Client/Minecraft.h @@ -35,7 +35,6 @@ class ConsoleSaveFile; class ItemInHandRenderer; class LevelSettings; class ColourTable; -class StructureTable; class MultiPlayerGameMode; class PsPlusUpsellWrapper; @@ -345,7 +344,6 @@ public: unsigned int getCurrentTexturePackId(); ColourTable *getColourTable(); - StructureTable *getStructureTable(); #if defined __ORBIS__ static int MustSignInReturnedPSN(void *pParam, int iPad, C4JStorage::EMessageResult result); diff --git a/Minecraft.Client/Options.cpp b/Minecraft.Client/Options.cpp index 63069d7f..bc4fa88c 100644 --- a/Minecraft.Client/Options.cpp +++ b/Minecraft.Client/Options.cpp @@ -474,6 +474,7 @@ void Options::load() if (cmds[0] == L"difficulty") difficulty = _fromString(cmds[1]); if (cmds[0] == L"fancyGraphics") fancyGraphics = cmds[1]==L"true"; if (cmds[0] == L"ao") ambientOcclusion = cmds[1]==L"true"; + if (cmds[0] == L"mipmapsBlend") mipmapsBlend = cmds[1]==L"false"; if (cmds[0] == L"clouds") renderClouds = cmds[1]==L"true"; if (cmds[0] == L"advancedTooltips") advancedTooltips = cmds[1]==L"false"; if (cmds[0] == L"skin") skin = cmds[1]; @@ -532,6 +533,7 @@ void Options::save() dos.writeChars(L"difficulty:" + std::to_wstring(difficulty)); dos.writeChars(L"fancyGraphics:" + wstring(fancyGraphics ? L"true" : L"false")); dos.writeChars(ambientOcclusion ? L"ao:true" : L"ao:false"); + dos.writeChars(mipmapsBlend ? L"mipmapsBlend:true" : L"mipmapsBlend:false"); dos.writeChars(renderClouds ? L"clouds:true" : L"clouds:false"); dos.writeChars(advancedTooltips ? L"advancedTooltips:true" : L"advancedTooltips:false"); dos.writeChars(L"skin:" + skin); diff --git a/Minecraft.Client/PSVita/PSVita_App.cpp b/Minecraft.Client/PSVita/PSVita_App.cpp index 84c3b79f..8c9236c7 100644 --- a/Minecraft.Client/PSVita/PSVita_App.cpp +++ b/Minecraft.Client/PSVita/PSVita_App.cpp @@ -1239,7 +1239,7 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage: if (saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota || saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfLocalStorage) { - if(UIScene_LoadCreateJoinMenu::isSaveTransferRunning()) + if(UIScene_LoadOrJoinMenu::isSaveTransferRunning()) { // 4J MGH - if we're trying to save from the save transfer stuff, only show "ok", and we won't try to save again if(saveIncompleteType == C4JStorage::ESaveIncomplete_OutOfQuota) blocksRequired = -1; @@ -1262,7 +1262,7 @@ void CConsoleMinecraftApp::Callback_SaveGameIncomplete(void *pParam, C4JStorage: int CConsoleMinecraftApp::NoSaveSpaceReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - if(result==C4JStorage::EMessage_ResultAccept && !UIScene_LoadCreateJoinMenu::isSaveTransferRunning()) // MGH - we won't try to save again during a save tranfer + if(result==C4JStorage::EMessage_ResultAccept && !UIScene_LoadOrJoinMenu::isSaveTransferRunning()) // MGH - we won't try to save again during a save tranfer { int blocksRequired = (int)pParam; if(blocksRequired > 0) diff --git a/Minecraft.Client/PreStitchedTextureMap.cpp b/Minecraft.Client/PreStitchedTextureMap.cpp index ad9678b7..33e0b59e 100644 --- a/Minecraft.Client/PreStitchedTextureMap.cpp +++ b/Minecraft.Client/PreStitchedTextureMap.cpp @@ -510,7 +510,7 @@ void PreStitchedTextureMap::loadUVs() ADD_ICON(10, 3, L"name_tag") ADD_ICON(10, 4, L"lead") ADD_ICON(10, 5, L"netherbrick") - ADD_ICON(10, 6, L"fish_clownfish_raw") + //ADD_ICON(10, 6, L"unused") ADD_ICON(10, 7, L"minecart_furnace") ADD_ICON(10, 8, L"charcoal") ADD_ICON(10, 9, L"monsterPlacer_overlay") @@ -524,10 +524,10 @@ void PreStitchedTextureMap::loadUVs() ADD_ICON(11, 0, L"leggingsCloth_overlay") //ADD_ICON(11, 1, L"unused") //ADD_ICON(11, 2, L"unused") - ADD_ICON(11, 3, L"barrier") - ADD_ICON(11, 4, L"mutton_raw") - ADD_ICON(11, 5, L"rabbit_raw") - ADD_ICON(11, 6, L"fish_pufferfish_raw") + //ADD_ICON(11, 3, L"unused") + //ADD_ICON(11, 4, L"unused") + //ADD_ICON(11, 5, L"unused") + //ADD_ICON(11, 6, L"unused") ADD_ICON(11, 7, L"minecart_hopper") ADD_ICON(11, 8, L"hopper") ADD_ICON(11, 9, L"nether_star") @@ -542,9 +542,9 @@ void PreStitchedTextureMap::loadUVs() //ADD_ICON(12, 1, L"unused") //ADD_ICON(12, 2, L"unused") //ADD_ICON(12, 3, L"unused") - ADD_ICON(12, 4, L"mutton_cooked") - ADD_ICON(12, 5, L"rabbit_cooked") - ADD_ICON(12, 6, L"fish_salmon_raw") + //ADD_ICON(12, 4, L"unused") + //ADD_ICON(12, 5, L"unused") + //ADD_ICON(12, 6, L"unused") ADD_ICON(12, 7, L"minecart_tnt") //ADD_ICON(12, 8, L"unused") ADD_ICON(12, 9, L"fireworks") @@ -555,23 +555,6 @@ void PreStitchedTextureMap::loadUVs() ADD_ICON(12, 14, L"frame") ADD_ICON(12, 15, L"enchantedBook") - ADD_ICON(13, 0, L"door_acacia") - ADD_ICON(13, 1, L"door_birch") - ADD_ICON(13, 2, L"door_dark_oak") - ADD_ICON(13, 3, L"door_jungle") - ADD_ICON(13, 4, L"door_spruce") - ADD_ICON(13, 5, L"rabbit_stew") - ADD_ICON(13, 6, L"fish_salmon_cooked") - ADD_ICON(13, 7, L"minecart_command_block") - //ADD_ICON(13, 8, L"unused") - //ADD_ICON(13, 9, L"unused") - //ADD_ICON(13, 10, L"unused") - //ADD_ICON(13, 11, L"unused") - //ADD_ICON(13, 12, L"unused") - ADD_ICON(13, 13, L"prismarine_shard") - ADD_ICON(13, 14, L"prismarine_crystals") - ADD_ICON(13, 15, L"potion_bottle_drinkable") - ADD_ICON(14, 0, L"skull_skeleton") ADD_ICON(14, 1, L"skull_wither") ADD_ICON(14, 2, L"skull_zombie") @@ -818,7 +801,7 @@ void PreStitchedTextureMap::loadUVs() ADD_ICON(8, 9, L"melon_top"); ADD_ICON(8, 10, L"cauldron_top"); ADD_ICON(8, 11, L"cauldron_inner"); - ADD_ICON(8, 12, L"sponge_wet"); + //ADD_ICON(8, 12, L"unused"); ADD_ICON(8, 13, L"mushroom_block_skin_stem"); ADD_ICON(8, 14, L"mushroom_block_inside"); ADD_ICON(8, 15, L"vine"); @@ -886,7 +869,7 @@ void PreStitchedTextureMap::loadUVs() ADD_ICON(12, 9, L"carrots_stage_1"); ADD_ICON(12, 10, L"carrots_stage_2"); ADD_ICON(12, 11, L"carrots_stage_3"); - ADD_ICON(12, 12, L"slime"); + //ADD_ICON(12, 12, L"unused"); ADD_ICON(12, 13, L"water"); ADD_ICON_SIZE(12,14,L"water_flow",2,2); @@ -939,12 +922,12 @@ void PreStitchedTextureMap::loadUVs() ADD_ICON(16, 0, L"coal_block"); ADD_ICON(16, 1, L"hardened_clay"); ADD_ICON(16, 2, L"noteblock"); - ADD_ICON(16, 3, L"stone_andesite"); - ADD_ICON(16, 4, L"stone_andesite_smooth"); - ADD_ICON(16, 5, L"stone_diorite"); - ADD_ICON(16, 6, L"stone_diorite_smooth"); - ADD_ICON(16, 7, L"stone_granite"); - ADD_ICON(16, 8, L"stone_granite_smooth"); + //ADD_ICON(16, 3, L"unused"); + //ADD_ICON(16, 4, L"unused"); + //ADD_ICON(16, 5, L"unused"); + //ADD_ICON(16, 6, L"unused"); + //ADD_ICON(16, 7, L"unused"); + //ADD_ICON(16, 8, L"unused"); ADD_ICON(16, 9, L"potatoes_stage_0"); ADD_ICON(16, 10, L"potatoes_stage_1"); ADD_ICON(16, 11, L"potatoes_stage_2"); @@ -1003,74 +986,5 @@ void PreStitchedTextureMap::loadUVs() ADD_ICON(19, 13, L"glass_pane_top_silver"); ADD_ICON(19, 14, L"glass_pane_top_white"); ADD_ICON(19, 15, L"glass_pane_top_yellow"); - - - ADD_ICON(20, 0, L"double_plant_fern_top") - ADD_ICON(20, 1, L"double_plant_grass_top") - ADD_ICON(20, 2, L"dobule_plant_paeonia_top") - ADD_ICON(20, 3, L"double_plant_rose_top") - ADD_ICON(20, 4, L"double_plant_syringa_top") - ADD_ICON(20, 5, L"flower_tulip_orange") - ADD_ICON(20, 6, L"double_plant_sunflower_top") - ADD_ICON(20, 7, L"double_plant_sunflower_front") - ADD_ICON(20, 8, L"log_acacia") - ADD_ICON(20, 9, L"log_acacia_top") - ADD_ICON(20, 10, L"planks_acacia") - ADD_ICON(20, 11, L"leaves_acacia") - ADD_ICON(20, 12, L"leaves_acacia_fast") - ADD_ICON(20, 13, L"prismarine_bricks") - ADD_ICON(20, 14, L"red_sand") - ADD_ICON(20, 15, L"red_sandstone_top") - - ADD_ICON(21, 0, L"double_plant_fern_bottom") - ADD_ICON(21, 1, L"double_plant_grass_bottom") - ADD_ICON(21, 2, L"double_plant_paeonia_bottom") - ADD_ICON(21, 3, L"double_plant_rose_bottom") - ADD_ICON(21, 4, L"double_plant_syringa_bottm") - ADD_ICON(21, 5, L"flower_tulip_pink") - ADD_ICON(21, 6, L"double_plant_sunflower_bottom") - ADD_ICON(21, 7, L"double_plant_sunflower_back") - ADD_ICON(21, 8, L"log_big_oak") - ADD_ICON(21, 9, L"log_big_oak_top") - ADD_ICON(21, 10, L"planks_big_oak") - ADD_ICON(21, 11, L"leaves_big_oak") - ADD_ICON(21, 12, L"leaves_big_oak_fast") - ADD_ICON(21, 13, L"prismarine_dark") - ADD_ICON(21, 14, L"red_sandstone_bottom") - ADD_ICON(21, 15, L"red_sandstone_normal") - - ADD_ICON(22, 0, L"flower_alium") - ADD_ICON(22, 1, L"flower_blue_orchid") - ADD_ICON(22, 2, L"flower_houstonia") - ADD_ICON(22, 3, L"flower_oxeye_daisy") - ADD_ICON(22, 4, L"flower_tulip_red") - ADD_ICON(22, 5, L"flower_tulip_white") - ADD_ICON(22, 6, L"sapling_acacia") - ADD_ICON(22, 7, L"sapling_roofed_oak") - ADD_ICON(22, 8, L"coarse_dirt") - ADD_ICON(22, 9, L"dirt_podzol_side") - ADD_ICON(22, 10, L"dirt_podzol_top") - ADD_ICON(22, 11, L"leaves_birch") - ADD_ICON(22, 12, L"leaves_birch_fast") - ADD_ICON(22, 13, L"prismarine_rough") - ADD_ICON(22, 14, L"red_sandstone_carved") - ADD_ICON(22, 15, L"red_sandstone_smooth") - - ADD_ICON(23, 0, L"door_acacia_upper") - ADD_ICON(23, 1, L"door_birch_upper") - ADD_ICON(23, 2, L"door_dark_oak_upper") - ADD_ICON(23, 3, L"door_jungle_upper") - ADD_ICON(23, 4, L"door_spruce_upper") - ADD_ICON(23, 11, L"barrier") - ADD_ICON(23, 12, L"ice_packed") - ADD_ICON(23, 13, L"sea_lantern") - ADD_ICON(23, 14, L"daylight_detector_inverted_top") - ADD_ICON(23, 15, L"iron_trapdoor") - - ADD_ICON(24, 0, L"door_acacia_lower") - ADD_ICON(24, 1, L"door_birch_lower") - ADD_ICON(24, 2, L"door_dark_oak_lower") - ADD_ICON(24, 3, L"door_jungle_lower") - ADD_ICON(24, 4, L"door_spruce_lower") } } diff --git a/Minecraft.Client/SheepRenderer.cpp b/Minecraft.Client/SheepRenderer.cpp index 31bd7de9..5e8a9905 100644 --- a/Minecraft.Client/SheepRenderer.cpp +++ b/Minecraft.Client/SheepRenderer.cpp @@ -48,7 +48,6 @@ int SheepRenderer::prepareArmor(shared_ptr _sheep, int layer, floa glColor3f(brightness * Sheep::COLOR[color][0], brightness * Sheep::COLOR[color][1], brightness * Sheep::COLOR[color][2]); */ return 1; - } return -1; } diff --git a/Minecraft.Client/StringTable.cpp b/Minecraft.Client/StringTable.cpp index b9d295fa..bdee2ca9 100644 --- a/Minecraft.Client/StringTable.cpp +++ b/Minecraft.Client/StringTable.cpp @@ -14,168 +14,123 @@ StringTable::StringTable(PBYTE pbData, DWORD dwSize) ProcessStringTableData(); } -StringTable::~StringTable(void) -{ - Reset(); -} - -void StringTable::Reset(void) -{ - m_stringsMap.clear(); - m_stringsVec.clear(); - m_langSizeMap.clear(); - isStatic = false; - currentLanguage.clear(); -} void StringTable::ReloadStringTable() { - Reset(); - ProcessStringTableData(); + m_stringsMap.clear(); + m_stringsVec.clear(); + + ProcessStringTableData(); } void StringTable::ProcessStringTableData(void) { - if (src.length > 0 && src.data != nullptr) + ByteArrayInputStream bais(src); + DataInputStream dis(&bais); + + int versionNumber = dis.readInt(); + int languagesCount = dis.readInt(); + + vector< pair > langSizeMap; + for(int i = 0; i < languagesCount; ++i) + { + wstring langId = dis.readUTF(); + int langSize = dis.readInt(); + + langSizeMap.push_back( vector< pair >::value_type(langId, langSize)); + } + + vector locales; + app.getLocale(locales); + + bool foundLang = false; + int64_t bytesToSkip = 0; + int dataSize = 0; + + // + for (auto it_locales = locales.begin(); + it_locales != locales.end() && (!foundLang); + ++it_locales) { - ByteArrayInputStream bais(src); - DataInputStream dis(&bais); - - ReadAllFromStream(&dis); - - dis.close(); - bais.reset(); - } + bytesToSkip = 0; + + for(auto& it : langSizeMap) + { + if(it.first.compare(*it_locales) == 0) + { + app.DebugPrintf("StringTable:: Found language '%ls'.\n", it_locales->c_str()); + dataSize = it.second; + foundLang = true; + break; + } + + bytesToSkip += it.second; + } + + if (!foundLang) + app.DebugPrintf("StringTable:: Can't find language '%ls'.\n", it_locales->c_str()); + } + + if(foundLang) + { + dis.skip(bytesToSkip); + + byteArray langData(dataSize); + dis.read(langData); + + dis.close(); + + ByteArrayInputStream bais2(langData); + DataInputStream dis2(&bais2); + + // Read the language file for the selected language + int langVersion = dis2.readInt(); + + isStatic = false; // 4J-JEV: Versions 1 and up could use + if (langVersion > 0) // integers rather than wstrings as keys. + isStatic = dis2.readBoolean(); + + wstring langId = dis2.readUTF(); + int totalStrings = dis2.readInt(); + + app.DebugPrintf("IsStatic=%d totalStrings = %d\n",isStatic?1:0,totalStrings); + + if (!isStatic) + { + for(int i = 0; i < totalStrings; ++i) + { + wstring stringId = dis2.readUTF(); + wstring stringValue = dis2.readUTF(); + + m_stringsMap.insert( unordered_map::value_type(stringId, stringValue) ); + } + } + else + { + for(int i = 0; i < totalStrings; ++i) + m_stringsVec.push_back( dis2.readUTF() ); + } + dis2.close(); + + // We can't delete this data in the dtor, so clear the reference + bais2.reset(); + } + else + { + app.DebugPrintf("Failed to get language\n"); + + + isStatic = false; + } + + // We can't delete this data in the dtor, so clear the reference + bais.reset(); } -void StringTable::ReadAllFromStream(DataInputStream* dis) + +StringTable::~StringTable(void) { - int versionNumber = dis->readInt(); - int languagesCount = dis->readInt(); - - m_langSizeMap.clear(); - - for(int i = 0; i < languagesCount; ++i) - { - wstring langId = dis->readUTF(); - int langSize = dis->readInt(); - m_langSizeMap.push_back(make_pair(langId, langSize)); - } - - int64_t bytesToSkip = 0; - int dataSize = 0; - - if(FindLanguage(currentLanguage, bytesToSkip, dataSize)) - { - dis->skip(bytesToSkip); - ReadLanguageFromStream(dis, dataSize); - } - else - { - isStatic = false; - } -} - -bool StringTable::FindLanguage(wstring& outLangId, int64_t& outBytesToSkip, int& outDataSize) -{ - vector locales; - app.getLocale(locales); - - outBytesToSkip = 0; - - for (auto it_locales = locales.begin(); it_locales != locales.end(); ++it_locales) - { - outBytesToSkip = 0; - - for(auto& it : m_langSizeMap) - { - if(it.first.compare(*it_locales) == 0) - { - app.DebugPrintf("StringTable:: Found language '%ls'.\n", it_locales->c_str()); - outDataSize = it.second; - outLangId = *it_locales; - return true; - } - outBytesToSkip += it.second; - } - - app.DebugPrintf("StringTable:: Can't find language '%ls'.\n", it_locales->c_str()); - } - - app.DebugPrintf("Failed to get language\n"); - return false; -} - -void StringTable::ReadLanguageFromStream(DataInputStream* dis, int dataSize) -{ - byteArray langData(dataSize); - dis->read(langData); - - ByteArrayInputStream bais2(langData); - DataInputStream dis2(&bais2); - - // Read the language file for the selected language - int langVersion = dis2.readInt(); - - isStatic = false; - if (langVersion > 0) - isStatic = dis2.readBoolean(); - - wstring langId = dis2.readUTF(); - int totalStrings = dis2.readInt(); - - app.DebugPrintf("IsStatic=%s totalStrings = %d\n", isStatic ? "TRUE" : "FALSE", totalStrings); - - if (!isStatic) - { - for(int i = 0; i < totalStrings; ++i) - { - wstring stringId = dis2.readUTF(); - wstring stringValue = dis2.readUTF(); - - m_stringsMap.insert(unordered_map::value_type(stringId, stringValue)); - } - } - else - { - for(int i = 0; i < totalStrings; ++i) - { - m_stringsVec.push_back(dis2.readUTF()); - } - } - - dis2.close(); - bais2.reset(); -} - -void StringTable::write(DataOutputStream* dos) -{ - dos->writeInt(1); - dos->writeInt(1); - - int langVersion = 1; - - dos->writeInt(langVersion); - dos->writeBoolean(isStatic); - dos->writeUTF(currentLanguage.empty() ? L"en_US" : currentLanguage); - - if (!isStatic) - { - dos->writeInt(m_stringsMap.size()); - for (auto const& [key, val] : m_stringsMap) - { - dos->writeUTF(key); - dos->writeUTF(val); - } - } - else - { - dos->writeInt(m_stringsVec.size()); - for (auto const& val : m_stringsVec) - { - dos->writeUTF(val); - } - } + // delete src.data; TODO 4J-JEV: ? } void StringTable::getData(PBYTE *ppData, UINT *pSize) @@ -186,6 +141,14 @@ void StringTable::getData(PBYTE *ppData, UINT *pSize) LPCWSTR StringTable::getString(const wstring &id) { +#ifndef _CONTENT_PACKAGE + if (isStatic) + { + __debugbreak(); + return L""; + } +#endif + auto it = m_stringsMap.find(id); if(it != m_stringsMap.end()) @@ -200,11 +163,24 @@ LPCWSTR StringTable::getString(const wstring &id) LPCWSTR StringTable::getString(int id) { - if (id >= 0 && id < m_stringsVec.size()) +#ifndef _CONTENT_PACKAGE + if (!isStatic) + { + __debugbreak(); + return L""; + } +#endif + + if (id < m_stringsVec.size()) { LPCWSTR pwchString=m_stringsVec.at(id).c_str(); return pwchString; } else return L""; -} \ No newline at end of file +} + + + + + diff --git a/Minecraft.Client/StringTable.h b/Minecraft.Client/StringTable.h index 4c4c931b..2353f81b 100644 --- a/Minecraft.Client/StringTable.h +++ b/Minecraft.Client/StringTable.h @@ -18,33 +18,63 @@ private: unordered_map m_stringsMap; vector m_stringsVec; - vector> m_langSizeMap; - wstring currentLanguage; - byteArray src; public: +// enum eLocale +// { +// eLocale_Default=0, +// eLocale_American, +// eLocale_Japanese, +// eLocale_German, +// eLocale_French, +// eLocale_Spanish, +// eLocale_Italian, +// eLocale_Korean, +// eLocale_TradChinese, +// eLocale_Portuguese, +// eLocale_Brazilian, +// #if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ +// eLocale_Russian, +// eLocale_Dutch, +// eLocale_Finish, +// eLocale_Swedish, +// eLocale_Danish, +// eLocale_Norwegian, +// eLocale_Polish, +// eLocale_Turkish, +// eLocale_LatinAmericanSpanish, +// eLocale_Greek, +// #elif defined _XBOX_ONE || defined _XBOX +// eLocale_British, +// eLocale_Irish, +// eLocale_Australian, +// eLocale_NewZealand, +// eLocale_Canadian, +// eLocale_Mexican, +// eLocale_FrenchCanadian, +// eLocale_Austrian, +// #endif +// }; + StringTable(void); StringTable(PBYTE pbData, DWORD dwSize); ~StringTable(void); - void ReloadStringTable(); - void Reset(); // TU30 - - void write(DataOutputStream* dos); // TU30 void getData(PBYTE *ppbData, UINT *pdwSize); LPCWSTR getString(const wstring &id); LPCWSTR getString(int id); + //static LPCWSTR m_wchLocaleCode[LOCALE_COUNT]; + + + private: + //wstring getLangId(DWORD dwLanguage=0); void ProcessStringTableData(void); - // From TU30 - void ReadAllFromStream(DataInputStream* dis); - bool FindLanguage(wstring& outLangId, int64_t& outBytesToSkip, int& outDataSize); - void ReadLanguageFromStream(DataInputStream* dis, int dataSize); }; diff --git a/Minecraft.Client/StructureTable.cpp b/Minecraft.Client/StructureTable.cpp deleted file mode 100644 index fee882a7..00000000 --- a/Minecraft.Client/StructureTable.cpp +++ /dev/null @@ -1,357 +0,0 @@ -#include "stdafx.h" -#include "StructureTable.h" -#include "../Minecraft.World/StringHelpers.h" - -unordered_map StructureTable::s_structureFeatureNamesMap; -unordered_map StructureTable::s_structurePieceNamesMap; -unordered_map StructureTable::s_generateObjectNamesMap; -unordered_map StructureTable::s_generateEntityNamesMap; -unordered_map StructureTable::s_generateStructureNamesMap; - -const wchar_t *StructureTable::StructureFeatureElements[eMinecraftStructureFeature_Count] = -{ - L"NOTSET", - L"VillageFeature", -}; - -const wchar_t *StructureTable::StructurePieceElements[eMinecraftStructurePiece_Count] = -{ - L"NOTSET", - L"DesertPyramidPiece", - L"SimpleHouse", - L"SmallTemple", - L"BookHouse", - L"SmallHut", - L"PigHouse", - L"DoubleFarmland", - L"Farmland", - L"Smithy", - L"TwoRoomHouse", - L"LightPost", - L"Well", -}; - -const wchar_t *StructureTable::GenerateObjectElements[eGenerateObject_Count] = -{ - L"Chest", - L"Dispenser", -}; - -const wchar_t *StructureTable::GenerateEntityElements[eGenerateEntity_Count] = -{ - L"Villager", - L"Witch", -}; - -const wchar_t *StructureTable::GenerateStructureElements[eGenerateStructure_Count] = -{ - L"Block", - L"maybeGenerateBlock", - L"AirBox", - L"Box", - L"MaybeBox", - L"UpperHalfSphere", - L"FullSphere", - L"AirColumnUp", - L"fillColumnDown", - L"fillBoxDown", - L"generateAirBoxUp", - L"Crops", - L"CreateDoor", - L"CheckBlock", -}; - -void StructureTable::staticCtor() -{ - for(unsigned int i = 0; i < eMinecraftStructureFeature_Count; ++i) - { - s_structureFeatureNamesMap.insert( unordered_map::value_type( StructureFeatureElements[i], (eMinecraftStructureFeature)i) ); - } - - for(unsigned int i = 0; i < eMinecraftStructurePiece_Count; ++i) - { - s_structurePieceNamesMap.insert(unordered_map::value_type( StructurePieceElements[i], (eMinecraftStructurePiece)i) ); - } - - for(unsigned int i = 0; i < eGenerateObject_Count; ++i) - { - s_generateObjectNamesMap.insert( unordered_map::value_type( GenerateObjectElements[i], (eGenerateObject)i) ); - } - - for(unsigned int i = 0; i < eGenerateEntity_Count; ++i) - { - s_generateEntityNamesMap.insert( unordered_map::value_type( GenerateEntityElements[i], (eGenerateEntity)i) ); - } - - for(unsigned int i = 0; i < eGenerateStructure_Count; ++i) - { - s_generateStructureNamesMap.insert(unordered_map::value_type( GenerateStructureElements[i], (eGenerateStructure)i) ); - } -} - -StructureTable::StructureTable(PBYTE pbData, DWORD dwLength) -{ - loadStructuresFromData(pbData, dwLength); -} - -StructureTable::StructurePiece* StructureTable::getStructurePiece(eMinecraftStructurePiece piece) -{ - return &m_structurePieces[(int)piece]; -} - -StructureTable::StructureFeature* StructureTable::getStructureFeature(eMinecraftStructureFeature feature) -{ - return &m_structureFeatures[(int)feature]; -} - -void StructureTable::loadStructuresFromData(PBYTE pbData, DWORD dwLength) -{ - byteArray src(pbData, dwLength); - - ByteArrayInputStream bais(src); - DataInputStream dis(&bais); - - int versionNumber = dis.readInt(); - int featureCount = dis.readInt(); - int pieceCount = dis.readInt(); - - for(int i = 0; i < featureCount; ++i) - { - StructureFeature feature; - feature.name = dis.readUTF(); - - int optionsCount = dis.readInt(); - int tilesCount = dis.readInt(); - - for(int j = 0; j < optionsCount; ++j) - { - feature.options.push_back(dis.readInt()); - } - - for(int j = 0; j < tilesCount; ++j) - { - std::wstring tile = dis.readUTF(); - size_t comma = tile.find(L','); - if(comma != std::wstring::npos) - { - int k = std::stoi(tile.substr(0, comma)); - int v = std::stoi(tile.substr(comma + 1)); - feature.tiles[k] = v; - } - } - - auto it = s_structureFeatureNamesMap.find(feature.name); - if (it != s_structureFeatureNamesMap.end()) - { - m_structureFeatures[(int)it->second] = feature; - } - } - - for(int i = 0; i < pieceCount; ++i) - { - StructurePiece structurePiece; - - structurePiece.name = dis.readUTF(); - structurePiece.width = dis.readInt(); - structurePiece.height = dis.readInt(); - structurePiece.depth = dis.readInt(); - - int treasureCount = dis.readInt(); - int structuresCount = dis.readInt(); - int objectsCount = dis.readInt(); - int entitiesCount = dis.readInt(); - - // ? - structurePiece.v8 = dis.readInt(); - - // @3UR: some sort of count/size? - int unk_count1 = dis.readInt(); - int numCropTiles = dis.readInt(); - - // ? - for(int j = 0; j < unk_count1; ++j) - { - structurePiece.v11.push_back(dis.readInt()); - } - for(int j = 0; j < numCropTiles; ++j) - { - structurePiece.cropTiles.push_back(dis.readInt()); - } - - for(int j = 0; j < treasureCount; ++j) - { - TreasureData t; - t.itemId = dis.readInt(); - t.auxValue = dis.readInt(); - t.minCount = dis.readInt(); - t.maxCount = dis.readInt(); - t.weight = dis.readInt(); - structurePiece.treasure.push_back(t); - } - - for(int j = 0; j < structuresCount; ++j) - { - StructureData s; - std::wstring name = dis.readUTF(); - - auto it = s_generateStructureNamesMap.find(name); - s.id = (it != s_generateStructureNamesMap.end()) ? (int)it->second : 0; - s.name = name; - - s.tileId = dis.readInt(); - s.data = dis.readInt(); - s.dataType = dis.readInt(); - - bool hasSecondTile = dis.readBoolean(); - if(hasSecondTile) - { - s.secondTileId = dis.readInt(); - s.secondData = dis.readInt(); - s.secondDataType = dis.readInt(); - } - else - { - s.secondTileId = 0; - s.secondData = 0; - s.secondDataType = 0; - } - - s.x0 = dis.readInt(); - s.y0 = dis.readInt(); - s.z0 = dis.readInt(); - - bool hasBounds = dis.readBoolean(); - if(hasBounds) - { - s.x1 = dis.readInt(); - s.y1 = dis.readInt(); - s.z1 = dis.readInt(); - } - else - { - s.x1 = 0; - s.y1 = 0; - s.z1 = 0; - } - - // ? - bool hasStartRemaps = dis.readBoolean(); - if(hasStartRemaps) - { - s.startRemap0 = dis.readInt(); - s.startRemap1 = dis.readInt(); - s.startRemap2 = dis.readInt(); - } - else - { - s.startRemap0 = -1; - s.startRemap1 = -1; - s.startRemap2 = -1; - } - - // ? - bool hasEndRemaps = dis.readBoolean(); - if(hasEndRemaps) - { - s.endRemap0 = dis.readInt(); - s.endRemap1 = dis.readInt(); - s.endRemap2 = dis.readInt(); - } - else - { - s.endRemap0 = -1; - s.endRemap1 = -1; - s.endRemap2 = -1; - } - - readIntSaveData(dis, s.cropAges); - readIntSaveData(dis, s.v25); - readIntSaveData(dis, s.v26); - readIntSaveData(dis, s.v27); - - structurePiece.structures.push_back(s); - } - - for(int j = 0; j < objectsCount; ++j) - { - ObjectData o; - std::wstring name = dis.readUTF(); - - auto it = s_generateObjectNamesMap.find(name); - o.id = (it != s_generateObjectNamesMap.end()) ? (int)it->second : 0; - o.name = name; - - o.x = dis.readInt(); - o.y = dis.readInt(); - o.z = dis.readInt(); - - o.minEnchantedBooks = dis.readInt(); - o.maxEnchantedBooks = dis.readInt(); - o.enchantedBookWeight = dis.readInt(); - o.rollCount = dis.readInt(); - o.canGenEnchantedBooks = dis.readBoolean(); - o.rollWeight = dis.readInt(); - o.dispenserDir = dis.readInt(); - - structurePiece.objects.push_back(o); - } - - for(int j = 0; j < entitiesCount; ++j) - { - EntityData e; - std::wstring name = dis.readUTF(); - - auto it = s_generateEntityNamesMap.find(name); - e.id = (it != s_generateEntityNamesMap.end()) ? (int)it->second : 0; - e.x = dis.readInt(); - e.y = dis.readInt(); - e.z = dis.readInt(); - e.count = dis.readInt(); - - std::wstring professionsCsv = dis.readUTF(); - - size_t start = 0, end; - while((end = professionsCsv.find(L',', start)) != std::wstring::npos) - { - e.professions.push_back(std::stoi(professionsCsv.substr(start, end - start))); - start = end + 1; - } - if(start < professionsCsv.size()) - { - e.professions.push_back(std::stoi(professionsCsv.substr(start))); - } - - structurePiece.entities.push_back(e); - } - - setStructurePiece(structurePiece.name, structurePiece); - } - - bais.reset(); -} - -void StructureTable::setStructurePiece(const wstring& name, const StructurePiece& piece) -{ - auto it = s_structurePieceNamesMap.find(name); - if (it != s_structurePieceNamesMap.end()) - { - m_structurePieces[(int)it->second] = piece; - } -} - -void StructureTable::readIntSaveData(DataInputStream& dis, vector& container) -{ - wstring data = dis.readUTF(); - - vector tokens = stringSplit(data, L','); - - for (size_t i = 0; i < tokens.size(); ++i) - { - wistringstream wiss(tokens[i]); - int outVal = 0; - - wiss >> dec >> outVal; - - container.push_back(outVal); - } -} \ No newline at end of file diff --git a/Minecraft.Client/StructureTable.h b/Minecraft.Client/StructureTable.h deleted file mode 100644 index b41f79d7..00000000 --- a/Minecraft.Client/StructureTable.h +++ /dev/null @@ -1,178 +0,0 @@ -#pragma once - -using namespace std; - -enum eGenerateStructure -{ - eGenerateStructure_Block = 0, - eGenerateStructure_maybeGenerateBlock, - eGenerateStructure_AirBox, - eGenerateStructure_Box, - eGenerateStructure_MaybeBox, - eGenerateStructure_UpperHalfSphere, - eGenerateStructure_FullSphere, - eGenerateStructure_AirColumnUp, - eGenerateStructure_fillColumnDown, - eGenerateStructure_fillBoxDown, - eGenerateStructure_generateAirBoxUp, - eGenerateStructure_Crops, - eGenerateStructure_CreateDoor, - eGenerateStructure_CheckBlock, - eGenerateStructure_Count -}; - -enum eGenerateObject -{ - eGenerateObject_Chest = 0, - eGenerateObject_Dispenser, - eGenerateObject_Count -}; - -enum eGenerateEntity -{ - eGenerateEntity_Villager = 0, - eGenerateEntity_Witch, - eGenerateEntity_Count -}; - -class StructureTable -{ -public: - - enum eBlockDataType - { - eBlockDataType_Default = 0, - eBlockDataType_Orientation, - eBlockDataType_Inverted - }; - -public: - struct StructureData - { - int id; - wstring name; - - int tileId; - int data; - int dataType; - - int secondTileId; - int secondData; - int secondDataType; - - int x0; - int y0; - int z0; - - int x1; - int y1; - int z1; - - int startRemap0; - int startRemap1; - int startRemap2; - - int endRemap0; - int endRemap1; - int endRemap2; - - vector cropAges; - vector v25; - vector v26; - vector v27; - }; - - struct TreasureData - { - int itemId; - int auxValue; - int minCount; - int maxCount; - int weight; - }; - - struct ObjectData - { - int id; - wstring name; - - int x; - int y; - int z; - - int minEnchantedBooks; - int maxEnchantedBooks; - int enchantedBookWeight; - int rollCount; - bool canGenEnchantedBooks; - int rollWeight; - int dispenserDir; - }; - - struct EntityData - { - int id; - int x; - int y; - int z; - int count; - vector professions; - }; - - struct StructurePiece - { - wstring name; - - int width; - int height; - int depth; - - vector structures; - vector treasure; - vector objects; - vector entities; - - int v8; - - vector v11; - vector cropTiles; - }; - - struct StructureFeature - { - wstring name; - - vector options; - unordered_map tiles; // @3UR: this maps one tile id to another - }; - -private: - StructurePiece m_structurePieces[eMinecraftStructurePiece_Count]; - StructureFeature m_structureFeatures[eMinecraftStructureFeature_Count]; - - static const wchar_t *StructureFeatureElements[eMinecraftStructureFeature_Count]; - static const wchar_t *StructurePieceElements[eMinecraftStructurePiece_Count]; - static const wchar_t *GenerateObjectElements[eGenerateObject_Count]; - static const wchar_t *GenerateEntityElements[eGenerateEntity_Count]; - static const wchar_t *GenerateStructureElements[eGenerateStructure_Count]; - - static unordered_map s_structureFeatureNamesMap; - static unordered_map s_structurePieceNamesMap; - static unordered_map s_generateObjectNamesMap; - static unordered_map s_generateEntityNamesMap; - static unordered_map s_generateStructureNamesMap; - -public: - static void staticCtor(); - - StructureTable(PBYTE pbData, DWORD dwLength); - - StructurePiece *getStructurePiece(eMinecraftStructurePiece piece); - StructureFeature *getStructureFeature(eMinecraftStructureFeature feature); - - void loadStructuresFromData(PBYTE pbData, DWORD dwLength); - void setStructurePiece(const wstring& name, const StructurePiece& piece); - - // @Patoke: seems to be inlined in Wii U, functionality is 1:1 with StructurePiece::readIntSaveData - inline void readIntSaveData(DataInputStream& dis, vector& container); -}; \ No newline at end of file diff --git a/Minecraft.Client/Tesselator.h b/Minecraft.Client/Tesselator.h index 2edc4a24..1f33866c 100644 --- a/Minecraft.Client/Tesselator.h +++ b/Minecraft.Client/Tesselator.h @@ -9,9 +9,6 @@ private: static bool TRIANGLE_MODE; static bool USE_VBO; - static constexpr int MAX_MEMORY_USE = 16 * 1024 * 1024; - static constexpr int MAX_FLOATS = MAX_MEMORY_USE / 4 / 2; - intArray *_array; int vertices; diff --git a/Minecraft.Client/TexturePack.h b/Minecraft.Client/TexturePack.h index 4782ee04..8e613423 100644 --- a/Minecraft.Client/TexturePack.h +++ b/Minecraft.Client/TexturePack.h @@ -43,7 +43,6 @@ public: virtual wstring getAnimationString(const wstring &textureName, const wstring &path, bool allowFallback) = 0; virtual BufferedImage *getImageResource(const wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const wstring &drive =L"") = 0; virtual void loadColourTable() = 0; - virtual void loadStructureTable() = 0; virtual void loadUI() = 0; virtual void unloadUI() = 0; virtual wstring getXuiRootPath() = 0; @@ -52,7 +51,6 @@ public: virtual unsigned int getDLCParentPackId() = 0; virtual unsigned char getDLCSubPackId() = 0; virtual ColourTable *getColourTable() = 0; - virtual StructureTable *getStructureTable() = 0; virtual ArchiveFile *getArchiveFile() = 0; private: diff --git a/Minecraft.Client/TexturePackRepository.cpp b/Minecraft.Client/TexturePackRepository.cpp index f9a3800d..ef926d78 100644 --- a/Minecraft.Client/TexturePackRepository.cpp +++ b/Minecraft.Client/TexturePackRepository.cpp @@ -28,7 +28,6 @@ TexturePackRepository::TexturePackRepository(File workingDirectory, Minecraft *m selected = DEFAULT_TEXTURE_PACK; DEFAULT_TEXTURE_PACK->loadColourTable(); - DEFAULT_TEXTURE_PACK->loadStructureTable(); // @3UR: this might not be called here m_dummyTexturePack = nullptr; m_dummyDLCTexturePack = nullptr; diff --git a/Minecraft.Client/TileRenderer.cpp b/Minecraft.Client/TileRenderer.cpp index f47f79d1..0b427e5f 100644 --- a/Minecraft.Client/TileRenderer.cpp +++ b/Minecraft.Client/TileRenderer.cpp @@ -1643,9 +1643,9 @@ bool TileRenderer::tesselatePistonExtensionInWorld( Tile* tt, int x, int y, int int data = ( forceData == -1 ) ? level->getData( x, y, z ) : forceData; int facing = PistonExtensionTile::getFacing( data ); - constexpr float thickness = PistonBaseTile::PLATFORM_THICKNESS / 16.0f; - constexpr float leftEdge = (8.0f - (PistonBaseTile::PLATFORM_THICKNESS / 2.0f)) / 16.0f; - constexpr float rightEdge = (8.0f + (PistonBaseTile::PLATFORM_THICKNESS / 2.0f)) / 16.0f; + constexpr float thickness = PistonBaseTile::PLATFORM_THICKNESS / 16.0f; + constexpr float leftEdge = ( 8.0f - ( PistonBaseTile::PLATFORM_THICKNESS / 2.0f ) ) / 16.0f; + constexpr float rightEdge = ( 8.0f + ( PistonBaseTile::PLATFORM_THICKNESS / 2.0f ) ) / 16.0f; const float br = tt->getBrightness( level, x, y, z ); const float armLength = fullArm ? 1.0f : 0.5f; const float armLengthPixels = fullArm ? 16.0f : 8.0f; @@ -3713,8 +3713,8 @@ bool TileRenderer::tesselateThinFenceInWorld( ThinFenceTile* tt, int x, int y, i bool up = tt->shouldRenderFace( level, x, y + 1, z, Facing::UP ); bool down = tt->shouldRenderFace( level, x, y - 1, z, Facing::DOWN ); - constexpr float noZFightingOffset = 0.01f; - constexpr float noZFightingOffsetB = 0.005; + const float noZFightingOffset = 0.01f; + const float noZFightingOffsetB = 0.005; if ( ( w && e ) || ( !w && !e && !n && !s ) ) { @@ -4559,439 +4559,512 @@ void TileRenderer::tesselateRowTexture( Tile* tt, int data, float x, float y, fl bool TileRenderer::tesselateWaterInWorld(Tile* tt, int x, int y, int z) { - Tesselator* t = Tesselator::getInstance(); - - int col = tt->getColor(level, x, y, z); - float r = ((col >> 16) & 0xff) / 255.0f; - float g = ((col >> 8) & 0xff) / 255.0f; - float b = (col & 0xff) / 255.0f; - - bool up = tt->shouldRenderFace(level, x, y + 1, z, 1); - bool down = tt->shouldRenderFace(level, x, y - 1, z, 0); - bool dirs[4]; + // 4J Java comment + // TODO: This all needs to change. Somehow. + Tesselator* t = Tesselator::getInstance(); + int col = tt->getColor( level, x, y, z ); + float r = ( col >> 16 & 0xff ) / 255.0f; + float g = ( col >> 8 & 0xff ) / 255.0f; + float b = ( col & 0xff ) / 255.0f; + bool up = tt->shouldRenderFace( level, x, y + 1, z, 1 ); + bool down = tt->shouldRenderFace( level, x, y - 1, z, 0 ); + bool dirs[4]; dirs[0] = tt->shouldRenderFace( level, x, y, z - 1, 2 ); dirs[1] = tt->shouldRenderFace( level, x, y, z + 1, 3 ); dirs[2] = tt->shouldRenderFace( level, x - 1, y, z, 4 ); dirs[3] = tt->shouldRenderFace( level, x + 1, y, z, 5 ); - if (!up && !down && !dirs[0] && !dirs[1] && !dirs[2] && !dirs[3]) - return false; + if ( !up && !down && !dirs[0] && !dirs[1] && !dirs[2] && !dirs[3] ) return false; - bool changed = false; - Material* m = tt->material; - int data = level->getData(x, y, z); - int renderLayer = tt->getRenderLayer(); + bool changed = false; + float c10 = 0.5f; + float c11 = 1; + float c2 = 0.8f; + float c3 = 0.6f; - float h0 = getWaterHeight(x, y, z, m); - float h1 = getWaterHeight(x, y, z + 1, m); - float h2 = getWaterHeight(x + 1, y, z + 1, m); - float h3 = getWaterHeight(x + 1, y, z, m); + double yo0 = 0; + double yo1 = 1; - float maxh = h0; - if (h1 > maxh) maxh = h1; - if (h2 > maxh) maxh = h2; - if (h3 > maxh) maxh = h3; + Material* m = tt->material; + int data = level->getData( x, y, z ); + float h0 = getWaterHeight( x, y, z, m ); + float h1 = getWaterHeight( x, y, z + 1, m ); + float h2 = getWaterHeight( x + 1, y, z + 1, m ); + float h3 = getWaterHeight( x + 1, y, z, m ); + + float offs = 0.001f; // 4J - added. Farm tiles often found beside water, but they consider themselves non-solid as they only extend up to 15.0f / 16.0f. // If the max height of this water is below that level, don't bother rendering sides bordering onto farmland. - if (maxh <= ( 15.0f / 16.0f )) - { - if (level->getTile(x, y, z - 1) == Tile::farmland_Id) dirs[0] = false; - if (level->getTile(x, y, z + 1) == Tile::farmland_Id) dirs[1] = false; - if (level->getTile(x - 1, y, z) == Tile::farmland_Id) dirs[2] = false; - if (level->getTile(x + 1, y, z) == Tile::farmland_Id) dirs[3] = false; - } + float maxh = h0; + if ( h1 > maxh ) maxh = h1; + if ( h2 > maxh ) maxh = h2; + if ( h3 > maxh ) maxh = h3; + if ( maxh <= ( 15.0f / 16.0f ) ) + { + if ( level->getTile( x, y, z - 1 ) == Tile::farmland_Id ) + { + dirs[0] = false; + } + if ( level->getTile( x, y, z + 1 ) == Tile::farmland_Id ) + { + dirs[1] = false; + } + if ( level->getTile( x - 1, y, z ) == Tile::farmland_Id ) + { + dirs[2] = false; + } + if ( level->getTile( x + 1, y, z ) == Tile::farmland_Id ) + { + dirs[3] = false; + } + } - constexpr float offs = 0.001f; + if ( noCulling || up ) + { + changed = true; + Icon *tex = getTexture( tt, 1, data ); + float angle = static_cast(LiquidTile::getSlopeAngle(level, x, y, z, m)); + if ( angle > -999 ) + { + tex = getTexture( tt, 2, data ); + } - if (noCulling || up) - { - changed = true; - Icon* tex = getTexture(tt, 1, data); - float angle = static_cast(LiquidTile::getSlopeAngle(level, x, y, z, m)); + h0 -= offs; + h1 -= offs; + h2 -= offs; + h3 -= offs; - if (angle > -999.0f) - tex = getTexture(tt, 2, data); + float u00, u01, u10, u11; + float v00, v01, v10, v11; + if ( angle < -999 ) + { + u00 = tex->getU(0, true); + v00 = tex->getV(0, true); + u01 = u00; + v01 = tex->getV(SharedConstants::WORLD_RESOLUTION, true); + u10 = tex->getU(SharedConstants::WORLD_RESOLUTION, true); + v10 = v01; + u11 = u10; + v11 = v00; + } + else + { + float s = Mth::sin(angle) * .25f; + float c = Mth::cos(angle) * .25f; + float cc = SharedConstants::WORLD_RESOLUTION * .5f; + u00 = tex->getU(cc + (-c - s) * SharedConstants::WORLD_RESOLUTION); + v00 = tex->getV(cc + (-c + s) * SharedConstants::WORLD_RESOLUTION); + u01 = tex->getU(cc + (-c + s) * SharedConstants::WORLD_RESOLUTION); + v01 = tex->getV(cc + (+c + s) * SharedConstants::WORLD_RESOLUTION); + u10 = tex->getU(cc + (+c + s) * SharedConstants::WORLD_RESOLUTION); + v10 = tex->getV(cc + (+c - s) * SharedConstants::WORLD_RESOLUTION); + u11 = tex->getU(cc + (+c - s) * SharedConstants::WORLD_RESOLUTION); + v11 = tex->getV(cc + (-c - s) * SharedConstants::WORLD_RESOLUTION); + } - h0 -= offs; h1 -= offs; h2 -= offs; h3 -= offs; + float br; + if ( SharedConstants::TEXTURE_LIGHTING ) + { + t->tex2( getLightColor(tt, level, x, y, z ) ); + br = 1; + } + else + { + br = tt->getBrightness( level, x, y, z ); + } + t->color( c11 * br * r, c11 * br * g, c11 * br * b ); + t->vertexUV( ( float )( x + 0.0f ), ( float )( y + h0 ), ( float )( z + 0.0f ), u00, v00 ); + t->vertexUV( ( float )( x + 0.0f ), ( float )( y + h1 ), ( float )( z + 1.0f ), u01, v01 ); + t->vertexUV( ( float )( x + 1.0f ), ( float )( y + h2 ), ( float )( z + 1.0f ), u10, v10 ); + t->vertexUV( ( float )( x + 1.0f ), ( float )( y + h3 ), ( float )( z + 0.0f ), u11, v11 ); + } - float u0, v0, u1, v1, u2, v2, u3, v3; + if ( noCulling || down ) + { + float br; + if ( SharedConstants::TEXTURE_LIGHTING ) + { + t->tex2( getLightColor(tt, level, x, y - 1, z ) ); + br = 1; + } + else + { + br = tt->getBrightness( level, x, y - 1, z ); + } + t->color( c10 * br, c10 * br, c10 * br ); + renderFaceDown( tt, x, y + offs, z, getTexture( tt, 0 ) ); + changed = true; + } - if (angle >= -999.0f) - { - constexpr float cc = SharedConstants::WORLD_RESOLUTION * 0.5f; - float fsin = Mth::sin(angle) * 0.25f; - float fcos = Mth::cos(angle) * 0.25f; - u0 = tex->getU(cc + (-fcos - fsin) * SharedConstants::WORLD_RESOLUTION); - v0 = tex->getV(cc + (fsin - fcos) * SharedConstants::WORLD_RESOLUTION); - u1 = tex->getU(cc + (fsin - fcos) * SharedConstants::WORLD_RESOLUTION); - v1 = tex->getV(cc + (fcos + fsin) * SharedConstants::WORLD_RESOLUTION); - u2 = tex->getU(cc + (fcos + fsin) * SharedConstants::WORLD_RESOLUTION); - v2 = tex->getV(cc + (fcos - fsin) * SharedConstants::WORLD_RESOLUTION); - u3 = tex->getU(cc + (fcos - fsin) * SharedConstants::WORLD_RESOLUTION); - v3 = tex->getV(cc + (-fcos - fsin) * SharedConstants::WORLD_RESOLUTION); - } - else - { - u0 = tex->getU(0.0f, true); - v0 = tex->getV(0.0f, true); - u1 = u0; - v1 = tex->getV(SharedConstants::WORLD_RESOLUTION, true); - u2 = tex->getU(SharedConstants::WORLD_RESOLUTION, true); - v2 = v1; - u3 = u2; - v3 = v0; - } + for ( int face = 0; face < 4; face++ ) + { + int xt = x; + int yt = y; + int zt = z; - t->tex2(getLightColor(tt, level, x, y, z)); - t->color(1.0f * r, 1.0f * g, 1.0f * b); + if ( face == 0 ) zt--; + if ( face == 1 ) zt++; + if ( face == 2 ) xt--; + if ( face == 3 ) xt++; - t->vertexUV(( float )( x + 0.0f ), ( float )( y + h0 ), ( float )( z + 0.0f ), u0, v0); - t->vertexUV(( float )( x + 0.0f ), ( float )( y + h1 ), ( float )( z + 1.0f ), u1, v1); - t->vertexUV(( float )( x + 1.0f ), ( float )( y + h2 ), ( float )( z + 1.0f ), u2, v2); - t->vertexUV(( float )( x + 1.0f ), ( float )( y + h3 ), ( float )( z + 0.0f ), u3, v3); + Icon *tex = getTexture(tt, face + 2, data); - if (static_cast(tt)->LiquidTile::shouldRenderBackwardUpFace(level, x, y + 1, z)) - { - t->vertexUV(( float )( x + 0.0f ), ( float )( y + h0 ), ( float )( z + 0.0f ), u0, v0); - t->vertexUV(( float )( x + 1.0f ), ( float )( y + h3 ), ( float )( z + 0.0f ), u3, v3); - t->vertexUV(( float )( x + 1.0f ), ( float )( y + h2 ), ( float )( z + 1.0f ), u2, v2); - t->vertexUV(( float )( x + 0.0f ), ( float )( y + h1 ), ( float )(z + 1.0f), u1, v1); - } - } + if ( noCulling || dirs[face] ) + { + float hh0; + float hh1; + float x0, z0, x1, z1; + if ( face == 0 ) + { + hh0 = ( float )( h0 ); + hh1 = ( float )( h3 ); + x0 = static_cast(x); + x1 = static_cast(x + 1); + z0 = ( float )( z + offs); + z1 = ( float )( z + offs); + } + else if ( face == 1 ) + { + hh0 = ( float )( h2 ); + hh1 = ( float )( h1 ); + x0 = static_cast(x + 1); + x1 = static_cast(x); + z0 = ( float )( z + 1 - offs); + z1 = ( float )( z + 1 - offs); + } + else if ( face == 2 ) + { + hh0 = ( float )( h1 ); + hh1 = ( float )( h0 ); + x0 = ( float )( x + offs); + x1 = ( float )( x + offs); + z0 = static_cast(z + 1); + z1 = static_cast(z); + } + else + { + hh0 = ( float )( h3 ); + hh1 = ( float )( h2 ); + x0 = ( float )( x + 1 - offs); + x1 = ( float )( x + 1 - offs); + z0 = static_cast(z); + z1 = static_cast(z + 1); + } - if (noCulling || down) - { - t->tex2(getLightColor(tt, level, x, y - 1, z)); - t->color(0.5f, 0.5f, 0.5f); - Icon* downTex = getTexture(tt, 0); - renderFaceDown(tt, x, y + offs, z, downTex); - changed = true; - } - float side_u0, side_u1, side_v1, side_v_h0, side_v_h1; - bool side_visible[4] = { dirs[0], dirs[1], dirs[2], dirs[3] }; - - for (int face = 0; face < 4; face++) - { - if (noCulling || side_visible[face]) - { - int xt = x, zt = z; - float x0, z0, x1, z1, hh0, hh1; + changed = true; + float u0 = tex->getU(0, true); + float u1 = tex->getU(SharedConstants::WORLD_RESOLUTION * .5f, true); - if (face == 0) - { - zt--; - x1 = static_cast(x + 1.0f); - z1 = ( float )( z + offs); - x0 = static_cast(x); - z0 = ( float )( z + offs); - hh0 = ( float )( h0 ); - hh1 = ( float )( h3 ); - } - else if (face == 1) - { - zt++; - x1 = static_cast(x); - z1 = ( float )( z + 1.0f - offs); - x0 = static_cast(x + 1.0f); - z0 = ( float )( z + 1.0f - offs); - hh0 = ( float )( h2 ); - hh1 = ( float )( h1 ); - } - else if (face == 2) - { - xt--; - x1 = ( float )( x + offs); - z1 = static_cast(z); - x0 = ( float )( x + offs); - z0 = static_cast(z + 1.0f); - hh0 = ( float )( h1 ); - hh1 = ( float )( h0 ); - } - else - { - xt++; - x0 = ( float )( x + 1.0f - offs); - z1 = static_cast(z + 1.0f); - x1 = ( float )( x + 1.0f - offs); - z0 = static_cast(z); - hh0 = ( float )( h3 ); - hh1 = ( float )( h2 ); - } + int yTex = tex->getY(); + float v01 = tex->getV((1 - hh0) * SharedConstants::WORLD_RESOLUTION * .5f); + float v02 = tex->getV((1 - hh1) * SharedConstants::WORLD_RESOLUTION * .5f); + float v1 = tex->getV(SharedConstants::WORLD_RESOLUTION * .5f, true); - changed = true; - Icon* tex = getTexture(tt, face + 2, data); - - side_u0 = tex->getU(0.0f, true); - side_u1 = tex->getU(8.0f, true); - side_v_h0 = tex->getV((1.0f - hh0) * 8.0f); - side_v_h1 = tex->getV((1.0f - hh1) * 8.0f); - side_v1 = tex->getV(8.0f, true); + float br; + if ( SharedConstants::TEXTURE_LIGHTING ) + { + t->tex2( getLightColor(tt, level, xt, yt, zt ) ); + br = 1; + } + else + { + br = tt->getBrightness( level, xt, yt, zt ); + } + if ( face < 2 ) br *= c2; + else + br *= c3; - t->tex2(getLightColor(tt, level, xt, y, zt)); - - float br = (face < 2) ? 0.8f : 0.6f; - t->color(br * r, br * g, br * b); + t->color( c11 * br * r, c11 * br * g, c11 * br * b ); + t->vertexUV( ( float )( x0 ), ( float )( y + hh0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v01 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + hh1 ), ( float )( z1 ), ( float )( u1 ), ( float )( v02 ) ); + t->vertexUV( ( float )( x1 ), static_cast(y + 0), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), static_cast(y + 0), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); - t->vertexUV(( float )( x0 ), ( float )(y + hh0), ( float )( z0 ), ( float )(side_u0), ( float )(side_v_h0)); - t->vertexUV(( float )( x1 ), ( float )(y + hh1), ( float )( z1 ), ( float )(side_u1), ( float )(side_v_h1)); - t->vertexUV(( float )( x1 ), static_cast(y + 0), ( float )( z1 ), ( float )(side_u1), ( float )(side_v1)); - t->vertexUV(( float )( x0 ), static_cast(y + 0), ( float )( z0 ), ( float )(side_u0), ( float )(side_v1)); - - //This is necessary, do not delete it - t->vertexUV(( float )( x0 ), static_cast(y + 0), ( float )( z0 ), ( float )(side_u0), ( float )(side_v1)); - t->vertexUV(( float )( x1 ), static_cast(y + 0), ( float )( z1 ), ( float )(side_u1), ( float )(side_v1)); - t->vertexUV(( float )( x1 ), ( float )(y + hh1), ( float )( z1 ),( float ) (side_u1), ( float )(side_v_h1)); - t->vertexUV(( float )( x0 ), ( float )(y + hh0), ( float )( z0 ), ( float )(side_u0), ( float )(side_v_h0)); - } - } + } - tileShapeY0 = 0.0f; - tileShapeY1 = 1.0f; + } - return changed; + tileShapeY0 = yo0; + tileShapeY1 = yo1; + + return changed; } bool TileRenderer::tesselateWaterInWorldAO(Tile* tt, int x, int y, int z) { - Tesselator* t = Tesselator::getInstance(); + // 4J Java comment + // TODO: This all needs to change. Somehow. + Tesselator* t = Tesselator::getInstance(); - int col = tt->getColor(level, x, y, z); - float r = ((col >> 16) & 0xff) / 255.0f; - float g = ((col >> 8) & 0xff) / 255.0f; - float b = (col & 0xff) / 255.0f; + int col = tt->getColor( level, x, y, z ); + float r = ( col >> 16 & 0xff ) / 255.0f; + float g = ( col >> 8 & 0xff ) / 255.0f; + float b = ( col & 0xff ) / 255.0f; + bool up = tt->shouldRenderFace( level, x, y + 1, z, 1 ); + bool down = tt->shouldRenderFace( level, x, y - 1, z, 0 ); + bool dirs[4]; + dirs[0] = tt->shouldRenderFace( level, x, y, z - 1, 2 ); + dirs[1] = tt->shouldRenderFace( level, x, y, z + 1, 3 ); + dirs[2] = tt->shouldRenderFace( level, x - 1, y, z, 4 ); + dirs[3] = tt->shouldRenderFace( level, x + 1, y, z, 5 ); - bool up = tt->shouldRenderFace(level, x, y + 1, z, 1); - bool down = tt->shouldRenderFace(level, x, y - 1, z, 0); - bool dirs[4]; + if ( !up && !down && !dirs[0] && !dirs[1] && !dirs[2] && !dirs[3] ) return false; - dirs[0] = tt->shouldRenderFace( level, x, y, z - 1, 2 ); - dirs[1] = tt->shouldRenderFace( level, x, y, z + 1, 3 ); - dirs[2] = tt->shouldRenderFace( level, x - 1, y, z, 4 ); - dirs[3] = tt->shouldRenderFace( level, x + 1, y, z, 5 ); + bool changed = false; + float c10 = 0.5f; + float c11 = 1; + float c2 = 0.8f; + float c3 = 0.6f; - if (!up && !down && !dirs[0] && !dirs[1] && !dirs[2] && !dirs[3]) - return false; + double yo0 = 0; + double yo1 = 1; - bool changed = false; - Material* m = tt->material; - int data = level->getData(x, y, z); - - float h0 = getWaterHeight(x, y, z, m); - float h1 = getWaterHeight(x, y, z + 1, m); - float h2 = getWaterHeight(x + 1, y, z + 1, m); - float h3 = getWaterHeight(x + 1, y, z, m); + Material* m = tt->material; + int data = level->getData( x, y, z ); - float maxh = h0; - if (h1 > maxh) maxh = h1; - if (h2 > maxh) maxh = h2; - if (h3 > maxh) maxh = h3; + float h0 = getWaterHeight( x, y, z, m ); + float h1 = getWaterHeight( x, y, z + 1, m ); + float h2 = getWaterHeight( x + 1, y, z + 1, m ); + float h3 = getWaterHeight( x + 1, y, z, m ); + float offs = 0.001f; // 4J - added. Farm tiles often found beside water, but they consider themselves non-solid as they only extend up to 15.0f / 16.0f. // If the max height of this water is below that level, don't bother rendering sides bordering onto farmland. - if (maxh <= ( 15.0f / 16.0f )) - { - if (level->getTile(x, y, z - 1) == Tile::farmland_Id) dirs[0] = false; - if (level->getTile(x, y, z + 1) == Tile::farmland_Id) dirs[1] = false; - if (level->getTile(x - 1, y, z) == Tile::farmland_Id) dirs[2] = false; - if (level->getTile(x + 1, y, z) == Tile::farmland_Id) dirs[3] = false; - } + float maxh = h0; + if ( h1 > maxh ) maxh = h1; + if ( h2 > maxh ) maxh = h2; + if ( h3 > maxh ) maxh = h3; + if ( maxh <= ( 15.0f / 16.0f ) ) + { + if ( level->getTile( x, y, z - 1 ) == Tile::farmland_Id ) + { + dirs[0] = false; + } + if ( level->getTile( x, y, z + 1 ) == Tile::farmland_Id ) + { + dirs[1] = false; + } + if ( level->getTile( x - 1, y, z ) == Tile::farmland_Id ) + { + dirs[2] = false; + } + if ( level->getTile( x + 1, y, z ) == Tile::farmland_Id ) + { + dirs[3] = false; + } + } - constexpr float offs = 0.001f; + if ( noCulling || up ) + { + changed = true; + Icon *tex = getTexture( tt, 1, data ); + float angle = static_cast(LiquidTile::getSlopeAngle(level, x, y, z, m)); + if ( angle > -999 ) + { + tex = getTexture( tt, 2, data ); + } - if (noCulling || up) - { - changed = true; - Icon* tex = getTexture(tt, 1, data); - float angle = static_cast(LiquidTile::getSlopeAngle(level, x, y, z, m)); + h0 -= offs; + h1 -= offs; + h2 -= offs; + h3 -= offs; - if (angle > -999.0f) tex = getTexture(tt, 2, data); + float u00, u01, u10, u11; + float v00, v01, v10, v11; + if ( angle < -999 ) + { + u00 = tex->getU(0, true); + v00 = tex->getV(0, true); + u01 = u00; + v01 = tex->getV(SharedConstants::WORLD_RESOLUTION, true); + u10 = tex->getU(SharedConstants::WORLD_RESOLUTION, true); + v10 = v01; + u11 = u10; + v11 = v00; + } + else + { + float s = Mth::sin(angle) * .25f; + float c = Mth::cos(angle) * .25f; + float cc = SharedConstants::WORLD_RESOLUTION * .5f; + u00 = tex->getU(cc + (-c - s) * SharedConstants::WORLD_RESOLUTION); + v00 = tex->getV(cc + (-c + s) * SharedConstants::WORLD_RESOLUTION); + u01 = tex->getU(cc + (-c + s) * SharedConstants::WORLD_RESOLUTION); + v01 = tex->getV(cc + (+c + s) * SharedConstants::WORLD_RESOLUTION); + u10 = tex->getU(cc + (+c + s) * SharedConstants::WORLD_RESOLUTION); + v10 = tex->getV(cc + (+c - s) * SharedConstants::WORLD_RESOLUTION); + u11 = tex->getU(cc + (+c - s) * SharedConstants::WORLD_RESOLUTION); + v11 = tex->getV(cc + (-c - s) * SharedConstants::WORLD_RESOLUTION); + } - h0 -= offs; h1 -= offs; h2 -= offs; h3 -= offs; + int pY = y + 1; + int centerColor = tt->getLightColor(level, x, pY, z); + float ll0Y0 = tt->getShadeBrightness(level, x, pY, z); - float u0, v0, u1, v1, u2, v2, u3, v3; + auto getWaterLight = [&](int sx, int sy, int sz) -> int + { + if (level->isSolidBlockingTile(sx, sy, sz)) + return centerColor; - if (angle >= -999.0f) - { - constexpr float cc = SharedConstants::WORLD_RESOLUTION * 0.5f; - float fsin = Mth::sin(angle) * 0.25f; - float fcos = Mth::cos(angle) * 0.25f; - u0 = tex->getU(cc + (-fcos - fsin) * SharedConstants::WORLD_RESOLUTION); - v0 = tex->getV(cc + (fsin - fcos) * SharedConstants::WORLD_RESOLUTION); - u1 = tex->getU(cc + (fsin - fcos) * SharedConstants::WORLD_RESOLUTION); - v1 = tex->getV(cc + (fcos + fsin) * SharedConstants::WORLD_RESOLUTION); - u2 = tex->getU(cc + (fcos + fsin) * SharedConstants::WORLD_RESOLUTION); - v2 = tex->getV(cc + (fcos - fsin) * SharedConstants::WORLD_RESOLUTION); - u3 = tex->getU(cc + (fcos - fsin) * SharedConstants::WORLD_RESOLUTION); - v3 = tex->getV(cc + (-fcos - fsin) * SharedConstants::WORLD_RESOLUTION); - } - else - { - u0 = tex->getU(0.0f, true); v0 = tex->getV(0.0f, true); - u1 = u0; v1 = tex->getV(SharedConstants::WORLD_RESOLUTION, true); - u2 = tex->getU(SharedConstants::WORLD_RESOLUTION, true); v2 = v1; - u3 = u2; v3 = v0; - } + return tt->getLightColor(level, sx, sy, sz); + }; - int pY = y + 1; - int centerColor = tt->getLightColor(level, x, pY, z); - float ll0Y0 = tt->getShadeBrightness(level, x, pY, z); + auto getWaterBr = [&](int sx, int sy, int sz) -> float + { + if (level->isSolidBlockingTile(sx, sy, sz)) + return ll0Y0; - auto getWaterLight = [&](int sx, int sy, int sz) -> int { - if (level->isSolidBlockingTile(sx, sy, sz)) return centerColor; - return tt->getLightColor(level, sx, sy, sz); - }; + return tt->getShadeBrightness(level, sx, sy, sz); + }; - auto getWaterBr = [&](int sx, int sy, int sz) -> float { - if (level->isSolidBlockingTile(sx, sy, sz)) return ll0Y0; - return tt->getShadeBrightness(level, sx, sy, sz); - }; + int ccxY0 = getWaterLight(x - 1, pY, z); + int ccXY0 = getWaterLight(x + 1, pY, z); + int cc0Yz = getWaterLight(x, pY, z - 1); + int cc0YZ = getWaterLight(x, pY, z + 1); - int ccxY0 = getWaterLight(x - 1, pY, z); - int ccXY0 = getWaterLight(x + 1, pY, z); - int cc0Yz = getWaterLight(x, pY, z - 1); - int cc0YZ = getWaterLight(x, pY, z + 1); + float llxY0 = getWaterBr(x - 1, pY, z); + float llXY0 = getWaterBr(x + 1, pY, z); + float ll0Yz = getWaterBr(x, pY, z - 1); + float ll0YZ = getWaterBr(x, pY, z + 1); - float llxY0 = getWaterBr(x - 1, pY, z); - float llXY0 = getWaterBr(x + 1, pY, z); - float ll0Yz = getWaterBr(x, pY, z - 1); - float ll0YZ = getWaterBr(x, pY, z + 1); + float llxYz, llXYz, llxYZ, llXYZ; + int ccxYz, ccXYz, ccxYZ, ccXYZ; - float llxYz, llXYz, llxYZ, llXYZ; - int ccxYz, ccXYz, ccxYZ, ccXYZ; + llxYz = getWaterBr(x - 1, pY, z - 1); ccxYz = getWaterLight(x - 1, pY, z - 1); + llXYz = getWaterBr(x + 1, pY, z - 1); ccXYz = getWaterLight(x + 1, pY, z - 1); + llxYZ = getWaterBr(x - 1, pY, z + 1); ccxYZ = getWaterLight(x - 1, pY, z + 1); + llXYZ = getWaterBr(x + 1, pY, z + 1); ccXYZ = getWaterLight(x + 1, pY, z + 1); - llxYz = getWaterBr(x - 1, pY, z - 1); ccxYz = getWaterLight(x - 1, pY, z - 1); - llXYz = getWaterBr(x + 1, pY, z - 1); ccXYz = getWaterLight(x + 1, pY, z - 1); - llxYZ = getWaterBr(x - 1, pY, z + 1); ccxYZ = getWaterLight(x - 1, pY, z + 1); - llXYZ = getWaterBr(x + 1, pY, z + 1); ccXYZ = getWaterLight(x + 1, pY, z + 1); + float b0 = (llxY0 + llxYz + ll0Y0 + ll0Yz) / 4.0f; + int c0 = blend(ccxY0, ccxYz, centerColor, cc0Yz); + + float b1 = (llxYZ + llxY0 + ll0YZ + ll0Y0) / 4.0f; + int c1 = blend(ccxYZ, ccxY0, cc0YZ, centerColor); + + float b2 = (ll0YZ + ll0Y0 + llXYZ + llXY0) / 4.0f; + int c2_color = blend(cc0YZ, centerColor, ccXYZ, ccXY0); + + float b3 = (ll0Y0 + ll0Yz + llXY0 + llXYz) / 4.0f; + int c3_color = blend(centerColor, cc0Yz, ccXY0, ccXYz); - float b0 = (llxY0 + llxYz + ll0Y0 + ll0Yz) / 4.0f; - int c0 = blend(ccxY0, ccxYz, centerColor, cc0Yz); - - float b1 = (llxYZ + llxY0 + ll0YZ + ll0Y0) / 4.0f; - int c1 = blend(ccxYZ, ccxY0, cc0YZ, centerColor); - - float b2 = (ll0YZ + ll0Y0 + llXYZ + llXY0) / 4.0f; - int c2 = blend(cc0YZ, centerColor, ccXYZ, ccXY0); - - float b3 = (ll0Y0 + ll0Yz + llXY0 + llXYz) / 4.0f; - int c3 = blend(centerColor, cc0Yz, ccXY0, ccXYz); + if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2(c0); + t->color( c11 * b0 * r, c11 * b0 * g, c11 * b0 * b ); + t->vertexUV( ( float )( x + 0.0f ), ( float )( y + h0 ), ( float )( z + 0.0f ), u00, v00 ); + + if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2(c1); + t->color( c11 * b1 * r, c11 * b1 * g, c11 * b1 * b ); + t->vertexUV( ( float )( x + 0.0f ), ( float )( y + h1 ), ( float )( z + 1.0f ), u01, v01 ); + + if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2(c2_color); + t->color( c11 * b2 * r, c11 * b2 * g, c11 * b2 * b ); + t->vertexUV( ( float )( x + 1.0f ), ( float )( y + h2 ), ( float )( z + 1.0f ), u10, v10 ); + + if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2(c3_color); + t->color( c11 * b3 * r, c11 * b3 * g, c11 * b3 * b ); + t->vertexUV( ( float )( x + 1.0f ), ( float )( y + h3 ), ( float )( z + 0.0f ), u11, v11 ); + } - t->tex2(c0); t->color(r * b0, g * b0, b * b0); - t->vertexUV(( float )( x + 0.0f ), ( float )( y + h0 ), ( float )( z + 0.0f ), u0, v0); - - t->tex2(c1); t->color(r * b1, g * b1, b * b1); - t->vertexUV(( float )( x + 0.0f ), ( float )( y + h1 ), ( float )( z + 1.0f ), u1, v1); - - t->tex2(c2); t->color(r * b2, g * b2, b * b2); - t->vertexUV(( float )( x + 1.0f ), ( float )( y + h2 ), ( float )( z + 1.0f ), u2, v2); - - t->tex2(c3); t->color(r * b3, g * b3, b * b3); - t->vertexUV(( float )( x + 1.0f ), ( float )( y + h3 ), ( float )( z + 0.0f ), u3, v3); + if ( noCulling || down ) + { + if ( SharedConstants::TEXTURE_LIGHTING ) + { + t->tex2( getLightColor(tt, level, x, y - 1, z ) ); + } + float bl = tt->getShadeBrightness(level, x, y - 1, z); + t->color( c10 * bl * r, c10 * bl * g, c10 * bl * b ); + renderFaceDown( tt, x, y + offs, z, getTexture( tt, 0 ) ); + changed = true; + } - if (static_cast(tt)->LiquidTile::shouldRenderBackwardUpFace(level, x, y + 1, z)) - { - t->tex2(c0); t->color(r * b0, g * b0, b * b0); - t->vertexUV(( float )( x + 0.0f ), ( float )( y + h0 ), ( float )( z + 0.0f ), u0, v0); - t->tex2(c3); t->color(r * b3, g * b3, b * b3); - t->vertexUV(( float )( x + 1.0f ), ( float )( y + h3 ), ( float )( z + 0.0f ), u3, v3); - t->tex2(c2); t->color(r * b2, g * b2, b * b2); - t->vertexUV(( float )( x + 1.0f ), ( float )( y + h2 ), ( float )( z + 1.0f ), u2, v2); - t->tex2(c1); t->color(r * b1, g * b1, b * b1); - t->vertexUV(( float )( x + 0.0f ), ( float )( y + h1 ), ( float )(z + 1.0f), u1, v1); - } - } + for ( int face = 0; face < 4; face++ ) + { + int xt = x; + int yt = y; + int zt = z; - if (noCulling || down) - { - t->tex2(getLightColor(tt, level, x, y - 1, z)); - float bl = tt->getShadeBrightness(level, x, y - 1, z); - t->color(r * 0.5f * bl, g * 0.5f * bl, b * 0.5f * bl); - renderFaceDown(tt, x, y + offs, z, getTexture(tt, 0)); - changed = true; - } + if ( face == 0 ) zt--; + if ( face == 1 ) zt++; + if ( face == 2 ) xt--; + if ( face == 3 ) xt++; - for (int face = 0; face < 4; face++) - { - if (noCulling || dirs[face]) - { - int xt = x, zt = z; - float x0, z0, x1, z1, hh0, hh1; + Icon *tex = getTexture(tt, face + 2, data); - if (face == 0) - { - zt--; - x1 = static_cast(x + 1.0f); - z1 = ( float )( z + offs); - x0 = static_cast(x); - z0 = ( float )( z + offs); - hh0 = ( float )( h0 ); - hh1 = ( float )( h3 ); - } - else if (face == 1) - { - zt++; - x1 = static_cast(x); - z1 = ( float )( z + 1.0f - offs); - x0 = static_cast(x + 1.0f); - z0 = ( float )( z + 1.0f - offs); - hh0 = ( float )( h2 ); - hh1 = ( float )( h1 ); - } - else if (face == 2) - { - xt--; - x1 = ( float )( x + offs); - z1 = static_cast(z); - x0 = ( float )( x + offs); - z0 = static_cast(z + 1.0f); - hh0 = ( float )( h1 ); - hh1 = ( float )( h0 ); - } - else - { - xt++; - x0 = ( float )( x + 1.0f - offs); - z1 = static_cast(z + 1.0f); - x1 = ( float )( x + 1.0f - offs); - z0 = static_cast(z); - hh0 = ( float )( h3 ); - hh1 = ( float )( h2 ); - } + if ( noCulling || dirs[face] ) + { + float hh0; + float hh1; + float x0, z0, x1, z1; + if ( face == 0 ) + { + hh0 = ( float )( h0 ); + hh1 = ( float )( h3 ); + x0 = static_cast(x); + x1 = static_cast(x + 1); + z0 = ( float )( z + offs); + z1 = ( float )( z + offs); + } + else if ( face == 1 ) + { + hh0 = ( float )( h2 ); + hh1 = ( float )( h1 ); + x0 = static_cast(x + 1); + x1 = static_cast(x); + z0 = ( float )( z + 1 - offs); + z1 = ( float )( z + 1 - offs); + } + else if ( face == 2 ) + { + hh0 = ( float )( h1 ); + hh1 = ( float )( h0 ); + x0 = ( float )( x + offs); + x1 = ( float )( x + offs); + z0 = static_cast(z + 1); + z1 = static_cast(z); + } + else + { + hh0 = ( float )( h3 ); + hh1 = ( float )( h2 ); + x0 = ( float )( x + 1 - offs); + x1 = ( float )( x + 1 - offs); + z0 = static_cast(z); + z1 = static_cast(z + 1); + } - changed = true; - Icon* tex = getTexture(tt, face + 2, data); - float side_v_h0 = tex->getV((1.0f - hh0) * 8.0f); - float side_v_h1 = tex->getV((1.0f - hh1) * 8.0f); - float side_u0 = tex->getU(0.0f, true), side_u1 = tex->getU(8.0f, true), side_v1 = tex->getV(8.0f, true); + changed = true; + float u0 = tex->getU(0, true); + float u1 = tex->getU(SharedConstants::WORLD_RESOLUTION * .5f, true); - int lightTop = getLightColor(tt, level, xt, y + 1, zt); - int lightBot = getLightColor(tt, level, xt, y, zt); - float br = (face < 2) ? 0.8f : 0.6f; + int yTex = tex->getY(); + float v01 = tex->getV((1 - hh0) * SharedConstants::WORLD_RESOLUTION * .5f); + float v02 = tex->getV((1 - hh1) * SharedConstants::WORLD_RESOLUTION * .5f); + float v1 = tex->getV(SharedConstants::WORLD_RESOLUTION * .5f, true); - t->tex2(lightTop); t->color(br * r, br * g, br * b); - t->vertexUV(( float )( x0 ), ( float )(y + hh0), ( float )( z0 ), ( float )(side_u0), ( float )(side_v_h0)); - t->vertexUV(( float )( x1 ), ( float )(y + hh1), ( float )( z1 ), ( float )(side_u1), ( float )(side_v_h1)); - t->tex2(lightBot); - t->vertexUV(( float )( x1 ), static_cast(y + 0), ( float )( z1 ), ( float )(side_u1), ( float )(side_v1)); - t->vertexUV(( float )( x0 ), static_cast(y + 0), ( float )( z0 ), ( float )(side_u0), ( float )(side_v1)); - - //This is necessary, do not delete it - t->tex2(lightBot); - t->vertexUV(( float )( x0 ), static_cast(y + 0), ( float )( z0 ), ( float )(side_u0), ( float )(side_v1)); - t->vertexUV(( float )( x1 ), static_cast(y + 0), ( float )( z1 ), ( float )(side_u1), ( float )(side_v1)); - t->tex2(lightTop); - t->vertexUV(( float )( x1 ), ( float )(y + hh1), ( float )( z1 ),( float ) (side_u1), ( float )(side_v_h1)); - t->vertexUV(( float )( x0 ), ( float )(y + hh0), ( float )( z0 ), ( float )(side_u0), ( float )(side_v_h0)); - } - } + float baseBr = tt->getShadeBrightness(level, xt, yt, zt); + float br = ( face < 2 ) ? (baseBr * c2) : (baseBr * c3); - tileShapeY0 = 0.0f; - tileShapeY1 = 1.0f; + int lightTop = getLightColor(tt, level, xt, y + 1, zt); + int lightBot = getLightColor(tt, level, xt, y, zt); - return changed; + t->color( c11 * br * r, c11 * br * g, c11 * br * b ); + + if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( lightTop ); + t->vertexUV( ( float )( x0 ), ( float )( y + hh0 ), ( float )( z0 ), ( float )( u0 ), ( float )( v01 ) ); + t->vertexUV( ( float )( x1 ), ( float )( y + hh1 ), ( float )( z1 ), ( float )( u1 ), ( float )( v02 ) ); + + if ( SharedConstants::TEXTURE_LIGHTING ) t->tex2( lightBot ); + t->vertexUV( ( float )( x1 ), static_cast(y + 0), ( float )( z1 ), ( float )( u1 ), ( float )( v1 ) ); + t->vertexUV( ( float )( x0 ), static_cast(y + 0), ( float )( z0 ), ( float )( u0 ), ( float )( v1 ) ); + } + } + + tileShapeY0 = yo0; + tileShapeY1 = yo1; + + return changed; } float TileRenderer::getWaterHeight( int x, int y, int z, Material* m ) @@ -5025,7 +5098,7 @@ float TileRenderer::getWaterHeight( int x, int y, int z, Material* m ) count++; } } - return (1 - (h / count)); + return 1 - h / count; } void TileRenderer::renderBlock( Tile* tt, Level* level, int x, int y, int z ) @@ -5141,16 +5214,16 @@ bool TileRenderer::tesselateBlockInWorld( Tile* tt, int x, int y, int z, int fac bool TileRenderer::tesselateTreeInWorld(Tile *tt, int x, int y, int z) { int data = level->getData(x, y, z); - int facing = data & LogTile::MASK_FACING; + int facing = data & TreeTile::MASK_FACING; - if (facing == LogTile::FACING_X) + if (facing == TreeTile::FACING_X) { northFlip = FLIP_CW; southFlip = FLIP_CW; upFlip = FLIP_CW; downFlip = FLIP_CW; } - else if (facing == LogTile::FACING_Z) + else if (facing == TreeTile::FACING_Z) { eastFlip = FLIP_CW; westFlip = FLIP_CW; @@ -5237,20 +5310,20 @@ bool TileRenderer::tesselateCocoaInWorld(CocoaTile *tt, int x, int y, int z) switch (dir) { case Direction::NORTH: - offX = 8.0 - cocoaWidth / 2.0; + offX = 8.0 - cocoaWidth / 2; offZ = 1.0; break; case Direction::SOUTH: - offX = 8.0 - cocoaWidth / 2.0; + offX = 8.0 - cocoaWidth / 2; offZ = 15.0 - cocoaWidth; break; case Direction::EAST: offX = 15.0 - cocoaWidth; - offZ = 8.0 - cocoaWidth / 2.0; + offZ = 8.0 - cocoaWidth / 2; break; case Direction::WEST: offX = 1.0; - offZ = 8.0 - cocoaWidth / 2.0; + offZ = 8.0 - cocoaWidth / 2; break; } @@ -6823,14 +6896,14 @@ bool TileRenderer::tesselateFenceGateInWorld(FenceGateTile *tt, int x, int y, in if (direction == Direction::EAST) { - constexpr float z00 = 0 / 16.0f; - constexpr float z01 = 2 / 16.0f; - constexpr float z10 = 14 / 16.0f; - constexpr float z11 = 16 / 16.0f; + const float z00 = 0 / 16.0f; + const float z01 = 2 / 16.0f; + const float z10 = 14 / 16.0f; + const float z11 = 16 / 16.0f; - constexpr float x0 = 9 / 16.0f; - constexpr float x1 = 13 / 16.0f; - constexpr float x2 = 15 / 16.0f; + const float x0 = 9 / 16.0f; + const float x1 = 13 / 16.0f; + const float x2 = 15 / 16.0f; setShape(x1, h00, z00, x2, h11, z01); tesselateBlockInWorld(tt, x, y, z); @@ -6849,14 +6922,14 @@ bool TileRenderer::tesselateFenceGateInWorld(FenceGateTile *tt, int x, int y, in } else if (direction == Direction::WEST) { - constexpr float z00 = 0 / 16.0f; - constexpr float z01 = 2 / 16.0f; - constexpr float z10 = 14 / 16.0f; - constexpr float z11 = 16 / 16.0f; + const float z00 = 0 / 16.0f; + const float z01 = 2 / 16.0f; + const float z10 = 14 / 16.0f; + const float z11 = 16 / 16.0f; - constexpr float x0 = 1 / 16.0f; - constexpr float x1 = 3 / 16.0f; - constexpr float x2 = 7 / 16.0f; + const float x0 = 1 / 16.0f; + const float x1 = 3 / 16.0f; + const float x2 = 7 / 16.0f; setShape(x0, h00, z00, x1, h11, z01); tesselateBlockInWorld(tt, x, y, z); @@ -6876,14 +6949,14 @@ bool TileRenderer::tesselateFenceGateInWorld(FenceGateTile *tt, int x, int y, in else if (direction == Direction::SOUTH) { - constexpr float x00 = 0 / 16.0f; - constexpr float x01 = 2 / 16.0f; - constexpr float x10 = 14 / 16.0f; - constexpr float x11 = 16 / 16.0f; + const float x00 = 0 / 16.0f; + const float x01 = 2 / 16.0f; + const float x10 = 14 / 16.0f; + const float x11 = 16 / 16.0f; - constexpr float z0 = 9 / 16.0f; - constexpr float z1 = 13 / 16.0f; - constexpr float z2 = 15 / 16.0f; + const float z0 = 9 / 16.0f; + const float z1 = 13 / 16.0f; + const float z2 = 15 / 16.0f; setShape(x00, h00, z1, x01, h11, z2); tesselateBlockInWorld(tt, x, y, z); @@ -6902,14 +6975,14 @@ bool TileRenderer::tesselateFenceGateInWorld(FenceGateTile *tt, int x, int y, in } else if (direction == Direction::NORTH) { - constexpr float x00 = 0 / 16.0f; - constexpr float x01 = 2 / 16.0f; - constexpr float x10 = 14 / 16.0f; - constexpr float x11 = 16 / 16.0f; + const float x00 = 0 / 16.0f; + const float x01 = 2 / 16.0f; + const float x10 = 14 / 16.0f; + const float x11 = 16 / 16.0f; - constexpr float z0 = 1 / 16.0f; - constexpr float z1 = 3 / 16.0f; - constexpr float z2 = 7 / 16.0f; + const float z0 = 1 / 16.0f; + const float z1 = 3 / 16.0f; + const float z2 = 7 / 16.0f; setShape(x00, h00, z0, x01, h11, z1); tesselateBlockInWorld(tt, x, y, z); @@ -8708,44 +8781,6 @@ void TileRenderer::renderTile( Tile* tile, int data, float brightness, float fAl tesselateHopperInWorld(tile, 0, 0, 0, 0, true); glTranslatef(0.5f, 0.5f, 0.5f); } - else if (shape == Tile::SHAPE_THIN_PANE) - { - setShape(7.0f / 16.0f, 0, 0, 9.0f / 16.0f, 1.0f, 1.0f); - - glTranslatef(-0.5f, -0.5f, -0.5f); - t->begin(); - t->normal(0, -1, 0); - renderFaceDown(tile, 0, 0, 0, getTexture(tile, 0, data)); - t->end(); - - t->begin(); - t->normal(0, 1, 0); - renderFaceUp(tile, 0, 0, 0, getTexture(tile, 1, data)); - t->end(); - - t->begin(); - t->normal(0, 0, -1); - renderNorth(tile, 0, 0, 0, getTexture(tile, 2, data)); - t->end(); - - t->begin(); - t->normal(0, 0, 1); - renderSouth(tile, 0, 0, 0, getTexture(tile, 3, data)); - t->end(); - - t->begin(); - t->normal(-1, 0, 0); - renderWest(tile, 0, 0, 0, getTexture(tile, 4, data)); - t->end(); - - t->begin(); - t->normal(1, 0, 0); - renderEast(tile, 0, 0, 0, getTexture(tile, 5, data)); - t->end(); - - glTranslatef(0.5f, 0.5f, 0.5f); - setShape(0, 0, 0, 1, 1, 1); - } t->setMipmapEnable( true ); // 4J added } @@ -8766,7 +8801,6 @@ bool TileRenderer::canRender( int renderShape ) if ( renderShape == Tile::SHAPE_WALL) return true; if ( renderShape == Tile::SHAPE_BEACON) return true; if ( renderShape == Tile::SHAPE_ANVIL) return true; - if ( renderShape == Tile::SHAPE_THIN_PANE ) return true; if ( renderShape == Tile::SHAPE_WATER ) return true; return false; } diff --git a/Minecraft.Client/Windows64/GameConfig/Minecraft.spa.h b/Minecraft.Client/Windows64/GameConfig/Minecraft.spa.h index f80e7e6f..d9be7551 100644 --- a/Minecraft.Client/Windows64/GameConfig/Minecraft.spa.h +++ b/Minecraft.Client/Windows64/GameConfig/Minecraft.spa.h @@ -642,6 +642,4 @@ extern "C" { } #endif -#endif // __MINECRAFT_SPA_H__ - - +#endif // __MINECRAFT_SPA_H__ \ No newline at end of file diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 3aa15325..fd99cf75 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -144,7 +144,7 @@ static void SaveFullscreenOption(bool fullscreen) FILE *f = nullptr; if (fopen_s(&f, path, "w") == 0 && f) { - fprintf_s(f, "fullscreen=%d\n", fullscreen ? 1 : 0); + fprintf(f, "fullscreen=%d\n", fullscreen ? 1 : 0); fclose(f); } } diff --git a/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml b/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml index 666567c5..825f247b 100644 --- a/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml +++ b/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml @@ -935,10 +935,6 @@ The colors of the bed are always the same, regardless of the colors of wool used Activated by using, hitting them or with redstone. They function as normal doors, but are a one by one block and lay flat on the ground. - - Iron trapdoors can only be opened by Redstone, buttons or switches. - - Shows text entered by you or other players. @@ -1024,7 +1020,7 @@ The colors of the bed are always the same, regardless of the colors of wool used - Is a block that outputs a Redstone signal based on sunlight or lack of sunlight if inverted. + Is a block that outputs a Redstone signal based on sunlight (or lack of sunlight). @@ -2977,14 +2973,6 @@ Can also be used for low-level lighting. Jungle Wood Planks - - Acacia Wood Planks - - - - Dark Oak Wood Planks - - Wood Planks (any type) @@ -3065,14 +3053,6 @@ Can also be used for low-level lighting. Jungle Wood - - Acacia Wood - - - - Dark Oak Wood - - Oak @@ -3105,14 +3085,6 @@ Can also be used for low-level lighting. Jungle Leaves - - Acacia Leaves - - - - Dark Oak Leaves - - Sponge @@ -3350,27 +3322,7 @@ Can also be used for low-level lighting. - Oak Door - - - - Spruce Door - - - - Birch Door - - - - Jungle Door - - - - Acacia Door - - - - Dark Oak Door + Wooden Door @@ -3442,29 +3394,9 @@ Can also be used for low-level lighting. - Oak Fence + Fence - - Spruce Fence - - - - Birch Fence - - - - Jungle Fence - - - - Acacia Fence - - - - Dark Oak Fence - - Pumpkin @@ -3541,10 +3473,6 @@ Can also be used for low-level lighting. Trapdoor - - Iron Trapdoor - - Wool (any color) @@ -3610,29 +3538,9 @@ Can also be used for low-level lighting. - Oak Fence Gate + Fence Gate - - Spruce Fence Gate - - - - Birch Fence Gate - - - - Jungle Fence Gate - - - - Acacia Fence Gate - - - - Dark Oak Fence Gate - - Brick Stairs @@ -3729,14 +3637,6 @@ Can also be used for low-level lighting. Jungle Wood Stairs - - Acacia Wood Stairs - - - - Dark Oak Wood Stairs - - Redstone Lamp @@ -6196,10 +6096,6 @@ Would you like to unlock the full game now? Difficulty - - Game Mode - - Music @@ -8948,14 +8844,6 @@ All Ender Chests in a world are linked. Items placed into an Ender Chest are acc Extra - - Cave Sounds - - - - Classic Crafting - - General Options diff --git a/Minecraft.Client/Windows64Media/strings.h b/Minecraft.Client/Windows64Media/strings.h index 460c44c1..9ef8e708 100644 --- a/Minecraft.Client/Windows64Media/strings.h +++ b/Minecraft.Client/Windows64Media/strings.h @@ -1,7 +1,7 @@ #pragma once // Auto-generated by StringTable builder — do not edit manually. // Source language: en-US -// Total strings: 2333 +// Total strings: 2305 #define IDS_NULL 0 #define IDS_OK 1 @@ -264,2075 +264,2047 @@ #define IDS_DESC_FENCE 258 #define IDS_DESC_LADDER 259 #define IDS_DESC_TRAPDOOR 260 -#define IDS_DESC_TRAPDOOR_IRON 261 -#define IDS_DESC_SIGN 262 -#define IDS_DESC_GLOWSTONE 263 -#define IDS_DESC_TNT 264 -#define IDS_DESC_BOWL 265 -#define IDS_DESC_BUCKET 266 -#define IDS_DESC_BUCKET_WATER 267 -#define IDS_DESC_BUCKET_LAVA 268 -#define IDS_DESC_BUCKET_MILK 269 -#define IDS_DESC_FLINTANDSTEEL 270 -#define IDS_DESC_FISHINGROD 271 -#define IDS_DESC_CLOCK 272 -#define IDS_DESC_COMPASS 273 -#define IDS_DESC_MAP 274 -#define IDS_DESC_MAP_EMPTY 275 -#define IDS_DESC_BOW 276 -#define IDS_DESC_ARROW 277 -#define IDS_DESC_NETHER_STAR 278 -#define IDS_DESC_FIREWORKS 279 -#define IDS_DESC_FIREWORKS_CHARGE 280 -#define IDS_DESC_COMPARATOR 281 -#define IDS_DESC_MINECART_TNT 282 -#define IDS_DESC_DAYLIGHT_DETECTOR 283 -#define IDS_DESC_MINECART_HOPPER 284 -#define IDS_DESC_IRON_HORSE_ARMOR 285 -#define IDS_DESC_GOLD_HORSE_ARMOR 286 -#define IDS_DESC_DIAMOND_HORSE_ARMOR 287 -#define IDS_DESC_LEAD 288 -#define IDS_DESC_NAME_TAG 289 -#define IDS_DESC_BREAD 290 -#define IDS_DESC_CAKE 291 -#define IDS_DESC_COOKIE 292 -#define IDS_DESC_MELON_SLICE 293 -#define IDS_DESC_MUSHROOMSTEW 294 -#define IDS_DESC_CHICKEN_RAW 295 -#define IDS_DESC_CHICKEN_COOKED 296 -#define IDS_DESC_BEEF_RAW 297 -#define IDS_DESC_BEEF_COOKED 298 -#define IDS_DESC_PORKCHOP_RAW 299 -#define IDS_DESC_PORKCHOP_COOKED 300 -#define IDS_DESC_FISH_RAW 301 -#define IDS_DESC_FISH_COOKED 302 -#define IDS_DESC_APPLE 303 -#define IDS_DESC_GOLDENAPPLE 304 -#define IDS_DESC_ROTTEN_FLESH 305 -#define IDS_DESC_SUGAR 306 -#define IDS_DESC_LEVER 307 -#define IDS_DESC_REDSTONETORCH 308 -#define IDS_DESC_REDSTONEREPEATER 309 -#define IDS_DESC_BUTTON 310 -#define IDS_DESC_DISPENSER 311 -#define IDS_DESC_NOTEBLOCK 312 -#define IDS_DESC_RAIL 313 -#define IDS_DESC_POWEREDRAIL 314 -#define IDS_DESC_DETECTORRAIL 315 -#define IDS_DESC_MINECART 316 -#define IDS_DESC_MINECARTWITHCHEST 317 -#define IDS_DESC_MINECARTWITHFURNACE 318 -#define IDS_DESC_BOAT 319 -#define IDS_DESC_WOOL 320 -#define IDS_DESC_WOOLSTRING 321 -#define IDS_DESC_DYE_BLACK 322 -#define IDS_DESC_DYE_GREEN 323 -#define IDS_DESC_DYE_BROWN 324 -#define IDS_DESC_DYE_SILVER 325 -#define IDS_DESC_DYE_YELLOW 326 -#define IDS_DESC_DYE_RED 327 -#define IDS_DESC_DYE_WHITE 328 -#define IDS_DESC_DYE_PINK 329 -#define IDS_DESC_DYE_ORANGE 330 -#define IDS_DESC_DYE_LIME 331 -#define IDS_DESC_DYE_GRAY 332 -#define IDS_DESC_DYE_LIGHTGRAY 333 -#define IDS_DESC_DYE_LIGHTBLUE 334 -#define IDS_DESC_DYE_CYAN 335 -#define IDS_DESC_DYE_PURPLE 336 -#define IDS_DESC_DYE_MAGENTA 337 -#define IDS_DESC_DYE_BLUE 338 -#define IDS_DESC_JUKEBOX 339 -#define IDS_DESC_DIAMONDS 340 -#define IDS_DESC_JACKOLANTERN 341 -#define IDS_DESC_PAPER 342 -#define IDS_DESC_BOOK 343 -#define IDS_DESC_BOOKSHELF 344 -#define IDS_DESC_PICTURE 345 -#define IDS_DESC_ORE_GOLD 346 -#define IDS_DESC_ORE_IRON 347 -#define IDS_DESC_ORE_COAL 348 -#define IDS_DESC_ORE_LAPIS 349 -#define IDS_DESC_ORE_DIAMOND 350 -#define IDS_DESC_ORE_REDSTONE 351 -#define IDS_DESC_STONE 352 -#define IDS_DESC_DIRT 353 -#define IDS_DESC_SAPLING 354 -#define IDS_DESC_BEDROCK 355 -#define IDS_DESC_LAVA 356 -#define IDS_DESC_SAND 357 -#define IDS_DESC_GRAVEL 358 -#define IDS_DESC_LOG 359 -#define IDS_DESC_GLASS 360 -#define IDS_DESC_STONE_BRICK 361 -#define IDS_DESC_BRICK 362 -#define IDS_DESC_CLAY 363 -#define IDS_DESC_CLAY_TILE 364 -#define IDS_DESC_SNOW 365 -#define IDS_DESC_TOP_SNOW 366 -#define IDS_DESC_TALL_GRASS 367 -#define IDS_DESC_FLOWER 368 -#define IDS_DESC_MUSHROOM 369 -#define IDS_DESC_OBSIDIAN 370 -#define IDS_DESC_MOB_SPAWNER 371 -#define IDS_DESC_REDSTONE_DUST 372 -#define IDS_DESC_CROPS 373 -#define IDS_DESC_FARMLAND 374 -#define IDS_DESC_CACTUS 375 -#define IDS_DESC_REEDS 376 -#define IDS_DESC_PUMPKIN 377 -#define IDS_DESC_HELL_ROCK 378 -#define IDS_DESC_HELL_SAND 379 -#define IDS_DESC_PORTAL 380 -#define IDS_DESC_COAL 381 -#define IDS_DESC_STRING 382 -#define IDS_DESC_FEATHER 383 -#define IDS_DESC_SULPHUR 384 -#define IDS_DESC_WHEAT_SEEDS 385 -#define IDS_DESC_WHEAT 386 -#define IDS_DESC_FLINT 387 -#define IDS_DESC_SADDLE 388 -#define IDS_DESC_SNOWBALL 389 -#define IDS_DESC_LEATHER 390 -#define IDS_DESC_SLIMEBALL 391 -#define IDS_DESC_EGG 392 -#define IDS_DESC_YELLOW_DUST 393 -#define IDS_DESC_BONE 394 -#define IDS_DESC_RECORD 395 -#define IDS_DESC_WATER 396 -#define IDS_DESC_LEAVES 397 -#define IDS_DESC_MOSS_STONE 398 -#define IDS_DESC_SHEARS 399 -#define IDS_DESC_PISTON 400 -#define IDS_DESC_STICKY_PISTON 401 -#define IDS_DESC_STONE_BRICK_SMOOTH 402 -#define IDS_DESC_IRON_FENCE 403 -#define IDS_DESC_FENCE_GATE 404 -#define IDS_DESC_MELON_BLOCK 405 -#define IDS_DESC_THIN_GLASS 406 -#define IDS_DESC_PUMPKIN_SEEDS 407 -#define IDS_DESC_MELON_SEEDS 408 -#define IDS_DESC_ENDER_PEARL 409 -#define IDS_DESC_GRASS 410 -#define IDS_DESC_SPONGE 411 -#define IDS_DESC_WEB 412 -#define IDS_DESC_STONE_SILVERFISH 413 -#define IDS_DESC_VINE 414 -#define IDS_DESC_ICE 415 -#define IDS_DESC_DEAD_BUSH 416 -#define IDS_DESC_BLAZE_ROD 417 -#define IDS_DESC_GHAST_TEAR 418 -#define IDS_DESC_GOLD_NUGGET 419 -#define IDS_DESC_NETHER_STALK_SEEDS 420 -#define IDS_DESC_POTION 421 -#define IDS_DESC_GLASS_BOTTLE 422 -#define IDS_DESC_SPIDER_EYE 423 -#define IDS_DESC_FERMENTED_SPIDER_EYE 424 -#define IDS_DESC_BLAZE_POWDER 425 -#define IDS_DESC_MAGMA_CREAM 426 -#define IDS_DESC_BREWING_STAND 427 -#define IDS_DESC_CAULDRON 428 -#define IDS_DESC_EYE_OF_ENDER 429 -#define IDS_DESC_SPECKLED_MELON 430 -#define IDS_DESC_MYCEL 431 -#define IDS_DESC_WATERLILY 432 -#define IDS_DESC_NETHERBRICK 433 -#define IDS_DESC_NETHERFENCE 434 -#define IDS_DESC_NETHERSTALK 435 -#define IDS_DESC_ENCHANTMENTTABLE 436 -#define IDS_DESC_END_PORTAL 437 -#define IDS_DESC_ENDPORTALFRAME 438 -#define IDS_DESC_WHITESTONE 439 -#define IDS_DESC_DRAGONEGG 440 -#define IDS_DESC_EXP_BOTTLE 441 -#define IDS_DESC_FIREBALL 442 -#define IDS_DESC_ITEMFRAME 443 -#define IDS_DESC_MONSTER_SPAWNER 444 -#define IDS_DESC_WOODSLAB 445 -#define IDS_DESC_STONESLAB 446 -#define IDS_DESC_ITEM_NETHERBRICK 447 -#define IDS_DESC_REDSTONE_LIGHT 448 -#define IDS_DESC_COCOA 449 -#define IDS_DESC_SKULL 450 -#define IDS_DESC_COMMAND_BLOCK 451 -#define IDS_DESC_BEACON 452 -#define IDS_DESC_CHEST_TRAP 453 -#define IDS_DESC_WEIGHTED_PLATE_LIGHT 454 -#define IDS_DESC_WEIGHTED_PLATE_HEAVY 455 -#define IDS_DESC_REDSTONE_BLOCK 456 -#define IDS_DESC_HOPPER 457 -#define IDS_DESC_ACTIVATOR_RAIL 458 -#define IDS_DESC_DROPPER 459 -#define IDS_DESC_STAINED_CLAY 460 -#define IDS_DESC_HAY 461 -#define IDS_DESC_HARDENED_CLAY 462 -#define IDS_DESC_STAINED_GLASS 463 -#define IDS_DESC_STAINED_GLASS_PANE 464 -#define IDS_DESC_COAL_BLOCK 465 -#define IDS_SQUID 466 -#define IDS_DESC_SQUID 467 -#define IDS_COW 468 -#define IDS_DESC_COW 469 -#define IDS_SHEEP 470 -#define IDS_DESC_SHEEP 471 -#define IDS_CHICKEN 472 -#define IDS_DESC_CHICKEN 473 -#define IDS_PIG 474 -#define IDS_DESC_PIG 475 -#define IDS_WOLF 476 -#define IDS_DESC_WOLF 477 -#define IDS_CREEPER 478 -#define IDS_DESC_CREEPER 479 -#define IDS_SKELETON 480 -#define IDS_DESC_SKELETON 481 -#define IDS_SPIDER 482 -#define IDS_DESC_SPIDER 483 -#define IDS_ZOMBIE 484 -#define IDS_DESC_ZOMBIE 485 -#define IDS_PIGZOMBIE 486 -#define IDS_DESC_PIGZOMBIE 487 -#define IDS_GHAST 488 -#define IDS_DESC_GHAST 489 -#define IDS_SLIME 490 -#define IDS_DESC_SLIME 491 -#define IDS_ENDERMAN 492 -#define IDS_DESC_ENDERMAN 493 -#define IDS_SILVERFISH 494 -#define IDS_DESC_SILVERFISH 495 -#define IDS_CAVE_SPIDER 496 -#define IDS_DESC_CAVE_SPIDER 497 -#define IDS_MUSHROOM_COW 498 -#define IDS_DESC_MUSHROOM_COW 499 -#define IDS_SNOWMAN 500 -#define IDS_DESC_SNOWMAN 501 -#define IDS_ENDERDRAGON 502 -#define IDS_DESC_ENDERDRAGON 503 -#define IDS_BLAZE 504 -#define IDS_DESC_BLAZE 505 -#define IDS_LAVA_SLIME 506 -#define IDS_DESC_LAVA_SLIME 507 -#define IDS_VILLAGER 508 -#define IDS_OZELOT 509 -#define IDS_DESC_OZELOT 510 -#define IDS_IRONGOLEM 511 -#define IDS_DESC_IRONGOLEM 512 -#define IDS_BAT 513 -#define IDS_DESC_BAT 514 -#define IDS_WITCH 515 -#define IDS_DESC_WITCH 516 -#define IDS_HORSE 517 -#define IDS_DESC_HORSE 518 -#define IDS_DONKEY 519 -#define IDS_DESC_DONKEY 520 -#define IDS_MULE 521 -#define IDS_DESC_MULE 522 -#define IDS_ZOMBIE_HORSE 523 -#define IDS_SKELETON_HORSE 524 -#define IDS_WITHER 525 -#define IDS_DESC_WITHER 526 -#define IDS_CREDITS_EXPLODANIM 527 -#define IDS_CREDITS_CONCEPTART 528 -#define IDS_CREDITS_CRUNCHER 529 -#define IDS_CREDITS_BULLYCOORD 530 -#define IDS_CREDITS_ORIGINALDESIGN 531 -#define IDS_CREDITS_PMPROD 532 -#define IDS_CREDITS_RESTOFMOJANG 533 -#define IDS_CREDITS_LEADPC 534 -#define IDS_CREDITS_CODENINJA 535 -#define IDS_CREDITS_CEO 536 -#define IDS_CREDITS_WCW 537 -#define IDS_CREDITS_CUSTOMERSUPPORT 538 -#define IDS_CREDITS_OFFICEDJ 539 -#define IDS_CREDITS_DESPROG 540 -#define IDS_CREDITS_DEVELOPER 541 -#define IDS_CREDITS_CHIEFARCHITECT 542 -#define IDS_CREDITS_ARTDEVELOPER 543 -#define IDS_CREDITS_GAMECRAFTER 544 -#define IDS_CREDITS_DOF 545 -#define IDS_CREDITS_MUSICANDSOUNDS 546 -#define IDS_CREDITS_PROGRAMMING 547 -#define IDS_CREDITS_ART 548 -#define IDS_CREDITS_QA 549 -#define IDS_CREDITS_EXECPRODUCER 550 -#define IDS_CREDITS_LEADPRODUCER 551 -#define IDS_CREDITS_PRODUCER 552 -#define IDS_CREDITS_TESTLEAD 553 -#define IDS_CREDITS_LEADTESTER 554 -#define IDS_CREDITS_DESIGNTEAM 555 -#define IDS_CREDITS_DEVELOPMENTTEAM 556 -#define IDS_CREDITS_RELEASEMANAGEMENT 557 -#define IDS_CREDITS_XBLADIRECTOR 558 -#define IDS_CREDITS_BIZDEV 559 -#define IDS_CREDITS_PORTFOLIODIRECTOR 560 -#define IDS_CREDITS_PRODUCTMANAGER 561 -#define IDS_CREDITS_MARKETING 562 -#define IDS_CREDITS_COMMUNITYMANAGER 563 -#define IDS_CREDITS_EUROPELOC 564 -#define IDS_CREDITS_REDMONDLOC 565 -#define IDS_CREDITS_ASIALOC 566 -#define IDS_CREDITS_USERRESEARCH 567 -#define IDS_CREDITS_MGSCENTRAL 568 -#define IDS_CREDITS_MILESTONEACCEPT 569 -#define IDS_CREDITS_SPECIALTHANKS 570 -#define IDS_CREDITS_TESTMANAGER 571 -#define IDS_CREDITS_SRTESTLEAD 572 -#define IDS_CREDITS_SDET 573 -#define IDS_CREDITS_PROJECT 574 -#define IDS_CREDITS_ADDITIONALSTE 575 -#define IDS_CREDITS_TESTASSOCIATES 576 -#define IDS_CREDITS_JON_KAGSTROM 577 -#define IDS_CREDITS_TOBIAS_MOLLSTAM 578 -#define IDS_CREDITS_RISE_LUGO 579 -#define IDS_ITEM_SWORD_WOOD 580 -#define IDS_ITEM_SWORD_STONE 581 -#define IDS_ITEM_SWORD_IRON 582 -#define IDS_ITEM_SWORD_DIAMOND 583 -#define IDS_ITEM_SWORD_GOLD 584 -#define IDS_ITEM_SHOVEL_WOOD 585 -#define IDS_ITEM_SHOVEL_STONE 586 -#define IDS_ITEM_SHOVEL_IRON 587 -#define IDS_ITEM_SHOVEL_DIAMOND 588 -#define IDS_ITEM_SHOVEL_GOLD 589 -#define IDS_ITEM_PICKAXE_WOOD 590 -#define IDS_ITEM_PICKAXE_STONE 591 -#define IDS_ITEM_PICKAXE_IRON 592 -#define IDS_ITEM_PICKAXE_DIAMOND 593 -#define IDS_ITEM_PICKAXE_GOLD 594 -#define IDS_ITEM_HATCHET_WOOD 595 -#define IDS_ITEM_HATCHET_STONE 596 -#define IDS_ITEM_HATCHET_IRON 597 -#define IDS_ITEM_HATCHET_DIAMOND 598 -#define IDS_ITEM_HATCHET_GOLD 599 -#define IDS_ITEM_HOE_WOOD 600 -#define IDS_ITEM_HOE_STONE 601 -#define IDS_ITEM_HOE_IRON 602 -#define IDS_ITEM_HOE_DIAMOND 603 -#define IDS_ITEM_HOE_GOLD 604 -#define IDS_ITEM_DOOR_WOOD 605 -#define IDS_ITEM_DOOR_IRON 606 -#define IDS_ITEM_HELMET_CHAIN 607 -#define IDS_ITEM_CHESTPLATE_CHAIN 608 -#define IDS_ITEM_LEGGINGS_CHAIN 609 -#define IDS_ITEM_BOOTS_CHAIN 610 -#define IDS_ITEM_HELMET_CLOTH 611 -#define IDS_ITEM_HELMET_IRON 612 -#define IDS_ITEM_HELMET_DIAMOND 613 -#define IDS_ITEM_HELMET_GOLD 614 -#define IDS_ITEM_CHESTPLATE_CLOTH 615 -#define IDS_ITEM_CHESTPLATE_IRON 616 -#define IDS_ITEM_CHESTPLATE_DIAMOND 617 -#define IDS_ITEM_CHESTPLATE_GOLD 618 -#define IDS_ITEM_LEGGINGS_CLOTH 619 -#define IDS_ITEM_LEGGINGS_IRON 620 -#define IDS_ITEM_LEGGINGS_DIAMOND 621 -#define IDS_ITEM_LEGGINGS_GOLD 622 -#define IDS_ITEM_BOOTS_CLOTH 623 -#define IDS_ITEM_BOOTS_IRON 624 -#define IDS_ITEM_BOOTS_DIAMOND 625 -#define IDS_ITEM_BOOTS_GOLD 626 -#define IDS_ITEM_INGOT_IRON 627 -#define IDS_ITEM_INGOT_GOLD 628 -#define IDS_ITEM_BUCKET 629 -#define IDS_ITEM_BUCKET_WATER 630 -#define IDS_ITEM_BUCKET_LAVA 631 -#define IDS_ITEM_FLINT_AND_STEEL 632 -#define IDS_ITEM_APPLE 633 -#define IDS_ITEM_BOW 634 -#define IDS_ITEM_ARROW 635 -#define IDS_ITEM_COAL 636 -#define IDS_ITEM_CHARCOAL 637 -#define IDS_ITEM_DIAMOND 638 -#define IDS_ITEM_STICK 639 -#define IDS_ITEM_BOWL 640 -#define IDS_ITEM_MUSHROOM_STEW 641 -#define IDS_ITEM_STRING 642 -#define IDS_ITEM_FEATHER 643 -#define IDS_ITEM_SULPHUR 644 -#define IDS_ITEM_WHEAT_SEEDS 645 -#define IDS_ITEM_WHEAT 646 -#define IDS_ITEM_BREAD 647 -#define IDS_ITEM_FLINT 648 -#define IDS_ITEM_PORKCHOP_RAW 649 -#define IDS_ITEM_PORKCHOP_COOKED 650 -#define IDS_ITEM_PAINTING 651 -#define IDS_ITEM_APPLE_GOLD 652 -#define IDS_ITEM_SIGN 653 -#define IDS_ITEM_MINECART 654 -#define IDS_ITEM_SADDLE 655 -#define IDS_ITEM_REDSTONE 656 -#define IDS_ITEM_SNOWBALL 657 -#define IDS_ITEM_BOAT 658 -#define IDS_ITEM_LEATHER 659 -#define IDS_ITEM_BUCKET_MILK 660 -#define IDS_ITEM_BRICK 661 -#define IDS_ITEM_CLAY 662 -#define IDS_ITEM_REEDS 663 -#define IDS_ITEM_PAPER 664 -#define IDS_ITEM_BOOK 665 -#define IDS_ITEM_SLIMEBALL 666 -#define IDS_ITEM_MINECART_CHEST 667 -#define IDS_ITEM_MINECART_FURNACE 668 -#define IDS_ITEM_EGG 669 -#define IDS_ITEM_COMPASS 670 -#define IDS_ITEM_FISHING_ROD 671 -#define IDS_ITEM_CLOCK 672 -#define IDS_ITEM_YELLOW_DUST 673 -#define IDS_ITEM_FISH_RAW 674 -#define IDS_ITEM_FISH_COOKED 675 -#define IDS_ITEM_DYE_POWDER 676 -#define IDS_ITEM_DYE_POWDER_BLACK 677 -#define IDS_ITEM_DYE_POWDER_RED 678 -#define IDS_ITEM_DYE_POWDER_GREEN 679 -#define IDS_ITEM_DYE_POWDER_BROWN 680 -#define IDS_ITEM_DYE_POWDER_BLUE 681 -#define IDS_ITEM_DYE_POWDER_PURPLE 682 -#define IDS_ITEM_DYE_POWDER_CYAN 683 -#define IDS_ITEM_DYE_POWDER_SILVER 684 -#define IDS_ITEM_DYE_POWDER_GRAY 685 -#define IDS_ITEM_DYE_POWDER_PINK 686 -#define IDS_ITEM_DYE_POWDER_LIME 687 -#define IDS_ITEM_DYE_POWDER_YELLOW 688 -#define IDS_ITEM_DYE_POWDER_LIGHT_BLUE 689 -#define IDS_ITEM_DYE_POWDER_MAGENTA 690 -#define IDS_ITEM_DYE_POWDER_ORANGE 691 -#define IDS_ITEM_DYE_POWDER_WHITE 692 -#define IDS_ITEM_BONE 693 -#define IDS_ITEM_SUGAR 694 -#define IDS_ITEM_CAKE 695 -#define IDS_ITEM_BED 696 -#define IDS_ITEM_DIODE 697 -#define IDS_ITEM_COOKIE 698 -#define IDS_ITEM_MAP 699 -#define IDS_ITEM_MAP_EMPTY 700 -#define IDS_ITEM_RECORD_01 701 -#define IDS_ITEM_RECORD_02 702 -#define IDS_ITEM_RECORD_03 703 -#define IDS_ITEM_RECORD_04 704 -#define IDS_ITEM_RECORD_05 705 -#define IDS_ITEM_RECORD_06 706 -#define IDS_ITEM_RECORD_07 707 -#define IDS_ITEM_RECORD_08 708 -#define IDS_ITEM_RECORD_09 709 -#define IDS_ITEM_RECORD_10 710 -#define IDS_ITEM_RECORD_11 711 -#define IDS_ITEM_RECORD_12 712 -#define IDS_ITEM_SHEARS 713 -#define IDS_ITEM_PUMPKIN_SEEDS 714 -#define IDS_ITEM_MELON_SEEDS 715 -#define IDS_ITEM_CHICKEN_RAW 716 -#define IDS_ITEM_CHICKEN_COOKED 717 -#define IDS_ITEM_BEEF_RAW 718 -#define IDS_ITEM_BEEF_COOKED 719 -#define IDS_ITEM_ROTTEN_FLESH 720 -#define IDS_ITEM_ENDER_PEARL 721 -#define IDS_ITEM_MELON_SLICE 722 -#define IDS_ITEM_BLAZE_ROD 723 -#define IDS_ITEM_GHAST_TEAR 724 -#define IDS_ITEM_GOLD_NUGGET 725 -#define IDS_ITEM_NETHER_STALK_SEEDS 726 -#define IDS_ITEM_POTION 727 -#define IDS_ITEM_GLASS_BOTTLE 728 -#define IDS_ITEM_WATER_BOTTLE 729 -#define IDS_ITEM_SPIDER_EYE 730 -#define IDS_ITEM_FERMENTED_SPIDER_EYE 731 -#define IDS_ITEM_BLAZE_POWDER 732 -#define IDS_ITEM_MAGMA_CREAM 733 -#define IDS_ITEM_BREWING_STAND 734 -#define IDS_ITEM_CAULDRON 735 -#define IDS_ITEM_EYE_OF_ENDER 736 -#define IDS_ITEM_SPECKLED_MELON 737 -#define IDS_ITEM_EXP_BOTTLE 738 -#define IDS_ITEM_FIREBALL 739 -#define IDS_ITEM_FIREBALLCHARCOAL 740 -#define IDS_ITEM_FIREBALLCOAL 741 -#define IDS_ITEM_ITEMFRAME 742 -#define IDS_ITEM_MONSTER_SPAWNER 743 -#define IDS_ITEM_NETHERBRICK 744 -#define IDS_ITEM_SKULL 745 -#define IDS_ITEM_SKULL_SKELETON 746 -#define IDS_ITEM_SKULL_WITHER 747 -#define IDS_ITEM_SKULL_ZOMBIE 748 -#define IDS_ITEM_SKULL_CHARACTER 749 -#define IDS_ITEM_SKULL_PLAYER 750 -#define IDS_ITEM_SKULL_CREEPER 751 -#define IDS_NETHER_STAR 752 -#define IDS_FIREWORKS 753 -#define IDS_FIREWORKS_CHARGE 754 -#define IDS_ITEM_COMPARATOR 755 -#define IDS_ITEM_MINECART_TNT 756 -#define IDS_ITEM_MINECART_HOPPER 757 -#define IDS_ITEM_IRON_HORSE_ARMOR 758 -#define IDS_ITEM_GOLD_HORSE_ARMOR 759 -#define IDS_ITEM_DIAMOND_HORSE_ARMOR 760 -#define IDS_ITEM_LEAD 761 -#define IDS_ITEM_NAME_TAG 762 -#define IDS_TILE_STONE 763 -#define IDS_TILE_GRASS 764 -#define IDS_TILE_DIRT 765 -#define IDS_TILE_STONE_BRICK 766 -#define IDS_TILE_OAKWOOD_PLANKS 767 -#define IDS_TILE_SPRUCEWOOD_PLANKS 768 -#define IDS_TILE_BIRCHWOOD_PLANKS 769 -#define IDS_TILE_JUNGLE_PLANKS 770 -#define IDS_TILE_ACACIA_PLANKS 771 -#define IDS_TILE_DARK_OAK_PLANKS 772 -#define IDS_TILE_PLANKS 773 -#define IDS_TILE_SAPLING 774 -#define IDS_TILE_SAPLING_OAK 775 -#define IDS_TILE_SAPLING_SPRUCE 776 -#define IDS_TILE_SAPLING_BIRCH 777 -#define IDS_TILE_SAPLING_JUNGLE 778 -#define IDS_TILE_BEDROCK 779 -#define IDS_TILE_WATER 780 -#define IDS_TILE_LAVA 781 -#define IDS_TILE_SAND 782 -#define IDS_TILE_SANDSTONE 783 -#define IDS_TILE_GRAVEL 784 -#define IDS_TILE_ORE_GOLD 785 -#define IDS_TILE_ORE_IRON 786 -#define IDS_TILE_ORE_COAL 787 -#define IDS_TILE_LOG 788 -#define IDS_TILE_LOG_OAK 789 -#define IDS_TILE_LOG_SPRUCE 790 -#define IDS_TILE_LOG_BIRCH 791 -#define IDS_TILE_LOG_JUNGLE 792 -#define IDS_TILE_LOG_ACACIA 793 -#define IDS_TILE_LOG_DARK_OAK 794 -#define IDS_TILE_OAK 795 -#define IDS_TILE_SPRUCE 796 -#define IDS_TILE_BIRCH 797 -#define IDS_TILE_LEAVES 798 -#define IDS_TILE_LEAVES_OAK 799 -#define IDS_TILE_LEAVES_SPRUCE 800 -#define IDS_TILE_LEAVES_BIRCH 801 -#define IDS_TILE_LEAVES_JUNGLE 802 -#define IDS_TILE_LEAVES_ACACIA 803 -#define IDS_TILE_LEAVES_DARK_OAK 804 -#define IDS_TILE_SPONGE 805 -#define IDS_TILE_GLASS 806 -#define IDS_TILE_CLOTH 807 -#define IDS_TILE_CLOTH_BLACK 808 -#define IDS_TILE_CLOTH_RED 809 -#define IDS_TILE_CLOTH_GREEN 810 -#define IDS_TILE_CLOTH_BROWN 811 -#define IDS_TILE_CLOTH_BLUE 812 -#define IDS_TILE_CLOTH_PURPLE 813 -#define IDS_TILE_CLOTH_CYAN 814 -#define IDS_TILE_CLOTH_SILVER 815 -#define IDS_TILE_CLOTH_GRAY 816 -#define IDS_TILE_CLOTH_PINK 817 -#define IDS_TILE_CLOTH_LIME 818 -#define IDS_TILE_CLOTH_YELLOW 819 -#define IDS_TILE_CLOTH_LIGHT_BLUE 820 -#define IDS_TILE_CLOTH_MAGENTA 821 -#define IDS_TILE_CLOTH_ORANGE 822 -#define IDS_TILE_CLOTH_WHITE 823 -#define IDS_TILE_FLOWER 824 -#define IDS_TILE_ROSE 825 -#define IDS_TILE_MUSHROOM 826 -#define IDS_TILE_BLOCK_GOLD 827 -#define IDS_DESC_BLOCK_GOLD 828 -#define IDS_DESC_BLOCK_IRON 829 -#define IDS_TILE_BLOCK_IRON 830 -#define IDS_TILE_STONESLAB 831 -#define IDS_TILE_STONESLAB_STONE 832 -#define IDS_TILE_STONESLAB_SAND 833 -#define IDS_TILE_STONESLAB_WOOD 834 -#define IDS_TILE_STONESLAB_COBBLE 835 -#define IDS_TILE_STONESLAB_BRICK 836 -#define IDS_TILE_STONESLAB_SMOOTHBRICK 837 -#define IDS_TILE_STONESLAB_OAK 838 -#define IDS_TILE_STONESLAB_SPRUCE 839 -#define IDS_TILE_STONESLAB_BIRCH 840 -#define IDS_TILE_STONESLAB_JUNGLE 841 -#define IDS_TILE_STONESLAB_NETHERBRICK 842 -#define IDS_TILE_BRICK 843 -#define IDS_TILE_TNT 844 -#define IDS_TILE_BOOKSHELF 845 -#define IDS_TILE_STONE_MOSS 846 -#define IDS_TILE_OBSIDIAN 847 -#define IDS_TILE_TORCH 848 -#define IDS_TILE_TORCHCOAL 849 -#define IDS_TILE_TORCHCHARCOAL 850 -#define IDS_TILE_FIRE 851 -#define IDS_TILE_MOB_SPAWNER 852 -#define IDS_TILE_STAIRS_WOOD 853 -#define IDS_TILE_CHEST 854 -#define IDS_TILE_REDSTONE_DUST 855 -#define IDS_TILE_ORE_DIAMOND 856 -#define IDS_TILE_BLOCK_DIAMOND 857 -#define IDS_DESC_BLOCK_DIAMOND 858 -#define IDS_TILE_WORKBENCH 859 -#define IDS_TILE_CROPS 860 -#define IDS_TILE_FARMLAND 861 -#define IDS_TILE_FURNACE 862 -#define IDS_TILE_SIGN 863 -#define IDS_TILE_DOOR_WOOD 864 -#define IDS_TILE_DOOR_SPRUCE 865 -#define IDS_TILE_DOOR_BIRCH 866 -#define IDS_TILE_DOOR_JUNGLE 867 -#define IDS_TILE_DOOR_ACACIA 868 -#define IDS_TILE_DOOR_DARK_OAK 869 -#define IDS_TILE_LADDER 870 -#define IDS_TILE_RAIL 871 -#define IDS_TILE_GOLDEN_RAIL 872 -#define IDS_TILE_DETECTOR_RAIL 873 -#define IDS_TILE_STAIRS_STONE 874 -#define IDS_TILE_LEVER 875 -#define IDS_TILE_PRESSURE_PLATE 876 -#define IDS_TILE_DOOR_IRON 877 -#define IDS_TILE_ORE_REDSTONE 878 -#define IDS_TILE_NOT_GATE 879 -#define IDS_TILE_BUTTON 880 -#define IDS_TILE_SNOW 881 -#define IDS_TILE_ICE 882 -#define IDS_TILE_CACTUS 883 -#define IDS_TILE_CLAY 884 -#define IDS_TILE_REEDS 885 -#define IDS_TILE_JUKEBOX 886 -#define IDS_TILE_FENCE 887 -#define IDS_TILE_FENCE_SPRUCE 888 -#define IDS_TILE_FENCE_BIRCH 889 -#define IDS_TILE_FENCE_JUNGLE 890 -#define IDS_TILE_FENCE_ACACIA 891 -#define IDS_TILE_FENCE_DARK_OAK 892 -#define IDS_TILE_PUMPKIN 893 -#define IDS_TILE_LIT_PUMPKIN 894 -#define IDS_TILE_HELL_ROCK 895 -#define IDS_TILE_HELL_SAND 896 -#define IDS_TILE_LIGHT_GEM 897 -#define IDS_TILE_PORTAL 898 -#define IDS_TILE_ORE_LAPIS 899 -#define IDS_TILE_BLOCK_LAPIS 900 -#define IDS_DESC_BLOCK_LAPIS 901 -#define IDS_TILE_DISPENSER 902 -#define IDS_TILE_MUSIC_BLOCK 903 -#define IDS_TILE_CAKE 904 -#define IDS_TILE_BED 905 -#define IDS_TILE_WEB 906 -#define IDS_TILE_TALL_GRASS 907 -#define IDS_TILE_DEAD_BUSH 908 -#define IDS_TILE_DIODE 909 -#define IDS_TILE_LOCKED_CHEST 910 -#define IDS_TILE_TRAPDOOR 911 -#define IDS_TILE_TRAPDOOR_IRON 912 -#define IDS_ANY_WOOL 913 -#define IDS_TILE_PISTON_BASE 914 -#define IDS_TILE_PISTON_STICK_BASE 915 -#define IDS_TILE_MONSTER_STONE_EGG 916 -#define IDS_TILE_STONE_BRICK_SMOOTH 917 -#define IDS_TILE_STONE_BRICK_SMOOTH_MOSSY 918 -#define IDS_TILE_STONE_BRICK_SMOOTH_CRACKED 919 -#define IDS_TILE_STONE_BRICK_SMOOTH_CHISELED 920 -#define IDS_TILE_HUGE_MUSHROOM_1 921 -#define IDS_TILE_HUGE_MUSHROOM_2 922 -#define IDS_TILE_IRON_FENCE 923 -#define IDS_TILE_THIN_GLASS 924 -#define IDS_TILE_MELON 925 -#define IDS_TILE_PUMPKIN_STEM 926 -#define IDS_TILE_MELON_STEM 927 -#define IDS_TILE_VINE 928 -#define IDS_TILE_FENCE_GATE 929 -#define IDS_TILE_FENCE_GATE_SPRUCE 930 -#define IDS_TILE_FENCE_GATE_BIRCH 931 -#define IDS_TILE_FENCE_GATE_JUNGLE 932 -#define IDS_TILE_FENCE_GATE_ACACIA 933 -#define IDS_TILE_FENCE_GATE_DARK_OAK 934 -#define IDS_TILE_STAIRS_BRICKS 935 -#define IDS_TILE_STAIRS_STONE_BRICKS_SMOOTH 936 -#define IDS_TILE_STONE_SILVERFISH 937 -#define IDS_TILE_STONE_SILVERFISH_COBBLESTONE 938 -#define IDS_TILE_STONE_SILVERFISH_STONE_BRICK 939 -#define IDS_TILE_MYCEL 940 -#define IDS_TILE_WATERLILY 941 -#define IDS_TILE_NETHERBRICK 942 -#define IDS_TILE_NETHERFENCE 943 -#define IDS_TILE_STAIRS_NETHERBRICK 944 -#define IDS_TILE_NETHERSTALK 945 -#define IDS_TILE_ENCHANTMENTTABLE 946 -#define IDS_TILE_BREWINGSTAND 947 -#define IDS_TILE_CAULDRON 948 -#define IDS_TILE_END_PORTAL 949 -#define IDS_TILE_ENDPORTALFRAME 950 -#define IDS_TILE_WHITESTONE 951 -#define IDS_TILE_DRAGONEGG 952 -#define IDS_TILE_SHRUB 953 -#define IDS_TILE_FERN 954 -#define IDS_TILE_STAIRS_SANDSTONE 955 -#define IDS_TILE_STAIRS_SPRUCEWOOD 956 -#define IDS_TILE_STAIRS_BIRCHWOOD 957 -#define IDS_TILE_STAIRS_JUNGLEWOOD 958 -#define IDS_TILE_STAIRS_ACACIA_WOOD 959 -#define IDS_TILE_STAIRS_DARK_OAK_WOOD 960 -#define IDS_TILE_REDSTONE_LIGHT 961 -#define IDS_TILE_COCOA 962 -#define IDS_TILE_SKULL 963 -#define IDS_TILE_COMMAND_BLOCK 964 -#define IDS_TILE_BEACON 965 -#define IDS_TILE_CHEST_TRAP 966 -#define IDS_TILE_WEIGHTED_PLATE_LIGHT 967 -#define IDS_TILE_WEIGHTED_PLATE_HEAVY 968 -#define IDS_TILE_COMPARATOR 969 -#define IDS_TILE_DAYLIGHT_DETECTOR 970 -#define IDS_TILE_REDSTONE_BLOCK 971 -#define IDS_TILE_HOPPER 972 -#define IDS_TILE_ACTIVATOR_RAIL 973 -#define IDS_TILE_DROPPER 974 -#define IDS_TILE_STAINED_CLAY 975 -#define IDS_TILE_HAY 976 -#define IDS_TILE_HARDENED_CLAY 977 -#define IDS_TILE_COAL 978 -#define IDS_TILE_STAINED_CLAY_BLACK 979 -#define IDS_TILE_STAINED_CLAY_RED 980 -#define IDS_TILE_STAINED_CLAY_GREEN 981 -#define IDS_TILE_STAINED_CLAY_BROWN 982 -#define IDS_TILE_STAINED_CLAY_BLUE 983 -#define IDS_TILE_STAINED_CLAY_PURPLE 984 -#define IDS_TILE_STAINED_CLAY_CYAN 985 -#define IDS_TILE_STAINED_CLAY_SILVER 986 -#define IDS_TILE_STAINED_CLAY_GRAY 987 -#define IDS_TILE_STAINED_CLAY_PINK 988 -#define IDS_TILE_STAINED_CLAY_LIME 989 -#define IDS_TILE_STAINED_CLAY_YELLOW 990 -#define IDS_TILE_STAINED_CLAY_LIGHT_BLUE 991 -#define IDS_TILE_STAINED_CLAY_MAGENTA 992 -#define IDS_TILE_STAINED_CLAY_ORANGE 993 -#define IDS_TILE_STAINED_CLAY_WHITE 994 -#define IDS_TILE_STAINED_GLASS 995 -#define IDS_TILE_STAINED_GLASS_BLACK 996 -#define IDS_TILE_STAINED_GLASS_RED 997 -#define IDS_TILE_STAINED_GLASS_GREEN 998 -#define IDS_TILE_STAINED_GLASS_BROWN 999 -#define IDS_TILE_STAINED_GLASS_BLUE 1000 -#define IDS_TILE_STAINED_GLASS_PURPLE 1001 -#define IDS_TILE_STAINED_GLASS_CYAN 1002 -#define IDS_TILE_STAINED_GLASS_SILVER 1003 -#define IDS_TILE_STAINED_GLASS_GRAY 1004 -#define IDS_TILE_STAINED_GLASS_PINK 1005 -#define IDS_TILE_STAINED_GLASS_LIME 1006 -#define IDS_TILE_STAINED_GLASS_YELLOW 1007 -#define IDS_TILE_STAINED_GLASS_LIGHT_BLUE 1008 -#define IDS_TILE_STAINED_GLASS_MAGENTA 1009 -#define IDS_TILE_STAINED_GLASS_ORANGE 1010 -#define IDS_TILE_STAINED_GLASS_WHITE 1011 -#define IDS_TILE_STAINED_GLASS_PANE 1012 -#define IDS_TILE_STAINED_GLASS_PANE_BLACK 1013 -#define IDS_TILE_STAINED_GLASS_PANE_RED 1014 -#define IDS_TILE_STAINED_GLASS_PANE_GREEN 1015 -#define IDS_TILE_STAINED_GLASS_PANE_BROWN 1016 -#define IDS_TILE_STAINED_GLASS_PANE_BLUE 1017 -#define IDS_TILE_STAINED_GLASS_PANE_PURPLE 1018 -#define IDS_TILE_STAINED_GLASS_PANE_CYAN 1019 -#define IDS_TILE_STAINED_GLASS_PANE_SILVER 1020 -#define IDS_TILE_STAINED_GLASS_PANE_GRAY 1021 -#define IDS_TILE_STAINED_GLASS_PANE_PINK 1022 -#define IDS_TILE_STAINED_GLASS_PANE_LIME 1023 -#define IDS_TILE_STAINED_GLASS_PANE_YELLOW 1024 -#define IDS_TILE_STAINED_GLASS_PANE_LIGHT_BLUE 1025 -#define IDS_TILE_STAINED_GLASS_PANE_MAGENTA 1026 -#define IDS_TILE_STAINED_GLASS_PANE_ORANGE 1027 -#define IDS_TILE_STAINED_GLASS_PANE_WHITE 1028 -#define IDS_FIREWORKS_CHARGE_TYPE_0 1029 -#define IDS_FIREWORKS_CHARGE_TYPE_1 1030 -#define IDS_FIREWORKS_CHARGE_TYPE_2 1031 -#define IDS_FIREWORKS_CHARGE_TYPE_3 1032 -#define IDS_FIREWORKS_CHARGE_TYPE_4 1033 -#define IDS_FIREWORKS_CHARGE_TYPE 1034 -#define IDS_FIREWORKS_CHARGE_BLACK 1035 -#define IDS_FIREWORKS_CHARGE_RED 1036 -#define IDS_FIREWORKS_CHARGE_GREEN 1037 -#define IDS_FIREWORKS_CHARGE_BROWN 1038 -#define IDS_FIREWORKS_CHARGE_BLUE 1039 -#define IDS_FIREWORKS_CHARGE_PURPLE 1040 -#define IDS_FIREWORKS_CHARGE_CYAN 1041 -#define IDS_FIREWORKS_CHARGE_SILVER 1042 -#define IDS_FIREWORKS_CHARGE_GRAY 1043 -#define IDS_FIREWORKS_CHARGE_PINK 1044 -#define IDS_FIREWORKS_CHARGE_LIME 1045 -#define IDS_FIREWORKS_CHARGE_YELLOW 1046 -#define IDS_FIREWORKS_CHARGE_LIGHT_BLUE 1047 -#define IDS_FIREWORKS_CHARGE_MAGENTA 1048 -#define IDS_FIREWORKS_CHARGE_ORANGE 1049 -#define IDS_FIREWORKS_CHARGE_WHITE 1050 -#define IDS_FIREWORKS_CHARGE_CUSTOM 1051 -#define IDS_FIREWORKS_CHARGE_FADE_TO 1052 -#define IDS_FIREWORKS_CHARGE_FLICKER 1053 -#define IDS_FIREWORKS_CHARGE_TRAIL 1054 -#define IDS_ITEM_FIREWORKS_FLIGHT 1055 -#define IDS_CURRENT_LAYOUT 1056 -#define IDS_CONTROLS_LAYOUT 1057 -#define IDS_CONTROLS_MOVE 1058 -#define IDS_CONTROLS_LOOK 1059 -#define IDS_CONTROLS_PAUSE 1060 -#define IDS_CONTROLS_JUMP 1061 -#define IDS_CONTROLS_JUMPFLY 1062 -#define IDS_CONTROLS_INVENTORY 1063 -#define IDS_CONTROLS_HELDITEM 1064 -#define IDS_CONTROLS_ACTION 1065 -#define IDS_CONTROLS_USE 1066 -#define IDS_CONTROLS_CRAFTING 1067 -#define IDS_CONTROLS_DROP 1068 -#define IDS_CONTROLS_SNEAK 1069 -#define IDS_CONTROLS_SNEAKFLY 1070 -#define IDS_CONTROLS_THIRDPERSON 1071 -#define IDS_CONTROLS_PLAYERS 1072 -#define IDS_CONTROLS_DPAD 1073 -#define IDS_CONTROLS_SCHEME0 1074 -#define IDS_CONTROLS_SCHEME1 1075 -#define IDS_CONTROLS_SCHEME2 1076 -#define IDS_CONTROLLER_A 1077 -#define IDS_CONTROLLER_B 1078 -#define IDS_CONTROLLER_X 1079 -#define IDS_CONTROLLER_Y 1080 -#define IDS_CONTROLLER_LEFT_STICK 1081 -#define IDS_CONTROLLER_RIGHT_STICK 1082 -#define IDS_CONTROLLER_LEFT_TRIGGER 1083 -#define IDS_CONTROLLER_RIGHT_TRIGGER 1084 -#define IDS_CONTROLLER_LEFT_BUMPER 1085 -#define IDS_CONTROLLER_RIGHT_BUMPER 1086 -#define IDS_CONTROLLER_BACK 1087 -#define IDS_CONTROLLER_START 1088 -#define IDS_CONTROLLER_RIGHT_THUMBSTICK 1089 -#define IDS_CONTROLLER_LEFT_THUMBSTICK 1090 -#define IDS_CONTROLLER_DPAD_R 1091 -#define IDS_CONTROLLER_DPAD_L 1092 -#define IDS_CONTROLLER_DPAD_U 1093 -#define IDS_CONTROLLER_DPAD_D 1094 -#define IDS_ICON_SHANK_01 1095 -#define IDS_ICON_SHANK_03 1096 -#define IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE 1097 -#define IDS_TUTORIAL_PROMPT_START_TUTORIAL 1098 -#define IDS_TUTORIAL_TASK_OVERVIEW 1099 -#define IDS_TUTORIAL_TASK_LOOK 1100 -#define IDS_TUTORIAL_TASK_MOVE 1101 -#define IDS_TUTORIAL_TASK_SPRINT 1102 -#define IDS_TUTORIAL_TASK_JUMP 1103 -#define IDS_TUTORIAL_TASK_MINE 1104 -#define IDS_TUTORIAL_TASK_CHOP_WOOD 1105 -#define IDS_TUTORIAL_TASK_CRAFTING 1106 -#define IDS_TUTORIAL_TASK_INVENTORY 1107 -#define IDS_TUTORIAL_TASK_FOOD_BAR_DEPLETE 1108 -#define IDS_TUTORIAL_TASK_FOOD_BAR_HEAL 1109 -#define IDS_TUTORIAL_TASK_FOOD_BAR_FEED 1110 -#define IDS_TUTORIAL_TASK_FOOD_BAR_EAT_STEAK 1111 -#define IDS_TUTORIAL_TASK_CREATE_PLANKS 1112 -#define IDS_TUTORIAL_TASK_CREATE_CRAFTING_TABLE 1113 -#define IDS_TUTORIAL_TASK_CREATE_STICKS 1114 -#define IDS_TUTORIAL_TASK_SCROLL 1115 -#define IDS_TUTORIAL_TASK_USE 1116 -#define IDS_TUTORIAL_TASK_PLACE_WORKBENCH 1117 -#define IDS_TUTORIAL_TASK_OPEN_WORKBENCH 1118 -#define IDS_TUTORIAL_TASK_CREATE_WOODEN_SHOVEL 1119 -#define IDS_TUTORIAL_TASK_CREATE_WOODEN_HATCHET 1120 -#define IDS_TUTORIAL_TASK_CREATE_WOODEN_PICKAXE 1121 -#define IDS_TUTORIAL_TASK_OPEN_CONTAINER 1122 -#define IDS_TUTORIAL_TASK_NIGHT_DANGER 1123 -#define IDS_TUTORIAL_TASK_NEARBY_SHELTER 1124 -#define IDS_TUTORIAL_TASK_COLLECT_RESOURCES 1125 -#define IDS_TUTORIAL_TASK_MINE_STONE 1126 -#define IDS_TUTORIAL_TASK_CREATE_FURNACE 1127 -#define IDS_TUTORIAL_TASK_PLACE_AND_OPEN_FURNACE 1128 -#define IDS_TUTORIAL_TASK_CREATE_CHARCOAL 1129 -#define IDS_TUTORIAL_TASK_CREATE_GLASS 1130 -#define IDS_TUTORIAL_TASK_CREATE_WOODEN_DOOR 1131 -#define IDS_TUTORIAL_TASK_PLACE_DOOR 1132 -#define IDS_TUTORIAL_TASK_CREATE_TORCH 1133 -#define IDS_TUTORIAL_TASK_BASIC_COMPLETE 1134 -#define IDS_TUTORIAL_PROMPT_BASIC_COMPLETE 1135 -#define IDS_TUTORIAL_TASK_INV_OVERVIEW 1136 -#define IDS_TUTORIAL_PROMPT_INV_OVERVIEW 1137 -#define IDS_TUTORIAL_TASK_INV_PICK_UP 1138 -#define IDS_TUTORIAL_TASK_INV_MOVE 1139 -#define IDS_TUTORIAL_TASK_INV_DROP 1140 -#define IDS_TUTORIAL_TASK_INV_INFO 1141 -#define IDS_TUTORIAL_TASK_INV_EXIT 1142 -#define IDS_TUTORIAL_TASK_CREATIVE_INV_OVERVIEW 1143 -#define IDS_TUTORIAL_PROMPT_CREATIVE_INV_OVERVIEW 1144 -#define IDS_TUTORIAL_TASK_CREATIVE_INV_PICK_UP 1145 -#define IDS_TUTORIAL_TASK_CREATIVE_INV_MOVE 1146 -#define IDS_TUTORIAL_TASK_CREATIVE_INV_DROP 1147 -#define IDS_TUTORIAL_TASK_CREATIVE_INV_NAV 1148 -#define IDS_TUTORIAL_TASK_CREATIVE_INV_INFO 1149 -#define IDS_TUTORIAL_TASK_CREATIVE_INV_EXIT 1150 -#define IDS_TUTORIAL_TASK_CRAFT_OVERVIEW 1151 -#define IDS_TUTORIAL_PROMPT_CRAFT_OVERVIEW 1152 -#define IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_DESCRIPTION 1153 -#define IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_INGREDIENTS 1154 -#define IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_INVENTORY 1155 -#define IDS_TUTORIAL_TASK_CRAFT_NAV 1156 -#define IDS_TUTORIAL_TASK_CRAFT_CREATE 1157 -#define IDS_TUTORIAL_TASK_CRAFT_CRAFT_TABLE 1158 -#define IDS_TUTORIAL_TASK_CRAFT_INVENTORY 1159 -#define IDS_TUTORIAL_TASK_CRAFT_DESCRIPTION 1160 -#define IDS_TUTORIAL_TASK_CRAFT_INGREDIENTS 1161 -#define IDS_TUTORIAL_TASK_CRAFT_CREATE_PLANKS 1162 -#define IDS_TUTORIAL_TASK_CRAFT_EXIT_AND_PLACE_TABLE 1163 -#define IDS_TUTORIAL_TASK_CRAFT_SELECT_TOOLS 1164 -#define IDS_TUTORIAL_TASK_CRAFT_SELECT_STRUCTURES 1165 -#define IDS_TUTORIAL_TASK_CRAFT_SELECT_WOODEN_SHOVEL 1166 -#define IDS_TUTORIAL_TASK_CRAFT_SELECT_CRAFTING_TABLE 1167 -#define IDS_TUTORIAL_TASK_CRAFT_TOOLS_BUILT 1168 -#define IDS_TUTORIAL_TASK_CRAFT_CREATE_FURNACE 1169 -#define IDS_TUTORIAL_TASK_CRAFT_EXIT_AND_PLACE_FURNACE 1170 -#define IDS_TUTORIAL_TASK_FURNACE_OVERVIEW 1171 -#define IDS_TUTORIAL_PROMPT_FURNACE_OVERVIEW 1172 -#define IDS_TUTORIAL_TASK_FURNACE_METHOD 1173 -#define IDS_TUTORIAL_TASK_FURNACE_FUELS 1174 -#define IDS_TUTORIAL_TASK_FURNACE_INGREDIENTS 1175 -#define IDS_TUTORIAL_TASK_FURNACE_CREATE_CHARCOAL 1176 -#define IDS_TUTORIAL_TASK_FURNACE_CHARCOAL_USES 1177 -#define IDS_TUTORIAL_TASK_FURNACE_CREATE_GLASS 1178 -#define IDS_TUTORIAL_TASK_BREWING_MENU_OVERVIEW 1179 -#define IDS_TUTORIAL_PROMPT_BREWING_MENU_OVERVIEW 1180 -#define IDS_TUTORIAL_TASK_BREWING_MENU_METHOD 1181 -#define IDS_TUTORIAL_TASK_BREWING_MENU_BASIC_INGREDIENTS 1182 -#define IDS_TUTORIAL_TASK_BREWING_MENU_EXTENDED_INGREDIENTS 1183 -#define IDS_TUTORIAL_TASK_BREWING_MENU_EXTENDED_INGREDIENTS_2 1184 -#define IDS_TUTORIAL_TASK_BREWING_MENU_CREATE_FIRE_POTION 1185 -#define IDS_TUTORIAL_TASK_BREWING_MENU_EXIT 1186 -#define IDS_TUTORIAL_TASK_BREWING_OVERVIEW 1187 -#define IDS_TUTORIAL_PROMPT_BREWING_OVERVIEW 1188 -#define IDS_TUTORIAL_TASK_BREWING_GET_GLASS_BOTTLE 1189 -#define IDS_TUTORIAL_TASK_BREWING_FILL_GLASS_BOTTLE 1190 -#define IDS_TUTORIAL_TASK_BREWING_FILL_CAULDRON 1191 -#define IDS_TUTORIAL_TASK_BREWING_CREATE_FIRE_POTION 1192 -#define IDS_TUTORIAL_TASK_BREWING_USE_POTION 1193 -#define IDS_TUTORIAL_TASK_BREWING_DRINK_FIRE_POTION 1194 -#define IDS_TUTORIAL_TASK_BREWING_USE_EFFECTS 1195 -#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_OVERVIEW 1196 -#define IDS_TUTORIAL_PROMPT_ENCHANTING_MENU_OVERVIEW 1197 -#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_START 1198 -#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_ENCHANTMENTS 1199 -#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_COST 1200 -#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_ENCHANT 1201 -#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_BETTER_ENCHANTMENTS 1202 -#define IDS_TUTORIAL_TASK_ENCHANTING_OVERVIEW 1203 -#define IDS_TUTORIAL_PROMPT_ENCHANTING_OVERVIEW 1204 -#define IDS_TUTORIAL_TASK_ENCHANTING_SUMMARY 1205 -#define IDS_TUTORIAL_TASK_ENCHANTING_BOOKCASES 1206 -#define IDS_TUTORIAL_TASK_ENCHANTING_EXPERIENCE 1207 -#define IDS_TUTORIAL_TASK_ENCHANTING_BOTTLE_O_ENCHANTING 1208 -#define IDS_TUTORIAL_TASK_ENCHANTING_USE_CHESTS 1209 -#define IDS_TUTORIAL_TASK_MINECART_OVERVIEW 1210 -#define IDS_TUTORIAL_PROMPT_MINECART_OVERVIEW 1211 -#define IDS_TUTORIAL_TASK_MINECART_RAILS 1212 -#define IDS_TUTORIAL_TASK_MINECART_POWERED_RAILS 1213 -#define IDS_TUTORIAL_TASK_BOAT_OVERVIEW 1214 -#define IDS_TUTORIAL_PROMPT_BOAT_OVERVIEW 1215 -#define IDS_TUTORIAL_TASK_BOAT_STEER 1216 -#define IDS_TUTORIAL_TASK_FISHING_OVERVIEW 1217 -#define IDS_TUTORIAL_PROMPT_FISHING_OVERVIEW 1218 -#define IDS_TUTORIAL_TASK_FISHING_CAST 1219 -#define IDS_TUTORIAL_TASK_FISHING_FISH 1220 -#define IDS_TUTORIAL_TASK_FISHING_USES 1221 -#define IDS_TUTORIAL_TASK_BED_OVERVIEW 1222 -#define IDS_TUTORIAL_PROMPT_BED_OVERVIEW 1223 -#define IDS_TUTORIAL_TASK_BED_PLACEMENT 1224 -#define IDS_TUTORIAL_TASK_BED_MULTIPLAYER 1225 -#define IDS_TUTORIAL_REDSTONE_OVERVIEW 1226 -#define IDS_TUTORIAL_PROMPT_REDSTONE_OVERVIEW 1227 -#define IDS_TUTORIAL_TASK_REDSTONE_POWER_SOURCES 1228 -#define IDS_TUTORIAL_TASK_REDSTONE_POWER_SOURCES_POSITION 1229 -#define IDS_TUTORIAL_TASK_REDSTONE_DUST 1230 -#define IDS_TUTORIAL_TASK_REDSTONE_REPEATER 1231 -#define IDS_TUTORIAL_TASK_PISTONS 1232 -#define IDS_TUTORIAL_TASK_TRY_IT 1233 -#define IDS_TUTORIAL_PORTAL_OVERVIEW 1234 -#define IDS_TUTORIAL_PROMPT_PORTAL_OVERVIEW 1235 -#define IDS_TUTORIAL_TASK_BUILD_PORTAL 1236 -#define IDS_TUTORIAL_TASK_ACTIVATE_PORTAL 1237 -#define IDS_TUTORIAL_TASK_USE_PORTAL 1238 -#define IDS_TUTORIAL_TASK_NETHER 1239 -#define IDS_TUTORIAL_TASK_NETHER_FAST_TRAVEL 1240 -#define IDS_TUTORIAL_CREATIVE_OVERVIEW 1241 -#define IDS_TUTORIAL_PROMPT_CREATIVE_OVERVIEW 1242 -#define IDS_TUTORIAL_TASK_CREATIVE_MODE 1243 -#define IDS_TUTORIAL_TASK_OPEN_CREATIVE_INVENTORY 1244 -#define IDS_TUTORIAL_TASK_CREATIVE_EXIT 1245 -#define IDS_TUTORIAL_TASK_CREATIVE_COMPLETE 1246 -#define IDS_TUTORIAL_FARMING_OVERVIEW 1247 -#define IDS_TUTORIAL_PROMPT_FARMING_OVERVIEW 1248 -#define IDS_TUTORIAL_TASK_FARMING_SEEDS 1249 -#define IDS_TUTORIAL_TASK_FARMING_FARMLAND 1250 -#define IDS_TUTORIAL_TASK_FARMING_WHEAT 1251 -#define IDS_TUTORIAL_TASK_FARMING_PUMPKIN_AND_MELON 1252 -#define IDS_TUTORIAL_TASK_FARMING_SUGARCANE 1253 -#define IDS_TUTORIAL_TASK_FARMING_CACTUS 1254 -#define IDS_TUTORIAL_TASK_FARMING_MUSHROOM 1255 -#define IDS_TUTORIAL_TASK_FARMING_BONEMEAL 1256 -#define IDS_TUTORIAL_TASK_FARMING_COMPLETE 1257 -#define IDS_TUTORIAL_BREEDING_OVERVIEW 1258 -#define IDS_TUTORIAL_PROMPT_BREEDING_OVERVIEW 1259 -#define IDS_TUTORIAL_TASK_BREEDING_FEED 1260 -#define IDS_TUTORIAL_TASK_BREEDING_FEED_FOOD 1261 -#define IDS_TUTORIAL_TASK_BREEDING_BABY 1262 -#define IDS_TUTORIAL_TASK_BREEDING_DELAY 1263 -#define IDS_TUTORIAL_TASK_BREEDING_FOLLOW 1264 -#define IDS_TUTORIAL_TASK_BREEDING_WOLF_TAMING 1265 -#define IDS_TUTORIAL_TASK_BREEDING_COMPLETE 1266 -#define IDS_TUTORIAL_GOLEM_OVERVIEW 1267 -#define IDS_TUTORIAL_PROMPT_GOLEM_OVERVIEW 1268 -#define IDS_TUTORIAL_TASK_GOLEM_PUMPKIN 1269 -#define IDS_TUTORIAL_TASK_GOLEM_SNOW 1270 -#define IDS_TUTORIAL_TASK_GOLEM_IRON 1271 -#define IDS_TUTORIAL_TASK_GOLEM_IRON_VILLAGE 1272 -#define IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA 1273 -#define IDS_TUTORIAL_HINT_DIGGER_ITEM_SHOVEL 1274 -#define IDS_TUTORIAL_HINT_DIGGER_ITEM_HATCHET 1275 -#define IDS_TUTORIAL_HINT_DIGGER_ITEM_PICKAXE 1276 -#define IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL 1277 -#define IDS_TUTORIAL_HINT_HOLD_TO_MINE 1278 -#define IDS_TUTORIAL_HINT_TOOL_DAMAGED 1279 -#define IDS_TUTORIAL_HINT_SWIM_UP 1280 -#define IDS_TUTORIAL_HINT_MINECART 1281 -#define IDS_TUTORIAL_HINT_BOAT 1282 -#define IDS_TUTORIAL_HINT_FISHING 1283 -#define IDS_TUTORIAL_HINT_PISTON_SELF_REPAIRING_BRIDGE 1284 -#define IDS_TUTORIAL_HINT_INV_DROP 1285 -#define IDS_TUTORIAL_HINT_CRAFT_NO_INGREDIENTS 1286 -#define IDS_TUTORIAL_COMPLETED 1287 -#define IDS_TUTORIAL_COMPLETED_EXPLORE 1288 -#define IDS_TUTORIAL_REMINDER 1289 -#define IDS_TUTORIAL_HTML_EXIT_PICTURE 1290 -#define IDS_TUTORIAL_NEW_FEATURES_CHOICE 1291 -#define IDS_TUTORIAL_PROMPT_NEW_FEATURES_CHOICE 1292 -#define IDS_TUTORIAL_FEATURES_IN_THIS_AREA 1293 -#define IDS_TUTORIAL_FEATURES_OUTSIDE_THIS_AREA 1294 -#define IDS_TUTORIAL_TASK_FOOD_BAR_OVERVIEW 1295 -#define IDS_TUTORIAL_PROMPT_FOOD_BAR_OVERVIEW 1296 -#define IDS_TUTORIAL_TASK_HORSE_MENU_OVERVIEW 1297 -#define IDS_TUTORIAL_PROMPT_HORSE_MENU_OVERVIEW 1298 -#define IDS_TUTORIAL_TASK_HORSE_MENU_LAYOUT 1299 -#define IDS_TUTORIAL_TASK_HORSE_MENU_EQUIPMENT 1300 -#define IDS_TUTORIAL_TASK_HORSE_MENU_SADDLEBAGS 1301 -#define IDS_TUTORIAL_TASK_HORSE_OVERVIEW 1302 -#define IDS_TUTORIAL_TASK_DONKEY_OVERVIEW 1303 -#define IDS_TUTORIAL_TASK_MULE_OVERVIEW 1304 -#define IDS_TUTORIAL_PROMPT_HORSE_OVERVIEW 1305 -#define IDS_TUTORIAL_TASK_HORSE_INTRO 1306 -#define IDS_TUTORIAL_TASK_HORSE_PURPOSE 1307 -#define IDS_TUTORIAL_TASK_HORSE_TAMING 1308 -#define IDS_TUTORIAL_TASK_HORSE_TAMING2 1309 -#define IDS_TUTORIAL_TASK_HORSE_RIDE 1310 -#define IDS_TUTORIAL_TASK_HORSE_SADDLES 1311 -#define IDS_TUTORIAL_TASK_HORSE_SADDLEBAGS 1312 -#define IDS_TUTORIAL_TASK_HORSE_BREEDING 1313 -#define IDS_TUTORIAL_TASK_HORSE_AREA 1314 -#define IDS_TUTORIAL_TASK_BEACON_MENU_OVERVIEW 1315 -#define IDS_TUTORIAL_PROMPT_BEACON_MENU_OVERVIEW 1316 -#define IDS_TUTORIAL_TASK_BEACON_MENU_PRIMARY_POWERS 1317 -#define IDS_TUTORIAL_TASK_BEACON_MENU_SECONDARY_POWER 1318 -#define IDS_TUTORIAL_TASK_BEACON_MENU_ACTIVATION 1319 -#define IDS_TUTORIAL_TASK_BEACON_OVERVIEW 1320 -#define IDS_TUTORIAL_PROMPT_BEACON_OVERVIEW 1321 -#define IDS_TUTORIAL_TASK_BEACON_PURPOSE 1322 -#define IDS_TUTORIAL_TASK_BEACON_DESIGN 1323 -#define IDS_TUTORIAL_TASK_BEACON_CHOOSING_POWERS 1324 -#define IDS_TUTORIAL_TASK_HOPPER_OVERVIEW 1325 -#define IDS_TUTORIAL_PROMPT_HOPPER_OVERVIEW 1326 -#define IDS_TUTORIAL_TASK_HOPPER_PURPOSE 1327 -#define IDS_TUTORIAL_TASK_HOPPER_CONTAINERS 1328 -#define IDS_TUTORIAL_TASK_HOPPER_MECHANICS 1329 -#define IDS_TUTORIAL_TASK_HOPPER_REDSTONE 1330 -#define IDS_TUTORIAL_TASK_HOPPER_OUTPUT 1331 -#define IDS_TUTORIAL_TASK_HOPPER_AREA 1332 -#define IDS_TUTORIAL_TASK_FIREWORK_MENU_OVERVIEW 1333 -#define IDS_TUTORIAL_PROMPT_FIREWORK_MENU_OVERVIEW 1334 -#define IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_START 1335 -#define IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_STARS 1336 -#define IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_HEIGHT 1337 -#define IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_CRAFT 1338 -#define IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_START 1339 -#define IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_COLOUR 1340 -#define IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_SHAPE 1341 -#define IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_EFFECT 1342 -#define IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_FADE 1343 -#define IDS_TUTORIAL_TASK_FIREWORK_OVERVIEW 1344 -#define IDS_TUTORIAL_PROMPT_FIREWORK_OVERVIEW 1345 -#define IDS_TUTORIAL_TASK_FIREWORK_PURPOSE 1346 -#define IDS_TUTORIAL_TASK_FIREWORK_CUSTOMISE 1347 -#define IDS_TUTORIAL_TASK_FIREWORK_CRAFTING 1348 -#define IDS_TOOLTIPS_SELECT 1349 -#define IDS_TOOLTIPS_USE 1350 -#define IDS_TOOLTIPS_BACK 1351 -#define IDS_TOOLTIPS_EXIT 1352 -#define IDS_TOOLTIPS_CANCEL 1353 -#define IDS_TOOLTIPS_CANCEL_JOIN 1354 -#define IDS_TOOLTIPS_REFRESH 1355 -#define IDS_TOOLTIPS_PARTY_GAMES 1356 -#define IDS_TOOLTIPS_ALL_GAMES 1357 -#define IDS_TOOLTIPS_CHANGE_GROUP 1358 -#define IDS_TOOLTIPS_SHOW_INVENTORY 1359 -#define IDS_TOOLTIPS_SHOW_DESCRIPTION 1360 -#define IDS_TOOLTIPS_SHOW_INGREDIENTS 1361 -#define IDS_TOOLTIPS_CRAFTING 1362 -#define IDS_TOOLTIPS_CREATE 1363 -#define IDS_TOOLTIPS_PICKUPPLACE 1364 -#define IDS_TOOLTIPS_PICKUP_GENERIC 1365 -#define IDS_TOOLTIPS_PICKUP_ALL 1366 -#define IDS_TOOLTIPS_PICKUP_HALF 1367 -#define IDS_TOOLTIPS_PLACE_GENERIC 1368 -#define IDS_TOOLTIPS_PLACE_ALL 1369 -#define IDS_TOOLTIPS_PLACE_ONE 1370 -#define IDS_TOOLTIPS_DROP_GENERIC 1371 -#define IDS_TOOLTIPS_DROP_ALL 1372 -#define IDS_TOOLTIPS_DROP_ONE 1373 -#define IDS_TOOLTIPS_SWAP 1374 -#define IDS_TOOLTIPS_QUICK_MOVE 1375 -#define IDS_TOOLTIPS_CLEAR_QUICK_SELECT 1376 -#define IDS_TOOLTIPS_WHAT_IS_THIS 1377 -#define IDS_TOOLTIPS_SHARE 1378 -#define IDS_TOOLTIPS_CHANGE_FILTER 1379 -#define IDS_TOOLTIPS_SEND_FRIEND_REQUEST 1380 -#define IDS_TOOLTIPS_PAGE_DOWN 1381 -#define IDS_TOOLTIPS_PAGE_UP 1382 -#define IDS_TOOLTIPS_NEXT 1383 -#define IDS_TOOLTIPS_PREVIOUS 1384 -#define IDS_TOOLTIPS_KICK 1385 -#define IDS_TOOLTIPS_DYE 1386 -#define IDS_TOOLTIPS_MINE 1387 -#define IDS_TOOLTIPS_FEED 1388 -#define IDS_TOOLTIPS_TAME 1389 -#define IDS_TOOLTIPS_HEAL 1390 -#define IDS_TOOLTIPS_SIT 1391 -#define IDS_TOOLTIPS_FOLLOWME 1392 -#define IDS_TOOLTIPS_EJECT 1393 -#define IDS_TOOLTIPS_EMPTY 1394 -#define IDS_TOOLTIPS_SADDLE 1395 -#define IDS_TOOLTIPS_PLACE 1396 -#define IDS_TOOLTIPS_HIT 1397 -#define IDS_TOOLTIPS_MILK 1398 -#define IDS_TOOLTIPS_COLLECT 1399 -#define IDS_TOOLTIPS_EAT 1400 -#define IDS_TOOLTIPS_SLEEP 1401 -#define IDS_TOOLTIPS_WAKEUP 1402 -#define IDS_TOOLTIPS_PLAY 1403 -#define IDS_TOOLTIPS_RIDE 1404 -#define IDS_TOOLTIPS_SAIL 1405 -#define IDS_TOOLTIPS_GROW 1406 -#define IDS_TOOLTIPS_SWIMUP 1407 -#define IDS_TOOLTIPS_OPEN 1408 -#define IDS_TOOLTIPS_CHANGEPITCH 1409 -#define IDS_TOOLTIPS_DETONATE 1410 -#define IDS_TOOLTIPS_READ 1411 -#define IDS_TOOLTIPS_HANG 1412 -#define IDS_TOOLTIPS_THROW 1413 -#define IDS_TOOLTIPS_PLANT 1414 -#define IDS_TOOLTIPS_TILL 1415 -#define IDS_TOOLTIPS_HARVEST 1416 -#define IDS_TOOLTIPS_CONTINUE 1417 -#define IDS_TOOLTIPS_UNLOCKFULLVERSION 1418 -#define IDS_TOOLTIPS_DELETESAVE 1419 -#define IDS_TOOLTIPS_DELETE 1420 -#define IDS_TOOLTIPS_OPTIONS 1421 -#define IDS_TOOLTIPS_INVITE_FRIENDS 1422 -#define IDS_TOOLTIPS_ACCEPT 1423 -#define IDS_TOOLTIPS_SHEAR 1424 -#define IDS_TOOLTIPS_BANLEVEL 1425 -#define IDS_TOOLTIPS_SELECT_SKIN 1426 -#define IDS_TOOLTIPS_IGNITE 1427 -#define IDS_TOOLTIPS_NAVIGATE 1428 -#define IDS_TOOLTIPS_INSTALL_FULL 1429 -#define IDS_TOOLTIPS_INSTALL_TRIAL 1430 -#define IDS_TOOLTIPS_INSTALL 1431 -#define IDS_TOOLTIPS_REINSTALL 1432 -#define IDS_TOOLTIPS_SAVEOPTIONS 1433 -#define IDS_TOOLTIPS_EXECUTE_COMMAND 1434 -#define IDS_TOOLTIPS_CREATIVE 1435 -#define IDS_TOOLTIPS_QUICK_MOVE_INGREDIENT 1436 -#define IDS_TOOLTIPS_QUICK_MOVE_FUEL 1437 -#define IDS_TOOLTIPS_QUICK_MOVE_TOOL 1438 -#define IDS_TOOLTIPS_QUICK_MOVE_ARMOR 1439 -#define IDS_TOOLTIPS_QUICK_MOVE_WEAPON 1440 -#define IDS_TOOLTIPS_EQUIP 1441 -#define IDS_TOOLTIPS_DRAW_BOW 1442 -#define IDS_TOOLTIPS_RELEASE_BOW 1443 -#define IDS_TOOLTIPS_PRIVILEGES 1444 -#define IDS_TOOLTIPS_BLOCK 1445 -#define IDS_TOOLTIPS_PAGEUP 1446 -#define IDS_TOOLTIPS_PAGEDOWN 1447 -#define IDS_TOOLTIPS_LOVEMODE 1448 -#define IDS_TOOLTIPS_DRINK 1449 -#define IDS_TOOLTIPS_ROTATE 1450 -#define IDS_TOOLTIPS_CLEARSLOTS 1451 -#define IDS_TOOLTIPS_MOUNT 1452 -#define IDS_TOOLTIPS_DISMOUNT 1453 -#define IDS_TOOLTIPS_SADDLEBAGS 1454 -#define IDS_TOOLTIPS_FIREWORK_LAUNCH 1455 -#define IDS_TOOLTIPS_LEASH 1456 -#define IDS_TOOLTIPS_UNLEASH 1457 -#define IDS_TOOLTIPS_ATTACH 1458 -#define IDS_TOOLTIPS_NAME 1459 -#define IDS_CONFIRM_OK 1460 -#define IDS_CONFIRM_CANCEL 1461 -#define IDS_DOWNLOADABLECONTENT 1462 -#define IDS_CONFIRM_LEAVE_VIA_INVITE 1463 -#define IDS_EXIT_GAME 1464 -#define IDS_TITLE_SAVE_GAME 1465 -#define IDS_TITLE_DECLINE_SAVE_GAME 1466 -#define IDS_CONFIRM_SAVE_GAME 1467 -#define IDS_CONFIRM_DECLINE_SAVE_GAME 1468 -#define IDS_TITLE_START_GAME 1469 -#define IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE 1470 -#define IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT 1471 -#define IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE 1472 -#define IDS_EXIT_GAME_SAVE 1473 -#define IDS_EXIT_GAME_NO_SAVE 1474 -#define IDS_CONFIRM_EXIT_GAME 1475 -#define IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST 1476 -#define IDS_CREATE_NEW_WORLD 1477 -#define IDS_PLAY_TUTORIAL 1478 -#define IDS_TUTORIALSAVENAME 1479 -#define IDS_NAME_WORLD 1480 -#define IDS_NAME_WORLD_TEXT 1481 -#define IDS_CREATE_NEW_WORLD_SEEDTEXT 1482 -#define IDS_LOAD_SAVED_WORLD 1483 -#define IDS_PRESS_START_TO_JOIN 1484 -#define IDS_EXITING_GAME 1485 -#define IDS_GENERIC_ERROR 1486 -#define IDS_CONNECTION_FAILED 1487 -#define IDS_CONNECTION_LOST 1488 -#define IDS_CONNECTION_LOST_SERVER 1489 -#define IDS_DISCONNECTED 1490 -#define IDS_DISCONNECTED_KICKED 1491 -#define IDS_DISCONNECTED_FLYING 1492 -#define IDS_DISCONNECTED_LOGIN_TOO_LONG 1493 -#define IDS_DISCONNECTED_SERVER_FULL 1494 -#define IDS_DISCONNECTED_SERVER_QUIT 1495 -#define IDS_DISCONNECTED_NO_FRIENDS_IN_GAME 1496 -#define IDS_DISCONNECTED_BANNED 1497 -#define IDS_DISCONNECTED_SERVER_OLD 1498 -#define IDS_DISCONNECTED_CLIENT_OLD 1499 -#define IDS_DEFAULT_SAVENAME 1500 -#define IDS_AWARD_TITLE 1501 -#define IDS_AWARD_GAMERPIC1 1502 -#define IDS_AWARD_GAMERPIC2 1503 -#define IDS_UNLOCK_TITLE 1504 -#define IDS_UNLOCK_TOSAVE_TEXT 1505 -#define IDS_LEADERBOARD_LOADING 1506 -#define IDS_LEADERBOARD_NORESULTS 1507 -#define IDS_LEADERBOARD_FILTER 1508 -#define IDS_LEADERBOARD_FILTER_FRIENDS 1509 -#define IDS_LEADERBOARD_FILTER_MYSCORE 1510 -#define IDS_LEADERBOARD_FILTER_OVERALL 1511 -#define IDS_LEADERBOARD_ENTRIES 1512 -#define IDS_LEADERBOARD_RANK 1513 -#define IDS_PROGRESS_SAVING_LEVEL 1514 -#define IDS_PROGRESS_SAVING_CHUNKS 1515 -#define IDS_PROGRESS_SAVING_TO_DISC 1516 -#define IDS_PROGRESS_BUILDING_TERRAIN 1517 -#define IDS_PROGRESS_SIMULATING_WORLD 1518 -#define IDS_PROGRESS_INITIALISING_SERVER 1519 -#define IDS_PROGRESS_GENERATING_SPAWN_AREA 1520 -#define IDS_PROGRESS_LOADING_SPAWN_AREA 1521 -#define IDS_PROGRESS_ENTERING_NETHER 1522 -#define IDS_PROGRESS_LEAVING_NETHER 1523 -#define IDS_PROGRESS_RESPAWNING 1524 -#define IDS_PROGRESS_GENERATING_LEVEL 1525 -#define IDS_PROGRESS_LOADING_LEVEL 1526 -#define IDS_PROGRESS_SAVING_PLAYERS 1527 -#define IDS_PROGRESS_CONNECTING 1528 -#define IDS_PROGRESS_DOWNLOADING_TERRAIN 1529 -#define IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME 1530 -#define IDS_PROGRESS_HOST_SAVING 1531 -#define IDS_PROGRESS_ENTERING_END 1532 -#define IDS_PROGRESS_LEAVING_END 1533 -#define IDS_PROGRESS_NEW_WORLD_SEED 1534 -#define IDS_TILE_BED_OCCUPIED 1535 -#define IDS_TILE_BED_NO_SLEEP 1536 -#define IDS_TILE_BED_PLAYERSLEEP 1537 -#define IDS_TILE_BED_NOT_VALID 1538 -#define IDS_TILE_BED_NOTSAFE 1539 -#define IDS_TILE_BED_MESLEEP 1540 -#define IDS_GROUPNAME_TOOLS 1541 -#define IDS_GROUPNAME_WEAPONS 1542 -#define IDS_GROUPNAME_FOOD 1543 -#define IDS_GROUPNAME_STRUCTURES 1544 -#define IDS_GROUPNAME_ARMOUR 1545 -#define IDS_GROUPNAME_MECHANISMS 1546 -#define IDS_GROUPNAME_TRANSPORT 1547 -#define IDS_GROUPNAME_DECORATIONS 1548 -#define IDS_GROUPNAME_BUILDING_BLOCKS 1549 -#define IDS_GROUPNAME_REDSTONE_AND_TRANSPORT 1550 -#define IDS_GROUPNAME_MISCELLANEOUS 1551 -#define IDS_GROUPNAME_POTIONS 1552 -#define IDS_GROUPNAME_TOOLS_WEAPONS_ARMOR 1553 -#define IDS_GROUPNAME_MATERIALS 1554 -#define IDS_RETURNEDTOMENU_TITLE 1555 -#define IDS_SLIDER_DIFFICULTY 1556 -#define IDS_SLIDER_GAMEMODE 1557 -#define IDS_SLIDER_MUSIC 1558 -#define IDS_SLIDER_SOUND 1559 -#define IDS_SLIDER_GAMMA 1560 -#define IDS_SLIDER_SENSITIVITY_INGAME 1561 -#define IDS_SLIDER_SENSITIVITY_INMENU 1562 -#define IDS_DIFFICULTY_TITLE_PEACEFUL 1563 -#define IDS_DIFFICULTY_TITLE_EASY 1564 -#define IDS_DIFFICULTY_TITLE_NORMAL 1565 -#define IDS_DIFFICULTY_TITLE_HARD 1566 -#define IDS_DIFFICULTY_PEACEFUL 1567 -#define IDS_DIFFICULTY_EASY 1568 -#define IDS_DIFFICULTY_NORMAL 1569 -#define IDS_DIFFICULTY_HARD 1570 -#define IDS_TRIALOVER_TITLE 1571 -#define IDS_MULTIPLAYER_FULL_TITLE 1572 -#define IDS_MULTIPLAYER_FULL_TEXT 1573 -#define IDS_SIGN_TITLE 1574 -#define IDS_SIGN_TITLE_TEXT 1575 -#define IDS_NAME_TITLE 1576 -#define IDS_NAME_TITLE_TEXT 1577 -#define IDS_NAME_CAPTION 1578 -#define IDS_NAME_CAPTION_TEXT 1579 -#define IDS_NAME_DESC 1580 -#define IDS_NAME_DESC_TEXT 1581 -#define IDS_INVENTORY 1582 -#define IDS_INGREDIENTS 1583 -#define IDS_BREWING_STAND 1584 -#define IDS_CHEST 1585 -#define IDS_ENCHANT 1586 -#define IDS_FURNACE 1587 -#define IDS_INGREDIENT 1588 -#define IDS_FUEL 1589 -#define IDS_DISPENSER 1590 -#define IDS_CONTAINER_ANIMAL 1591 -#define IDS_CONTAINER_DROPPER 1592 -#define IDS_CONTAINER_HOPPER 1593 -#define IDS_CONTAINER_BEACON 1594 -#define IDS_CONTAINER_BEACON_PRIMARY_POWER 1595 -#define IDS_CONTAINER_BEACON_SECONDARY_POWER 1596 -#define IDS_CONTAINER_MINECART 1597 -#define IDS_NO_DLCOFFERS 1598 -#define IDS_PLAYER_JOINED 1599 -#define IDS_PLAYER_LEFT 1600 -#define IDS_PLAYER_KICKED 1601 -#define IDS_TEXT_DELETE_SAVE 1602 -#define IDS_STRINGVERIFY_AWAITING_APPROVAL 1603 -#define IDS_STRINGVERIFY_CENSORED 1604 -#define IDS_NOWPLAYING 1605 -#define IDS_DEFAULTS_TITLE 1606 -#define IDS_DEFAULTS_TEXT 1607 -#define IDS_FATAL_ERROR_TITLE 1608 -#define IDS_GAME_HOST_NAME 1609 -#define IDS_GAME_HOST_NAME_UNKNOWN 1610 -#define IDS_GUEST_ORDER_CHANGED_TITLE 1611 -#define IDS_GUEST_ORDER_CHANGED_TEXT 1612 -#define IDS_MUST_SIGN_IN_TITLE 1613 -#define IDS_MUST_SIGN_IN_TEXT 1614 -#define IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE 1615 -#define IDS_FAILED_TO_CREATE_GAME_TITLE 1616 -#define IDS_DEFAULT_SKINS 1617 -#define IDS_NO_SKIN_PACK 1618 -#define IDS_FAVORITES_SKIN_PACK 1619 -#define IDS_BANNED_LEVEL_TITLE 1620 -#define IDS_PLAYER_BANNED_LEVEL 1621 -#define IDS_ACTION_BAN_LEVEL_TITLE 1622 -#define IDS_ACTION_BAN_LEVEL_DESCRIPTION 1623 -#define IDS_BUTTON_REMOVE_FROM_BAN_LIST 1624 -#define IDS_SLIDER_AUTOSAVE 1625 -#define IDS_SLIDER_AUTOSAVE_OFF 1626 -#define IDS_MINUTES 1627 -#define IDS_CANT_PLACE_NEAR_SPAWN_TITLE 1628 -#define IDS_CANT_PLACE_NEAR_SPAWN_TEXT 1629 -#define IDS_SLIDER_INTERFACEOPACITY 1630 -#define IDS_PROGRESS_AUTOSAVING_LEVEL 1631 -#define IDS_SLIDER_UISIZE 1632 -#define IDS_SLIDER_UISIZESPLITSCREEN 1633 -#define IDS_SEED 1634 -#define IDS_UNLOCK_DLC_TITLE 1635 -#define IDS_UNLOCK_DLC_SKIN 1636 -#define IDS_UNLOCK_DLC_TEXTUREPACK_TITLE 1637 -#define IDS_UNLOCK_DLC_TEXTUREPACK_TEXT 1638 -#define IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE 1639 -#define IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT 1640 -#define IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE 1641 -#define IDS_DLC_TEXTUREPACK_UNLOCK_TITLE 1642 -#define IDS_DLC_TEXTUREPACK_GET_TRIAL_TITLE 1643 -#define IDS_DLC_TEXTUREPACK_GET_FULL_TITLE 1644 -#define IDS_DLC_TEXTUREPACK_NOT_PRESENT 1645 -#define IDS_TEXTURE_PACK_TRIALVERSION 1646 -#define IDS_TEXTUREPACK_FULLVERSION 1647 -#define IDS_UNLOCK_KICK_PLAYER_TITLE 1648 -#define IDS_UNLOCK_KICK_PLAYER 1649 -#define IDS_GAMERPICS 1650 -#define IDS_THEMES 1651 -#define IDS_SKINS 1652 -#define IDS_ALLOWFRIENDSOFFRIENDS 1653 -#define IDS_NOTALLOWED_FRIENDSOFFRIENDS 1654 -#define IDS_CANTJOIN_TITLE 1655 -#define IDS_SELECTED 1656 -#define IDS_SELECTED_SKIN 1657 -#define IDS_CORRUPT_DLC_TITLE 1658 -#define IDS_CORRUPT_DLC 1659 -#define IDS_CORRUPT_DLC_MULTIPLE 1660 -#define IDS_GAME_MODE_CHANGED 1661 -#define IDS_RENAME_WORLD_TITLE 1662 -#define IDS_RENAME_WORLD_TEXT 1663 -#define IDS_GAMEMODE_SURVIVAL 1664 -#define IDS_GAMEMODE_CREATIVE 1665 -#define IDS_GAMEMODE_ADVENTURE 1666 -#define IDS_SURVIVAL 1667 -#define IDS_CREATIVE 1668 -#define IDS_ADVENTURE 1669 -#define IDS_CREATED_IN_SURVIVAL 1670 -#define IDS_CREATED_IN_CREATIVE 1671 -#define IDS_CHECKBOX_RENDER_CLOUDS 1672 -#define IDS_TEXT_SAVEOPTIONS 1673 -#define IDS_TITLE_RENAMESAVE 1674 -#define IDS_AUTOSAVE_COUNTDOWN 1675 -#define IDS_ON 1676 -#define IDS_OFF 1677 -#define IDS_LEVELTYPE_NORMAL 1678 -#define IDS_LEVELTYPE_SUPERFLAT 1679 -#define IDS_GAMEOPTION_SEED 1680 -#define IDS_GAMEOPTION_ONLINE 1681 -#define IDS_GAMEOPTION_INVITEONLY 1682 -#define IDS_GAMEOPTION_ALLOWFOF 1683 -#define IDS_GAMEOPTION_PVP 1684 -#define IDS_GAMEOPTION_TRUST 1685 -#define IDS_GAMEOPTION_FIRE_SPREADS 1686 -#define IDS_GAMEOPTION_TNT_EXPLODES 1687 -#define IDS_GAMEOPTION_RESET_NETHER 1688 -#define IDS_GAMEOPTION_STRUCTURES 1689 -#define IDS_GAMEOPTION_SUPERFLAT 1690 -#define IDS_GAMEOPTION_BONUS_CHEST 1691 -#define IDS_GAMEOPTION_MOB_GRIEFING 1692 -#define IDS_GAMEOPTION_KEEP_INVENTORY 1693 -#define IDS_GAMEOPTION_MOB_SPAWNING 1694 -#define IDS_GAMEOPTION_MOB_LOOT 1695 -#define IDS_GAMEOPTION_TILE_DROPS 1696 -#define IDS_GAMEOPTION_NATURAL_REGEN 1697 -#define IDS_GAMEOPTION_DAYLIGHT_CYCLE 1698 -#define IDS_DLC_MENU_SKINPACKS 1699 -#define IDS_DLC_MENU_THEMES 1700 -#define IDS_DLC_MENU_GAMERPICS 1701 -#define IDS_DLC_MENU_AVATARITEMS 1702 -#define IDS_DLC_MENU_TEXTUREPACKS 1703 -#define IDS_DLC_MENU_MASHUPPACKS 1704 -#define IDS_DEATH_INFIRE 1705 -#define IDS_DEATH_ONFIRE 1706 -#define IDS_DEATH_LAVA 1707 -#define IDS_DEATH_INWALL 1708 -#define IDS_DEATH_DROWN 1709 -#define IDS_DEATH_STARVE 1710 -#define IDS_DEATH_CACTUS 1711 -#define IDS_DEATH_FALL 1712 -#define IDS_DEATH_OUTOFWORLD 1713 -#define IDS_DEATH_GENERIC 1714 -#define IDS_DEATH_EXPLOSION 1715 -#define IDS_DEATH_MAGIC 1716 -#define IDS_DEATH_DRAGON_BREATH 1717 -#define IDS_DEATH_MOB 1718 -#define IDS_DEATH_PLAYER 1719 -#define IDS_DEATH_ARROW 1720 -#define IDS_DEATH_FIREBALL 1721 -#define IDS_DEATH_THROWN 1722 -#define IDS_DEATH_INDIRECT_MAGIC 1723 -#define IDS_DEATH_FELL_ACCIDENT_LADDER 1724 -#define IDS_DEATH_FELL_ACCIDENT_VINES 1725 -#define IDS_DEATH_FELL_ACCIDENT_WATER 1726 -#define IDS_DEATH_FELL_ACCIDENT_GENERIC 1727 -#define IDS_DEATH_FELL_KILLER 1728 -#define IDS_DEATH_FELL_ASSIST 1729 -#define IDS_DEATH_FELL_ASSIST_ITEM 1730 -#define IDS_DEATH_FELL_FINISH 1731 -#define IDS_DEATH_FELL_FINISH_ITEM 1732 -#define IDS_DEATH_INFIRE_PLAYER 1733 -#define IDS_DEATH_ONFIRE_PLAYER 1734 -#define IDS_DEATH_LAVA_PLAYER 1735 -#define IDS_DEATH_DROWN_PLAYER 1736 -#define IDS_DEATH_CACTUS_PLAYER 1737 -#define IDS_DEATH_EXPLOSION_PLAYER 1738 -#define IDS_DEATH_WITHER 1739 -#define IDS_DEATH_PLAYER_ITEM 1740 -#define IDS_DEATH_ARROW_ITEM 1741 -#define IDS_DEATH_FIREBALL_ITEM 1742 -#define IDS_DEATH_THROWN_ITEM 1743 -#define IDS_DEATH_INDIRECT_MAGIC_ITEM 1744 -#define IDS_CHECKBOX_RENDER_BEDROCKFOG 1745 -#define IDS_CHECKBOX_DISPLAY_HUD 1746 -#define IDS_CHECKBOX_DISPLAY_HAND 1747 -#define IDS_CHECKBOX_DEATH_MESSAGES 1748 -#define IDS_CHECKBOX_ANIMATED_CHARACTER 1749 -#define IDS_CHECKBOX_CUSTOM_SKIN_ANIM 1750 -#define IDS_PRIV_MINE_TOGGLE_ON 1751 -#define IDS_PRIV_MINE_TOGGLE_OFF 1752 -#define IDS_PRIV_BUILD_TOGGLE_ON 1753 -#define IDS_PRIV_BUILD_TOGGLE_OFF 1754 -#define IDS_PRIV_USE_DOORS_TOGGLE_ON 1755 -#define IDS_PRIV_USE_DOORS_TOGGLE_OFF 1756 -#define IDS_PRIV_USE_CONTAINERS_TOGGLE_ON 1757 -#define IDS_PRIV_USE_CONTAINERS_TOGGLE_OFF 1758 -#define IDS_PRIV_ATTACK_MOB_TOGGLE_ON 1759 -#define IDS_PRIV_ATTACK_MOB_TOGGLE_OFF 1760 -#define IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON 1761 -#define IDS_PRIV_ATTACK_PLAYER_TOGGLE_OFF 1762 -#define IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON 1763 -#define IDS_PRIV_ATTACK_ANIMAL_TOGGLE_OFF 1764 -#define IDS_PRIV_MODERATOR_TOGGLE_ON 1765 -#define IDS_PRIV_MODERATOR_TOGGLE_OFF 1766 -#define IDS_PRIV_FLY_TOGGLE_ON 1767 -#define IDS_PRIV_FLY_TOGGLE_OFF 1768 -#define IDS_PRIV_EXHAUSTION_TOGGLE_ON 1769 -#define IDS_PRIV_EXHAUSTION_TOGGLE_OFF 1770 -#define IDS_PRIV_INVISIBLE_TOGGLE_ON 1771 -#define IDS_PRIV_INVISIBLE_TOGGLE_OFF 1772 -#define IDS_PRIV_INVULNERABLE_TOGGLE_ON 1773 -#define IDS_PRIV_INVULNERABLE_TOGGLE_OFF 1774 -#define IDS_DLC_COST 1775 -#define IDS_BOSS_ENDERDRAGON_HEALTH 1776 -#define IDS_PLAYER_ENTERED_END 1777 -#define IDS_PLAYER_LEFT_END 1778 -#define IDS_WIN_TEXT 1779 -#define IDS_WIN_TEXT_PART_2 1780 -#define IDS_WIN_TEXT_PART_3 1781 -#define IDS_RESETNETHER_TITLE 1782 -#define IDS_RESETNETHER_TEXT 1783 -#define IDS_RESET_NETHER 1784 -#define IDS_DONT_RESET_NETHER 1785 -#define IDS_CANT_SHEAR_MOOSHROOM 1786 -#define IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED 1787 -#define IDS_MAX_MOOSHROOMS_SPAWNED 1788 -#define IDS_MAX_WOLVES_SPAWNED 1789 -#define IDS_MAX_CHICKENS_SPAWNED 1790 -#define IDS_MAX_SQUID_SPAWNED 1791 -#define IDS_MAX_BATS_SPAWNED 1792 -#define IDS_MAX_ENEMIES_SPAWNED 1793 -#define IDS_MAX_VILLAGERS_SPAWNED 1794 -#define IDS_MAX_HANGINGENTITIES 1795 -#define IDS_CANT_SPAWN_IN_PEACEFUL 1796 -#define IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED 1797 -#define IDS_MAX_WOLVES_BRED 1798 -#define IDS_MAX_CHICKENS_BRED 1799 -#define IDS_MAX_HORSES_BRED 1800 -#define IDS_MAX_MUSHROOMCOWS_BRED 1801 -#define IDS_MAX_BOATS 1802 -#define IDS_MAX_SKULL_TILES 1803 -#define IDS_INVERT_LOOK 1804 -#define IDS_SOUTHPAW 1805 -#define IDS_YOU_DIED 1806 -#define IDS_RESPAWN 1807 -#define IDS_DOWNLOADABLE_CONTENT_OFFERS 1808 -#define IDS_CHANGE_SKIN 1809 -#define IDS_HOW_TO_PLAY 1810 -#define IDS_CONTROLS 1811 -#define IDS_SETTINGS 1812 -#define IDS_LANGUAGE_SELECTOR 1813 -#define IDS_CREDITS 1814 -#define IDS_REINSTALL_CONTENT 1815 -#define IDS_DEBUG_SETTINGS 1816 -#define IDS_FIRE_SPREADS 1817 -#define IDS_TNT_EXPLODES 1818 -#define IDS_PLAYER_VS_PLAYER 1819 -#define IDS_TRUST_PLAYERS 1820 -#define IDS_HOST_PRIVILEGES 1821 -#define IDS_GENERATE_STRUCTURES 1822 -#define IDS_SUPERFLAT_WORLD 1823 -#define IDS_BONUS_CHEST 1824 -#define IDS_WORLD_OPTIONS 1825 -#define IDS_GAME_OPTIONS 1826 -#define IDS_MOB_GRIEFING 1827 -#define IDS_KEEP_INVENTORY 1828 -#define IDS_MOB_SPAWNING 1829 -#define IDS_MOB_LOOT 1830 -#define IDS_TILE_DROPS 1831 -#define IDS_NATURAL_REGEN 1832 -#define IDS_DAYLIGHT_CYCLE 1833 -#define IDS_CAN_BUILD_AND_MINE 1834 -#define IDS_CAN_USE_DOORS_AND_SWITCHES 1835 -#define IDS_CAN_OPEN_CONTAINERS 1836 -#define IDS_CAN_ATTACK_PLAYERS 1837 -#define IDS_CAN_ATTACK_ANIMALS 1838 -#define IDS_MODERATOR 1839 -#define IDS_KICK_PLAYER 1840 -#define IDS_CAN_FLY 1841 -#define IDS_DISABLE_EXHAUSTION 1842 -#define IDS_INVISIBLE 1843 -#define IDS_HOST_OPTIONS 1844 -#define IDS_PLAYERS_INVITE 1845 -#define IDS_ONLINE_GAME 1846 -#define IDS_INVITE_ONLY 1847 -#define IDS_MORE_OPTIONS 1848 -#define IDS_LOAD 1849 -#define IDS_DEFAULT_WORLD_NAME 1850 -#define IDS_WORLD_NAME 1851 -#define IDS_CREATE_NEW_WORLD_SEED 1852 -#define IDS_CREATE_NEW_WORLD_RANDOM_SEED 1853 -#define IDS_PLAYERS 1854 -#define IDS_JOIN_GAME 1855 -#define IDS_START_GAME 1856 -#define IDS_NO_GAMES_FOUND 1857 -#define IDS_PLAY_GAME 1858 -#define IDS_LEADERBOARDS 1859 -#define IDS_HELP_AND_OPTIONS 1860 -#define IDS_UNLOCK_FULL_GAME 1861 -#define IDS_RESUME_GAME 1862 -#define IDS_SAVE_GAME 1863 -#define IDS_LABEL_DIFFICULTY 1864 -#define IDS_LABEL_GAME_TYPE 1865 -#define IDS_LABEL_STRUCTURES 1866 -#define IDS_LABEL_LEVEL_TYPE 1867 -#define IDS_LABEL_PvP 1868 -#define IDS_LABEL_TRUST 1869 -#define IDS_LABEL_TNT 1870 -#define IDS_LABEL_FIRE_SPREADS 1871 -#define IDS_REINSTALL_THEME 1872 -#define IDS_REINSTALL_GAMERPIC_1 1873 -#define IDS_REINSTALL_GAMERPIC_2 1874 -#define IDS_REINSTALL_AVATAR_ITEM_1 1875 -#define IDS_REINSTALL_AVATAR_ITEM_2 1876 -#define IDS_REINSTALL_AVATAR_ITEM_3 1877 -#define IDS_OPTIONS 1878 -#define IDS_AUDIO 1879 -#define IDS_CONTROL 1880 -#define IDS_GRAPHICS 1881 -#define IDS_USER_INTERFACE 1882 -#define IDS_RESET_TO_DEFAULTS 1883 -#define IDS_VIEW_BOBBING 1884 -#define IDS_HINTS 1885 -#define IDS_IN_GAME_TOOLTIPS 1886 -#define IDS_CHECKBOX_VERTICAL_SPLIT_SCREEN 1887 -#define IDS_DONE 1888 -#define IDS_EDIT_SIGN_MESSAGE 1889 -#define IDS_SOCIAL_TEXT 1890 -#define IDS_SOCIAL_LABEL_CAPTION 1891 -#define IDS_SOCIAL_DEFAULT_CAPTION 1892 -#define IDS_SOCIAL_LABEL_DESCRIPTION 1893 -#define IDS_DEFAULT_TEXTUREPACK 1894 -#define IDS_POTION_EMPTY 1895 -#define IDS_POTION_MOVESPEED 1896 -#define IDS_POTION_MOVESLOWDOWN 1897 -#define IDS_POTION_DIGSPEED 1898 -#define IDS_POTION_DIGSLOWDOWN 1899 -#define IDS_POTION_DAMAGEBOOST 1900 -#define IDS_POTION_WEAKNESS 1901 -#define IDS_POTION_HEAL 1902 -#define IDS_POTION_HARM 1903 -#define IDS_POTION_JUMP 1904 -#define IDS_POTION_CONFUSION 1905 -#define IDS_POTION_REGENERATION 1906 -#define IDS_POTION_RESISTANCE 1907 -#define IDS_POTION_FIRERESISTANCE 1908 -#define IDS_POTION_WATERBREATHING 1909 -#define IDS_POTION_INVISIBILITY 1910 -#define IDS_POTION_BLINDNESS 1911 -#define IDS_POTION_NIGHTVISION 1912 -#define IDS_POTION_HUNGER 1913 -#define IDS_POTION_POISON 1914 -#define IDS_POTION_WITHER 1915 -#define IDS_POTION_HEALTHBOOST 1916 -#define IDS_POTION_ABSORPTION 1917 -#define IDS_POTION_SATURATION 1918 -#define IDS_POTION_MOVESPEED_POSTFIX 1919 -#define IDS_POTION_MOVESLOWDOWN_POSTFIX 1920 -#define IDS_POTION_DIGSPEED_POSTFIX 1921 -#define IDS_POTION_DIGSLOWDOWN_POSTFIX 1922 -#define IDS_POTION_DAMAGEBOOST_POSTFIX 1923 -#define IDS_POTION_WEAKNESS_POSTFIX 1924 -#define IDS_POTION_HEAL_POSTFIX 1925 -#define IDS_POTION_HARM_POSTFIX 1926 -#define IDS_POTION_JUMP_POSTFIX 1927 -#define IDS_POTION_CONFUSION_POSTFIX 1928 -#define IDS_POTION_REGENERATION_POSTFIX 1929 -#define IDS_POTION_RESISTANCE_POSTFIX 1930 -#define IDS_POTION_FIRERESISTANCE_POSTFIX 1931 -#define IDS_POTION_WATERBREATHING_POSTFIX 1932 -#define IDS_POTION_INVISIBILITY_POSTFIX 1933 -#define IDS_POTION_BLINDNESS_POSTFIX 1934 -#define IDS_POTION_NIGHTVISION_POSTFIX 1935 -#define IDS_POTION_HUNGER_POSTFIX 1936 -#define IDS_POTION_POISON_POSTFIX 1937 -#define IDS_POTION_WITHER_POSTFIX 1938 -#define IDS_POTION_HEALTHBOOST_POSTFIX 1939 -#define IDS_POTION_ABSORPTION_POSTFIX 1940 -#define IDS_POTION_SATURATION_POSTFIX 1941 -#define IDS_POTION_POTENCY_0 1942 -#define IDS_POTION_POTENCY_1 1943 -#define IDS_POTION_POTENCY_2 1944 -#define IDS_POTION_POTENCY_3 1945 -#define IDS_POTION_PREFIX_GRENADE 1946 -#define IDS_POTION_PREFIX_MUNDANE 1947 -#define IDS_POTION_PREFIX_UNINTERESTING 1948 -#define IDS_POTION_PREFIX_BLAND 1949 -#define IDS_POTION_PREFIX_CLEAR 1950 -#define IDS_POTION_PREFIX_MILKY 1951 -#define IDS_POTION_PREFIX_DIFFUSE 1952 -#define IDS_POTION_PREFIX_ARTLESS 1953 -#define IDS_POTION_PREFIX_THIN 1954 -#define IDS_POTION_PREFIX_AWKWARD 1955 -#define IDS_POTION_PREFIX_FLAT 1956 -#define IDS_POTION_PREFIX_BULKY 1957 -#define IDS_POTION_PREFIX_BUNGLING 1958 -#define IDS_POTION_PREFIX_BUTTERED 1959 -#define IDS_POTION_PREFIX_SMOOTH 1960 -#define IDS_POTION_PREFIX_SUAVE 1961 -#define IDS_POTION_PREFIX_DEBONAIR 1962 -#define IDS_POTION_PREFIX_THICK 1963 -#define IDS_POTION_PREFIX_ELEGANT 1964 -#define IDS_POTION_PREFIX_FANCY 1965 -#define IDS_POTION_PREFIX_CHARMING 1966 -#define IDS_POTION_PREFIX_DASHING 1967 -#define IDS_POTION_PREFIX_REFINED 1968 -#define IDS_POTION_PREFIX_CORDIAL 1969 -#define IDS_POTION_PREFIX_SPARKLING 1970 -#define IDS_POTION_PREFIX_POTENT 1971 -#define IDS_POTION_PREFIX_FOUL 1972 -#define IDS_POTION_PREFIX_ODORLESS 1973 -#define IDS_POTION_PREFIX_RANK 1974 -#define IDS_POTION_PREFIX_HARSH 1975 -#define IDS_POTION_PREFIX_ACRID 1976 -#define IDS_POTION_PREFIX_GROSS 1977 -#define IDS_POTION_PREFIX_STINKY 1978 -#define IDS_POTION_DESC_WATER_BOTTLE 1979 -#define IDS_POTION_DESC_EMPTY 1980 -#define IDS_POTION_DESC_MOVESPEED 1981 -#define IDS_POTION_DESC_MOVESLOWDOWN 1982 -#define IDS_POTION_DESC_DAMAGEBOOST 1983 -#define IDS_POTION_DESC_WEAKNESS 1984 -#define IDS_POTION_DESC_HEAL 1985 -#define IDS_POTION_DESC_HARM 1986 -#define IDS_POTION_DESC_REGENERATION 1987 -#define IDS_POTION_DESC_FIRERESISTANCE 1988 -#define IDS_POTION_DESC_POISON 1989 -#define IDS_POTION_EFFECTS_WHENDRANK 1990 -#define IDS_ATTRIBUTE_NAME_HORSE_JUMPSTRENGTH 1991 -#define IDS_ATTRIBUTE_NAME_ZOMBIE_SPAWNREINFORCEMENTS 1992 -#define IDS_ATTRIBUTE_NAME_GENERIC_MAXHEALTH 1993 -#define IDS_ATTRIBUTE_NAME_GENERIC_FOLLOWRANGE 1994 -#define IDS_ATTRIBUTE_NAME_GENERIC_KNOCKBACKRESISTANCE 1995 -#define IDS_ATTRIBUTE_NAME_GENERIC_MOVEMENTSPEED 1996 -#define IDS_ATTRIBUTE_NAME_GENERIC_ATTACKDAMAGE 1997 -#define IDS_ENCHANTMENT_DAMAGE_ALL 1998 -#define IDS_ENCHANTMENT_DAMAGE_UNDEAD 1999 -#define IDS_ENCHANTMENT_DAMAGE_ARTHROPODS 2000 -#define IDS_ENCHANTMENT_KNOCKBACK 2001 -#define IDS_ENCHANTMENT_FIRE 2002 -#define IDS_ENCHANTMENT_PROTECT_ALL 2003 -#define IDS_ENCHANTMENT_PROTECT_FIRE 2004 -#define IDS_ENCHANTMENT_PROTECT_FALL 2005 -#define IDS_ENCHANTMENT_PROTECT_EXPLOSION 2006 -#define IDS_ENCHANTMENT_PROTECT_PROJECTILE 2007 -#define IDS_ENCHANTMENT_OXYGEN 2008 -#define IDS_ENCHANTMENT_WATER_WORKER 2009 -#define IDS_ENCHANTMENT_DIGGING 2010 -#define IDS_ENCHANTMENT_UNTOUCHING 2011 -#define IDS_ENCHANTMENT_DURABILITY 2012 -#define IDS_ENCHANTMENT_LOOT_BONUS 2013 -#define IDS_ENCHANTMENT_LOOT_BONUS_DIGGER 2014 -#define IDS_ENCHANTMENT_ARROW_DAMAGE 2015 -#define IDS_ENCHANTMENT_ARROW_FIRE 2016 -#define IDS_ENCHANTMENT_ARROW_KNOCKBACK 2017 -#define IDS_ENCHANTMENT_ARROW_INFINITE 2018 -#define IDS_ENCHANTMENT_LEVEL_1 2019 -#define IDS_ENCHANTMENT_LEVEL_2 2020 -#define IDS_ENCHANTMENT_LEVEL_3 2021 -#define IDS_ENCHANTMENT_LEVEL_4 2022 -#define IDS_ENCHANTMENT_LEVEL_5 2023 -#define IDS_ENCHANTMENT_LEVEL_6 2024 -#define IDS_ENCHANTMENT_LEVEL_7 2025 -#define IDS_ENCHANTMENT_LEVEL_8 2026 -#define IDS_ENCHANTMENT_LEVEL_9 2027 -#define IDS_ENCHANTMENT_LEVEL_10 2028 -#define IDS_DESC_EMERALDORE 2029 -#define IDS_DESC_ENDERCHEST 2030 -#define IDS_DESC_TRIPWIRE_SOURCE 2031 -#define IDS_DESC_TRIPWIRE 2032 -#define IDS_DESC_EMERALDBLOCK 2033 -#define IDS_DESC_COBBLESTONE_WALL 2034 -#define IDS_DESC_ANVIL 2035 -#define IDS_DESC_NETHER_QUARTZ_ORE 2036 -#define IDS_DESC_QUARTZ_BLOCK 2037 -#define IDS_DESC_EMERALD 2038 -#define IDS_DESC_FLOWERPOT 2039 -#define IDS_DESC_CARROTS 2040 -#define IDS_DESC_POTATO 2041 -#define IDS_DESC_POTATO_BAKED 2042 -#define IDS_DESC_POTATO_POISONOUS 2043 -#define IDS_DESC_CARROT_GOLDEN 2044 -#define IDS_DESC_CARROT_ON_A_STICK 2045 -#define IDS_DESC_PUMPKIN_PIE 2046 -#define IDS_DESC_ENCHANTED_BOOK 2047 -#define IDS_DESC_NETHER_QUARTZ 2048 -#define IDS_DESC_CARPET 2049 -#define IDS_ITEM_EMERALD 2050 -#define IDS_FLOWERPOT 2051 -#define IDS_CARROTS 2052 -#define IDS_POTATO 2053 -#define IDS_ITEM_POTATO_BAKED 2054 -#define IDS_ITEM_POTATO_POISONOUS 2055 -#define IDS_ITEM_CARROT_GOLDEN 2056 -#define IDS_ITEM_CARROT_ON_A_STICK 2057 -#define IDS_ITEM_PUMPKIN_PIE 2058 -#define IDS_ITEM_ENCHANTED_BOOK 2059 -#define IDS_ITEM_NETHER_QUARTZ 2060 -#define IDS_TILE_EMERALDORE 2061 -#define IDS_TILE_ENDERCHEST 2062 -#define IDS_TILE_TRIPWIRE_SOURCE 2063 -#define IDS_TILE_TRIPWIRE 2064 -#define IDS_TILE_EMERALDBLOCK 2065 -#define IDS_TILE_COBBLESTONE_WALL 2066 -#define IDS_TILE_COBBLESTONE_WALL_MOSSY 2067 -#define IDS_TILE_FLOWERPOT 2068 -#define IDS_TILE_CARROTS 2069 -#define IDS_TILE_POTATOES 2070 -#define IDS_TILE_ANVIL 2071 -#define IDS_TILE_ANVIL_INTACT 2072 -#define IDS_TILE_ANVIL_SLIGHTLYDAMAGED 2073 -#define IDS_TILE_ANVIL_VERYDAMAGED 2074 -#define IDS_TILE_NETHER_QUARTZ 2075 -#define IDS_TILE_QUARTZ_BLOCK 2076 -#define IDS_TILE_QUARTZ_BLOCK_CHISELED 2077 -#define IDS_TILE_QUARTZ_BLOCK_LINES 2078 -#define IDS_TILE_STAIRS_QUARTZ 2079 -#define IDS_TILE_CARPET 2080 -#define IDS_TILE_CARPET_BLACK 2081 -#define IDS_TILE_CARPET_RED 2082 -#define IDS_TILE_CARPET_GREEN 2083 -#define IDS_TILE_CARPET_BROWN 2084 -#define IDS_TILE_CARPET_BLUE 2085 -#define IDS_TILE_CARPET_PURPLE 2086 -#define IDS_TILE_CARPET_CYAN 2087 -#define IDS_TILE_CARPET_SILVER 2088 -#define IDS_TILE_CARPET_GRAY 2089 -#define IDS_TILE_CARPET_PINK 2090 -#define IDS_TILE_CARPET_LIME 2091 -#define IDS_TILE_CARPET_YELLOW 2092 -#define IDS_TILE_CARPET_LIGHT_BLUE 2093 -#define IDS_TILE_CARPET_MAGENTA 2094 -#define IDS_TILE_CARPET_ORANGE 2095 -#define IDS_TILE_CARPET_WHITE 2096 -#define IDS_TILE_SANDSTONE_CHISELED 2097 -#define IDS_TILE_SANDSTONE_SMOOTH 2098 -#define IDS_DEATH_THORNS 2099 -#define IDS_DEATH_FALLING_ANVIL 2100 -#define IDS_DEATH_FALLING_TILE 2101 -#define IDS_COMMAND_TELEPORT_SUCCESS 2102 -#define IDS_COMMAND_TELEPORT_ME 2103 -#define IDS_COMMAND_TELEPORT_TO_ME 2104 -#define IDS_ENCHANTMENT_THORNS 2105 -#define IDS_TILE_STONESLAB_QUARTZ 2106 -#define IDS_POTION_DESC_NIGHTVISION 2107 -#define IDS_POTION_DESC_INVISIBILITY 2108 -#define IDS_REPAIR_AND_NAME 2109 -#define IDS_REPAIR_COST 2110 -#define IDS_REPAIR_EXPENSIVE 2111 -#define IDS_TITLE_RENAME 2112 -#define IDS_YOU_HAVE 2113 -#define IDS_REQUIRED_ITEMS_FOR_TRADE 2114 -#define IDS_VILLAGER_OFFERS_ITEM 2115 -#define IDS_TOOLTIPS_REPAIR 2116 -#define IDS_TOOLTIPS_TRADE 2117 -#define IDS_TOOLTIPS_DYECOLLAR 2118 -#define IDS_TUTORIAL_TASK_ANVIL_MENU_OVERVIEW 2119 -#define IDS_TUTORIAL_PROMPT_ANVIL_MENU_OVERVIEW 2120 -#define IDS_TUTORIAL_TASK_ANVIL_MENU_START 2121 -#define IDS_TUTORIAL_TASK_ANVIL_MENU_REPAIR 2122 -#define IDS_TUTORIAL_TASK_ANVIL_MENU_SACRIFICE 2123 -#define IDS_TUTORIAL_TASK_ANVIL_MENU_ENCHANT 2124 -#define IDS_TUTORIAL_TASK_ANVIL_MENU_COST 2125 -#define IDS_TUTORIAL_TASK_ANVIL_MENU_RENAMING 2126 -#define IDS_TUTORIAL_TASK_ANVIL_MENU_SMITH 2127 -#define IDS_TUTORIAL_TASK_ANVIL_OVERVIEW 2128 -#define IDS_TUTORIAL_PROMPT_ANVIL_OVERVIEW 2129 -#define IDS_TUTORIAL_TASK_ANVIL_SUMMARY 2130 -#define IDS_TUTORIAL_TASK_ANVIL_ENCHANTED_BOOKS 2131 -#define IDS_TUTORIAL_TASK_ANVIL_COST 2132 -#define IDS_TUTORIAL_TASK_ANVIL_COST2 2133 -#define IDS_TUTORIAL_TASK_ANVIL_RENAMING 2134 -#define IDS_TUTORIAL_TASK_ANVIL_USE_CHESTS 2135 -#define IDS_TUTORIAL_TASK_TRADING_MENU_OVERVIEW 2136 -#define IDS_TUTORIAL_PROMPT_TRADING_MENU_OVERVIEW 2137 -#define IDS_TUTORIAL_TASK_TRADING_MENU_START 2138 -#define IDS_TUTORIAL_TASK_TRADING_MENU_UNAVAILABLE 2139 -#define IDS_TUTORIAL_TASK_TRADING_MENU_DETAILS 2140 -#define IDS_TUTORIAL_TASK_TRADING_MENU_INVENTORY 2141 -#define IDS_TUTORIAL_TASK_TRADING_MENU_TRADE 2142 -#define IDS_TUTORIAL_TASK_TRADING_OVERVIEW 2143 -#define IDS_TUTORIAL_PROMPT_TRADING_OVERVIEW 2144 -#define IDS_TUTORIAL_TASK_TRADING_SUMMARY 2145 -#define IDS_TUTORIAL_TASK_TRADING_TRADES 2146 -#define IDS_TUTORIAL_TASK_TRADING_INCREASE_TRADES 2147 -#define IDS_TUTORIAL_TASK_TRADING_DECREASE_TRADES 2148 -#define IDS_TUTORIAL_TASK_TRADING_USE_CHESTS 2149 -#define IDS_TUTORIAL_TASK_ENDERCHEST_OVERVIEW 2150 -#define IDS_TUTORIAL_PROMPT_ENDERCHEST_OVERVIEW 2151 -#define IDS_TUTORIAL_TASK_ENDERCHEST_SUMMARY 2152 -#define IDS_TUTORIAL_TASK_ENDERCHEST_PLAYERS 2153 -#define IDS_TUTORIAL_TASK_ENDERCHEST_FUNCTION 2154 -#define IDS_DESC_ENCHANTED_GOLDENAPPLE 2155 -#define IDS_ENABLE_TELEPORT 2156 -#define IDS_TELEPORT 2157 -#define IDS_TELEPORT_TO_PLAYER 2158 -#define IDS_TELEPORT_TO_ME 2159 -#define IDS_CAN_DISABLE_EXHAUSTION 2160 -#define IDS_CAN_INVISIBLE 2161 -#define IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON 2162 -#define IDS_PRIV_CAN_INVISIBLE_TOGGLE_OFF 2163 -#define IDS_PRIV_CAN_FLY_TOGGLE_ON 2164 -#define IDS_PRIV_CAN_FLY_TOGGLE_OFF 2165 -#define IDS_PRIV_CAN_EXHAUSTION_TOGGLE_ON 2166 -#define IDS_PRIV_CAN_EXHAUSTION_TOGGLE_OFF 2167 -#define IDS_PRIV_CAN_TELEPORT_TOGGLE_ON 2168 -#define IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF 2169 -#define IDS_HOW_TO_PLAY_ANVIL 2170 -#define IDS_HOW_TO_PLAY_TRADING 2171 -#define IDS_HOW_TO_PLAY_ENDERCHEST 2172 -#define IDS_VILLAGER_FARMER 2173 -#define IDS_VILLAGER_LIBRARIAN 2174 -#define IDS_VILLAGER_PRIEST 2175 -#define IDS_VILLAGER_SMITH 2176 -#define IDS_VILLAGER_BUTCHER 2177 -#define IDS_DESC_VILLAGER 2178 -#define IDS_CHEST_LARGE 2179 -#define IDS_TUTORIAL_TASK_ENCHANTING_BOOKS 2180 -#define IDS_TUTORIAL_TASK_REDSTONE_TRIPWIRE 2181 -#define IDS_TUTORIAL_TASK_BREEDING_WOLF_COLLAR 2182 -#define IDS_TUTORIAL_TASK_FARMING_CARROTS_AND_POTATOES 2183 -#define IDS_TUTORIAL_TASK_BREEDING_RIDING_PIGS 2184 -#define IDS_TUTORIAL_TASK_MINECART_PUSHING 2185 -#define IDS_CONNECTION_FAILED_NO_SD_SPLITSCREEN 2186 -#define IDS_TOOLTIPS_CURE 2187 -#define IDS_WINDOWS_EXIT 2188 -#define IDS_SLIDER_FOV 2189 -#define IDS_SLIDER_RENDERDISTANCE 2190 -#define IDS_IN_GAME_OLDSWINGANIMATION 2191 -#define IDS_GRAPHICSMODE_POTATO 2192 -#define IDS_GRAPHICSMODE_FAST 2193 -#define IDS_GRAPHICSMODE_FANCY 2194 -#define IDS_GRAPHICSMODE_EXTRA 2195 -#define IDS_CHECKBOX_CAVESOUNDS 2196 -#define IDS_CHECKBOX_CLASSICCRAFTING 2197 -#define IDS_GENERAL_OPTIONS 2198 -#define IDS_QUALITY_OPTIONS 2199 -#define IDS_LANG_SYSTEM 2200 -#define IDS_LANG_ENGLISH 2201 -#define IDS_LANG_GERMAN 2202 -#define IDS_LANG_SPANISH 2203 -#define IDS_LANG_SPANISH_SPAIN 2204 -#define IDS_LANG_SPANISH_LATIN_AMERICA 2205 -#define IDS_LANG_FRENCH 2206 -#define IDS_LANG_ITALIAN 2207 -#define IDS_LANG_PORTUGUESE 2208 -#define IDS_LANG_PORTUGUESE_PORTUGAL 2209 -#define IDS_LANG_PORTUGUESE_BRAZIL 2210 -#define IDS_LANG_JAPANESE 2211 -#define IDS_LANG_KOREAN 2212 -#define IDS_LANG_CHINESE_TRADITIONAL 2213 -#define IDS_LANG_CHINESE_SIMPLIFIED 2214 -#define IDS_LANG_DANISH 2215 -#define IDS_LANG_FINISH 2216 -#define IDS_LANG_DUTCH 2217 -#define IDS_LANG_POLISH 2218 -#define IDS_LANG_RUSSIAN 2219 -#define IDS_LANG_SWEDISH 2220 -#define IDS_LANG_NORWEGIAN 2221 -#define IDS_LANG_GREEK 2222 -#define IDS_LANG_TURKISH 2223 -#define IDS_LEADERBOARD_KILLS_EASY 2224 -#define IDS_LEADERBOARD_KILLS_NORMAL 2225 -#define IDS_LEADERBOARD_KILLS_HARD 2226 -#define IDS_LEADERBOARD_MINING_BLOCKS_PEACEFUL 2227 -#define IDS_LEADERBOARD_MINING_BLOCKS_EASY 2228 -#define IDS_LEADERBOARD_MINING_BLOCKS_NORMAL 2229 -#define IDS_LEADERBOARD_MINING_BLOCKS_HARD 2230 -#define IDS_LEADERBOARD_FARMING_PEACEFUL 2231 -#define IDS_LEADERBOARD_FARMING_EASY 2232 -#define IDS_LEADERBOARD_FARMING_NORMAL 2233 -#define IDS_LEADERBOARD_FARMING_HARD 2234 -#define IDS_LEADERBOARD_TRAVELLING_PEACEFUL 2235 -#define IDS_LEADERBOARD_TRAVELLING_EASY 2236 -#define IDS_LEADERBOARD_TRAVELLING_NORMAL 2237 -#define IDS_LEADERBOARD_TRAVELLING_HARD 2238 -#define IDS_TIPS_GAMETIP_0 2239 -#define IDS_TIPS_GAMETIP_1 2240 -#define IDS_TIPS_GAMETIP_48 2241 -#define IDS_TIPS_GAMETIP_44 2242 -#define IDS_TIPS_GAMETIP_45 2243 -#define IDS_TIPS_TRIVIA_4 2244 -#define IDS_TIPS_TRIVIA_17 2245 -#define IDS_HOW_TO_PLAY_MULTIPLAYER 2246 -#define IDS_HOW_TO_PLAY_SOCIALMEDIA 2247 -#define IDS_HOW_TO_PLAY_CREATIVE 2248 -#define IDS_TUTORIAL_TASK_FLY 2249 -#define IDS_TOOLTIPS_SELECTDEVICE 2250 -#define IDS_TOOLTIPS_CHANGEDEVICE 2251 -#define IDS_TOOLTIPS_VIEW_GAMERCARD 2252 -#define IDS_TOOLTIPS_VIEW_GAMERPROFILE 2253 -#define IDS_TOOLTIPS_INVITE_PARTY 2254 -#define IDS_CONFIRM_START_CREATIVE 2255 -#define IDS_CONFIRM_START_SAVEDINCREATIVE 2256 -#define IDS_CONFIRM_START_SAVEDINCREATIVE_CONTINUE 2257 -#define IDS_CONFIRM_START_HOST_PRIVILEGES 2258 -#define IDS_CONNECTION_LOST_LIVE 2259 -#define IDS_CONNECTION_LOST_LIVE_NO_EXIT 2260 -#define IDS_AWARD_AVATAR1 2261 -#define IDS_AWARD_AVATAR2 2262 -#define IDS_AWARD_AVATAR3 2263 -#define IDS_AWARD_THEME 2264 -#define IDS_UNLOCK_ACHIEVEMENT_TEXT 2265 -#define IDS_UNLOCK_AVATAR_TEXT 2266 -#define IDS_UNLOCK_GAMERPIC_TEXT 2267 -#define IDS_UNLOCK_THEME_TEXT 2268 -#define IDS_UNLOCK_ACCEPT_INVITE 2269 -#define IDS_UNLOCK_GUEST_TEXT 2270 -#define IDS_LEADERBOARD_GAMERTAG 2271 -#define IDS_GROUPNAME_POTIONS_480 2272 -#define IDS_RETURNEDTOTITLESCREEN_TEXT 2273 -#define IDS_TRIALOVER_TEXT 2274 -#define IDS_FATAL_ERROR_TEXT 2275 -#define IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT 2276 -#define IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT 2277 -#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL 2278 -#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL 2279 -#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_REMOTE 2280 -#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE 2281 -#define IDS_SAVE_ICON_MESSAGE 2282 -#define IDS_GAMEOPTION_HOST_PRIVILEGES 2283 -#define IDS_CHECKBOX_DISPLAY_SPLITSCREENGAMERTAGS 2284 -#define IDS_ACHIEVEMENTS 2285 -#define IDS_LABEL_GAMERTAGS 2286 -#define IDS_IN_GAME_GAMERTAGS 2287 -#define IDS_SOCIAL_DEFAULT_DESCRIPTION 2288 -#define IDS_TITLE_UPDATE_NAME 2289 -#define IDS_PLATFORM_NAME 2290 -#define IDS_BACK_BUTTON 2291 -#define IDS_HOST_OPTION_DISABLES_ACHIEVEMENTS 2292 -#define IDS_KICK_PLAYER_DESCRIPTION 2293 -#define IDS_USING_TRIAL_TEXUREPACK_WARNING 2294 -#define IDS_WORLD_SIZE_TITLE_SMALL 2295 -#define IDS_WORLD_SIZE_TITLE_MEDIUM 2296 -#define IDS_WORLD_SIZE_TITLE_LARGE 2297 -#define IDS_WORLD_SIZE_TITLE_CLASSIC 2298 -#define IDS_WORLD_SIZE 2299 -#define IDS_GAMEOPTION_WORLD_SIZE 2300 -#define IDS_DISABLE_SAVING 2301 -#define IDS_GAMEOPTION_DISABLE_SAVING 2302 -#define IDS_RICHPRESENCE_GAMESTATE 2303 -#define IDS_RICHPRESENCE_IDLE 2304 -#define IDS_RICHPRESENCE_MENUS 2305 -#define IDS_RICHPRESENCE_MULTIPLAYER 2306 -#define IDS_RICHPRESENCE_MULTIPLAYEROFFLINE 2307 -#define IDS_RICHPRESENCE_MULTIPLAYER_1P 2308 -#define IDS_RICHPRESENCE_MULTIPLAYER_1POFFLINE 2309 -#define IDS_RICHPRESENCESTATE_BLANK 2310 -#define IDS_RICHPRESENCESTATE_RIDING_PIG 2311 -#define IDS_RICHPRESENCESTATE_RIDING_MINECART 2312 -#define IDS_RICHPRESENCESTATE_BOATING 2313 -#define IDS_RICHPRESENCESTATE_FISHING 2314 -#define IDS_RICHPRESENCESTATE_CRAFTING 2315 -#define IDS_RICHPRESENCESTATE_FORGING 2316 -#define IDS_RICHPRESENCESTATE_NETHER 2317 -#define IDS_RICHPRESENCESTATE_CD 2318 -#define IDS_RICHPRESENCESTATE_MAP 2319 -#define IDS_RICHPRESENCESTATE_ENCHANTING 2320 -#define IDS_RICHPRESENCESTATE_BREWING 2321 -#define IDS_RICHPRESENCESTATE_ANVIL 2322 -#define IDS_RICHPRESENCESTATE_TRADING 2323 -#define IDS_RICHPRESENCESTATE_BEACON 2324 -#define IDS_RICHPRESENCESTATE_END 2325 -#define IDS_RICHPRESENCESTATE_END_POEM 2326 -#define IDS_RICHPRESENCESTATE_FIREWORKS 2327 -#define IDS_RICHPRESENCESTATE_FURNACE 2328 -#define IDS_RICHPRESENCESTATE_HOPPER 2329 -#define IDS_RICHPRESENCESTATE_HORSE 2330 -#define IDS_RICHPRESENCESTATE_RIDING_HORSE 2331 -#define IDS_RICHPRESENCESTATE_SIGN 2332 +#define IDS_DESC_SIGN 261 +#define IDS_DESC_GLOWSTONE 262 +#define IDS_DESC_TNT 263 +#define IDS_DESC_BOWL 264 +#define IDS_DESC_BUCKET 265 +#define IDS_DESC_BUCKET_WATER 266 +#define IDS_DESC_BUCKET_LAVA 267 +#define IDS_DESC_BUCKET_MILK 268 +#define IDS_DESC_FLINTANDSTEEL 269 +#define IDS_DESC_FISHINGROD 270 +#define IDS_DESC_CLOCK 271 +#define IDS_DESC_COMPASS 272 +#define IDS_DESC_MAP 273 +#define IDS_DESC_MAP_EMPTY 274 +#define IDS_DESC_BOW 275 +#define IDS_DESC_ARROW 276 +#define IDS_DESC_NETHER_STAR 277 +#define IDS_DESC_FIREWORKS 278 +#define IDS_DESC_FIREWORKS_CHARGE 279 +#define IDS_DESC_COMPARATOR 280 +#define IDS_DESC_MINECART_TNT 281 +#define IDS_DESC_DAYLIGHT_DETECTOR 282 +#define IDS_DESC_MINECART_HOPPER 283 +#define IDS_DESC_IRON_HORSE_ARMOR 284 +#define IDS_DESC_GOLD_HORSE_ARMOR 285 +#define IDS_DESC_DIAMOND_HORSE_ARMOR 286 +#define IDS_DESC_LEAD 287 +#define IDS_DESC_NAME_TAG 288 +#define IDS_DESC_BREAD 289 +#define IDS_DESC_CAKE 290 +#define IDS_DESC_COOKIE 291 +#define IDS_DESC_MELON_SLICE 292 +#define IDS_DESC_MUSHROOMSTEW 293 +#define IDS_DESC_CHICKEN_RAW 294 +#define IDS_DESC_CHICKEN_COOKED 295 +#define IDS_DESC_BEEF_RAW 296 +#define IDS_DESC_BEEF_COOKED 297 +#define IDS_DESC_PORKCHOP_RAW 298 +#define IDS_DESC_PORKCHOP_COOKED 299 +#define IDS_DESC_FISH_RAW 300 +#define IDS_DESC_FISH_COOKED 301 +#define IDS_DESC_APPLE 302 +#define IDS_DESC_GOLDENAPPLE 303 +#define IDS_DESC_ROTTEN_FLESH 304 +#define IDS_DESC_SUGAR 305 +#define IDS_DESC_LEVER 306 +#define IDS_DESC_REDSTONETORCH 307 +#define IDS_DESC_REDSTONEREPEATER 308 +#define IDS_DESC_BUTTON 309 +#define IDS_DESC_DISPENSER 310 +#define IDS_DESC_NOTEBLOCK 311 +#define IDS_DESC_RAIL 312 +#define IDS_DESC_POWEREDRAIL 313 +#define IDS_DESC_DETECTORRAIL 314 +#define IDS_DESC_MINECART 315 +#define IDS_DESC_MINECARTWITHCHEST 316 +#define IDS_DESC_MINECARTWITHFURNACE 317 +#define IDS_DESC_BOAT 318 +#define IDS_DESC_WOOL 319 +#define IDS_DESC_WOOLSTRING 320 +#define IDS_DESC_DYE_BLACK 321 +#define IDS_DESC_DYE_GREEN 322 +#define IDS_DESC_DYE_BROWN 323 +#define IDS_DESC_DYE_SILVER 324 +#define IDS_DESC_DYE_YELLOW 325 +#define IDS_DESC_DYE_RED 326 +#define IDS_DESC_DYE_WHITE 327 +#define IDS_DESC_DYE_PINK 328 +#define IDS_DESC_DYE_ORANGE 329 +#define IDS_DESC_DYE_LIME 330 +#define IDS_DESC_DYE_GRAY 331 +#define IDS_DESC_DYE_LIGHTGRAY 332 +#define IDS_DESC_DYE_LIGHTBLUE 333 +#define IDS_DESC_DYE_CYAN 334 +#define IDS_DESC_DYE_PURPLE 335 +#define IDS_DESC_DYE_MAGENTA 336 +#define IDS_DESC_DYE_BLUE 337 +#define IDS_DESC_JUKEBOX 338 +#define IDS_DESC_DIAMONDS 339 +#define IDS_DESC_JACKOLANTERN 340 +#define IDS_DESC_PAPER 341 +#define IDS_DESC_BOOK 342 +#define IDS_DESC_BOOKSHELF 343 +#define IDS_DESC_PICTURE 344 +#define IDS_DESC_ORE_GOLD 345 +#define IDS_DESC_ORE_IRON 346 +#define IDS_DESC_ORE_COAL 347 +#define IDS_DESC_ORE_LAPIS 348 +#define IDS_DESC_ORE_DIAMOND 349 +#define IDS_DESC_ORE_REDSTONE 350 +#define IDS_DESC_STONE 351 +#define IDS_DESC_DIRT 352 +#define IDS_DESC_SAPLING 353 +#define IDS_DESC_BEDROCK 354 +#define IDS_DESC_LAVA 355 +#define IDS_DESC_SAND 356 +#define IDS_DESC_GRAVEL 357 +#define IDS_DESC_LOG 358 +#define IDS_DESC_GLASS 359 +#define IDS_DESC_STONE_BRICK 360 +#define IDS_DESC_BRICK 361 +#define IDS_DESC_CLAY 362 +#define IDS_DESC_CLAY_TILE 363 +#define IDS_DESC_SNOW 364 +#define IDS_DESC_TOP_SNOW 365 +#define IDS_DESC_TALL_GRASS 366 +#define IDS_DESC_FLOWER 367 +#define IDS_DESC_MUSHROOM 368 +#define IDS_DESC_OBSIDIAN 369 +#define IDS_DESC_MOB_SPAWNER 370 +#define IDS_DESC_REDSTONE_DUST 371 +#define IDS_DESC_CROPS 372 +#define IDS_DESC_FARMLAND 373 +#define IDS_DESC_CACTUS 374 +#define IDS_DESC_REEDS 375 +#define IDS_DESC_PUMPKIN 376 +#define IDS_DESC_HELL_ROCK 377 +#define IDS_DESC_HELL_SAND 378 +#define IDS_DESC_PORTAL 379 +#define IDS_DESC_COAL 380 +#define IDS_DESC_STRING 381 +#define IDS_DESC_FEATHER 382 +#define IDS_DESC_SULPHUR 383 +#define IDS_DESC_WHEAT_SEEDS 384 +#define IDS_DESC_WHEAT 385 +#define IDS_DESC_FLINT 386 +#define IDS_DESC_SADDLE 387 +#define IDS_DESC_SNOWBALL 388 +#define IDS_DESC_LEATHER 389 +#define IDS_DESC_SLIMEBALL 390 +#define IDS_DESC_EGG 391 +#define IDS_DESC_YELLOW_DUST 392 +#define IDS_DESC_BONE 393 +#define IDS_DESC_RECORD 394 +#define IDS_DESC_WATER 395 +#define IDS_DESC_LEAVES 396 +#define IDS_DESC_MOSS_STONE 397 +#define IDS_DESC_SHEARS 398 +#define IDS_DESC_PISTON 399 +#define IDS_DESC_STICKY_PISTON 400 +#define IDS_DESC_STONE_BRICK_SMOOTH 401 +#define IDS_DESC_IRON_FENCE 402 +#define IDS_DESC_FENCE_GATE 403 +#define IDS_DESC_MELON_BLOCK 404 +#define IDS_DESC_THIN_GLASS 405 +#define IDS_DESC_PUMPKIN_SEEDS 406 +#define IDS_DESC_MELON_SEEDS 407 +#define IDS_DESC_ENDER_PEARL 408 +#define IDS_DESC_GRASS 409 +#define IDS_DESC_SPONGE 410 +#define IDS_DESC_WEB 411 +#define IDS_DESC_STONE_SILVERFISH 412 +#define IDS_DESC_VINE 413 +#define IDS_DESC_ICE 414 +#define IDS_DESC_DEAD_BUSH 415 +#define IDS_DESC_BLAZE_ROD 416 +#define IDS_DESC_GHAST_TEAR 417 +#define IDS_DESC_GOLD_NUGGET 418 +#define IDS_DESC_NETHER_STALK_SEEDS 419 +#define IDS_DESC_POTION 420 +#define IDS_DESC_GLASS_BOTTLE 421 +#define IDS_DESC_SPIDER_EYE 422 +#define IDS_DESC_FERMENTED_SPIDER_EYE 423 +#define IDS_DESC_BLAZE_POWDER 424 +#define IDS_DESC_MAGMA_CREAM 425 +#define IDS_DESC_BREWING_STAND 426 +#define IDS_DESC_CAULDRON 427 +#define IDS_DESC_EYE_OF_ENDER 428 +#define IDS_DESC_SPECKLED_MELON 429 +#define IDS_DESC_MYCEL 430 +#define IDS_DESC_WATERLILY 431 +#define IDS_DESC_NETHERBRICK 432 +#define IDS_DESC_NETHERFENCE 433 +#define IDS_DESC_NETHERSTALK 434 +#define IDS_DESC_ENCHANTMENTTABLE 435 +#define IDS_DESC_END_PORTAL 436 +#define IDS_DESC_ENDPORTALFRAME 437 +#define IDS_DESC_WHITESTONE 438 +#define IDS_DESC_DRAGONEGG 439 +#define IDS_DESC_EXP_BOTTLE 440 +#define IDS_DESC_FIREBALL 441 +#define IDS_DESC_ITEMFRAME 442 +#define IDS_DESC_MONSTER_SPAWNER 443 +#define IDS_DESC_WOODSLAB 444 +#define IDS_DESC_STONESLAB 445 +#define IDS_DESC_ITEM_NETHERBRICK 446 +#define IDS_DESC_REDSTONE_LIGHT 447 +#define IDS_DESC_COCOA 448 +#define IDS_DESC_SKULL 449 +#define IDS_DESC_COMMAND_BLOCK 450 +#define IDS_DESC_BEACON 451 +#define IDS_DESC_CHEST_TRAP 452 +#define IDS_DESC_WEIGHTED_PLATE_LIGHT 453 +#define IDS_DESC_WEIGHTED_PLATE_HEAVY 454 +#define IDS_DESC_REDSTONE_BLOCK 455 +#define IDS_DESC_HOPPER 456 +#define IDS_DESC_ACTIVATOR_RAIL 457 +#define IDS_DESC_DROPPER 458 +#define IDS_DESC_STAINED_CLAY 459 +#define IDS_DESC_HAY 460 +#define IDS_DESC_HARDENED_CLAY 461 +#define IDS_DESC_STAINED_GLASS 462 +#define IDS_DESC_STAINED_GLASS_PANE 463 +#define IDS_DESC_COAL_BLOCK 464 +#define IDS_SQUID 465 +#define IDS_DESC_SQUID 466 +#define IDS_COW 467 +#define IDS_DESC_COW 468 +#define IDS_SHEEP 469 +#define IDS_DESC_SHEEP 470 +#define IDS_CHICKEN 471 +#define IDS_DESC_CHICKEN 472 +#define IDS_PIG 473 +#define IDS_DESC_PIG 474 +#define IDS_WOLF 475 +#define IDS_DESC_WOLF 476 +#define IDS_CREEPER 477 +#define IDS_DESC_CREEPER 478 +#define IDS_SKELETON 479 +#define IDS_DESC_SKELETON 480 +#define IDS_SPIDER 481 +#define IDS_DESC_SPIDER 482 +#define IDS_ZOMBIE 483 +#define IDS_DESC_ZOMBIE 484 +#define IDS_PIGZOMBIE 485 +#define IDS_DESC_PIGZOMBIE 486 +#define IDS_GHAST 487 +#define IDS_DESC_GHAST 488 +#define IDS_SLIME 489 +#define IDS_DESC_SLIME 490 +#define IDS_ENDERMAN 491 +#define IDS_DESC_ENDERMAN 492 +#define IDS_SILVERFISH 493 +#define IDS_DESC_SILVERFISH 494 +#define IDS_CAVE_SPIDER 495 +#define IDS_DESC_CAVE_SPIDER 496 +#define IDS_MUSHROOM_COW 497 +#define IDS_DESC_MUSHROOM_COW 498 +#define IDS_SNOWMAN 499 +#define IDS_DESC_SNOWMAN 500 +#define IDS_ENDERDRAGON 501 +#define IDS_DESC_ENDERDRAGON 502 +#define IDS_BLAZE 503 +#define IDS_DESC_BLAZE 504 +#define IDS_LAVA_SLIME 505 +#define IDS_DESC_LAVA_SLIME 506 +#define IDS_VILLAGER 507 +#define IDS_OZELOT 508 +#define IDS_DESC_OZELOT 509 +#define IDS_IRONGOLEM 510 +#define IDS_DESC_IRONGOLEM 511 +#define IDS_BAT 512 +#define IDS_DESC_BAT 513 +#define IDS_WITCH 514 +#define IDS_DESC_WITCH 515 +#define IDS_HORSE 516 +#define IDS_DESC_HORSE 517 +#define IDS_DONKEY 518 +#define IDS_DESC_DONKEY 519 +#define IDS_MULE 520 +#define IDS_DESC_MULE 521 +#define IDS_ZOMBIE_HORSE 522 +#define IDS_SKELETON_HORSE 523 +#define IDS_WITHER 524 +#define IDS_DESC_WITHER 525 +#define IDS_CREDITS_EXPLODANIM 526 +#define IDS_CREDITS_CONCEPTART 527 +#define IDS_CREDITS_CRUNCHER 528 +#define IDS_CREDITS_BULLYCOORD 529 +#define IDS_CREDITS_ORIGINALDESIGN 530 +#define IDS_CREDITS_PMPROD 531 +#define IDS_CREDITS_RESTOFMOJANG 532 +#define IDS_CREDITS_LEADPC 533 +#define IDS_CREDITS_CODENINJA 534 +#define IDS_CREDITS_CEO 535 +#define IDS_CREDITS_WCW 536 +#define IDS_CREDITS_CUSTOMERSUPPORT 537 +#define IDS_CREDITS_OFFICEDJ 538 +#define IDS_CREDITS_DESPROG 539 +#define IDS_CREDITS_DEVELOPER 540 +#define IDS_CREDITS_CHIEFARCHITECT 541 +#define IDS_CREDITS_ARTDEVELOPER 542 +#define IDS_CREDITS_GAMECRAFTER 543 +#define IDS_CREDITS_DOF 544 +#define IDS_CREDITS_MUSICANDSOUNDS 545 +#define IDS_CREDITS_PROGRAMMING 546 +#define IDS_CREDITS_ART 547 +#define IDS_CREDITS_QA 548 +#define IDS_CREDITS_EXECPRODUCER 549 +#define IDS_CREDITS_LEADPRODUCER 550 +#define IDS_CREDITS_PRODUCER 551 +#define IDS_CREDITS_TESTLEAD 552 +#define IDS_CREDITS_LEADTESTER 553 +#define IDS_CREDITS_DESIGNTEAM 554 +#define IDS_CREDITS_DEVELOPMENTTEAM 555 +#define IDS_CREDITS_RELEASEMANAGEMENT 556 +#define IDS_CREDITS_XBLADIRECTOR 557 +#define IDS_CREDITS_BIZDEV 558 +#define IDS_CREDITS_PORTFOLIODIRECTOR 559 +#define IDS_CREDITS_PRODUCTMANAGER 560 +#define IDS_CREDITS_MARKETING 561 +#define IDS_CREDITS_COMMUNITYMANAGER 562 +#define IDS_CREDITS_EUROPELOC 563 +#define IDS_CREDITS_REDMONDLOC 564 +#define IDS_CREDITS_ASIALOC 565 +#define IDS_CREDITS_USERRESEARCH 566 +#define IDS_CREDITS_MGSCENTRAL 567 +#define IDS_CREDITS_MILESTONEACCEPT 568 +#define IDS_CREDITS_SPECIALTHANKS 569 +#define IDS_CREDITS_TESTMANAGER 570 +#define IDS_CREDITS_SRTESTLEAD 571 +#define IDS_CREDITS_SDET 572 +#define IDS_CREDITS_PROJECT 573 +#define IDS_CREDITS_ADDITIONALSTE 574 +#define IDS_CREDITS_TESTASSOCIATES 575 +#define IDS_CREDITS_JON_KAGSTROM 576 +#define IDS_CREDITS_TOBIAS_MOLLSTAM 577 +#define IDS_CREDITS_RISE_LUGO 578 +#define IDS_ITEM_SWORD_WOOD 579 +#define IDS_ITEM_SWORD_STONE 580 +#define IDS_ITEM_SWORD_IRON 581 +#define IDS_ITEM_SWORD_DIAMOND 582 +#define IDS_ITEM_SWORD_GOLD 583 +#define IDS_ITEM_SHOVEL_WOOD 584 +#define IDS_ITEM_SHOVEL_STONE 585 +#define IDS_ITEM_SHOVEL_IRON 586 +#define IDS_ITEM_SHOVEL_DIAMOND 587 +#define IDS_ITEM_SHOVEL_GOLD 588 +#define IDS_ITEM_PICKAXE_WOOD 589 +#define IDS_ITEM_PICKAXE_STONE 590 +#define IDS_ITEM_PICKAXE_IRON 591 +#define IDS_ITEM_PICKAXE_DIAMOND 592 +#define IDS_ITEM_PICKAXE_GOLD 593 +#define IDS_ITEM_HATCHET_WOOD 594 +#define IDS_ITEM_HATCHET_STONE 595 +#define IDS_ITEM_HATCHET_IRON 596 +#define IDS_ITEM_HATCHET_DIAMOND 597 +#define IDS_ITEM_HATCHET_GOLD 598 +#define IDS_ITEM_HOE_WOOD 599 +#define IDS_ITEM_HOE_STONE 600 +#define IDS_ITEM_HOE_IRON 601 +#define IDS_ITEM_HOE_DIAMOND 602 +#define IDS_ITEM_HOE_GOLD 603 +#define IDS_ITEM_DOOR_WOOD 604 +#define IDS_ITEM_DOOR_IRON 605 +#define IDS_ITEM_HELMET_CHAIN 606 +#define IDS_ITEM_CHESTPLATE_CHAIN 607 +#define IDS_ITEM_LEGGINGS_CHAIN 608 +#define IDS_ITEM_BOOTS_CHAIN 609 +#define IDS_ITEM_HELMET_CLOTH 610 +#define IDS_ITEM_HELMET_IRON 611 +#define IDS_ITEM_HELMET_DIAMOND 612 +#define IDS_ITEM_HELMET_GOLD 613 +#define IDS_ITEM_CHESTPLATE_CLOTH 614 +#define IDS_ITEM_CHESTPLATE_IRON 615 +#define IDS_ITEM_CHESTPLATE_DIAMOND 616 +#define IDS_ITEM_CHESTPLATE_GOLD 617 +#define IDS_ITEM_LEGGINGS_CLOTH 618 +#define IDS_ITEM_LEGGINGS_IRON 619 +#define IDS_ITEM_LEGGINGS_DIAMOND 620 +#define IDS_ITEM_LEGGINGS_GOLD 621 +#define IDS_ITEM_BOOTS_CLOTH 622 +#define IDS_ITEM_BOOTS_IRON 623 +#define IDS_ITEM_BOOTS_DIAMOND 624 +#define IDS_ITEM_BOOTS_GOLD 625 +#define IDS_ITEM_INGOT_IRON 626 +#define IDS_ITEM_INGOT_GOLD 627 +#define IDS_ITEM_BUCKET 628 +#define IDS_ITEM_BUCKET_WATER 629 +#define IDS_ITEM_BUCKET_LAVA 630 +#define IDS_ITEM_FLINT_AND_STEEL 631 +#define IDS_ITEM_APPLE 632 +#define IDS_ITEM_BOW 633 +#define IDS_ITEM_ARROW 634 +#define IDS_ITEM_COAL 635 +#define IDS_ITEM_CHARCOAL 636 +#define IDS_ITEM_DIAMOND 637 +#define IDS_ITEM_STICK 638 +#define IDS_ITEM_BOWL 639 +#define IDS_ITEM_MUSHROOM_STEW 640 +#define IDS_ITEM_STRING 641 +#define IDS_ITEM_FEATHER 642 +#define IDS_ITEM_SULPHUR 643 +#define IDS_ITEM_WHEAT_SEEDS 644 +#define IDS_ITEM_WHEAT 645 +#define IDS_ITEM_BREAD 646 +#define IDS_ITEM_FLINT 647 +#define IDS_ITEM_PORKCHOP_RAW 648 +#define IDS_ITEM_PORKCHOP_COOKED 649 +#define IDS_ITEM_PAINTING 650 +#define IDS_ITEM_APPLE_GOLD 651 +#define IDS_ITEM_SIGN 652 +#define IDS_ITEM_MINECART 653 +#define IDS_ITEM_SADDLE 654 +#define IDS_ITEM_REDSTONE 655 +#define IDS_ITEM_SNOWBALL 656 +#define IDS_ITEM_BOAT 657 +#define IDS_ITEM_LEATHER 658 +#define IDS_ITEM_BUCKET_MILK 659 +#define IDS_ITEM_BRICK 660 +#define IDS_ITEM_CLAY 661 +#define IDS_ITEM_REEDS 662 +#define IDS_ITEM_PAPER 663 +#define IDS_ITEM_BOOK 664 +#define IDS_ITEM_SLIMEBALL 665 +#define IDS_ITEM_MINECART_CHEST 666 +#define IDS_ITEM_MINECART_FURNACE 667 +#define IDS_ITEM_EGG 668 +#define IDS_ITEM_COMPASS 669 +#define IDS_ITEM_FISHING_ROD 670 +#define IDS_ITEM_CLOCK 671 +#define IDS_ITEM_YELLOW_DUST 672 +#define IDS_ITEM_FISH_RAW 673 +#define IDS_ITEM_FISH_COOKED 674 +#define IDS_ITEM_DYE_POWDER 675 +#define IDS_ITEM_DYE_POWDER_BLACK 676 +#define IDS_ITEM_DYE_POWDER_RED 677 +#define IDS_ITEM_DYE_POWDER_GREEN 678 +#define IDS_ITEM_DYE_POWDER_BROWN 679 +#define IDS_ITEM_DYE_POWDER_BLUE 680 +#define IDS_ITEM_DYE_POWDER_PURPLE 681 +#define IDS_ITEM_DYE_POWDER_CYAN 682 +#define IDS_ITEM_DYE_POWDER_SILVER 683 +#define IDS_ITEM_DYE_POWDER_GRAY 684 +#define IDS_ITEM_DYE_POWDER_PINK 685 +#define IDS_ITEM_DYE_POWDER_LIME 686 +#define IDS_ITEM_DYE_POWDER_YELLOW 687 +#define IDS_ITEM_DYE_POWDER_LIGHT_BLUE 688 +#define IDS_ITEM_DYE_POWDER_MAGENTA 689 +#define IDS_ITEM_DYE_POWDER_ORANGE 690 +#define IDS_ITEM_DYE_POWDER_WHITE 691 +#define IDS_ITEM_BONE 692 +#define IDS_ITEM_SUGAR 693 +#define IDS_ITEM_CAKE 694 +#define IDS_ITEM_BED 695 +#define IDS_ITEM_DIODE 696 +#define IDS_ITEM_COOKIE 697 +#define IDS_ITEM_MAP 698 +#define IDS_ITEM_MAP_EMPTY 699 +#define IDS_ITEM_RECORD_01 700 +#define IDS_ITEM_RECORD_02 701 +#define IDS_ITEM_RECORD_03 702 +#define IDS_ITEM_RECORD_04 703 +#define IDS_ITEM_RECORD_05 704 +#define IDS_ITEM_RECORD_06 705 +#define IDS_ITEM_RECORD_07 706 +#define IDS_ITEM_RECORD_08 707 +#define IDS_ITEM_RECORD_09 708 +#define IDS_ITEM_RECORD_10 709 +#define IDS_ITEM_RECORD_11 710 +#define IDS_ITEM_RECORD_12 711 +#define IDS_ITEM_SHEARS 712 +#define IDS_ITEM_PUMPKIN_SEEDS 713 +#define IDS_ITEM_MELON_SEEDS 714 +#define IDS_ITEM_CHICKEN_RAW 715 +#define IDS_ITEM_CHICKEN_COOKED 716 +#define IDS_ITEM_BEEF_RAW 717 +#define IDS_ITEM_BEEF_COOKED 718 +#define IDS_ITEM_ROTTEN_FLESH 719 +#define IDS_ITEM_ENDER_PEARL 720 +#define IDS_ITEM_MELON_SLICE 721 +#define IDS_ITEM_BLAZE_ROD 722 +#define IDS_ITEM_GHAST_TEAR 723 +#define IDS_ITEM_GOLD_NUGGET 724 +#define IDS_ITEM_NETHER_STALK_SEEDS 725 +#define IDS_ITEM_POTION 726 +#define IDS_ITEM_GLASS_BOTTLE 727 +#define IDS_ITEM_WATER_BOTTLE 728 +#define IDS_ITEM_SPIDER_EYE 729 +#define IDS_ITEM_FERMENTED_SPIDER_EYE 730 +#define IDS_ITEM_BLAZE_POWDER 731 +#define IDS_ITEM_MAGMA_CREAM 732 +#define IDS_ITEM_BREWING_STAND 733 +#define IDS_ITEM_CAULDRON 734 +#define IDS_ITEM_EYE_OF_ENDER 735 +#define IDS_ITEM_SPECKLED_MELON 736 +#define IDS_ITEM_EXP_BOTTLE 737 +#define IDS_ITEM_FIREBALL 738 +#define IDS_ITEM_FIREBALLCHARCOAL 739 +#define IDS_ITEM_FIREBALLCOAL 740 +#define IDS_ITEM_ITEMFRAME 741 +#define IDS_ITEM_MONSTER_SPAWNER 742 +#define IDS_ITEM_NETHERBRICK 743 +#define IDS_ITEM_SKULL 744 +#define IDS_ITEM_SKULL_SKELETON 745 +#define IDS_ITEM_SKULL_WITHER 746 +#define IDS_ITEM_SKULL_ZOMBIE 747 +#define IDS_ITEM_SKULL_CHARACTER 748 +#define IDS_ITEM_SKULL_PLAYER 749 +#define IDS_ITEM_SKULL_CREEPER 750 +#define IDS_NETHER_STAR 751 +#define IDS_FIREWORKS 752 +#define IDS_FIREWORKS_CHARGE 753 +#define IDS_ITEM_COMPARATOR 754 +#define IDS_ITEM_MINECART_TNT 755 +#define IDS_ITEM_MINECART_HOPPER 756 +#define IDS_ITEM_IRON_HORSE_ARMOR 757 +#define IDS_ITEM_GOLD_HORSE_ARMOR 758 +#define IDS_ITEM_DIAMOND_HORSE_ARMOR 759 +#define IDS_ITEM_LEAD 760 +#define IDS_ITEM_NAME_TAG 761 +#define IDS_TILE_STONE 762 +#define IDS_TILE_GRASS 763 +#define IDS_TILE_DIRT 764 +#define IDS_TILE_STONE_BRICK 765 +#define IDS_TILE_OAKWOOD_PLANKS 766 +#define IDS_TILE_SPRUCEWOOD_PLANKS 767 +#define IDS_TILE_BIRCHWOOD_PLANKS 768 +#define IDS_TILE_JUNGLE_PLANKS 769 +#define IDS_TILE_PLANKS 770 +#define IDS_TILE_SAPLING 771 +#define IDS_TILE_SAPLING_OAK 772 +#define IDS_TILE_SAPLING_SPRUCE 773 +#define IDS_TILE_SAPLING_BIRCH 774 +#define IDS_TILE_SAPLING_JUNGLE 775 +#define IDS_TILE_BEDROCK 776 +#define IDS_TILE_WATER 777 +#define IDS_TILE_LAVA 778 +#define IDS_TILE_SAND 779 +#define IDS_TILE_SANDSTONE 780 +#define IDS_TILE_GRAVEL 781 +#define IDS_TILE_ORE_GOLD 782 +#define IDS_TILE_ORE_IRON 783 +#define IDS_TILE_ORE_COAL 784 +#define IDS_TILE_LOG 785 +#define IDS_TILE_LOG_OAK 786 +#define IDS_TILE_LOG_SPRUCE 787 +#define IDS_TILE_LOG_BIRCH 788 +#define IDS_TILE_LOG_JUNGLE 789 +#define IDS_TILE_OAK 790 +#define IDS_TILE_SPRUCE 791 +#define IDS_TILE_BIRCH 792 +#define IDS_TILE_LEAVES 793 +#define IDS_TILE_LEAVES_OAK 794 +#define IDS_TILE_LEAVES_SPRUCE 795 +#define IDS_TILE_LEAVES_BIRCH 796 +#define IDS_TILE_LEAVES_JUNGLE 797 +#define IDS_TILE_SPONGE 798 +#define IDS_TILE_GLASS 799 +#define IDS_TILE_CLOTH 800 +#define IDS_TILE_CLOTH_BLACK 801 +#define IDS_TILE_CLOTH_RED 802 +#define IDS_TILE_CLOTH_GREEN 803 +#define IDS_TILE_CLOTH_BROWN 804 +#define IDS_TILE_CLOTH_BLUE 805 +#define IDS_TILE_CLOTH_PURPLE 806 +#define IDS_TILE_CLOTH_CYAN 807 +#define IDS_TILE_CLOTH_SILVER 808 +#define IDS_TILE_CLOTH_GRAY 809 +#define IDS_TILE_CLOTH_PINK 810 +#define IDS_TILE_CLOTH_LIME 811 +#define IDS_TILE_CLOTH_YELLOW 812 +#define IDS_TILE_CLOTH_LIGHT_BLUE 813 +#define IDS_TILE_CLOTH_MAGENTA 814 +#define IDS_TILE_CLOTH_ORANGE 815 +#define IDS_TILE_CLOTH_WHITE 816 +#define IDS_TILE_FLOWER 817 +#define IDS_TILE_ROSE 818 +#define IDS_TILE_MUSHROOM 819 +#define IDS_TILE_BLOCK_GOLD 820 +#define IDS_DESC_BLOCK_GOLD 821 +#define IDS_DESC_BLOCK_IRON 822 +#define IDS_TILE_BLOCK_IRON 823 +#define IDS_TILE_STONESLAB 824 +#define IDS_TILE_STONESLAB_STONE 825 +#define IDS_TILE_STONESLAB_SAND 826 +#define IDS_TILE_STONESLAB_WOOD 827 +#define IDS_TILE_STONESLAB_COBBLE 828 +#define IDS_TILE_STONESLAB_BRICK 829 +#define IDS_TILE_STONESLAB_SMOOTHBRICK 830 +#define IDS_TILE_STONESLAB_OAK 831 +#define IDS_TILE_STONESLAB_SPRUCE 832 +#define IDS_TILE_STONESLAB_BIRCH 833 +#define IDS_TILE_STONESLAB_JUNGLE 834 +#define IDS_TILE_STONESLAB_NETHERBRICK 835 +#define IDS_TILE_BRICK 836 +#define IDS_TILE_TNT 837 +#define IDS_TILE_BOOKSHELF 838 +#define IDS_TILE_STONE_MOSS 839 +#define IDS_TILE_OBSIDIAN 840 +#define IDS_TILE_TORCH 841 +#define IDS_TILE_TORCHCOAL 842 +#define IDS_TILE_TORCHCHARCOAL 843 +#define IDS_TILE_FIRE 844 +#define IDS_TILE_MOB_SPAWNER 845 +#define IDS_TILE_STAIRS_WOOD 846 +#define IDS_TILE_CHEST 847 +#define IDS_TILE_REDSTONE_DUST 848 +#define IDS_TILE_ORE_DIAMOND 849 +#define IDS_TILE_BLOCK_DIAMOND 850 +#define IDS_DESC_BLOCK_DIAMOND 851 +#define IDS_TILE_WORKBENCH 852 +#define IDS_TILE_CROPS 853 +#define IDS_TILE_FARMLAND 854 +#define IDS_TILE_FURNACE 855 +#define IDS_TILE_SIGN 856 +#define IDS_TILE_DOOR_WOOD 857 +#define IDS_TILE_LADDER 858 +#define IDS_TILE_RAIL 859 +#define IDS_TILE_GOLDEN_RAIL 860 +#define IDS_TILE_DETECTOR_RAIL 861 +#define IDS_TILE_STAIRS_STONE 862 +#define IDS_TILE_LEVER 863 +#define IDS_TILE_PRESSURE_PLATE 864 +#define IDS_TILE_DOOR_IRON 865 +#define IDS_TILE_ORE_REDSTONE 866 +#define IDS_TILE_NOT_GATE 867 +#define IDS_TILE_BUTTON 868 +#define IDS_TILE_SNOW 869 +#define IDS_TILE_ICE 870 +#define IDS_TILE_CACTUS 871 +#define IDS_TILE_CLAY 872 +#define IDS_TILE_REEDS 873 +#define IDS_TILE_JUKEBOX 874 +#define IDS_TILE_FENCE 875 +#define IDS_TILE_PUMPKIN 876 +#define IDS_TILE_LIT_PUMPKIN 877 +#define IDS_TILE_HELL_ROCK 878 +#define IDS_TILE_HELL_SAND 879 +#define IDS_TILE_LIGHT_GEM 880 +#define IDS_TILE_PORTAL 881 +#define IDS_TILE_ORE_LAPIS 882 +#define IDS_TILE_BLOCK_LAPIS 883 +#define IDS_DESC_BLOCK_LAPIS 884 +#define IDS_TILE_DISPENSER 885 +#define IDS_TILE_MUSIC_BLOCK 886 +#define IDS_TILE_CAKE 887 +#define IDS_TILE_BED 888 +#define IDS_TILE_WEB 889 +#define IDS_TILE_TALL_GRASS 890 +#define IDS_TILE_DEAD_BUSH 891 +#define IDS_TILE_DIODE 892 +#define IDS_TILE_LOCKED_CHEST 893 +#define IDS_TILE_TRAPDOOR 894 +#define IDS_ANY_WOOL 895 +#define IDS_TILE_PISTON_BASE 896 +#define IDS_TILE_PISTON_STICK_BASE 897 +#define IDS_TILE_MONSTER_STONE_EGG 898 +#define IDS_TILE_STONE_BRICK_SMOOTH 899 +#define IDS_TILE_STONE_BRICK_SMOOTH_MOSSY 900 +#define IDS_TILE_STONE_BRICK_SMOOTH_CRACKED 901 +#define IDS_TILE_STONE_BRICK_SMOOTH_CHISELED 902 +#define IDS_TILE_HUGE_MUSHROOM_1 903 +#define IDS_TILE_HUGE_MUSHROOM_2 904 +#define IDS_TILE_IRON_FENCE 905 +#define IDS_TILE_THIN_GLASS 906 +#define IDS_TILE_MELON 907 +#define IDS_TILE_PUMPKIN_STEM 908 +#define IDS_TILE_MELON_STEM 909 +#define IDS_TILE_VINE 910 +#define IDS_TILE_FENCE_GATE 911 +#define IDS_TILE_STAIRS_BRICKS 912 +#define IDS_TILE_STAIRS_STONE_BRICKS_SMOOTH 913 +#define IDS_TILE_STONE_SILVERFISH 914 +#define IDS_TILE_STONE_SILVERFISH_COBBLESTONE 915 +#define IDS_TILE_STONE_SILVERFISH_STONE_BRICK 916 +#define IDS_TILE_MYCEL 917 +#define IDS_TILE_WATERLILY 918 +#define IDS_TILE_NETHERBRICK 919 +#define IDS_TILE_NETHERFENCE 920 +#define IDS_TILE_STAIRS_NETHERBRICK 921 +#define IDS_TILE_NETHERSTALK 922 +#define IDS_TILE_ENCHANTMENTTABLE 923 +#define IDS_TILE_BREWINGSTAND 924 +#define IDS_TILE_CAULDRON 925 +#define IDS_TILE_END_PORTAL 926 +#define IDS_TILE_ENDPORTALFRAME 927 +#define IDS_TILE_WHITESTONE 928 +#define IDS_TILE_DRAGONEGG 929 +#define IDS_TILE_SHRUB 930 +#define IDS_TILE_FERN 931 +#define IDS_TILE_STAIRS_SANDSTONE 932 +#define IDS_TILE_STAIRS_SPRUCEWOOD 933 +#define IDS_TILE_STAIRS_BIRCHWOOD 934 +#define IDS_TILE_STAIRS_JUNGLEWOOD 935 +#define IDS_TILE_REDSTONE_LIGHT 936 +#define IDS_TILE_COCOA 937 +#define IDS_TILE_SKULL 938 +#define IDS_TILE_COMMAND_BLOCK 939 +#define IDS_TILE_BEACON 940 +#define IDS_TILE_CHEST_TRAP 941 +#define IDS_TILE_WEIGHTED_PLATE_LIGHT 942 +#define IDS_TILE_WEIGHTED_PLATE_HEAVY 943 +#define IDS_TILE_COMPARATOR 944 +#define IDS_TILE_DAYLIGHT_DETECTOR 945 +#define IDS_TILE_REDSTONE_BLOCK 946 +#define IDS_TILE_HOPPER 947 +#define IDS_TILE_ACTIVATOR_RAIL 948 +#define IDS_TILE_DROPPER 949 +#define IDS_TILE_STAINED_CLAY 950 +#define IDS_TILE_HAY 951 +#define IDS_TILE_HARDENED_CLAY 952 +#define IDS_TILE_COAL 953 +#define IDS_TILE_STAINED_CLAY_BLACK 954 +#define IDS_TILE_STAINED_CLAY_RED 955 +#define IDS_TILE_STAINED_CLAY_GREEN 956 +#define IDS_TILE_STAINED_CLAY_BROWN 957 +#define IDS_TILE_STAINED_CLAY_BLUE 958 +#define IDS_TILE_STAINED_CLAY_PURPLE 959 +#define IDS_TILE_STAINED_CLAY_CYAN 960 +#define IDS_TILE_STAINED_CLAY_SILVER 961 +#define IDS_TILE_STAINED_CLAY_GRAY 962 +#define IDS_TILE_STAINED_CLAY_PINK 963 +#define IDS_TILE_STAINED_CLAY_LIME 964 +#define IDS_TILE_STAINED_CLAY_YELLOW 965 +#define IDS_TILE_STAINED_CLAY_LIGHT_BLUE 966 +#define IDS_TILE_STAINED_CLAY_MAGENTA 967 +#define IDS_TILE_STAINED_CLAY_ORANGE 968 +#define IDS_TILE_STAINED_CLAY_WHITE 969 +#define IDS_TILE_STAINED_GLASS 970 +#define IDS_TILE_STAINED_GLASS_BLACK 971 +#define IDS_TILE_STAINED_GLASS_RED 972 +#define IDS_TILE_STAINED_GLASS_GREEN 973 +#define IDS_TILE_STAINED_GLASS_BROWN 974 +#define IDS_TILE_STAINED_GLASS_BLUE 975 +#define IDS_TILE_STAINED_GLASS_PURPLE 976 +#define IDS_TILE_STAINED_GLASS_CYAN 977 +#define IDS_TILE_STAINED_GLASS_SILVER 978 +#define IDS_TILE_STAINED_GLASS_GRAY 979 +#define IDS_TILE_STAINED_GLASS_PINK 980 +#define IDS_TILE_STAINED_GLASS_LIME 981 +#define IDS_TILE_STAINED_GLASS_YELLOW 982 +#define IDS_TILE_STAINED_GLASS_LIGHT_BLUE 983 +#define IDS_TILE_STAINED_GLASS_MAGENTA 984 +#define IDS_TILE_STAINED_GLASS_ORANGE 985 +#define IDS_TILE_STAINED_GLASS_WHITE 986 +#define IDS_TILE_STAINED_GLASS_PANE 987 +#define IDS_TILE_STAINED_GLASS_PANE_BLACK 988 +#define IDS_TILE_STAINED_GLASS_PANE_RED 989 +#define IDS_TILE_STAINED_GLASS_PANE_GREEN 990 +#define IDS_TILE_STAINED_GLASS_PANE_BROWN 991 +#define IDS_TILE_STAINED_GLASS_PANE_BLUE 992 +#define IDS_TILE_STAINED_GLASS_PANE_PURPLE 993 +#define IDS_TILE_STAINED_GLASS_PANE_CYAN 994 +#define IDS_TILE_STAINED_GLASS_PANE_SILVER 995 +#define IDS_TILE_STAINED_GLASS_PANE_GRAY 996 +#define IDS_TILE_STAINED_GLASS_PANE_PINK 997 +#define IDS_TILE_STAINED_GLASS_PANE_LIME 998 +#define IDS_TILE_STAINED_GLASS_PANE_YELLOW 999 +#define IDS_TILE_STAINED_GLASS_PANE_LIGHT_BLUE 1000 +#define IDS_TILE_STAINED_GLASS_PANE_MAGENTA 1001 +#define IDS_TILE_STAINED_GLASS_PANE_ORANGE 1002 +#define IDS_TILE_STAINED_GLASS_PANE_WHITE 1003 +#define IDS_FIREWORKS_CHARGE_TYPE_0 1004 +#define IDS_FIREWORKS_CHARGE_TYPE_1 1005 +#define IDS_FIREWORKS_CHARGE_TYPE_2 1006 +#define IDS_FIREWORKS_CHARGE_TYPE_3 1007 +#define IDS_FIREWORKS_CHARGE_TYPE_4 1008 +#define IDS_FIREWORKS_CHARGE_TYPE 1009 +#define IDS_FIREWORKS_CHARGE_BLACK 1010 +#define IDS_FIREWORKS_CHARGE_RED 1011 +#define IDS_FIREWORKS_CHARGE_GREEN 1012 +#define IDS_FIREWORKS_CHARGE_BROWN 1013 +#define IDS_FIREWORKS_CHARGE_BLUE 1014 +#define IDS_FIREWORKS_CHARGE_PURPLE 1015 +#define IDS_FIREWORKS_CHARGE_CYAN 1016 +#define IDS_FIREWORKS_CHARGE_SILVER 1017 +#define IDS_FIREWORKS_CHARGE_GRAY 1018 +#define IDS_FIREWORKS_CHARGE_PINK 1019 +#define IDS_FIREWORKS_CHARGE_LIME 1020 +#define IDS_FIREWORKS_CHARGE_YELLOW 1021 +#define IDS_FIREWORKS_CHARGE_LIGHT_BLUE 1022 +#define IDS_FIREWORKS_CHARGE_MAGENTA 1023 +#define IDS_FIREWORKS_CHARGE_ORANGE 1024 +#define IDS_FIREWORKS_CHARGE_WHITE 1025 +#define IDS_FIREWORKS_CHARGE_CUSTOM 1026 +#define IDS_FIREWORKS_CHARGE_FADE_TO 1027 +#define IDS_FIREWORKS_CHARGE_FLICKER 1028 +#define IDS_FIREWORKS_CHARGE_TRAIL 1029 +#define IDS_ITEM_FIREWORKS_FLIGHT 1030 +#define IDS_CURRENT_LAYOUT 1031 +#define IDS_CONTROLS_LAYOUT 1032 +#define IDS_CONTROLS_MOVE 1033 +#define IDS_CONTROLS_LOOK 1034 +#define IDS_CONTROLS_PAUSE 1035 +#define IDS_CONTROLS_JUMP 1036 +#define IDS_CONTROLS_JUMPFLY 1037 +#define IDS_CONTROLS_INVENTORY 1038 +#define IDS_CONTROLS_HELDITEM 1039 +#define IDS_CONTROLS_ACTION 1040 +#define IDS_CONTROLS_USE 1041 +#define IDS_CONTROLS_CRAFTING 1042 +#define IDS_CONTROLS_DROP 1043 +#define IDS_CONTROLS_SNEAK 1044 +#define IDS_CONTROLS_SNEAKFLY 1045 +#define IDS_CONTROLS_THIRDPERSON 1046 +#define IDS_CONTROLS_PLAYERS 1047 +#define IDS_CONTROLS_DPAD 1048 +#define IDS_CONTROLS_SCHEME0 1049 +#define IDS_CONTROLS_SCHEME1 1050 +#define IDS_CONTROLS_SCHEME2 1051 +#define IDS_CONTROLLER_A 1052 +#define IDS_CONTROLLER_B 1053 +#define IDS_CONTROLLER_X 1054 +#define IDS_CONTROLLER_Y 1055 +#define IDS_CONTROLLER_LEFT_STICK 1056 +#define IDS_CONTROLLER_RIGHT_STICK 1057 +#define IDS_CONTROLLER_LEFT_TRIGGER 1058 +#define IDS_CONTROLLER_RIGHT_TRIGGER 1059 +#define IDS_CONTROLLER_LEFT_BUMPER 1060 +#define IDS_CONTROLLER_RIGHT_BUMPER 1061 +#define IDS_CONTROLLER_BACK 1062 +#define IDS_CONTROLLER_START 1063 +#define IDS_CONTROLLER_RIGHT_THUMBSTICK 1064 +#define IDS_CONTROLLER_LEFT_THUMBSTICK 1065 +#define IDS_CONTROLLER_DPAD_R 1066 +#define IDS_CONTROLLER_DPAD_L 1067 +#define IDS_CONTROLLER_DPAD_U 1068 +#define IDS_CONTROLLER_DPAD_D 1069 +#define IDS_ICON_SHANK_01 1070 +#define IDS_ICON_SHANK_03 1071 +#define IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE 1072 +#define IDS_TUTORIAL_PROMPT_START_TUTORIAL 1073 +#define IDS_TUTORIAL_TASK_OVERVIEW 1074 +#define IDS_TUTORIAL_TASK_LOOK 1075 +#define IDS_TUTORIAL_TASK_MOVE 1076 +#define IDS_TUTORIAL_TASK_SPRINT 1077 +#define IDS_TUTORIAL_TASK_JUMP 1078 +#define IDS_TUTORIAL_TASK_MINE 1079 +#define IDS_TUTORIAL_TASK_CHOP_WOOD 1080 +#define IDS_TUTORIAL_TASK_CRAFTING 1081 +#define IDS_TUTORIAL_TASK_INVENTORY 1082 +#define IDS_TUTORIAL_TASK_FOOD_BAR_DEPLETE 1083 +#define IDS_TUTORIAL_TASK_FOOD_BAR_HEAL 1084 +#define IDS_TUTORIAL_TASK_FOOD_BAR_FEED 1085 +#define IDS_TUTORIAL_TASK_FOOD_BAR_EAT_STEAK 1086 +#define IDS_TUTORIAL_TASK_CREATE_PLANKS 1087 +#define IDS_TUTORIAL_TASK_CREATE_CRAFTING_TABLE 1088 +#define IDS_TUTORIAL_TASK_CREATE_STICKS 1089 +#define IDS_TUTORIAL_TASK_SCROLL 1090 +#define IDS_TUTORIAL_TASK_USE 1091 +#define IDS_TUTORIAL_TASK_PLACE_WORKBENCH 1092 +#define IDS_TUTORIAL_TASK_OPEN_WORKBENCH 1093 +#define IDS_TUTORIAL_TASK_CREATE_WOODEN_SHOVEL 1094 +#define IDS_TUTORIAL_TASK_CREATE_WOODEN_HATCHET 1095 +#define IDS_TUTORIAL_TASK_CREATE_WOODEN_PICKAXE 1096 +#define IDS_TUTORIAL_TASK_OPEN_CONTAINER 1097 +#define IDS_TUTORIAL_TASK_NIGHT_DANGER 1098 +#define IDS_TUTORIAL_TASK_NEARBY_SHELTER 1099 +#define IDS_TUTORIAL_TASK_COLLECT_RESOURCES 1100 +#define IDS_TUTORIAL_TASK_MINE_STONE 1101 +#define IDS_TUTORIAL_TASK_CREATE_FURNACE 1102 +#define IDS_TUTORIAL_TASK_PLACE_AND_OPEN_FURNACE 1103 +#define IDS_TUTORIAL_TASK_CREATE_CHARCOAL 1104 +#define IDS_TUTORIAL_TASK_CREATE_GLASS 1105 +#define IDS_TUTORIAL_TASK_CREATE_WOODEN_DOOR 1106 +#define IDS_TUTORIAL_TASK_PLACE_DOOR 1107 +#define IDS_TUTORIAL_TASK_CREATE_TORCH 1108 +#define IDS_TUTORIAL_TASK_BASIC_COMPLETE 1109 +#define IDS_TUTORIAL_PROMPT_BASIC_COMPLETE 1110 +#define IDS_TUTORIAL_TASK_INV_OVERVIEW 1111 +#define IDS_TUTORIAL_PROMPT_INV_OVERVIEW 1112 +#define IDS_TUTORIAL_TASK_INV_PICK_UP 1113 +#define IDS_TUTORIAL_TASK_INV_MOVE 1114 +#define IDS_TUTORIAL_TASK_INV_DROP 1115 +#define IDS_TUTORIAL_TASK_INV_INFO 1116 +#define IDS_TUTORIAL_TASK_INV_EXIT 1117 +#define IDS_TUTORIAL_TASK_CREATIVE_INV_OVERVIEW 1118 +#define IDS_TUTORIAL_PROMPT_CREATIVE_INV_OVERVIEW 1119 +#define IDS_TUTORIAL_TASK_CREATIVE_INV_PICK_UP 1120 +#define IDS_TUTORIAL_TASK_CREATIVE_INV_MOVE 1121 +#define IDS_TUTORIAL_TASK_CREATIVE_INV_DROP 1122 +#define IDS_TUTORIAL_TASK_CREATIVE_INV_NAV 1123 +#define IDS_TUTORIAL_TASK_CREATIVE_INV_INFO 1124 +#define IDS_TUTORIAL_TASK_CREATIVE_INV_EXIT 1125 +#define IDS_TUTORIAL_TASK_CRAFT_OVERVIEW 1126 +#define IDS_TUTORIAL_PROMPT_CRAFT_OVERVIEW 1127 +#define IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_DESCRIPTION 1128 +#define IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_INGREDIENTS 1129 +#define IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_INVENTORY 1130 +#define IDS_TUTORIAL_TASK_CRAFT_NAV 1131 +#define IDS_TUTORIAL_TASK_CRAFT_CREATE 1132 +#define IDS_TUTORIAL_TASK_CRAFT_CRAFT_TABLE 1133 +#define IDS_TUTORIAL_TASK_CRAFT_INVENTORY 1134 +#define IDS_TUTORIAL_TASK_CRAFT_DESCRIPTION 1135 +#define IDS_TUTORIAL_TASK_CRAFT_INGREDIENTS 1136 +#define IDS_TUTORIAL_TASK_CRAFT_CREATE_PLANKS 1137 +#define IDS_TUTORIAL_TASK_CRAFT_EXIT_AND_PLACE_TABLE 1138 +#define IDS_TUTORIAL_TASK_CRAFT_SELECT_TOOLS 1139 +#define IDS_TUTORIAL_TASK_CRAFT_SELECT_STRUCTURES 1140 +#define IDS_TUTORIAL_TASK_CRAFT_SELECT_WOODEN_SHOVEL 1141 +#define IDS_TUTORIAL_TASK_CRAFT_SELECT_CRAFTING_TABLE 1142 +#define IDS_TUTORIAL_TASK_CRAFT_TOOLS_BUILT 1143 +#define IDS_TUTORIAL_TASK_CRAFT_CREATE_FURNACE 1144 +#define IDS_TUTORIAL_TASK_CRAFT_EXIT_AND_PLACE_FURNACE 1145 +#define IDS_TUTORIAL_TASK_FURNACE_OVERVIEW 1146 +#define IDS_TUTORIAL_PROMPT_FURNACE_OVERVIEW 1147 +#define IDS_TUTORIAL_TASK_FURNACE_METHOD 1148 +#define IDS_TUTORIAL_TASK_FURNACE_FUELS 1149 +#define IDS_TUTORIAL_TASK_FURNACE_INGREDIENTS 1150 +#define IDS_TUTORIAL_TASK_FURNACE_CREATE_CHARCOAL 1151 +#define IDS_TUTORIAL_TASK_FURNACE_CHARCOAL_USES 1152 +#define IDS_TUTORIAL_TASK_FURNACE_CREATE_GLASS 1153 +#define IDS_TUTORIAL_TASK_BREWING_MENU_OVERVIEW 1154 +#define IDS_TUTORIAL_PROMPT_BREWING_MENU_OVERVIEW 1155 +#define IDS_TUTORIAL_TASK_BREWING_MENU_METHOD 1156 +#define IDS_TUTORIAL_TASK_BREWING_MENU_BASIC_INGREDIENTS 1157 +#define IDS_TUTORIAL_TASK_BREWING_MENU_EXTENDED_INGREDIENTS 1158 +#define IDS_TUTORIAL_TASK_BREWING_MENU_EXTENDED_INGREDIENTS_2 1159 +#define IDS_TUTORIAL_TASK_BREWING_MENU_CREATE_FIRE_POTION 1160 +#define IDS_TUTORIAL_TASK_BREWING_MENU_EXIT 1161 +#define IDS_TUTORIAL_TASK_BREWING_OVERVIEW 1162 +#define IDS_TUTORIAL_PROMPT_BREWING_OVERVIEW 1163 +#define IDS_TUTORIAL_TASK_BREWING_GET_GLASS_BOTTLE 1164 +#define IDS_TUTORIAL_TASK_BREWING_FILL_GLASS_BOTTLE 1165 +#define IDS_TUTORIAL_TASK_BREWING_FILL_CAULDRON 1166 +#define IDS_TUTORIAL_TASK_BREWING_CREATE_FIRE_POTION 1167 +#define IDS_TUTORIAL_TASK_BREWING_USE_POTION 1168 +#define IDS_TUTORIAL_TASK_BREWING_DRINK_FIRE_POTION 1169 +#define IDS_TUTORIAL_TASK_BREWING_USE_EFFECTS 1170 +#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_OVERVIEW 1171 +#define IDS_TUTORIAL_PROMPT_ENCHANTING_MENU_OVERVIEW 1172 +#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_START 1173 +#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_ENCHANTMENTS 1174 +#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_COST 1175 +#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_ENCHANT 1176 +#define IDS_TUTORIAL_TASK_ENCHANTING_MENU_BETTER_ENCHANTMENTS 1177 +#define IDS_TUTORIAL_TASK_ENCHANTING_OVERVIEW 1178 +#define IDS_TUTORIAL_PROMPT_ENCHANTING_OVERVIEW 1179 +#define IDS_TUTORIAL_TASK_ENCHANTING_SUMMARY 1180 +#define IDS_TUTORIAL_TASK_ENCHANTING_BOOKCASES 1181 +#define IDS_TUTORIAL_TASK_ENCHANTING_EXPERIENCE 1182 +#define IDS_TUTORIAL_TASK_ENCHANTING_BOTTLE_O_ENCHANTING 1183 +#define IDS_TUTORIAL_TASK_ENCHANTING_USE_CHESTS 1184 +#define IDS_TUTORIAL_TASK_MINECART_OVERVIEW 1185 +#define IDS_TUTORIAL_PROMPT_MINECART_OVERVIEW 1186 +#define IDS_TUTORIAL_TASK_MINECART_RAILS 1187 +#define IDS_TUTORIAL_TASK_MINECART_POWERED_RAILS 1188 +#define IDS_TUTORIAL_TASK_BOAT_OVERVIEW 1189 +#define IDS_TUTORIAL_PROMPT_BOAT_OVERVIEW 1190 +#define IDS_TUTORIAL_TASK_BOAT_STEER 1191 +#define IDS_TUTORIAL_TASK_FISHING_OVERVIEW 1192 +#define IDS_TUTORIAL_PROMPT_FISHING_OVERVIEW 1193 +#define IDS_TUTORIAL_TASK_FISHING_CAST 1194 +#define IDS_TUTORIAL_TASK_FISHING_FISH 1195 +#define IDS_TUTORIAL_TASK_FISHING_USES 1196 +#define IDS_TUTORIAL_TASK_BED_OVERVIEW 1197 +#define IDS_TUTORIAL_PROMPT_BED_OVERVIEW 1198 +#define IDS_TUTORIAL_TASK_BED_PLACEMENT 1199 +#define IDS_TUTORIAL_TASK_BED_MULTIPLAYER 1200 +#define IDS_TUTORIAL_REDSTONE_OVERVIEW 1201 +#define IDS_TUTORIAL_PROMPT_REDSTONE_OVERVIEW 1202 +#define IDS_TUTORIAL_TASK_REDSTONE_POWER_SOURCES 1203 +#define IDS_TUTORIAL_TASK_REDSTONE_POWER_SOURCES_POSITION 1204 +#define IDS_TUTORIAL_TASK_REDSTONE_DUST 1205 +#define IDS_TUTORIAL_TASK_REDSTONE_REPEATER 1206 +#define IDS_TUTORIAL_TASK_PISTONS 1207 +#define IDS_TUTORIAL_TASK_TRY_IT 1208 +#define IDS_TUTORIAL_PORTAL_OVERVIEW 1209 +#define IDS_TUTORIAL_PROMPT_PORTAL_OVERVIEW 1210 +#define IDS_TUTORIAL_TASK_BUILD_PORTAL 1211 +#define IDS_TUTORIAL_TASK_ACTIVATE_PORTAL 1212 +#define IDS_TUTORIAL_TASK_USE_PORTAL 1213 +#define IDS_TUTORIAL_TASK_NETHER 1214 +#define IDS_TUTORIAL_TASK_NETHER_FAST_TRAVEL 1215 +#define IDS_TUTORIAL_CREATIVE_OVERVIEW 1216 +#define IDS_TUTORIAL_PROMPT_CREATIVE_OVERVIEW 1217 +#define IDS_TUTORIAL_TASK_CREATIVE_MODE 1218 +#define IDS_TUTORIAL_TASK_OPEN_CREATIVE_INVENTORY 1219 +#define IDS_TUTORIAL_TASK_CREATIVE_EXIT 1220 +#define IDS_TUTORIAL_TASK_CREATIVE_COMPLETE 1221 +#define IDS_TUTORIAL_FARMING_OVERVIEW 1222 +#define IDS_TUTORIAL_PROMPT_FARMING_OVERVIEW 1223 +#define IDS_TUTORIAL_TASK_FARMING_SEEDS 1224 +#define IDS_TUTORIAL_TASK_FARMING_FARMLAND 1225 +#define IDS_TUTORIAL_TASK_FARMING_WHEAT 1226 +#define IDS_TUTORIAL_TASK_FARMING_PUMPKIN_AND_MELON 1227 +#define IDS_TUTORIAL_TASK_FARMING_SUGARCANE 1228 +#define IDS_TUTORIAL_TASK_FARMING_CACTUS 1229 +#define IDS_TUTORIAL_TASK_FARMING_MUSHROOM 1230 +#define IDS_TUTORIAL_TASK_FARMING_BONEMEAL 1231 +#define IDS_TUTORIAL_TASK_FARMING_COMPLETE 1232 +#define IDS_TUTORIAL_BREEDING_OVERVIEW 1233 +#define IDS_TUTORIAL_PROMPT_BREEDING_OVERVIEW 1234 +#define IDS_TUTORIAL_TASK_BREEDING_FEED 1235 +#define IDS_TUTORIAL_TASK_BREEDING_FEED_FOOD 1236 +#define IDS_TUTORIAL_TASK_BREEDING_BABY 1237 +#define IDS_TUTORIAL_TASK_BREEDING_DELAY 1238 +#define IDS_TUTORIAL_TASK_BREEDING_FOLLOW 1239 +#define IDS_TUTORIAL_TASK_BREEDING_WOLF_TAMING 1240 +#define IDS_TUTORIAL_TASK_BREEDING_COMPLETE 1241 +#define IDS_TUTORIAL_GOLEM_OVERVIEW 1242 +#define IDS_TUTORIAL_PROMPT_GOLEM_OVERVIEW 1243 +#define IDS_TUTORIAL_TASK_GOLEM_PUMPKIN 1244 +#define IDS_TUTORIAL_TASK_GOLEM_SNOW 1245 +#define IDS_TUTORIAL_TASK_GOLEM_IRON 1246 +#define IDS_TUTORIAL_TASK_GOLEM_IRON_VILLAGE 1247 +#define IDS_TUTORIAL_CONSTRAINT_TUTORIAL_AREA 1248 +#define IDS_TUTORIAL_HINT_DIGGER_ITEM_SHOVEL 1249 +#define IDS_TUTORIAL_HINT_DIGGER_ITEM_HATCHET 1250 +#define IDS_TUTORIAL_HINT_DIGGER_ITEM_PICKAXE 1251 +#define IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL 1252 +#define IDS_TUTORIAL_HINT_HOLD_TO_MINE 1253 +#define IDS_TUTORIAL_HINT_TOOL_DAMAGED 1254 +#define IDS_TUTORIAL_HINT_SWIM_UP 1255 +#define IDS_TUTORIAL_HINT_MINECART 1256 +#define IDS_TUTORIAL_HINT_BOAT 1257 +#define IDS_TUTORIAL_HINT_FISHING 1258 +#define IDS_TUTORIAL_HINT_PISTON_SELF_REPAIRING_BRIDGE 1259 +#define IDS_TUTORIAL_HINT_INV_DROP 1260 +#define IDS_TUTORIAL_HINT_CRAFT_NO_INGREDIENTS 1261 +#define IDS_TUTORIAL_COMPLETED 1262 +#define IDS_TUTORIAL_COMPLETED_EXPLORE 1263 +#define IDS_TUTORIAL_REMINDER 1264 +#define IDS_TUTORIAL_HTML_EXIT_PICTURE 1265 +#define IDS_TUTORIAL_NEW_FEATURES_CHOICE 1266 +#define IDS_TUTORIAL_PROMPT_NEW_FEATURES_CHOICE 1267 +#define IDS_TUTORIAL_FEATURES_IN_THIS_AREA 1268 +#define IDS_TUTORIAL_FEATURES_OUTSIDE_THIS_AREA 1269 +#define IDS_TUTORIAL_TASK_FOOD_BAR_OVERVIEW 1270 +#define IDS_TUTORIAL_PROMPT_FOOD_BAR_OVERVIEW 1271 +#define IDS_TUTORIAL_TASK_HORSE_MENU_OVERVIEW 1272 +#define IDS_TUTORIAL_PROMPT_HORSE_MENU_OVERVIEW 1273 +#define IDS_TUTORIAL_TASK_HORSE_MENU_LAYOUT 1274 +#define IDS_TUTORIAL_TASK_HORSE_MENU_EQUIPMENT 1275 +#define IDS_TUTORIAL_TASK_HORSE_MENU_SADDLEBAGS 1276 +#define IDS_TUTORIAL_TASK_HORSE_OVERVIEW 1277 +#define IDS_TUTORIAL_TASK_DONKEY_OVERVIEW 1278 +#define IDS_TUTORIAL_TASK_MULE_OVERVIEW 1279 +#define IDS_TUTORIAL_PROMPT_HORSE_OVERVIEW 1280 +#define IDS_TUTORIAL_TASK_HORSE_INTRO 1281 +#define IDS_TUTORIAL_TASK_HORSE_PURPOSE 1282 +#define IDS_TUTORIAL_TASK_HORSE_TAMING 1283 +#define IDS_TUTORIAL_TASK_HORSE_TAMING2 1284 +#define IDS_TUTORIAL_TASK_HORSE_RIDE 1285 +#define IDS_TUTORIAL_TASK_HORSE_SADDLES 1286 +#define IDS_TUTORIAL_TASK_HORSE_SADDLEBAGS 1287 +#define IDS_TUTORIAL_TASK_HORSE_BREEDING 1288 +#define IDS_TUTORIAL_TASK_HORSE_AREA 1289 +#define IDS_TUTORIAL_TASK_BEACON_MENU_OVERVIEW 1290 +#define IDS_TUTORIAL_PROMPT_BEACON_MENU_OVERVIEW 1291 +#define IDS_TUTORIAL_TASK_BEACON_MENU_PRIMARY_POWERS 1292 +#define IDS_TUTORIAL_TASK_BEACON_MENU_SECONDARY_POWER 1293 +#define IDS_TUTORIAL_TASK_BEACON_MENU_ACTIVATION 1294 +#define IDS_TUTORIAL_TASK_BEACON_OVERVIEW 1295 +#define IDS_TUTORIAL_PROMPT_BEACON_OVERVIEW 1296 +#define IDS_TUTORIAL_TASK_BEACON_PURPOSE 1297 +#define IDS_TUTORIAL_TASK_BEACON_DESIGN 1298 +#define IDS_TUTORIAL_TASK_BEACON_CHOOSING_POWERS 1299 +#define IDS_TUTORIAL_TASK_HOPPER_OVERVIEW 1300 +#define IDS_TUTORIAL_PROMPT_HOPPER_OVERVIEW 1301 +#define IDS_TUTORIAL_TASK_HOPPER_PURPOSE 1302 +#define IDS_TUTORIAL_TASK_HOPPER_CONTAINERS 1303 +#define IDS_TUTORIAL_TASK_HOPPER_MECHANICS 1304 +#define IDS_TUTORIAL_TASK_HOPPER_REDSTONE 1305 +#define IDS_TUTORIAL_TASK_HOPPER_OUTPUT 1306 +#define IDS_TUTORIAL_TASK_HOPPER_AREA 1307 +#define IDS_TUTORIAL_TASK_FIREWORK_MENU_OVERVIEW 1308 +#define IDS_TUTORIAL_PROMPT_FIREWORK_MENU_OVERVIEW 1309 +#define IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_START 1310 +#define IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_STARS 1311 +#define IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_HEIGHT 1312 +#define IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_CRAFT 1313 +#define IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_START 1314 +#define IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_COLOUR 1315 +#define IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_SHAPE 1316 +#define IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_EFFECT 1317 +#define IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_FADE 1318 +#define IDS_TUTORIAL_TASK_FIREWORK_OVERVIEW 1319 +#define IDS_TUTORIAL_PROMPT_FIREWORK_OVERVIEW 1320 +#define IDS_TUTORIAL_TASK_FIREWORK_PURPOSE 1321 +#define IDS_TUTORIAL_TASK_FIREWORK_CUSTOMISE 1322 +#define IDS_TUTORIAL_TASK_FIREWORK_CRAFTING 1323 +#define IDS_TOOLTIPS_SELECT 1324 +#define IDS_TOOLTIPS_USE 1325 +#define IDS_TOOLTIPS_BACK 1326 +#define IDS_TOOLTIPS_EXIT 1327 +#define IDS_TOOLTIPS_CANCEL 1328 +#define IDS_TOOLTIPS_CANCEL_JOIN 1329 +#define IDS_TOOLTIPS_REFRESH 1330 +#define IDS_TOOLTIPS_PARTY_GAMES 1331 +#define IDS_TOOLTIPS_ALL_GAMES 1332 +#define IDS_TOOLTIPS_CHANGE_GROUP 1333 +#define IDS_TOOLTIPS_SHOW_INVENTORY 1334 +#define IDS_TOOLTIPS_SHOW_DESCRIPTION 1335 +#define IDS_TOOLTIPS_SHOW_INGREDIENTS 1336 +#define IDS_TOOLTIPS_CRAFTING 1337 +#define IDS_TOOLTIPS_CREATE 1338 +#define IDS_TOOLTIPS_PICKUPPLACE 1339 +#define IDS_TOOLTIPS_PICKUP_GENERIC 1340 +#define IDS_TOOLTIPS_PICKUP_ALL 1341 +#define IDS_TOOLTIPS_PICKUP_HALF 1342 +#define IDS_TOOLTIPS_PLACE_GENERIC 1343 +#define IDS_TOOLTIPS_PLACE_ALL 1344 +#define IDS_TOOLTIPS_PLACE_ONE 1345 +#define IDS_TOOLTIPS_DROP_GENERIC 1346 +#define IDS_TOOLTIPS_DROP_ALL 1347 +#define IDS_TOOLTIPS_DROP_ONE 1348 +#define IDS_TOOLTIPS_SWAP 1349 +#define IDS_TOOLTIPS_QUICK_MOVE 1350 +#define IDS_TOOLTIPS_CLEAR_QUICK_SELECT 1351 +#define IDS_TOOLTIPS_WHAT_IS_THIS 1352 +#define IDS_TOOLTIPS_SHARE 1353 +#define IDS_TOOLTIPS_CHANGE_FILTER 1354 +#define IDS_TOOLTIPS_SEND_FRIEND_REQUEST 1355 +#define IDS_TOOLTIPS_PAGE_DOWN 1356 +#define IDS_TOOLTIPS_PAGE_UP 1357 +#define IDS_TOOLTIPS_NEXT 1358 +#define IDS_TOOLTIPS_PREVIOUS 1359 +#define IDS_TOOLTIPS_KICK 1360 +#define IDS_TOOLTIPS_DYE 1361 +#define IDS_TOOLTIPS_MINE 1362 +#define IDS_TOOLTIPS_FEED 1363 +#define IDS_TOOLTIPS_TAME 1364 +#define IDS_TOOLTIPS_HEAL 1365 +#define IDS_TOOLTIPS_SIT 1366 +#define IDS_TOOLTIPS_FOLLOWME 1367 +#define IDS_TOOLTIPS_EJECT 1368 +#define IDS_TOOLTIPS_EMPTY 1369 +#define IDS_TOOLTIPS_SADDLE 1370 +#define IDS_TOOLTIPS_PLACE 1371 +#define IDS_TOOLTIPS_HIT 1372 +#define IDS_TOOLTIPS_MILK 1373 +#define IDS_TOOLTIPS_COLLECT 1374 +#define IDS_TOOLTIPS_EAT 1375 +#define IDS_TOOLTIPS_SLEEP 1376 +#define IDS_TOOLTIPS_WAKEUP 1377 +#define IDS_TOOLTIPS_PLAY 1378 +#define IDS_TOOLTIPS_RIDE 1379 +#define IDS_TOOLTIPS_SAIL 1380 +#define IDS_TOOLTIPS_GROW 1381 +#define IDS_TOOLTIPS_SWIMUP 1382 +#define IDS_TOOLTIPS_OPEN 1383 +#define IDS_TOOLTIPS_CHANGEPITCH 1384 +#define IDS_TOOLTIPS_DETONATE 1385 +#define IDS_TOOLTIPS_READ 1386 +#define IDS_TOOLTIPS_HANG 1387 +#define IDS_TOOLTIPS_THROW 1388 +#define IDS_TOOLTIPS_PLANT 1389 +#define IDS_TOOLTIPS_TILL 1390 +#define IDS_TOOLTIPS_HARVEST 1391 +#define IDS_TOOLTIPS_CONTINUE 1392 +#define IDS_TOOLTIPS_UNLOCKFULLVERSION 1393 +#define IDS_TOOLTIPS_DELETESAVE 1394 +#define IDS_TOOLTIPS_DELETE 1395 +#define IDS_TOOLTIPS_OPTIONS 1396 +#define IDS_TOOLTIPS_INVITE_FRIENDS 1397 +#define IDS_TOOLTIPS_ACCEPT 1398 +#define IDS_TOOLTIPS_SHEAR 1399 +#define IDS_TOOLTIPS_BANLEVEL 1400 +#define IDS_TOOLTIPS_SELECT_SKIN 1401 +#define IDS_TOOLTIPS_IGNITE 1402 +#define IDS_TOOLTIPS_NAVIGATE 1403 +#define IDS_TOOLTIPS_INSTALL_FULL 1404 +#define IDS_TOOLTIPS_INSTALL_TRIAL 1405 +#define IDS_TOOLTIPS_INSTALL 1406 +#define IDS_TOOLTIPS_REINSTALL 1407 +#define IDS_TOOLTIPS_SAVEOPTIONS 1408 +#define IDS_TOOLTIPS_EXECUTE_COMMAND 1409 +#define IDS_TOOLTIPS_CREATIVE 1410 +#define IDS_TOOLTIPS_QUICK_MOVE_INGREDIENT 1411 +#define IDS_TOOLTIPS_QUICK_MOVE_FUEL 1412 +#define IDS_TOOLTIPS_QUICK_MOVE_TOOL 1413 +#define IDS_TOOLTIPS_QUICK_MOVE_ARMOR 1414 +#define IDS_TOOLTIPS_QUICK_MOVE_WEAPON 1415 +#define IDS_TOOLTIPS_EQUIP 1416 +#define IDS_TOOLTIPS_DRAW_BOW 1417 +#define IDS_TOOLTIPS_RELEASE_BOW 1418 +#define IDS_TOOLTIPS_PRIVILEGES 1419 +#define IDS_TOOLTIPS_BLOCK 1420 +#define IDS_TOOLTIPS_PAGEUP 1421 +#define IDS_TOOLTIPS_PAGEDOWN 1422 +#define IDS_TOOLTIPS_LOVEMODE 1423 +#define IDS_TOOLTIPS_DRINK 1424 +#define IDS_TOOLTIPS_ROTATE 1425 +#define IDS_TOOLTIPS_CLEARSLOTS 1426 +#define IDS_TOOLTIPS_MOUNT 1427 +#define IDS_TOOLTIPS_DISMOUNT 1428 +#define IDS_TOOLTIPS_SADDLEBAGS 1429 +#define IDS_TOOLTIPS_FIREWORK_LAUNCH 1430 +#define IDS_TOOLTIPS_LEASH 1431 +#define IDS_TOOLTIPS_UNLEASH 1432 +#define IDS_TOOLTIPS_ATTACH 1433 +#define IDS_TOOLTIPS_NAME 1434 +#define IDS_CONFIRM_OK 1435 +#define IDS_CONFIRM_CANCEL 1436 +#define IDS_DOWNLOADABLECONTENT 1437 +#define IDS_CONFIRM_LEAVE_VIA_INVITE 1438 +#define IDS_EXIT_GAME 1439 +#define IDS_TITLE_SAVE_GAME 1440 +#define IDS_TITLE_DECLINE_SAVE_GAME 1441 +#define IDS_CONFIRM_SAVE_GAME 1442 +#define IDS_CONFIRM_DECLINE_SAVE_GAME 1443 +#define IDS_TITLE_START_GAME 1444 +#define IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE 1445 +#define IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT 1446 +#define IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE 1447 +#define IDS_EXIT_GAME_SAVE 1448 +#define IDS_EXIT_GAME_NO_SAVE 1449 +#define IDS_CONFIRM_EXIT_GAME 1450 +#define IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST 1451 +#define IDS_CREATE_NEW_WORLD 1452 +#define IDS_PLAY_TUTORIAL 1453 +#define IDS_TUTORIALSAVENAME 1454 +#define IDS_NAME_WORLD 1455 +#define IDS_NAME_WORLD_TEXT 1456 +#define IDS_CREATE_NEW_WORLD_SEEDTEXT 1457 +#define IDS_LOAD_SAVED_WORLD 1458 +#define IDS_PRESS_START_TO_JOIN 1459 +#define IDS_EXITING_GAME 1460 +#define IDS_GENERIC_ERROR 1461 +#define IDS_CONNECTION_FAILED 1462 +#define IDS_CONNECTION_LOST 1463 +#define IDS_CONNECTION_LOST_SERVER 1464 +#define IDS_DISCONNECTED 1465 +#define IDS_DISCONNECTED_KICKED 1466 +#define IDS_DISCONNECTED_FLYING 1467 +#define IDS_DISCONNECTED_LOGIN_TOO_LONG 1468 +#define IDS_DISCONNECTED_SERVER_FULL 1469 +#define IDS_DISCONNECTED_SERVER_QUIT 1470 +#define IDS_DISCONNECTED_NO_FRIENDS_IN_GAME 1471 +#define IDS_DISCONNECTED_BANNED 1472 +#define IDS_DISCONNECTED_SERVER_OLD 1473 +#define IDS_DISCONNECTED_CLIENT_OLD 1474 +#define IDS_DEFAULT_SAVENAME 1475 +#define IDS_AWARD_TITLE 1476 +#define IDS_AWARD_GAMERPIC1 1477 +#define IDS_AWARD_GAMERPIC2 1478 +#define IDS_UNLOCK_TITLE 1479 +#define IDS_UNLOCK_TOSAVE_TEXT 1480 +#define IDS_LEADERBOARD_LOADING 1481 +#define IDS_LEADERBOARD_NORESULTS 1482 +#define IDS_LEADERBOARD_FILTER 1483 +#define IDS_LEADERBOARD_FILTER_FRIENDS 1484 +#define IDS_LEADERBOARD_FILTER_MYSCORE 1485 +#define IDS_LEADERBOARD_FILTER_OVERALL 1486 +#define IDS_LEADERBOARD_ENTRIES 1487 +#define IDS_LEADERBOARD_RANK 1488 +#define IDS_PROGRESS_SAVING_LEVEL 1489 +#define IDS_PROGRESS_SAVING_CHUNKS 1490 +#define IDS_PROGRESS_SAVING_TO_DISC 1491 +#define IDS_PROGRESS_BUILDING_TERRAIN 1492 +#define IDS_PROGRESS_SIMULATING_WORLD 1493 +#define IDS_PROGRESS_INITIALISING_SERVER 1494 +#define IDS_PROGRESS_GENERATING_SPAWN_AREA 1495 +#define IDS_PROGRESS_LOADING_SPAWN_AREA 1496 +#define IDS_PROGRESS_ENTERING_NETHER 1497 +#define IDS_PROGRESS_LEAVING_NETHER 1498 +#define IDS_PROGRESS_RESPAWNING 1499 +#define IDS_PROGRESS_GENERATING_LEVEL 1500 +#define IDS_PROGRESS_LOADING_LEVEL 1501 +#define IDS_PROGRESS_SAVING_PLAYERS 1502 +#define IDS_PROGRESS_CONNECTING 1503 +#define IDS_PROGRESS_DOWNLOADING_TERRAIN 1504 +#define IDS_PROGRESS_CONVERTING_TO_OFFLINE_GAME 1505 +#define IDS_PROGRESS_HOST_SAVING 1506 +#define IDS_PROGRESS_ENTERING_END 1507 +#define IDS_PROGRESS_LEAVING_END 1508 +#define IDS_PROGRESS_NEW_WORLD_SEED 1509 +#define IDS_TILE_BED_OCCUPIED 1510 +#define IDS_TILE_BED_NO_SLEEP 1511 +#define IDS_TILE_BED_PLAYERSLEEP 1512 +#define IDS_TILE_BED_NOT_VALID 1513 +#define IDS_TILE_BED_NOTSAFE 1514 +#define IDS_TILE_BED_MESLEEP 1515 +#define IDS_GROUPNAME_TOOLS 1516 +#define IDS_GROUPNAME_WEAPONS 1517 +#define IDS_GROUPNAME_FOOD 1518 +#define IDS_GROUPNAME_STRUCTURES 1519 +#define IDS_GROUPNAME_ARMOUR 1520 +#define IDS_GROUPNAME_MECHANISMS 1521 +#define IDS_GROUPNAME_TRANSPORT 1522 +#define IDS_GROUPNAME_DECORATIONS 1523 +#define IDS_GROUPNAME_BUILDING_BLOCKS 1524 +#define IDS_GROUPNAME_REDSTONE_AND_TRANSPORT 1525 +#define IDS_GROUPNAME_MISCELLANEOUS 1526 +#define IDS_GROUPNAME_POTIONS 1527 +#define IDS_GROUPNAME_TOOLS_WEAPONS_ARMOR 1528 +#define IDS_GROUPNAME_MATERIALS 1529 +#define IDS_RETURNEDTOMENU_TITLE 1530 +#define IDS_SLIDER_DIFFICULTY 1531 +#define IDS_SLIDER_MUSIC 1532 +#define IDS_SLIDER_SOUND 1533 +#define IDS_SLIDER_GAMMA 1534 +#define IDS_SLIDER_SENSITIVITY_INGAME 1535 +#define IDS_SLIDER_SENSITIVITY_INMENU 1536 +#define IDS_DIFFICULTY_TITLE_PEACEFUL 1537 +#define IDS_DIFFICULTY_TITLE_EASY 1538 +#define IDS_DIFFICULTY_TITLE_NORMAL 1539 +#define IDS_DIFFICULTY_TITLE_HARD 1540 +#define IDS_DIFFICULTY_PEACEFUL 1541 +#define IDS_DIFFICULTY_EASY 1542 +#define IDS_DIFFICULTY_NORMAL 1543 +#define IDS_DIFFICULTY_HARD 1544 +#define IDS_TRIALOVER_TITLE 1545 +#define IDS_MULTIPLAYER_FULL_TITLE 1546 +#define IDS_MULTIPLAYER_FULL_TEXT 1547 +#define IDS_SIGN_TITLE 1548 +#define IDS_SIGN_TITLE_TEXT 1549 +#define IDS_NAME_TITLE 1550 +#define IDS_NAME_TITLE_TEXT 1551 +#define IDS_NAME_CAPTION 1552 +#define IDS_NAME_CAPTION_TEXT 1553 +#define IDS_NAME_DESC 1554 +#define IDS_NAME_DESC_TEXT 1555 +#define IDS_INVENTORY 1556 +#define IDS_INGREDIENTS 1557 +#define IDS_BREWING_STAND 1558 +#define IDS_CHEST 1559 +#define IDS_ENCHANT 1560 +#define IDS_FURNACE 1561 +#define IDS_INGREDIENT 1562 +#define IDS_FUEL 1563 +#define IDS_DISPENSER 1564 +#define IDS_CONTAINER_ANIMAL 1565 +#define IDS_CONTAINER_DROPPER 1566 +#define IDS_CONTAINER_HOPPER 1567 +#define IDS_CONTAINER_BEACON 1568 +#define IDS_CONTAINER_BEACON_PRIMARY_POWER 1569 +#define IDS_CONTAINER_BEACON_SECONDARY_POWER 1570 +#define IDS_CONTAINER_MINECART 1571 +#define IDS_NO_DLCOFFERS 1572 +#define IDS_PLAYER_JOINED 1573 +#define IDS_PLAYER_LEFT 1574 +#define IDS_PLAYER_KICKED 1575 +#define IDS_TEXT_DELETE_SAVE 1576 +#define IDS_STRINGVERIFY_AWAITING_APPROVAL 1577 +#define IDS_STRINGVERIFY_CENSORED 1578 +#define IDS_NOWPLAYING 1579 +#define IDS_DEFAULTS_TITLE 1580 +#define IDS_DEFAULTS_TEXT 1581 +#define IDS_FATAL_ERROR_TITLE 1582 +#define IDS_GAME_HOST_NAME 1583 +#define IDS_GAME_HOST_NAME_UNKNOWN 1584 +#define IDS_GUEST_ORDER_CHANGED_TITLE 1585 +#define IDS_GUEST_ORDER_CHANGED_TEXT 1586 +#define IDS_MUST_SIGN_IN_TITLE 1587 +#define IDS_MUST_SIGN_IN_TEXT 1588 +#define IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE 1589 +#define IDS_FAILED_TO_CREATE_GAME_TITLE 1590 +#define IDS_DEFAULT_SKINS 1591 +#define IDS_NO_SKIN_PACK 1592 +#define IDS_FAVORITES_SKIN_PACK 1593 +#define IDS_BANNED_LEVEL_TITLE 1594 +#define IDS_PLAYER_BANNED_LEVEL 1595 +#define IDS_ACTION_BAN_LEVEL_TITLE 1596 +#define IDS_ACTION_BAN_LEVEL_DESCRIPTION 1597 +#define IDS_BUTTON_REMOVE_FROM_BAN_LIST 1598 +#define IDS_SLIDER_AUTOSAVE 1599 +#define IDS_SLIDER_AUTOSAVE_OFF 1600 +#define IDS_MINUTES 1601 +#define IDS_CANT_PLACE_NEAR_SPAWN_TITLE 1602 +#define IDS_CANT_PLACE_NEAR_SPAWN_TEXT 1603 +#define IDS_SLIDER_INTERFACEOPACITY 1604 +#define IDS_PROGRESS_AUTOSAVING_LEVEL 1605 +#define IDS_SLIDER_UISIZE 1606 +#define IDS_SLIDER_UISIZESPLITSCREEN 1607 +#define IDS_SEED 1608 +#define IDS_UNLOCK_DLC_TITLE 1609 +#define IDS_UNLOCK_DLC_SKIN 1610 +#define IDS_UNLOCK_DLC_TEXTUREPACK_TITLE 1611 +#define IDS_UNLOCK_DLC_TEXTUREPACK_TEXT 1612 +#define IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE 1613 +#define IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT 1614 +#define IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE 1615 +#define IDS_DLC_TEXTUREPACK_UNLOCK_TITLE 1616 +#define IDS_DLC_TEXTUREPACK_GET_TRIAL_TITLE 1617 +#define IDS_DLC_TEXTUREPACK_GET_FULL_TITLE 1618 +#define IDS_DLC_TEXTUREPACK_NOT_PRESENT 1619 +#define IDS_TEXTURE_PACK_TRIALVERSION 1620 +#define IDS_TEXTUREPACK_FULLVERSION 1621 +#define IDS_UNLOCK_KICK_PLAYER_TITLE 1622 +#define IDS_UNLOCK_KICK_PLAYER 1623 +#define IDS_GAMERPICS 1624 +#define IDS_THEMES 1625 +#define IDS_SKINS 1626 +#define IDS_ALLOWFRIENDSOFFRIENDS 1627 +#define IDS_NOTALLOWED_FRIENDSOFFRIENDS 1628 +#define IDS_CANTJOIN_TITLE 1629 +#define IDS_SELECTED 1630 +#define IDS_SELECTED_SKIN 1631 +#define IDS_CORRUPT_DLC_TITLE 1632 +#define IDS_CORRUPT_DLC 1633 +#define IDS_CORRUPT_DLC_MULTIPLE 1634 +#define IDS_GAME_MODE_CHANGED 1635 +#define IDS_RENAME_WORLD_TITLE 1636 +#define IDS_RENAME_WORLD_TEXT 1637 +#define IDS_GAMEMODE_SURVIVAL 1638 +#define IDS_GAMEMODE_CREATIVE 1639 +#define IDS_GAMEMODE_ADVENTURE 1640 +#define IDS_SURVIVAL 1641 +#define IDS_CREATIVE 1642 +#define IDS_ADVENTURE 1643 +#define IDS_CREATED_IN_SURVIVAL 1644 +#define IDS_CREATED_IN_CREATIVE 1645 +#define IDS_CHECKBOX_RENDER_CLOUDS 1646 +#define IDS_TEXT_SAVEOPTIONS 1647 +#define IDS_TITLE_RENAMESAVE 1648 +#define IDS_AUTOSAVE_COUNTDOWN 1649 +#define IDS_ON 1650 +#define IDS_OFF 1651 +#define IDS_LEVELTYPE_NORMAL 1652 +#define IDS_LEVELTYPE_SUPERFLAT 1653 +#define IDS_GAMEOPTION_SEED 1654 +#define IDS_GAMEOPTION_ONLINE 1655 +#define IDS_GAMEOPTION_INVITEONLY 1656 +#define IDS_GAMEOPTION_ALLOWFOF 1657 +#define IDS_GAMEOPTION_PVP 1658 +#define IDS_GAMEOPTION_TRUST 1659 +#define IDS_GAMEOPTION_FIRE_SPREADS 1660 +#define IDS_GAMEOPTION_TNT_EXPLODES 1661 +#define IDS_GAMEOPTION_RESET_NETHER 1662 +#define IDS_GAMEOPTION_STRUCTURES 1663 +#define IDS_GAMEOPTION_SUPERFLAT 1664 +#define IDS_GAMEOPTION_BONUS_CHEST 1665 +#define IDS_GAMEOPTION_MOB_GRIEFING 1666 +#define IDS_GAMEOPTION_KEEP_INVENTORY 1667 +#define IDS_GAMEOPTION_MOB_SPAWNING 1668 +#define IDS_GAMEOPTION_MOB_LOOT 1669 +#define IDS_GAMEOPTION_TILE_DROPS 1670 +#define IDS_GAMEOPTION_NATURAL_REGEN 1671 +#define IDS_GAMEOPTION_DAYLIGHT_CYCLE 1672 +#define IDS_DLC_MENU_SKINPACKS 1673 +#define IDS_DLC_MENU_THEMES 1674 +#define IDS_DLC_MENU_GAMERPICS 1675 +#define IDS_DLC_MENU_AVATARITEMS 1676 +#define IDS_DLC_MENU_TEXTUREPACKS 1677 +#define IDS_DLC_MENU_MASHUPPACKS 1678 +#define IDS_DEATH_INFIRE 1679 +#define IDS_DEATH_ONFIRE 1680 +#define IDS_DEATH_LAVA 1681 +#define IDS_DEATH_INWALL 1682 +#define IDS_DEATH_DROWN 1683 +#define IDS_DEATH_STARVE 1684 +#define IDS_DEATH_CACTUS 1685 +#define IDS_DEATH_FALL 1686 +#define IDS_DEATH_OUTOFWORLD 1687 +#define IDS_DEATH_GENERIC 1688 +#define IDS_DEATH_EXPLOSION 1689 +#define IDS_DEATH_MAGIC 1690 +#define IDS_DEATH_DRAGON_BREATH 1691 +#define IDS_DEATH_MOB 1692 +#define IDS_DEATH_PLAYER 1693 +#define IDS_DEATH_ARROW 1694 +#define IDS_DEATH_FIREBALL 1695 +#define IDS_DEATH_THROWN 1696 +#define IDS_DEATH_INDIRECT_MAGIC 1697 +#define IDS_DEATH_FELL_ACCIDENT_LADDER 1698 +#define IDS_DEATH_FELL_ACCIDENT_VINES 1699 +#define IDS_DEATH_FELL_ACCIDENT_WATER 1700 +#define IDS_DEATH_FELL_ACCIDENT_GENERIC 1701 +#define IDS_DEATH_FELL_KILLER 1702 +#define IDS_DEATH_FELL_ASSIST 1703 +#define IDS_DEATH_FELL_ASSIST_ITEM 1704 +#define IDS_DEATH_FELL_FINISH 1705 +#define IDS_DEATH_FELL_FINISH_ITEM 1706 +#define IDS_DEATH_INFIRE_PLAYER 1707 +#define IDS_DEATH_ONFIRE_PLAYER 1708 +#define IDS_DEATH_LAVA_PLAYER 1709 +#define IDS_DEATH_DROWN_PLAYER 1710 +#define IDS_DEATH_CACTUS_PLAYER 1711 +#define IDS_DEATH_EXPLOSION_PLAYER 1712 +#define IDS_DEATH_WITHER 1713 +#define IDS_DEATH_PLAYER_ITEM 1714 +#define IDS_DEATH_ARROW_ITEM 1715 +#define IDS_DEATH_FIREBALL_ITEM 1716 +#define IDS_DEATH_THROWN_ITEM 1717 +#define IDS_DEATH_INDIRECT_MAGIC_ITEM 1718 +#define IDS_CHECKBOX_RENDER_BEDROCKFOG 1719 +#define IDS_CHECKBOX_DISPLAY_HUD 1720 +#define IDS_CHECKBOX_DISPLAY_HAND 1721 +#define IDS_CHECKBOX_DEATH_MESSAGES 1722 +#define IDS_CHECKBOX_ANIMATED_CHARACTER 1723 +#define IDS_CHECKBOX_CUSTOM_SKIN_ANIM 1724 +#define IDS_PRIV_MINE_TOGGLE_ON 1725 +#define IDS_PRIV_MINE_TOGGLE_OFF 1726 +#define IDS_PRIV_BUILD_TOGGLE_ON 1727 +#define IDS_PRIV_BUILD_TOGGLE_OFF 1728 +#define IDS_PRIV_USE_DOORS_TOGGLE_ON 1729 +#define IDS_PRIV_USE_DOORS_TOGGLE_OFF 1730 +#define IDS_PRIV_USE_CONTAINERS_TOGGLE_ON 1731 +#define IDS_PRIV_USE_CONTAINERS_TOGGLE_OFF 1732 +#define IDS_PRIV_ATTACK_MOB_TOGGLE_ON 1733 +#define IDS_PRIV_ATTACK_MOB_TOGGLE_OFF 1734 +#define IDS_PRIV_ATTACK_PLAYER_TOGGLE_ON 1735 +#define IDS_PRIV_ATTACK_PLAYER_TOGGLE_OFF 1736 +#define IDS_PRIV_ATTACK_ANIMAL_TOGGLE_ON 1737 +#define IDS_PRIV_ATTACK_ANIMAL_TOGGLE_OFF 1738 +#define IDS_PRIV_MODERATOR_TOGGLE_ON 1739 +#define IDS_PRIV_MODERATOR_TOGGLE_OFF 1740 +#define IDS_PRIV_FLY_TOGGLE_ON 1741 +#define IDS_PRIV_FLY_TOGGLE_OFF 1742 +#define IDS_PRIV_EXHAUSTION_TOGGLE_ON 1743 +#define IDS_PRIV_EXHAUSTION_TOGGLE_OFF 1744 +#define IDS_PRIV_INVISIBLE_TOGGLE_ON 1745 +#define IDS_PRIV_INVISIBLE_TOGGLE_OFF 1746 +#define IDS_PRIV_INVULNERABLE_TOGGLE_ON 1747 +#define IDS_PRIV_INVULNERABLE_TOGGLE_OFF 1748 +#define IDS_DLC_COST 1749 +#define IDS_BOSS_ENDERDRAGON_HEALTH 1750 +#define IDS_PLAYER_ENTERED_END 1751 +#define IDS_PLAYER_LEFT_END 1752 +#define IDS_WIN_TEXT 1753 +#define IDS_WIN_TEXT_PART_2 1754 +#define IDS_WIN_TEXT_PART_3 1755 +#define IDS_RESETNETHER_TITLE 1756 +#define IDS_RESETNETHER_TEXT 1757 +#define IDS_RESET_NETHER 1758 +#define IDS_DONT_RESET_NETHER 1759 +#define IDS_CANT_SHEAR_MOOSHROOM 1760 +#define IDS_MAX_PIGS_SHEEP_COWS_CATS_SPAWNED 1761 +#define IDS_MAX_MOOSHROOMS_SPAWNED 1762 +#define IDS_MAX_WOLVES_SPAWNED 1763 +#define IDS_MAX_CHICKENS_SPAWNED 1764 +#define IDS_MAX_SQUID_SPAWNED 1765 +#define IDS_MAX_BATS_SPAWNED 1766 +#define IDS_MAX_ENEMIES_SPAWNED 1767 +#define IDS_MAX_VILLAGERS_SPAWNED 1768 +#define IDS_MAX_HANGINGENTITIES 1769 +#define IDS_CANT_SPAWN_IN_PEACEFUL 1770 +#define IDS_MAX_PIGS_SHEEP_COWS_CATS_BRED 1771 +#define IDS_MAX_WOLVES_BRED 1772 +#define IDS_MAX_CHICKENS_BRED 1773 +#define IDS_MAX_HORSES_BRED 1774 +#define IDS_MAX_MUSHROOMCOWS_BRED 1775 +#define IDS_MAX_BOATS 1776 +#define IDS_MAX_SKULL_TILES 1777 +#define IDS_INVERT_LOOK 1778 +#define IDS_SOUTHPAW 1779 +#define IDS_YOU_DIED 1780 +#define IDS_RESPAWN 1781 +#define IDS_DOWNLOADABLE_CONTENT_OFFERS 1782 +#define IDS_CHANGE_SKIN 1783 +#define IDS_HOW_TO_PLAY 1784 +#define IDS_CONTROLS 1785 +#define IDS_SETTINGS 1786 +#define IDS_LANGUAGE_SELECTOR 1787 +#define IDS_CREDITS 1788 +#define IDS_REINSTALL_CONTENT 1789 +#define IDS_DEBUG_SETTINGS 1790 +#define IDS_FIRE_SPREADS 1791 +#define IDS_TNT_EXPLODES 1792 +#define IDS_PLAYER_VS_PLAYER 1793 +#define IDS_TRUST_PLAYERS 1794 +#define IDS_HOST_PRIVILEGES 1795 +#define IDS_GENERATE_STRUCTURES 1796 +#define IDS_SUPERFLAT_WORLD 1797 +#define IDS_BONUS_CHEST 1798 +#define IDS_WORLD_OPTIONS 1799 +#define IDS_GAME_OPTIONS 1800 +#define IDS_MOB_GRIEFING 1801 +#define IDS_KEEP_INVENTORY 1802 +#define IDS_MOB_SPAWNING 1803 +#define IDS_MOB_LOOT 1804 +#define IDS_TILE_DROPS 1805 +#define IDS_NATURAL_REGEN 1806 +#define IDS_DAYLIGHT_CYCLE 1807 +#define IDS_CAN_BUILD_AND_MINE 1808 +#define IDS_CAN_USE_DOORS_AND_SWITCHES 1809 +#define IDS_CAN_OPEN_CONTAINERS 1810 +#define IDS_CAN_ATTACK_PLAYERS 1811 +#define IDS_CAN_ATTACK_ANIMALS 1812 +#define IDS_MODERATOR 1813 +#define IDS_KICK_PLAYER 1814 +#define IDS_CAN_FLY 1815 +#define IDS_DISABLE_EXHAUSTION 1816 +#define IDS_INVISIBLE 1817 +#define IDS_HOST_OPTIONS 1818 +#define IDS_PLAYERS_INVITE 1819 +#define IDS_ONLINE_GAME 1820 +#define IDS_INVITE_ONLY 1821 +#define IDS_MORE_OPTIONS 1822 +#define IDS_LOAD 1823 +#define IDS_DEFAULT_WORLD_NAME 1824 +#define IDS_WORLD_NAME 1825 +#define IDS_CREATE_NEW_WORLD_SEED 1826 +#define IDS_CREATE_NEW_WORLD_RANDOM_SEED 1827 +#define IDS_PLAYERS 1828 +#define IDS_JOIN_GAME 1829 +#define IDS_START_GAME 1830 +#define IDS_NO_GAMES_FOUND 1831 +#define IDS_PLAY_GAME 1832 +#define IDS_LEADERBOARDS 1833 +#define IDS_HELP_AND_OPTIONS 1834 +#define IDS_UNLOCK_FULL_GAME 1835 +#define IDS_RESUME_GAME 1836 +#define IDS_SAVE_GAME 1837 +#define IDS_LABEL_DIFFICULTY 1838 +#define IDS_LABEL_GAME_TYPE 1839 +#define IDS_LABEL_STRUCTURES 1840 +#define IDS_LABEL_LEVEL_TYPE 1841 +#define IDS_LABEL_PvP 1842 +#define IDS_LABEL_TRUST 1843 +#define IDS_LABEL_TNT 1844 +#define IDS_LABEL_FIRE_SPREADS 1845 +#define IDS_REINSTALL_THEME 1846 +#define IDS_REINSTALL_GAMERPIC_1 1847 +#define IDS_REINSTALL_GAMERPIC_2 1848 +#define IDS_REINSTALL_AVATAR_ITEM_1 1849 +#define IDS_REINSTALL_AVATAR_ITEM_2 1850 +#define IDS_REINSTALL_AVATAR_ITEM_3 1851 +#define IDS_OPTIONS 1852 +#define IDS_AUDIO 1853 +#define IDS_CONTROL 1854 +#define IDS_GRAPHICS 1855 +#define IDS_USER_INTERFACE 1856 +#define IDS_RESET_TO_DEFAULTS 1857 +#define IDS_VIEW_BOBBING 1858 +#define IDS_HINTS 1859 +#define IDS_IN_GAME_TOOLTIPS 1860 +#define IDS_CHECKBOX_VERTICAL_SPLIT_SCREEN 1861 +#define IDS_DONE 1862 +#define IDS_EDIT_SIGN_MESSAGE 1863 +#define IDS_SOCIAL_TEXT 1864 +#define IDS_SOCIAL_LABEL_CAPTION 1865 +#define IDS_SOCIAL_DEFAULT_CAPTION 1866 +#define IDS_SOCIAL_LABEL_DESCRIPTION 1867 +#define IDS_DEFAULT_TEXTUREPACK 1868 +#define IDS_POTION_EMPTY 1869 +#define IDS_POTION_MOVESPEED 1870 +#define IDS_POTION_MOVESLOWDOWN 1871 +#define IDS_POTION_DIGSPEED 1872 +#define IDS_POTION_DIGSLOWDOWN 1873 +#define IDS_POTION_DAMAGEBOOST 1874 +#define IDS_POTION_WEAKNESS 1875 +#define IDS_POTION_HEAL 1876 +#define IDS_POTION_HARM 1877 +#define IDS_POTION_JUMP 1878 +#define IDS_POTION_CONFUSION 1879 +#define IDS_POTION_REGENERATION 1880 +#define IDS_POTION_RESISTANCE 1881 +#define IDS_POTION_FIRERESISTANCE 1882 +#define IDS_POTION_WATERBREATHING 1883 +#define IDS_POTION_INVISIBILITY 1884 +#define IDS_POTION_BLINDNESS 1885 +#define IDS_POTION_NIGHTVISION 1886 +#define IDS_POTION_HUNGER 1887 +#define IDS_POTION_POISON 1888 +#define IDS_POTION_WITHER 1889 +#define IDS_POTION_HEALTHBOOST 1890 +#define IDS_POTION_ABSORPTION 1891 +#define IDS_POTION_SATURATION 1892 +#define IDS_POTION_MOVESPEED_POSTFIX 1893 +#define IDS_POTION_MOVESLOWDOWN_POSTFIX 1894 +#define IDS_POTION_DIGSPEED_POSTFIX 1895 +#define IDS_POTION_DIGSLOWDOWN_POSTFIX 1896 +#define IDS_POTION_DAMAGEBOOST_POSTFIX 1897 +#define IDS_POTION_WEAKNESS_POSTFIX 1898 +#define IDS_POTION_HEAL_POSTFIX 1899 +#define IDS_POTION_HARM_POSTFIX 1900 +#define IDS_POTION_JUMP_POSTFIX 1901 +#define IDS_POTION_CONFUSION_POSTFIX 1902 +#define IDS_POTION_REGENERATION_POSTFIX 1903 +#define IDS_POTION_RESISTANCE_POSTFIX 1904 +#define IDS_POTION_FIRERESISTANCE_POSTFIX 1905 +#define IDS_POTION_WATERBREATHING_POSTFIX 1906 +#define IDS_POTION_INVISIBILITY_POSTFIX 1907 +#define IDS_POTION_BLINDNESS_POSTFIX 1908 +#define IDS_POTION_NIGHTVISION_POSTFIX 1909 +#define IDS_POTION_HUNGER_POSTFIX 1910 +#define IDS_POTION_POISON_POSTFIX 1911 +#define IDS_POTION_WITHER_POSTFIX 1912 +#define IDS_POTION_HEALTHBOOST_POSTFIX 1913 +#define IDS_POTION_ABSORPTION_POSTFIX 1914 +#define IDS_POTION_SATURATION_POSTFIX 1915 +#define IDS_POTION_POTENCY_0 1916 +#define IDS_POTION_POTENCY_1 1917 +#define IDS_POTION_POTENCY_2 1918 +#define IDS_POTION_POTENCY_3 1919 +#define IDS_POTION_PREFIX_GRENADE 1920 +#define IDS_POTION_PREFIX_MUNDANE 1921 +#define IDS_POTION_PREFIX_UNINTERESTING 1922 +#define IDS_POTION_PREFIX_BLAND 1923 +#define IDS_POTION_PREFIX_CLEAR 1924 +#define IDS_POTION_PREFIX_MILKY 1925 +#define IDS_POTION_PREFIX_DIFFUSE 1926 +#define IDS_POTION_PREFIX_ARTLESS 1927 +#define IDS_POTION_PREFIX_THIN 1928 +#define IDS_POTION_PREFIX_AWKWARD 1929 +#define IDS_POTION_PREFIX_FLAT 1930 +#define IDS_POTION_PREFIX_BULKY 1931 +#define IDS_POTION_PREFIX_BUNGLING 1932 +#define IDS_POTION_PREFIX_BUTTERED 1933 +#define IDS_POTION_PREFIX_SMOOTH 1934 +#define IDS_POTION_PREFIX_SUAVE 1935 +#define IDS_POTION_PREFIX_DEBONAIR 1936 +#define IDS_POTION_PREFIX_THICK 1937 +#define IDS_POTION_PREFIX_ELEGANT 1938 +#define IDS_POTION_PREFIX_FANCY 1939 +#define IDS_POTION_PREFIX_CHARMING 1940 +#define IDS_POTION_PREFIX_DASHING 1941 +#define IDS_POTION_PREFIX_REFINED 1942 +#define IDS_POTION_PREFIX_CORDIAL 1943 +#define IDS_POTION_PREFIX_SPARKLING 1944 +#define IDS_POTION_PREFIX_POTENT 1945 +#define IDS_POTION_PREFIX_FOUL 1946 +#define IDS_POTION_PREFIX_ODORLESS 1947 +#define IDS_POTION_PREFIX_RANK 1948 +#define IDS_POTION_PREFIX_HARSH 1949 +#define IDS_POTION_PREFIX_ACRID 1950 +#define IDS_POTION_PREFIX_GROSS 1951 +#define IDS_POTION_PREFIX_STINKY 1952 +#define IDS_POTION_DESC_WATER_BOTTLE 1953 +#define IDS_POTION_DESC_EMPTY 1954 +#define IDS_POTION_DESC_MOVESPEED 1955 +#define IDS_POTION_DESC_MOVESLOWDOWN 1956 +#define IDS_POTION_DESC_DAMAGEBOOST 1957 +#define IDS_POTION_DESC_WEAKNESS 1958 +#define IDS_POTION_DESC_HEAL 1959 +#define IDS_POTION_DESC_HARM 1960 +#define IDS_POTION_DESC_REGENERATION 1961 +#define IDS_POTION_DESC_FIRERESISTANCE 1962 +#define IDS_POTION_DESC_POISON 1963 +#define IDS_POTION_EFFECTS_WHENDRANK 1964 +#define IDS_ATTRIBUTE_NAME_HORSE_JUMPSTRENGTH 1965 +#define IDS_ATTRIBUTE_NAME_ZOMBIE_SPAWNREINFORCEMENTS 1966 +#define IDS_ATTRIBUTE_NAME_GENERIC_MAXHEALTH 1967 +#define IDS_ATTRIBUTE_NAME_GENERIC_FOLLOWRANGE 1968 +#define IDS_ATTRIBUTE_NAME_GENERIC_KNOCKBACKRESISTANCE 1969 +#define IDS_ATTRIBUTE_NAME_GENERIC_MOVEMENTSPEED 1970 +#define IDS_ATTRIBUTE_NAME_GENERIC_ATTACKDAMAGE 1971 +#define IDS_ENCHANTMENT_DAMAGE_ALL 1972 +#define IDS_ENCHANTMENT_DAMAGE_UNDEAD 1973 +#define IDS_ENCHANTMENT_DAMAGE_ARTHROPODS 1974 +#define IDS_ENCHANTMENT_KNOCKBACK 1975 +#define IDS_ENCHANTMENT_FIRE 1976 +#define IDS_ENCHANTMENT_PROTECT_ALL 1977 +#define IDS_ENCHANTMENT_PROTECT_FIRE 1978 +#define IDS_ENCHANTMENT_PROTECT_FALL 1979 +#define IDS_ENCHANTMENT_PROTECT_EXPLOSION 1980 +#define IDS_ENCHANTMENT_PROTECT_PROJECTILE 1981 +#define IDS_ENCHANTMENT_OXYGEN 1982 +#define IDS_ENCHANTMENT_WATER_WORKER 1983 +#define IDS_ENCHANTMENT_DIGGING 1984 +#define IDS_ENCHANTMENT_UNTOUCHING 1985 +#define IDS_ENCHANTMENT_DURABILITY 1986 +#define IDS_ENCHANTMENT_LOOT_BONUS 1987 +#define IDS_ENCHANTMENT_LOOT_BONUS_DIGGER 1988 +#define IDS_ENCHANTMENT_ARROW_DAMAGE 1989 +#define IDS_ENCHANTMENT_ARROW_FIRE 1990 +#define IDS_ENCHANTMENT_ARROW_KNOCKBACK 1991 +#define IDS_ENCHANTMENT_ARROW_INFINITE 1992 +#define IDS_ENCHANTMENT_LEVEL_1 1993 +#define IDS_ENCHANTMENT_LEVEL_2 1994 +#define IDS_ENCHANTMENT_LEVEL_3 1995 +#define IDS_ENCHANTMENT_LEVEL_4 1996 +#define IDS_ENCHANTMENT_LEVEL_5 1997 +#define IDS_ENCHANTMENT_LEVEL_6 1998 +#define IDS_ENCHANTMENT_LEVEL_7 1999 +#define IDS_ENCHANTMENT_LEVEL_8 2000 +#define IDS_ENCHANTMENT_LEVEL_9 2001 +#define IDS_ENCHANTMENT_LEVEL_10 2002 +#define IDS_DESC_EMERALDORE 2003 +#define IDS_DESC_ENDERCHEST 2004 +#define IDS_DESC_TRIPWIRE_SOURCE 2005 +#define IDS_DESC_TRIPWIRE 2006 +#define IDS_DESC_EMERALDBLOCK 2007 +#define IDS_DESC_COBBLESTONE_WALL 2008 +#define IDS_DESC_ANVIL 2009 +#define IDS_DESC_NETHER_QUARTZ_ORE 2010 +#define IDS_DESC_QUARTZ_BLOCK 2011 +#define IDS_DESC_EMERALD 2012 +#define IDS_DESC_FLOWERPOT 2013 +#define IDS_DESC_CARROTS 2014 +#define IDS_DESC_POTATO 2015 +#define IDS_DESC_POTATO_BAKED 2016 +#define IDS_DESC_POTATO_POISONOUS 2017 +#define IDS_DESC_CARROT_GOLDEN 2018 +#define IDS_DESC_CARROT_ON_A_STICK 2019 +#define IDS_DESC_PUMPKIN_PIE 2020 +#define IDS_DESC_ENCHANTED_BOOK 2021 +#define IDS_DESC_NETHER_QUARTZ 2022 +#define IDS_DESC_CARPET 2023 +#define IDS_ITEM_EMERALD 2024 +#define IDS_FLOWERPOT 2025 +#define IDS_CARROTS 2026 +#define IDS_POTATO 2027 +#define IDS_ITEM_POTATO_BAKED 2028 +#define IDS_ITEM_POTATO_POISONOUS 2029 +#define IDS_ITEM_CARROT_GOLDEN 2030 +#define IDS_ITEM_CARROT_ON_A_STICK 2031 +#define IDS_ITEM_PUMPKIN_PIE 2032 +#define IDS_ITEM_ENCHANTED_BOOK 2033 +#define IDS_ITEM_NETHER_QUARTZ 2034 +#define IDS_TILE_EMERALDORE 2035 +#define IDS_TILE_ENDERCHEST 2036 +#define IDS_TILE_TRIPWIRE_SOURCE 2037 +#define IDS_TILE_TRIPWIRE 2038 +#define IDS_TILE_EMERALDBLOCK 2039 +#define IDS_TILE_COBBLESTONE_WALL 2040 +#define IDS_TILE_COBBLESTONE_WALL_MOSSY 2041 +#define IDS_TILE_FLOWERPOT 2042 +#define IDS_TILE_CARROTS 2043 +#define IDS_TILE_POTATOES 2044 +#define IDS_TILE_ANVIL 2045 +#define IDS_TILE_ANVIL_INTACT 2046 +#define IDS_TILE_ANVIL_SLIGHTLYDAMAGED 2047 +#define IDS_TILE_ANVIL_VERYDAMAGED 2048 +#define IDS_TILE_NETHER_QUARTZ 2049 +#define IDS_TILE_QUARTZ_BLOCK 2050 +#define IDS_TILE_QUARTZ_BLOCK_CHISELED 2051 +#define IDS_TILE_QUARTZ_BLOCK_LINES 2052 +#define IDS_TILE_STAIRS_QUARTZ 2053 +#define IDS_TILE_CARPET 2054 +#define IDS_TILE_CARPET_BLACK 2055 +#define IDS_TILE_CARPET_RED 2056 +#define IDS_TILE_CARPET_GREEN 2057 +#define IDS_TILE_CARPET_BROWN 2058 +#define IDS_TILE_CARPET_BLUE 2059 +#define IDS_TILE_CARPET_PURPLE 2060 +#define IDS_TILE_CARPET_CYAN 2061 +#define IDS_TILE_CARPET_SILVER 2062 +#define IDS_TILE_CARPET_GRAY 2063 +#define IDS_TILE_CARPET_PINK 2064 +#define IDS_TILE_CARPET_LIME 2065 +#define IDS_TILE_CARPET_YELLOW 2066 +#define IDS_TILE_CARPET_LIGHT_BLUE 2067 +#define IDS_TILE_CARPET_MAGENTA 2068 +#define IDS_TILE_CARPET_ORANGE 2069 +#define IDS_TILE_CARPET_WHITE 2070 +#define IDS_TILE_SANDSTONE_CHISELED 2071 +#define IDS_TILE_SANDSTONE_SMOOTH 2072 +#define IDS_DEATH_THORNS 2073 +#define IDS_DEATH_FALLING_ANVIL 2074 +#define IDS_DEATH_FALLING_TILE 2075 +#define IDS_COMMAND_TELEPORT_SUCCESS 2076 +#define IDS_COMMAND_TELEPORT_ME 2077 +#define IDS_COMMAND_TELEPORT_TO_ME 2078 +#define IDS_ENCHANTMENT_THORNS 2079 +#define IDS_TILE_STONESLAB_QUARTZ 2080 +#define IDS_POTION_DESC_NIGHTVISION 2081 +#define IDS_POTION_DESC_INVISIBILITY 2082 +#define IDS_REPAIR_AND_NAME 2083 +#define IDS_REPAIR_COST 2084 +#define IDS_REPAIR_EXPENSIVE 2085 +#define IDS_TITLE_RENAME 2086 +#define IDS_YOU_HAVE 2087 +#define IDS_REQUIRED_ITEMS_FOR_TRADE 2088 +#define IDS_VILLAGER_OFFERS_ITEM 2089 +#define IDS_TOOLTIPS_REPAIR 2090 +#define IDS_TOOLTIPS_TRADE 2091 +#define IDS_TOOLTIPS_DYECOLLAR 2092 +#define IDS_TUTORIAL_TASK_ANVIL_MENU_OVERVIEW 2093 +#define IDS_TUTORIAL_PROMPT_ANVIL_MENU_OVERVIEW 2094 +#define IDS_TUTORIAL_TASK_ANVIL_MENU_START 2095 +#define IDS_TUTORIAL_TASK_ANVIL_MENU_REPAIR 2096 +#define IDS_TUTORIAL_TASK_ANVIL_MENU_SACRIFICE 2097 +#define IDS_TUTORIAL_TASK_ANVIL_MENU_ENCHANT 2098 +#define IDS_TUTORIAL_TASK_ANVIL_MENU_COST 2099 +#define IDS_TUTORIAL_TASK_ANVIL_MENU_RENAMING 2100 +#define IDS_TUTORIAL_TASK_ANVIL_MENU_SMITH 2101 +#define IDS_TUTORIAL_TASK_ANVIL_OVERVIEW 2102 +#define IDS_TUTORIAL_PROMPT_ANVIL_OVERVIEW 2103 +#define IDS_TUTORIAL_TASK_ANVIL_SUMMARY 2104 +#define IDS_TUTORIAL_TASK_ANVIL_ENCHANTED_BOOKS 2105 +#define IDS_TUTORIAL_TASK_ANVIL_COST 2106 +#define IDS_TUTORIAL_TASK_ANVIL_COST2 2107 +#define IDS_TUTORIAL_TASK_ANVIL_RENAMING 2108 +#define IDS_TUTORIAL_TASK_ANVIL_USE_CHESTS 2109 +#define IDS_TUTORIAL_TASK_TRADING_MENU_OVERVIEW 2110 +#define IDS_TUTORIAL_PROMPT_TRADING_MENU_OVERVIEW 2111 +#define IDS_TUTORIAL_TASK_TRADING_MENU_START 2112 +#define IDS_TUTORIAL_TASK_TRADING_MENU_UNAVAILABLE 2113 +#define IDS_TUTORIAL_TASK_TRADING_MENU_DETAILS 2114 +#define IDS_TUTORIAL_TASK_TRADING_MENU_INVENTORY 2115 +#define IDS_TUTORIAL_TASK_TRADING_MENU_TRADE 2116 +#define IDS_TUTORIAL_TASK_TRADING_OVERVIEW 2117 +#define IDS_TUTORIAL_PROMPT_TRADING_OVERVIEW 2118 +#define IDS_TUTORIAL_TASK_TRADING_SUMMARY 2119 +#define IDS_TUTORIAL_TASK_TRADING_TRADES 2120 +#define IDS_TUTORIAL_TASK_TRADING_INCREASE_TRADES 2121 +#define IDS_TUTORIAL_TASK_TRADING_DECREASE_TRADES 2122 +#define IDS_TUTORIAL_TASK_TRADING_USE_CHESTS 2123 +#define IDS_TUTORIAL_TASK_ENDERCHEST_OVERVIEW 2124 +#define IDS_TUTORIAL_PROMPT_ENDERCHEST_OVERVIEW 2125 +#define IDS_TUTORIAL_TASK_ENDERCHEST_SUMMARY 2126 +#define IDS_TUTORIAL_TASK_ENDERCHEST_PLAYERS 2127 +#define IDS_TUTORIAL_TASK_ENDERCHEST_FUNCTION 2128 +#define IDS_DESC_ENCHANTED_GOLDENAPPLE 2129 +#define IDS_ENABLE_TELEPORT 2130 +#define IDS_TELEPORT 2131 +#define IDS_TELEPORT_TO_PLAYER 2132 +#define IDS_TELEPORT_TO_ME 2133 +#define IDS_CAN_DISABLE_EXHAUSTION 2134 +#define IDS_CAN_INVISIBLE 2135 +#define IDS_PRIV_CAN_INVISIBLE_TOGGLE_ON 2136 +#define IDS_PRIV_CAN_INVISIBLE_TOGGLE_OFF 2137 +#define IDS_PRIV_CAN_FLY_TOGGLE_ON 2138 +#define IDS_PRIV_CAN_FLY_TOGGLE_OFF 2139 +#define IDS_PRIV_CAN_EXHAUSTION_TOGGLE_ON 2140 +#define IDS_PRIV_CAN_EXHAUSTION_TOGGLE_OFF 2141 +#define IDS_PRIV_CAN_TELEPORT_TOGGLE_ON 2142 +#define IDS_PRIV_CAN_TELEPORT_TOGGLE_OFF 2143 +#define IDS_HOW_TO_PLAY_ANVIL 2144 +#define IDS_HOW_TO_PLAY_TRADING 2145 +#define IDS_HOW_TO_PLAY_ENDERCHEST 2146 +#define IDS_VILLAGER_FARMER 2147 +#define IDS_VILLAGER_LIBRARIAN 2148 +#define IDS_VILLAGER_PRIEST 2149 +#define IDS_VILLAGER_SMITH 2150 +#define IDS_VILLAGER_BUTCHER 2151 +#define IDS_DESC_VILLAGER 2152 +#define IDS_CHEST_LARGE 2153 +#define IDS_TUTORIAL_TASK_ENCHANTING_BOOKS 2154 +#define IDS_TUTORIAL_TASK_REDSTONE_TRIPWIRE 2155 +#define IDS_TUTORIAL_TASK_BREEDING_WOLF_COLLAR 2156 +#define IDS_TUTORIAL_TASK_FARMING_CARROTS_AND_POTATOES 2157 +#define IDS_TUTORIAL_TASK_BREEDING_RIDING_PIGS 2158 +#define IDS_TUTORIAL_TASK_MINECART_PUSHING 2159 +#define IDS_CONNECTION_FAILED_NO_SD_SPLITSCREEN 2160 +#define IDS_TOOLTIPS_CURE 2161 +#define IDS_WINDOWS_EXIT 2162 +#define IDS_SLIDER_FOV 2163 +#define IDS_SLIDER_RENDERDISTANCE 2164 +#define IDS_IN_GAME_OLDSWINGANIMATION 2165 +#define IDS_GRAPHICSMODE_POTATO 2166 +#define IDS_GRAPHICSMODE_FAST 2167 +#define IDS_GRAPHICSMODE_FANCY 2168 +#define IDS_GRAPHICSMODE_EXTRA 2169 +#define IDS_GENERAL_OPTIONS 2170 +#define IDS_QUALITY_OPTIONS 2171 +#define IDS_LANG_SYSTEM 2172 +#define IDS_LANG_ENGLISH 2173 +#define IDS_LANG_GERMAN 2174 +#define IDS_LANG_SPANISH 2175 +#define IDS_LANG_SPANISH_SPAIN 2176 +#define IDS_LANG_SPANISH_LATIN_AMERICA 2177 +#define IDS_LANG_FRENCH 2178 +#define IDS_LANG_ITALIAN 2179 +#define IDS_LANG_PORTUGUESE 2180 +#define IDS_LANG_PORTUGUESE_PORTUGAL 2181 +#define IDS_LANG_PORTUGUESE_BRAZIL 2182 +#define IDS_LANG_JAPANESE 2183 +#define IDS_LANG_KOREAN 2184 +#define IDS_LANG_CHINESE_TRADITIONAL 2185 +#define IDS_LANG_CHINESE_SIMPLIFIED 2186 +#define IDS_LANG_DANISH 2187 +#define IDS_LANG_FINISH 2188 +#define IDS_LANG_DUTCH 2189 +#define IDS_LANG_POLISH 2190 +#define IDS_LANG_RUSSIAN 2191 +#define IDS_LANG_SWEDISH 2192 +#define IDS_LANG_NORWEGIAN 2193 +#define IDS_LANG_GREEK 2194 +#define IDS_LANG_TURKISH 2195 +#define IDS_LEADERBOARD_KILLS_EASY 2196 +#define IDS_LEADERBOARD_KILLS_NORMAL 2197 +#define IDS_LEADERBOARD_KILLS_HARD 2198 +#define IDS_LEADERBOARD_MINING_BLOCKS_PEACEFUL 2199 +#define IDS_LEADERBOARD_MINING_BLOCKS_EASY 2200 +#define IDS_LEADERBOARD_MINING_BLOCKS_NORMAL 2201 +#define IDS_LEADERBOARD_MINING_BLOCKS_HARD 2202 +#define IDS_LEADERBOARD_FARMING_PEACEFUL 2203 +#define IDS_LEADERBOARD_FARMING_EASY 2204 +#define IDS_LEADERBOARD_FARMING_NORMAL 2205 +#define IDS_LEADERBOARD_FARMING_HARD 2206 +#define IDS_LEADERBOARD_TRAVELLING_PEACEFUL 2207 +#define IDS_LEADERBOARD_TRAVELLING_EASY 2208 +#define IDS_LEADERBOARD_TRAVELLING_NORMAL 2209 +#define IDS_LEADERBOARD_TRAVELLING_HARD 2210 +#define IDS_TIPS_GAMETIP_0 2211 +#define IDS_TIPS_GAMETIP_1 2212 +#define IDS_TIPS_GAMETIP_48 2213 +#define IDS_TIPS_GAMETIP_44 2214 +#define IDS_TIPS_GAMETIP_45 2215 +#define IDS_TIPS_TRIVIA_4 2216 +#define IDS_TIPS_TRIVIA_17 2217 +#define IDS_HOW_TO_PLAY_MULTIPLAYER 2218 +#define IDS_HOW_TO_PLAY_SOCIALMEDIA 2219 +#define IDS_HOW_TO_PLAY_CREATIVE 2220 +#define IDS_TUTORIAL_TASK_FLY 2221 +#define IDS_TOOLTIPS_SELECTDEVICE 2222 +#define IDS_TOOLTIPS_CHANGEDEVICE 2223 +#define IDS_TOOLTIPS_VIEW_GAMERCARD 2224 +#define IDS_TOOLTIPS_VIEW_GAMERPROFILE 2225 +#define IDS_TOOLTIPS_INVITE_PARTY 2226 +#define IDS_CONFIRM_START_CREATIVE 2227 +#define IDS_CONFIRM_START_SAVEDINCREATIVE 2228 +#define IDS_CONFIRM_START_SAVEDINCREATIVE_CONTINUE 2229 +#define IDS_CONFIRM_START_HOST_PRIVILEGES 2230 +#define IDS_CONNECTION_LOST_LIVE 2231 +#define IDS_CONNECTION_LOST_LIVE_NO_EXIT 2232 +#define IDS_AWARD_AVATAR1 2233 +#define IDS_AWARD_AVATAR2 2234 +#define IDS_AWARD_AVATAR3 2235 +#define IDS_AWARD_THEME 2236 +#define IDS_UNLOCK_ACHIEVEMENT_TEXT 2237 +#define IDS_UNLOCK_AVATAR_TEXT 2238 +#define IDS_UNLOCK_GAMERPIC_TEXT 2239 +#define IDS_UNLOCK_THEME_TEXT 2240 +#define IDS_UNLOCK_ACCEPT_INVITE 2241 +#define IDS_UNLOCK_GUEST_TEXT 2242 +#define IDS_LEADERBOARD_GAMERTAG 2243 +#define IDS_GROUPNAME_POTIONS_480 2244 +#define IDS_RETURNEDTOTITLESCREEN_TEXT 2245 +#define IDS_TRIALOVER_TEXT 2246 +#define IDS_FATAL_ERROR_TEXT 2247 +#define IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT 2248 +#define IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT 2249 +#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL 2250 +#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL 2251 +#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_REMOTE 2252 +#define IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE 2253 +#define IDS_SAVE_ICON_MESSAGE 2254 +#define IDS_GAMEOPTION_HOST_PRIVILEGES 2255 +#define IDS_CHECKBOX_DISPLAY_SPLITSCREENGAMERTAGS 2256 +#define IDS_ACHIEVEMENTS 2257 +#define IDS_LABEL_GAMERTAGS 2258 +#define IDS_IN_GAME_GAMERTAGS 2259 +#define IDS_SOCIAL_DEFAULT_DESCRIPTION 2260 +#define IDS_TITLE_UPDATE_NAME 2261 +#define IDS_PLATFORM_NAME 2262 +#define IDS_BACK_BUTTON 2263 +#define IDS_HOST_OPTION_DISABLES_ACHIEVEMENTS 2264 +#define IDS_KICK_PLAYER_DESCRIPTION 2265 +#define IDS_USING_TRIAL_TEXUREPACK_WARNING 2266 +#define IDS_WORLD_SIZE_TITLE_SMALL 2267 +#define IDS_WORLD_SIZE_TITLE_MEDIUM 2268 +#define IDS_WORLD_SIZE_TITLE_LARGE 2269 +#define IDS_WORLD_SIZE_TITLE_CLASSIC 2270 +#define IDS_WORLD_SIZE 2271 +#define IDS_GAMEOPTION_WORLD_SIZE 2272 +#define IDS_DISABLE_SAVING 2273 +#define IDS_GAMEOPTION_DISABLE_SAVING 2274 +#define IDS_RICHPRESENCE_GAMESTATE 2275 +#define IDS_RICHPRESENCE_IDLE 2276 +#define IDS_RICHPRESENCE_MENUS 2277 +#define IDS_RICHPRESENCE_MULTIPLAYER 2278 +#define IDS_RICHPRESENCE_MULTIPLAYEROFFLINE 2279 +#define IDS_RICHPRESENCE_MULTIPLAYER_1P 2280 +#define IDS_RICHPRESENCE_MULTIPLAYER_1POFFLINE 2281 +#define IDS_RICHPRESENCESTATE_BLANK 2282 +#define IDS_RICHPRESENCESTATE_RIDING_PIG 2283 +#define IDS_RICHPRESENCESTATE_RIDING_MINECART 2284 +#define IDS_RICHPRESENCESTATE_BOATING 2285 +#define IDS_RICHPRESENCESTATE_FISHING 2286 +#define IDS_RICHPRESENCESTATE_CRAFTING 2287 +#define IDS_RICHPRESENCESTATE_FORGING 2288 +#define IDS_RICHPRESENCESTATE_NETHER 2289 +#define IDS_RICHPRESENCESTATE_CD 2290 +#define IDS_RICHPRESENCESTATE_MAP 2291 +#define IDS_RICHPRESENCESTATE_ENCHANTING 2292 +#define IDS_RICHPRESENCESTATE_BREWING 2293 +#define IDS_RICHPRESENCESTATE_ANVIL 2294 +#define IDS_RICHPRESENCESTATE_TRADING 2295 +#define IDS_RICHPRESENCESTATE_BEACON 2296 +#define IDS_RICHPRESENCESTATE_END 2297 +#define IDS_RICHPRESENCESTATE_END_POEM 2298 +#define IDS_RICHPRESENCESTATE_FIREWORKS 2299 +#define IDS_RICHPRESENCESTATE_FURNACE 2300 +#define IDS_RICHPRESENCESTATE_HOPPER 2301 +#define IDS_RICHPRESENCESTATE_HORSE 2302 +#define IDS_RICHPRESENCESTATE_RIDING_HORSE 2303 +#define IDS_RICHPRESENCESTATE_SIGN 2304 diff --git a/Minecraft.Client/Xbox/Xbox_App.cpp b/Minecraft.Client/Xbox/Xbox_App.cpp index f902e44d..a717540b 100644 --- a/Minecraft.Client/Xbox/Xbox_App.cpp +++ b/Minecraft.Client/Xbox/Xbox_App.cpp @@ -1658,7 +1658,7 @@ HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *in // If you're navigating to the multigamejoinload, and the player hasn't seen the updates message yet, display it now // display this message the first 3 times // todo: re-enable if we fix this menu, for now its just blank! - if(false && (eScene==eUIScene_LoadCreateJoinMenu) && (bSeenUpdateTextThisSession==false) && ( app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplayUpdateMessage)!=0)) + if(false && (eScene==eUIScene_LoadOrJoinMenu) && (bSeenUpdateTextThisSession==false) && ( app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplayUpdateMessage)!=0)) { eScene=eUIScene_NewUpdateMessage; bSeenUpdateTextThisSession=true; @@ -1671,7 +1671,6 @@ HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *in case eUIScene_PauseMenu: case eUIScene_Crafting2x2Menu: case eUIScene_Crafting3x3Menu: - case eUIScene_ClassicCraftingMenu: case eUIScene_FurnaceMenu: case eUIScene_ContainerMenu: case eUIScene_LargeContainerMenu: @@ -1738,7 +1737,7 @@ HRESULT CConsoleMinecraftApp::NavigateToScene(int iPad,EUIScene eScene, void *in case eUIScene_LeaderboardsMenu: case eUIScene_Credits: case eUIScene_CreateWorldMenu: - case eUIScene_LoadCreateJoinMenu: + case eUIScene_LoadOrJoinMenu: case eUIScene_JoinMenu: case eUIScene_DLCOffersMenu: case eUIScene_DLCMainMenu: diff --git a/Minecraft.Client/cmake/sources/Common.cmake b/Minecraft.Client/cmake/sources/Common.cmake index ea8ba533..f9303c15 100644 --- a/Minecraft.Client/cmake/sources/Common.cmake +++ b/Minecraft.Client/cmake/sources/Common.cmake @@ -157,12 +157,6 @@ set(_MINECRAFT_CLIENT_COMMON_COMMON_LOCALISATION ) source_group("Common/Localisation" FILES ${_MINECRAFT_CLIENT_COMMON_COMMON_LOCALISATION}) -set(_MINECRAFT_CLIENT_COMMON_COMMON_STRUCTURETABLE - "${CMAKE_CURRENT_SOURCE_DIR}/StructureTable.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/StructureTable.h" -) -source_group("Common/StructureTable" FILES ${_MINECRAFT_CLIENT_COMMON_COMMON_STRUCTURETABLE}) - set(_MINECRAFT_CLIENT_COMMON_COMMON_NETWORK "${BASE_DIR}/Network/GameNetworkManager.cpp" "${BASE_DIR}/Network/GameNetworkManager.h" @@ -299,8 +293,6 @@ set(_MINECRAFT_CLIENT_COMMON_COMMON_UI_ALL_PLATFORMS "${BASE_DIR}/UI/IUIScene_CraftingMenu.h" "${BASE_DIR}/UI/IUIScene_CreativeMenu.cpp" "${BASE_DIR}/UI/IUIScene_CreativeMenu.h" - "${BASE_DIR}/UI/IUIScene_ClassicCraftingMenu.cpp" - "${BASE_DIR}/UI/IUIScene_ClassicCraftingMenu.h" "${BASE_DIR}/UI/IUIScene_DispenserMenu.cpp" "${BASE_DIR}/UI/IUIScene_DispenserMenu.h" "${BASE_DIR}/UI/IUIScene_EnchantingMenu.cpp" @@ -1059,7 +1051,6 @@ set(MINECRAFT_CLIENT_COMMON ${_MINECRAFT_CLIENT_COMMON_COMMON_GAMERULES_LEVELRULES_RULES} ${_MINECRAFT_CLIENT_COMMON_COMMON_LEADERBOARDS} ${_MINECRAFT_CLIENT_COMMON_COMMON_LOCALISATION} - ${_MINECRAFT_CLIENT_COMMON_COMMON_STRUCTURETABLE} ${_MINECRAFT_CLIENT_COMMON_COMMON_NETWORK} ${_MINECRAFT_CLIENT_COMMON_COMMON_TELEMETRY} ${_MINECRAFT_CLIENT_COMMON_COMMON_TRIAL} diff --git a/Minecraft.Client/cmake/sources/Windows.cmake b/Minecraft.Client/cmake/sources/Windows.cmake index 21d4c56c..85fb0f5d 100644 --- a/Minecraft.Client/cmake/sources/Windows.cmake +++ b/Minecraft.Client/cmake/sources/Windows.cmake @@ -83,16 +83,10 @@ set(_MINECRAFT_CLIENT_WINDOWS_COMMON_UI_CONTROLS "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_Label.h" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_LeaderboardList.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_LeaderboardList.h" - "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_LeftIconButtonList.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_LeftIconButtonList.h" - "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_List.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_List.h" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_MinecraftHorse.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_MinecraftHorse.h" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_MinecraftPlayer.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_MinecraftPlayer.h" - "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_MultiList.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_MultiList.h" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_PlayerList.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_PlayerList.h" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIControl_PlayerSkinPreview.cpp" @@ -162,8 +156,8 @@ set(_MINECRAFT_CLIENT_WINDOWS_COMMON_UI_SCENES_FRONTEND_MENU_SCREENS "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_LeaderboardsMenu.h" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_LoadMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_LoadMenu.h" - "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_LoadCreateJoinMenu.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_LoadCreateJoinMenu.h" + "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_LoadOrJoinMenu.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_LoadOrJoinMenu.h" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_MainMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_MainMenu.h" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_NewUpdateMessage.cpp" @@ -238,8 +232,6 @@ set(_MINECRAFT_CLIENT_WINDOWS_COMMON_UI_SCENES_INGAME_MENU_SCREENS_CONTAINERS "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_BeaconMenu.h" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_BrewingStandMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_BrewingStandMenu.h" - "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_ClassicCraftingMenu.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_ClassicCraftingMenu.h" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_ContainerMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_ContainerMenu.h" "${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_CreativeMenu.cpp" @@ -320,6 +312,13 @@ set(_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_4JLIBS_INC ) source_group("Windows64/Libs/4JLibs/inc" FILES ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_4JLIBS_INC}) +set(_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_GAMECONFIG + "${BASE_DIR}/GameConfig/Minecraft.gameconfig" + "${BASE_DIR}/GameConfig/Minecraft.spa" + "${BASE_DIR}/GameConfig/Minecraft.spa.h" +) +source_group("Windows64/GameConfig" FILES ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_GAMECONFIG}) + set(_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_IGGY_GDRAW "${BASE_DIR}/Libs/Iggy/gdraw/gdraw_d3d11.cpp" "${BASE_DIR}/Libs/Iggy/gdraw/gdraw_d3d11.h" @@ -335,26 +334,6 @@ set(_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_IGGY_INC ) source_group("Windows64/Libs/Iggy/inc" FILES ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_IGGY_INC}) -set(_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_DISCORD_INC - "${BASE_DIR}/Libs/Discord/inc/discord_register.h" - "${BASE_DIR}/Libs/Discord/inc/discord_rpc.h" -) -source_group("Windows64/Libs/Discord/inc" FILES ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_DISCORD_INC}) - -set(_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_ZSTD_INC - "${BASE_DIR}/Libs/zstd/inc/zdict.h" - "${BASE_DIR}/Libs/zstd/inc/zstd.h" - "${BASE_DIR}/Libs/zstd/inc/zstd_errors.h" -) -source_group("Windows64/Libs/zstd/inc" FILES ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_ZSTD_INC}) - -set(_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_GAMECONFIG - "${BASE_DIR}/GameConfig/Minecraft.gameconfig" - "${BASE_DIR}/GameConfig/Minecraft.spa" - "${BASE_DIR}/GameConfig/Minecraft.spa.h" -) -source_group("Windows64/GameConfig" FILES ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_GAMECONFIG}) - set(_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LEADERBOARDS "${BASE_DIR}/Leaderboards/WindowsLeaderboardManager.cpp" "${BASE_DIR}/Leaderboards/WindowsLeaderboardManager.h" @@ -450,11 +429,9 @@ set(MINECRAFT_CLIENT_WINDOWS ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS} ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64} ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_4JLIBS_INC} + ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_GAMECONFIG} ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_IGGY_GDRAW} ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_IGGY_INC} - ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_DISCORD_INC} - ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LIBS_ZSTD_INC} - ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_GAMECONFIG} ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_LEADERBOARDS} ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_SENTIENT} ${_MINECRAFT_CLIENT_WINDOWS_WINDOWS64_SOCIAL} diff --git a/Minecraft.Client/stdafx.h b/Minecraft.Client/stdafx.h index d048f444..a6a563d1 100644 --- a/Minecraft.Client/stdafx.h +++ b/Minecraft.Client/stdafx.h @@ -332,7 +332,6 @@ namespace fs = std::filesystem; #include "Common\GameRules\ConsoleGameRules.h" #include "Common\GameRules\ConsoleSchematicFile.h" #include "Common\Colours\ColourTable.h" -#include "StructureTable.h" #include "Common\DLC\DLCSkinFile.h" #include "Common\DLC\DLCManager.h" #include "Common\DLC\DLCPack.h" diff --git a/Minecraft.Server/WorldManager.cpp b/Minecraft.Server/WorldManager.cpp index 4600e6dd..2020fd9f 100644 --- a/Minecraft.Server/WorldManager.cpp +++ b/Minecraft.Server/WorldManager.cpp @@ -135,9 +135,9 @@ static bool EnsureDirectoryExists(const std::wstring &directoryPath, bool *outCr } /** - * Prepares the save root used by the Windows64 storage layout + * Prepares the save root used by the Data storage layout * - Creates `Data` first because `CreateDirectoryW` is not recursive - * - Creates `Data\Saves` when missing before world bootstrap starts + * - Creates `Data/Saves` when missing before world bootstrap starts * Windows64用保存先ディレクトリの存在保証 */ static bool EnsureSavesRootExists() @@ -156,7 +156,7 @@ static bool EnsureSavesRootExists() if (windows64Created || savesCreated) { - LogWorldIO("created missing Windows64\\Saves storage directories"); + LogWorldIO("created missing Data/Saves storage directories"); } return true; @@ -552,7 +552,7 @@ WorldBootstrapResult BootstrapWorldForServer( WorldBootstrapResult result; if (!EnsureSavesRootExists()) { - LogWorldIO("failed to prepare Windows64\\Saves storage root"); + LogWorldIO("failed to prepare Windows64/Data/Saves storage root"); return result; } diff --git a/Minecraft.Server/cmake/sources/Common.cmake b/Minecraft.Server/cmake/sources/Common.cmake index 897e313a..28ff00d4 100644 --- a/Minecraft.Server/cmake/sources/Common.cmake +++ b/Minecraft.Server/cmake/sources/Common.cmake @@ -117,7 +117,6 @@ set(_MINECRAFT_SERVER_COMMON_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/IUIScene_CommandBlockMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/IUIScene_ContainerMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/IUIScene_ClassicCraftingMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/IUIScene_DispenserMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/IUIScene_EnchantingMenu.cpp" @@ -155,10 +154,8 @@ set(_MINECRAFT_SERVER_COMMON_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIControl_HTMLLabel.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIControl_Label.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIControl_LeaderboardList.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIControl_List.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIControl_MinecraftHorse.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIControl_MinecraftPlayer.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIControl_MultiList.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIControl_PlayerList.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIControl_Progress.cpp" @@ -181,7 +178,6 @@ set(_MINECRAFT_SERVER_COMMON_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_ClassicCraftingMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_Credits.cpp" @@ -216,7 +212,7 @@ set(_MINECRAFT_SERVER_COMMON_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_LoadCreateJoinMenu.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_MainMenu.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_MessageBox.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.cpp" @@ -424,7 +420,6 @@ set(_MINECRAFT_SERVER_COMMON_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/StitchedTexture.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/Stitcher.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/StringTable.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/StructureTable.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/SuspendedParticle.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/SuspendedTownParticle.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/TakeAnimationParticle.cpp" @@ -487,8 +482,6 @@ set(_MINECRAFT_SERVER_COMMON_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.Client/stubs.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.World/ConsoleSaveFileOriginal.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.World/ConsoleSaveFileOriginal.h" - "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.World/ConsoleSaveFileSplit.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../Minecraft.World/ConsoleSaveFileSplit.h" "${CMAKE_CURRENT_SOURCE_DIR}/Console/ServerCliInput.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/Console/ServerCliInput.h" ) diff --git a/Minecraft.World/AnvilMenu.h b/Minecraft.World/AnvilMenu.h index 228e91d4..f0c8d971 100644 --- a/Minecraft.World/AnvilMenu.h +++ b/Minecraft.World/AnvilMenu.h @@ -6,20 +6,20 @@ class AnvilMenu : public AbstractContainerMenu { friend class RepairResultSlot; private: - static constexpr bool DEBUG_COST = false; + static const bool DEBUG_COST = false; public: - static constexpr int INPUT_SLOT = 0; - static constexpr int ADDITIONAL_SLOT = 1; - static constexpr int RESULT_SLOT = 2; + static const int INPUT_SLOT = 0; + static const int ADDITIONAL_SLOT = 1; + static const int RESULT_SLOT = 2; static constexpr int INV_SLOT_START = RESULT_SLOT + 1; static constexpr int INV_SLOT_END = INV_SLOT_START + 9 * 3; - static constexpr int USE_ROW_SLOT_START = INV_SLOT_END; + static const int USE_ROW_SLOT_START = INV_SLOT_END; static constexpr int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9; public: - static constexpr int DATA_TOTAL_COST = 0; + static const int DATA_TOTAL_COST = 0; private: shared_ptr resultSlots; diff --git a/Minecraft.World/ArmorItem.cpp b/Minecraft.World/ArmorItem.cpp index ee67561a..93d58cdd 100644 --- a/Minecraft.World/ArmorItem.cpp +++ b/Minecraft.World/ArmorItem.cpp @@ -263,23 +263,4 @@ Icon *ArmorItem::getEmptyIcon(int slot) } return nullptr; -} - -// TU25 Addition -shared_ptr ArmorItem::use(shared_ptr itemInstance, Level *level, shared_ptr player) -{ - if ((player->getArmor(Mob::getEquipmentSlotForItem(itemInstance) - 1)) == nullptr) - { - shared_ptr equip = itemInstance->copy(); - equip->count = 1; - player->setEquippedSlot(Mob::getEquipmentSlotForItem(itemInstance) - 1, equip); - itemInstance->count--; - } - - return itemInstance; -} - -bool ArmorItem::TestUse(shared_ptr itemInstance, Level *level, shared_ptr player) -{ - return ((player->getArmor(Mob::getEquipmentSlotForItem(itemInstance) - 1)) == nullptr); } \ No newline at end of file diff --git a/Minecraft.World/ArmorItem.h b/Minecraft.World/ArmorItem.h index 39199fbc..92a40aea 100644 --- a/Minecraft.World/ArmorItem.h +++ b/Minecraft.World/ArmorItem.h @@ -88,7 +88,4 @@ public: virtual void registerIcons(IconRegister *iconRegister); static Icon *getEmptyIcon(int slot); - - virtual bool TestUse(shared_ptr itemInstance, Level *level, shared_ptr player); - virtual shared_ptr use(shared_ptr itemInstance, Level *level, shared_ptr player); }; \ No newline at end of file diff --git a/Minecraft.World/BasicTree.cpp b/Minecraft.World/BasicTree.cpp index 62c7303f..54138e3b 100644 --- a/Minecraft.World/BasicTree.cpp +++ b/Minecraft.World/BasicTree.cpp @@ -283,7 +283,7 @@ void BasicTree::limb(int *start, int *end, int material) coordinate[secidx1] = Mth::floor(start[secidx1] + (primoffset * secfac1) + 0.5); coordinate[secidx2] = Mth::floor(start[secidx2] + (primoffset * secfac2) + 0.5); - int dir = LogTile::FACING_Y; + int dir = TreeTile::FACING_Y; int xdiff = abs(coordinate[0] - start[0]); int zdiff = abs(coordinate[2] - start[2]); int maxdiff = max(xdiff, zdiff); @@ -292,11 +292,11 @@ void BasicTree::limb(int *start, int *end, int material) { if (xdiff == maxdiff) { - dir = LogTile::FACING_X; + dir = TreeTile::FACING_X; } else if (zdiff == maxdiff) { - dir = LogTile::FACING_Z; + dir = TreeTile::FACING_Z; } } placeBlock(thisLevel, coordinate[0], coordinate[1], coordinate[2], material, dir); diff --git a/Minecraft.World/Bat.cpp b/Minecraft.World/Bat.cpp index 43b7bb8e..462fef57 100644 --- a/Minecraft.World/Bat.cpp +++ b/Minecraft.World/Bat.cpp @@ -41,8 +41,9 @@ float Bat::getVoicePitch() int Bat::getAmbientSound() { if (isResting() && random->nextInt(4) != 0) + { return -1; - + } return eSoundType_MOB_BAT_IDLE; //"mob.bat.idle"; } @@ -88,9 +89,13 @@ void Bat::setResting(bool value) { char current = entityData->getByte(DATA_ID_FLAGS); if (value) + { entityData->set(DATA_ID_FLAGS, static_cast(current | FLAG_RESTING)); + } else + { entityData->set(DATA_ID_FLAGS, static_cast(current & ~FLAG_RESTING)); + } } bool Bat::useNewAi() @@ -100,6 +105,7 @@ bool Bat::useNewAi() void Bat::tick() { + AmbientCreature::tick(); if (isResting()) @@ -108,7 +114,10 @@ void Bat::tick() y = Mth::floor(y) + 1.0 - bbHeight; } else + { yd *= .6f; + } + } inline int signum(double x) { return (x > 0) - (x < 0); } @@ -126,8 +135,11 @@ void Bat::newServerAiStep() } else { + if (random->nextInt(200) == 0) + { yHeadRot = random->nextInt(360); + } if (level->getNearestPlayer(shared_from_this(), 4.0f) != nullptr) { @@ -164,7 +176,10 @@ void Bat::newServerAiStep() yRot += rotDiff; if (random->nextInt(100) == 0 && level->isSolidBlockingTile(Mth::floor(x), static_cast(y) + 1, Mth::floor(z))) + { setResting(true); + } + } } @@ -173,7 +188,9 @@ bool Bat::makeStepSound() return false; } -void Bat::causeFallDamage(float distance) {} +void Bat::causeFallDamage(float distance) +{ +} void Bat::checkFallDamage(double ya, bool onGround) { @@ -188,13 +205,13 @@ bool Bat::isIgnoringTileTriggers() bool Bat::hurt(DamageSource *source, float dmg) { - if (isInvulnerable()) - return false; - + if (isInvulnerable()) return false; if (!level->isClientSide) { if (isResting()) + { setResting(false); + } } return AmbientCreature::hurt(source, dmg); @@ -214,11 +231,11 @@ void Bat::addAdditonalSaveData(CompoundTag *entityTag) entityTag->putByte(L"BatFlags", entityData->getByte(DATA_ID_FLAGS)); } + bool Bat::canSpawn() { int yt = Mth::floor(bb->y0); - if (yt >= level->seaLevel) - return false; + if (yt >= level->seaLevel) return false; int xt = Mth::floor(x); int zt = Mth::floor(z); @@ -227,18 +244,15 @@ bool Bat::canSpawn() int maxLight = 4; if ((Calendar::GetDayOfMonth() + 1 == 10 && Calendar::GetDayOfMonth() >= 20) || (Calendar::GetMonth() + 1 == 11 && Calendar::GetMonth() <= 3)) + { maxLight = 7; + } else if (random->nextBoolean()) + { return false; + } - if (br > random->nextInt(maxLight)) - return false; + if (br > random->nextInt(maxLight)) return false; return AmbientCreature::canSpawn(); -} - -// TU25 Addition -float Bat::getEyeHeight() -{ - return bbHeight * 0.5f; } \ No newline at end of file diff --git a/Minecraft.World/Bat.h b/Minecraft.World/Bat.h index 6a76a679..118fc6ed 100644 --- a/Minecraft.World/Bat.h +++ b/Minecraft.World/Bat.h @@ -55,6 +55,4 @@ public: virtual void readAdditionalSaveData(CompoundTag *tag); virtual void addAdditonalSaveData(CompoundTag *entityTag); virtual bool canSpawn(); - // TU25 Addition - virtual float getEyeHeight(); }; \ No newline at end of file diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index 0218bfeb..43c83ff5 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -309,32 +309,4 @@ int Biome::getFolageColor() int Biome::getWaterColor() { return Minecraft::GetInstance()->getColourTable()->getColor( m_waterColor ); -} - -// TU25 -Vec3 *Biome::getFogColor(float td, float a) const -{ - float br = Mth::cos(td * PI * 2) * 2 + 0.5f; - if (br < 0.0f) br = 0.0f; - if (br > 1.0f) br = 1.0f; - - unsigned int baseFogColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Default_Fog_Colour ); - float r = ((baseFogColour >> 16) & 0xff) / 255.0f; - float g = ((baseFogColour >> 8) & 0xff) / 255.0f; - float b = ((baseFogColour) & 0xff) / 255.0f; - r *= br * 0.94f + 0.06f; - g *= br * 0.94f + 0.06f; - b *= br * 0.91f + 0.09f; - - return Vec3::newTemp(r, g, b); -} - -bool Biome::isNatural() -{ - return true; -} - -bool Biome::isFoggy() -{ - return false; } \ No newline at end of file diff --git a/Minecraft.World/Biome.h b/Minecraft.World/Biome.h index 03320559..d87bd36a 100644 --- a/Minecraft.World/Biome.h +++ b/Minecraft.World/Biome.h @@ -150,8 +150,4 @@ public: virtual int getGrassColor(); virtual int getFolageColor(); virtual int getWaterColor(); // 4J Added - //TU25 - virtual Vec3 *getFogColor(float td, float a) const; - virtual bool isNatural(); - virtual bool isFoggy(); }; \ No newline at end of file diff --git a/Minecraft.World/BirchFeature.cpp b/Minecraft.World/BirchFeature.cpp index 5a855e6a..3c423564 100644 --- a/Minecraft.World/BirchFeature.cpp +++ b/Minecraft.World/BirchFeature.cpp @@ -75,7 +75,7 @@ bool BirchFeature::place(Level *level, Random *random, int x, int y, int z) for (int hh = 0; hh < treeHeight; hh++) { int t = level->getTile(x, y + hh, z); - if (t == 0 || t == Tile::leaves_Id) placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, LogTile::BIRCH_TRUNK); + if (t == 0 || t == Tile::leaves_Id) placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, TreeTile::BIRCH_TRUNK); } return true; diff --git a/Minecraft.World/BoundingBox.cpp b/Minecraft.World/BoundingBox.cpp index 67be9308..e93158f2 100644 --- a/Minecraft.World/BoundingBox.cpp +++ b/Minecraft.World/BoundingBox.cpp @@ -178,22 +178,12 @@ wstring BoundingBox::toString() return L"(" + std::to_wstring(x0) + L", " + std::to_wstring(y0) + L", " + std::to_wstring(z0) + L"; " + std::to_wstring(x1) + L", " + std::to_wstring(y1) + L", " + std::to_wstring(z1) + L")"; } -void BoundingBox::read(DataInputStream *dis) +IntArrayTag *BoundingBox::createTag(const wstring &name) { - x0 = dis->readInt(); - y0 = dis->readInt(); - z0 = dis->readInt(); - x1 = dis->readInt(); - y1 = dis->readInt(); - z1 = dis->readInt(); -} + // 4J-JEV: If somebody knows a better way to do this, please tell me. + int *data = new int[6](); + data[0] = x0; data[1] = y0; data[2] = z0; + data[3] = x1; data[4] = y1; data[5] = z1; -void BoundingBox::write(DataOutputStream *dos) -{ - dos->writeInt(x0); - dos->writeInt(y0); - dos->writeInt(z0); - dos->writeInt(x1); - dos->writeInt(y1); - dos->writeInt(z1); + return new IntArrayTag( name, intArray(data,6) ); } \ No newline at end of file diff --git a/Minecraft.World/BoundingBox.h b/Minecraft.World/BoundingBox.h index 2698f23d..ac29883f 100644 --- a/Minecraft.World/BoundingBox.h +++ b/Minecraft.World/BoundingBox.h @@ -31,7 +31,5 @@ public: int getZCenter(); wstring toString(); - - void read(DataInputStream *dis); - void write(DataOutputStream *dos); + IntArrayTag *createTag(const wstring &name); }; \ No newline at end of file diff --git a/Minecraft.World/C4JThread.cpp b/Minecraft.World/C4JThread.cpp index 1add41c4..ec8263ca 100644 --- a/Minecraft.World/C4JThread.cpp +++ b/Minecraft.World/C4JThread.cpp @@ -1004,7 +1004,7 @@ C4JThread::EventQueue::EventQueue( UpdateFunc* updateFunc, ThreadInitFunc thread { m_updateFunc = updateFunc; m_threadInitFunc = threadInitFunc; - strcpy_s(m_threadName, szThreadName); + strcpy(m_threadName, szThreadName); m_thread = nullptr; m_startEvent = nullptr; m_finishedEvent = nullptr; diff --git a/Minecraft.World/CaveSpider.cpp b/Minecraft.World/CaveSpider.cpp index 61658a80..d9396c43 100644 --- a/Minecraft.World/CaveSpider.cpp +++ b/Minecraft.World/CaveSpider.cpp @@ -60,10 +60,4 @@ MobGroupData *CaveSpider::finalizeMobSpawn(MobGroupData *groupData, int extraDat { // do nothing return groupData; -} - -// TU25 Addition -float CaveSpider::getEyeHeight() -{ - return 0.45f; } \ No newline at end of file diff --git a/Minecraft.World/CaveSpider.h b/Minecraft.World/CaveSpider.h index d7c993b6..79824e68 100644 --- a/Minecraft.World/CaveSpider.h +++ b/Minecraft.World/CaveSpider.h @@ -17,6 +17,4 @@ protected: public: virtual bool doHurtTarget(shared_ptr target); MobGroupData *finalizeMobSpawn(MobGroupData *groupData, int extraData = 0); // 4J Added extraData param - // TU25 Addition - virtual float getEyeHeight(); }; \ No newline at end of file diff --git a/Minecraft.World/Chicken.cpp b/Minecraft.World/Chicken.cpp index 568beed0..355d8a25 100644 --- a/Minecraft.World/Chicken.cpp +++ b/Minecraft.World/Chicken.cpp @@ -155,9 +155,3 @@ bool Chicken::isFood(shared_ptr itemInstance) { return (itemInstance->id == Item::seeds_wheat_Id) || (itemInstance->id == Item::netherwart_seeds_Id) || (itemInstance->id == Item::seeds_melon_Id) || (itemInstance->id == Item::seeds_pumpkin_Id); } - -// TU25 Addition -float Chicken::getEyeHeight() -{ - return bbHeight; -} \ No newline at end of file diff --git a/Minecraft.World/Chicken.h b/Minecraft.World/Chicken.h index f4d176f2..0f406219 100644 --- a/Minecraft.World/Chicken.h +++ b/Minecraft.World/Chicken.h @@ -43,6 +43,5 @@ protected: public: virtual shared_ptr getBreedOffspring(shared_ptr target); virtual bool isFood(shared_ptr itemInstance); - // TU25 Addition - virtual float getEyeHeight(); + }; diff --git a/Minecraft.World/ClothDyeRecipes.cpp b/Minecraft.World/ClothDyeRecipes.cpp index d567d5d2..c0625d2e 100644 --- a/Minecraft.World/ClothDyeRecipes.cpp +++ b/Minecraft.World/ClothDyeRecipes.cpp @@ -21,6 +21,7 @@ void ClothDyeRecipes::addRecipes(Recipes *r) L'#', new ItemInstance(Tile::clayHardened), L'X', new ItemInstance(Item::dye_powder, 1, i),L'D'); +#if 0 r->addShapedRecipy(new ItemInstance(Tile::stained_glass, 8, ColoredTile::getItemAuxValueForTileData(i)), // L"sssczczg", L"###", @@ -33,6 +34,7 @@ void ClothDyeRecipes::addRecipes(Recipes *r) L"###", L"###", L'#', new ItemInstance(Tile::stained_glass, 1, i), L'D'); +#endif } // some dye recipes diff --git a/Minecraft.World/CocoaTile.cpp b/Minecraft.World/CocoaTile.cpp index 31b912d9..3df58eb8 100644 --- a/Minecraft.World/CocoaTile.cpp +++ b/Minecraft.World/CocoaTile.cpp @@ -54,7 +54,7 @@ bool CocoaTile::canSurvive(Level *level, int x, int y, int z) z += Direction::STEP_Z[dir]; int attachedTo = level->getTile(x, y, z); - return attachedTo == Tile::treeTrunk_Id && Tile::treeTrunk->getWoodType(level->getData(x, y, z)) == LogTile::JUNGLE_TRUNK; + return attachedTo == Tile::treeTrunk_Id && TreeTile::getWoodType(level->getData(x, y, z)) == TreeTile::JUNGLE_TRUNK; } int CocoaTile::getRenderShape() diff --git a/Minecraft.World/CompressedTileStorage.cpp b/Minecraft.World/CompressedTileStorage.cpp index db20fca5..4c979a61 100644 --- a/Minecraft.World/CompressedTileStorage.cpp +++ b/Minecraft.World/CompressedTileStorage.cpp @@ -226,7 +226,7 @@ CompressedTileStorage::~CompressedTileStorage() } else { - if(indicesAndData) mi_free(indicesAndData); + if(indicesAndData) free(indicesAndData); } #endif } @@ -830,7 +830,7 @@ void CompressedTileStorage::tick() } else { - mi_free(toFree); + free(toFree); } #endif } while( toFree ); diff --git a/Minecraft.World/ConsoleSaveFileConverter.cpp b/Minecraft.World/ConsoleSaveFileConverter.cpp index ec5098ed..0c8b6658 100644 --- a/Minecraft.World/ConsoleSaveFileConverter.cpp +++ b/Minecraft.World/ConsoleSaveFileConverter.cpp @@ -296,6 +296,6 @@ void ConsoleSaveFileConverter::ConvertSave(ConsoleSaveFile *sourceSave, ConsoleS } } } - } #endif + } } \ No newline at end of file diff --git a/Minecraft.World/ConsoleSaveFileSplit.cpp b/Minecraft.World/ConsoleSaveFileSplit.cpp deleted file mode 100644 index 90d0c051..00000000 --- a/Minecraft.World/ConsoleSaveFileSplit.cpp +++ /dev/null @@ -1,1713 +0,0 @@ -#ifdef SPLIT_SAVES -#include "stdafx.h" -#include "StringHelpers.h" -#include "ConsoleSaveFileSplit.h" -#include "ConsoleSaveFileConverter.h" -#include "File.h" -#include -#include "compression.h" -#include "..\Minecraft.Client\Minecraft.h" -#include "..\Minecraft.Client\MinecraftServer.h" -#include "..\Minecraft.Client\ServerLevel.h" -#include "..\Minecraft.World\net.minecraft.world.level.h" -#include "..\Minecraft.World\LevelData.h" -#include "..\Minecraft.Client\Common\GameRules\LevelGenerationOptions.h" -#include "..\Minecraft.World\net.minecraft.world.level.chunk.storage.h" - -#define RESERVE_ALLOCATION MEM_RESERVE -#define COMMIT_ALLOCATION MEM_COMMIT - -unsigned int ConsoleSaveFileSplit::pagesCommitted = 0; -void *ConsoleSaveFileSplit::pvHeap = nullptr; - -ConsoleSaveFileSplit::RegionFileReference::RegionFileReference(int index, unsigned int regionIndex, unsigned int length/*=0*/, unsigned char *data/*=nullptr*/) -{ - fileEntry = new FileEntry(); - fileEntry->currentFilePointer = 0; - fileEntry->data.length = 0; - fileEntry->data.regionIndex = regionIndex; - this->data = 0; - this->index = index; - this->dirty = false; - this->dataCompressed = data; - this->dataCompressedSize = length; - this->lastWritten = 0; -} - -ConsoleSaveFileSplit::RegionFileReference::~RegionFileReference() -{ - free(data); - delete fileEntry; -} - -// Compress from data to dataCompressed. Uses a special compression method that is designed just to efficiently store runs of zeros, with little overhead on other stuff. -// Compresed format is a 4 byte uncompressed size, followed by data as follows: -// -// Byte value Meaning -// -// 1 - 255 Normal data -// 0 followed by 1 - 255 Run of 1 - 255 0s -// 0 followed by 0, followed by 256 to 65791 (as 2 bytes) Run of 256 to 65791 zeros - -void ConsoleSaveFileSplit::RegionFileReference::Compress() -{ - unsigned char *dataIn = data; - unsigned char *dataInLast = data + fileEntry->data.length; - -// int64_t startTime = System::currentTimeMillis(); - - // One pass through to work out storage space required for compressed data - unsigned int outputSize = 4; // 4 bytes required to store the uncompressed size for faster decompression - unsigned int runLength = 0; - while( dataIn != dataInLast ) - { - unsigned char thisByte = *dataIn++; - if( ( thisByte != 0 ) || ( runLength == ( 65535 + 256 ) ) ) - { - // We've got a non-zero value, or we've hit our maximum run length. - // If there was a preceeding run of zeros, encode that nwo - if( runLength != 0 ) - { - if( runLength < 256 ) - { - // Runs of 1 to 255 encoded as 0 followed by one byte of run length - outputSize += 2; - } - else - { - // Runs of 256 to 65791 encoded as two 0s followed by two bytes of run length - 256 - outputSize += 4; - } - // Run is now processed - runLength = 0; - } - // Now handle the current byte - if( thisByte == 0 ) - { - runLength++; - } - else - { - // Non-zero, just copy over to output - outputSize++; - } - } - else - { - // It's a zero - keep counting size of the run - runLength++; - } - } - // Handle any outstanding run - if ( runLength != 0 ) - { - if( runLength < 256 ) - { - // Runs of 1 to 255 encoded as 0 followed by one byte of run length - outputSize += 2; - } - else - { - // Runs of 256 to 65791 encoded as two 0s followed by two bytes of run length - 256 - outputSize += 4; - } - // Run is now processed - runLength = 0; - } - - // Now actually allocate & write the compress data. First 4 bytes store the uncompressed size - dataCompressed = (unsigned char *)malloc(outputSize); - *((unsigned int *)dataCompressed) = fileEntry->data.length; - unsigned char *dataOut = dataCompressed + 4; - dataIn = data; - - // Now same process as before, but actually writing - while( dataIn != dataInLast ) - { - unsigned char thisByte = *dataIn++; - if( ( thisByte != 0 ) || ( runLength == ( 65535 + 256 ) ) ) - { - // We've got a non-zero value, or we've hit our maximum run length. - // If there was a preceeding run of zeros, encode that nwo - if( runLength != 0 ) - { - if( runLength < 256 ) - { - // Runs of 1 to 255 encoded as 0 followed by one byte of run length - *dataOut++ = 0; - *dataOut++ = runLength; - } - else - { - // Runs of 256 to 65791 encoded as two 0s followed by two bytes of run length - 256 - *dataOut++ = 0; - *dataOut++ = 0; - unsigned int largeRunLength = runLength - 256; - *dataOut++ = ( largeRunLength >> 8 ) & 0xff; - *dataOut++ = ( largeRunLength ) & 0xff; - } - // Run is now processed - runLength = 0; - } - // Now handle the current byte - if( thisByte == 0 ) - { - runLength++; - } - else - { - // Non-zero, just copy over to output - *dataOut++ = thisByte; - } - } - else - { - // It's a zero - keep counting size of the run - runLength++; - } - } - // Handle any outstanding run - if( runLength != 0 ) - { - if( runLength < 256 ) - { - // Runs of 1 to 255 encoded as 0 followed by one byte of run length - *dataOut++ = 0; - *dataOut++ = runLength; - } - else - { - // Runs of 256 to 65791 encoded as two 0s followed by two bytes of run length - 256 - *dataOut++ = 0; - *dataOut++ = 0; - unsigned int largeRunLength = runLength - 256; - *dataOut++ = ( largeRunLength >> 8 ) & 0xff; - *dataOut++ = ( largeRunLength ) & 0xff; - } - // Run is now processed - runLength = 0; - } - assert(( dataOut - dataCompressed ) == outputSize ); - dataCompressedSize = outputSize; -// int64_t endTime = System::currentTimeMillis(); -// app.DebugPrintf("Compressing region file 0x%.8x from %d to %d bytes - %dms\n", fileEntry->data.regionIndex, fileEntry->data.length, dataCompressedSize, endTime - startTime); -} - -// Decompress from dataCompressed -> data. See comment in Compress method for format -void ConsoleSaveFileSplit::RegionFileReference::Decompress() -{ -// int64_t startTime = System::currentTimeMillis(); - fileEntry->data.length = *((unsigned int *)dataCompressed); - - // If this is unusually large, then test how big it would be when expanded before trying to allocate. Matching the expanded size - // is (currently) our means of knowing that this file is ok - if( fileEntry->data.length > 1 * 1024 * 1024 ) - { - unsigned int uncompressedSize = 0; - unsigned char *dataIn = dataCompressed + 4; - unsigned char *dataInLast = dataCompressed + dataCompressedSize; - - while (dataIn != dataInLast) - { - unsigned char thisByte = *dataIn++; - if( thisByte == 0 ) - { - thisByte = *dataIn++; - if( thisByte == 0 ) - { - unsigned int runLength = (*dataIn++) << 8; - runLength |= (*dataIn++); - runLength += 256; - uncompressedSize += runLength; - } - else - { - unsigned int runLength = thisByte; - uncompressedSize += runLength; - } - } - else - { - uncompressedSize++; - } - } - - if( fileEntry->data.length != uncompressedSize ) - { - // Treat as if it was an empty region file - fileEntry->data.length = 0; - assert(0); - return; - } - } - - - data = (unsigned char *)malloc(fileEntry->data.length); - unsigned char *dataIn = dataCompressed + 4; - unsigned char *dataInLast = dataCompressed + dataCompressedSize; - unsigned char *dataOut = data; - - while (dataIn != dataInLast) - { - unsigned char thisByte = *dataIn++; - if( thisByte == 0 ) - { - thisByte = *dataIn++; - if( thisByte == 0 ) - { - unsigned int runLength = (*dataIn++) << 8; - runLength |= (*dataIn++); - runLength += 256; - for( unsigned int i = 0; i < runLength; i++ ) - { - *dataOut++ = 0; - } - } - else - { - unsigned int runLength = thisByte; - for( unsigned int i = 0; i < runLength; i++ ) - { - *dataOut++ = 0; - } - } - } - else - { - *dataOut++ = thisByte; - } - } - // If we failed to correctly decompress, then treat as if it was an empty region file - if( ( dataOut - data ) != fileEntry->data.length ) - { - free(data); - fileEntry->data.length = 0; - data = nullptr; - assert(0); - } -// int64_t endTime = System::currentTimeMillis(); -// app.DebugPrintf("Decompressing region file from 0x%.8x %d to %d bytes - %dms\n", fileEntry->data.regionIndex, dataCompressedSize, fileEntry->data.length, endTime - startTime);// -} - -unsigned int ConsoleSaveFileSplit::RegionFileReference::GetCompressedSize() -{ - unsigned char *dataIn = data; - unsigned char *dataInLast = data + fileEntry->data.length; - - unsigned int outputSize = 4; // 4 bytes required to store the uncompressed size for faster decompression - unsigned int runLength = 0; - while( dataIn != dataInLast ) - { - unsigned char thisByte = *dataIn++; - if( ( thisByte != 0 ) || ( runLength == ( 65535 + 256 ) ) ) - { - // We've got a non-zero value, or we've hit our maximum run length. - // If there was a preceeding run of zeros, encode that nwo - if( runLength != 0 ) - { - if( runLength < 256 ) - { - // Runs of 1 to 255 encoded as 0 followed by one byte of run length - outputSize += 2; - } - else - { - // Runs of 256 to 65791 encoded as two 0s followed by two bytes of run length - 256 - outputSize += 4; - } - // Run is now processed - runLength = 0; - } - // Now handle the current byte - if( thisByte == 0 ) - { - runLength++; - } - else - { - // Non-zero, just copy over to output - outputSize++; - } - } - else - { - // It's a zero - keep counting size of the run - runLength++; - } - } - // Handle any outstanding run - if ( runLength != 0 ) - { - if( runLength < 256 ) - { - // Runs of 1 to 255 encoded as 0 followed by one byte of run length - outputSize += 2; - } - else - { - // Runs of 256 to 65791 encoded as two 0s followed by two bytes of run length - 256 - outputSize += 4; - } - // Run is now processed - runLength = 0; - } - return outputSize; -} - -// Release dataCompressed -void ConsoleSaveFileSplit::RegionFileReference::ReleaseCompressed() -{ -// app.DebugPrintf("Releasing compressed data for region file from 0x%.8x\n", fileEntry->data.regionIndex ); - free(dataCompressed); - dataCompressed = nullptr; - dataCompressedSize = nullptr; -} - -FileEntry *ConsoleSaveFileSplit::GetRegionFileEntry(unsigned int regionIndex) -{ - // Is a region file - determine if we've got it as a separate file - if (auto it = regionFiles.find(regionIndex); it != regionFiles.end()) - { - // Already got it - return it->second->fileEntry; - } - - int index = StorageManager.AddSubfile(regionIndex); - RegionFileReference *newRef = new RegionFileReference(index, regionIndex); - regionFiles[regionIndex] = newRef; - - return newRef->fileEntry; -} - -ConsoleSaveFileSplit::ConsoleSaveFileSplit(const wstring &fileName, LPVOID pvSaveData /*= nullptr*/, DWORD dFileSize /*= 0*/, bool forceCleanSave /*= false*/, ESavePlatform plat /*= SAVE_FILE_PLATFORM_LOCAL*/) -{ - DWORD fileSize = dFileSize; - - // Load a save from the game rules - bool bLevelGenBaseSave = false; - LevelGenerationOptions *levelGen = app.getLevelGenerationOptions(); - if( pvSaveData == nullptr && levelGen != nullptr && levelGen->requiresBaseSave()) - { - pvSaveData = levelGen->getBaseSaveData(fileSize); - if(pvSaveData && fileSize != 0) bLevelGenBaseSave = true; - } - - if( pvSaveData == nullptr || fileSize == 0) - fileSize = StorageManager.GetSaveSize(); - - if( forceCleanSave ) - fileSize = 0; - - _init(fileName, pvSaveData, fileSize, plat); - - if(bLevelGenBaseSave) - { - levelGen->deleteBaseSaveData(); - } -} - -ConsoleSaveFileSplit::ConsoleSaveFileSplit(ConsoleSaveFile *sourceSave, bool alreadySmallRegions, ProgressListener *progress) -{ - _init(sourceSave->getFilename(), nullptr, 0, sourceSave->getSavePlatform()); - - header.setOriginalSaveVersion(sourceSave->getOriginalSaveVersion()); - header.setSaveVersion(sourceSave->getSaveVersion()); - - if(alreadySmallRegions) - { - - vector *sourceFiles = sourceSave->getFilesWithPrefix(L""); - - DWORD bytesWritten; - for (auto it = sourceFiles->begin(); it != sourceFiles->end(); ++it) - { - FileEntry *sourceEntry = *it; - sourceSave->setFilePointer(sourceEntry, 0, nullptr, FILE_BEGIN); - - FileEntry *targetEntry = createFile(ConsoleSavePath(sourceEntry->data.filename)); - - writeFile(targetEntry, sourceSave->getWritePointer(sourceEntry), sourceEntry->getFileSize(), &bytesWritten); - } - - delete sourceFiles; - } - else - { - ConsoleSaveFileConverter::ConvertSave(sourceSave, this, progress); - } -} - -void ConsoleSaveFileSplit::_init(const wstring &fileName, LPVOID pvSaveData, DWORD fileSize, ESavePlatform plat) -{ - InitializeCriticalSectionAndSpinCount(&m_lock,5120); - - m_lastTickTime = 0; - - // One time initialise of static stuff required for our storage - if( pvHeap == nullptr ) - { - // Reserve a chunk of 64MB of virtual address space for our saves, using 64KB pages. - // We'll only be committing these as required to grow the storage we need, which will - // the storage to grow without having to use realloc. - pvHeap = VirtualAlloc(nullptr, MAX_PAGE_COUNT * CSF_PAGE_SIZE, RESERVE_ALLOCATION, PAGE_READWRITE ); - } - - pvSaveMem = pvHeap; - m_fileName = fileName; - - // Get details of region files. From this point on we are responsible for the memory that the storage manager initially allocated for them - unsigned int regionCount = StorageManager.GetSubfileCount(); - for( unsigned int i = 0; i < regionCount; i++ ) - { - unsigned int regionIndex; - unsigned char *regionDataCompressed; - unsigned int regionSizeCompressed; - - StorageManager.GetSubfileDetails(i, ®ionIndex, ®ionDataCompressed, ®ionSizeCompressed); - - RegionFileReference *regionFileRef = new RegionFileReference(i, regionIndex, regionSizeCompressed, regionDataCompressed); - if( regionSizeCompressed > 0 ) - { - regionFileRef->Decompress(); - } - else - { - regionFileRef->fileEntry->data.length = 0; - } - regionFileRef->ReleaseCompressed(); - regionFiles[regionIndex] = regionFileRef; - } - - DWORD heapSize = max( fileSize, (DWORD)(1024 * 1024 * 2)); // 4J Stu - Our files are going to be bigger than 2MB so allocate high to start with - - // Initially committ enough room to store headSize bytes (using CSF_PAGE_SIZE pages, so rounding up here). We should only ever have one save file at a time, - // and the pages should be decommitted in the dtor, so pages committed should always be zero at this point. - if( pagesCommitted != 0 ) - { -#ifndef _CONTENT_PACKAGE - __debugbreak(); -#endif - } - - unsigned int pagesRequired = ( heapSize + (CSF_PAGE_SIZE - 1 ) ) / CSF_PAGE_SIZE; - - void *pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, COMMIT_ALLOCATION, PAGE_READWRITE); - if( pvRet == nullptr ) - { -#ifndef _CONTENT_PACKAGE - // Out of physical memory - __debugbreak(); -#endif - } - pagesCommitted = pagesRequired; - - if( fileSize > 0) - { - if(pvSaveData != nullptr) - { - memcpy(pvSaveMem, pvSaveData, fileSize); - } - else - { - unsigned int storageLength; - StorageManager.GetSaveData( pvSaveMem, &storageLength ); - app.DebugPrintf("Filesize - %d, Adjusted size - %d\n",fileSize,storageLength); - fileSize = storageLength; - } - - int compressed = *(int*)pvSaveMem; - if( compressed == 0 ) - { - unsigned int decompSize = *( (int*)pvSaveMem+1 ); - - // An invalid save, so clear the memory and start from scratch - if(decompSize == 0) - { - // 4J Stu - Saves created between 2/12/2011 and 7/12/2011 will have this problem - app.DebugPrintf("Invalid save data format\n"); - ZeroMemory( pvSaveMem, fileSize ); - // Clear the first 8 bytes that reference the header - header.WriteHeader( pvSaveMem ); - } - else - { - unsigned char *buf = new unsigned char[decompSize]; - - if( Compression::getCompression()->Decompress(buf, &decompSize, (unsigned char *)pvSaveMem+8, fileSize-8 ) == S_OK) - { - - // 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; - - if( desiredSize > currentHeapSize ) - { - unsigned int pagesRequired = ( desiredSize + (CSF_PAGE_SIZE - 1 ) ) / CSF_PAGE_SIZE; - void *pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, COMMIT_ALLOCATION, PAGE_READWRITE); - if( pvRet == nullptr ) - { - // Out of physical memory - __debugbreak(); - } - pagesCommitted = pagesRequired; - } - - memcpy(pvSaveMem, buf, decompSize); - } - else - { - // Corrupt save, although most of the terrain should actually be ok - app.DebugPrintf("Failed to decompress save data!\n"); -#ifndef _CONTENT_PACKAGE - __debugbreak(); -#endif - ZeroMemory( pvSaveMem, fileSize ); - // Clear the first 8 bytes that reference the header - header.WriteHeader( pvSaveMem ); - } - - delete[] buf; - } - } - - header.ReadHeader( pvSaveMem, plat ); - - } - else - { - // Clear the first 8 bytes that reference the header - header.WriteHeader( pvSaveMem ); - } -} - -ConsoleSaveFileSplit::~ConsoleSaveFileSplit() -{ - VirtualFree( pvHeap, MAX_PAGE_COUNT * CSF_PAGE_SIZE, MEM_DECOMMIT ); - pagesCommitted = 0; - // Make sure we don't have any thumbnail data still waiting round - we can't need it now we've destroyed the save file anyway -#if defined _XBOX - app.GetSaveThumbnail(nullptr,nullptr); -#elif defined __PS3__ - app.GetSaveThumbnail(nullptr,nullptr, nullptr,nullptr); -#endif - - for (auto it = regionFiles.begin(); it != regionFiles.end(); it++) - { - delete it->second; - } - - StorageManager.ResetSubfiles(); - DeleteCriticalSection(&m_lock); -} - -// Add the file to our table of internal files if not already there -// Open our actual save file ready for reading/writing, and the set the file pointer to the start of this file -FileEntry *ConsoleSaveFileSplit::createFile( const ConsoleSavePath &fileName ) -{ - LockSaveAccess(); - - // Determine if the file is a region file that should be split off into its own file - unsigned int regionFileIndex; - bool isRegionFile = GetNumericIdentifierFromName(fileName.getName(), ®ionFileIndex); - if( isRegionFile ) - { - // First, for backwards compatibility, check if it is already in the main file - will just use that if so - if( !header.fileExists( fileName.getName() ) ) - { - // Find or create a new region file - FileEntry *file = GetRegionFileEntry(regionFileIndex); - ReleaseSaveAccess(); - return file; - } - } - - FileEntry *file = header.AddFile( fileName.getName() ); - ReleaseSaveAccess(); - - return file; -} - -void ConsoleSaveFileSplit::deleteFile( FileEntry *file ) -{ - if( file == nullptr ) return; - - assert( file->isRegionFile() == false ); - - LockSaveAccess(); - - DWORD numberOfBytesRead = 0; - DWORD numberOfBytesWritten = 0; - - const int bufferSize = 4096; - int amountToRead = bufferSize; - byte buffer[bufferSize]; - DWORD bufferDataSize = 0; - - - char *readStartOffset = (char *)pvSaveMem + file->data.startOffset + file->getFileSize(); - - char *writeStartOffset = (char *)pvSaveMem + file->data.startOffset; - - char *endOfDataOffset = (char *)pvSaveMem + header.GetStartOfNextData(); - - while(true) - { - // Fill buffer from file - if( readStartOffset + bufferSize > endOfDataOffset ) - { - amountToRead = (int)(endOfDataOffset - readStartOffset); - } - else - { - amountToRead = bufferSize; - } - - if( amountToRead == 0 ) - break; - - memcpy( buffer, readStartOffset, amountToRead ); - numberOfBytesRead = amountToRead; - - bufferDataSize = amountToRead; - readStartOffset += numberOfBytesRead; - - // Write buffer to file - memcpy( (void *)writeStartOffset, buffer, bufferDataSize ); - numberOfBytesWritten = bufferDataSize; - - writeStartOffset += numberOfBytesWritten; - } - - header.RemoveFile( file ); - - finalizeWrite(); - - ReleaseSaveAccess(); -} - -void ConsoleSaveFileSplit::setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod) -{ - LockSaveAccess(); - - if( file->isRegionFile() ) - { - file->currentFilePointer = lDistanceToMove; - } - else - { - file->currentFilePointer = file->data.startOffset + lDistanceToMove; - } - - if( dwMoveMethod == FILE_END) - { - file->currentFilePointer += file->getFileSize(); - } - - ReleaseSaveAccess(); -} - -// If this file needs to grow, move the data after along -void ConsoleSaveFileSplit::PrepareForWrite( FileEntry *file, DWORD nNumberOfBytesToWrite ) -{ - int bytesToGrowBy = ( (file->currentFilePointer - file->data.startOffset) + nNumberOfBytesToWrite) - file->getFileSize(); - if( bytesToGrowBy <= 0 ) - return; - - // 4J Stu - Not forcing a minimum size, it is up to the caller to write data in sensible amounts - // This lets us keep some of the smaller files small - //if( bytesToGrowBy < 1024 ) - // bytesToGrowBy = 1024; - - // Move all the data beyond us - PIXBeginNamedEvent(0,"Growing file by %d bytes", bytesToGrowBy); - MoveDataBeyond(file, bytesToGrowBy); - PIXEndNamedEvent(); - - // Update our length - if( file->data.length < 0 ) - file->data.length = 0; - file->data.length += bytesToGrowBy; - - // Write the header with the updated data - finalizeWrite(); -} - -BOOL ConsoleSaveFileSplit::writeFile(FileEntry *file,LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) -{ - assert( pvSaveMem != nullptr ); - if( pvSaveMem == nullptr ) - { - return 0; - } - - LockSaveAccess(); - - if( file->isRegionFile() ) - { - unsigned int sizeRequired = file->currentFilePointer + nNumberOfBytesToWrite; - RegionFileReference *fileRef = regionFiles[file->data.regionIndex]; - if( sizeRequired > file->getFileSize() ) - { - fileRef->data = (unsigned char *)realloc(fileRef->data, sizeRequired); - file->data.length = sizeRequired; - } - - memcpy( fileRef->data + file->currentFilePointer, lpBuffer, nNumberOfBytesToWrite ); - -// app.DebugPrintf(">>>>>>>>>>>>>> writing a region file's data 0x%.8x, 0x%x offset %d of %d bytes (writing %d bytes)\n",file->data.regionIndex,fileRef->data,file->currentFilePointer, file->getFileSize(), nNumberOfBytesToWrite); - - file->currentFilePointer += nNumberOfBytesToWrite; - file->updateLastModifiedTime(); - fileRef->dirty = true; - } - else - { - PrepareForWrite( file, nNumberOfBytesToWrite ); - - char *writeStartOffset = (char *)pvSaveMem + file->currentFilePointer; - //printf("Write: pvSaveMem = %0xd, currentFilePointer = %d, writeStartOffset = %0xd\n", pvSaveMem, file->currentFilePointer, writeStartOffset); - - memcpy( (void *)writeStartOffset, lpBuffer, nNumberOfBytesToWrite ); - *lpNumberOfBytesWritten = nNumberOfBytesToWrite; - - if(file->data.length < 0) - file->data.length = 0; - - file->currentFilePointer += *lpNumberOfBytesWritten; - - //wprintf(L"Wrote %d bytes to %s, new file pointer is %I64d\n", *lpNumberOfBytesWritten, file->data.filename, file->currentFilePointer); - - file->updateLastModifiedTime(); - } - - ReleaseSaveAccess(); - - return 1; -} - -BOOL ConsoleSaveFileSplit::zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten) -{ - assert( pvSaveMem != nullptr ); - if( pvSaveMem == nullptr ) - { - return 0; - } - - LockSaveAccess(); - - if( file->isRegionFile() ) - { - unsigned int sizeRequired = file->currentFilePointer + nNumberOfBytesToWrite; - RegionFileReference *fileRef = regionFiles[file->data.regionIndex]; - if( sizeRequired > file->getFileSize() ) - { - fileRef->data = (unsigned char *)realloc(fileRef->data, sizeRequired); - file->data.length = sizeRequired; - } - - memset( fileRef->data + file->currentFilePointer, 0, nNumberOfBytesToWrite ); - -// app.DebugPrintf(">>>>>>>>>>>>>> writing a region file's data 0x%.8x, 0x%x offset %d of %d bytes (writing %d bytes)\n",file->data.regionIndex,fileRef->data,file->currentFilePointer, file->getFileSize(), nNumberOfBytesToWrite); - - file->currentFilePointer += nNumberOfBytesToWrite; - file->updateLastModifiedTime(); - fileRef->dirty = true; - } - else - { - PrepareForWrite( file, nNumberOfBytesToWrite ); - - char *writeStartOffset = (char *)pvSaveMem + file->currentFilePointer; - //printf("Write: pvSaveMem = %0xd, currentFilePointer = %d, writeStartOffset = %0xd\n", pvSaveMem, file->currentFilePointer, writeStartOffset); - - memset( (void *)writeStartOffset, 0, nNumberOfBytesToWrite ); - *lpNumberOfBytesWritten = nNumberOfBytesToWrite; - - if(file->data.length < 0) - file->data.length = 0; - - file->currentFilePointer += *lpNumberOfBytesWritten; - - //wprintf(L"Wrote %d bytes to %s, new file pointer is %I64d\n", *lpNumberOfBytesWritten, file->data.filename, file->currentFilePointer); - - file->updateLastModifiedTime(); - } - - ReleaseSaveAccess(); - - return 1; -} - -BOOL ConsoleSaveFileSplit::readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead) -{ - DWORD actualBytesToRead; - assert( pvSaveMem != nullptr ); - if( pvSaveMem == nullptr ) - { - return 0; - } - - LockSaveAccess(); - - if( file->isRegionFile() ) - { - actualBytesToRead = nNumberOfBytesToRead; - if( file->currentFilePointer + nNumberOfBytesToRead > file->data.length ) - { - actualBytesToRead = file->data.length - file->currentFilePointer; - } - RegionFileReference *fileRef = regionFiles[file->data.regionIndex]; - memcpy( lpBuffer, fileRef->data + file->currentFilePointer, actualBytesToRead ); - *lpNumberOfBytesRead = actualBytesToRead; - - file->currentFilePointer += actualBytesToRead; - } - else - { - char *readStartOffset = (char *)pvSaveMem + file->currentFilePointer; - //printf("Read: pvSaveMem = %0xd, currentFilePointer = %d, readStartOffset = %0xd\n", pvSaveMem, file->currentFilePointer, readStartOffset); - - assert( nNumberOfBytesToRead <= file->getFileSize() ); - - actualBytesToRead = nNumberOfBytesToRead; - if( file->currentFilePointer + nNumberOfBytesToRead > file->data.startOffset + file->data.length ) - { - actualBytesToRead = (file->data.startOffset + file->data.length) - file->currentFilePointer; - } - - memcpy( lpBuffer, readStartOffset, actualBytesToRead ); - *lpNumberOfBytesRead = actualBytesToRead; - - file->currentFilePointer += *lpNumberOfBytesRead; - - //wprintf(L"Read %d bytes from %s, new file pointer is %I64d\n", *lpNumberOfBytesRead, file->data.filename, file->currentFilePointer); - } - - - - ReleaseSaveAccess(); - - return 1; -} - -BOOL ConsoleSaveFileSplit::closeHandle( FileEntry *file ) -{ - LockSaveAccess(); - finalizeWrite(); - ReleaseSaveAccess(); - - return TRUE; -} - -// In this method, attempt to write any dirty region files, subject to maintaining a maximum write output rate. Writing is prioritised by time since the region was last written. -void ConsoleSaveFileSplit::tick() -{ - int64_t currentTime = System::currentTimeMillis(); - - // Don't do anything if the save system is up to something... - if( StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle ) - { - return; - } - - // ...or we shouldn't be saving... - if( StorageManager.GetSaveDisabled() ) - { - return; - } - - // ... or we haven't passed the required time since last assessing what to do - if( ( currentTime - m_lastTickTime ) < WRITE_TICK_RATE_MS ) - { - return; - } - - LockSaveAccess(); - - m_lastTickTime = currentTime; - - // Get total amount of data written over the time period we are interested in averaging over. Remove any older data. - unsigned int bytesWritten = 0; - for (auto it = writeHistory.begin(); it != writeHistory.end(); ) - { - if ((currentTime - it->writeTime) > (WRITE_BANDWIDTH_MEASUREMENT_PERIOD_SECONDS * 1000)) - { - it = writeHistory.erase(it); - } - else - { - bytesWritten += it->writeSize; - it++; - } - } - - // Compile a vector of dirty regions. - vector dirtyRegions; - for (auto it = regionFiles.begin(); it != regionFiles.end(); it++) - { - DirtyRegionFile dirtyRegion; - - if (it->second->dirty) - { - dirtyRegion.fileRef = it->second->fileEntry->getRegionFileIndex(); - dirtyRegion.lastWritten = it->second->lastWritten; - dirtyRegions.push_back(dirtyRegion); - } - } - - // Sort into ascending order, by lastWritten time. First elements will therefore be the ones least recently saved - std::sort( dirtyRegions.begin(), dirtyRegions.end() ); - - bool writeRequired = false; - unsigned int bytesInTimePeriod = bytesWritten; - unsigned int bytesAddedThisTick = 0; - for( int i = 0; i < dirtyRegions.size(); i++ ) - { - RegionFileReference *regionRef = regionFiles[dirtyRegions[i].fileRef]; - unsigned int compressedSize = regionRef->GetCompressedSize(); - bytesInTimePeriod += compressedSize; - bytesAddedThisTick += compressedSize; - - // Always consider at least one item for writing, even if it breaks the rule on the maximum number of bytes we would like to send per tick - if( ( i > 0 ) && ( bytesAddedThisTick > WRITE_MAX_WRITE_PER_TICK ) ) - { - break; - } - - // Could we add this without breaking our bytes per second cap? - if ( ( bytesInTimePeriod / WRITE_BANDWIDTH_MEASUREMENT_PERIOD_SECONDS ) > WRITE_BANDWIDTH_BYTESPERSECOND ) - { - break; - } - - // Can add for writing - WriteHistory writeEvent; - writeEvent.writeSize = compressedSize; - writeEvent.writeTime = System::currentTimeMillis(); - writeHistory.push_back(writeEvent); - - regionRef->Compress(); -// app.DebugPrintf("Tick: Writing region 0x%.8x, compressed as %d bytes\n",regionRef->fileEntry->getRegionFileIndex(), regionRef->dataCompressedSize); - StorageManager.UpdateSubfile(regionRef->index, regionRef->dataCompressed, regionRef->dataCompressedSize); - regionRef->dirty = false; - regionRef->lastWritten = System::currentTimeMillis(); - - writeRequired = true; - } -#ifndef _CONTENT_PACKAGE - { - unsigned int totalDirty = 0; - unsigned int totalDirtyBytes = 0; - __int64 oldestDirty = currentTime; - for (auto it = regionFiles.begin(); it != regionFiles.end(); it++) - { - if (it->second->dirty) - { - if (it->second->lastWritten < oldestDirty) - { - oldestDirty = it->second->lastWritten; - } - totalDirty++; - totalDirtyBytes += it->second->fileEntry->getFileSize(); - } - } -#ifdef _DURANGO - PIXReportCounter(L"Dirty regions", (float)totalDirty); - PIXReportCounter(L"Dirty MB", (float)totalDirtyBytes / ( 1024 * 1024) ); - PIXReportCounter(L"Dirty oldest age", ((float) currentTime - oldestDirty ) ); - PIXReportCounter(L"Region writing bandwidth",((float)bytesInTimePeriod/ WRITE_BANDWIDTH_MEASUREMENT_PERIOD_SECONDS) / ( 1024 * 1024)); -#endif - } -#endif - - if( writeRequired ) - { - StorageManager.SaveSubfiles(SaveRegionFilesCallback, this); - } - - ReleaseSaveAccess(); -} - -void ConsoleSaveFileSplit::finalizeWrite() -{ - LockSaveAccess(); - header.WriteHeader( pvSaveMem ); - ReleaseSaveAccess(); -} - -void ConsoleSaveFileSplit::MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesToWrite) -{ - DWORD numberOfBytesRead = 0; - DWORD numberOfBytesWritten = 0; - - const DWORD bufferSize = 4096; - DWORD amountToRead = bufferSize; - //assert( nNumberOfBytesToWrite <= 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 - DWORD currentHeapSize = pagesCommitted * CSF_PAGE_SIZE; - - DWORD desiredSize = header.GetFileSize() + nNumberOfBytesToWrite; - - if( desiredSize > currentHeapSize ) - { - unsigned int pagesRequired = ( desiredSize + (CSF_PAGE_SIZE - 1 ) ) / CSF_PAGE_SIZE; - void *pvRet = VirtualAlloc(pvHeap, pagesRequired * CSF_PAGE_SIZE, COMMIT_ALLOCATION, PAGE_READWRITE); - if( pvRet == nullptr ) - { - // Out of physical memory - __debugbreak(); - } - pagesCommitted = pagesRequired; - } - - // This is the start of where we want the space to be, and the start of the data that we need to move - char *spaceStartOffset = (char *)pvSaveMem + file->data.startOffset + file->getFileSize(); - - // This is the end of where we want the space to be - char *spaceEndOffset = spaceStartOffset + nNumberOfBytesToWrite; - - // This is the current end of the data that we want to move - char *beginEndOfDataOffset = (char *)pvSaveMem + header.GetStartOfNextData(); - - // This is where the end of the data is going to be - char *finishEndOfDataOffset = beginEndOfDataOffset + nNumberOfBytesToWrite; - - // This is where we are going to read from (with the amount we want to read subtracted before we read) - char *readStartOffset = beginEndOfDataOffset; - - // This is where we can safely write to (with the amount we want write subtracted before we write) - char *writeStartOffset = finishEndOfDataOffset; - - //printf("\n******* MOVEDATABEYOND *******\n"); - //printf("Space start: %d, space end: %d\n", spaceStartOffset - (char *)pvSaveMem, spaceEndOffset - (char *)pvSaveMem); - //printf("Current end of data: %d, new end of data: %d\n", beginEndOfDataOffset - (char *)pvSaveMem, finishEndOfDataOffset - (char *)pvSaveMem); - - // Optimisation for things that are being moved in whole region file sector (4K chunks). We could generalise this a bit more but seems safest at the moment to identify this particular type - // of move and code explicitly for this situation - if( ( nNumberOfBytesToWrite & 4095 ) == 0 ) - { - if( nNumberOfBytesToWrite > 0 ) - { - // Get addresses for start & end of the region we are copying from as uintptr_t, for easier maths - 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 - uintptr_t uiFromStartChunk = uiFromStart & ~((uintptr_t)4095); - uintptr_t uiFromEndChunk = (uiFromEnd - 1 ) & ~((uintptr_t)4095); - - // Loop through all the affected source 4096 chunks, going backwards so we don't overwrite anything we'll need in the future - for( uintptr_t uiCurrentChunk = uiFromEndChunk; uiCurrentChunk >= uiFromStartChunk; uiCurrentChunk -= 4096 ) - { - // Establish chunk we'll need to copy - uintptr_t uiCopyStart = uiCurrentChunk; - uintptr_t uiCopyEnd = uiCurrentChunk + 4096; - // Clamp chunk to the bounds of the full region we are trying to copy - if( uiCopyStart < uiFromStart ) - { - // Needs to be clampged against the start of our region - uiCopyStart = uiFromStart; - } - if ( uiCopyEnd > uiFromEnd ) - { - // Needs to be clamped to the end of our region - uiCopyEnd = uiFromEnd; - } - XMemCpy( (void *)(uiCopyStart + nNumberOfBytesToWrite), ( void *)uiCopyStart, uiCopyEnd - uiCopyStart ); - } - } - } - else - { - while(true) - { - // Copy buffer 1 to buffer 2 - memcpy( buffer2, buffer1, buffer1Size); - buffer2Size = buffer1Size; - - // Fill buffer 1 from file - if( (readStartOffset - bufferSize) < spaceStartOffset ) - { - amountToRead = (DWORD)(readStartOffset - spaceStartOffset); - } - else - { - amountToRead = bufferSize; - } - - // Push the read point back by the amount of bytes that we are going to read - readStartOffset -= amountToRead; - - //printf("About to read %u from %d\n", amountToRead, readStartOffset - (char *)pvSaveMem ); - - memcpy( buffer1, readStartOffset, amountToRead ); - numberOfBytesRead = amountToRead; - - buffer1Size = amountToRead; - - // Move back the write pointer by the amount of bytes we are going to write - writeStartOffset -= buffer2Size; - - // Write buffer 2 to file - if( (writeStartOffset + buffer2Size) <= finishEndOfDataOffset) - { - //printf("About to write %u to %d\n", buffer2Size, writeStartOffset - (char *)pvSaveMem ); - memcpy( (void *)writeStartOffset, buffer2, buffer2Size ); - numberOfBytesWritten = buffer2Size; - } - else - { - assert((writeStartOffset + buffer2Size) <= finishEndOfDataOffset); - numberOfBytesWritten = 0; - } - - if( numberOfBytesRead == 0 ) - { - //printf("\n************** MOVE COMPLETED *************** \n\n"); - assert( writeStartOffset == spaceEndOffset ); - break; - } - } - } - - header.AdjustStartOffsets( file, nNumberOfBytesToWrite ); -} - -// Attempt to convert a filename into a numeric identifier, which we use for region files. File names supported are of the form: -// -// Filename Encoded as -// -// r.x.z.mcr 00 00 xx zz -// DIM-1r.x.z.mcr 00 01 xx zz -// DIM1/r.x.z.mcr 00 02 xx zz - -bool ConsoleSaveFileSplit::GetNumericIdentifierFromName(const wstring &fileName, unsigned int *idOut) -{ - // Determine whether it is one of our region file names if the file extension is ".mbr" - if( fileName.length() < 4 ) return false; - wstring extension = fileName.substr(fileName.length()-4,4); - if( extension != wstring(L".mcr") ) return false; - - unsigned int id = 0; - int x, z; - - const wchar_t *cstr = fileName.c_str(); - const wchar_t *body = cstr + 2; - - // If this filename starts with a "r" then assume it is of the format "r.x.z.mcr" - don't do anything as default value we've set are correct - if( cstr[0] != L'r' ) - { - // Must be prefixed by "DIM-1r." or "DIM1/r." - body = cstr + 7; - // Differentiate between these 2 options - if( cstr[3] == L'-' ) - { - // "DIM-1r." - id = 0x00010000; - } - else - { - // "DIM/1r." - id = 0x00020000; - } - } - // Get x/z coords - swscanf_s(body, L"%d.%d.mcr", &x, &z ); - - // Pack full id - id |= ( ( x << 8 ) & 0x0000ff00 ); - id |= ( z & 0x000000ff ); - - *idOut = id; - - return true; -} - -// Convert a numeric file identifier (for region files) back into a normal filename. See comment above. - -wstring ConsoleSaveFileSplit::GetNameFromNumericIdentifier(unsigned int idIn) -{ - wstring prefix; - - switch(idIn & 0x00ff0000 ) - { - case 0: - prefix = L""; - break; - case 1: - prefix = L"DIM-1"; - break; - case 2: - prefix = L"DIM1/"; - break; - } - signed char regionX = ( idIn >> 8 ) & 255; - signed char regionZ = idIn & 255; - wstring region = ( prefix + wstring(L"r.") + _toString(regionX) + L"." + _toString(regionZ) + L".mcr" ); - - return region; -} - -// Compress any dirty region files, and tell the storage manager about them so that it will process them when we ask it to save sub files -void ConsoleSaveFileSplit::processSubfilesForWrite() -{ -#if 0 - // 4J Stu - There are debug reasons where we want to force a save of all regions - StorageManager.ResetSubfiles(); - for (auto it = regionFiles.begin(); it != regionFiles.end(); it++) - { - RegionFileReference* region = it->second; - int index = StorageManager.AddSubfile(region->fileEntry->data.regionIndex); - // if (region->dirty) - { - region->Compress(); - StorageManager.UpdateSubfile(index, region->dataCompressed, region->dataCompressedSize); - region->dirty = false; - region->lastWritten = System::currentTimeMillis(); - } - } -#else - for (auto it = regionFiles.begin(); it != regionFiles.end(); it++) - { - RegionFileReference* region = it->second; - if (region->dirty) - { - region->Compress(); - StorageManager.UpdateSubfile(region->index, region->dataCompressed, region->dataCompressedSize); - region->dirty = false; - region->lastWritten = System::currentTimeMillis(); - } - } -#endif -} - -// Clean up any memory allocated for compressed data when we have finished writing -void ConsoleSaveFileSplit::processSubfilesAfterWrite() -{ - // This is called from the StorageManager.Tick() which should always be on the main thread - for (auto it = regionFiles.begin(); it != regionFiles.end(); it++) - { - RegionFileReference* region = it->second; - region->ReleaseCompressed(); - } -} - -bool ConsoleSaveFileSplit::doesFileExist(ConsoleSavePath file) -{ - LockSaveAccess(); - bool exists = header.fileExists( file.getName() ); - ReleaseSaveAccess(); - - return exists; -} - -void ConsoleSaveFileSplit::Flush(bool autosave, bool updateThumbnail) -{ - LockSaveAccess(); - -#ifdef _XBOX_ONE - MinecraftServer *server = MinecraftServer::getInstance(); -#endif - - // The storage manage might potentially be busy doing a sub-file write initiated from the tick. Wait until this is totally processed. - while( StorageManager.GetSaveState() != C4JStorage::ESaveGame_Idle ) - { -#ifdef _XBOX_ONE - if (server && server->IsSuspending()) - { - // If the server is mid-suspend we need to tick the storage manager ourselves - StorageManager.Tick(); - } -#endif - - app.DebugPrintf("Flush wait\n"); - Sleep(10); - } - - finalizeWrite(); - - m_autosave = autosave; - if(!m_autosave) processSubfilesForWrite(); - - // Get the frequency of the timer - LARGE_INTEGER qwTicksPerSec, qwTime, qwNewTime, qwDeltaTime; - float fElapsedTime = 0.0f; - QueryPerformanceFrequency( &qwTicksPerSec ); - float fSecsPerTick = 1.0f / (float)qwTicksPerSec.QuadPart; - - unsigned int fileSize = header.GetFileSize(); - - // Assume that the compression will make it smaller so initially attempt to allocate the current file size - // We add 4 bytes to the start so that we can signal compressed data - // And another 4 bytes to store the decompressed data size - unsigned int compLength = fileSize+8; - - // 4J Stu - Added TU-1 interim - - // Attempt to allocate the required memory - // We do not own this, it belongs to the StorageManager - byte *compData = (byte *)StorageManager.AllocateSaveData( compLength ); - - // If we failed to allocate then compData will be nullptr - // Pre-calculate the compressed data size so that we can attempt to allocate a smaller buffer - if(compData == nullptr) - { - // Length should be 0 here so that the compression call knows that we want to know the length back - compLength = 0; - - // Pre-calculate the buffer size required for the compressed data - PIXBeginNamedEvent(0,"Pre-calc save compression"); - // Save the start time - QueryPerformanceCounter( &qwTime ); - Compression::getCompression()->Compress(nullptr,&compLength,pvSaveMem,fileSize); - QueryPerformanceCounter( &qwNewTime ); - - qwDeltaTime.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart; - fElapsedTime = fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); - - app.DebugPrintf("Check buffer size: Elapsed time %f\n", fElapsedTime); - PIXEndNamedEvent(); - - // We add 4 bytes to the start so that we can signal compressed data - // And another 4 bytes to store the decompressed data size - compLength = compLength+8; - - // Attempt to allocate the required memory - compData = (byte *)StorageManager.AllocateSaveData( compLength ); - } - - if(compData != nullptr) - { - // Re-compress all save data before we save it to disk - PIXBeginNamedEvent(0,"Actual save compression"); - // Save the start time - QueryPerformanceCounter( &qwTime ); - Compression::getCompression()->Compress(compData+8,&compLength,pvSaveMem,fileSize); - QueryPerformanceCounter( &qwNewTime ); - - qwDeltaTime.QuadPart = qwNewTime.QuadPart - qwTime.QuadPart; - fElapsedTime = fSecsPerTick * ((FLOAT)(qwDeltaTime.QuadPart)); - - app.DebugPrintf("Compress: Elapsed time %f\n", fElapsedTime); - PIXEndNamedEvent(); - - ZeroMemory(compData,8); - int saveVer = 0; - memcpy( compData, &saveVer, sizeof(int) ); - memcpy( compData+4, &fileSize, sizeof(int) ); - - app.DebugPrintf("Save data compressed from %d to %d\n", fileSize, compLength); - - if(updateThumbnail) - { - PBYTE pbThumbnailData=nullptr; - DWORD dwThumbnailDataSize=0; - - PBYTE pbDataSaveImage=nullptr; - DWORD dwDataSizeSaveImage=0; - -#if ( defined _XBOX || defined _DURANGO ) - app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize); -#elif ( defined __PS3__ || defined __ORBIS__ ) - app.GetSaveThumbnail(&pbThumbnailData,&dwThumbnailDataSize,&pbDataSaveImage,&dwDataSizeSaveImage); -#endif - - BYTE bTextMetadata[88]; - ZeroMemory(bTextMetadata,88); - - __int64 seed = 0; - bool hasSeed = false; - if(MinecraftServer::getInstance()!= nullptr && MinecraftServer::getInstance()->levels[0]!=nullptr) - { - seed = MinecraftServer::getInstance()->levels[0]->getLevelData()->getSeed(); - hasSeed = true; - } - - int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, seed, hasSeed, app.GetGameHostOption(eGameHostOption_All), Minecraft::GetInstance()->getCurrentTexturePackId()); - - // set the icon and save image - StorageManager.SetSaveImages(pbThumbnailData,dwThumbnailDataSize,pbDataSaveImage,dwDataSizeSaveImage,bTextMetadata,iTextMetadataBytes); - app.DebugPrintf("Save thumbnail size %d\n",dwThumbnailDataSize); - - } - - INT saveOrCheckpointId = 0; - bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - TelemetryManager->RecordLevelSaveOrCheckpoint(ProfileManager.GetPrimaryPad(), saveOrCheckpointId, compLength+8); - - // save the data - StorageManager.SaveSaveData( &ConsoleSaveFileSplit::SaveSaveDataCallback, this ); -#ifndef _CONTENT_PACKAGE - if( app.DebugSettingsOn()) - { - if(app.GetWriteSavesToFolderEnabled() ) - { - DebugFlushToFile(compData, compLength+8); - } - } -#endif - ReleaseSaveAccess(); - } -} - -int ConsoleSaveFileSplit::SaveSaveDataCallback(LPVOID lpParam,bool bRes) -{ - ConsoleSaveFileSplit *pClass=(ConsoleSaveFileSplit *)lpParam; - - // Don't save sub files on autosave (their always being saved anyway) - if (!pClass->m_autosave) - { - // This is called from the StorageManager.Tick() which should always be on the main thread - StorageManager.SaveSubfiles(SaveRegionFilesCallback, pClass); - } - return 0; -} - -int ConsoleSaveFileSplit::SaveRegionFilesCallback(LPVOID lpParam,bool bRes) -{ - ConsoleSaveFileSplit *pClass=(ConsoleSaveFileSplit *)lpParam; - - // This is called from the StorageManager.Tick() which should always be on the main thread - pClass->processSubfilesAfterWrite(); - - return 0; -} - -#ifndef _CONTENT_PACKAGE -void ConsoleSaveFileSplit::DebugFlushToFile(void *compressedData /*= nullptr*/, unsigned int compressedDataSize /*= 0*/) -{ - LockSaveAccess(); - - finalizeWrite(); - - unsigned int fileSize = header.GetFileSize(); - - DWORD numberOfBytesWritten = 0; - - File targetFileDir(L"Saves"); - - if(!targetFileDir.exists()) - targetFileDir.mkdir(); - - wchar_t *fileName = new wchar_t[XCONTENT_MAX_FILENAME_LENGTH+1]; - - SYSTEMTIME t; - GetSystemTime( &t ); - - //14 chars for the digits - //11 chars for the separators + suffix - //25 chars total - wstring cutFileName = m_fileName; - if(m_fileName.length() > XCONTENT_MAX_FILENAME_LENGTH - 25) - { - cutFileName = m_fileName.substr(0, XCONTENT_MAX_FILENAME_LENGTH - 25); - } - swprintf(fileName, XCONTENT_MAX_FILENAME_LENGTH+1, L"\\v%04d-%ls%02d.%02d.%02d.%02d.%02d.mcs",VER_PRODUCTBUILD,cutFileName.c_str(), t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond); - -#ifdef _UNICODE - wstring wtemp = targetFileDir.getPath() + wstring(fileName); - LPCWSTR lpFileName = wtemp.c_str(); -#else - LPCSTR lpFileName = wstringtofilename( targetFileDir.getPath() + wstring(fileName) ); -#endif - - HANDLE hSaveFile = CreateFile( lpFileName, GENERIC_WRITE, 0, nullptr, OPEN_ALWAYS, FILE_FLAG_RANDOM_ACCESS, nullptr); - - if(compressedData != nullptr && compressedDataSize > 0) - { - WriteFile(hSaveFile,compressedData,compressedDataSize,&numberOfBytesWritten,nullptr); - assert(numberOfBytesWritten == compressedDataSize); - } - else - { - WriteFile(hSaveFile,pvSaveMem,fileSize,&numberOfBytesWritten,nullptr); - assert(numberOfBytesWritten == fileSize); - } - CloseHandle( hSaveFile ); - - delete[] fileName; - - ReleaseSaveAccess(); -} -#endif - -unsigned int ConsoleSaveFileSplit::getSizeOnDisk() -{ - return header.GetFileSize(); -} - -wstring ConsoleSaveFileSplit::getFilename() -{ - return m_fileName; -} - -vector *ConsoleSaveFileSplit::getFilesWithPrefix(const wstring &prefix) -{ - return header.getFilesWithPrefix( prefix ); -} - -vector *ConsoleSaveFileSplit::getRegionFilesByDimension(unsigned int dimensionIndex) -{ - vector *files = nullptr; - - for (auto it = regionFiles.begin(); it != regionFiles.end(); ++it) - { - unsigned int entryDimension = ((it->first) >> 16) & 0xFF; - - if (entryDimension == dimensionIndex) - { - if (files == nullptr) - { - files = new vector(); - } - - files->push_back(it->second->fileEntry); - } - } - - return files; -} - -#if defined(__PS3__) || defined(__ORBIS__) -wstring ConsoleSaveFileSplit::getPlayerDataFilenameForLoad(const PlayerUID& pUID) -{ - return header.getPlayerDataFilenameForLoad( pUID ); -} -wstring ConsoleSaveFileSplit::getPlayerDataFilenameForSave(const PlayerUID& pUID) -{ - return header.getPlayerDataFilenameForSave( pUID ); -} -vector *ConsoleSaveFileSplit::getValidPlayerDatFiles() -{ - return header.getValidPlayerDatFiles(); -} -#endif - -int ConsoleSaveFileSplit::getSaveVersion() -{ - return header.getSaveVersion(); -} - -int ConsoleSaveFileSplit::getOriginalSaveVersion() -{ - return header.getOriginalSaveVersion(); -} - -void ConsoleSaveFileSplit::LockSaveAccess() -{ - EnterCriticalSection(&m_lock); -} - -void ConsoleSaveFileSplit::ReleaseSaveAccess() -{ - LeaveCriticalSection(&m_lock); -} - -ESavePlatform ConsoleSaveFileSplit::getSavePlatform() -{ - return header.getSavePlatform(); -} - -bool ConsoleSaveFileSplit::isSaveEndianDifferent() -{ - return header.isSaveEndianDifferent(); -} - -void ConsoleSaveFileSplit::setLocalPlatform() -{ - header.setLocalPlatform(); -} - -void ConsoleSaveFileSplit::setPlatform(ESavePlatform plat) -{ - header.setPlatform(plat); -} - -ByteOrder ConsoleSaveFileSplit::getSaveEndian() -{ - return header.getSaveEndian(); -} - -ByteOrder ConsoleSaveFileSplit::getLocalEndian() -{ - return header.getLocalEndian(); -} - -void ConsoleSaveFileSplit::setEndian(ByteOrder endian) -{ - header.setEndian(endian); -} - -void ConsoleSaveFileSplit::ConvertRegionFile(File sourceFile) -{ - DWORD numberOfBytesWritten = 0; - DWORD numberOfBytesRead = 0; - - RegionFile sourceRegionFile(this, &sourceFile); - - for(unsigned int x = 0; x < 32; ++x) - { - for(unsigned int z = 0; z < 32; ++z) - { - DataInputStream *dis = sourceRegionFile.getChunkDataInputStream(x,z); - - if(dis) - { - byteArray inData(1024*1024); - int read = dis->read(inData); - dis->close(); - dis->deleteChildStream(); - delete dis; - - DataOutputStream *dos = sourceRegionFile.getChunkDataOutputStream(x,z); - dos->write(inData, 0, read); - - - dos->close(); - dos->deleteChildStream(); - delete dos; - delete inData.data; - - } - - } - } - sourceRegionFile.writeAllOffsets(); // saves all the endian swapped offsets back out to the file (not all of these are written in the above processing). - -} - -void ConsoleSaveFileSplit::ConvertToLocalPlatform() -{ - if(getSavePlatform() == SAVE_FILE_PLATFORM_LOCAL) - { - // already in the correct format - return; - } - // convert each of the region files to the local platform - vector *allFilesInSave = getFilesWithPrefix(wstring(L"")); - for (auto it = allFilesInSave->begin(); it < allFilesInSave->end(); ++it) - { - FileEntry *fe = *it; - wstring fName(fe->data.filename); - wstring suffix(L".mcr"); - - if (fName.compare(fName.length() - suffix.length(), suffix.length(), suffix) == 0) - { - app.DebugPrintf("Processing a region file: %ls\n", fName.c_str()); - ConvertRegionFile(File(fe->data.filename)); - } - else - { - app.DebugPrintf("%ls is not a region file, ignoring\n", fName.c_str()); - } - } - - setLocalPlatform(); // set the platform of this save to the local platform, now that it's been coverted -} -#endif \ No newline at end of file diff --git a/Minecraft.World/ConsoleSaveFileSplit.h b/Minecraft.World/ConsoleSaveFileSplit.h deleted file mode 100644 index 976359e9..00000000 --- a/Minecraft.World/ConsoleSaveFileSplit.h +++ /dev/null @@ -1,145 +0,0 @@ -#ifdef SPLIT_SAVES -#pragma once - -#include "FileHeader.h" -#include "ConsoleSavePath.h" -#include "ConsoleSaveFile.h" - -class ProgressRenderer; - -class ConsoleSaveFileSplit : public ConsoleSaveFile -{ -private: - FileHeader header; - - static const int WRITE_BANDWIDTH_BYTESPERSECOND = 1048576; // Average bytes per second we will cap to when writing region files during the tick() method - static const int WRITE_BANDWIDTH_MEASUREMENT_PERIOD_SECONDS = 10; // Time period over which the bytes per second average is calculated - static const int WRITE_TICK_RATE_MS = 500; // Time between attempts to work out which regions we should write during the tick - static const int WRITE_MAX_WRITE_PER_TICK = WRITE_BANDWIDTH_BYTESPERSECOND; // Maximum number of bytes we can add in a single tick - - class WriteHistory - { - public: - int64_t writeTime; - unsigned int writeSize; - } ; - - class DirtyRegionFile - { - public: - int64_t lastWritten; - unsigned int fileRef; - bool operator<(const DirtyRegionFile& rhs) { return lastWritten < rhs.lastWritten; } - }; - - class RegionFileReference - { - public: - RegionFileReference(int index, unsigned int regionIndex, unsigned int length = 0, unsigned char *data = NULL); - ~RegionFileReference(); - void Compress(); // Compress from data to dataCompressed - void Decompress(); // Decompress from dataCompressed -> data - unsigned int GetCompressedSize(); // Gets byte size for what this region will compress to - void ReleaseCompressed(); // Release dataCompressed - FileEntry *fileEntry; - unsigned char *data; - unsigned char *dataCompressed; - unsigned int dataCompressedSize; - int index; - bool dirty; - int64_t lastWritten; - }; - unordered_map regionFiles; - vector writeHistory; - int64_t m_lastTickTime; - - FileEntry *GetRegionFileEntry(unsigned int regionIndex); - - wstring m_fileName; - bool m_autosave; - -// HANDLE hHeap; - static void *pvHeap; - static unsigned int pagesCommitted; -#ifdef _LARGE_WORLDS - static const unsigned int CSF_PAGE_SIZE = 64 * 1024; - static const unsigned int MAX_PAGE_COUNT = 32 * 1024; // 2GB virtual allocation -#else - static const unsigned int CSF_PAGE_SIZE = 64 * 1024; - static const unsigned int MAX_PAGE_COUNT = 1024; -#endif - LPVOID pvSaveMem; - - CRITICAL_SECTION m_lock; - - void PrepareForWrite( FileEntry *file, DWORD nNumberOfBytesToWrite ); - void MoveDataBeyond(FileEntry *file, DWORD nNumberOfBytesToWrite); - - bool GetNumericIdentifierFromName(const wstring &fileName, unsigned int *idOut); - wstring GetNameFromNumericIdentifier(unsigned int idIn); - void processSubfilesForWrite(); - void processSubfilesAfterWrite(); -public: - static int SaveSaveDataCallback(LPVOID lpParam,bool bRes); - static int SaveRegionFilesCallback(LPVOID lpParam,bool bRes); - -private: - void _init(const wstring &fileName, LPVOID pvSaveData, DWORD fileSize, ESavePlatform plat); - -public: - ConsoleSaveFileSplit(const wstring &fileName, LPVOID pvSaveData = NULL, DWORD fileSize = 0, bool forceCleanSave = false, ESavePlatform plat = SAVE_FILE_PLATFORM_LOCAL); - ConsoleSaveFileSplit(ConsoleSaveFile *sourceSave, bool alreadySmallRegions = true, ProgressListener *progress = NULL); - virtual ~ConsoleSaveFileSplit(); - - // 4J Stu - Initial implementation is intended to have a similar interface to the standard Xbox file access functions - - virtual FileEntry *createFile( const ConsoleSavePath &fileName ); - virtual void deleteFile( FileEntry *file ); - - virtual void setFilePointer(FileEntry *file,LONG lDistanceToMove,PLONG lpDistanceToMoveHigh,DWORD dwMoveMethod); - virtual BOOL writeFile( FileEntry *file, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten ); - virtual BOOL zeroFile(FileEntry *file, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten); - virtual BOOL readFile( FileEntry *file, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead ); - virtual BOOL closeHandle( FileEntry *file ); - - virtual void finalizeWrite(); - virtual void tick(); - - virtual bool doesFileExist(ConsoleSavePath file); - - virtual void Flush(bool autosave, bool updateThumbnail = true); - -#ifndef _CONTENT_PACKAGE - virtual void DebugFlushToFile(void *compressedData = NULL, unsigned int compressedDataSize = 0); -#endif - virtual unsigned int getSizeOnDisk(); - - virtual wstring getFilename(); - - virtual vector *getFilesWithPrefix(const wstring &prefix); - virtual vector *getRegionFilesByDimension(unsigned int dimensionIndex); - -#if defined(__PS3__) || defined(__ORBIS__) - virtual wstring getPlayerDataFilenameForLoad(const PlayerUID& pUID); - virtual wstring getPlayerDataFilenameForSave(const PlayerUID& pUID); - virtual vector *getValidPlayerDatFiles(); -#endif //__PS3__ - - virtual int getSaveVersion(); - virtual int getOriginalSaveVersion(); - - virtual void LockSaveAccess(); - virtual void ReleaseSaveAccess(); - - virtual ESavePlatform getSavePlatform(); - virtual bool isSaveEndianDifferent(); - virtual void setLocalPlatform(); - virtual void setPlatform(ESavePlatform plat); - virtual ByteOrder getSaveEndian(); - virtual ByteOrder getLocalEndian(); - virtual void setEndian(ByteOrder endian); - - virtual void ConvertRegionFile(File sourceFile); - virtual void ConvertToLocalPlatform(); -}; -#endif \ No newline at end of file diff --git a/Minecraft.World/Cow.cpp b/Minecraft.World/Cow.cpp index f45b3c17..69628d64 100644 --- a/Minecraft.World/Cow.cpp +++ b/Minecraft.World/Cow.cpp @@ -136,9 +136,3 @@ shared_ptr Cow::getBreedOffspring(shared_ptr target) return nullptr; } } - -// TU25 Addition -float Cow::getEyeHeight() -{ - return bbHeight; -} diff --git a/Minecraft.World/Cow.h b/Minecraft.World/Cow.h index 8d50b17d..24210631 100644 --- a/Minecraft.World/Cow.h +++ b/Minecraft.World/Cow.h @@ -30,6 +30,4 @@ protected: public: virtual bool mobInteract(shared_ptr player); virtual shared_ptr getBreedOffspring(shared_ptr target); - // TU25 Addition - virtual float getEyeHeight(); }; diff --git a/Minecraft.World/CraftingMenu.h b/Minecraft.World/CraftingMenu.h index 8cfbccaa..b26cd304 100644 --- a/Minecraft.World/CraftingMenu.h +++ b/Minecraft.World/CraftingMenu.h @@ -9,12 +9,12 @@ class CraftingMenu : public AbstractContainerMenu { // 4J Stu Made these public for UI menus, perhaps should make friend class? public: - static constexpr int RESULT_SLOT = 0; - static constexpr int CRAFT_SLOT_START = 1; + static const int RESULT_SLOT = 0; + static const int CRAFT_SLOT_START = 1; static constexpr int CRAFT_SLOT_END = CRAFT_SLOT_START + 9; - static constexpr int INV_SLOT_START = CRAFT_SLOT_END; + static const int INV_SLOT_START = CRAFT_SLOT_END; static constexpr int INV_SLOT_END = INV_SLOT_START + (9*3); - static constexpr int USE_ROW_SLOT_START = INV_SLOT_END; + static const int USE_ROW_SLOT_START = INV_SLOT_END; static constexpr int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9; public: diff --git a/Minecraft.World/DaylightDetectorTile.cpp b/Minecraft.World/DaylightDetectorTile.cpp index 8e049e5b..0bfc949b 100644 --- a/Minecraft.World/DaylightDetectorTile.cpp +++ b/Minecraft.World/DaylightDetectorTile.cpp @@ -5,14 +5,12 @@ #include "net.minecraft.world.level.redstone.h" #include "net.minecraft.world.level.tile.entity.h" #include "net.minecraft.world.h" -#include "net.minecraft.world.item.h" #include "JavaMath.h" #include "DaylightDetectorTile.h" -DaylightDetectorTile::DaylightDetectorTile(int id, bool inverted) : BaseEntityTile(id, Material::wood, isSolidRender() ) +DaylightDetectorTile::DaylightDetectorTile(int id) : BaseEntityTile(id, Material::wood, isSolidRender() ) { updateDefaultShape(); - this->inverted = inverted; } void DaylightDetectorTile::updateDefaultShape() @@ -73,10 +71,6 @@ void DaylightDetectorTile::updateSignalStrength(Level *level, int x, int y, int { target = Redstone::SIGNAL_MAX; } - if (inverted) - { - target = Redstone::SIGNAL_MAX - target; - } if (current != target) { @@ -108,46 +102,13 @@ Icon *DaylightDetectorTile::getTexture(int face, int data) { if (face == Facing::UP) { - if (inverted) - { - return icons[1]; - } - return icons[0]; } - return icons[2]; + return icons[1]; } void DaylightDetectorTile::registerIcons(IconRegister *iconRegister) { icons[0] = iconRegister->registerIcon(getIconName() + L"_top"); - icons[1] = iconRegister->registerIcon(getIconName() + L"_inverted_top"); - icons[2] = iconRegister->registerIcon(getIconName() + L"_side"); -} - -bool DaylightDetectorTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param -{ - if (player->mayBuild()) - { - if (!level->isClientSide) - { - int data = level->getData(x, y, z); - if (inverted) - level->setTileAndData(x, y, z, Tile::daylightDetector_Id, data, Tile::UPDATE_INVISIBLE); - else - level->setTileAndData(x, y, z, Tile::daylightDetectorInverted_Id, data, Tile::UPDATE_INVISIBLE); - - updateSignalStrength(level, x, y, z); - } - return true; - } - else - { - return Tile::use(level, x, y, z, player, clickedFace, clickX, clickY, clickZ, soundOnly); - } -} - -int DaylightDetectorTile::getResource(int data, Random *random, int playerBonusLevel) -{ - return Tile::daylightDetector_Id; + icons[1] = iconRegister->registerIcon(getIconName() + L"_side"); } \ No newline at end of file diff --git a/Minecraft.World/DaylightDetectorTile.h b/Minecraft.World/DaylightDetectorTile.h index ffbc8e40..635504d2 100644 --- a/Minecraft.World/DaylightDetectorTile.h +++ b/Minecraft.World/DaylightDetectorTile.h @@ -6,11 +6,10 @@ class DaylightDetectorTile : public BaseEntityTile { friend class ChunkRebuildData; private: - Icon *icons[3]; - bool inverted; + Icon *icons[2]; public: - DaylightDetectorTile(int id, bool inverted); + DaylightDetectorTile(int id); virtual void updateDefaultShape(); // 4J Added override virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); @@ -25,6 +24,4 @@ public: virtual shared_ptr newTileEntity(Level *level); virtual Icon *getTexture(int face, int data); virtual void registerIcons(IconRegister *iconRegister); - virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param - virtual int getResource(int data, Random *random, int playerBonusLevel); }; \ No newline at end of file diff --git a/Minecraft.World/Dimension.cpp b/Minecraft.World/Dimension.cpp index 2f5096f5..b7a2ea7c 100644 --- a/Minecraft.World/Dimension.cpp +++ b/Minecraft.World/Dimension.cpp @@ -164,6 +164,23 @@ float *Dimension::getSunriseColor(float td, float a) return nullptr; } +Vec3 *Dimension::getFogColor(float td, float a) const +{ + float br = Mth::cos(td * PI * 2) * 2 + 0.5f; + if (br < 0.0f) br = 0.0f; + if (br > 1.0f) br = 1.0f; + + unsigned int baseFogColour = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Default_Fog_Colour ); + float r = ((baseFogColour >> 16) & 0xff) / 255.0f; + float g = ((baseFogColour >> 8) & 0xff) / 255.0f; + float b = ((baseFogColour) & 0xff) / 255.0f; + r *= br * 0.94f + 0.06f; + g *= br * 0.94f + 0.06f; + b *= br * 0.91f + 0.09f; + + return Vec3::newTemp(r, g, b); +} + bool Dimension::mayRespawn() const { return true; @@ -222,13 +239,12 @@ double Dimension::getClearColorScale() return 1.0 / 32.0; } +bool Dimension::isFoggyAt(int x, int z) +{ + return false; +} + int Dimension::getXZSize() { return level->getLevelData()->getXZSize(); } - -// TU30 -int Dimension::getBlockLightColour() -{ - return Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_BlockLight_OverworldDimension ); -} \ No newline at end of file diff --git a/Minecraft.World/Dimension.h b/Minecraft.World/Dimension.h index 8fe0c861..ca040e21 100644 --- a/Minecraft.World/Dimension.h +++ b/Minecraft.World/Dimension.h @@ -42,10 +42,13 @@ public: virtual int getMoonPhase(int64_t time) const; virtual bool isNaturalDimension(); private: + static const int fogColor = 0xc0d8ff; + float sunriseCol[4]; public: virtual float *getSunriseColor(float td, float a); + virtual Vec3 *getFogColor(float td, float a) const; virtual bool mayRespawn() const; static Dimension *getNew(int id); virtual float getCloudHeight(); @@ -55,8 +58,8 @@ public: int getSpawnYPosition(); virtual bool hasBedrockFog(); double getClearColorScale(); + virtual bool isFoggyAt(int x, int z); // 4J Added virtual int getXZSize(); - virtual int getBlockLightColour(); // TU25 }; diff --git a/Minecraft.World/DoorInteractGoal.cpp b/Minecraft.World/DoorInteractGoal.cpp index be73a726..45805744 100644 --- a/Minecraft.World/DoorInteractGoal.cpp +++ b/Minecraft.World/DoorInteractGoal.cpp @@ -68,6 +68,6 @@ void DoorInteractGoal::tick() DoorTile *DoorInteractGoal::getDoorTile(int x, int y, int z) { int tileId = mob->level->getTile(x, y, z); - if (!DoorTile::isDoor(tileId)) return nullptr; + if (tileId != Tile::door_wood_Id) return nullptr; return static_cast(Tile::tiles[tileId]); } \ No newline at end of file diff --git a/Minecraft.World/DoorItem.cpp b/Minecraft.World/DoorItem.cpp index 36f30993..97de0f65 100644 --- a/Minecraft.World/DoorItem.cpp +++ b/Minecraft.World/DoorItem.cpp @@ -12,9 +12,8 @@ using namespace std; #include "GenericStats.h" #include "DoorItem.h" -DoorItem::DoorItem(int id, Material *material, Tile *tile) : Item(id) +DoorItem::DoorItem(int id, Material *material) : Item(id) { - this->tile = tile; this->material = material; maxStackSize = 1; } @@ -24,7 +23,10 @@ bool DoorItem::useOn(shared_ptr instance, shared_ptr playe if (face != Facing::UP) return false; y++; - Tile *tile = this->tile; + Tile *tile; + + if (material == Material::wood) tile = Tile::door_wood; + else tile = Tile::door_iron; if (!player->mayUseItemAt(x, y, z, face, instance) || !player->mayUseItemAt(x, y + 1, z, face, instance)) return false; if (!tile->mayPlace(level, x, y, z)) return false; diff --git a/Minecraft.World/DoorItem.h b/Minecraft.World/DoorItem.h index f171fcda..843c768b 100644 --- a/Minecraft.World/DoorItem.h +++ b/Minecraft.World/DoorItem.h @@ -11,10 +11,9 @@ class DoorItem : public Item { private: Material *material; - Tile* tile; public: - DoorItem(int id, Material *material, Tile *tile); + DoorItem(int id, Material *material); virtual bool useOn(shared_ptr instance, shared_ptr player, Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false); static void place(Level *level, int x, int y, int z, int dir, Tile *tile); diff --git a/Minecraft.World/DoorTile.cpp b/Minecraft.World/DoorTile.cpp index c80fa7f9..8b70e6d9 100644 --- a/Minecraft.World/DoorTile.cpp +++ b/Minecraft.World/DoorTile.cpp @@ -119,37 +119,11 @@ int DoorTile::getDir(LevelSource *level, int x, int y, int z) return getCompositeData(level, x, y, z) & C_DIR_MASK; } -int DoorTile::getItem() -{ - switch(id) - { - case Tile::door_iron_Id: - return Item::door_iron_Id; - case Tile::door_spruce_Id: - return Item::door_spruce_Id; - case Tile::door_birch_Id: - return Item::door_birch_Id; - case Tile::door_jungle_Id: - return Item::door_jungle_Id; - case Tile::door_acacia_Id: - return Item::door_acacia_Id; - case Tile::door_dark_oak_Id: - return Item::door_dark_oak_Id; - default: - return Item::door_wood_Id; - } -} - bool DoorTile::isOpen(LevelSource *level, int x, int y, int z) { return (getCompositeData(level, x, y, z) & C_OPEN_MASK) != 0; } -bool DoorTile::isDoor(int t) -{ - return (t == Tile::door_wood_Id) || (t >= Tile::door_spruce_Id && t <= Tile::door_dark_oak_Id); -} - void DoorTile::setShape(int compositeData) { float r = 3 / 16.0f; @@ -205,7 +179,7 @@ void DoorTile::attack(Level *level, int x, int y, int z, shared_ptr play // 4J-PB - Adding a TestUse for tooltip display bool DoorTile::TestUse() { - return isDoor(id); + return id == Tile::door_wood_Id; } bool DoorTile::use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly/*=false*/) // 4J added soundOnly param @@ -314,7 +288,8 @@ void DoorTile::neighborChanged(Level *level, int x, int y, int z, int type) int DoorTile::getResource(int data, Random *random, int playerBonusLevel) { if ((data & 8) != 0) return 0; - return getItem(); + if (material == Material::metal) return Item::door_iron->id; + return Item::door_wood->id; } HitResult *DoorTile::clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b) @@ -364,7 +339,7 @@ int DoorTile::getCompositeData(LevelSource *level, int x, int y, int z) int DoorTile::cloneTileId(Level *level, int x, int y, int z) { - return getItem(); + return material == Material::metal ? Item::door_iron_Id : Item::door_wood_Id; } void DoorTile::playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr player) diff --git a/Minecraft.World/DoorTile.h b/Minecraft.World/DoorTile.h index d17b1f0c..a4e4f62f 100644 --- a/Minecraft.World/DoorTile.h +++ b/Minecraft.World/DoorTile.h @@ -44,9 +44,7 @@ public: virtual AABB *getAABB(Level *level, int x, int y, int z); virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param int getDir(LevelSource *level, int x, int y, int z); - int getItem(); bool isOpen(LevelSource *level, int x, int y, int z); - static bool isDoor(int t); private: using Tile::setShape; virtual void setShape(int compositeData); diff --git a/Minecraft.World/DyePowderItem.cpp b/Minecraft.World/DyePowderItem.cpp index c9fe81c2..3392da98 100644 --- a/Minecraft.World/DyePowderItem.cpp +++ b/Minecraft.World/DyePowderItem.cpp @@ -141,7 +141,7 @@ bool DyePowderItem::useOn(shared_ptr itemInstance, shared_ptrgetTile(x, y, z); int data = level->getData(x, y, z); - if (tile == Tile::treeTrunk_Id && Tile::treeTrunk->getWoodType(data) == LogTile::JUNGLE_TRUNK) + if (tile == Tile::treeTrunk_Id && TreeTile::getWoodType(data) == TreeTile::JUNGLE_TRUNK) { if (face == 0) return false; if (face == 1) return false; diff --git a/Minecraft.World/EnchantmentMenu.h b/Minecraft.World/EnchantmentMenu.h index 675965b6..87774aca 100644 --- a/Minecraft.World/EnchantmentMenu.h +++ b/Minecraft.World/EnchantmentMenu.h @@ -6,10 +6,10 @@ class EnchantmentMenu : public AbstractContainerMenu { // 4J Stu Made these public for UI menus, perhaps should make friend class? public: - static constexpr int INGREDIENT_SLOT = 0; + static const int INGREDIENT_SLOT = 0; static constexpr int INV_SLOT_START = EnchantmentMenu::INGREDIENT_SLOT + 1; - static constexpr int INV_SLOT_END = EnchantmentMenu::INV_SLOT_START + (9*3); - static constexpr int USE_ROW_SLOT_START = EnchantmentMenu::INV_SLOT_END; + static constexpr int INV_SLOT_END = EnchantmentMenu::INV_SLOT_START + 9 * 3; + static const int USE_ROW_SLOT_START = EnchantmentMenu::INV_SLOT_END; static constexpr int USE_ROW_SLOT_END = EnchantmentMenu::USE_ROW_SLOT_START + 9; public: diff --git a/Minecraft.World/EnderMan.cpp b/Minecraft.World/EnderMan.cpp index 3133dfae..b558dab0 100644 --- a/Minecraft.World/EnderMan.cpp +++ b/Minecraft.World/EnderMan.cpp @@ -90,7 +90,9 @@ shared_ptr EnderMan::findAttackTarget() { #ifndef _FINAL_BUILD if(app.GetMobsDontAttackEnabled()) + { return shared_ptr(); + } #endif shared_ptr player = level->getNearestAttackablePlayer(shared_from_this(), 64); @@ -99,8 +101,7 @@ shared_ptr EnderMan::findAttackTarget() if (isLookingAtMe(player)) { aggroedByPlayer = true; - if (aggroTime == 0) - level->playEntitySound(player, eSoundType_MOB_ENDERMAN_STARE, 1, 1); + if (aggroTime == 0) level->playEntitySound(player, eSoundType_MOB_ENDERMAN_STARE, 1, 1); if (aggroTime++ == 5) { aggroTime = 0; @@ -109,7 +110,9 @@ shared_ptr EnderMan::findAttackTarget() } } else + { aggroTime = 0; + } } return nullptr; } @@ -117,8 +120,7 @@ shared_ptr EnderMan::findAttackTarget() bool EnderMan::isLookingAtMe(shared_ptr player) { shared_ptr helmet = player->inventory->armor[3]; - if (helmet != nullptr && helmet->id == Tile::pumpkin_Id) - return false; + if (helmet != nullptr && helmet->id == Tile::pumpkin_Id) return false; Vec3 *look = player->getViewVector(1)->normalize(); Vec3 *dir = Vec3::newTemp(x - player->x, (bb->y0 + bbHeight / 2) - (player->y + player->getHeadHeight()), z - player->z); @@ -126,8 +128,9 @@ bool EnderMan::isLookingAtMe(shared_ptr player) dir = dir->normalize(); double dot = look->dot(dir); if (dot > 1 - 0.025 / dist) + { return player->canSee(shared_from_this()); - + } return false; } @@ -141,7 +144,9 @@ void EnderMan::aiStep() speed->removeModifier(SPEED_MODIFIER_ATTACKING); if (attackTarget != nullptr) + { speed->addModifier(new AttributeModifier(*SPEED_MODIFIER_ATTACKING)); + } } lastAttackTarget = attackTarget; @@ -185,6 +190,7 @@ void EnderMan::aiStep() } } + for (int i = 0; i < 2; i++) { level->addParticle(eParticleType_ender, x + (random->nextDouble() - 0.5) * bbWidth, y + random->nextDouble() * bbHeight - 0.25f, z + (random->nextDouble() - 0.5) * bbWidth, @@ -215,11 +221,15 @@ void EnderMan::aiStep() } if (isCreepy() && !aggroedByPlayer && random->nextInt(100) == 0) + { setCreepy(false); + } jumping = false; if (attackTarget != nullptr) + { lookAt(attackTarget, 100, 100); + } if (!level->isClientSide && isAlive()) { @@ -228,8 +238,9 @@ void EnderMan::aiStep() if ( attackTarget->instanceof(eTYPE_PLAYER) && isLookingAtMe(dynamic_pointer_cast(attackTarget))) { if (attackTarget->distanceToSqr(shared_from_this()) < 4 * 4) + { teleport(); - + } teleportTime = 0; } else if (attackTarget->distanceToSqr(shared_from_this()) > 16 * 16) @@ -237,7 +248,9 @@ void EnderMan::aiStep() if (teleportTime++ >= 30) { if (teleportTowards(attackTarget)) + { teleportTime = 0; + } } } } @@ -296,16 +309,21 @@ bool EnderMan::teleport(double xx, double yy, double zz) yt--; } else + { landed = true; + } } if (landed) { setPos(x, y, z); if (level->getCubes(shared_from_this(), bb)->empty() && !level->containsAnyLiquid(bb)) + { ok = true; + } } } + if (ok) { int count = 128; @@ -393,17 +411,22 @@ bool EnderMan::hurt(DamageSource *source, float damage) if ( dynamic_cast(source) != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER)) { if (!dynamic_pointer_cast(source->getEntity())->abilities.invulnerable) + { aggroedByPlayer = true; + } else setCreepy(false); } + if (dynamic_cast(source) != nullptr) { aggroedByPlayer = false; for (int i = 0; i < 64; i++) { if (teleport()) + { return true; + } } return false; } @@ -418,10 +441,4 @@ bool EnderMan::isCreepy() void EnderMan::setCreepy(bool creepy) { entityData->set(DATA_CREEPY, static_cast(creepy ? 1 : 0)); -} - -// TU25 Addition -float EnderMan::getEyeHeight() -{ - return 2.55f; } \ No newline at end of file diff --git a/Minecraft.World/EnderMan.h b/Minecraft.World/EnderMan.h index 90f6b91d..10fb2b37 100644 --- a/Minecraft.World/EnderMan.h +++ b/Minecraft.World/EnderMan.h @@ -63,6 +63,4 @@ public: virtual bool hurt(DamageSource *source, float damage); bool isCreepy(); void setCreepy(bool creepy); - // TU25 Addition - virtual float getEyeHeight(); }; \ No newline at end of file diff --git a/Minecraft.World/Entity.cpp b/Minecraft.World/Entity.cpp index d03b3bff..7f6f4e29 100644 --- a/Minecraft.World/Entity.cpp +++ b/Minecraft.World/Entity.cpp @@ -2116,28 +2116,6 @@ wstring Entity::getNetworkName() return getDisplayName(); } -// TU25 Addition -bool Entity::hasCustomName() -{ - return false; -} -bool Entity::shouldShowName() -{ - return false; -} -AABB *Entity::getBoundingBox() -{ - return this->bb; -} -void Entity::setBoundingBox(AABB *bb) -{ - this->bb = bb; -} -float Entity::getEyeHeight() -{ - return this->bbHeight * 0.85F; -} - void Entity::setAnimOverrideBitmask(unsigned int uiBitmask) { m_uiAnimOverrideBitmask=uiBitmask; diff --git a/Minecraft.World/Entity.h b/Minecraft.World/Entity.h index 5d1572c9..5a2edc88 100644 --- a/Minecraft.World/Entity.h +++ b/Minecraft.World/Entity.h @@ -44,7 +44,7 @@ public: public: static const wstring RIDING_TAG; - static const short TOTAL_AIR_SUPPLY = 20 * 15; + static constexpr short TOTAL_AIR_SUPPLY = 20 * 15; private: static int entityCounter; @@ -377,7 +377,7 @@ private: // Things also added here to be able to manage the concept of a number of extra "wandering" entities - normally path finding entities aren't allowed to // randomly wander about once they are a certain distance away from any player, but we want to be able to (in a controlled fashion) allow some to be able // to move so that we can determine whether they have been enclosed in some kind of farm, and so be able to better determine what shouldn't or shouldn't be despawned. - static constexpr int EXTRA_WANDER_MAX = 3; // Number of entities that can simultaneously wander (in addition to the ones that would be wandering in java) + static const int EXTRA_WANDER_MAX = 3; // Number of entities that can simultaneously wander (in addition to the ones that would be wandering in java) static constexpr int EXTRA_WANDER_TICKS = 20 * 30; // Number of ticks each extra entity will be allowed to wander for. This should be enough for it to realistically be able to walk further than the biggest enclosure we want to consider int getSmallId(); @@ -419,12 +419,6 @@ public: virtual bool isPushedByWater(); virtual wstring getDisplayName(); virtual wstring getNetworkName(); // 4J: Added - //TU25 Addition - virtual bool hasCustomName(); - virtual bool shouldShowName(); - virtual AABB *getBoundingBox(); - virtual void setBoundingBox(AABB *bb); - virtual float getEyeHeight(); private: unsigned int m_uiAnimOverrideBitmask; diff --git a/Minecraft.World/EntityHorse.cpp b/Minecraft.World/EntityHorse.cpp index a2097bd1..a20f2132 100644 --- a/Minecraft.World/EntityHorse.cpp +++ b/Minecraft.World/EntityHorse.cpp @@ -405,7 +405,7 @@ void EntityHorse::dropBags() void EntityHorse::eatingHorse() { openMouth(); -// level->playEntitySound(shared_from_this(), eSoundType_MOB_HORSE_EAT, 1.0f, 1.0f + (random->nextFloat() - random->nextFloat()) * 0.2f); +// level->playEntitySound(shared_from_this(), eSoundType_MOB_HORSE_EAT, 1.0f, 1.0f + (random->nextFloat() - random->nextFloat()) * 0.2f); } /** @@ -1841,10 +1841,4 @@ bool EntityHorse::onLadder() shared_ptr EntityHorse::getOwner() { return level->getPlayerByUUID(getOwnerName()); -} - -// TU25 Addition -float EntityHorse::getEyeHeight() -{ - return bbHeight; } \ No newline at end of file diff --git a/Minecraft.World/EntityHorse.h b/Minecraft.World/EntityHorse.h index 8f62ba51..a40b05b5 100644 --- a/Minecraft.World/EntityHorse.h +++ b/Minecraft.World/EntityHorse.h @@ -342,6 +342,4 @@ public: static bool isHorseArmor(int itemId); virtual bool onLadder(); - // TU25 Addition - virtual float getEyeHeight(); }; \ No newline at end of file diff --git a/Minecraft.World/FenceGateTile.cpp b/Minecraft.World/FenceGateTile.cpp index a42257de..bd1326a9 100644 --- a/Minecraft.World/FenceGateTile.cpp +++ b/Minecraft.World/FenceGateTile.cpp @@ -1,14 +1,17 @@ #include "stdafx.h" #include "FenceGateTile.h" #include "AABB.h" -#include "net.minecraft.world.h" #include "net.minecraft.world.level.h" #include "net.minecraft.h" #include "LevelEvent.h" -FenceGateTile::FenceGateTile(int id, const wstring& texture) : DirectionalTile(id, Material::wood, isSolidRender()) +FenceGateTile::FenceGateTile(int id) : DirectionalTile(id, Material::wood, isSolidRender() ) { - this->texture = texture; +} + +Icon *FenceGateTile::getTexture(int face, int data) +{ + return Tile::wood->getTexture(face); } bool FenceGateTile::mayPlace(Level *level, int x, int y, int z) @@ -17,16 +20,6 @@ bool FenceGateTile::mayPlace(Level *level, int x, int y, int z) return Tile::mayPlace(level, x, y, z); } -bool FenceGateTile::isOpen(int data) -{ - return (data & OPEN_BIT) != 0; -} - -bool FenceGateTile::isFenceGate(int t) -{ - return (t == Tile::fenceGate_Id) || (t >= Tile::spruceFenceGate_Id && t <= Tile::darkOakFenceGate_Id); -} - AABB *FenceGateTile::getAABB(Level *level, int x, int y, int z) { int data = level->getData(x, y, z); @@ -139,9 +132,14 @@ void FenceGateTile::neighborChanged(Level *level, int x, int y, int z, int type) } } +bool FenceGateTile::isOpen(int data) +{ + return (data & OPEN_BIT) != 0; +} + void FenceGateTile::registerIcons(IconRegister *iconRegister) { - icon = iconRegister->registerIcon(texture); + // None } bool FenceGateTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face) diff --git a/Minecraft.World/FenceGateTile.h b/Minecraft.World/FenceGateTile.h index 5130ee02..125a776d 100644 --- a/Minecraft.World/FenceGateTile.h +++ b/Minecraft.World/FenceGateTile.h @@ -5,10 +5,10 @@ class FenceGateTile : public DirectionalTile { private: static const int OPEN_BIT = 4; - wstring texture; public: - FenceGateTile(int id, const wstring& texture); + FenceGateTile(int id); + Icon *getTexture(int face, int data); virtual bool mayPlace(Level *level, int x, int y, int z); virtual AABB *getAABB(Level *level, int x, int y, int z); virtual void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param // Brought forward from 1.2.3 @@ -22,6 +22,5 @@ public: virtual bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param virtual void neighborChanged(Level *level, int x, int y, int z, int type); static bool isOpen(int data); - static bool isFenceGate(int t); - virtual void registerIcons(IconRegister *iconRegister); + void registerIcons(IconRegister *iconRegister); }; diff --git a/Minecraft.World/FenceTile.cpp b/Minecraft.World/FenceTile.cpp index 8a1f9d43..83c31167 100644 --- a/Minecraft.World/FenceTile.cpp +++ b/Minecraft.World/FenceTile.cpp @@ -3,7 +3,6 @@ #include "net.minecraft.world.level.h" #include "net.minecraft.world.h" #include "FenceTile.h" -#include "FenceGateTile.h" FenceTile::FenceTile(int id, const wstring &texture, Material *material) : Tile( id, material, isSolidRender()) { @@ -118,7 +117,7 @@ int FenceTile::getRenderShape() bool FenceTile::connectsTo(LevelSource *level, int x, int y, int z) { int tile = level->getTile(x, y, z); - if (isFence(tile) || FenceGateTile::isFenceGate(tile)) + if (tile == id || tile == Tile::fenceGate_Id) { return true; } @@ -135,7 +134,7 @@ bool FenceTile::connectsTo(LevelSource *level, int x, int y, int z) bool FenceTile::isFence(int tile) { - return (tile == Tile::fence_Id || tile == Tile::netherFence_Id) || (tile >= Tile::spruce_fence_Id && tile <= Tile::dark_oak_fence_Id); + return tile == Tile::fence_Id || tile == Tile::netherFence_Id; } void FenceTile::registerIcons(IconRegister *iconRegister) diff --git a/Minecraft.World/File.cpp b/Minecraft.World/File.cpp index 0ed6e6cf..11871e42 100644 --- a/Minecraft.World/File.cpp +++ b/Minecraft.World/File.cpp @@ -286,10 +286,10 @@ std::vector *File::listFiles() const std::string mountedPath = StorageManager.GetMountedPath(lpFileName); if(mountedPath.length() > 0) { - strcpy_s(filePath, mountedPath.c_str()); + strcpy(filePath, mountedPath.c_str()); } else if(lpFileName[0] == '/') // already fully qualified path - strcpy_s(filePath, lpFileName ); + strcpy(filePath, lpFileName ); else sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); int fd; @@ -314,10 +314,10 @@ std::vector *File::listFiles() const std::string mountedPath = StorageManager.GetMountedPath(lpFileName); if(mountedPath.length() > 0) { - strcpy_s(filePath, mountedPath.c_str()); + strcpy(filePath, mountedPath.c_str()); } else if(lpFileName[0] == '/') // already fully qualified path - strcpy_s(filePath, lpFileName ); + strcpy(filePath, lpFileName ); else sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); @@ -429,10 +429,10 @@ std::vector *File::listFiles(FileFilter *filter) const std::string mountedPath = StorageManager.GetMountedPath(lpFileName); if(mountedPath.length() > 0) { - strcpy_s(filePath, mountedPath.c_str()); + strcpy(filePath, mountedPath.c_str()); } else if(lpFileName[0] == '/') // already fully qualified path - strcpy_s(filePath, lpFileName ); + strcpy(filePath, lpFileName ); else sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); int fd; @@ -531,10 +531,10 @@ int64_t File::length() std::string mountedPath = StorageManager.GetMountedPath(lpFileName); if(mountedPath.length() > 0) { - strcpy_s(filePath, mountedPath.c_str()); + strcpy(filePath, mountedPath.c_str()); } else if(lpFileName[0] == '/') // already fully qualified path - strcpy_s(filePath, lpFileName ); + strcpy(filePath, lpFileName ); else sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); @@ -567,10 +567,10 @@ int64_t File::length() std::string mountedPath = StorageManager.GetMountedPath(lpFileName); if(mountedPath.length() > 0) { - strcpy_s(filePath, mountedPath.c_str()); + strcpy(filePath, mountedPath.c_str()); } else if(lpFileName[0] == '/') // already fully qualified path - strcpy_s(filePath, lpFileName ); + strcpy(filePath, lpFileName ); else sprintf(filePath,"%s/%s",getUsrDirPath(), lpFileName ); diff --git a/Minecraft.World/FileHeader.cpp b/Minecraft.World/FileHeader.cpp index c9982fa5..a7bdbc90 100644 --- a/Minecraft.World/FileHeader.cpp +++ b/Minecraft.World/FileHeader.cpp @@ -533,7 +533,7 @@ vector *FileHeader::getDatFilesWithOnlineID(const PlayerUID& pUID) // we're looking for the online name from the pUID in these types of filenames - // P_5e7ff8372ea9_00000004_Mark_4J wchar_t onlineIDW[64]; - mbstowcs_s(nullptr, onlineIDW, 64, pUID.getOnlineID(), _TRUNCATE); + mbstowcs(onlineIDW, pUID.getOnlineID(), 64); vector *files = nullptr; int onlineIDSize = wcslen(onlineIDW); @@ -659,6 +659,7 @@ vector *FileHeader::getDatFilesWithPrimaryUser() ByteOrder FileHeader::getEndian( ESavePlatform plat ) { + ByteOrder platEndian; switch(plat) { case SAVE_FILE_PLATFORM_X360: diff --git a/Minecraft.World/FireTile.cpp b/Minecraft.World/FireTile.cpp index 5613b8f2..49f859b5 100644 --- a/Minecraft.World/FireTile.cpp +++ b/Minecraft.World/FireTile.cpp @@ -41,21 +41,12 @@ void FireTile::init() setFlammable(Tile::woodSlab_Id, FLAME_HARD, BURN_MEDIUM); setFlammable(Tile::woodSlabHalf_Id, FLAME_HARD, BURN_MEDIUM); setFlammable(Tile::fence_Id, FLAME_HARD, BURN_MEDIUM); - setFlammable(Tile::birch_fence_Id, FLAME_HARD, BURN_MEDIUM); - setFlammable(Tile::spruce_fence_Id, FLAME_HARD, BURN_MEDIUM); - setFlammable(Tile::jungle_fence_Id, FLAME_HARD, BURN_MEDIUM); - setFlammable(Tile::acacia_fence_Id, FLAME_HARD, BURN_MEDIUM); - setFlammable(Tile::dark_oak_fence_Id, FLAME_HARD, BURN_MEDIUM); setFlammable(Tile::stairs_wood_Id, FLAME_HARD, BURN_MEDIUM); setFlammable(Tile::stairs_birchwood_Id, FLAME_HARD, BURN_MEDIUM); setFlammable(Tile::stairs_sprucewood_Id, FLAME_HARD, BURN_MEDIUM); setFlammable(Tile::stairs_junglewood_Id, FLAME_HARD, BURN_MEDIUM); - setFlammable(Tile::stairs_acaciawood_Id, FLAME_HARD, BURN_MEDIUM); - setFlammable(Tile::stairs_darkoakwood_Id, FLAME_HARD, BURN_MEDIUM); setFlammable(Tile::treeTrunk_Id, FLAME_HARD, BURN_HARD); - setFlammable(Tile::newTreeTrunk_Id, FLAME_HARD, BURN_HARD); setFlammable(Tile::leaves_Id, FLAME_EASY, BURN_EASY); - setFlammable(Tile::newLeaves_Id, FLAME_EASY, BURN_EASY); setFlammable(Tile::bookshelf_Id, FLAME_EASY, BURN_MEDIUM); setFlammable(Tile::tnt_Id, FLAME_MEDIUM, BURN_INSTANT); setFlammable(Tile::tallgrass_Id, FLAME_INSTANT, BURN_INSTANT); diff --git a/Minecraft.World/FireworksMenu.h b/Minecraft.World/FireworksMenu.h index daef7902..6865d002 100644 --- a/Minecraft.World/FireworksMenu.h +++ b/Minecraft.World/FireworksMenu.h @@ -9,12 +9,12 @@ class FireworksMenu : public AbstractContainerMenu { // 4J Stu Made these public for UI menus, perhaps should make friend class? public: - static constexpr int RESULT_SLOT = 0; - static constexpr int CRAFT_SLOT_START = 1; + static const int RESULT_SLOT = 0; + static const int CRAFT_SLOT_START = 1; static constexpr int CRAFT_SLOT_END = CRAFT_SLOT_START + 9; - static constexpr int INV_SLOT_START = CRAFT_SLOT_END; + static const int INV_SLOT_START = CRAFT_SLOT_END; static constexpr int INV_SLOT_END = INV_SLOT_START + (9*3); - static constexpr int USE_ROW_SLOT_START = INV_SLOT_END; + static const int USE_ROW_SLOT_START = INV_SLOT_END; static constexpr int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9; public: diff --git a/Minecraft.World/FurnaceMenu.h b/Minecraft.World/FurnaceMenu.h index d7a9f6d3..c4037116 100644 --- a/Minecraft.World/FurnaceMenu.h +++ b/Minecraft.World/FurnaceMenu.h @@ -8,12 +8,12 @@ class FurnaceMenu : public AbstractContainerMenu { // 4J Stu Made these public for UI menus, perhaps should make friend class? public: - static constexpr int INGREDIENT_SLOT = 0; - static constexpr int FUEL_SLOT = 1; - static constexpr int RESULT_SLOT = 2; + static const int INGREDIENT_SLOT = 0; + static const int FUEL_SLOT = 1; + static const int RESULT_SLOT = 2; static constexpr int INV_SLOT_START = FurnaceMenu::RESULT_SLOT + 1; static constexpr int INV_SLOT_END = FurnaceMenu::INV_SLOT_START + (9*3); - static constexpr int USE_ROW_SLOT_START = FurnaceMenu::INV_SLOT_END; + static const int USE_ROW_SLOT_START = FurnaceMenu::INV_SLOT_END; static constexpr int USE_ROW_SLOT_END = FurnaceMenu::USE_ROW_SLOT_START + 9; private: diff --git a/Minecraft.World/FurnaceRecipes.cpp b/Minecraft.World/FurnaceRecipes.cpp index 1fa1a140..f0a4c770 100644 --- a/Minecraft.World/FurnaceRecipes.cpp +++ b/Minecraft.World/FurnaceRecipes.cpp @@ -30,7 +30,6 @@ FurnaceRecipes::FurnaceRecipes() addFurnaceRecipy(Tile::clay_Id, new ItemInstance(Tile::clayHardened), .35f); addFurnaceRecipy(Tile::cactus_Id, new ItemInstance(Item::dye_powder, 1, DyePowderItem::GREEN), .2f); addFurnaceRecipy(Tile::treeTrunk_Id, new ItemInstance(Item::coal, 1, CoalItem::CHAR_COAL), .15f); - addFurnaceRecipy(Tile::newTreeTrunk_Id, new ItemInstance(Item::coal, 1, CoalItem::CHAR_COAL), .15f); addFurnaceRecipy(Tile::emeraldOre_Id, new ItemInstance(Item::emerald), 1); addFurnaceRecipy(Item::potato_Id, new ItemInstance(Item::potatoBaked), .35f); addFurnaceRecipy(Tile::netherRack_Id, new ItemInstance(Item::netherbrick), .1f); diff --git a/Minecraft.World/Ghast.cpp b/Minecraft.World/Ghast.cpp index 0d022fa0..e5e072ee 100644 --- a/Minecraft.World/Ghast.cpp +++ b/Minecraft.World/Ghast.cpp @@ -119,13 +119,14 @@ void Ghast::serverAiStep() } } - if (target != nullptr && target->removed) - target = nullptr; + if (target != nullptr && target->removed) target = nullptr; if (target == nullptr || retargetTime-- <= 0) { target = level->getNearestAttackablePlayer(shared_from_this(), 100); if (target != nullptr) + { retargetTime = 20; + } } double maxDist = 64.0f; @@ -159,8 +160,10 @@ void Ghast::serverAiStep() charge = -40; } } - else if (charge > 0) - charge--; + else + { + if (charge > 0) charge--; + } } else { @@ -173,7 +176,9 @@ void Ghast::serverAiStep() BYTE old = entityData->getByte(DATA_IS_CHARGING); BYTE current = static_cast(charge > 10 ? 1 : 0); if (old != current) + { entityData->set(DATA_IS_CHARGING, current); + } } } @@ -217,11 +222,14 @@ void Ghast::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) { int count = random->nextInt(2) + random->nextInt(1 + playerBonusLevel); for (int i = 0; i < count; i++) + { spawnAtLocation(Item::ghastTear_Id, 1); - + } count = random->nextInt(3) + random->nextInt(1 + playerBonusLevel); for (int i = 0; i < count; i++) + { spawnAtLocation(Item::gunpowder_Id, 1); + } } float Ghast::getSoundVolume() @@ -238,7 +246,6 @@ int Ghast::getMaxSpawnClusterSize() { return 1; } - void Ghast::addAdditonalSaveData(CompoundTag *tag) { FlyingMob::addAdditonalSaveData(tag); @@ -249,10 +256,4 @@ void Ghast::readAdditionalSaveData(CompoundTag *tag) { FlyingMob::readAdditionalSaveData(tag); if (tag->contains(L"ExplosionPower")) explosionPower = tag->getInt(L"ExplosionPower"); -} - -// TU25 Addition -float Ghast::getEyeHeight() -{ - return 2.6f; } \ No newline at end of file diff --git a/Minecraft.World/Ghast.h b/Minecraft.World/Ghast.h index 329821c3..f19f737c 100644 --- a/Minecraft.World/Ghast.h +++ b/Minecraft.World/Ghast.h @@ -63,6 +63,4 @@ public: virtual int getMaxSpawnClusterSize(); virtual void addAdditonalSaveData(CompoundTag *tag); virtual void readAdditionalSaveData(CompoundTag *tag); - // TU25 Addition - virtual float getEyeHeight(); }; diff --git a/Minecraft.World/Giant.cpp b/Minecraft.World/Giant.cpp index f762a17b..ba74ce9e 100644 --- a/Minecraft.World/Giant.cpp +++ b/Minecraft.World/Giant.cpp @@ -28,10 +28,4 @@ void Giant::registerAttributes() float Giant::getWalkTargetValue(int x, int y, int z) { return level->getBrightness(x, y, z)-0.5f; -} - -// TU25 Addition -float Giant::getEyeHeight() -{ - return 1.62f * 6.0f; } \ No newline at end of file diff --git a/Minecraft.World/Giant.h b/Minecraft.World/Giant.h index e7cf779f..478de94c 100644 --- a/Minecraft.World/Giant.h +++ b/Minecraft.World/Giant.h @@ -18,6 +18,4 @@ protected: public: virtual float getWalkTargetValue(int x, int y, int z); - // TU25 Addition - virtual float getEyeHeight(); }; diff --git a/Minecraft.World/HalfTransparentTile.cpp b/Minecraft.World/HalfTransparentTile.cpp index b007e915..5ef85f2d 100644 --- a/Minecraft.World/HalfTransparentTile.cpp +++ b/Minecraft.World/HalfTransparentTile.cpp @@ -19,18 +19,6 @@ bool HalfTransparentTile::shouldRenderFace(LevelSource *level, int x, int y, int { int id = level->getTile(x, y, z); - if (this->id == Tile::stained_glass_Id) - { - bool isBlocking = level->isTopSolidBlocking(x, y, z); - if (face == Facing::DOWN && level->isSolidBlockingTile(x, y + 1, z) != isBlocking) return true; - else if (face == Facing::UP && level->isTopSolidBlocking(x, y - 1, z) != isBlocking) return true; - else if (face == Facing::NORTH && level->isSolidBlockingTile(x, y, z + 1) != isBlocking) return true; - else if (face == Facing::SOUTH && level->isSolidBlockingTile(x, y, z - 1) != isBlocking) return true; - else if (face == Facing::WEST && level->isSolidBlockingTile(x + 1, y, z) != isBlocking) return true; - else if (face == Facing::EAST && level->isSolidBlockingTile(x - 1, y, z) != isBlocking) return true; - //else if (face == 6 && level->isSolidBlockingTile(x, y, z) != isBlocking) return true; // not really a direction? is this supposed to be here? - } - if (!allowSame && id == this->id) { return false; diff --git a/Minecraft.World/HellBiome.cpp b/Minecraft.World/HellBiome.cpp index c315e01d..865b21d7 100644 --- a/Minecraft.World/HellBiome.cpp +++ b/Minecraft.World/HellBiome.cpp @@ -1,7 +1,6 @@ #include "stdafx.h" #include "net.minecraft.world.entity.monster.h" #include "HellBiome.h" -#include "..\Minecraft.Client\Minecraft.h" HellBiome::HellBiome(int id) : Biome(id) { @@ -12,36 +11,8 @@ HellBiome::HellBiome(int id) : Biome(id) waterFriendlies.clear(); ambientFriendlies.clear(); - enemies.push_back(new MobSpawnerData(eTYPE_GHAST, 100, 4, 4)); - enemies.push_back(new MobSpawnerData(eTYPE_PIGZOMBIE, 200, 4, 4)); - enemies.push_back(new MobSpawnerData(eTYPE_LAVASLIME, 2, 4, 4)); + enemies.push_back(new MobSpawnerData(eTYPE_GHAST, 50, 4, 4)); + enemies.push_back(new MobSpawnerData(eTYPE_PIGZOMBIE, 100, 4, 4)); + enemies.push_back(new MobSpawnerData(eTYPE_LAVASLIME, 1, 4, 4)); enemies.push_back(new MobSpawnerData(eTYPE_SKELETON, 1, 4, 4)); -} - -Vec3 *HellBiome::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); - - float rr = static_cast(redComponent)/256;//0.2f; - float gg = static_cast(greenComponent)/256;//0.03f; - float bb = static_cast(blueComponent)/256;//0.03f; - return Vec3::newTemp(rr, gg, bb); -} - -int HellBiome::getSkyColor(float temp) -{ - return 0; -} - -bool HellBiome::isNatural() -{ - return false; -} - -bool HellBiome::isFoggy() -{ - return true; } \ No newline at end of file diff --git a/Minecraft.World/HellBiome.h b/Minecraft.World/HellBiome.h index a796420f..ed51de83 100644 --- a/Minecraft.World/HellBiome.h +++ b/Minecraft.World/HellBiome.h @@ -5,9 +5,4 @@ class HellBiome : public Biome { public: HellBiome(int id); - //TU25 - virtual Vec3 *getFogColor(float td, float a) const; - virtual int getSkyColor(float temp); - virtual bool isNatural(); - virtual bool isFoggy(); }; \ No newline at end of file diff --git a/Minecraft.World/HellDimension.cpp b/Minecraft.World/HellDimension.cpp index 552e5895..a8b70d03 100644 --- a/Minecraft.World/HellDimension.cpp +++ b/Minecraft.World/HellDimension.cpp @@ -16,6 +16,19 @@ void HellDimension::init() id = -1; } +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); + + float rr = static_cast(redComponent)/256;//0.2f; + float gg = static_cast(greenComponent)/256;//0.03f; + float bb = static_cast(blueComponent)/256;//0.03f; + return Vec3::newTemp(rr, gg, bb); +} + void HellDimension::updateLightRamp() { float ambientLight = 0.10f; @@ -65,13 +78,12 @@ bool HellDimension::mayRespawn() const return false; } +bool HellDimension::isFoggyAt(int x, int z) +{ + return true; +} + int HellDimension::getXZSize() { return ceil(static_cast(level->getLevelData()->getXZSize()) / level->getLevelData()->getHellScale()); } - -// TU30 -int HellDimension::getBlockLightColour() -{ - return Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_BlockLight_HellDimension ); -} \ No newline at end of file diff --git a/Minecraft.World/HellDimension.h b/Minecraft.World/HellDimension.h index f097df3c..fa95d9b2 100644 --- a/Minecraft.World/HellDimension.h +++ b/Minecraft.World/HellDimension.h @@ -5,6 +5,7 @@ class HellDimension : public Dimension { public: virtual void init(); + virtual Vec3 *getFogColor(float td, float a) const; protected: virtual void updateLightRamp(); @@ -15,8 +16,8 @@ public: virtual bool isValidSpawn(int x, int y) const; virtual float getTimeOfDay(int64_t time, float a) const; virtual bool mayRespawn() const; + virtual bool isFoggyAt(int x, int z); // 4J Added virtual int getXZSize(); - virtual int getBlockLightColour(); // TU25 }; diff --git a/Minecraft.World/HopperMenu.h b/Minecraft.World/HopperMenu.h index 89347b52..dc87f5ab 100644 --- a/Minecraft.World/HopperMenu.h +++ b/Minecraft.World/HopperMenu.h @@ -8,10 +8,10 @@ private: shared_ptr hopper; public: - static constexpr int CONTENTS_SLOT_START = 0; + static const int CONTENTS_SLOT_START = 0; static constexpr int INV_SLOT_START = CONTENTS_SLOT_START + 5; static constexpr int INV_SLOT_END = INV_SLOT_START + (9*3); - static constexpr int USE_ROW_SLOT_START = INV_SLOT_END; + static const int USE_ROW_SLOT_START = INV_SLOT_END; static constexpr int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9; public: diff --git a/Minecraft.World/InventoryMenu.h b/Minecraft.World/InventoryMenu.h index a527eb11..86579340 100644 --- a/Minecraft.World/InventoryMenu.h +++ b/Minecraft.World/InventoryMenu.h @@ -12,14 +12,14 @@ private: // 4J Stu Made these public for UI menus, perhaps should make friend class? public: - static constexpr int RESULT_SLOT = 0; - static constexpr int CRAFT_SLOT_START = 1; + static const int RESULT_SLOT = 0; + static const int CRAFT_SLOT_START = 1; static constexpr int CRAFT_SLOT_END = CRAFT_SLOT_START + 4; - static constexpr int ARMOR_SLOT_START = CRAFT_SLOT_END; + static const int ARMOR_SLOT_START = CRAFT_SLOT_END; static constexpr int ARMOR_SLOT_END = ARMOR_SLOT_START + 4; - static constexpr int INV_SLOT_START = ARMOR_SLOT_END; + static const int INV_SLOT_START = ARMOR_SLOT_END; static constexpr int INV_SLOT_END = INV_SLOT_START + (9*3); - static constexpr int USE_ROW_SLOT_START = INV_SLOT_END; + static const int USE_ROW_SLOT_START = INV_SLOT_END; static constexpr int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9; public: diff --git a/Minecraft.World/Item.cpp b/Minecraft.World/Item.cpp index 8fa26d41..5b247cc3 100644 --- a/Minecraft.World/Item.cpp +++ b/Minecraft.World/Item.cpp @@ -213,7 +213,11 @@ Item *Item::frame = nullptr; Item *Item::skull = nullptr; + // TU14 +//Item *Item::writingBook = nullptr; +//Item *Item::writtenBook = nullptr; + Item *Item::emerald = nullptr; Item *Item::flowerPot = nullptr; @@ -247,14 +251,6 @@ Item *Item::horseArmorDiamond = nullptr; Item *Item::lead = nullptr; Item *Item::nameTag = nullptr; -// TU25 -//Item *Item::writingBook = nullptr; -//Item *Item::writtenBook = nullptr; -Item *Item::door_spruce = nullptr; -Item *Item::door_birch = nullptr; -Item *Item::door_jungle = nullptr; -Item *Item::door_acacia = nullptr; -Item *Item::door_dark_oak = nullptr; void Item::staticCtor() { @@ -288,8 +284,8 @@ void Item::staticCtor() Item::hoe_diamond = ( new HoeItem(37, _Tier::DIAMOND) ) ->setBaseItemTypeAndMaterial(eBaseItemType_hoe, eMaterial_diamond) ->setIconName(L"hoeDiamond")->setDescriptionId(IDS_ITEM_HOE_DIAMOND)->setUseDescriptionId(IDS_DESC_HOE); Item::hoe_gold = ( new HoeItem(38, _Tier::GOLD) ) ->setBaseItemTypeAndMaterial(eBaseItemType_hoe, eMaterial_gold) ->setIconName(L"hoeGold")->setDescriptionId(IDS_ITEM_HOE_GOLD)->setUseDescriptionId(IDS_DESC_HOE); - Item::door_wood = ( new DoorItem(68, Material::wood, Tile::door_wood) ) ->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_wood)->setIconName(L"doorWood")->setDescriptionId(IDS_ITEM_DOOR_WOOD)->setUseDescriptionId(IDS_DESC_DOOR_WOOD); - Item::door_iron = ( new DoorItem(74, Material::metal, Tile::door_iron) ) ->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_iron)->setIconName(L"doorIron")->setDescriptionId(IDS_ITEM_DOOR_IRON)->setUseDescriptionId(IDS_DESC_DOOR_IRON); + Item::door_wood = ( new DoorItem(68, Material::wood) ) ->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_wood)->setIconName(L"doorWood")->setDescriptionId(IDS_ITEM_DOOR_WOOD)->setUseDescriptionId(IDS_DESC_DOOR_WOOD); + Item::door_iron = ( new DoorItem(74, Material::metal) ) ->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_iron)->setIconName(L"doorIron")->setDescriptionId(IDS_ITEM_DOOR_IRON)->setUseDescriptionId(IDS_DESC_DOOR_IRON); Item::helmet_leather = static_cast((new ArmorItem(42, ArmorItem::ArmorMaterial::CLOTH, 0, ArmorItem::SLOT_HEAD))->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_cloth)->setIconName(L"helmetCloth")->setDescriptionId(IDS_ITEM_HELMET_CLOTH)->setUseDescriptionId(IDS_DESC_HELMET_LEATHER)); Item::helmet_iron = static_cast((new ArmorItem(50, ArmorItem::ArmorMaterial::IRON, 2, ArmorItem::SLOT_HEAD))->setBaseItemTypeAndMaterial(eBaseItemType_helmet, eMaterial_iron)->setIconName(L"helmetIron")->setDescriptionId(IDS_ITEM_HELMET_IRON)->setUseDescriptionId(IDS_DESC_HELMET_IRON)); @@ -464,6 +460,10 @@ void Item::staticCtor() // TU12 Item::skull = (new SkullItem(141)) ->setIconName(L"skull")->setDescriptionId(IDS_ITEM_SKULL)->setUseDescriptionId(IDS_DESC_SKULL); + // TU14 + //Item::writingBook = (new WritingBookItem(130))->setIcon(11, 11)->setDescriptionId("writingBook"); + //Item::writtenBook = (new WrittenBookItem(131))->setIcon(12, 11)->setDescriptionId("writtenBook"); + Item::emerald = (new Item(132)) ->setBaseItemTypeAndMaterial(eBaseItemType_treasure, eMaterial_emerald)->setIconName(L"emerald")->setDescriptionId(IDS_ITEM_EMERALD)->setUseDescriptionId(IDS_DESC_EMERALD); Item::flowerPot = (new TilePlanterItem(134, Tile::flowerPot)) ->setIconName(L"flowerPot")->setDescriptionId(IDS_FLOWERPOT)->setUseDescriptionId(IDS_DESC_FLOWERPOT); @@ -493,17 +493,8 @@ void Item::staticCtor() Item::horseArmorGold = (new Item(162)) ->setIconName(L"gold_horse_armor")->setMaxStackSize(1)->setDescriptionId(IDS_ITEM_GOLD_HORSE_ARMOR)->setUseDescriptionId(IDS_DESC_GOLD_HORSE_ARMOR); Item::horseArmorDiamond = (new Item(163)) ->setIconName(L"diamond_horse_armor")->setMaxStackSize(1)->setDescriptionId(IDS_ITEM_DIAMOND_HORSE_ARMOR)->setUseDescriptionId(IDS_DESC_DIAMOND_HORSE_ARMOR); Item::lead = (new LeashItem(164)) ->setBaseItemTypeAndMaterial(eBaseItemType_pockettool, eMaterial_undefined)->setIconName(L"lead")->setDescriptionId(IDS_ITEM_LEAD)->setUseDescriptionId(IDS_DESC_LEAD); - Item::nameTag = (new NameTagItem(165)) ->setIconName(L"name_tag")->setDescriptionId(IDS_ITEM_NAME_TAG)->setUseDescriptionId(IDS_DESC_NAME_TAG); + Item::nameTag = (new NameTagItem(165)) ->setIconName(L"name_tag")->setDescriptionId(IDS_ITEM_NAME_TAG)->setUseDescriptionId(IDS_DESC_NAME_TAG);} - // TU25 - //Item::writingBook = (new WritingBookItem(130))->setIcon(11, 11)->setDescriptionId("writingBook"); - //Item::writtenBook = (new WrittenBookItem(131))->setIcon(12, 11)->setDescriptionId("writtenBook"); - Item::door_spruce = (new DoorItem(171, Material::wood, Tile::door_spruce))->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_sprucewood)->setIconName(L"door_spruce")->setDescriptionId(IDS_TILE_DOOR_SPRUCE)->setUseDescriptionId(IDS_DESC_DOOR_WOOD); - Item::door_birch = (new DoorItem(172, Material::wood, Tile::door_birch))->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_birchwood)->setIconName(L"door_birch")->setDescriptionId(IDS_TILE_DOOR_BIRCH)->setUseDescriptionId(IDS_DESC_DOOR_WOOD); - Item::door_jungle = (new DoorItem(173, Material::wood, Tile::door_jungle))->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_junglewood)->setIconName(L"door_jungle")->setDescriptionId(IDS_TILE_DOOR_JUNGLE)->setUseDescriptionId(IDS_DESC_DOOR_WOOD); - Item::door_acacia = (new DoorItem(174, Material::wood, Tile::door_acacia))->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_acaciawood)->setIconName(L"door_acacia")->setDescriptionId(IDS_TILE_DOOR_ACACIA)->setUseDescriptionId(IDS_DESC_DOOR_WOOD); - Item::door_dark_oak = (new DoorItem(175, Material::wood, Tile::door_dark_oak))->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_darkoakwood)->setIconName(L"door_dark_oak")->setDescriptionId(IDS_TILE_DOOR_DARK_OAK)->setUseDescriptionId(IDS_DESC_DOOR_WOOD); -} // 4J Stu - We need to do this after the staticCtor AND after staticCtors for other class // eg Recipes @@ -1040,10 +1031,10 @@ const int Item::hoe_gold_Id ; const int Item::seeds_wheat_Id ; const int Item::wheat_Id ; const int Item::bread_Id ; -const int Item::helmet_leather_Id ; -const int Item::chestplate_leather_Id; +const int Item::helmet_leather_Id ; +const int Item::chestplate_leather_Id ; const int Item::leggings_leather_Id ; -const int Item::boots_leather_Id ; +const int Item::boots_leather_Id ; const int Item::helmet_chain_Id ; const int Item::chestplate_chain_Id ; const int Item::leggings_chain_Id ; @@ -1066,44 +1057,44 @@ const int Item::porkChop_cooked_Id ; const int Item::painting_Id ; const int Item::apple_gold_Id ; const int Item::sign_Id ; -const int Item::door_wood_Id ; +const int Item::door_wood_Id ; const int Item::bucket_empty_Id ; const int Item::bucket_water_Id ; const int Item::bucket_lava_Id ; const int Item::minecart_Id ; const int Item::saddle_Id ; -const int Item::door_iron_Id ; +const int Item::door_iron_Id ; const int Item::redStone_Id ; const int Item::snowBall_Id ; const int Item::boat_Id ; const int Item::leather_Id ; -const int Item::bucket_milk_Id ; -const int Item::brick_Id ; +const int Item::bucket_milk_Id ; +const int Item::brick_Id ; const int Item::clay_Id ; -const int Item::reeds_Id ; -const int Item::paper_Id ; +const int Item::reeds_Id ; +const int Item::paper_Id ; const int Item::book_Id ; -const int Item::slimeBall_Id ; +const int Item::slimeBall_Id ; const int Item::minecart_chest_Id ; const int Item::minecart_furnace_Id ; const int Item::egg_Id ; const int Item::compass_Id ; const int Item::fishingRod_Id ; -const int Item::clock_Id ; +const int Item::clock_Id ; const int Item::yellowDust_Id ; const int Item::fish_raw_Id ; const int Item::fish_cooked_Id ; const int Item::dye_powder_Id ; const int Item::bone_Id ; -const int Item::sugar_Id ; +const int Item::sugar_Id ; const int Item::cake_Id ; const int Item::bed_Id ; -const int Item::repeater_Id ; +const int Item::repeater_Id ; const int Item::cookie_Id ; const int Item::map_Id ; const int Item::shears_Id ; -const int Item::melon_Id ; -const int Item::seeds_pumpkin_Id ; +const int Item::melon_Id ; +const int Item::seeds_pumpkin_Id ; const int Item::seeds_melon_Id ; const int Item::beef_raw_Id ; const int Item::beef_cooked_Id ; @@ -1112,39 +1103,39 @@ const int Item::chicken_cooked_Id ; const int Item::rotten_flesh_Id ; const int Item::enderPearl_Id ; const int Item::blazeRod_Id ; -const int Item::ghastTear_Id ; +const int Item::ghastTear_Id ; const int Item::goldNugget_Id ; const int Item::netherwart_seeds_Id; const int Item::potion_Id ; const int Item::glassBottle_Id ; -const int Item::spiderEye_Id ; +const int Item::spiderEye_Id ; const int Item::fermentedSpiderEye_Id; const int Item::blazePowder_Id ; const int Item::magmaCream_Id ; const int Item::brewingStand_Id ; const int Item::cauldron_Id ; const int Item::eyeOfEnder_Id ; -const int Item::speckledMelon_Id ; -const int Item::spawnEgg_Id ; -const int Item::expBottle_Id ; -const int Item::skull_Id ; -const int Item::record_01_Id ; -const int Item::record_02_Id ; -const int Item::record_03_Id ; -const int Item::record_04_Id ; -const int Item::record_05_Id ; -const int Item::record_06_Id ; -const int Item::record_07_Id ; -const int Item::record_08_Id ; -const int Item::record_09_Id ; -const int Item::record_10_Id ; -const int Item::record_11_Id ; -const int Item::record_12_Id ; +const int Item::speckledMelon_Id ; +const int Item::spawnEgg_Id; +const int Item::expBottle_Id ; +const int Item::skull_Id ; +const int Item::record_01_Id ; +const int Item::record_02_Id ; +const int Item::record_03_Id ; +const int Item::record_04_Id ; +const int Item::record_05_Id ; +const int Item::record_06_Id ; +const int Item::record_07_Id ; +const int Item::record_08_Id ; +const int Item::record_09_Id ; +const int Item::record_10_Id ; +const int Item::record_11_Id ; +const int Item::record_12_Id ; const int Item::fireball_Id ; -const int Item::itemFrame_Id ; +const int Item::itemFrame_Id ; const int Item::netherbrick_Id ; const int Item::emerald_Id ; -const int Item::flowerPot_Id ; +const int Item::flowerPot_Id ; const int Item::carrots_Id ; const int Item::potato_Id ; const int Item::potatoBaked_Id ; @@ -1152,13 +1143,6 @@ const int Item::potatoPoisonous_Id ; const int Item::carrotGolden_Id ; const int Item::carrotOnAStick_Id ; const int Item::pumpkinPie_Id ; -const int Item::enchantedBook_Id ; +const int Item::enchantedBook_Id ; const int Item::netherQuartz_Id ; -//const int Item::writingBook_Id ; -//const int Item::writtenBook_Id ; -const int Item::door_spruce_Id ; -const int Item::door_birch_Id ; -const int Item::door_jungle_Id ; -const int Item::door_acacia_Id ; -const int Item::door_dark_oak_Id ; #endif diff --git a/Minecraft.World/Item.h b/Minecraft.World/Item.h index e0ae6599..eab64880 100644 --- a/Minecraft.World/Item.h +++ b/Minecraft.World/Item.h @@ -80,8 +80,6 @@ public: eMaterial_sprucewood, eMaterial_birchwood, eMaterial_junglewood, - eMaterial_acaciawood, - eMaterial_darkoakwood, eMaterial_emerald, eMaterial_quartz, eMaterial_apple, @@ -127,7 +125,6 @@ public: eBaseItemType_piston, eBaseItemType_devicetool, eBaseItemType_fence, - eBaseItemType_fencegate, eBaseItemType_device, eBaseItemType_treasure, eBaseItemType_seed, @@ -378,6 +375,10 @@ public: static Item *fireball; static Item *frame; + // TU14 + //static Item writingBook; + //static Item writtenBook; + static Item *emerald; static Item *flowerPot; @@ -411,15 +412,6 @@ public: static Item *lead; static Item *nameTag; - // TU25 - //static Item *writingBook; - //static Item *writtenBook; - static Item *door_spruce; - static Item *door_birch; - static Item *door_jungle; - static Item *door_acacia; - static Item *door_dark_oak; - static const int shovel_iron_Id = 256; static const int pickAxe_iron_Id = 257; @@ -586,6 +578,10 @@ public: static const int fireball_Id = 385; static const int itemFrame_Id = 389; + // TU14 + //static const int writingBook_Id = 130; + //static const int writtenBook_Id = 131; + static const int emerald_Id = 388; static const int flowerPot_Id = 390; @@ -620,15 +616,6 @@ public: static const int lead_Id = 420; static const int nameTag_Id = 421; - // TU25 - //static const int writingBook_Id = 130; - //static const int writtenBook_Id = 131; - static const int door_spruce_Id = 427; - static const int door_birch_Id = 428; - static const int door_jungle_Id = 429; - static const int door_acacia_Id = 430; - static const int door_dark_oak_Id = 431; - public: const int id; diff --git a/Minecraft.World/JungleBiome.cpp b/Minecraft.World/JungleBiome.cpp index f34c902d..1388e97f 100644 --- a/Minecraft.World/JungleBiome.cpp +++ b/Minecraft.World/JungleBiome.cpp @@ -27,13 +27,13 @@ Feature *JungleBiome::getTreeFeature(Random *random) } if (random->nextInt(2) == 0) { - return new GroundBushFeature(LogTile::JUNGLE_TRUNK, LeafTile::NORMAL_LEAF); + return new GroundBushFeature(TreeTile::JUNGLE_TRUNK, LeafTile::NORMAL_LEAF); } if (random->nextInt(3) == 0) { - return new MegaTreeFeature(false, 10 + random->nextInt(20), LogTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF); + return new MegaTreeFeature(false, 10 + random->nextInt(20), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF); } - return new TreeFeature(false, 4 + random->nextInt(7), LogTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, true); + return new TreeFeature(false, 4 + random->nextInt(7), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, true); } Feature *JungleBiome::getGrassFeature(Random *random) diff --git a/Minecraft.World/LeafTile.cpp b/Minecraft.World/LeafTile.cpp index d6ff81bc..92b37db6 100644 --- a/Minecraft.World/LeafTile.cpp +++ b/Minecraft.World/LeafTile.cpp @@ -9,26 +9,19 @@ #include "..\Minecraft.Client\Options.h" #include "..\Minecraft.Client\Minecraft.h" -const unsigned int LeafTile::LEAF_NAMES[LEAF_NAMES_LENGTH] = { - IDS_TILE_LEAVES_OAK, +const unsigned int LeafTile::LEAF_NAMES[LEAF_NAMES_LENGTH] = { IDS_TILE_LEAVES_OAK, IDS_TILE_LEAVES_SPRUCE, IDS_TILE_LEAVES_BIRCH, IDS_TILE_LEAVES_JUNGLE, - IDS_TILE_LEAVES_ACACIA, - IDS_TILE_LEAVES_DARK_OAK, }; -const wstring LeafTile::TEXTURES[2][6] = { - {L"leaves", L"leaves_spruce", L"leaves", L"leaves_jungle", L"leaves_acacia", L"leaves_big_oak"}, - {L"leaves_opaque", L"leaves_spruce_opaque", L"leaves_opaque", L"leaves_jungle_opaque", L"leaves_acacia_fast", L"leaves_big_oak_fast"}, -}; +const wstring LeafTile::TEXTURES[2][4] = { {L"leaves", L"leaves_spruce", L"leaves", L"leaves_jungle"}, {L"leaves_opaque", L"leaves_spruce_opaque", L"leaves_opaque", L"leaves_jungle_opaque"},}; -LeafTile::LeafTile(int id, int offset) : TransparentTile(id, Material::leaves, false, isSolidRender()) +LeafTile::LeafTile(int id) : TransparentTile(id, Material::leaves, false, isSolidRender()) { checkBuffer = nullptr; fancyTextureSet = 0; setTicking(true); - leafTypeOffset = offset; } LeafTile::~LeafTile() @@ -49,11 +42,11 @@ int LeafTile::getColor() const int LeafTile::getColor(int data) { - if ((data & LEAF_TYPE_MASK) + leafTypeOffset == EVERGREEN_LEAF) + if ((data & LEAF_TYPE_MASK) == EVERGREEN_LEAF) { return FoliageColor::getEvergreenColor(); } - if ((data & LEAF_TYPE_MASK) + leafTypeOffset == BIRCH_LEAF) + if ((data & LEAF_TYPE_MASK) == BIRCH_LEAF) { return FoliageColor::getBirchColor(); } @@ -69,11 +62,11 @@ int LeafTile::getColor(LevelSource *level, int x, int y, int z) // 4J - changed interface to have data passed in, and put existing interface as wrapper above int LeafTile::getColor(LevelSource *level, int x, int y, int z, int data) { - if ((data & LEAF_TYPE_MASK) + leafTypeOffset == EVERGREEN_LEAF) + if ((data & LEAF_TYPE_MASK) == EVERGREEN_LEAF) { return FoliageColor::getEvergreenColor(); } - if ((data & LEAF_TYPE_MASK) + leafTypeOffset == BIRCH_LEAF) + if ((data & LEAF_TYPE_MASK) == BIRCH_LEAF) { return FoliageColor::getBirchColor(); } @@ -262,7 +255,7 @@ void LeafTile::spawnResources(Level *level, int x, int y, int z, int data, float if (!level->isClientSide) { int chance = 20; - if ((data & LEAF_TYPE_MASK) + leafTypeOffset == JUNGLE_LEAF) + if ((data & LEAF_TYPE_MASK) == JUNGLE_LEAF) { chance = 40; } @@ -289,7 +282,7 @@ void LeafTile::spawnResources(Level *level, int x, int y, int z, int data, float chance = 40; } } - if ((data & LEAF_TYPE_MASK) + leafTypeOffset == NORMAL_LEAF && level->random->nextInt(chance) == 0) + if ((data & LEAF_TYPE_MASK) == NORMAL_LEAF && level->random->nextInt(chance) == 0) { popResource(level, x, y, z, std::make_shared(Item::apple_Id, 1, 0)); } @@ -306,7 +299,7 @@ void LeafTile::playerDestroy(Level *level, shared_ptr player, int x, int ); // drop leaf block instead of sapling - popResource(level, x, y, z, std::make_shared(Tile::leaves_Id, 1, (data & LEAF_TYPE_MASK) + leafTypeOffset)); + popResource(level, x, y, z, std::make_shared(Tile::leaves_Id, 1, data & LEAF_TYPE_MASK)); } else { @@ -316,7 +309,7 @@ void LeafTile::playerDestroy(Level *level, shared_ptr player, int x, int int LeafTile::getSpawnResourcesAuxValue(int data) { - return (data & LEAF_TYPE_MASK) + leafTypeOffset; + return data & LEAF_TYPE_MASK; } bool LeafTile::isSolidRender(bool isServerLevel) @@ -329,7 +322,19 @@ bool LeafTile::isSolidRender(bool isServerLevel) Icon *LeafTile::getTexture(int face, int data) { - return icons[fancyTextureSet][leafTypeOffset + (data & LEAF_TYPE_MASK)]; + if ((data & LEAF_TYPE_MASK) == EVERGREEN_LEAF) + { + return icons[fancyTextureSet][EVERGREEN_LEAF]; + } + if ((data & LEAF_TYPE_MASK) == JUNGLE_LEAF) + { + return icons[fancyTextureSet][JUNGLE_LEAF]; + } + if ((data & LEAF_TYPE_MASK) == BIRCH_LEAF) + { + return icons[fancyTextureSet][BIRCH_LEAF]; + } + return icons[fancyTextureSet][0]; } void LeafTile::setFancy(bool fancyGraphics) @@ -340,7 +345,7 @@ void LeafTile::setFancy(bool fancyGraphics) shared_ptr LeafTile::getSilkTouchItemInstance(int data) { - return std::make_shared(id, 1, (data & LEAF_TYPE_MASK) + leafTypeOffset); + return std::make_shared(id, 1, data & LEAF_TYPE_MASK); } void LeafTile::stepOn(Level *level, int x, int y, int z, shared_ptr entity) @@ -356,12 +361,8 @@ bool LeafTile::shouldTileTick(Level *level, int x,int y,int z) unsigned int LeafTile::getDescriptionId(int iData /*= -1*/) { - int leafIndex = 0; - if (iData != -1) - { - leafIndex = (iData & LEAF_TYPE_MASK) + leafTypeOffset; - } - return LeafTile::LEAF_NAMES[leafIndex]; + int leafIndex = iData & LEAF_TYPE_MASK; + return LeafTile::LEAF_NAMES[leafIndex]; } void LeafTile::registerIcons(IconRegister *iconRegister) @@ -370,7 +371,7 @@ void LeafTile::registerIcons(IconRegister *iconRegister) { //icons[fancy] = new Icon[TEXTURES[fancy].length]; - for (int i = 0; i < 6; i++) + for (int i = 0; i < 4; i++) { icons[fancy][i] = iconRegister->registerIcon(TEXTURES[fancy][i]); } diff --git a/Minecraft.World/LeafTile.h b/Minecraft.World/LeafTile.h index f9630932..e6c39a7f 100644 --- a/Minecraft.World/LeafTile.h +++ b/Minecraft.World/LeafTile.h @@ -9,18 +9,18 @@ class LeafTile : public TransparentTile friend class Tile; friend class ChunkRebuildData; public: - static const wstring TEXTURES[2][6]; + static const wstring TEXTURES[2][4]; static const int REQUIRED_WOOD_RANGE = 4; static const int UPDATE_LEAF_BIT = 8; static const int PERSISTENT_LEAF_BIT = 4; // player-placed - static const int NORMAL_LEAF = 0; static const int EVERGREEN_LEAF = 1; static const int BIRCH_LEAF = 2; static const int JUNGLE_LEAF = 3; - static const int LEAF_NAMES_LENGTH = 6; + static const int LEAF_NAMES_LENGTH = 4; + static const unsigned int LEAF_NAMES[LEAF_NAMES_LENGTH]; private: static const int LEAF_TYPE_MASK = 3; @@ -29,11 +29,10 @@ private: // ssssssssss sssssssssss s int fancyTextureSet; - Icon *icons[2][6]; - int leafTypeOffset; + Icon *icons[2][4]; protected: - LeafTile(int id, int offset); + LeafTile(int id); virtual ~LeafTile(); public: virtual int getColor() const; diff --git a/Minecraft.World/LeashFenceKnotEntity.cpp b/Minecraft.World/LeashFenceKnotEntity.cpp index 99f5a9c9..f94bcba7 100644 --- a/Minecraft.World/LeashFenceKnotEntity.cpp +++ b/Minecraft.World/LeashFenceKnotEntity.cpp @@ -154,10 +154,4 @@ shared_ptr LeashFenceKnotEntity::findKnotAt(Level *level, delete knots; } return nullptr; -} - -// TU25 Addition -float LeashFenceKnotEntity::getEyeHeight() -{ - return -0.0625f; } \ No newline at end of file diff --git a/Minecraft.World/LeashFenceKnotEntity.h b/Minecraft.World/LeashFenceKnotEntity.h index 64f2f77c..1bf3a7b7 100644 --- a/Minecraft.World/LeashFenceKnotEntity.h +++ b/Minecraft.World/LeashFenceKnotEntity.h @@ -33,6 +33,4 @@ public: virtual bool survives(); static shared_ptr createAndAddKnot(Level *level, int x, int y, int z); static shared_ptr findKnotAt(Level *level, int x, int y, int z); - // TU25 Addition - virtual float getEyeHeight(); }; \ No newline at end of file diff --git a/Minecraft.World/Level.cpp b/Minecraft.World/Level.cpp index dd66898b..290f26bf 100644 --- a/Minecraft.World/Level.cpp +++ b/Minecraft.World/Level.cpp @@ -915,25 +915,23 @@ LevelChunk *Level::getChunk(int x, int z) bool Level::setTileAndData(int x, int y, int z, int tile, int data, int updateFlags) { if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z >= MAX_LEVEL_SIZE) + { return false; - + } if (y < 0) return false; if (y >= maxBuildHeight) return false; - LevelChunk *c = getChunk(x >> 4, z >> 4); - if (!c) return false; int oldTile = 0; if ((updateFlags & Tile::UPDATE_NEIGHBORS) != 0) + { oldTile = c->getTile(x & 15, y, z & 15); - + } bool result; - #ifndef _CONTENT_PACKAGE int old = c->getTile(x & 15, y, z & 15); int olddata = c->getData( x & 15, y, z & 15); #endif - result = c->setTileAndData(x & 15, y, z & 15, tile, data); if( updateFlags != Tile::UPDATE_INVISIBLE_NO_LIGHT) { @@ -941,22 +939,21 @@ bool Level::setTileAndData(int x, int y, int z, int tile, int data, int updateFl PIXBeginNamedEvent(0,"Checking light %d %d %d",x,y,z); PIXBeginNamedEvent(0,"was %d, %d now %d, %d",old,olddata,tile,data); #endif - Level::checkLight(x, y, z); - + checkLight(x, y, z); PIXEndNamedEvent(); PIXEndNamedEvent(); } if (result) { if ((updateFlags & Tile::UPDATE_CLIENTS) != 0 && !(isClientSide && (updateFlags & Tile::UPDATE_INVISIBLE) != 0)) + { sendTileUpdated(x, y, z); - + } if (!isClientSide && (updateFlags & Tile::UPDATE_NEIGHBORS) != 0) { tileUpdated(x, y, z, oldTile); Tile *tobj = Tile::tiles[tile]; - if (tobj != nullptr && tobj->hasAnalogOutputSignal()) - updateNeighbourForOutputSignal(x, y, z, tile); + if (tobj != nullptr && tobj->hasAnalogOutputSignal()) updateNeighbourForOutputSignal(x, y, z, tile); } } return result; @@ -972,12 +969,12 @@ Material *Level::getMaterial(int x, int y, int z) int Level::getData(int x, int y, int z) { if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z >= MAX_LEVEL_SIZE) - return false; - - if (y < 0) return false; - if (y >= maxBuildHeight) return false; + { + return 0; + } + if (y < 0) return 0; + if (y >= maxBuildHeight) return 0; LevelChunk *c = getChunk(x >> 4, z >> 4); - x &= 15; z &= 15; return c->getData(x, y, z); @@ -986,14 +983,12 @@ int Level::getData(int x, int y, int z) bool Level::setData(int x, int y, int z, int data, int updateFlags, bool forceUpdate/*=false*/) // 4J added forceUpdate) { if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z >= MAX_LEVEL_SIZE) + { return false; - + } if (y < 0) return false; if (y >= maxBuildHeight) return false; - LevelChunk *c = getChunk(x >> 4, z >> 4); - if (!c) return false; - int cx = x & 15; int cz = z & 15; // 4J - have changed _sendTileData to encode a bitfield of which bits are important to be sent. This will be zero where the original flag was false, and non-zero where the original @@ -1335,18 +1330,15 @@ int Level::getBrightness(LightLayer::variety layer, int x, int y, int z) int ix = xc + (chunkSourceXZSize/2); int iz = zc + (chunkSourceXZSize/2); - if( ( ix < 0 ) || ( ix >= chunkSourceXZSize) || - ( iz < 0 ) || ( iz >= chunkSourceXZSize ) ) - return 0; - + if( ( ix < 0 ) || ( ix >= chunkSourceXZSize ) ) return 0; + if( ( iz < 0 ) || ( iz >= chunkSourceXZSize ) ) return 0; int idx = ix * chunkSourceXZSize + iz; LevelChunk *c = chunkSourceCache[idx]; if( c == nullptr ) return (int)layer; - // Removed in TU25 -// if (y < 0) y = 0; -// if (y >= maxBuildHeight) y = maxBuildHeight - 1; + if (y < 0) y = 0; + if (y >= maxBuildHeight) y = maxBuildHeight - 1; return c->getBrightness(layer, x & 15, y, z & 15); } @@ -1412,14 +1404,13 @@ void Level::getNeighbourBrightnesses(int *brightnesses, LightLayer::variety laye void Level::setBrightness(LightLayer::variety layer, int x, int y, int z, int brightness, bool noUpdateOnClient/*=false*/) // 4J added noUpdateOnClient { if (x < -MAX_LEVEL_SIZE || z < -MAX_LEVEL_SIZE || x >= MAX_LEVEL_SIZE || z >= MAX_LEVEL_SIZE) + { return; - - // Removed in TU25 -// if (y < 0) return; -// if (y >= maxBuildHeight) return; - + } + if (y < 0) return; + if (y >= maxBuildHeight) return; + if (!hasChunk(x >> 4, z >> 4)) return; LevelChunk *c = getChunk(x >> 4, z >> 4); - if (!c) return; c->setBrightness(layer, x & 15, y, z & 15, brightness); @@ -2030,6 +2021,8 @@ float Level::getSkyDarken(float a) return br * 0.8f + 0.2f; } + + Vec3 *Level::getSkyColor(shared_ptr source, float a) { float td = getTimeOfDay(a); @@ -2159,14 +2152,11 @@ Vec3 *Level::getCloudColor(float a) return Vec3::newTemp(r, g, b); } -Vec3 *Level::getFogColor(shared_ptr source, float a) -{ - int x = Mth::floor(source->x); - int z = Mth::floor(source->z); - Biome *biome = getBiome(x, z); +Vec3 *Level::getFogColor(float a) +{ float td = getTimeOfDay(a); - return biome->getFogColor(td, a); + return dimension->getFogColor(td, a); } @@ -3313,8 +3303,6 @@ void Level::buildAndPrepareChunksToPoll() void Level::tickClientSideTiles(int xo, int zo, LevelChunk *lc) { - if (app.GetGameSettings(0,eGameSetting_CaveSounds) == 0) return; - //lc->tick(); // 4J - brought this lighting update forward from 1.8.2 if (delayUntilNextMoodSound == 0 && !isClientSide) @@ -3412,9 +3400,7 @@ bool Level::shouldSnow(int x, int y, int z) void Level::checkLight(int x, int y, int z, bool force, bool rootOnlyEmissive) // 4J added force, rootOnlyEmissive parameters { - if (!dimension->hasCeiling) - checkLight(LightLayer::Sky, x, y, z, force, false); - + if (!dimension->hasCeiling) checkLight(LightLayer::Sky, x, y, z, force, false); checkLight(LightLayer::Block, x, y, z, force, rootOnlyEmissive); } diff --git a/Minecraft.World/Level.h b/Minecraft.World/Level.h index 97a0c56d..a67fde5e 100644 --- a/Minecraft.World/Level.h +++ b/Minecraft.World/Level.h @@ -71,9 +71,9 @@ public: static const int MAX_LEVEL_SIZE = 30000000; static const int maxMovementHeight = 512; // 4J added - static constexpr int minBuildHeight = 0; // 4J - brought forward from 1.2.3 - static constexpr int maxBuildHeight = 256; // 4J - brought forward from 1.2.3 - static constexpr int genDepthBits = 7; + static const int minBuildHeight = 0; // 4J - brought forward from 1.2.3 + static const int maxBuildHeight = 256; // 4J - brought forward from 1.2.3 + static const int genDepthBits = 7; static constexpr int genDepthBitsPlusFour = genDepthBits + 4; static constexpr int genDepth = 1 << genDepthBits; static constexpr int genDepthMinusOne = genDepth - 1; @@ -81,7 +81,7 @@ public: static constexpr int CHUNK_TILE_COUNT = maxBuildHeight * 16 * 16; static constexpr int HALF_CHUNK_TILE_COUNT = CHUNK_TILE_COUNT/2; - static constexpr int COMPRESSED_CHUNK_SECTION_HEIGHT = 128; + static const int COMPRESSED_CHUNK_SECTION_HEIGHT = 128; static constexpr int COMPRESSED_CHUNK_SECTION_TILES = COMPRESSED_CHUNK_SECTION_HEIGHT * 16 * 16; // 4J Stu - Fixed size int seaLevel; @@ -96,7 +96,7 @@ public: static void setInstaTick(bool enable); // bool instaTick; // 4J - removed - static constexpr int MAX_BRIGHTNESS = 15; + static const int MAX_BRIGHTNESS = 15; static constexpr int TICKS_PER_DAY = 20 * 60 * 20; // ORG:20*60*20 public: @@ -328,7 +328,7 @@ public: float getMoonBrightness(); float getSunAngle(float a); Vec3 *getCloudColor(float a); - Vec3 *getFogColor(shared_ptr source, float a); + Vec3 *getFogColor(float a); int getTopRainBlock(int x, int z); int getTopSolidBlock(int x, int z); bool biomeHasRain(int x, int z); // 4J added @@ -402,8 +402,8 @@ protected: private: int delayUntilNextMoodSound; - static constexpr int CHUNK_POLL_RANGE = 9; - static constexpr int CHUNK_TILE_TICK_COUNT = 80; + static const int CHUNK_POLL_RANGE = 9; + static const int CHUNK_TILE_TICK_COUNT = 80; static constexpr int CHUNK_SECTION_TILE_TICK_COUNT = (CHUNK_TILE_TICK_COUNT / 8) + 1; protected: diff --git a/Minecraft.World/LiquidTile.cpp b/Minecraft.World/LiquidTile.cpp index 6c216256..9cf53fcc 100644 --- a/Minecraft.World/LiquidTile.cpp +++ b/Minecraft.World/LiquidTile.cpp @@ -145,26 +145,9 @@ bool LiquidTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int f { Material *m = level->getMaterial(x, y, z); if (m == material) return false; - if (face != Facing::UP) return Tile::shouldRenderFace(level, x, y, z, face); - - return true; -} - -bool LiquidTile::shouldRenderBackwardUpFace(LevelSource* level, int x, int y, int z) -{ - Material *m = level->getMaterial(x, y, z); - - if (m != material && !level->isSolidRenderTile(x - 1, y, z - 1)) return true; - else if (m != material && !level->isSolidRenderTile(x - 1, y, z)) return true; - else if (m != material && !level->isSolidRenderTile(x - 1, y, z + 1)) return true; - else if (m != material && !level->isSolidRenderTile(x, y, z - 1)) return true; - else if (m != material && !level->isSolidRenderTile(x, y, z)) return true; - else if (m != material && !level->isSolidRenderTile(x, y, z + 1)) return true; - else if (m != material && !level->isSolidRenderTile(x + 1, y, z - 1)) return true; - else if (m != material && !level->isSolidRenderTile(x + 1, y, z)) return true; - else if (m != material && !level->isSolidRenderTile(x + 1, y, z + 1)) return true; - - return false; + if (face == Facing::UP) return true; + if (m == Material::ice) return false; + return Tile::shouldRenderFace(level, x, y, z, face); } AABB *LiquidTile::getAABB(Level *level, int x, int y, int z) @@ -291,7 +274,7 @@ float LiquidTile::getBrightness(LevelSource *level, int x, int y, int z) int LiquidTile::getRenderLayer() { - return material == Material::water ? 2 : 0; + return material == Material::water ? 1 : 0; } void LiquidTile::animateTick(Level *level, int x, int y, int z, Random *random) diff --git a/Minecraft.World/LiquidTile.h b/Minecraft.World/LiquidTile.h index b810a75b..bcc00347 100644 --- a/Minecraft.World/LiquidTile.h +++ b/Minecraft.World/LiquidTile.h @@ -35,7 +35,6 @@ public: virtual bool mayPick(int data, bool liquid); virtual bool isSolidFace(LevelSource *level, int x, int y, int z, int face); virtual bool shouldRenderFace(LevelSource *level, int x, int y, int z, int face); - virtual bool shouldRenderBackwardUpFace(LevelSource *level, int x, int y, int z); virtual AABB *getAABB(Level *level, int x, int y, int z); virtual int getRenderShape(); virtual int getResource(int data, Random *random, int playerBonusLevel); diff --git a/Minecraft.World/LiquidTileDynamic.cpp b/Minecraft.World/LiquidTileDynamic.cpp index b17ce1a5..2c7c74f4 100644 --- a/Minecraft.World/LiquidTileDynamic.cpp +++ b/Minecraft.World/LiquidTileDynamic.cpp @@ -2,7 +2,6 @@ #include "net.minecraft.world.level.h" #include "LiquidTileDynamic.h" #include "net.minecraft.world.level.dimension.h" -#include "DoorTile.h" LiquidTileDynamic::LiquidTileDynamic(int id, Material *material) : LiquidTile(id, material) { @@ -296,7 +295,7 @@ bool *LiquidTileDynamic::getSpread(Level *level, int x, int y, int z) bool LiquidTileDynamic::isWaterBlocking(Level *level, int x, int y, int z) { int t = level->getTile(x, y, z); - if (DoorTile::isDoor(t) || t == Tile::door_iron_Id || t == Tile::sign_Id || t == Tile::ladder_Id || t == Tile::reeds_Id) + if (t == Tile::door_wood_Id || t == Tile::door_iron_Id || t == Tile::sign_Id || t == Tile::ladder_Id || t == Tile::reeds_Id) { return true; } diff --git a/Minecraft.World/LogTile.cpp b/Minecraft.World/LogTile.cpp deleted file mode 100644 index e87728a9..00000000 --- a/Minecraft.World/LogTile.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "stdafx.h" -#include "net.minecraft.world.level.h" -#include "net.minecraft.world.level.tile.piston.h" -#include "net.minecraft.h" -#include "net.minecraft.world.h" -#include "LeafTile.h" -#include "LogTile.h" - -const unsigned int LogTile::TREE_NAMES[LogTile::TREE_NAMES_LENGTH] = { - IDS_TILE_LOG_OAK, - IDS_TILE_LOG_SPRUCE, - IDS_TILE_LOG_BIRCH, - IDS_TILE_LOG_JUNGLE, - IDS_TILE_LOG_ACACIA, - IDS_TILE_LOG_DARK_OAK -}; - -const wstring LogTile::TREE_STRING_NAMES[LogTile::TREE_NAMES_LENGTH] = { - L"oak", L"spruce", L"birch", L"jungle", L"acacia", L"big_oak" -}; - -LogTile::LogTile(int id) : RotatedPillarTile(id, Material::wood) -{ -} - -int LogTile::getResourceCount(Random *random) -{ - return 1; -} - -void LogTile::onRemove(Level *level, int x, int y, int z, int id, int data) -{ - int r = LeafTile::REQUIRED_WOOD_RANGE; - int r2 = r + 1; - - if (level->hasChunksAt(x - r2, y - r2, z - r2, x + r2, y + r2, z + r2)) - { - for (int xo = -r; xo <= r; xo++) - for (int yo = -r; yo <= r; yo++) - for (int zo = -r; zo <= r; zo++) - { - int t = level->getTile(x + xo, y + yo, z + zo); - if (t == Tile::leaves_Id) - { - int currentData = level->getData(x + xo, y + yo, z + zo); - if ((currentData & LeafTile::UPDATE_LEAF_BIT) == 0) - { - level->setData(x + xo, y + yo, z + zo, currentData | LeafTile::UPDATE_LEAF_BIT, Tile::UPDATE_NONE); - } - } - } - } -} - -unsigned int LogTile::getDescriptionId(int iData /*= -1*/) -{ - int type = getWoodType(iData); - if (type < 0) type = 0; - return LogTile::TREE_NAMES[type]; -} - -Icon *LogTile::getTypeTexture(int type) -{ - return icons_side[getWoodType(type)]; -} - -Icon *LogTile::getTopTexture(int type) -{ - return icons_top[getWoodType(type)]; -} - -int LogTile::getWoodType(int data) -{ - return data & MASK_TYPE; -} - -shared_ptr LogTile::getSilkTouchItemInstance(int data) -{ - // fix to avoid getting silktouched sideways logs - return shared_ptr(new ItemInstance(id, 1, getWoodType(data))); -} - -void LogTile::registerIcons(IconRegister *iconRegister) -{ - for (int i = 0; i < TREE_NAMES_LENGTH; i++) - { - icons_side[i] = iconRegister->registerIcon(getIconName() + L"_" + TREE_STRING_NAMES[i]); - icons_top[i] = iconRegister->registerIcon(getIconName() + L"_" + TREE_STRING_NAMES[i] + L"_top"); - } -} \ No newline at end of file diff --git a/Minecraft.World/MineShaftPieces.cpp b/Minecraft.World/MineShaftPieces.cpp index 179d7c95..97caf366 100644 --- a/Minecraft.World/MineShaftPieces.cpp +++ b/Minecraft.World/MineShaftPieces.cpp @@ -213,27 +213,23 @@ bool MineShaftPieces::MineShaftRoom::postProcess(Level *level, Random *random, B return true; } -void MineShaftPieces::MineShaftRoom::addAdditionalSaveData(DataOutputStream *dos) +void MineShaftPieces::MineShaftRoom::addAdditonalSaveData(CompoundTag *tag) { - dos->writeInt((int)childEntranceBoxes.size()); - - for (auto it = childEntranceBoxes.begin(); it != childEntranceBoxes.end(); ++it) + ListTag *entrances = new ListTag(L"Entrances"); + for (auto& bb : childEntranceBoxes) { - BoundingBox *bb = *it; - bb->write(dos); + entrances->add(bb->createTag(L"")); } + tag->put(L"Entrances", entrances); } -void MineShaftPieces::MineShaftRoom::readAdditonalSaveData(DataInputStream *dis) +void MineShaftPieces::MineShaftRoom::readAdditonalSaveData(CompoundTag *tag) { - int count = dis->readInt(); - - for (int i = 0; i < count; i++) - { - BoundingBox *bb = new BoundingBox(); - bb->read(dis); - childEntranceBoxes.push_back(bb); - } + ListTag *entrances = (ListTag *) tag->getList(L"Entrances"); + for (int i = 0; i < entrances->size(); i++) + { + childEntranceBoxes.push_back(new BoundingBox(entrances->get(i)->data)); + } } MineShaftPieces::MineShaftCorridor::MineShaftCorridor() @@ -241,20 +237,20 @@ MineShaftPieces::MineShaftCorridor::MineShaftCorridor() // for reflection } -void MineShaftPieces::MineShaftCorridor::addAdditionalSaveData(DataOutputStream *dos) +void MineShaftPieces::MineShaftCorridor::addAdditonalSaveData(CompoundTag *tag) { - dos->writeBoolean(hasRails); - dos->writeBoolean(spiderCorridor); - dos->writeBoolean(hasPlacedSpider); - dos->writeInt(numSections); + tag->putBoolean(L"hr", hasRails); + tag->putBoolean(L"sc", spiderCorridor); + tag->putBoolean(L"hps", hasPlacedSpider); + tag->putInt(L"Num", numSections); } -void MineShaftPieces::MineShaftCorridor::readAdditonalSaveData(DataInputStream* dis) +void MineShaftPieces::MineShaftCorridor::readAdditonalSaveData(CompoundTag *tag) { - hasRails = dis->readBoolean(); - spiderCorridor = dis->readBoolean(); - hasPlacedSpider = dis->readBoolean(); - numSections = dis->readInt(); + hasRails = tag->getBoolean(L"hr"); + spiderCorridor = tag->getBoolean(L"sc"); + hasPlacedSpider = tag->getBoolean(L"hps"); + numSections = tag->getInt(L"Num"); } MineShaftPieces::MineShaftCorridor::MineShaftCorridor(int genDepth, Random *random, BoundingBox *corridorBox, int direction) @@ -516,7 +512,6 @@ bool MineShaftPieces::MineShaftCorridor::postProcess(Level *level, Random *rando newZ = getWorldZ(x0 + 1, newZ); if (chunkBB->isInside(x, y, newZ)) { - setDirty(); hasPlacedSpider = true; level->setTileAndData(x, y, newZ, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, newZ) ); @@ -558,16 +553,16 @@ MineShaftPieces::MineShaftCrossing::MineShaftCrossing() // for reflection } -void MineShaftPieces::MineShaftCrossing::addAdditionalSaveData(DataOutputStream *dos) +void MineShaftPieces::MineShaftCrossing::addAdditonalSaveData(CompoundTag *tag) { - dos->writeBoolean(isTwoFloored); - dos->writeInt(direction); + tag->putBoolean(L"tf", isTwoFloored); + tag->putInt(L"D", direction); } -void MineShaftPieces::MineShaftCrossing::readAdditonalSaveData(DataInputStream* dis) +void MineShaftPieces::MineShaftCrossing::readAdditonalSaveData(CompoundTag *tag) { - isTwoFloored = dis->readBoolean(); - direction = dis->readInt(); + isTwoFloored = tag->getBoolean(L"tf"); + direction = tag->getInt(L"D"); } MineShaftPieces::MineShaftCrossing::MineShaftCrossing(int genDepth, Random *random, BoundingBox *crossingBox, int direction) @@ -717,11 +712,11 @@ MineShaftPieces::MineShaftStairs::MineShaftStairs(int genDepth, Random *random, } -void MineShaftPieces::MineShaftStairs::addAdditionalSaveData(DataOutputStream *dos) +void MineShaftPieces::MineShaftStairs::addAdditonalSaveData(CompoundTag *tag) { } -void MineShaftPieces::MineShaftStairs::readAdditonalSaveData(DataInputStream* dis) +void MineShaftPieces::MineShaftStairs::readAdditonalSaveData(CompoundTag *tag) { } diff --git a/Minecraft.World/MineShaftPieces.h b/Minecraft.World/MineShaftPieces.h index 4e9ba019..c2278467 100644 --- a/Minecraft.World/MineShaftPieces.h +++ b/Minecraft.World/MineShaftPieces.h @@ -41,8 +41,8 @@ public: virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); protected: - void addAdditionalSaveData(DataOutputStream *dos); - void readAdditonalSaveData(DataInputStream *dis); + void addAdditonalSaveData(CompoundTag *tag); + void readAdditonalSaveData(CompoundTag *tag); }; /** @@ -65,8 +65,8 @@ public: MineShaftCorridor(); protected: - void addAdditionalSaveData(DataOutputStream *dos); - void readAdditonalSaveData(DataInputStream *dis); + void addAdditonalSaveData(CompoundTag *tag); + void readAdditonalSaveData(CompoundTag *tag); public: MineShaftCorridor(int genDepth, Random *random, BoundingBox *corridorBox, int direction); @@ -99,8 +99,8 @@ public: MineShaftCrossing(); protected: - void addAdditionalSaveData(DataOutputStream *dos); - void readAdditonalSaveData(DataInputStream *dis); + void addAdditonalSaveData(CompoundTag *tag); + void readAdditonalSaveData(CompoundTag *tag); public: MineShaftCrossing(int genDepth, Random *random, BoundingBox *crossingBox, int direction); @@ -125,8 +125,8 @@ public: MineShaftStairs(int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - void addAdditionalSaveData(DataOutputStream *dos); - void readAdditonalSaveData(DataInputStream *dis); + void addAdditonalSaveData(CompoundTag *tag); + void readAdditonalSaveData(CompoundTag *tag); public: static BoundingBox *findStairs(list *pieces, Random *random, int footX, int footY, int footZ, int direction); diff --git a/Minecraft.World/MonsterPlacerItem.cpp b/Minecraft.World/MonsterPlacerItem.cpp index 9c24862b..3b4cffa0 100644 --- a/Minecraft.World/MonsterPlacerItem.cpp +++ b/Minecraft.World/MonsterPlacerItem.cpp @@ -196,7 +196,7 @@ bool MonsterPlacerItem::useOn(shared_ptr itemInstance, shared_ptr< double yOff = 0; // 4J-PB - missing parentheses added - if (face == Facing::UP && FenceTile::isFence(tile)) + if (face == Facing::UP && (tile == Tile::fence_Id || tile == Tile::netherFence_Id)) { // special case yOff = .5; diff --git a/Minecraft.World/NetherBridgePieces.cpp b/Minecraft.World/NetherBridgePieces.cpp index 5512cb84..d9fbbf35 100644 --- a/Minecraft.World/NetherBridgePieces.cpp +++ b/Minecraft.World/NetherBridgePieces.cpp @@ -159,11 +159,11 @@ NetherBridgePieces::NetherBridgePiece::NetherBridgePiece(int genDepth) : Structu { } -void NetherBridgePieces::NetherBridgePiece::readAdditonalSaveData(DataInputStream *dis) +void NetherBridgePieces::NetherBridgePiece::readAdditonalSaveData(CompoundTag *tag) { } -void NetherBridgePieces::NetherBridgePiece::addAdditionalSaveData(DataOutputStream *dos) +void NetherBridgePieces::NetherBridgePiece::addAdditonalSaveData(CompoundTag *tag) { } @@ -497,18 +497,18 @@ bool NetherBridgePieces::BridgeEndFiller::postProcess(Level *level, Random *rand return true; } -void NetherBridgePieces::BridgeEndFiller::readAdditonalSaveData(DataInputStream *dis) +void NetherBridgePieces::BridgeEndFiller::readAdditonalSaveData(CompoundTag *tag) { - NetherBridgePiece::readAdditonalSaveData(dis); + NetherBridgePiece::readAdditonalSaveData(tag); - selfSeed = dis->readInt(); + selfSeed = tag->getInt(L"Seed"); } -void NetherBridgePieces::BridgeEndFiller::addAdditionalSaveData(DataOutputStream *dos) +void NetherBridgePieces::BridgeEndFiller::addAdditonalSaveData(CompoundTag *tag) { - NetherBridgePiece::addAdditionalSaveData(dos); + NetherBridgePiece::addAdditonalSaveData(tag); - dos->writeInt(selfSeed); + tag->putInt(L"Seed", selfSeed); } NetherBridgePieces::BridgeCrossing::BridgeCrossing() @@ -636,14 +636,14 @@ NetherBridgePieces::StartPiece::StartPiece(Random *random, int west, int north, } } -void NetherBridgePieces::StartPiece::readAdditonalSaveData(DataInputStream *dis) +void NetherBridgePieces::StartPiece::readAdditonalSaveData(CompoundTag *tag) { - BridgeCrossing::readAdditonalSaveData(dis); + BridgeCrossing::readAdditonalSaveData(tag); } -void NetherBridgePieces::StartPiece::addAdditionalSaveData(DataOutputStream *dos) +void NetherBridgePieces::StartPiece::addAdditonalSaveData(CompoundTag *tag) { - BridgeCrossing::addAdditionalSaveData(dos); + BridgeCrossing::addAdditonalSaveData(tag); } NetherBridgePieces::RoomCrossing::RoomCrossing() @@ -824,18 +824,18 @@ NetherBridgePieces::MonsterThrone *NetherBridgePieces::MonsterThrone::createPiec return new MonsterThrone(genDepth, random, box, direction); } -void NetherBridgePieces::MonsterThrone::readAdditonalSaveData(DataInputStream *dis) +void NetherBridgePieces::MonsterThrone::readAdditonalSaveData(CompoundTag *tag) { - NetherBridgePiece::readAdditonalSaveData(dis); + NetherBridgePiece::readAdditonalSaveData(tag); - hasPlacedMobSpawner = dis->readBoolean(); + hasPlacedMobSpawner = tag->getBoolean(L"Mob"); } -void NetherBridgePieces::MonsterThrone::addAdditionalSaveData(DataOutputStream *dos) +void NetherBridgePieces::MonsterThrone::addAdditonalSaveData(CompoundTag *tag) { - NetherBridgePiece::addAdditionalSaveData(dos); + NetherBridgePiece::addAdditonalSaveData(tag); - dos->writeBoolean(hasPlacedMobSpawner); + tag->putBoolean(L"Mob", hasPlacedMobSpawner); } bool NetherBridgePieces::MonsterThrone::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -870,7 +870,6 @@ bool NetherBridgePieces::MonsterThrone::postProcess(Level *level, Random *random int y = getWorldY(5), x = getWorldX(3, 5), z = getWorldZ(3, 5); if (chunkBB->isInside(x, y, z)) { - setDirty(); hasPlacedMobSpawner = true; level->setTileAndData(x, y, z, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr entity = dynamic_pointer_cast( level->getTileEntity(x, y, z) ); @@ -1322,18 +1321,18 @@ NetherBridgePieces::CastleSmallCorridorRightTurnPiece::CastleSmallCorridorRightT isNeedingChest = random->nextInt(3) == 0; } -void NetherBridgePieces::CastleSmallCorridorRightTurnPiece::readAdditonalSaveData(DataInputStream *dis) +void NetherBridgePieces::CastleSmallCorridorRightTurnPiece::readAdditonalSaveData(CompoundTag *tag) { - NetherBridgePiece::readAdditonalSaveData(dis); + NetherBridgePiece::readAdditonalSaveData(tag); - isNeedingChest = dis->readBoolean(); + isNeedingChest = tag->getBoolean(L"Chest"); } -void NetherBridgePieces::CastleSmallCorridorRightTurnPiece::addAdditionalSaveData(DataOutputStream *dos) +void NetherBridgePieces::CastleSmallCorridorRightTurnPiece::addAdditonalSaveData(CompoundTag *tag) { - NetherBridgePiece::addAdditionalSaveData(dos); + NetherBridgePiece::addAdditonalSaveData(tag); - dos->writeBoolean(isNeedingChest); + tag->putBoolean(L"Chest", isNeedingChest); } void NetherBridgePieces::CastleSmallCorridorRightTurnPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) @@ -1381,7 +1380,6 @@ bool NetherBridgePieces::CastleSmallCorridorRightTurnPiece::postProcess(Level *l int x = getWorldX(1, 3), z = getWorldZ(1, 3); if (chunkBB->isInside(x, y, z)) { - setDirty(); isNeedingChest = false; createChest(level, chunkBB, random, 1, 2, 3, WeighedTreasureArray(fortressTreasureItems,FORTRESS_TREASURE_ITEMS_COUNT), 2 + random->nextInt(4)); } @@ -1415,18 +1413,18 @@ NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::CastleSmallCorridorLeftTur isNeedingChest = random->nextInt(3) == 0; } -void NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::readAdditonalSaveData(DataInputStream *dis) +void NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::readAdditonalSaveData(CompoundTag *tag) { - NetherBridgePiece::readAdditonalSaveData(dis); + NetherBridgePiece::readAdditonalSaveData(tag); - isNeedingChest = dis->readBoolean(); + isNeedingChest = tag->getBoolean(L"Chest"); } -void NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::addAdditionalSaveData(DataOutputStream *dos) +void NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::addAdditonalSaveData(CompoundTag *tag) { - NetherBridgePiece::addAdditionalSaveData(dos); + NetherBridgePiece::addAdditonalSaveData(tag); - dos->writeBoolean(isNeedingChest); + tag->putBoolean(L"Chest", isNeedingChest); } void NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::addChildren(StructurePiece *startPiece, list *pieces, Random *random) @@ -1474,7 +1472,6 @@ bool NetherBridgePieces::CastleSmallCorridorLeftTurnPiece::postProcess(Level *le int x = getWorldX(3, 3), z = getWorldZ(3, 3); if (chunkBB->isInside(x, y, z)) { - setDirty(); isNeedingChest = false; createChest(level, chunkBB, random, 3, 2, 3, WeighedTreasureArray(fortressTreasureItems,FORTRESS_TREASURE_ITEMS_COUNT), 2 + random->nextInt(4)); } diff --git a/Minecraft.World/NetherBridgePieces.h b/Minecraft.World/NetherBridgePieces.h index 921515c4..81cb1560 100644 --- a/Minecraft.World/NetherBridgePieces.h +++ b/Minecraft.World/NetherBridgePieces.h @@ -75,8 +75,8 @@ private: protected: NetherBridgePiece(int genDepth); - virtual void readAdditonalSaveData(DataInputStream *dis); - virtual void addAdditionalSaveData(DataOutputStream *dos); + virtual void readAdditonalSaveData(CompoundTag *tag); + virtual void addAdditonalSaveData(CompoundTag *tag); private: int updatePieceWeight(list *currentPieces); @@ -141,8 +141,8 @@ private: virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); protected: - void readAdditonalSaveData(DataInputStream *dis); - void addAdditionalSaveData(DataOutputStream *dos); + void readAdditonalSaveData(CompoundTag *tag); + void addAdditonalSaveData(CompoundTag *tag); }; class BridgeCrossing : public NetherBridgePiece @@ -188,8 +188,8 @@ public: StartPiece(Random *random, int west, int north, Level *level); // 4J Added level param protected: - virtual void readAdditonalSaveData(DataInputStream *dis); - virtual void addAdditionalSaveData(DataOutputStream *dos); + virtual void readAdditonalSaveData(CompoundTag *tag); + virtual void addAdditonalSaveData(CompoundTag *tag); }; private: @@ -249,8 +249,8 @@ private: MonsterThrone(int genDepth, Random *random, BoundingBox *box, int direction); protected: - virtual void readAdditonalSaveData(DataInputStream *dis); - virtual void addAdditionalSaveData(DataOutputStream *dos); + virtual void readAdditonalSaveData(CompoundTag *tag); + virtual void addAdditonalSaveData(CompoundTag *tag); public: static MonsterThrone *createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); @@ -370,8 +370,8 @@ private: CastleSmallCorridorRightTurnPiece(int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - virtual void readAdditonalSaveData(DataInputStream *dis); - virtual void addAdditionalSaveData(DataOutputStream *dos); + virtual void readAdditonalSaveData(CompoundTag *tag); + virtual void addAdditonalSaveData(CompoundTag *tag); public: virtual void addChildren(StructurePiece *startPiece, list *pieces, Random *random); @@ -401,8 +401,8 @@ private: CastleSmallCorridorLeftTurnPiece(int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - virtual void readAdditonalSaveData(DataInputStream *dis); - virtual void addAdditionalSaveData(DataOutputStream *dos); + virtual void readAdditonalSaveData(CompoundTag *tag); + virtual void addAdditonalSaveData(CompoundTag *tag); public: virtual void addChildren(StructurePiece *startPiece, list *pieces, Random *random); diff --git a/Minecraft.World/NewLogTile.cpp b/Minecraft.World/NewLogTile.cpp deleted file mode 100644 index 826468c9..00000000 --- a/Minecraft.World/NewLogTile.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "stdafx.h" -#include "NewLogTile.h" - -const unsigned int NewLogTile::TREE_NAMES[NewLogTile::TREE_NAMES_LENGTH] = { - IDS_TILE_LOG_ACACIA, - IDS_TILE_LOG_DARK_OAK -}; - -NewLogTile::NewLogTile(int id) : LogTile(id) -{ -} - -int NewLogTile::getWoodType(int data) -{ - return (data & MASK_TYPE) + 4; -} \ No newline at end of file diff --git a/Minecraft.World/NewLogTile.h b/Minecraft.World/NewLogTile.h deleted file mode 100644 index 762c7f09..00000000 --- a/Minecraft.World/NewLogTile.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include "LogTile.h" - -class NewLogTile : public LogTile -{ - friend class Tile; -public: - static const int TREE_NAMES_LENGTH = 2; - static const unsigned int TREE_NAMES[TREE_NAMES_LENGTH]; - -protected: - NewLogTile(int id); - -public: - virtual int getWoodType(int data); -}; \ No newline at end of file diff --git a/Minecraft.World/OldLogTile.cpp b/Minecraft.World/OldLogTile.cpp deleted file mode 100644 index eee8e38c..00000000 --- a/Minecraft.World/OldLogTile.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "stdafx.h" -#include "OldLogTile.h" - -OldLogTile::OldLogTile(int id) : LogTile(id) -{ -} \ No newline at end of file diff --git a/Minecraft.World/OldLogTile.h b/Minecraft.World/OldLogTile.h deleted file mode 100644 index 37433d5a..00000000 --- a/Minecraft.World/OldLogTile.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "LogTile.h" - -class OldLogTile : public LogTile -{ - friend class Tile; -protected: - OldLogTile(int id); -}; \ No newline at end of file diff --git a/Minecraft.World/PathFinder.cpp b/Minecraft.World/PathFinder.cpp index e440026c..cf42029f 100644 --- a/Minecraft.World/PathFinder.cpp +++ b/Minecraft.World/PathFinder.cpp @@ -217,7 +217,9 @@ int PathFinder::isFree(Entity *entity, int x, int y, int z, Node *size, bool avo //Use 4J XZY Loops order instead of Mojang XYZ Loops orders for (int xx = x; xx < x + size->x; xx++) + { for (int zz = z; zz < z + size->z; zz++) + { for (int yy = y; yy < y + size->y; yy++) { int tileId = entity->level->getTile(xx, yy, zz); @@ -225,7 +227,7 @@ int PathFinder::isFree(Entity *entity, int x, int y, int z, Node *size, bool avo if(tileId <= 0) continue; - if (TrapDoorTile::isTrapDoor(tileId)) + if (tileId == Tile::trapdoor_Id) walkable = true; else if (tileId == Tile::water_Id || tileId == Tile::calmWater_Id) @@ -236,7 +238,7 @@ int PathFinder::isFree(Entity *entity, int x, int y, int z, Node *size, bool avo walkable = true; continue; } - else if (!canPassDoors && DoorTile::isDoor(tileId)) + else if (!canPassDoors && tileId == Tile::door_wood_Id) return TYPE_BLOCKED; Tile *tile = Tile::tiles[tileId]; @@ -256,26 +258,30 @@ int PathFinder::isFree(Entity *entity, int x, int y, int z, Node *size, bool avo if (tile->isPathfindable(entity->level, xx, yy, zz)) continue; - if (canOpenDoors && DoorTile::isDoor(tileId)) + if (canOpenDoors && tileId == Tile::door_wood_Id) continue; int renderShape = tile->getRenderShape(); - if (renderShape == Tile::SHAPE_FENCE || FenceGateTile::isFenceGate(tileId) || renderShape == Tile::SHAPE_WALL) + if (renderShape == Tile::SHAPE_FENCE || tileId == Tile::fenceGate_Id || renderShape == Tile::SHAPE_WALL) return TYPE_FENCE; - if (TrapDoorTile::isTrapDoor(tileId)) + if (tileId == Tile::trapdoor_Id) return TYPE_TRAP; Material *m = tile->material; if (m == Material::lava) { - if (entity->isInLava()) continue; + if (entity->isInLava()) + continue; + return TYPE_LAVA; } return TYPE_BLOCKED; } + } return walkable ? TYPE_WALKABLE : TYPE_OPEN; + } } // function reconstruct_path(came_from,current_node) diff --git a/Minecraft.World/PineFeature.cpp b/Minecraft.World/PineFeature.cpp index 5f0d9fda..bbe424aa 100644 --- a/Minecraft.World/PineFeature.cpp +++ b/Minecraft.World/PineFeature.cpp @@ -95,7 +95,7 @@ bool PineFeature::place(Level *level, Random *random, int x, int y, int z) for (int hh = 0; hh < treeHeight - 1; hh++) { int t = level->getTile(x, y + hh, z); - if (t == 0 || t == Tile::leaves_Id) placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, LogTile::DARK_TRUNK); + if (t == 0 || t == Tile::leaves_Id) placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, TreeTile::DARK_TRUNK); } return true; diff --git a/Minecraft.World/PistonBaseTile.cpp b/Minecraft.World/PistonBaseTile.cpp index d934b540..a6045637 100644 --- a/Minecraft.World/PistonBaseTile.cpp +++ b/Minecraft.World/PistonBaseTile.cpp @@ -19,7 +19,7 @@ const wstring PistonBaseTile::INSIDE_TEX = L"piston_inner_top"; DWORD PistonBaseTile::tlsIdx = TlsAlloc(); -// TU25 Note: IgnoreUpdate is removed. I need to find what they did. +// TU24 Note: IgnoreUpdate is removed. I need to find what they did. // 4J - NOTE - this ignoreUpdate stuff has been removed from the java version, but I'm not currently sure how the java version does without it... there must be // some other mechanism that we don't have that stops the event from one piston being processed, from causing neighbours to have extra events created for them. @@ -298,6 +298,7 @@ bool PistonBaseTile::triggerEvent(Level *level, int x, int y, int z, int param1, { if (ppe->getFacing() == facing && ppe->isExtending()) { + // force the tile to air before pushing ppe->finalTick(); block = ppe->getId(); blockData = ppe->getData(); diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index d1a1cb1a..7543e508 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -1037,7 +1037,7 @@ void Player::aiStep() tilt += (tTilt - tilt) * 0.8f; - if (getHealth() > 0.0f) // && !isSpectator() + if (getHealth() > 0) { AABB *pickupArea = nullptr; if (riding != nullptr && !riding->removed) @@ -1375,6 +1375,7 @@ float Player::getHeadHeight() return 0.12f; } + void Player::setDefaultHeadHeight() { heightOffset = 1.62f; @@ -1578,7 +1579,7 @@ void Player::removeSelectedItem() double Player::getRidingHeight() { - return -0.35f; + return heightOffset - 0.5f; } void Player::attack(shared_ptr entity) @@ -1814,48 +1815,56 @@ Player::BedSleepingResult Player::startSleepInBed(int x, int y, int z, bool bTes } if (isRiding()) + { ride(nullptr); + } setSize(0.2f, 0.2f); heightOffset = .2f; if (level->hasChunkAt(x, y, z)) { + + int data = level->getData(x, y, z); int direction = BedTile::getDirection(data); float xo = .5f, zo = .5f; switch (direction) { - case Direction::SOUTH: - zo = .9f; + case Direction::SOUTH: + zo = .9f; break; - case Direction::NORTH: - zo = .1f; + case Direction::NORTH: + zo = .1f; break; - case Direction::WEST: - xo = .1f; + case Direction::WEST: + xo = .1f; break; - case Direction::EAST: - xo = .9f; + case Direction::EAST: + xo = .9f; break; } setBedOffset(direction); setPos(x + xo, y + 15.0f / 16.0f, z + zo); } else + { setPos(x + .5f, y + 15.0f / 16.0f, z + .5f); - + } m_isSleeping = true; sleepCounter = 0; bedPosition = new Pos(x, y, z); xd = zd = yd = 0; if (!level->isClientSide) + { level->updateSleepingPlayerList(); + } return OK; } + void Player::setBedOffset(int bedDirection) { // place position on pillow and feet at bottom @@ -1864,21 +1873,22 @@ void Player::setBedOffset(int bedDirection) switch (bedDirection) { - case Direction::SOUTH: - bedOffsetZ = -1.8f; + case Direction::SOUTH: + bedOffsetZ = -1.8f; break; - case Direction::NORTH: - bedOffsetZ = 1.8f; + case Direction::NORTH: + bedOffsetZ = 1.8f; break; - case Direction::WEST: - bedOffsetX = 1.8f; + case Direction::WEST: + bedOffsetX = 1.8f; break; - case Direction::EAST: - bedOffsetX = -1.8f; + case Direction::EAST: + bedOffsetX = -1.8f; break; } } + /** * * @param forcefulWakeUp @@ -1893,7 +1903,6 @@ void Player::setBedOffset(int bedDirection) */ void Player::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool saveRespawnPoint) { -// setSize(0.6f, 1.8f); setDefaultHeadHeight(); @@ -1906,29 +1915,38 @@ void Player::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool save standUp = BedTile::findStandUpPosition(level, pos->x, pos->y, pos->z, 0); if (standUp == nullptr) + { standUp = new Pos(pos->x, pos->y + 1, pos->z); - + } setPos(standUp->x + .5f, standUp->y + heightOffset + .1f, standUp->z + .5f); } m_isSleeping = false; if (!level->isClientSide && updateLevelList) + { level->updateSleepingPlayerList(); - + } if (forcefulWakeUp) + { sleepCounter = 0; + } else + { sleepCounter = SLEEP_DURATION; - + } if (saveRespawnPoint) + { setRespawnPosition(bedPosition, false); + } } + bool Player::checkBed() { return (level->getTile(bedPosition->x, bedPosition->y, bedPosition->z) == Tile::bed_Id); } + Pos *Player::checkBedValidRespawnPosition(Level *level, Pos *pos, bool forced) { // make sure the chunks around the bed exist @@ -1947,8 +1965,9 @@ Pos *Player::checkBedValidRespawnPosition(Level *level, Pos *pos, bool forced) bool freeHead = !topMaterial->isSolid() && !topMaterial->isLiquid(); if (forced && freeFeet && freeHead) + { return pos; - + } return nullptr; } // make sure the bed still has a stand-up position @@ -1965,14 +1984,14 @@ float Player::getSleepRotation() switch (direction) { - case Direction::SOUTH: - return 90; - case Direction::WEST: - return 0; - case Direction::NORTH: - return 270; - case Direction::EAST: - return 180; + case Direction::SOUTH: + return 90; + case Direction::WEST: + return 0; + case Direction::NORTH: + return 270; + case Direction::EAST: + return 180; } } return 0; @@ -2008,17 +2027,25 @@ void Player::setPlayerFlag(int flag, bool value) { BYTE currentValue = entityData->getByte(DATA_PLAYER_FLAGS_ID); if (value) + { entityData->set(DATA_PLAYER_FLAGS_ID, static_cast(currentValue | (1 << flag))); + } else + { entityData->set(DATA_PLAYER_FLAGS_ID, static_cast(currentValue & ~(1 << flag))); + } } + /** * This method is currently only relevant to client-side players. It will * try to load the messageId from the language file and display it to the * client. */ -void Player::displayClientMessage(int messageId) {} +void Player::displayClientMessage(int messageId) +{ + +} Pos *Player::getRespawnPosition() { @@ -2047,9 +2074,12 @@ void Player::setRespawnPosition(Pos *respawnPosition, bool forced) void Player::awardStat(Stat *stat, byteArray paramBlob) { if (paramBlob.data != nullptr) + { delete [] paramBlob.data; + } } + void Player::jumpFromGround() { LivingEntity::jumpFromGround(); @@ -2058,11 +2088,16 @@ void Player::jumpFromGround() //awardStat(Stats::jump, 1); if (isSprinting()) + { causeFoodExhaustion(FoodConstants::EXHAUSTION_SPRINT_JUMP); + } else + { causeFoodExhaustion(FoodConstants::EXHAUSTION_JUMP); + } } + void Player::travel(float xa, float ya) { double preX = x, preY = y, preZ = z; @@ -2077,7 +2112,9 @@ void Player::travel(float xa, float ya) flyingSpeed = ofs; } else + { LivingEntity::travel(xa, ya); + } checkMovementStatistiscs(x - preX, y - preY, z - preZ); } @@ -2089,9 +2126,11 @@ float Player::getSpeed() void Player::checkMovementStatistiscs(double dx, double dy, double dz) { - if (riding != nullptr) - return; + if (riding != nullptr) + { + return; + } if (isUnderLiquid(Material::water)) { int distance = static_cast(Math::round(sqrt(dx * dx + dy * dy + dz * dz) * 100.0f)); @@ -2142,13 +2181,18 @@ void Player::checkMovementStatistiscs(double dx, double dy, double dz) awardStat( GenericStats::walkOneM(), GenericStats::param_walk(newDistance/100) ); } if (isSprinting()) + { causeFoodExhaustion(FoodConstants::EXHAUSTION_SPRINT * horizontalDistance * .01f); + } else + { causeFoodExhaustion(FoodConstants::EXHAUSTION_WALK * horizontalDistance * .01f); + } } } } + void Player::checkRidingStatistiscs(double dx, double dy, double dz) { if (riding != nullptr) @@ -2168,8 +2212,9 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) int dist = 0; if (minecartAchievementPos == nullptr) + { minecartAchievementPos = new Pos(Mth::floor(x), Mth::floor(y), Mth::floor(z)); - + } // 4J-PB - changed this because our world isn't big enough to go 1000m else { @@ -2182,7 +2227,9 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) if(dist < 500) { if((dist>0) && (dist%100==0)) + { awardStat(GenericStats::onARail(), GenericStats::param_onARail(dist)); + } } else { @@ -2224,6 +2271,7 @@ void Player::checkRidingStatistiscs(double dx, double dy, double dz) } } + void Player::causeFallDamage(float distance) { if (abilities.mayfly) return; @@ -2241,6 +2289,7 @@ void Player::causeFallDamage(float distance) LivingEntity::causeFallDamage(distance); } + void Player::killed(shared_ptr mob) { // 4J-PB - added the lavaslime enemy - fix for #64007 - TU7: Code: Achievements: TCR#073: Killing Magma Cubes doesn't unlock "Monster Hunter" Achievement. @@ -2250,67 +2299,78 @@ void Player::killed(shared_ptr mob) switch( mob->GetType() ) { - case eTYPE_CREEPER: - awardStat(GenericStats::killsCreeper(), GenericStats::param_noArgs()); + case eTYPE_CREEPER: + awardStat(GenericStats::killsCreeper(), GenericStats::param_noArgs()); break; - case eTYPE_SKELETON: - if( mob->isRiding() && mob->riding->GetType() == eTYPE_SPIDER ) - awardStat(GenericStats::killsSpiderJockey(), GenericStats::param_noArgs()); - else - awardStat(GenericStats::killsSkeleton(), GenericStats::param_noArgs()); + case eTYPE_SKELETON: + if( mob->isRiding() && mob->riding->GetType() == eTYPE_SPIDER ) + awardStat(GenericStats::killsSpiderJockey(), GenericStats::param_noArgs()); + else + awardStat(GenericStats::killsSkeleton(), GenericStats::param_noArgs()); break; - case eTYPE_SPIDER: - if( mob->rider.lock() != nullptr && mob->rider.lock()->GetType() == eTYPE_SKELETON ) - awardStat(GenericStats::killsSpiderJockey(), GenericStats::param_noArgs()); - else - awardStat(GenericStats::killsSpider(), GenericStats::param_noArgs()); + case eTYPE_SPIDER: + if( mob->rider.lock() != nullptr && mob->rider.lock()->GetType() == eTYPE_SKELETON ) + awardStat(GenericStats::killsSpiderJockey(), GenericStats::param_noArgs()); + else + awardStat(GenericStats::killsSpider(), GenericStats::param_noArgs()); break; - case eTYPE_ZOMBIE: - awardStat(GenericStats::killsZombie(), GenericStats::param_noArgs()); + case eTYPE_ZOMBIE: + awardStat(GenericStats::killsZombie(), GenericStats::param_noArgs()); break; - case eTYPE_PIGZOMBIE: - if( level->dimension->id == 0 ) - awardStat(GenericStats::killsZombiePigman(), GenericStats::param_noArgs()); - else - awardStat(GenericStats::killsNetherZombiePigman(), GenericStats::param_noArgs()); + case eTYPE_PIGZOMBIE: + if( level->dimension->id == 0 ) + awardStat(GenericStats::killsZombiePigman(), GenericStats::param_noArgs()); + else + awardStat(GenericStats::killsNetherZombiePigman(), GenericStats::param_noArgs()); break; - case eTYPE_GHAST: - awardStat(GenericStats::killsGhast(), GenericStats::param_noArgs()); + case eTYPE_GHAST: + awardStat(GenericStats::killsGhast(), GenericStats::param_noArgs()); break; - case eTYPE_SLIME: - awardStat(GenericStats::killsSlime(), GenericStats::param_noArgs()); + case eTYPE_SLIME: + awardStat(GenericStats::killsSlime(), GenericStats::param_noArgs()); break; - case eTYPE_ENDERDRAGON: - awardStat(GenericStats::killsEnderdragon(), GenericStats::param_noArgs()); + case eTYPE_ENDERDRAGON: + awardStat(GenericStats::killsEnderdragon(), GenericStats::param_noArgs()); break; } } else if( mob->GetType() == eTYPE_COW ) + { awardStat(GenericStats::killCow(), GenericStats::param_noArgs()); + } } void Player::makeStuckInWeb() { - if (!abilities.flying) - LivingEntity::makeStuckInWeb(); + if (!abilities.flying) LivingEntity::makeStuckInWeb(); } Icon *Player::getItemInHandIcon(shared_ptr item, int layer) { Icon *icon = LivingEntity::getItemInHandIcon(item, layer); if (item->id == Item::fishingRod->id && fishing != nullptr) + { icon = Item::fishingRod->getEmptyIcon(); + } else if (item->getItem()->hasMultipleSpriteLayers()) + { return item->getItem()->getLayerIcon(item->getAuxValue(), layer); + } else if (useItem != nullptr && item->id == Item::bow_Id) { int ticksHeld = (item->getUseDuration() - useItemDuration); if (ticksHeld >= BowItem::MAX_DRAW_DURATION - 2) + { return Item::bow->getDrawnIcon(2); + } if (ticksHeld > (2 * BowItem::MAX_DRAW_DURATION) / 3) + { return Item::bow->getDrawnIcon(1); + } if (ticksHeld > 0) + { return Item::bow->getDrawnIcon(0); + } } return icon; } @@ -2325,8 +2385,9 @@ void Player::increaseXp(int i) increaseScore(i); int max = INT_MAX - totalExperience; if (i > max) + { i = max; - + } experienceProgress += static_cast(i) / getXpNeededForNextLevel(); totalExperience += i; while (experienceProgress >= 1) @@ -2359,11 +2420,13 @@ int Player::getXpNeededForNextLevel() { // Update xp calculations from 1.3 if (experienceLevel >= 30) + { return 17 + 15 * 3 + (experienceLevel - 30) * 7; - + } if (experienceLevel >= 15) + { return 17 + (experienceLevel - 15) * 3; - + } return 17; } @@ -2378,17 +2441,16 @@ int Player::getXpNeededForNextLevel() */ void Player::causeFoodExhaustion(float amount) { - if( isAllowedToIgnoreExhaustion() || ( isAllowedToFly() && abilities.flying) ) - return; - if (abilities.invulnerable || hasInvulnerablePrivilege() ) - return; + if( isAllowedToIgnoreExhaustion() || ( isAllowedToFly() && abilities.flying) ) return; + if (abilities.invulnerable || hasInvulnerablePrivilege() ) return; // 4J Stu - Added 1.8.2 bug fix (TU6) - If players cannot eat, then their food bar should not decrease due to exhaustion - if(app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) != 0) - return; + if(app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) != 0) return; if (!level->isClientSide) + { foodData.addExhaustion(amount); + } } FoodData *Player::getFoodData() @@ -2408,14 +2470,13 @@ bool Player::isHurt() void Player::startUsingItem(shared_ptr instance, int duration) { - if (instance == useItem) - return; - + if (instance == useItem) return; useItem = instance; useItemDuration = duration; - if (!level->isClientSide) + { setUsingItemFlag(true); + } // 4J-JEV, hook for ItemUsed event, and ironbelly achievement. awardStat(GenericStats::itemsUsed(instance->getItem()->id), @@ -2427,29 +2488,28 @@ void Player::startUsingItem(shared_ptr instance, int duration) #endif } -bool Player::mayBuild() -{ - return abilities.mayBuild; -} - bool Player::mayDestroyBlockAt(int x, int y, int z) { if (abilities.mayBuild) - return true; - - int t = level->getTile(x, y, z); - if (t > 0) { + return true; + } + int t = level->getTile(x, y, z); + if (t > 0) { Tile *tile = Tile::tiles[t]; if (tile->material->isDestroyedByHand()) + { return true; + } else if (getSelectedItem() != nullptr) { shared_ptr carried = getSelectedItem(); if (carried->canDestroySpecial(tile) || carried->getDestroySpeed(tile) > 1) + { return true; + } } } return false; @@ -2458,22 +2518,24 @@ bool Player::mayDestroyBlockAt(int x, int y, int z) bool Player::mayUseItemAt(int x, int y, int z, int face, shared_ptr item) { if (abilities.mayBuild) + { return true; + } if (item != nullptr) + { return item->mayBePlacedInAdventureMode(); - + } return false; } int Player::getExperienceReward(shared_ptr killedBy) { - if (level->getGameRules()->getBoolean(GameRules::RULE_KEEPINVENTORY)) - return 0; - + if (level->getGameRules()->getBoolean(GameRules::RULE_KEEPINVENTORY)) return 0; int reward = experienceLevel * 7; if (reward > 100) + { return 100; - + } return reward; } @@ -2526,9 +2588,13 @@ bool Player::makeStepSound() return !abilities.flying; } -void Player::onUpdateAbilities() {} +void Player::onUpdateAbilities() +{ +} -void Player::setGameMode(GameType *mode) {} +void Player::setGameMode(GameType *mode) +{ +} wstring Player::getName() { @@ -2616,83 +2682,29 @@ float Player::getAbsorptionAmount() return getEntityData()->getFloat(DATA_PLAYER_ABSORPTION_ID); } -float Player::getEyeHeight() // TU25 Addition -{ -/* - //TODO: Need the LCE one. This is from java - float f = 1.62F; - - if (isSleeping()) - f = 0.2F; - - if (isSneaking()) - f -= 0.08F; - - return f; -*/ - - float height = 1.62f; - - if ( isSleeping() ) - { - height = 0.2f; - - return height; - } - - if ( isRiding() ) - height = bbHeight * 0.85f; - - if ( this->isSneaking() ) - height -= 0.08f; - - return height; -} - -/* -void Player::UpdateSize() // TU25 Addition -{ -// if ( isSneaking() && isSwimming() || isInForcedSneak() ) -// return setSize(0.2f); -// else - return setSize(0.6f, 1.8f); -} - -void Player::SetNormalSize() // TU25 Addition -{ -// if ( isSneaking() && isSwimming() || isInForcedSneak() ) -// return setSize(0.2f); -// else - return setSize(0.6f, 1.8f); -} - -int Player::SetSmallSize() // TU25 Addition -{ - return setSize(0.2f); -} -*/ int Player::getTexture() { switch(m_skinIndex) { - case eDefaultSkins_Skin0: - return TN_MOB_CHAR; // 4J - was L"/mob/char.png"; - case eDefaultSkins_Skin1: - return TN_MOB_CHAR1; // 4J - was L"/mob/char1.png"; - case eDefaultSkins_Skin2: - return TN_MOB_CHAR2; // 4J - was L"/mob/char2.png"; - case eDefaultSkins_Skin3: - return TN_MOB_CHAR3; // 4J - was L"/mob/char3.png"; - case eDefaultSkins_Skin4: - return TN_MOB_CHAR4; // 4J - was L"/mob/char4.png"; - case eDefaultSkins_Skin5: - return TN_MOB_CHAR5; // 4J - was L"/mob/char5.png"; - case eDefaultSkins_Skin6: - return TN_MOB_CHAR6; // 4J - was L"/mob/char6.png"; - case eDefaultSkins_Skin7: - return TN_MOB_CHAR7; // 4J - was L"/mob/char7.png"; - default: - return TN_MOB_CHAR; // 4J - was L"/mob/char.png"; + case eDefaultSkins_Skin0: + return TN_MOB_CHAR; // 4J - was L"/mob/char.png"; + case eDefaultSkins_Skin1: + return TN_MOB_CHAR1; // 4J - was L"/mob/char1.png"; + case eDefaultSkins_Skin2: + return TN_MOB_CHAR2; // 4J - was L"/mob/char2.png"; + case eDefaultSkins_Skin3: + return TN_MOB_CHAR3; // 4J - was L"/mob/char3.png"; + case eDefaultSkins_Skin4: + return TN_MOB_CHAR4; // 4J - was L"/mob/char4.png"; + case eDefaultSkins_Skin5: + return TN_MOB_CHAR5; // 4J - was L"/mob/char5.png"; + case eDefaultSkins_Skin6: + return TN_MOB_CHAR6; // 4J - was L"/mob/char6.png"; + case eDefaultSkins_Skin7: + return TN_MOB_CHAR7; // 4J - was L"/mob/char7.png"; + + default: + return TN_MOB_CHAR; // 4J - was L"/mob/char.png"; } } @@ -2712,6 +2724,7 @@ bool Player::eq_test(const shared_ptr x, const shared_ptr y) return x->name.compare( y->name ) == 0; // 4J Stu - Names are completely unique? } + unsigned int Player::getPlayerGamePrivilege(EPlayerGamePrivileges privilege) { return Player::getPlayerGamePrivilege(m_uiGamePrivileges,privilege); @@ -2720,10 +2733,13 @@ unsigned int Player::getPlayerGamePrivilege(EPlayerGamePrivileges privilege) unsigned int Player::getPlayerGamePrivilege(unsigned int uiGamePrivileges, EPlayerGamePrivileges privilege) { if( privilege == ePlayerGamePrivilege_All ) + { return uiGamePrivileges; + } else if (privilege < ePlayerGamePrivilege_MAX ) + { return uiGamePrivileges&(1<id) { - case Tile::button_stone_Id: - case Tile::button_wood_Id: - case Tile::lever_Id: - case Tile::trapdoor_Id: - case Tile::iron_trapdoor_Id: - case Tile::comparator_off_Id: - case Tile::comparator_on_Id: - case Tile::daylightDetector_Id: - case Tile::daylightDetectorInverted_Id: - allowed = true; - break; - default: - allowed = DoorTile::isDoor(tile->id) || FenceGateTile::isFenceGate(tile->id); - break; + case Tile::door_wood_Id: + case Tile::button_stone_Id: + case Tile::button_wood_Id: + case Tile::lever_Id: + case Tile::fenceGate_Id: + case Tile::trapdoor_Id: + allowed = true; + break; } } @@ -2813,20 +2829,16 @@ bool Player::isAllowedToUse(Tile *tile) { switch(tile->id) { - case Tile::dispenser_Id: - case Tile::chest_Id: - case Tile::furnace_Id: - case Tile::furnace_lit_Id: - case Tile::workBench_Id: - case Tile::enchantTable_Id: - case Tile::brewingStand_Id: - case Tile::enderChest_Id: - case Tile::beacon_Id: - case Tile::anvil_Id: - case Tile::chest_trap_Id: - case Tile::hopper_Id: - case Tile::dropper_Id: - allowed = true; + case Tile::chest_Id: + case Tile::furnace_Id: + case Tile::furnace_lit_Id: + case Tile::dispenser_Id: + case Tile::brewingStand_Id: + case Tile::enchantTable_Id: + case Tile::workBench_Id: + case Tile::anvil_Id: + case Tile::enderChest_Id: + allowed = true; break; } } @@ -2835,32 +2847,25 @@ bool Player::isAllowedToUse(Tile *tile) { switch(tile->id) { - case Tile::button_stone_Id: - case Tile::button_wood_Id: - case Tile::lever_Id: - case Tile::trapdoor_Id: - case Tile::iron_trapdoor_Id: - case Tile::comparator_off_Id: - case Tile::comparator_on_Id: - case Tile::daylightDetector_Id: - case Tile::daylightDetectorInverted_Id: - case Tile::dispenser_Id: - case Tile::chest_Id: - case Tile::furnace_Id: - case Tile::furnace_lit_Id: - case Tile::workBench_Id: - case Tile::enchantTable_Id: - case Tile::brewingStand_Id: - case Tile::enderChest_Id: - case Tile::beacon_Id: - case Tile::anvil_Id: - case Tile::chest_trap_Id: - case Tile::hopper_Id: - case Tile::dropper_Id: - allowed = false; + case Tile::door_wood_Id: + case Tile::button_stone_Id: + case Tile::button_wood_Id: + case Tile::lever_Id: + case Tile::fenceGate_Id: + case Tile::trapdoor_Id: + case Tile::chest_Id: + case Tile::furnace_Id: + case Tile::furnace_lit_Id: + case Tile::dispenser_Id: + case Tile::brewingStand_Id: + case Tile::enchantTable_Id: + case Tile::workBench_Id: + case Tile::anvil_Id: + case Tile::enderChest_Id: + allowed = false; break; - default: - allowed = !(DoorTile::isDoor(tile->id) || FenceGateTile::isFenceGate(tile->id)); + default: + allowed = true; break; } } @@ -2875,35 +2880,37 @@ bool Player::isAllowedToUse(shared_ptr item) if(item != nullptr && app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) { if(getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) != 0) + { allowed = false; + } // 4J Stu - TU8 Players should always be able to eat food items, even if the build option is turned of switch(item->id) { // food - case Item::mushroomStew_Id: - case Item::apple_Id: - case Item::bread_Id: - case Item::porkChop_raw_Id: - case Item::porkChop_cooked_Id: - case Item::apple_gold_Id: - case Item::fish_raw_Id: - case Item::fish_cooked_Id: - case Item::cookie_Id: - case Item::beef_cooked_Id: - case Item::beef_raw_Id: - case Item::chicken_cooked_Id: - case Item::chicken_raw_Id: - case Item::melon_Id: - case Item::rotten_flesh_Id: + case Item::mushroomStew_Id: + case Item::apple_Id: + case Item::bread_Id: + case Item::porkChop_raw_Id: + case Item::porkChop_cooked_Id: + case Item::apple_gold_Id: + case Item::fish_raw_Id: + case Item::fish_cooked_Id: + case Item::cookie_Id: + case Item::beef_cooked_Id: + case Item::beef_raw_Id: + case Item::chicken_cooked_Id: + case Item::chicken_raw_Id: + case Item::melon_Id: + case Item::rotten_flesh_Id: // bow - case Item::bow_Id: - case Item::sword_diamond_Id: - case Item::sword_gold_Id: - case Item::sword_iron_Id: - case Item::sword_stone_Id: - case Item::sword_wood_Id: - allowed = true; + case Item::bow_Id: + case Item::sword_diamond_Id: + case Item::sword_gold_Id: + case Item::sword_iron_Id: + case Item::sword_stone_Id: + case Item::sword_wood_Id: + allowed = true; break; } } @@ -2929,10 +2936,14 @@ bool Player::isAllowedToInteract(shared_ptr target) else { if(getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotBuild) != 0) + { allowed = false; + } if(getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotMine) != 0) + { allowed = false; + } } } @@ -2945,7 +2956,9 @@ bool Player::isAllowedToMine() if(app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) { if(getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotMine) != 0) + { allowed = false; + } } return allowed; } @@ -2954,8 +2967,9 @@ bool Player::isAllowedToAttackPlayers() { bool allowed = true; if( hasInvisiblePrivilege() || ((app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotAttackPlayers)) ) + { allowed = false; - + } return allowed; } @@ -2963,8 +2977,9 @@ bool Player::isAllowedToAttackAnimals() { bool allowed = true; if( (app.GetGameHostOption(eGameHostOption_TrustPlayers) == 0) && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CannotAttackAnimals) ) + { allowed = false; - + } return allowed; } @@ -2976,14 +2991,16 @@ bool Player::isAllowedToHurtEntity(shared_ptr target) { switch(target->GetType()) { - case eTYPE_HANGING_ENTITY: - case eTYPE_PAINTING: - case eTYPE_ITEM_FRAME: - // 4J-JEV: Fix for #88212, - // Untrusted players shouldn't be able to damage minecarts or boats. - case eTYPE_BOAT: - case eTYPE_MINECART: - allowed = false; + case eTYPE_HANGING_ENTITY: + case eTYPE_PAINTING: + case eTYPE_ITEM_FRAME: + + // 4J-JEV: Fix for #88212, + // Untrusted players shouldn't be able to damage minecarts or boats. + case eTYPE_BOAT: + case eTYPE_MINECART: + + allowed = false; break; }; } @@ -2994,17 +3011,20 @@ bool Player::isAllowedToFly() { bool allowed = false; if(app.GetGameHostOption(eGameHostOption_HostCanFly) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CanFly) != 0) + { allowed = true; - + } return allowed; } bool Player::isAllowedToIgnoreExhaustion() { bool allowed = false; - if( (app.GetGameHostOption(eGameHostOption_HostCanChangeHunger) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_ClassicHunger) != 0) || (isAllowedToFly() && abilities.flying) ) + if( (app.GetGameHostOption(eGameHostOption_HostCanChangeHunger) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_ClassicHunger) != 0) || + (isAllowedToFly() && abilities.flying) ) + { allowed = true; - + } return allowed; } @@ -3012,8 +3032,9 @@ bool Player::isAllowedToTeleport() { bool allowed = false; if( isModerator() && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_CanTeleport) != 0) + { allowed = true; - + } return allowed; } @@ -3021,8 +3042,9 @@ bool Player::hasInvisiblePrivilege() { bool enabled = false; if(app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invisible) != 0) + { enabled = true; - + } return enabled; } @@ -3030,8 +3052,9 @@ bool Player::hasInvulnerablePrivilege() { bool enabled = false; if(app.GetGameHostOption(eGameHostOption_HostCanBeInvisible) != 0 && getPlayerGamePrivilege(Player::ePlayerGamePrivilege_Invulnerable) != 0) + { enabled = true; - + } return enabled; } @@ -3072,8 +3095,9 @@ vector *Player::GetAdditionalModelParts() // If it's a default texture (which has no parts), we have the parts, or we already have the texture (in which case we should have parts if there are any) then we are done if(!hasCustomTexture || customTextureIsDefaultSkin || m_ppAdditionalModelParts != nullptr || app.IsFileInMemoryTextures(customTextureUrl)) + { m_bCheckedForModelParts=true; - + } if(m_ppAdditionalModelParts == nullptr && !m_bCheckedDLCForModelParts) { m_bCheckedDLCForModelParts = true; @@ -3119,8 +3143,13 @@ Player::ePlayerNameValidState Player::GetPlayerNameValidState(void) void Player::SetPlayerNameValidState(bool bState) { if(bState) + { m_ePlayerNameValidState=ePlayerNameValid_True; + } else + { m_ePlayerNameValidState=ePlayerNameValid_False; + + } } -#endif \ No newline at end of file +#endif diff --git a/Minecraft.World/Player.h b/Minecraft.World/Player.h index 47fd4f51..f77a946b 100644 --- a/Minecraft.World/Player.h +++ b/Minecraft.World/Player.h @@ -352,7 +352,6 @@ public: bool canEat(bool magicalItem); bool isHurt(); virtual void startUsingItem(shared_ptr instance, int duration); - virtual bool mayBuild(); virtual bool mayDestroyBlockAt(int x, int y, int z); virtual bool mayUseItemAt(int x, int y, int z, int face, shared_ptr item); @@ -390,8 +389,6 @@ public: virtual Team *getTeam(); virtual void setAbsorptionAmount(float absorptionAmount); virtual float getAbsorptionAmount(); - // TU25 Addition - virtual float getEyeHeight(); //////// 4J ///////////////// diff --git a/Minecraft.World/PrimedTnt.cpp b/Minecraft.World/PrimedTnt.cpp index cd9c14c9..6a0f2a48 100644 --- a/Minecraft.World/PrimedTnt.cpp +++ b/Minecraft.World/PrimedTnt.cpp @@ -45,7 +45,9 @@ PrimedTnt::PrimedTnt(Level *level, double x, double y, double z, shared_ptrowner = weak_ptr(owner); } -void PrimedTnt::defineSynchedData() {} +void PrimedTnt::defineSynchedData() +{ +} bool PrimedTnt::makeStepSound() { @@ -80,18 +82,25 @@ void PrimedTnt::tick() { remove(); if (!level->isClientSide) + { explode(); + } } else + { level->addParticle(eParticleType_smoke, x, y + 0.5f, z, 0, 0, 0); + } + } + void PrimedTnt::explode() { float r = 4.0f; level->explode(shared_from_this(), x, y, z, r, true); } + void PrimedTnt::addAdditonalSaveData(CompoundTag *entityTag) { entityTag->putByte(L"Fuse", static_cast(life)); @@ -110,10 +119,4 @@ float PrimedTnt::getShadowHeightOffs() shared_ptr PrimedTnt::getOwner() { return owner.lock(); -} - -// TU25 Addition -float PrimedTnt::getEyeHeight() -{ - return 0.0f; } \ No newline at end of file diff --git a/Minecraft.World/PrimedTnt.h b/Minecraft.World/PrimedTnt.h index ed50037f..0b65a5ca 100644 --- a/Minecraft.World/PrimedTnt.h +++ b/Minecraft.World/PrimedTnt.h @@ -36,6 +36,4 @@ protected: public: virtual float getShadowHeightOffs(); virtual shared_ptr getOwner(); - // TU25 Addition - virtual float getEyeHeight(); }; diff --git a/Minecraft.World/Recipes.cpp b/Minecraft.World/Recipes.cpp index b305ea42..aea505eb 100644 --- a/Minecraft.World/Recipes.cpp +++ b/Minecraft.World/Recipes.cpp @@ -51,39 +51,35 @@ Recipes::Recipes() pFireworksRecipes = new FireworksRecipe(); - addShapedRecipy(new ItemInstance(Tile::wood, 4, LogTile::OAK_TRUNK), // + addShapedRecipy(new ItemInstance(Tile::wood, 4, 0), // L"sczg", L"#", // - L'#', new ItemInstance(Tile::treeTrunk, 1, LogTile::OAK_TRUNK), + L'#', new ItemInstance(Tile::treeTrunk, 1, 0), L'S'); // TU9 - adding coloured wood - addShapedRecipy(new ItemInstance(Tile::wood, 4, LogTile::BIRCH_TRUNK), // + addShapedRecipy(new ItemInstance(Tile::wood, 4, TreeTile::BIRCH_TRUNK), // L"sczg", L"#", // - L'#', new ItemInstance(Tile::treeTrunk, 1, LogTile::BIRCH_TRUNK), + L'#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::BIRCH_TRUNK), L'S'); - addShapedRecipy(new ItemInstance(Tile::wood, 4, LogTile::DARK_TRUNK), // + addShapedRecipy(new ItemInstance(Tile::wood, 4, TreeTile::DARK_TRUNK), // L"sczg", L"#", // - L'#', new ItemInstance(Tile::treeTrunk, 1, LogTile::DARK_TRUNK), + L'#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::DARK_TRUNK), L'S'); - addShapedRecipy(new ItemInstance(Tile::wood, 4, LogTile::JUNGLE_TRUNK), // + addShapedRecipy(new ItemInstance(Tile::wood, 4, TreeTile::JUNGLE_TRUNK), // L"sczg", L"#", // - L'#', new ItemInstance(Tile::treeTrunk, 1, LogTile::JUNGLE_TRUNK), + L'#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::JUNGLE_TRUNK), L'S'); -#if TO_BE_IMPLEMENTED // TU31 - // Tile::newTreeTrunk (LogTile::ACACIA_TRUNK and LogTile::DARK_OAK_TRUNK) -#endif - addShapedRecipy(new ItemInstance(Item::stick, 4), // L"ssctg", L"#", // @@ -135,87 +131,21 @@ Recipes::Recipes() L'S'); addShapedRecipy(new ItemInstance(Tile::fenceGate, 1), // - L"ssciczg", + L"sscictg", L"#W#", // L"#W#", // - L'#', Item::stick, - L'W', new ItemInstance(Tile::wood, 1, LogTile::OAK_TRUNK), - L'S'); + L'#', Item::stick, L'W', Tile::wood, + L'S'); - addShapedRecipy(new ItemInstance(Tile::birchFenceGate, 1), // - L"ssciczg", - L"#W#", // - L"#W#", // + addShapedRecipy(new ItemInstance(Tile::fence, 2), // + L"sscig", + L"###", // + L"###", // L'#', Item::stick, - L'W', new ItemInstance(Tile::wood, 1, LogTile::BIRCH_TRUNK), L'S'); - addShapedRecipy(new ItemInstance(Tile::spruceFenceGate, 1), // - L"ssciczg", - L"#W#", // - L"#W#", // - - L'#', Item::stick, - L'W', new ItemInstance(Tile::wood, 1, LogTile::DARK_TRUNK), - L'S'); - - addShapedRecipy(new ItemInstance(Tile::jungleFenceGate, 1), // - L"ssciczg", - L"#W#", // - L"#W#", // - - L'#', Item::stick, - L'W', new ItemInstance(Tile::wood, 1, LogTile::JUNGLE_TRUNK), - L'S'); - -#if TO_BE_IMPLEMENTED // TU31 - // Tile::acaciaFenceGate - // Tile::darkOakFenceGate -#endif - - addShapedRecipy(new ItemInstance(Tile::fence, 3), // - L"ssciczg", - L"W#W", // - L"W#W", // - - L'#', Item::stick, - L'W', new ItemInstance(Tile::wood, 1, LogTile::OAK_TRUNK), - L'S'); - - addShapedRecipy(new ItemInstance(Tile::birchFence, 3), // - L"ssciczg", - L"W#W", // - L"W#W", // - - L'#', Item::stick, - L'W', new ItemInstance(Tile::wood, 1, LogTile::BIRCH_TRUNK), - L'S'); - - addShapedRecipy(new ItemInstance(Tile::spruceFence, 3), // - L"ssciczg", - L"W#W", // - L"W#W", // - - L'#', Item::stick, - L'W', new ItemInstance(Tile::wood, 1, LogTile::DARK_TRUNK), - L'S'); - - addShapedRecipy(new ItemInstance(Tile::jungleFence, 3), // - L"ssciczg", - L"W#W", // - L"W#W", // - - L'#', Item::stick, - L'W', new ItemInstance(Tile::wood, 1, LogTile::JUNGLE_TRUNK), - L'S'); - -#if TO_BE_IMPLEMENTED // TU31 - // Tile::acaciaFence - // Tile::darkOakFence -#endif - addShapedRecipy(new ItemInstance(Tile::netherFence, 6), // L"ssctg", L"###", // @@ -248,48 +178,16 @@ Recipes::Recipes() L'#', Tile::mossyCobblestone, L'S'); - addShapedRecipy(new ItemInstance(Item::door_wood, 3), // - L"sssczg", + addShapedRecipy(new ItemInstance(Item::door_wood, 1), // + L"sssctg", L"##", // L"##", // L"##", // - L'#', new ItemInstance(Tile::wood, 1, LogTile::OAK_TRUNK), + L'#', Tile::wood, L'S'); - addShapedRecipy(new ItemInstance(Item::door_birch, 3), // - L"sssczg", - L"##", // - L"##", // - L"##", // - - L'#', new ItemInstance(Tile::wood, 1, LogTile::BIRCH_TRUNK), - L'S'); - - addShapedRecipy(new ItemInstance(Item::door_spruce, 3), // - L"sssczg", - L"##", // - L"##", // - L"##", // - - L'#', new ItemInstance(Tile::wood, 1, LogTile::DARK_TRUNK), - L'S'); - - addShapedRecipy(new ItemInstance(Item::door_jungle, 3), // - L"sssczg", - L"##", // - L"##", // - L"##", // - - L'#', new ItemInstance(Tile::wood, 1, LogTile::JUNGLE_TRUNK), - L'S'); - -#if TO_BE_IMPLEMENTED // TU31 - // Item::door_acacia - // Item::door_dark_oak -#endif - - addShapedRecipy(new ItemInstance(Item::door_iron, 3), // + addShapedRecipy(new ItemInstance(Item::door_iron, 1), // L"ssscig", L"##", // L"##", // @@ -304,7 +202,7 @@ Recipes::Recipes() L"## ", // L"###", // - L'#', new ItemInstance(Tile::wood, 1, LogTile::OAK_TRUNK), + L'#', new ItemInstance(Tile::wood, 1, 0), L'S'); addShapedRecipy(new ItemInstance(Tile::trapdoor, 2), // @@ -314,15 +212,6 @@ Recipes::Recipes() L'#', Tile::wood, L'S'); - - addShapedRecipy(new ItemInstance(Tile::iron_trapdoor, 1), // - L"sscig", - L"##", // - L"##", // - - L'#', Item::ironIngot, - L'S'); - addShapedRecipy(new ItemInstance(Tile::stairs_stone, 4), // L"sssctg", L"# ", // @@ -374,7 +263,7 @@ Recipes::Recipes() L"## ", // L"###", // - L'#', new ItemInstance(Tile::wood, 1, LogTile::BIRCH_TRUNK), + L'#', new ItemInstance(Tile::wood, 1, TreeTile::BIRCH_TRUNK), L'S'); addShapedRecipy(new ItemInstance(Tile::woodStairsDark, 4), // @@ -383,7 +272,7 @@ Recipes::Recipes() L"## ", // L"###", // - L'#', new ItemInstance(Tile::wood, 1, LogTile::DARK_TRUNK), + L'#', new ItemInstance(Tile::wood, 1, TreeTile::DARK_TRUNK), L'S'); addShapedRecipy(new ItemInstance(Tile::woodStairsJungle, 4), // @@ -392,14 +281,9 @@ Recipes::Recipes() L"## ", // L"###", // - L'#', new ItemInstance(Tile::wood, 1, LogTile::JUNGLE_TRUNK), + L'#', new ItemInstance(Tile::wood, 1, TreeTile::JUNGLE_TRUNK), L'S'); -#if TO_BE_IMPLEMENTED // TU31 - // LogTile::ACACIA_TRUNK - // LogTile::DARK_OAK_TRUNK -#endif - addShapedRecipy(new ItemInstance(Tile::stairs_quartz, 4), // L"sssctg", L"# ", // @@ -512,39 +396,37 @@ Recipes::Recipes() L'#', Tile::quartzBlock, L'S'); - addShapedRecipy(new ItemInstance(Tile::woodSlabHalf, 6, LogTile::OAK_TRUNK), // + addShapedRecipy(new ItemInstance(Tile::woodSlabHalf, 6, 0), // L"sczg", L"###", // - L'#', new ItemInstance(Tile::wood, 1, LogTile::OAK_TRUNK), + L'#', new ItemInstance(Tile::wood, 1, 0), L'S'); // TU9 - adding wood slabs - addShapedRecipy(new ItemInstance(Tile::woodSlabHalf, 6, LogTile::BIRCH_TRUNK), // + addShapedRecipy(new ItemInstance(Tile::woodSlabHalf, 6, TreeTile::BIRCH_TRUNK), // L"sczg", L"###", // - L'#', new ItemInstance(Tile::wood, 1, LogTile::BIRCH_TRUNK), + L'#', new ItemInstance(Tile::wood, 1, TreeTile::BIRCH_TRUNK), L'S'); - addShapedRecipy(new ItemInstance(Tile::woodSlabHalf, 6, LogTile::DARK_TRUNK), // + addShapedRecipy(new ItemInstance(Tile::woodSlabHalf, 6, TreeTile::DARK_TRUNK), // L"sczg", L"###", // - L'#', new ItemInstance(Tile::wood, 1, LogTile::DARK_TRUNK), + L'#', new ItemInstance(Tile::wood, 1, TreeTile::DARK_TRUNK), L'S'); - addShapedRecipy(new ItemInstance(Tile::woodSlabHalf, 6, LogTile::JUNGLE_TRUNK), // + addShapedRecipy(new ItemInstance(Tile::woodSlabHalf, 6, TreeTile::JUNGLE_TRUNK), // L"sczg", L"###", // - L'#', new ItemInstance(Tile::wood, 1, LogTile::JUNGLE_TRUNK), + L'#', new ItemInstance(Tile::wood, 1, TreeTile::JUNGLE_TRUNK), L'S'); -#if TO_BE_IMPLEMENTED // TU31 - // LogTile::ACACIA_TRUNK and LogTile::DARK_OAK_TRUNK -#endif + @@ -1371,7 +1253,7 @@ shared_ptr Recipes::getItemFor(shared_ptr craft int count = 0; shared_ptr first = nullptr; shared_ptr second = nullptr; - for (unsigned int i = 0; i < craftSlots->getContainerSize(); i++) + for (int i = 0; i < craftSlots->getContainerSize(); i++) { shared_ptr item = craftSlots->getItem(i); if (item != nullptr) diff --git a/Minecraft.World/RepairMenu.h b/Minecraft.World/RepairMenu.h index c28ca0d1..6d06859b 100644 --- a/Minecraft.World/RepairMenu.h +++ b/Minecraft.World/RepairMenu.h @@ -6,20 +6,20 @@ class RepairMenu : public AbstractContainerMenu { friend class RepairResultSlot; private: - static constexpr bool DEBUG_COST = false; + static const bool DEBUG_COST = false; public: - static constexpr int INPUT_SLOT = 0; - static constexpr int ADDITIONAL_SLOT = 1; - static constexpr int RESULT_SLOT = 2; + static const int INPUT_SLOT = 0; + static const int ADDITIONAL_SLOT = 1; + static const int RESULT_SLOT = 2; static constexpr int INV_SLOT_START = RESULT_SLOT + 1; static constexpr int INV_SLOT_END = INV_SLOT_START + (9*3); - static constexpr int USE_ROW_SLOT_START = INV_SLOT_END; + static const int USE_ROW_SLOT_START = INV_SLOT_END; static constexpr int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9; public: - static constexpr int DATA_TOTAL_COST = 0; + static const int DATA_TOTAL_COST = 0; private: shared_ptr resultSlots; diff --git a/Minecraft.World/Sapling.cpp b/Minecraft.World/Sapling.cpp index d86512a6..c169a608 100644 --- a/Minecraft.World/Sapling.cpp +++ b/Minecraft.World/Sapling.cpp @@ -88,7 +88,7 @@ void Sapling::growTree(Level *level, int x, int y, int z, Random *random) if (isSapling(level, x + ox, y, z + oz, TYPE_JUNGLE) && isSapling(level, x + ox + 1, y, z + oz, TYPE_JUNGLE) && isSapling(level, x + ox, y, z + oz + 1, TYPE_JUNGLE) && isSapling(level, x + ox + 1, y, z + oz + 1, TYPE_JUNGLE)) { - f = new MegaTreeFeature(true, 10 + random->nextInt(20), LogTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF); + f = new MegaTreeFeature(true, 10 + random->nextInt(20), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF); multiblock = true; break; } @@ -101,7 +101,7 @@ void Sapling::growTree(Level *level, int x, int y, int z, Random *random) if (f == nullptr) { ox = oz = 0; - f = new TreeFeature(true, 4 + random->nextInt(7), LogTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, false); + f = new TreeFeature(true, 4 + random->nextInt(7), TreeTile::JUNGLE_TRUNK, LeafTile::JUNGLE_LEAF, false); } } else diff --git a/Minecraft.World/ScatteredFeaturePieces.cpp b/Minecraft.World/ScatteredFeaturePieces.cpp index 62cf3a69..fbe342f6 100644 --- a/Minecraft.World/ScatteredFeaturePieces.cpp +++ b/Minecraft.World/ScatteredFeaturePieces.cpp @@ -1,5 +1,4 @@ #include "stdafx.h" -#include "..\Minecraft.Client\Minecraft.h" #include "net.minecraft.h" #include "net.minecraft.world.entity.monster.h" #include "net.minecraft.world.item.h" @@ -57,20 +56,20 @@ ScatteredFeaturePieces::ScatteredFeaturePiece::ScatteredFeaturePiece(Random *ran } } -void ScatteredFeaturePieces::ScatteredFeaturePiece::addAdditionalSaveData(DataOutputStream *dos) +void ScatteredFeaturePieces::ScatteredFeaturePiece::addAdditonalSaveData(CompoundTag *tag) { - dos->writeInt(width); - dos->writeInt(height); - dos->writeInt(depth); - dos->writeInt(heightPosition); + tag->putInt(L"Width", width); + tag->putInt(L"Height", height); + tag->putInt(L"Depth", depth); + tag->putInt(L"HPos", heightPosition); } -void ScatteredFeaturePieces::ScatteredFeaturePiece::readAdditonalSaveData(DataInputStream *dis) +void ScatteredFeaturePieces::ScatteredFeaturePiece::readAdditonalSaveData(CompoundTag *tag) { - width = dis->readInt(); - height = dis->readInt(); - depth = dis->readInt(); - heightPosition = dis->readInt(); + width = tag->getInt(L"Width"); + height = tag->getInt(L"Height"); + depth = tag->getInt(L"Depth"); + heightPosition = tag->getInt(L"HPos"); } bool ScatteredFeaturePieces::ScatteredFeaturePiece::updateAverageGroundHeight(Level *level, BoundingBox *chunkBB, int offset) @@ -103,41 +102,267 @@ bool ScatteredFeaturePieces::ScatteredFeaturePiece::updateAverageGroundHeight(Le return true; } +WeighedTreasure *ScatteredFeaturePieces::DesertPyramidPiece::treasureItems[ScatteredFeaturePieces::DesertPyramidPiece::TREASURE_ITEMS_COUNT] = +{ + new WeighedTreasure(Item::diamond_Id, 0, 1, 3, 3), + new WeighedTreasure(Item::ironIngot_Id, 0, 1, 5, 10), + new WeighedTreasure(Item::goldIngot_Id, 0, 2, 7, 15), + new WeighedTreasure(Item::emerald_Id, 0, 1, 3, 2), + new WeighedTreasure(Item::bone_Id, 0, 4, 6, 20), + new WeighedTreasure(Item::rotten_flesh_Id, 0, 3, 7, 16), + // very rare for pyramids ... + new WeighedTreasure(Item::saddle_Id, 0, 1, 1, 3), + new WeighedTreasure(Item::horseArmorMetal_Id, 0, 1, 1, 1), + new WeighedTreasure(Item::horseArmorGold_Id, 0, 1, 1, 1), + new WeighedTreasure(Item::horseArmorDiamond_Id, 0, 1, 1, 1), + // ... +}; + ScatteredFeaturePieces::DesertPyramidPiece::DesertPyramidPiece() { - objectPlacedFlags.clear(); - tileOptionRemap.clear(); - tileOptionRemap.clear(); - entitySpawnCounts.clear(); + hasPlacedChest[0] = false; + hasPlacedChest[1] = false; + hasPlacedChest[2] = false; + hasPlacedChest[3] = false; + // for reflection } -ScatteredFeaturePieces::DesertPyramidPiece::DesertPyramidPiece(Random *random, int west, int north) : ScatteredFeaturePiece(random, west, 64, north, - Minecraft::GetInstance()->getStructureTable()->getStructurePiece(eMinecraftStructurePiece_DesertPyramidPiece)->width, - Minecraft::GetInstance()->getStructureTable()->getStructurePiece(eMinecraftStructurePiece_DesertPyramidPiece)->height, - Minecraft::GetInstance()->getStructureTable()->getStructurePiece(eMinecraftStructurePiece_DesertPyramidPiece)->depth) +ScatteredFeaturePieces::DesertPyramidPiece::DesertPyramidPiece(Random *random, int west, int north) : ScatteredFeaturePiece(random, west, 64, north, 21, 15, 21) { - objectPlacedFlags.clear(); - tileOptionRemap.clear(); - tileOptionRemap.clear(); - entitySpawnCounts.clear(); + hasPlacedChest[0] = false; + hasPlacedChest[1] = false; + hasPlacedChest[2] = false; + hasPlacedChest[3] = false; } -void ScatteredFeaturePieces::DesertPyramidPiece::addAdditionalSaveData(DataOutputStream *dos) +void ScatteredFeaturePieces::DesertPyramidPiece::addAdditonalSaveData(CompoundTag *tag) { - ScatteredFeaturePiece::addAdditionalSaveData(dos); + ScatteredFeaturePiece::addAdditonalSaveData(tag); + tag->putBoolean(L"hasPlacedChest0", hasPlacedChest[0]); + tag->putBoolean(L"hasPlacedChest1", hasPlacedChest[1]); + tag->putBoolean(L"hasPlacedChest2", hasPlacedChest[2]); + tag->putBoolean(L"hasPlacedChest3", hasPlacedChest[3]); } -void ScatteredFeaturePieces::DesertPyramidPiece::readAdditonalSaveData(DataInputStream *dis) +void ScatteredFeaturePieces::DesertPyramidPiece::readAdditonalSaveData(CompoundTag *tag) { - ScatteredFeaturePiece::readAdditonalSaveData(dis); + ScatteredFeaturePiece::readAdditonalSaveData(tag); + hasPlacedChest[0] = tag->getBoolean(L"hasPlacedChest0"); + hasPlacedChest[1] = tag->getBoolean(L"hasPlacedChest1"); + hasPlacedChest[2] = tag->getBoolean(L"hasPlacedChest2"); + hasPlacedChest[3] = tag->getBoolean(L"hasPlacedChest3"); } bool ScatteredFeaturePieces::DesertPyramidPiece::postProcess(Level *level, Random *random, BoundingBox *chunkBB) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_DesertPyramidPiece); + // pyramid + generateBox(level, chunkBB, 0, -4, 0, width - 1, 0, depth - 1, Tile::sandStone_Id, Tile::sandStone_Id, false); + for (int pos = 1; pos <= 9; pos++) + { + generateBox(level, chunkBB, pos, pos, pos, width - 1 - pos, pos, depth - 1 - pos, Tile::sandStone_Id, Tile::sandStone_Id, false); + generateBox(level, chunkBB, pos + 1, pos, pos + 1, width - 2 - pos, pos, depth - 2 - pos, 0, 0, false); + } + for (int x = 0; x < width; x++) + { + for (int z = 0; z < depth; z++) + { + fillColumnDown(level, Tile::sandStone_Id, 0, x, -5, z, chunkBB); + } + } - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); + int stairsNorth = getOrientationData(Tile::stairs_sandstone_Id, 3); + int stairsSouth = getOrientationData(Tile::stairs_sandstone_Id, 2); + int stairsEast = getOrientationData(Tile::stairs_sandstone_Id, 0); + int stairsWest = getOrientationData(Tile::stairs_sandstone_Id, 1); + int baseDecoColor = ~DyePowderItem::ORANGE & 0xf; + int blue = ~DyePowderItem::BLUE & 0xf; + + // towers + generateBox(level, chunkBB, 0, 0, 0, 4, 9, 4, Tile::sandStone_Id, 0, false); + generateBox(level, chunkBB, 1, 10, 1, 3, 10, 3, Tile::sandStone_Id, Tile::sandStone_Id, false); + placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, 2, 10, 0, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, stairsSouth, 2, 10, 4, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, stairsEast, 0, 10, 2, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, stairsWest, 4, 10, 2, chunkBB); + generateBox(level, chunkBB, width - 5, 0, 0, width - 1, 9, 4, Tile::sandStone_Id, 0, false); + generateBox(level, chunkBB, width - 4, 10, 1, width - 2, 10, 3, Tile::sandStone_Id, Tile::sandStone_Id, false); + placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, width - 3, 10, 0, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, stairsSouth, width - 3, 10, 4, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, stairsEast, width - 5, 10, 2, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, stairsWest, width - 1, 10, 2, chunkBB); + + // entrance + generateBox(level, chunkBB, 8, 0, 0, 12, 4, 4, Tile::sandStone_Id, 0, false); + generateBox(level, chunkBB, 9, 1, 0, 11, 3, 4, 0, 0, false); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 9, 1, 1, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 9, 2, 1, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 9, 3, 1, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 10, 3, 1, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 11, 3, 1, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 11, 2, 1, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 11, 1, 1, chunkBB); + + // tower pathways + generateBox(level, chunkBB, 4, 1, 1, 8, 3, 3, Tile::sandStone_Id, 0, false); + generateBox(level, chunkBB, 4, 1, 2, 8, 2, 2, 0, 0, false); + generateBox(level, chunkBB, 12, 1, 1, 16, 3, 3, Tile::sandStone_Id, 0, false); + generateBox(level, chunkBB, 12, 1, 2, 16, 2, 2, 0, 0, false); + + // hall floor and pillars + generateBox(level, chunkBB, 5, 4, 5, width - 6, 4, depth - 6, Tile::sandStone_Id, Tile::sandStone_Id, false); + generateBox(level, chunkBB, 9, 4, 9, 11, 4, 11, 0, 0, false); + generateBox(level, chunkBB, 8, 1, 8, 8, 3, 8, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); + generateBox(level, chunkBB, 12, 1, 8, 12, 3, 8, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); + generateBox(level, chunkBB, 8, 1, 12, 8, 3, 12, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); + generateBox(level, chunkBB, 12, 1, 12, 12, 3, 12, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); + + // catwalks + generateBox(level, chunkBB, 1, 1, 5, 4, 4, 11, Tile::sandStone_Id, Tile::sandStone_Id, false); + generateBox(level, chunkBB, width - 5, 1, 5, width - 2, 4, 11, Tile::sandStone_Id, Tile::sandStone_Id, false); + generateBox(level, chunkBB, 6, 7, 9, 6, 7, 11, Tile::sandStone_Id, Tile::sandStone_Id, false); + generateBox(level, chunkBB, width - 7, 7, 9, width - 7, 7, 11, Tile::sandStone_Id, Tile::sandStone_Id, false); + generateBox(level, chunkBB, 5, 5, 9, 5, 7, 11, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); + generateBox(level, chunkBB, width - 6, 5, 9, width - 6, 7, 11, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); + placeBlock(level, 0, 0, 5, 5, 10, chunkBB); + placeBlock(level, 0, 0, 5, 6, 10, chunkBB); + placeBlock(level, 0, 0, 6, 6, 10, chunkBB); + placeBlock(level, 0, 0, width - 6, 5, 10, chunkBB); + placeBlock(level, 0, 0, width - 6, 6, 10, chunkBB); + placeBlock(level, 0, 0, width - 7, 6, 10, chunkBB); + + // tower stairs + generateBox(level, chunkBB, 2, 4, 4, 2, 6, 4, 0, 0, false); + generateBox(level, chunkBB, width - 3, 4, 4, width - 3, 6, 4, 0, 0, false); + placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, 2, 4, 5, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, 2, 3, 4, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, width - 3, 4, 5, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, stairsNorth, width - 3, 3, 4, chunkBB); + generateBox(level, chunkBB, 1, 1, 3, 2, 2, 3, Tile::sandStone_Id, Tile::sandStone_Id, false); + generateBox(level, chunkBB, width - 3, 1, 3, width - 2, 2, 3, Tile::sandStone_Id, Tile::sandStone_Id, false); + placeBlock(level, Tile::stairs_sandstone_Id, 0, 1, 1, 2, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, 0, width - 2, 1, 2, chunkBB); + placeBlock(level, Tile::stoneSlabHalf_Id, StoneSlabTile::SAND_SLAB, 1, 2, 2, chunkBB); + placeBlock(level, Tile::stoneSlabHalf_Id, StoneSlabTile::SAND_SLAB, width - 2, 2, 2, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, stairsWest, 2, 1, 2, chunkBB); + placeBlock(level, Tile::stairs_sandstone_Id, stairsEast, width - 3, 1, 2, chunkBB); + + // indoor decoration + generateBox(level, chunkBB, 4, 3, 5, 4, 3, 18, Tile::sandStone_Id, Tile::sandStone_Id, false); + generateBox(level, chunkBB, width - 5, 3, 5, width - 5, 3, 17, Tile::sandStone_Id, Tile::sandStone_Id, false); + generateBox(level, chunkBB, 3, 1, 5, 4, 2, 16, 0, 0, false); + generateBox(level, chunkBB, width - 6, 1, 5, width - 5, 2, 16, 0, 0, false); + for (int z = 5; z <= 17; z += 2) + { + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 4, 1, z, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 4, 2, z, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, width - 5, 1, z, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, width - 5, 2, z, chunkBB); + } + placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 7, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 8, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 9, 0, 9, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 11, 0, 9, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 8, 0, 10, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 12, 0, 10, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 7, 0, 10, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 13, 0, 10, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 9, 0, 11, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 11, 0, 11, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 12, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 10, 0, 13, chunkBB); + placeBlock(level, Tile::wool_Id, blue, 10, 0, 10, chunkBB); + + // outdoor decoration + for (int x = 0; x <= width - 1; x += width - 1) + { + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 2, 1, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 2, 2, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 2, 3, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 3, 1, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 3, 2, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 3, 3, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 4, 1, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 4, 2, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 4, 3, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 5, 1, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 5, 2, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 5, 3, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 6, 1, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 6, 2, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 6, 3, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 1, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 2, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 3, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 1, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 2, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 3, chunkBB); + } + for (int x = 2; x <= width - 3; x += width - 3 - 2) + { + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 2, 0, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 2, 0, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 2, 0, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 3, 0, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 3, 0, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 3, 0, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x - 1, 4, 0, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 4, 0, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x + 1, 4, 0, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 5, 0, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 5, 0, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 5, 0, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x - 1, 6, 0, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, x, 6, 0, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x + 1, 6, 00, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x - 1, 7, 0, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x, 7, 0, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, x + 1, 7, 0, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x - 1, 8, 0, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x, 8, 0, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, x + 1, 8, 0, chunkBB); + } + generateBox(level, chunkBB, 8, 4, 0, 12, 6, 0, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); + placeBlock(level, 0, 0, 8, 6, 0, chunkBB); + placeBlock(level, 0, 0, 12, 6, 0, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 9, 5, 0, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 10, 5, 0, chunkBB); + placeBlock(level, Tile::wool_Id, baseDecoColor, 11, 5, 0, chunkBB); + + // tombs + generateBox(level, chunkBB, 8, -14, 8, 12, -11, 12, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); + generateBox(level, chunkBB, 8, -10, 8, 12, -10, 12, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, false); + generateBox(level, chunkBB, 8, -9, 8, 12, -9, 12, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, false); + generateBox(level, chunkBB, 8, -8, 8, 12, -1, 12, Tile::sandStone_Id, Tile::sandStone_Id, false); + generateBox(level, chunkBB, 9, -11, 9, 11, -1, 11, 0, 0, false); + placeBlock(level, Tile::pressurePlate_stone_Id, 0, 10, -11, 10, chunkBB); + generateBox(level, chunkBB, 9, -13, 9, 11, -13, 11, Tile::tnt_Id, 0, false); + placeBlock(level, 0, 0, 8, -11, 10, chunkBB); + placeBlock(level, 0, 0, 8, -10, 10, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 7, -10, 10, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 7, -11, 10, chunkBB); + placeBlock(level, 0, 0, 12, -11, 10, chunkBB); + placeBlock(level, 0, 0, 12, -10, 10, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 13, -10, 10, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 13, -11, 10, chunkBB); + placeBlock(level, 0, 0, 10, -11, 8, chunkBB); + placeBlock(level, 0, 0, 10, -10, 8, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 10, -10, 7, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 10, -11, 7, chunkBB); + placeBlock(level, 0, 0, 10, -11, 12, chunkBB); + placeBlock(level, 0, 0, 10, -10, 12, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS, 10, -10, 13, chunkBB); + placeBlock(level, Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE, 10, -11, 13, chunkBB); + + // chests! + for (int i = 0; i < 4; i++) + { + if (!hasPlacedChest[i]) + { + int xo = Direction::STEP_X[i] * 2; + int zo = Direction::STEP_Z[i] * 2; + hasPlacedChest[i] = createChest(level, chunkBB, random, 10 + xo, -11, 10 + zo, WeighedTreasure::addToTreasure(WeighedTreasureArray(treasureItems,TREASURE_ITEMS_COUNT), Item::enchantedBook->createForRandomTreasure(random)), 2 + random->nextInt(5)); + } + } return true; } @@ -178,22 +403,22 @@ ScatteredFeaturePieces::JunglePyramidPiece::JunglePyramidPiece(Random *random, i placedTrap2 = false; } -void ScatteredFeaturePieces::JunglePyramidPiece::addAdditionalSaveData(DataOutputStream *dos) +void ScatteredFeaturePieces::JunglePyramidPiece::addAdditonalSaveData(CompoundTag *tag) { - ScatteredFeaturePiece::addAdditionalSaveData(dos); - dos->writeBoolean(placedMainChest); - dos->writeBoolean(placedHiddenChest); - dos->writeBoolean(placedTrap1); - dos->writeBoolean(placedTrap2); + ScatteredFeaturePiece::addAdditonalSaveData(tag); + tag->putBoolean(L"placedMainChest", placedMainChest); + tag->putBoolean(L"placedHiddenChest", placedHiddenChest); + tag->putBoolean(L"placedTrap1", placedTrap1); + tag->putBoolean(L"placedTrap2", placedTrap2); } -void ScatteredFeaturePieces::JunglePyramidPiece::readAdditonalSaveData(DataInputStream *dis) +void ScatteredFeaturePieces::JunglePyramidPiece::readAdditonalSaveData(CompoundTag *tag) { - ScatteredFeaturePiece::readAdditonalSaveData(dis); - placedMainChest = dis->readBoolean(); - placedHiddenChest = dis->readBoolean(); - placedTrap1 = dis->readBoolean(); - placedTrap2 = dis->readBoolean(); + ScatteredFeaturePiece::readAdditonalSaveData(tag); + placedMainChest = tag->getBoolean(L"placedMainChest"); + placedHiddenChest = tag->getBoolean(L"placedHiddenChest"); + placedTrap1 = tag->getBoolean(L"placedTrap1"); + placedTrap2 = tag->getBoolean(L"placedTrap2"); } bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -341,7 +566,6 @@ bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(Level *level, Rando placeBlock(level, Tile::mossyCobblestone_Id, 0, 3, -3, 1, chunkBB); if (!placedTrap1) { - setDirty(); placedTrap1 = createDispenser(level, chunkBB, random, 3, -2, 1, Facing::NORTH, WeighedTreasureArray(dispenserItems,DISPENSER_ITEMS_COUNT), 2); } placeBlock(level, Tile::vine_Id, 0xf, 3, -2, 2, chunkBB); @@ -359,14 +583,12 @@ bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(Level *level, Rando placeBlock(level, Tile::redStoneDust_Id, 0, 9, -2, 4, chunkBB); if (!placedTrap2) { - setDirty(); placedTrap2 = createDispenser(level, chunkBB, random, 9, -2, 3, Facing::WEST, WeighedTreasureArray(dispenserItems,DISPENSER_ITEMS_COUNT), 2); } placeBlock(level, Tile::vine_Id, 0xf, 8, -1, 3, chunkBB); placeBlock(level, Tile::vine_Id, 0xf, 8, -2, 3, chunkBB); if (!placedMainChest) { - setDirty(); placedMainChest = createChest(level, chunkBB, random, 8, -3, 3, WeighedTreasure::addToTreasure(WeighedTreasureArray(treasureItems,TREASURE_ITEMS_COUNT), Item::enchantedBook->createForRandomTreasure(random)), 2 + random->nextInt(5)); } placeBlock(level, Tile::mossyCobblestone_Id, 0, 9, -3, 2, chunkBB); @@ -400,7 +622,6 @@ bool ScatteredFeaturePieces::JunglePyramidPiece::postProcess(Level *level, Rando placeBlock(level, Tile::diode_off_Id, getOrientationData(Tile::diode_off_Id, Direction::NORTH), 10, -2, 10, chunkBB); if (!placedHiddenChest) { - setDirty(); placedHiddenChest = createChest(level, chunkBB, random, 9, -3, 10, WeighedTreasure::addToTreasure(WeighedTreasureArray(treasureItems,TREASURE_ITEMS_COUNT), Item::enchantedBook->createForRandomTreasure(random)), 2 + random->nextInt(5)); } @@ -432,16 +653,16 @@ ScatteredFeaturePieces::SwamplandHut::SwamplandHut(Random *random, int west, int spawnedWitch = false; } -void ScatteredFeaturePieces::SwamplandHut::addAdditionalSaveData(DataOutputStream *dos) +void ScatteredFeaturePieces::SwamplandHut::addAdditonalSaveData(CompoundTag *tag) { - ScatteredFeaturePiece::addAdditionalSaveData(dos); - dos->writeBoolean(spawnedWitch); + ScatteredFeaturePiece::addAdditonalSaveData(tag); + tag->putBoolean(L"Witch", spawnedWitch); } -void ScatteredFeaturePieces::SwamplandHut::readAdditonalSaveData(DataInputStream *dis) +void ScatteredFeaturePieces::SwamplandHut::readAdditonalSaveData(CompoundTag *tag) { - ScatteredFeaturePiece::readAdditonalSaveData(dis); - spawnedWitch = dis->readBoolean(); + ScatteredFeaturePiece::readAdditonalSaveData(tag); + spawnedWitch = tag->getBoolean(L"Witch"); } bool ScatteredFeaturePieces::SwamplandHut::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -452,15 +673,15 @@ bool ScatteredFeaturePieces::SwamplandHut::postProcess(Level *level, Random *ran } // floor and ceiling - generateBox(level, chunkBB, 1, 1, 1, 5, 1, 7, Tile::wood_Id, LogTile::DARK_TRUNK, Tile::wood_Id, LogTile::DARK_TRUNK, false); - generateBox(level, chunkBB, 1, 4, 2, 5, 4, 7, Tile::wood_Id, LogTile::DARK_TRUNK, Tile::wood_Id, LogTile::DARK_TRUNK, false); - generateBox(level, chunkBB, 2, 1, 0, 4, 1, 0, Tile::wood_Id, LogTile::DARK_TRUNK, Tile::wood_Id, LogTile::DARK_TRUNK, false); + generateBox(level, chunkBB, 1, 1, 1, 5, 1, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); + generateBox(level, chunkBB, 1, 4, 2, 5, 4, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); + generateBox(level, chunkBB, 2, 1, 0, 4, 1, 0, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); // walls - generateBox(level, chunkBB, 2, 2, 2, 3, 3, 2, Tile::wood_Id, LogTile::DARK_TRUNK, Tile::wood_Id, LogTile::DARK_TRUNK, false); - generateBox(level, chunkBB, 1, 2, 3, 1, 3, 6, Tile::wood_Id, LogTile::DARK_TRUNK, Tile::wood_Id, LogTile::DARK_TRUNK, false); - generateBox(level, chunkBB, 5, 2, 3, 5, 3, 6, Tile::wood_Id, LogTile::DARK_TRUNK, Tile::wood_Id, LogTile::DARK_TRUNK, false); - generateBox(level, chunkBB, 2, 2, 7, 4, 3, 7, Tile::wood_Id, LogTile::DARK_TRUNK, Tile::wood_Id, LogTile::DARK_TRUNK, false); + generateBox(level, chunkBB, 2, 2, 2, 3, 3, 2, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); + generateBox(level, chunkBB, 1, 2, 3, 1, 3, 6, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); + generateBox(level, chunkBB, 5, 2, 3, 5, 3, 6, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); + generateBox(level, chunkBB, 2, 2, 7, 4, 3, 7, Tile::wood_Id, TreeTile::DARK_TRUNK, Tile::wood_Id, TreeTile::DARK_TRUNK, false); // pillars generateBox(level, chunkBB, 1, 0, 2, 1, 3, 2, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); @@ -514,7 +735,6 @@ bool ScatteredFeaturePieces::SwamplandHut::postProcess(Level *level, Random *ran if (chunkBB->isInside(wx, wy, wz)) { - setDirty(); spawnedWitch = true; shared_ptr witch = std::make_shared(level); diff --git a/Minecraft.World/ScatteredFeaturePieces.h b/Minecraft.World/ScatteredFeaturePieces.h index f48f6eaf..5fb334df 100644 --- a/Minecraft.World/ScatteredFeaturePieces.h +++ b/Minecraft.World/ScatteredFeaturePieces.h @@ -20,8 +20,8 @@ private: ScatteredFeaturePiece(); ScatteredFeaturePiece(Random *random, int west, int floor, int north, int width, int height, int depth); - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); bool updateAverageGroundHeight(Level *level, BoundingBox *chunkBB, int offset); }; @@ -32,20 +32,22 @@ public: static StructurePiece *Create() { return new DesertPyramidPiece(); } virtual EStructurePiece GetType() { return eStructurePiece_DesertPyramidPiece; } + public: + static const int TREASURE_ITEMS_COUNT = 10; + private: + bool hasPlacedChest[4]; + static WeighedTreasure *treasureItems[TREASURE_ITEMS_COUNT]; + public: DesertPyramidPiece(); DesertPyramidPiece(Random *random, int west, int north); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); - std::vector objectPlacedFlags; - std::vector featureConditions; - std::vector tileOptionRemap; - std::vector entitySpawnCounts; }; class JunglePyramidPiece : public ScatteredFeaturePiece @@ -71,8 +73,8 @@ public: JunglePyramidPiece(Random *random, int west, int north); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); @@ -102,8 +104,8 @@ public: SwamplandHut(Random *random, int west, int north); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); diff --git a/Minecraft.World/Sheep.cpp b/Minecraft.World/Sheep.cpp index 9b706c7b..1c5af6ce 100644 --- a/Minecraft.World/Sheep.cpp +++ b/Minecraft.World/Sheep.cpp @@ -313,12 +313,6 @@ MobGroupData *Sheep::finalizeMobSpawn(MobGroupData *groupData, int extraData /*= return groupData; } -// TU25 Addition -float Sheep::getEyeHeight() -{ - return 0.95f * bbHeight; -} - int Sheep::getOffspringColor(shared_ptr animal, shared_ptr partner) { int parent1DyeColor = getDyeColor(animal); @@ -345,4 +339,3 @@ int Sheep::getDyeColor(shared_ptr animal) { return 15 - dynamic_pointer_cast(animal)->getColor(); } - diff --git a/Minecraft.World/Sheep.h b/Minecraft.World/Sheep.h index 8b74ad0b..33637ad4 100644 --- a/Minecraft.World/Sheep.h +++ b/Minecraft.World/Sheep.h @@ -82,9 +82,6 @@ public: MobGroupData *finalizeMobSpawn(MobGroupData *groupData, int extraData = 0); // 4J Added extraData param - // TU25 Addition - virtual float getEyeHeight(); - private: int getOffspringColor(shared_ptr animal, shared_ptr partner); int getDyeColor(shared_ptr animal); diff --git a/Minecraft.World/Silverfish.cpp b/Minecraft.World/Silverfish.cpp index e6875852..98f559c9 100644 --- a/Minecraft.World/Silverfish.cpp +++ b/Minecraft.World/Silverfish.cpp @@ -224,10 +224,4 @@ bool Silverfish::canSpawn() MobType Silverfish::getMobType() { return ARTHROPOD; -} - -// TU25 Addition -float Silverfish::getEyeHeight() -{ - return 0.1f; } \ No newline at end of file diff --git a/Minecraft.World/Silverfish.h b/Minecraft.World/Silverfish.h index 8f3ce722..e954fff1 100644 --- a/Minecraft.World/Silverfish.h +++ b/Minecraft.World/Silverfish.h @@ -45,6 +45,4 @@ protected: public: virtual bool canSpawn(); virtual MobType getMobType(); - // TU25 Addition - virtual float getEyeHeight(); }; \ No newline at end of file diff --git a/Minecraft.World/Skeleton.cpp b/Minecraft.World/Skeleton.cpp index bd2875d9..b88a8916 100644 --- a/Minecraft.World/Skeleton.cpp +++ b/Minecraft.World/Skeleton.cpp @@ -356,13 +356,4 @@ void Skeleton::setEquippedSlot(int slot, shared_ptr item) double Skeleton::getRidingHeight() { return Monster::getRidingHeight() - .5; -} - -// TU25 Addition -float Skeleton::getEyeHeight() -{ - if (getSkeletonType() == TYPE_WITHER) - return Entity::getEyeHeight(); - else - return 1.62f; } \ No newline at end of file diff --git a/Minecraft.World/Skeleton.h b/Minecraft.World/Skeleton.h index 04cb7bac..e2f6594c 100644 --- a/Minecraft.World/Skeleton.h +++ b/Minecraft.World/Skeleton.h @@ -66,6 +66,4 @@ public: virtual void addAdditonalSaveData(CompoundTag *entityTag); virtual void setEquippedSlot(int slot, shared_ptr item); virtual double getRidingHeight(); - // TU25 Addition - virtual float getEyeHeight(); }; diff --git a/Minecraft.World/Slime.cpp b/Minecraft.World/Slime.cpp index a73d931e..c10feb78 100644 --- a/Minecraft.World/Slime.cpp +++ b/Minecraft.World/Slime.cpp @@ -290,12 +290,6 @@ int Slime::getMaxHeadXRot() return 0; } -// TU25 Addition -float Slime::getEyeHeight() -{ - return 0.625f * bbHeight; -} - bool Slime::doPlayJumpSound() { return getSize() > 0; diff --git a/Minecraft.World/Slime.h b/Minecraft.World/Slime.h index af1ff564..95a1aef1 100644 --- a/Minecraft.World/Slime.h +++ b/Minecraft.World/Slime.h @@ -70,8 +70,6 @@ protected: public: virtual int getMaxHeadXRot(); - // TU25 Addition - virtual float getEyeHeight(); protected: virtual bool doPlayJumpSound(); diff --git a/Minecraft.World/SnowMan.cpp b/Minecraft.World/SnowMan.cpp index d92689c2..7e87fecf 100644 --- a/Minecraft.World/SnowMan.cpp +++ b/Minecraft.World/SnowMan.cpp @@ -119,10 +119,4 @@ bool SnowMan::hurt(DamageSource *source, float dmg) } return Golem::hurt(source, dmg); -} - -// TU25 Addition -float SnowMan::getEyeHeight() -{ - return 1.7f; } \ No newline at end of file diff --git a/Minecraft.World/SnowMan.h b/Minecraft.World/SnowMan.h index ef7a7b96..eed8e225 100644 --- a/Minecraft.World/SnowMan.h +++ b/Minecraft.World/SnowMan.h @@ -26,6 +26,4 @@ protected: public: virtual void performRangedAttack(shared_ptr target, float power); virtual bool hurt(DamageSource *source, float dmg); - // TU25 Addition - virtual float getEyeHeight(); }; \ No newline at end of file diff --git a/Minecraft.World/SparseDataStorage.cpp b/Minecraft.World/SparseDataStorage.cpp index e182a595..01855cdc 100644 --- a/Minecraft.World/SparseDataStorage.cpp +++ b/Minecraft.World/SparseDataStorage.cpp @@ -81,7 +81,7 @@ SparseDataStorage::~SparseDataStorage() { free(indicesAndData); } -// printf("free (in dtor) 0x%x\n", indicesAndData); +// printf("Free (in dtor) 0x%x\n", indicesAndData); } SparseDataStorage::SparseDataStorage(SparseDataStorage *copyFrom) @@ -450,7 +450,7 @@ void SparseDataStorage::tick() // before we ever delete something, from when the request to delete it came in const int freeIndex = ( deleteQueueIndex + 1 ) % 3; -// printf("free queue: %d, %d\n",deleteQueue[freeIndex].GetEntryCount(),deleteQueue[freeIndex].GetAllocated()); +// printf("Free queue: %d, %d\n",deleteQueue[freeIndex].GetEntryCount(),deleteQueue[freeIndex].GetAllocated()); unsigned char *toFree = nullptr; do { diff --git a/Minecraft.World/Spider.cpp b/Minecraft.World/Spider.cpp index 0dbae0cd..ff5c24ea 100644 --- a/Minecraft.World/Spider.cpp +++ b/Minecraft.World/Spider.cpp @@ -223,12 +223,6 @@ MobGroupData *Spider::finalizeMobSpawn(MobGroupData *groupData, int extraData /* return groupData; } -// TU25 Addition -float Spider::getEyeHeight() -{ - return 0.65f; -} - const float Spider::SPIDER_SPECIAL_EFFECT_CHANCE = .1f; Spider::SpiderEffectsGroupData::SpiderEffectsGroupData() diff --git a/Minecraft.World/Spider.h b/Minecraft.World/Spider.h index 0b84906c..941ac45a 100644 --- a/Minecraft.World/Spider.h +++ b/Minecraft.World/Spider.h @@ -42,8 +42,6 @@ public: virtual bool isClimbing(); virtual void setClimbing(bool value); virtual MobGroupData *finalizeMobSpawn(MobGroupData *groupData, int extraData = 0); // 4J Added extraData param - // TU25 Addition - virtual float getEyeHeight(); private: static const float SPIDER_SPECIAL_EFFECT_CHANCE; diff --git a/Minecraft.World/SpruceFeature.cpp b/Minecraft.World/SpruceFeature.cpp index 9a179fc4..d42e46f3 100644 --- a/Minecraft.World/SpruceFeature.cpp +++ b/Minecraft.World/SpruceFeature.cpp @@ -110,7 +110,7 @@ bool SpruceFeature::place(Level *level, Random *random, int x, int y, int z) for (int hh = 0; hh < treeHeight - topOffset; hh++) { int t = level->getTile(x, y + hh, z); - if (t == 0 || t == Tile::leaves_Id) placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, LogTile::DARK_TRUNK); + if (t == 0 || t == Tile::leaves_Id) placeBlock(level, x, y + hh, z, Tile::treeTrunk_Id, TreeTile::DARK_TRUNK); } return true; } diff --git a/Minecraft.World/Squid.cpp b/Minecraft.World/Squid.cpp index 4f9d1cd1..f1b660eb 100644 --- a/Minecraft.World/Squid.cpp +++ b/Minecraft.World/Squid.cpp @@ -191,9 +191,3 @@ bool Squid::canSpawn() { return y > 45 && y < level->seaLevel && WaterAnimal::canSpawn(); } - -// TU25 Addition -float Squid::getEyeHeight() -{ - return bbHeight * 0.5f; -} \ No newline at end of file diff --git a/Minecraft.World/Squid.h b/Minecraft.World/Squid.h index f19a78ae..c645d9f8 100644 --- a/Minecraft.World/Squid.h +++ b/Minecraft.World/Squid.h @@ -50,6 +50,4 @@ protected: public: virtual bool canSpawn(); - // TU25 Addition - virtual float getEyeHeight(); }; diff --git a/Minecraft.World/StrongholdPieces.cpp b/Minecraft.World/StrongholdPieces.cpp index b0593db6..d98d9488 100644 --- a/Minecraft.World/StrongholdPieces.cpp +++ b/Minecraft.World/StrongholdPieces.cpp @@ -261,14 +261,14 @@ StrongholdPieces::StrongholdPiece::StrongholdPiece(int genDepth) : StructurePiec entryDoor = OPENING; } -void StrongholdPieces::StrongholdPiece::addAdditionalSaveData(DataOutputStream *dos) +void StrongholdPieces::StrongholdPiece::addAdditonalSaveData(CompoundTag *tag) { - dos->writeInt(entryDoor); + tag->putString(L"EntryDoor", std::to_wstring(entryDoor)); } -void StrongholdPieces::StrongholdPiece::readAdditonalSaveData(DataInputStream *dis) +void StrongholdPieces::StrongholdPiece::readAdditonalSaveData(CompoundTag *tag) { - entryDoor = (SmallDoorType)dis->readInt(); + entryDoor = static_cast(_fromString(tag->getString(L"EntryDoor"))); } void StrongholdPieces::StrongholdPiece::generateSmallDoor(Level *level, Random *random, BoundingBox *chunkBB, StrongholdPieces::StrongholdPiece::SmallDoorType doorType, int footX, int footY, int footZ) @@ -422,16 +422,16 @@ StrongholdPieces::FillerCorridor::FillerCorridor(int genDepth, Random *random, B boundingBox = corridorBox; } -void StrongholdPieces::FillerCorridor::addAdditionalSaveData(DataOutputStream *dos) +void StrongholdPieces::FillerCorridor::addAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::addAdditionalSaveData(dos); - dos->writeInt(steps); + StrongholdPiece::addAdditonalSaveData(tag); + tag->putInt(L"Steps", steps); } -void StrongholdPieces::FillerCorridor::readAdditonalSaveData(DataInputStream *dis) +void StrongholdPieces::FillerCorridor::readAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::readAdditonalSaveData(dis); - steps = dis->readInt(); + StrongholdPiece::readAdditonalSaveData(tag); + steps = tag->getInt(L"Steps"); } BoundingBox *StrongholdPieces::FillerCorridor::findPieceBox(list *pieces, Random *random, int footX, int footY, int footZ, int direction) @@ -536,16 +536,16 @@ StrongholdPieces::StairsDown::StairsDown(int genDepth, Random *random, BoundingB boundingBox = stairsBox; } -void StrongholdPieces::StairsDown::addAdditionalSaveData(DataOutputStream *dos) +void StrongholdPieces::StairsDown::addAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::addAdditionalSaveData(dos); - dos->writeBoolean(isSource); + StrongholdPiece::addAdditonalSaveData(tag); + tag->putBoolean(L"Source", isSource); } -void StrongholdPieces::StairsDown::readAdditonalSaveData(DataInputStream *dis) +void StrongholdPieces::StairsDown::readAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::readAdditonalSaveData(dis); - isSource = dis->readBoolean(); + StrongholdPiece::readAdditonalSaveData(tag); + isSource = tag->getBoolean(L"Source"); } void StrongholdPieces::StairsDown::addChildren(StructurePiece *startPiece, list *pieces, Random *random) @@ -647,18 +647,18 @@ StrongholdPieces::Straight::Straight(int genDepth, Random *random, BoundingBox * boundingBox = stairsBox; } -void StrongholdPieces::Straight::addAdditionalSaveData(DataOutputStream *dos) +void StrongholdPieces::Straight::addAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::addAdditionalSaveData(dos); - dos->writeBoolean(leftChild); - dos->writeBoolean(rightChild); + StrongholdPiece::addAdditonalSaveData(tag); + tag->putBoolean(L"Left", leftChild); + tag->putBoolean(L"Right", rightChild); } -void StrongholdPieces::Straight::readAdditonalSaveData(DataInputStream *dis) +void StrongholdPieces::Straight::readAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::readAdditonalSaveData(dis); - leftChild = dis->readBoolean(); - rightChild = dis->readBoolean(); + StrongholdPiece::readAdditonalSaveData(tag); + leftChild = tag->getBoolean(L"Left"); + rightChild = tag->getBoolean(L"Right"); } void StrongholdPieces::Straight::addChildren(StructurePiece *startPiece, list *pieces, Random *random) @@ -751,16 +751,16 @@ StrongholdPieces::ChestCorridor::ChestCorridor(int genDepth, Random *random, Bou boundingBox = stairsBox; } -void StrongholdPieces::ChestCorridor::addAdditionalSaveData(DataOutputStream *dos) +void StrongholdPieces::ChestCorridor::addAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::addAdditionalSaveData(dos); - dos->writeBoolean(hasPlacedChest); + StrongholdPiece::addAdditonalSaveData(tag); + tag->putBoolean(L"Chest", hasPlacedChest); } -void StrongholdPieces::ChestCorridor::readAdditonalSaveData(DataInputStream *dis) +void StrongholdPieces::ChestCorridor::readAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::readAdditonalSaveData(dis); - hasPlacedChest = dis->readBoolean(); + StrongholdPiece::readAdditonalSaveData(tag); + hasPlacedChest = tag->getBoolean(L"Chest"); } void StrongholdPieces::ChestCorridor::addChildren(StructurePiece *startPiece, list *pieces, Random *random) @@ -815,7 +815,6 @@ bool StrongholdPieces::ChestCorridor::postProcess(Level *level, Random *random, int x = getWorldX(3, 3), z = getWorldZ(3, 3); if (chunkBB->isInside(x, y, z)) { - setDirty(); hasPlacedChest = true; createChest(level, chunkBB, random, 3, 2, 3, WeighedTreasure::addToTreasure(WeighedTreasureArray(treasureItems,TREASURE_ITEMS_COUNT), Item::enchantedBook->createForRandomTreasure(random)), 2 + random->nextInt(2)); } @@ -1010,16 +1009,16 @@ StrongholdPieces::RoomCrossing::RoomCrossing(int genDepth, Random *random, Bound boundingBox = stairsBox; } -void StrongholdPieces::RoomCrossing::addAdditionalSaveData(DataOutputStream *dos) +void StrongholdPieces::RoomCrossing::addAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::addAdditionalSaveData(dos); - dos->writeInt(type); + StrongholdPiece::addAdditonalSaveData(tag); + tag->putInt(L"Type", type); } -void StrongholdPieces::RoomCrossing::readAdditonalSaveData(DataInputStream *dis) +void StrongholdPieces::RoomCrossing::readAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::readAdditonalSaveData(dis); - type = dis->readInt(); + StrongholdPiece::readAdditonalSaveData(tag); + type = tag->getInt(L"Type"); } void StrongholdPieces::RoomCrossing::addChildren(StructurePiece *startPiece, list *pieces, Random *random) @@ -1247,16 +1246,16 @@ StrongholdPieces::Library::Library(int genDepth, Random *random, BoundingBox *ro boundingBox = roomBox; } -void StrongholdPieces::Library::addAdditionalSaveData(DataOutputStream *dos) +void StrongholdPieces::Library::addAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::addAdditionalSaveData(dos); - dos->writeBoolean(isTall); + StrongholdPiece::addAdditonalSaveData(tag); + tag->putBoolean(L"Tall", isTall); } -void StrongholdPieces::Library::readAdditonalSaveData(DataInputStream *dis) +void StrongholdPieces::Library::readAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::readAdditonalSaveData(dis); - isTall = dis->readBoolean(); + StrongholdPiece::readAdditonalSaveData(tag); + isTall = tag->getBoolean(L"Tall"); } StrongholdPieces::Library *StrongholdPieces::Library::createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) @@ -1437,22 +1436,22 @@ StrongholdPieces::FiveCrossing::FiveCrossing(int genDepth, Random *random, Bound rightHigh = random->nextInt(3) > 0; } -void StrongholdPieces::FiveCrossing::addAdditionalSaveData(DataOutputStream *dos) +void StrongholdPieces::FiveCrossing::addAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::addAdditionalSaveData(dos); - dos->writeBoolean(leftLow); - dos->writeBoolean(leftHigh); - dos->writeBoolean(rightLow); - dos->writeBoolean(rightHigh); + StrongholdPiece::addAdditonalSaveData(tag); + tag->putBoolean(L"leftLow", leftLow); + tag->putBoolean(L"leftHigh", leftHigh); + tag->putBoolean(L"rightLow", rightLow); + tag->putBoolean(L"rightHigh", rightHigh); } -void StrongholdPieces::FiveCrossing::readAdditonalSaveData(DataInputStream *dis) +void StrongholdPieces::FiveCrossing::readAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::readAdditonalSaveData(dis); - leftLow = dis->readBoolean(); - leftHigh = dis->readBoolean(); - rightLow = dis->readBoolean(); - rightHigh = dis->readBoolean(); + StrongholdPiece::readAdditonalSaveData(tag); + leftLow = tag->getBoolean(L"leftLow"); + leftHigh = tag->getBoolean(L"leftHigh"); + rightLow = tag->getBoolean(L"rightLow"); + rightHigh = tag->getBoolean(L"rightHigh"); } void StrongholdPieces::FiveCrossing::addChildren(StructurePiece *startPiece, list *pieces, Random *random) @@ -1548,16 +1547,16 @@ StrongholdPieces::PortalRoom::PortalRoom(int genDepth, Random *random, BoundingB boundingBox = box; } -void StrongholdPieces::PortalRoom::addAdditionalSaveData(DataOutputStream *dos) +void StrongholdPieces::PortalRoom::addAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::addAdditionalSaveData(dos); - dos->writeBoolean(hasPlacedMobSpawner); + StrongholdPiece::addAdditonalSaveData(tag); + tag->putBoolean(L"Mob", hasPlacedMobSpawner); } -void StrongholdPieces::PortalRoom::readAdditonalSaveData(DataInputStream *dis) +void StrongholdPieces::PortalRoom::readAdditonalSaveData(CompoundTag *tag) { - StrongholdPiece::readAdditonalSaveData(dis); - hasPlacedMobSpawner = dis->readBoolean(); + StrongholdPiece::readAdditonalSaveData(tag); + hasPlacedMobSpawner = tag->getBoolean(L"Mob"); } void StrongholdPieces::PortalRoom::addChildren(StructurePiece *startPiece, list *pieces, Random *random) @@ -1686,7 +1685,6 @@ bool StrongholdPieces::PortalRoom::postProcess(Level *level, Random *random, Bou level->getLevelData()->setZStrongholdEndPortal(z); level->getLevelData()->setHasStrongholdEndPortal(); - setDirty(); hasPlacedMobSpawner = true; level->setTileAndData(x, y, z, Tile::mobSpawner_Id, 0, Tile::UPDATE_CLIENTS); shared_ptr entity = dynamic_pointer_cast(level->getTileEntity(x, y, z)); diff --git a/Minecraft.World/StrongholdPieces.h b/Minecraft.World/StrongholdPieces.h index d38c2e34..2b15f3c2 100644 --- a/Minecraft.World/StrongholdPieces.h +++ b/Minecraft.World/StrongholdPieces.h @@ -99,8 +99,8 @@ private: protected: StrongholdPiece(int genDepth); - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); void generateSmallDoor(Level *level, Random *random, BoundingBox *chunkBB, SmallDoorType doorType, int footX, int footY, int footZ); SmallDoorType randomSmallDoor(Random *random); @@ -130,8 +130,8 @@ public: FillerCorridor(int genDepth, Random *random, BoundingBox *corridorBox, int direction); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: static BoundingBox *findPieceBox(list *pieces, Random *random, int footX, int footY, int footZ, int direction); @@ -162,8 +162,8 @@ public: StairsDown(int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: virtual void addChildren(StructurePiece *startPiece, list *pieces, Random *random); @@ -218,8 +218,8 @@ public: Straight(int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: virtual void addChildren(StructurePiece *startPiece, list *pieces, Random *random); @@ -253,8 +253,8 @@ public: ChestCorridor(int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: virtual void addChildren(StructurePiece *startPiece, list *pieces, Random *random); @@ -357,8 +357,8 @@ public: RoomCrossing(int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: virtual void addChildren(StructurePiece *startPiece, list *pieces, Random *random); @@ -419,8 +419,8 @@ public: Library(int genDepth, Random *random, BoundingBox *roomBox, int direction); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: static Library *createPiece(list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); @@ -452,8 +452,8 @@ public: FiveCrossing(int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: virtual void addChildren(StructurePiece *startPiece, list *pieces, Random *random); @@ -485,8 +485,8 @@ public: PortalRoom(int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: void addChildren(StructurePiece *startPiece, list *pieces, Random *random); diff --git a/Minecraft.World/StructureFeature.cpp b/Minecraft.World/StructureFeature.cpp index 2481a8eb..8de619ca 100644 --- a/Minecraft.World/StructureFeature.cpp +++ b/Minecraft.World/StructureFeature.cpp @@ -9,7 +9,9 @@ StructureFeature::StructureFeature() { +#ifdef ENABLE_STRUCTURE_SAVING savedData = nullptr; +#endif } StructureFeature::~StructureFeature() @@ -69,11 +71,8 @@ bool StructureFeature::postProcess(Level *level, Random *random, int chunkX, int delete bb; intersection = true; - if (structureStart->isDirty()) - { - // because some feature pieces are modified in the postProcess step, we need to save them again - saveFeature(structureStart->getChunkX(), structureStart->getChunkZ(), structureStart); - } + // because some feature pieces are modified in the postProcess step, we need to save them again + saveFeature(structureStart->getChunkX(), structureStart->getChunkZ(), structureStart); } } } @@ -204,12 +203,47 @@ TilePos *StructureFeature::getNearestGeneratedFeature(Level *level, int cellX, i } } } + if (selected != nullptr) + { + return selected; + } + else + { + vector *guesstimatedFeaturePositions = getGuesstimatedFeaturePositions(); + if (guesstimatedFeaturePositions != nullptr) + { + TilePos *pSelectedPos = new TilePos(0,0,0); + for(const auto& it : *guesstimatedFeaturePositions) + { + int dx = it.x - cellX; + int dy = it.y - cellY; + int dz = it.z - cellZ; + double dist = dx * dx + dy * dy + dz * dz; + + if (dist < minDistance) + { + minDistance = dist; + pSelectedPos->x = it.x; + pSelectedPos->y = it.y; + pSelectedPos->z = it.z; + } + } + delete guesstimatedFeaturePositions; + return pSelectedPos; + } + } + return nullptr; +} + +vector *StructureFeature::getGuesstimatedFeaturePositions() +{ return nullptr; } void StructureFeature::restoreSavedData(Level *level) { +#ifdef ENABLE_STRUCTURE_SAVING if (savedData == nullptr) { savedData = dynamic_pointer_cast( level->getSavedData(typeid(StructureFeatureSavedData), getFeatureName()) ); @@ -221,39 +255,36 @@ void StructureFeature::restoreSavedData(Level *level) } else { - app.DebugPrintf("==== Restoring saved data for %ls\n", getFeatureName()); - CompoundTag *fullTag = savedData->getFullTag(); vector *allTags = fullTag->getAllTags(); - for (auto it = allTags->begin(); it != allTags->end(); ++it) - { - Tag *currentTag = *it; + for ( Tag *featureTag : *allTags ) + { + if ( featureTag && featureTag->getId() == Tag::TAG_Compound) + { + CompoundTag *ct = (CompoundTag *) featureTag; - if (currentTag->getId() == Tag::TAG_Byte_Array) - { - StructureStart *start = StructureFeatureIO::loadStaticStart((ByteArrayTag *)currentTag, level); + if (ct->contains(L"ChunkX") && ct->contains(L"ChunkZ")) + { + int cx = ct->getInt(L"ChunkX"); + int cz = ct->getInt(L"ChunkZ"); - if (start) - { - int cx = start->getChunkX(); - int cz = start->getChunkZ(); - - app.DebugPrintf("========= Restoring structure starting in chunk %d, %d\n", cx, cz); - - cachedStructures[ChunkPos::hashCode(cx, cz)] = start; - } - } - } + StructureStart *start = StructureFeatureIO::loadStaticStart(ct, level); + // System.out.println("Loaded " + start.getClass().getSimpleName() + " from file"); + cachedStructures[ChunkPos::hashCode(cx, cz)] = start; + } + } + } delete allTags; } } +#endif } void StructureFeature::saveFeature(int chunkX, int chunkZ, StructureStart *feature) { - app.DebugPrintf("########### Saving %ls feature [%d, %d]\n", getFeatureName(), chunkX, chunkZ); +#ifdef ENABLE_STRUCTURE_SAVING savedData->putFeatureTag(feature->createTag(chunkX, chunkZ), chunkX, chunkZ); savedData->setDirty(); - feature->clearDirty(); +#endif } diff --git a/Minecraft.World/StructureFeature.h b/Minecraft.World/StructureFeature.h index bfcb6048..52103243 100644 --- a/Minecraft.World/StructureFeature.h +++ b/Minecraft.World/StructureFeature.h @@ -4,6 +4,8 @@ class StructureStart; +//#define ENABLE_STRUCTURE_SAVING + class StructureFeature : public LargeFeature { public: @@ -17,8 +19,11 @@ public: eFeature_Village, }; +#ifdef ENABLE_STRUCTURE_SAVING private: shared_ptr savedData; +#endif + protected: unordered_map cachedStructures; diff --git a/Minecraft.World/StructureFeatureIO.cpp b/Minecraft.World/StructureFeatureIO.cpp index e786fd0c..784d14c9 100644 --- a/Minecraft.World/StructureFeatureIO.cpp +++ b/Minecraft.World/StructureFeatureIO.cpp @@ -61,17 +61,11 @@ wstring StructureFeatureIO::getEncodeId(StructurePiece *piece) } } -StructureStart *StructureFeatureIO::loadStaticStart(ByteArrayTag *tag, Level *level) +StructureStart *StructureFeatureIO::loadStaticStart(CompoundTag *tag, Level *level) { StructureStart *start = nullptr; - ByteArrayInputStream bais(tag->data); - DataInputStream dis(&bais); - - int version = dis.readInt(); - wstring structureId = dis.readUTF(); - - auto it = startIdClassMap.find( structureId ); + auto it = startIdClassMap.find(tag->getString(L"id")); if(it != startIdClassMap.end()) { start = (it->second)(); @@ -79,30 +73,20 @@ StructureStart *StructureFeatureIO::loadStaticStart(ByteArrayTag *tag, Level *le if (start != nullptr) { - if (!version && !start->isValid()) - { - start->clearDirty(); - start = nullptr; - - app.DebugPrintf("Skipping Structure with id %ls as it was a broken data version\n", it->first.c_str()); - } - else - { - start->load(level, &dis); - } + start->load(level, tag); } else { - app.DebugPrintf( "Skipping Structure with id %ls", it->first.c_str() ); + app.DebugPrintf( "Skipping Structure with id %ls", tag->getString(L"id").c_str() ); } return start; } -StructurePiece *StructureFeatureIO::loadStaticPiece(DataInputStream *dis, Level *level) +StructurePiece *StructureFeatureIO::loadStaticPiece(CompoundTag *tag, Level *level) { StructurePiece *piece = nullptr; - auto it = pieceIdClassMap.find(dis->readUTF() ); + auto it = pieceIdClassMap.find(tag->getString(L"id")); if(it != pieceIdClassMap.end()) { piece = (it->second)(); @@ -110,11 +94,11 @@ StructurePiece *StructureFeatureIO::loadStaticPiece(DataInputStream *dis, Level if (piece != nullptr) { - piece->load(level, dis); + piece->load(level, tag); } else { - app.DebugPrintf( "Skipping Piece with id %ls", it->first.c_str() ); + app.DebugPrintf( "Skipping Piece with id %ls", tag->getString(L"id").c_str() ); } return piece; } \ No newline at end of file diff --git a/Minecraft.World/StructureFeatureIO.h b/Minecraft.World/StructureFeatureIO.h index 44bb6d22..90fc115d 100644 --- a/Minecraft.World/StructureFeatureIO.h +++ b/Minecraft.World/StructureFeatureIO.h @@ -88,6 +88,6 @@ public: static void staticCtor(); static wstring getEncodeId(StructureStart *start); static wstring getEncodeId(StructurePiece *piece); - static StructureStart *loadStaticStart(ByteArrayTag *tag, Level *level); - static StructurePiece *loadStaticPiece(DataInputStream *dis, Level *level); + static StructureStart *loadStaticStart(CompoundTag *tag, Level *level); + static StructurePiece *loadStaticPiece(CompoundTag *tag, Level *level); }; \ No newline at end of file diff --git a/Minecraft.World/StructureFeatureSavedData.cpp b/Minecraft.World/StructureFeatureSavedData.cpp index d417fbb4..6d580d02 100644 --- a/Minecraft.World/StructureFeatureSavedData.cpp +++ b/Minecraft.World/StructureFeatureSavedData.cpp @@ -24,18 +24,15 @@ void StructureFeatureSavedData::save(CompoundTag *tag) tag->put(TAG_FEATURES, pieceTags->copy() ); } -void StructureFeatureSavedData::putFeatureTag(byteArray data, int chunkX, int chunkZ) +CompoundTag *StructureFeatureSavedData::getFeatureTag(int chunkX, int chunkZ) { - wstring name = createFeatureTagId(chunkX, chunkZ); + return pieceTags->getCompound(createFeatureTagId(chunkX, chunkZ)); +} - if (pieceTags->contains(name)) - { - delete pieceTags->getCompound(name); - pieceTags->remove(name); - } - - CompoundTag* tag = new CompoundTag(name); - tag->putByteArray(L"data", data); +void StructureFeatureSavedData::putFeatureTag(CompoundTag *tag, int chunkX, int chunkZ) +{ + wstring name = createFeatureTagId(chunkX, chunkZ); + tag->setName(name); pieceTags->put(name, tag); } diff --git a/Minecraft.World/StructureFeatureSavedData.h b/Minecraft.World/StructureFeatureSavedData.h index 003d5e23..599befd3 100644 --- a/Minecraft.World/StructureFeatureSavedData.h +++ b/Minecraft.World/StructureFeatureSavedData.h @@ -14,8 +14,8 @@ public: void load(CompoundTag *tag); void save(CompoundTag *tag); - - void putFeatureTag(byteArray data, int chunkX, int chunkZ); + CompoundTag *getFeatureTag(int chunkX, int chunkZ); + void putFeatureTag(CompoundTag *tag, int chunkX, int chunkZ); wstring createFeatureTagId(int chunkX, int chunkZ); CompoundTag *getFullTag(); }; \ No newline at end of file diff --git a/Minecraft.World/StructurePiece.cpp b/Minecraft.World/StructurePiece.cpp index db1e793e..bb3887c0 100644 --- a/Minecraft.World/StructurePiece.cpp +++ b/Minecraft.World/StructurePiece.cpp @@ -5,8 +5,6 @@ #include "net.minecraft.world.level.material.h" #include "net.minecraft.world.level.tile.entity.h" #include "net.minecraft.world.entity.h" -#include "net.minecraft.world.entity.monster.h" -#include "net.minecraft.world.entity.npc.h" #include "WeighedTreasure.h" #include "StructurePiece.h" #include "BoundingBox.h" @@ -14,7 +12,6 @@ #include "JavaMath.h" #include "Facing.h" #include "DoorItem.h" -#include "EnchantedBookItem.h" /** * @@ -50,7 +47,6 @@ StructurePiece::StructurePiece() boundingBox = nullptr; orientation = 0; genDepth = 0; - dirty = false; // for reflection } @@ -70,28 +66,27 @@ CompoundTag *StructurePiece::createTag() { CompoundTag *tag = new CompoundTag(); + tag->putString(L"id", StructureFeatureIO::getEncodeId(this)); + tag->put(L"BB", boundingBox->createTag(L"BB")); + tag->putInt(L"O", orientation); + tag->putInt(L"GD", genDepth); + + addAdditonalSaveData(tag); + return tag; } -void StructurePiece::write(DataOutputStream *dos) +void StructurePiece::load(Level *level, CompoundTag *tag) { - wstring encodeId = StructureFeatureIO::getEncodeId(this); - dos->writeUTF(encodeId); - boundingBox->write(dos); - dos->writeInt(orientation); - dos->writeInt(genDepth); - addAdditionalSaveData(dos); -} -void StructurePiece::load(Level *level, DataInputStream *dis) -{ - boundingBox = new BoundingBox(); - boundingBox->read(dis); + if (tag->contains(L"BB")) + { + boundingBox = new BoundingBox(tag->getIntArray(L"BB")); + } + orientation = tag->getInt(L"O"); + genDepth = tag->getInt(L"GD"); - orientation = dis->readInt(); - genDepth = dis->readInt(); - - readAdditonalSaveData(dis); + readAdditonalSaveData(tag); } void StructurePiece::addChildren( StructurePiece* startPiece, list< StructurePiece* > *pieces, Random* random ) @@ -769,36 +764,7 @@ void StructurePiece::generateUpperHalfSphere( Level* level, BoundingBox* chunkBB } } } -} -void StructurePiece::generateFullSphere( Level* level, BoundingBox* chunkBB, int cx, int cy, int cz, int radius, - int edgeTile, int edgeData, int fillTile, int fillData, bool skipAir ) -{ - for ( int y = cy - radius; y <= cy + radius; y++ ) - { - for ( int x = cx - radius; x <= cx + radius; x++ ) - { - for ( int z = cz - radius; z <= cz + radius; z++ ) - { - float dx = ( float )( abs( x - cx ) ) + 0.5f; - float dy = ( float )( abs( y - cy ) ) + 0.5f; - float dz = ( float )( abs( z - cz ) ) + 0.5f; - - float dist = sqrtf( dx * dx + dy * dy + dz * dz ); - - if ( !skipAir || getBlock( level, x, y, z, chunkBB ) != 0 ) - { - if ( fabsf( dist - ( float )radius ) <= 0.5f ) - placeBlock( level, edgeTile, edgeData, x, y, z, chunkBB ); - } - - if ( ( float ) radius - dist > 0.5f ) - { - placeBlock( level, fillTile, fillData, x, y, z, chunkBB ); - } - } - } - } } void StructurePiece::generateAirColumnUp( Level* level, int x, int startY, int z, BoundingBox* chunkBB ) @@ -819,17 +785,6 @@ void StructurePiece::generateAirColumnUp( Level* level, int x, int startY, int z } } -void StructurePiece::generateAirBoxUp( Level* level, int x0, int z0, int x1, int z1, int y, BoundingBox* chunkBB ) -{ - for ( int x = x0; x < x1; ++x ) - { - for ( int z = z0; z < z1; ++z ) - { - placeBlock( level, 0, 0, x, y, z, chunkBB ); - } - } -} - void StructurePiece::fillColumnDown( Level* level, int tile, int tileData, int x, int startY, int z, BoundingBox* chunkBB ) { int worldX = getWorldX( x, z ); @@ -848,17 +803,6 @@ void StructurePiece::fillColumnDown( Level* level, int tile, int tileData, int x } } -void StructurePiece::fillBoxDown( Level* level, int tileId, int tileData, int x0, int y0, int z0, int x1, int z1, BoundingBox* chunkBB ) -{ - for ( int x = x0; x <= x1; x++ ) - { - for ( int z = z0; z <= z1; z++ ) - { - fillColumnDown( level, tileId, tileData, x, y0, z, chunkBB ); - } - } -} - bool StructurePiece::createChest( Level* level, BoundingBox* chunkBB, Random* random, int x, int y, int z, WeighedTreasureArray treasure, int numRolls ) { @@ -879,7 +823,6 @@ bool StructurePiece::createChest( Level* level, BoundingBox* chunkBB, Random* ra return false; } - bool StructurePiece::createDispenser(Level *level, BoundingBox *chunkBB, Random *random, int x, int y, int z, int facing, WeighedTreasureArray items, int numRolls) { int worldX = getWorldX(x, z); @@ -899,507 +842,15 @@ bool StructurePiece::createDispenser(Level *level, BoundingBox *chunkBB, Random return false; } -int StructurePiece::getBlockDataValue( StructureTable::eBlockDataType type, int tile, int data ) +void StructurePiece::createDoor( Level* level, BoundingBox* chunkBB, Random* random, int x, int y, int z, + int orientation ) { - if ( type == StructureTable::eBlockDataType_Orientation ) - return getOrientationData( tile, data ); + int worldX = getWorldX( x, z ); + int worldY = getWorldY( y ); + int worldZ = getWorldZ( x, z ); - if ( type == StructureTable::eBlockDataType_Inverted ) - return ~data & 0xF; - - return data; -} - -void StructurePiece::createCrops( Level *level, BoundingBox *chunkBB, Random *random, int x0, int z0, int x1, int z1, int y, int tileId, int minData, int maxData ) -{ - for ( int x = x0; x <= x1; x++ ) - { - for ( int z = z0; z <= z1; z++ ) - { - placeBlock( level, tileId, Mth::nextInt( random, minData, maxData ), x, y, z, chunkBB ); - } - } -} - -void StructurePiece::generateStructureFromData( Level *level, BoundingBox *chunkBB, Random *random, StructureTable::StructurePiece *piece, vector &objectPlacedFlags, - vector featureConditions, vector tileOptionRemap, vector &entitySpawnCounts ) -{ - unordered_map failures; - - int treasureCount = piece->treasure.size(); - WeighedTreasureArray treasureItems; - - if ( treasureCount > 0 ) + if ( chunkBB->isInside( worldX, worldY, worldZ ) ) { - treasureItems = WeighedTreasureArray( treasureCount ); - for ( unsigned int i = 0; i < treasureCount; ++i ) - { - const StructureTable::TreasureData &t = piece->treasure[i]; - treasureItems[i] = new WeighedTreasure( t.itemId, t.auxValue, t.minCount, t.maxCount, t.weight ); - } - } - - for ( unsigned int i = 0; i < piece->structures.size(); ++i ) - { - StructureTable::StructureData &s = piece->structures[i]; - - bool shouldGenerate = true; - if ( s.v26.size() == 2 ) - { - int bitIndex = s.v26[0]; - bool invert = s.v26[1] != 0; - - if ( bitIndex >= (int)featureConditions.size() ) - { - shouldGenerate = false; - } - else - { - bool bit = featureConditions[bitIndex]; - if ( invert ) - { - if ( bit ) - { - shouldGenerate = false; - } - } - else - { - if ( !bit ) - { - shouldGenerate = false; - } - } - } - } - - if (!s.v27.empty()) - { - for (unsigned int depIdx = 0; depIdx < s.v27.size(); ++depIdx) - { - if (s.id != eGenerateStructure_CheckBlock) - { - auto it = failures.find(s.v27[depIdx]); - if (it != failures.end() && it->second) - { - shouldGenerate = false; - break; - } - } - } - } - - if (shouldGenerate && !s.cropAges.empty()) - { - for (unsigned int exclIdx = 0; exclIdx < s.cropAges.size(); ++exclIdx) - { - for (unsigned int remapIdx = 0; remapIdx < tileOptionRemap.size(); ++remapIdx) - { - if (s.cropAges[exclIdx] == tileOptionRemap[remapIdx]) - { - shouldGenerate = false; - break; - } - } - if (!shouldGenerate) break; - } - } - - if (!shouldGenerate) - continue; - - // @Patoke todo: this is broken, please fix - for (unsigned int remapIdx = 0; remapIdx < tileOptionRemap.size(); ++remapIdx) - { - int offsetValue = tileOptionRemap[remapIdx]; - // start - if (s.startRemap0 == remapIdx) s.x0 += offsetValue; - if (s.startRemap1 == remapIdx) s.x0 += offsetValue; - if (s.startRemap2 == remapIdx) s.y0 += offsetValue; - - // end - if (s.endRemap0 == remapIdx) s.x1 += offsetValue; - if (s.endRemap1 == remapIdx) s.x1 += offsetValue; - if (s.endRemap2 == remapIdx) s.y1 += offsetValue; - } - - switch( s.id ) - { - case eGenerateStructure_Block: - placeBlock( level, s.tileId, getBlockDataValue( (StructureTable::eBlockDataType)s.dataType, s.tileId, s.data ), s.x0, s.y0, s.z0, chunkBB ); - break; - -/* - case eGenerateStructure_maybeGenerateBlock: - maybeGenerateBlock( level, chunkBB, random, s.probability, s.x0, s.y0, s.z0, s.tileId, s.data ); - break; - - case eGenerateStructure_AirBox: - generateAirBox( level, chunkBB, s.x0, s.y0, s.z0, s.x1, s.y1, s.z1 ); - break; -*/ - - case eGenerateStructure_Box: - { - int data0 = getBlockDataValue( (StructureTable::eBlockDataType)s.dataType, s.tileId, s.data ); - int data1 = getBlockDataValue( (StructureTable::eBlockDataType)s.secondDataType, s.secondTileId, s.secondData ); - generateBox( level, chunkBB, s.x0, s.y0, s.z0, s.x1, s.y1, s.z1, s.tileId, data0, s.secondTileId, data1, false ); - break; - } - -/* - case eGenerateStructure_MaybeBox: - generateMaybeBox( level, chunkBB, random, s.probability, s.x0, s.y0, s.z0, s.x1, s.y1, s.z1, s.tileId, s.data, false ); - break; - - case eGenerateStructure_UpperHalfSphere: - generateUpperHalfSphere( level, chunkBB, s.x0, s.y0, s.z0, s.x1, s.y1, s.z1, s.tileId, false ); - break; -*/ - - case eGenerateStructure_FullSphere: - { - int data0 = getBlockDataValue( (StructureTable::eBlockDataType)s.dataType, s.tileId, s.data ); - int data1 = getBlockDataValue( (StructureTable::eBlockDataType)s.secondDataType, s.secondTileId, s.secondData ); - generateFullSphere( level, chunkBB, s.x0, s.y0, s.z0, s.v25[0], s.tileId, data0, s.secondTileId, data1, false ); - break; - } - -/* - case eGenerateStructure_AirColumnUp: - generateAirColumnUp( level, s.x0, s.y0, s.z0, chunkBB ); - break; -*/ - - case eGenerateStructure_fillColumnDown: - { - int data0 = getBlockDataValue( (StructureTable::eBlockDataType)s.dataType, s.tileId, s.data ); - fillColumnDown( level, s.tileId, data0, s.x0, s.y0, s.z0, chunkBB ); - break; - } - - case eGenerateStructure_fillBoxDown: - { - int data0 = getBlockDataValue( (StructureTable::eBlockDataType)s.dataType, s.tileId, s.data ); - fillBoxDown( level, s.tileId, data0, s.x0, s.y0, s.z0, s.x1, s.z1, chunkBB ); - break; - } - - case eGenerateStructure_generateAirBoxUp: - generateAirBoxUp( level, s.x0, s.z0, s.x1, s.z1, s.y0, chunkBB ); - break; - - case eGenerateStructure_Crops: - { - if( tileOptionRemap.empty() ) - break; - if( s.cropAges.size() != 2 ) - break; - if( piece->cropTiles.empty() ) - break; - if( s.tileId >= (int)tileOptionRemap.size() ) - break; - if( s.x0 > s.x1 ) - break; - - int minCropAge = s.cropAges[0]; - int maxCropAge = s.cropAges[1]; - int remapIdx = tileOptionRemap[s.tileId]; - int cropTileId = ( remapIdx >= (int)piece->cropTiles.size() ) ? piece->cropTiles.back() : piece->cropTiles[remapIdx]; - - createCrops( level, chunkBB, random, s.x0, s.z0, s.x1, s.z1, s.y0, cropTileId, minCropAge, maxCropAge); - break; - } - - case eGenerateStructure_CreateDoor: - { - int worldX = getWorldX( s.x0, s.z0 ); - int worldY = getWorldY( s.y0 ); - int worldZ = getWorldZ( s.x0, s.z0 ); - if( chunkBB->isInside( worldX, worldY, worldZ ) ) - { - int doorData = getBlockDataValue( (StructureTable::eBlockDataType)s.dataType, s.tileId, s.data ); - if( s.tileId == Tile::door_wood_Id ) - { - DoorItem::place( level, worldX, worldY, worldZ, doorData, Tile::door_wood ); - } - else - { - DoorItem::place( level, worldX, worldY, worldZ, doorData, Tile::door_iron ); - } - } - break; - } - - case eGenerateStructure_CheckBlock: - { - int block = getBlock(level, s.x0, s.y0, s.z0, chunkBB); - bool match = (block != 0); - - if (!s.v25.empty() && s.v25[0] == 0) - { - match = (block == 0); - } - - if (!match) - { - if (!s.v27.empty()) - { - failures[s.v27[0]] = true; - } - } - - break; - } - - default: - break; - } - } - - vector newObjectPlacedFlags; - - for ( unsigned int i = 0; i < piece->objects.size(); ++i ) - { - const StructureTable::ObjectData &o = piece->objects[i]; - - bool process = true; - if ( (int)objectPlacedFlags.size() == (int)piece->objects.size() ) - { - process = objectPlacedFlags[i]; - } - - bool placed = false; - - if ( process ) - { - if ( o.id == eGenerateObject_Chest || o.id == eGenerateObject_Dispenser ) - { - if ( o.canGenEnchantedBooks ) - { - WeighedTreasure* book = Item::enchantedBook->createForRandomTreasure( random, o.minEnchantedBooks, o.maxEnchantedBooks, o.enchantedBookWeight ); - WeighedTreasureArray treasure = WeighedTreasureArray( treasureCount + 1 ); - - for ( int k = 0; k < treasureCount; k++ ) - { - treasure[k] = treasureItems[k]; - treasure[treasureCount] = book; - } - - int rollOffset = random->nextInt( o.rollWeight ); - if ( o.id == eGenerateObject_Chest ) - { - placed = createChest( level, chunkBB, random, o.x, o.y, o.z, treasure, o.rollCount + rollOffset ); - } - else - { - placed = createDispenser( level, chunkBB, random, o.x, o.y, o.z, o.dispenserDir, treasure, o.rollCount + rollOffset ); - } - - delete book; - } - else - { - int rollOffset = random->nextInt( o.rollWeight ); - if ( o.id == eGenerateObject_Chest ) - { - placed = createChest( level, chunkBB, random, o.x, o.y, o.z, treasureItems, o.rollCount + rollOffset ); - } - else - { - placed = createDispenser( level, chunkBB, random, o.x, o.y, o.z, o.dispenserDir, treasureItems, o.rollCount + rollOffset ); - } - } - } - } - - newObjectPlacedFlags.push_back( placed ); - } - - objectPlacedFlags = newObjectPlacedFlags; - - for ( unsigned int j = 0; j < piece->entities.size(); ++j ) - { - const StructureTable::EntityData &e = piece->entities[j]; - - if ( j >= entitySpawnCounts.size() ) - { - entitySpawnCounts.push_back( 0 ); - } - - spawnEntity( level, chunkBB, e.x, e.y, e.z, (eGenerateEntity)e.id, e.count, const_cast&>( e.professions ), entitySpawnCounts[j] ); - } - - for (int i = 0; i < treasureItems.length; i++) - { - delete treasureItems[i]; + DoorItem::place( level, worldX, worldY, worldZ, orientation, Tile::door_wood ); } } - -void StructurePiece::setDirty() -{ - dirty = true; -} - -void StructurePiece::spawnEntity( Level *level, BoundingBox *chunkBB, int x, int y, int z, eGenerateEntity entityType, int count, vector &professions, int &entitySpawnCounts ) -{ - while ( entitySpawnCounts < count ) - { - int worldX = getWorldX( x, z ); - int worldY = getWorldY( y ); - int worldZ = getWorldZ( x, z ); - - worldX += entitySpawnCounts; - - if ( !chunkBB->isInside( worldX, worldY, worldZ ) ) - { - return; - } - - if ( entityType == eGenerateEntity_Witch ) - { - setDirty(); - - shared_ptr witch = shared_ptr( new Witch( level ) ); - witch->moveTo( worldX + 0.5, worldY, worldZ + 0.5, 0, 0 ); - level->addEntity( witch ); - } - else if ( entityType == eGenerateEntity_Villager ) - { - int profession = 0; - if ( !professions.empty() && entitySpawnCounts < professions.size() ) - profession = professions[entitySpawnCounts]; - - setDirty(); - - shared_ptr villager = shared_ptr( new Villager( level, profession ) ); - villager->moveTo( worldX + 0.5, worldY, worldZ + 0.5, 0, 0 ); - level->addEntity( villager ); - } - - entitySpawnCounts++; - } -} - -void StructurePiece::getRandomValuesFromDataSet( StructureTable::StructurePiece *piece, Random *random, vector &stateConditions, vector &placedTiles ) -{ - for ( int i = 0; i < piece->v8; i++ ) - { - bool value = random->nextBoolean(); - stateConditions.push_back( value ); - } - - for ( unsigned int i = 0; i < piece->v11.size(); i++ ) - { - int value = random->nextInt( piece->v11[i] ); - placedTiles.push_back( value ); - } -} - -void StructurePiece::addStructurePieceSaveData(DataOutputStream *dos, vector &objectState, vector &featureConditions, vector &tileOptionRemap, vector &entitySpawnCounts) -{ - addBoolSaveData( dos, objectState ); - addBoolSaveData( dos, featureConditions ); - addIntSaveData( dos, tileOptionRemap ); - addIntSaveData( dos, entitySpawnCounts ); -} - -void StructurePiece::readStructurePieceSaveData(DataInputStream *dis, vector &objectState, vector &featureConditions, vector &tileOptionRemap, vector &entitySpawnCounts) -{ - objectState = readBoolSaveData( dis ); - featureConditions = readBoolSaveData( dis ); - tileOptionRemap = readIntSaveData( dis ); - entitySpawnCounts = readIntSaveData( dis ); -} - -void StructurePiece::clearDirty() -{ - dirty = false; -} - -bool StructurePiece::isDirty() -{ - return dirty; -} - -void StructurePiece::addBoolSaveData(DataOutputStream *dos, vector &data) -{ - wstring outData; - outData.assign( L"\0" ); - - for ( size_t i = 0; i < data.size(); ++i ) - { - wostringstream woss; - woss << boolalpha << data[i]; - - outData.append( woss.str() ); - - if ( i < data.size() - 1 ) - { - outData.append( L"," ); - } - } - - dos->writeUTF( outData ); -} - -vector StructurePiece::readBoolSaveData( DataInputStream *dis ) -{ - wstring data = dis->readUTF(); - - vector tokens = stringSplit( data, L',' ); - - vector outData; - for ( size_t i = 0; i < tokens.size(); ++i ) - { - wistringstream wiss( tokens[i] ); - bool outVal = false; - - wiss >> boolalpha >> outVal; - - outData.push_back( outVal ); - } - - return outData; -} - -void StructurePiece::addIntSaveData(DataOutputStream *dos, vector &data) -{ - wstring outData; - outData.assign( L"\0" ); - - for ( size_t i = 0; i < data.size(); ++i ) - { - wostringstream woss; - woss << dec << data[i]; - - outData.append( woss.str() ); - - if ( i < data.size() - 1 ) - { - outData.append( L"," ); - } - } - - dos->writeUTF( outData ); -} - -vector StructurePiece::readIntSaveData(DataInputStream *dis) -{ - wstring data = dis->readUTF(); - - vector tokens = stringSplit( data, L',' ); - - vector outData; - for ( size_t i = 0; i < tokens.size(); ++i ) - { - wistringstream wiss( tokens[i] ); - int outVal = 0; - - wiss >> dec >> outVal; - - outData.push_back( outVal ); - } - - return outData; -} \ No newline at end of file diff --git a/Minecraft.World/StructurePiece.h b/Minecraft.World/StructurePiece.h index fceec860..2d5767f9 100644 --- a/Minecraft.World/StructurePiece.h +++ b/Minecraft.World/StructurePiece.h @@ -2,9 +2,6 @@ #include "WeighedRandom.h" #include "BoundingBox.h" #include "StructureFeatureIO.h" -#include "../Minecraft.Client/StructureTable.h" - -using namespace std; class Level; class Random; @@ -66,8 +63,6 @@ public: // 4J is protected in java, but accessed from VillagePieces, not sure h protected: int orientation; int genDepth; -private: - bool dirty; public: StructurePiece(); @@ -79,16 +74,15 @@ public: virtual ~StructurePiece(); virtual CompoundTag *createTag(); - void write(DataOutputStream* dos); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos) = 0; + virtual void addAdditonalSaveData(CompoundTag *tag) = 0; public: - virtual void load(Level *level, DataInputStream *dis); + virtual void load(Level *level, CompoundTag *tag); protected: - virtual void readAdditonalSaveData(DataInputStream *dis) = 0; + virtual void readAdditonalSaveData(CompoundTag *tag) = 0; public: virtual void addChildren(StructurePiece *startPiece, list *pieces, Random *random); @@ -134,28 +128,11 @@ public: virtual void generateMaybeBox(Level *level, BoundingBox *chunkBB, Random *random, float probability, int x0, int y0, int z0, int x1, int y1, int z1, int edgeTile, int fillTile, bool skipAir); virtual void maybeGenerateBlock(Level *level, BoundingBox *chunkBB, Random *random, float probability, int x, int y, int z, int tile, int data); virtual void generateUpperHalfSphere(Level *level, BoundingBox *chunkBB, int x0, int y0, int z0, int x1, int y1, int z1, int fillTile, bool skipAir); - virtual void generateFullSphere(Level* level, BoundingBox* chunkBB, int cx, int cy, int cz, int radius, int edgeTile, int edgeData, int fillTile, int fillData, bool skipAir); virtual void generateAirColumnUp(Level *level, int x, int startY, int z, BoundingBox *chunkBB); - virtual void generateAirBoxUp(Level* level, int x0, int z0, int x1, int z1, int y, BoundingBox* chunkBB); virtual void fillColumnDown(Level *level, int tile, int tileData, int x, int startY, int z, BoundingBox *chunkBB); - virtual void fillBoxDown(Level* level, int tileId, int tileData, int x0, int y0, int z0, int x1, int z1, BoundingBox* chunkBB); virtual bool createChest(Level *level, BoundingBox *chunkBB, Random *random, int x, int y, int z, WeighedTreasureArray treasure, int numRolls); virtual bool createDispenser(Level *level, BoundingBox *chunkBB, Random *random, int x, int y, int z, int facing, WeighedTreasureArray items, int numRolls); - virtual int getBlockDataValue(StructureTable::eBlockDataType type, int tile, int data); - virtual void generateStructureFromData(Level *level, BoundingBox *chunkBB, Random *random, StructureTable::StructurePiece *piece, vector &objectState, vector featureConditions, vector tileOptionRemap, vector &entitySpawnCounts); - virtual void spawnEntity(Level* level, BoundingBox* chunkBB, int x, int y, int z, eGenerateEntity entityType, int count, vector& professions, int& entitySpawnCounts); - virtual void getRandomValuesFromDataSet(StructureTable::StructurePiece *piece, Random* random, vector& featureConditions, vector& tileOptionRemap); - virtual void addStructurePieceSaveData(DataOutputStream* dos, vector& objectState, vector& featureConditions, vector& tileOptionRemap, vector& entitySpawnCounts); - virtual void readStructurePieceSaveData(DataInputStream* dis, vector& objectState, vector& featureConditions, vector& tileOptionRemap, vector& entitySpawnCounts); - virtual void addBoolSaveData(DataOutputStream* dos, vector& data); - virtual vector readBoolSaveData(DataInputStream* dis); - virtual void addIntSaveData(DataOutputStream* dos, vector& data); - virtual vector readIntSaveData(DataInputStream* dis); - -public: - virtual void createCrops(Level* level, BoundingBox* chunkBB, Random* random, int x0, int z0, int x1, int z1, int y, int tileId, int minData, int maxData); - void setDirty(); - void clearDirty(); - bool isDirty(); +protected: + void createDoor(Level *level, BoundingBox *chunkBB, Random *random, int x, int y, int z, int orientation); }; diff --git a/Minecraft.World/StructureStart.cpp b/Minecraft.World/StructureStart.cpp index ef7d8b2e..0065160e 100644 --- a/Minecraft.World/StructureStart.cpp +++ b/Minecraft.World/StructureStart.cpp @@ -10,7 +10,6 @@ StructureStart::StructureStart() { chunkX = chunkZ = 0; boundingBox = nullptr; // 4J added initialiser - dirty = true; } StructureStart::StructureStart(int x, int z) @@ -45,8 +44,7 @@ void StructureStart::postProcess(Level *level, Random *random, BoundingBox *chun while( it != pieces.end() ) { - StructurePiece *piece = *it; - if( piece->getBoundingBox()->intersects(chunkBB) && !piece->postProcess(level, random, chunkBB) ) + if( (*it)->getBoundingBox()->intersects(chunkBB) && !(*it)->postProcess(level, random, chunkBB)) { // this piece can't be placed, so remove it to avoid future // attempts @@ -54,11 +52,6 @@ void StructureStart::postProcess(Level *level, Random *random, BoundingBox *chun } else { - if( piece->isDirty() ) - { - dirty = true; - piece->clearDirty(); - } it++; } } @@ -74,51 +67,51 @@ void StructureStart::calculateBoundingBox() } } -byteArray StructureStart::createTag(int chunkX, int chunkZ) +CompoundTag *StructureStart::createTag(int chunkX, int chunkZ) { - ByteArrayOutputStream baos; - DataOutputStream dos(&baos); + CompoundTag *tag = new CompoundTag(); - dos.writeInt(1); // version - dos.writeUTF(StructureFeatureIO::getEncodeId(this)); - dos.writeInt(chunkX); - dos.writeInt(chunkZ); - boundingBox->write(&dos); + tag->putString(L"id", StructureFeatureIO::getEncodeId(this)); + tag->putInt(L"ChunkX", chunkX); + tag->putInt(L"ChunkZ", chunkZ); + tag->put(L"BB", boundingBox->createTag(L"BB")); - for (auto it = pieces.begin(); it != pieces.end(); ++it) - { - StructurePiece *piece = *it; - piece->write(&dos); - } - - addAdditionalSaveData(&dos); - - return baos.toByteArray(); -} - -void StructureStart::addAdditionalSaveData(DataOutputStream *dos) -{ - -} - -void StructureStart::load(Level *level, DataInputStream *dis) -{ - chunkX = dis->readInt(); - chunkZ = dis->readInt(); - - boundingBox = new BoundingBox(); - boundingBox->read(dis); - - int count = dis->readInt(); - for (int i = 0; i < count; i++) + ListTag *childrenTags = new ListTag(L"Children"); + for(auto& piece : pieces) { - pieces.push_back(StructureFeatureIO::loadStaticPiece(dis, level)); + childrenTags->add(piece->createTag()); + } + tag->put(L"Children", childrenTags); + + addAdditonalSaveData(tag); + + return tag; +} + +void StructureStart::addAdditonalSaveData(CompoundTag *tag) +{ + +} + +void StructureStart::load(Level *level, CompoundTag *tag) +{ + chunkX = tag->getInt(L"ChunkX"); + chunkZ = tag->getInt(L"ChunkZ"); + if (tag->contains(L"BB")) + { + boundingBox = new BoundingBox(tag->getIntArray(L"BB")); } - readAdditonalSaveData(dis); + ListTag *children = (ListTag *) tag->getList(L"Children"); + for (int i = 0; i < children->size(); i++) + { + pieces.push_back(StructureFeatureIO::loadStaticPiece(children->get(i), level)); + } + + readAdditonalSaveData(tag); } -void StructureStart::readAdditonalSaveData(DataInputStream *dis) +void StructureStart::readAdditonalSaveData(CompoundTag *tag) { } @@ -180,14 +173,4 @@ int StructureStart::getChunkX() int StructureStart::getChunkZ() { return chunkZ; -} - -void StructureStart::clearDirty() -{ - dirty = false; -} - -bool StructureStart::isDirty() -{ - return dirty; } \ No newline at end of file diff --git a/Minecraft.World/StructureStart.h b/Minecraft.World/StructureStart.h index 72d782ff..72035367 100644 --- a/Minecraft.World/StructureStart.h +++ b/Minecraft.World/StructureStart.h @@ -14,7 +14,6 @@ protected: private: int chunkX, chunkZ; - bool dirty; public: StructureStart(); @@ -27,10 +26,10 @@ protected: void calculateBoundingBox(); public: - virtual byteArray createTag(int chunkX, int chunkZ); - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void load(Level *level, DataInputStream *dis); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual CompoundTag *createTag(int chunkX, int chunkZ); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void load(Level *level, CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); protected: void moveBelowSeaLevel(Level *level, Random *random, int offset); @@ -39,8 +38,6 @@ public: bool isValid(); int getChunkX(); int getChunkZ(); - void clearDirty(); - bool isDirty(); virtual EStructureStart GetType() = 0; }; diff --git a/Minecraft.World/TheEndBiome.cpp b/Minecraft.World/TheEndBiome.cpp index e8c22525..0dc22150 100644 --- a/Minecraft.World/TheEndBiome.cpp +++ b/Minecraft.World/TheEndBiome.cpp @@ -3,7 +3,6 @@ #include "TheEndBiomeDecorator.h" #include "net.minecraft.world.entity.monster.h" #include "net.minecraft.world.level.tile.h" -#include "..\Minecraft.Client\Minecraft.h" TheEndBiome::TheEndBiome(int id) : Biome(id) { @@ -21,29 +20,8 @@ TheEndBiome::TheEndBiome(int id) : Biome(id) decorator = new TheEndBiomeDecorator(this); } -Vec3 *TheEndBiome::getFogColor(float td, float a) const -{ - int fogColor = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_End_Fog_Colour ); //0xa080a0; - float br = Mth::cos(td * PI * 2) * 2 + 0.5f; - if (br < 0.0f) br = 0.0f; - if (br > 1.0f) br = 1.0f; - - float r = ((fogColor >> 16) & 0xff) / 255.0f; - float g = ((fogColor >> 8) & 0xff) / 255.0f; - float b = ((fogColor) & 0xff) / 255.0f; - r *= br * 0.0f + 0.15f; - g *= br * 0.0f + 0.15f; - b *= br * 0.0f + 0.15f; - - return Vec3::newTemp(r, g, b); -} - -bool TheEndBiome::isNatural() -{ - return false; -} - -bool TheEndBiome::isFoggy() -{ - return true; -} \ No newline at end of file +// 4J Stu - Don't need override +//int TheEndBiome::getSkyColor(float temp) +//{ +// return 0x000000; +//} \ No newline at end of file diff --git a/Minecraft.World/TheEndBiome.h b/Minecraft.World/TheEndBiome.h index 33291b24..b3698511 100644 --- a/Minecraft.World/TheEndBiome.h +++ b/Minecraft.World/TheEndBiome.h @@ -5,8 +5,7 @@ class TheEndBiome : public Biome { public: TheEndBiome(int id); - //TU25 - virtual Vec3 *getFogColor(float td, float a) const; - virtual bool isNatural(); - virtual bool isFoggy(); + + // 4J Stu - Don't need override + //virtual int getSkyColor(float temp); }; \ No newline at end of file diff --git a/Minecraft.World/TheEndDimension.cpp b/Minecraft.World/TheEndDimension.cpp index 202e0caf..7f26d0e8 100644 --- a/Minecraft.World/TheEndDimension.cpp +++ b/Minecraft.World/TheEndDimension.cpp @@ -29,6 +29,23 @@ float *TheEndDimension::getSunriseColor(float td, float a) return nullptr; } +Vec3 *TheEndDimension::getFogColor(float td, float a) const +{ + int fogColor = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_End_Fog_Colour ); //0xa080a0; + float br = Mth::cos(td * PI * 2) * 2 + 0.5f; + if (br < 0.0f) br = 0.0f; + if (br > 1.0f) br = 1.0f; + + float r = ((fogColor >> 16) & 0xff) / 255.0f; + float g = ((fogColor >> 8) & 0xff) / 255.0f; + float b = ((fogColor) & 0xff) / 255.0f; + r *= br * 0.0f + 0.15f; + g *= br * 0.0f + 0.15f; + b *= br * 0.0f + 0.15f; + + return Vec3::newTemp(r, g, b); +} + bool TheEndDimension::hasGround() { return false; @@ -63,13 +80,12 @@ Pos *TheEndDimension::getSpawnPos() return new Pos(100, 50, 0); } +bool TheEndDimension::isFoggyAt(int x, int z) +{ + return true; +} + int TheEndDimension::getSpawnYPosition() { return 50; -} - -// TU30 -int TheEndDimension::getBlockLightColour() -{ - return Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_BlockLight_EndDimension ); } \ No newline at end of file diff --git a/Minecraft.World/TheEndDimension.h b/Minecraft.World/TheEndDimension.h index be33fab3..268be6f6 100644 --- a/Minecraft.World/TheEndDimension.h +++ b/Minecraft.World/TheEndDimension.h @@ -8,6 +8,7 @@ public: virtual ChunkSource *createRandomLevelSource() const; virtual float getTimeOfDay(int64_t time, float a) const; virtual float *getSunriseColor(float td, float a); + virtual Vec3 *getFogColor(float td, float a) const; virtual bool hasGround(); virtual bool mayRespawn() const; virtual bool isNaturalDimension(); @@ -15,5 +16,5 @@ public: virtual bool isValidSpawn(int x, int z) const; virtual Pos *getSpawnPos(); virtual int getSpawnYPosition(); - virtual int getBlockLightColour(); // TU25 + virtual bool isFoggyAt(int x, int z); }; diff --git a/Minecraft.World/Tile.cpp b/Minecraft.World/Tile.cpp index 7139c312..0163433c 100644 --- a/Minecraft.World/Tile.cpp +++ b/Minecraft.World/Tile.cpp @@ -60,7 +60,7 @@ Tile *Tile::gravel = nullptr; Tile *Tile::goldOre = nullptr; Tile *Tile::ironOre = nullptr; Tile *Tile::coalOre = nullptr; -LogTile *Tile::treeTrunk = nullptr; +Tile *Tile::treeTrunk = nullptr; LeafTile *Tile::leaves = nullptr; Tile *Tile::sponge = nullptr; Tile *Tile::glass = nullptr; @@ -215,38 +215,11 @@ Tile *Tile::dropper = nullptr; Tile *Tile::clayHardened_colored = nullptr; Tile *Tile::stained_glass_pane = nullptr; -LogTile *Tile::newTreeTrunk = nullptr; -LeafTile *Tile::newLeaves = nullptr; - -Tile *Tile::woodStairsAcacia = nullptr; -Tile *Tile::woodStairsDarkOak = nullptr; -Tile *Tile::iron_trapdoor = nullptr; - Tile *Tile::hayBlock = nullptr; Tile *Tile::woolCarpet = nullptr; Tile *Tile::clayHardened = nullptr; Tile *Tile::coalBlock = nullptr; -Tile *Tile::daylightDetectorInverted = nullptr; - -Tile *Tile::spruceFenceGate = nullptr; -Tile *Tile::birchFenceGate = nullptr; -Tile *Tile::jungleFenceGate = nullptr; -Tile *Tile::acaciaFenceGate = nullptr; -Tile *Tile::darkOakFenceGate = nullptr; - -Tile *Tile::spruceFence = nullptr; -Tile *Tile::birchFence = nullptr; -Tile *Tile::jungleFence = nullptr; -Tile *Tile::acaciaFence = nullptr; -Tile *Tile::darkOakFence = nullptr; - -Tile *Tile::door_spruce = nullptr; -Tile *Tile::door_birch = nullptr; -Tile *Tile::door_jungle = nullptr; -Tile *Tile::door_acacia = nullptr; -Tile *Tile::door_dark_oak = nullptr; - DWORD Tile::tlsIdxShape = TlsAlloc(); Tile::ThreadStorage::ThreadStorage() @@ -302,9 +275,9 @@ void Tile::staticCtor() Tile::goldOre = (new OreTile(14)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_STONE)->setIconName(L"gold_ore")->setDescriptionId(IDS_TILE_ORE_GOLD)->setUseDescriptionId(IDS_DESC_ORE_GOLD); Tile::ironOre = (new OreTile(15)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_STONE)->setIconName(L"iron_ore")->setDescriptionId(IDS_TILE_ORE_IRON)->setUseDescriptionId(IDS_DESC_ORE_IRON); Tile::coalOre = (new OreTile(16)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_STONE)->setIconName(L"coal_ore")->setDescriptionId(IDS_TILE_ORE_COAL)->setUseDescriptionId(IDS_DESC_ORE_COAL); - Tile::treeTrunk = static_cast((new OldLogTile(17))->setDestroyTime(2.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"log")->setDescriptionId(IDS_TILE_LOG)->sendTileData()->setUseDescriptionId(IDS_DESC_LOG)); + Tile::treeTrunk = (new TreeTile(17))->setDestroyTime(2.0f) ->setSoundType(Tile::SOUND_WOOD)->setIconName(L"log")->setDescriptionId(IDS_TILE_LOG)->sendTileData()->setUseDescriptionId(IDS_DESC_LOG); // 4J - for leaves, have specified that only the data bits that encode the type of leaf are important to be sent - Tile::leaves = static_cast((new LeafTile(18, 0))->setDestroyTime(0.2f)->setLightBlock(1)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"leaves")->setDescriptionId(IDS_TILE_LEAVES)->sendTileData(LeafTile::LEAF_TYPE_MASK)->setUseDescriptionId(IDS_DESC_LEAVES)); + Tile::leaves = static_cast((new LeafTile(18))->setDestroyTime(0.2f)->setLightBlock(1)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"leaves")->setDescriptionId(IDS_TILE_LEAVES)->sendTileData(LeafTile::LEAF_TYPE_MASK)->setUseDescriptionId(IDS_DESC_LEAVES)); Tile::sponge = (new Sponge(19)) ->setDestroyTime(0.6f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"sponge")->setDescriptionId(IDS_TILE_SPONGE)->setUseDescriptionId(IDS_DESC_SPONGE); Tile::glass = (new GlassTile(20, Material::glass, false)) ->setDestroyTime(0.3f)->setSoundType(Tile::SOUND_GLASS)->setIconName(L"glass")->setDescriptionId(IDS_TILE_GLASS)->setUseDescriptionId(IDS_DESC_GLASS); @@ -398,12 +371,12 @@ void Tile::staticCtor() Tile::ironFence = (new ThinFenceTile(101, L"iron_bars", L"iron_bars", Material::metal, true)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_iron)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(SOUND_METAL)->setDescriptionId(IDS_TILE_IRON_FENCE)->setUseDescriptionId(IDS_DESC_IRON_FENCE); - Tile::thinGlass = (new ThinFenceTile(102, L"glass", L"glass_pane_top", Material::glass, false)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_glass, Item::eMaterial_glass)->setDestroyTime(0.3f)->setSoundType(SOUND_GLASS)->setDescriptionId(IDS_TILE_THIN_GLASS)->setUseDescriptionId(IDS_DESC_THIN_GLASS); + Tile::thinGlass = (new ThinFenceTile(102, L"glass", L"glass_pane_top", Material::glass, false)) ->setDestroyTime(0.3f)->setSoundType(SOUND_GLASS)->setDescriptionId(IDS_TILE_THIN_GLASS)->setUseDescriptionId(IDS_DESC_THIN_GLASS); Tile::melon = (new MelonTile(103)) ->setDestroyTime(1.0f)->setSoundType(SOUND_WOOD)->setIconName(L"melon")->setDescriptionId(IDS_TILE_MELON)->setUseDescriptionId(IDS_DESC_MELON_BLOCK); Tile::pumpkinStem = (new StemTile(104, Tile::pumpkin)) ->setDestroyTime(0.0f)->setSoundType(SOUND_WOOD)->setIconName(L"pumpkin_stem")->setDescriptionId(IDS_TILE_PUMPKIN_STEM)->sendTileData(); Tile::melonStem = (new StemTile(105, Tile::melon)) ->setDestroyTime(0.0f)->setSoundType(SOUND_WOOD)->setIconName(L"melon_stem")->setDescriptionId(IDS_TILE_MELON_STEM)->sendTileData(); Tile::vine = (new VineTile(106))->setDestroyTime(0.2f) ->setSoundType(SOUND_GRASS)->setIconName(L"vine")->setDescriptionId(IDS_TILE_VINE)->setUseDescriptionId(IDS_DESC_VINE)->sendTileData(); - Tile::fenceGate = (new FenceGateTile(107, L"planks_oak")) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fencegate, Item::eMaterial_wood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"fenceGate")->setDescriptionId(IDS_TILE_FENCE_GATE)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); + Tile::fenceGate = (new FenceGateTile(107)) ->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"fenceGate")->setDescriptionId(IDS_TILE_FENCE_GATE)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); Tile::stairs_bricks = (new StairTile(108, Tile::redBrick,0)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_brick) ->setIconName(L"stairsBrick")->setDescriptionId(IDS_TILE_STAIRS_BRICKS) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::stairs_stoneBrickSmooth = (new StairTile(109, Tile::stoneBrick,0)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_stoneSmooth)->setIconName(L"stairsStoneBrickSmooth")->setDescriptionId(IDS_TILE_STAIRS_STONE_BRICKS_SMOOTH) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::mycel = static_cast((new MycelTile(110))->setDestroyTime(0.6f)->setSoundType(SOUND_GRASS)->setIconName(L"mycelium")->setDescriptionId(IDS_TILE_MYCEL)->setUseDescriptionId(IDS_DESC_MYCEL)); @@ -434,9 +407,9 @@ void Tile::staticCtor() Tile::tripWireSource = static_cast((new TripWireSourceTile(131))->setBaseItemTypeAndMaterial(Item::eBaseItemType_lever, Item::eMaterial_undefined)->setIconName(L"trip_wire_source")->sendTileData()->setDescriptionId(IDS_TILE_TRIPWIRE_SOURCE)->setUseDescriptionId(IDS_DESC_TRIPWIRE_SOURCE)); Tile::tripWire = (new TripWireTile(132)) ->setIconName(L"trip_wire")->sendTileData()->setDescriptionId(IDS_TILE_TRIPWIRE)->setUseDescriptionId(IDS_DESC_TRIPWIRE); Tile::emeraldBlock = (new MetalTile(133)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_emerald)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(SOUND_METAL)->setIconName(L"emerald_block")->setDescriptionId(IDS_TILE_EMERALDBLOCK)->setUseDescriptionId(IDS_DESC_EMERALDBLOCK); - Tile::woodStairsDark = (new StairTile(134, Tile::wood, LogTile::DARK_TRUNK)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_sprucewood)->setIconName(L"stairsWoodSpruce")->setDescriptionId(IDS_TILE_STAIRS_SPRUCEWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); - Tile::woodStairsBirch = (new StairTile(135, Tile::wood, LogTile::BIRCH_TRUNK)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_birchwood)->setIconName(L"stairsWoodBirch")->setDescriptionId(IDS_TILE_STAIRS_BIRCHWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); - Tile::woodStairsJungle =(new StairTile(136, Tile::wood, LogTile::JUNGLE_TRUNK))->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_junglewood)->setIconName(L"stairsWoodJungle")->setDescriptionId(IDS_TILE_STAIRS_JUNGLEWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); + Tile::woodStairsDark = (new StairTile(134, Tile::wood, TreeTile::DARK_TRUNK)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_sprucewood)->setIconName(L"stairsWoodSpruce")->setDescriptionId(IDS_TILE_STAIRS_SPRUCEWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); + Tile::woodStairsBirch = (new StairTile(135, Tile::wood, TreeTile::BIRCH_TRUNK)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_birchwood)->setIconName(L"stairsWoodBirch")->setDescriptionId(IDS_TILE_STAIRS_BIRCHWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); + Tile::woodStairsJungle =(new StairTile(136, Tile::wood, TreeTile::JUNGLE_TRUNK))->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_junglewood)->setIconName(L"stairsWoodJungle")->setDescriptionId(IDS_TILE_STAIRS_JUNGLEWOOD) ->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); Tile::commandBlock = (new CommandBlock(137)) ->setIndestructible()->setExplodeable(6000000)->setIconName(L"command_block")->setDescriptionId(IDS_TILE_COMMAND_BLOCK)->setUseDescriptionId(IDS_DESC_COMMAND_BLOCK); Tile::beacon = static_cast((new BeaconTile(138))->setLightEmission(1.0f)->setIconName(L"beacon")->setDescriptionId(IDS_TILE_BEACON)->setUseDescriptionId(IDS_DESC_BEACON)); Tile::cobbleWall = (new WallTile(139, Tile::stoneBrick)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_stone)->setIconName(L"cobbleWall")->setDescriptionId(IDS_TILE_COBBLESTONE_WALL)->setUseDescriptionId(IDS_DESC_COBBLESTONE_WALL); @@ -453,7 +426,7 @@ void Tile::staticCtor() Tile::comparator_off = static_cast((new ComparatorTile(149, false))->setDestroyTime(0.0f)->setSoundType(SOUND_WOOD)->setIconName(L"comparator_off")->setDescriptionId(IDS_TILE_COMPARATOR)->setUseDescriptionId(IDS_DESC_COMPARATOR)); Tile::comparator_on = static_cast((new ComparatorTile(150, true))->setDestroyTime(0.0f)->setLightEmission(10 / 16.0f)->setSoundType(SOUND_WOOD)->setIconName(L"comparator_on")->setDescriptionId(IDS_TILE_COMPARATOR)->setUseDescriptionId(IDS_DESC_COMPARATOR)); - Tile::daylightDetector = static_cast((new DaylightDetectorTile(151, false))->setDestroyTime(0.2f)->setSoundType(SOUND_WOOD)->setIconName(L"daylight_detector")->setDescriptionId(IDS_TILE_DAYLIGHT_DETECTOR)->setUseDescriptionId(IDS_DESC_DAYLIGHT_DETECTOR)); + Tile::daylightDetector = static_cast((new DaylightDetectorTile(151))->setDestroyTime(0.2f)->setSoundType(SOUND_WOOD)->setIconName(L"daylight_detector")->setDescriptionId(IDS_TILE_DAYLIGHT_DETECTOR)->setUseDescriptionId(IDS_DESC_DAYLIGHT_DETECTOR)); Tile::redstoneBlock = (new PoweredMetalTile(152)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_redstone)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(SOUND_METAL)->setIconName(L"redstone_block")->setDescriptionId(IDS_TILE_REDSTONE_BLOCK)->setUseDescriptionId(IDS_DESC_REDSTONE_BLOCK); Tile::netherQuartz = (new OreTile(153)) ->setDestroyTime(3.0f)->setExplodeable(5)->setSoundType(SOUND_STONE)->setIconName(L"quartz_ore")->setDescriptionId(IDS_TILE_NETHER_QUARTZ)->setUseDescriptionId(IDS_DESC_NETHER_QUARTZ_ORE); Tile::hopper = static_cast((new HopperTile(154))->setBaseItemTypeAndMaterial(Item::eBaseItemType_redstoneContainer, Item::eMaterial_undefined)->setDestroyTime(3.0f)->setExplodeable(8)->setSoundType(SOUND_WOOD)->setIconName(L"hopper")->setDescriptionId(IDS_TILE_HOPPER)->setUseDescriptionId(IDS_DESC_HOPPER)); @@ -464,37 +437,11 @@ void Tile::staticCtor() Tile::clayHardened_colored = (new ColoredTile(159, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_clay, Item::eMaterial_clay)->setDestroyTime(1.25f)->setExplodeable(7)->setSoundType(SOUND_STONE)->setIconName(L"hardened_clay_stained")->setDescriptionId(IDS_TILE_STAINED_CLAY)->setUseDescriptionId(IDS_DESC_STAINED_CLAY); Tile::stained_glass_pane = (new StainedGlassPaneBlock(160)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_glass, Item::eMaterial_glass)->setDestroyTime(0.3f)->setSoundType(SOUND_GLASS)->setIconName(L"glass")->setDescriptionId(IDS_TILE_STAINED_GLASS_PANE)->setUseDescriptionId(IDS_DESC_STAINED_GLASS_PANE); - Tile::newTreeTrunk = static_cast((new NewLogTile(161))->setDestroyTime(2.0f) ->setSoundType(Tile::SOUND_WOOD)->setIconName(L"log")->setDescriptionId(IDS_TILE_LOG)->sendTileData()->setUseDescriptionId(IDS_DESC_LOG)); - Tile::newLeaves = static_cast((new LeafTile(162, 4)) ->setDestroyTime(0.2f)->setSoundType(Tile::SOUND_GRASS)->setIconName(L"leaves")->setDescriptionId(IDS_TILE_LEAVES)->setUseDescriptionId(IDS_DESC_LEAVES)); - - Tile::woodStairsAcacia = (new StairTile(163, Tile::wood, NewLogTile::ACACIA_TRUNK))->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_acaciawood)->setIconName(L"stairsWoodAcacia")->setDescriptionId(IDS_TILE_STAIRS_ACACIA_WOOD)->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); - Tile::woodStairsDarkOak = (new StairTile(164, Tile::wood, NewLogTile::DARK_OAK_TRUNK))->setBaseItemTypeAndMaterial(Item::eBaseItemType_stairs, Item::eMaterial_darkoakwood)->setIconName(L"stairsWoodDarkOak")->setDescriptionId(IDS_TILE_STAIRS_DARK_OAK_WOOD)->sendTileData()->setUseDescriptionId(IDS_DESC_STAIRS); - Tile::iron_trapdoor = (new TrapDoorTile(167, Material::metal))->setBaseItemTypeAndMaterial(Item::eBaseItemType_door, Item::eMaterial_trap)->setDestroyTime(5.0f)->setSoundType(Tile::SOUND_METAL)->setIconName(L"iron_trapdoor")->setDescriptionId(IDS_TILE_TRAPDOOR_IRON)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_TRAPDOOR_IRON); - Tile::hayBlock = (new HayBlockTile(170)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_wheat)->setDestroyTime(0.5f)->setSoundType(SOUND_GRASS)->setIconName(L"hay_block")->setDescriptionId(IDS_TILE_HAY)->setUseDescriptionId(IDS_DESC_HAY); Tile::woolCarpet = (new WoolCarpetTile(171)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_carpet, Item::eMaterial_cloth)->setDestroyTime(0.1f)->setSoundType(SOUND_CLOTH)->setIconName(L"woolCarpet")->setLightBlock(0)->setDescriptionId(IDS_TILE_CARPET)->setUseDescriptionId(IDS_DESC_CARPET); Tile::clayHardened = (new Tile(172, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_clay, Item::eMaterial_clay)->setDestroyTime(1.25f)->setExplodeable(7)->setSoundType(SOUND_STONE)->setIconName(L"hardened_clay")->setDescriptionId(IDS_TILE_HARDENED_CLAY)->setUseDescriptionId(IDS_DESC_HARDENED_CLAY); Tile::coalBlock = (new Tile(173, Material::stone)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_block, Item::eMaterial_coal)->setDestroyTime(5.0f)->setExplodeable(10)->setSoundType(SOUND_STONE)->setIconName(L"coal_block")->setDescriptionId(IDS_TILE_COAL)->setUseDescriptionId(IDS_DESC_COAL_BLOCK); - Tile::daylightDetectorInverted = static_cast((new DaylightDetectorTile(178, true))->setDestroyTime(0.2f)->setSoundType(SOUND_WOOD)->setIconName(L"daylight_detector")->setDescriptionId(IDS_TILE_DAYLIGHT_DETECTOR)->setUseDescriptionId(IDS_DESC_DAYLIGHT_DETECTOR)); - - Tile::spruceFenceGate = (new FenceGateTile(183, L"planks_spruce")) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fencegate, Item::eMaterial_sprucewood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"fenceGate")->setDescriptionId(IDS_TILE_FENCE_GATE_SPRUCE)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); - Tile::birchFenceGate = (new FenceGateTile(184, L"planks_birch")) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fencegate, Item::eMaterial_birchwood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"fenceGate")->setDescriptionId(IDS_TILE_FENCE_GATE_BIRCH)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); - Tile::jungleFenceGate = (new FenceGateTile(185, L"planks_jungle")) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fencegate, Item::eMaterial_junglewood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"fenceGate")->setDescriptionId(IDS_TILE_FENCE_GATE_JUNGLE)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); - Tile::acaciaFenceGate = (new FenceGateTile(186, L"planks_acacia")) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fencegate, Item::eMaterial_acaciawood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"fenceGate")->setDescriptionId(IDS_TILE_FENCE_GATE_ACACIA)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); - Tile::darkOakFenceGate = (new FenceGateTile(187, L"planks_big_oak")) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fencegate, Item::eMaterial_darkoakwood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(SOUND_WOOD)->setIconName(L"fenceGate")->setDescriptionId(IDS_TILE_FENCE_GATE_DARK_OAK)->sendTileData()->setUseDescriptionId(IDS_DESC_FENCE_GATE); - - Tile::spruceFence = (new FenceTile(188, L"planks_spruce", Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_sprucewood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(IDS_TILE_FENCE_SPRUCE)->setUseDescriptionId(IDS_DESC_FENCE); - Tile::birchFence = (new FenceTile(189, L"planks_birch", Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_birchwood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(IDS_TILE_FENCE_BIRCH)->setUseDescriptionId(IDS_DESC_FENCE); - Tile::jungleFence = (new FenceTile(190, L"planks_jungle", Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_junglewood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(IDS_TILE_FENCE_JUNGLE)->setUseDescriptionId(IDS_DESC_FENCE); - Tile::acaciaFence = (new FenceTile(191, L"planks_acacia", Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_acaciawood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(IDS_TILE_FENCE_ACACIA)->setUseDescriptionId(IDS_DESC_FENCE); - Tile::darkOakFence = (new FenceTile(192, L"planks_big_oak", Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_fence, Item::eMaterial_darkoakwood)->setDestroyTime(2.0f)->setExplodeable(5)->setSoundType(Tile::SOUND_WOOD)->setDescriptionId(IDS_TILE_FENCE_DARK_OAK)->setUseDescriptionId(IDS_DESC_FENCE); - - Tile::door_spruce = (new DoorTile(193, Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_door, Item::eMaterial_sprucewood)->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_spruce")->setDescriptionId(IDS_TILE_DOOR_SPRUCE)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); - Tile::door_birch = (new DoorTile(194, Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_door, Item::eMaterial_birchwood)->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_birch")->setDescriptionId(IDS_TILE_DOOR_BIRCH)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); - Tile::door_jungle = (new DoorTile(195, Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_door, Item::eMaterial_junglewood)->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_jungle")->setDescriptionId(IDS_TILE_DOOR_JUNGLE)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); - Tile::door_acacia = (new DoorTile(196, Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_door, Item::eMaterial_acaciawood)->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_acacia")->setDescriptionId(IDS_TILE_DOOR_ACACIA)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); - Tile::door_dark_oak = (new DoorTile(197, Material::wood)) ->setBaseItemTypeAndMaterial(Item::eBaseItemType_door, Item::eMaterial_darkoakwood)->setDestroyTime(3.0f)->setSoundType(Tile::SOUND_WOOD)->setIconName(L"door_dark_oak")->setDescriptionId(IDS_TILE_DOOR_DARK_OAK)->setNotCollectStatistics()->sendTileData()->setUseDescriptionId(IDS_DESC_DOOR_WOOD); // Special cases for certain items since they can have different icons Item::items[wool_Id] = ( new WoolTileItem(Tile::wool_Id- 256) )->setIconName(L"cloth")->setDescriptionId(IDS_TILE_CLOTH)->setUseDescriptionId(IDS_DESC_WOOL); @@ -502,8 +449,8 @@ void Tile::staticCtor() Item::items[stained_glass_Id] = ( new WoolTileItem(Tile::stained_glass_Id - 256))->setIconName(L"stainedGlass")->setDescriptionId(IDS_TILE_STAINED_GLASS)->setUseDescriptionId(IDS_DESC_STAINED_GLASS); Item::items[stained_glass_pane_Id] = ( new WoolTileItem(Tile::stained_glass_pane_Id - 256))->setIconName(L"stainedGlassPane")->setDescriptionId(IDS_TILE_STAINED_GLASS_PANE)->setUseDescriptionId(IDS_DESC_STAINED_GLASS_PANE); Item::items[woolCarpet_Id] = ( new WoolTileItem(Tile::woolCarpet_Id - 256))->setIconName(L"woolCarpet")->setDescriptionId(IDS_TILE_CARPET)->setUseDescriptionId(IDS_DESC_CARPET); - Item::items[treeTrunk_Id] = ( new MultiTextureTileItem(Tile::treeTrunk_Id - 256, treeTrunk, (int *)LogTile::TREE_NAMES, 4) )->setIconName(L"log")->setDescriptionId(IDS_TILE_LOG)->setUseDescriptionId(IDS_DESC_LOG); - Item::items[wood_Id] = ( new MultiTextureTileItem(Tile::wood_Id - 256, Tile::wood, (int *)WoodTile::WOOD_NAMES, 6, IDS_TILE_PLANKS))->setIconName(L"wood")->setDescriptionId(IDS_TILE_OAKWOOD_PLANKS)->setUseDescriptionId(IDS_DESC_LOG); // <- TODO + Item::items[treeTrunk_Id] = ( new MultiTextureTileItem(Tile::treeTrunk_Id - 256, treeTrunk, (int *)TreeTile::TREE_NAMES, 4) )->setIconName(L"log")->setDescriptionId(IDS_TILE_LOG)->setUseDescriptionId(IDS_DESC_LOG); + Item::items[wood_Id] = ( new MultiTextureTileItem(Tile::wood_Id - 256, Tile::wood, (int *)WoodTile::WOOD_NAMES, 4, IDS_TILE_PLANKS))->setIconName(L"wood")->setDescriptionId(IDS_TILE_OAKWOOD_PLANKS)->setUseDescriptionId(IDS_DESC_LOG); // <- TODO Item::items[monsterStoneEgg_Id] = ( new MultiTextureTileItem(Tile::monsterStoneEgg_Id - 256, monsterStoneEgg, (int *)StoneMonsterTile::STONE_MONSTER_NAMES, 3))->setIconName(L"monsterStoneEgg")->setDescriptionId(IDS_TILE_STONE_SILVERFISH)->setUseDescriptionId(IDS_DESC_STONE_SILVERFISH); // 4J - Brought forward from post-1.2 to fix stacking problem Item::items[stoneBrick_Id] = ( new MultiTextureTileItem(Tile::stoneBrick_Id - 256, stoneBrick,(int *)SmoothStoneBrickTile::SMOOTH_STONE_BRICK_NAMES, 4))->setIconName(L"stonebricksmooth")->setDescriptionId(IDS_TILE_STONE_BRICK_SMOOTH); Item::items[sandStone_Id] = ( new MultiTextureTileItem(sandStone_Id - 256, sandStone, SandStoneTile::SANDSTONE_NAMES, SandStoneTile::SANDSTONE_BLOCK_NAMES) )->setIconName(L"sandStone")->setDescriptionId(IDS_TILE_SANDSTONE)->setUseDescriptionId(IDS_DESC_SANDSTONE); @@ -524,8 +471,7 @@ void Tile::staticCtor() Item::items[pistonStickyBase_Id] = ( new PistonTileItem(Tile::pistonStickyBase_Id - 256) )->setDescriptionId(IDS_TILE_PISTON_STICK_BASE)->setUseDescriptionId(IDS_DESC_STICKY_PISTON); Item::items[cobbleWall_Id] = ( new MultiTextureTileItem(cobbleWall_Id - 256, cobbleWall, (int *)WallTile::COBBLE_NAMES, 2) )->setDescriptionId(IDS_TILE_COBBLESTONE_WALL)->setUseDescriptionId(IDS_DESC_COBBLESTONE_WALL); Item::items[anvil_Id] = ( new AnvilTileItem(anvil) )->setDescriptionId(IDS_TILE_ANVIL)->setUseDescriptionId(IDS_DESC_ANVIL); - Item::items[newTreeTrunk_Id] = ( new MultiTextureTileItem(Tile::newTreeTrunk_Id - 256, Tile::newTreeTrunk, (int *)NewLogTile::TREE_NAMES, 2))->setIconName(L"log")->setDescriptionId(IDS_TILE_LOG)->setUseDescriptionId(IDS_DESC_LOG); - Item::items[newLeaves_Id] = ( new LeafTileItem(Tile::newLeaves_Id - 256))->setIconName(L"leaves")->setDescriptionId(IDS_TILE_LEAVES)->setUseDescriptionId(IDS_DESC_LEAVES); + for (int i = 0; i < 256; i++) { @@ -868,9 +814,6 @@ Icon *Tile::getTexture(int face) AABB *Tile::getTileAABB(Level *level, int x, int y, int z) { ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); - if (tls == nullptr) - return AABB::newTemp(x, y, z, x, y, z); - // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1); @@ -885,9 +828,6 @@ void Tile::addAABBs(Level *level, int x, int y, int z, AABB *box, AABBList *boxe AABB *Tile::getAABB(Level *level, int x, int y, int z) { ThreadStorage *tls = static_cast(TlsGetValue(Tile::tlsIdxShape)); - if (tls == nullptr) - return AABB::newTemp(x, y, z, x, y, z); - // 4J Stu - Added this so that the TLS shape is correct for this tile if(tls->tileId != this->id) updateDefaultShape(); return AABB::newTemp(x + tls->xx0, y + tls->yy0, z + tls->zz0, x + tls->xx1, y + tls->yy1, z + tls->zz1); @@ -1286,7 +1226,7 @@ void Tile::playerDestroy(Level *level, shared_ptr player, int x, int y, player->awardStat(GenericStats::totalBlocksMined(), GenericStats::param_noArgs()); // 4J : WESTY : Added for other award. player->causeFoodExhaustion(FoodConstants::EXHAUSTION_MINE); - if( id == Tile::treeTrunk_Id || id == Tile::newTreeTrunk_Id ) + if( id == Tile::treeTrunk_Id ) player->awardStat(GenericStats::mineWood(), GenericStats::param_noArgs()); @@ -1679,11 +1619,6 @@ const int Tile::furnace_Id; const int Tile::furnace_lit_Id; const int Tile::sign_Id; const int Tile::door_wood_Id; -const int Tile::door_spruce_Id; -const int Tile::door_birch_Id; -const int Tile::door_jungle_Id; -const int Tile::door_acacia_Id; -const int Tile::door_dark_oak_Id; const int Tile::ladder_Id; const int Tile::rail_Id; const int Tile::stairs_stone_Id; @@ -1715,11 +1650,7 @@ const int Tile::cake_Id; const int Tile::diode_off_Id; const int Tile::diode_on_Id; const int Tile::stained_glass_Id; -const int Tile::stained_glass_pane_Id; -const int Tile::newTreeTrunk_Id; -const int Tile::newLeaves_Id; const int Tile::trapdoor_Id; -const int Tile::iron_trapdoor_Id; const int Tile::monsterStoneEgg_Id; const int Tile::stoneBrick_Id; const int Tile::hugeMushroom_brown_Id; @@ -1731,11 +1662,6 @@ const int Tile::pumpkinStem_Id; const int Tile::melonStem_Id; const int Tile::vine_Id; const int Tile::fenceGate_Id; -const int Tile::spruceFenceGate_Id; -const int Tile::birchFenceGate_Id; -const int Tile::jungleFenceGate_Id; -const int Tile::acaciaFenceGate_Id; -const int Tile::darkOakFenceGate_Id; const int Tile::stairs_bricks_Id; const int Tile::stairs_stoneBrick_Id; const int Tile::mycel_Id; @@ -1760,8 +1686,6 @@ const int Tile::stairs_sandstone_Id; const int Tile::stairs_sprucewood_Id; const int Tile::stairs_birchwood_Id; const int Tile::stairs_junglewood_Id; -const int Tile::stairs_acaciawood_Id; -const int Tile::stairs_darkoakwood_Id; const int Tile::emeraldOre_Id; const int Tile::enderChest_Id; const int Tile::tripWireSource_Id; diff --git a/Minecraft.World/Tile.h b/Minecraft.World/Tile.h index d7bfbced..307c4106 100644 --- a/Minecraft.World/Tile.h +++ b/Minecraft.World/Tile.h @@ -7,7 +7,6 @@ using namespace std; class GrassTile; class LeafTile; -class LogTile; class TallGrass; class DeadBushTile; class FireTile; @@ -73,16 +72,16 @@ public: // tile update flags // neighbors: notify neighbors the block changed - static constexpr int UPDATE_NEIGHBORS = (1 << 0); + static const int UPDATE_NEIGHBORS = (1 << 0); // clients: send tile update over network connections - static constexpr int UPDATE_CLIENTS = (1 << 1); + static const int UPDATE_CLIENTS = (1 << 1); // invisible: this update is invisible, so don't rebuild graphics - static constexpr int UPDATE_INVISIBLE = (1 << 2); + static const int UPDATE_INVISIBLE = (1 << 2); // clients: send tile update over network connections - static constexpr int UPDATE_INVISIBLE_NO_LIGHT = (1 << 3) | UPDATE_INVISIBLE; + static const int UPDATE_INVISIBLE_NO_LIGHT = (1 << 3) | UPDATE_INVISIBLE; - static constexpr int UPDATE_NONE = UPDATE_INVISIBLE; - static constexpr int UPDATE_ALL = UPDATE_NEIGHBORS | UPDATE_CLIENTS; + static const int UPDATE_NONE = UPDATE_INVISIBLE; + static const int UPDATE_ALL = UPDATE_NEIGHBORS | UPDATE_CLIENTS; private: // 4J Stu - Was const but had to change it so that we can initialise it in TileStaticInit @@ -361,38 +360,11 @@ public: static const int clayHardened_colored_Id = 159; static const int stained_glass_pane_Id = 160; - static const int newTreeTrunk_Id = 161; - static const int newLeaves_Id = 162; - - static const int stairs_acaciawood_Id = 163; - static const int stairs_darkoakwood_Id = 164; - - static const int iron_trapdoor_Id = 167; - static const int hayBlock_Id = 170; static const int woolCarpet_Id = 171; static const int clayHardened_Id = 172; static const int coalBlock_Id = 173; - static const int daylightDetectorInverted_Id = 178; - - static const int spruceFenceGate_Id = 183; - static const int birchFenceGate_Id = 184; - static const int jungleFenceGate_Id = 185; - static const int acaciaFenceGate_Id = 186; - static const int darkOakFenceGate_Id = 187; - - static const int spruce_fence_Id = 188; - static const int birch_fence_Id = 189; - static const int jungle_fence_Id = 190; - static const int acacia_fence_Id = 191; - static const int dark_oak_fence_Id = 192; - - static const int door_spruce_Id = 193; - static const int door_birch_Id = 194; - static const int door_jungle_Id = 195; - static const int door_acacia_Id = 196; - static const int door_dark_oak_Id= 197; static Tile *stone; static GrassTile *grass; @@ -410,7 +382,7 @@ public: static Tile *goldOre; static Tile *ironOre; static Tile *coalOre; - static LogTile *treeTrunk; + static Tile *treeTrunk; static LeafTile *leaves; static Tile *sponge; static Tile *glass; @@ -564,38 +536,11 @@ public: static Tile *clayHardened_colored; static Tile *stained_glass_pane; - static LogTile *newTreeTrunk; - static LeafTile *newLeaves; - - static Tile *woodStairsAcacia; - static Tile *woodStairsDarkOak; - static Tile *iron_trapdoor; - static Tile *hayBlock; static Tile *woolCarpet; static Tile *clayHardened; static Tile *coalBlock; - static Tile *daylightDetectorInverted; - - static Tile *spruceFenceGate; - static Tile *birchFenceGate; - static Tile *jungleFenceGate; - static Tile *acaciaFenceGate; - static Tile *darkOakFenceGate; - - static Tile *spruceFence; - static Tile *birchFence; - static Tile *jungleFence; - static Tile *acaciaFence; - static Tile *darkOakFence; - - static Tile *door_spruce; - static Tile *door_birch; - static Tile *door_jungle; - static Tile *door_acacia; - static Tile *door_dark_oak; - static void staticCtor(); int id; diff --git a/Minecraft.World/TileItem.cpp b/Minecraft.World/TileItem.cpp index 8c55bfce..8d22594d 100644 --- a/Minecraft.World/TileItem.cpp +++ b/Minecraft.World/TileItem.cpp @@ -128,7 +128,7 @@ bool TileItem::useOn(shared_ptr instance, shared_ptr playe // // if(iPlaceSound==-1) // { - // strcpy_s(szPlaceSoundName,"nullptr"); + // strcpy(szPlaceSoundName,"nullptr"); // } // else // { @@ -136,7 +136,7 @@ bool TileItem::useOn(shared_ptr instance, shared_ptr playe // } // if(iStepSound==-1) // { - // strcpy_s(szStepSoundName,"nullptr"); + // strcpy(szStepSoundName,"nullptr"); // } // else // { diff --git a/Minecraft.World/TorchTile.cpp b/Minecraft.World/TorchTile.cpp index 5ad55762..129a3b13 100644 --- a/Minecraft.World/TorchTile.cpp +++ b/Minecraft.World/TorchTile.cpp @@ -71,12 +71,15 @@ int TorchTile::getRenderShape() bool TorchTile::isConnection(Level *level, int x, int y, int z) { if (level->isTopSolidBlocking(x, y, z)) + { return true; - + } int tile = level->getTile(x, y, z); - if (FenceTile::isFence(tile) || tile == Tile::glass_Id || tile == Tile::cobbleWall_Id) + if (tile == Tile::fence_Id || tile == Tile::netherFence_Id + || tile == Tile::glass_Id || tile == Tile::cobbleWall_Id) + { return true; - + } return false; } diff --git a/Minecraft.World/TrapDoorTile.cpp b/Minecraft.World/TrapDoorTile.cpp index 69191973..6ea64172 100644 --- a/Minecraft.World/TrapDoorTile.cpp +++ b/Minecraft.World/TrapDoorTile.cpp @@ -5,6 +5,7 @@ #include "net.minecraft.h" #include "TrapDoorTile.h" + TrapDoorTile::TrapDoorTile(int id, Material *material) : Tile(id, material,isSolidRender()) { float r = 0.5f; @@ -17,11 +18,13 @@ bool TrapDoorTile::blocksLight() return false; } + bool TrapDoorTile::isSolidRender(bool isServerLevel) { return false; } + bool TrapDoorTile::isCubeShaped() { return false; @@ -37,31 +40,37 @@ int TrapDoorTile::getRenderShape() return Tile::SHAPE_BLOCK; } + AABB *TrapDoorTile::getTileAABB(Level *level, int x, int y, int z) { updateShape(level, x, y, z); return Tile::getTileAABB(level, x, y, z); } + AABB *TrapDoorTile::getAABB(Level *level, int x, int y, int z) { updateShape(level, x, y, z); return Tile::getAABB(level, x, y, z); } + void TrapDoorTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr forceEntity) // 4J added forceData, forceEntity param { setShape(level->getData(x, y, z)); } + void TrapDoorTile::updateDefaultShape() { float r = 3 / 16.0f; setShape(0, 0.5f - r / 2, 0, 1, 0.5f + r / 2, 1); } + void TrapDoorTile::setShape(int data) { + float r = 3 / 16.0f; if ((data & TOP_MASK) != 0) { @@ -80,9 +89,10 @@ void TrapDoorTile::setShape(int data) } } -bool TrapDoorTile::isTrapDoor(int tile) + +void TrapDoorTile::attack(Level *level, int x, int y, int z, shared_ptr player) { - return (tile == Tile::trapdoor_Id || tile == Tile::iron_trapdoor_Id); + //use(level, x, y, z, player, 0, 0, 0, 0); } // 4J-PB - Adding a TestUse for tooltip display diff --git a/Minecraft.World/TrapDoorTile.h b/Minecraft.World/TrapDoorTile.h index edc8cf17..19cec150 100644 --- a/Minecraft.World/TrapDoorTile.h +++ b/Minecraft.World/TrapDoorTile.h @@ -14,38 +14,72 @@ private: protected: TrapDoorTile(int id, Material *material); +/* + * public int getTexture(int face, int data) { if (face == 0 || face == 1) + * return tex; int dir = getDir(data); if ((dir == 0 || dir == 2) ^ (face <= 3)) + * { return tex; } int tt = (dir / 2 + ((face & 1) ^ dir)); tt += ((data & 4) / + * 4); int texture = tex - (data & 8) * 2; if ((tt & 1) != 0) { texture = + * -texture; } // if (getDir(data)==0 // tt-=((face+data&3)&1)^((data&4)>>2); + * return texture; } + */ + public: bool blocksLight(); + +public: bool isSolidRender(bool isServerLevel = false); + +public: bool isCubeShaped(); bool isPathfindable(LevelSource *level, int x, int y, int z); +public: int getRenderShape(); +public: AABB *getTileAABB(Level *level, int x, int y, int z); + +public: AABB *getAABB(Level *level, int x, int y, int z); +public: void updateShape(LevelSource *level, int x, int y, int z, int forceData = -1, shared_ptr forceEntity = shared_ptr()); // 4J added forceData, forceEntity param + +public: void updateDefaultShape(); +public: using Tile::setShape; void setShape(int data); - static bool isTrapDoor(int tile); - virtual bool TestUse(); +public: + void attack(Level *level, int x, int y, int z, shared_ptr player); +public: + virtual bool TestUse(); bool use(Level *level, int x, int y, int z, shared_ptr player, int clickedFace, float clickX, float clickY, float clickZ, bool soundOnly = false); // 4J added soundOnly param +public: void setOpen(Level *level, int x, int y, int z, bool shouldOpen); + + +public: void neighborChanged(Level *level, int x, int y, int z, int type); + +public: HitResult *clip(Level *level, int xt, int yt, int zt, Vec3 *a, Vec3 *b); +public: int getDir(int dir); + +public: int getPlacedOnFaceDataValue(Level *level, int x, int y, int z, int face, float clickX, float clickY, float clickZ, int itemValue); +public: bool mayPlace(Level *level, int x, int y, int z, int face); +public: static bool isOpen(int data); private: diff --git a/Minecraft.World/TrapMenu.h b/Minecraft.World/TrapMenu.h index f8bceeca..418d7cda 100644 --- a/Minecraft.World/TrapMenu.h +++ b/Minecraft.World/TrapMenu.h @@ -7,9 +7,9 @@ class DispenserTileEntity; class TrapMenu : public AbstractContainerMenu { private: - static constexpr int INV_SLOT_START = 9; + static const int INV_SLOT_START = 9; static constexpr int INV_SLOT_END = INV_SLOT_START + (9*3); - static constexpr int USE_ROW_SLOT_START = INV_SLOT_END; + static const int USE_ROW_SLOT_START = INV_SLOT_END; static constexpr int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9; private: shared_ptr trap; diff --git a/Minecraft.World/TreeTile.cpp b/Minecraft.World/TreeTile.cpp new file mode 100644 index 00000000..6a5860f3 --- /dev/null +++ b/Minecraft.World/TreeTile.cpp @@ -0,0 +1,94 @@ +#include "stdafx.h" +#include "net.minecraft.world.level.h" +#include "net.minecraft.world.level.tile.piston.h" +#include "net.minecraft.h" +#include "net.minecraft.world.h" +#include "LeafTile.h" + +#include "TreeTile.h" + +const unsigned int TreeTile::TREE_NAMES[ TreeTile::TREE_NAMES_LENGTH] = { IDS_TILE_LOG_OAK, + IDS_TILE_LOG_SPRUCE, + IDS_TILE_LOG_BIRCH, + IDS_TILE_LOG_JUNGLE + }; + +const wstring TreeTile::TREE_STRING_NAMES[ TreeTile::TREE_NAMES_LENGTH] = {L"oak", L"spruce", L"birch", L"jungle"}; + +const wstring TreeTile::TREE_TEXTURES[] = {L"tree_side", L"tree_spruce", L"tree_birch", L"tree_jungle"}; + +TreeTile::TreeTile(int id) : RotatedPillarTile(id, Material::wood) +{ +} + +int TreeTile::getResourceCount(Random *random) +{ + return 1; +} + +int TreeTile::getResource(int data, Random *random, int playerBonusLevel) +{ + return Tile::treeTrunk_Id; +} + +void TreeTile::onRemove(Level *level, int x, int y, int z, int id, int data) +{ + int r = LeafTile::REQUIRED_WOOD_RANGE; + int r2 = r + 1; + + if (level->hasChunksAt(x - r2, y - r2, z - r2, x + r2, y + r2, z + r2)) + { + for (int xo = -r; xo <= r; xo++) + for (int yo = -r; yo <= r; yo++) + for (int zo = -r; zo <= r; zo++) + { + int t = level->getTile(x + xo, y + yo, z + zo); + if (t == Tile::leaves_Id) + { + int currentData = level->getData(x + xo, y + yo, z + zo); + if ((currentData & LeafTile::UPDATE_LEAF_BIT) == 0) + { + level->setData(x + xo, y + yo, z + zo, currentData | LeafTile::UPDATE_LEAF_BIT, Tile::UPDATE_NONE); + } + } + } + } +} + + +unsigned int TreeTile::getDescriptionId(int iData /*= -1*/) +{ + int type = iData & MASK_TYPE; + if(type < 0 ) type = 0; + return TreeTile::TREE_NAMES[type]; +} + +Icon *TreeTile::getTypeTexture(int type) +{ + return icons_side[type]; +} + +Icon *TreeTile::getTopTexture(int type) +{ + return icons_top[type]; +} + +int TreeTile::getWoodType(int data) +{ + return data & MASK_TYPE; +} + +shared_ptr TreeTile::getSilkTouchItemInstance(int data) +{ + // fix to avoid getting silktouched sideways logs + return std::make_shared(id, 1, getWoodType(data)); +} + +void TreeTile::registerIcons(IconRegister *iconRegister) +{ + for (int i = 0; i < TREE_NAMES_LENGTH; i++) + { + icons_side[i] = iconRegister->registerIcon(getIconName() + L"_" + TREE_STRING_NAMES[i]); + icons_top[i] = iconRegister->registerIcon(getIconName() + L"_" + TREE_STRING_NAMES[i] + L"_top"); + } +} \ No newline at end of file diff --git a/Minecraft.World/LogTile.h b/Minecraft.World/TreeTile.h similarity index 80% rename from Minecraft.World/LogTile.h rename to Minecraft.World/TreeTile.h index d98d9589..8738c8cf 100644 --- a/Minecraft.World/LogTile.h +++ b/Minecraft.World/TreeTile.h @@ -5,17 +5,14 @@ class ChunkRebuildData; class Player; -class LogTile : public RotatedPillarTile +class TreeTile : public RotatedPillarTile { friend class Tile; friend class ChunkRebuildData; public: - static const int OAK_TRUNK = 0; static const int DARK_TRUNK = 1; static const int BIRCH_TRUNK = 2; static const int JUNGLE_TRUNK = 3; - static const int ACACIA_TRUNK = 4; - static const int DARK_OAK_TRUNK = 5; static const int MASK_TYPE = 0x3; static const int MASK_FACING = 0xC; @@ -23,19 +20,25 @@ public: static const int FACING_X = 1 << 2; static const int FACING_Z = 2 << 2; - static const int TREE_NAMES_LENGTH = 6; + static const int TREE_NAMES_LENGTH = 4; + + static const unsigned int TREE_NAMES[TREE_NAMES_LENGTH]; + static const wstring TREE_STRING_NAMES[TREE_NAMES_LENGTH]; + static const wstring TREE_TEXTURES[]; + private: Icon *icons_side[TREE_NAMES_LENGTH]; Icon *icons_top[TREE_NAMES_LENGTH]; protected: - LogTile(int id); + TreeTile(int id); public: virtual int getResourceCount(Random *random); + virtual int getResource(int data, Random *random, int playerBonusLevel); virtual void onRemove(Level *level, int x, int y, int z, int id, int data); virtual unsigned int getDescriptionId(int iData = -1); @@ -44,7 +47,7 @@ protected: virtual Icon *getTopTexture(int type); public: - virtual int getWoodType(int data); + static int getWoodType(int data); void registerIcons(IconRegister *iconRegister); protected: diff --git a/Minecraft.World/Village.cpp b/Minecraft.World/Village.cpp index d69cf8c3..b7c82fa4 100644 --- a/Minecraft.World/Village.cpp +++ b/Minecraft.World/Village.cpp @@ -346,7 +346,7 @@ bool Village::isDoor(int x, int y, int z) { int tileId = level->getTile(x, y, z); if (tileId <= 0) return false; - return DoorTile::isDoor(tileId); + return tileId == Tile::door_wood_Id; } void Village::calcInfo() diff --git a/Minecraft.World/VillageFeature.cpp b/Minecraft.World/VillageFeature.cpp index c2ffc3d6..bde8a66c 100644 --- a/Minecraft.World/VillageFeature.cpp +++ b/Minecraft.World/VillageFeature.cpp @@ -173,14 +173,15 @@ bool VillageFeature::VillageStart::isValid() return valid; } -void VillageFeature::VillageStart::addAdditionalSaveData(DataOutputStream *dos) +void VillageFeature::VillageStart::addAdditonalSaveData(CompoundTag *tag) { - StructureStart::addAdditionalSaveData(dos); - dos->writeBoolean(valid); + StructureStart::addAdditonalSaveData(tag); + + tag->putBoolean(L"Valid", valid); } -void VillageFeature::VillageStart::readAdditonalSaveData(DataInputStream *dis) +void VillageFeature::VillageStart::readAdditonalSaveData(CompoundTag *tag) { - StructureStart::readAdditonalSaveData(dis); - valid = dis->readBoolean(); + StructureStart::readAdditonalSaveData(tag); + valid = tag->getBoolean(L"Valid"); } \ No newline at end of file diff --git a/Minecraft.World/VillageFeature.h b/Minecraft.World/VillageFeature.h index a589eebd..1ff7ac75 100644 --- a/Minecraft.World/VillageFeature.h +++ b/Minecraft.World/VillageFeature.h @@ -41,8 +41,8 @@ public: VillageStart(); VillageStart(Level *level, Random *random, int chunkX, int chunkZ, int villageSizeModifier,int iXZSize); bool isValid(); - void addAdditionalSaveData(DataOutputStream *dos); - void readAdditonalSaveData(DataInputStream *dis); + void addAdditonalSaveData(CompoundTag *tag); + void readAdditonalSaveData(CompoundTag *tag); }; int m_iXZSize; diff --git a/Minecraft.World/VillagePieces.cpp b/Minecraft.World/VillagePieces.cpp index 5c227029..dcd765e0 100644 --- a/Minecraft.World/VillagePieces.cpp +++ b/Minecraft.World/VillagePieces.cpp @@ -1,5 +1,4 @@ #include "stdafx.h" -#include "..\Minecraft.Client\Minecraft.h" #include "net.minecraft.h" #include "net.minecraft.world.level.h" #include "net.minecraft.world.level.storage.h" @@ -56,20 +55,15 @@ list *VillagePieces::createPieceSet(Random *random { list *newPieces = new list; - StructureTable* table = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructureFeature* feature = table->getStructureFeature(eMinecraftStructureFeature_VillageFeature); - - int size = feature->options[0] + villageSize; - - newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_SimpleHouse, 4, Mth::nextInt(random, 2 + size, 4 + size * 2))); - newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_SmallTemple, 20, Mth::nextInt(random, 0 + size, 1 + size))); - newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_BookHouse, 20, Mth::nextInt(random, 0 + size, 2 + size))); - newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_SmallHut, 3, Mth::nextInt(random, 2 + size, 5 + size * 3))); - newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_PigHouse, 15, Mth::nextInt(random, 0 + size, 2 + size))); - newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_DoubleFarmland, 3, Mth::nextInt(random, 1 + size, 4 + size))); - newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_Farmland, 3, Mth::nextInt(random, 2 + size, 4 + size * 2))); - newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_Smithy, 15, Mth::nextInt(random, 0, 1 + size))); - newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_TwoRoomHouse, 8, Mth::nextInt(random, 0 + size, 3 + size * 2))); + newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_SimpleHouse, 4, Mth::nextInt(random, 2 + villageSize, 4 + villageSize * 2))); + newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_SmallTemple, 20, Mth::nextInt(random, 0 + villageSize, 1 + villageSize))); + newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_BookHouse, 20, Mth::nextInt(random, 0 + villageSize, 2 + villageSize))); + newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_SmallHut, 3, Mth::nextInt(random, 2 + villageSize, 5 + villageSize * 3))); + newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_PigHouse, 15, Mth::nextInt(random, 0 + villageSize, 2 + villageSize))); + newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_DoubleFarmland, 3, Mth::nextInt(random, 1 + villageSize, 4 + villageSize))); + newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_Farmland, 3, Mth::nextInt(random, 2 + villageSize, 4 + villageSize * 2))); + newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_Smithy, 15, Mth::nextInt(random, 0, 1 + villageSize))); + newPieces->push_back(new PieceWeight(VillagePieces::EPieceClass_TwoRoomHouse, 8, Mth::nextInt(random, 0 + villageSize, 3 + villageSize * 2))); // silly way of filtering "infinite" buildings auto it = newPieces->begin(); @@ -271,10 +265,6 @@ StructurePiece *VillagePieces::generateAndAddRoadPiece(StartPiece *startPiece, l VillagePieces::VillagePiece::VillagePiece() { - objectPlacedFlags.clear(); - featureConditions.clear(); - tileOptionRemap.clear(); - entitySpawnCounts.clear(); heightPosition = -1; spawnedVillagerCount = 0; isDesertVillage = false; @@ -284,10 +274,6 @@ VillagePieces::VillagePiece::VillagePiece() VillagePieces::VillagePiece::VillagePiece(StartPiece *startPiece, int genDepth) : StructurePiece(genDepth) { - objectPlacedFlags.clear(); - featureConditions.clear(); - tileOptionRemap.clear(); - entitySpawnCounts.clear(); heightPosition = -1; isDesertVillage = false; spawnedVillagerCount = 0; @@ -298,27 +284,18 @@ VillagePieces::VillagePiece::VillagePiece(StartPiece *startPiece, int genDepth) } } -void VillagePieces::VillagePiece::addAdditionalSaveData(DataOutputStream *dos) +void VillagePieces::VillagePiece::addAdditonalSaveData(CompoundTag *tag) { - if (startPiece != nullptr) - { - this->isDesertVillage = startPiece->isDesertVillage; - } - - dos->writeInt(heightPosition); - addStructurePieceSaveData(dos, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); - dos->writeInt(spawnedVillagerCount); - dos->writeBoolean(isDesertVillage); + tag->putInt(L"HPos", heightPosition); + tag->putInt(L"VCount", spawnedVillagerCount); + tag->putBoolean(L"Desert", isDesertVillage); } -void VillagePieces::VillagePiece::readAdditonalSaveData(DataInputStream *dis) +void VillagePieces::VillagePiece::readAdditonalSaveData(CompoundTag *tag) { - heightPosition = dis->readInt(); - readStructurePieceSaveData(dis, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); - spawnedVillagerCount = dis->readInt(); - - bool isDesertVillageValue = dis->readBoolean(); - isDesertVillage = startPiece != nullptr ? startPiece->isDesertVillage : isDesertVillageValue; + heightPosition = tag->getInt(L"HPos"); + spawnedVillagerCount = tag->getInt(L"VCount"); + isDesertVillage = tag->getBoolean(L"Desert"); } StructurePiece *VillagePieces::VillagePiece::generateHouseNorthernLeft(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff) @@ -433,38 +410,53 @@ int VillagePieces::VillagePiece::getVillagerProfession(int villagerNumber) int VillagePieces::VillagePiece::biomeBlock(int tile, int data) { - if (startPiece != nullptr) - this->isDesertVillage = startPiece->isDesertVillage; - - if (!isDesertVillage) - return tile; - - StructureTable* table = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructureFeature* feature = table->getStructureFeature(eMinecraftStructureFeature_VillageFeature); - - - auto it = feature->tiles.find(tile); - if (it != feature->tiles.end()) - { - return it->second; - } - - return tile; + if (isDesertVillage) + { + if (tile == Tile::treeTrunk_Id) + { + return Tile::sandStone_Id; + } + else if (tile == Tile::cobblestone_Id) + { + return Tile::sandStone_Id; + } + else if (tile == Tile::wood_Id) + { + return Tile::sandStone_Id; + } + else if (tile == Tile::stairs_wood_Id) + { + return Tile::stairs_sandstone_Id; + } + else if (tile == Tile::stairs_stone_Id) + { + return Tile::stairs_sandstone_Id; + } + else if (tile == Tile::gravel_Id) + { + return Tile::sandStone_Id; + } + } + return tile; } int VillagePieces::VillagePiece::biomeData(int tile, int data) { - if (startPiece != nullptr) - this->isDesertVillage = startPiece->isDesertVillage; - - if (!isDesertVillage) - return data; - - if (tile == Tile::treeTrunk_Id || tile == Tile::cobblestone_Id) - return SandStoneTile::TYPE_DEFAULT; - else if (tile == Tile::wood_Id) - return SandStoneTile::TYPE_SMOOTHSIDE; - + if (isDesertVillage) + { + if (tile == Tile::treeTrunk_Id) + { + return 0; + } + else if (tile == Tile::cobblestone_Id) + { + return SandStoneTile::TYPE_DEFAULT; + } + else if (tile == Tile::wood_Id) + { + return SandStoneTile::TYPE_SMOOTHSIDE; + } + } return data; } @@ -491,13 +483,6 @@ void VillagePieces::VillagePiece::fillColumnDown(Level *level, int block, int da StructurePiece::fillColumnDown(level, bblock, bdata, x, startY, z, chunkBB); } -void VillagePieces::VillagePiece::fillBoxDown(Level* level, int x0, int y0, int z0, int x1, int y1, int z1, int tile, int tileData, BoundingBox* chunkBB) -{ - int bblock = biomeBlock(x0, y0); - int bdata = biomeData(x0, y0); - StructurePiece::fillBoxDown(level, bblock, bdata, x0, y0, z0, x1, z1, chunkBB); -} - VillagePieces::Well::Well() { // for reflection @@ -507,17 +492,14 @@ VillagePieces::Well::Well(StartPiece *startPiece, int genDepth, Random *random, { orientation = random->nextInt(4); - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_Well); - switch (orientation) { case Direction::NORTH: case Direction::SOUTH: - boundingBox = new BoundingBox(west, 64, north, west + piece->width - 1, 64 + piece->height - 1, north + piece->depth - 1); + boundingBox = new BoundingBox(west, 64, north, west + width - 1, 64 + height - 1, north + depth - 1); break; default: - boundingBox = new BoundingBox(west, 64, north, west + piece->depth - 1, 64 + piece->height - 1, north + piece->width - 1); + boundingBox = new BoundingBox(west, 64, north, west + depth - 1, 64 + height - 1, north + width - 1); break; } } @@ -548,12 +530,38 @@ bool VillagePieces::Well::postProcess(Level *level, Random *random, BoundingBox boundingBox->move(0, heightPosition - boundingBox->y1 + 3, 0); } - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_Well); + generateBox(level, chunkBB, 1, 0, 1, 4, height - 3, 4, Tile::cobblestone_Id, Tile::water_Id, false); + placeBlock(level, 0, 0, 2, height - 3, 2, chunkBB); + placeBlock(level, 0, 0, 3, height - 3, 2, chunkBB); + placeBlock(level, 0, 0, 2, height - 3, 3, chunkBB); + placeBlock(level, 0, 0, 3, height - 3, 3, chunkBB); - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); + placeBlock(level, Tile::fence_Id, 0, 1, height - 2, 1, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 1, height - 1, 1, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 4, height - 2, 1, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 4, height - 1, 1, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 1, height - 2, 4, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 1, height - 1, 4, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 4, height - 2, 4, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 4, height - 1, 4, chunkBB); + generateBox(level, chunkBB, 1, height, 1, 4, height, 4, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + + for (int z = 0; z <= 5; z++) + { + for (int x = 0; x <= 5; x++) + { + // only do the frame + if (x != 0 && x != 5 && z != 0 && z != 5) + { + continue; + } + placeBlock(level, Tile::gravel_Id, 0, x, height - 4, z, chunkBB); + generateAirColumnUp(level, x, height - 3, z, chunkBB); + } + } return true; + } VillagePieces::StartPiece::StartPiece() @@ -600,32 +608,25 @@ VillagePieces::StraightRoad::StraightRoad(StartPiece *startPiece, int genDepth, length = Math::_max(stairsBox->getXSpan(), stairsBox->getZSpan()); } -void VillagePieces::StraightRoad::addAdditionalSaveData(DataOutputStream *dos) +void VillagePieces::StraightRoad::addAdditonalSaveData(CompoundTag *tag) { - VillageRoadPiece::addAdditionalSaveData(dos); - dos->writeInt(length); + VillageRoadPiece::addAdditonalSaveData(tag); + tag->putInt(L"Length", length); } -void VillagePieces::StraightRoad::readAdditonalSaveData(DataInputStream *dis) +void VillagePieces::StraightRoad::readAdditonalSaveData(CompoundTag *tag) { - VillageRoadPiece::readAdditonalSaveData(dis); - length = dis->readInt(); + VillageRoadPiece::readAdditonalSaveData(tag); + length = tag->getInt(L"Length"); } void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, list *pieces, Random *random) { bool hasHouses = false; - StructureTable* table = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructureFeature* feature = table->getStructureFeature(eMinecraftStructureFeature_VillageFeature); - - int roadExtensionChance = feature->options[1]; - int endBuffer = feature->options[3]; - int houseSpacing = feature->options[4]; - // place left houses - int depth = random->nextInt(houseSpacing); - while (depth < length - endBuffer) + int depth = random->nextInt(5); + while (depth < length - 8) { StructurePiece *piece = generateHouseNorthernLeft(static_cast(startPiece), pieces, random, 0, depth); if (piece != nullptr) @@ -633,12 +634,12 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, listboundingBox->getXSpan(), piece->boundingBox->getZSpan()); hasHouses = true; } - depth += 2 + random->nextInt(houseSpacing); + depth += 2 + random->nextInt(5); } // place right houses - depth = random->nextInt(houseSpacing); - while (depth < length - endBuffer) + depth = random->nextInt(5); + while (depth < length - 8) { StructurePiece *piece = generateHouseNorthernRight(static_cast(startPiece), pieces, random, 0, depth); if (piece != nullptr) @@ -646,10 +647,10 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, listboundingBox->getXSpan(), piece->boundingBox->getZSpan()); hasHouses = true; } - depth += 2 + random->nextInt(houseSpacing); + depth += 2 + random->nextInt(5); } - if (hasHouses && random->nextInt(roadExtensionChance) > 0) + if (hasHouses && random->nextInt(3) > 0) { switch (orientation) { @@ -667,8 +668,7 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, listnextInt(roadExtensionChance) > 0) + if (hasHouses && random->nextInt(3) > 0) { switch (orientation) { @@ -690,13 +690,9 @@ void VillagePieces::StraightRoad::addChildren(StructurePiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction) { - StructureTable *table = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructureFeature *feature = table->getStructureFeature(eMinecraftStructureFeature_VillageFeature); + int length = 7 * (Mth::nextInt(random, 3, 5)); - int size = feature->options[2]; - int length = size * (Mth::nextInt(random, 3, 5)); - - while (length >= size) + while (length >= 7) { BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, 3, length, direction); @@ -705,7 +701,7 @@ BoundingBox *VillagePieces::StraightRoad::findPieceBox(StartPiece *startPiece, l return box; } delete box; - length -= size; + length -= 7; } return nullptr; @@ -713,12 +709,7 @@ BoundingBox *VillagePieces::StraightRoad::findPieceBox(StartPiece *startPiece, l bool VillagePieces::StraightRoad::postProcess(Level *level, Random *random, BoundingBox *chunkBB) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructureFeature *feature = structureTable->getStructureFeature(eMinecraftStructureFeature_VillageFeature); - - int tileId = feature->options[5]; - - int tile = biomeBlock(tileId, 0); + int tile = biomeBlock(Tile::gravel_Id, 0); for (int x = boundingBox->x0; x <= boundingBox->x1; x++) { for (int z = boundingBox->z0; z <= boundingBox->z1; z++) @@ -736,31 +727,31 @@ bool VillagePieces::StraightRoad::postProcess(Level *level, Random *random, Boun VillagePieces::SimpleHouse::SimpleHouse() { + hasTerrace = false; // for reflection } -VillagePieces::SimpleHouse::SimpleHouse(StartPiece *startPiece, int genDepth, Random *random, BoundingBox *stairsBox, int direction) : VillagePiece(startPiece, genDepth) +VillagePieces::SimpleHouse::SimpleHouse(StartPiece *startPiece, int genDepth, Random *random, BoundingBox *stairsBox, int direction) : VillagePiece(startPiece, genDepth), hasTerrace(random->nextBoolean()) { orientation = direction; boundingBox = stairsBox; } -void VillagePieces::SimpleHouse::addAdditionalSaveData(DataOutputStream *dos) +void VillagePieces::SimpleHouse::addAdditonalSaveData(CompoundTag *tag) { - VillagePiece::addAdditionalSaveData(dos); + VillagePiece::addAdditonalSaveData(tag); + tag->putBoolean(L"Terrace", hasTerrace); } -void VillagePieces::SimpleHouse::readAdditonalSaveData(DataInputStream *dis) +void VillagePieces::SimpleHouse::readAdditonalSaveData(CompoundTag *tag) { - VillagePiece::readAdditonalSaveData(dis); + VillagePiece::readAdditonalSaveData(tag); + hasTerrace = tag->getBoolean(L"Terrace"); } VillagePieces::SimpleHouse *VillagePieces::SimpleHouse::createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_SimpleHouse); - - BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, piece->width, piece->height, piece->depth, direction); + BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { @@ -768,10 +759,7 @@ VillagePieces::SimpleHouse *VillagePieces::SimpleHouse::createPiece(StartPiece * return nullptr; } - SimpleHouse *simpleHouse = new SimpleHouse(startPiece, genDepth, random, box, direction); - simpleHouse->getRandomValuesFromDataSet(piece, random, simpleHouse->featureConditions, simpleHouse->tileOptionRemap); - - return simpleHouse; + return new SimpleHouse(startPiece, genDepth, random, box, direction); } bool VillagePieces::SimpleHouse::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -786,10 +774,91 @@ bool VillagePieces::SimpleHouse::postProcess(Level *level, Random *random, Bound boundingBox->move(0, heightPosition - boundingBox->y1 + height - 1, 0); } - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_SimpleHouse); + // floor + generateBox(level, chunkBB, 0, 0, 0, 4, 0, 4, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + // roof + generateBox(level, chunkBB, 0, 4, 0, 4, 4, 4, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 1, 4, 1, 3, 4, 3, Tile::wood_Id, Tile::wood_Id, false); - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); + // window walls + placeBlock(level, Tile::cobblestone_Id, 0, 0, 1, 0, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 0, 2, 0, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 0, 3, 0, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 4, 1, 0, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 4, 2, 0, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 4, 3, 0, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 0, 1, 4, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 0, 2, 4, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 0, 3, 4, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 4, 1, 4, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 4, 2, 4, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 4, 3, 4, chunkBB); + generateBox(level, chunkBB, 0, 1, 1, 0, 3, 3, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 4, 1, 1, 4, 3, 3, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 1, 1, 4, 3, 3, 4, Tile::wood_Id, Tile::wood_Id, false); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 2, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 2, 2, 4, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 4, 2, 2, chunkBB); + + // door wall + placeBlock(level, Tile::wood_Id, 0, 1, 1, 0, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 1, 2, 0, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 1, 3, 0, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 2, 3, 0, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 3, 3, 0, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 3, 2, 0, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 3, 1, 0, chunkBB); + if (getBlock(level, 2, 0, -1, chunkBB) == 0 && getBlock(level, 2, -1, -1, chunkBB) != 0) + { + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 3), 2, 0, -1, chunkBB); + } + + // fill room with air + generateBox(level, chunkBB, 1, 1, 1, 3, 3, 3, 0, 0, false); + + // roof fence + if (hasTerrace) { + placeBlock(level, Tile::fence_Id, 0, 0, 5, 0, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 1, 5, 0, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 2, 5, 0, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 3, 5, 0, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 4, 5, 0, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 0, 5, 4, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 1, 5, 4, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 2, 5, 4, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 3, 5, 4, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 4, 5, 4, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 4, 5, 1, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 4, 5, 2, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 4, 5, 3, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 0, 5, 1, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 0, 5, 2, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 0, 5, 3, chunkBB); + } + + // ladder + if (hasTerrace) + { + int orientationData = getOrientationData(Tile::ladder_Id, 3); + placeBlock(level, Tile::ladder_Id, orientationData, 3, 1, 3, chunkBB); + placeBlock(level, Tile::ladder_Id, orientationData, 3, 2, 3, chunkBB); + placeBlock(level, Tile::ladder_Id, orientationData, 3, 3, 3, chunkBB); + placeBlock(level, Tile::ladder_Id, orientationData, 3, 4, 3, chunkBB); + } + + // torch + placeBlock(level, Tile::torch_Id, 0, 2, 3, 1, chunkBB); + + for (int z = 0; z < depth; z++) + { + for (int x = 0; x < width; x++) + { + generateAirColumnUp(level, x, height, z, chunkBB); + fillColumnDown(level, Tile::cobblestone_Id, 0, x, -1, z, chunkBB); + } + } + + spawnVillagers(level, chunkBB, 1, 1, 2, 1); return true; @@ -809,10 +878,7 @@ VillagePieces::SmallTemple::SmallTemple(StartPiece *startPiece, int genDepth, Ra VillagePieces::SmallTemple *VillagePieces::SmallTemple::createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_SmallTemple); - - BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, piece->width, piece->height, piece->depth, direction); + BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { @@ -820,10 +886,7 @@ VillagePieces::SmallTemple *VillagePieces::SmallTemple::createPiece(StartPiece * return nullptr; } - SmallTemple *smallTemple = new SmallTemple(startPiece, genDepth, random, box, direction); - smallTemple->getRandomValuesFromDataSet(piece, random, smallTemple->featureConditions, smallTemple->tileOptionRemap); - - return smallTemple; + return new SmallTemple(startPiece, genDepth, random, box, direction); } bool VillagePieces::SmallTemple::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -838,12 +901,104 @@ bool VillagePieces::SmallTemple::postProcess(Level *level, Random *random, Bound boundingBox->move(0, heightPosition - boundingBox->y1 + height - 1, 0); } - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_SmallTemple); + // fill inside with air + generateBox(level, chunkBB, 1, 1, 1, 3, 3, 7, 0, 0, false); + generateBox(level, chunkBB, 1, 5, 1, 3, 9, 3, 0, 0, false); - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); + // floor + generateBox(level, chunkBB, 1, 0, 0, 3, 0, 8, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + + // front wall + generateBox(level, chunkBB, 1, 1, 0, 3, 10, 0, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + // left tall wall + generateBox(level, chunkBB, 0, 1, 1, 0, 10, 3, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + // right tall wall + generateBox(level, chunkBB, 4, 1, 1, 4, 10, 3, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + // left low wall + generateBox(level, chunkBB, 0, 0, 4, 0, 4, 7, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + // right low wall + generateBox(level, chunkBB, 4, 0, 4, 4, 4, 7, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + // far low wall + generateBox(level, chunkBB, 1, 1, 8, 3, 4, 8, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + // far upper wall + generateBox(level, chunkBB, 1, 5, 4, 3, 10, 4, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + + // low roof + generateBox(level, chunkBB, 1, 5, 5, 3, 5, 7, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + // high roof + generateBox(level, chunkBB, 0, 9, 0, 4, 9, 4, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + // middle floor / roof + generateBox(level, chunkBB, 0, 4, 0, 4, 4, 4, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + placeBlock(level, Tile::cobblestone_Id, 0, 0, 11, 2, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 4, 11, 2, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 2, 11, 0, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 2, 11, 4, chunkBB); + + // altar pieces + placeBlock(level, Tile::cobblestone_Id, 0, 1, 1, 6, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 1, 1, 7, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 2, 1, 7, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 3, 1, 6, chunkBB); + placeBlock(level, Tile::cobblestone_Id, 0, 3, 1, 7, chunkBB); + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 3), 1, 1, 5, chunkBB); + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 3), 2, 1, 6, chunkBB); + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 3), 3, 1, 5, chunkBB); + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 1), 1, 2, 7, chunkBB); + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 0), 3, 2, 7, chunkBB); + + // windows + placeBlock(level, Tile::thinGlass_Id, 0, 0, 2, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 3, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 4, 2, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 4, 3, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 6, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 7, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 4, 6, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 4, 7, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 2, 6, 0, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 2, 7, 0, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 2, 6, 4, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 2, 7, 4, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 3, 6, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 4, 3, 6, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 2, 3, 8, chunkBB); + + // torches + placeBlock(level, Tile::torch_Id, 0, 2, 4, 7, chunkBB); + placeBlock(level, Tile::torch_Id, 0, 1, 4, 6, chunkBB); + placeBlock(level, Tile::torch_Id, 0, 3, 4, 6, chunkBB); + placeBlock(level, Tile::torch_Id, 0, 2, 4, 5, chunkBB); + + // ladder + int orientationData = getOrientationData(Tile::ladder_Id, 4); + for (int y = 1; y <= 9; y++) + { + placeBlock(level, Tile::ladder_Id, orientationData, 3, y, 3, chunkBB); + } + + // entrance + placeBlock(level, 0, 0, 2, 1, 0, chunkBB); + placeBlock(level, 0, 0, 2, 2, 0, chunkBB); + createDoor(level, chunkBB, random, 2, 1, 0, getOrientationData(Tile::door_wood_Id, 1)); + if (getBlock(level, 2, 0, -1, chunkBB) == 0 && getBlock(level, 2, -1, -1, chunkBB) != 0) + { + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 3), 2, 0, -1, chunkBB); + } + + + for (int z = 0; z < depth; z++) + { + for (int x = 0; x < width; x++) + { + generateAirColumnUp(level, x, height, z, chunkBB); + fillColumnDown(level, Tile::cobblestone_Id, 0, x, -1, z, chunkBB); + } + } + + spawnVillagers(level, chunkBB, 2, 1, 2, 1); return true; + } int VillagePieces::SmallTemple::getVillagerProfession(int villagerNumber) @@ -865,10 +1020,7 @@ VillagePieces::BookHouse::BookHouse(StartPiece *startPiece, int genDepth, Random VillagePieces::BookHouse *VillagePieces::BookHouse::createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_BookHouse); - -BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, piece->width, piece->height, piece->depth, direction); + BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { @@ -876,10 +1028,7 @@ BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, piece->w return nullptr; } - BookHouse *bookHouse = new BookHouse(startPiece, genDepth, random, box, direction); - bookHouse->getRandomValuesFromDataSet(piece, random, bookHouse->featureConditions, bookHouse->tileOptionRemap); - - return bookHouse; + return new BookHouse(startPiece, genDepth, random, box, direction); } bool VillagePieces::BookHouse::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -894,12 +1043,103 @@ bool VillagePieces::BookHouse::postProcess(Level *level, Random *random, Boundin boundingBox->move(0, heightPosition - boundingBox->y1 + height - 1, 0); } - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_BookHouse); + // fill inside with air + generateBox(level, chunkBB, 1, 1, 1, 7, 5, 4, 0, 0, false); - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); + // floor + generateBox(level, chunkBB, 0, 0, 0, 8, 0, 5, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + // roof + generateBox(level, chunkBB, 0, 5, 0, 8, 5, 5, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 0, 6, 1, 8, 6, 4, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 0, 7, 2, 8, 7, 3, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + int southStairs = getOrientationData(Tile::stairs_wood_Id, 3); + int northStairs = getOrientationData(Tile::stairs_wood_Id, 2); + for (int d = -1; d <= 2; d++) { + for (int w = 0; w <= 8; w++) { + placeBlock(level, Tile::stairs_wood_Id, southStairs, w, 6 + d, d, chunkBB); + placeBlock(level, Tile::stairs_wood_Id, northStairs, w, 6 + d, 5 - d, chunkBB); + } + } + + // rock supports + generateBox(level, chunkBB, 0, 1, 0, 0, 1, 5, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 1, 1, 5, 8, 1, 5, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 8, 1, 0, 8, 1, 4, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 2, 1, 0, 7, 1, 0, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 0, 2, 0, 0, 4, 0, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 0, 2, 5, 0, 4, 5, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 8, 2, 5, 8, 4, 5, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 8, 2, 0, 8, 4, 0, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + + // wooden walls + generateBox(level, chunkBB, 0, 2, 1, 0, 4, 4, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 1, 2, 5, 7, 4, 5, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 8, 2, 1, 8, 4, 4, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 1, 2, 0, 7, 4, 0, Tile::wood_Id, Tile::wood_Id, false); + + // windows + placeBlock(level, Tile::thinGlass_Id, 0, 4, 2, 0, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 5, 2, 0, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 6, 2, 0, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 4, 3, 0, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 5, 3, 0, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 6, 3, 0, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 2, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 2, 3, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 3, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 3, 3, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 8, 2, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 8, 2, 3, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 8, 3, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 8, 3, 3, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 2, 2, 5, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 3, 2, 5, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 5, 2, 5, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 6, 2, 5, chunkBB); + + // roof inside and bookshelf + generateBox(level, chunkBB, 1, 4, 1, 7, 4, 1, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 1, 4, 4, 7, 4, 4, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 1, 3, 4, 7, 3, 4, Tile::bookshelf_Id, Tile::bookshelf_Id, false); + + // couch + placeBlock(level, Tile::wood_Id, 0, 7, 1, 4, chunkBB); + placeBlock(level, Tile::stairs_wood_Id, getOrientationData(Tile::stairs_wood_Id, 0), 7, 1, 3, chunkBB); + int orientationData = getOrientationData(Tile::stairs_wood_Id, 3); + placeBlock(level, Tile::stairs_wood_Id, orientationData, 6, 1, 4, chunkBB); + placeBlock(level, Tile::stairs_wood_Id, orientationData, 5, 1, 4, chunkBB); + placeBlock(level, Tile::stairs_wood_Id, orientationData, 4, 1, 4, chunkBB); + placeBlock(level, Tile::stairs_wood_Id, orientationData, 3, 1, 4, chunkBB); + + // tables + placeBlock(level, Tile::fence_Id, 0, 6, 1, 3, chunkBB); + placeBlock(level, Tile::pressurePlate_wood_Id, 0, 6, 2, 3, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 4, 1, 3, chunkBB); + placeBlock(level, Tile::pressurePlate_wood_Id, 0, 4, 2, 3, chunkBB); + placeBlock(level, Tile::workBench_Id, 0, 7, 1, 1, chunkBB); + + // entrance + placeBlock(level, 0, 0, 1, 1, 0, chunkBB); + placeBlock(level, 0, 0, 1, 2, 0, chunkBB); + createDoor(level, chunkBB, random, 1, 1, 0, getOrientationData(Tile::door_wood_Id, 1)); + if (getBlock(level, 1, 0, -1, chunkBB) == 0 && getBlock(level, 1, -1, -1, chunkBB) != 0) + { + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 3), 1, 0, -1, chunkBB); + } + + for (int z = 0; z < depth; z++) + { + for (int x = 0; x < width; x++) + { + generateAirColumnUp(level, x, height, z, chunkBB); + fillColumnDown(level, Tile::cobblestone_Id, 0, x, -1, z, chunkBB); + } + } + + spawnVillagers(level, chunkBB, 2, 1, 2, 1); return true; + } int VillagePieces::BookHouse::getVillagerProfession(int villagerNumber) @@ -912,7 +1152,7 @@ VillagePieces::SmallHut::SmallHut() // for reflection } -VillagePieces::SmallHut::SmallHut(StartPiece *startPiece, int genDepth, Random *random, BoundingBox *stairsBox, int direction) : VillagePiece(startPiece, genDepth) +VillagePieces::SmallHut::SmallHut(StartPiece *startPiece, int genDepth, Random *random, BoundingBox *stairsBox, int direction) : VillagePiece(startPiece, genDepth), lowCeiling(random->nextBoolean()), tablePlacement(random->nextInt(3)) { heightPosition = -1; // 4J added initialiser @@ -920,22 +1160,23 @@ VillagePieces::SmallHut::SmallHut(StartPiece *startPiece, int genDepth, Random * boundingBox = stairsBox; } -void VillagePieces::SmallHut::addAdditionalSaveData(DataOutputStream *dos) +void VillagePieces::SmallHut::addAdditonalSaveData(CompoundTag *tag) { - VillagePiece::addAdditionalSaveData(dos); + VillagePiece::addAdditonalSaveData(tag); + tag->putInt(L"T", tablePlacement); + tag->putBoolean(L"C", lowCeiling); } -void VillagePieces::SmallHut::readAdditonalSaveData(DataInputStream *dis) +void VillagePieces::SmallHut::readAdditonalSaveData(CompoundTag *tag) { - VillagePiece::readAdditonalSaveData(dis); + VillagePiece::readAdditonalSaveData(tag); + tablePlacement = tag->getInt(L"T"); + lowCeiling = tag->getBoolean(L"C"); } VillagePieces::SmallHut *VillagePieces::SmallHut::createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_SmallHut); - - BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, piece->width, piece->height, piece->depth, direction); + BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { @@ -943,10 +1184,7 @@ VillagePieces::SmallHut *VillagePieces::SmallHut::createPiece(StartPiece *startP return nullptr; } - SmallHut *hut = new SmallHut(startPiece, genDepth, random, box, direction); - hut->getRandomValuesFromDataSet(piece, random, hut->featureConditions, hut->tileOptionRemap); - - return hut; + return new SmallHut(startPiece, genDepth, random, box, direction); } bool VillagePieces::SmallHut::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -961,12 +1199,73 @@ bool VillagePieces::SmallHut::postProcess(Level *level, Random *random, Bounding boundingBox->move(0, heightPosition - boundingBox->y1 + height - 1, 0); } - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_SmallHut); + // fill inside with air + generateBox(level, chunkBB, 1, 1, 1, 3, 5, 4, 0, 0, false); - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); + // floor + generateBox(level, chunkBB, 0, 0, 0, 3, 0, 4, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 1, 0, 1, 2, 0, 3, Tile::dirt_Id, Tile::dirt_Id, false); + // roof + if (lowCeiling) { + generateBox(level, chunkBB, 1, 4, 1, 2, 4, 3, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + } else { + generateBox(level, chunkBB, 1, 5, 1, 2, 5, 3, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + } + placeBlock(level, Tile::treeTrunk_Id, 0, 1, 4, 0, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 2, 4, 0, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 1, 4, 4, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 2, 4, 4, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 0, 4, 1, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 0, 4, 2, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 0, 4, 3, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 3, 4, 1, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 3, 4, 2, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 3, 4, 3, chunkBB); + + // corners + generateBox(level, chunkBB, 0, 1, 0, 0, 3, 0, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 3, 1, 0, 3, 3, 0, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 0, 1, 4, 0, 3, 4, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 3, 1, 4, 3, 3, 4, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + + // wooden walls + generateBox(level, chunkBB, 0, 1, 1, 0, 3, 3, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 3, 1, 1, 3, 3, 3, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 1, 1, 0, 2, 3, 0, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 1, 1, 4, 2, 3, 4, Tile::wood_Id, Tile::wood_Id, false); + + // windows + placeBlock(level, Tile::thinGlass_Id, 0, 0, 2, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 3, 2, 2, chunkBB); + + // table + if (tablePlacement > 0) { + placeBlock(level, Tile::fence_Id, 0, tablePlacement, 1, 3, chunkBB); + placeBlock(level, Tile::pressurePlate_wood_Id, 0, tablePlacement, 2, 3, chunkBB); + } + + // entrance + placeBlock(level, 0, 0, 1, 1, 0, chunkBB); + placeBlock(level, 0, 0, 1, 2, 0, chunkBB); + createDoor(level, chunkBB, random, 1, 1, 0, getOrientationData(Tile::door_wood_Id, 1)); + if (getBlock(level, 1, 0, -1, chunkBB) == 0 && getBlock(level, 1, -1, -1, chunkBB) != 0) + { + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 3), 1, 0, -1, chunkBB); + } + + for (int z = 0; z < depth; z++) + { + for (int x = 0; x < width; x++) + { + generateAirColumnUp(level, x, height, z, chunkBB); + fillColumnDown(level, Tile::cobblestone_Id, 0, x, -1, z, chunkBB); + } + } + + spawnVillagers(level, chunkBB, 1, 1, 2, 1); return true; + } VillagePieces::PigHouse::PigHouse() @@ -982,10 +1281,8 @@ VillagePieces::PigHouse::PigHouse(StartPiece *startPiece, int genDepth, Random * VillagePieces::PigHouse *VillagePieces::PigHouse::createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_PigHouse); - BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, piece->width, piece->height, piece->depth, direction); + BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { @@ -993,10 +1290,7 @@ VillagePieces::PigHouse *VillagePieces::PigHouse::createPiece(StartPiece *startP return nullptr; } - PigHouse *pigHouse = new PigHouse(startPiece, genDepth, random, box, direction); - pigHouse->getRandomValuesFromDataSet(piece, random, pigHouse->featureConditions, pigHouse->tileOptionRemap); - - return pigHouse; + return new PigHouse(startPiece, genDepth, random, box, direction); } bool VillagePieces::PigHouse::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -1011,10 +1305,99 @@ bool VillagePieces::PigHouse::postProcess(Level *level, Random *random, Bounding boundingBox->move(0, heightPosition - boundingBox->y1 + height - 1, 0); } - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_PigHouse); + // fill inside with air + generateBox(level, chunkBB, 1, 1, 1, 7, 4, 4, 0, 0, false); + generateBox(level, chunkBB, 2, 1, 6, 8, 4, 10, 0, 0, false); - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); + // pig floor + generateBox(level, chunkBB, 2, 0, 6, 8, 0, 10, Tile::dirt_Id, Tile::dirt_Id, false); + placeBlock(level, Tile::cobblestone_Id, 0, 6, 0, 6, chunkBB); + // pig fence + generateBox(level, chunkBB, 2, 1, 6, 2, 1, 10, Tile::fence_Id, Tile::fence_Id, false); + generateBox(level, chunkBB, 8, 1, 6, 8, 1, 10, Tile::fence_Id, Tile::fence_Id, false); + generateBox(level, chunkBB, 3, 1, 10, 7, 1, 10, Tile::fence_Id, Tile::fence_Id, false); + + // floor + generateBox(level, chunkBB, 1, 0, 1, 7, 0, 4, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 0, 0, 0, 0, 3, 5, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 8, 0, 0, 8, 3, 5, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 1, 0, 0, 7, 1, 0, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 1, 0, 5, 7, 1, 5, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + + // roof + generateBox(level, chunkBB, 1, 2, 0, 7, 3, 0, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 1, 2, 5, 7, 3, 5, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 0, 4, 1, 8, 4, 1, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 0, 4, 4, 8, 4, 4, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 0, 5, 2, 8, 5, 3, Tile::wood_Id, Tile::wood_Id, false); + placeBlock(level, Tile::wood_Id, 0, 0, 4, 2, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 0, 4, 3, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 8, 4, 2, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 8, 4, 3, chunkBB); + + int southStairs = getOrientationData(Tile::stairs_wood_Id, 3); + int northStairs = getOrientationData(Tile::stairs_wood_Id, 2); + for (int d = -1; d <= 2; d++) + { + for (int w = 0; w <= 8; w++) + { + placeBlock(level, Tile::stairs_wood_Id, southStairs, w, 4 + d, d, chunkBB); + placeBlock(level, Tile::stairs_wood_Id, northStairs, w, 4 + d, 5 - d, chunkBB); + } + } + + // windows etc + placeBlock(level, Tile::treeTrunk_Id, 0, 0, 2, 1, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 0, 2, 4, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 8, 2, 1, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 8, 2, 4, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 2, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 2, 3, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 8, 2, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 8, 2, 3, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 2, 2, 5, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 3, 2, 5, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 5, 2, 0, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 6, 2, 5, chunkBB); + + // table + placeBlock(level, Tile::fence_Id, 0, 2, 1, 3, chunkBB); + placeBlock(level, Tile::pressurePlate_wood_Id, 0, 2, 2, 3, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 1, 1, 4, chunkBB); + placeBlock(level, Tile::stairs_wood_Id, getOrientationData(Tile::stairs_wood_Id, 3), 2, 1, 4, chunkBB); + placeBlock(level, Tile::stairs_wood_Id, getOrientationData(Tile::stairs_wood_Id, 1), 1, 1, 3, chunkBB); + + // butcher table + generateBox(level, chunkBB, 5, 0, 1, 7, 0, 3, Tile::stoneSlab_Id, Tile::stoneSlab_Id, false); + placeBlock(level, Tile::stoneSlab_Id, 0, 6, 1, 1, chunkBB); + placeBlock(level, Tile::stoneSlab_Id, 0, 6, 1, 2, chunkBB); + + // entrance + placeBlock(level, 0, 0, 2, 1, 0, chunkBB); + placeBlock(level, 0, 0, 2, 2, 0, chunkBB); + placeBlock(level, Tile::torch_Id, 0, 2, 3, 1, chunkBB); + createDoor(level, chunkBB, random, 2, 1, 0, getOrientationData(Tile::door_wood_Id, 1)); + if (getBlock(level, 2, 0, -1, chunkBB) == 0 && getBlock(level, 2, -1, -1, chunkBB) != 0) + { + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 3), 2, 0, -1, chunkBB); + } + + // pig entrance + placeBlock(level, 0, 0, 6, 1, 5, chunkBB); + placeBlock(level, 0, 0, 6, 2, 5, chunkBB); + placeBlock(level, Tile::torch_Id, 0, 6, 3, 4, chunkBB); + createDoor(level, chunkBB, random, 6, 1, 5, getOrientationData(Tile::door_wood_Id, 1)); + + for (int z = 0; z < 5; z++) + { + for (int x = 0; x < width; x++) + { + generateAirColumnUp(level, x, height, z, chunkBB); + fillColumnDown(level, Tile::cobblestone_Id, 0, x, -1, z, chunkBB); + } + } + + spawnVillagers(level, chunkBB, 4, 1, 2, 2); return true; @@ -1044,10 +1427,7 @@ VillagePieces::TwoRoomHouse::TwoRoomHouse(StartPiece *startPiece, int genDepth, VillagePieces::TwoRoomHouse *VillagePieces::TwoRoomHouse::createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_TwoRoomHouse); - - BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, piece->width, piece->height, piece->depth, direction); + BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { @@ -1055,10 +1435,7 @@ VillagePieces::TwoRoomHouse *VillagePieces::TwoRoomHouse::createPiece(StartPiece return nullptr; } - TwoRoomHouse *twoRoomHouse = new TwoRoomHouse(startPiece, genDepth, random, box, direction); - twoRoomHouse->getRandomValuesFromDataSet(piece, random, twoRoomHouse->featureConditions, twoRoomHouse->tileOptionRemap); - - return twoRoomHouse; + return new TwoRoomHouse(startPiece, genDepth, random, box, direction); } bool VillagePieces::TwoRoomHouse::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -1073,10 +1450,129 @@ bool VillagePieces::TwoRoomHouse::postProcess(Level *level, Random *random, Boun boundingBox->move(0, heightPosition - boundingBox->y1 + height - 1, 0); } - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_TwoRoomHouse); + // fill inside with air + generateBox(level, chunkBB, 1, 1, 1, 7, 4, 4, 0, 0, false); + generateBox(level, chunkBB, 2, 1, 6, 8, 4, 10, 0, 0, false); - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); + // floor + generateBox(level, chunkBB, 2, 0, 5, 8, 0, 10, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 1, 0, 1, 7, 0, 4, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 0, 0, 0, 0, 3, 5, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 8, 0, 0, 8, 3, 10, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 1, 0, 0, 7, 2, 0, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 1, 0, 5, 2, 1, 5, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 2, 0, 6, 2, 3, 10, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 3, 0, 10, 7, 3, 10, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + + // room 1 roof + generateBox(level, chunkBB, 1, 2, 0, 7, 3, 0, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 1, 2, 5, 2, 3, 5, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 0, 4, 1, 8, 4, 1, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 0, 4, 4, 3, 4, 4, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 0, 5, 2, 8, 5, 3, Tile::wood_Id, Tile::wood_Id, false); + placeBlock(level, Tile::wood_Id, 0, 0, 4, 2, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 0, 4, 3, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 8, 4, 2, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 8, 4, 3, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 8, 4, 4, chunkBB); + + int southStairs = getOrientationData(Tile::stairs_wood_Id, 3); + int northStairs = getOrientationData(Tile::stairs_wood_Id, 2); + for (int d = -1; d <= 2; d++) + { + for (int w = 0; w <= 8; w++) + { + placeBlock(level, Tile::stairs_wood_Id, southStairs, w, 4 + d, d, chunkBB); + if ((d > -1 || w <= 1) && (d > 0 || w <= 3) && (d > 1 || w <= 4 || w >= 6)) { + placeBlock(level, Tile::stairs_wood_Id, northStairs, w, 4 + d, 5 - d, chunkBB); + } + } + } + + // room 2 roof + generateBox(level, chunkBB, 3, 4, 5, 3, 4, 10, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 7, 4, 2, 7, 4, 10, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 4, 5, 4, 4, 5, 10, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 6, 5, 4, 6, 5, 10, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 5, 6, 3, 5, 6, 10, Tile::wood_Id, Tile::wood_Id, false); + int westStairs = getOrientationData(Tile::stairs_wood_Id, 0); + for (int w = 4; w >= 1; w--) + { + placeBlock(level, Tile::wood_Id, 0, w, 2 + w, 7 - w, chunkBB); + for (int d = 8 - w; d <= 10; d++) + { + placeBlock(level, Tile::stairs_wood_Id, westStairs, w, 2 + w, d, chunkBB); + } + } + int eastStairs = getOrientationData(Tile::stairs_wood_Id, 1); + placeBlock(level, Tile::wood_Id, 0, 6, 6, 3, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 7, 5, 4, chunkBB); + placeBlock(level, Tile::stairs_wood_Id, eastStairs, 6, 6, 4, chunkBB); + for (int w = 6; w <= 8; w++) + { + for (int d = 5; d <= 10; d++) + { + placeBlock(level, Tile::stairs_wood_Id, eastStairs, w, 12 - w, d, chunkBB); + } + } + + // windows etc + placeBlock(level, Tile::treeTrunk_Id, 0, 0, 2, 1, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 0, 2, 4, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 2, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 2, 3, chunkBB); + + placeBlock(level, Tile::treeTrunk_Id, 0, 4, 2, 0, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 5, 2, 0, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 6, 2, 0, chunkBB); + + placeBlock(level, Tile::treeTrunk_Id, 0, 8, 2, 1, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 8, 2, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 8, 2, 3, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 8, 2, 4, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 8, 2, 5, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 8, 2, 6, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 8, 2, 7, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 8, 2, 8, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 8, 2, 9, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 2, 2, 6, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 2, 2, 7, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 2, 2, 8, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 2, 2, 9, chunkBB); + + placeBlock(level, Tile::treeTrunk_Id, 0, 4, 4, 10, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 5, 4, 10, chunkBB); + placeBlock(level, Tile::treeTrunk_Id, 0, 6, 4, 10, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 5, 5, 10, chunkBB); + + // entrance + placeBlock(level, 0, 0, 2, 1, 0, chunkBB); + placeBlock(level, 0, 0, 2, 2, 0, chunkBB); + placeBlock(level, Tile::torch_Id, 0, 2, 3, 1, chunkBB); + createDoor(level, chunkBB, random, 2, 1, 0, getOrientationData(Tile::door_wood_Id, 1)); + generateBox(level, chunkBB, 1, 0, -1, 3, 2, -1, 0, 0, false); + if (getBlock(level, 2, 0, -1, chunkBB) == 0 && getBlock(level, 2, -1, -1, chunkBB) != 0) { + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 3), 2, 0, -1, chunkBB); + } + + for (int z = 0; z < 5; z++) + { + for (int x = 0; x < width; x++) + { + generateAirColumnUp(level, x, height, z, chunkBB); + fillColumnDown(level, Tile::cobblestone_Id, 0, x, -1, z, chunkBB); + } + } + for (int z = 5; z < depth - 1; z++) + { + for (int x = 2; x < width; x++) + { + generateAirColumnUp(level, x, height, z, chunkBB); + fillColumnDown(level, Tile::cobblestone_Id, 0, x, -1, z, chunkBB); + } + } + + spawnVillagers(level, chunkBB, 4, 1, 2, 2); return true; @@ -1113,16 +1609,15 @@ VillagePieces::Smithy::Smithy() VillagePieces::Smithy::Smithy(StartPiece *startPiece, int genDepth, Random *random, BoundingBox *stairsBox, int direction) : VillagePiece(startPiece, genDepth) { + hasPlacedChest = false; + orientation = direction; boundingBox = stairsBox; } VillagePieces::Smithy *VillagePieces::Smithy::createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_Smithy); - - BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, piece->width, piece->height, piece->depth, direction); + BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { @@ -1130,20 +1625,19 @@ VillagePieces::Smithy *VillagePieces::Smithy::createPiece(StartPiece *startPiece return nullptr; } - Smithy *smithy = new Smithy(startPiece, genDepth, random, box, direction); - smithy->getRandomValuesFromDataSet(piece, random, smithy->featureConditions, smithy->tileOptionRemap); - - return smithy; + return new Smithy(startPiece, genDepth, random, box, direction); } -void VillagePieces::Smithy::addAdditionalSaveData(DataOutputStream *dos) +void VillagePieces::Smithy::addAdditonalSaveData(CompoundTag *tag) { - VillagePiece::addAdditionalSaveData(dos); + VillagePiece::addAdditonalSaveData(tag); + tag->putBoolean(L"Chest", hasPlacedChest); } -void VillagePieces::Smithy::readAdditonalSaveData(DataInputStream *dis) +void VillagePieces::Smithy::readAdditonalSaveData(CompoundTag *tag) { - VillagePiece::readAdditonalSaveData(dis); + VillagePiece::readAdditonalSaveData(tag); + hasPlacedChest = tag->getBoolean(L"Chest"); } bool VillagePieces::Smithy::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -1158,10 +1652,87 @@ bool VillagePieces::Smithy::postProcess(Level *level, Random *random, BoundingBo boundingBox->move(0, heightPosition - boundingBox->y1 + height - 1, 0); } - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_Smithy); + // fill inside with air + generateBox(level, chunkBB, 0, 1, 0, 9, 4, 6, 0, 0, false); - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); + // floor + generateBox(level, chunkBB, 0, 0, 0, 9, 0, 6, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + + // roof + generateBox(level, chunkBB, 0, 4, 0, 9, 4, 6, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + generateBox(level, chunkBB, 0, 5, 0, 9, 5, 6, Tile::stoneSlabHalf_Id, Tile::stoneSlabHalf_Id, false); + generateBox(level, chunkBB, 1, 5, 1, 8, 5, 5, 0, 0, false); + + // room walls + generateBox(level, chunkBB, 1, 1, 0, 2, 3, 0, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 0, 1, 0, 0, 4, 0, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 3, 1, 0, 3, 4, 0, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 0, 1, 6, 0, 4, 6, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + placeBlock(level, Tile::wood_Id, 0, 3, 3, 1, chunkBB); + generateBox(level, chunkBB, 3, 1, 2, 3, 3, 2, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 4, 1, 3, 5, 3, 3, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 0, 1, 1, 0, 3, 5, Tile::wood_Id, Tile::wood_Id, false); + generateBox(level, chunkBB, 1, 1, 6, 5, 3, 6, Tile::wood_Id, Tile::wood_Id, false); + + // pillars + generateBox(level, chunkBB, 5, 1, 0, 5, 3, 0, Tile::fence_Id, Tile::fence_Id, false); + generateBox(level, chunkBB, 9, 1, 0, 9, 3, 0, Tile::fence_Id, Tile::fence_Id, false); + + // furnace + generateBox(level, chunkBB, 6, 1, 4, 9, 4, 6, Tile::cobblestone_Id, Tile::cobblestone_Id, false); + placeBlock(level, Tile::lava_Id, 0, 7, 1, 5, chunkBB); + placeBlock(level, Tile::lava_Id, 0, 8, 1, 5, chunkBB); + placeBlock(level, Tile::ironFence_Id, 0, 9, 2, 5, chunkBB); + placeBlock(level, Tile::ironFence_Id, 0, 9, 2, 4, chunkBB); + generateBox(level, chunkBB, 7, 2, 4, 8, 2, 5, 0, 0, false); + placeBlock(level, Tile::cobblestone_Id, 0, 6, 1, 3, chunkBB); + placeBlock(level, Tile::furnace_Id, 0, 6, 2, 3, chunkBB); + placeBlock(level, Tile::furnace_Id, 0, 6, 3, 3, chunkBB); + placeBlock(level, Tile::stoneSlab_Id, 0, 8, 1, 1, chunkBB); + + // windows etc + placeBlock(level, Tile::thinGlass_Id, 0, 0, 2, 2, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 0, 2, 4, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 2, 2, 6, chunkBB); + placeBlock(level, Tile::thinGlass_Id, 0, 4, 2, 6, chunkBB); + + // table + placeBlock(level, Tile::fence_Id, 0, 2, 1, 4, chunkBB); + placeBlock(level, Tile::pressurePlate_wood_Id, 0, 2, 2, 4, chunkBB); + placeBlock(level, Tile::wood_Id, 0, 1, 1, 5, chunkBB); + placeBlock(level, Tile::stairs_wood_Id, getOrientationData(Tile::stairs_wood_Id, 3), 2, 1, 5, chunkBB); + placeBlock(level, Tile::stairs_wood_Id, getOrientationData(Tile::stairs_wood_Id, 1), 1, 1, 4, chunkBB); + + if (!hasPlacedChest) + { + int y = getWorldY(1); + int x = getWorldX(5, 5), z = getWorldZ(5, 5); + if (chunkBB->isInside(x, y, z)) + { + hasPlacedChest = true; + createChest(level, chunkBB, random, 5, 1, 5, treasureItems, 3 + random->nextInt(6)); + } + } + + // entrance + for (int x = 6; x <= 8; x++) + { + if (getBlock(level, x, 0, -1, chunkBB) == 0 && getBlock(level, x, -1, -1, chunkBB) != 0 ) + { + placeBlock(level, Tile::stairs_stone_Id, getOrientationData(Tile::stairs_stone_Id, 3), x, 0, -1, chunkBB); + } + } + + for (int z = 0; z < depth; z++) + { + for (int x = 0; x < width; x++) + { + generateAirColumnUp(level, x, height, z, chunkBB); + fillColumnDown(level, Tile::cobblestone_Id, 0, x, -1, z, chunkBB); + } + } + + spawnVillagers(level, chunkBB, 7, 1, 1, 1); return true; @@ -1174,6 +1745,8 @@ int VillagePieces::Smithy::getVillagerProfession(int villagerNumber) VillagePieces::Farmland::Farmland() { + cropsA = 0; + cropsB = 0; // for reflection } @@ -1181,24 +1754,41 @@ VillagePieces::Farmland::Farmland(StartPiece *startPiece, int genDepth, Random * { orientation = direction; boundingBox = stairsBox; + + cropsA = selectCrops(random); + cropsB = selectCrops(random); } -void VillagePieces::Farmland::addAdditionalSaveData(DataOutputStream *dos) +int VillagePieces::Farmland::selectCrops(Random *random) { - VillagePiece::addAdditionalSaveData(dos); + switch (random->nextInt(5)) + { + default: + return Tile::wheat_Id; + case 0: + return Tile::carrots_Id; + case 1: + return Tile::potatoes_Id; + } } -void VillagePieces::Farmland::readAdditonalSaveData(DataInputStream *dis) +void VillagePieces::Farmland::addAdditonalSaveData(CompoundTag *tag) { - VillagePiece::readAdditonalSaveData(dis); + VillagePiece::addAdditonalSaveData(tag); + tag->putInt(L"CA", cropsA); + tag->putInt(L"CB", cropsB); +} + +void VillagePieces::Farmland::readAdditonalSaveData(CompoundTag *tag) +{ + VillagePiece::readAdditonalSaveData(tag); + cropsA = tag->getInt(L"CA"); + cropsB = tag->getInt(L"CB"); } VillagePieces::Farmland *VillagePieces::Farmland::createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_Farmland); - - BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, piece->width, piece->height, piece->depth, direction); + BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { @@ -1206,10 +1796,7 @@ VillagePieces::Farmland *VillagePieces::Farmland::createPiece(StartPiece *startP return nullptr; } - Farmland *farmland = new Farmland(startPiece, genDepth, random, box, direction); - farmland->getRandomValuesFromDataSet(piece, random, farmland->featureConditions, farmland->tileOptionRemap); - - return farmland; + return new Farmland(startPiece, genDepth, random, box, direction); } bool VillagePieces::Farmland::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -1224,16 +1811,47 @@ bool VillagePieces::Farmland::postProcess(Level *level, Random *random, Bounding boundingBox->move(0, heightPosition - boundingBox->y1 + height - 1, 0); } - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_Farmland); + // fill inside with air + generateBox(level, chunkBB, 0, 1, 0, 6, 4, 8, 0, 0, false); - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); + // farmlands + generateBox(level, chunkBB, 1, 0, 1, 2, 0, 7, Tile::farmland_Id, Tile::farmland_Id, false); + generateBox(level, chunkBB, 4, 0, 1, 5, 0, 7, Tile::farmland_Id, Tile::farmland_Id, false); + // walkpaths + generateBox(level, chunkBB, 0, 0, 0, 0, 0, 8, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 6, 0, 0, 6, 0, 8, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 1, 0, 0, 5, 0, 0, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 1, 0, 8, 5, 0, 8, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + // water + generateBox(level, chunkBB, 3, 0, 1, 3, 0, 7, Tile::water_Id, Tile::water_Id, false); + // crops + for (int d = 1; d <= 7; d++) + { + placeBlock(level, cropsA, Mth::nextInt(random, 2, 7), 1, 1, d, chunkBB); + placeBlock(level, cropsA, Mth::nextInt(random, 2, 7), 2, 1, d, chunkBB); + placeBlock(level, cropsB, Mth::nextInt(random, 2, 7), 4, 1, d, chunkBB); + placeBlock(level, cropsB, Mth::nextInt(random, 2, 7), 5, 1, d, chunkBB); + } + + for (int z = 0; z < depth; z++) + { + for (int x = 0; x < width; x++) + { + generateAirColumnUp(level, x, height, z, chunkBB); + fillColumnDown(level, Tile::dirt_Id, 0, x, -1, z, chunkBB); + } + } return true; + } VillagePieces::DoubleFarmland::DoubleFarmland() { + cropsA = 0; + cropsB = 0; + cropsC = 0; + cropsD = 0; // for reflection } @@ -1242,24 +1860,47 @@ VillagePieces::DoubleFarmland::DoubleFarmland(StartPiece *startPiece, int genDep heightPosition = -1; // 4J added initialiser orientation = direction; boundingBox = stairsBox; + + cropsA = selectCrops(random); + cropsB = selectCrops(random); + cropsC = selectCrops(random); + cropsD = selectCrops(random); } -void VillagePieces::DoubleFarmland::addAdditionalSaveData(DataOutputStream *dos) +void VillagePieces::DoubleFarmland::addAdditonalSaveData(CompoundTag *tag) { - VillagePiece::addAdditionalSaveData(dos); + VillagePiece::addAdditonalSaveData(tag); + tag->putInt(L"CA", cropsA); + tag->putInt(L"CB", cropsB); + tag->putInt(L"CC", cropsC); + tag->putInt(L"CD", cropsD); } -void VillagePieces::DoubleFarmland::readAdditonalSaveData(DataInputStream *dis) +void VillagePieces::DoubleFarmland::readAdditonalSaveData(CompoundTag *tag) { - VillagePiece::readAdditonalSaveData(dis); + VillagePiece::readAdditonalSaveData(tag); + cropsA = tag->getInt(L"CA"); + cropsB = tag->getInt(L"CB"); + cropsC = tag->getInt(L"CC"); + cropsD = tag->getInt(L"CD"); +} + +int VillagePieces::DoubleFarmland::selectCrops(Random *random) +{ + switch (random->nextInt(5)) + { + default: + return Tile::wheat_Id; + case 0: + return Tile::carrots_Id; + case 1: + return Tile::potatoes_Id; + } } VillagePieces::DoubleFarmland *VillagePieces::DoubleFarmland::createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_DoubleFarmland); - - BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, piece->width, piece->height, piece->depth, direction); + BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { @@ -1267,10 +1908,7 @@ VillagePieces::DoubleFarmland *VillagePieces::DoubleFarmland::createPiece(StartP return nullptr; } - DoubleFarmland *farmland = new DoubleFarmland(startPiece, genDepth, random, box, direction); - farmland->getRandomValuesFromDataSet(piece, random, farmland->featureConditions, farmland->tileOptionRemap); - - return farmland; + return new DoubleFarmland(startPiece, genDepth, random, box, direction); } bool VillagePieces::DoubleFarmland::postProcess(Level *level, Random *random, BoundingBox *chunkBB) @@ -1285,12 +1923,48 @@ bool VillagePieces::DoubleFarmland::postProcess(Level *level, Random *random, Bo boundingBox->move(0, heightPosition - boundingBox->y1 + height - 1, 0); } - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_DoubleFarmland); + // fill inside with air + generateBox(level, chunkBB, 0, 1, 0, 12, 4, 8, 0, 0, false); + + // farmlands + generateBox(level, chunkBB, 1, 0, 1, 2, 0, 7, Tile::farmland_Id, Tile::farmland_Id, false); + generateBox(level, chunkBB, 4, 0, 1, 5, 0, 7, Tile::farmland_Id, Tile::farmland_Id, false); + generateBox(level, chunkBB, 7, 0, 1, 8, 0, 7, Tile::farmland_Id, Tile::farmland_Id, false); + generateBox(level, chunkBB, 10, 0, 1, 11, 0, 7, Tile::farmland_Id, Tile::farmland_Id, false); + // walkpaths + generateBox(level, chunkBB, 0, 0, 0, 0, 0, 8, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 6, 0, 0, 6, 0, 8, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 12, 0, 0, 12, 0, 8, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 1, 0, 0, 11, 0, 0, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + generateBox(level, chunkBB, 1, 0, 8, 11, 0, 8, Tile::treeTrunk_Id, Tile::treeTrunk_Id, false); + // water + generateBox(level, chunkBB, 3, 0, 1, 3, 0, 7, Tile::water_Id, Tile::water_Id, false); + generateBox(level, chunkBB, 9, 0, 1, 9, 0, 7, Tile::water_Id, Tile::water_Id, false); + // crops + for (int d = 1; d <= 7; d++) + { + placeBlock(level, cropsA, Mth::nextInt(random, 2, 7), 1, 1, d, chunkBB); + placeBlock(level, cropsA, Mth::nextInt(random, 2, 7), 2, 1, d, chunkBB); + placeBlock(level, cropsB, Mth::nextInt(random, 2, 7), 4, 1, d, chunkBB); + placeBlock(level, cropsB, Mth::nextInt(random, 2, 7), 5, 1, d, chunkBB); + placeBlock(level, cropsC, Mth::nextInt(random, 2, 7), 7, 1, d, chunkBB); + placeBlock(level, cropsC, Mth::nextInt(random, 2, 7), 8, 1, d, chunkBB); + placeBlock(level, cropsD, Mth::nextInt(random, 2, 7), 10, 1, d, chunkBB); + placeBlock(level, cropsD, Mth::nextInt(random, 2, 7), 11, 1, d, chunkBB); + } + + for (int z = 0; z < depth; z++) + { + for (int x = 0; x < width; x++) + { + generateAirColumnUp(level, x, height, z, chunkBB); + fillColumnDown(level, Tile::dirt_Id, 0, x, -1, z, chunkBB); + } + } - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); return true; + } VillagePieces::LightPost::LightPost() @@ -1307,10 +1981,7 @@ VillagePieces::LightPost::LightPost(StartPiece *startPiece, int genDepth, Random BoundingBox *VillagePieces::LightPost::findPieceBox(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction) { - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_LightPost); - - BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, piece->width, piece->height, piece->depth, direction); + BoundingBox *box = BoundingBox::orientBox(footX, footY, footZ, 0, 0, 0, width, height, depth, direction); if (!isOkBox(box, startPiece) || StructurePiece::findCollisionPiece(pieces, box) != nullptr) { @@ -1333,10 +2004,22 @@ bool VillagePieces::LightPost::postProcess(Level *level, Random *random, Boundin boundingBox->move(0, heightPosition - boundingBox->y1 + height - 1, 0); } - StructureTable *structureTable = Minecraft::GetInstance()->getStructureTable(); - StructureTable::StructurePiece *piece = structureTable->getStructurePiece(eMinecraftStructurePiece_LightPost); + // fill with air + generateBox(level, chunkBB, 0, 0, 0, 2, 3, 1, 0, 0, false); - generateStructureFromData(level, chunkBB, random, piece, objectPlacedFlags, featureConditions, tileOptionRemap, entitySpawnCounts); + // pillar + placeBlock(level, Tile::fence_Id, 0, 1, 0, 0, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 1, 1, 0, chunkBB); + placeBlock(level, Tile::fence_Id, 0, 1, 2, 0, chunkBB); + + // head + placeBlock(level, Tile::wool_Id, DyePowderItem::WHITE, 1, 3, 0, chunkBB); + + // torches + placeBlock(level, Tile::torch_Id, 0, 0, 3, 0, chunkBB); + placeBlock(level, Tile::torch_Id, 0, 1, 3, 1, chunkBB); + placeBlock(level, Tile::torch_Id, 0, 2, 3, 0, chunkBB); + placeBlock(level, Tile::torch_Id, 0, 1, 3, -1, chunkBB); return true; } diff --git a/Minecraft.World/VillagePieces.h b/Minecraft.World/VillagePieces.h index b2f4cc31..7570d65b 100644 --- a/Minecraft.World/VillagePieces.h +++ b/Minecraft.World/VillagePieces.h @@ -69,20 +69,14 @@ private: int heightPosition; private: int spawnedVillagerCount; - protected: - std::vector objectPlacedFlags; - std::vector featureConditions; - std::vector tileOptionRemap; - std::vector entitySpawnCounts; - private: bool isDesertVillage; protected: StartPiece *startPiece; VillagePiece(); VillagePiece(StartPiece *startPiece, int genDepth); - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); StructurePiece *generateHouseNorthernLeft(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff); StructurePiece *generateHouseNorthernRight(StartPiece *startPiece, list *pieces, Random *random, int yOff, int zOff); int getAverageGroundHeight(Level *level, BoundingBox *chunkBB); @@ -94,7 +88,6 @@ private: virtual void placeBlock(Level *level, int block, int data, int x, int y, int z, BoundingBox *chunkBB); virtual void generateBox(Level *level, BoundingBox *chunkBB, int x0, int y0, int z0, int x1, int y1, int z1, int edgeTile, int fillTile, bool skipAir); virtual void fillColumnDown(Level *level, int block, int data, int x, int startY, int z, BoundingBox *chunkBB); - virtual void fillBoxDown(Level* level, int x0, int y0, int z0, int x1, int y1, int z1, int tile, int tileData, BoundingBox* chunkBB); }; /** @@ -108,6 +101,11 @@ public: static StructurePiece *Create() { return new Well(); } virtual EStructurePiece GetType() { return eStructurePiece_Well; } + private: + static const int width = 6; + static const int height = 15; + static const int depth = 6; + public: Well(); Well(StartPiece *startPiece, int genDepth, Random *random, int west, int north); @@ -172,8 +170,8 @@ public: StraightRoad(StartPiece *startPiece, int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - void addAdditionalSaveData(DataOutputStream *dos); - void readAdditonalSaveData(DataInputStream *dis); + void addAdditonalSaveData(CompoundTag *tag); + void readAdditonalSaveData(CompoundTag *tag); public: virtual void addChildren(StructurePiece *startPiece, list *pieces, Random *random); @@ -193,15 +191,20 @@ public: virtual EStructurePiece GetType() { return eStructurePiece_SimpleHouse; } private: + static const int width = 5; static const int height = 6; + static const int depth = 5; + + private: + bool hasTerrace; public: SimpleHouse(); SimpleHouse(StartPiece *startPiece, int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - void addAdditionalSaveData(DataOutputStream *dos); - void readAdditonalSaveData(DataInputStream *dis); + void addAdditonalSaveData(CompoundTag *tag); + void readAdditonalSaveData(CompoundTag *tag); public: static SimpleHouse *createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); @@ -216,7 +219,9 @@ public: virtual EStructurePiece GetType() { return eStructurePiece_SmallTemple; } private: + static const int width = 5; static const int height = 12; + static const int depth = 9; int heightPosition; @@ -237,7 +242,9 @@ public: virtual EStructurePiece GetType() { return eStructurePiece_BookHouse; } private: + static const int width = 9; static const int height = 9; + static const int depth = 6; int heightPosition; @@ -259,15 +266,20 @@ public: private: + static const int width = 4; static const int height = 6; + static const int depth = 5; + + bool lowCeiling; + int tablePlacement; public: SmallHut(); SmallHut(StartPiece *startPiece, int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: static SmallHut *createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); @@ -283,7 +295,9 @@ public: private: + static const int width = 9; static const int height = 7; + static const int depth = 11; public: PigHouse(); @@ -301,7 +315,9 @@ public: virtual EStructurePiece GetType() { return eStructurePiece_TwoRoomHouse; } private: + static const int width = 9; static const int height = 7; + static const int depth = 12; int heightPosition; @@ -321,7 +337,11 @@ public: private: + static const int width = 10; static const int height = 6; + static const int depth = 7; + + bool hasPlacedChest; static WeighedTreasureArray treasureItems; @@ -333,8 +353,8 @@ public: static Smithy *createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); protected: - void addAdditionalSaveData(DataOutputStream *dos); - void readAdditonalSaveData(DataInputStream *dis); + void addAdditonalSaveData(CompoundTag *tag); + void readAdditonalSaveData(CompoundTag *tag); public: virtual bool postProcess(Level *level, Random *random, BoundingBox *chunkBB); @@ -348,16 +368,24 @@ public: static StructurePiece *Create() { return new Farmland(); } virtual EStructurePiece GetType() { return eStructurePiece_Farmland; } + private: + static const int width = 7; static const int height = 4; + static const int depth = 9; + + int cropsA; + int cropsB; + + int selectCrops(Random *random); public: Farmland(); Farmland(StartPiece *startPiece, int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: static Farmland *createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); @@ -372,17 +400,26 @@ public: virtual EStructurePiece GetType() { return eStructurePiece_DoubleFarmland; } private: + static const int width = 13; static const int height = 4; + static const int depth = 9; int heightPosition; + int cropsA; + int cropsB; + int cropsC; + int cropsD; + + int selectCrops(Random *random); + public: DoubleFarmland(); DoubleFarmland(StartPiece *startPiece, int genDepth, Random *random, BoundingBox *stairsBox, int direction); protected: - virtual void addAdditionalSaveData(DataOutputStream *dos); - virtual void readAdditonalSaveData(DataInputStream *dis); + virtual void addAdditonalSaveData(CompoundTag *tag); + virtual void readAdditonalSaveData(CompoundTag *tag); public: static DoubleFarmland *createPiece(StartPiece *startPiece, list *pieces, Random *random, int footX, int footY, int footZ, int direction, int genDepth); @@ -397,7 +434,9 @@ public: virtual EStructurePiece GetType() { return eStructurePiece_LightPost; } private: + static const int width = 3; static const int height = 4; + static const int depth = 2; int heightPosition; diff --git a/Minecraft.World/Villager.cpp b/Minecraft.World/Villager.cpp index 759006ca..fa5c091c 100644 --- a/Minecraft.World/Villager.cpp +++ b/Minecraft.World/Villager.cpp @@ -776,15 +776,3 @@ wstring Villager::getDisplayName() }; return app.GetString(name); } - -// TU25 Addition -float Villager::getEyeHeight() -{ - //TODO: Use LCE instead of JAVA - float f = 1.62F; - - if (isBaby()) - f -= 0.81; - - return f; -} \ No newline at end of file diff --git a/Minecraft.World/Villager.h b/Minecraft.World/Villager.h index c3ca5d8e..3867cfd7 100644 --- a/Minecraft.World/Villager.h +++ b/Minecraft.World/Villager.h @@ -147,6 +147,4 @@ public: virtual shared_ptr getBreedOffspring(shared_ptr target); virtual bool canBeLeashed(); virtual wstring getDisplayName(); - // TU25 Addition - virtual float getEyeHeight(); }; \ No newline at end of file diff --git a/Minecraft.World/Villages.cpp b/Minecraft.World/Villages.cpp index eec2ffc3..432a8b6b 100644 --- a/Minecraft.World/Villages.cpp +++ b/Minecraft.World/Villages.cpp @@ -208,7 +208,7 @@ bool Villages::hasQuery(int x, int y, int z) bool Villages::isDoor(int x, int y, int z) { int tileId = level->getTile(x, y, z); - return DoorTile::isDoor(tileId); + return tileId == Tile::door_wood_Id; } void Villages::load(CompoundTag *tag) diff --git a/Minecraft.World/WallTile.cpp b/Minecraft.World/WallTile.cpp index df9b84e4..b7d3f038 100644 --- a/Minecraft.World/WallTile.cpp +++ b/Minecraft.World/WallTile.cpp @@ -154,7 +154,7 @@ AABB *WallTile::getAABB(Level *level, int x, int y, int z) bool WallTile::connectsTo(LevelSource *level, int x, int y, int z) { int tile = level->getTile(x, y, z); - if (tile == id || FenceGateTile::isFenceGate(tile)) + if (tile == id || tile == Tile::fenceGate_Id) { return true; } diff --git a/Minecraft.World/Witch.cpp b/Minecraft.World/Witch.cpp index 82e65b06..4384456e 100644 --- a/Minecraft.World/Witch.cpp +++ b/Minecraft.World/Witch.cpp @@ -221,10 +221,4 @@ void Witch::performRangedAttack(shared_ptr target, float power) potion->shoot(xd, yd + dist * 0.2f, zd, 0.75f, 8); level->addEntity(potion); -} - -// TU25 Addition -float Witch::getEyeHeight() -{ - return 1.62f; } \ No newline at end of file diff --git a/Minecraft.World/Witch.h b/Minecraft.World/Witch.h index a1643afb..4c9b80ad 100644 --- a/Minecraft.World/Witch.h +++ b/Minecraft.World/Witch.h @@ -45,6 +45,4 @@ protected: public: virtual void performRangedAttack(shared_ptr target, float power); - // TU25 Addition - virtual float getEyeHeight(); }; \ No newline at end of file diff --git a/Minecraft.World/Wolf.cpp b/Minecraft.World/Wolf.cpp index 90df4a20..06b03a70 100644 --- a/Minecraft.World/Wolf.cpp +++ b/Minecraft.World/Wolf.cpp @@ -596,10 +596,4 @@ bool Wolf::wantsToAttack(shared_ptr target, shared_ptr target, shared_ptr owner); - // TU25 Addition - virtual float getEyeHeight(); }; diff --git a/Minecraft.World/WoodSlabTile.cpp b/Minecraft.World/WoodSlabTile.cpp index 3a3b26a9..574dab93 100644 --- a/Minecraft.World/WoodSlabTile.cpp +++ b/Minecraft.World/WoodSlabTile.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "WoodSlabTile.h" #include "woodtile.h" -#include "LogTile.h" +#include "treetile.h" #include "net.minecraft.world.level.h" #include "net.minecraft.world.level.biome.h" #include "net.minecraft.world.item.h" diff --git a/Minecraft.World/WoodTile.cpp b/Minecraft.World/WoodTile.cpp index 63aad133..239ef61c 100644 --- a/Minecraft.World/WoodTile.cpp +++ b/Minecraft.World/WoodTile.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "WoodTile.h" -#include "LogTile.h" +#include "TreeTile.h" #include "net.minecraft.world.level.h" #include "net.minecraft.world.level.biome.h" #include "net.minecraft.world.item.h" @@ -11,11 +11,9 @@ const unsigned int WoodTile::WOOD_NAMES[WOOD_NAMES_LENGTH] = { IDS_TILE_OAKWOOD_ IDS_TILE_SPRUCEWOOD_PLANKS, IDS_TILE_BIRCHWOOD_PLANKS, IDS_TILE_JUNGLE_PLANKS, - IDS_TILE_ACACIA_PLANKS, - IDS_TILE_DARK_OAK_PLANKS, }; -const wstring WoodTile::TEXTURE_NAMES[] = {L"oak", L"spruce", L"birch", L"jungle", L"acacia", L"big_oak"}; +const wstring WoodTile::TEXTURE_NAMES[] = {L"oak", L"spruce", L"birch", L"jungle"}; // public static final String[] WOOD_NAMES = { // "oak", "spruce", "birch", "jungle" diff --git a/Minecraft.World/WoodTile.h b/Minecraft.World/WoodTile.h index 1a4e8c45..23bbdfb1 100644 --- a/Minecraft.World/WoodTile.h +++ b/Minecraft.World/WoodTile.h @@ -7,7 +7,7 @@ class WoodTile : public Tile { friend class ChunkRebuildData; public: - static const int WOOD_NAMES_LENGTH = 6; + static const int WOOD_NAMES_LENGTH = 4; static const unsigned int WOOD_NAMES[WOOD_NAMES_LENGTH]; diff --git a/Minecraft.World/WritingBookItem.cpp b/Minecraft.World/WritingBookItem.cpp deleted file mode 100644 index 9efa56eb..00000000 --- a/Minecraft.World/WritingBookItem.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "stdafx.h" - -#include "WritingBookItem.h" diff --git a/Minecraft.World/WritingBookItem.h b/Minecraft.World/WritingBookItem.h deleted file mode 100644 index 5554ec11..00000000 --- a/Minecraft.World/WritingBookItem.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#include "Item.h" diff --git a/Minecraft.World/WrittenBookItem.cpp b/Minecraft.World/WrittenBookItem.cpp deleted file mode 100644 index 00b68b75..00000000 --- a/Minecraft.World/WrittenBookItem.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "stdafx.h" - -#include "WrittenBookItem.h" -#include "WritingBookItem.h" diff --git a/Minecraft.World/Zombie.cpp b/Minecraft.World/Zombie.cpp index 6fba7b91..c829f920 100644 --- a/Minecraft.World/Zombie.cpp +++ b/Minecraft.World/Zombie.cpp @@ -238,18 +238,6 @@ void Zombie::updateSize(bool isBaby) setSize(0.6f, 1.8f * scale); } -// TU25 Addition -float Zombie::getEyeHeight() -{ - //TODO: Use LCE one instead of JAVA - float f = 1.74F; - - if (isBaby()) - f -= 0.81; - - return f; -} - int Zombie::getAmbientSound() { return eSoundType_MOB_ZOMBIE_AMBIENT; @@ -514,4 +502,4 @@ Zombie::ZombieGroupData::ZombieGroupData(bool baby, bool villager) { isBaby = baby; isVillager = villager; -} \ No newline at end of file +} diff --git a/Minecraft.World/Zombie.h b/Minecraft.World/Zombie.h index 1f558919..9852980a 100644 --- a/Minecraft.World/Zombie.h +++ b/Minecraft.World/Zombie.h @@ -61,8 +61,6 @@ public: virtual void tick(); virtual bool doHurtTarget(shared_ptr target); virtual void updateSize(bool isBaby); - // TU25 Addition - virtual float getEyeHeight(); protected: virtual int getAmbientSound(); diff --git a/Minecraft.World/cmake/sources/Common.cmake b/Minecraft.World/cmake/sources/Common.cmake index 684b6bab..8a4d6833 100644 --- a/Minecraft.World/cmake/sources/Common.cmake +++ b/Minecraft.World/cmake/sources/Common.cmake @@ -27,8 +27,6 @@ set(_MINECRAFT_WORLD_COMMON_CONSOLEHELPERS_CONSOLESAVEFILEIO "${CMAKE_CURRENT_SOURCE_DIR}/ConsoleSaveFileInputStream.h" "${CMAKE_CURRENT_SOURCE_DIR}/ConsoleSaveFileOriginal.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/ConsoleSaveFileOriginal.h" - "${CMAKE_CURRENT_SOURCE_DIR}/ConsoleSaveFileSplit.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/ConsoleSaveFileSplit.h" "${CMAKE_CURRENT_SOURCE_DIR}/ConsoleSaveFileOutputStream.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/ConsoleSaveFileOutputStream.h" "${CMAKE_CURRENT_SOURCE_DIR}/ConsoleSavePath.h" @@ -1158,8 +1156,6 @@ set(_MINECRAFT_WORLD_COMMON_NET_MINECRAFT_WORLD_ITEM "${CMAKE_CURRENT_SOURCE_DIR}/WoolTileItem.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/WoolTileItem.h" "${CMAKE_CURRENT_SOURCE_DIR}/WrittenBookItem.h" - "${CMAKE_CURRENT_SOURCE_DIR}/WritingBookItem.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/WritingBookItem.h" "${CMAKE_CURRENT_SOURCE_DIR}/net.minecraft.world.item.h" ) source_group("net/minecraft/world/item" FILES ${_MINECRAFT_WORLD_COMMON_NET_MINECRAFT_WORLD_ITEM}) @@ -1833,12 +1829,6 @@ set(_MINECRAFT_WORLD_COMMON_NET_MINECRAFT_WORLD_LEVEL_TILE "${CMAKE_CURRENT_SOURCE_DIR}/LiquidTileStatic.h" "${CMAKE_CURRENT_SOURCE_DIR}/LockedChestTile.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/LockedChestTile.h" - "${CMAKE_CURRENT_SOURCE_DIR}/LogTile.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/LogTile.h" - "${CMAKE_CURRENT_SOURCE_DIR}/NewLogTile.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/NewLogTile.h" - "${CMAKE_CURRENT_SOURCE_DIR}/OldLogTile.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/OldLogTile.h" "${CMAKE_CURRENT_SOURCE_DIR}/MelonTile.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/MelonTile.h" "${CMAKE_CURRENT_SOURCE_DIR}/MetalTile.cpp" @@ -1941,6 +1931,8 @@ set(_MINECRAFT_WORLD_COMMON_NET_MINECRAFT_WORLD_LEVEL_TILE "${CMAKE_CURRENT_SOURCE_DIR}/TransparentTile.h" "${CMAKE_CURRENT_SOURCE_DIR}/TrapDoorTile.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/TrapDoorTile.h" + "${CMAKE_CURRENT_SOURCE_DIR}/TreeTile.cpp" + "${CMAKE_CURRENT_SOURCE_DIR}/TreeTile.h" "${CMAKE_CURRENT_SOURCE_DIR}/TripWireSourceTile.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/TripWireSourceTile.h" "${CMAKE_CURRENT_SOURCE_DIR}/TripWireTile.cpp" diff --git a/Minecraft.World/net.minecraft.world.level.tile.h b/Minecraft.World/net.minecraft.world.level.tile.h index 4182106f..36c7ac5c 100644 --- a/Minecraft.World/net.minecraft.world.level.tile.h +++ b/Minecraft.World/net.minecraft.world.level.tile.h @@ -115,9 +115,7 @@ #include "TorchTile.h" #include "TransparentTile.h" #include "TrapDoorTile.h" -#include "NewLogTile.h" -#include "OldLogTile.h" -#include "LogTile.h" +#include "TreeTile.h" #include "TripWireSourceTile.h" #include "TripWireTile.h" #include "VineTile.h" diff --git a/Minecraft.World/stdafx.h b/Minecraft.World/stdafx.h index 61a3dae8..b85819e3 100644 --- a/Minecraft.World/stdafx.h +++ b/Minecraft.World/stdafx.h @@ -190,7 +190,6 @@ void MemSect(int sect); #include "..\Minecraft.Client\Common\Consoles_App.h" #include "..\Minecraft.Client\Common\Minecraft_Macros.h" #include "..\Minecraft.Client\Common\Colours\ColourTable.h" -#include "..\Minecraft.Client\StructureTable.h" #include "Common\BuildVer.h" diff --git a/build-start-dedicated-server.sh b/build-start-dedicated-server.sh index 77218a3b..00860aea 100644 --- a/build-start-dedicated-server.sh +++ b/build-start-dedicated-server.sh @@ -3,7 +3,7 @@ set -euo pipefail SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" COMPOSE_FILE="${SCRIPT_DIR}/docker-compose.dedicated-server.yml" -SERVICE_NAME="minecraft-tu30dev-dedicated-server" +SERVICE_NAME="minecraft-tu24dev-dedicated-server" PERSIST_DIR="${SCRIPT_DIR}/server-data" if [[ ! -f "${COMPOSE_FILE}" ]]; then diff --git a/docker-compose.dedicated-server.ghcr.yml b/docker-compose.dedicated-server.ghcr.yml index 2393f3c8..456fc62a 100644 --- a/docker-compose.dedicated-server.ghcr.yml +++ b/docker-compose.dedicated-server.ghcr.yml @@ -1,7 +1,7 @@ services: - minecraft-tu30dev-dedicated-server: - image: ghcr.io/GabsPuNs/minecraft-tu30dev-dedicated-server:nightly - container_name: minecraft-tu30dev-dedicated-server + minecraft-tu24dev-dedicated-server: + image: ghcr.io/GabsPuNs/minecraft-tu24dev-dedicated-server:nightly + container_name: minecraft-tu24dev-dedicated-server restart: unless-stopped tty: true stdin_open: true diff --git a/docker-compose.dedicated-server.yml b/docker-compose.dedicated-server.yml index 92ba6fa7..f3c4fd1c 100644 --- a/docker-compose.dedicated-server.yml +++ b/docker-compose.dedicated-server.yml @@ -1,11 +1,11 @@ services: - minecraft-tu30dev-dedicated-server: + minecraft-tu24dev-dedicated-server: build: context: . dockerfile: docker/dedicated-server/Dockerfile args: MC_RUNTIME_DIR: ${MC_RUNTIME_DIR:-x64/Minecraft.Server/Release} - container_name: minecraft-tu30dev-dedicated-server + container_name: minecraft-tu24dev-dedicated-server restart: unless-stopped tty: true stdin_open: true diff --git a/docker/dedicated-server/entrypoint.sh b/docker/dedicated-server/entrypoint.sh index 79498f27..73918697 100644 --- a/docker/dedicated-server/entrypoint.sh +++ b/docker/dedicated-server/entrypoint.sh @@ -104,7 +104,7 @@ fi mkdir -p "${PERSIST_DIR}" # created because it is not implemented on the server side -mkdir -p "${PERSIST_DIR}/Saves" +mkdir -p "${PERSIST_DIR}Saves" ensure_persist_file "${PERSIST_DIR}/server.properties" "server.properties" "" ensure_persist_file "${PERSIST_DIR}/banned-players.json" "banned-players.json" "[]\n" @@ -114,7 +114,7 @@ ensure_persist_file "${PERSIST_DIR}/banned-ips.json" "banned-ips.json" "[]\n" if [ -e "Data/Saves" ] && [ ! -L "Data/Saves" ]; then rm -rf "Data/Saves" fi -ln -sfn "${PERSIST_DIR}/Saves" "Data/Saves" +ln -sfn "${PERSIST_DIR}/Data/Saves" "Data/Saves" # for compatibility with other images if command -v wine64 >/dev/null 2>&1; then diff --git a/include/Common/BuildVer.h b/include/Common/BuildVer.h index 65743db5..5e64744e 100644 --- a/include/Common/BuildVer.h +++ b/include/Common/BuildVer.h @@ -1,6 +1,6 @@ #pragma once -#define VER_PRODUCTBUILD 779 +#define VER_PRODUCTBUILD 626 #define VER_PRODUCTVERSION_STR_W L"DEV (unknown version)" #define VER_FILEVERSION_STR_W VER_PRODUCTVERSION_STR_W #define VER_BRANCHVERSION_STR_W L"UNKNOWN BRANCH" diff --git a/start-dedicated-server.sh b/start-dedicated-server.sh index 190490bd..3e0db457 100644 --- a/start-dedicated-server.sh +++ b/start-dedicated-server.sh @@ -3,7 +3,7 @@ set -euo pipefail SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" COMPOSE_FILE="${SCRIPT_DIR}/docker-compose.dedicated-server.ghcr.yml" -SERVICE_NAME="minecraft-tu30dev-dedicated-server" +SERVICE_NAME="minecraft-tu24dev-dedicated-server" PERSIST_DIR="${SCRIPT_DIR}/server-data" if [[ ! -f "${COMPOSE_FILE}" ]]; then