1
This commit is contained in:
parent
39b4def85c
commit
00a20a41b2
@ -5,7 +5,7 @@ set(GAME_ID 2001)
|
|||||||
|
|
||||||
set(CMAKE_BUILD_TYPE "Debug")
|
set(CMAKE_BUILD_TYPE "Debug")
|
||||||
set(CMAKE_BUILD_TYPE "Release")
|
set(CMAKE_BUILD_TYPE "Release")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
|
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
@ -1476,21 +1476,11 @@ void Room::NotifyWxVoip()
|
|||||||
&xtimer_attacher.timer_list_);
|
&xtimer_attacher.timer_list_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Room::CreateBornPoint(int x, int y, int width, int height, int hum_limit)
|
|
||||||
{
|
|
||||||
BornPoint born_point;
|
|
||||||
born_point.born_point_id = AllocUniid();
|
|
||||||
born_point.pos = a8::Vec2(x, y);
|
|
||||||
born_point.rad = std::min(width, height);
|
|
||||||
born_point.hum_limit = hum_limit;
|
|
||||||
born_point_hash_[born_point.born_point_id] = born_point;
|
|
||||||
}
|
|
||||||
|
|
||||||
BornPoint* Room::AllocBornPoint(Human* hum)
|
BornPoint* Room::AllocBornPoint(Human* hum)
|
||||||
{
|
{
|
||||||
BornPoint* born_point = nullptr;
|
BornPoint* born_point = nullptr;
|
||||||
for (auto& pair : born_point_hash_) {
|
for (auto& pair : born_point_hash_) {
|
||||||
if (pair.second.player_num + pair.second.android_num < pair.second.hum_limit) {
|
if (pair.second.player_num + pair.second.android_num < pair.second.thing_tpl->i->param1()) {
|
||||||
born_point = &pair.second;
|
born_point = &pair.second;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1555,10 +1545,7 @@ void Room::CreateMapObject(MetaData::MapTplThing& thing_tpl)
|
|||||||
|
|
||||||
void Room::CreateMapSpawnPoint(MetaData::MapTplThing& thing_tpl)
|
void Room::CreateMapSpawnPoint(MetaData::MapTplThing& thing_tpl)
|
||||||
{
|
{
|
||||||
CreateBornPoint(thing_tpl.i->x(),
|
BornPoint born_point;
|
||||||
thing_tpl.i->y(),
|
born_point.thing_tpl = &thing_tpl;
|
||||||
thing_tpl.i->width(),
|
born_point_hash_[AllocUniid()] = born_point;
|
||||||
thing_tpl.i->height(),
|
|
||||||
thing_tpl.i->param1()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,6 @@ private:
|
|||||||
void OnGameOver();
|
void OnGameOver();
|
||||||
void RandRemoveAndroid();
|
void RandRemoveAndroid();
|
||||||
void NotifyWxVoip();
|
void NotifyWxVoip();
|
||||||
void CreateBornPoint(int x, int y, int width, int height, int hum_limit);
|
|
||||||
BornPoint* AllocBornPoint(Human* hum);
|
BornPoint* AllocBornPoint(Human* hum);
|
||||||
void CreateMapObject(MetaData::MapTplThing& thing_tpl);
|
void CreateMapObject(MetaData::MapTplThing& thing_tpl);
|
||||||
void CreateMapSpawnPoint(MetaData::MapTplThing& thing_tpl);
|
void CreateMapSpawnPoint(MetaData::MapTplThing& thing_tpl);
|
||||||
|
@ -33,13 +33,21 @@ void Skin::ToPB(cs::MFSkin* pb_obj)
|
|||||||
|
|
||||||
a8::Vec2 BornPoint::RandPoint() const
|
a8::Vec2 BornPoint::RandPoint() const
|
||||||
{
|
{
|
||||||
a8::Vec2 born_point = pos;
|
a8::Vec2 born_point = a8::Vec2(thing_tpl->i->x(), thing_tpl->i->y());
|
||||||
a8::Vec2 dir = born_point;
|
MetaData::Player* hum_meta = MetaMgr::Instance()->GetPlayer(40002);
|
||||||
dir.Normalize();
|
if (hum_meta) {
|
||||||
dir.Rotate(a8::RandAngle());
|
born_point.x -= thing_tpl->i->width() / 2;
|
||||||
if (rad < 2) {
|
born_point.y -= thing_tpl->i->height() / 2;
|
||||||
return born_point;
|
born_point.x += hum_meta->i->radius() / 2;
|
||||||
} else {
|
born_point.y += hum_meta->i->radius() / 2;
|
||||||
return born_point + dir * (rand() % (int)rad);
|
int rand_x = thing_tpl->i->width() - hum_meta->i->radius();
|
||||||
|
int rand_y = thing_tpl->i->height() - hum_meta->i->radius();
|
||||||
|
if (rand_x > 0) {
|
||||||
|
born_point.x += rand() % rand_x;
|
||||||
|
}
|
||||||
|
if (rand_y > 0) {
|
||||||
|
born_point.y += rand() % rand_y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return born_point;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ namespace MetaData
|
|||||||
struct SafeArea;
|
struct SafeArea;
|
||||||
struct Equip;
|
struct Equip;
|
||||||
struct EquipUpgrade;
|
struct EquipUpgrade;
|
||||||
|
struct MapTplThing;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace cs
|
namespace cs
|
||||||
@ -121,13 +122,9 @@ struct CarObject
|
|||||||
|
|
||||||
struct BornPoint
|
struct BornPoint
|
||||||
{
|
{
|
||||||
int born_point_id = 0;
|
MetaData::MapTplThing* thing_tpl = nullptr;
|
||||||
a8::Vec2 pos;
|
|
||||||
float rad = 0.0f;
|
|
||||||
|
|
||||||
int player_num = 0;
|
int player_num = 0;
|
||||||
int android_num = 0;
|
int android_num = 0;
|
||||||
|
|
||||||
int hum_limit = 0;
|
|
||||||
a8::Vec2 RandPoint() const;
|
a8::Vec2 RandPoint() const;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user