ScummVM API documentation
Entity.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_ENTITY_H
29 #define HPL_ENTITY_H
30 
31 #include "hpl1/engine/game/SaveGame.h"
32 #include "hpl1/engine/math/MathTypes.h"
33 #include "hpl1/engine/system/SystemTypes.h"
34 
35 namespace hpl {
36 
37 class iNode;
38 
39 //------------------------------------
40 
41 kSaveData_BaseClass(iEntity) {
42  kSaveData_ClassInit(iEntity) public : int mlParentNodeId;
43  tString msName;
44  bool mbIsVisible;
45  bool mbIsActive;
46 };
47 
48 //------------------------------------
49 
50 class iEntity : public iSaveObject {
51  typedef iSaveObject super;
52 
53 public:
54  iEntity(tString asName) : msName(asName), mbIsVisible(true),
55  mbIsActive(true), mpParentNode(NULL) {}
56 
57  virtual ~iEntity();
58 
59  virtual tString GetEntityType() = 0;
60 
61  virtual void UpdateLogic(float afTimeStep) {}
62 
63  tString &GetName() { return msName; }
64  void SetName(const tString &asName) { msName = asName; }
65 
66  iNode *GetParent() { return mpParentNode; }
67  void SetParent(iNode *apNode) { mpParentNode = apNode; }
68  bool HasParent() { return mpParentNode != NULL; }
69 
70  bool IsActive() { return mbIsActive; }
71  void SetActive(bool abActive) { mbIsActive = abActive; }
72  virtual bool IsVisible() { return mbIsVisible; }
73  virtual void SetVisible(bool abVisible) { mbIsVisible = abVisible; }
74 
75  // SaveObject implementation
76  virtual iSaveData *CreateSaveData();
77  virtual void SaveToSaveData(iSaveData *apSaveData);
78  virtual void LoadFromSaveData(iSaveData *apSaveData);
79  virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame);
80 
81 protected:
82  iNode *mpParentNode;
83 
84  tString msName;
85  bool mbIsVisible;
86  bool mbIsActive;
87 };
88 
91 
93 
94 } // namespace hpl
95 
96 #endif // HPL_ENTITY2D_H
Definition: AI.h:36
Definition: Game.h:91
Definition: str.h:59
virtual iSaveData * CreateSaveData()
Definition: SaveGame.h:130
Definition: SystemTypes.h:411
Definition: Node.h:55
Definition: SaveGame.h:111
virtual void LoadFromSaveData(iSaveData *apSaveData)
virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame)
Definition: list_intern.h:51
Definition: SaveGame.h:183
Definition: Entity.h:50
virtual void SaveToSaveData(iSaveData *apSaveData)