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
15 #include "ivancommon.h"
26 typedef gwterrain
*(*gwterrainspawner
) ();
27 typedef owterrain
*(*owterrainspawner
) ();
32 wterrain () : WSquareUnder(0), AnimationFrames(1) {}
33 virtual ~wterrain () {}
35 virtual void Load (inputfile
&);
36 v2
GetPos () const { return WSquareUnder
->GetPos(); }
37 void SetWSquareUnder (wsquare
*What
) { WSquareUnder
= What
; }
38 worldmap
*GetWorldMap () const { return WSquareUnder
->GetWorldMap(); }
39 void AddName (festring
&, int) const;
40 festring
GetName (int) const;
41 truth
IsAnimated () const { return AnimationFrames
> 1; }
42 void SetAnimationFrames (int What
) { AnimationFrames
= What
; }
43 virtual cchar
*GetNameStem () const = 0;
46 virtual truth
UsesLongArticle () const { return false; }
47 virtual v2
GetBitmapPos (int) const = 0;
50 wsquare
*WSquareUnder
;
55 class gwterrainprototype
{
57 gwterrainprototype (gwterrainspawner
, cchar
*);
58 virtual ~gwterrainprototype () {}
60 gwterrain
*Spawn () const { return Spawner(); }
61 gwterrain
*SpawnAndLoad (inputfile
&) const;
62 cchar
*GetClassID () const { return ClassID
; }
63 int GetIndex () const { return Index
; }
67 gwterrainspawner Spawner
;
75 class gwterrain
: public wterrain
, public gterrain
{
77 typedef gwterrainprototype prototype
;
79 virtual ~gwterrain () {}
81 virtual void Save (outputfile
&) const;
82 void Draw (blitdata
&) const;
83 virtual int GetPriority () const = 0;
84 virtual int GetEntryDifficulty () const { return 10; }
85 virtual const prototype
*GetProtoType() const = 0;
86 int GetType () const { return GetProtoType()->GetIndex(); }
87 void CalculateNeighbourBitmapPoses ();
88 virtual int GetWalkability () const;
91 std::pair
<v2
, int> Neighbour
[8];
95 class owterrainprototype
{
97 owterrainprototype (owterrainspawner
, cchar
*);
98 virtual ~owterrainprototype () {}
100 owterrain
*Spawn () const { return Spawner(); }
101 owterrain
*SpawnAndLoad (inputfile
&) const;
102 cchar
*GetClassID () const { return ClassID
; }
103 int GetIndex () const { return Index
; }
107 owterrainspawner Spawner
;
112 class owterrain
: public wterrain
, public oterrain
{
114 typedef owterrainprototype prototype
;
116 virtual ~owterrain () {}
118 virtual void Save (outputfile
&) const;
119 void Draw (blitdata
&) const;
120 virtual const prototype
*GetProtoType () const = 0;
121 int GetType () const { return GetProtoType()->GetIndex(); }
122 virtual int GetAttachedDungeon () const { return 0; }
123 virtual int GetAttachedArea () const { return 0; }
124 virtual int GetAttachedEntry () const;
125 virtual truth
Enter (truth
) const;
126 virtual int GetWalkability () const;
128 virtual truth
IsSuitableContinent (continent
*);
129 virtual truth
WantPetrusContinent () const { return true; } // for now they all should want it
130 virtual truth
IsAttnam () const { return false; }
131 virtual truth
IsHidden () const { return false; }
132 virtual truth
IsRevealed () const { return false; }
139 #ifdef __FILE_OF_STATIC_WTERRAIN_PROTOTYPE_DEFINITIONS__
140 #define WTERRAIN_PROTO(name, protobase)\
141 template<> const protobase##prototype\
142 name##sysbase::ProtoType((protobase##spawner)(&name##sysbase::Spawn),\
145 #define WTERRAIN_PROTO(name, protobase)
149 #define WTERRAIN(name, base, protobase)\
151 typedef simplesysbase<name, base, protobase##prototype> name##sysbase;\
152 WTERRAIN_PROTO(name, protobase)\
153 class name : public name##sysbase
155 #define GWTERRAIN(name, base) WTERRAIN(name, base, gwterrain)
156 #define OWTERRAIN(name, base) WTERRAIN(name, base, owterrain)