typos
[k8-i-v-a-n.git] / src / game / wterra.h
blobd6b907fbd1fd0cb62fc7fdad133587cc4e11d104
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
12 #ifndef __WTERRA_H__
13 #define __WTERRA_H__
15 #include "ivancommon.h"
17 #include "cont.h"
18 #include "worldmap.h"
19 #include "terra.h"
20 #include "wsquare.h"
21 #include "festring.h"
24 struct blitdata;
26 typedef gwterrain *(*gwterrainspawner) ();
27 typedef owterrain *(*owterrainspawner) ();
30 class wterrain {
31 public:
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;
45 protected:
46 virtual truth UsesLongArticle () const { return false; }
47 virtual v2 GetBitmapPos (int) const = 0;
49 protected:
50 wsquare *WSquareUnder;
51 int AnimationFrames;
55 class gwterrainprototype {
56 public:
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; }
65 private:
66 int Index;
67 gwterrainspawner Spawner;
68 cchar *ClassID;
70 public:
71 festring mOnEvents;
75 class gwterrain : public wterrain, public gterrain {
76 public:
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;
90 protected:
91 std::pair<v2, int> Neighbour[8];
95 class owterrainprototype {
96 public:
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; }
105 private:
106 int Index;
107 owterrainspawner Spawner;
108 cchar *ClassID;
112 class owterrain : public wterrain, public oterrain {
113 public:
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; }
134 public:
135 festring mOnEvents;
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),\
143 #name);
144 #else
145 #define WTERRAIN_PROTO(name, protobase)
146 #endif
149 #define WTERRAIN(name, base, protobase)\
150 class name;\
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)
159 #endif