1 #pragma once
2 
3 //********************************************************************************************
4 //*
5 //*    This file is part of Egoboo.
6 //*
7 //*    Egoboo is free software: you can redistribute it and/or modify it
8 //*    under the terms of the GNU General Public License as published by
9 //*    the Free Software Foundation, either version 3 of the License, or
10 //*    (at your option) any later version.
11 //*
12 //*    Egoboo is distributed in the hope that it will be useful, but
13 //*    WITHOUT ANY WARRANTY; without even the implied warranty of
14 //*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 //*    General Public License for more details.
16 //*
17 //*    You should have received a copy of the GNU General Public License
18 //*    along with Egoboo.  If not, see <http://www.gnu.org/licenses/>.
19 //*
20 //********************************************************************************************
21 
22 /// @file file_formats/wawalite_file.h
23 /// @details loading the environment definitions for a module
24 
25 #include "egoboo_math.h"
26 
27 #if defined(__cplusplus)
28 extern "C"
29 {
30 #endif
31 
32 //--------------------------------------------------------------------------------------------
33 //--------------------------------------------------------------------------------------------
34 #define MAXWATERLAYER 2                             ///< Maximum water layers
35 
36 //--------------------------------------------------------------------------------------------
37 //--------------------------------------------------------------------------------------------
38 
39 /// A wrapper for the water layer data in "wawalite.txt"
40     struct s_wawalite_water_layer
41     {
42         Uint32  frame_add;      ///< Speed
43 
44         float   z;                ///< Base height of water
45         float   amp;            ///< Amplitude of waves
46 
47         fvec2_t dist;            ///< For distant backgrounds
48         Uint32  light_dir;        ///< direct  reflectivity 0 - 63
49         Uint32  light_add;        ///< ambient reflectivity 0 - 63
50 
51         fvec2_t tx_add;            ///< Texture movement
52         Uint8   alpha;            ///< Transparency
53     };
54     typedef struct s_wawalite_water_layer wawalite_water_layer_t;
55 
56 //--------------------------------------------------------------------------------------------
57 
58 /// A wrapper for the water data in "wawalite.txt"
59     struct s_wawalite_water
60     {
61         int                    layer_count;
62         wawalite_water_layer_t layer[MAXWATERLAYER];
63 
64         float  surface_level;    ///< Surface level for water striders
65         float  douse_level;         ///< Surface level for torches
66         Uint8  spek_start;         ///< Specular begins at which light value
67         Uint8  spek_level;         ///< General specular amount (0-255)
68         bool_t is_water;         ///< Is it water?  ( Or lava... )
69         bool_t overlay_req;
70         bool_t background_req;
71 
72         bool_t light;            ///< Is it light ( default is alpha )
73 
74         float  foregroundrepeat;
75         float  backgroundrepeat;
76     };
77     typedef struct s_wawalite_water wawalite_water_t;
78 
79 //--------------------------------------------------------------------------------------------
80 
81 /// A wrapper for the physics data in "wawalite.txt"
82     struct s_wawalite_physics
83     {
84         float hillslide;
85         float slippyfriction;
86         float airfriction;
87         float waterfriction;
88         float noslipfriction;
89         float gravity;
90     };
91     typedef struct s_wawalite_physics wawalite_physics_t;
92 
93 //--------------------------------------------------------------------------------------------
94 
95 /// A wrapper for the animated tile data in "wawalite.txt"
96     struct s_wawalite_animtile
97     {
98         Uint32 update_and;
99         Uint32 frame_and;
100     };
101     typedef struct s_wawalite_animtile wawalite_animtile_t;
102 
103 //--------------------------------------------------------------------------------------------
104 
105 /// A wrapper for the damagetile data in "wawalite.txt"
106     struct s_wawalite_damagetile
107     {
108         Uint32 amount;
109         int    damagetype;
110 
111         int    part_gpip;
112         Uint32 partand;
113         int    sound_index;
114     };
115     typedef struct s_wawalite_damagetile wawalite_damagetile_t;
116 
117 //--------------------------------------------------------------------------------------------
118 
119 /// A wrapper for the weather data in "wawalite.txt"
120     struct s_wawalite_weather
121     {
122         bool_t  over_water;
123         int     timer_reset;
124         int     part_gpip;           ///< Which particle to spawn?
125     };
126     typedef struct s_wawalite_weather wawalite_weather_t;
127 
128 /// A wrapper for the graphics data in "wawalite.txt"
129     struct s_wawalite_graphics
130     {
131         bool_t exploremode;
132         bool_t usefaredge;
133     };
134     typedef struct s_wawalite_graphics wawalite_graphics_t;
135 
136 //--------------------------------------------------------------------------------------------
137 
138 /// A wrapper for the camera data in "wawalite.txt"
139     struct s_wawalite_camera
140     {
141         bool_t swing;
142         float  swingrate;
143         float  swingamp;
144     };
145     typedef struct s_wawalite_camera wawalite_camera_t;
146 
147 //--------------------------------------------------------------------------------------------
148 
149 /// A wrapper for the fog data in "wawalite.txt"
150     struct s_wawalite_fog
151     {
152         bool_t found;
153         float  top;
154         float  bottom;
155         float  red;
156         float  grn;
157         float  blu;
158         bool_t affects_water;
159     };
160     typedef struct s_wawalite_fog wawalite_fog_t;
161 
162 //--------------------------------------------------------------------------------------------
163 
164 /// An internal representation of the data in "wawalite.txt"
165     struct s_wawalite_data
166     {
167         Uint32 seed;
168         Sint8 version;
169 
170         wawalite_water_t      water;
171         wawalite_physics_t    phys;
172         wawalite_animtile_t   animtile;
173         wawalite_damagetile_t damagetile;
174 
175         wawalite_weather_t    weather;
176         wawalite_graphics_t   graphics;
177         wawalite_camera_t     camera;
178         wawalite_fog_t        fog;
179 
180         float light_x;
181         float light_y;
182         float light_z;
183         float light_a;
184     };
185 
186     typedef struct s_wawalite_data wawalite_data_t;
187 
188 //--------------------------------------------------------------------------------------------
189 //--------------------------------------------------------------------------------------------
190     extern wawalite_data_t wawalite_data;
191 
192 //--------------------------------------------------------------------------------------------
193 //--------------------------------------------------------------------------------------------
194     bool_t            write_wawalite_file_vfs( wawalite_data_t * pdata );
195     wawalite_data_t * read_wawalite_file_vfs( const char *filename, wawalite_data_t * pdata );
196 
197 //--------------------------------------------------------------------------------------------
198 //--------------------------------------------------------------------------------------------
199 
200 #if defined(__cplusplus)
201 }
202 #endif
203 
204 //--------------------------------------------------------------------------------------------
205 //--------------------------------------------------------------------------------------------
206 
207 #define _wawalite_h
208