移除无用代码

This commit is contained in:
aozhiwei 2019-09-23 16:00:32 +08:00
parent 7432ceef10
commit aed9564e82
2 changed files with 0 additions and 112 deletions

View File

@ -372,71 +372,6 @@ void Human::RecalcSelfCollider()
}
}
bool Human::IsCollision()
{
if (room->OverBorder(pos, meta->i->radius())){
return true;
}
if (a8::HasBitFlag(status, HS_Jump)) {
return false;
}
std::vector<Entity*> objects;
for (auto& grid : grid_list) {
for (Entity* entity : grid->entity_list) {
switch (entity->entity_type) {
case ET_Obstacle:
{
if (
(last_collision_door == nullptr || last_collision_door != entity) &&
TestCollision(entity)
){
Obstacle* obstacle = (Obstacle*)entity;
if (!obstacle->dead &&
obstacle->meta->i->attack_type() == 1 &&
obstacle->meta->i->drop() != 0 &&
room->gas_data.gas_mode != GasInactive &&
!a8::HasBitFlag(status, HS_Fly) &&
!a8::HasBitFlag(status, HS_Jump)
) {
obstacle->health = 0;
obstacle->dead = obstacle->health <= 0.01f;
obstacle->dead_frameno = room->frame_no;
if (obstacle->dead) {
#if 0
if (obstacle->meta->i->damage_dia() > 0.01f &&
obstacle->meta->i->damage() > 0.01f) {
obstacle->Explosion(this);
}
#endif
room->ScatterDrop(obstacle->pos, obstacle->meta->i->drop());
}
obstacle->BroadcastFullState();
} else {
objects.push_back(entity);
}
}
}
break;
case ET_Building:
{
if (TestCollision(entity)) {
objects.push_back(entity);
}
}
break;
default:
{
}
break;
}
}
}
return !objects.empty();
}
bool Human::IsCollisionInMapService()
{
if (room->OverBorder(pos, meta->i->radius())){
@ -500,51 +435,6 @@ bool Human::IsCollisionInMapService()
return false;
}
void Human::FindPath()
{
a8::Vec2 old_pos = pos;
{
float up_dot = a8::Vec2::UP.Dot(move_dir);
bool at_left_side = a8::Vec2::LEFT.Dot(move_dir) > 0.0001f;
if (std::abs(up_dot) <= 0.001f) { //相互垂直
//向上
pos = old_pos + a8::Vec2::UP;
if (!IsCollision()) {
return;
} else {
//向下
pos = old_pos + a8::Vec2::DOWN;
if (!IsCollision()) {
return;
}
}
} else if (up_dot > 0.001f) { //基本相同
pos = old_pos + (at_left_side ? a8::Vec2::LEFT : a8::Vec2::RIGHT);
if (!IsCollision()) {
return;
} else {
//向上
pos = old_pos + a8::Vec2::UP;
if (!IsCollision()) {
return;
}
}
} else if (up_dot < 0.001f) { //基本相反
pos = old_pos + (at_left_side ? a8::Vec2::LEFT : a8::Vec2::RIGHT);
if (!IsCollision()) {
return;
} else {
//向下
pos = old_pos + a8::Vec2::DOWN;
if (!IsCollision()) {
return;
}
}
}
}
pos = old_pos;
}
void Human::FindPathInMapService()
{
a8::Vec2 old_pos = pos;

View File

@ -142,9 +142,7 @@ class Human : public Entity
void Shot(a8::Vec2& target_dir);
void TankShot(a8::Vec2& target_dir);
void RecalcSelfCollider();
bool IsCollision();
bool IsCollisionInMapService();
void FindPath();
void FindPathInMapService();
float GetRadius();
float GetMaxHP();