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 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);

View File

@@ -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;
}
};

View File

@@ -50,22 +50,20 @@ struct CompressionPiece {
int length;
int argument_length;
std::string argument;
std::shared_ptr<CompressionPiece> next;
CompressionPiece() {}
std::shared_ptr<CompressionPiece> 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<std::vector<ushort>>;
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();