diff --git a/Minecraft.Client/AchievementScreen.cpp b/Minecraft.Client/AchievementScreen.cpp index 26f20326..bcd36243 100644 --- a/Minecraft.Client/AchievementScreen.cpp +++ b/Minecraft.Client/AchievementScreen.cpp @@ -157,8 +157,6 @@ void AchievementScreen::renderLabels() void AchievementScreen::renderBg(int xm, int ym, float a) { - // 4J Unused -#if 0 int xScroll = Mth::floor(xScrollO + (xScrollP - xScrollO) * a); int yScroll = Mth::floor(yScrollO + (yScrollP - yScrollO) * a); @@ -168,8 +166,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a) if (yScroll >= yMax) yScroll = yMax - 1; - int terrainTex = minecraft->textures->loadTexture(L"/terrain.png"); - int tex = minecraft->textures->loadTexture(L"/achievement/bg.png"); + // Textures bound inline at usage sites via bindTexture() int xo = (width - imageWidth) / 2; int yo = (height - imageHeight) / 2; @@ -189,7 +186,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a) glEnable(GL_RESCALE_NORMAL); glEnable(GL_COLOR_MATERIAL); - minecraft->textures->bind(terrainTex); + minecraft->textures->bindTexture(L"/terrain.png"); int leftTile = (xScroll + EDGE_VALUE_X) >> 4; int topTile = (yScroll + EDGE_VALUE_Y) >> 4; @@ -202,6 +199,16 @@ void AchievementScreen::renderBg(int xm, int ym, float a) const int diamondLevel = (Achievements::ACHIEVEMENT_HEIGHT_POSITION * 19) / 10; const int bedrockLevel = (Achievements::ACHIEVEMENT_HEIGHT_POSITION * 31) / 10; + // Standard terrain.png tile indices (16-wide atlas, row*16+col) + const int TEX_SAND = 18; // row 1, col 2 + const int TEX_BEDROCK = 17; // row 1, col 1 + const int TEX_DIAMOND_ORE = 50; // row 3, col 2 + const int TEX_REDSTONE_ORE = 51; // row 3, col 3 + const int TEX_IRON_ORE = 33; // row 2, col 1 + const int TEX_COAL_ORE = 34; // row 2, col 2 + const int TEX_STONE = 1; // row 0, col 1 + const int TEX_DIRT = 2; // row 0, col 2 + Random *random = new Random(); for (int tileY = 0; (tileY * 16) - yMod < BIGMAP_HEIGHT; tileY++) @@ -216,38 +223,38 @@ void AchievementScreen::renderBg(int xm, int ym, float a) random->setSeed(1234 + leftTile + tileX); random->nextInt(); int heightValue = random->nextInt(1 + topTile + tileY) + (topTile + tileY) / 2; - int tileType = Tile::sand->tex; + int tileType = TEX_SAND; if (heightValue > bedrockLevel || (topTile + tileY) == MAX_BG_TILE_Y) { - tileType = Tile::unbreakable->tex; + tileType = TEX_BEDROCK; } else if (heightValue == diamondLevel) { if (random->nextInt(2) == 0) { - tileType = Tile::diamondOre->tex; + tileType = TEX_DIAMOND_ORE; } else { - tileType = Tile::redStoneOre->tex; + tileType = TEX_REDSTONE_ORE; } } else if (heightValue == ironLevel) { - tileType = Tile::ironOre->tex; + tileType = TEX_IRON_ORE; } else if (heightValue == coalLevel) { - tileType = Tile::coalOre->tex; + tileType = TEX_COAL_ORE; } else if (heightValue > rockLevel) { - tileType = Tile::rock->tex; + tileType = TEX_STONE; } else if (heightValue > 0) { - tileType = Tile::dirt->tex; + tileType = TEX_DIRT; } this->blit(xBigMap + tileX * 16 - xMod, yBigMap + tileY * 16 - yMod, (tileType % 16) << 4, (tileType >> 4) << 4, 16, 16); @@ -326,7 +333,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a) glColor4f(br, br, br, 1); } - minecraft->textures->bind(tex); + minecraft->textures->bindTexture(L"/achievement/bg.png"); int xx = xBigMap + x; int yy = yBigMap + y; if (ach->isGolden()) @@ -364,7 +371,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a) glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glColor4f(1, 1, 1, 1); - minecraft->textures->bind(tex); + minecraft->textures->bindTexture(L"/achievement/bg.png"); blit(xo, yo, 0, 0, imageWidth, imageHeight); @@ -396,7 +403,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a) } fillGradient(x - 3, y - 3, x + width + 3, y + height + 3 + 12, 0xc0000000, 0xc0000000); - font->drawWordWrap(descr, x, y + 12, width, 0xffa0a0a0); + font->drawWordWrap(descr, x, y + 12, width, 0xffa0a0a0, font->wordWrapHeight(descr, width)); if (statsCounter->hasTaken(ach)) { font->drawShadow(I18n::get(L"achievement.taken"), x, y + height + 4, 0xff9090ff); @@ -408,7 +415,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a) wstring msg = I18n::get(L"achievement.requires", ach->requires->name); int height = font->wordWrapHeight(msg, width); fillGradient(x - 3, y - 3, x + width + 3, y + height + 12 + 3, 0xc0000000, 0xc0000000); - font->drawWordWrap(msg, x, y + 12, width, 0xff705050); + font->drawWordWrap(msg, x, y + 12, width, 0xff705050, font->wordWrapHeight(msg, width)); } font->drawShadow(name, x, y, statsCounter->canTake(ach) ? ach->isGolden() ? 0xffffff80 : 0xffffffff : ach->isGolden() ? 0xff808040 : 0xff808080); @@ -417,7 +424,6 @@ void AchievementScreen::renderBg(int xm, int ym, float a) glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); Lighting::turnOff(); -#endif } bool AchievementScreen::isPauseScreen() diff --git a/Minecraft.Client/Common/UI/UIScene.cpp b/Minecraft.Client/Common/UI/UIScene.cpp index e7d907ec..e71fd22c 100644 --- a/Minecraft.Client/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Common/UI/UIScene.cpp @@ -992,6 +992,7 @@ bool UIScene::allowRepeat(int key) void UIScene::externalCallback(IggyExternalFunctionCallUTF16 * call) { + printf("externalCallback: [%S]\n", call->function_name.string); if(wcscmp((wchar_t *)call->function_name.string,L"handlePress")==0) { if(call->num_arguments != 2) diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp index 8896a968..525ae802 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp @@ -6,6 +6,10 @@ #include "..\..\MinecraftServer.h" #include "UI.h" #include "UIScene_MainMenu.h" +#ifdef _WINDOWS64 +#include "AchievementScreen.h" +#include "StatsCounter.h" +#endif #ifdef __ORBIS__ #include #endif @@ -279,6 +283,8 @@ void UIScene_MainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) { + printf("[DBG] handlePress controlId=%d childId=%d\n", (int)controlId, (int)childId); + int primaryPad = ProfileManager.GetPrimaryPad(); int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; @@ -942,7 +948,11 @@ int UIScene_MainMenu::Achievements_SignInReturned(void *pParam,bool bContinue,in // 4J-JEV: We only need to update rich-presence if the sign-in status changes. ProfileManager.SetCurrentGameActivity(iPad, CONTEXT_PRESENCE_MENUS, false); +#ifdef _WINDOWS64 + pClass->RunAchievements(iPad); +#else XShowAchievementsUI( ProfileManager.GetPrimaryPad() ); +#endif } else { @@ -1908,7 +1918,28 @@ void UIScene_MainMenu::tick() void UIScene_MainMenu::RunAchievements(int iPad) { -#if TO_BE_IMPLEMENTED +#ifdef _WINDOWS64 + printf("[DBG] RunAchievements called\n"); + if(ProfileManager.IsGuest(iPad)) + { + printf("[DBG] IsGuest - showing message\n"); + UINT uiIDA[1]; + uiIDA[0]=IDS_OK; + ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); + } + else + { + printf("[DBG] Getting minecraft instance\n"); + Minecraft *minecraft = Minecraft::GetInstance(); + printf("[DBG] minecraft=%p\n", minecraft); + if (minecraft) + { + printf("[DBG] Calling setScreen\n"); + minecraft->setScreen(new AchievementScreen(new StatsCounter())); + printf("[DBG] setScreen returned\n"); + } + } +#elif TO_BE_IMPLEMENTED UINT uiIDA[1]; uiIDA[0]=IDS_OK; @@ -2051,4 +2082,4 @@ int UIScene_MainMenu::SelectNetworkModeReturned(void *pParam,int iPad,C4JStorage pClass->updateTooltips(); return 0; } -#endif //__PSVITA__ +#endif //__PSVITA__ \ No newline at end of file diff --git a/Minecraft.Client/Extrax64Stubs.cpp b/Minecraft.Client/Extrax64Stubs.cpp index 94cf6b66..acf77074 100644 --- a/Minecraft.Client/Extrax64Stubs.cpp +++ b/Minecraft.Client/Extrax64Stubs.cpp @@ -20,6 +20,8 @@ #include "StatsCounter.h" #include "Windows64\Social\SocialManager.h" #include "Windows64\Sentient\DynamicConfigurations.h" +#include "AchievementScreen.h" +#include "Minecraft.h" #elif defined __PSVITA__ #include "PSVita\Sentient\SentientManager.h" #include "StatsCounter.h" @@ -76,7 +78,12 @@ DWORD XShowPartyUI(DWORD dwUserIndex) { return 0; } DWORD XShowFriendsUI(DWORD dwUserIndex) { return 0; } HRESULT XPartyGetUserList(XPARTY_USER_LIST *pUserList) { return S_OK; } DWORD XContentGetThumbnail(DWORD dwUserIndex, const XCONTENT_DATA *pContentData, PBYTE pbThumbnail, PDWORD pcbThumbnail, PXOVERLAPPED *pOverlapped) { return 0; } -void XShowAchievementsUI(int i) {} +void XShowAchievementsUI(int i) +{ + Minecraft *minecraft = Minecraft::GetInstance(); + if (minecraft && i >= 0 && i < 4 && minecraft->stats[i] != NULL) + minecraft->setScreen(new AchievementScreen(minecraft->stats[i])); +} DWORD XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE Mode) { return 0; } #ifndef _DURANGO @@ -903,7 +910,7 @@ wstring C_4JProfile::GetDisplayName(int iPad) return displayName; } #endif -bool C_4JProfile::IsFullVersion() { return s_bProfileIsFullVersion; } +bool C_4JProfile::IsFullVersion() { return true; } void C_4JProfile::SetSignInChangeCallback(void ( *Func)(LPVOID, bool, unsigned int),LPVOID lpParam) {} void C_4JProfile::SetNotificationsCallback(void ( *Func)(LPVOID, DWORD, unsigned int),LPVOID lpParam) {} bool C_4JProfile::RegionIsNorthAmerica(void) { return false; } @@ -924,6 +931,10 @@ int C_4JProfile::SetOldProfileVersionCallback(int( *Func)(LPVOID,unsigned ch // To store the dashboard preferences for controller flipped, etc. C_4JProfile::PROFILESETTINGS ProfileSettingsA[XUSER_MAX_COUNT]; +#define MAX_AWARDS 32 + +static bool s_awardsUnlocked[XUSER_MAX_COUNT][MAX_AWARDS] = {}; + C_4JProfile::PROFILESETTINGS * C_4JProfile::GetDashboardProfileSettings(int iPad) { return &ProfileSettingsA[iPad]; } void C_4JProfile::WriteToProfile(int iQuadrant, bool bGameDefinedDataChanged, bool bOverride5MinuteLimitOnProfileWrites) {} void C_4JProfile::ForceQueuedProfileWrites(int iPad) {} @@ -941,9 +952,24 @@ void C_4JProfile::RegisterAward(int iAwardNumber,int iGamerconfigID, eAwardTy CXuiStringTable*pStringTable, int iTitleStr, int iTextStr, int iAcceptStr, char *pszThemeName, unsigned int ulThemeSize) {} int C_4JProfile::GetAwardId(int iAwardNumber) { return 0; } eAwardType C_4JProfile::GetAwardType(int iAwardNumber) { return eAwardType_Achievement; } -bool C_4JProfile::CanBeAwarded(int iQuadrant, int iAwardNumber) { return false; } -void C_4JProfile::Award(int iQuadrant, int iAwardNumber, bool bForce) {} -bool C_4JProfile::IsAwardsFlagSet(int iQuadrant, int iAward) { return false; } +bool C_4JProfile::CanBeAwarded(int iQuadrant, int iAwardNumber) +{ + if (iQuadrant < 0 || iQuadrant >= XUSER_MAX_COUNT) return false; + if (iAwardNumber < 0 || iAwardNumber >= MAX_AWARDS) return false; + return !s_awardsUnlocked[iQuadrant][iAwardNumber]; +} +void C_4JProfile::Award(int iQuadrant, int iAwardNumber, bool bForce) +{ + if (iQuadrant < 0 || iQuadrant >= XUSER_MAX_COUNT) return; + if (iAwardNumber < 0 || iAwardNumber >= MAX_AWARDS) return; + s_awardsUnlocked[iQuadrant][iAwardNumber] = true; +} +bool C_4JProfile::IsAwardsFlagSet(int iQuadrant, int iAward) +{ + if (iQuadrant < 0 || iQuadrant >= XUSER_MAX_COUNT) return false; + if (iAward < 0 || iAward >= MAX_AWARDS) return false; + return s_awardsUnlocked[iQuadrant][iAward]; +} void C_4JProfile::RichPresenceInit(int iPresenceCount, int iContextCount) {} void C_4JProfile::RegisterRichPresenceContext(int iGameConfigContextID) {} void C_4JProfile::SetRichPresenceContextValue(int iPad,int iContextID, int iVal) {} @@ -1063,4 +1089,4 @@ void StatsCounter::setupStatBoards() {} #ifdef _DEBUG void StatsCounter::WipeLeaderboards() {} #endif -*/ +*/ \ No newline at end of file diff --git a/Minecraft.Client/StatsCounter.cpp b/Minecraft.Client/StatsCounter.cpp index 4568c7db..0194961d 100644 --- a/Minecraft.Client/StatsCounter.cpp +++ b/Minecraft.Client/StatsCounter.cpp @@ -34,6 +34,11 @@ StatsCounter::StatsCounter() void StatsCounter::award(Stat* stat, unsigned int difficulty, unsigned int count) { + printf("[StatsCounter] award(): %ls | isAchievement: %s | difficulty: %u | count: %u\n", + stat->name.c_str(), + stat->isAchievement() ? "YES" : "NO", + difficulty, + count); #ifndef _DURANGO if( stat->isAchievement() ) difficulty = 0; @@ -204,10 +209,12 @@ void StatsCounter::save(int player, bool force) { #ifndef _DURANGO // 4J-PB - If this is the trial game, don't save any stats +#ifndef _WINDOWS64 if(!ProfileManager.IsFullVersion()) { return; } +#endif //Check we're going to have enough room to store all possible stats unsigned int uiTotalStatsSize = (Stats::all->size() * 4 * sizeof(unsigned short)) - (Achievements::achievements->size() * 3 * sizeof(unsigned short)) + (LARGE_STATS_COUNT*4*(sizeof(unsigned int)-sizeof(unsigned short))); @@ -302,6 +309,7 @@ void StatsCounter::setLeaderboardRating(XUSER_PROPERTY* prop, LONGLONG value) void StatsCounter::flushLeaderboards() { #ifndef _DURANGO +#ifndef _WINDOWS64 if( LeaderboardManager::Instance()->OpenSession() ) { writeStats(); @@ -310,18 +318,17 @@ void StatsCounter::flushLeaderboards() else { app.DebugPrintf("Failed to open a session in order to write to leaderboard\n"); - - // 4J-JEV: If user was not signed in it would hit this. - //assert(false);// && "Failed to open a session in order to write to leaderboard"); } modifiedBoards = 0; #endif +#endif } void StatsCounter::saveLeaderboards() { #ifndef _DURANGO +#ifndef _WINDOWS64 // 4J-PB - If this is the trial game, no writing leaderboards if(!ProfileManager.IsFullVersion()) { @@ -336,13 +343,11 @@ void StatsCounter::saveLeaderboards() else { app.DebugPrintf("Failed to open a session in order to write to leaderboard\n"); - - // 4J-JEV: If user was not signed in it would hit this. - //assert(false);// && "Failed to open a session in order to write to leaderboard"); } modifiedBoards = 0; #endif +#endif } void StatsCounter::writeStats() @@ -1341,4 +1346,4 @@ void StatsCounter::WipeLeaderboards() } #endif } -#endif +#endif \ No newline at end of file diff --git a/Minecraft.Client/Windows64/GameHDD/20260302103102/saveData.ms b/Minecraft.Client/Windows64/GameHDD/20260302103102/saveData.ms new file mode 100644 index 00000000..962bbe86 Binary files /dev/null and b/Minecraft.Client/Windows64/GameHDD/20260302103102/saveData.ms differ diff --git a/Minecraft.Client/Windows64/GameHDD/20260302103251/saveData.ms b/Minecraft.Client/Windows64/GameHDD/20260302103251/saveData.ms new file mode 100644 index 00000000..bd666f47 Binary files /dev/null and b/Minecraft.Client/Windows64/GameHDD/20260302103251/saveData.ms differ diff --git a/Minecraft.Client/Windows64/GameHDD/20260302103440/saveData.ms b/Minecraft.Client/Windows64/GameHDD/20260302103440/saveData.ms new file mode 100644 index 00000000..9b1b5326 Binary files /dev/null and b/Minecraft.Client/Windows64/GameHDD/20260302103440/saveData.ms differ diff --git a/Minecraft.Client/discord_game_sdk.dll b/Minecraft.Client/discord_game_sdk.dll new file mode 100644 index 00000000..10a8928f Binary files /dev/null and b/Minecraft.Client/discord_game_sdk.dll differ diff --git a/Minecraft.Client/iggy_w64.dll b/Minecraft.Client/iggy_w64.dll new file mode 100644 index 00000000..43430508 Binary files /dev/null and b/Minecraft.Client/iggy_w64.dll differ diff --git a/Minecraft.Client/mss64.dll b/Minecraft.Client/mss64.dll new file mode 100644 index 00000000..5e19ce1c Binary files /dev/null and b/Minecraft.Client/mss64.dll differ diff --git a/Minecraft.Client/server.properties b/Minecraft.Client/server.properties new file mode 100644 index 00000000..bae44552 --- /dev/null +++ b/Minecraft.Client/server.properties @@ -0,0 +1,9 @@ +allow-nether=true +gamemode=0 +level-name=world +level-type=default +max-build-height=256 +max-players=20 +spawn-animals=true +spawn-monsters=true +spawn-npcs=true