Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaMKW committed Aug 14, 2023
1 parent e4a7389 commit 42b5f33
Show file tree
Hide file tree
Showing 82 changed files with 591 additions and 569 deletions.
2 changes: 1 addition & 1 deletion include/BetterSMS/application.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ namespace BetterSMS {
bool registerContextCallback(u8 context, ContextCallback cb);
void deregisterContextCallback(u8 context);
void setIntroStage(u8 area, u8 episode);
} // namespace Game
} // namespace Application
}; // namespace BetterSMS
4 changes: 2 additions & 2 deletions include/BetterSMS/bmg.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ namespace BetterSMS {

bool registerBMGCommandCallback(u8 identifier, BMGCommandCallback cb);
void deregisterBMGCommandCallback(u8 identifier);
}
}; // namespace BetterSMS::BMG
} // namespace BMG
}; // namespace BetterSMS
2 changes: 1 addition & 1 deletion include/BetterSMS/game.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ namespace BetterSMS {
void deregisterLoopCallback(const char *name);
void deregisterPostDrawCallback(const char *name);
void deregisterChangeCallback(const char *name);
} // namespace Debug
} // namespace Game
}; // namespace BetterSMS
7 changes: 3 additions & 4 deletions include/BetterSMS/libs/anim2d.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
#include <Dolphin/OS.h>
#include <Dolphin/types.h>

#include <JSystem/JUtility/JUTTexture.hxx>
#include <JSystem/J2D/J2DPicture.hxx>

#include <JSystem/JUtility/JUTTexture.hxx>

class SimpleTexAnimator {
public:
Expand All @@ -16,8 +15,8 @@ public:
: mTextures(textures), mTexCount(texCount), mRotation(0.0f), mSpin(0.0f), mLastTime(0),
mCurrentFrame(0.0f), mFrameRate(30.0f) {}
SimpleTexAnimator(const u8 **textures, size_t texCount)
: mTexCount(texCount), mRotation(0.0f), mSpin(0.0f), mLastTime(0),
mCurrentFrame(0.0f), mFrameRate(30.0f) {
: mTexCount(texCount), mRotation(0.0f), mSpin(0.0f), mLastTime(0), mCurrentFrame(0.0f),
mFrameRate(30.0f) {
mTextures = reinterpret_cast<const ResTIMG **>(textures);
}
~SimpleTexAnimator() {}
Expand Down
12 changes: 6 additions & 6 deletions include/BetterSMS/libs/geometry.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ namespace BetterSMS {
TVec3f euler;

// Assuming the order is Yaw-Pitch-Roll (Y-X-Z)
//if (rotMtx[0][2] > 0.998f) { // singularity at north pole
// if (rotMtx[0][2] > 0.998f) { // singularity at north pole
// euler.x = atan2f(rotMtx[2][0], rotMtx[0][0]);
// euler.y = M_PI / 2;
// euler.z = 0;
Expand All @@ -145,15 +145,15 @@ namespace BetterSMS {
//}

//// Yaw (y rotation)
//float sinY = -rotMtx[2][0];
//float cosY = sqrtf(rotMtx[0][0] * rotMtx[0][0] + rotMtx[1][0] * rotMtx[1][0]);
//euler.y = atan2f(sinY, cosY);
// float sinY = -rotMtx[2][0];
// float cosY = sqrtf(rotMtx[0][0] * rotMtx[0][0] + rotMtx[1][0] * rotMtx[1][0]);
// euler.y = atan2f(sinY, cosY);

//// Pitch (x rotation)
//euler.x = atan2f(rotMtx[1][2], -rotMtx[2][2]);
// euler.x = atan2f(rotMtx[1][2], -rotMtx[2][2]);

//// Roll (z rotation)
//euler.z = atan2f(-rotMtx[1][0], -rotMtx[0][0]);
// euler.z = atan2f(-rotMtx[1][0], -rotMtx[0][0]);

const float PI_OVER_2 = 1.57079632679f; // Pi/2
const float EPSILON = 0.0001f; // For precision checking
Expand Down
6 changes: 4 additions & 2 deletions include/BetterSMS/libs/global_unordered_map.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

namespace BetterSMS {
template <class _Key, class _T, class _Hash = JSystem::hash<_Key>,
class _Pred = JSystem::equal_to<_Key>>
using TGlobalUnorderedMap = JGadget::TUnorderedMap<_Key, _T, _Hash, _Pred, TGlobalAllocator<JGadget::TPair<const _Key, _T>>>;
class _Pred = JSystem::equal_to<_Key>>
using TGlobalUnorderedMap =
JGadget::TUnorderedMap<_Key, _T, _Hash, _Pred,
TGlobalAllocator<JGadget::TPair<const _Key, _T>>>;
}
3 changes: 1 addition & 2 deletions include/BetterSMS/libs/global_vector.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
#include <JSystem/JGadget/Vector.hxx>

namespace BetterSMS {
template <class _T>
using TGlobalVector = JGadget::TVector<_T, TGlobalAllocator<_T>>;
template <class _T> using TGlobalVector = JGadget::TVector<_T, TGlobalAllocator<_T>>;
}
2 changes: 1 addition & 1 deletion include/BetterSMS/libs/profiler.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace BetterSMS {
const char *mFunction;
OSStopwatch mStopwatch;
};
}
} // namespace BetterSMS

#define BETTERSMS_START_PROFILE BetterSMS::TProfiler __profiler = BetterSMS::TProfiler(SMS_FUNC_SIG)
#define BETTERSMS_STOP_PROFILE __profiler.~TProfiler()
22 changes: 12 additions & 10 deletions include/BetterSMS/libs/string.hxx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include <Dolphin/OS.h>
#include <Dolphin/types.h>
#include <Dolphin/math.h>
#include <Dolphin/types.h>

#include <JSystem/bits/functional_hash.h>
#include <JSystem/JGadget/Allocator.hxx>
#include "global_allocator.hxx"
#include <JSystem/JGadget/Allocator.hxx>
#include <JSystem/bits/functional_hash.h>

namespace BetterSMS {

Expand Down Expand Up @@ -183,7 +183,10 @@ namespace BetterSMS {
}

explicit _GLIBCXX20_CONSTEXPR TBasicString(const allocator_type &alloc) _GLIBCXX_NOEXCEPT
: mAllocator(alloc), mData(nullptr), mSize(0), mCapacity(120) {
: mAllocator(alloc),
mData(nullptr),
mSize(0),
mCapacity(120) {
mData = allocate_buffer(mCapacity);
mData[0] = '\0';
}
Expand Down Expand Up @@ -637,7 +640,7 @@ namespace BetterSMS {
"Realloc for TBasicString failed! (Attempted to allocate %lu bytes)", size);
JSystem::copy(mData, mData + mSize + 1, p);
deallocate_buffer(mData);
mData = p;
mData = p;
mCapacity = size;
}

Expand All @@ -654,7 +657,7 @@ namespace BetterSMS {
};

template <class _CharT, class _Alloc = JGadget::TAllocator<_CharT>>
_GLIBCXX20_CONSTEXPR bool operator==(const TBasicString<_CharT, _Alloc>& a,
_GLIBCXX20_CONSTEXPR bool operator==(const TBasicString<_CharT, _Alloc> &a,
const TBasicString<_CharT, _Alloc> &b) {
if (a.length() != b.length())
return false;
Expand Down Expand Up @@ -685,9 +688,9 @@ namespace BetterSMS {
}
#endif

using TString = TBasicString<char>;
using TString = TBasicString<char>;
using TGlobalString = TBasicString<char, TGlobalAllocator<char>>;
using TWString = TBasicString<wchar_t>;
using TWString = TBasicString<wchar_t>;
#ifdef _GLIBCXX_USE_CHAR8_T
using TU8String = TBasicString<u8>;
#endif
Expand All @@ -707,8 +710,7 @@ namespace JSystem {
#ifndef _GLIBCXX_COMPATIBILITY_CXX0X
/// std::hash specialization for string.
template <typename _Alloc>
struct hash<BetterSMS::TBasicString<char, _Alloc>>
: public __str_hash_base<char, _Alloc> {};
struct hash<BetterSMS::TBasicString<char, _Alloc>> : public __str_hash_base<char, _Alloc> {};

/// std::hash specialization for wstring.
template <typename _Alloc>
Expand Down
5 changes: 3 additions & 2 deletions include/BetterSMS/module.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#endif

#define BETTER_SMS_FOR_CALLBACK SMS_NO_INLINE
#define BETTER_SMS_FOR_EXPORT SMS_NO_INLINE
#define BETTER_SMS_FOR_EXPORT SMS_NO_INLINE

namespace BetterSMS {

Expand All @@ -77,7 +77,8 @@ namespace BetterSMS {

class BugsSetting final : public Settings::SwitchSetting {
public:
BugsSetting(const char *name) : SwitchSetting(name, &mBugsValue), mBugsValue(true), mIsUnlocked(true) {}
BugsSetting(const char *name)
: SwitchSetting(name, &mBugsValue), mBugsValue(true), mIsUnlocked(true) {}
~BugsSetting() override {}

bool isUnlocked() const override { return mIsUnlocked; }
Expand Down
4 changes: 2 additions & 2 deletions include/BetterSMS/music.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <Dolphin/types.h>
#include <JSystem/JKernel/JKRHeap.hxx>
#include <JSystem/JSupport/JSUStream.hxx>
#include <SMS/System/Params.hxx>
#include <SMS/MSound/MSBGM.hxx>
#include <SMS/System/Params.hxx>

namespace BetterSMS {
namespace Music {
Expand Down Expand Up @@ -202,4 +202,4 @@ namespace BetterSMS {
bool isWeakBGM(u32 id);
bool isWeakBGM(MSStageInfo id);
} // namespace Music
} // namespace BetterSMS::Music
} // namespace BetterSMS
2 changes: 1 addition & 1 deletion include/BetterSMS/object.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ namespace BetterSMS {

bool deregisterObject(const char *name);
} // namespace Objects
} // namespace BetterSMS::Objects
} // namespace BetterSMS
3 changes: 2 additions & 1 deletion include/BetterSMS/objects/particle.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public:
}

TParticleBox(const char *name)
: TActor(name), mID(-1), mSpawnRate(10), mSpawnScale(1.0f), mShape(BoundingType::Box), mIsStrict(false), mSpawnTimer() {}
: TActor(name), mID(-1), mSpawnRate(10), mSpawnScale(1.0f), mShape(BoundingType::Box),
mIsStrict(false), mSpawnTimer() {}
virtual ~TParticleBox() override {}

void load(JSUMemoryInputStream &in) override;
Expand Down
4 changes: 2 additions & 2 deletions include/BetterSMS/objects/sound.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public:
}

TSoundBox(const char *name)
: TActor(name), mID(-1), mVolume(1.0f), mPitch(1.0f), mSpawnRate(1), mShape(BoundingType::Box),
mSpawnTimer(), mSoundPos() {}
: TActor(name), mID(-1), mVolume(1.0f), mPitch(1.0f), mSpawnRate(1),
mShape(BoundingType::Box), mSpawnTimer(), mSoundPos() {}
virtual ~TSoundBox() override {}

void load(JSUMemoryInputStream &in) override;
Expand Down
13 changes: 5 additions & 8 deletions include/BetterSMS/player.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <JSystem/JGeometry/JGMVec.hxx>
#include <JSystem/JSupport/JSUMemoryStream.hxx>
#include <JSystem/JUtility/JUTColor.hxx>
#include <SMS/Player/Mario.hxx>
#include <SMS/Camera/PolarSubCamera.hxx>
#include <SMS/Player/Mario.hxx>
#include <SMS/raw_fn.hxx>

#include "libs/container.hxx"
Expand All @@ -22,7 +22,7 @@ using namespace BetterSMS::Collision;
namespace BetterSMS {
namespace Player {
struct TPlayerData;

// Get the specialized BetterSMS info of a player
void *getRegisteredData(TMario *, const char *);

Expand Down Expand Up @@ -79,13 +79,10 @@ namespace BetterSMS {

struct TPlayerParams : public TParams {
TPlayerParams()
: TParams(), SMS_TPARAM_INIT(mMaxHealth, 8),
SMS_TPARAM_INIT(mCanRideYoshi, true),
SMS_TPARAM_INIT(mCanUseFludd, true),
SMS_TPARAM_INIT(mPlayerHasHelmet, false),
: TParams(), SMS_TPARAM_INIT(mMaxHealth, 8), SMS_TPARAM_INIT(mCanRideYoshi, true),
SMS_TPARAM_INIT(mCanUseFludd, true), SMS_TPARAM_INIT(mPlayerHasHelmet, false),
SMS_TPARAM_INIT(mPlayerHasGlasses, false),
SMS_TPARAM_INIT(mPlayerHasShirt, false),
SMS_TPARAM_INIT(mScaleMultiplier, 1.0f),
SMS_TPARAM_INIT(mPlayerHasShirt, false), SMS_TPARAM_INIT(mScaleMultiplier, 1.0f),
SMS_TPARAM_INIT(mThrowPowerMultiplier, 1.0f),
SMS_TPARAM_INIT(mUnderwaterHealthMultiplier, 1.0f),
SMS_TPARAM_INIT(mFallDamageMinMultiplier, 1.0f) {
Expand Down
5 changes: 2 additions & 3 deletions include/BetterSMS/stage.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <JSystem/J2D/J2DOrthoGraph.hxx>
#include <JSystem/JDrama/JDRNameRef.hxx>
#include <SMS/MapObj/MapObjInit.hxx>
#include <SMS/System/Application.hxx>
#include <SMS/System/MarDirector.hxx>
#include <SMS/MapObj/MapObjInit.hxx>
#include <SMS/System/Params.hxx>

namespace BetterSMS {
Expand Down Expand Up @@ -64,8 +64,7 @@ namespace BetterSMS {

static TStageParams *sStageConfig;

static char *stageNameToParamPath(char *dst, const char *stage,
bool global = false);
static char *stageNameToParamPath(char *dst, const char *stage, bool global = false);

bool isCustomConfig() const { return mIsCustomConfigLoaded; }
void load(const char *stageName);
Expand Down
2 changes: 1 addition & 1 deletion include/BetterSMS/sunscript.hxx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include <Dolphin/types.h>
#include <SMS/assert.h>
#include <SMS/SPC/SpcInterp.hxx>
#include <SMS/SPC/SpcSlice.hxx>
#include <SMS/assert.h>

#include "sunscript.hxx"

Expand Down
2 changes: 1 addition & 1 deletion include/BetterSMS/time.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ namespace BetterSMS {
void calendarToDate(char *dst, const OSCalendarTime &calendar);
void calendarToTime(char *dst, const OSCalendarTime &calendar);
} // namespace Time
} // namespace BetterSMS::Time
} // namespace BetterSMS
2 changes: 1 addition & 1 deletion lib/sms_interface
Loading

0 comments on commit 42b5f33

Please sign in to comment.