1
This commit is contained in:
parent
a9faaeda2e
commit
7f21ebc7d1
@ -111,5 +111,6 @@ bool IntersectCircleCircle(Vector2D a_pos, float a_rad, Vector2D b_pos, float b_
|
|||||||
|
|
||||||
bool CircleContainCircle(Vector2D a_pos, float a_rad, Vector2D b_pos, float b_rad)
|
bool CircleContainCircle(Vector2D a_pos, float a_rad, Vector2D b_pos, float b_rad)
|
||||||
{
|
{
|
||||||
return false;
|
float distance = (a_pos - b_pos).Norm();
|
||||||
|
return distance < a_rad - b_rad;
|
||||||
}
|
}
|
||||||
|
@ -71,3 +71,5 @@ const int DEF_WEAPON_ID = 12103;
|
|||||||
const int GAS_INACTIVE_TIME = 1;
|
const int GAS_INACTIVE_TIME = 1;
|
||||||
const int SERVER_FRAME_RATE = 20;
|
const int SERVER_FRAME_RATE = 20;
|
||||||
const int SYNC_FRAME_RATE = 10;
|
const int SYNC_FRAME_RATE = 10;
|
||||||
|
|
||||||
|
const int MAX_INVENTORY_NUM = 14;
|
||||||
|
@ -52,6 +52,10 @@ void Player::Initialize()
|
|||||||
chest_meta = MetaMgr::Instance()->GetEquip(chest);
|
chest_meta = MetaMgr::Instance()->GetEquip(chest);
|
||||||
weapon_meta = MetaMgr::Instance()->GetEquip(weapon);
|
weapon_meta = MetaMgr::Instance()->GetEquip(weapon);
|
||||||
RecalcSelfCollider();
|
RecalcSelfCollider();
|
||||||
|
inventory.reserve(MAX_INVENTORY_NUM);
|
||||||
|
for (size_t i = 0; i < inventory.size(); ++i) {
|
||||||
|
inventory[i] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Update(int delta_time)
|
void Player::Update(int delta_time)
|
||||||
@ -292,7 +296,7 @@ void Player::_CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg)
|
|||||||
send_func);
|
send_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::FillMFPlayerData(cs::MFActivePlayerData* player_data)
|
void Player::FillMFActivePlayerData(cs::MFActivePlayerData* player_data)
|
||||||
{
|
{
|
||||||
player_data->set_has_action(false);
|
player_data->set_has_action(false);
|
||||||
}
|
}
|
||||||
@ -352,7 +356,7 @@ void Player::MakeUpdateMsg()
|
|||||||
}
|
}
|
||||||
if (updated_times == 0) {
|
if (updated_times == 0) {
|
||||||
update_msg->set_active_player_id(entity_uniid);
|
update_msg->set_active_player_id(entity_uniid);
|
||||||
FillMFPlayerData(update_msg->mutable_active_player_data());
|
FillMFActivePlayerData(update_msg->mutable_active_player_data());
|
||||||
}
|
}
|
||||||
if (updated_times == 0 || last_sync_gas_frameno < room->gas_data.gas_start_frameno) {
|
if (updated_times == 0 || last_sync_gas_frameno < room->gas_data.gas_start_frameno) {
|
||||||
last_sync_gas_frameno = room->gas_data.gas_start_frameno;
|
last_sync_gas_frameno = room->gas_data.gas_start_frameno;
|
||||||
|
@ -63,12 +63,13 @@ class Player : public Human
|
|||||||
void _CMSpectate(f8::MsgHdr& hdr, const cs::CMSpectate& msg);
|
void _CMSpectate(f8::MsgHdr& hdr, const cs::CMSpectate& msg);
|
||||||
void _CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg);
|
void _CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg);
|
||||||
|
|
||||||
void FillMFPlayerData(cs::MFActivePlayerData* player_data);
|
void FillMFActivePlayerData(cs::MFActivePlayerData* player_data);
|
||||||
void FillMFGasData(cs::MFGasData* gas_data);
|
void FillMFGasData(cs::MFGasData* gas_data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cs::SMUpdate* update_msg = nullptr;
|
cs::SMUpdate* update_msg = nullptr;
|
||||||
long long last_sync_gas_frameno = 0;
|
long long last_sync_gas_frameno = 0;
|
||||||
|
std::vector<int> inventory;
|
||||||
|
|
||||||
void MakeUpdateMsg();
|
void MakeUpdateMsg();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user