202 lines
6.8 KiB
C++
202 lines
6.8 KiB
C++
#include "precompile.h"
|
|
|
|
#include "config.h"
|
|
|
|
#include "f8/utils.h"
|
|
#include "metamgr.h"
|
|
|
|
#define METAMGR_READ(field_name, def_val) Config::Instance()->field_name = \
|
|
a8::XValue(Config::Instance()->GetStringParam(#field_name, #def_val));
|
|
|
|
#define METAMGR_READ_STR(field_name, def_val) Config::Instance()->field_name = \
|
|
a8::XValue(Config::Instance()->GetStringParam(#field_name, def_val)).GetString();
|
|
|
|
void Config::Init()
|
|
{
|
|
f8::ReadCsvMetaFile(MetaMgr::Instance()->GetResDir() + "parameter@parameter.csv",
|
|
parameter_meta_list);
|
|
{
|
|
for (auto& meta : parameter_meta_list) {
|
|
MetaData::Parameter& item = a8::FastAppend(parameter_list);
|
|
item.pb = &meta;
|
|
item.Init();
|
|
parameter_hash[item.pb->param_name()] = &item;
|
|
}
|
|
}
|
|
|
|
{
|
|
gas_inactive_time = GetIntParam("gas_inactive_time");
|
|
|
|
downed_relive_recover_hp = GetIntParam("downed_relive_recover_hp");
|
|
|
|
kill_param = GetFloatParam("kill_parameter");
|
|
rank_param = GetFloatParam("rank_parameter");
|
|
fighting_mode = GetIntParam("fighting_mode", 1);
|
|
max_oil = GetIntParam("max_oil");
|
|
max_mount_horse_distance = GetFloatParam("max_mount_horse_distance", 100);
|
|
map_cell_width = GetIntParam("map_cell_width", 64 * 8);
|
|
#ifdef DEBUG
|
|
map_cell_width = 512;
|
|
#endif
|
|
bullet_planck_step_length = std::max(15, GetIntParam("bullet_planck_step_length", 15));
|
|
match_team_time = GetIntParam("match_team_time", 0);
|
|
match_robot_time = GetIntParam("match_robot_time", 0);
|
|
match_choose_time = GetIntParam("match_choose_time", 0);
|
|
match_lock_time = GetIntParam("match_lock_time", 0);
|
|
#if 1
|
|
match_lock_time++;
|
|
#endif
|
|
#ifdef DEBUG
|
|
match_team_time = 6;
|
|
match_robot_time = 5;
|
|
match_choose_time = 25;
|
|
match_lock_time = 3;
|
|
#endif
|
|
{
|
|
|
|
METAMGR_READ(level0room_shua_robot_min_time, 5);
|
|
METAMGR_READ(level0room_shua_robot_max_time, 7);
|
|
METAMGR_READ(level0room_shua_robot_min_num, 1);
|
|
METAMGR_READ(level0room_shua_robot_max_num, 3);
|
|
METAMGR_READ(level0room_die_robot_min_time, 10);
|
|
METAMGR_READ(level0room_die_robot_max_time, 20);
|
|
METAMGR_READ(level0room_die_robot_min_num, 1);
|
|
METAMGR_READ(level0room_die_robot_max_num, 3);
|
|
METAMGR_READ(level0room_robot_water, 3);
|
|
METAMGR_READ(level0room_robot_protect_time, 60);
|
|
METAMGR_READ(level0room_robot_autodie_time, 10);
|
|
METAMGR_READ(level0room_robot_autodie_distance, 500);
|
|
METAMGR_READ(water_move_coefficient, 0.75);
|
|
METAMGR_READ(teammate_kill_color, 0xFFFF00);
|
|
METAMGR_READ(teammate_bekill_color, 0x00FF00);
|
|
METAMGR_READ(self_kill_color, 0xFFFF00);
|
|
METAMGR_READ(self_bekill_color, 0x00FF00);
|
|
|
|
METAMGR_READ(view_objects_out_distance, 530);
|
|
METAMGR_READ(view_objects_in_distance, 530);
|
|
|
|
METAMGR_READ(incubator_base_length, 501);
|
|
METAMGR_READ(incubator_rand_length, 10);
|
|
METAMGR_READ(incubator_canset_distance, 520);
|
|
|
|
METAMGR_READ(prebattle_can_use_skill, 1);
|
|
METAMGR_READ(watchable, 1);
|
|
METAMGR_READ(prebattle_combine_team, 1);
|
|
|
|
METAMGR_READ(refresh_view_time, 4);
|
|
|
|
METAMGR_READ(level1room_shua_robot_min_time, 5);
|
|
METAMGR_READ(level1room_shua_robot_max_time, 7);
|
|
METAMGR_READ(level1room_shua_robot_min_num, 2);
|
|
METAMGR_READ(level1room_shua_robot_max_num, 5);
|
|
METAMGR_READ(level1room_die_robot_min_time, 10);
|
|
METAMGR_READ(level1room_die_robot_max_time, 14);
|
|
METAMGR_READ(level1room_die_robot_min_num, 1);
|
|
METAMGR_READ(level1room_die_robot_max_num, 3);
|
|
METAMGR_READ(level1room_robot_water, 8);
|
|
METAMGR_READ(level1room_robot_autodie_time, 10);
|
|
METAMGR_READ(level1room_robot_autodie_distance, 500);
|
|
METAMGR_READ_STR(level1room_born_point, "");
|
|
|
|
METAMGR_READ(dive_oxygen_total, 200);
|
|
METAMGR_READ(dive_oxygen_consume, 20);
|
|
METAMGR_READ(dive_hp_consume, 20);
|
|
METAMGR_READ(dive_explosion_dmg_switch, 0);
|
|
METAMGR_READ(inwater_oxygen_recover, 20);
|
|
}
|
|
|
|
}
|
|
{
|
|
human_meta = MetaMgr::Instance()->GetPlayer(40001);
|
|
if (!human_meta) {
|
|
A8_ABORT();
|
|
}
|
|
android_meta = MetaMgr::Instance()->GetPlayer(40002);
|
|
if (!android_meta) {
|
|
A8_ABORT();
|
|
}
|
|
}
|
|
{
|
|
{
|
|
if (level0room_shua_robot_min_time >
|
|
level0room_shua_robot_max_time) {
|
|
A8_ABORT();
|
|
}
|
|
if (level0room_shua_robot_min_num >
|
|
level0room_shua_robot_max_num) {
|
|
A8_ABORT();
|
|
}
|
|
if (level0room_die_robot_min_time >
|
|
level0room_die_robot_max_time) {
|
|
A8_ABORT();
|
|
}
|
|
if (level0room_die_robot_min_num >
|
|
level0room_die_robot_max_num) {
|
|
A8_ABORT();
|
|
}
|
|
}
|
|
|
|
{
|
|
if (level1room_shua_robot_min_time >
|
|
level1room_shua_robot_max_time) {
|
|
A8_ABORT();
|
|
}
|
|
if (level1room_shua_robot_min_num >
|
|
level1room_shua_robot_max_num) {
|
|
A8_ABORT();
|
|
}
|
|
if (level1room_die_robot_min_time >
|
|
level1room_die_robot_max_time) {
|
|
A8_ABORT();
|
|
}
|
|
if (level1room_die_robot_min_num >
|
|
level1room_die_robot_max_num) {
|
|
A8_ABORT();
|
|
}
|
|
}
|
|
|
|
if (match_team_time <= 0) {
|
|
A8_ABORT();
|
|
}
|
|
if (match_robot_time <= 0) {
|
|
A8_ABORT();
|
|
}
|
|
if (match_robot_time >= match_team_time) {
|
|
A8_ABORT();
|
|
}
|
|
if (match_choose_time <= 0) {
|
|
A8_ABORT();
|
|
}
|
|
if (match_lock_time <= 0) {
|
|
A8_ABORT();
|
|
}
|
|
if (match_lock_time >= match_choose_time) {
|
|
A8_ABORT();
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
void Config::UnInit()
|
|
{
|
|
|
|
}
|
|
|
|
int Config::GetIntParam(const std::string& param_name, int def_val)
|
|
{
|
|
auto itr = parameter_hash.find(param_name);
|
|
return itr != parameter_hash.end() ? itr->second->int_val: def_val;
|
|
}
|
|
|
|
double Config::GetFloatParam(const std::string& param_name, double def_val)
|
|
{
|
|
auto itr = parameter_hash.find(param_name);
|
|
return itr != parameter_hash.end() ? itr->second->float_val: def_val;
|
|
}
|
|
|
|
std::string Config::GetStringParam(const std::string& param_name, const char* def_val)
|
|
{
|
|
auto itr = parameter_hash.find(param_name);
|
|
return itr != parameter_hash.end() ? itr->second->str_val: def_val;
|
|
}
|