-
Notifications
You must be signed in to change notification settings - Fork 6
/
DetailedTile.h
58 lines (52 loc) · 1.69 KB
/
DetailedTile.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
#pragma once
#include "common.h"
#include <vector>
#include <string>
#include "isoworldremote.pb.h"
class MapSection;
class TileSet;
class DetailedTile {
ALLEGRO_BITMAP * sprite;
int offset_x;
int offset_y;
unsigned int coords_to_index(unsigned int x, unsigned int y) {
return ((y%48) * 48) + (x%48);
}
double get_average_heights(vector<int> * heightmap, int width, int height, int distance, int x, int y);
vector<ALLEGRO_COLOR> generate_ambient_lighting(vector<int> * heightmap, int width, int height);
vector<int> heightmap;
double get_height(int x, int y);
int surrounding_heights[3][3];
int world_x;
int world_y;
int world_z;
public:
bool valid;
int year;
char season;
DetailedTile();
~DetailedTile();
void make_tile(isoworldremote::EmbarkTile * input, MapSection * section, TileSet * tile_set);
void draw(int x, int y);
//ALLEGRO_BITMAP * get_sprite() {return sprite;}
void save_tile(ALLEGRO_PATH * base_path, TileSet * tile_set);
void load_tile(const char * filepath, int inx, int iny);
};
class DetailedMap {
vector<DetailedTile *> tile_list;
vector<int> tile_map;
unsigned int width;
unsigned int height;
unsigned int coords_to_index(unsigned int x, unsigned int y) {
return ((y%height) * width) + (x%width);
}
public:
void flush();
void save_tiles(string *folder);
void load_tiles(string *folder);
DetailedTile * get_tile(unsigned int x, unsigned int y);
DetailedTile * new_tile(unsigned int x, unsigned int y);
DetailedMap(unsigned int width, unsigned int height);
~DetailedMap();
};
void load_detailed_tiles(ALLEGRO_PATH * base_path, MapSection * section);