This commit is contained in:
aozhiwei 2023-06-16 13:41:44 +08:00
parent cf1a03f5c8
commit 150c578a60
4 changed files with 39 additions and 4 deletions

View File

@ -104,6 +104,9 @@ void Bullet::Update(int delta_time)
void Bullet::OnHit(std::set<Entity*>& objects)
{
if (gun_meta->id() == 60201) {
int i = 0;
}
std::shared_ptr<Ability> old_context_ability = sender.Get()->context_ability;
glm::vec3 old_context_dir = sender.Get()->context_dir;
Position old_context_pos = sender.Get()->context_pos;
@ -500,6 +503,9 @@ float Bullet::GetExplosionRange()
void Bullet::Check(float distance)
{
if (gun_meta->id() == 60201) {
int i = 0;
}
BulletCheckResult result;
result.flyed_distance = distance;
GetHitThings(result);

View File

@ -12,6 +12,7 @@
#include "mt/Map.h"
#include "mt/MapThing.h"
#include "mt/Hero.h"
static const float GUN_HEIGHT = 3.0f;
@ -25,14 +26,14 @@ bool Collision::CheckBullet(IBullet* bullet, Creature* c)
bool ret = a8::IntersectCylinderCylinder
(
bullet_real_pos, bullet_hit_radius * 1.0, GUN_HEIGHT,
c->GetPos().ToGlmVec3(), c->GetHitRadius(), GUN_HEIGHT
c->GetPos().ToGlmVec3(), c->GetHitRadius(), c->GetHeroMeta()->GetHeight()
);
if (!ret) {
bullet_real_pos = bullet->GetPos().ToGlmVec3() - bullet->GetDir() * (bullet->GetHitRadius() - 2);
ret = a8::IntersectCylinderCylinder
(
bullet_real_pos, bullet_hit_radius * 1.0, GUN_HEIGHT,
c->GetPos().ToGlmVec3(), c->GetHitRadius(), GUN_HEIGHT
c->GetPos().ToGlmVec3(), c->GetHitRadius(), c->GetHeroMeta()->GetHeight()
);
}
return ret;

View File

@ -138,6 +138,31 @@ namespace mt
{
LoadHeroAndEquipShotData();
Equip::AdjustMuzzlePos();
Traverse(
[] (const Hero* hero, bool& stop)
{
if (hero->GetHeight() < 0.1) {
if (!(hero->id() == 40001 ||
hero->id() == 40002 ||
hero->id() == 9001 ||
hero->id() == 9002 ||
hero->id() == 9003 ||
hero->id() == 9004 ||
hero->id() == 9005 ||
hero->id() == 9006 ||
hero->id() == 9007 ||
hero->id() == 9008 ||
hero->id() == 9009 ||
hero->id() == 9010 ||
hero->id() == 8001 ||
hero->id() == 8002 ||
hero->id() == 8003 ||
hero->id() == 8004 ||
hero->id() == 8005)) {
abort();
}
}
});
}
const HeroShotAnimation* Hero::GetShotAnimi(int shotfire) const
@ -159,13 +184,14 @@ namespace mt
int hero_id = a8::XValue(key);
std::vector<std::string> keys2;
hero_xobj->GetKeys(keys2);
const mt::Hero* hero_meta = mt::Hero::GetById(hero_id);
#if 1
{
const mt::Hero* hero_meta = Hero::GetById(hero_id);
if (hero_meta) {
mt::Hero* mut_hero_meta = (mt::Hero*)hero_meta;
auto size_xobj = hero_xobj->At("size");
mut_hero_meta->hit_radius_ = size_xobj->At("radius")->AsXValue().GetDouble() * 10;
mut_hero_meta->height_ = size_xobj->At("height")->AsXValue().GetDouble();
}
}
#endif
@ -222,7 +248,6 @@ namespace mt
}
{
const mt::Hero* hero_meta = mt::Hero::GetById(hero_id);
if (hero_meta) {
mt::HeroShotAnimation anim;
anim.id = id;

View File

@ -52,8 +52,11 @@ namespace mt
int RandDrop() const;
const HeroShotAnimation* GetShotAnimi(int shotfire) const;
float GetHeight() const { return height_; }
private:
float height_ = 0.0f;
static void LoadHeroAndEquipShotData();
};