Skip to content

Commit 3d4189a

Browse files
committed
-Added toasts, used only for achievements for now
-Added Achievements screen -Added Stats screen -Added recipes for ore blocks -Now, the original lang assets will be loaded, and they will be needed from now on -Now, the gui tiles lighting will be accurate to the original -Now, the Select World screen will be accurate to the original -Fixed player and mob kills stats not being obtainable -Fixed Change Profile screen not changing the stats counter used username -Fixed achievements map being parsed incorrectly -Fixed build sword achievement not being obtainable
1 parent ad415b3 commit 3d4189a

89 files changed

Lines changed: 2651 additions & 935 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ xcuserdata/
138138
/game/assets/gui/*
139139
!/game/assets/gui/touchscreen.png
140140
!/game/assets/lang/
141-
!/game/assets/lang/*
141+
/game/assets/lang/*
142+
!/game/assets/lang/*.json
143+
144+
/game/stats/*
142145

143146
# Ignore keep directory - where you can keep files for later use
144147
/keep

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ My thanks to the contributors of ReMinecraftPE, without them this project would
66
## TO-DO List
77
* Make screens accurate, like Options and Select World screens
88
* Texture Packs System
9-
* Stats and Achievements
10-
* Completely functional integrated servers
9+
* Completely functional integrated servers (half done, needs stability)
1110
* Optimization in general, mainly RAM Usage
1211

1312
## FAQ

compat/KeyCodes.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,26 @@ enum eSDLVirtualKeys
1919
#undef CODE
2020
};
2121

22+
static int getSDLVirtualKeyCode(int key)
23+
{
24+
switch (key) {
25+
#define CODE(x) case SDLK_ ## x: return SDLVK_ ## x;
26+
#include "compat/SDLKeyCodes.h"
27+
#undef CODE
28+
}
29+
return SDLVK_UNKNOWN;
30+
}
31+
32+
static int getSDLKeyCode(int key)
33+
{
34+
switch (key) {
35+
#define CODE(x) case SDLVK_ ## x: return SDLK_ ## x;
36+
#include "compat/SDLKeyCodes.h"
37+
#undef CODE
38+
}
39+
return SDLK_UNKNOWN;
40+
}
41+
2242
#endif
2343

2444
#ifdef _WIN32

platforms/sdl/main.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ static void teardown()
3333
}
3434
}
3535

36-
static int TranslateSDLKeyCodeToVirtual(int sdlCode)
37-
{
38-
switch (sdlCode) {
39-
#define CODE(x) case SDLK_ ## x: return SDLVK_ ## x;
40-
#include "compat/SDLKeyCodes.h"
41-
#undef CODE
42-
}
43-
return SDLVK_UNKNOWN;
44-
}
45-
4636
// Touch
4737
#define TOUCH_IDS_SIZE (MAX_TOUCHES - 1) // ID 0 Is Reserved For The Mouse
4838
struct touch_id_data {
@@ -136,7 +126,7 @@ static void handle_events()
136126
g_pApp->handleCharInput('\b');
137127
}
138128

139-
g_pAppPlatform->handleKeyEvent(TranslateSDLKeyCodeToVirtual(event.key.keysym.sym), event.key.state);
129+
g_pAppPlatform->handleKeyEvent(getSDLVirtualKeyCode(event.key.keysym.sym), event.key.state);
140130
break;
141131
}
142132
case SDL_CONTROLLERBUTTONDOWN:

platforms/windows/projects/Client/Client.vcxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,12 @@
203203
<ClInclude Include="$(MC_ROOT)\source\client\renderer\Lighting.hpp" />
204204
<ClInclude Include="$(MC_ROOT)\source\client\player\input\BuildActionIntention.hpp" />
205205
<ClInclude Include="..\..\..\..\source\client\gui\components\SliderButton.hpp" />
206+
<ClInclude Include="..\..\..\..\source\client\gui\components\toasts\Toast.hpp" />
207+
<ClInclude Include="..\..\..\..\source\client\gui\components\toasts\ToastComponent.hpp" />
208+
<ClInclude Include="..\..\..\..\source\client\gui\components\toasts\ToastInstance.hpp" />
209+
<ClInclude Include="..\..\..\..\source\client\gui\screens\AchievementsScreen.hpp" />
206210
<ClInclude Include="..\..\..\..\source\client\gui\screens\ChangeProfileScreen.hpp" />
211+
<ClInclude Include="..\..\..\..\source\client\gui\screens\EditWorldScreen.hpp" />
207212
<ClInclude Include="..\..\..\..\source\client\gui\screens\InBedChatScreen.hpp" />
208213
<ClInclude Include="..\..\..\..\source\client\gui\screens\IntroScreen.hpp" />
209214
<ClInclude Include="..\..\..\..\source\client\gui\screens\inventory\ChestScreen.hpp" />
@@ -214,6 +219,7 @@
214219
<ClInclude Include="..\..\..\..\source\client\gui\screens\inventory\InventoryScreen.hpp" />
215220
<ClInclude Include="..\..\..\..\source\client\gui\screens\inventory\TextEditScreen.hpp" />
216221
<ClInclude Include="..\..\..\..\source\client\gui\screens\inventory\TrapScreen.hpp" />
222+
<ClInclude Include="..\..\..\..\source\client\gui\screens\StatsScreen.hpp" />
217223
<ClInclude Include="..\..\..\..\source\client\gui\screens\VideoSettingsScreen.hpp" />
218224
<ClInclude Include="..\..\..\..\source\client\locale\Language.hpp" />
219225
<ClInclude Include="..\..\..\..\source\client\model\BoatModel.hpp" />
@@ -366,7 +372,12 @@
366372
<ClCompile Include="$(MC_ROOT)\source\client\player\input\MouseBuildInput.cpp" />
367373
<ClCompile Include="$(MC_ROOT)\source\client\renderer\Lighting.cpp" />
368374
<ClCompile Include="..\..\..\..\source\client\gui\components\SliderButton.cpp" />
375+
<ClCompile Include="..\..\..\..\source\client\gui\components\toasts\Toast.cpp" />
376+
<ClCompile Include="..\..\..\..\source\client\gui\components\toasts\ToastComponent.cpp" />
377+
<ClCompile Include="..\..\..\..\source\client\gui\components\toasts\ToastInstance.cpp" />
378+
<ClCompile Include="..\..\..\..\source\client\gui\screens\AchievementsScreen.cpp" />
369379
<ClCompile Include="..\..\..\..\source\client\gui\screens\ChangeProfileScreen.cpp" />
380+
<ClCompile Include="..\..\..\..\source\client\gui\screens\EditWorldScreen.cpp" />
370381
<ClCompile Include="..\..\..\..\source\client\gui\screens\InBedChatScreen.cpp" />
371382
<ClCompile Include="..\..\..\..\source\client\gui\screens\IntroScreen.cpp" />
372383
<ClCompile Include="..\..\..\..\source\client\gui\screens\inventory\ChestScreen.cpp" />
@@ -377,6 +388,7 @@
377388
<ClCompile Include="..\..\..\..\source\client\gui\screens\inventory\InventoryScreen.cpp" />
378389
<ClCompile Include="..\..\..\..\source\client\gui\screens\inventory\TextEditScreen.cpp" />
379390
<ClCompile Include="..\..\..\..\source\client\gui\screens\inventory\TrapScreen.cpp" />
391+
<ClCompile Include="..\..\..\..\source\client\gui\screens\StatsScreen.cpp" />
380392
<ClCompile Include="..\..\..\..\source\client\gui\screens\VideoSettingsScreen.cpp" />
381393
<ClCompile Include="..\..\..\..\source\client\locale\Language.cpp" />
382394
<ClCompile Include="..\..\..\..\source\client\model\BoatModel.cpp" />

platforms/windows/projects/Client/Client.vcxproj.filters

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@
9393
<Filter Include="Header Files\GUI\Screens\Inventory">
9494
<UniqueIdentifier>{7399c75d-551e-48c7-87d5-d500191cdc2c}</UniqueIdentifier>
9595
</Filter>
96+
<Filter Include="Header Files\GUI\Components\Toasts">
97+
<UniqueIdentifier>{bace6224-83fc-4d77-8a82-60b9565f0d05}</UniqueIdentifier>
98+
</Filter>
99+
<Filter Include="Source Files\GUI\Components\Toasts">
100+
<UniqueIdentifier>{b499d710-5f1f-4851-962d-68ab0fbd59f6}</UniqueIdentifier>
101+
</Filter>
96102
</ItemGroup>
97103
<ItemGroup>
98104
<ClInclude Include="$(MC_ROOT)\source\client\gui\components\AvailableGamesList.hpp">
@@ -584,6 +590,24 @@
584590
<ClInclude Include="..\..\..\..\source\client\gui\screens\ChangeProfileScreen.hpp">
585591
<Filter>Header Files\GUI\Screens</Filter>
586592
</ClInclude>
593+
<ClInclude Include="..\..\..\..\source\client\gui\components\toasts\ToastComponent.hpp">
594+
<Filter>Header Files\GUI\Components\Toasts</Filter>
595+
</ClInclude>
596+
<ClInclude Include="..\..\..\..\source\client\gui\components\toasts\Toast.hpp">
597+
<Filter>Header Files\GUI\Components\Toasts</Filter>
598+
</ClInclude>
599+
<ClInclude Include="..\..\..\..\source\client\gui\components\toasts\ToastInstance.hpp">
600+
<Filter>Header Files\GUI\Components\Toasts</Filter>
601+
</ClInclude>
602+
<ClInclude Include="..\..\..\..\source\client\gui\screens\AchievementsScreen.hpp">
603+
<Filter>Header Files\GUI\Screens</Filter>
604+
</ClInclude>
605+
<ClInclude Include="..\..\..\..\source\client\gui\screens\StatsScreen.hpp">
606+
<Filter>Header Files\GUI\Screens</Filter>
607+
</ClInclude>
608+
<ClInclude Include="..\..\..\..\source\client\gui\screens\EditWorldScreen.hpp">
609+
<Filter>Header Files\GUI\Screens</Filter>
610+
</ClInclude>
587611
</ItemGroup>
588612
<ItemGroup>
589613
<ClCompile Include="$(MC_ROOT)\source\client\gui\components\AvailableGamesList.cpp">
@@ -1075,5 +1099,23 @@
10751099
<ClCompile Include="..\..\..\..\source\client\gui\screens\ChangeProfileScreen.cpp">
10761100
<Filter>Source Files\GUI\Screens</Filter>
10771101
</ClCompile>
1102+
<ClCompile Include="..\..\..\..\source\client\gui\components\toasts\ToastComponent.cpp">
1103+
<Filter>Source Files\GUI\Components\Toasts</Filter>
1104+
</ClCompile>
1105+
<ClCompile Include="..\..\..\..\source\client\gui\components\toasts\Toast.cpp">
1106+
<Filter>Source Files\GUI\Components\Toasts</Filter>
1107+
</ClCompile>
1108+
<ClCompile Include="..\..\..\..\source\client\gui\components\toasts\ToastInstance.cpp">
1109+
<Filter>Source Files\GUI\Components\Toasts</Filter>
1110+
</ClCompile>
1111+
<ClCompile Include="..\..\..\..\source\client\gui\screens\AchievementsScreen.cpp">
1112+
<Filter>Source Files\GUI\Screens</Filter>
1113+
</ClCompile>
1114+
<ClCompile Include="..\..\..\..\source\client\gui\screens\StatsScreen.cpp">
1115+
<Filter>Source Files\GUI\Screens</Filter>
1116+
</ClCompile>
1117+
<ClCompile Include="..\..\..\..\source\client\gui\screens\EditWorldScreen.cpp">
1118+
<Filter>Source Files\GUI\Screens</Filter>
1119+
</ClCompile>
10781120
</ItemGroup>
10791121
</Project>

platforms/windows/projects/Common/Common.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
<ClCompile Include="$(MC_ROOT)\source\common\ShortTag.cpp" />
9797
<ClCompile Include="$(MC_ROOT)\source\common\StringTag.cpp" />
9898
<ClCompile Include="$(MC_ROOT)\source\common\Tag.cpp" />
99+
<ClCompile Include="..\..\..\..\source\common\math\Color.cpp" />
99100
<ClCompile Include="..\..\..\..\source\common\md5.cpp" />
100101
<ClCompile Include="..\..\..\..\source\common\NbtIo.cpp" />
101102
<ClCompile Include="..\..\..\..\source\common\ProgressListener.cpp" />
@@ -125,6 +126,7 @@
125126
<ClInclude Include="$(MC_ROOT)\source\common\ShortTag.hpp" />
126127
<ClInclude Include="$(MC_ROOT)\source\common\StringTag.hpp" />
127128
<ClInclude Include="$(MC_ROOT)\source\common\Tag.hpp" />
129+
<ClInclude Include="..\..\..\..\source\common\math\Color.hpp" />
128130
<ClInclude Include="..\..\..\..\source\common\md5.hpp" />
129131
<ClInclude Include="..\..\..\..\source\common\NbtIo.hpp" />
130132
<ClInclude Include="..\..\..\..\source\common\ProgressListener.hpp" />

platforms/windows/projects/Common/Common.vcxproj.filters

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
<Filter Include="Source Files\Tag">
1616
<UniqueIdentifier>{26afbdb0-42d5-4e26-a51f-fc6d4994b9e8}</UniqueIdentifier>
1717
</Filter>
18+
<Filter Include="Header Files\Math">
19+
<UniqueIdentifier>{1a2207e2-a88a-40a8-931c-e823785e7e1d}</UniqueIdentifier>
20+
</Filter>
21+
<Filter Include="Source Files\Math">
22+
<UniqueIdentifier>{5541234e-499f-4033-8fa2-e470506459b5}</UniqueIdentifier>
23+
</Filter>
1824
</ItemGroup>
1925
<ItemGroup>
2026
<ClCompile Include="$(MC_ROOT)\source\common\CThread.cpp">
@@ -98,6 +104,9 @@
98104
<ClCompile Include="..\..\..\..\source\common\md5.cpp">
99105
<Filter>Source Files</Filter>
100106
</ClCompile>
107+
<ClCompile Include="..\..\..\..\source\common\math\Color.cpp">
108+
<Filter>Source Files\Math</Filter>
109+
</ClCompile>
101110
</ItemGroup>
102111
<ItemGroup>
103112
<ClInclude Include="$(MC_ROOT)\source\common\CThread.hpp">
@@ -181,5 +190,8 @@
181190
<ClInclude Include="..\..\..\..\source\common\md5.hpp">
182191
<Filter>Header Files</Filter>
183192
</ClInclude>
193+
<ClInclude Include="..\..\..\..\source\common\math\Color.hpp">
194+
<Filter>Header Files\Math</Filter>
195+
</ClInclude>
184196
</ItemGroup>
185197
</Project>

source/client/app/Minecraft.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ const char* Minecraft::progressMessages[] =
6262
};
6363

6464
Minecraft::Minecraft() :
65-
m_gui(this)
65+
m_gui(this),
66+
m_toastComponent(this)
6667
{
6768
m_options = nullptr;
6869
m_bLocateMultiplayer = false;
@@ -177,7 +178,8 @@ void Minecraft::setScreen(Screen* pScreen)
177178
if (m_pScreen)
178179
{
179180
m_pScreen->removed();
180-
delete m_pScreen;
181+
if (pScreen && pScreen->m_bDeletePrevious)
182+
delete m_pScreen;
181183
}
182184

183185
Mouse::reset();
@@ -468,7 +470,7 @@ void Minecraft::tickInput()
468470
}
469471
else if (getOptions()->isKey(KM_TOGGLEGUI, keyCode))
470472
{
471-
getOptions()->m_bDontRenderGui = !getOptions()->m_bDontRenderGui;
473+
getOptions()->m_bHideGui = !getOptions()->m_bHideGui;
472474
}
473475
else if (getOptions()->isKey(KM_TOGGLEDEBUG, keyCode))
474476
{
@@ -848,6 +850,11 @@ void Minecraft::initAssets()
848850
FoliageColor::init(m_pPlatform->loadTexture("misc/foliagecolor.png", true));
849851
Language::getInstance()->init(getOptions());
850852
AchievementMap::getInstance()->init();
853+
initStatsCounter();
854+
}
855+
856+
void Minecraft::initStatsCounter()
857+
{
851858
SAFE_DELETE(m_pStatsCounter);
852859
m_pStatsCounter = new StatsCounter(m_pUser, m_externalStorageDir);
853860
}

source/client/app/Minecraft.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "world/particle/ParticleEngine.hpp"
3232
#include <stdint.h>
3333
#include "stats/StatsCounter.hpp"
34+
#include "client/gui/components/toasts/ToastComponent.hpp"
3435

3536
class Screen; // in case we're included from Screen.hpp
3637

@@ -114,6 +115,7 @@ class Minecraft : public App
114115
virtual void update() override;
115116
virtual void init() override;
116117
virtual void initAssets();
118+
virtual void initStatsCounter();
117119
virtual void onGraphicsReset();
118120
virtual void sizeUpdate(int newWidth, int newHeight) override;
119121
virtual void resizeDisplay(int guiScale, int newWidth = Minecraft::width, int newHeight = Minecraft::height);
@@ -173,6 +175,7 @@ class Minecraft : public App
173175
std::shared_ptr<LocalPlayer> m_pPlayer;
174176
std::shared_ptr<Mob> m_pCameraEntity;
175177
Gui m_gui;
178+
ToastComponent m_toastComponent;
176179
int field_D0C;
177180
std::vector<std::function<void()>> m_delayed;
178181
std::vector<AsyncTask> m_async;

0 commit comments

Comments
 (0)