This commit is contained in:
aozhiwei 2023-07-07 20:36:16 +08:00
parent edf7d6f0bb
commit d83b3b04f0
5 changed files with 35 additions and 2 deletions

View File

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

View File

@ -108,7 +108,13 @@ void MapInstance::Init()
MAP_GRID_WIDTH);
{
navmesh_ = dtAllocNavMesh();
FILE *fp = fopen((mt::MetaMgr::Instance()->GetResDir() + "map4.bin").c_str(), "rb");
std::string navmesh_file = "map4.bin";
#ifdef DEBUG
if (DebugCmd::EnableNewMap() && map_id == 2002) {
navmesh_file = "map5.bin";
}
#endif
FILE *fp = fopen((mt::MetaMgr::Instance()->GetResDir() + navmesh_file).c_str(), "rb");
if(fp){
//fseek(fp, 0, SEEK_END);
//int file_size = ftell(fp);
@ -1245,6 +1251,11 @@ 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
dtQueryFilter filter;
filter.setIncludeFlags(0xffff);

View File

@ -4,6 +4,7 @@
#include "room.h"
#include "mapinstance.h"
#include "roommgr.h"
#include "debugcmd.h"
#include "mt/Map.h"
#include "mt/PveGemini.h"
@ -17,7 +18,11 @@ void MapMgr::Init()
[this] (const mt::Map* map_meta, bool& stop)
{
if (map_meta->map_id() == 2001 ||
map_meta->map_id() == 1003
map_meta->map_id() == 1003 ||
#ifdef DEBUG
(DebugCmd::EnableNewMap() && map_meta->map_id() == 2002) ||
#endif
false
) {
auto map_instance = std::make_shared<MapInstance>();
map_instance->map_id = map_meta->map_id();
@ -98,6 +103,11 @@ 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

@ -35,6 +35,7 @@
#include "guide.h"
#include "mapinstance.h"
#include "compose.h"
#include "debugcmd.h"
#include "mt/Param.h"
#include "mt/Equip.h"
@ -1439,6 +1440,11 @@ 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());