This commit is contained in:
aozhiwei 2023-01-05 15:39:00 +08:00
parent 19899d7fec
commit b0c385312a
3 changed files with 44 additions and 7 deletions

View File

@ -114,7 +114,9 @@ void Android::InternalUpdate(int delta_time)
return;
}
}
#if 0
agent_->Exec();
#endif
}
void Android::GiveEquip()

View File

@ -371,8 +371,28 @@ void Bullet::MapServiceUpdate()
}
}
move_length -= step_len;
auto old_pos = GetPos();
GetMutablePos().AddGlmVec3(dir * step_len);
float distance = GetPos().DistanceGlmVec3(born_pos.ToGlmVec3());
#ifdef DEBUG1
a8::XPrintf("step_len:%f born_pos:%f,%f,%f curr_pos:%f,%f,%f old_pos:%f,%f,%f distance:%f\n",
{
step_len,
born_pos.x,
born_pos.y,
born_pos.z,
old_pos.x,
old_pos.y,
old_pos.z,
GetPos().x,
GetPos().y,
GetPos().z,
distance
});
#endif
if (room->OverBorder(GetPos(), gun_meta->bullet_rad())) {
if (IsBomb()) {
ProcBomb();
@ -633,7 +653,6 @@ void Bullet::ClearBuffList()
void Bullet::ProcFlyHook(Entity* target)
{
return;
ClearBuffList();
float distance = born_pos.Distance2D2(GetPos());
if (distance < 0.001f) {
@ -840,7 +859,9 @@ void Bullet::GetHitCreatures(BulletCheckResult& result)
if (c != sender.Get() && !c->dead &&
Collision::CheckBullet(this, c)) {
#ifdef DEBUG
a8::XPrintf("bullet hit\n", {});
if (IsFlyHook()) {
a8::XPrintf("bullet hit\n", {});
}
#endif
if (meta->_inventory_slot() == IS_C4) {
if (!c->IsHuman()) {
@ -954,7 +975,7 @@ void Bullet::Raycast()
{
raycasted_ = true;
glm::vec3 start = born_pos.ToGlmVec3();
glm::vec3 end = born_pos.AddGlmVec3(born_dir * (float)gun_meta->range()).ToGlmVec3();
glm::vec3 end = born_pos.ToGlmVec3() + born_dir * (float)gun_meta->range();
bool hit_result = false;
glm::vec3 hit_point;
@ -966,8 +987,10 @@ void Bullet::Raycast()
sender.Get()->room->map_instance->UnScale(hit_point);
raycast_hit_point_ = hit_point;
raycast_len_ = GlmHelper::Norm(hit_point - born_pos.ToGlmVec3());
} else {
raycast_len_ = gun_meta->range();
}
#ifdef DEBUG
#ifdef DEBUG1
a8::XPrintf("bullet.raycast ret:%d hit_result:%d raycast_hit_point_:%f,%f,%f\n",
{
ret,

View File

@ -580,7 +580,7 @@ int Room::CreateBullet(Creature* sender,
float shot_animi_time)
{
int bullet_uniid = 0;
if (grid_service->CanAdd(pos.x, pos.y)) {
if (grid_service->CanAdd(pos.x, pos.z)) {
Bullet* bullet = EntityFactory::Instance()->MakeBullet(AllocUniid());
bullet->sender.Attach(sender);
if (passenger) {
@ -601,6 +601,19 @@ int Room::CreateBullet(Creature* sender,
bullet->keep_shot_animi_timer_ptr = keep_shot_animi_timer_ptr;
bullet->shot_animi_time = shot_animi_time;
bullet->Initialize();
#ifdef DEBUG
a8::XPrintf("xxxxxxx born_pos:%f,%f,%f curr_pos:%f,%f,%f\n",
{
bullet->born_pos.x,
bullet->born_pos.y,
bullet->born_pos.z,
bullet->GetPos().x,
bullet->GetPos().y,
bullet->GetPos().z,
});
#endif
AddObjectLater(bullet);
bullet_uniid = bullet->GetUniId();
}
@ -3179,8 +3192,7 @@ size_t Room::GetRoomMaxPlayerNum()
{
#ifdef MAP3D
return 2;
return map_meta_->player();
//return 2;
//return map_meta_->player();
#else
if (pve_instance) {
return pve_human_num;