#include "dark.hpp"
void Plr_dark::update_input(float dt) {
#ifdef DEBUG_CONTROL
  (void)dt;
  phys.pos = plr_shake_offset;
  phys.spd = 0;
  g_offset = {};
  phys.set_deg(90.0f);
  cauto spd = Game::input.test(KEY_FOCUS) ? 20.0f : 600.0f;
  if (Game::input.test(KEY_LEFT)) {
    g_offset.spd = spd;
    g_offset.set_dir2(g_offset.dir + Vec(-1, 0));
  }
  if (Game::input.test(KEY_RIGHT)) {
    g_offset.spd = spd;
    g_offset.set_dir2(g_offset.dir + Vec(1, 0));
  }
  if (Game::input.test(KEY_UP)) { 
    g_offset.spd = spd;
    g_offset.set_dir2(g_offset.dir + Vec(0, -1));
  }
  if (Game::input.test(KEY_DOWN)) { 
    g_offset.spd = spd;
    g_offset.set_dir2(g_offset.dir + Vec(0, 1));
  }
  g_offset.pos = phys.pos;
#else // normal input:
  if (Game::input.test(KEY_LEFT)) left(dt);
  else if (Game::input.test(KEY_RIGHT)) right(dt);
  if (Game::input.test(KEY_UP)) up(dt);
  else if (Game::input.test(KEY_DOWN)) down(dt);
  info_cast(info);
  phys.set_deg(phys.deg);
  phys.pos = plr_shake_offset;
  phys.update_speed(dt, info->spd_min, info->spd_max);
  g_offset = phys;
#endif
} // update_input
void Plr_dark::left(float dt) {
  info_cast(info);
  phys.rotate(Game::input.test(KEY_FOCUS)
    ? info->accel_rot_focus
    : info->accel_rot, dt);
  phys.update_dir();
}
void Plr_dark::right(float dt) {
  info_cast(info);
  phys.rotate(Game::input.test(KEY_FOCUS)
    ? -info->accel_rot_focus
    : -info->accel_rot, dt);
  phys.update_dir();
}
void Plr_dark::up(float dt) {
  info_cast(info);
  phys.add_spd(+info->accel_add, dt);
}
void Plr_dark::down(float dt) {
  info_cast(info);
  phys.add_spd(-info->accel_add, dt);
}