Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@ set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_EXTENSIONS OFF)

# Warnings
add_compile_options(-Wall)
add_compile_options(-Wall -Wignored-qualifiers -Wvariadic-macros)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wc++11-extensions>)
if(WERROR)
add_compile_options(-Werror)
endif()
if(APPLE)
add_compile_options(-Wno-deprecated-declarations)
endif()

# Detect Windows
include(CheckSymbolExists)
check_symbol_exists("_WIN32" "" REMCPE_WIN32)

# Clang
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-inconsistent-missing-override)
endif()
if(APPLE)
add_compile_options(-Wno-deprecated-declarations)
endif()

# Windows Linking
if(REMCPE_WIN32)
# Modern MinGW doesn't support C++98 and will error if you try to use it
set(CMAKE_CXX_STANDARD 11)
Expand Down
2 changes: 2 additions & 0 deletions compat/KeyCodes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
enum eSDLVirtualKeys
{
#define CODE(x) SDLVK_ ## x,
#define _CODE(x) SDLVK_ ## x
#include "SDLKeyCodes.h"
#undef CODE
#undef _CODE
};
#endif

Expand Down
3 changes: 3 additions & 0 deletions compat/LegacyCPP_Compat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#ifdef USE_OLD_CPP

#define CONSTEXPR
#ifndef constexpr
#define constexpr const
#endif
Expand Down Expand Up @@ -37,6 +38,8 @@ namespace std

#endif // !defined(_WIN32)*/

#else
#define CONSTEXPR constexpr
#endif // USE_OLD_CPP

// https://gcc.gnu.org/legacy-ml/gcc-help/2006-04/msg00062.html
Expand Down
4 changes: 2 additions & 2 deletions compat/SDLKeyCodes.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CODE(UNKNOWN)
CODE(RETURN)
CODE(ESCAPE)
CODE(BACKSPACE)
Expand Down Expand Up @@ -247,4 +246,5 @@ CODE(AUDIOREWIND)
#endif
#ifdef SDLK_AUDIOFASTFORWARD
CODE(AUDIOFASTFORWARD)
#endif
#endif
_CODE(UNKNOWN)
2 changes: 1 addition & 1 deletion platforms/android/AppPlatform_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ std::string AppPlatform_android::getDateString(int time)
return std::string(buffer);
}

SoundSystem* const AppPlatform_android::getSoundSystem() const
SoundSystem* AppPlatform_android::getSoundSystem() const
{
return m_pSoundSystem;
}
Expand Down
2 changes: 1 addition & 1 deletion platforms/android/AppPlatform_android.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class AppPlatform_android : public AppPlatform

bool hasFileSystemAccess() override;

SoundSystem* const getSoundSystem() const override;
SoundSystem* getSoundSystem() const override;
void initSoundSystem() override;
bool isTouchscreen() const override;

Expand Down
4 changes: 2 additions & 2 deletions platforms/android/android_native_app_glue.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ enum {
/**
* Start of user-defined ALooper identifiers.
*/
LOOPER_ID_USER = 3,
LOOPER_ID_USER = 3
};

enum {
Expand Down Expand Up @@ -308,7 +308,7 @@ enum {
* Command from main thread: the app's activity is being destroyed,
* and waiting for the app thread to clean up and exit before proceeding.
*/
APP_CMD_DESTROY,
APP_CMD_DESTROY
};

/**
Expand Down
2 changes: 1 addition & 1 deletion platforms/ios/AppPlatform_iOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AppPlatform_iOS : public AppPlatform
bool isTouchscreen() const override;
std::string getAssetPath(const std::string& path) const override;
std::string getPatchData() override;
SoundSystem* const getSoundSystem() const override { return m_pSoundSystem; }
SoundSystem* getSoundSystem() const override { return m_pSoundSystem; }

// Also add these to allow proper text input within the game.
bool shiftPressed() override;
Expand Down
2 changes: 2 additions & 0 deletions platforms/sdl/base/AppPlatform_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,10 @@ int AppPlatform_sdl::_TranslateSDLKeyCodeToVirtual(int sdlCode)
{
switch (sdlCode) {
#define CODE(x) case SDLK_ ## x: return SDLVK_ ## x;
#define _CODE(x) CODE(x)
#include "compat/SDLKeyCodes.h"
#undef CODE
#undef _CODE
}
return SDLVK_UNKNOWN;
}
Expand Down
2 changes: 1 addition & 1 deletion platforms/sdl/base/AppPlatform_sdl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AppPlatform_sdl : public AppPlatform
int getUserInputStatus() override;
void saveScreenshot(const std::string& fileName, int width, int height) override;
bool doesTextureExist(const std::string& path) const override;
SoundSystem* const getSoundSystem() const override { return m_pSoundSystem; }
SoundSystem* getSoundSystem() const override { return m_pSoundSystem; }

// Also add these to allow proper turning within the game.
void setMouseGrabbed(bool b) override;
Expand Down
2 changes: 1 addition & 1 deletion platforms/sound/opensl/SoundSystemSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void SoundSystemSL::removeStoppedSounds()
toRemove.clear();
pthread_mutex_unlock(&toRemoveMutex);

for (int i = 0; i < m_tempToRemove.size(); i++)
for (size_t i = 0; i < m_tempToRemove.size(); i++)
{

for (SLSoundList::iterator it = m_playingSounds.begin();
Expand Down
4 changes: 2 additions & 2 deletions platforms/windows/AppPlatform_win32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class AppPlatform_win32 : public AppPlatform
AssetFile readAssetFile(const std::string&, bool) const override;

void setScreenSize(int width, int height);
const char* const getWindowTitle() const { return m_WindowTitle; }
SoundSystem* const getSoundSystem() const override { return m_pSoundSystem; }
const char* getWindowTitle() const { return m_WindowTitle; }
SoundSystem* getSoundSystem() const override { return m_pSoundSystem; }

HWND createWindow(HINSTANCE hInstance, WNDPROC wndProc, LPVOID lpParam, WORD iconId);
void initializeWindow(HWND hWnd, int nCmdShow);
Expand Down
4 changes: 2 additions & 2 deletions source/client/app/AppPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

AppPlatform* AppPlatform::m_singleton = nullptr;

AppPlatform* const AppPlatform::singleton()
AppPlatform* AppPlatform::singleton()
{
return m_singleton;
}
Expand Down Expand Up @@ -377,7 +377,7 @@ void AppPlatform::initSoundSystem()
{
}

SoundSystem* const AppPlatform::getSoundSystem() const
SoundSystem* AppPlatform::getSoundSystem() const
{
return nullptr;
}
6 changes: 3 additions & 3 deletions source/client/app/AppPlatform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ class AppPlatform
DLG_CREATE_WORLD,
DLG_CHAT,
DLG_OPTIONS,
DLG_RENAME_MP_WORLD,
DLG_RENAME_MP_WORLD
};

private:
static AppPlatform* m_singleton;
public:
static AppPlatform* const singleton();
static AppPlatform* singleton();

public:
AppPlatform();
Expand Down Expand Up @@ -120,7 +120,7 @@ class AppPlatform
// Also add this to allow dynamic patching.
virtual std::string getPatchData();
virtual void initSoundSystem();
virtual SoundSystem* const getSoundSystem() const;
virtual SoundSystem* getSoundSystem() const;
// Used For Sounds
virtual std::string getAssetPath(const std::string& path) const;
virtual AssetFile readAssetFile(const std::string& path, bool quiet) const;
Expand Down
2 changes: 1 addition & 1 deletion source/client/gui/components/OptionList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void OptionList::initMultiplayerMenu()

OPTION(Boolean, m_bServerVisibleDefault, "Local Server Multiplayer");

#ifdef __EMSCRIPTEN
#ifndef FEATURE_NETWORKING
m_items[currentIndex]->setDisabled(true);
#endif
(void)currentIndex; // compiler will warn about an unused variable sometimes if this isn't here
Expand Down
2 changes: 1 addition & 1 deletion source/client/gui/components/OptionList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DistanceOptionItem : public OptionItem
RD_FAR,
RD_NORMAL,
RD_SHORT,
RD_COUNT,
RD_COUNT
};

public:
Expand Down
4 changes: 1 addition & 3 deletions source/client/network/ClientSideNetworkHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@

#if defined(ORIGINAL_CODE) || defined(VERBOSE_CLIENT)
#define puts_ignorable(str) LOG_I(str)
#define printf_ignorable(str, ...) LOG_I(str, __VA_ARGS__)
#else
#define puts_ignorable(str)
#define printf_ignorable(str, ...)
#endif

ClientSideNetworkHandler::ClientSideNetworkHandler(Minecraft* pMinecraft, RakNetInstance* pRakNetInstance)
Expand Down Expand Up @@ -60,7 +58,7 @@ void ClientSideNetworkHandler::onConnect(const RakNet::RakNetGUID& rakGuid) // s
{
#ifdef VERBOSE_CLIENT
RakNet::RakNetGUID localGuid = ((RakNet::RakPeer*)m_pServerPeer)->GetMyGUID();
printf_ignorable("onConnect, server guid: %s, local guid: %s", rakGuid.ToString(), localGuid.ToString());
LOG_I("onConnect, server guid: %s, local guid: %s", rakGuid.ToString(), localGuid.ToString());
#endif

m_serverGUID = rakGuid;
Expand Down
2 changes: 1 addition & 1 deletion source/client/options/Options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ enum eKeyMappingIndex
KM_FLY_UP,
KM_FLY_DOWN,
KM_CHAT_CMD, // called "Open Chat" in Release 1.8
KM_COUNT,
KM_COUNT
};

struct KeyMapping
Expand Down
2 changes: 1 addition & 1 deletion source/client/player/input/IMoveInput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum
INPUT_JUMP,
INPUT_SNEAK,
INPUT_FORWARDLEFT,
INPUT_FORWARDRIGHT,
INPUT_FORWARDRIGHT
};

class IMoveInput
Expand Down
2 changes: 1 addition & 1 deletion source/client/player/input/MouseDevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum MouseButtonType
BUTTON_MIDDLE,
BUTTON_COUNT,
BUTTON_SCROLLWHEEL,
BUTTON_MIN = BUTTON_LEFT,
BUTTON_MIN = BUTTON_LEFT
};

struct MouseAction
Expand Down
4 changes: 2 additions & 2 deletions source/client/renderer/PatchManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ enum ePatchType
TYPE_TERRAIN,
TYPE_ITEMS,
TYPE_FRAME,
TYPE_FEATURE,
TYPE_FEATURE
};

enum ePatchOption
{
PO_NONE,
PO_GRASS_TINT,
PO_GRASS_TINT
};

struct PatchData
Expand Down
2 changes: 1 addition & 1 deletion source/client/renderer/TileRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2791,7 +2791,7 @@ bool TileRenderer::tesselateBlockInWorldWithAmbienceOcclusionV2(Tile* tile, cons
ETILE_FACE_DNE,// -Y+X-Z
ETILE_FACE_DSW,// -Y-X+Z
ETILE_FACE_DSE,// -Y+X+Z
ETILE_FACE_COUNT,
ETILE_FACE_COUNT
};

// for Facing::Name directions
Expand Down
2 changes: 1 addition & 1 deletion source/client/renderer/texture/ColorSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
enum ColorSpace
{
COLOR_SPACE_RGBA,
COLOR_SPACE_RGB,
COLOR_SPACE_RGB
};
12 changes: 9 additions & 3 deletions source/client/sound/SoundData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,20 +107,26 @@ void SoundDesc::_unload()
// Load All Sounds
void SoundDesc::_loadAll(const AppPlatform* platform)
{
#define SOUND(category, name, number) SA_##name##number._load(platform, #category, #name#number);
#define SOUND(category, name) SA_##name._load(platform, #category, #name);
#define SOUND_NUM(category, name, number) SA_##name##number._load(platform, #category, #name#number);
#include "sound_list.h"
#undef SOUND
#undef SOUND_NUM
}

// Un-load All Sounds
void SoundDesc::_unloadAll()
{
#define SOUND(category, name, number) SA_##name##number._unload();
#define SOUND(category, name) SA_##name._unload();
#define SOUND_NUM(category, name, number) SA_##name##number._unload();
#include "sound_list.h"
#undef SOUND
#undef SOUND_NUM
}

// Declare Variables
#define SOUND(category, name, number) SoundDesc SA_##name##number;
#define SOUND(category, name) SoundDesc SA_##name;
#define SOUND_NUM(category, name, number) SoundDesc SA_##name##number;
#include "sound_list.h"
#undef SOUND
#undef SOUND_NUM
4 changes: 3 additions & 1 deletion source/client/sound/SoundData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ struct SoundDesc : AudioDescriptor
static void _unloadAll();
};

#define SOUND(category, name, number) extern SoundDesc SA_##name##number;
#define SOUND(category, name) extern SoundDesc SA_##name;
#define SOUND_NUM(category, name, number) extern SoundDesc SA_##name##number;
#include "sound_list.h"
#undef SOUND
#undef SOUND_NUM
4 changes: 3 additions & 1 deletion source/client/sound/SoundEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ void SoundEngine::init(Options* options, AppPlatform* platform)
// Load Sounds
SoundDesc::_loadAll(platform);

#define SOUND(category, name, number) m_sounds.add(#category "." #name, SA_##name##number);
#define SOUND(category, name) m_sounds.add(#category "." #name, SA_##name);
#define SOUND_NUM(category, name, number) m_sounds.add(#category "." #name, SA_##name##number);
#include "sound_list.h"
#undef SOUND
#undef SOUND_NUM

#define MUSIC(name, number) m_songs.add(#name, platform->getAssetPath("music/" #name #number ".ogg"));
#define NEWMUSIC(name, number) m_songs.add(#name, platform->getAssetPath("newmusic/" #name #number ".ogg"));
Expand Down
Loading