2019-04-28 14:03:26 +08:00

104 lines
2.2 KiB
C++

#pragma once
#include "human.h"
#include "GGListener.h"
namespace cs
{
class CMMove;
class CMDropItem;
class CMEmote;
class CMVoice;
class MFActivePlayerData;
class MFGasData;
}
class Room;
class Loot;
class Obstacle;
class Player : public Human
{
public:
enum { HID = HID_Player };
public:
int socket_handle = 0;
int team_mode = 0;
int player_count = 0;
bool auto_fill = false;
bool use_touch = false;
int last_seq_id = 0;
bool moving = false;
int moved_frames = 0;
bool shot_start = false;
bool shot_hold = false;
int series_shot_frames = 0;
float fly_distance = 0.0f;
bool select_weapon = false;
int selected_weapon_idx = 0;
bool drop_weapon = false;
int drop_weapon_idx = 0;
bool cancel_action = false;
bool use_item = false;
int use_item_idx = 0;
bool use_scope = false;
int use_scope_idx = 0;
bool reload = false;
bool spectate = false;
bool emote = false;
int emote_id = 0;
bool jump = false;
bool use_skill = false;
::google::protobuf::RepeatedField< ::google::protobuf::int32 > interaction_objids;
template <typename T>
void SendNotifyMsg(T& msg)
{
GGListener::Instance()->SendToClient(socket_handle, 0, msg);
}
Player();
virtual ~Player() override;
virtual void Initialize() override;
virtual void Update(int delta_time) override;
void UpdateMove();
void UpdateShot();
void UpdateSelectWeapon();
void UpdateDropWeapon();
void UpdateUseScope();
void UpdateAction();
void UpdateReload();
void UpdateCancelAction();
void UpdateUseItemIdx();
void UpdateSpectate();
void UpdateGameOver();
void UpdateEmote();
void UpdateJump();
void UpdateUseSkill();
void Shot();
void ProcInteraction();
void ObstacleInteraction(Obstacle* entity);
void LootInteraction(Loot* entity);
void HumanInteraction(Human* hum);
void SendUpdateMsg();
void _CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg);
void _CMEmote(f8::MsgHdr& hdr, const cs::CMEmote& msg);
void _CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg);
private:
int send_update_msg_times = 0;
};