From 219b277e5c43bcaf2b99c9c062af84842ce7a3e0 Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Tue, 12 Apr 2022 11:33:22 -0400 Subject: [PATCH] some cleanup of the code --- src/Main.cpp | 20 +++++++++---------- src/Main.h | 12 +++++------ src/player/Player.cpp | 32 +++++++++++++++--------------- src/player/Player.h | 20 +++++++++---------- src/state_machine/State.cpp | 10 +++++----- src/state_machine/State.h | 4 ++-- src/state_machine/StateMachine.cpp | 12 +++++------ src/state_machine/StateMachine.h | 4 ++-- 8 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/Main.cpp b/src/Main.cpp index ef0fe55..387ff6e 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -55,39 +55,39 @@ void Main::_physics_process(float delta) } } -void Main::set_full_screen(bool new_full_screen) +void Main::set_full_screen(bool full_screen) { - full_screen = new_full_screen; + this->full_screen = full_screen; } bool Main::get_full_screen() { - return full_screen; + return this->full_screen; } -void Main::set_window_size(Vector2 new_window_size) +void Main::set_window_size(Vector2 window_size) { - window_size = new_window_size; + this-> window_size = window_size; } Vector2 Main::get_window_size() { - return window_size; + return this->window_size; } -void Main::set_launch_screen(int8_t new_launch_screen) +void Main::set_launch_screen(int8_t launch_screen) { - launch_screen = new_launch_screen; + this->launch_screen = launch_screen; } int8_t Main::get_launch_screen() { - if (launch_screen == -1) + if (this->launch_screen == -1) { return _os->get_current_screen(); } else { - return launch_screen; + return this->launch_screen; } } diff --git a/src/Main.h b/src/Main.h index 3a65398..af61ec8 100644 --- a/src/Main.h +++ b/src/Main.h @@ -89,9 +89,9 @@ namespace godot /** * @brief Set the full screen object. * - * @param[in] new_full_screen The new full screen state. + * @param[in] full_screen The new full screen state. */ - void set_full_screen(bool new_full_screen); + void set_full_screen(bool full_screen); /** * @brief Get the full screen object. @@ -104,9 +104,9 @@ namespace godot /** * @brief Set the window size object. * - * @param[in] new_window_size The new window size. + * @param[in] window_size The new window size. */ - void set_window_size(Vector2 new_window_size); + void set_window_size(Vector2 window_size); /** * @brief Get the window size object. @@ -118,9 +118,9 @@ namespace godot /** * @brief Set the launch screen object. * - * @param[in] new_launch_screen The launch screen to use. + * @param[in] launch_screen The launch screen to use. */ - void set_launch_screen(int8_t new_launch_screen); + void set_launch_screen(int8_t launch_screen); /** * @brief Get the launch screen object. diff --git a/src/player/Player.cpp b/src/player/Player.cpp index 30c801d..843043b 100644 --- a/src/player/Player.cpp +++ b/src/player/Player.cpp @@ -1,4 +1,4 @@ -#include "Player.h" +#include "player/Player.h" #include #include @@ -112,54 +112,54 @@ void Player::_physics_process(float delta) } } -void Player::set_sprite_frames(Ref new_sprite_frames) +void Player::set_sprite_frames(Ref sprite_frames) { - sprite_frames = new_sprite_frames; + this->sprite_frames = sprite_frames; } Ref Player::get_sprite_frames() { - return sprite_frames; + return this->sprite_frames; } -void Player::set_speed(float new_speed) +void Player::set_speed(float speed) { - speed = new_speed; + this->speed = speed; } float Player::get_speed() { - return speed; + return this->speed; } -void Player::set_jump_force(float new_jump_force) +void Player::set_jump_force(float jump_force) { - jump_force = new_jump_force; + this->jump_force = jump_force; } float Player::get_jump_force() { - return jump_force; + return this->jump_force; } -void Player::set_gravity(float new_gravity) +void Player::set_gravity(float gravity) { - gravity = new_gravity; + this->gravity = gravity; } float Player::get_gravity() { - return gravity; + return this->gravity; } -void Player::set_run_speed(float new_run_speed) +void Player::set_run_speed(float run_speed) { - run_speed = new_run_speed; + this->run_speed = run_speed; } float Player::get_run_speed() { - return run_speed; + return this->run_speed; } void Player::set_double_jump(bool double_jump) diff --git a/src/player/Player.h b/src/player/Player.h index 67ff8c4..78bc986 100644 --- a/src/player/Player.h +++ b/src/player/Player.h @@ -112,9 +112,9 @@ namespace godot /** * @brief Set the sprite frames object. * - * @param[in] new_sprite_frames The new sprite frame. + * @param[in] sprite_frames The new sprite frame. */ - void set_sprite_frames(Ref new_sprite_frames); + void set_sprite_frames(Ref sprite_frames); /** * @brief Get the sprite frames object. @@ -126,9 +126,9 @@ namespace godot /** * @brief Set the speed object. * - * @param[in] new_speed The new speed. + * @param[in] speed The new speed. */ - void set_speed(float new_speed); + void set_speed(float speed); /** * @brief Get the speed object. @@ -140,9 +140,9 @@ namespace godot /** * @brief Set the jump force object. * - * @param[in] new_jump_force The new force applied to the player to make him jump. + * @param[in] jump_force The new force applied to the player to make him jump. */ - void set_jump_force(float new_jump_force); + void set_jump_force(float jump_force); /** * @brief Get the jump force object. @@ -154,9 +154,9 @@ namespace godot /** * @brief Set the gravity object. * - * @param[in] new_gravity The new gravity to apply to the player. + * @param[in] gravity The new gravity to apply to the player. */ - void set_gravity(float new_gravity); + void set_gravity(float gravity); /** * @brief Get the gravity object. @@ -168,9 +168,9 @@ namespace godot /** * @brief Set the run speed object. * - * @param[in] new_run_speed The new speed for running. + * @param[in] run_speed The new speed for running. */ - void set_run_speed(float new_run_speed); + void set_run_speed(float run_speed); /** * @brief Get the run speed object. diff --git a/src/state_machine/State.cpp b/src/state_machine/State.cpp index 6e53a52..24d8b6d 100644 --- a/src/state_machine/State.cpp +++ b/src/state_machine/State.cpp @@ -33,9 +33,9 @@ void State::_state_exit(const String state, const Array args) WARN_PRINT("State " + state + " is missing its _state_exit method!"); } -void State::set_parent(Node *new_parent) +void State::set_parent(Node *parent) { - parent = new_parent; + this->parent = parent; } Node *State::get_parent() @@ -43,12 +43,12 @@ Node *State::get_parent() return parent; } -void State::set_state_machine(StateMachine *new_state_machine) +void State::set_state_machine(StateMachine *state_machine) { - state_machine = new_state_machine; + this->state_machine = state_machine; } StateMachine *State::get_state_machine() { - return state_machine; + return this->state_machine; } diff --git a/src/state_machine/State.h b/src/state_machine/State.h index 5ae0db8..bd8d787 100644 --- a/src/state_machine/State.h +++ b/src/state_machine/State.h @@ -33,11 +33,11 @@ namespace godot virtual void _state_exit(const String state, const Array args = Array()); - virtual void set_parent(Node *new_parent) final; + virtual void set_parent(Node *parent) final; virtual Node *get_parent() final; - virtual void set_state_machine(StateMachine *new_state_machine) final; + virtual void set_state_machine(StateMachine *state_machine) final; virtual StateMachine *get_state_machine() final; }; diff --git a/src/state_machine/StateMachine.cpp b/src/state_machine/StateMachine.cpp index 200883b..6556431 100644 --- a/src/state_machine/StateMachine.cpp +++ b/src/state_machine/StateMachine.cpp @@ -155,24 +155,24 @@ Variant StateMachine::_call(const String method, const Array &args) return this->call(method, args); } -void StateMachine::set_default_state(const String new_default_state) +void StateMachine::set_default_state(const String default_state) { - default_state = new_default_state; + this->default_state = default_state; } String StateMachine::get_default_state() { - return default_state; + return this->default_state; } -void StateMachine::set_current_state(const String new_current_sate) +void StateMachine::set_current_state(const String current_sate) { - current_state = new_current_sate; + this->current_state = current_sate; } String StateMachine::get_current_state() { - return current_state; + return this->current_state; } void StateMachine::set_debug(bool debug) diff --git a/src/state_machine/StateMachine.h b/src/state_machine/StateMachine.h index 66920e3..5f0cea5 100644 --- a/src/state_machine/StateMachine.h +++ b/src/state_machine/StateMachine.h @@ -74,7 +74,7 @@ namespace godot return _call(method, Array::make(args...)); } - void set_default_state(const String new_default_state); + void set_default_state(const String default_state); String get_default_state(); @@ -82,7 +82,7 @@ namespace godot bool get_debug(); - void set_current_state(const String new_current_state); + void set_current_state(const String current_state); String get_current_state();