Apparently the first post is too big to contain any more.. I'll see what I can do about that.
Anyway here we go. More Core Data Types:
(this process was 1/3 automated so some things were not output. but it should give an idea of how it works.) :)
Code:
/**
* class that manages attribute values.
*/
class attributes;
{
attributes();
attributes(const attributes &);
attributes& operator +=(const attributes &);
attributes& operator -=(const attributes &);
attributes operator +(const attributes &) const;
attributes operator -(const attributes &) const;
int get_max_param(int) const;
int get_stat(int) const;
int get_element(int);
int get_status_atk(int);
int get_status_def(int);
void set_max_param(int, int) const;
void set_stat(int, int) const;
void set_element(int, int);
void set_status_atk(int, int);
void set_status_def(int, int);
};
/**
* class that manages items and amount.
*/
class inventory
{
inventory();
inventory(const inventory &);
};
/**
* class that manages equipped items.
*/
class equipment
{
equipment();
equipment(const equipment &);
};
/**
* class that describes an enchantment
* or temporary effect on an actor or entity.
*/
class buff
{
buff();
buff(const buff &);
};
/**
* class that holds all basic information of a character
*/
class character_data
{
string name;
string script;
string description;
int id;
int race_id;
int class_id;
int portrait_id;
int map_spriteset_id;
int battle_spriteset_id;
int lv;
int exp;
int gold;
attributes attributes;
};
/**
* class that holds all basic information of a monster
*/
class monster_data
{
string name;
string script;
string description;
int id;
int portrait_id;
int map_spriteset_id;
int battle_spriteset_id;
int lv;
int exp;
int gold;
attributes attributes;
item_dropset item_dropset;
};
/**
* class that is an instance of a character or monster class;
*/
class actor
{
actor();
actor(const actor &);
string name;
string script;
int id;
int portrait_id;
int map_spriteset_id;
int battle_spriteset_id;
int get_lv() const;
int get_exp() const;
int get_gold() const;
void set_lv(int) const;
void set_exp(int) const;
void set_gold(int) const;
int get_param(int) const;
int get_max_param(int) const;
int get_base_max_param(int) const;
int get_stat(int) const;
int get_base_stat(int) const;
int get_status_atk(int) const;
int get_status_def(int) const;
int get_base_status_atk(int) const;
int get_base_status_def(int) const;
void set_param(int, int) const;
void set_base_max_param(int, int) const;
void set_base_stat(int, int) const;
void set_base_status_atk(int, int) const;
void set_base_status_def(int, int) const;
const attributes& get_attributes() const;
const equipment& get_equipment() const;
};
/**
* class entity that is a battle instance of, and
* holds a reference to, an actor.
*/
class combatant
{
actor();
actor(const actor &);
actor@ get_actor() const;
int get_param(int) const;
int get_max_param(int) const;
int get_base_max_param(int) const;
int get_stat(int) const;
int get_base_stat(int) const;
int get_status_atk(int) const;
int get_status_def(int) const;
int get_base_status_atk(int) const;
int get_base_status_def(int) const;
void set_param(int, int) const;
void set_base_max_param(int, int) const;
void set_base_stat(int, int) const;
void set_base_status_atk(int, int) const;
void set_base_status_def(int, int) const;
const attributes& get_attributes() const;
const equipment& get_equipment() const;
};
/**
* class that manages a list of current active and reserve
* party members, as well as other information.
*/
class party
{
party();
party(const party &);
int get_gold() const;
int get_size() const;
int get_active_size() const;
int get_reserve_size() const;
int get_max_size() const;
int get_max_active_size() const;
int get_active_member_id(int index) const;
int get_reserve_member_id(int index) const;
actor@ get_active_member(int index) const;
actor@ get_reserve_member(int index) const;
inventory& get_inventory();
const inventory& get_inventory() const;
void set_gold(int);
void set_max_size(int);
void set_max_active_size(int);
void add_gold(int);
void remove_gold(int);
void add_member(int);
void remove_member(int);
bool has_member(int) const;
bool is_member_active(int) const;
bool is_member_in_reserve(int) const;
bool is_full() const;
};
Basic Sprite classes reference:
Code:
//----------------------------------
// * Sprite
//----------------------------------
class sprite
{
public:
vec2 size;
vec2 scale;
color color;
blendmode blendmode;
float angle;
rectf uv;
sprite();
sprite(const sprite&);
sprite &operator =(const sprite&);
};
//----------------------------------
// * SpriteAnimation
//----------------------------------
class sprite_animation
{
public:
int animation_speed;
int frame;
int num_frames;
rect source_rect;
rectf uv;
bool is_animated() const;
//void flip(int flags);
};
//----------------------------------
// * AnimatedSprite
//----------------------------------
class animated_sprite : public sprite_animation
{
public:
vec2 size;
vec2 scale;
color color;
blendmode blendmode;
float angle;
animated_sprite();
animated_sprite(const animated_sprite&);
animated_sprite &operator =(const sprite&);
animated_sprite &operator =(const animated_sprite&);
};
//----------------------------------
// * AnimatedSpriteSet
//----------------------------------
class animated_spriteset
{
public:
sprite_animation animation[];
vec2 size;
vec2 scale;
color color;
blendmode blendmode;
float angle;
int num_animations; //get
int state;
animated_spriteset();
animated_spriteset(const animated_spriteset&);
animated_spriteset &operator =(const animated_spriteset&);
//void add_animation(const rect& sourceRect, float speed, int numFrames, int frameOffsetX, int frameOffsetY);
//void remove_animation(int index);
};
Whewee... we're getting serious now!
Anyway it's not perfect but it's the best documentation I can do right now.
Ideas for better design, names, functions, etc.. are most welcome.