1
This commit is contained in:
parent
eb52effa0f
commit
d357bfe47c
@ -1,8 +1,3 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "entity.h"
|
||||
|
||||
void Entity::Update(int delta_time)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
namespace cs
|
||||
{
|
||||
class MFObjectPart;
|
||||
class MFObjectFull;
|
||||
}
|
||||
|
||||
enum EntityType_e
|
||||
{
|
||||
ET_None = 0,
|
||||
@ -14,14 +20,18 @@ enum EntityType_e
|
||||
ET_Smoke = 9
|
||||
};
|
||||
|
||||
class Room;
|
||||
class Entity
|
||||
{
|
||||
public:
|
||||
unsigned short entity_uniid = 0;
|
||||
EntityType_e entity_type = ET_None;
|
||||
Room* room = nullptr;
|
||||
Vector2D pos;
|
||||
Vector2D dir;
|
||||
int updated_times = 0;
|
||||
|
||||
virtual void Update(int delta_time);
|
||||
virtual void Update(int delta_time) {};
|
||||
virtual void FillMFObjectPart(cs::MFObjectPart* part_data) {};
|
||||
virtual void FillMFObjectFull(cs::MFObjectFull* full_data) {};
|
||||
};
|
||||
|
@ -1,5 +1,38 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "human.h"
|
||||
#include "cs_proto.pb.h"
|
||||
|
||||
void Human::FillMFObjectPart(cs::MFObjectPart* part_data)
|
||||
{
|
||||
part_data->set_object_type(ET_Player);
|
||||
cs::MFPlayerPart* p = part_data->mutable_union_obj_1();
|
||||
p->set_obj_uniid(entity_uniid);
|
||||
pos.ToPB(p->mutable_pos());
|
||||
dir.ToPB(p->mutable_dir());
|
||||
}
|
||||
|
||||
void Human::FillMFObjectFull(cs::MFObjectFull* full_data)
|
||||
{
|
||||
full_data->set_object_type(ET_Player);
|
||||
cs::MFPlayerFull* p = full_data->mutable_union_obj_1();
|
||||
p->set_obj_uniid(entity_uniid);
|
||||
pos.ToPB(p->mutable_pos());
|
||||
dir.ToPB(p->mutable_dir());
|
||||
|
||||
p->set_health(health);
|
||||
p->set_dead(dead);
|
||||
p->set_downed(downed);
|
||||
p->set_disconnected(disconnected);
|
||||
p->set_anim_type(anim_type);
|
||||
p->set_anim_seq(anim_seq);
|
||||
p->set_action_type(action_type);
|
||||
p->set_skin(skin);
|
||||
|
||||
p->set_helmet(helmet);
|
||||
p->set_chest(chest);
|
||||
p->set_weapon(weapon);
|
||||
p->set_energy_shield(energy_shield);
|
||||
p->set_vip(vip);
|
||||
p->set_sdmg(sdmg);
|
||||
}
|
||||
|
@ -4,5 +4,30 @@
|
||||
|
||||
class Human : public Entity
|
||||
{
|
||||
public:
|
||||
std::string team_uniid;
|
||||
|
||||
float health = 0.0;
|
||||
bool dead = false;
|
||||
bool downed = false;
|
||||
bool disconnected = false;
|
||||
int anim_type = 0;
|
||||
int anim_seq = 0;
|
||||
int action_type = 0;
|
||||
int skin = 0;
|
||||
int helmet = 0;
|
||||
int chest = 0;
|
||||
int weapon = 0;
|
||||
int energy_shield = 0;
|
||||
int vip = 0;
|
||||
int sdmg = 0;
|
||||
|
||||
std::set<Human*> my_seen_players;
|
||||
std::set<Human*> seen_me_players;
|
||||
std::set<Human*> new_players;
|
||||
std::set<Human*> part_players;
|
||||
|
||||
virtual void FillMFObjectPart(cs::MFObjectPart* part_data) override;
|
||||
virtual void FillMFObjectFull(cs::MFObjectFull* full_data) override;
|
||||
|
||||
};
|
||||
|
@ -94,37 +94,3 @@ void Player::FillMFPlayerData(cs::MFPlayerData* player_data)
|
||||
{
|
||||
player_data->set_has_action(false);
|
||||
}
|
||||
|
||||
void Player::FillMFObjectPart(cs::MFObjectPart* part_data)
|
||||
{
|
||||
part_data->set_object_type(ET_Player);
|
||||
cs::MFPlayerPart* p = part_data->mutable_union_obj_1();
|
||||
p->set_obj_uniid(entity_uniid);
|
||||
pos.ToPB(p->mutable_pos());
|
||||
dir.ToPB(p->mutable_dir());
|
||||
}
|
||||
|
||||
void Player::FillMFObjectFull(cs::MFObjectFull* full_data)
|
||||
{
|
||||
full_data->set_object_type(ET_Player);
|
||||
cs::MFPlayerFull* p = full_data->mutable_union_obj_1();
|
||||
p->set_obj_uniid(entity_uniid);
|
||||
pos.ToPB(p->mutable_pos());
|
||||
dir.ToPB(p->mutable_dir());
|
||||
|
||||
p->set_health(health);
|
||||
p->set_dead(dead);
|
||||
p->set_downed(downed);
|
||||
p->set_disconnected(disconnected);
|
||||
p->set_anim_type(anim_type);
|
||||
p->set_anim_seq(anim_seq);
|
||||
p->set_action_type(action_type);
|
||||
p->set_skin(skin);
|
||||
|
||||
p->set_helmet(helmet);
|
||||
p->set_chest(chest);
|
||||
p->set_weapon(weapon);
|
||||
p->set_energy_shield(energy_shield);
|
||||
p->set_vip(vip);
|
||||
p->set_sdmg(sdmg);
|
||||
}
|
||||
|
@ -11,8 +11,6 @@ namespace cs
|
||||
class CMSpectate;
|
||||
class CMVoice;
|
||||
class MFPlayerData;
|
||||
class MFObjectPart;
|
||||
class MFObjectFull;
|
||||
}
|
||||
|
||||
class Room;
|
||||
@ -23,34 +21,13 @@ class Player : public Human
|
||||
|
||||
public:
|
||||
int socket_handle = 0;
|
||||
Room* room = nullptr;
|
||||
std::string account_id;
|
||||
std::string team_uniid;
|
||||
int team_mode = 0;
|
||||
int player_count = 0;
|
||||
bool auto_fill = false;
|
||||
bool use_touch = false;
|
||||
std::string avatar_url;
|
||||
|
||||
float health = 0.0;
|
||||
bool dead = false;
|
||||
bool downed = false;
|
||||
bool disconnected = false;
|
||||
int anim_type = 0;
|
||||
int anim_seq = 0;
|
||||
int action_type = 0;
|
||||
int skin = 0;
|
||||
int helmet = 0;
|
||||
int chest = 0;
|
||||
int weapon = 0;
|
||||
int energy_shield = 0;
|
||||
int vip = 0;
|
||||
int sdmg = 0;
|
||||
std::set<Player*> my_seen_players;
|
||||
std::set<Player*> seen_me_players;
|
||||
std::set<Player*> new_players;
|
||||
std::set<Player*> part_players;
|
||||
|
||||
template <typename T>
|
||||
void SendNotifyMsg(T& msg)
|
||||
{
|
||||
@ -66,6 +43,4 @@ class Player : public Human
|
||||
void _CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg);
|
||||
|
||||
void FillMFPlayerData(cs::MFPlayerData* player_data);
|
||||
void FillMFObjectPart(cs::MFObjectPart* part_data);
|
||||
void FillMFObjectFull(cs::MFObjectFull* full_data);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user