1
This commit is contained in:
parent
2f92392b50
commit
1c0de58eb8
@ -2,10 +2,10 @@
|
||||
|
||||
struct GasData
|
||||
{
|
||||
a8::Vec2 pos_old;
|
||||
a8::Vec2 pos_old_bk;
|
||||
a8::Vec2 pre_pos_old;
|
||||
a8::Vec2 pos_new;
|
||||
glm::vec2 pos_old;
|
||||
glm::vec2 pos_old_bk;
|
||||
glm::vec2 pre_pos_old;
|
||||
glm::vec2 pos_new;
|
||||
float rad_old = 0.0f;
|
||||
float rad_new = 0.0f;
|
||||
float gas_progress = 0.0f;
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
#include <random>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
#include <a8/mutable_xobject.h>
|
||||
#include <a8/collision.h>
|
||||
#include <a8/vec2.h>
|
||||
@ -1148,16 +1151,18 @@ void Room::UpdateGas()
|
||||
a8::HasBitFlag(c->status, CS_Disable)) {
|
||||
continue;
|
||||
}
|
||||
bool b1 = a8::CircleContainCircle(gas_data_.pos_old,
|
||||
gas_data_.gas_progress,
|
||||
c->GetPos().ToVec2(),
|
||||
c->GetRadius()
|
||||
);
|
||||
bool b2 = a8::CircleContainCircle(gas_data_.pos_new,
|
||||
gas_data_.rad_new,
|
||||
c->GetPos().ToVec2(),
|
||||
c->GetRadius()
|
||||
);
|
||||
bool b1 = a8::CircleContainCircle
|
||||
(gas_data_.pos_old,
|
||||
gas_data_.gas_progress,
|
||||
glm::vec2(c->GetPos().GetX(), c->GetPos().GetZ()),
|
||||
c->GetRadius()
|
||||
);
|
||||
bool b2 = a8::CircleContainCircle
|
||||
(gas_data_.pos_new,
|
||||
gas_data_.rad_new,
|
||||
glm::vec2(c->GetPos().GetX(), c->GetPos().GetZ()),
|
||||
c->GetRadius()
|
||||
);
|
||||
if (!b1 && !b2) {
|
||||
c->poisoning = true;
|
||||
if (!c->GetBuffByEffectId(kBET_Poisoning)) {
|
||||
@ -1231,7 +1236,8 @@ void Room::UpdateGasInactivePve()
|
||||
gas_data_.old_area_meta = first_safearea;
|
||||
gas_data_.new_area_meta = pve_mode_meta->_area[0];
|
||||
gas_data_.gas_start_frameno = GetFrameNo();
|
||||
gas_data_.pos_new = a8::Vec2(gas_data_.new_area_meta->x1(), gas_data_.new_area_meta->y1());
|
||||
gas_data_.pos_new = glm::vec2(gas_data_.new_area_meta->x1(),
|
||||
gas_data_.new_area_meta->y1());
|
||||
gas_data_.pos_old = gas_data_.pos_new;
|
||||
gas_data_.pos_old_bk = gas_data_.pos_old;
|
||||
gas_data_.rad_old = gas_data_.old_area_meta->rad();
|
||||
@ -1267,13 +1273,13 @@ void Room::UpdateGasMoving()
|
||||
((GetFrameNo() - gas_data_.gas_start_frameno) * (1.0 / SERVER_FRAME_RATE));
|
||||
gas_data_.gas_progress = std::max(gas_data_.rad_old - distance, gas_data_.rad_new);
|
||||
if (!(gas_data_.pos_new == gas_data_.pos_old)) {
|
||||
a8::Vec2 p1 = gas_data_.pos_new - gas_data_.pos_old_bk;
|
||||
glm::vec2 p1 = gas_data_.pos_new - gas_data_.pos_old_bk;
|
||||
gas_data_.pre_pos_old = gas_data_.pos_old;
|
||||
if (p1.Norm() - distance <= 0.01f) {
|
||||
if (glm::length(p1) - distance <= 0.01f) {
|
||||
gas_data_.pos_old = gas_data_.pos_new;
|
||||
} else {
|
||||
a8::Vec2 dir = p1;
|
||||
dir.Normalize();
|
||||
glm::vec2 dir = p1;
|
||||
dir = glm::normalize(dir);
|
||||
gas_data_.pos_old = gas_data_.pos_old_bk + dir * distance;
|
||||
}
|
||||
if (gas_data_.rad_old - distance <= gas_data_.rad_new) {
|
||||
@ -1339,17 +1345,18 @@ void Room::UpdateGasJump()
|
||||
gas_data_.gas_progress = gas_data_.old_area_meta->rad();
|
||||
gas_data_.gas_start_frameno = GetFrameNo();
|
||||
#if 1
|
||||
gas_data_.pos_old = a8::Vec2(first_safearea->x1(), first_safearea->y1());
|
||||
gas_data_.pos_old = glm::vec2(first_safearea->x1(),
|
||||
first_safearea->y1());
|
||||
#else
|
||||
gas_data_.pos_old = map_meta_->first_safearea_center;
|
||||
#endif
|
||||
gas_data_.pos_old_bk = gas_data_.pos_old;
|
||||
{
|
||||
if (gas_data_.pos_list && !gas_data_.pos_list->_poses.empty()) {
|
||||
gas_data_.pos_old = a8::Vec2(
|
||||
gas_data_.pos_list->_poses[0].x,
|
||||
gas_data_.pos_list->_poses[0].z
|
||||
);
|
||||
gas_data_.pos_old = glm::vec2(
|
||||
gas_data_.pos_list->_poses[0].x,
|
||||
gas_data_.pos_list->_poses[0].z
|
||||
);
|
||||
gas_data_.pos_old_bk = gas_data_.pos_old;
|
||||
}
|
||||
bool gen_ok = GenSmallCircle();
|
||||
@ -1379,14 +1386,14 @@ bool Room::GenSmallCircle()
|
||||
}
|
||||
if (gas_data_.pos_list && gas_data_.gas_count + 1 < gas_data_.pos_list->_poses.size()) {
|
||||
gas_data_.pos_new =
|
||||
a8::Vec2(
|
||||
gas_data_.pos_list->_poses[gas_data_.gas_count + 1].x,
|
||||
gas_data_.pos_list->_poses[gas_data_.gas_count + 1].z
|
||||
);
|
||||
glm::vec2(
|
||||
gas_data_.pos_list->_poses[gas_data_.gas_count + 1].x,
|
||||
gas_data_.pos_list->_poses[gas_data_.gas_count + 1].z
|
||||
);
|
||||
} else {
|
||||
#if 1
|
||||
gas_data_.pos_new = a8::Vec2(gas_data_.new_area_meta->x1(),
|
||||
gas_data_.new_area_meta->y1());
|
||||
gas_data_.pos_new = glm::vec2(gas_data_.new_area_meta->x1(),
|
||||
gas_data_.new_area_meta->y1());
|
||||
#else
|
||||
a8::Vec2 dir = a8::Vec2::UP;
|
||||
dir.Rotate(a8::RandAngle());
|
||||
@ -3218,7 +3225,7 @@ void Room::ForwardGasRing(int n)
|
||||
return;
|
||||
}
|
||||
gas_data_.SetGasMode(GasWaiting);
|
||||
a8::Vec2 pre_pos = gas_data_.pos_new;
|
||||
glm::vec2 pre_pos = gas_data_.pos_new;
|
||||
gas_data_.old_area_meta = mt::SafeArea::GetById(pre_area_id);
|
||||
gas_data_.new_area_meta = mt::SafeArea::GetById(pre_area_id + 1);
|
||||
gas_data_.gas_progress = gas_data_.old_area_meta->rad();
|
||||
@ -3346,10 +3353,10 @@ void Room::AirRaid(int airraid_id)
|
||||
if (!raid_meta) {
|
||||
return;
|
||||
}
|
||||
a8::Vec2 dir = a8::Vec2::UP;
|
||||
dir.Rotate(a8::RandAngle());
|
||||
glm::vec3 dir = GlmHelper::UP;
|
||||
GlmHelper::RotateY(dir, a8::RandAngle());
|
||||
float rnd_rad = gas_data_.new_area_meta->rad() > 0 ? rand() % gas_data_.new_area_meta->rad() : 0;
|
||||
a8::Vec2 v2_center= gas_data_.pos_new + dir * (100 + rnd_rad);
|
||||
glm::vec2 v2_center= gas_data_.pos_new + glm::vec2(dir.x, dir.z) * (100.f + rnd_rad);
|
||||
glm::vec3 center = glm::vec3(v2_center.x, 0.0f, v2_center.y);
|
||||
{
|
||||
std::vector<Player*> humans;
|
||||
@ -3621,7 +3628,8 @@ void Room::OnEnterNewWave(int wave)
|
||||
gas_data_.old_area_meta = pve_mode_meta->_area[wave];
|
||||
gas_data_.new_area_meta = pve_mode_meta->_area[wave];
|
||||
gas_data_.gas_start_frameno = GetFrameNo();
|
||||
gas_data_.pos_new = a8::Vec2(gas_data_.new_area_meta->x1(), gas_data_.new_area_meta->y1());
|
||||
gas_data_.pos_new = glm::vec2(gas_data_.new_area_meta->x1(),
|
||||
gas_data_.new_area_meta->y1());
|
||||
gas_data_.pos_old = gas_data_.pos_new;
|
||||
gas_data_.pos_old_bk = gas_data_.pos_old;
|
||||
gas_data_.rad_old = gas_data_.old_area_meta->rad();
|
||||
|
2
third_party/a8
vendored
2
third_party/a8
vendored
@ -1 +1 @@
|
||||
Subproject commit e908a1e8e9e01fe78a66e5e704fdb2d38fe28727
|
||||
Subproject commit ff1eedc0cb3e90edefa8acedaf9bbeaf4f655f8d
|
Loading…
x
Reference in New Issue
Block a user