|
|
1.1 ! root 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 [email protected]. ! 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: ! 76: typedef 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: ! 88: typedef 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: } XDisplay; ! 117: ! 118: ! 119: typedef struct SimView { ! 120: struct SimView *next; ! 121: char *title; ! 122: int type; ! 123: int class; ! 124: ! 125: /* graphics stuff */ ! 126: int *pixels; ! 127: int line_bytes; ! 128: int pixel_bytes; ! 129: int depth; ! 130: unsigned char *data; ! 131: int line_bytes8; ! 132: unsigned char *data8; ! 133: int visible; ! 134: int invalid; ! 135: int skips; ! 136: int skip; ! 137: int update; ! 138: ! 139: /* map stuff */ ! 140: unsigned char *smalltiles; ! 141: short map_state; ! 142: int show_editors; ! 143: ! 144: /* editor stuff */ ! 145: unsigned char *bigtiles; ! 146: short power_type; ! 147: short tool_showing; ! 148: short tool_mode; ! 149: short tool_x, tool_y; ! 150: short tool_x_const, tool_y_const; ! 151: short tool_state; ! 152: short tool_state_save; ! 153: short super_user; ! 154: short show_me; ! 155: short dynamic_filter; ! 156: Tk_TimerToken auto_scroll_token; ! 157: Time tool_event_time; ! 158: Time tool_last_event_time; ! 159: ! 160: /* scrolling */ ! 161: int w_x, w_y; /* view window position */ ! 162: int w_width, w_height; /* view window size */ ! 163: int m_width, m_height; /* memory buffer size */ ! 164: int i_width, i_height; /* ideal whole size */ ! 165: int pan_x, pan_y; /* centered in window */ ! 166: int tile_x, tile_y, tile_width, tile_height; /* visible tiles */ ! 167: int screen_x, screen_y, screen_width, screen_height; /* visible pixels */ ! 168: ! 169: /* tracking */ ! 170: int orig_pan_x, orig_pan_y; ! 171: int last_x, last_y; ! 172: int last_button; ! 173: char *track_info; ! 174: char *message_var; ! 175: ! 176: /* window system */ ! 177: Tk_Window tkwin; ! 178: Tcl_Interp *interp; ! 179: int flags; ! 180: ! 181: XDisplay *x; ! 182: XShmSegmentInfo *shminfo; ! 183: short **tiles; ! 184: short **other_tiles; ! 185: XImage *image; ! 186: XImage *other_image; ! 187: unsigned char *other_data; ! 188: Pixmap pixmap; ! 189: Pixmap pixmap2; ! 190: Pixmap overlay_pixmap; ! 191: Pixmap overlay_valid; ! 192: XFontStruct *fontPtr; ! 193: ! 194: /* timing */ ! 195: int updates; ! 196: double update_real; ! 197: double update_user; ! 198: double update_system; ! 199: int update_context; ! 200: ! 201: /* auto goto */ ! 202: int auto_goto; ! 203: int auto_going; ! 204: int auto_x_goal, auto_y_goal; ! 205: int auto_speed; ! 206: struct SimSprite *follow; ! 207: ! 208: /* sound */ ! 209: int sound; ! 210: ! 211: /* configuration */ ! 212: int width, height; ! 213: ! 214: /* overlay */ ! 215: int show_overlay; ! 216: int overlay_mode; ! 217: struct timeval overlay_time; ! 218: } SimView; ! 219: ! 220: ! 221: typedef struct SimGraph { ! 222: struct SimGraph *next; ! 223: int range; ! 224: int mask; ! 225: Tk_Window tkwin; ! 226: Tcl_Interp *interp; ! 227: int flags; ! 228: XDisplay *x; ! 229: int visible; ! 230: int w_x, w_y; ! 231: int w_width, w_height; ! 232: Pixmap pixmap; ! 233: int *pixels; ! 234: XFontStruct *fontPtr; ! 235: Tk_3DBorder border; ! 236: int borderWidth; ! 237: int relief; ! 238: Tk_TimerToken draw_graph_token; ! 239: } SimGraph; ! 240: ! 241: ! 242: typedef struct SimDate { ! 243: struct SimDate *next; ! 244: int reset; ! 245: int month; ! 246: int year; ! 247: int lastmonth; ! 248: int lastyear; ! 249: Tk_Window tkwin; ! 250: Tcl_Interp *interp; ! 251: int flags; ! 252: XDisplay *x; ! 253: int visible; ! 254: int w_x, w_y; ! 255: int w_width, w_height; ! 256: Pixmap pixmap; ! 257: int *pixels; ! 258: XFontStruct *fontPtr; ! 259: Tk_3DBorder border; ! 260: int borderWidth; ! 261: int padX; ! 262: int padY; ! 263: int width; ! 264: int monthTab; ! 265: int monthTabX; ! 266: int yearTab; ! 267: int yearTabX; ! 268: Tk_TimerToken draw_date_token; ! 269: } SimDate; ! 270: ! 271: ! 272: typedef struct SimSprite { ! 273: struct SimSprite *next; ! 274: char *name; ! 275: int type; ! 276: int frame; ! 277: int x, y; ! 278: int width, height; ! 279: int x_offset, y_offset; ! 280: int x_hot, y_hot; ! 281: int orig_x, orig_y; ! 282: int dest_x, dest_y; ! 283: int count, sound_count; ! 284: int dir, new_dir; ! 285: int step, flag, control; ! 286: int turn; ! 287: int accel; ! 288: int speed; ! 289: } SimSprite; ! 290: ! 291: ! 292: #ifdef CAM ! 293: #include "cam.h" ! 294: #endif ! 295: ! 296: ! 297: typedef struct Person { ! 298: int id; ! 299: char *name; ! 300: } Person; ! 301: ! 302: ! 303: typedef struct Sim { ! 304: int editors; ! 305: SimView *editor; ! 306: int maps; ! 307: SimView *map; ! 308: int graphs; ! 309: SimGraph *graph; ! 310: int dates; ! 311: SimDate *date; ! 312: int sprites; ! 313: SimSprite *sprite; ! 314: #ifdef CAM ! 315: int scams; ! 316: SimCam *scam; ! 317: #endif ! 318: Ink *overlay; ! 319: } Sim; ! 320: ! 321: ! 322: typedef struct Cmd { ! 323: char *name; ! 324: int (*cmd)(); ! 325: } Cmd; ! 326:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.