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 
25 struct ParticleParameters;
26 struct ParticleSpawnerParameters;
27 struct SkyboxParams;
28 struct SunParams;
29 struct MoonParams;
30 struct StarParams;
31 
32 enum ClientEventType : u8
33 {
34 	CE_NONE,
35 	CE_PLAYER_DAMAGE,
36 	CE_PLAYER_FORCE_MOVE,
37 	CE_DEATHSCREEN,
38 	CE_SHOW_FORMSPEC,
39 	CE_SHOW_LOCAL_FORMSPEC,
40 	CE_SPAWN_PARTICLE,
41 	CE_ADD_PARTICLESPAWNER,
42 	CE_DELETE_PARTICLESPAWNER,
43 	CE_HUDADD,
44 	CE_HUDRM,
45 	CE_HUDCHANGE,
46 	CE_SET_SKY,
47 	CE_SET_SUN,
48 	CE_SET_MOON,
49 	CE_SET_STARS,
50 	CE_OVERRIDE_DAY_NIGHT_RATIO,
51 	CE_CLOUD_PARAMS,
52 	CLIENTEVENT_MAX,
53 };
54 
55 struct ClientEvent
56 {
57 	ClientEventType type;
58 	union
59 	{
60 		// struct{
61 		//} none;
62 		struct
63 		{
64 			u16 amount;
65 		} player_damage;
66 		struct
67 		{
68 			f32 pitch;
69 			f32 yaw;
70 		} player_force_move;
71 		struct
72 		{
73 			bool set_camera_point_target;
74 			f32 camera_point_target_x;
75 			f32 camera_point_target_y;
76 			f32 camera_point_target_z;
77 		} deathscreen;
78 		struct
79 		{
80 			std::string *formspec;
81 			std::string *formname;
82 		} show_formspec;
83 		// struct{
84 		//} textures_updated;
85 		ParticleParameters *spawn_particle;
86 		struct
87 		{
88 			ParticleSpawnerParameters *p;
89 			u16 attached_id;
90 			u64 id;
91 		} add_particlespawner;
92 		struct
93 		{
94 			u32 id;
95 		} delete_particlespawner;
96 		struct
97 		{
98 			u32 server_id;
99 			u8 type;
100 			v2f *pos;
101 			std::string *name;
102 			v2f *scale;
103 			std::string *text;
104 			u32 number;
105 			u32 item;
106 			u32 dir;
107 			v2f *align;
108 			v2f *offset;
109 			v3f *world_pos;
110 			v2s32 *size;
111 			s16 z_index;
112 			std::string *text2;
113 		} hudadd;
114 		struct
115 		{
116 			u32 id;
117 		} hudrm;
118 		struct
119 		{
120 			u32 id;
121 			HudElementStat stat;
122 			v2f *v2fdata;
123 			std::string *sdata;
124 			u32 data;
125 			v3f *v3fdata;
126 			v2s32 *v2s32data;
127 		} hudchange;
128 		SkyboxParams *set_sky;
129 		struct
130 		{
131 			bool do_override;
132 			float ratio_f;
133 		} override_day_night_ratio;
134 		struct
135 		{
136 			f32 density;
137 			u32 color_bright;
138 			u32 color_ambient;
139 			f32 height;
140 			f32 thickness;
141 			f32 speed_x;
142 			f32 speed_y;
143 		} cloud_params;
144 		SunParams *sun_params;
145 		MoonParams *moon_params;
146 		StarParams *star_params;
147 	};
148 };
149