Skip to content

Commit

Permalink
Reformat code with clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
Clang Format committed Oct 2, 2023
1 parent 54c3b2c commit 082d525
Show file tree
Hide file tree
Showing 1,306 changed files with 83,779 additions and 102,675 deletions.
58 changes: 26 additions & 32 deletions src/Common/Game/GameLanguage.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,34 @@

#include <string>

enum class GameLanguage
{
LANGUAGE_NONE,
LANGUAGE_ENGLISH,
LANGUAGE_FRENCH,
LANGUAGE_GERMAN,
LANGUAGE_ITALIAN,
LANGUAGE_SPANISH,
LANGUAGE_BRITISH,
LANGUAGE_RUSSIAN,
LANGUAGE_POLISH,
LANGUAGE_KOREAN,
LANGUAGE_TAIWANESE,
LANGUAGE_JAPANESE,
LANGUAGE_CHINESE,
LANGUAGE_THAI,
LANGUAGE_LEET,
LANGUAGE_CZECH,
LANGUAGE_FRENCH_CAN,
LANGUAGE_AUSTRIAN,
LANGUAGE_PORTUGUESE,
LANGUAGE_MEXICAN_SPANISH,
LANGUAGE_FULL_JAPANESE
enum class GameLanguage {
LANGUAGE_NONE,
LANGUAGE_ENGLISH,
LANGUAGE_FRENCH,
LANGUAGE_GERMAN,
LANGUAGE_ITALIAN,
LANGUAGE_SPANISH,
LANGUAGE_BRITISH,
LANGUAGE_RUSSIAN,
LANGUAGE_POLISH,
LANGUAGE_KOREAN,
LANGUAGE_TAIWANESE,
LANGUAGE_JAPANESE,
LANGUAGE_CHINESE,
LANGUAGE_THAI,
LANGUAGE_LEET,
LANGUAGE_CZECH,
LANGUAGE_FRENCH_CAN,
LANGUAGE_AUSTRIAN,
LANGUAGE_PORTUGUESE,
LANGUAGE_MEXICAN_SPANISH,
LANGUAGE_FULL_JAPANESE
};

class GameLanguagePrefix
{
class GameLanguagePrefix {
public:
GameLanguage m_language;
const std::string m_prefix;
GameLanguage m_language;
const std::string m_prefix;

GameLanguagePrefix(const GameLanguage language, std::string prefix)
: m_language(language),
m_prefix(std::move(prefix))
{
}
GameLanguagePrefix(const GameLanguage language, std::string prefix) : m_language(language), m_prefix(std::move(prefix)) {}
};
29 changes: 14 additions & 15 deletions src/Common/Game/IGame.h
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
#pragma once
#include <vector>
#include "GameLanguage.h"
#include <vector>

class Zone;

class IGame
{
class IGame {
public:
IGame() = default;
virtual ~IGame() = default;
IGame(const IGame& other) = default;
IGame(IGame&& other) noexcept = default;
IGame& operator=(const IGame& other) = default;
IGame& operator=(IGame&& other) noexcept = default;
IGame() = default;
virtual ~IGame() = default;
IGame(const IGame &other) = default;
IGame(IGame &&other) noexcept = default;
IGame &operator=(const IGame &other) = default;
IGame &operator=(IGame &&other) noexcept = default;

virtual std::string GetFullName() = 0;
virtual std::string GetShortName() = 0;
virtual void AddZone(Zone* zone) = 0;
virtual void RemoveZone(Zone* zone) = 0;
virtual std::vector<Zone*> GetZones() = 0;
virtual std::vector<GameLanguagePrefix> GetLanguagePrefixes() = 0;
virtual std::string GetFullName() = 0;
virtual std::string GetShortName() = 0;
virtual void AddZone(Zone *zone) = 0;
virtual void RemoveZone(Zone *zone) = 0;
virtual std::vector<Zone *> GetZones() = 0;
virtual std::vector<GameLanguagePrefix> GetLanguagePrefixes() = 0;
};
40 changes: 11 additions & 29 deletions src/Common/Game/IW3/CommonIW3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,14 @@

using namespace IW3;

PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
{
return PackedTexCoords{Pack32::Vec2PackTexCoords(reinterpret_cast<const float*>(in))};
}

PackedUnitVec Common::Vec3PackUnitVec(const vec3_t* in)
{
return PackedUnitVec{Pack32::Vec3PackUnitVec(reinterpret_cast<const float*>(in))};
}

GfxColor Common::Vec4PackGfxColor(const vec4_t* in)
{
return GfxColor{Pack32::Vec4PackGfxColor(reinterpret_cast<const float*>(in))};
}

void Common::Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out)
{
Pack32::Vec2UnpackTexCoordsVU(in.packed, reinterpret_cast<float*>(out));
}

void Common::Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out)
{
Pack32::Vec3UnpackUnitVecScaleBased(in.packed, reinterpret_cast<float*>(out));
}

void Common::Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out)
{
Pack32::Vec4UnpackGfxColor(in.packed, reinterpret_cast<float*>(out));
}
PackedTexCoords Common::Vec2PackTexCoords(const vec2_t *in) { return PackedTexCoords{Pack32::Vec2PackTexCoords(reinterpret_cast<const float *>(in))}; }

PackedUnitVec Common::Vec3PackUnitVec(const vec3_t *in) { return PackedUnitVec{Pack32::Vec3PackUnitVec(reinterpret_cast<const float *>(in))}; }

GfxColor Common::Vec4PackGfxColor(const vec4_t *in) { return GfxColor{Pack32::Vec4PackGfxColor(reinterpret_cast<const float *>(in))}; }

void Common::Vec2UnpackTexCoords(const PackedTexCoords &in, vec2_t *out) { Pack32::Vec2UnpackTexCoordsVU(in.packed, reinterpret_cast<float *>(out)); }

void Common::Vec3UnpackUnitVec(const PackedUnitVec &in, vec3_t *out) { Pack32::Vec3UnpackUnitVecScaleBased(in.packed, reinterpret_cast<float *>(out)); }

void Common::Vec4UnpackGfxColor(const GfxColor &in, vec4_t *out) { Pack32::Vec4UnpackGfxColor(in.packed, reinterpret_cast<float *>(out)); }
46 changes: 21 additions & 25 deletions src/Common/Game/IW3/CommonIW3.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,26 @@

#include "IW3.h"

namespace IW3
{
class Common
{
public:
static constexpr uint32_t R_HashString(const char* string, const uint32_t hash)
{
const char* v2 = string; // edx@1
char v3 = *string; // cl@1
uint32_t result = hash;
namespace IW3 {
class Common {
public:
static constexpr uint32_t R_HashString(const char *string, const uint32_t hash) {
const char *v2 = string; // edx@1
char v3 = *string; // cl@1
uint32_t result = hash;

for (; *v2; v3 = *v2)
{
++v2;
result = 33 * result ^ (v3 | 0x20);
}
return result;
}
for (; *v2; v3 = *v2) {
++v2;
result = 33 * result ^ (v3 | 0x20);
}
return result;
}

static PackedTexCoords Vec2PackTexCoords(const vec2_t* in);
static PackedUnitVec Vec3PackUnitVec(const vec3_t* in);
static GfxColor Vec4PackGfxColor(const vec4_t* in);
static void Vec2UnpackTexCoords(const PackedTexCoords& in, vec2_t* out);
static void Vec3UnpackUnitVec(const PackedUnitVec& in, vec3_t* out);
static void Vec4UnpackGfxColor(const GfxColor& in, vec4_t* out);
};
}
static PackedTexCoords Vec2PackTexCoords(const vec2_t *in);
static PackedUnitVec Vec3PackUnitVec(const vec3_t *in);
static GfxColor Vec4PackGfxColor(const vec4_t *in);
static void Vec2UnpackTexCoords(const PackedTexCoords &in, vec2_t *out);
static void Vec3UnpackUnitVec(const PackedUnitVec &in, vec3_t *out);
static void Vec4UnpackGfxColor(const GfxColor &in, vec4_t *out);
};
} // namespace IW3
36 changes: 11 additions & 25 deletions src/Common/Game/IW3/GameIW3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,22 @@ using namespace IW3;

GameIW3 g_GameIW3;

std::string GameIW3::GetFullName()
{
return "Call Of Duty 4: Modern Warfare";
}
std::string GameIW3::GetFullName() { return "Call Of Duty 4: Modern Warfare"; }

std::string GameIW3::GetShortName()
{
return "IW3";
}
std::string GameIW3::GetShortName() { return "IW3"; }

void GameIW3::AddZone(Zone* zone)
{
m_zones.push_back(zone);
}
void GameIW3::AddZone(Zone *zone) { m_zones.push_back(zone); }

void GameIW3::RemoveZone(Zone* zone)
{
const auto foundEntry = std::find(m_zones.begin(), m_zones.end(), zone);
void GameIW3::RemoveZone(Zone *zone) {
const auto foundEntry = std::find(m_zones.begin(), m_zones.end(), zone);

if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
if (foundEntry != m_zones.end())
m_zones.erase(foundEntry);
}

std::vector<Zone*> GameIW3::GetZones()
{
return m_zones;
}
std::vector<Zone *> GameIW3::GetZones() { return m_zones; }

std::vector<GameLanguagePrefix> GameIW3::GetLanguagePrefixes()
{
std::vector<GameLanguagePrefix> prefixes;
return prefixes;
std::vector<GameLanguagePrefix> GameIW3::GetLanguagePrefixes() {
std::vector<GameLanguagePrefix> prefixes;
return prefixes;
}
17 changes: 8 additions & 9 deletions src/Common/Game/IW3/GameIW3.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#pragma once
#include "Game/IGame.h"

class GameIW3 : public IGame
{
std::vector<Zone*> m_zones;
class GameIW3 : public IGame {
std::vector<Zone *> m_zones;

public:
std::string GetFullName() override;
std::string GetShortName() override;
void AddZone(Zone* zone) override;
void RemoveZone(Zone* zone) override;
std::vector<Zone*> GetZones() override;
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
std::string GetFullName() override;
std::string GetShortName() override;
void AddZone(Zone *zone) override;
void RemoveZone(Zone *zone) override;
std::vector<Zone *> GetZones() override;
std::vector<GameLanguagePrefix> GetLanguagePrefixes() override;
};

extern GameIW3 g_GameIW3;
Loading

0 comments on commit 082d525

Please sign in to comment.