overworld sprite cleanup
This commit is contained in:
@@ -26,10 +26,42 @@ namespace zelda3 {
|
||||
class Sprite : public OverworldEntity {
|
||||
public:
|
||||
Sprite() = default;
|
||||
Sprite(std::vector<uint8_t> src, uchar mapid, uchar id, uchar x, uchar y, int map_x,
|
||||
int map_y);
|
||||
void InitSprite(const std::vector<uint8_t>& src, uchar mapid, uchar id, uchar x, uchar y,
|
||||
int map_x, int map_y);
|
||||
Sprite(std::vector<uint8_t> src, uint8_t mapid, uint8_t id, uint8_t x,
|
||||
uint8_t y, int map_x, int map_y)
|
||||
: current_gfx_(src),
|
||||
map_id_(static_cast<int>(mapid)),
|
||||
id_(id),
|
||||
nx_(x),
|
||||
ny_(y),
|
||||
map_x_(map_x),
|
||||
map_y_(map_y) {
|
||||
type_ = zelda3::OverworldEntity::EntityType::kSprite;
|
||||
entity_id_ = id;
|
||||
x_ = map_x_;
|
||||
y_ = map_y_;
|
||||
current_gfx_ = src;
|
||||
overworld_ = true;
|
||||
name_ = core::kSpriteDefaultNames[id];
|
||||
preview_gfx_.resize(64 * 64, 0xFF);
|
||||
}
|
||||
|
||||
void InitSprite(const std::vector<uint8_t>& src, uint8_t mapid, uint8_t id,
|
||||
uint8_t x, uint8_t y, int map_x, int map_y) {
|
||||
current_gfx_ = src;
|
||||
overworld_ = true;
|
||||
map_id_ = static_cast<int>(mapid);
|
||||
id_ = id;
|
||||
type_ = zelda3::OverworldEntity::EntityType::kSprite;
|
||||
entity_id_ = id;
|
||||
x_ = map_x_;
|
||||
y_ = map_y_;
|
||||
nx_ = x;
|
||||
ny_ = y;
|
||||
name_ = core::kSpriteDefaultNames[id];
|
||||
map_x_ = map_x;
|
||||
map_y_ = map_y;
|
||||
preview_gfx_.resize(64 * 64, 0xFF);
|
||||
}
|
||||
void updateBBox();
|
||||
|
||||
void Draw();
|
||||
@@ -40,11 +72,11 @@ class Sprite : public OverworldEntity {
|
||||
void UpdateMapProperties(short map_id) override;
|
||||
|
||||
// New methods
|
||||
void updateCoordinates(int map_x, int map_y);
|
||||
void UpdateCoordinates(int map_x, int map_y);
|
||||
|
||||
auto PreviewGraphics() const { return preview_gfx_; }
|
||||
auto id() const { return id_; }
|
||||
auto set_id(uchar id) { id_ = id; }
|
||||
auto set_id(uint8_t id) { id_ = id; }
|
||||
auto x() const { return x_; }
|
||||
auto y() const { return y_; }
|
||||
auto nx() const { return nx_; }
|
||||
@@ -52,6 +84,7 @@ class Sprite : public OverworldEntity {
|
||||
auto map_id() const { return map_id_; }
|
||||
auto map_x() const { return map_x_; }
|
||||
auto map_y() const { return map_y_; }
|
||||
auto game_state() const { return game_state_; }
|
||||
|
||||
auto layer() const { return layer_; }
|
||||
auto subtype() const { return subtype_; }
|
||||
@@ -64,36 +97,33 @@ class Sprite : public OverworldEntity {
|
||||
auto set_deleted(bool deleted) { deleted_ = deleted; }
|
||||
|
||||
private:
|
||||
std::vector<uint8_t> current_gfx_;
|
||||
bool overworld_;
|
||||
|
||||
uchar map_id_;
|
||||
uchar id_;
|
||||
// uchar x_;
|
||||
// uchar y_;
|
||||
uchar nx_;
|
||||
uchar ny_;
|
||||
uchar overlord_ = 0;
|
||||
std::string name_;
|
||||
|
||||
int subtype_;
|
||||
int layer_;
|
||||
|
||||
int map_x_;
|
||||
int map_y_;
|
||||
std::vector<uint8_t> preview_gfx_;
|
||||
uchar lowerX_;
|
||||
uchar lowerY_;
|
||||
uchar higherX_;
|
||||
uchar higherY_;
|
||||
SDL_Rect bounding_box_;
|
||||
uint8_t map_id_;
|
||||
uint8_t game_state_;
|
||||
uint8_t id_;
|
||||
uint8_t nx_;
|
||||
uint8_t ny_;
|
||||
uint8_t overlord_ = 0;
|
||||
uint8_t lowerX_;
|
||||
uint8_t lowerY_;
|
||||
uint8_t higherX_;
|
||||
uint8_t higherY_;
|
||||
|
||||
int width_ = 16;
|
||||
int height_ = 16;
|
||||
|
||||
int map_x_;
|
||||
int map_y_;
|
||||
int layer_;
|
||||
int subtype_;
|
||||
int key_drop_;
|
||||
|
||||
bool deleted_ = false;
|
||||
bool overworld_;
|
||||
|
||||
std::string name_;
|
||||
std::vector<uint8_t> preview_gfx_;
|
||||
std::vector<uint8_t> current_gfx_;
|
||||
|
||||
SDL_Rect bounding_box_;
|
||||
};
|
||||
|
||||
} // namespace zelda3
|
||||
|
||||
Reference in New Issue
Block a user