#ifndef __ENTITY_H__
#define __ENTITY_H__
#include <SDL/SDL.h>
#include "animation.h"
#include "sprite.h"
#define HE_WALK_UNARMED 0x00
#define HE_WALK_ARMED 0x01
#define HE_RUN_UNARMED 0x02
#define HE_RUN_ARMED 0x03
#define HE_STAND 0x04
enum draw_order{
DRAW_ORDER_LAND,
DRAW_ORDER_MAP,
DRAW_ORDER_OTHER,
DRAW_ORDER_MOBILE
};
class Entity
{
public:
Entity();
virtual ~Entity();
virtual void blit(unsigned int x, unsigned int y);
virtual bool isLandTile() { return false; }
virtual bool isMapTile() { return false; }
virtual bool isMobile() { return false; }
virtual draw_order order() { return DRAW_ORDER_OTHER; }
virtual Uint8 sHeight() { return 0; }
bool operator>(class Entity &lesser);
Sint8 z;
class Cell *inCell;
};
class LandTile : public Entity
{
public:
LandTile() { Entity::Entity(); }
void blit(unsigned int x, unsigned int y);
void render(int y2, int y3, int y4);
bool isLandTile() { return true; }
bool isMapTile() { return true; }
draw_order order() { return DRAW_ORDER_LAND; }
Uint32 index;
protected:
Sprite image;
};
class Static : public Entity
{
public:
Static() { Entity::Entity(); }
void blit(unsigned int x, unsigned int y);
bool isMapTile() { return (index < 0x4000); }
draw_order order() { return (index < 0x4000)?DRAW_ORDER_MAP:DRAW_ORDER_OTHER; }
Uint8 sHeight();
Uint32 index;
};
class Mobile : public Entity
{
public:
Mobile(Uint32 serial, Uint32 id);
void blit(unsigned int x, unsigned int y);
bool isMobile() { return true; }
draw_order order() { return DRAW_ORDER_MOBILE; }
void updateAnimation();
Uint32 id;
Uint32 animation_base;
Uint8 action;
Uint8 dir;
Uint16 x, y;
Uint16 hue;
Uint8 color;
Uint8 status;
bool inThirdDawn;
protected:
AnimationState currentState;
Uint32 serial;
};
#endif