ScummVM API documentation
TileData.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_TILEDATA_H
29 #define HPL_TILEDATA_H
30 
31 #include "hpl1/engine/graphics/Graphics.h"
32 #include "hpl1/engine/graphics/GraphicsTypes.h"
33 #include "hpl1/engine/graphics/Material.h"
34 #include "hpl1/engine/graphics/Mesh2d.h"
35 #include "hpl1/engine/resources/ImageManager.h"
36 #include "hpl1/engine/resources/ResourceImage.h"
37 
38 namespace hpl {
39 
40 enum eTileCollisionType {
41  eTileCollisionType_None,
42  eTileCollisionType_Normal,
43  eTileCollisionType_OnlyDown,
44  eTileCollisionType_LastEnum
45 };
46 
47 enum eTileDataType {
48  eTileDataType_Normal,
49  eTileDataType_LastEnum
50 };
51 
53 class iTileData {
54 public:
55  virtual ~iTileData() {}
56 
57  virtual void Destroy() = 0;
58  virtual bool IsSolid() = 0;
59  virtual eTileDataType GetType() = 0;
60 
61  /*virtual tVertexVec GetVertexVec(const cVector3f &avPos, const cVector2f &avSize,
62  unsigned char acAngle)=0;*/
63 };
64 
66 
67 class cTileDataNormal : public iTileData {
68 public:
69  cTileDataNormal(cImageManager *apImageManager, cVector2f avTileSize);
70  ~cTileDataNormal();
71 
72  void Destroy();
73  bool IsSolid() { return mbIsSolid; }
74  void SetIsSolid(bool abIsSolid) { mbIsSolid = abIsSolid; }
75 
76  eTileCollisionType GetCollisionType() { return mCollisionType; }
77  void SetCollisionType(eTileCollisionType aCollisionType) { mCollisionType = aCollisionType; }
78 
79  eTileDataType GetType() { return eTileDataType_Normal; }
80  tVertexVec *GetVertexVec(eTileRotation aRotation);
81  tUIntVec *GetIndexVec(eTileRotation aRotation);
82 
83  tVertexVec *GetCollideVertexVec(eTileRotation aRotation);
84  tUIntVec *GetCollideIndexVec(eTileRotation aRotation);
85 
86  iMaterial *GetMaterial() { return mpMaterial; }
87 
88  cMesh2D *GetMesh() { return mpMesh; }
89 
90  void SetData(cMesh2D *apMesh, iMaterial *apMaterial);
91 
92  cMesh2D *GetCollideMesh();
93  void SetCollideMesh(cMesh2D *apCollideMesh);
94 
95 private:
96  cImageManager *mpImageManager;
97 
98  tResourceImageVec mvImage;
99  iMaterial *mpMaterial;
100  tVertexVec *mvVtx[eTileRotation_LastEnum];
101  tVertexVec *mvCollideVtx[eTileRotation_LastEnum];
102  tUIntVec *mvIdx;
103  tUIntVec *mvCollideIdx;
104  cMesh2D *mpMesh;
105  cVector2f mvTileSize;
106  bool mbIsSolid;
107  eTileCollisionType mCollisionType;
108 
109  cMesh2D *mpCollideMesh;
110 
111  void SetMesh(cMesh2D *apMesh);
112  void SetMaterial(iMaterial *apMaterial);
113 };
114 
115 } // namespace hpl
116 #endif // HPL_TILEDATA_H
Definition: AI.h:36
Definition: TileData.h:67
Definition: TileData.h:53
Definition: Mesh2d.h:68
Definition: ImageManager.h:48
Definition: Material.h:203