1
This commit is contained in:
parent
4ec3bcc3ee
commit
4bb004afba
@ -97,7 +97,7 @@ void AndroidAI::Update(int delta_time)
|
||||
if (hum->dead) {
|
||||
return;
|
||||
}
|
||||
if (hum->room->GetGasData().gas_mode == GasInactive) {
|
||||
if (hum->room->GetGasData().GetGasMode() == GasInactive) {
|
||||
DefaultAi();
|
||||
return;
|
||||
}
|
||||
@ -219,7 +219,7 @@ void AndroidAI::DoAttackOldAI()
|
||||
if (hum->HasBuffEffect(kBET_Jump)) {
|
||||
return;
|
||||
}
|
||||
if (hum->room->GetGasData().gas_mode == GasInactive) {
|
||||
if (hum->room->GetGasData().GetGasMode() == GasInactive) {
|
||||
return;
|
||||
}
|
||||
if (owner->UpdatedTimes() % 10 == 0) {
|
||||
@ -324,7 +324,7 @@ void AndroidAI::UpdateIdle()
|
||||
void AndroidAI::UpdateThinking()
|
||||
{
|
||||
Human* hum = (Human*)owner;
|
||||
if (hum->room->GetGasData().gas_mode == GasInactive ||
|
||||
if (hum->room->GetGasData().GetGasMode() == GasInactive ||
|
||||
hum->room->IsWaitingStart() ||
|
||||
hum->HasBuffEffect(kBET_Jump) ||
|
||||
hum->HasBuffEffect(kBET_PeaceMode) ||
|
||||
@ -496,7 +496,7 @@ void AndroidAI::ChangeToStateNewAI(AndroidStateEx_e to_state)
|
||||
node_->start_shot_frameno = 0;
|
||||
node_->shot_times = 0;
|
||||
moving_ = false;
|
||||
if (hum->room->GetGasData().gas_mode == GasInactive ||
|
||||
if (hum->room->GetGasData().GetGasMode() == GasInactive ||
|
||||
hum->room->IsWaitingStart() ||
|
||||
hum->HasBuffEffect(kBET_Jump)) {
|
||||
node_->param1 = rand() % (3 * SERVER_FRAME_RATE);
|
||||
@ -569,7 +569,7 @@ Creature* AndroidAI::GetTarget()
|
||||
return nullptr;
|
||||
}
|
||||
Human* myself = (Human*)owner;
|
||||
if (myself->room->GetGasData().gas_mode == GasInactive) {
|
||||
if (myself->room->GetGasData().GetGasMode() == GasInactive) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -1111,7 +1111,7 @@ bool Creature::CanUseSkill(int skill_id)
|
||||
if (!skill) {
|
||||
return false;
|
||||
}
|
||||
if (room->GetGasData().gas_mode == GasInactive &&
|
||||
if (room->GetGasData().GetGasMode() == GasInactive &&
|
||||
!MetaMgr::Instance()->prebattle_can_use_skill) {
|
||||
return false;
|
||||
}
|
||||
@ -3434,7 +3434,7 @@ bool Creature::CanFollow(Creature* follower)
|
||||
if (follower->HasBuffEffect(kBET_Jump)) {
|
||||
return false;
|
||||
}
|
||||
if (!follower->HasBuffEffect(kBET_Fly) && room->GetGasData().gas_mode != GasInactive) {
|
||||
if (!follower->HasBuffEffect(kBET_Fly) && room->GetGasData().GetGasMode() != GasInactive) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3446,7 +3446,7 @@ bool Creature::CanFollow(Creature* follower)
|
||||
if (HasBuffEffect(kBET_Jump)) {
|
||||
return false;
|
||||
}
|
||||
if (!HasBuffEffect(kBET_Fly) && room->GetGasData().gas_mode != GasInactive) {
|
||||
if (!HasBuffEffect(kBET_Fly) && room->GetGasData().GetGasMode() != GasInactive) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -128,7 +128,7 @@ void FrameMaker::PreProcess(cs::SMUpdate* msg, Room* room, Human* hum, FrameData
|
||||
{
|
||||
{
|
||||
msg->set_frameno(hum->room->GetFrameNo() / 2);
|
||||
if (hum->room->GetGasData().gas_mode == GasJump) {
|
||||
if (hum->room->GetGasData().GetGasMode() == GasJump) {
|
||||
cs::MFPlane* p = msg->mutable_plane();
|
||||
TypeConvert::ToPb(hum->room->plane.start_point, p->mutable_start_point());
|
||||
TypeConvert::ToPb(hum->room->plane.end_point, p->mutable_end_point());
|
||||
@ -158,7 +158,7 @@ void FrameMaker::PostProcess(cs::SMUpdate* msg, Room* room, Human* hum, FrameDat
|
||||
if (room->frame_event.airraids_.size() > 0) {
|
||||
*msg->mutable_airraid() = room->frame_event.airraids_.Get(0);
|
||||
}
|
||||
if (room->GetGasData().gas_mode == GasMoving) {
|
||||
if (room->GetGasData().GetGasMode() == GasMoving) {
|
||||
msg->set_gas_progress(room->GetGasData().gas_progress);
|
||||
TypeConvert::ToPb(room->GetGasData().pos_old, msg->mutable_gas_pos_old());
|
||||
}
|
||||
@ -257,7 +257,7 @@ void FrameMaker::SerializePartObjects(cs::SMUpdate* msg, Room* room, Human* hum,
|
||||
hum->room->GetFrameNo() - entity->GetDeadFrameNo(room) > 10) {
|
||||
continue;
|
||||
} else {
|
||||
if (room->GetGasData().gas_mode == GasJump &&
|
||||
if (room->GetGasData().GetGasMode() == GasJump &&
|
||||
entity != hum &&
|
||||
entity->GetEntityType() == ET_Player &&
|
||||
((Human*)entity)->HasBuffEffect(kBET_Fly)) {
|
||||
|
@ -0,0 +1,8 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "gasdata.h"
|
||||
|
||||
void GasData::SetGasMode(GasMode_e gas_mode)
|
||||
{
|
||||
gas_mode_ = gas_mode;
|
||||
}
|
@ -12,7 +12,6 @@ namespace MetaData
|
||||
|
||||
struct GasData
|
||||
{
|
||||
GasMode_e gas_mode = GasInactive;
|
||||
a8::Vec2 pos_old;
|
||||
a8::Vec2 pos_old_bk;
|
||||
a8::Vec2 pre_pos_old;
|
||||
@ -26,4 +25,11 @@ struct GasData
|
||||
MetaData::SafeAreaPos* pos_list = nullptr;
|
||||
bool is_last_gas = false;
|
||||
int gas_count = 0;
|
||||
|
||||
GasMode_e GetGasMode() const { return gas_mode_; };
|
||||
void SetGasMode(GasMode_e gas_mode);
|
||||
|
||||
private:
|
||||
GasMode_e gas_mode_ = GasInactive;
|
||||
|
||||
};
|
||||
|
@ -107,7 +107,7 @@ void HeroAI::UpdateIdle()
|
||||
void HeroAI::UpdateThinking()
|
||||
{
|
||||
Hero* hero = (Hero*)owner;
|
||||
if (hero->room->GetGasData().gas_mode == GasInactive ||
|
||||
if (hero->room->GetGasData().GetGasMode() == GasInactive ||
|
||||
hero->room->IsWaitingStart() ||
|
||||
hero->HasBuffEffect(kBET_PeaceMode) ||
|
||||
hero->HasBuffEffect(kBET_Jump)
|
||||
@ -312,7 +312,7 @@ void HeroAI::ChangeToStateAI(HeroState_e to_state)
|
||||
node_->start_shot_frameno = 0;
|
||||
node_->shot_times = 0;
|
||||
moving_ = false;
|
||||
if (hero->room->GetGasData().gas_mode == GasInactive ||
|
||||
if (hero->room->GetGasData().GetGasMode() == GasInactive ||
|
||||
hero->room->IsWaitingStart() ||
|
||||
hero->HasBuffEffect(kBET_Jump)) {
|
||||
node_->param1 = rand() % (3 * SERVER_FRAME_RATE);
|
||||
@ -418,7 +418,7 @@ Creature* HeroAI::GetTarget()
|
||||
return nullptr;
|
||||
}
|
||||
Hero* myself = (Hero*)owner;
|
||||
if (myself->room->GetGasData().gas_mode == GasInactive) {
|
||||
if (myself->room->GetGasData().GetGasMode() == GasInactive) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -737,11 +737,11 @@ void Human::FillMFTeamData(Human* hum, cs::MFTeamData* team_data, bool is_game_o
|
||||
team_data->set_dead(dead);
|
||||
#endif
|
||||
|
||||
if (is_game_over || room->GetGasData().gas_mode == GasInactive) {
|
||||
if (is_game_over || room->GetGasData().GetGasMode() == GasInactive) {
|
||||
team_data->set_name(name);
|
||||
}
|
||||
|
||||
if (room->GetGasData().gas_mode != GasInactive &&
|
||||
if (room->GetGasData().GetGasMode() != GasInactive &&
|
||||
room->GetFrameNo() - room->GetBattleStartFrameNo() < 4) {
|
||||
team_data->set_name(name);
|
||||
team_data->set_disconnected(socket_handle == 0);
|
||||
@ -766,7 +766,7 @@ void Human::FillMFTeamData(Human* hum, cs::MFTeamData* team_data, bool is_game_o
|
||||
if (sex != 0) {
|
||||
team_data->set_sex(sex);
|
||||
}
|
||||
if (room->GetGasData().gas_mode == GasInactive ||
|
||||
if (room->GetGasData().GetGasMode() == GasInactive ||
|
||||
room->GetFrameNo() - room->GetBattleStartFrameNo() < 4) {
|
||||
team_data->set_user_data(user_data);
|
||||
}
|
||||
@ -1422,7 +1422,7 @@ void Human::DoJump()
|
||||
|
||||
void Human::DoGetOn(int obj_uniid)
|
||||
{
|
||||
if (room->GetGasData().gas_mode == GasInactive) {
|
||||
if (room->GetGasData().GetGasMode() == GasInactive) {
|
||||
return;
|
||||
}
|
||||
Entity* entity = room->GetEntityByUniId(obj_uniid);
|
||||
@ -1655,14 +1655,14 @@ void Human::FillMFActivePlayerData(cs::MFActivePlayerData* player_data)
|
||||
|
||||
void Human::FillMFGasData(cs::MFGasData* gas_data)
|
||||
{
|
||||
gas_data->set_mode(room->GetGasData().gas_mode);
|
||||
if (room->GetGasData().gas_mode == GasInactive) {
|
||||
gas_data->set_mode(room->GetGasData().GetGasMode());
|
||||
if (room->GetGasData().GetGasMode() == GasInactive) {
|
||||
long long duration = room->GetGasInactiveTime() * SERVER_FRAME_RATE -
|
||||
(room->GetFrameNo() - room->GetGasData().gas_start_frameno);
|
||||
gas_data->set_duration(std::max(duration * 50, (long long)1000) / 1000);
|
||||
} else if (room->GetGasData().gas_mode == GasJump) {
|
||||
} else if (room->GetGasData().GetGasMode() == GasJump) {
|
||||
gas_data->set_duration(0);
|
||||
} else if (room->GetGasData().gas_mode == GasMoving) {
|
||||
} else if (room->GetGasData().GetGasMode() == GasMoving) {
|
||||
if (room->GetGasData().new_area_meta->i->shrink_speed() > 0.01f) {
|
||||
long long duration = (room->GetGasData().old_area_meta->i->rad() - room->GetGasData().new_area_meta->i->rad()) /
|
||||
room->GetGasData().new_area_meta->i->shrink_speed();
|
||||
@ -4207,7 +4207,7 @@ void Human::DoFollow(int target_id)
|
||||
hum->room->xtimer.DeleteTimer(hum->room->xtimer.GetRunningTimer());
|
||||
return;
|
||||
}
|
||||
if (hum->room->GetGasData().gas_mode != GasInactive &&
|
||||
if (hum->room->GetGasData().GetGasMode() != GasInactive &&
|
||||
!(hum->follow_target.Get()->HasBuffEffect(kBET_Fly) ||
|
||||
hum->follow_target.Get()->HasBuffEffect(kBET_Jump))
|
||||
){
|
||||
|
@ -183,13 +183,13 @@ bool Incubator::CanSee(Human* hum, Human* exclude_hum)
|
||||
|
||||
void Incubator::AutoAllocAndroid()
|
||||
{
|
||||
switch (room->GetGasData().gas_mode) {
|
||||
switch (room->GetGasData().GetGasMode()) {
|
||||
case GasWaiting:
|
||||
case GasMoving:
|
||||
{
|
||||
if (!hold_humans_.empty()){
|
||||
Human* hum = hold_humans_[0];
|
||||
if (room->GetGasData().gas_mode == GasWaiting &&
|
||||
if (room->GetGasData().GetGasMode() == GasWaiting &&
|
||||
hold_humans_.size() > 1 &&
|
||||
((rand() % 100) > 40)) {
|
||||
Human* killer = nullptr;
|
||||
|
@ -351,7 +351,7 @@ bool MapService::CollisionDetectionAndGetCollider(Room* room,
|
||||
case ET_Obstacle:
|
||||
{
|
||||
Obstacle* obstacle = (Obstacle*)collider->owner;
|
||||
if (obstacle->meta->i->prebattle_hide() && room->GetGasData().gas_mode == GasInactive) {
|
||||
if (obstacle->meta->i->prebattle_hide() && room->GetGasData().GetGasMode() == GasInactive) {
|
||||
break;
|
||||
}
|
||||
if (obstacle->meta->i->collision_hit() != kCollisionHitPass) {
|
||||
|
@ -94,7 +94,7 @@ void MoveableEntity::SetAttackDir(const a8::Vec2& attack_dir)
|
||||
{
|
||||
attack_dir_ = attack_dir;
|
||||
++chg_attack_dir_times_;
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG1
|
||||
if (IsCreature(room) && ((Creature*)this)->IsPlayer()) {
|
||||
Creature* c = (Creature*)this;
|
||||
c->SendDebugMsg(
|
||||
|
@ -707,7 +707,7 @@ int Obstacle::OnCollisionTrigger(Creature* c, ColliderComponent* collider)
|
||||
break;
|
||||
case kCollisionHitDeadAndDrop:
|
||||
{
|
||||
if (c->room->GetGasData().gas_mode != GasInactive &&
|
||||
if (c->room->GetGasData().GetGasMode() != GasInactive &&
|
||||
meta->HasDrop() &&
|
||||
c->IsHuman()) {
|
||||
Die(c->room);
|
||||
|
@ -450,8 +450,8 @@ void Player::UpdateUseItemId()
|
||||
|
||||
void Player::UpdateSpectate()
|
||||
{
|
||||
if (room->GetGasData().gas_mode == GasInactive ||
|
||||
room->GetGasData().gas_mode == GasJump ||
|
||||
if (room->GetGasData().GetGasMode() == GasInactive ||
|
||||
room->GetGasData().GetGasMode() == GasJump ||
|
||||
HasBuffEffect(kBET_Fly)) {
|
||||
spectate = false;
|
||||
return;
|
||||
@ -563,7 +563,7 @@ void Player::Shot()
|
||||
|
||||
void Player::ProcInteraction()
|
||||
{
|
||||
if (room->GetGasData().gas_mode == GasInactive) {
|
||||
if (room->GetGasData().GetGasMode() == GasInactive) {
|
||||
return;
|
||||
}
|
||||
if (HasBuffEffect(kBET_Fly)) {
|
||||
|
@ -241,7 +241,7 @@ Player* Room::NewPlayer()
|
||||
|
||||
void Room::AddPlayer(Player* hum, BornPoint* init_born_point, bool no_matchteam)
|
||||
{
|
||||
if (gas_data_.gas_mode != GasInactive) {
|
||||
if (GetGasData().GetGasMode() != GasInactive) {
|
||||
A8_ABORT();
|
||||
}
|
||||
while (human_hash_.size() >= GetRoomMaxPlayerNum()) {
|
||||
@ -297,7 +297,7 @@ int Room::AllocUniid()
|
||||
|
||||
void Room::ShuaAndroid()
|
||||
{
|
||||
if (gas_data_.gas_mode != GasInactive) {
|
||||
if (GetGasData().GetGasMode() != GasInactive) {
|
||||
return;
|
||||
}
|
||||
int robot_num = a8::RandEx(map_meta_->refresh_robot_min_num,
|
||||
@ -534,7 +534,7 @@ int Room::CreateLootEx(int equip_id, a8::Vec2 born_pos, a8::Vec2 pos, int count,
|
||||
MetaData::Equip* equip_meta = MetaMgr::Instance()->GetEquip(equip_id);
|
||||
if (equip_meta) {
|
||||
#ifdef DEBUG
|
||||
if (GetGasData().gas_mode == GasWaiting || GetGasData().gas_mode == GasMoving) {
|
||||
if (GetGasData().GetGasMode() == GasWaiting || GetGasData().GetGasMode() == GasMoving) {
|
||||
#if 0
|
||||
if (equip_id == 30908) {
|
||||
A8_ABORT();
|
||||
@ -972,7 +972,7 @@ bool Room::CanJoin(const std::string& accountid,
|
||||
if (room_mode_ != self_room_mode) {
|
||||
return false;
|
||||
}
|
||||
if (gas_data_.gas_mode != GasInactive) {
|
||||
if (GetGasData().GetGasMode() != GasInactive) {
|
||||
return false;
|
||||
}
|
||||
if (init_map_id != 0) {
|
||||
@ -1000,7 +1000,7 @@ bool Room::CanJoin(const std::string& accountid,
|
||||
|
||||
bool Room::CanJoin(class MatchTeam* team)
|
||||
{
|
||||
if (gas_data_.gas_mode != GasInactive) {
|
||||
if (GetGasData().GetGasMode() != GasInactive) {
|
||||
return false;
|
||||
}
|
||||
if (map_instance->map_id != team->GetMapId()) {
|
||||
@ -1176,7 +1176,7 @@ void Room::BroadcastDebugMsg(const std::string& debug_msg)
|
||||
|
||||
void Room::UpdateGas()
|
||||
{
|
||||
switch (gas_data_.gas_mode) {
|
||||
switch (GetGasData().GetGasMode()) {
|
||||
case GasInactive:
|
||||
UpdateGasInactive();
|
||||
break;
|
||||
@ -1190,8 +1190,8 @@ void Room::UpdateGas()
|
||||
UpdateGasMoving();
|
||||
break;
|
||||
}
|
||||
if (gas_data_.gas_mode != GasInactive && gas_data_.gas_mode != GasJump) {
|
||||
if (gas_data_.gas_mode != GasInactive) {
|
||||
if (GetGasData().GetGasMode() != GasInactive && GetGasData().GetGasMode() != GasJump) {
|
||||
if (GetGasData().GetGasMode() != GasInactive) {
|
||||
if (IsPveRoom()) {
|
||||
if (!IsGameOver() &&
|
||||
(
|
||||
@ -1262,7 +1262,7 @@ void Room::UpdateGasInactivePvp()
|
||||
if (GetFrameNo() - gas_data_.gas_start_frameno >=
|
||||
GetGasInactiveTime() * SERVER_FRAME_RATE) {
|
||||
long long begin_tick = a8::XGetTickCount();
|
||||
gas_data_.gas_mode = GasJump;
|
||||
gas_data_.SetGasMode(GasJump);
|
||||
gas_data_.gas_start_frameno = GetFrameNo();
|
||||
if (human_hash_.size() < GetRoomMaxPlayerNum()) {
|
||||
CreateAndroid(GetRoomMaxPlayerNum() - human_hash_.size());
|
||||
@ -1324,7 +1324,7 @@ void Room::UpdateGasInactivePve()
|
||||
GetGasInactiveTime() * SERVER_FRAME_RATE) {
|
||||
{
|
||||
auto first_safearea = pve_mode_meta->area[0];
|
||||
gas_data_.gas_mode = GasWaiting;
|
||||
gas_data_.SetGasMode(GasWaiting);
|
||||
gas_data_.gas_start_frameno = GetFrameNo();
|
||||
battle_start_frameno_ = GetFrameNo();
|
||||
gas_data_.old_area_meta = first_safearea;
|
||||
@ -1352,7 +1352,7 @@ void Room::UpdateGasWaiting()
|
||||
} else {
|
||||
if (GetFrameNo() - gas_data_.gas_start_frameno >=
|
||||
gas_data_.old_area_meta->i->wait_time() * SERVER_FRAME_RATE) {
|
||||
gas_data_.gas_mode = GasMoving;
|
||||
gas_data_.SetGasMode(GasMoving);
|
||||
gas_data_.gas_start_frameno = GetFrameNo();;
|
||||
}
|
||||
}
|
||||
@ -1430,7 +1430,7 @@ void Room::UpdateGasJump()
|
||||
});
|
||||
MetaData::SafeArea* first_safearea = MetaMgr::Instance()->GetSafeAreaByType
|
||||
(map_meta_->RandSafeArea());
|
||||
gas_data_.gas_mode = GasWaiting;
|
||||
gas_data_.SetGasMode(GasWaiting);
|
||||
gas_data_.old_area_meta = first_safearea;
|
||||
gas_data_.new_area_meta = MetaMgr::Instance()->GetSafeArea(first_safearea->i->id() + 1);
|
||||
gas_data_.pos_list = MetaMgr::Instance()->RandSafeAreaPos(first_safearea->i->id());
|
||||
@ -3706,7 +3706,7 @@ void Room::ForwardGasRing(int n)
|
||||
gas_data_.is_last_gas = true;
|
||||
return;
|
||||
}
|
||||
gas_data_.gas_mode = GasWaiting;
|
||||
gas_data_.SetGasMode(GasWaiting);
|
||||
a8::Vec2 pre_pos = gas_data_.pos_new;
|
||||
gas_data_.old_area_meta = MetaMgr::Instance()->GetSafeArea(pre_area_id);
|
||||
gas_data_.new_area_meta = MetaMgr::Instance()->GetSafeArea(pre_area_id + 1);
|
||||
@ -4082,7 +4082,7 @@ bool Room::IsSurvivalRoom()
|
||||
void Room::OnEnterNewWave(int wave)
|
||||
{
|
||||
if (IsDestoryRoom() && wave > 0 && wave < pve_mode_meta->area.size()) {
|
||||
gas_data_.gas_mode = GasWaiting;
|
||||
gas_data_.SetGasMode(GasWaiting);
|
||||
gas_data_.gas_start_frameno = GetFrameNo();
|
||||
battle_start_frameno_ = GetFrameNo();
|
||||
gas_data_.old_area_meta = pve_mode_meta->area[wave];
|
||||
|
Loading…
x
Reference in New Issue
Block a user