void UpdateServer::serializeto( BitStream &tgt ) const { tgt.StorePackedBits(1, 2); //opcode tgt.StorePackedBits(1, m_build_date); tgt.StorePackedBits(1, 0); // flags tgt.StoreString(currentVersion); tgt.StoreBitArray(clientInfo,sizeof(clientInfo)*8); tgt.StorePackedBits(1, authID); tgt.StoreBits(32, authCookie); tgt.StoreString(accountName); }
void EntitiesResponse::sendClientData(BitStream &tgt) const { PlayerEntity *ent=static_cast<PlayerEntity *>(m_client->char_entity()); Character &player_char=ent->m_char; if(!m_incremental) { ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("\tSending Character to client: full\n"))); //full_update - > receiveCharacterFromServer // initial character update = level/name/class/origin/map_name //m_client->char_entity()->m_char.m_ent=m_client->char_entity(); ent->serialize_full(tgt); player_char.sendTray(tgt); player_char.sendTrayMode(tgt); tgt.StoreString(ent->name()); // maxlength 32 tgt.StoreString(ent->m_battle_cry); //max 128 tgt.StoreString(ent->m_character_description); //max 1024 player_char.sendWindows(tgt); tgt.StoreBits(1,0); // lfg related tgt.StoreBits(1,0); // a2->ent_player2->field_AC player_char.sendTeamBuffMode(tgt); player_char.sendDockMode(tgt); player_char.sendChatSettings(tgt); player_char.sendTitles(tgt); player_char.sendDescription(tgt); uint8_t auth_data[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; tgt.StoreBitArray(auth_data,128); player_char.sendKeybinds(tgt); player_char.sendOptions(tgt); player_char.sendFriendList(tgt); } else { //ACE_DEBUG ((LM_DEBUG,ACE_TEXT ("\tSending Character to client: stats-only\n"))); ent->m_char.sendFullStats(tgt); } storePowerInfoUpdate(tgt); //storePowerModeUpdate(tgt); //storeBadgeUpdate(tgt); //storeGenericinventoryUpdate(tgt); //storeInventionUpdate(tgt); storeTeamList(tgt); storeSuperStats(tgt); storeGroupDyn(tgt); bool additional=false; tgt.StoreBits(1,additional); if(additional) { tgt.StoreFloat(0.1f); tgt.StoreFloat(0.2f); // camera_yaw tgt.StoreFloat(0.3f); } }
void EntitiesResponse::sendServerControlState(BitStream &bs) const { Vector3 spd(1,80,1); Vector3 zeroes; bool m_flying=false; bool m_dazed=false; // user entity Entity *ent = m_client->char_entity(); CscCommon_Sub28 struct_csc; memset(&struct_csc,0,sizeof(struct_csc)); static int vla=1; int g=rand()&0xff; for(int i=0; i<3; ++i) struct_csc.a.v[i] = g+vla; vla+=1; struct_csc.b.max_speed = struct_csc.a.max_speed = 5.0f; struct_csc.b.gravitational_constant = struct_csc.a.gravitational_constant = 3.0f; // for(int i=3; i<5; ++i) // struct_csc.a.v[i] = rand()&0xf; bool update_part_1=true; bool update_part_2=false; bs.StoreBits(1,update_part_1); if(update_part_1) { //rand()&0xFF bs.StoreBits(8,vla); // value stored in control state field_134 // after input_send_time_initialized, this value is enqueued as CSC_9's control_flags // This is entity speed vector !! NetStructure::storeVector(bs,spd); bs.StoreFloat(1.0f); // speed rel back bs.StoreBitArray((uint8_t *)&struct_csc,sizeof(CscCommon_Sub28)*8); bs.StoreFloat(0.1f); bs.StoreBits(1,m_flying); // key push bits ?? bs.StoreBits(1,m_dazed); // key push bits ?? bs.StoreBits(1,0); // key push bits ?? bs.StoreBits(1,0); // key push bits ?? bs.StoreBits(1,0); // key push bits ?? bs.StoreBits(1,0); // key push bits ?? } // Used to force the client to a position/speed/pitch/rotation by server bs.StoreBits(1,update_part_2); if(update_part_2) { bs.StorePackedBits(1,0); // sets g_client_pos_id_rel NetStructure::storeVector(bs,spd); NetStructure::storeVectorConditional(bs,zeroes); // vector3 -> speed ? likely NetStructure::storeFloatConditional(bs,0); // Pitch not used ? NetStructure::storeFloatConditional(bs,ent->inp_state.pyr.x); // Pitch NetStructure::storeFloatConditional(bs,0); // Roll bs.StorePackedBits(1,0); // sets the lowest bit in CscCommon::flags } }
void storeTransformMatrix(BitStream &tgt, const glm::mat4x3 &src ) { tgt.StoreBits(1,0); // no packed matrices for now tgt.StoreBitArray((const uint8_t*)glm::value_ptr(src),12*4*8); }
void NetStructure::storeTransformMatrix( BitStream &tgt,const Matrix4x3 &src ) { tgt.StoreBits(1,0); // no packed matrices for now tgt.StoreBitArray((uint8_t*)&src,12*4*8); }