aozhiwei 71123a3434 1
2023-03-02 12:19:14 +08:00

157 lines
4.0 KiB
C++

#pragma once
#include "human.h"
namespace cs
{
class CMReconnect;
class CMMove;
class CMDropItem;
class CMEmote;
class CMVoice;
class CMStowShield;
class CMImmediateMsg;
class CMTeamMarkTargetPos;
class CMExecCommand;
class CMGameOver;
class CMWatchWar;
class CMLeave;
class CMRevive;
class CMCancelRevive;
class CMRequestBulletDmg;
class CMRequestThrowDmg;
class MFActivePlayerData;
class MFGasData;
class MFPair;
class MFSettlement;
}
class Room;
class Loot;
class Obstacle;
class Player : public Human
{
public:
enum { HID = HID_Player };
public:
int team_mode = 0;
bool use_touch = false;
long long create_tick = 0;
int last_seq_id = 0;
bool moving = false;
int moved_frames = 0;
bool select_weapon = false;
size_t selected_weapon_idx = 0;
bool drop_weapon = false;
size_t drop_weapon_idx = 0;
size_t drop_num = 0;
bool cancel_action = false;
bool use_item = false;
int use_item_idx = 0;
bool has_use_item_id = false;
int use_item_id = 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;
int use_skill_id = 0;
int skill_target_id = 0;
glm::vec3 skill_dir;
float skill_distance = 0.0f;
bool get_down = false;
int get_on = 0;
int switch_seat = 0;
int follow = -1;
int dive = 0;
int trace_target_uniid = 0;
std::shared_ptr<cs::MFSettlement> settlement;
std::vector<int> interaction_objids;
virtual ~Player() override;
virtual void Initialize() override;
virtual void Update(int delta_time) override;
void UpdateMoving();
void UpdateShot();
void UpdateSelectWeapon();
void UpdateDropWeapon();
void UpdateUseScope();
void UpdateReload();
void UpdateCancelAction();
void UpdateUseItemIdx();
void UpdateUseItemId();
void UpdateSpectate();
void UpdateEmote();
void UpdateJump();
void UpdateGetDown();
void UpdateGetOn();
void UpdateSwitchSeat();
void UpdateUseSkill();
void UpdateAiming();
void UpdateFollow();
void UpdateDive();
void UpdateThrowBomb();
void Shot();
void ProcInteraction();
void ObstacleInteraction(Obstacle* entity);
void HumanInteraction(Human* hum);
void ProcPreSettlementInfo(const std::string& pre_settlement_info);
void ProcSkillList();
void PushJoinRoomMsg();
void _CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg);
void _CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg);
void _CMImmediateMsg(f8::MsgHdr& hdr, const cs::CMImmediateMsg& msg);
void _CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg);
void _CMEmote(f8::MsgHdr& hdr, const cs::CMEmote& msg);
void _CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg);
void _CMGameOver(f8::MsgHdr& hdr, const cs::CMGameOver& msg);
void _CMWatchWar(f8::MsgHdr& hdr, const cs::CMWatchWar& msg);
void _CMLeave(f8::MsgHdr& hdr, const cs::CMLeave& msg);
void _CMRevive(f8::MsgHdr& hdr, const cs::CMRevive& msg);
void _CMCancelRevive(f8::MsgHdr& hdr, const cs::CMCancelRevive& msg);
void _CMRequestBulletDmg(f8::MsgHdr& hdr, const cs::CMRequestBulletDmg& msg);
void _CMRequestThrowDmg(f8::MsgHdr& hdr, const cs::CMRequestThrowDmg& msg);
void _CMStowShield(f8::MsgHdr& hdr, const cs::CMStowShield& msg);
void _CMTeamMarkTargetPos(f8::MsgHdr& hdr, const cs::CMTeamMarkTargetPos& msg);
virtual void SetAttackDir(const glm::vec3& attack_dir) override;
void AsyncRequestWatchWar(bool send_rsp_msg);
protected:
Player();
private:
void InternalUpdate(int delta_time);
std::vector<std::tuple<int, int, int>>* GetBox(int box_id);
void CheckShotHoldState(Weapon* weapon);
void InternalRevive(int target_uniid, int revive_coin);
private:
long long last_cmmove_frameno_ = 0;
a8::XTimerWp watch_war_req_timer_;
friend class EntityFactory;
friend class PBUtils;
};