SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Costume.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #pragma once
9 
10 #include "CommonNetStructures.h"
11 #include "BitStream.h"
12 
13 #include <QtCore/QString>
14 #include <vector>
15 
17 {
18  enum class Type {
19  Pants=0,
20  Chest,
21  Head,
22  Gloves,
23  Boots,
24  Belt,
25  Hair,
26  Face,
27  EyeDetail,
29  Shoulders,
30  Back,
31  WepR,
32  Neck,
33  UarmR,
34  };
35  QString m_geometry;
36  QString m_texture_1;
37  QString m_texture_2;
38  QString name_3;
39  QString name_4;
40  QString name_5;
41  QString name_6;
42  uint32_t m_colors[2] = {0};
43  uint8_t m_type=0; // arms/legs etc..
45 };
46 
47 void serializeto(const CostumePart &part, BitStream &bs, const ColorAndPartPacker *packingContext);
48 void serializefrom(CostumePart &part, BitStream &bs, const ColorAndPartPacker *packingContext);
49 
50 struct Costume
51 {
52  float m_height=0;
53  float m_physique=0;
54  uint32_t skin_color=0;
56  int m_num_parts=0;
57  float m_floats[8];
58  std::vector<CostumePart> m_parts;
59  uint32_t m_body_type;
60  void storeCharselParts(BitStream &bs) const;
62  {
63  bs.StorePackedBits(1,m_body_type); // 0:male normal
64  bs.StoreFloat(m_height);
66  bs.StoreBits(32,skin_color); // rgb ?
67  }
68  void serializeToDb(QString &tgt) const;
69  void serializeFromDb(const QString &src);
70  void dump() const;
71 protected:
72 };
73 
74 void serializefrom(Costume &tgt, BitStream &bs, const ColorAndPartPacker *packer);
75 void serializeto(const Costume &tgt, BitStream &bs, const ColorAndPartPacker *packer);
76 
77 class CharacterCostume : public Costume
78 {
79  uint8_t m_slot_index;
80  uint64_t m_character_id;
81 public:
83 
84  uint8_t getSlotIndex() const { return m_slot_index; }
85  void setSlotIndex(uint8_t val) { m_slot_index = val; }
86  uint64_t getCharacterId() const { return m_character_id; }
87  void setCharacterId(uint64_t val) { m_character_id = val; }
88 };
The ColorAndPartPacker class is responsible for packing/unpacking colors and part names from BitStrea...
Definition: CommonNetStructures.h:34
QString name_5
Definition: Costume.h:40
std::vector< CostumePart > m_parts
Definition: Costume.h:58
void StoreBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:114
uint8_t getSlotIndex() const
Definition: Costume.h:84
void serializeto(const CostumePart &part, BitStream &bs, const ColorAndPartPacker *packingContext)
Definition: Costume.cpp:38
uint32_t m_colors[2]
Definition: Costume.h:42
Definition: Costume.h:77
void setSlotIndex(uint8_t val)
Definition: Costume.h:85
static CharacterCostume NullCostume
Character to whom this costume belongs.
Definition: Costume.h:82
bool m_non_default_costme_p
Definition: Costume.h:55
void serializeFromDb(const QString &src)
Definition: Costume.cpp:109
Definition: BitStream.h:30
void StorePackedBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:161
int m_num_parts
Definition: Costume.h:56
float m_floats[8]
Definition: Costume.h:57
QString name_6
Definition: Costume.h:41
void dump() const
Definition: Costume.cpp:127
uint64_t getCharacterId() const
Definition: Costume.h:86
void serializeToDb(QString &tgt) const
Definition: Costume.cpp:97
QString m_texture_2
Definition: Costume.h:37
bool m_full_part
Definition: Costume.h:44
QString name_3
Definition: Costume.h:38
void setCharacterId(uint64_t val)
Definition: Costume.h:87
uint32_t skin_color
Definition: Costume.h:54
QString m_geometry
Definition: Costume.h:35
uint8_t m_type
Definition: Costume.h:43
void storeCharselParts(BitStream &bs) const
Definition: Costume.cpp:69
QString name_4
Definition: Costume.h:39
QString m_texture_1
Definition: Costume.h:36
Definition: Costume.h:16
Type
Definition: Costume.h:18
float m_height
Definition: Costume.h:52
float m_physique
Definition: Costume.h:53
Definition: Costume.h:50
void StoreFloat(float val)
Definition: BitStream.cpp:393
uint32_t m_body_type
Definition: Costume.h:59
void storeCharsel(BitStream &bs)
Definition: Costume.h:61
void serializefrom(CostumePart &part, BitStream &bs, const ColorAndPartPacker *packingContext)
Definition: Costume.cpp:53