ReC98/th01/main/boss/entity.hpp

63 lines
1.9 KiB
C++
Raw Normal View History

struct area_t {
int left, right, top, bottom;
};
// An individual entity rendered with sprites from a .BOS file. May or may not
// be animated, and may or may not have a hitbox for collision with the Orb.
class CBossEntity {
public:
int cur_left;
int cur_top;
int prev_left;
int prev_top;
int vram_w;
int h;
area_t move_clamp; // Relative to VRAM
area_t hitbox_orb; // Relative to [cur_left] and [cur_top]
// Never actually read outside of the functions that set them...
int prev_delta_y;
int prev_delta_x;
int bos_image_count;
int zero_1;
int bos_image;
int unknown;
bool16 hitbox_orb_inactive;
bool16 loading;
int move_lock_frame;
int zero_2;
char zero_3;
unsigned char bos_slot;
// Loads all images from the .BOS file with the given [fn] inside the
// currently active packfile into the given .BOS [slot], and keeps the
// .BOS metadata in this class. Always returns 0.
int bos_load(const char fn[PF_FN_LEN], int slot);
// Copies the .BOS header data of this instance to the given variables. In
// practice, only used to copy these values from one CBossEntity to
// another.
void bos_metadata_get(
int &image_count, unsigned char &slot, int &vram_w, int &h
) const;
/// Blitting
/// --------
// All of functions with an [image] parameter use that image from
// [bos_slot], *not* the [bos_image] of this instance.
// All of these also make an attempt at clipping the sprite at the left
// and right edges of VRAM. This only really works if [left] is a multiple
// of 16 and inside the [-RES_X, RES_X[ range, though, and is pretty much
// broken otherwise.
// Blits [image] to (⌊left/8⌋*8, top).
// Additionally clips at the bottom edge of VRAM.
void put_8(int left, int top, int image) const;
// Blits line #[row] of [image] to (left, top).
// Additionally clips at the bottom edge of VRAM.
void put_1line(int left, int y, int image, int row) const;
/// --------
};