Filter:   InfoImg
download entity.h
Language: C++
LOC: 76
Project Info
Ultima Online Project(uop)
Server: SourceForge
Type: cvs
SourceForge\u\uop\uop\uop\
   acinclude.m4
   aclocal.m4
   action.cc
   action.h
   animation.cc
   animation.h
   artexport.cc
   artfactory.cc
   artfactory.h
   audio.cc
   audio.h
   btree.cc
   btree.h
   cache.h
   cliloc.cc
   cliloc.h
   config.h.in
   configure.in
   cvs2cl.pl
   entity.cc
   entity.h
   gumps.cc
   gumps.h
   interface.cc
   interface.h
   interfacegumps.cc
   interfacegumps.h
   interfacehandler.cc
   interfacehandler.h
   intrface.def
   Makefile.am
   Makefile.in
   message.cc
   message.h
   musicmap.def
   network.cc
   network.h
   patchhandler.cc
   patchhandler.h
   readable.pl
   serverhandler.cc
   serverhandler.h
   sprite.cc
   sprite.h
   stamp-h.in
   texthandler.cc
   texthandler.h
   tiledata.cc
   tiledata.h
   unreadable.pl
   uop.cc
   uop.cfg
   uop.dox
   uop.h
   uopconfig.cc
   uopconfig.h
   uosprite.h
   uostub.pl
   world.cc
   world.h

#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