|
|
@@ -33,11 +33,11 @@ inline constexpr float kHoldStandUpDuration = 2.0F;
|
|
|
class TransformComponent : public Component {
|
|
|
public:
|
|
|
TransformComponent(float x = 0.0F, float y = 0.0F, float z = 0.0F,
|
|
|
- float rotX = 0.0F, float rotY = 0.0F, float rotZ = 0.0F,
|
|
|
- float scale_x = 1.0F, float scaleY = 1.0F,
|
|
|
+ float rot_x = 0.0F, float rot_y = 0.0F, float rot_z = 0.0F,
|
|
|
+ float scale_x = 1.0F, float scale_y = 1.0F,
|
|
|
float scale_z = 1.0F)
|
|
|
- : position{x, y, z}, rotation{rotX, rotY, rotZ},
|
|
|
- scale{scale_x, scaleY, scale_z} {}
|
|
|
+ : position{x, y, z}, rotation{rot_x, rot_y, rot_z},
|
|
|
+ scale{scale_x, scale_y, scale_z} {}
|
|
|
|
|
|
struct Vec3 {
|
|
|
float x, y, z;
|
|
|
@@ -46,22 +46,22 @@ public:
|
|
|
Vec3 rotation;
|
|
|
Vec3 scale;
|
|
|
|
|
|
- float desiredYaw = 0.0F;
|
|
|
- bool hasDesiredYaw = false;
|
|
|
+ float desired_yaw = 0.0F;
|
|
|
+ bool has_desired_yaw = false;
|
|
|
};
|
|
|
|
|
|
class RenderableComponent : public Component {
|
|
|
public:
|
|
|
enum class MeshKind { None, Quad, Plane, Cube, Capsule, Ring };
|
|
|
|
|
|
- RenderableComponent(std::string meshPath, std::string texturePath)
|
|
|
- : meshPath(std::move(meshPath)), texturePath(std::move(texturePath)) {
|
|
|
+ RenderableComponent(std::string mesh_path, std::string texture_path)
|
|
|
+ : mesh_path(std::move(mesh_path)), texture_path(std::move(texture_path)) {
|
|
|
color.fill(1.0F);
|
|
|
}
|
|
|
|
|
|
- std::string meshPath;
|
|
|
- std::string texturePath;
|
|
|
- std::string rendererId;
|
|
|
+ std::string mesh_path;
|
|
|
+ std::string texture_path;
|
|
|
+ std::string renderer_id;
|
|
|
bool visible{true};
|
|
|
MeshKind mesh{MeshKind::Cube};
|
|
|
std::array<float, 3> color{};
|
|
|
@@ -89,17 +89,17 @@ class MovementComponent : public Component {
|
|
|
public:
|
|
|
MovementComponent() = default;
|
|
|
|
|
|
- bool hasTarget{false};
|
|
|
+ bool has_target{false};
|
|
|
float target_x{0.0F}, target_y{0.0F};
|
|
|
- float goalX{0.0F}, goalY{0.0F};
|
|
|
+ float goal_x{0.0F}, goal_y{0.0F};
|
|
|
float vx{0.0F}, vz{0.0F};
|
|
|
std::vector<std::pair<float, float>> path;
|
|
|
- bool pathPending{false};
|
|
|
- std::uint64_t pendingRequestId{0};
|
|
|
- float repathCooldown{0.0F};
|
|
|
+ bool path_pending{false};
|
|
|
+ std::uint64_t pending_request_id{0};
|
|
|
+ float repath_cooldown{0.0F};
|
|
|
|
|
|
- float lastGoalX{0.0F}, lastGoalY{0.0F};
|
|
|
- float timeSinceLastPathRequest{0.0F};
|
|
|
+ float last_goal_x{0.0F}, last_goal_y{0.0F};
|
|
|
+ float time_since_last_path_request{0.0F};
|
|
|
};
|
|
|
|
|
|
class AttackComponent : public Component {
|
|
|
@@ -110,49 +110,49 @@ public:
|
|
|
int damage = Defaults::kAttackDefaultDamage,
|
|
|
float cooldown = 1.0F)
|
|
|
: range(range), damage(damage), cooldown(cooldown),
|
|
|
- meleeRange(Defaults::kAttackMeleeRange), meleeDamage(damage),
|
|
|
- meleeCooldown(cooldown),
|
|
|
- max_heightDifference(Defaults::kAttackHeightTolerance) {}
|
|
|
+ melee_range(Defaults::kAttackMeleeRange), melee_damage(damage),
|
|
|
+ melee_cooldown(cooldown),
|
|
|
+ max_height_difference(Defaults::kAttackHeightTolerance) {}
|
|
|
|
|
|
float range;
|
|
|
int damage;
|
|
|
float cooldown;
|
|
|
- float timeSinceLast{0.0F};
|
|
|
+ float time_since_last{0.0F};
|
|
|
|
|
|
- float meleeRange;
|
|
|
- int meleeDamage;
|
|
|
- float meleeCooldown;
|
|
|
+ float melee_range;
|
|
|
+ int melee_damage;
|
|
|
+ float melee_cooldown;
|
|
|
|
|
|
- CombatMode preferredMode{CombatMode::Auto};
|
|
|
- CombatMode currentMode{CombatMode::Ranged};
|
|
|
+ CombatMode preferred_mode{CombatMode::Auto};
|
|
|
+ CombatMode current_mode{CombatMode::Ranged};
|
|
|
|
|
|
- bool canMelee{true};
|
|
|
- bool canRanged{false};
|
|
|
+ bool can_melee{true};
|
|
|
+ bool can_ranged{false};
|
|
|
|
|
|
- float max_heightDifference;
|
|
|
+ float max_height_difference;
|
|
|
|
|
|
- bool inMeleeLock{false};
|
|
|
- EntityID meleeLockTargetId{0};
|
|
|
+ bool in_melee_lock{false};
|
|
|
+ EntityID melee_lock_target_id{0};
|
|
|
|
|
|
- [[nodiscard]] auto isInMeleeRange(float distance,
|
|
|
+ [[nodiscard]] auto is_in_melee_range(float distance,
|
|
|
float height_diff) const -> bool {
|
|
|
- return distance <= meleeRange && height_diff <= max_heightDifference;
|
|
|
+ return distance <= melee_range && height_diff <= max_height_difference;
|
|
|
}
|
|
|
|
|
|
- [[nodiscard]] auto isInRangedRange(float distance) const -> bool {
|
|
|
- return distance <= range && distance > meleeRange;
|
|
|
+ [[nodiscard]] auto is_in_ranged_range(float distance) const -> bool {
|
|
|
+ return distance <= range && distance > melee_range;
|
|
|
}
|
|
|
|
|
|
- [[nodiscard]] auto getCurrentDamage() const -> int {
|
|
|
- return (currentMode == CombatMode::Melee) ? meleeDamage : damage;
|
|
|
+ [[nodiscard]] auto get_current_damage() const -> int {
|
|
|
+ return (current_mode == CombatMode::Melee) ? melee_damage : damage;
|
|
|
}
|
|
|
|
|
|
- [[nodiscard]] auto getCurrentCooldown() const -> float {
|
|
|
- return (currentMode == CombatMode::Melee) ? meleeCooldown : cooldown;
|
|
|
+ [[nodiscard]] auto get_current_cooldown() const -> float {
|
|
|
+ return (current_mode == CombatMode::Melee) ? melee_cooldown : cooldown;
|
|
|
}
|
|
|
|
|
|
- [[nodiscard]] auto getCurrentRange() const -> float {
|
|
|
- return (currentMode == CombatMode::Melee) ? meleeRange : range;
|
|
|
+ [[nodiscard]] auto get_current_range() const -> float {
|
|
|
+ return (current_mode == CombatMode::Melee) ? melee_range : range;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -161,7 +161,7 @@ public:
|
|
|
AttackTargetComponent() = default;
|
|
|
|
|
|
EntityID target_id{0};
|
|
|
- bool shouldChase{false};
|
|
|
+ bool should_chase{false};
|
|
|
};
|
|
|
|
|
|
class PatrolComponent : public Component {
|
|
|
@@ -169,7 +169,7 @@ public:
|
|
|
PatrolComponent() = default;
|
|
|
|
|
|
std::vector<std::pair<float, float>> waypoints;
|
|
|
- size_t currentWaypoint{0};
|
|
|
+ size_t current_waypoint{0};
|
|
|
bool patrolling{false};
|
|
|
};
|
|
|
|
|
|
@@ -185,20 +185,20 @@ public:
|
|
|
class ProductionComponent : public Component {
|
|
|
public:
|
|
|
ProductionComponent()
|
|
|
- : buildTime(Defaults::kProductionDefaultBuildTime),
|
|
|
+ : build_time(Defaults::kProductionDefaultBuildTime),
|
|
|
|
|
|
- maxUnits(Defaults::kProductionMaxUnits) {}
|
|
|
+ max_units(Defaults::kProductionMaxUnits) {}
|
|
|
|
|
|
- bool inProgress{false};
|
|
|
- float buildTime;
|
|
|
- float timeRemaining{0.0F};
|
|
|
- int producedCount{0};
|
|
|
- int maxUnits;
|
|
|
+ bool in_progress{false};
|
|
|
+ float build_time;
|
|
|
+ float time_remaining{0.0F};
|
|
|
+ int produced_count{0};
|
|
|
+ int max_units;
|
|
|
Game::Units::TroopType product_type{Game::Units::TroopType::Archer};
|
|
|
- float rallyX{0.0F}, rallyZ{0.0F};
|
|
|
- bool rallySet{false};
|
|
|
- int villagerCost{1};
|
|
|
- std::vector<Game::Units::TroopType> productionQueue;
|
|
|
+ float rally_x{0.0F}, rally_z{0.0F};
|
|
|
+ bool rally_set{false};
|
|
|
+ int villager_cost{1};
|
|
|
+ std::vector<Game::Units::TroopType> production_queue;
|
|
|
};
|
|
|
|
|
|
class AIControlledComponent : public Component {
|
|
|
@@ -208,12 +208,12 @@ public:
|
|
|
|
|
|
class CaptureComponent : public Component {
|
|
|
public:
|
|
|
- CaptureComponent() : requiredTime(Defaults::kCaptureRequiredTime) {}
|
|
|
+ CaptureComponent() : required_time(Defaults::kCaptureRequiredTime) {}
|
|
|
|
|
|
int capturing_player_id{-1};
|
|
|
- float captureProgress{0.0F};
|
|
|
- float requiredTime;
|
|
|
- bool isBeingCaptured{false};
|
|
|
+ float capture_progress{0.0F};
|
|
|
+ float required_time;
|
|
|
+ bool is_being_captured{false};
|
|
|
};
|
|
|
|
|
|
class PendingRemovalComponent : public Component {
|