1
This commit is contained in:
parent
65303f049c
commit
ce5dcf7ea7
@ -4,6 +4,7 @@
|
||||
#include "human.h"
|
||||
#include "room.h"
|
||||
#include "typeconvert.h"
|
||||
#include "metamgr.h"
|
||||
|
||||
cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
||||
{
|
||||
@ -73,6 +74,16 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
||||
if (room->frame_event.airdrops_.size() > 0) {
|
||||
*msg->mutable_airdrop() = room->frame_event.airdrops_.Get(0);
|
||||
}
|
||||
{
|
||||
if (room->BattleStarted()) {
|
||||
int game_left_time = MetaMgr::Instance()->game_duration * 1000 -
|
||||
(room->frame_no - room->battle_start_frameno_) * FRAME_RATE_MS;
|
||||
game_left_time = std::max(0, game_left_time);
|
||||
msg->set_game_left_time(game_left_time);
|
||||
} else {
|
||||
msg->set_game_left_time(MetaMgr::Instance()->game_duration * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
@ -515,11 +515,12 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
hum->Relive();
|
||||
hum->Revive();
|
||||
},
|
||||
&xtimer_attacher.timer_list_
|
||||
);
|
||||
room->frame_event.AddDead(this);
|
||||
room->OnHumanDie(this);
|
||||
SyncAroundPlayers();
|
||||
}
|
||||
}
|
||||
@ -1703,10 +1704,11 @@ void Human::DeadDrop()
|
||||
}
|
||||
}
|
||||
|
||||
void Human::Relive()
|
||||
void Human::Revive()
|
||||
{
|
||||
dead = false;
|
||||
health = GetMaxHP();
|
||||
room->frame_event.AddRevive(this);
|
||||
room->OnHumanRevive(this);
|
||||
SyncAroundPlayers();
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ private:
|
||||
void ClearFrameData();
|
||||
void GenBattleReportData(a8::MutableXObject* params);
|
||||
void DeadDrop();
|
||||
void Relive();
|
||||
void Revive();
|
||||
|
||||
protected:
|
||||
long long last_shot_frameno_ = 0;
|
||||
|
@ -40,7 +40,7 @@ void Room::Init()
|
||||
{
|
||||
xtimer.Init(RoomXGetTickCount, this, 100, 100);
|
||||
xtimer_attacher.xtimer = &xtimer;
|
||||
grid_service.Init(MAP_WIDTH, MAP_HEIGHT, MAP_CELL_WIDTH);
|
||||
grid_service.Init(MAP_WIDTH, MAP_HEIGHT, MAP_CELL_WIDTH * 8);
|
||||
map_service.Init(MAP_WIDTH / MAP_GRID_WIDTH, MAP_HEIGHT / MAP_GRID_WIDTH, MAP_GRID_WIDTH);
|
||||
|
||||
CreateThings();
|
||||
@ -603,6 +603,7 @@ void Room::FetchBuilding(Human* hum)
|
||||
|
||||
void Room::OnHumanDie(Human* hum)
|
||||
{
|
||||
#if 0
|
||||
if (hum->skill_meta && hum->skill_meta->i->type() == ST_SelfDetonate) {
|
||||
for (auto& pair : human_hash_) {
|
||||
if (pair.second != hum && (pair.second->team_id == 0 || pair.second->team_id != hum->team_id)) {
|
||||
@ -617,10 +618,17 @@ void Room::OnHumanDie(Human* hum)
|
||||
}
|
||||
frame_event.AddExplosionEx(hum, 0, hum->pos, 1);
|
||||
}
|
||||
#endif
|
||||
--alive_count_;
|
||||
NotifyUiUpdate();
|
||||
}
|
||||
|
||||
void Room::OnHumanRevive(Human* hum)
|
||||
{
|
||||
++alive_count_;
|
||||
NotifyUiUpdate();
|
||||
}
|
||||
|
||||
bool Room::OverBorder(const a8::Vec2 pos, float radius)
|
||||
{
|
||||
//检查x轴
|
||||
|
@ -78,6 +78,7 @@ public:
|
||||
a8::Vec2 pos, a8::Vec2 dir, float fly_distance);
|
||||
|
||||
void OnHumanDie(Human* hum);
|
||||
void OnHumanRevive(Human* hum);
|
||||
bool OverBorder(const a8::Vec2 pos, float radius);
|
||||
Human* GetWatchWarTarget(Human* hum);
|
||||
bool BattleStarted();
|
||||
|
@ -551,13 +551,6 @@ message MFBuff
|
||||
optional float lasting_time = 3; //持续时间(总时间毫秒)
|
||||
}
|
||||
|
||||
//飞机
|
||||
message MFPlane
|
||||
{
|
||||
optional MFVector2D start_point = 1; //飞机起点
|
||||
optional MFVector2D end_point = 2; //飞机终点
|
||||
}
|
||||
|
||||
//end mfmsg
|
||||
|
||||
//加入
|
||||
@ -699,7 +692,7 @@ message SMUpdate
|
||||
repeated MFObjectPart part_objects = 4; //对象-部分(用于插值更新)
|
||||
optional int32 active_player_id = 5; //当前活跃玩家id(如果玩家死亡后是观战对象的id)
|
||||
optional MFActivePlayerData active_player_data = 6; //活跃玩家数据(如果玩家死亡后是观战对象的数据)
|
||||
optional int32 alive_count = 15; //存活数量
|
||||
optional int32 game_left_time = 15; //游戏剩余时间(毫秒, 战斗开始后字段才有意义)
|
||||
optional int32 gas_progress = 16; //毒圈进度,表示缩进的像素数(只有当gas_data.mode == moving时才会发进度)
|
||||
optional MFVector2D gas_pos_old = 30; //毒圈当前圆心坐标
|
||||
optional MFGasData gas_data = 17; //毒圈数据
|
||||
|
Loading…
x
Reference in New Issue
Block a user