ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
terrain.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  * 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_TERRAIN_H
27 #define SAGA2_TERRAIN_H
28 
29 namespace Saga2 {
30 
31 struct TilePoint;
32 struct TileRegion;
33 
34 // these control the rate of drowning damage
35 // the first two determine the chances of doing damage on a
36 // each screen refresh
37 // the third is the damage done
38 #define kDrowningDamageOddsYes (1)
39 #define kDrowningDamageOddsNo (3)
40 #define kDrowningDamagePerFrame (1)
41 
42 // these control damage taken by falling
43 // the magnatude of the velocity vector is multiplied by the first
44 // then divided by the second.
45 // as it turns out the velocity is a pretty reasonable damage amount
46 
47 #define kFallingDamageMult (2)
48 #define kFallingDamageDiv (1)
49 
50 // these control the rate of lava damage
51 // the first two determine the chances of doing damage on a
52 // each screen refresh
53 // the last two are the damage done (absolute & d6)
54 #define kHeatDamageOddsYes (1)
55 #define kHeatDamageOddsNo (3)
56 #define kHeatDamagePerFrame (1)
57 #define kHeatDamageDicePerFrame (1)
58 
59 // these control the rate of freezing damage
60 // the first two determine the chances of doing damage on a
61 // each screen refresh
62 // the last two are the damage done (absolute & d6)
63 #define kColdDamageOddsYes (1)
64 #define kColdDamageOddsNo (15)
65 #define kColdDamagePerFrame (1)
66 #define kColdDamageDicePerFrame (0)
67 
68 #define kTerrainDamageOddsYes (1)
69 #define kTerrainDamageOddsNo (1)
70 #define kTerrainDamagePerFrame (1)
71 #define kTerrainDamageDicePerFrame (2)
72 
73 /* ===================================================================== *
74  Classes referenced by this header
75  * ===================================================================== */
76 
77 class GameObject;
78 struct StandingTileInfo;
79 
80 /* ===================================================================== *
81  Terrain damage prototypes
82  * ===================================================================== */
83 
84 void drown(GameObject *obj);
85 void fallingDamage(GameObject *obj, int16 speed);
86 void lavaDamage(GameObject *obj);
87 void coldDamage(GameObject *obj);
88 void terrainDamageSlash(GameObject *obj);
89 void terrainDamageBash(GameObject *obj);
90 
91 /* ===================================================================== *
92  other Terrain prototypes
93  * ===================================================================== */
94 
95 
96 
97 // Determine the height of the tile terrain contour
98 #if 0
99 int16 tileSlopeHeight(
100  const TilePoint &pt,
101  GameObject *obj,
102  StandingTileInfo *sti = NULL);
103 #else
104 
105 // We've replaced tileSlopeHeight with a new version that takes
106 // slightly more generalized parameters, and made an inline function
107 // that takes the old-style parameters. Take your pick...
108 
109 // New-style version of tileSlopeHeight
110 int16 tileSlopeHeight(
111  const TilePoint &tileCoords,
112  int16 mapNum,
113  int objectHeight,
114  StandingTileInfo *stiResult = NULL,
115  uint8 *platformResult = NULL);
116 
117 // Old-style version of tileSlopeHeight()
118 int16 tileSlopeHeight(
119  const TilePoint &pt,
120  GameObject *obj,
121  StandingTileInfo *stiResult = NULL,
122  uint8 *platformResult = NULL);
123 
124 // A version which takes the map number explicitly
125 int16 tileSlopeHeight(
126  const TilePoint &pt,
127  int mapNum,
128  GameObject *obj,
129  StandingTileInfo *stiResult = NULL,
130  uint8 *platformResult = NULL);
131 
132 #endif
133 
134 // Query a tile about its terrain
135 uint32 tileTerrain(
136  int16 mapNum,
137  const TilePoint &pt,
138  int16 mask,
139  int16 minZ,
140  int16 maxZ);
141 
142 // Determine the terrain for a given volume
143 uint32 volumeTerrain(int16 mapNum, const TileRegion &volume);
144 
145 uint32 volumeTerrain(
146  int16 mapNum,
147  const TilePoint &pos,
148  int16 objSection,
149  int16 objHeight);
150 
151 uint32 volumeTerrain(
152  int16 mapNum,
153  const TilePoint &pos,
154  int16 uCross,
155  int16 vCross,
156  int16 objHeight);
157 
158 // Determine the terrain between two points
159 uint32 lineTerrain(
160  int16 mapNum,
161  const TilePoint &from,
162  const TilePoint &to,
163  uint32 opaqueTerrain);
164 
165 // return terrain that object is currently interacting with
166 uint32 objectTerrain(GameObject *obj, StandingTileInfo &sti);
167 
168 // return terrain that object is currently interacting with
169 int16 checkBlocked(
170  GameObject *obj,
171  int16 mapNum,
172  const TilePoint &loc,
173  GameObject **blockResultObj = NULL);
174 
175 // return terrain that object is currently interacting with
176 int16 checkBlocked(
177  GameObject *obj,
178  const TilePoint &loc,
179  GameObject **blockResultObj = NULL);
180 
181 int16 checkWalkable(
182  GameObject *obj,
183  const TilePoint &loc,
184  GameObject **blockResultObj = NULL);
185 
186 // return terrain that object is currently interacting with
187 int16 checkContact(
188  GameObject *obj,
189  const TilePoint &loc,
190  GameObject **blockResultObj = NULL);
191 
192 } // end of namespace Saga2
193 
194 #endif
Definition: actor.h:32