feat: replace 'fallback weapon' with 'starting weapon'
This commit is contained in:
parent
a93e79cd1c
commit
01b69df872
12 changed files with 233 additions and 57 deletions
|
|
@ -11,15 +11,8 @@ void Rifle::queue_start_aim() {
|
|||
}
|
||||
|
||||
void Rifle::queue_stop_ads_anim() {
|
||||
if (run_requested()) {
|
||||
this->running = true;
|
||||
get_anim()->clear_queue();
|
||||
get_anim()->queue("aim_to_run");
|
||||
get_anim()->queue("run");
|
||||
} else {
|
||||
get_anim()->queue("aim_to_hip");
|
||||
get_anim()->queue("hip");
|
||||
}
|
||||
get_anim()->queue("aim_to_hip");
|
||||
get_anim()->queue("hip");
|
||||
}
|
||||
|
||||
void Rifle::queue_start_run_anim() {
|
||||
|
|
@ -42,10 +35,10 @@ void Rifle::stop_run_anim() {
|
|||
}
|
||||
|
||||
void Rifle::shoot() {
|
||||
if (get_anim()->get_queue().size() == 0 && get_anim()->get_current_animation() == "") {
|
||||
if (!is_animating()) {
|
||||
if (this->request_alt_mode) {
|
||||
get_anim()->queue("fire_aim");
|
||||
} else if (get_anim()->get_current_animation() == "") {
|
||||
} else {
|
||||
get_anim()->queue("fire_hip");
|
||||
}
|
||||
}
|
||||
|
|
@ -91,31 +84,28 @@ void Rifle::ready() {
|
|||
|
||||
void Rifle::process(double delta) {
|
||||
String const current{ get_anim()->get_current_animation() };
|
||||
bool run_requested{ this->run_requested() };
|
||||
float const progress{ float(CLAMP(get_anim()->get_current_animation_position() / get_anim()->get_current_animation_length(), 0.0, 1.0)) };
|
||||
if (current == "hip_to_aim") {
|
||||
get_camera()->set_fov_factor(Math::lerp(1.f, this->ads_factor, progress));
|
||||
} else if (current == "aim_to_hip") {
|
||||
get_camera()->set_fov_factor(Math::lerp(this->ads_factor, 1.f, progress));
|
||||
} else if (current == "aim_to_run") {
|
||||
get_camera()->set_fov_factor(Math::lerp(this->ads_factor, this->run_factor, progress));
|
||||
} else if (current == "run_to_aim") {
|
||||
get_camera()->set_fov_factor(Math::lerp(this->run_factor, this->ads_factor, progress));
|
||||
} else if (current == "hip_to_run") {
|
||||
get_camera()->set_fov_factor(Math::lerp(1.f, this->run_factor, progress));
|
||||
} else if (current == "run_to_hip") {
|
||||
get_camera()->set_fov_factor(Math::lerp(this->run_factor, 1.f, progress));
|
||||
} else if (this->request_alt_mode != this->in_alt_mode && current.is_empty()) {
|
||||
} else if (this->request_alt_mode != this->in_alt_mode && !is_animating()) {
|
||||
if (this->request_alt_mode) {
|
||||
queue_start_aim();
|
||||
} else {
|
||||
queue_stop_ads_anim();
|
||||
}
|
||||
}
|
||||
bool run_requested{ this->run_requested() };
|
||||
if (this->running != run_requested) {
|
||||
if (run_requested) {
|
||||
} else if (this->running != run_requested) {
|
||||
if (run_requested && !is_animating()) {
|
||||
queue_start_run_anim();
|
||||
} else {
|
||||
} else if (!run_requested) {
|
||||
stop_run_anim();
|
||||
}
|
||||
}
|
||||
|
|
@ -150,3 +140,7 @@ bool Rifle::run_requested() const {
|
|||
void Rifle::notify_selected() {
|
||||
get_anim()->play("equip");
|
||||
}
|
||||
|
||||
bool Rifle::is_animating() const {
|
||||
return !get_anim()->get_current_animation().is_empty() || !get_anim()->get_queue().is_empty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public:
|
|||
virtual bool allows_running() const override;
|
||||
bool run_requested() const;
|
||||
virtual void notify_selected() override;
|
||||
bool is_animating() const;
|
||||
|
||||
private:
|
||||
float ads_factor{ 0.5f };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue