1 #include "e3d.h"
2 #include "global.h"
3 
4 int have_arb_compression=0;
5 int have_s3_compression=0;
6 int elwin_mouse;
7 
8 int map_meters_size_x;
9 int map_meters_size_y;
10 
11 int window_width=800;
12 int window_height=570;
13 
14 int bpp;
15 
16 Uint32 cur_time=0, last_time=0;//for FPS
17 char exec_path[256];
18 
19 int video_mode=2;
20 int auto_save_time=0;
21 
22 float camera_x_end_point;
23 float camera_z_end_point;
24 
25 int last_texture=-2;
26 
27 float gcr=0.8f,gcg=0.8f,gcb=0.8f;
28 
29 e3d_cache_struct e3d_cache[1000];
30 obj_2d_cache_struct obj_2d_def_cache[MAX_OBJ_2D_DEF];
31 
32 object3d *objects_list[MAX_OBJ_3D];
33 obj_2d *obj_2d_list[MAX_OBJ_2D];
34 
35   Uint8 *e3d_file_mem;
36   Uint8 *handle_e3d_file_mem;
37 
38 //lights
39 GLfloat global_lights[global_lights_no][4];
40 
41 GLfloat sky_lights_c1[global_lights_no*2][4];
42 GLfloat sky_lights_c2[global_lights_no*2][4];
43 GLfloat sky_lights_c3[global_lights_no*2][4];
44 GLfloat sky_lights_c4[global_lights_no*2][4];
45 
46 
47 GLfloat light_0_position[4];
48 GLfloat light_0_diffuse[4];
49 GLfloat light_0_dist;
50 
51 GLfloat light_1_position[4];
52 GLfloat light_1_diffuse[4];
53 GLfloat light_1_dist;
54 
55 GLfloat light_2_position[4];
56 GLfloat light_2_diffuse[4];
57 GLfloat light_2_dist;
58 
59 GLfloat light_3_position[4];
60 GLfloat light_3_diffuse[4];
61 GLfloat light_3_dist;
62 
63 GLfloat light_4_position[4];
64 GLfloat light_4_diffuse[4];
65 GLfloat light_4_dist;
66 
67 GLfloat light_5_position[4];
68 GLfloat light_5_diffuse[4];
69 GLfloat light_5_dist;
70 
71 GLfloat light_6_position[4];
72 GLfloat light_6_diffuse[4];
73 GLfloat light_6_dist;
74 
75 light *lights_list[MAX_LIGHTS];
76 sun sun_pos[60*3];
77 char lights_on=1;
78 unsigned char light_level=0;
79 int game_minute=60;
80 
81 //tile map things
82 unsigned char *tile_map;
83 int tile_map_size_x;
84 int tile_map_size_y;
85 int tile_list[256];
86 
87 char dungeon=0;//no sun
88 float ambient_r=0;
89 float ambient_g=0;
90 float ambient_b=0;
91 
92 //interface
93 int mouse_x;
94 int mouse_y;
95 int mouse_delta_x;
96 int mouse_delta_y;
97 int right_click;
98 int left_click;
99 int middle_click;
100 
101 int icons_text;
102 
103 float scene_mouse_x;
104 float scene_mouse_y;
105 
106 int cur_mode=mode_3d;
107 int cur_tool=tool_select;
108 int view_tile=1;
109 int view_2d=1;
110 int view_3d=1;
111 int view_particles=1;
112 int view_particle_handles=1;
113 int view_eye_candy=1;
114 int view_light=1;
115 int view_height=0;
116 int selected_3d_object=-1;
117 int selected_2d_object=-1;
118 int selected_particles_object=-1;
119 int selected_light=-1;
120 int selected_tile=255;
121 int selected_height=-1;
122 char move_tile_a_tile=0;
123 char move_tile_a_height=0;
124 int tiles_no = 255;
125 int tile_offset=0;
126 float x_tile_menu_offset=64;
127 float y_tile_menu_offset=128;
128 char view_new_map_menu=0;
129 int view_grid=0;
130 int view_tooltips=1;
131 
132 #if defined(SDL2)
133 Uint16 mod_key_status;
134 #else
135 SDLMod mod_key_status;
136 #endif
137 char shift_on=0;
138 char ctrl_on=0;
139 char alt_on=0;
140 
141 int buttons_text;
142 
143 
144 //editor things
145 unsigned char *height_map;
146 char heights_3d=0;
147 char minimap_on=0;
148 int new_map_menu = -1;
149 
150 //shadows
151 
152 float fDestMat[16];
153 float fSunPos[4]={400.0, 400.0, 500.0, 0.0};
154 float fLightPos[4]={400.0, 400.0, 500.0, 0.0};
155 float fPlane[4]={0,0,1,0.0};
156 int shadows_on=0;
157 int day_shadows_on;
158 int night_shadows_on;
159 
160 
161 //reflections
162 water_vertex noise_array[16*16];
163 float water_deepth_offset=-0.25f;
164 int lake_waves_timer=0;
165 float water_movement_u=0;
166 float water_movement_v=0;
167 
168 #ifndef LINUX //extensions
169 PFNGLMULTITEXCOORD2FARBPROC		glMultiTexCoord2fARB	= NULL;
170 PFNGLMULTITEXCOORD2FVARBPROC	glMultiTexCoord2fvARB	= NULL;
171 PFNGLACTIVETEXTUREARBPROC		glActiveTextureARB		= NULL;
172 PFNGLCLIENTACTIVETEXTUREARBPROC	glClientActiveTextureARB= NULL;
173 #endif
174 int have_multitexture;
175 int ground_detail_text;
176 
177 float clouds_movement_u=-8;
178 float clouds_movement_v=-3;
179 Uint32 last_clear_clouds=0;
180 float texture_scale=12.0;
181 int use_mipmaps=0;
182 
183