1
This commit is contained in:
parent
70e89667b0
commit
e7f0395e79
@ -19,7 +19,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DNDEBUG -DNEWGS")
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DNDEBUG -DNEWGS")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DDEBUG -fsanitize=address -fno-omit-frame-pointer -DNEWGS -DPVE")
|
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DDEBUG -DNEWGS -DPVE")
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
AFTER
|
AFTER
|
||||||
|
@ -324,7 +324,7 @@ int Incubator::GetPveLeftTime()
|
|||||||
room->pve_data.wave < 0) {
|
room->pve_data.wave < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
xtimer_list* timer = wave_timers_[room->pve_data.wave - 1];
|
xtimer_list* timer = wave_timers_[room->pve_data.wave];
|
||||||
int remain_time = room->xtimer.GetRemainTime(timer);
|
int remain_time = room->xtimer.GetRemainTime(timer);
|
||||||
return remain_time * FRAME_RATE_MS;
|
return remain_time * FRAME_RATE_MS;
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,16 @@ void MapInstance::CreateThings()
|
|||||||
if (!MetaMgr::Instance()->GetHeroAI(hero_meta->i->ai())) {
|
if (!MetaMgr::Instance()->GetHeroAI(hero_meta->i->ai())) {
|
||||||
A8_ABORT();
|
A8_ABORT();
|
||||||
}
|
}
|
||||||
|
if (map_id > 1001) {
|
||||||
|
auto itr = spawn_name_hash_.find(thing_tpl.i->name());
|
||||||
|
if (itr != spawn_name_hash_.end()) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
a8::Vec2 point;
|
||||||
|
point.x = thing_tpl.i->x();
|
||||||
|
point.y = thing_tpl.i->y();
|
||||||
|
spawn_name_hash_[thing_tpl.i->name()] = point;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -491,3 +501,9 @@ MapBlock* MapInstance::InternalCreateMapBlock(int id, float x, float y,
|
|||||||
p->permanent_map_service = map_service_;
|
p->permanent_map_service = map_service_;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a8::Vec2* MapInstance::GetSpawnPoint(const std::string& name)
|
||||||
|
{
|
||||||
|
auto itr = spawn_name_hash_.find(name);
|
||||||
|
return itr != spawn_name_hash_.end() ? &itr->second : nullptr;
|
||||||
|
}
|
||||||
|
@ -30,6 +30,8 @@ class MapInstance
|
|||||||
void AttachRoom(Room* room, RoomInitInfo& init_info);
|
void AttachRoom(Room* room, RoomInitInfo& init_info);
|
||||||
MetaData::Map* GetMapMeta() { return map_meta_; }
|
MetaData::Map* GetMapMeta() { return map_meta_; }
|
||||||
Entity* GetEntityByUniId(int uniid);
|
Entity* GetEntityByUniId(int uniid);
|
||||||
|
a8::Vec2* GetSpawnPoint(const std::string& name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateThings();
|
void CreateThings();
|
||||||
void CreateTerrain();
|
void CreateTerrain();
|
||||||
@ -63,6 +65,7 @@ class MapInstance
|
|||||||
std::vector<Building*> buildings_;
|
std::vector<Building*> buildings_;
|
||||||
std::vector<MetaData::MapTplThing*> level0room_spec_things_;
|
std::vector<MetaData::MapTplThing*> level0room_spec_things_;
|
||||||
std::list<metatable::MapBlockJson> terrain_blocks_;
|
std::list<metatable::MapBlockJson> terrain_blocks_;
|
||||||
|
std::map<std::string, a8::Vec2> spawn_name_hash_;
|
||||||
|
|
||||||
int building_num_ = 0;
|
int building_num_ = 0;
|
||||||
int obstacle_num_ = 0;
|
int obstacle_num_ = 0;
|
||||||
|
@ -36,6 +36,7 @@ void MapMgr::Init()
|
|||||||
if (mode_hash_.find(kChiJiMode) == mode_hash_.end()) {
|
if (mode_hash_.find(kChiJiMode) == mode_hash_.end()) {
|
||||||
A8_ABORT();
|
A8_ABORT();
|
||||||
}
|
}
|
||||||
|
MetaMgr::Instance()->CheckMapSpawnPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapMgr::UnInit()
|
void MapMgr::UnInit()
|
||||||
|
@ -1659,16 +1659,6 @@ namespace MetaData
|
|||||||
|
|
||||||
void PveGeminiContent::Init()
|
void PveGeminiContent::Init()
|
||||||
{
|
{
|
||||||
{
|
|
||||||
std::vector<std::string> strings;
|
|
||||||
a8::Split(pb->spawn_point(), strings, ':');
|
|
||||||
if (strings.size() != 2) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
spawn_point = a8::Vec2(a8::XValue(strings[0]).GetDouble(),
|
|
||||||
a8::XValue(strings[1]).GetDouble());
|
|
||||||
spawn_point.y = 7680 - spawn_point.y;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PveGeminiMode::Init()
|
void PveGeminiMode::Init()
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
#include "metamgr.h"
|
#include "metamgr.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "jsondatamgr.h"
|
#include "jsondatamgr.h"
|
||||||
|
#include "mapmgr.h"
|
||||||
|
#include "mapinstance.h"
|
||||||
|
|
||||||
#define METAMGR_READ(field_name, def_val) MetaMgr::Instance()->field_name = \
|
#define METAMGR_READ(field_name, def_val) MetaMgr::Instance()->field_name = \
|
||||||
a8::XValue(MetaMgr::Instance()->GetSysParamAsString(#field_name, #def_val));
|
a8::XValue(MetaMgr::Instance()->GetSysParamAsString(#field_name, #def_val));
|
||||||
@ -1344,3 +1346,28 @@ MetaData::PveGeminiMode* MetaMgr::GetPveGeminiMode(int mode_id)
|
|||||||
auto itr = loader_->pve_gemini_mode_hash.find(mode_id);
|
auto itr = loader_->pve_gemini_mode_hash.find(mode_id);
|
||||||
return itr != loader_->pve_gemini_mode_hash.end() ? &itr->second : nullptr;
|
return itr != loader_->pve_gemini_mode_hash.end() ? &itr->second : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MetaMgr::CheckMapSpawnPoint()
|
||||||
|
{
|
||||||
|
for (int i = kDestoryMode; i <= kSurvivalMode; ++i) {
|
||||||
|
MetaData::PveGeminiMode* mode_meta = GetPveGeminiMode(i);
|
||||||
|
if (!mode_meta) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
auto contents = GetPveGeminiContents(i);
|
||||||
|
if (!contents) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
MapInstance* map_instance = MapMgr::Instance()->GetMapInstance(mode_meta->pb->map_id());
|
||||||
|
if (!map_instance) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
for (auto& content : *contents) {
|
||||||
|
a8::Vec2* p = map_instance->GetSpawnPoint(content.pb->spawn_point());
|
||||||
|
if (!p) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
content.spawn_point = *p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -73,6 +73,8 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
|||||||
bool HasText(const std::string& textid);
|
bool HasText(const std::string& textid);
|
||||||
std::vector<std::tuple<int, std::string>>* GetTextElements(const std::string& textid);
|
std::vector<std::tuple<int, std::string>>* GetTextElements(const std::string& textid);
|
||||||
|
|
||||||
|
void CheckMapSpawnPoint();
|
||||||
|
|
||||||
int gas_inactive_time = 10;
|
int gas_inactive_time = 10;
|
||||||
int newbie_gas_inactive_time = 5;
|
int newbie_gas_inactive_time = 5;
|
||||||
int midbrid_gas_inactive_time = 15;
|
int midbrid_gas_inactive_time = 15;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user