1 /* ---------------------------------------------------------------------- *
2  * cliglobs.c
3  * This file is part of lincity.
4  * Lincity is copyright (c) I J Peters 1995-1997, (c) Greg Sharp 1997-2001.
5  * ---------------------------------------------------------------------- */
6 #include "cliglobs.h"
7 #include "common.h"
8 #include "geometry.h"
9 #include "lcintl.h"
10 
11 Screen_Geometry scr;
12 short mappointoldtype[WORLD_SIDE_LEN][WORLD_SIDE_LEN];
13 
14 int lc_mouse_type;
15 char progbox[(PROGBOXW + 16) * (PROGBOXH + 16)];
16 
17 /* Preferences */
18 int overwrite_transport_flag = 0;
19 int suppress_popups = 0;
20 int time_multiplex_stats = 0;
21 int no_init_help = 0;
22 int confine_flag = 0;	/* Only used for X11 */
23 int skip_splash_screen = 0;
24 int suppress_firsttime_module_help = 0;
25 
26 int main_screen_flag = MAIN_SCREEN_NORMAL_FLAG;
27 
28 int mappoint_stats_flag = 0, mappoint_stats_time = 0;
29 int mini_screen_flags = MINI_SCREEN_NORMAL_FLAG;
30 int mini_screen_time = 0;
31 int mini_screen_port_x, mini_screen_port_y;
32 
33 float gamma_correct_red = 0.0, gamma_correct_green = 0.0, gamma_correct_blue = 0.0;
34 
35 int mouse_initialized = 0;
36 int cs_mouse_x, cs_mouse_y, cs_mouse_button;	/* current mouse status */
37 int cs_mouse_shifted = 0;	/* shift key pressed with mouse. */
38 int cs_mouse_xmax, cs_mouse_ymax, omx, omy, mox = 10, moy = 10;
39 
40 int mouse_hide_count;
41 #if defined (WIN32)
42 /* int cs_current_mouse_x, cs_current_mouse_y, cs_current_mouse_button; */
43 int cs_square_mouse_visible = 0;
44 #endif
45 int kmousex, kmousey, kmouse_val, reset_mouse_flag, mt_flag = 0;
46 
47 char under_square_mouse_pointer_top[20 * 2 * 4];
48 char under_square_mouse_pointer_left[18 * 2 * 4];
49 char under_square_mouse_pointer_right[18 * 2 * 4];
50 char under_square_mouse_pointer_bottom[20 * 2 * 4];
51 int mouse_type = MOUSE_TYPE_NORMAL;
52 
53 int mt_start_posx, mt_start_posy, mt_current_posx, mt_current_posy;
54 
55 char *months[] =
56 {N_("Jan"), N_("Feb"), N_("Mar"), N_("Apr"),
57 N_("May"), N_("Jun"), N_("Jul"), N_("Aug"),
58 N_("Sep"), N_("Oct"), N_("Nov"), N_("Dec")};
59 
60 char *up_pbar1_graphic, *up_pbar2_graphic;
61 char *down_pbar1_graphic, *down_pbar2_graphic, *pop_pbar_graphic;
62 char *tech_pbar_graphic, *food_pbar_graphic, *jobs_pbar_graphic;
63 char *money_pbar_graphic, *coal_pbar_graphic, *goods_pbar_graphic;
64 char *ore_pbar_graphic, *steel_pbar_graphic;
65 char *pause_button1_off, *pause_button2_off;
66 char *pause_button1_on, *pause_button2_on;
67 char *fast_button1_off, *fast_button2_off;
68 char *fast_button1_on, *fast_button2_on;
69 char *med_button1_off, *med_button2_off;
70 char *med_button1_on, *med_button2_on;
71 char *slow_button1_off, *slow_button2_off;
72 char *slow_button1_on, *slow_button2_on;
73 char *results_button1, *results_button2;
74 char *toveron_button1, *toveron_button2;
75 char *toveroff_button1, *toveroff_button2;
76 #ifdef LC_X11
77 char *confine_button, *unconfine_button;
78 #endif
79 int pause_flag = 0, slow_flag = 0, med_flag = 0, fast_flag = 0;
80 
81 char *ms_pollution_button_graphic, *ms_normal_button_graphic;
82 char *ms_fire_cover_button_graphic, *ms_health_cover_button_graphic;
83 char *ms_cricket_cover_button_graphic;
84 char *ms_ub40_button_graphic, *ms_coal_button_graphic;
85 char *ms_starve_button_graphic, *ms_ocost_button_graphic;
86 char *ms_power_button_graphic;
87 char *checked_box_graphic, *unchecked_box_graphic;
88 
89 char market_cb_gbuf[MARKET_CB_W * MARKET_CB_H];
90 int market_cb_flag = 0, mcbx, mcby, market_cb_drawn_flag = 0;
91 int port_cb_flag = 0, port_cb_drawn_flag = 0;
92 
93 /* GCS -- this one is difficult to deal with.
94    LinCity will give your money back if you bulldoze
95    the most recently constructed building (i.e. if
96    you make a mistake.  How does this fit into a
97    multiplayer game?  Not at all, I suppose... */
98 
99 int help_flag, numof_help_buttons, help_history_count, help_return_val;
100 int block_help_exit;
101 int help_button_x[MAX_NUMOF_HELP_BUTTONS];
102 int help_button_y[MAX_NUMOF_HELP_BUTTONS];
103 int help_button_w[MAX_NUMOF_HELP_BUTTONS];
104 int help_button_h[MAX_NUMOF_HELP_BUTTONS];
105 char help_button_s[MAX_NUMOF_HELP_BUTTONS][MAX_LENOF_HELP_FILENAME];
106 char help_button_history[MAX_HELP_HISTORY][MAX_LENOF_HELP_FILENAME];
107 char *help_button_graphic, help_graphic[MAX_ICON_LEN];
108 char *quit_button_graphic, *load_button_graphic, *save_button_graphic;
109 char *menu_button_graphic;
110 int quit_flag, network_flag, load_flag, save_flag;
111 int prefs_flag = 0, prefs_drawn_flag = 0;
112 int monument_bul_flag, river_bul_flag, shanty_bul_flag;
113 int must_release_button = 0, let_one_through = 0;
114 
115 int db_yesbox_x1, db_yesbox_x2, db_yesbox_y1, db_yesbox_y2;
116 int db_nobox_x1, db_nobox_x2, db_nobox_y1, db_nobox_y2;
117 int db_flag, db_yesbox_clicked, db_nobox_clicked;
118 char okmessage[22][74];
119 int db_okbox_x1, db_okbox_x2, db_okbox_y1, db_okbox_y2, db_okflag, db_okbox_clicked;
120 int suppress_ok_buttons;
121 
122 disp display;
123 int borderx, bordery;
124 
125 int command_line_debug = 0;
126 
127 #ifdef LC_X11
128 int winX, winY, mouse_button;
129 
130 char *bg_color = NULL;
131 int verbose = FALSE;		/* display settings if TRUE */
132 int stay_in_front = FALSE;	/* Try to stay in clear area of the screen. */
133 int text_bg = 0;
134 int text_fg = 255;
135 int x_key_value;
136 int x_key_shifted = 0;	/* Is the key shifted? */
137 int xclip_x1, xclip_y1, xclip_x2, xclip_y2, clipping_flag = 0;
138 long unsigned int colour_table[256];
139 unsigned char *open_font;
140 int open_font_height, suppress_next_expose = 0;
141 Cursor pirate_cursor;
142 
143 #ifdef USE_PIXMAPS
144 Pixmap icon_pixmap[NUM_OF_TYPES];
145 char icon_pixmap_flag[NUM_OF_TYPES];
146 #endif
147 #endif
148 
149 #ifdef WIN32
150 int mouse_button;
151 char *bg_color = NULL;
152 char dummy1[1024];
153 char dummy2[1024];
154 int verbose = FALSE;		/* display settings if TRUE */
155 int stay_in_front = FALSE;	/* Try to stay in clear area of the screen. */
156 int text_bg = 0;
157 int text_fg = 255;
158 int x_key_value = 0;		/* GCS: Add initialization value */
159 BOOL x_key_shifted = FALSE;	/* Is the key shifted? */
160 int xclip_x1, xclip_y1, xclip_x2, xclip_y2, clipping_flag = 0;
161 long unsigned int colour_table[256];
162 unsigned char *open_font;
163 int open_font_height, suppress_next_expose = 0;
164 
165 #if defined (USE_PIXMAPS)
166 HBITMAP icon_pixmap[NUM_OF_TYPES];
167 char icon_pixmap_flag[NUM_OF_TYPES];
168 #endif
169 #endif /* WIN32 */
170