Skip to content

Commit

Permalink
clangformat
Browse files Browse the repository at this point in the history
  • Loading branch information
vittorioromeo committed Feb 4, 2024
1 parent 4b4cca0 commit 57bbea9
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 57 deletions.
18 changes: 9 additions & 9 deletions include/SSVOpenHexagon/Components/CPlayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ class CCustomWall;
class CPlayer
{
private:
sf::Vector2f _startPos; // Position at start of the level.
sf::Vector2f _startPos; // Position at start of the level.

sf::Vector2f _pos; // Actual position of player.
sf::Vector2f _pos; // Actual position of player.

sf::Vector2f _prePushPos; // Position before the player is pushed by a wall.
// Unlike `pos` it is not updated after a
// successful wall push.

sf::Vector2f _lastPos; // Position of the player in the previous frame,
sf::Vector2f _lastPos; // Position of the player in the previous frame,
// adjusted according to the current frame's radius.

float _hue;
Expand All @@ -42,20 +42,20 @@ class CPlayer
bool _dead;
bool _justSwapped;

bool _forcedMove; // Wherever player has been forcefully moved
// with a setPlayerAngle() call. Essential
// for proper behavior of collision calculation,
// especially on levels that make heavy usage of it.
bool _forcedMove; // Wherever player has been forcefully moved
// with a setPlayerAngle() call. Essential
// for proper behavior of collision calculation,
// especially on levels that make heavy usage of it.

float _radius; // Cached value of the radius in the current frame.
float _radius; // Cached value of the radius in the current frame.

float _maxSafeDistance; // The maximum distance that there can be between
// the current player position and the closest
// position safe from collision with a wall player
// overlaps with. If the closest position is further
// away player cannot be saved.

float _currentSpeed; // Cached player speed in the current frame.
float _currentSpeed; // Cached player speed in the current frame.

float _triangleWidth; // Visual width of the triangle, varies when focusing.
float _triangleWidthTransitionTime; // From 0 to 1, when transitioning
Expand Down
7 changes: 4 additions & 3 deletions include/SSVOpenHexagon/Core/BindControl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class KeyboardBindControl final : public BindControlBase
using Trigger = ssvs::Input::Trigger;
using TriggerGetter = std::function<ssvs::Input::Trigger()>;
using SizeGetter = std::function<int()>;
using AddBind = std::function<void(const sf::Keyboard::Key, const sf::Mouse::Button)>;
using AddBind =
std::function<void(const sf::Keyboard::Key, const sf::Mouse::Button)>;
using Callback =
std::function<void(const ssvs::Input::Trigger&, const int)>;

Expand Down Expand Up @@ -64,8 +65,8 @@ class KeyboardBindControl final : public BindControlBase
triggerGetter{mFuncGet},
sizeGetter{
[this] { return getRealSize(triggerGetter().getCombos()); }},
addBind{
[this, mFuncSet](const sf::Keyboard::Key setKey, const sf::Mouse::Button setBtn)
addBind{[this, mFuncSet](const sf::Keyboard::Key setKey,
const sf::Mouse::Button setBtn)
{ mFuncSet(setKey, setBtn, sizeGetter()); }},
clearBind{[this, mFuncClear] { mFuncClear(sizeGetter() - 1); }},
callback{mCallback},
Expand Down
4 changes: 2 additions & 2 deletions include/SSVOpenHexagon/Global/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ using TriggerGetter = ssvs::Input::Trigger& (*)();
extern const std::array<TriggerGetter, toSizeT(Tid::TriggersCount)>
triggerGetters;

void rebindTrigger(
ssvs::Input::Trigger& trig, const sf::Keyboard::Key key, const sf::Mouse::Button btn, int index);
void rebindTrigger(ssvs::Input::Trigger& trig, const sf::Keyboard::Key key,
const sf::Mouse::Button btn, int index);

void clearTriggerBind(ssvs::Input::Trigger& trig, const int index);

Expand Down
2 changes: 1 addition & 1 deletion include/SSVOpenHexagon/Utils/LuaMetadataProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class LuaMetadataProxy

[&]<std::size_t... Is>(std::index_sequence<Is...>)
{
(( //
(( //
res += typeToStr(TypeWrapper<
std::decay_t<typename AE::template NthArg<Is>>>{}), //
res += ' ', //
Expand Down
2 changes: 1 addition & 1 deletion include/SSVOpenHexagon/Utils/TinyVariant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <initializer_list> // TODO: remove dependency?
#include <new> // TODO: remove dependency?

#if ((__GNUC__ >= 10) || defined(__clang__)) && !defined(_MSC_VER)
#if((__GNUC__ >= 10) || defined(__clang__)) && !defined(_MSC_VER)
#define TINYVARIANT_SUPPORTS_HAS_BUILTIN
#endif

Expand Down
3 changes: 2 additions & 1 deletion src/SSVOpenHexagon/Core/BindControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ bool KeyboardBindControl::newKeyboardBind(const sf::Mouse::Button btn)
return true;
}

void KeyboardBindControl::applyBind(const sf::Keyboard::Key key, const sf::Mouse::Button btn)
void KeyboardBindControl::applyBind(
const sf::Keyboard::Key key, const sf::Mouse::Button btn)
{
// assign the pressed key to the config value
addBind(key, btn);
Expand Down
3 changes: 2 additions & 1 deletion src/SSVOpenHexagon/Core/HGUpdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,8 @@ void HexagonGame::postUpdate_ImguiLuaConsole()
ilcShowConsole = !ilcShowConsole;
ilcShowConsoleNext = false;

ImGui::SFML::ProcessEvent(window->getRenderWindow(), sf::Event{sf::Event::GainedFocus});
ImGui::SFML::ProcessEvent(
window->getRenderWindow(), sf::Event{sf::Event::GainedFocus});
}

if(!ilcShowConsole)
Expand Down
20 changes: 10 additions & 10 deletions src/SSVOpenHexagon/Core/HexagonClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ template <typename T>
{
SSVOH_CLOG_VERBOSE << "Sending registration request to server...\n";

return sendEncrypted( //
return sendEncrypted( //
CTSPRegister{
.steamId = steamId, //
.name = name, //
Expand All @@ -273,7 +273,7 @@ template <typename T>
{
SSVOH_CLOG_VERBOSE << "Sending login request to server...\n";

return sendEncrypted( //
return sendEncrypted( //
CTSPLogin{
.steamId = steamId, //
.name = name, //
Expand All @@ -293,7 +293,7 @@ template <typename T>
{
SSVOH_CLOG_VERBOSE << "Sending delete account request to server...\n";

return sendEncrypted( //
return sendEncrypted( //
CTSPDeleteAccount{
.steamId = steamId, //
.passwordHash = passwordHash //
Expand All @@ -306,7 +306,7 @@ template <typename T>
{
SSVOH_CLOG_VERBOSE << "Sending top scores request to server...\n";

return sendEncrypted( //
return sendEncrypted( //
CTSPRequestTopScores{
.loginToken = loginToken, //
.levelValidator = levelValidator //
Expand All @@ -319,7 +319,7 @@ template <typename T>
{
SSVOH_CLOG_VERBOSE << "Sending own score request to server...\n";

return sendEncrypted( //
return sendEncrypted( //
CTSPRequestOwnScore{
.loginToken = loginToken, //
.levelValidator = levelValidator //
Expand All @@ -333,7 +333,7 @@ template <typename T>
SSVOH_CLOG_VERBOSE
<< "Sending top scores and own score request to server...\n";

return sendEncrypted( //
return sendEncrypted( //
CTSPRequestTopScoresAndOwnScore{
.loginToken = loginToken, //
.levelValidator = levelValidator //
Expand All @@ -346,7 +346,7 @@ template <typename T>
{
SSVOH_CLOG_VERBOSE << "Sending started game packet to server...\n";

return sendEncrypted( //
return sendEncrypted( //
CTSPStartedGame{
.loginToken = loginToken, //
.levelValidator = levelValidator //
Expand All @@ -361,7 +361,7 @@ template <typename T>
SSVOH_CLOG_VERBOSE << "Sending compressed replay for level validator '"
<< levelValidator << "' to server...\n";

return sendEncrypted( //
return sendEncrypted( //
CTSPCompressedReplay{
.loginToken = loginToken, //
.compressedReplayFile = compressedReplayFile //
Expand All @@ -374,7 +374,7 @@ template <typename T>
{
SSVOH_CLOG_VERBOSE << "Sending status request to server...\n";

return sendEncrypted( //
return sendEncrypted( //
CTSPRequestServerStatus{
.loginToken = loginToken, //
} //
Expand All @@ -385,7 +385,7 @@ template <typename T>
{
SSVOH_CLOG_VERBOSE << "Sending ready to server...\n";

return sendEncrypted( //
return sendEncrypted( //
CTSPReady{
.loginToken = loginToken, //
} //
Expand Down
3 changes: 2 additions & 1 deletion src/SSVOpenHexagon/Core/HexagonGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ HexagonGame::HexagonGame(Steam::steam_manager* mSteamManager,

game.onDraw += [this] { draw(); };

game.onAnyEvent += [this](const sf::Event& e){ Imgui::processEvent(window->getRenderWindow(), e); };
game.onAnyEvent += [this](const sf::Event& e)
{ Imgui::processEvent(window->getRenderWindow(), e); };

if(window != nullptr)
{
Expand Down
10 changes: 5 additions & 5 deletions src/SSVOpenHexagon/Core/HexagonServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ template <typename T>
[[nodiscard]] bool HexagonServer::sendLoginSuccess(ConnectedClient& c,
const std::uint64_t loginToken, const std::string& loginName)
{
return sendEncrypted(c, //
return sendEncrypted(c, //
STCPLoginSuccess{
.loginToken = static_cast<std::uint64_t>(loginToken), //
.loginName = loginName //
Expand Down Expand Up @@ -217,7 +217,7 @@ template <typename T>
const std::string& levelValidator,
const std::vector<Database::ProcessedScore>& scores)
{
return sendEncrypted(c, //
return sendEncrypted(c, //
STCPTopScores{
.levelValidator = levelValidator, //
.scores = scores //
Expand All @@ -228,7 +228,7 @@ template <typename T>
[[nodiscard]] bool HexagonServer::sendOwnScore(ConnectedClient& c,
const std::string& levelValidator, const Database::ProcessedScore& score)
{
return sendEncrypted(c, //
return sendEncrypted(c, //
STCPOwnScore{
.levelValidator = levelValidator, //
.score = score //
Expand All @@ -241,7 +241,7 @@ template <typename T>
const std::vector<Database::ProcessedScore>& scores,
const std::optional<Database::ProcessedScore>& ownScore)
{
return sendEncrypted(c, //
return sendEncrypted(c, //
STCPTopScoresAndOwnScore{
.levelValidator = levelValidator, //
.scores = scores, //
Expand All @@ -254,7 +254,7 @@ template <typename T>
const ProtocolVersion& protocolVersion, const GameVersion& gameVersion,
const std::vector<std::string>& supportedLevelValidators)
{
return sendEncrypted(c, //
return sendEncrypted(c, //
STCPServerStatus{
.protocolVersion = protocolVersion, //
.gameVersion = gameVersion, //
Expand Down
14 changes: 8 additions & 6 deletions src/SSVOpenHexagon/Core/MenuGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,8 @@ void MenuGame::initMenus()

const auto mkAddBindFn = [](ssvs::Input::Trigger& trig)
{
return [&trig](const sf::Keyboard::Key key, const sf::Mouse::Button btn, const int index)
return [&trig](const sf::Keyboard::Key key, const sf::Mouse::Button btn,
const int index)
{ Config::rebindTrigger(trig, key, btn, index); };
};

Expand Down Expand Up @@ -1874,9 +1875,10 @@ void MenuGame::leftRightActionImpl(bool left)
return;
}

const bool modifier = (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::LShift) ||
sf::Keyboard::isKeyPressed(sf::Keyboard::Key::RShift) ||
focusHeld || wasFocusHeld);
const bool modifier =
(sf::Keyboard::isKeyPressed(sf::Keyboard::Key::LShift) ||
sf::Keyboard::isKeyPressed(sf::Keyboard::Key::RShift) ||
focusHeld || wasFocusHeld);

for(int i{0}; i < (modifier ? 2 : 1); ++i)
{
Expand Down Expand Up @@ -5752,8 +5754,8 @@ void MenuGame::draw()
{
mouseHovering = false;
mouseWasPressed = mousePressed;
mousePressed =
(ignoreInputs == 0) && sf::Mouse::isButtonPressed(sf::Mouse::Button::Left);
mousePressed = (ignoreInputs == 0) &&
sf::Mouse::isButtonPressed(sf::Mouse::Button::Left);

if(mustRefresh)
{
Expand Down
4 changes: 2 additions & 2 deletions src/SSVOpenHexagon/Core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ getFirstCompressedReplayFilenameFromArgs(const std::vector<std::string>& args)
[&assets](const std::string& assetId) -> sf::SoundBuffer*
{ return assets.getSoundBuffer(assetId); }, //
[&assets](const std::string& assetId) -> const std::string*
{ return assets.getMusicPath(assetId); } //
{ return assets.getMusicPath(assetId); } //
};

audio.setSoundVolume(hg::Config::getSoundVolume());
Expand Down Expand Up @@ -436,7 +436,7 @@ getFirstCompressedReplayFilenameFromArgs(const std::vector<std::string>& args)
mg->fnHGTriggerRefresh = [&](const ssvs::Input::Trigger& trigger,
int bindId) //
{
hg.refreshTrigger(trigger, bindId); //
hg.refreshTrigger(trigger, bindId); //
};

mg->fnHGNewGame = [&](const std::string& packId,
Expand Down
8 changes: 4 additions & 4 deletions src/SSVOpenHexagon/Data/StyleData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ StyleData::StyleData(const ssvuj::Obj& mRoot)
ssvuj::getExtr<float>(mRoot, "3D_perspective_multiplier", 1.f)},
_3dOverrideColor{ssvuj::getExtr<sf::Color>(
mRoot, "3D_override_color", sf::Color::Transparent)},
mainColorData{ssvuj::getObj(mRoot, "main")}, //
mainColorData{ssvuj::getObj(mRoot, "main")}, //
playerColor{
colorDataFromObjOrDefault(mRoot, "player_color", mainColorData)}, //
textColor{
colorDataFromObjOrDefault(mRoot, "text_color", mainColorData)}, //
colorDataFromObjOrDefault(mRoot, "text_color", mainColorData)}, //
wallColor{colorDataFromObjOrDefault(mRoot, "wall_color", mainColorData)},
capColor{parseCapColor(ssvuj::getObj(mRoot, "cap_color"))}
{
Expand Down Expand Up @@ -341,8 +341,8 @@ StyleData::getColors() const noexcept

sf::Color StyleData::getCapColorResult() const noexcept
{
return capColor.linear_match( //
[this](CapColorMode::Main) { return getMainColor(); }, //
return capColor.linear_match( //
[this](CapColorMode::Main) { return getMainColor(); }, //
[this](CapColorMode::MainDarkened)
{ return Utils::getColorDarkened(getMainColor(), 1.4f); }, //
[this](CapColorMode::ByIndex x) { return getColor(x._index); }, //
Expand Down
2 changes: 1 addition & 1 deletion src/SSVOpenHexagon/Global/Assets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ HGAssets::HGAssetsImpl::~HGAssetsImpl()

packInfos.emplace_back(PackInfo{packId, packPath});

packDatas.emplace(packId, //
packDatas.emplace(packId, //
PackData{
.folderPath{packPath.getStr()}, //
.id{packId}, //
Expand Down
16 changes: 8 additions & 8 deletions src/SSVOpenHexagon/Global/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ using cil = std::initializer_list<cmb>;
X(triggerRotateCW, trig, "t_rotate_cw", \
cil{cmb{{k::D}}, cmb{{k::Right}}, cmb{kil{}, mil{m::Right}}}) \
X(triggerFocus, trig, "t_focus", \
cil{cmb{{k::LShift}}, cmb{kil{}, mil{m::Extra1}}}) \
cil{cmb{{k::LShift}}, cmb{kil{}, mil{m::Extra1}}}) \
X(triggerSelect, trig, "t_select", \
cil{cmb{{k::Space}}, cmb{kil{}, mil{m::Middle}}}) \
X(triggerExit, trig, "t_exit", \
cil{cmb{{k::T}}, cmb{kil{}, mil{m::Extra2}}}) \
cil{cmb{{k::T}}, cmb{kil{}, mil{m::Extra2}}}) \
X(triggerForceRestart, trig, "t_force_restart", \
cil{cmb{{k::Up}}, cmb{{k::R}}}) \
X(triggerRestart, trig, "t_restart", \
Expand Down Expand Up @@ -1480,8 +1480,8 @@ const std::array<TriggerGetter, toSizeT(Tid::TriggersCount)> triggerGetters{
}

// names are shifted compared to the Key enum
bindNames +=
bindToHumanReadableName(ssvs::getKKeyName(sf::Keyboard::Key(j - 1)));
bindNames += bindToHumanReadableName(
ssvs::getKKeyName(sf::Keyboard::Key(j - 1)));
break;
}

Expand All @@ -1499,8 +1499,8 @@ const std::array<TriggerGetter, toSizeT(Tid::TriggersCount)> triggerGetters{
}

// same as with keys
bindNames +=
bindToHumanReadableName(ssvs::getMBtnName(sf::Mouse::Button(j - 1)));
bindNames += bindToHumanReadableName(
ssvs::getMBtnName(sf::Mouse::Button(j - 1)));
break;
}
}
Expand All @@ -1512,8 +1512,8 @@ const std::array<TriggerGetter, toSizeT(Tid::TriggersCount)> triggerGetters{
//**************************************************
// Add new key binds

void rebindTrigger(
ssvs::Input::Trigger& trig, const sf::Keyboard::Key key, const sf::Mouse::Button btn, int index)
void rebindTrigger(ssvs::Input::Trigger& trig, const sf::Keyboard::Key key,
const sf::Mouse::Button btn, int index)
{
// if both slots are taken replace the first one
if(index >= maxBinds)
Expand Down
Loading

0 comments on commit 57bbea9

Please sign in to comment.