]> git.zerfleddert.de Git - micropolis/blame_incremental - src/sim/headers/view.h
better search for matching visual
[micropolis] / src / sim / headers / view.h
... / ...
CommitLineData
1/* view.h
2 *
3 * Micropolis, Unix Version. This game was released for the Unix platform
4 * in or about 1990 and has been modified for inclusion in the One Laptop
5 * Per Child program. Copyright (C) 1989 - 2007 Electronic Arts Inc. If
6 * you need assistance with this program, you may contact:
7 * http://wiki.laptop.org/go/Micropolis or email micropolis@laptop.org.
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or (at
12 * your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details. You should have received a
18 * copy of the GNU General Public License along with this program. If
19 * not, see <http://www.gnu.org/licenses/>.
20 *
21 * ADDITIONAL TERMS per GNU GPL Section 7
22 *
23 * No trademark or publicity rights are granted. This license does NOT
24 * give you any right, title or interest in the trademark SimCity or any
25 * other Electronic Arts trademark. You may not distribute any
26 * modification of this program using the trademark SimCity or claim any
27 * affliation or association with Electronic Arts Inc. or its employees.
28 *
29 * Any propagation or conveyance of this program must include this
30 * copyright notice and these terms.
31 *
32 * If you convey this program (or any modifications of it) and assume
33 * contractual liability for the program to recipients of it, you agree
34 * to indemnify Electronic Arts for any liability that those contractual
35 * assumptions impose on Electronic Arts.
36 *
37 * You may not misrepresent the origins of this program; modified
38 * versions of the program must be marked as such and not identified as
39 * the original program.
40 *
41 * This disclaimer supplements the one included in the General Public
42 * License. TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, THIS
43 * PROGRAM IS PROVIDED TO YOU "AS IS," WITH ALL FAULTS, WITHOUT WARRANTY
44 * OF ANY KIND, AND YOUR USE IS AT YOUR SOLE RISK. THE ENTIRE RISK OF
45 * SATISFACTORY QUALITY AND PERFORMANCE RESIDES WITH YOU. ELECTRONIC ARTS
46 * DISCLAIMS ANY AND ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES,
47 * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY,
48 * FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT OF THIRD PARTY
49 * RIGHTS, AND WARRANTIES (IF ANY) ARISING FROM A COURSE OF DEALING,
50 * USAGE, OR TRADE PRACTICE. ELECTRONIC ARTS DOES NOT WARRANT AGAINST
51 * INTERFERENCE WITH YOUR ENJOYMENT OF THE PROGRAM; THAT THE PROGRAM WILL
52 * MEET YOUR REQUIREMENTS; THAT OPERATION OF THE PROGRAM WILL BE
53 * UNINTERRUPTED OR ERROR-FREE, OR THAT THE PROGRAM WILL BE COMPATIBLE
54 * WITH THIRD PARTY SOFTWARE OR THAT ANY ERRORS IN THE PROGRAM WILL BE
55 * CORRECTED. NO ORAL OR WRITTEN ADVICE PROVIDED BY ELECTRONIC ARTS OR
56 * ANY AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. SOME
57 * JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF OR LIMITATIONS ON IMPLIED
58 * WARRANTIES OR THE LIMITATIONS ON THE APPLICABLE STATUTORY RIGHTS OF A
59 * CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY
60 * NOT APPLY TO YOU.
61 */
62
63#define X_Mem_View 1
64#define X_Wire_View 2
65
66#define Editor_Class 0
67#define Map_Class 1
68
69#define Button_Press 0
70#define Button_Move 1
71#define Button_Release 2
72
73#define VIEW_REDRAW_PENDING 1
74
75
76typedef struct Ink {
77 struct Ink *next;
78 int x, y;
79 int color;
80 int length;
81 int maxlength;
82 XPoint *points;
83 int left, top, right, bottom;
84 int last_x, last_y;
85} Ink;
86
87
88typedef struct XDisplay {
89 struct XDisplay *next;
90 int references;
91 char *display;
92 TkDisplay *tkDisplay;
93 Display *dpy;
94 Screen *screen;
95 Window root;
96 Visual *visual;
97 int depth;
98 int color;
99 Colormap colormap;
100 int *pixels;
101 GC gc;
102 int shared;
103 unsigned long last_request_read;
104 unsigned long request;
105 XImage *big_tile_image;
106 XImage *small_tile_image;
107 Pixmap big_tile_pixmap;
108 Pixmap **objects;
109 GC overlay_gc;
110 Pixmap gray25_stipple;
111 Pixmap gray50_stipple;
112 Pixmap gray75_stipple;
113 Pixmap vert_stipple;
114 Pixmap horiz_stipple;
115 Pixmap diag_stipple;
116 int needs_swap;
117} XDisplay;
118
119
120typedef struct SimView {
121 struct SimView *next;
122 char *title;
123 int type;
124 int class;
125
126/* graphics stuff */
127 int *pixels;
128 int line_bytes;
129 int pixel_bytes;
130 int depth;
131 unsigned char *data;
132 int line_bytes8;
133 unsigned char *data8;
134 int visible;
135 int invalid;
136 int skips;
137 int skip;
138 int update;
139
140/* map stuff */
141 unsigned char *smalltiles;
142 short map_state;
143 int show_editors;
144
145/* editor stuff */
146 unsigned char *bigtiles;
147 short power_type;
148 short tool_showing;
149 short tool_mode;
150 short tool_x, tool_y;
151 short tool_x_const, tool_y_const;
152 short tool_state;
153 short tool_state_save;
154 short super_user;
155 short show_me;
156 short dynamic_filter;
157 Tk_TimerToken auto_scroll_token;
158 Time tool_event_time;
159 Time tool_last_event_time;
160
161/* scrolling */
162 int w_x, w_y; /* view window position */
163 int w_width, w_height; /* view window size */
164 int m_width, m_height; /* memory buffer size */
165 int i_width, i_height; /* ideal whole size */
166 int pan_x, pan_y; /* centered in window */
167 int tile_x, tile_y, tile_width, tile_height; /* visible tiles */
168 int screen_x, screen_y, screen_width, screen_height; /* visible pixels */
169
170/* tracking */
171 int orig_pan_x, orig_pan_y;
172 int last_x, last_y;
173 int last_button;
174 char *track_info;
175 char *message_var;
176
177/* window system */
178 Tk_Window tkwin;
179 Tcl_Interp *interp;
180 int flags;
181
182 XDisplay *x;
183 XShmSegmentInfo *shminfo;
184 short **tiles;
185 short **other_tiles;
186 XImage *image;
187 XImage *other_image;
188 unsigned char *other_data;
189 Pixmap pixmap;
190 Pixmap pixmap2;
191 Pixmap overlay_pixmap;
192 Pixmap overlay_valid;
193 XFontStruct *fontPtr;
194
195/* timing */
196 int updates;
197 double update_real;
198 double update_user;
199 double update_system;
200 int update_context;
201
202/* auto goto */
203 int auto_goto;
204 int auto_going;
205 int auto_x_goal, auto_y_goal;
206 int auto_speed;
207 struct SimSprite *follow;
208
209/* sound */
210 int sound;
211
212/* configuration */
213 int width, height;
214
215/* overlay */
216 int show_overlay;
217 int overlay_mode;
218 struct timeval overlay_time;
219} SimView;
220
221
222typedef struct SimGraph {
223 struct SimGraph *next;
224 int range;
225 int mask;
226 Tk_Window tkwin;
227 Tcl_Interp *interp;
228 int flags;
229 XDisplay *x;
230 int visible;
231 int w_x, w_y;
232 int w_width, w_height;
233 Pixmap pixmap;
234 int *pixels;
235 XFontStruct *fontPtr;
236 Tk_3DBorder border;
237 int borderWidth;
238 int relief;
239 Tk_TimerToken draw_graph_token;
240} SimGraph;
241
242
243typedef struct SimDate {
244 struct SimDate *next;
245 int reset;
246 int month;
247 int year;
248 int lastmonth;
249 int lastyear;
250 Tk_Window tkwin;
251 Tcl_Interp *interp;
252 int flags;
253 XDisplay *x;
254 int visible;
255 int w_x, w_y;
256 int w_width, w_height;
257 Pixmap pixmap;
258 int *pixels;
259 XFontStruct *fontPtr;
260 Tk_3DBorder border;
261 int borderWidth;
262 int padX;
263 int padY;
264 int width;
265 int monthTab;
266 int monthTabX;
267 int yearTab;
268 int yearTabX;
269 Tk_TimerToken draw_date_token;
270} SimDate;
271
272
273typedef struct SimSprite {
274 struct SimSprite *next;
275 char *name;
276 int type;
277 int frame;
278 int x, y;
279 int width, height;
280 int x_offset, y_offset;
281 int x_hot, y_hot;
282 int orig_x, orig_y;
283 int dest_x, dest_y;
284 int count, sound_count;
285 int dir, new_dir;
286 int step, flag, control;
287 int turn;
288 int accel;
289 int speed;
290} SimSprite;
291
292
293#ifdef CAM
294#include "cam.h"
295#endif
296
297
298typedef struct Person {
299 int id;
300 char *name;
301} Person;
302
303
304typedef struct Sim {
305 int editors;
306 SimView *editor;
307 int maps;
308 SimView *map;
309 int graphs;
310 SimGraph *graph;
311 int dates;
312 SimDate *date;
313 int sprites;
314 SimSprite *sprite;
315#ifdef CAM
316 int scams;
317 SimCam *scam;
318#endif
319 Ink *overlay;
320} Sim;
321
322
323typedef struct Cmd {
324 char *name;
325 int (*cmd)();
326} Cmd;
327
Impressum, Datenschutz