1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #ifndef G1_CONTROLLER_EDIT_CLASS_HH
|
---|
10 | #define G1_CONTROLLER_EDIT_CLASS_HH
|
---|
11 |
|
---|
12 | #include "map.hh"
|
---|
13 | #include "device/event.hh"
|
---|
14 | #include "device/device.hh"
|
---|
15 | #include "math/point.hh"
|
---|
16 | #include "controller.hh"
|
---|
17 | #include "math/spline.hh"
|
---|
18 | #include "r1_vert.hh"
|
---|
19 | #include "editor/mode/e_mode.hh"
|
---|
20 | #include "map_cell.hh"
|
---|
21 |
|
---|
22 | class g1_object_controller_class;
|
---|
23 | class g1_object_class;
|
---|
24 | class i4_spline_class;
|
---|
25 |
|
---|
26 | class g1_controller_edit_class : public g1_object_controller_class
|
---|
27 | {
|
---|
28 | friend class g1_mode_handler;
|
---|
29 | friend class g1_tile_mode;
|
---|
30 | friend class g1_camera_mode;
|
---|
31 | friend class g1_light_mode;
|
---|
32 | friend class g1_object_mode;
|
---|
33 | friend class g1_ai_mode;
|
---|
34 |
|
---|
35 | g1_mode_handler *mode;
|
---|
36 |
|
---|
37 | i4_bool graph_changed;
|
---|
38 | i4_bool drag_select, move_points, focus_visible;
|
---|
39 |
|
---|
40 | i4_spline_class::point *move_point;
|
---|
41 | g1_object_class *place_object;
|
---|
42 | i4_bool place_object_on_map;
|
---|
43 |
|
---|
44 | g1_object_class *selected_object;
|
---|
45 | g1_player_type selected_object_player_num;
|
---|
46 |
|
---|
47 | // this this cell the mouse is currently on for this controller
|
---|
48 | w32 cell_x, cell_y;
|
---|
49 |
|
---|
50 | // i4_float last_game_x, last_game_y; // projection on to ground
|
---|
51 |
|
---|
52 | // sw32 sel_x1, sel_y1, sel_x2, sel_y2;
|
---|
53 |
|
---|
54 | sw32 last_mouse_x, last_mouse_y;
|
---|
55 |
|
---|
56 | // i4_bool mouse_down, mouse_grabbed;
|
---|
57 |
|
---|
58 | // if we need to restore the map back to normal (because we changed the
|
---|
59 | // map for visual cues)
|
---|
60 | i4_bool need_restore_cell;
|
---|
61 | g1_map_cell_class saved_cell;
|
---|
62 | void save_and_put_cell();
|
---|
63 |
|
---|
64 | // this will replace the 'original' with new cell and move all the objects
|
---|
65 | // on original to new_cell
|
---|
66 | void replace_cell(g1_map_class *map,
|
---|
67 | g1_map_cell_class &original,
|
---|
68 | g1_map_cell_class &new_cell);
|
---|
69 |
|
---|
70 | void send_to_parent(i4_event *ev); // defined in editor.cc
|
---|
71 |
|
---|
72 | void changed(); // so user can save, defined in editor.cc
|
---|
73 | void change_map_cell();
|
---|
74 | void fill_map(); // does a flood fill at the current cell x&y
|
---|
75 |
|
---|
76 |
|
---|
77 |
|
---|
78 | // void tile_mouse_moved(sw32 x, sw32 y, i4_float gx, i4_float gy);
|
---|
79 | // void object_mouse_moved(sw32 x, sw32 y);
|
---|
80 |
|
---|
81 | void add_movie_control_point(int list_number);
|
---|
82 |
|
---|
83 | enum { SELECTED_PLAYER_NUM=2 };
|
---|
84 |
|
---|
85 | void refresh();
|
---|
86 |
|
---|
87 | i4_window_class *edit_win;
|
---|
88 |
|
---|
89 | void display_edit_win(); // defined in editor.cc
|
---|
90 |
|
---|
91 | // void camera_mouse_move(sw32 x, sw32 y);
|
---|
92 | // void zoom_mouse_move(sw32 x, sw32 y);
|
---|
93 | // void rotate_mouse_move(sw32 x, sw32 y);
|
---|
94 | // void grab_mouse();
|
---|
95 | // void ungrab_mouse();
|
---|
96 |
|
---|
97 | void select_points_in_area(sw32 x1, sw32 y1, sw32 x2, sw32 y2,
|
---|
98 | g1_mode_handler::select_modifier mod);
|
---|
99 |
|
---|
100 | // void draw_drag_rectangle(i4_draw_context_class &context);
|
---|
101 | // void drag_area(sw32 &dx1, sw32 &dy1, sw32 &dx2, sw32 &dy2);
|
---|
102 |
|
---|
103 | void clear_selected_points();
|
---|
104 | void move_selected_points(i4_float xa, i4_float ya, i4_float za);
|
---|
105 | void delete_selected_points();
|
---|
106 | void insert_control_points();
|
---|
107 |
|
---|
108 | // void height_modify_button_down();
|
---|
109 | // void height_modify_mouse_move(sw32 mx, sw32 my);
|
---|
110 | g1_map_vertex_class *find_map_vertex(sw32 x, sw32 y,
|
---|
111 | sw32 &vx, sw32 &vy);
|
---|
112 | void clear_selected_verts();
|
---|
113 | void select_verts_in_area(sw32 x1, sw32 y1, sw32 x2, sw32 y2,
|
---|
114 | g1_mode_handler::select_modifier mod);
|
---|
115 |
|
---|
116 | i4_bool move_verts;
|
---|
117 |
|
---|
118 | void change_light_direction();
|
---|
119 |
|
---|
120 | sw32 move_vert_x, move_vert_y;
|
---|
121 | i4_float move_vert_z;
|
---|
122 |
|
---|
123 | i4_spline_class::point *find_spline_point(sw32 mx, sw32 my, w32 instance);
|
---|
124 |
|
---|
125 | int get_current_splines(i4_spline_class **buffer, int buf_size);
|
---|
126 | void setup_context();
|
---|
127 |
|
---|
128 |
|
---|
129 | public:
|
---|
130 | virtual clear_if_cannot_draw() { return i4_F; }
|
---|
131 | enum { MAX_SPLINE_EDIT=10 };
|
---|
132 |
|
---|
133 | void tile_cell_draw(sw32 x, sw32 y);
|
---|
134 | void object_cell_draw(sw32 x, sw32 y);
|
---|
135 |
|
---|
136 |
|
---|
137 | i4_bool active() { return g1_current_controller.get()==this; }
|
---|
138 | ~g1_controller_edit_class();
|
---|
139 |
|
---|
140 | void focused();
|
---|
141 | void unfocused();
|
---|
142 |
|
---|
143 |
|
---|
144 | // void set_current_height(w8 height);
|
---|
145 |
|
---|
146 | g1_controller_edit_class(w16 w, w16 h,
|
---|
147 | i4_graphical_style_class *style);
|
---|
148 |
|
---|
149 | void mouse_moved(sw32 x, sw32 y);
|
---|
150 |
|
---|
151 | void button_down(i4_mouse_button_down_event_class *bev);
|
---|
152 | void button_up(i4_mouse_button_up_event_class *bev);
|
---|
153 |
|
---|
154 |
|
---|
155 | void restore_cell();
|
---|
156 |
|
---|
157 | void update_cursor();
|
---|
158 |
|
---|
159 | void show_focus();
|
---|
160 | void hide_focus();
|
---|
161 |
|
---|
162 | virtual void receive_event(i4_event *ev);
|
---|
163 |
|
---|
164 | void draw_3d_line(const i4_3d_point_class &p1,
|
---|
165 | const i4_3d_point_class &p2,
|
---|
166 | i4_color color1, // for first point
|
---|
167 | i4_color color2, // for second point
|
---|
168 | i4_image_class *local_image,
|
---|
169 | g1_draw_context_class *context);
|
---|
170 |
|
---|
171 | void draw_3d_point(sw32 w,
|
---|
172 | i4_color color,
|
---|
173 | const i4_3d_point_class &p,
|
---|
174 | i4_image_class *local_image,
|
---|
175 | g1_draw_context_class *context);
|
---|
176 |
|
---|
177 | void draw_spline(i4_image_class *local_image,
|
---|
178 | g1_draw_context_class *context,
|
---|
179 | i4_color cpoint_color,
|
---|
180 | i4_color line_color,
|
---|
181 | i4_color spline_color,
|
---|
182 | i4_spline_class *s,
|
---|
183 | w32 cur_frame);
|
---|
184 |
|
---|
185 | virtual void process_input(i4_time_class tick_time);
|
---|
186 |
|
---|
187 | virtual void editor_pre_draw(i4_draw_context_class &context);
|
---|
188 | virtual void editor_post_draw(i4_draw_context_class &context);
|
---|
189 |
|
---|
190 | void move_selected_heights(sw32 z_change);
|
---|
191 |
|
---|
192 | void setup_mode();
|
---|
193 |
|
---|
194 | void major_mode_change();
|
---|
195 | g1_mode_handler *get_mode() { return mode; }
|
---|
196 |
|
---|
197 | char *name() { return "contedit"; }
|
---|
198 | };
|
---|
199 |
|
---|
200 |
|
---|
201 | #endif
|
---|
202 |
|
---|
203 |
|
---|
204 |
|
---|