/
level.h
135 lines (97 loc) · 3.47 KB
/
level.h
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
/* Copyright (c) 2012-2013 Cheese and Bacon Games, LLC */
/* See the file docs/COPYING.txt for copying permission. */
#ifndef level_h
#define level_h
#include "tile.h"
#include "tile_background.h"
#include "background_layer.h"
#include "devworld.h"
#include "timer.h"
#include "light_data.h"
#include <vector>
#include <string>
#include <SDL.h>
#include <SDL_mixer.h>
class Level{
private:
public:
Level();
void load_level_adventure();
void load_level_survival();
//This function loads whatever level is needed from the corresponding level files.
void load_level();
//Unload from memory anything needed.
void unload_level();
//Randomly generate a level.
void generate_level();
//Returns which region of the worldmap a given level's entrance is part of.
short return_level_region(int i);
//Returns true if the level has snow.
//Returns false if it does not.
bool return_level_snow(int i);
//Returns true if the level has rain.
//Returns false if it does not.
bool return_level_rain(int i);
std::string return_level_name(int i);
void set_title_strings(int i);
//Returns true if the game is paused due to title display.
//Returns false otherwise.
bool return_title_pause();
void process_title();
void render_title();
//Turn all party balls into an explosion of items.
void explode_party_balls(short item_type);
//Survival functions.
unsigned long survival_spawn_items_time();
unsigned long survival_spawn_npcs_time();
int survival_spawn_items_chance();
int survival_spawn_npcs_chance();
//The dimensions of the level map.
int level_x,level_y;
//The current level's total available items.
short leaves,cheese;
//If true, the alarm is sounding.
//If false, the alarm is not sounding.
bool alarm;
//The number of replicators in the current level.
unsigned int amount_replicators;
std::vector<Background_Layer> background_layers;
//The current level's tile array.
std::vector< std::vector<Tile> > tile_array;
//The current level's background tile array.
std::vector< std::vector<Tile_Background> > tile_background_array;
//The position of the level's title and title background.
double title_top_x;
double title_bottom_x;
double title_bg_y_top;
double title_bg_x_bottom;
double title_bg_x_left;
//The level title.
std::string title_top_string;
std::string title_bottom_string;
short title_moving;
//When the title reaches the middle, this counts down to its removal.
short counter_title;
//Special tile distortion data for DevWorld.
DevWorld devworld_tiles;
//Keeps track of time spent in this level.
Timer timer_current_level;
//Keeps track of the seconds spent in this playthrough of this level.
unsigned long seconds_in_current_level;
//Survival mode variables.
unsigned long survival_seconds_played;
bool survival_never_spawned_items;
bool survival_never_spawned_npcs;
Timer timer_survival_escape_counter;
Timer timer_survival_spawn_items;
Timer timer_survival_spawn_npcs;
//FOV:
void setSeen_map(int x,int y);
bool onMap_map(int x,int y);
bool blockLOS_map(int x,int y);
void setSeen_lighting(int x,int y,Light_Source* src);
bool onMap_lighting(int x,int y);
bool blockLOS_lighting(int x,int y);
Light_Data blend_light(double src_opacity,color_data src_color,double dest_opacity,color_data dest_color);
};
#endif