This commit is contained in:
aozhiwei 2023-09-06 14:50:04 +08:00
parent c2e86e60be
commit ecc478c4c2
11 changed files with 25 additions and 31 deletions

View File

@ -11,11 +11,6 @@ bool DebugCmd::Enable()
return App::Instance()->instance_id == 6;
}
bool DebugCmd::EnableNewMap()
{
return App::Instance()->instance_id == 3;
}
void DebugCmd::CreateSphere(Creature* c,
const glm::vec3& pos,
const glm::vec3& scale,

View File

@ -11,7 +11,6 @@ class DebugCmd
public:
static bool Enable();
static bool EnableNewMap();
static void CreateSphere(Creature* c,
const glm::vec3& pos,

View File

@ -108,12 +108,7 @@ void MapInstance::Init()
MAP_GRID_WIDTH);
{
navmesh_ = dtAllocNavMesh();
std::string navmesh_file = "map4.bin";
#ifdef DEBUG
if (DebugCmd::EnableNewMap() && map_id == 2002) {
navmesh_file = "map5.bin";
}
#endif
std::string navmesh_file = map_meta_->navmesh_file();
FILE *fp = fopen((mt::MetaMgr::Instance()->GetResDir() + navmesh_file).c_str(), "rb");
if(fp){
//fseek(fp, 0, SEEK_END);
@ -1251,12 +1246,7 @@ void MapInstance::MarkConnectablePolys()
{
dtPolyRef startRef = INVALID_NAVMESH_POLYREF;
{
glm::vec3 pos = glm::vec3(5120.000000000000f, 6.250846862793f, 5120.000000000000f);
#ifdef DEBUG
if (DebugCmd::EnableNewMap() && map_id == 2002) {
pos = glm::vec3(287.000000000000f, 6.19, 453);
}
#endif
glm::vec3 pos = map_meta_->GroundSamplingPos();
dtQueryFilter filter;
filter.setIncludeFlags(0xffff);

View File

@ -97,11 +97,6 @@ void MapMgr::AttachRoom(Room* room, RoomInitInfo& init_info)
}
#endif
}
#endif
#ifdef DEBUG
if (DebugCmd::EnableNewMap()) {
map_instance = GetMapInstance(2002);
}
#endif
if (!map_instance) {
A8_ABORT();

View File

@ -274,4 +274,9 @@ namespace mt
return is_open();
}
glm::vec3 Map::GroundSamplingPos() const
{
}
}

View File

@ -43,6 +43,7 @@ namespace mt
int RandSafeArea() const;
bool IsPveMap() const;
bool IsOpen() const;
glm::vec3 GroundSamplingPos() const;
void Init1();
void Init2();

View File

@ -35,6 +35,8 @@ namespace mtb
int team() const { return team_; };
int star_condition() const { return star_condition_; };
int is_open() const { return is_open_; };
const std::string ground_sampling_pos() const { return ground_sampling_pos_; };
const std::string navmesh_file() const { return navmesh_file_; };
bool has_map_id() const { return __flags__.test(0);};
bool has_template_list() const { return __flags__.test(1);};
@ -61,6 +63,8 @@ namespace mtb
bool has_team() const { return __flags__.test(22);};
bool has_star_condition() const { return __flags__.test(23);};
bool has_is_opon() const { return __flags__.test(24);};
bool has_ground_sampling_pos() const { return __flags__.test(25);};
bool has_navmesh_file() const { return __flags__.test(26);};
protected:
@ -89,6 +93,8 @@ namespace mtb
int team_ = 0;
int star_condition_ = 0;
int is_open_ = 0;
std::string ground_sampling_pos_;
std::string navmesh_file_;
public:
std::bitset<21> __flags__;

View File

@ -71,7 +71,7 @@ namespace mtb
{
a8::reflect::Class* meta_class = nullptr;
if (!meta_class) {
meta_class = new a8::reflect::Class("Map", 25, 0);
meta_class = new a8::reflect::Class("Map", 27, 0);
meta_class->SetSimpleField(0, "map_id", a8::reflect::ET_INT32, my_offsetof2(Map, map_id_));
meta_class->SetSimpleField(1, "template_list", a8::reflect::ET_STRING, my_offsetof2(Map, template_list_));
meta_class->SetSimpleField(2, "map_name", a8::reflect::ET_STRING, my_offsetof2(Map, map_name_));
@ -97,6 +97,8 @@ namespace mtb
meta_class->SetSimpleField(22, "team", a8::reflect::ET_INT32, my_offsetof2(Map, team_));
meta_class->SetSimpleField(23, "star_condition", a8::reflect::ET_INT32, my_offsetof2(Map, star_condition_));
meta_class->SetSimpleField(24, "is_open", a8::reflect::ET_INT32, my_offsetof2(Map, is_open_));
meta_class->SetSimpleField(25, "ground_sampling_pos", a8::reflect::ET_STRING, my_offsetof2(Map, ground_sampling_pos_));
meta_class->SetSimpleField(26, "navmesh_fle", a8::reflect::ET_STRING, my_offsetof2(Map, navmesh_file_));
}
return meta_class;
}

View File

@ -1440,11 +1440,6 @@ void Player::PushJoinRoomMsg()
notifymsg.set_map_id(room->GetMapMeta()->map_id());
#if 1
notifymsg.set_map_id(1001);
#endif
#ifdef DEBUG
if (DebugCmd::EnableNewMap()) {
notifymsg.set_map_id(room->GetMapMeta()->map_id());
}
#endif
notifymsg.set_map_width(room->GetMapMeta()->map_width());
notifymsg.set_map_height(room->GetMapMeta()->map_height());

View File

@ -33,8 +33,8 @@
#include <f8/udplog.h>
#include <f8/timer.h>
const int ROOM_NUM_UP_LIMIT = 1000;
const int HUM_NUM_DOWN_LIMIT = 2500;
static const int ROOM_NUM_UP_LIMIT = 1000;
static const int HUM_NUM_DOWN_LIMIT = 2500;
static RoomType_e GetHumanRoomType(const std::shared_ptr<BattleDataContext> netdata)
{

View File

@ -36,6 +36,12 @@ message Map
optional string map_collider = 19;
optional string world_object_file = 20;
optional string terrain_file = 21;
optional int32 map_type = 22;
optional int32 team = 23;
optional int32 star_condition = 24;
optional int32 is_open = 25;
optional string ground_sampling_pos = 26;
optional string navmesh_file = 27;
}
message MapArea