-
Notifications
You must be signed in to change notification settings - Fork 9
/
map.h
75 lines (53 loc) · 1.53 KB
/
map.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
#pragma once
////////////////////////////////////////////////////////////////////
// Constants
////////////////////////////////////////////////////////////////////
const unsigned int MAX_TOKEN_LENGTH = 512;
const unsigned int MAX_TEXTURE_LENGTH = 16;
////////////////////////////////////////////////////////////////////
// Includes
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <fstream>
using namespace std;
#include <windows.h>
#ifdef _DEBUG
#include <crtdbg.h>
#ifdef new
#undef new
#endif
#define new new(_NORMAL_BLOCK,__FILE__, __LINE__)
#endif
#include "math.h"
#include "entity.h"
#include "brush.h"
////////////////////////////////////////////////////////////////////
// Classes
////////////////////////////////////////////////////////////////////
class MAPFile
{
private:
enum Result
{
RESULT_SUCCEED = 0, RESULT_FAIL, RESULT_EOF
};
char m_acToken[ MAX_TOKEN_LENGTH + 1 ];
HANDLE m_hFile;
int m_iWADFiles;
LPVOID *m_pWAD;
DWORD *m_pWADSize;
Texture *m_pTextureList;
int m_iEntities;
int m_iPolygons;
int m_iTextures;
Result GetToken ( );
Result GetString ( );
Result ParseEntity ( Entity **ppEntity_ );
Result ParseProperty ( Property **ppProperty_ );
Result ParseBrush ( Brush **ppBrush_ );
Result ParseFace ( Face **ppFace_ );
Result ParseVector ( Vector3 &v_ );
Result ParsePlane ( Plane &p_ );
public:
bool Load ( char *pcFile_, Entity **ppEntities_, Texture **pTexture_ );
};