-
Notifications
You must be signed in to change notification settings - Fork 1
/
DungeonGenerator.h
142 lines (107 loc) · 3.62 KB
/
DungeonGenerator.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
136
137
138
139
140
141
142
// --------------------------------------------------------------------------------------------------------------------------------
// DEMISERL
// Copyright 2014 Corremn
//
// $LastChangedBy$
// $LastChangedDate$
// $LastChangedRevision$
// $HeadURL: $
// --------------------------------------------------------------------------------------------------------------------------------
#if !defined(AFX_DUNGEONGENERATOR_H__D49B02F6_8AA1_4C67_8264_6171D1953767__INCLUDED_)
#define AFX_DUNGEONGENERATOR_H__D49B02F6_8AA1_4C67_8264_6171D1953767__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "GeneratorMap.h"
#include <iostream>
#include <fstream>
typedef enum eDir
{
dNone = -2,
dWait = -1,
dNorth = 1,
dSouth = 2,
dEast = 3,
dNorthEast = 4,
dSouthEast = 5,
dWest = 6,
dNorthWest = 7,
dSouthWest = 8,
dUp,
dDown
}direction;
#define DUNGEON_SIZE_W 80
#define DUNGEON_SIZE_H 39
#define MAP_SCALE 4
#define MAX_ROOMS 18 //15
#define MIN_ROOMS 4 //8
#define MAX_X_POS 85
#define MIN_X_POS 3
#define MAX_Y_POS 35
#define MIN_Y_POS 3
#define MAX_X_SIZE 20 //20
#define MIN_X_SIZE 3 //3
#define MAX_Y_SIZE 10 //10
#define MIN_Y_SIZE 3 //3
class DungeonGenerator
{
public:
int CreateMap();
virtual int Create(int type);
int ConvertMapToDungeon();
bool FloodTest();
GeneratorMap<char> getMap();
protected:
int DumpDungeon();
virtual int makeNormalDungeon();
virtual int makeRiverDungeon();
virtual int makeMazeDungeon();
virtual int makeOutSideDungeon();
virtual int makeUndeadDungeon();
virtual int makeSpecialDungeon();
virtual void makeBoatHouse();
virtual int makeEncounterDungeon();
int makeCavernDungeon();
void FloodFill(int x, int y);
void addLoops(int loops);
int findwall(int *x, int *y);
int createCorridor(int *x, int *y, int dir);
int createRoom(int roomCount, const int maxRooms, int x, int y, int max_w = MAX_X_SIZE, int min_w = MIN_X_SIZE, int max_h = MAX_Y_SIZE, int min_h = MIN_Y_SIZE);
int createUndeadRoom(int roomCount, const int maxRooms, int x, int y, int max_w = MAX_X_SIZE, int min_w = MIN_X_SIZE, int max_h = MAX_Y_SIZE, int min_h = MIN_Y_SIZE);
int createRuin(int x, int y, int max_w = MAX_X_SIZE, int min_w = MIN_X_SIZE, int max_h = MAX_Y_SIZE, int min_h = MIN_Y_SIZE);
int createPath(int x1, int y1, int x2, int y2);
int createDoor(int x, int y, int chance = 50);
int last_room_x;
int last_room_y;
void OpenTrace(bool open);
void buildRoom(int x, int y, int w_size, int h_size, int type);
void TraceMsg(char * msg);
int isNearWall(int x, int y);
/*
* Remove doors that dont make sense
*/
int fixDoors();
bool addSpecialRoom();
int validRoomPos(int x, int y, int w_size, int h_size);
void makeRiver(int top, int size = 0);
void makeWater(int x, int y);
void makeSand(int x, int y);
void makeTomb(int x, int y);
void makeFloor(int x, int y);
void makeBridge();
void makeMountain();
void makeGrass(int x, int y);
void makeTree(int x, int y);
int AddFountain();
int AddTeleport();
void SafetyReset();
int Safety(char* message, int test = 5000);
bool findTerrainType(int &x, int &y, const char terrain);
protected:
std::ofstream ofile;
int type;
int safety;
GeneratorMap<char> dmap;
GeneratorMap<char> flood_test;
};
#endif // !defined(AFX_DUNGEONGENERATOR_H__D49B02F6_8AA1_4C67_8264_6171D1953767__INCLUDED_)