physicallayer/pl.h
00001 /* 00002 Crystal Space Entity Layer 00003 Copyright (C) 2001-2005 by Jorrit Tyberghein 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef __CEL_PL_PL__ 00021 #define __CEL_PL_PL__ 00022 00023 #include "cstypes.h" 00024 #include "csutil/scf.h" 00025 #include "csutil/strset.h" 00026 #include "csutil/ref.h" 00027 #include "csutil/csstring.h" 00028 00029 struct iObject; 00030 struct iCelEntity; 00031 struct iCelEntityList; 00032 struct iCelEntityIterator; 00033 struct iCelDataBuffer; 00034 struct iCelParameterBlock; 00035 struct iCelPropertyClass; 00036 struct iCelPropertyClassFactory; 00037 struct iCelBlLayer; 00038 struct iCelBehaviour; 00039 struct iCelEntityTemplate; 00040 struct iSector; 00041 struct iCamera; 00042 class csVector3; 00043 class csBox3; 00044 class csString; 00045 00046 #define CEL_EVENT_PRE 0 00047 #define CEL_EVENT_VIEW 1 00048 #define CEL_EVENT_POST 2 00049 00050 #define CEL_PROPCLASS_END (void*)0 00051 #define CEL_PARAM_END (void*)0 00052 00054 typedef csHash<csStringFast<12>, csStringFast<12> > celEntityTemplateParams; 00055 00056 struct iCelEntityTracker; 00057 00062 struct iCelNewEntityCallback : public virtual iBase 00063 { 00064 SCF_INTERFACE (iCelNewEntityCallback, 0, 0, 2); 00065 00067 virtual void NewEntity (iCelEntity* entity) = 0; 00068 }; 00069 00074 struct iCelEntityRemoveCallback : public virtual iBase 00075 { 00076 SCF_INTERFACE (iCelEntityRemoveCallback, 0, 0, 2); 00077 00079 virtual void RemoveEntity (iCelEntity* entity) = 0; 00080 }; 00081 00082 00087 struct iCelTimerListener : public virtual iBase 00088 { 00089 SCF_INTERFACE (iCelTimerListener, 0, 0, 1); 00090 00095 virtual void TickEveryFrame () = 0; 00096 00101 virtual void TickOnce () = 0; 00102 }; 00103 00107 struct iCelPlLayer : public virtual iBase 00108 { 00109 SCF_INTERFACE (iCelPlLayer, 0, 4, 0); 00110 00116 virtual csPtr<iCelEntity> CreateEntity () = 0; 00117 00122 virtual csPtr<iCelEntity> CreateEntityInScope (int scope) = 0; 00123 00129 virtual csPtr<iCelEntity> CreateEntity (uint id) = 0; 00130 00146 virtual csPtr<iCelEntity> CreateEntity (const char* entname, 00147 iCelBlLayer* bl, const char* bhname, ...) = 0; 00148 00154 virtual void RemoveEntity (iCelEntity* entity) = 0; 00155 00159 virtual void RemoveEntities () = 0; 00160 00165 virtual iCelEntityTemplate* CreateEntityTemplate (const char* factname) = 0; 00166 00170 virtual void RemoveEntityTemplate (iCelEntityTemplate* entfact) = 0; 00171 00175 virtual void RemoveEntityTemplates () = 0; 00176 00180 virtual iCelEntityTemplate* FindEntityTemplate (const char* factname) = 0; 00181 00185 virtual size_t GetEntityTemplateCount () const = 0; 00186 00190 virtual iCelEntityTemplate* GetEntityTemplate (size_t idx) const = 0; 00191 00199 virtual iCelEntity* CreateEntity (iCelEntityTemplate* factory, 00200 const char* name, const celEntityTemplateParams& params) = 0; 00201 00211 virtual iCelEntity* CreateEntity (iCelEntityTemplate* factory, 00212 const char* name, ...) = 0; 00213 00220 virtual csPtr<iCelDataBuffer> CreateDataBuffer (long serialnr) = 0; 00221 00227 virtual void AttachEntity (iObject* object, iCelEntity* entity) = 0; 00228 00232 virtual void UnattachEntity (iObject* object, iCelEntity* entity) = 0; 00233 00237 virtual iCelEntity* GetEntity (uint id) = 0; 00238 00242 virtual size_t GetEntityCount () const = 0; 00243 00247 virtual iCelEntity* GetEntityByIndex (size_t idx) const = 0; 00248 00254 virtual iCelEntity* FindEntity (const char* name) = 0; 00255 00260 virtual iCelBehaviour* GetBehaviour (uint id) = 0; 00261 00265 virtual iCelEntity* FindAttachedEntity (iObject* object) = 0; 00266 00272 virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector, 00273 const csVector3& pos, float radius, bool do_invisible = false) = 0; 00274 00280 virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector, 00281 const csBox3& box, bool do_invisible = false) = 0; 00282 00288 virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector, 00289 const csVector3& start, const csVector3& end, 00290 bool do_invisible = false) = 0; 00291 00297 virtual iCelEntity* GetHitEntity (iCamera* camera, int x, int y) = 0; 00298 00302 virtual csPtr<iCelEntityList> CreateEmptyEntityList () = 0; 00303 00308 virtual iCelEntityTracker* CreateEntityTracker (const char* name) = 0; 00309 00313 virtual iCelEntityTracker* FindEntityTracker (const char* name) = 0; 00314 00318 virtual void RemoveEntityTracker (iCelEntityTracker* tracker) = 0; 00319 00327 virtual void SetEntityAddonAllowed (bool allow) = 0; 00328 00332 virtual bool IsEntityAddonAllowed () const = 0; 00333 00334 //------------------------------------------------------------------------- 00335 00341 virtual bool LoadPropertyClassFactory (const char* plugin_id) = 0; 00342 00349 virtual void RegisterPropertyClassFactory (iCelPropertyClassFactory* pf, 00350 const char* altname = 0) = 0; 00351 00355 virtual void UnregisterPropertyClassFactory ( 00356 iCelPropertyClassFactory* pf) = 0; 00357 00361 virtual size_t GetPropertyClassFactoryCount () const = 0; 00362 00366 virtual iCelPropertyClassFactory* GetPropertyClassFactory (size_t idx) 00367 const = 0; 00368 00372 virtual iCelPropertyClassFactory* FindPropertyClassFactory ( 00373 const char* name) const = 0; 00374 00380 virtual iCelPropertyClass* CreatePropertyClass 00381 (iCelEntity* entity, const char* propname) = 0; 00382 00388 virtual iCelPropertyClass* CreateTaggedPropertyClass 00389 (iCelEntity* entity, const char* propname, const char* tagname) = 0; 00390 00391 //------------------------------------------------------------------------- 00392 00396 virtual void RegisterBehaviourLayer (iCelBlLayer* bl) = 0; 00397 00401 virtual void UnregisterBehaviourLayer (iCelBlLayer* bl) = 0; 00402 00406 virtual size_t GetBehaviourLayerCount () const = 0; 00407 00411 virtual iCelBlLayer* GetBehaviourLayer (size_t idx) const = 0; 00412 00416 virtual iCelBlLayer* FindBehaviourLayer (const char* name) const = 0; 00417 00418 //------------------------------------------------------------------------- 00419 00425 virtual void Cache (iBase* object) = 0; 00426 00430 virtual void Uncache (iBase* object) = 0; 00431 00437 virtual void CleanCache () = 0; 00438 00439 //------------------------------------------------------------------------- 00440 00451 virtual csStringID FetchStringID (const char* str) = 0; 00452 00457 virtual const char* FetchString (csStringID id) = 0; 00458 00463 virtual void AddEntityRemoveCallback (iCelEntityRemoveCallback* clback) = 0; 00464 00468 virtual void RemoveEntityRemoveCallback ( 00469 iCelEntityRemoveCallback* clback) = 0; 00470 00475 virtual void AddNewEntityCallback (iCelNewEntityCallback* clback) = 0; 00476 00480 virtual void RemoveNewEntityCallback (iCelNewEntityCallback* clback) = 0; 00481 00482 //------------------------------------------------------------------------- 00483 00497 virtual void CallbackEveryFrame (iCelTimerListener* listener, int where) = 0; 00498 00513 virtual void CallbackOnce (iCelTimerListener* listener, csTicks delta, 00514 int where) = 0; 00515 00519 virtual void RemoveCallbackEveryFrame (iCelTimerListener* listener, 00520 int where) = 0; 00521 00525 virtual void RemoveCallbackOnce (iCelTimerListener* listener, int where) = 0; 00526 00533 virtual int AddScope (csString version, int size) = 0; 00534 00535 /* 00536 * Get a list of all entities with a certain class assigned. 00537 * The list returned is always kept up to date by the physical layer so 00538 * you can save the reference safely and keep using it. 00539 */ 00540 virtual const csRef<iCelEntityList> GetClassEntitiesList ( 00541 csStringID classid) = 0; 00542 00543 /* 00544 * Send a message to all entities in an entity list. Returns the number 00545 * of entities that understood and handled the message. 00546 */ 00547 virtual int SendMessage (iCelEntityList *entlist, const char* msgname, 00548 iCelParameterBlock* params, ...) = 0; 00549 00550 /* 00551 * Send a message to all entities in an entity list. Returns the number 00552 * of entities that understood and handled the message. 00553 */ 00554 virtual int SendMessageV (iCelEntityList *entlist, const char* msgname, 00555 iCelParameterBlock* params, va_list arg) = 0; 00556 }; 00557 00563 struct iCelEntityTracker : public virtual iBase 00564 { 00565 SCF_INTERFACE (iCelEntityTracker, 0, 0, 2); 00566 00570 virtual const char* GetName () const = 0; 00571 00577 virtual bool AddEntity (iCelEntity* entity) = 0; 00578 00582 virtual void RemoveEntity (iCelEntity* entity) = 0; 00583 00587 virtual void RemoveEntities () = 0; 00588 00593 virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector, 00594 const csVector3& pos, float radius) = 0; 00595 00599 virtual csPtr<iCelEntityIterator> GetIterator () = 0; 00600 00604 virtual void AddEntities (iCelEntityTracker* tracker) = 0; 00605 00609 virtual void RemoveEntities (iCelEntityTracker* tracker) = 0; 00610 }; 00611 00612 #endif // __CEL_PL_PL__ 00613
Generated for CEL: Crystal Entity Layer 1.2 by doxygen 1.4.7
