From 443b77e47a7ef3a137e39c64abb277229a665d03 Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Tue, 8 Dec 2015 15:56:17 -0500 Subject: Sword can now kill the first entity --- doc/html/world_8h_source.html | 333 ------------------------------------------ 1 file changed, 333 deletions(-) delete mode 100644 doc/html/world_8h_source.html (limited to 'doc/html/world_8h_source.html') diff --git a/doc/html/world_8h_source.html b/doc/html/world_8h_source.html deleted file mode 100644 index 4d396a7..0000000 --- a/doc/html/world_8h_source.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - - - -gamedev: include/world.h Source File - - - - - - - - - - -
-
- - - - - - -
-
gamedev -
-
-
- - - - - - -
-
- - -
- -
- - -
-
-
-
world.h
-
-
-Go to the documentation of this file.
1 
-
8 #ifndef WORLD_H
-
9 #define WORLD_H
-
10 
-
11 #include <common.h> // For HLINE, vec2, OpenGL utilities, etc.
-
12 #include <entities.h>
-
13 
-
14 #define GEN_INC 10 // Defines at what interval y values should be calculated for the array 'line'.
-
15  // As explained in World(), the last few lines in the array 'line' are incorrectly calculated
-
16  // or not calculated at all, so GEN_INC is also used to decrease 'lineCount' in functions like draw()
-
17  // and detect().
-
18 
-
19 #define DAY_CYCLE 3000
-
20 
-
27 typedef enum {
- - - -
31 
-
38 typedef enum {
-
39  SUNNY = 0,
-
40  DARK,
- -
42 } WEATHER;
-
43 
-
50 struct line_t {
-
51  float y;
-
52  bool gs;
-
53  float gh[2];
-
54  unsigned char color;
-
55 } __attribute__ ((packed));
-
56 
-
61 class World {
-
62 protected:
-
63 
-
70  struct line_t *line;
-
71 
-
78  int x_start;
-
79 
-
84  void singleDetect(Entity *e);
-
85 
-
86  /*
-
87  * Deletes all entities in the world.
-
88  */
-
89 
-
90  void deleteEntities(void);
-
91 
-
92  /*
-
93  * The size of the line array. This is set once by World->generate().
-
94  */
-
95 
-
96  unsigned int lineCount;
-
97 
-
98  /*
-
99  * Contains the background image layers (including the background image).
-
100  */
-
101 
-
102  vec2 *star;
-
103 
-
104  Texturec *bgTex;
-
105 
-
106  Mix_Music *bgmObj;
-
107  char *bgm;
-
108 
-
109 public:
-
110 
-
111  /*
-
112  * These pointers keep track of worlds that are adjacent to this one. Used in ui.cpp
-
113  * for world jumping.
-
114  */
-
115 
-
116  World *toLeft,
-
117  *toRight,
-
118  *behind,
-
119  *infront;
-
120 
-
121  /*
-
122  * Entity arrays.
-
123  */
-
124 
-
125  std::vector<NPC *> npc;
-
126  std::vector<Structures *> build;
-
127  std::vector<Mob *> mob;
-
128  std::vector<Entity *> entity;
-
129  std::vector<Object *> object;
-
130 
-
131  void addStructure(_TYPE t,float x,float y,World *outside,World *inside);
-
132  void addMob(int t,float x,float y);
-
133  void addMob(int t,float x,float y,void (*hey)(Mob *));
-
134  void addNPC(float x,float y);
-
135  void addObject(ITEM_ID, bool, const char *, float, float);
-
136 
-
137  void update(Player *p,unsigned int delta);
-
138 
-
139  /*
-
140  * Constructor and deconstructor, these do what you would expect.
-
141  */
-
142 
-
143  World(void);
-
144  virtual ~World(void); // Frees the 'line' array.
-
145 
-
146  /*
-
147  * Generate a world of width `width`. This function is virtual so that other world
-
148  * classes that are based on this one can generate themselves their own way.
-
149  */
-
150 
-
151  virtual void generate(unsigned int width);
-
152  void generateFunc(unsigned int width,float(*func)(float));
-
153 
-
154  /*
-
155  * Adds images to using for the background.
-
156  */
-
157 
-
158  void setBackground(WORLD_BG_TYPE bgt);
-
159 
-
160  /*
-
161  * Start/stop background music.
-
162  */
-
163 
-
164  void setBGM(const char *path);
-
165  void bgmPlay(void);
-
166  void bgmStop(void);
-
167 
-
168  /*
-
169  * Looks for the furthest back layer in this world and adds a new layer of width `width` behind it.
-
170  */
-
171 
-
172  void addLayer(unsigned int width);
-
173 
-
174  /*
-
175  * Draw the world and entities based on the player's coordinates. Virtual for the same
-
176  * reason generate() is.
-
177  */
-
178 
-
179  virtual void draw(Player *p);
-
180 
-
181 
-
182  /*
-
183  * Detect the player and any entities in the current world.
-
184  */
-
185 
-
186  void detect(Player *p);
-
187 
-
188  /*
-
189  * These functions return the pointer to the world in the direction that is requested if it
-
190  * exists and the player is in a condition that it can make the switch, otherwise they
-
191  * return the current world.
-
192  */
-
193 
-
194  World *goWorldLeft(Player *p);
-
195  World *goWorldRight(Player *p);
-
196  World *goWorldBack(Player *p);
-
197  World *goWorldFront(Player *p);
-
198 
-
199  /*
-
200  * Called to enter/exit a structure.
-
201  */
-
202 
-
203  World *goInsideStructure(Player *p);
-
204 
-
205  /*
-
206  * These functions add features to the world.
-
207  */
-
208 
-
209  void addHole(unsigned int start,unsigned int end);
-
210 
-
211  /*
-
212  * Get's the world's width.
-
213  */
-
214 
-
215  int getTheWidth(void);
-
216 
-
217  void save(FILE *);
-
218  void load(FILE *);
-
219 };
-
220 
-
221 /*
-
222  * Gets a good base y value for background rendering.
-
223 */
-
224 
-
225 float worldGetYBase(World *w);
-
226 
-
227 /*
-
228  * IndoorWorld - Indoor settings stored in a World class ;)
-
229  */
-
230 
-
231 class IndoorWorld : public World {
-
232 public:
-
233  World *outside;
-
234  IndoorWorld(void);
-
235  ~IndoorWorld(void);
-
236 
-
237  void generate(unsigned int width); // Generates a flat world of width 'width'
-
238  void draw(Player *p); // Draws the world (ignores layers)
-
239 };
-
240 
-
241 class Arena : public World {
-
242 private:
-
243  vec2 pxy;
-
244  vec2 door;
-
245  World *exit;
-
246 public:
-
247  Arena(World *leave,Player *p);
-
248  ~Arena(void);
-
249  World *exitArena(Player *p);
-
250 };
-
251 
-
252 extern int worldShade;
-
253 
-
254 #endif // WORLD_H
-
Definition: world.h:50
-
Definition: world.h:39
-
Definition: world.h:29
-
Definition: world.h:61
-
Definition: entities.h:127
-
Definition: common.h:46
-
WEATHER
Definition: world.h:38
-
Definition: Texture.h:12
-
Definition: world.h:41
-
float y
Definition: world.h:51
-
struct line_t * line
Definition: world.h:70
-
Definition: world.h:241
-
Definition: entities.h:37
-
unsigned char color
Definition: world.h:54
-
float y
Definition: world.h:88
-
float gh[2]
Definition: world.h:53
-
int x_start
Definition: world.h:78
-
bool gs
Definition: world.h:52
-
Definition: entities.h:94
-
WORLD_BG_TYPE
Definition: world.h:27
-
Definition: world.h:40
-
Definition: world.h:231
-
Definition: world.h:28
-
- - - - -- cgit v1.2.3