clientevent.h 2.8 KB

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