1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
2 | |
2 | |
3 | =head1 NAME |
3 | =head1 NAME |
4 | |
4 | |
5 | gce - gtk (perl) crossfire editor |
5 | gce - gtk (perl) crossfire editor |
|
|
6 | |
|
|
7 | =head1 SYNOPSIS |
|
|
8 | |
|
|
9 | gce [<map-filename>] |
|
|
10 | |
|
|
11 | =head1 FEATURES |
|
|
12 | |
|
|
13 | gce is a map editor for crossfire. |
|
|
14 | Main features are: |
|
|
15 | |
|
|
16 | - more map editing comfort |
|
|
17 | - intelligent placement tool |
|
|
18 | - intelligent connection tool |
|
|
19 | - intelligent erase tool |
|
|
20 | - faster and smaller than the java editor |
|
|
21 | - map normalizing (removal of old deprecated attributes) |
|
|
22 | - exit following |
|
|
23 | - world map navigation |
|
|
24 | |
|
|
25 | =head1 DESCRIPTION |
|
|
26 | |
|
|
27 | =head2 THE MAIN WINDOW |
|
|
28 | |
|
|
29 | This is the main window of gce. It provides the display of the |
|
|
30 | picked arch and the tools. The buttons are providing the selection |
|
|
31 | of the editing tool: |
|
|
32 | |
|
|
33 | =over 4 |
|
|
34 | |
|
|
35 | =item * Pick |
|
|
36 | |
|
|
37 | This tool is the simplest of all. It lets the user just pick the topmost |
|
|
38 | object of a map cell in the map window and updates the stack view, the picked arch |
|
|
39 | and the attribute editor. |
|
|
40 | |
|
|
41 | If the pick attr flag is set only the attribute editor and the stack view |
|
|
42 | are updated. This is useful when you want to put an object in the attribute editor |
|
|
43 | and want to place an object from the map, you picked before, in an inventory of a different |
|
|
44 | object (you just picked). This is a very special thing. It will propably go away. |
|
|
45 | |
|
|
46 | Shortcut-key in map editor: i |
|
|
47 | |
|
|
48 | =item * Place |
|
|
49 | |
|
|
50 | This is the intelligent placement tool. It has many modes: |
|
|
51 | |
|
|
52 | =over 4 |
|
|
53 | |
|
|
54 | =item auto |
|
|
55 | |
|
|
56 | This mode trys to do the most usual thing with the picked arch. |
|
|
57 | If you picked a floor arch, it will try to replace the existing floor |
|
|
58 | or set the floor below all items. If you picked a monster or other arch, |
|
|
59 | it will place it on top. If you picked a wall, it will put the wall above the floor |
|
|
60 | and propably replace other walls. |
|
|
61 | |
|
|
62 | =item top |
|
|
63 | |
|
|
64 | Places the picked arch on the top of the stack of the map cell. |
|
|
65 | |
|
|
66 | =item above floor |
|
|
67 | |
|
|
68 | Places the picked arch just right above the floor (or the bottom of the stack). |
|
|
69 | |
|
|
70 | =item below floor |
|
|
71 | |
|
|
72 | Places the picked arch just right below the floor (or the bottom of the stack). |
|
|
73 | |
|
|
74 | =item bottom |
|
|
75 | |
|
|
76 | Places the picked arch on the bottom of the stack. |
|
|
77 | |
|
|
78 | =item place clean (checkbox) |
|
|
79 | |
|
|
80 | This is a flag, that when enabled, will let the placement tool |
|
|
81 | only place an unmodified object on the map. This is useful when you have a |
|
|
82 | modified arch in the picker (eg. special monster with modified hp) but want |
|
|
83 | a unmodified monster being placed. |
|
|
84 | |
|
|
85 | =back |
|
|
86 | |
|
|
87 | Shortcut-key in map editor: p |
|
|
88 | |
|
|
89 | =item * Erase |
|
|
90 | |
|
|
91 | This is the tool that lets you erase an arch. |
|
|
92 | It has following modes: |
|
|
93 | |
|
|
94 | =over 4 |
|
|
95 | |
|
|
96 | =item top |
|
|
97 | |
|
|
98 | Erases the topmost object on the stack. |
|
|
99 | |
|
|
100 | =item walls |
|
|
101 | |
|
|
102 | Erases all walls in the stack. (and only walls) |
|
|
103 | |
|
|
104 | =item above floor |
|
|
105 | |
|
|
106 | Erases the first object above the floor. |
|
|
107 | |
|
|
108 | =item floor |
|
|
109 | |
|
|
110 | Erases all floor from the stack. (and only the floor) |
|
|
111 | |
|
|
112 | =item below floor |
|
|
113 | |
|
|
114 | Erases the first object below the floor. |
|
|
115 | |
|
|
116 | =item bottom |
|
|
117 | |
|
|
118 | Erases the first object on the bottom of the stack. |
|
|
119 | |
|
|
120 | =item pick match |
|
|
121 | |
|
|
122 | This erases all object with the same name as the picked arch |
|
|
123 | from the stack. |
|
|
124 | |
|
|
125 | =item exclude walls (checkbox) |
|
|
126 | |
|
|
127 | This excludes erasing of walls in any erase action (except when erasing walls) |
|
|
128 | |
|
|
129 | =item exclude monsters (checkbox) |
|
|
130 | |
|
|
131 | This excludes erasing of monsters in any erase action. |
|
|
132 | |
|
|
133 | =back |
|
|
134 | |
|
|
135 | Shortcut-key in map editor: e |
|
|
136 | |
|
|
137 | =item * Select |
|
|
138 | |
|
|
139 | This is the select tool. You can select rectangular areas with it |
|
|
140 | and operate on that area in following ways: |
|
|
141 | |
|
|
142 | =over 4 |
|
|
143 | |
|
|
144 | =item copy |
|
|
145 | |
|
|
146 | This just copies all selected stacks. |
|
|
147 | |
|
|
148 | Shortcut-key in map editor: c |
|
|
149 | |
|
|
150 | =item paste |
|
|
151 | |
|
|
152 | This function pastes the copied stacks. The pasting |
|
|
153 | beginns at the top left cell which is selected. |
|
|
154 | |
|
|
155 | Shortcut-key in map editor: p |
|
|
156 | |
|
|
157 | =item invoke |
|
|
158 | |
|
|
159 | This functions is a very mighty one. It can iterate the |
|
|
160 | selected tool over the selected area. For example: It |
|
|
161 | can be used to fill a map with floor or erase everything. |
|
|
162 | |
|
|
163 | Shortcut-key in map editor: n |
|
|
164 | |
|
|
165 | =back |
|
|
166 | |
|
|
167 | Shortcut-key in map editor: s |
|
|
168 | |
|
|
169 | =item * Eval |
|
|
170 | |
|
|
171 | This is a very special tool which isn't finished yet. |
|
|
172 | It lets you insert a perl snippet that can manipulate the |
|
|
173 | stack. |
|
|
174 | |
|
|
175 | Shortcut-key in map editor: l |
|
|
176 | |
|
|
177 | =item * Connect Exit |
|
|
178 | |
|
|
179 | This tool connectes two exits or teleporters. |
|
|
180 | You can either connect two exits to each other, or just direct |
|
|
181 | an exit to a certain location on a map. |
|
|
182 | |
|
|
183 | Shortcut-key in map editor: x |
|
|
184 | |
|
|
185 | =item * Follow Exit |
|
|
186 | |
|
|
187 | With this tool you can follow exits and teleporters on a map. |
|
|
188 | It will open the map you go to. |
|
|
189 | |
|
|
190 | Shortcut-key in map editor: f |
|
|
191 | |
|
|
192 | =back |
|
|
193 | |
|
|
194 | =head2 THE STACK VIEW |
|
|
195 | |
|
|
196 | This window displays the stack of the picked map cell. |
|
|
197 | You can swap two objects on the stack and delete a object from the stack. |
|
|
198 | |
|
|
199 | By clicking on an item on the stack you can transfer it to the picker and the attribute editor. |
|
|
200 | |
|
|
201 | =head2 THE MAP EDITOR |
|
|
202 | |
|
|
203 | This window just displays the map and lets you use the tools. The shortcuts are |
|
|
204 | documented above in the tool descriptions. |
|
|
205 | |
|
|
206 | You can pan the map with the middle mouse button and use the tool with the |
|
|
207 | left mouse button. |
|
|
208 | |
|
|
209 | There are two modifiers: You can hold the Alt-key to switch quickly to the pick tool |
|
|
210 | and hold the Ctrl-key to switch to the erase tool. The settings from the tool in the |
|
|
211 | main window will be used. |
|
|
212 | |
|
|
213 | =head2 THE ATTRIBUTE EDITOR |
|
|
214 | |
|
|
215 | This is the attribute editing window. On the top will be the name of the |
|
|
216 | arch followed by the name of the object and the type of the arch in parents. |
|
|
217 | |
|
|
218 | The first tabs are the different aspects of the object. |
|
|
219 | The lore and msg tab lets you edit the text attributes of the object. |
|
|
220 | The inventory tab lets you add stuff to the inventory by dragging them from the |
|
|
221 | picked arch in the main window to the top most button with the image in the inventory. |
|
|
222 | (the inventory editor is subject to change and improvement) |
|
|
223 | |
|
|
224 | Tool tips on the labels in the attribute editor show the documentation of the |
|
|
225 | attribute and the tool tips over the editing widget show the default value from the archetypes. |
|
|
226 | |
|
|
227 | |
|
|
228 | =head2 THE PICK WINDOW |
|
|
229 | |
|
|
230 | You can pick archetypes from this window. |
|
|
231 | The left click puts the object in the picker in the main window and the attribute editor. |
|
|
232 | You can change the attributes of the picked arch in the attribute editor and will let you |
|
|
233 | place that modifies object on the map. |
|
|
234 | |
|
|
235 | You can open multiple pick windows. |
6 | |
236 | |
7 | =cut |
237 | =cut |
8 | |
238 | |
9 | our $VERSION = '0.1'; |
239 | our $VERSION = '0.1'; |
10 | |
240 | |
… | |
… | |
34 | our $CFG; |
264 | our $CFG; |
35 | our $MAINWIN; |
265 | our $MAINWIN; |
36 | |
266 | |
37 | use GCE::MainWindow; |
267 | use GCE::MainWindow; |
38 | use Data::Dumper; |
268 | use Data::Dumper; |
|
|
269 | use File::Spec; |
39 | |
270 | |
40 | sub read_cfg { |
271 | sub read_cfg { |
41 | my ($file) = @_; |
272 | my ($file) = @_; |
42 | |
273 | |
43 | open CFG, $file |
274 | open CFG, $file |
… | |
… | |
98 | $window->move ($p_and_s->[0] || $default_x, $p_and_s->[1] || $default_y); |
329 | $window->move ($p_and_s->[0] || $default_x, $p_and_s->[1] || $default_y); |
99 | } |
330 | } |
100 | |
331 | |
101 | read_cfg "$Crossfire::VARDIR/gceconfig"; |
332 | read_cfg "$Crossfire::VARDIR/gceconfig"; |
102 | |
333 | |
|
|
334 | $CFG->{LIBDIR} ||= $ENV{CROSSFIRE_LIBDIR}; |
|
|
335 | $CFG->{MAPDIR} ||= File::Spec->catfile ($CFG->{LIBDIR}, 'maps'); |
|
|
336 | |
103 | # must be done after changing the libdir path: |
337 | # must be done after changing the libdir path: |
104 | Crossfire::set_libdir $ENV{CROSSFIRE_LIBDIR}; |
338 | Crossfire::set_libdir ($CFG->{LIBDIR}); |
105 | Crossfire::load_archetypes; |
339 | Crossfire::load_archetypes; |
106 | Crossfire::load_tilecache; |
340 | Crossfire::load_tilecache; |
107 | |
341 | |
108 | my $w = GCE::MainWindow->new; |
342 | my $w = GCE::MainWindow->new; |
109 | |
343 | |