3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
8 * See LICENSING which should be included
9 * along with this file for more details
40 template <class type
> struct fearray
;
42 struct nodepointerstorer
44 nodepointerstorer(node
* Node
) : Node(Node
) { }
45 bool operator<(const nodepointerstorer
&) const;
55 typedef std::priority_queue
<nodepointerstorer
> nodequeue
;
56 typedef std::vector
<item
*> itemvector
;
57 typedef std::vector
<character
*> charactervector
;
58 typedef std::vector
<emitter
> emittervector
;
59 typedef std::vector
<feuLong
> sunemittervector
;
60 typedef character
* (*characterspawner
)(int, int);
64 node(int x
, int y
, lsquare
* Square
) : Square(Square
), Pos(x
, y
) { }
65 void CalculateNextNodes();
71 sLong TotalDistanceEstimate
;
75 static node
*** NodeMap
;
76 static int RequiredWalkability
;
77 static ccharacter
* SpecialMover
;
79 static uChar
** WalkabilityMap
;
80 static int XSize
, YSize
;
81 static nodequeue
* NodeQueue
;
98 beamdata(character
*, cfestring
&, int, feuLong
);
99 beamdata(character
*, cfestring
&, v2
, col16
, int, int, int, feuLong
);
107 feuLong SpecialParameters
;
110 inline beamdata::beamdata
115 feuLong SpecialParameters
119 Direction(Direction
),
120 SpecialParameters(SpecialParameters
)
123 inline beamdata::beamdata
132 feuLong SpecialParameters
137 BeamColor(BeamColor
),
138 BeamEffect(BeamEffect
),
139 Direction(Direction
),
141 SpecialParameters(SpecialParameters
)
144 class level
: public area
150 v2
GetRandomSquare(ccharacter
* = 0, int = 0, const rect
* = 0) const;
151 void GenerateMonsters();
152 lsquare
* GetLSquare(v2 Pos
) const { return Map
[Pos
.X
][Pos
.Y
]; }
153 lsquare
* GetLSquare(int x
, int y
) const { return Map
[x
][y
]; }
154 void GenerateTunnel(int, int, int, int, truth
);
155 void ExpandPossibleRoute(int, int, int, int, truth
);
156 void ExpandStillPossibleRoute(int, int, int, int, truth
);
157 void Save(outputfile
&) const;
158 void Load(inputfile
&);
160 int GetIdealPopulation() const { return IdealPopulation
; }
161 double GetDifficulty() const { return Difficulty
; }
162 void GenerateNewMonsters(int, truth
= true);
163 void AttachPos(int, int);
164 void AttachPos(v2 Pos
) { AttachPos(Pos
.X
, Pos
.Y
); }
165 void CreateItems(int);
166 truth
MakeRoom(const roomscript
*);
167 void ParticleTrail(v2
, v2
);
168 festring
GetLevelMessage() { return LevelMessage
; }
169 void SetLevelMessage(cfestring
& What
) { LevelMessage
= What
; }
170 void SetLevelScript(const levelscript
* What
) { LevelScript
= What
; }
171 truth
IsOnGround() const;
172 const levelscript
* GetLevelScript() const { return LevelScript
; }
173 int GetLOSModifier() const;
174 room
* GetRoom(int) const;
175 void SetRoom(int, room
*);
177 void Explosion(character
*, cfestring
&, v2
, int, truth
= true);
178 truth
CollectCreatures(charactervector
&, character
*, truth
);
179 void ApplyLSquareScript(const squarescript
*);
180 virtual void Draw(truth
) const;
181 v2
GetEntryPos(ccharacter
*, int) const;
182 void GenerateRectangularRoom(std::vector
<v2
>&, std::vector
<v2
>&, std::vector
<v2
>&, const roomscript
*, room
*, v2
, v2
);
184 static void (level::*GetBeam(int))(beamdata
&);
185 void ParticleBeam(beamdata
&);
186 void LightningBeam(beamdata
&);
187 void ShieldBeam(beamdata
&);
188 dungeon
* GetDungeon() const { return Dungeon
; }
189 void SetDungeon(dungeon
* What
) { Dungeon
= What
; }
190 int GetIndex() const { return Index
; }
191 void SetIndex(int What
) { Index
= What
; }
192 truth
DrawExplosion(const explosion
*) const;
193 int TriggerExplosions(int);
194 lsquare
*** GetMap() const { return Map
; }
195 v2
GetNearestFreeSquare(ccharacter
*, v2
, truth
= true) const;
196 v2
FreeSquareSeeker(ccharacter
*, v2
, v2
, int, truth
) const;
197 v2
GetFreeAdjacentSquare(ccharacter
*, v2
, truth
) const;
198 static void (level::*GetBeamEffectVisualizer(int))(const fearray
<lsquare
*>&, col16
) const;
199 void ParticleVisualizer(const fearray
<lsquare
*>&, col16
) const;
200 void LightningVisualizer(const fearray
<lsquare
*>&, col16
) const;
201 truth
PreProcessForBone();
202 truth
PostProcessForBone();
203 void FinalProcessForBone();
204 void GenerateDungeon(int);
205 void GenerateDesert();
206 void GenerateJungle();
207 void GenerateSteppe();
208 void GenerateLeafyForest();
209 void GenerateEvergreenForest();
210 void GenerateTundra();
211 void GenerateGlacier();
212 void CreateTunnelNetwork(int, int, int, int, v2
);
213 void SetWalkability(v2 Pos
, int What
) { WalkabilityMap
[Pos
.X
][Pos
.Y
] = What
; }
214 node
* FindRoute(v2
, v2
, const std::set
<v2
>&, int, ccharacter
* = 0);
215 void AddToAttachQueue(v2
);
216 void CollectEverything(itemvector
&, charactervector
&);
217 void CreateGlobalRain(liquid
*, v2
);
218 void CheckSunLight();
219 col24
GetSunLightEmitation() const { return SunLightEmitation
; }
220 void InitSquarePartEmitationTicks();
221 col24
GetAmbientLuminance() const { return AmbientLuminance
; }
222 void ForceEmitterNoxify(const emittervector
&) const;
223 void ForceEmitterEmitation(const emittervector
&, const sunemittervector
&, feuLong
= 0) const;
225 void EnableGlobalRain();
226 void DisableGlobalRain();
228 lsquare
** GetSquareStack() const { return SquareStack
; }
229 col24
GetNightAmbientLuminance() const { return NightAmbientLuminance
; }
230 int DetectMaterial(cmaterial
*);
232 void CalculateLuminances();
233 int AddRadiusToSquareStack(v2
, sLong
) const;
234 olterrain
* GetRandomFountainWithWater(olterrain
*) const;
235 int GetEnchantmentMinusChance() { return EnchantmentMinusChance
; }
236 int GetEnchantmentPlusChance() { return EnchantmentPlusChance
; }
238 spawnresult
SpawnMonsters(characterspawner
, team
*, v2
, int = 0, int = 1, truth
= false);
239 void AddSpecialCursors();
240 void GasExplosion(gas
*, lsquare
*);
242 truth
GenerateLanterns(int, int, int) const;
243 truth
GenerateWindows(int, int) const;
244 void CreateRoomSquare(glterrain
*, olterrain
*, int, int, int, int) const;
246 void EmitSunBeam(v2
, feuLong
, int) const;
247 void ChangeSunLight();
248 void EmitSunLight(v2
);
250 const levelscript
* LevelScript
;
251 festring LevelMessage
;
252 std::vector
<v2
> Door
;
253 std::vector
<room
*> Room
;
255 int MonsterGenerationInterval
;
259 std::vector
<explosion
*> ExplosionQueue
;
260 std::vector
<truth
> PlayerHurt
;
262 uChar
** WalkabilityMap
;
263 std::vector
<v2
> AttachQueue
;
264 liquid
* GlobalRainLiquid
;
266 col24 SunLightEmitation
;
267 v2 SunLightDirection
;
268 col24 AmbientLuminance
;
269 static feuLong NextExplosionID
;
270 lsquare
** SquareStack
;
271 col24 NightAmbientLuminance
;
272 int EnchantmentMinusChance
;
273 int EnchantmentPlusChance
;
276 outputfile
& operator<<(outputfile
&, const level
*);
277 inputfile
& operator>>(inputfile
&, level
*&);