-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTileHandler.h
61 lines (48 loc) · 1.2 KB
/
TileHandler.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
#ifndef __TILEHANDLER_H__
#define __TILEHANDLER_H__
#include <vector>
#include <string>
#include <fstream>
#include "Bitmap.h"
using namespace std;
#define MAX_MAP_SIZE 40 //increase maybe
#define MAX_TILES (MAX_MAP_SIZE*MAX_MAP_SIZE*16*16)
class CTileHandler
{
public:
CTileHandler();
~CTileHandler(void);
void LoadTexture(string name);
void ProcessTiles(float compressFactor);
void SaveData(ofstream& ofs);
void ReadTile(int xpos, int ypos, char *destbuf, char *sourcebuf);
int FindCloseTile(CBitmap* bm,int forbidden);
void ProcessTiles2(void);
int GetFileSize(void);
void AddExternalTileFile(string file);
void SetOutputFile(string file);
CBitmap bigTex;
int xsize;
int ysize;
CBitmap* tiles[MAX_TILES];
vector<char*> newTiles;
int tileUse[MAX_TILES];
int usedTiles;
int numExternalTile;
struct FastStat{
int r,g,b;
int rx,gx,bx;
int ry,gy,by;
};
FastStat fastStats[MAX_TILES];
FastStat CalcFastStat(CBitmap* bm);
bool CompareTiles(CBitmap* bm, CBitmap* bm2);
int meanThreshold;
int meanDirThreshold;
int borderThreshold;
vector<string> externalFiles;
vector<int> externalFileTileSize;
string myTileFile;
};
extern CTileHandler tileHandler;
#endif // __TILEHANDLER_H__