forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditmap.h
178 lines (157 loc) · 5.08 KB
/
editmap.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#ifndef _EDITMAP_H_
#define _EDITMAP_H_
#include "game.h"
#include "line.h"
#include "options.h"
#include "omdata.h"
#include <vector>
#include <map>
#include <list>
#include <stdarg.h>
enum shapetype {
editmap_rect, editmap_rect_filled, editmap_line, editmap_circle,
};
class editmap;
struct editmap_hilight {
std::vector<bool> blink_interval;
int cur_blink;
nc_color color;
std::map<point, char> points;
nc_color(*getbg)(nc_color);
void setup() {
getbg = ( color == c_red ? &red_background :
( color == c_magenta ? &magenta_background :
( color == c_cyan ? &cyan_background :
( color == c_yellow ? &yellow_background : &green_background )
)
)
);
};
void draw(editmap * em, bool update=false);
};
class editmap
{
public:
void uphelp(std::string txt1 = "", std::string txt2 = "", std::string title = "" );
point pos2screen( const int x, const int y );
point screen2pos( const int i, const int j );
bool eget_direction ( int &x, int &y, InputEvent &input, int ch );
point edit(point coords);
void uber_draw_ter( WINDOW * w, map * m );
void update_view(bool update_info = false);
int edit_ter(point coords);
int edit_fld(point coords);
int edit_trp(point coords);
int edit_itm(point coords);
int edit_mon(point coords);
int edit_npc(point coords);
int edit_veh(point coords);
int edit_mapgen(point coords);
void cleartmpmap( tinymap & tmpmap );
int mapgen_preview(real_coords &tc, uimenu &gmenu);
int mapgen_retarget(WINDOW * preview = NULL, map * mptr = NULL);
int select_shape(shapetype shape, int mode = -1 );
void update_fmenu_entry(uimenu *fmenu, field *field, int idx);
void setup_fmenu(uimenu *fmenu, field *field);
bool change_fld(std::vector<point> coords, field_id fid, int density);
WINDOW *w_info;
WINDOW *w_help;
int width;
int height;
int infoHeight;
int ter_frn_mode;
int sel_ter;
int target_ter;
int sel_frn;
int target_frn;
point recalc_target(shapetype shape);
bool move_target( InputEvent &input, int ch, int moveorigin = -1 );
field *cur_field;
trap_id cur_trap;
int sel_field;
int sel_fdensity;
int sel_trap;
int fsel;
int fset;
int trsel;
int trset;
point target;
point origin;
bool moveall;
bool refresh_mplans;
shapetype editshape;
game *g;
std::string padding;
std::string fids[num_fields];
std::vector<point> target_list;
std::map<std::string, editmap_hilight> hilights;
int lastop;
bool blink;
bool altblink;
int tmaxx;
int tmaxy;
int zlevel;
bool uberdraw;
std::map<oter_id, int> oter_special;
editmap(game *gptr) {
g = gptr;
width = TERMX - TERRAIN_WINDOW_WIDTH;
height = TERMY - TERRAIN_WINDOW_HEIGHT;
infoHeight = 0;
sel_ter = -1;
target_ter = -1;
sel_frn = -1;
target_frn = -1;
ter_frn_mode = 0;
cur_field = 0;
cur_trap = tr_null;
sel_field = -1;
sel_fdensity = -1;
sel_trap = -1;
fsel = -1;
fset = -1;
trsel = -1;
trset = -1;
w_info = 0;
w_help = 0;
lastop = 0;
padding = std::string(width - 2, ' ');
blink = false;
altblink = false;
moveall = false;
editshape = editmap_rect;
refresh_mplans = true;
tmaxx = getmaxx(g->w_terrain);
tmaxy = getmaxy(g->w_terrain);
fids[0] = "-clear-";
fids[fd_fire_vent] = "fire_vent";
fids[fd_push_items] = "push_items";
fids[fd_shock_vent] = "shock_vent";
fids[fd_acid_vent] = "acid_vent";
target_list.clear();
hilights.clear();
hilights["mplan"].blink_interval.push_back(true);
hilights["mplan"].blink_interval.push_back(false);
hilights["mplan"].cur_blink = 0;
hilights["mplan"].color = c_red;
hilights["mplan"].setup();
hilights["mapgentgt"].blink_interval.push_back(true);
hilights["mapgentgt"].blink_interval.push_back(false);
hilights["mapgentgt"].blink_interval.push_back(false);
hilights["mapgentgt"].cur_blink = 0;
hilights["mapgentgt"].color = c_cyan;
hilights["mapgentgt"].setup();
oter_special.clear();
zlevel = g->levz;
uberdraw = false;
for ( int i=0; i < NUM_OMSPECS; i++ ) {
oter_id key=overmap_specials[i].ter;
oter_special[key]=i;
}
};
~editmap() {
delwin(w_info);
delwin(w_help);
}
};
#endif