2004-05-22 02:57:54 +02:00
|
|
|
// BaseEntity.h
|
|
|
|
//
|
2004-07-20 21:30:35 +02:00
|
|
|
// Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com
|
2004-05-22 02:57:54 +02:00
|
|
|
//
|
|
|
|
// Entity Templates
|
|
|
|
//
|
|
|
|
// Usage: These templates are used as the default values for entity properties.
|
2004-12-05 22:56:09 +01:00
|
|
|
// Due to Pyrogenesis' data-inheritance model for these properties,
|
2004-05-22 02:57:54 +02: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-22 01:46:16 +02:00
|
|
|
#ifndef BASE_ENTITY_INCLUDED
|
|
|
|
#define BASE_ENTITY_INCLUDED
|
|
|
|
|
|
|
|
#include "CStr.h"
|
|
|
|
#include "ObjectEntry.h"
|
|
|
|
|
2004-10-07 21:23:35 +02:00
|
|
|
#include "scripting/ScriptableObject.h"
|
2004-05-26 22:57:25 +02:00
|
|
|
#include "BoundingObjects.h"
|
2004-10-07 21:23:35 +02:00
|
|
|
#include "EventHandlers.h"
|
|
|
|
#include "ScriptObject.h"
|
|
|
|
#include "Xeromyces.h"
|
2004-05-22 01:46:16 +02:00
|
|
|
|
2004-11-11 08:09:32 +01:00
|
|
|
class CBaseEntity : public CJSObject<CBaseEntity>
|
2004-05-22 01:46:16 +02:00
|
|
|
{
|
|
|
|
public:
|
2004-06-11 00:24:03 +02:00
|
|
|
CBaseEntity();
|
2004-05-30 03:57:26 +02:00
|
|
|
~CBaseEntity();
|
2004-05-22 01:46:16 +02:00
|
|
|
// Load from XML
|
|
|
|
bool loadXML( CStr filename );
|
2004-10-07 21:23:35 +02:00
|
|
|
// Load a tree of properties from an XML (XMB) node.
|
2004-10-07 22:49:35 +02:00
|
|
|
void XMLLoadProperty( const CXeromyces& XeroFile, const XMBElement& Source, CStrW BasePropertyName );
|
2004-05-22 01:46:16 +02:00
|
|
|
|
|
|
|
// Base stats
|
|
|
|
|
2004-10-07 21:23:35 +02:00
|
|
|
CBaseEntity* m_base;
|
2004-11-11 08:09:32 +01:00
|
|
|
CStrW m_corpse;
|
|
|
|
bool m_extant;
|
|
|
|
|
2004-10-07 21:23:35 +02: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-22 01:46:16 +02:00
|
|
|
CObjectEntry* m_actorObject;
|
2004-11-11 08:09:32 +01:00
|
|
|
|
2004-05-22 01:46:16 +02:00
|
|
|
|
2004-10-07 21:23:35 +02:00
|
|
|
CStrW m_Tag;
|
2004-05-26 22:57:25 +02:00
|
|
|
CBoundingCircle* m_bound_circle;
|
|
|
|
CBoundingBox* m_bound_box;
|
|
|
|
CBoundingObject::EBoundingType m_bound_type;
|
|
|
|
|
2004-10-07 21:23:35 +02:00
|
|
|
float m_speed;
|
2004-11-11 08:09:32 +01:00
|
|
|
float m_meleeRange;
|
|
|
|
float m_meleeRangeMin;
|
|
|
|
|
2004-10-07 21:23:35 +02: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-22 01:46:16 +02:00
|
|
|
};
|
|
|
|
|
2004-06-03 15:27:01 +02:00
|
|
|
#endif
|