2004-05-21 17:57:54 -07:00
|
|
|
// BaseEntity.h
|
|
|
|
|
//
|
2004-07-20 12:30:35 -07:00
|
|
|
// Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com
|
2004-05-21 17:57:54 -07:00
|
|
|
//
|
|
|
|
|
// Entity Templates
|
|
|
|
|
//
|
|
|
|
|
// Usage: These templates are used as the default values for entity properties.
|
2004-12-05 13:56:09 -08:00
|
|
|
// Due to Pyrogenesis' data-inheritance model for these properties,
|
2004-05-21 17:57:54 -07:00
|
|
|
// templates specify a base-template, then override only those properties
|
|
|
|
|
// in that template that need to change.
|
|
|
|
|
// Similarly, entities need only specify properties they possess that are
|
|
|
|
|
// different to the ones in their respective templates. Of course,
|
|
|
|
|
// properties such as position, current HP, etc. cannot be inherited from
|
|
|
|
|
// a template in this way.
|
|
|
|
|
//
|
|
|
|
|
// Note: Data-inheritance is not currently implemented.
|
|
|
|
|
|
2004-05-21 16:46:16 -07:00
|
|
|
#ifndef BASE_ENTITY_INCLUDED
|
|
|
|
|
#define BASE_ENTITY_INCLUDED
|
|
|
|
|
|
|
|
|
|
#include "CStr.h"
|
|
|
|
|
#include "ObjectEntry.h"
|
|
|
|
|
|
2004-10-07 12:23:35 -07:00
|
|
|
#include "scripting/ScriptableObject.h"
|
2004-05-26 13:57:25 -07:00
|
|
|
#include "BoundingObjects.h"
|
2004-10-07 12:23:35 -07:00
|
|
|
#include "EventHandlers.h"
|
|
|
|
|
#include "ScriptObject.h"
|
|
|
|
|
#include "Xeromyces.h"
|
2004-05-21 16:46:16 -07:00
|
|
|
|
2004-11-10 23:09:32 -08:00
|
|
|
class CBaseEntity : public CJSObject<CBaseEntity>
|
2004-05-21 16:46:16 -07:00
|
|
|
{
|
|
|
|
|
public:
|
2004-06-10 15:24:03 -07:00
|
|
|
CBaseEntity();
|
2004-05-29 18:57:26 -07:00
|
|
|
~CBaseEntity();
|
2004-05-21 16:46:16 -07:00
|
|
|
// Load from XML
|
|
|
|
|
bool loadXML( CStr filename );
|
2004-10-07 12:23:35 -07:00
|
|
|
// Load a tree of properties from an XML (XMB) node.
|
2004-10-07 13:49:35 -07:00
|
|
|
void XMLLoadProperty( const CXeromyces& XeroFile, const XMBElement& Source, CStrW BasePropertyName );
|
2004-05-21 16:46:16 -07:00
|
|
|
|
|
|
|
|
// Base stats
|
|
|
|
|
|
2004-10-07 12:23:35 -07:00
|
|
|
CBaseEntity* m_base;
|
2004-11-10 23:09:32 -08:00
|
|
|
CStrW m_corpse;
|
|
|
|
|
bool m_extant;
|
|
|
|
|
|
2004-10-07 12:23:35 -07:00
|
|
|
CStrW m_Base_Name; // <- We don't guarantee the order XML files will be loaded in, so we'll store the name of the
|
|
|
|
|
// parent entity referenced, then, after all files are loaded, attempt to match names to objects.
|
|
|
|
|
|
2004-05-21 16:46:16 -07:00
|
|
|
CObjectEntry* m_actorObject;
|
2004-11-10 23:09:32 -08:00
|
|
|
|
2004-05-21 16:46:16 -07:00
|
|
|
|
2004-10-07 12:23:35 -07:00
|
|
|
CStrW m_Tag;
|
2004-05-26 13:57:25 -07:00
|
|
|
CBoundingCircle* m_bound_circle;
|
|
|
|
|
CBoundingBox* m_bound_box;
|
|
|
|
|
CBoundingObject::EBoundingType m_bound_type;
|
|
|
|
|
|
2004-10-07 12:23:35 -07:00
|
|
|
float m_speed;
|
2004-11-10 23:09:32 -08:00
|
|
|
float m_meleeRange;
|
|
|
|
|
float m_meleeRangeMin;
|
|
|
|
|
|
2004-10-07 12:23:35 -07:00
|
|
|
float m_turningRadius;
|
|
|
|
|
CScriptObject m_EventHandlers[EVENT_LAST];
|
|
|
|
|
|
|
|
|
|
void loadBase();
|
|
|
|
|
|
|
|
|
|
// Script-bound functions
|
|
|
|
|
|
|
|
|
|
jsval ToString( JSContext* cx, uintN argc, jsval* argv );
|
|
|
|
|
|
|
|
|
|
static void ScriptingInit();
|
2004-05-21 16:46:16 -07:00
|
|
|
};
|
|
|
|
|
|
2004-06-03 06:27:01 -07:00
|
|
|
#endif
|