ScummVM API documentation
mapfeatr.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  * aint32 with this program; if not, write to the Free Software
19  *
20  *
21  * Based on the original sources
22  * Faery Tale II -- The Halls of the Dead
23  * (c) 1993-1996 The Wyrmkeep Entertainment Co.
24  */
25 
26 #ifndef SAGA2_MAPFEATR_H
27 #define SAGA2_MAPFEATR_H
28 
29 #include "saga2/rect.h"
30 #include "saga2/tcoords.h"
31 
32 namespace Saga2 {
33 
34 class gPort;
35 class gPixelMap;
36 
37 #define MAX_MAP_FEATURE_NAME_LENGTH 32
38 
39 /* ===================================================================== *
40  Types
41  * ===================================================================== */
42 
43 // ------------------------------------------------------------------------
44 // Pure virtual base class for map features
45 
46 class CMapFeature {
47  bool _visible;
48  int16 _world;
49  TilePoint _featureCoords;
50  char _name[MAX_MAP_FEATURE_NAME_LENGTH];
51 
52 
53 public:
54  CMapFeature(TilePoint where, int16 inWorld, const char *desc);
55  virtual ~CMapFeature() {}
56 
57  void expose(bool canSee = true) {
58  _visible = canSee;
59  }
60  void draw(TileRegion tr, int16 inWorld, TilePoint bc, gPort &tport);
61  bool hitCheck(TileRegion vr, int16 inWorld, TilePoint bc, TilePoint cp);
62  int16 getWorld() {
63  return _world;
64  }
65  int16 getU() {
66  return _featureCoords.u;
67  }
68  int16 getV() {
69  return _featureCoords.v;
70  }
71  TilePoint getLocation() {
72  return _featureCoords;
73  }
74  char *getText() {
75  return _name;
76  }
77 
78  // The only aspect of different map features is what they look like
79  virtual void blit(gPort &tp, int32 x, int32 y) = 0;
80  virtual bool isHit(TilePoint disp, TilePoint mouse) = 0;
81  virtual void update() = 0;
82 };
83 
84 
85 typedef CMapFeature *pCMapFeature;
86 
87 // ------------------------------------------------------------------------
88 // class for map features with static icons
89 
91  int16 _color;
92 
93 public:
94  CStaticMapFeature(TilePoint where, int16 inWorld, const char *desc, int16 bColor);
95  virtual void blit(gPort &tp, int32 x, int32 y);
96  virtual void update() {}
97  virtual bool isHit(TilePoint disp, TilePoint mouse);
98 };
99 
100 
101 // ------------------------------------------------------------------------
102 // class for map features with static icons
103 
105  gPixelMap *_pic;
106 
107 public:
108  CPictureMapFeature(TilePoint where, int16 inWorld, char *desc, gPixelMap *pm);
109  virtual void blit(gPort &tp, int32 x, int32 y);
110  virtual void update() {}
111  virtual bool isHit(TilePoint disp, TilePoint mouse) {
112  return false;
113  }
114 };
115 
116 
117 /* ===================================================================== *
118  Prototypes
119  * ===================================================================== */
120 
121 void initMapFeatures() ;
122 void updateMapFeatures(int16 currentWorld);
123 void drawMapFeatures(TileRegion viewRegion,
124  int16 world,
125  TilePoint baseCoords,
126  gPort &tPort);
127 void termMapFeatures() ;
128 char *getMapFeaturesText(TileRegion viewRegion,
129  int16 inWorld,
130  TilePoint baseCoords,
131  Point16 mouseCoords) ;
132 
133 } // end of namespace Saga2
134 
135 #endif
Definition: actor.h:32
Definition: gdraw.h:56
Definition: gdraw.h:178
Definition: tcoords.h:127
Definition: tcoords.h:222
Definition: rect.h:42
Definition: mapfeatr.h:46
Definition: mapfeatr.h:104
Definition: mapfeatr.h:90