1
This commit is contained in:
parent
7db4770845
commit
809a14a28e
@ -5,12 +5,186 @@
|
|||||||
IMPL_TABLE(mt::Param)
|
IMPL_TABLE(mt::Param)
|
||||||
mt::Param::S mt::Param::s_;
|
mt::Param::S mt::Param::s_;
|
||||||
|
|
||||||
|
#define METAMGR_READ(field_name, def_val) s_.field_name = \
|
||||||
|
a8::XValue(GetStringParam(#field_name, #def_val));
|
||||||
|
|
||||||
|
#define METAMGR_READ_STR(field_name, def_val) s_.field_name = \
|
||||||
|
a8::XValue(GetStringParam(#field_name, def_val)).GetString();
|
||||||
|
|
||||||
namespace mt
|
namespace mt
|
||||||
{
|
{
|
||||||
|
|
||||||
void Param::StaticPostInit()
|
void Param::StaticPostInit()
|
||||||
{
|
{
|
||||||
s_.gas_inactive_time = 100;
|
{
|
||||||
|
s_.gas_inactive_time = GetIntParam("gas_inactive_time");
|
||||||
|
|
||||||
|
s_.downed_relive_recover_hp = GetIntParam("downed_relive_recover_hp");
|
||||||
|
|
||||||
|
s_.kill_param = GetFloatParam("kill_parameter");
|
||||||
|
s_.rank_param = GetFloatParam("rank_parameter");
|
||||||
|
s_.fighting_mode = GetIntParam("fighting_mode", 1);
|
||||||
|
s_.max_oil = GetIntParam("max_oil");
|
||||||
|
s_.max_mount_horse_distance = GetFloatParam("max_mount_horse_distance", 100);
|
||||||
|
s_.map_cell_width = GetIntParam("map_cell_width", 64 * 8);
|
||||||
|
#ifdef DEBUG
|
||||||
|
s_.map_cell_width = 512;
|
||||||
|
#endif
|
||||||
|
s_.bullet_planck_step_length = std::max(15, GetIntParam("bullet_planck_step_length", 15));
|
||||||
|
s_.match_team_time = GetIntParam("match_team_time", 0);
|
||||||
|
s_.match_robot_time = GetIntParam("match_robot_time", 0);
|
||||||
|
s_.match_choose_time = GetIntParam("match_choose_time", 0);
|
||||||
|
s_.match_lock_time = GetIntParam("match_lock_time", 0);
|
||||||
|
#if 1
|
||||||
|
s_.match_lock_time++;
|
||||||
|
#endif
|
||||||
|
#ifdef DEBUG
|
||||||
|
s_.match_team_time = 6;
|
||||||
|
s_.match_robot_time = 5;
|
||||||
|
s_.match_choose_time = 25;
|
||||||
|
s_.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);
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
human_meta = MetaMgr::Instance()->GetPlayer(40001);
|
||||||
|
if (!human_meta) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
android_meta = MetaMgr::Instance()->GetPlayer(40002);
|
||||||
|
if (!android_meta) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
{
|
||||||
|
if (s_.level0room_shua_robot_min_time >
|
||||||
|
s_.level0room_shua_robot_max_time) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
if (s_.level0room_shua_robot_min_num >
|
||||||
|
s_.level0room_shua_robot_max_num) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
if (s_.level0room_die_robot_min_time >
|
||||||
|
s_.level0room_die_robot_max_time) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
if (s_.level0room_die_robot_min_num >
|
||||||
|
s_.level0room_die_robot_max_num) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
if (s_.level1room_shua_robot_min_time >
|
||||||
|
s_.level1room_shua_robot_max_time) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
if (s_.level1room_shua_robot_min_num >
|
||||||
|
s_.level1room_shua_robot_max_num) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
if (s_.level1room_die_robot_min_time >
|
||||||
|
s_.level1room_die_robot_max_time) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
if (s_.level1room_die_robot_min_num >
|
||||||
|
s_.level1room_die_robot_max_num) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s_.match_team_time <= 0) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
if (s_.match_robot_time <= 0) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
if (s_.match_robot_time >= s_.match_team_time) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
if (s_.match_choose_time <= 0) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
if (s_.match_lock_time <= 0) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
if (s_.match_lock_time >= s_.match_choose_time) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Param::GetIntParam(const std::string& param_name, int def_val)
|
||||||
|
{
|
||||||
|
auto p = GetByName(param_name);
|
||||||
|
return p ? a8::XValue(p->get_param_value()).GetInt() : def_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Param::GetFloatParam(const std::string& param_name, double def_val)
|
||||||
|
{
|
||||||
|
auto p = GetByName(param_name);
|
||||||
|
return p ? a8::XValue(p->get_param_value()).GetDouble() : def_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Param::GetStringParam(const std::string& param_name, const char* def_val)
|
||||||
|
{
|
||||||
|
auto p = GetByName(param_name);
|
||||||
|
return p ? a8::XValue(p->get_param_value()).GetString() : def_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
namespace mt
|
namespace mt
|
||||||
{
|
{
|
||||||
|
|
||||||
DECLARE_ID_TABLE(Param, mtb::Parameter,
|
DECLARE_NAME_TABLE(Param, mtb::Parameter,
|
||||||
"parameter@parameter.csv",
|
"parameter@parameter.csv",
|
||||||
"param_name")
|
"param_name")
|
||||||
public:
|
public:
|
||||||
@ -87,6 +87,11 @@ namespace mt
|
|||||||
};
|
};
|
||||||
static void StaticPostInit();
|
static void StaticPostInit();
|
||||||
static const S& s() { return s_; };
|
static const S& s() { return s_; };
|
||||||
|
|
||||||
|
static int GetIntParam(const std::string& param_name, int def_val = 0);
|
||||||
|
static double GetFloatParam(const std::string& param_name, double def_val = 0.0f);
|
||||||
|
static std::string GetStringParam(const std::string& param_name, const char* def_val = "");
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static S s_;
|
static S s_;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user