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 #include "physicallayer/messaging.h" 00029 00030 struct iObject; 00031 struct iCelEntity; 00032 struct iCelEntityList; 00033 struct iCelEntityIterator; 00034 struct iDataBuffer; 00035 struct iCelDataBuffer; 00036 struct iCelCompactDataBufferWriter; 00037 struct iCelCompactDataBufferReader; 00038 struct iCelParameterBlock; 00039 struct iCelPropertyClass; 00040 struct iCelPropertyClassFactory; 00041 struct iCelBlLayer; 00042 struct iCelBehaviour; 00043 struct iCelEntityTemplate; 00044 struct iCelEntityTemplateIterator; 00045 struct iSector; 00046 struct iCamera; 00047 class csVector3; 00048 class csBox3; 00049 class csString; 00050 00051 #define CEL_EVENT_PRE 0 00052 #define CEL_EVENT_VIEW 1 00053 #define CEL_EVENT_POST 2 00054 00055 #define CEL_PROPCLASS_END (void*)0 00056 #define CEL_PARAM_END (void*)0 00057 00058 struct iCelEntityTracker; 00059 00064 struct iCelNewEntityCallback : public virtual iBase 00065 { 00066 SCF_INTERFACE (iCelNewEntityCallback, 0, 0, 2); 00067 00069 virtual void NewEntity (iCelEntity* entity) = 0; 00070 }; 00071 00076 struct iCelEntityRemoveCallback : public virtual iBase 00077 { 00078 SCF_INTERFACE (iCelEntityRemoveCallback, 0, 0, 2); 00079 00081 virtual void RemoveEntity (iCelEntity* entity) = 0; 00082 }; 00083 00084 00089 struct iCelTimerListener : public virtual iBase 00090 { 00091 SCF_INTERFACE (iCelTimerListener, 0, 0, 2); 00092 00097 virtual void TickEveryFrame () = 0; 00098 00103 virtual void TickOnce () = 0; 00104 }; 00105 00112 struct iCallable : public virtual iBase 00113 { 00114 SCF_INTERFACE (iCallable, 0, 0, 1); 00115 00116 virtual void Call () = 0; 00117 }; 00118 00122 struct iCelPlLayer : public virtual iBase 00123 { 00124 SCF_INTERFACE (iCelPlLayer, 0, 4, 2); 00125 00131 virtual csPtr<iCelEntity> CreateEntity () = 0; 00132 00137 virtual csPtr<iCelEntity> CreateEntityInScope (int scope) = 0; 00138 00144 virtual csPtr<iCelEntity> CreateEntity (uint id) = 0; 00145 00161 virtual csPtr<iCelEntity> CreateEntity (const char* entname, 00162 iCelBlLayer* bl, const char* bhname, ...) = 0; 00163 00169 virtual void RemoveEntity (iCelEntity* entity) = 0; 00170 00174 virtual void RemoveEntities () = 0; 00175 00180 virtual iCelEntityTemplate* CreateEntityTemplate (const char* factname) = 0; 00181 00185 virtual void RemoveEntityTemplate (iCelEntityTemplate* entfact) = 0; 00186 00190 virtual void RemoveEntityTemplates () = 0; 00191 00195 virtual iCelEntityTemplate* FindEntityTemplate (const char* factname) = 0; 00196 00200 virtual csPtr<iCelEntityTemplateIterator> GetEntityTemplates () const = 0; 00201 00208 virtual iCelEntity* CreateEntity (iCelEntityTemplate* factory, 00209 const char* name, iCelParameterBlock* params) = 0; 00210 00220 virtual iCelEntity* CreateEntity (iCelEntityTemplate* factory, 00221 const char* name, ...) = 0; 00222 00227 virtual bool ApplyTemplate (iCelEntity* entity, iCelEntityTemplate* factory, 00228 iCelParameterBlock* params) = 0; 00229 00236 virtual csPtr<iCelDataBuffer> CreateDataBuffer (long serialnr) = 0; 00237 00242 virtual csPtr<iCelCompactDataBufferWriter> CreateCompactDataBufferWriter () = 0; 00243 00247 virtual csPtr<iCelCompactDataBufferReader> CreateCompactDataBufferReader ( 00248 iDataBuffer* buf) = 0; 00249 00255 virtual void AttachEntity (iObject* object, iCelEntity* entity) = 0; 00256 00260 virtual void UnattachEntity (iObject* object, iCelEntity* entity) = 0; 00261 00265 virtual iCelEntity* GetEntity (uint id) = 0; 00266 00270 virtual size_t GetEntityCount () const = 0; 00271 00275 virtual iCelEntity* GetEntityByIndex (size_t idx) const = 0; 00276 00282 virtual iCelEntity* FindEntity (const char* name) = 0; 00283 00288 virtual iCelBehaviour* GetBehaviour (uint id) = 0; 00289 00293 virtual iCelEntity* FindAttachedEntity (iObject* object) = 0; 00294 00302 virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector, 00303 const csVector3& pos, float radius, bool do_invisible = false, 00304 csStringID cls = csInvalidStringID) = 0; 00305 00313 virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector, 00314 const csBox3& box, bool do_invisible = false, 00315 csStringID cls = csInvalidStringID) = 0; 00316 00324 virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector, 00325 const csVector3& start, const csVector3& end, 00326 bool do_invisible = false, 00327 csStringID cls = csInvalidStringID) = 0; 00328 00334 virtual iCelEntity* GetHitEntity (iCamera* camera, int x, int y) = 0; 00335 00339 virtual csPtr<iCelEntityList> CreateEmptyEntityList () = 0; 00340 00345 virtual iCelEntityTracker* CreateEntityTracker (const char* name) = 0; 00346 00350 virtual iCelEntityTracker* FindEntityTracker (const char* name) = 0; 00351 00355 virtual void RemoveEntityTracker (iCelEntityTracker* tracker) = 0; 00356 00364 virtual void SetEntityAddonAllowed (bool allow) = 0; 00365 00369 virtual bool IsEntityAddonAllowed () const = 0; 00370 00371 //------------------------------------------------------------------------- 00372 00378 virtual bool LoadPropertyClassFactory (const char* plugin_id) = 0; 00379 00386 virtual void RegisterPropertyClassFactory (iCelPropertyClassFactory* pf, 00387 const char* altname = 0) = 0; 00388 00392 virtual void UnregisterPropertyClassFactory ( 00393 iCelPropertyClassFactory* pf) = 0; 00394 00398 virtual size_t GetPropertyClassFactoryCount () const = 0; 00399 00403 virtual iCelPropertyClassFactory* GetPropertyClassFactory (size_t idx) 00404 const = 0; 00405 00409 virtual iCelPropertyClassFactory* FindPropertyClassFactory ( 00410 const char* name) const = 0; 00411 00417 virtual iCelPropertyClass* CreatePropertyClass (iCelEntity* entity, 00418 const char* propname, const char* tagname = 0) = 0; 00419 00425 virtual iCelPropertyClass* CreateTaggedPropertyClass 00426 (iCelEntity* entity, const char* propname, const char* tagname) = 0; 00427 00428 //------------------------------------------------------------------------- 00429 00433 virtual void RegisterBehaviourLayer (iCelBlLayer* bl) = 0; 00434 00438 virtual void UnregisterBehaviourLayer (iCelBlLayer* bl) = 0; 00439 00443 virtual size_t GetBehaviourLayerCount () const = 0; 00444 00448 virtual iCelBlLayer* GetBehaviourLayer (size_t idx) const = 0; 00449 00453 virtual iCelBlLayer* FindBehaviourLayer (const char* name) const = 0; 00454 00455 //------------------------------------------------------------------------- 00456 00462 virtual void Cache (iBase* object) = 0; 00463 00467 virtual void Uncache (iBase* object) = 0; 00468 00474 virtual void CleanCache () = 0; 00475 00476 //------------------------------------------------------------------------- 00477 00483 virtual csStringID FetchStringID (const char* str) = 0; 00484 00489 virtual const char* FetchString (csStringID id) = 0; 00490 00495 virtual void AddEntityRemoveCallback (iCelEntityRemoveCallback* clback) = 0; 00496 00500 virtual void RemoveEntityRemoveCallback ( 00501 iCelEntityRemoveCallback* clback) = 0; 00502 00507 virtual void AddNewEntityCallback (iCelNewEntityCallback* clback) = 0; 00508 00512 virtual void RemoveNewEntityCallback (iCelNewEntityCallback* clback) = 0; 00513 00514 //------------------------------------------------------------------------- 00515 00529 virtual void CallbackEveryFrame (iCelTimerListener* listener, int where) = 0; 00530 00545 virtual void CallbackOnce (iCelTimerListener* listener, csTicks delta, 00546 int where) = 0; 00547 00551 virtual void RemoveCallbackEveryFrame (iCelTimerListener* listener, 00552 int where) = 0; 00553 00557 virtual void RemoveCallbackOnce (iCelTimerListener* listener, int where) = 0; 00558 00563 virtual csTicks GetTicksLeft (iCelTimerListener* listener, int where) = 0; 00564 00569 virtual void CallLater (iCallable* callable) = 0; 00570 00577 virtual size_t AddScope (csString version, int size) = 0; 00578 00583 virtual void ResetScope (size_t scope_idx) = 0; 00584 00585 /* 00586 * Get a list of all entities with a certain class assigned. 00587 * The list returned is always kept up to date by the physical layer so 00588 * you can save the reference safely and keep using it. 00589 */ 00590 virtual const csRef<iCelEntityList> GetClassEntitiesList ( 00591 csStringID classid) = 0; 00592 00593 /* 00594 * Send a message to all entities in an entity list. Returns the number 00595 * of entities that understood and handled the message. 00596 * Note that this version of SendMessage only sends a message to the 00597 * behaviour of the entity and not the channel. Use the new messaging 00598 * system for sending a message to the channel. 00599 * \deprecated Use SendMessage() for new message system instead. 00600 */ 00601 CS_DEPRECATED_METHOD_MSG("Use SendMessage() for new message system instead.") 00602 virtual int SendMessage (iCelEntityList *entlist, const char* msgname, 00603 iCelParameterBlock* params, ...) = 0; 00604 00605 /* 00606 * Send a message to all entities in an entity list. Returns the number 00607 * of entities that understood and handled the message. 00608 * Note that this version of SendMessage only sends a message to the 00609 * behaviour of the entity and not the channel. Use the new messaging 00610 * system for sending a message to the channel. 00611 * \deprecated Use SendMessage() for new message system instead. 00612 */ 00613 CS_DEPRECATED_METHOD_MSG("Use SendMessage() for new message system instead.") 00614 virtual int SendMessageV (iCelEntityList *entlist, const char* msgname, 00615 iCelParameterBlock* params, va_list arg) = 0; 00616 00617 /* 00618 * Send a message to all entities in an entity list. Returns the number 00619 * of entities that understood and handled the message. 00620 * Note that this version of SendMessage() sends a message to the channel 00621 * of the entity only and not the behaviour (unless the behaviour also 00622 * happens to subscribe to the channel). 00623 * \param msgid is the message ID. 00624 * \param sender is the sender from this message. 00625 * \param params contains the parameters for this message. 00626 * \param ret if this is not 0 then it can be used to collect information 00627 * from the receivers. If 0 then information from the receivers is simply 00628 * ignored. 00629 */ 00630 virtual int SendMessage (csStringID msgid, iMessageSender* sender, 00631 iCelEntityList *entlist, iCelParameterBlock* params, 00632 iCelDataArray* ret = 0) = 0; 00633 00638 virtual iMessageSender* QueryMessageSender () = 0; 00639 }; 00640 00646 struct iCelEntityTracker : public virtual iBase 00647 { 00648 SCF_INTERFACE (iCelEntityTracker, 0, 0, 3); 00649 00653 virtual const char* GetName () const = 0; 00654 00660 virtual bool AddEntity (iCelEntity* entity) = 0; 00661 00665 virtual void RemoveEntity (iCelEntity* entity) = 0; 00666 00670 virtual void RemoveEntities () = 0; 00671 00678 virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector, 00679 const csVector3& pos, float radius, 00680 csStringID cls = csInvalidStringID) = 0; 00681 00685 virtual csPtr<iCelEntityIterator> GetIterator () = 0; 00686 00690 virtual void AddEntities (iCelEntityTracker* tracker) = 0; 00691 00695 virtual void RemoveEntities (iCelEntityTracker* tracker) = 0; 00696 }; 00697 00698 #endif // __CEL_PL_PL__ 00699
Generated for CEL: Crystal Entity Layer 2.1 by doxygen 1.6.1
