-
Notifications
You must be signed in to change notification settings - Fork 0
/
Terrain.cpp
186 lines (181 loc) · 3.41 KB
/
Terrain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
* Terrain.cpp
* TractionEdge
*
* Created by Steven Hamilton on 5/08/09.
* Copyright 2009 scorch.org. All rights reserved.
*
*/
#include "defines.h"
#include "Terrain.h"
#include <iostream>
Terrain::Terrain()
{
}
Terrain::~Terrain()
{
}
Terrain::Terrain(int terrainType)
{
wasVisible=false;
isVisible=false;
switch (terrainType) {
case BLANK_S:
name="BLANK";
moveCost=0;
height=0;
totalHitPoints=10;
currentHitPoints=totalHitPoints;
gfxId=BLANK_S;
isPassable=true;
isTranslucent=true;
deadTerrain=BLANK_S;
break;
case GRASS_S:
name="Grass";
moveCost=1;
height=0;
totalHitPoints=10;
currentHitPoints=totalHitPoints;
gfxId=GRASS_S;
isPassable=true;
isTranslucent=true;
deadTerrain=GRASS_S;
break;
case STONE_WALL_S:
name="Stone Wall";
moveCost=0;
height=2;
totalHitPoints=50;
currentHitPoints=totalHitPoints;
gfxId=STONE_WALL_S;
isPassable=false;
isTranslucent=false;
deadTerrain=RUBBLE_S;
break;
case RUBBLE_S:
moveCost=3;
name="Rubble";
height=1;
totalHitPoints=10;
currentHitPoints=totalHitPoints;
gfxId=RUBBLE_S;
isPassable=true;
isTranslucent=true;
deadTerrain=COBBLES_S;
break;
case WATER_S:
name="Water";
moveCost=5;
height=0;
totalHitPoints=0;
currentHitPoints=totalHitPoints;
gfxId=WATER_S;
isPassable=true;
isTranslucent=true;
deadTerrain=WATER_S;
break;
case COBBLES_S:
name="Cobbles";
moveCost=1;
height=0;
totalHitPoints=0;
currentHitPoints=totalHitPoints;
gfxId=COBBLES_S;
isPassable=true;
isTranslucent=true;
deadTerrain=COBBLES_S;
break;
case DIRT_S:
name="Dirt";
moveCost=1;
height=0;
totalHitPoints=10;
currentHitPoints=totalHitPoints;
gfxId=DIRT_S;
isPassable=true;
isTranslucent=true;
deadTerrain=DIRT_S;
break;
case FENCE_S:
name="Fence";
moveCost=10;
height=1;
totalHitPoints=5;
currentHitPoints=totalHitPoints;
gfxId=FENCE_S;
isPassable=true;
isTranslucent=true;
deadTerrain=GRASS_S;
break;
case TREE_S:
name="Tree";
moveCost=0;
height=2;
totalHitPoints=30;
currentHitPoints=totalHitPoints;
gfxId=TREE_S;
isPassable=false;
isTranslucent=false;
deadTerrain=GRASS_S;
break;
case DOOR_S:
name="Door";
moveCost=20;
height=2;
totalHitPoints=15;
currentHitPoints=totalHitPoints;
gfxId=DOOR_S;
isPassable=false;
isTranslucent=false;
deadTerrain=COBBLES_S;
break;
case WINDOW_S:
name="Window";
moveCost=20;
height=2;
totalHitPoints=5;
currentHitPoints=totalHitPoints;
gfxId=WINDOW_S;
isPassable=false;
isTranslucent=true;
deadTerrain=RUBBLE_S;
break;
case LOWWALL_S:
name="Low Wall";
moveCost=6;
height=1;
totalHitPoints=10;
currentHitPoints=totalHitPoints;
gfxId=LOWWALL_S;
isPassable=true;
isTranslucent=true;
deadTerrain=RUBBLE_S;
break;
case STATUE_S:
name="Statue";
moveCost=20;
height=2;
totalHitPoints=5;
currentHitPoints=totalHitPoints;
gfxId=STATUE_S;
isPassable=false;
isTranslucent=false;
deadTerrain=RUBBLE_S;
break;
case WELL_S:
name="Well";
moveCost=6;
height=1;
totalHitPoints=30;
currentHitPoints=totalHitPoints;
gfxId=WELL_S;
isPassable=true;
isTranslucent=true;
deadTerrain=RUBBLE_S;
break;
default:
std::cout << "Error loading map with :" << terrainType << std::endl;
break;
}
}