1
This commit is contained in:
parent
544691e71c
commit
8bfb3f3c93
@ -126,6 +126,31 @@ static void SavePerfLog()
|
||||
|
||||
bool App::Init(int argc, char* argv[])
|
||||
{
|
||||
#if 0
|
||||
{
|
||||
{
|
||||
a8::Vec2 v(1, 0);
|
||||
a8::XPrintf("1: %f\n", { v.CalcAngleEx(a8::Vec2::RIGHT) });
|
||||
}
|
||||
{
|
||||
a8::Vec2 v(1, 1);
|
||||
a8::XPrintf("2: %f\n", { v.CalcAngleEx(a8::Vec2::RIGHT) });
|
||||
}
|
||||
{
|
||||
a8::Vec2 v(1, -1);
|
||||
a8::XPrintf("3: %f\n", { v.CalcAngleEx(a8::Vec2::RIGHT) });
|
||||
}
|
||||
{
|
||||
a8::Vec2 v(-1, -1);
|
||||
a8::XPrintf("4: %f\n", { v.CalcAngleEx(a8::Vec2::RIGHT) });
|
||||
}
|
||||
{
|
||||
a8::Vec2 v(-1, 0);
|
||||
a8::XPrintf("4: %f\n", { v.CalcAngleEx(a8::Vec2::RIGHT) });
|
||||
}
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
{
|
||||
std::string data = "${master.name} [aa ]${image.id:1000} bb${}cc";
|
||||
|
@ -421,6 +421,27 @@ void Bullet::MapServiceUpdate()
|
||||
Check(distance);
|
||||
}
|
||||
} while(!later_removed_ && move_length >= 0.0001f);
|
||||
#ifdef DEBUG1
|
||||
{
|
||||
if (sender.Get()->IsPlayer()) {
|
||||
if ((room->GetFrameNo() - create_frameno_) % 2 == 0) {
|
||||
float distance = (GetPos() - born_pos).Norm();
|
||||
a8::XPrintf("bullet_id:%d frame_no:%d speed:%f range:%f fly_distance:%f born_pos:%f,%f pos:%f,%f\n",
|
||||
{
|
||||
gun_meta->i->id(),
|
||||
(room->GetFrameNo() - create_frameno_) / 2,
|
||||
gun_meta->i->bullet_speed(),
|
||||
gun_meta->i->range(),
|
||||
distance,
|
||||
born_pos.x,
|
||||
born_pos.y,
|
||||
GetPos().x,
|
||||
GetPos().y
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
room->RemoveObjectLater(this);
|
||||
later_removed_ = true;
|
||||
|
@ -198,11 +198,6 @@ void InternalShot(Creature* c,
|
||||
for (auto& tuple : weapon_meta->bullet_born_offset) {
|
||||
++i;
|
||||
a8::Vec2 bullet_born_offset = a8::Vec2(std::get<0>(tuple), std::get<1>(tuple));
|
||||
float bullet_born_angle = c->GetAttackDir().CalcAngleEx(a8::Vec2::UP);
|
||||
if (c->GetAttackDir().x < 0.00001f) {
|
||||
bullet_born_angle = -bullet_born_angle;
|
||||
}
|
||||
bullet_born_offset.Rotate(bullet_born_angle);
|
||||
a8::Vec2 bullet_born_pos = c->GetPos() + c->shoot_offset + bullet_born_offset;
|
||||
a8::Vec2 bullet_dir = c->GetAttackDir();
|
||||
float bullet_angle = std::get<2>(tuple);
|
||||
@ -215,9 +210,16 @@ void InternalShot(Creature* c,
|
||||
bullet_dir.Rotate(bullet_angle / 180.0f);
|
||||
#if 1
|
||||
{
|
||||
float bullet_born_angle = c->GetAttackDir().CalcAngleEx(a8::Vec2::RIGHT);
|
||||
if (c->GetAttackDir().y > 0.00001f) {
|
||||
bullet_born_angle = -bullet_born_angle;
|
||||
}
|
||||
float old_bullet_born_angle = bullet_born_angle;
|
||||
bullet_born_offset.Rotate(bullet_born_angle);
|
||||
|
||||
auto transform = glm::rotate(hero_transform,
|
||||
bullet_born_angle * A8_PI,
|
||||
glm::vec3(0.0, 1.0, 0.0));
|
||||
bullet_born_angle * A8_PI,
|
||||
glm::vec3(0.0, 1.0, 0.0));
|
||||
glm::vec4 gun_muzzle_position(0.0, 0.0, 0.0, 0.0);
|
||||
if (weapon_meta->i->shootfire()) {
|
||||
MetaData::Player* hero_meta = c->GetHeroMeta();
|
||||
@ -255,18 +257,26 @@ void InternalShot(Creature* c,
|
||||
);
|
||||
}
|
||||
glm::vec4 v = transform * gun_muzzle_position;
|
||||
bullet_born_offset = a8::Vec2(v.x *10*1, v.z*10*1);
|
||||
bullet_born_offset = a8::Vec2(v.z *10*1, v.x*10*-1);
|
||||
bullet_born_pos = c->GetPos() + bullet_born_offset;
|
||||
if (c->IsPlayer()) {
|
||||
a8::XPrintf("offset:%f,%f angle:%f angle_xy:%f,%f %f %f\n",
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("offset:%f,%f angle:%f old_angle:%f angle_xy:%f,%f %f %f gun_muzzle_position:%f,%f,%f pos:%f,%f\n",
|
||||
{bullet_born_offset.x,
|
||||
bullet_born_offset.y,
|
||||
bullet_born_angle,
|
||||
old_bullet_born_angle,
|
||||
c->GetAttackDir().x,
|
||||
c->GetAttackDir().y,
|
||||
(bullet_born_angle * 180),
|
||||
(bullet_born_angle - glm::radians(90.0f) / A8_PI) * 180
|
||||
(bullet_born_angle - glm::radians(90.0f) / A8_PI) * 180,
|
||||
gun_muzzle_position.x,
|
||||
gun_muzzle_position.y,
|
||||
gun_muzzle_position.z,
|
||||
bullet_born_pos.x,
|
||||
bullet_born_pos.y,
|
||||
});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -252,36 +252,36 @@ void PlayerStats::ParseReward(a8::XObject& xobj)
|
||||
return;
|
||||
}
|
||||
auto reward_xobj = xobj.At("reward");
|
||||
if (!reward_xobj->IsObject()) {
|
||||
if (!reward_xobj || !reward_xobj->IsObject()) {
|
||||
return;
|
||||
}
|
||||
{
|
||||
auto hero_xobj = reward_xobj->At("hero");
|
||||
if (hero_xobj->IsObject()) {
|
||||
if (hero_xobj && hero_xobj->IsObject()) {
|
||||
over_reward.hero.obtain_gold = hero_xobj->At("obtain_ceg")->AsXValue();
|
||||
over_reward.hero.gold_limit = hero_xobj->At("ceg_uplimit")->AsXValue();
|
||||
}
|
||||
}
|
||||
{
|
||||
auto weapon_xobj = reward_xobj->At("weapon1");
|
||||
if (weapon_xobj->IsObject()) {
|
||||
if (weapon_xobj && weapon_xobj->IsObject()) {
|
||||
over_reward.weapon1.obtain_gold = weapon_xobj->At("obtain_ceg")->AsXValue();
|
||||
over_reward.weapon1.gold_limit = weapon_xobj->At("ceg_uplimit")->AsXValue();
|
||||
}
|
||||
}
|
||||
{
|
||||
auto weapon_xobj = reward_xobj->At("weapon2");
|
||||
if (weapon_xobj->IsObject()) {
|
||||
if (weapon_xobj && weapon_xobj->IsObject()) {
|
||||
over_reward.weapon2.obtain_gold = weapon_xobj->At("obtain_ceg")->AsXValue();
|
||||
over_reward.weapon2.gold_limit = weapon_xobj->At("ceg_uplimit")->AsXValue();
|
||||
}
|
||||
}
|
||||
{
|
||||
auto items_xobj = reward_xobj->At("items");
|
||||
if (items_xobj->IsArray()) {
|
||||
if (items_xobj && items_xobj->IsArray()) {
|
||||
for (int i = 0; i < items_xobj->Size(); ++i) {
|
||||
auto item_xobj = reward_xobj->At(i);
|
||||
if (item_xobj->IsObject()) {
|
||||
if (item_xobj && item_xobj->IsObject()) {
|
||||
over_reward.items.push_back
|
||||
(std::make_tuple
|
||||
(
|
||||
|
@ -1626,7 +1626,7 @@ namespace MetaData
|
||||
abort();
|
||||
}
|
||||
waves[content.pb->round() - 1].push_back(&content);
|
||||
if (content.pb->round() +1 >= waves.size()) {
|
||||
if (content.pb->round() >= waves.size()) {
|
||||
if (content.enemys.size() != 1) {
|
||||
abort();
|
||||
}
|
||||
|
@ -462,9 +462,7 @@ Human* Room::FindEnemy(Human* hum)
|
||||
void Room::FillSMJoinedNotify(Player* self_hum, cs::SMJoinedNotify& msg)
|
||||
{
|
||||
msg.set_team_mode(msg.team_mode());
|
||||
#if 0
|
||||
msg.set_adjust_bullet(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Room::ScatterDrop(a8::Vec2 center, int drop_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user