ScummVM API documentation
ImageEntityData.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_IMAGE_ENTITY_DATA_H
29 #define HPL_IMAGE_ENTITY_DATA_H
30 
31 #include "hpl1/engine/graphics/GraphicsTypes.h"
32 #include "hpl1/engine/math/MathTypes.h"
33 #include "hpl1/engine/resources/ResourceBase.h"
34 #include "hpl1/engine/system/SystemTypes.h"
35 #include "common/stablemap.h"
36 
37 class TiXmlElement;
38 
39 namespace hpl {
40 
41 #define kMaxImageEntityFrameWidth (1024)
42 
43 class cResources;
44 class cGraphics;
45 class iMaterial;
46 class cMesh2D;
47 
48 class cImageFrame {
49 public:
50  iMaterial *mpMaterial;
51  tVertexVec mvVtx;
52 };
53 
55 typedef tImageFrameVec::iterator tImageFrameVecIt;
56 
58 public:
59  tString msName;
60  int mlHandle;
61  float mfSpeed;
62  tIntVec mvFrameNums;
63  bool mbCollidable;
64  tString msSound;
65 };
66 
68 typedef tImageAnimationMap::iterator tImageAnimationMapIt;
69 
71 public:
72  cImageEntityData(tString asName, cGraphics *apGraphics, cResources *apResources);
74 
75  // resource stuff:
76  bool reload() { return false; }
77  void unload() {}
78  void destroy() {}
79 
80  bool CreateFromFile(const tString &asFile, tIntVec &avImageHandle);
81 
82  cImageFrame *GetImageFrame(int alFrame);
83  tUIntVec *GetIndexVec() { return &mvIdxVec; }
84 
85  int GetFrameNum() { return mlFrameNum; }
86  cImageAnimation *GetAnimationByName(const tString &asName);
87  cImageAnimation *GetAnimationByHandle(int alHandle);
88  int GetAnimationNum() { return (int)m_mapAnimations.size(); }
89  tImageAnimationMap *GetAnimationMap() { return &m_mapAnimations; }
90 
91  const tString &GetType() { return msType; }
92  const tString &GetSubType() { return msSubType; }
93  const tString &GetDataName() { return msDataName; }
94 
95  cVector2f GetImageSize() { return mvImageSize; }
96 
97  cMesh2D *GetCollideMesh() { return mpCollideMesh; }
98 
99  bool IsCollidable() { return mbCollidable; }
100  bool GetCollides() { return mbCollides; }
101  bool GetCastShadows() { return mbCastShadows; }
102 
103 private:
104  int mlFrameNum;
105  cResources *mpResources;
106  cGraphics *mpGraphics;
107  cVector2l mvFrameSize;
108  cMesh2D *mpMesh;
109  cMesh2D *mpCollideMesh;
110  tUIntVec mvIdxVec;
111  cVector2f mvImageSize;
112 
113  tString msDataName;
114  tString msType;
115  tString msSubType;
116 
117  bool mbCastShadows;
118  bool mbCollidable;
119  bool mbCollides;
120  bool mbLit;
121 
122  tImageFrameVec mvImageFrames;
123  tImageAnimationMap m_mapAnimations;
124 
125  void GetFrameNum(TiXmlElement *apElement);
126 };
127 
128 } // namespace hpl
129 
130 #endif // HPL_IMAGE_ENTITY_DATA_H
Definition: AI.h:36
Definition: str.h:59
Definition: ResourceBase.h:36
Definition: ImageEntityData.h:57
cImageFrame * iterator
Definition: array.h:54
void destroy()
Definition: ImageEntityData.h:78
typename TreeT::BasicIterator iterator
Definition: stablemap.h:48
Definition: ImageEntityData.h:70
Definition: Mesh2d.h:68
void unload()
Definition: ImageEntityData.h:77
bool reload()
Definition: ImageEntityData.h:76
Definition: Resources.h:160
Definition: tinyxml.h:864
Definition: ImageEntityData.h:48
Definition: Material.h:203
Definition: Graphics.h:46