tools/rewards.h
00001 /* 00002 Crystal Space Entity Layer 00003 Copyright (C) 2004-2006 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_REWARDS__ 00021 #define __CEL_REWARDS__ 00022 00023 #include "behaviourlayer/behave.h" 00024 #include "iutil/document.h" 00025 #include "tools/parameters.h" 00026 #include "tools/sequences.h" 00027 00028 //------------------------------------------------------------------------- 00029 // Rewards 00030 //------------------------------------------------------------------------- 00031 00037 struct iReward : public virtual iBase 00038 { 00039 SCF_INTERFACE (iReward, 0, 0, 1); 00043 virtual void Reward (iCelParameterBlock* params) = 0; 00044 }; 00045 00050 struct iRewardFactory : public virtual iBase 00051 { 00052 SCF_INTERFACE (iRewardFactory, 0, 0, 1); 00053 00060 virtual csPtr<iReward> CreateReward (const celParams& params) = 0; 00061 00067 virtual bool Load (iDocumentNode* node) = 0; 00068 }; 00069 00077 struct iRewardType : public virtual iBase 00078 { 00079 SCF_INTERFACE (iRewardType, 0, 0, 1); 00080 00084 virtual const char* GetName () const = 0; 00085 00089 virtual csPtr<iRewardFactory> CreateRewardFactory () = 0; 00090 }; 00091 00092 00093 //------------------------------------------------------------------------- 00094 // Specific reward implementations. 00095 //------------------------------------------------------------------------- 00096 00115 struct iActionRewardFactory : public virtual iBase 00116 { 00117 SCF_INTERFACE (iActionRewardFactory, 0, 0, 1); 00118 00124 virtual void SetEntityParameter (const char* entity) = 0; 00125 00131 virtual void SetClassParameter (const char* ent_class) = 0; 00132 00137 virtual void SetIDParameter (const char* id) = 0; 00138 00144 virtual void SetPropertyClassParameter (const char* propertyclass) = 0; 00145 00151 virtual void SetTagParameter (const char* tag) = 0; 00152 00161 virtual void AddParameter (celDataType type, csStringID id, 00162 const char* name, const char* value) = 0; 00163 }; 00164 00192 struct iChangePropertyRewardFactory : public virtual iBase 00193 { 00194 SCF_INTERFACE (iChangePropertyRewardFactory, 0, 0, 1); 00195 00202 virtual void SetEntityParameter (const char* entity) = 0; 00203 00210 virtual void SetClassParameter (const char* ent_class) = 0; 00211 00221 virtual void SetPCParameter (const char* pc, const char* tag) = 0; 00222 00228 virtual void SetPropertyParameter (const char* prop) = 0; 00229 00234 virtual void SetStringParameter (const char* pstring) = 0; 00235 00240 virtual void SetLongParameter (const char* plong) = 0; 00241 00246 virtual void SetFloatParameter (const char* pfloat) = 0; 00247 00252 virtual void SetBoolParameter (const char* pbool) = 0; 00253 00258 virtual void SetDiffParameter (const char* pdiff) = 0; 00259 00263 virtual void SetToggle () = 0; 00264 }; 00265 00286 struct iCreateEntityRewardFactory : public virtual iBase 00287 { 00288 SCF_INTERFACE (iCreateEntityRewardFactory, 0, 0, 1); 00289 00296 virtual void SetEntityTemplateParameter (const char* entity_tpl) = 0; 00297 00303 virtual void SetNameParameter (const char* name) = 0; 00304 00311 virtual void AddParameter (const char* name, const char* value) = 0; 00312 }; 00313 00328 struct iDestroyEntityRewardFactory : public virtual iBase 00329 { 00330 SCF_INTERFACE (iDestroyEntityRewardFactory, 0, 0, 1); 00331 00337 virtual void SetEntityParameter (const char* entity) = 0; 00338 00344 virtual void SetClassParameter (const char* ent_class) = 0; 00345 00346 00347 }; 00348 00361 struct iDebugPrintRewardFactory : public virtual iBase 00362 { 00363 SCF_INTERFACE (iDebugPrintRewardFactory, 0, 0, 1); 00364 00369 virtual void SetMessageParameter (const char* msg) = 0; 00370 }; 00371 00391 struct iInventoryRewardFactory : public virtual iBase 00392 { 00393 SCF_INTERFACE (iInventoryRewardFactory, 0, 0, 1); 00394 00403 virtual void SetEntityParameter (const char* entity, const char* tag = 0) = 0; 00404 00410 virtual void SetChildEntityParameter (const char* entity, 00411 const char* tag = 0) = 0; 00412 }; 00413 00430 struct iMessageRewardFactory : public virtual iBase 00431 { 00432 SCF_INTERFACE (iMessageRewardFactory, 0, 0, 1); 00433 00439 virtual void SetEntityParameter (const char* entity) = 0; 00440 00446 virtual void SetClassParameter (const char* ent_class) = 0; 00447 00452 virtual void SetIDParameter (const char* id) = 0; 00453 00462 virtual void AddParameter (celDataType type, csStringID id, 00463 const char* name, const char* value) = 0; 00464 }; 00465 00479 struct iCsSequenceRewardFactory : public virtual iBase 00480 { 00481 SCF_INTERFACE (iCsSequenceRewardFactory, 0, 0, 1); 00482 00488 virtual void SetSequenceParameter (const char* sequence) = 0; 00489 00494 virtual void SetDelayParameter (const char* delay) = 0; 00495 }; 00496 00516 struct iSequenceRewardFactory : public virtual iBase 00517 { 00518 SCF_INTERFACE (iSequenceRewardFactory, 0, 0, 1); 00519 00528 virtual void SetEntityParameter (const char* entity, const char* tag = 0) = 0; 00529 00535 virtual void SetTagParameter (const char* tag_par) = 0; 00536 00543 virtual void SetClassParameter (const char* ent_class) = 0; 00544 00552 virtual void SetSequenceParameter (const char* sequence) = 0; 00553 00559 virtual void SetSequence (iCelSequence* sequence) = 0; 00560 00565 virtual void SetDelayParameter (const char* delay) = 0; 00566 }; 00567 00586 struct iSequenceFinishRewardFactory : public virtual iBase 00587 { 00588 SCF_INTERFACE (iSequenceFinishRewardFactory, 0, 0, 1); 00589 00598 virtual void SetEntityParameter (const char* entity, const char* tag = 0) = 0; 00599 00605 virtual void SetTagParameter (const char* tag_par) = 0; 00606 00613 virtual void SetClassParameter (const char* ent_class) = 0; 00614 00622 virtual void SetSequenceParameter (const char* sequence) = 0; 00623 00629 virtual void SetSequence (iCelSequence* sequence) = 0; 00630 }; 00631 00632 //------------------------------------------------------------------------- 00633 00637 #define CEL_DECLARE_REWARDTYPE(name,id) \ 00638 class cel##name##RewardType : public scfImplementation2< \ 00639 cel##name##RewardType,iRewardType, iComponent> \ 00640 { \ 00641 public: \ 00642 iObjectRegistry* object_reg; \ 00643 csWeakRef<iCelPlLayer> pl; \ 00644 cel##name##RewardType (iBase* parent); \ 00645 virtual ~cel##name##RewardType () { } \ 00646 virtual bool Initialize (iObjectRegistry*); \ 00647 virtual const char* GetName () const { return id; } \ 00648 virtual csPtr<iRewardFactory> CreateRewardFactory (); \ 00649 }; 00650 00654 #define CEL_IMPLEMENT_REWARDTYPE(name) \ 00655 cel##name##RewardType::cel##name##RewardType ( \ 00656 iBase* parent) : scfImplementationType (this, parent), \ 00657 object_reg(0) \ 00658 { \ 00659 } \ 00660 bool cel##name##RewardType::Initialize ( \ 00661 iObjectRegistry* object_reg) \ 00662 { \ 00663 cel##name##RewardType::object_reg = object_reg; \ 00664 pl = csQueryRegistry<iCelPlLayer> (object_reg); \ 00665 return true; \ 00666 } \ 00667 csPtr<iRewardFactory> cel##name##RewardType::CreateRewardFactory ()\ 00668 { \ 00669 cel##name##RewardFactory* fact = new \ 00670 cel##name##RewardFactory (this); \ 00671 return fact; \ 00672 } 00673 00674 #endif // __CEL_REWARDS__
Generated for CEL: Crystal Entity Layer 2.0 by doxygen 1.6.1
