X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=9e4ba501b141f3420b2b8eb957429da39e7be5be;hb=8de9eb53c9ae92c6bfa8f01cf6659b683fe2155d;hp=44163f6cc17b74b9cb548b3bd93242e6028b6a90;hpb=1d225566f79566e2dbbad8cb2876696f4c074ff5;p=blank.git diff --git a/src/client/client.cpp b/src/client/client.cpp index 44163f6..9e4ba50 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -51,7 +51,7 @@ InteractiveState::InteractiveState(MasterState &master, uint32_t player_id) , sounds() , save(master.GetEnv().config.GetWorldPath(master.GetWorldConf().name, master.GetConfig().net.host)) , world(res.block_types, master.GetWorldConf()) -, player(*world.AddPlayer(master.GetConfig().player.name)) +, player(*world.AddPlayer(master.GetConfig().player.name, player_id)) , hud(master.GetEnv(), master.GetConfig(), player) , manip(master.GetEnv().audio, sounds, player.GetEntity()) , input(world, player, master.GetClient()) @@ -171,11 +171,10 @@ void InteractiveState::Handle(const Packet::SpawnEntity &pack) { Entity &entity = world.ForceAddEntity(entity_id); UpdateEntity(entity_id, pack.Seq()); pack.ReadEntity(entity); - uint32_t skel_id; - pack.ReadSkeletonID(skel_id); - if (skel_id > 0 && skel_id <= res.models.size()) { - Model &skel = res.models.Get(skel_id); - skel.Instantiate(entity.GetModel()); + uint32_t model_id; + pack.ReadModelID(model_id); + if (model_id > 0 && model_id <= res.models.size()) { + res.models.Get(model_id).Instantiate(entity.GetModel()); } cout << "spawned entity #" << entity_id << " (" << entity.Name() << ") at " << entity.AbsolutePosition() << endl; @@ -199,7 +198,9 @@ void InteractiveState::Handle(const Packet::EntityUpdate &pack) { auto world_end = world.Entities().end(); uint32_t count = 0; + glm::ivec3 base; pack.ReadEntityCount(count); + pack.ReadChunkBase(base); for (uint32_t i = 0; i < count; ++i) { uint32_t entity_id = 0; @@ -214,7 +215,7 @@ void InteractiveState::Handle(const Packet::EntityUpdate &pack) { } if (world_iter->ID() == entity_id) { if (UpdateEntity(entity_id, pack.Seq())) { - pack.ReadEntityState(world_iter->GetState(), i); + pack.ReadEntityState(world_iter->GetState(), base, i); } } }