MCPcopy Create free account
hub / github.com/Segs/Segs / storeServerControlState

Function storeServerControlState

Projects/CoX/Servers/MapServer/MessageHelpers.cpp:97–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95 }
96}
97void storeServerControlState(BitStream &bs,Entity *self)
98{
99 bs.StoreBits(1,self->m_update_part_1);
100 if(self->m_update_part_1)
101 {
102 //rand()&0xFF
103 bs.StoreBits(8,self->m_update_id);
104 // after input_send_time_initialized, this value is enqueued as CSC_9's control_flags
105
106 storeVector(bs,self->m_motion_state.m_speed); // This is entity speed vector !!
107
108 bs.StoreFloat(self->m_motion_state.m_backup_spd); // Backup Speed default = 1.0f
109 bs.StoreBitArray((uint8_t *)&self->m_motion_state.m_surf_mods,2*sizeof(SurfaceParams)*8);
110
111 bs.StoreFloat(self->m_motion_state.m_jump_height); // How high entity goes before gravity bring them back down. Set by leaping default = 0.1f
112 bs.StoreBits(1,self->m_motion_state.m_is_flying); // is_flying flag
113 bs.StoreBits(1,self->m_motion_state.m_is_stunned); // is_stunned flag (lacks overhead 'dizzy' FX)
114 bs.StoreBits(1,self->m_motion_state.m_has_jumppack); // jumpack flag (lacks costume parts)
115
116 bs.StoreBits(1,self->m_motion_state.m_controls_disabled); // if 1/true entity anims stop, can still move, but camera stays. Slipping on ice?
117 bs.StoreBits(1,self->m_motion_state.m_is_jumping); // leaping? seems like the anim changes slightly?
118 bs.StoreBits(1,self->m_motion_state.m_is_sliding); // sliding? default = 0
119 }
120 // Used to force the client to a position/speed/pitch/rotation by server
121 bs.StoreBits(1,self->m_force_pos_and_cam);
122 if(self->m_force_pos_and_cam)
123 {
124 bs.StorePackedBits(1,self->m_states.current()->m_every_4_ticks); // sets g_client_pos_id_rel default = 0
125 storeVector(bs,self->m_entity_data.m_pos); // server-side pos
126 storeVectorConditional(bs,self->m_motion_state.m_velocity); // server-side velocity
127
128 storeFloatConditional(bs,self->m_entity_data.m_orientation_pyr.x); // Pitch not used ?
129 storeFloatConditional(bs,self->m_entity_data.m_orientation_pyr.y); // Yaw
130 storeFloatConditional(bs,self->m_entity_data.m_orientation_pyr.z); // Roll
131 bs.StorePackedBits(1,self->m_motion_state.m_is_falling); // server side forced falling bit
132
133 self->m_force_pos_and_cam = false; // run once
134 }
135}
136
137void storeControlState(BitStream &bs,Entity *self)
138{

Callers 1

storeControlStateFunction · 0.85

Calls 8

storeVectorFunction · 0.85
storeVectorConditionalFunction · 0.85
storeFloatConditionalFunction · 0.85
StoreFloatMethod · 0.80
currentMethod · 0.80
StoreBitsMethod · 0.45
StoreBitArrayMethod · 0.45
StorePackedBitsMethod · 0.45

Tested by

no test coverage detected