chore: replace typedefs with using alias

This commit is contained in:
scawful
2022-08-16 16:53:37 -04:00
parent 43dab0986e
commit d20d4a7912
3 changed files with 28 additions and 29 deletions

View File

@@ -17,21 +17,22 @@ namespace yaze {
namespace app { namespace app {
namespace gfx { namespace gfx {
typedef struct { struct snes_color {
uchar red; uchar red;
uchar blue; uchar blue;
uchar green; uchar green;
} snes_color; };
using snes_color = struct snes_color;
typedef struct { struct snes_palette {
uint id; uint id;
uint size; uint size;
snes_color* colors; snes_color* colors;
} snes_palette; };
using snes_palette = struct snes_palette;
ushort ConvertRGBtoSNES(const snes_color color); ushort ConvertRGBtoSNES(const snes_color color);
snes_color ConvertSNEStoRGB(const ushort snes_color); snes_color ConvertSNEStoRGB(const ushort snes_color);
snes_palette* Extract(const char* data, const unsigned int offset, snes_palette* Extract(const char* data, const unsigned int offset,
const unsigned int palette_size); const unsigned int palette_size);
char* Convert(const snes_palette pal); char* Convert(const snes_palette pal);

View File

@@ -10,11 +10,12 @@ namespace yaze {
namespace app { namespace app {
namespace gfx { namespace gfx {
typedef struct { struct tile8 {
unsigned int id; unsigned int id;
char data[64]; char data[64];
unsigned int palette_id; unsigned int palette_id;
} tile8; };
using tile8 = struct tile8;
// vhopppcc cccccccc // vhopppcc cccccccc
// [0, 1] // [0, 1]
@@ -67,22 +68,21 @@ class Tile16 {
class OAMTile { class OAMTile {
public: public:
int x, y, mx, my, pal; int x_;
ushort tile; int y_;
OAMTile() {} int mx_;
int my_;
int pal_;
ushort tile_;
OAMTile() = default;
OAMTile(int x, int y, ushort tile, int pal, bool upper = false, int mx = 0, OAMTile(int x, int y, ushort tile, int pal, bool upper = false, int mx = 0,
int my = 0) { int my = 0)
x = x; : x_(x), y_(y), mx_(mx), my_(my), pal_(pal) {
y = y;
if (upper) { if (upper) {
tile = (ushort)(tile + 512); tile_ = (ushort)(tile + 512);
} else { } else {
tile = (ushort)(tile + 256 + 512); tile_ = (ushort)(tile + 256 + 512);
} }
pal = pal;
mx = mx;
my = my;
} }
}; };

View File

@@ -50,22 +50,20 @@ struct CompressionPiece {
int length; int length;
int argument_length; int argument_length;
std::string argument; std::string argument;
std::shared_ptr<CompressionPiece> next; std::shared_ptr<CompressionPiece> next = nullptr;
CompressionPiece() {} CompressionPiece() = default;
CompressionPiece(int cmd, int len, std::string args, int arg_len) CompressionPiece(int cmd, int len, std::string args, int arg_len)
: command(cmd), : command(cmd), length(len), argument_length(arg_len), argument(args) {}
length(len), };
argument(args), using CompressionPiece = struct CompressionPiece;
argument_length(arg_len),
next(nullptr) {}
} typedef CompressionPiece;
using OWBlockset = std::vector<std::vector<ushort>>; using OWBlockset = std::vector<std::vector<ushort>>;
struct OWMapTiles { struct OWMapTiles {
OWBlockset light_world; // 64 maps OWBlockset light_world; // 64 maps
OWBlockset dark_world; // 64 maps OWBlockset dark_world; // 64 maps
OWBlockset special_world; // 32 maps OWBlockset special_world; // 32 maps
} typedef OWMapTiles; };
using OWMapTiles = struct OWMapTiles;
class ROM { class ROM {
public: public:
@@ -84,7 +82,7 @@ class ROM {
absl::Status LoadAllGraphicsData(); absl::Status LoadAllGraphicsData();
absl::Status LoadFromFile(const absl::string_view& filename); absl::Status LoadFromFile(const absl::string_view& filename);
absl::Status LoadFromPointer(uchar* data, size_t length); absl::Status LoadFromPointer(uchar* data, size_t length);
absl::Status LoadFromBytes(const Bytes & data); absl::Status LoadFromBytes(const Bytes& data);
absl::Status SaveToFile(); absl::Status SaveToFile();