SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
clientoptions_definitions.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2019 SEGS Team (see AUTHORS.md)
5  * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
6  */
7 
8 #pragma once
9 
10 #include <QtCore/QString>
11 #include <stdint.h>
12 #include <vector>
13 #include <cassert>
14 
15 #include <QDebug>
16 #include <cereal/cereal.hpp>
17 
18 enum ReticleVisibility : uint32_t {
20  rv_Always = 1,
24 };
25 
27 {
28  enum eType
29  {
30  t_int = 1,
31  t_string = 2,
32  t_float = 3,
35  t_mat4 = 6,
36  t_vec3 = 7,
37  t_date = 9,
39  };
40  struct Arg
41  {
42  Arg(int t,void *v) : type(eType(t)),tgt(v){}
44  void *tgt;
45  };
46  std::string name;
47  std::vector<Arg> m_args;
48  //ClientOption(const char *v) : name(v) {}
49 };
50 
52 {
53  std::vector<ClientOption> m_opts;
54  void init();
55 public:
57  {
58  init();
59  m_mouse_speed = 0.6f;
60  }
61 
62  // ClientOptions serialization class version
63  enum : uint32_t { class_version = 1 };
64 
65  // Other Options
66  int32_t control_debug = 0;
67  int32_t no_strafe = 0;
68  int32_t alwaysmobile = 0; // 1 - player is always mobile (can't be immobilized by powers)
69  int32_t repredict = 0; // 1 - client is out of sync with server, asking for new physics state info.
70  int32_t neterrorcorrection = 0;
71  float speed_scale = 0;
72 
73  int32_t svr_lag,svr_lag_vary,svr_pl,svr_oo_packets,client_pos_id;
74  int32_t atest0,atest1,atest2,atest3,atest4,atest5,atest6,atest7,atest8,atest9;
75  int32_t predict,notimeout,selected_ent_server_index;
76 
77  // Options
78  bool m_first_person_view = false;
79 
80  // Options Window Settings
81  bool m_mouse_invert = false;
82  float m_mouse_speed = 0;
83  float m_turn_speed = 3; // client displays this as pct (*100)
84  bool m_fade_chat_wnd = true;
85  bool m_fade_nav_wnd = true;
86  bool m_show_tooltips = true;
87  bool m_allow_profanity = false;
88  bool m_chat_balloons = true;
89  ReticleVisibility m_show_archetype = rv_OnMouseOver;
90  ReticleVisibility m_show_supergroup = rv_OnMouseOver;
91  ReticleVisibility m_show_player_name = rv_Always;
95  ReticleVisibility m_show_player_reticles = rv_SelectedOrMouseOver;
96  ReticleVisibility m_show_enemy_reticles = rv_SelectedOrMouseOver;
97  ReticleVisibility m_show_assist_reticles = rv_SelectedOrMouseOver;
98  uint8_t m_chat_font_size = 12; // 12 default size
99 
100  ClientOption *get(int idx)
101  {
102  if(idx<0)
103  return nullptr;
104  assert((size_t(idx)<m_opts.size()) && "Unknown option requested!!");
105  return &m_opts[idx];
106  }
107 
108  void clientOptionsDump() const
109  {
110  qDebug().noquote() << "Debugging ClientOptions:"
111  << "\n\t" << "Invert Mouse:" << m_mouse_invert
112  << "\n\t" << "Mouse Speed:" << m_mouse_speed
113  << "\n\t" << "Turn Speed:" << m_turn_speed
114  << "\n\t" << "Fade Chat Window:" << m_fade_chat_wnd
115  << "\n\t" << "Fade Nav Window:" << m_fade_nav_wnd
116  << "\n\t" << "Show Tooltips:" << m_show_tooltips
117  << "\n\t" << "Allow Profanity:" << m_allow_profanity
118  << "\n\t" << "Chat Balloons:" << m_chat_balloons
119  << "\n\t" << "Show Archetype:" << m_show_archetype
120  << "\n\t" << "Show SuperGroup:" << m_show_supergroup
121  << "\n\t" << "Show Player Name:" << m_show_player_name
122  << "\n\t" << "Show Player Bars:" << m_show_player_bars
123  << "\n\t" << "Show Enemy Name:" << m_show_enemy_name
124  << "\n\t" << "Show Enemy Bars:" << m_show_enemy_bars
125  << "\n\t" << "Show Player Reticles:" << m_show_player_reticles
126  << "\n\t" << "Show Enemy Reticles:" << m_show_enemy_reticles
127  << "\n\t" << "Show Assist Reticles:" << m_show_assist_reticles
128  << "\n\t" << "Chat Font Size:" << m_chat_font_size;
129  }
130 
131  template<class Archive>
132  void serialize(Archive &archive, uint32_t const version)
133  {
134  if(version != ClientOptions::class_version)
135  {
136  qCritical() << "Failed to serialize ClientOptions, incompatible serialization format version " << version;
137  return;
138  }
139 
140  archive(cereal::make_nvp("FirstPersonView", m_first_person_view));
141  archive(cereal::make_nvp("MouseSpeed", m_mouse_speed));
142  archive(cereal::make_nvp("TurnSpeed", m_turn_speed));
143  archive(cereal::make_nvp("InvertMouse", m_mouse_invert));
144  archive(cereal::make_nvp("FadeChatWindow", m_fade_chat_wnd));
145  archive(cereal::make_nvp("FadeNavWindow", m_fade_nav_wnd));
146  archive(cereal::make_nvp("ShowTooltips", m_show_tooltips));
147  archive(cereal::make_nvp("AllowProfanity", m_allow_profanity));
148  archive(cereal::make_nvp("ChatBalloons", m_chat_balloons));
149  archive(cereal::make_nvp("ShowArchetype", uint32_t(m_show_archetype)));
150  archive(cereal::make_nvp("ShowSuperGroup", uint32_t(m_show_supergroup)));
151  archive(cereal::make_nvp("PlayerName", uint32_t(m_show_player_name)));
152  archive(cereal::make_nvp("PlayerBars", uint32_t(m_show_player_bars)));
153  archive(cereal::make_nvp("EnemyName", uint32_t(m_show_enemy_name)));
154  archive(cereal::make_nvp("EnemyBars", uint32_t(m_show_enemy_bars)));
155  archive(cereal::make_nvp("PlayerReticles", uint32_t(m_show_player_reticles)));
156  archive(cereal::make_nvp("EnemyReticles", uint32_t(m_show_enemy_reticles)));
157  archive(cereal::make_nvp("AssistReticles", uint32_t(m_show_assist_reticles)));
158  archive(cereal::make_nvp("FontSize", uint32_t(m_chat_font_size)));
159  }
160 };
Definition: clientoptions_definitions.h:21
Definition: clientoptions_definitions.h:38
int32_t svr_pl
Definition: clientoptions_definitions.h:73
Definition: clientoptions_definitions.h:30
eType
Definition: clientoptions_definitions.h:28
archive(cereal::make_nvp("OriginIdx", ed.m_origin_idx))
Definition: clientoptions_definitions.h:22
Definition: clientoptions_definitions.h:19
Definition: clientoptions_definitions.h:34
Definition: clientoptions_definitions.h:40
ReticleVisibility
Definition: clientoptions_definitions.h:18
eType type
Definition: clientoptions_definitions.h:43
Definition: clientoptions_definitions.h:35
Definition: clientoptions_definitions.h:63
Definition: clientoptions_definitions.h:31
Definition: clientoptions_definitions.h:23
std::string name
Definition: clientoptions_definitions.h:46
Arg(int t, void *v)
Definition: clientoptions_definitions.h:42
Definition: clientoptions_definitions.h:36
Definition: clientoptions_definitions.h:37
void clientOptionsDump() const
Definition: clientoptions_definitions.h:108
std::vector< Arg > m_args
Definition: clientoptions_definitions.h:47
int32_t atest9
Definition: clientoptions_definitions.h:74
void * tgt
Definition: clientoptions_definitions.h:44
int32_t selected_ent_server_index
Definition: clientoptions_definitions.h:75
Definition: clientoptions_definitions.h:20
Definition: clientoptions_definitions.h:26
Definition: clientoptions_definitions.h:51
Definition: clientoptions_definitions.h:33
EntityData uint32_t const version
Definition: entitydata_serializers.cpp:25
CEREAL_CLASS_VERSION(Souvenir, Souvenir::class_version) template< class Archive > void Clue
Definition: Clue.cpp:28
ClientOptions()
Definition: clientoptions_definitions.h:56
Definition: clientoptions_definitions.h:32
void serialize(Archive &archive, uint32_t const version)
Definition: clientoptions_definitions.h:132