diff --git a/src/app/gfx/snes_palette.h b/src/app/gfx/snes_palette.h index 00301788..d25a418a 100644 --- a/src/app/gfx/snes_palette.h +++ b/src/app/gfx/snes_palette.h @@ -17,21 +17,22 @@ namespace yaze { namespace app { namespace gfx { -typedef struct { +struct snes_color { uchar red; uchar blue; uchar green; -} snes_color; +}; +using snes_color = struct snes_color; -typedef struct { +struct snes_palette { uint id; uint size; snes_color* colors; -} snes_palette; +}; +using snes_palette = struct snes_palette; ushort ConvertRGBtoSNES(const snes_color color); snes_color ConvertSNEStoRGB(const ushort snes_color); - snes_palette* Extract(const char* data, const unsigned int offset, const unsigned int palette_size); char* Convert(const snes_palette pal); diff --git a/src/app/gfx/snes_tile.h b/src/app/gfx/snes_tile.h index 4bec72d5..d7bfb8f2 100644 --- a/src/app/gfx/snes_tile.h +++ b/src/app/gfx/snes_tile.h @@ -10,11 +10,12 @@ namespace yaze { namespace app { namespace gfx { -typedef struct { +struct tile8 { unsigned int id; char data[64]; unsigned int palette_id; -} tile8; +}; +using tile8 = struct tile8; // vhopppcc cccccccc // [0, 1] @@ -67,22 +68,21 @@ class Tile16 { class OAMTile { public: - int x, y, mx, my, pal; - ushort tile; - OAMTile() {} + int x_; + int y_; + 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, - int my = 0) { - x = x; - y = y; + int my = 0) + : x_(x), y_(y), mx_(mx), my_(my), pal_(pal) { if (upper) { - tile = (ushort)(tile + 512); + tile_ = (ushort)(tile + 512); } else { - tile = (ushort)(tile + 256 + 512); + tile_ = (ushort)(tile + 256 + 512); } - - pal = pal; - mx = mx; - my = my; } }; diff --git a/src/app/rom.h b/src/app/rom.h index 60f1df8d..63139730 100644 --- a/src/app/rom.h +++ b/src/app/rom.h @@ -50,22 +50,20 @@ struct CompressionPiece { int length; int argument_length; std::string argument; - std::shared_ptr next; - CompressionPiece() {} + std::shared_ptr next = nullptr; + CompressionPiece() = default; CompressionPiece(int cmd, int len, std::string args, int arg_len) - : command(cmd), - length(len), - argument(args), - argument_length(arg_len), - next(nullptr) {} -} typedef CompressionPiece; + : command(cmd), length(len), argument_length(arg_len), argument(args) {} +}; +using CompressionPiece = struct CompressionPiece; using OWBlockset = std::vector>; struct OWMapTiles { OWBlockset light_world; // 64 maps OWBlockset dark_world; // 64 maps OWBlockset special_world; // 32 maps -} typedef OWMapTiles; +}; +using OWMapTiles = struct OWMapTiles; class ROM { public: @@ -84,7 +82,7 @@ class ROM { absl::Status LoadAllGraphicsData(); absl::Status LoadFromFile(const absl::string_view& filename); absl::Status LoadFromPointer(uchar* data, size_t length); - absl::Status LoadFromBytes(const Bytes & data); + absl::Status LoadFromBytes(const Bytes& data); absl::Status SaveToFile();