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 "bornpoint.h"
#include "room.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;
if (wo_meta) {
@ -16,8 +38,3 @@ Position BornPoint::RandPoint() const
}
return pos;
}
int BornPoint::GetNum()
{
return 10;
}

View File

@ -10,6 +10,7 @@ namespace mt
struct WorldObject;
}
class Room;
struct BornPoint
{
int player_num = 0;
@ -17,5 +18,6 @@ struct BornPoint
std::shared_ptr<mt::WorldObject> wo_meta;
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 1
if (IsHuman()) {
point = AsHuman()->born_point->RandPoint().ToGlmVec3();
point = AsHuman()->born_point->GetSrcPoint(room).ToGlmVec3();
}
#else
abort();

View File

@ -263,7 +263,7 @@ Human* Incubator::ActiveAndroid(Human* hum)
Global::Instance()->verify_set_pos = 0;
} else {
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;
}
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) {
abort();
} else {
hum->SetPos(hum->born_point->RandPoint());
hum->SetPos(hum->born_point->RandPoint(this));
}
Global::Instance()->verify_set_pos = 0;
glm::vec3 attack_dir = hum->GetPos().ToGlmVec3();
@ -372,7 +372,7 @@ void Room::ShowAndroid(Human* target, int num)
}
hum->born_point = target->born_point;
IncBornPointHumanNum(hum->born_point, hum);
hum->SetPos(hum->born_point->RandPoint());
hum->SetPos(hum->born_point->RandPoint(this));
EnableHuman(hum);
++i;
if (i >= num) {
@ -406,7 +406,7 @@ void Room::CreateAndroid(int robot_num)
if (!hum->born_point) {
abort();
} else {
hum->SetPos(hum->born_point->RandPoint());
hum->SetPos(hum->born_point->RandPoint(this));
}
Global::Instance()->verify_set_pos = 0;
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;
if (hum->born_point) {
IncBornPointHumanNum(hum->born_point, hum);
hum->SetPos(hum->born_point->RandPoint());
hum->SetPos(hum->born_point->RandPoint(this));
}
hum->FindLocation();
hum->RefreshView();
@ -3418,7 +3418,7 @@ void Room::AddTeam(class MatchTeam* team)
if (!hum->born_point) {
abort();
} else {
hum->SetPos(hum->born_point->RandPoint());
hum->SetPos(hum->born_point->RandPoint(this));
}
Global::Instance()->verify_set_pos = 0;
glm::vec3 attack_dir = hum->GetPos().ToGlmVec3();

View File

@ -243,6 +243,8 @@ public:
std::shared_ptr<SandTable> GetSandTable() { return sand_table_; }
bool IsSandTableRoom();
void LockRoom() { lock_room_ = true; }
void CombineTeam();
void FillTeam();
private:
void ShuaAndroid();
@ -258,8 +260,6 @@ private:
void UpdateGasJump();
bool GenSmallCircle();
void MatchTeam(Human* hum);
void CombineTeam();
void FillTeam();
void ShuaPlane();
Team* NewTeam();
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) {
room->LockRoom();
room->CombineTeam();
room->FillTeam();
}
},
&room->xtimer_attacher_);

View File

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