Compare commits

...

47 Commits
master ... dev

Author SHA1 Message Date
azw
c47167c2c9 1 2023-11-08 10:11:02 +00:00
azw
eabd540021 1 2023-11-08 10:09:35 +00:00
azw
4f822967d4 1 2023-11-08 10:03:04 +00:00
azw
12feeffafb 1 2023-11-08 09:52:58 +00:00
azw
c3c0bc5d29 1 2023-11-06 11:14:23 +00:00
azw
d0f9a9b30e 1 2023-11-06 10:58:36 +00:00
aozhiwei
9fa4062b82 Merge branch 'jump' into dev 2023-05-15 18:12:23 +08:00
aozhiwei
b68a232135 1 2023-05-14 16:26:48 +08:00
aozhiwei
8ef59c6030 1 2023-05-12 11:57:46 +08:00
aozhiwei
9c00a80f3d 1 2023-05-11 15:55:27 +08:00
aozhiwei
681697d647 1 2023-05-10 16:45:00 +08:00
aozhiwei
976712c9d4 1 2023-05-10 16:30:15 +08:00
aozhiwei
bf283f2ac9 1 2023-05-06 10:41:29 +08:00
aozhiwei
5214bc056e 1 2023-05-06 10:38:48 +08:00
aozhiwei
4f5b8d0d9b 1 2023-05-05 19:23:00 +08:00
aozhiwei
3226878c93 1 2023-04-27 13:22:26 +08:00
aozhiwei
b2bb8cc9e9 1 2023-04-27 10:34:07 +08:00
aozhiwei
8315b155d6 1 2023-04-25 19:14:24 +08:00
aozhiwei
d6a684dd10 1 2023-04-19 13:45:41 +08:00
aozhiwei
cb37f0db76 1 2023-04-18 13:29:46 +08:00
aozhiwei
c79b8453a9 1 2023-04-18 13:23:40 +08:00
aozhiwei
f6f0e5a6bf 1 2023-04-18 11:40:36 +08:00
aozhiwei
55516aee64 1 2023-04-17 20:29:32 +08:00
aozhiwei
943fd1415c 1 2023-04-17 20:09:29 +08:00
aozhiwei
c66ce54497 1 2023-04-17 20:08:04 +08:00
aozhiwei
4c775a46a9 1 2023-04-17 20:06:59 +08:00
aozhiwei
0481a7d088 1 2023-04-17 19:52:39 +08:00
aozhiwei
a5400d027f 1 2023-04-17 19:51:26 +08:00
aozhiwei
13cd59f9a8 1 2023-04-17 19:50:25 +08:00
aozhiwei
7ad03facd1 Merge branch 'online' into dev 2023-04-17 18:51:14 +08:00
aozhiwei
8c3ecf7a26 1 2023-04-17 14:19:41 +08:00
aozhiwei
9b7c7a0f9b 1 2023-04-17 14:16:24 +08:00
aozhiwei
f7678c47fd 1 2023-04-17 14:03:50 +08:00
aozhiwei
301df577f1 1 2023-04-17 13:40:48 +08:00
aozhiwei
f93847711d git Merge branch 'online' into dev 2023-04-17 13:23:34 +08:00
aozhiwei
d348de32fb Merge branch 'online' into dev 2023-04-14 14:25:36 +08:00
aozhiwei
c9ab65044e Merge branch 'online' into dev 2023-04-14 11:09:47 +08:00
aozhiwei
07ed1c345d Merge branch 'online' into dev 2023-04-13 19:17:06 +08:00
aozhiwei
e1ef898c0f Merge branch 'online' into dev 2023-04-12 14:40:42 +08:00
aozhiwei
01b4969583 Merge branch 'online' into dev 2023-04-11 15:57:08 +08:00
aozhiwei
b1e980950a 1 2023-04-11 15:07:04 +08:00
aozhiwei
afa835f36d 1 2023-04-11 10:27:57 +08:00
aozhiwei
08f442aa9c 1 2023-04-10 19:32:15 +08:00
aozhiwei
35f73b8344 1 2023-04-10 19:15:44 +08:00
aozhiwei
385d95c248 1 2023-04-10 18:34:35 +08:00
aozhiwei
ae1ab3b1ee 1 2023-04-10 16:32:09 +08:00
aozhiwei
95d4c99416 修正地图问题 2023-04-10 13:39:57 +08:00
10 changed files with 187 additions and 10 deletions

3
.gitignore vendored
View File

@ -29,4 +29,5 @@ x64
*.settings/
server/gameserver/.gitignore
gameserver.cbp
behaviac_generated
behaviac_generated
node_modules/

View File

@ -28,5 +28,6 @@ void FragMiTask::Done()
center,
explosion_range,
gun_meta->explosion_effect(),
GetAtk());
GetAtk()
);
}

View File

@ -9,6 +9,7 @@
#include "glmhelper.h"
#include "mapinstance.h"
#include "bornpoint.h"
#include "killmgr.h"
#include "movement.h"
#include "mt/Param.h"
@ -253,7 +254,7 @@ void Incubator::AutoAllocAndroid()
{
if (!hold_humans_.empty() && hold_humans_.size() > 6) {
Human* hum = hold_humans_[0];
if (room->GetGasData().GetGasMode() == GasWaiting &&
if (room->GetGasData().GetGasMode() == GasMoving &&
hold_humans_.size() > 1 &&
((rand() % 100) > 70)) {
Human* killer = nullptr;
@ -274,8 +275,10 @@ void Incubator::AutoAllocAndroid()
VP_Gas,
TEXT("battle_server_killer_gas", "毒圈"));
} else {
KillMgr::Instance()->UnSetAutoDie();
return;
}
KillMgr::Instance()->UnSetAutoDie();
hold_humans_.erase(hold_humans_.begin());
room->xtimer.ModifyTime(alloc_timer_, SERVER_FRAME_RATE * (30 + rand() % 5));
}

View File

@ -70,6 +70,9 @@ void KillMgr::UnInit()
void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hint_info)
{
#ifdef DEBUG
std::string dbg_str;
#endif
hint_info.dead_name = dead_hum->GetName();
switch (info->killer_id) {
@ -78,6 +81,14 @@ void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hin
hint_info.killer_name = "";
hint_info.hint_template = mt::Text::GetTextElements
("battle_server_dead_text_gas");
#ifdef DEBUG
dbg_str = a8::Format("死者:%s(%s) 凶手:%s",
{
dead_hum->name,
dead_hum->IsAndroid() ? "机器人" : "玩家",
"毒圈"
});
#endif
}
break;
case VP_Buff:
@ -89,6 +100,14 @@ void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hin
hint_info.hint_template = mt::Text::GetTextElements
("battle_server_dead_text_buff_default");
}
#ifdef DEBUG
dbg_str = a8::Format("死者:%s(%s) 凶手:%s",
{
dead_hum->name,
dead_hum->IsAndroid() ? "机器人" : "玩家",
"buff"
});
#endif
}
break;
case VP_Explosion:
@ -100,6 +119,14 @@ void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hin
hint_info.hint_template = mt::Text::GetTextElements
("battle_server_dead_text_explosion_default");
}
#ifdef DEBUG
dbg_str = a8::Format("死者:%s(%s) 凶手:%s",
{
dead_hum->name,
dead_hum->IsAndroid() ? "机器人" : "玩家",
"炸弹"
});
#endif
}
break;
case VP_Water:
@ -107,6 +134,14 @@ void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hin
hint_info.killer_name = "";
hint_info.hint_template = mt::Text::GetTextElements
("battle_server_dead_text_drown");
#ifdef DEBUG
dbg_str = a8::Format("死者:%s(%s) 凶手:%s",
{
dead_hum->name,
dead_hum->IsAndroid() ? "机器人" : "玩家",
""
});
#endif
}
break;
default:
@ -124,14 +159,38 @@ void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hin
//${dead.name} 自杀
hint_info.hint_template = mt::Text::GetTextElements
("battle_server_dead_text_specate");
#ifdef DEBUG
dbg_str = a8::Format("死者:%s(%s) 凶手:%s(%s)",
{
dead_hum->name,
dead_hum->IsAndroid() ? "机器人" : "玩家",
dead_hum->name,
dead_hum->IsAndroid() ? "机器人" : "玩家"
});
#endif
} else {
//${killer.name} 使用 ${weapon.text_icon} 干掉了 ${dead.name}
hint_info.hint_template = mt::Text::GetTextElements
("battle_server_dead_text_weapon");
#ifdef DEBUG
if (killer->IsCreature(dead_hum->room)) {
dbg_str = a8::Format("死者:%s(%s) 凶手:%s(%s)",
{
dead_hum->name,
dead_hum->IsAndroid() ? "机器人" : "玩家",
((Creature*)killer)->GetName(),
((Creature*)killer)->IsAndroid() ? "机器人" : "玩家"
});
}
#endif
}
} else {
}
}
break;
}
#ifdef DEBUG
dbg_str = a8::Format("是否自动死亡:%d ", {is_auto_die_ ? 1 : 0}) + dbg_str;
dead_hum->room->BroadcastDebugMsg(dbg_str);
#endif
}

View File

@ -45,6 +45,8 @@ class KillMgr : public a8::Singleton<KillMgr>
void Init();
void UnInit();
void OnHumanDead(Human* dead_hum, KillInfo* info);
void SetAutoDie() { is_auto_die_ = true; };
void UnSetAutoDie() { is_auto_die_ = false; };
private:
void FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hint_info);
@ -61,5 +63,8 @@ private:
std::shared_ptr<cs::SMRollMsg> pb_msg);
private:
bool is_auto_die_ = false;
friend class PBUtils;
};

View File

@ -126,7 +126,7 @@ namespace mc
{
node->name
});
childs[node->name] = node;
childs[a8::Format("%s_%d", {node->name, i + 1})] = node;
#else
A8_ABORT();
#endif
@ -155,8 +155,19 @@ namespace mc
dirs.push_back(glm::vec3(-extends.x, -extends.y, -extends.z));
dirs.push_back(glm::vec3(-extends.x, -extends.y, extends.z));
for (const glm::vec3& dir : dirs) {
points.push_back(center + dir);
points.push_back(center + quat * dir);
}
}
std::string ColliderNode::GetPath()
{
std::string path = name;
ColliderNode* node = this;
while (node && node->parent) {
path = node->parent->name + "/" + path;
node = node->parent;
}
return path;
}
}

View File

@ -104,6 +104,7 @@ namespace mc
std::map<std::string, std::shared_ptr<ColliderNode>> childs;
void Read(std::shared_ptr<a8::XObject> xobj);
std::string GetPath();
};
void RotateBounds(const glm::vec3& center,

View File

@ -1125,10 +1125,10 @@ bool MapInstance::SceneRaycast(const glm::vec3& orig,
} while (!end);
if (result) {
#ifdef DEBUG1
#ifdef DEBUG
if (DebugCmd::Enable()) {
a8::XPrintf("nearest_node:%s tri_count:%d nearest_distance:%f\n",
{nearest_node->tri->node->name,
{nearest_node->tri->node->GetPath(),
tri_count,
nearest_distance});
}

View File

@ -88,6 +88,11 @@ bool MapService::CanAdd(const glm::vec3& pos, int rad)
void MapService::AddTriangle(mc::Triangle* tri)
{
#if 0
if (tri->node->name == "water03") {
return;
}
#endif
glm::vec3* verts[3] = {&tri->vert0, &tri->vert1, &tri->vert2};
float min_x = verts[0]->x;
float max_x = verts[0]->x;
@ -112,6 +117,9 @@ void MapService::AddTriangle(mc::Triangle* tri)
max_x += 1.0f;
min_y -= 1.0f;
max_y += 1.0f;
min_x = std::max(min_x, 0.0f);
min_y = std::max(min_y, 0.0f);
}
{
@ -119,22 +127,83 @@ void MapService::AddTriangle(mc::Triangle* tri)
int min_grid_y = floor(min_y / cell_width_);
int max_grid_x = ceil(max_x / cell_width_);
int max_grid_y = ceil(max_y / cell_width_);
#if 1
if (min_grid_x < 0) {
a8::XPrintf("error1 name:%s tri:%f,%f,%f %f,%f,%f\n",
{
tri->node->GetPath(),
tri->vert0.x,
tri->vert0.y,
tri->vert0.z,
tri->vert1.x,
tri->vert1.y,
tri->vert1.z,
tri->vert2.x,
tri->vert2.y,
tri->vert2.z,
}
);
return;
min_grid_x = 0;
}
#endif
if (min_grid_x < 0) {
A8_ABORT();
}
if (max_grid_x >= map_width_) {
#if 1
a8::XPrintf("error4 name:%s tri:%f,%f,%f %f,%f,%f\n",
{
tri->node->GetPath(),
tri->vert0.x,
tri->vert0.y,
tri->vert0.z,
tri->vert1.x,
tri->vert1.y,
tri->vert1.z,
tri->vert2.x,
tri->vert2.y,
tri->vert2.z,
}
);
#endif
return;
A8_ABORT();
max_grid_x = map_width_ - 1;
}
#if 1
if (min_grid_y < 0) {
a8::XPrintf("error2 name:%s tri:%f,%f,%f %f,%f,%f\n",
{
tri->node->GetPath(),
tri->vert0.x,
tri->vert0.y,
tri->vert0.z,
tri->vert1.x,
tri->vert1.y,
tri->vert1.z,
tri->vert2.x,
tri->vert2.y,
tri->vert2.z,
}
);
return;
min_grid_y = 0;
}
#endif
if (min_grid_y < 0) {
A8_ABORT();
//A8_ABORT();
}
if (max_grid_y >= map_height_) {
#if 0
A8_ABORT();
#endif
max_grid_y = map_height_ - 1;
}
float tri_verts[3 * 3];
@ -196,7 +265,7 @@ void MapService::AddTriangle(mc::Triangle* tri)
found = true;
}
}
#if 0
#if 1
if (dtOverlapPolyPoly2D(tri_verts, 3, aabb_verts, 4)) {
int grid_id = x + y * map_width_;
list_head* head = &map_cells_[grid_id];
@ -209,9 +278,28 @@ void MapService::AddTriangle(mc::Triangle* tri)
#endif
}
}
#if 0
#if 1
if (!found) {
a8::XPrintf("error3 name:%s tri:%f,%f,%f %f,%f,%f\n",
{
tri->node->GetPath(),
tri->vert0.x,
tri->vert0.y,
tri->vert0.z,
tri->vert1.x,
tri->vert1.y,
tri->vert1.z,
tri->vert2.x,
tri->vert2.y,
tri->vert2.z,
}
);
#if 0
AddTriangle(tri);
abort();
#endif
}
#endif
}

View File

@ -30,14 +30,22 @@ namespace mt
{
#if 0
std::vector<std::string> files = {
#ifdef DEBUG
"main3d_map.colliders.new.json"
#else
"main3d_map.colliders.json"
#endif
};
for (auto& filename : files) {
auto p = std::make_shared<MapCollider>();
p->Load(filename);
p->LoadTerrain("map4_terrain.bin");
raw_list.push_back(p);
#ifdef DEBUG
name_hash["main3d_map.colliders.json"] = p;
#else
name_hash[filename] = p;
#endif
}
#endif
}