Sky API: Rename *_tint to fog_*_tint for consistency
[oweals/minetest.git] / src / client / clientevent.h
1 /*
2 Minetest
3 Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #pragma once
21
22 #include <string>
23 #include "irrlichttypes_bloated.h"
24 #include "hud.h"
25 #include "skyparams.h"
26
27 enum ClientEventType : u8
28 {
29         CE_NONE,
30         CE_PLAYER_DAMAGE,
31         CE_PLAYER_FORCE_MOVE,
32         CE_DEATHSCREEN,
33         CE_SHOW_FORMSPEC,
34         CE_SHOW_LOCAL_FORMSPEC,
35         CE_SPAWN_PARTICLE,
36         CE_ADD_PARTICLESPAWNER,
37         CE_DELETE_PARTICLESPAWNER,
38         CE_HUDADD,
39         CE_HUDRM,
40         CE_HUDCHANGE,
41         CE_SET_SKY,
42         CE_SET_SUN,
43         CE_SET_MOON,
44         CE_SET_STARS,
45         CE_OVERRIDE_DAY_NIGHT_RATIO,
46         CE_CLOUD_PARAMS,
47         CLIENTEVENT_MAX,
48 };
49
50 struct ClientEvent
51 {
52         ClientEventType type;
53         union
54         {
55                 // struct{
56                 //} none;
57                 struct
58                 {
59                         u16 amount;
60                 } player_damage;
61                 struct
62                 {
63                         f32 pitch;
64                         f32 yaw;
65                 } player_force_move;
66                 struct
67                 {
68                         bool set_camera_point_target;
69                         f32 camera_point_target_x;
70                         f32 camera_point_target_y;
71                         f32 camera_point_target_z;
72                 } deathscreen;
73                 struct
74                 {
75                         std::string *formspec;
76                         std::string *formname;
77                 } show_formspec;
78                 // struct{
79                 //} textures_updated;
80                 struct
81                 {
82                         v3f *pos;
83                         v3f *vel;
84                         v3f *acc;
85                         f32 expirationtime;
86                         f32 size;
87                         bool collisiondetection;
88                         bool collision_removal;
89                         bool object_collision;
90                         bool vertical;
91                         std::string *texture;
92                         struct TileAnimationParams animation;
93                         u8 glow;
94                 } spawn_particle;
95                 struct
96                 {
97                         u16 amount;
98                         f32 spawntime;
99                         v3f *minpos;
100                         v3f *maxpos;
101                         v3f *minvel;
102                         v3f *maxvel;
103                         v3f *minacc;
104                         v3f *maxacc;
105                         f32 minexptime;
106                         f32 maxexptime;
107                         f32 minsize;
108                         f32 maxsize;
109                         bool collisiondetection;
110                         bool collision_removal;
111                         bool object_collision;
112                         u16 attached_id;
113                         bool vertical;
114                         std::string *texture;
115                         u64 id;
116                         struct TileAnimationParams animation;
117                         u8 glow;
118                 } add_particlespawner;
119                 struct
120                 {
121                         u32 id;
122                 } delete_particlespawner;
123                 struct
124                 {
125                         u32 server_id;
126                         u8 type;
127                         v2f *pos;
128                         std::string *name;
129                         v2f *scale;
130                         std::string *text;
131                         u32 number;
132                         u32 item;
133                         u32 dir;
134                         v2f *align;
135                         v2f *offset;
136                         v3f *world_pos;
137                         v2s32 *size;
138                         s16 z_index;
139                 } hudadd;
140                 struct
141                 {
142                         u32 id;
143                 } hudrm;
144                 struct
145                 {
146                         u32 id;
147                         HudElementStat stat;
148                         v2f *v2fdata;
149                         std::string *sdata;
150                         u32 data;
151                         v3f *v3fdata;
152                         v2s32 *v2s32data;
153                 } hudchange;
154                 SkyboxParams *set_sky;
155                 struct
156                 {
157                         bool do_override;
158                         float ratio_f;
159                 } override_day_night_ratio;
160                 struct
161                 {
162                         f32 density;
163                         u32 color_bright;
164                         u32 color_ambient;
165                         f32 height;
166                         f32 thickness;
167                         f32 speed_x;
168                         f32 speed_y;
169                 } cloud_params;
170                 SunParams *sun_params;
171                 MoonParams *moon_params;
172                 StarParams *star_params;
173         };
174 };