This commit is contained in:
aozhiwei 2023-05-19 16:14:28 +08:00
parent 809fa8e608
commit 609dc6ed88
8 changed files with 38 additions and 17 deletions

View File

@ -1,10 +1,32 @@
#include "precompile.h" #include "precompile.h"
#include "bornpoint.h" #include "bornpoint.h"
#include "room.h"
#include "mt/Map.h" #include "mt/Map.h"
Position BornPoint::RandPoint() const Position BornPoint::RandPoint(Room* room) const
{
Position pos;
if (wo_meta) {
pos.FromGlmVec3(wo_meta->pos);
} else {
pos.SetX(5120.000000000000);
pos.SetY(6.250846862793);
pos.SetZ(5120.000000000000);
}
if (room->IsSandTableRoom()) {
}
return pos;
}
int BornPoint::GetNum()
{
return 4;
}
Position BornPoint::GetSrcPoint(Room* room) const
{ {
Position pos; Position pos;
if (wo_meta) { if (wo_meta) {
@ -16,8 +38,3 @@ Position BornPoint::RandPoint() const
} }
return pos; return pos;
} }
int BornPoint::GetNum()
{
return 10;
}

View File

@ -10,6 +10,7 @@ namespace mt
struct WorldObject; struct WorldObject;
} }
class Room;
struct BornPoint struct BornPoint
{ {
int player_num = 0; int player_num = 0;
@ -17,5 +18,6 @@ struct BornPoint
std::shared_ptr<mt::WorldObject> wo_meta; std::shared_ptr<mt::WorldObject> wo_meta;
int GetNum(); int GetNum();
Position RandPoint() const; Position RandPoint(Room* room) const;
Position GetSrcPoint(Room* room) const;
}; };

View File

@ -2589,7 +2589,7 @@ void Creature::OnLand()
if (!ok) { if (!ok) {
#if 1 #if 1
if (IsHuman()) { if (IsHuman()) {
point = AsHuman()->born_point->RandPoint().ToGlmVec3(); point = AsHuman()->born_point->GetSrcPoint(room).ToGlmVec3();
} }
#else #else
abort(); abort();

View File

@ -263,7 +263,7 @@ Human* Incubator::ActiveAndroid(Human* hum)
Global::Instance()->verify_set_pos = 0; Global::Instance()->verify_set_pos = 0;
} else { } else {
Global::Instance()->verify_set_pos = 1; Global::Instance()->verify_set_pos = 1;
target->GetMutablePos().FromGlmVec3(target->born_point->RandPoint().ToGlmVec3()); target->GetMutablePos().FromGlmVec3(target->born_point->GetSrcPoint(room).ToGlmVec3());
Global::Instance()->verify_set_pos = 0; Global::Instance()->verify_set_pos = 0;
} }
room->EnableHuman(hum); room->EnableHuman(hum);

View File

@ -288,7 +288,7 @@ void Room::AddPlayer(Player* hum, std::shared_ptr<BornPoint> init_born_point, bo
if (!hum->born_point) { if (!hum->born_point) {
abort(); abort();
} else { } else {
hum->SetPos(hum->born_point->RandPoint()); hum->SetPos(hum->born_point->RandPoint(this));
} }
Global::Instance()->verify_set_pos = 0; Global::Instance()->verify_set_pos = 0;
glm::vec3 attack_dir = hum->GetPos().ToGlmVec3(); glm::vec3 attack_dir = hum->GetPos().ToGlmVec3();
@ -372,7 +372,7 @@ void Room::ShowAndroid(Human* target, int num)
} }
hum->born_point = target->born_point; hum->born_point = target->born_point;
IncBornPointHumanNum(hum->born_point, hum); IncBornPointHumanNum(hum->born_point, hum);
hum->SetPos(hum->born_point->RandPoint()); hum->SetPos(hum->born_point->RandPoint(this));
EnableHuman(hum); EnableHuman(hum);
++i; ++i;
if (i >= num) { if (i >= num) {
@ -406,7 +406,7 @@ void Room::CreateAndroid(int robot_num)
if (!hum->born_point) { if (!hum->born_point) {
abort(); abort();
} else { } else {
hum->SetPos(hum->born_point->RandPoint()); hum->SetPos(hum->born_point->RandPoint(this));
} }
Global::Instance()->verify_set_pos = 0; Global::Instance()->verify_set_pos = 0;
glm::vec3 attack_dir = hum->GetPos().ToGlmVec3(); glm::vec3 attack_dir = hum->GetPos().ToGlmVec3();
@ -2932,7 +2932,7 @@ void Room::ForceSetBornPoint(Human* hum, std::shared_ptr<BornPoint> born_point)
hum->born_point = born_point; hum->born_point = born_point;
if (hum->born_point) { if (hum->born_point) {
IncBornPointHumanNum(hum->born_point, hum); IncBornPointHumanNum(hum->born_point, hum);
hum->SetPos(hum->born_point->RandPoint()); hum->SetPos(hum->born_point->RandPoint(this));
} }
hum->FindLocation(); hum->FindLocation();
hum->RefreshView(); hum->RefreshView();
@ -3418,7 +3418,7 @@ void Room::AddTeam(class MatchTeam* team)
if (!hum->born_point) { if (!hum->born_point) {
abort(); abort();
} else { } else {
hum->SetPos(hum->born_point->RandPoint()); hum->SetPos(hum->born_point->RandPoint(this));
} }
Global::Instance()->verify_set_pos = 0; Global::Instance()->verify_set_pos = 0;
glm::vec3 attack_dir = hum->GetPos().ToGlmVec3(); glm::vec3 attack_dir = hum->GetPos().ToGlmVec3();

View File

@ -243,6 +243,8 @@ public:
std::shared_ptr<SandTable> GetSandTable() { return sand_table_; } std::shared_ptr<SandTable> GetSandTable() { return sand_table_; }
bool IsSandTableRoom(); bool IsSandTableRoom();
void LockRoom() { lock_room_ = true; } void LockRoom() { lock_room_ = true; }
void CombineTeam();
void FillTeam();
private: private:
void ShuaAndroid(); void ShuaAndroid();
@ -258,8 +260,6 @@ private:
void UpdateGasJump(); void UpdateGasJump();
bool GenSmallCircle(); bool GenSmallCircle();
void MatchTeam(Human* hum); void MatchTeam(Human* hum);
void CombineTeam();
void FillTeam();
void ShuaPlane(); void ShuaPlane();
Team* NewTeam(); Team* NewTeam();
RoomObstacle* InternalCreateObstacle(int id, float x, float y, float z, RoomObstacle* InternalCreateObstacle(int id, float x, float y, float z,

View File

@ -12,6 +12,8 @@ SandTable::SandTable(Room* room): room_(room)
{ {
if (a8::TIMER_EXEC_EVENT == event) { if (a8::TIMER_EXEC_EVENT == event) {
room->LockRoom(); room->LockRoom();
room->CombineTeam();
room->FillTeam();
} }
}, },
&room->xtimer_attacher_); &room->xtimer_attacher_);

View File

@ -115,7 +115,7 @@ void Team::CombineBornPoint()
if (!member->born_point) { if (!member->born_point) {
abort(); abort();
} else { } else {
member->SetPos(member->born_point->RandPoint()); member->SetPos(member->born_point->RandPoint(member->room));
} }
if (!a8::HasBitFlag(member->status, CS_Disable)) { if (!a8::HasBitFlag(member->status, CS_Disable)) {
member->FindLocation(); member->FindLocation();