Browse Source

convert to snake case

djeada 1 month ago
parent
commit
b96a11ab43
53 changed files with 869 additions and 851 deletions
  1. 4 2
      app/controllers/command_controller.cpp
  2. 6 6
      app/core/game_engine.cpp
  3. 5 5
      app/models/selected_units_model.cpp
  4. 2 3
      game/audio/AudioSystem.cpp
  5. 6 4
      game/audio/MiniaudioBackend.cpp
  6. 13 13
      game/core/serialization.cpp
  7. 45 45
      game/map/map_catalog.cpp
  8. 4 4
      game/map/map_transformer.cpp
  9. 13 13
      game/map/skirmish_loader.cpp
  10. 64 63
      game/map/terrain.cpp
  11. 2 0
      game/systems/ai_system.cpp
  12. 2 2
      game/systems/ai_system/ai_reasoner.h
  13. 1 1
      game/systems/ai_system/ai_tactical.cpp
  14. 1 1
      game/systems/arrow_system.cpp
  15. 5 5
      game/systems/building_collision_registry.cpp
  16. 1 1
      game/systems/capture_system.cpp
  17. 1 1
      game/systems/cleanup_system.cpp
  18. 63 59
      game/systems/combat_system.cpp
  19. 1 1
      game/systems/game_state_serializer.cpp
  20. 8 8
      game/systems/movement_system.cpp
  21. 1 1
      game/systems/patrol_system.cpp
  22. 30 28
      game/systems/picking_service.cpp
  23. 22 21
      game/systems/save_load_service.cpp
  24. 1 2
      game/systems/terrain_alignment_system.cpp
  25. 1 1
      game/systems/victory_service.cpp
  26. 1 1
      game/visuals/visual_catalog.h
  27. 6 6
      main.cpp
  28. 31 31
      render/entity/archer_renderer.cpp
  29. 145 140
      render/entity/barracks_renderer.cpp
  30. 13 13
      render/entity/horse_renderer.cpp
  31. 44 43
      render/entity/knight_renderer.cpp
  32. 29 32
      render/entity/mounted_knight_renderer.cpp
  33. 7 9
      render/entity/spearman_renderer.cpp
  34. 2 2
      render/geom/arrow.cpp
  35. 27 27
      render/geom/transforms.cpp
  36. 56 54
      render/gl/backend.cpp
  37. 1 0
      render/gl/backend/cylinder_pipeline.cpp
  38. 1 0
      render/gl/backend/vegetation_pipeline.cpp
  39. 27 26
      render/gl/camera.cpp
  40. 3 3
      render/gl/mesh.cpp
  41. 22 22
      render/gl/primitives.cpp
  42. 14 13
      render/ground/biome_renderer.cpp
  43. 14 14
      render/ground/bridge_renderer.cpp
  44. 7 6
      render/ground/firecamp_renderer.cpp
  45. 2 2
      render/ground/ground_renderer.cpp
  46. 8 6
      render/ground/pine_renderer.cpp
  47. 10 9
      render/ground/plant_renderer.cpp
  48. 1 2
      render/ground/riverbank_asset_renderer.cpp
  49. 10 9
      render/ground/stone_renderer.cpp
  50. 35 35
      render/ground/terrain_renderer.cpp
  51. 45 49
      render/humanoid_base.cpp
  52. 0 1
      render/palette.cpp
  53. 6 6
      ui/theme.cpp

+ 4 - 2
app/controllers/command_controller.cpp

@@ -41,8 +41,10 @@ auto CommandController::onAttackClick(qreal sx, qreal sy, int viewportWidth,
   }
 
   auto *cam = static_cast<Render::GL::Camera *>(camera);
-  Engine::Core::EntityID const target_id = m_pickingService->pickUnitFirst(
-      float(sx), float(sy), *m_world, *cam, viewportWidth, viewportHeight, 0);
+  Engine::Core::EntityID const target_id =
+      Game::Systems::PickingService::pickUnitFirst(
+          float(sx), float(sy), *m_world, *cam, viewportWidth, viewportHeight,
+          0);
 
   if (target_id == 0) {
     result.resetCursorToNormal = true;

+ 6 - 6
app/core/game_engine.cpp

@@ -242,9 +242,9 @@ GameEngine::GameEngine(QObject *parent)
                 auto *picking = m_pickingService.get();
                 if ((cam != nullptr) && (picking != nullptr)) {
                   Engine::Core::EntityID const target_id =
-                      picking->pickUnitFirst(0.0F, 0.0F, *m_world, *cam,
-                                             m_viewport.width,
-                                             m_viewport.height, 0);
+                      Game::Systems::PickingService::pickUnitFirst(
+                          0.0F, 0.0F, *m_world, *cam, m_viewport.width,
+                          m_viewport.height, 0);
                   if (target_id != 0) {
                     App::Controllers::ActionVFX::spawnAttackArrow(m_world.get(),
                                                                   target_id);
@@ -300,13 +300,13 @@ void GameEngine::cleanupOpenGLResources() {
   qInfo() << "Cleaning up OpenGL resources...";
 
   QOpenGLContext *context = QOpenGLContext::currentContext();
-  const bool hasValidContext = (context != nullptr);
+  const bool has_valid_context = (context != nullptr);
 
-  if (!hasValidContext) {
+  if (!has_valid_context) {
     qInfo() << "No valid OpenGL context, skipping OpenGL cleanup";
   }
 
-  if (m_renderer && hasValidContext) {
+  if (m_renderer && has_valid_context) {
     m_renderer->shutdown();
     qInfo() << "Renderer shut down";
   }

+ 5 - 5
app/models/selected_units_model.cpp

@@ -33,12 +33,12 @@ auto SelectedUnitsModel::data(const QModelIndex &index,
   QString name;
   int hp = 0;
   int max_hp = 0;
-  bool isB = false;
+  bool is_b = false;
   bool alive = false;
   if (role == UnitIdRole) {
     return QVariant::fromValue<int>(static_cast<int>(id));
   }
-  if (!m_engine->getUnitInfo(id, name, hp, max_hp, isB, alive)) {
+  if (!m_engine->getUnitInfo(id, name, hp, max_hp, is_b, alive)) {
     return {};
   }
   if (role == NameRole) {
@@ -91,12 +91,12 @@ void SelectedUnitsModel::refresh() {
     QString nm;
     int hp = 0;
     int max_hp = 0;
-    bool isB = false;
+    bool is_b = false;
     bool alive = false;
-    if (!m_engine->getUnitInfo(id, nm, hp, max_hp, isB, alive)) {
+    if (!m_engine->getUnitInfo(id, nm, hp, max_hp, is_b, alive)) {
       continue;
     }
-    if (isB) {
+    if (is_b) {
       continue;
     }
     if (!alive) {

+ 2 - 3
game/audio/AudioSystem.cpp

@@ -81,8 +81,7 @@ void AudioSystem::playSound(const std::string &soundId, float volume, bool loop,
   queueCondition.notify_one();
 }
 
-void AudioSystem::playMusic(const std::string &musicId, float volume,
-                            bool crossfade) {
+void AudioSystem::playMusic(const std::string &musicId, float volume, bool) {
   std::lock_guard<std::mutex> const lock(queueMutex);
   eventQueue.emplace(AudioEventType::PLAY_MUSIC, musicId, volume);
   queueCondition.notify_one();
@@ -366,7 +365,7 @@ void AudioSystem::processEvent(const AudioEvent &event) {
   }
 }
 
-auto AudioSystem::canPlaySound(int priority) -> bool {
+auto AudioSystem::canPlaySound(int) -> bool {
   std::lock_guard<std::mutex> const lock(activeSoundsMutex);
   return activeSounds.size() < maxChannels;
 }

+ 6 - 4
game/audio/MiniaudioBackend.cpp

@@ -2,6 +2,7 @@
 #include <QDebug>
 #include <algorithm>
 #include <cmath>
+#include <cstddef>
 #include <cstring>
 #include <qglobal.h>
 #include <qhashfunctions.h>
@@ -31,7 +32,8 @@ static void audioCallback(ma_device *device, void *pOutput, const void *,
                           ma_uint32 frameCount) {
   auto *w = reinterpret_cast<DeviceWrapper *>(device->pUserData);
   if ((w == nullptr) || (w->self == nullptr)) {
-    std::memset(pOutput, 0, frameCount * 2 * sizeof(float));
+    std::memset(pOutput, 0,
+                static_cast<unsigned long>(frameCount * 2) * sizeof(float));
     return;
   }
   w->self->onAudio(reinterpret_cast<float *>(pOutput), frameCount);
@@ -40,7 +42,7 @@ static void audioCallback(ma_device *device, void *pOutput, const void *,
 MiniaudioBackend::MiniaudioBackend(QObject *parent) : QObject(parent) {}
 MiniaudioBackend::~MiniaudioBackend() { shutdown(); }
 
-auto MiniaudioBackend::initialize(int deviceRate, int outChannels,
+auto MiniaudioBackend::initialize(int deviceRate, int,
                                   int musicChannels) -> bool {
   m_rate = std::max(22050, deviceRate);
   m_outCh = 2;
@@ -330,7 +332,7 @@ void MiniaudioBackend::onAudio(float *out, unsigned frames) {
         }
       }
       const unsigned can_copy = std::min(frames_left, ch.track->frames - pos);
-      const float *src = pcm + pos * 2;
+      const float *src = pcm + static_cast<size_t>(pos * 2);
 
       for (unsigned i = 0; i < can_copy; ++i) {
         const float vol = ch.curVol * m_masterVol;
@@ -385,7 +387,7 @@ void MiniaudioBackend::onAudio(float *out, unsigned frames) {
       }
 
       const unsigned can_copy = std::min(frames_left, sfx.track->frames - pos);
-      const float *src = pcm + pos * 2;
+      const float *src = pcm + static_cast<size_t>(pos * 2);
 
       for (unsigned i = 0; i < can_copy; ++i) {
         const float vol = sfx.volume * m_masterVol;

+ 13 - 13
game/core/serialization.cpp

@@ -168,11 +168,11 @@ auto Serialization::serializeEntity(const Entity *entity) -> QJsonObject {
 
   if (const auto *attack_target =
           entity->getComponent<AttackTargetComponent>()) {
-    QJsonObject attack_targetObj;
-    attack_targetObj["target_id"] =
+    QJsonObject attack_target_obj;
+    attack_target_obj["target_id"] =
         static_cast<qint64>(attack_target->target_id);
-    attack_targetObj["shouldChase"] = attack_target->shouldChase;
-    entity_obj["attack_target"] = attack_targetObj;
+    attack_target_obj["shouldChase"] = attack_target->shouldChase;
+    entity_obj["attack_target"] = attack_target_obj;
   }
 
   if (const auto *patrol = entity->getComponent<PatrolComponent>()) {
@@ -362,11 +362,11 @@ void Serialization::deserializeEntity(Entity *entity, const QJsonObject &json) {
   }
 
   if (json.contains("attack_target")) {
-    const auto attack_targetObj = json["attack_target"].toObject();
+    const auto attack_target_obj = json["attack_target"].toObject();
     auto *attack_target = entity->addComponent<AttackTargetComponent>();
     attack_target->target_id = static_cast<EntityID>(
-        attack_targetObj["target_id"].toVariant().toULongLong());
-    attack_target->shouldChase = attack_targetObj["shouldChase"].toBool(false);
+        attack_target_obj["target_id"].toVariant().toULongLong());
+    attack_target->shouldChase = attack_target_obj["shouldChase"].toBool(false);
   }
 
   if (json.contains("patrol")) {
@@ -554,15 +554,15 @@ void Serialization::deserializeTerrain(Game::Map::TerrainHeightMap *height_map,
     const Game::Map::BiomeSettings default_biome{};
     const auto read_color = [&](const QString &base,
                                 const QVector3D &fallback) -> QVector3D {
-      const auto rKey = base + QStringLiteral("R");
-      const auto gKey = base + QStringLiteral("G");
-      const auto bKey = base + QStringLiteral("B");
+      const auto r_key = base + QStringLiteral("R");
+      const auto g_key = base + QStringLiteral("G");
+      const auto b_key = base + QStringLiteral("B");
       const float r = static_cast<float>(
-          biome_obj[rKey].toDouble(static_cast<double>(fallback.x())));
+          biome_obj[r_key].toDouble(static_cast<double>(fallback.x())));
       const float g = static_cast<float>(
-          biome_obj[gKey].toDouble(static_cast<double>(fallback.y())));
+          biome_obj[g_key].toDouble(static_cast<double>(fallback.y())));
       const float b = static_cast<float>(
-          biome_obj[bKey].toDouble(static_cast<double>(fallback.z())));
+          biome_obj[b_key].toDouble(static_cast<double>(fallback.z())));
       return {r, g, b};
     };
 

+ 45 - 45
game/map/map_catalog.cpp

@@ -36,18 +36,18 @@ MapCatalog::MapCatalog(QObject *parent) : QObject(parent) {}
 
 auto MapCatalog::availableMaps() -> QVariantList {
   QVariantList list;
-  const QString mapsRoot =
+  const QString maps_root =
       Utils::Resources::resolveResourcePath(QStringLiteral(":/assets/maps"));
-  QDir const mapsDir(mapsRoot);
-  if (!mapsDir.exists()) {
+  QDir const maps_dir(maps_root);
+  if (!maps_dir.exists()) {
     return list;
   }
 
   QStringList const files =
-      mapsDir.entryList(QStringList() << "*.json", QDir::Files, QDir::Name);
+      maps_dir.entryList(QStringList() << "*.json", QDir::Files, QDir::Name);
   for (const QString &f : files) {
     QString const path =
-        Utils::Resources::resolveResourcePath(mapsDir.filePath(f));
+        Utils::Resources::resolveResourcePath(maps_dir.filePath(f));
     QFile file(path);
     QString name = f;
     QString desc;
@@ -68,9 +68,9 @@ auto MapCatalog::availableMaps() -> QVariantList {
 
         if (obj.contains(SPAWNS) && obj[SPAWNS].isArray()) {
           QJsonArray const spawns = obj[SPAWNS].toArray();
-          for (const QJsonValue &spawnVal : spawns) {
-            if (spawnVal.isObject()) {
-              QJsonObject spawn = spawnVal.toObject();
+          for (const QJsonValue &spawn_val : spawns) {
+            if (spawn_val.isObject()) {
+              QJsonObject spawn = spawn_val.toObject();
               if (spawn.contains(PLAYER_ID)) {
                 int const player_id = spawn[PLAYER_ID].toInt();
                 if (player_id > 0) {
@@ -87,13 +87,13 @@ auto MapCatalog::availableMaps() -> QVariantList {
     entry[DESCRIPTION] = desc;
     entry["path"] = path;
     entry["playerCount"] = player_ids.size();
-    QVariantList player_idList;
-    QList<int> sortedIds = player_ids.values();
-    std::sort(sortedIds.begin(), sortedIds.end());
-    for (int const id : sortedIds) {
-      player_idList.append(id);
+    QVariantList player_id_list;
+    QList<int> sorted_ids = player_ids.values();
+    std::sort(sorted_ids.begin(), sorted_ids.end());
+    for (int const id : sorted_ids) {
+      player_id_list.append(id);
     }
-    entry["player_ids"] = player_idList;
+    entry["player_ids"] = player_id_list;
 
     QString thumbnail;
     if (file.open(QIODevice::ReadOnly)) {
@@ -110,12 +110,12 @@ auto MapCatalog::availableMaps() -> QVariantList {
     }
 
     if (thumbnail.isEmpty()) {
-      QString const baseName = QFileInfo(f).baseName();
-      QString const thumbCandidate = Utils::Resources::resolveResourcePath(
-          QString(":/assets/maps/%1_thumb.png").arg(baseName));
+      QString const base_name = QFileInfo(f).baseName();
+      QString const thumb_candidate = Utils::Resources::resolveResourcePath(
+          QString(":/assets/maps/%1_thumb.png").arg(base_name));
 
-      if (QFileInfo::exists(thumbCandidate)) {
-        thumbnail = thumbCandidate;
+      if (QFileInfo::exists(thumb_candidate)) {
+        thumbnail = thumb_candidate;
       } else {
         thumbnail = "";
       }
@@ -137,10 +137,10 @@ void MapCatalog::loadMapsAsync() {
   m_loading = true;
   emit loadingChanged(true);
 
-  const QString mapsRoot =
+  const QString maps_root =
       Utils::Resources::resolveResourcePath(QStringLiteral(":/assets/maps"));
-  QDir const mapsDir(mapsRoot);
-  if (!mapsDir.exists()) {
+  QDir const maps_dir(maps_root);
+  if (!maps_dir.exists()) {
     m_loading = false;
     emit loadingChanged(false);
     emit allMapsLoaded();
@@ -148,7 +148,7 @@ void MapCatalog::loadMapsAsync() {
   }
 
   m_pendingFiles =
-      mapsDir.entryList(QStringList() << "*.json", QDir::Files, QDir::Name);
+      maps_dir.entryList(QStringList() << "*.json", QDir::Files, QDir::Name);
 
   if (m_pendingFiles.isEmpty()) {
     m_loading = false;
@@ -168,12 +168,12 @@ void MapCatalog::loadNextMap() {
     return;
   }
 
-  QString const fileName = m_pendingFiles.takeFirst();
-  const QString mapsRoot =
+  QString const file_name = m_pendingFiles.takeFirst();
+  const QString maps_root =
       Utils::Resources::resolveResourcePath(QStringLiteral(":/assets/maps"));
-  QDir const mapsDir(mapsRoot);
+  QDir const maps_dir(maps_root);
   QString const path =
-      Utils::Resources::resolveResourcePath(mapsDir.filePath(fileName));
+      Utils::Resources::resolveResourcePath(maps_dir.filePath(file_name));
 
   QVariantMap const entry = loadSingleMap(path);
   if (!entry.isEmpty()) {
@@ -191,9 +191,9 @@ void MapCatalog::loadNextMap() {
 }
 
 auto MapCatalog::loadSingleMap(const QString &path) -> QVariantMap {
-  const QString resolvedPath = Utils::Resources::resolveResourcePath(path);
-  QFile file(resolvedPath);
-  QString name = QFileInfo(resolvedPath).fileName();
+  const QString resolved_path = Utils::Resources::resolveResourcePath(path);
+  QFile file(resolved_path);
+  QString name = QFileInfo(resolved_path).fileName();
   QString desc;
   QSet<int> player_ids;
 
@@ -213,9 +213,9 @@ auto MapCatalog::loadSingleMap(const QString &path) -> QVariantMap {
 
       if (obj.contains(SPAWNS) && obj[SPAWNS].isArray()) {
         QJsonArray const spawns = obj[SPAWNS].toArray();
-        for (const QJsonValue &spawnVal : spawns) {
-          if (spawnVal.isObject()) {
-            QJsonObject spawn = spawnVal.toObject();
+        for (const QJsonValue &spawn_val : spawns) {
+          if (spawn_val.isObject()) {
+            QJsonObject spawn = spawn_val.toObject();
             if (spawn.contains(PLAYER_ID)) {
               int const player_id = spawn[PLAYER_ID].toInt();
               if (player_id > 0) {
@@ -231,16 +231,16 @@ auto MapCatalog::loadSingleMap(const QString &path) -> QVariantMap {
   QVariantMap entry;
   entry[NAME] = name;
   entry[DESCRIPTION] = desc;
-  entry["path"] = resolvedPath;
+  entry["path"] = resolved_path;
   entry["playerCount"] = player_ids.size();
 
-  QVariantList player_idList;
-  QList<int> sortedIds = player_ids.values();
-  std::sort(sortedIds.begin(), sortedIds.end());
-  for (int const id : sortedIds) {
-    player_idList.append(id);
+  QVariantList player_id_list;
+  QList<int> sorted_ids = player_ids.values();
+  std::sort(sorted_ids.begin(), sorted_ids.end());
+  for (int const id : sorted_ids) {
+    player_id_list.append(id);
   }
-  entry["player_ids"] = player_idList;
+  entry["player_ids"] = player_id_list;
 
   QString thumbnail;
   if (file.open(QIODevice::ReadOnly)) {
@@ -256,12 +256,12 @@ auto MapCatalog::loadSingleMap(const QString &path) -> QVariantMap {
     }
   }
   if (thumbnail.isEmpty()) {
-    QString const baseName = QFileInfo(resolvedPath).baseName();
-    QString const thumbCandidate = Utils::Resources::resolveResourcePath(
-        QString(":/assets/maps/%1_thumb.png").arg(baseName));
+    QString const base_name = QFileInfo(resolved_path).baseName();
+    QString const thumb_candidate = Utils::Resources::resolveResourcePath(
+        QString(":/assets/maps/%1_thumb.png").arg(base_name));
 
-    if (QFileInfo::exists(thumbCandidate)) {
-      thumbnail = thumbCandidate;
+    if (QFileInfo::exists(thumb_candidate)) {
+      thumbnail = thumb_candidate;
     } else {
       thumbnail = "";
     }

+ 4 - 4
game/map/map_transformer.cpp

@@ -65,7 +65,7 @@ auto MapTransformer::applyToWorld(
 
   auto &owner_registry = Game::Systems::OwnerRegistry::instance();
   std::set<int> unique_player_ids;
-  std::unordered_map<int, int> player_idToTeam;
+  std::unordered_map<int, int> player_id_to_team;
 
   for (const auto &spawn : def.spawns) {
     if (spawn.player_id == Game::Core::NEUTRAL_OWNER_ID) {
@@ -74,7 +74,7 @@ auto MapTransformer::applyToWorld(
     unique_player_ids.insert(spawn.player_id);
 
     if (spawn.team_id > 0) {
-      player_idToTeam[spawn.player_id] = spawn.team_id;
+      player_id_to_team[spawn.player_id] = spawn.team_id;
     }
   }
 
@@ -109,8 +109,8 @@ auto MapTransformer::applyToWorld(
       final_team_id = override_it->second;
     } else {
 
-      auto team_it = player_idToTeam.find(player_id);
-      if (team_it != player_idToTeam.end()) {
+      auto team_it = player_id_to_team.find(player_id);
+      if (team_it != player_id_to_team.end()) {
         final_team_id = team_it->second;
       } else {
       }

+ 13 - 13
game/map/skirmish_loader.cpp

@@ -213,9 +213,9 @@ auto SkirmishLoader::start(const QString &map_path,
     return result;
   }
 
-  constexpr float COLOR_SCALE = 255.0F;
-  constexpr int HEX_COLOR_LENGTH = 7;
-  constexpr int HEX_BASE = 16;
+  constexpr float color_scale = 255.0F;
+  constexpr int hex_color_length = 7;
+  constexpr int hex_base = 16;
 
   if (!saved_player_configs.isEmpty()) {
     for (const QVariant &config_var : saved_player_configs) {
@@ -224,13 +224,13 @@ auto SkirmishLoader::start(const QString &map_path,
       const QString color_hex = config.value("colorHex", "#FFFFFF").toString();
 
       if (player_id >= 0 && color_hex.startsWith("#") &&
-          color_hex.length() == HEX_COLOR_LENGTH) {
+          color_hex.length() == hex_color_length) {
         bool conversion_ok = false;
-        const int red = color_hex.mid(1, 2).toInt(&conversion_ok, HEX_BASE);
-        const int green = color_hex.mid(3, 2).toInt(&conversion_ok, HEX_BASE);
-        const int blue = color_hex.mid(5, 2).toInt(&conversion_ok, HEX_BASE);
-        owner_registry.setOwnerColor(player_id, red / COLOR_SCALE,
-                                     green / COLOR_SCALE, blue / COLOR_SCALE);
+        const int red = color_hex.mid(1, 2).toInt(&conversion_ok, hex_base);
+        const int green = color_hex.mid(3, 2).toInt(&conversion_ok, hex_base);
+        const int blue = color_hex.mid(5, 2).toInt(&conversion_ok, hex_base);
+        owner_registry.setOwnerColor(player_id, red / color_scale,
+                                     green / color_scale, blue / color_scale);
       }
     }
 
@@ -345,10 +345,10 @@ auto SkirmishLoader::start(const QString &map_path,
         std::vector<float> intensities;
         std::vector<float> radii;
 
-        const auto *heightMap = terrain_service.getHeightMap();
-        const float tile_size = heightMap->getTileSize();
-        const int width = heightMap->getWidth();
-        const int height = heightMap->getHeight();
+        const auto *height_map = terrain_service.getHeightMap();
+        const float tile_size = height_map->getTileSize();
+        const int width = height_map->getWidth();
+        const int height = height_map->getHeight();
         const float half_width = width * 0.5F;
         const float half_height = height * 0.5F;
 

+ 64 - 63
game/map/terrain.cpp

@@ -3,6 +3,7 @@
 #include <cmath>
 #include <cstddef>
 #include <cstdint>
+#include <math.h>
 #include <numbers>
 #include <vector>
 
@@ -81,24 +82,24 @@ void TerrainHeightMap::buildFromFeatures(
           std::max(grid_radius * 1.8F, grid_radius + 3.0F);
       const float minor_radius = std::max(grid_radius * 0.22F, 0.8F);
       const float bound = std::max(major_radius, minor_radius) + 2.0F;
-      const int minX = std::max(0, int(std::floor(grid_center_x - bound)));
-      const int maxX =
+      const int min_x = std::max(0, int(std::floor(grid_center_x - bound)));
+      const int max_x =
           std::min(m_width - 1, int(std::ceil(grid_center_x + bound)));
-      const int minZ = std::max(0, int(std::floor(grid_center_z - bound)));
-      const int maxZ =
+      const int min_z = std::max(0, int(std::floor(grid_center_z - bound)));
+      const int max_z =
           std::min(m_height - 1, int(std::ceil(grid_center_z + bound)));
 
       const float angle_rad = feature.rotationDeg * k_deg_to_rad;
-      const float cosA = std::cos(angle_rad);
-      const float sinA = std::sin(angle_rad);
+      const float cos_a = std::cos(angle_rad);
+      const float sin_a = std::sin(angle_rad);
 
-      for (int z = minZ; z <= maxZ; ++z) {
-        for (int x = minX; x <= maxX; ++x) {
+      for (int z = min_z; z <= max_z; ++z) {
+        for (int x = min_x; x <= max_x; ++x) {
           const float local_x = float(x) - grid_center_x;
           const float local_z = float(z) - grid_center_z;
 
-          const float rotated_x = local_x * cosA + local_z * sinA;
-          const float rotated_z = -local_x * sinA + local_z * cosA;
+          const float rotated_x = local_x * cos_a + local_z * sin_a;
+          const float rotated_z = -local_x * sin_a + local_z * cos_a;
 
           const float norm = std::sqrt(
               (rotated_x * rotated_x) / (major_radius * major_radius) +
@@ -135,29 +136,29 @@ void TerrainHeightMap::buildFromFeatures(
       const float slope_depth = std::max(plateau_depth + 1.5F, grid_depth);
 
       const float max_extent = std::max(slope_width, slope_depth);
-      const int minX =
+      const int min_x =
           std::max(0, int(std::floor(grid_center_x - max_extent - 1.0F)));
-      const int maxX = std::min(
+      const int max_x = std::min(
           m_width - 1, int(std::ceil(grid_center_x + max_extent + 1.0F)));
-      const int minZ =
+      const int min_z =
           std::max(0, int(std::floor(grid_center_z - max_extent - 1.0F)));
-      const int maxZ = std::min(
+      const int max_z = std::min(
           m_height - 1, int(std::ceil(grid_center_z + max_extent + 1.0F)));
 
       std::vector<int> plateau_cells;
       plateau_cells.reserve(int(M_PI * plateau_width * plateau_depth));
 
       const float angle_rad = feature.rotationDeg * k_deg_to_rad;
-      const float cosA = std::cos(angle_rad);
-      const float sinA = std::sin(angle_rad);
+      const float cos_a = std::cos(angle_rad);
+      const float sin_a = std::sin(angle_rad);
 
-      for (int z = minZ; z <= maxZ; ++z) {
-        for (int x = minX; x <= maxX; ++x) {
+      for (int z = min_z; z <= max_z; ++z) {
+        for (int x = min_x; x <= max_x; ++x) {
           const float dx = float(x) - grid_center_x;
           const float dz = float(z) - grid_center_z;
 
-          const float rotated_x = dx * cosA + dz * sinA;
-          const float rotated_z = -dx * sinA + dz * cosA;
+          const float rotated_x = dx * cos_a + dz * sin_a;
+          const float rotated_z = -dx * sin_a + dz * cos_a;
 
           const float norm_plateau_dist = std::sqrt(
               (rotated_x * rotated_x) / (plateau_width * plateau_width) +
@@ -207,23 +208,23 @@ void TerrainHeightMap::buildFromFeatures(
         m_hillEntrances[entrance_idx] = true;
         m_hillWalkable[entrance_idx] = true;
 
-        float dirX = grid_center_x - float(ex);
-        float dirZ = grid_center_z - float(ez);
-        float const length = std::sqrt(dirX * dirX + dirZ * dirZ);
+        float dir_x = grid_center_x - float(ex);
+        float dir_z = grid_center_z - float(ez);
+        float const length = std::sqrt(dir_x * dir_x + dir_z * dir_z);
         if (length < 0.001F) {
           continue;
         }
 
-        dirX /= length;
-        dirZ /= length;
+        dir_x /= length;
+        dir_z /= length;
 
-        auto curX = float(ex);
-        auto curZ = float(ez);
+        auto cur_x = float(ex);
+        auto cur_z = float(ez);
         const int steps = int(length) + 3;
 
         for (int step = 0; step < steps; ++step) {
-          int const ix = int(std::round(curX));
-          int const iz = int(std::round(curZ));
+          int const ix = int(std::round(cur_x));
+          int const iz = int(std::round(cur_z));
           if (!inBounds(ix, iz)) {
             break;
           }
@@ -232,8 +233,8 @@ void TerrainHeightMap::buildFromFeatures(
 
           const float cell_dx = float(ix) - grid_center_x;
           const float cell_dz = float(iz) - grid_center_z;
-          const float cell_rot_x = cell_dx * cosA + cell_dz * sinA;
-          const float cell_rot_z = -cell_dx * sinA + cell_dz * cosA;
+          const float cell_rot_x = cell_dx * cos_a + cell_dz * sin_a;
+          const float cell_rot_z = -cell_dx * sin_a + cell_dz * cos_a;
           const float cell_norm_dist = std::sqrt(
               (cell_rot_x * cell_rot_x) / (slope_width * slope_width) +
               (cell_rot_z * cell_rot_z) / (slope_depth * slope_depth));
@@ -264,24 +265,24 @@ void TerrainHeightMap::buildFromFeatures(
                 continue;
               }
 
-              const float nDx = float(nx) - grid_center_x;
-              const float nDz = float(nz) - grid_center_z;
-              const float n_rot_x = nDx * cosA + nDz * sinA;
-              const float n_rot_z = -nDx * sinA + nDz * cosA;
+              const float n_dx = float(nx) - grid_center_x;
+              const float n_dz = float(nz) - grid_center_z;
+              const float n_rot_x = n_dx * cos_a + n_dz * sin_a;
+              const float n_rot_z = -n_dx * sin_a + n_dz * cos_a;
               const float neighbor_norm_dist =
                   std::sqrt((n_rot_x * n_rot_x) / (slope_width * slope_width) +
                             (n_rot_z * n_rot_z) / (slope_depth * slope_depth));
 
               if (neighbor_norm_dist <= 1.05F) {
-                int const nIdx = indexAt(nx, nz);
-                if (m_terrain_types[nIdx] != TerrainType::Mountain) {
-                  m_hillWalkable[nIdx] = true;
-                  if (m_terrain_types[nIdx] == TerrainType::Flat) {
-                    m_terrain_types[nIdx] = TerrainType::Hill;
+                int const n_idx = indexAt(nx, nz);
+                if (m_terrain_types[n_idx] != TerrainType::Mountain) {
+                  m_hillWalkable[n_idx] = true;
+                  if (m_terrain_types[n_idx] == TerrainType::Flat) {
+                    m_terrain_types[n_idx] = TerrainType::Hill;
                   }
-                  if (m_heights[nIdx] < m_heights[idx] * 0.8F) {
-                    m_heights[nIdx] =
-                        std::max(m_heights[nIdx], m_heights[idx] * 0.7F);
+                  if (m_heights[n_idx] < m_heights[idx] * 0.8F) {
+                    m_heights[n_idx] =
+                        std::max(m_heights[n_idx], m_heights[idx] * 0.7F);
                   }
                 }
               }
@@ -295,8 +296,8 @@ void TerrainHeightMap::buildFromFeatures(
             break;
           }
 
-          curX += dirX;
-          curZ += dirZ;
+          cur_x += dir_x;
+          cur_z += dir_z;
         }
       }
 
@@ -304,15 +305,15 @@ void TerrainHeightMap::buildFromFeatures(
     }
 
     const float flat_radius = grid_radius;
-    const int minX = std::max(0, int(std::floor(grid_center_x - flat_radius)));
-    const int maxX =
+    const int min_x = std::max(0, int(std::floor(grid_center_x - flat_radius)));
+    const int max_x =
         std::min(m_width - 1, int(std::ceil(grid_center_x + flat_radius)));
-    const int minZ = std::max(0, int(std::floor(grid_center_z - flat_radius)));
-    const int maxZ =
+    const int min_z = std::max(0, int(std::floor(grid_center_z - flat_radius)));
+    const int max_z =
         std::min(m_height - 1, int(std::ceil(grid_center_z + flat_radius)));
 
-    for (int z = minZ; z <= maxZ; ++z) {
-      for (int x = minX; x <= maxX; ++x) {
+    for (int z = min_z; z <= max_z; ++z) {
+      for (int x = min_x; x <= max_x; ++x) {
         const float dx = float(x) - grid_center_x;
         const float dz = float(z) - grid_center_z;
         const float dist = std::sqrt(dx * dx + dz * dz);
@@ -538,19 +539,19 @@ void TerrainHeightMap::addRiverSegments(
 
       float const half_width = river.width * 0.5F / m_tile_size;
 
-      int const minX = std::max(
+      int const min_x = std::max(
           0, static_cast<int>(std::floor(grid_center_x - half_width - 1.0F)));
-      int const maxX = std::min(
+      int const max_x = std::min(
           m_width - 1,
           static_cast<int>(std::ceil(grid_center_x + half_width + 1.0F)));
-      int const minZ = std::max(
+      int const min_z = std::max(
           0, static_cast<int>(std::floor(grid_center_z - half_width - 1.0F)));
-      int const maxZ = std::min(
+      int const max_z = std::min(
           m_height - 1,
           static_cast<int>(std::ceil(grid_center_z + half_width + 1.0F)));
 
-      for (int z = minZ; z <= maxZ; ++z) {
-        for (int x = minX; x <= maxX; ++x) {
+      for (int z = min_z; z <= max_z; ++z) {
+        for (int x = min_x; x <= max_x; ++x) {
           float const dx = static_cast<float>(x) - grid_center_x;
           float const dz = static_cast<float>(z) - grid_center_z;
 
@@ -605,18 +606,18 @@ void TerrainHeightMap::addBridges(const std::vector<Bridge> &bridges) {
 
       float const half_width = bridge.width * 0.5F / m_tile_size;
 
-      int const minX =
+      int const min_x =
           std::max(0, static_cast<int>(std::floor(grid_center_x - half_width)));
-      int const maxX = std::min(
+      int const max_x = std::min(
           m_width - 1, static_cast<int>(std::ceil(grid_center_x + half_width)));
-      int const minZ =
+      int const min_z =
           std::max(0, static_cast<int>(std::floor(grid_center_z - half_width)));
-      int const maxZ =
+      int const max_z =
           std::min(m_height - 1,
                    static_cast<int>(std::ceil(grid_center_z + half_width)));
 
-      for (int z = minZ; z <= maxZ; ++z) {
-        for (int x = minX; x <= maxX; ++x) {
+      for (int z = min_z; z <= max_z; ++z) {
+        for (int x = min_x; x <= max_x; ++x) {
           float const dx = static_cast<float>(x) - grid_center_x;
           float const dz = static_cast<float>(z) - grid_center_z;
 

+ 2 - 0
game/systems/ai_system.cpp

@@ -7,6 +7,8 @@
 #include "ai_system/behaviors/retreat_behavior.h"
 #include "core/event_manager.h"
 #include "owner_registry.h"
+#include "systems/ai_system/ai_command_applier.h"
+#include "systems/ai_system/ai_snapshot_builder.h"
 #include "systems/ai_system/ai_types.h"
 #include "systems/ai_system/ai_worker.h"
 #include <cstdint>

+ 2 - 2
game/systems/ai_system/ai_reasoner.h

@@ -12,9 +12,9 @@ public:
   AIReasoner(const AIReasoner &) = delete;
   auto operator=(const AIReasoner &) -> AIReasoner & = delete;
 
-  static void updateContext(const AISnapshot &snapshot, AIContext &context);
+  static void updateContext(const AISnapshot &snapshot, AIContext &ctx);
 
-  static void updateStateMachine(AIContext &context, float deltaTime);
+  static void updateStateMachine(AIContext &ctx, float deltaTime);
 };
 
 } // namespace Game::Systems::AI

+ 1 - 1
game/systems/ai_system/ai_tactical.cpp

@@ -73,7 +73,7 @@ auto TacticalUtils::assessEngagement(
 }
 
 auto TacticalUtils::selectFocusFireTarget(
-    const std::vector<const EntitySnapshot *> &attackers,
+    const std::vector<const EntitySnapshot *> &,
     const std::vector<const ContactSnapshot *> &enemies, float group_center_x,
     float group_center_y, float group_center_z, const AIContext &context,
     Engine::Core::EntityID currentTarget) -> TacticalUtils::TargetScore {

+ 1 - 1
game/systems/arrow_system.cpp

@@ -26,7 +26,7 @@ void ArrowSystem::spawnArrow(const QVector3D &start, const QVector3D &end,
   m_arrows.push_back(a);
 }
 
-void ArrowSystem::update(Engine::Core::World *world, float deltaTime) {
+void ArrowSystem::update(Engine::Core::World *, float deltaTime) {
   for (auto &arrow : m_arrows) {
     if (!arrow.active) {
       continue;

+ 5 - 5
game/systems/building_collision_registry.cpp

@@ -117,12 +117,12 @@ auto BuildingCollisionRegistry::isPointInBuilding(
     float const half_width = building.width / 2.0F;
     float const half_depth = building.depth / 2.0F;
 
-    float const minX = building.center_x - half_width;
-    float const maxX = building.center_x + half_width;
-    float const minZ = building.center_z - half_depth;
-    float const maxZ = building.center_z + half_depth;
+    float const min_x = building.center_x - half_width;
+    float const max_x = building.center_x + half_width;
+    float const min_z = building.center_z - half_depth;
+    float const max_z = building.center_z + half_depth;
 
-    if (x >= minX && x <= maxX && z >= minZ && z <= maxZ) {
+    if (x >= min_x && x <= max_x && z >= min_z && z <= max_z) {
       return true;
     }
   }

+ 1 - 1
game/systems/capture_system.cpp

@@ -56,7 +56,7 @@ auto CaptureSystem::countNearbyTroops(Engine::Core::World *world,
   return total_troops;
 }
 
-void CaptureSystem::transferBarrackOwnership(Engine::Core::World *world,
+void CaptureSystem::transferBarrackOwnership(Engine::Core::World *,
                                              Engine::Core::Entity *barrack,
                                              int newOwnerId) {
   auto *unit = barrack->getComponent<Engine::Core::UnitComponent>();

+ 1 - 1
game/systems/cleanup_system.cpp

@@ -6,7 +6,7 @@
 
 namespace Game::Systems {
 
-void CleanupSystem::update(Engine::Core::World *world, float deltaTime) {
+void CleanupSystem::update(Engine::Core::World *world, float) {
   removeDeadEntities(world);
 }
 

+ 63 - 59
game/systems/combat_system.cpp

@@ -65,12 +65,12 @@ void CombatSystem::processAttacks(Engine::Core::World *world, float deltaTime) {
           attacker_atk->meleeLockTargetId = 0;
         } else {
 
-          auto *attT = attacker_transform;
-          auto *tgtT =
+          auto *att_t = attacker_transform;
+          auto *tgt_t =
               lock_target->getComponent<Engine::Core::TransformComponent>();
-          if ((attT != nullptr) && (tgtT != nullptr)) {
-            float const dx = tgtT->position.x - attT->position.x;
-            float const dz = tgtT->position.z - attT->position.z;
+          if ((att_t != nullptr) && (tgt_t != nullptr)) {
+            float const dx = tgt_t->position.x - att_t->position.x;
+            float const dz = tgt_t->position.z - att_t->position.z;
             float const dist = std::sqrt(dx * dx + dz * dz);
 
             const float ideal_melee_distance = 0.6F;
@@ -83,8 +83,8 @@ void CombatSystem::processAttacks(Engine::Core::World *world, float deltaTime) {
               if (dist > 0.001F) {
                 QVector3D const direction(dx / dist, 0.0F, dz / dist);
 
-                attT->position.x += direction.x() * pull_amount;
-                attT->position.z += direction.z() * pull_amount;
+                att_t->position.x += direction.x() * pull_amount;
+                att_t->position.z += direction.z() * pull_amount;
               }
             }
           }
@@ -195,18 +195,18 @@ void CombatSystem::processAttacks(Engine::Core::World *world, float deltaTime) {
               }
             }
 
-            if (auto *attT =
+            if (auto *att_t =
                     attacker
                         ->getComponent<Engine::Core::TransformComponent>()) {
-              if (auto *tgtT =
+              if (auto *tgt_t =
                       target
                           ->getComponent<Engine::Core::TransformComponent>()) {
-                float const dx = tgtT->position.x - attT->position.x;
-                float const dz = tgtT->position.z - attT->position.z;
+                float const dx = tgt_t->position.x - att_t->position.x;
+                float const dz = tgt_t->position.z - att_t->position.z;
                 float const yaw =
                     std::atan2(dx, dz) * 180.0F / std::numbers::pi_v<float>;
-                attT->desiredYaw = yaw;
-                attT->hasDesiredYaw = true;
+                att_t->desiredYaw = yaw;
+                att_t->hasDesiredYaw = true;
               }
             }
           } else if (attack_target->shouldChase) {
@@ -238,13 +238,13 @@ void CombatSystem::processAttacks(Engine::Core::World *world, float deltaTime) {
                 movement->vx = 0.0F;
                 movement->vz = 0.0F;
                 movement->path.clear();
-                auto *attacker_transformComponent =
+                auto *attacker_transform_component =
                     attacker->getComponent<Engine::Core::TransformComponent>();
-                if (attacker_transformComponent != nullptr) {
-                  movement->target_x = attacker_transformComponent->position.x;
-                  movement->target_y = attacker_transformComponent->position.z;
-                  movement->goalX = attacker_transformComponent->position.x;
-                  movement->goalY = attacker_transformComponent->position.z;
+                if (attacker_transform_component != nullptr) {
+                  movement->target_x = attacker_transform_component->position.x;
+                  movement->target_y = attacker_transform_component->position.z;
+                  movement->goalX = attacker_transform_component->position.x;
+                  movement->goalY = attacker_transform_component->position.z;
                 }
               }
               best_target = target;
@@ -252,13 +252,13 @@ void CombatSystem::processAttacks(Engine::Core::World *world, float deltaTime) {
 
               auto *target_transform =
                   target->getComponent<Engine::Core::TransformComponent>();
-              auto *attacker_transformComponent =
+              auto *attacker_transform_component =
                   attacker->getComponent<Engine::Core::TransformComponent>();
               if ((target_transform != nullptr) &&
-                  (attacker_transformComponent != nullptr)) {
+                  (attacker_transform_component != nullptr)) {
                 QVector3D const attacker_pos(
-                    attacker_transformComponent->position.x, 0.0F,
-                    attacker_transformComponent->position.z);
+                    attacker_transform_component->position.x, 0.0F,
+                    attacker_transform_component->position.z);
                 QVector3D const target_pos(target_transform->position.x, 0.0F,
                                            target_transform->position.z);
                 QVector3D desired_pos = target_pos;
@@ -311,13 +311,15 @@ void CombatSystem::processAttacks(Engine::Core::World *world, float deltaTime) {
                     movement->vx = 0.0F;
                     movement->vz = 0.0F;
                     movement->path.clear();
-                    if (attacker_transformComponent != nullptr) {
+                    if (attacker_transform_component != nullptr) {
                       movement->target_x =
-                          attacker_transformComponent->position.x;
+                          attacker_transform_component->position.x;
                       movement->target_y =
-                          attacker_transformComponent->position.z;
-                      movement->goalX = attacker_transformComponent->position.x;
-                      movement->goalY = attacker_transformComponent->position.z;
+                          attacker_transform_component->position.z;
+                      movement->goalX =
+                          attacker_transform_component->position.x;
+                      movement->goalY =
+                          attacker_transform_component->position.z;
                     }
                   } else {
                     QVector3D planned_target(movement->target_x, 0.0F,
@@ -444,43 +446,44 @@ void CombatSystem::processAttacks(Engine::Core::World *world, float deltaTime) {
         }
       }
 
-      if (auto *attT =
+      if (auto *att_t =
               attacker->getComponent<Engine::Core::TransformComponent>()) {
-        if (auto *tgtT =
+        if (auto *tgt_t =
                 best_target->getComponent<Engine::Core::TransformComponent>()) {
-          float const dx = tgtT->position.x - attT->position.x;
-          float const dz = tgtT->position.z - attT->position.z;
+          float const dx = tgt_t->position.x - att_t->position.x;
+          float const dz = tgt_t->position.z - att_t->position.z;
           float const yaw =
               std::atan2(dx, dz) * 180.0F / std::numbers::pi_v<float>;
-          attT->desiredYaw = yaw;
-          attT->hasDesiredYaw = true;
+          att_t->desiredYaw = yaw;
+          att_t->hasDesiredYaw = true;
         }
       }
 
       if (arrow_sys != nullptr) {
-        auto *attT = attacker->getComponent<Engine::Core::TransformComponent>();
-        auto *tgtT =
+        auto *att_t =
+            attacker->getComponent<Engine::Core::TransformComponent>();
+        auto *tgt_t =
             best_target->getComponent<Engine::Core::TransformComponent>();
-        auto *attU = attacker->getComponent<Engine::Core::UnitComponent>();
+        auto *att_u = attacker->getComponent<Engine::Core::UnitComponent>();
 
         if ((attacker_atk == nullptr) ||
             attacker_atk->currentMode !=
                 Engine::Core::AttackComponent::CombatMode::Melee) {
-          QVector3D const aPos(attT->position.x, attT->position.y,
-                               attT->position.z);
-          QVector3D const tPos(tgtT->position.x, tgtT->position.y,
-                               tgtT->position.z);
-          QVector3D const dir = (tPos - aPos).normalized();
+          QVector3D const a_pos(att_t->position.x, att_t->position.y,
+                                att_t->position.z);
+          QVector3D const t_pos(tgt_t->position.x, tgt_t->position.y,
+                                tgt_t->position.z);
+          QVector3D const dir = (t_pos - a_pos).normalized();
           QVector3D const color =
-              (attU != nullptr)
-                  ? Game::Visuals::team_colorForOwner(attU->owner_id)
+              (att_u != nullptr)
+                  ? Game::Visuals::team_colorForOwner(att_u->owner_id)
                   : QVector3D(0.8F, 0.9F, 1.0F);
 
           int arrow_count = 1;
-          if (attU != nullptr) {
+          if (att_u != nullptr) {
             int const troop_size =
                 Game::Units::TroopConfig::instance().getIndividualsPerUnit(
-                    attU->spawn_type);
+                    att_u->spawn_type);
             int const max_arrows = std::max(1, troop_size / 3);
 
             static thread_local std::mt19937 gen(std::random_device{}());
@@ -505,10 +508,10 @@ void CombatSystem::processAttacks(Engine::Core::World *world, float deltaTime) {
                                          up_vector * vertical_offset +
                                          dir * depth_offset;
 
-            QVector3D const start =
-                aPos + QVector3D(0.0F, 0.6F, 0.0F) + dir * 0.35F + start_offset;
+            QVector3D const start = a_pos + QVector3D(0.0F, 0.6F, 0.0F) +
+                                    dir * 0.35F + start_offset;
             QVector3D const end =
-                tPos + QVector3D(0.5F, 0.5F, 0.0F) + end_offset;
+                t_pos + QVector3D(0.5F, 0.5F, 0.0F) + end_offset;
 
             arrow_sys->spawnArrow(start, end, color, 14.0F);
           }
@@ -529,12 +532,13 @@ void CombatSystem::processAttacks(Engine::Core::World *world, float deltaTime) {
           target_atk->meleeLockTargetId = attacker->getId();
         }
 
-        auto *attT = attacker->getComponent<Engine::Core::TransformComponent>();
-        auto *tgtT =
+        auto *att_t =
+            attacker->getComponent<Engine::Core::TransformComponent>();
+        auto *tgt_t =
             best_target->getComponent<Engine::Core::TransformComponent>();
-        if ((attT != nullptr) && (tgtT != nullptr)) {
-          float const dx = tgtT->position.x - attT->position.x;
-          float const dz = tgtT->position.z - attT->position.z;
+        if ((att_t != nullptr) && (tgt_t != nullptr)) {
+          float const dx = tgt_t->position.x - att_t->position.x;
+          float const dz = tgt_t->position.z - att_t->position.z;
           float const dist = std::sqrt(dx * dx + dz * dz);
 
           const float ideal_melee_distance = 0.6F;
@@ -546,11 +550,11 @@ void CombatSystem::processAttacks(Engine::Core::World *world, float deltaTime) {
             if (dist > 0.001F) {
               QVector3D const direction(dx / dist, 0.0F, dz / dist);
 
-              attT->position.x += direction.x() * move_amount;
-              attT->position.z += direction.z() * move_amount;
+              att_t->position.x += direction.x() * move_amount;
+              att_t->position.z += direction.z() * move_amount;
 
-              tgtT->position.x -= direction.x() * move_amount;
-              tgtT->position.z -= direction.z() * move_amount;
+              tgt_t->position.x -= direction.x() * move_amount;
+              tgt_t->position.z -= direction.z() * move_amount;
             }
           }
         }
@@ -888,7 +892,7 @@ auto CombatSystem::isUnitIdle(Engine::Core::Entity *unit) -> bool {
   }
 
   auto *patrol = unit->getComponent<Engine::Core::PatrolComponent>();
-  return !((patrol != nullptr) && patrol->patrolling);
+  return (patrol == nullptr) || !patrol->patrolling;
 }
 
 auto CombatSystem::findNearestEnemy(Engine::Core::Entity *unit,

+ 1 - 1
game/systems/game_state_serializer.cpp

@@ -12,7 +12,7 @@
 namespace Game::Systems {
 
 auto GameStateSerializer::buildMetadata(
-    const Engine::Core::World &world, const Render::GL::Camera *camera,
+    const Engine::Core::World &, const Render::GL::Camera *camera,
     const LevelSnapshot &level, const RuntimeSnapshot &runtime) -> QJsonObject {
 
   QJsonObject metadata;

+ 8 - 8
game/systems/movement_system.cpp

@@ -292,14 +292,14 @@ void MovementSystem::moveUnit(Engine::Core::Entity *entity,
 
     float const arrive_radius =
         std::clamp(max_speed * deltaTime * 2.0F, 0.05F, 0.25F);
-    float const arrive_radiusSq = arrive_radius * arrive_radius;
+    float const arrive_radius_sq = arrive_radius * arrive_radius;
 
     float dx = movement->target_x - transform->position.x;
     float dz = movement->target_y - transform->position.z;
     float dist2 = dx * dx + dz * dz;
 
     int safety_counter = max_waypoint_skip_count;
-    while (movement->hasTarget && dist2 < arrive_radiusSq &&
+    while (movement->hasTarget && dist2 < arrive_radius_sq &&
            safety_counter-- > 0) {
       if (!movement->path.empty()) {
         movement->path.erase(movement->path.begin());
@@ -358,12 +358,12 @@ void MovementSystem::moveUnit(Engine::Core::Entity *entity,
       if (w > 0 && h > 0) {
         const float half_w = w * 0.5F - 0.5F;
         const float half_h = h * 0.5F - 0.5F;
-        const float minX = -half_w * tile;
-        const float maxX = half_w * tile;
-        const float minZ = -half_h * tile;
-        const float maxZ = half_h * tile;
-        transform->position.x = std::clamp(transform->position.x, minX, maxX);
-        transform->position.z = std::clamp(transform->position.z, minZ, maxZ);
+        const float min_x = -half_w * tile;
+        const float max_x = half_w * tile;
+        const float min_z = -half_h * tile;
+        const float max_z = half_h * tile;
+        transform->position.x = std::clamp(transform->position.x, min_x, max_x);
+        transform->position.z = std::clamp(transform->position.z, min_z, max_z);
       }
     }
   }

+ 1 - 1
game/systems/patrol_system.cpp

@@ -6,7 +6,7 @@
 
 namespace Game::Systems {
 
-void PatrolSystem::update(Engine::Core::World *world, float deltaTime) {
+void PatrolSystem::update(Engine::Core::World *world, float) {
   if (world == nullptr) {
     return;
   }

+ 30 - 28
game/systems/picking_service.cpp

@@ -41,17 +41,17 @@ auto PickingService::projectBounds(const Render::GL::Camera &cam,
       return false;
     }
   }
-  qreal minX = screen_pts[0].x();
-  qreal maxX = screen_pts[0].x();
-  qreal minY = screen_pts[0].y();
-  qreal maxY = screen_pts[0].y();
+  qreal min_x = screen_pts[0].x();
+  qreal max_x = screen_pts[0].x();
+  qreal min_y = screen_pts[0].y();
+  qreal max_y = screen_pts[0].y();
   for (int i = 1; i < 4; ++i) {
-    minX = std::min(minX, screen_pts[i].x());
-    maxX = std::max(maxX, screen_pts[i].x());
-    minY = std::min(minY, screen_pts[i].y());
-    maxY = std::max(maxY, screen_pts[i].y());
+    min_x = std::min(min_x, screen_pts[i].x());
+    max_x = std::max(max_x, screen_pts[i].x());
+    min_y = std::min(min_y, screen_pts[i].y());
+    max_y = std::max(max_y, screen_pts[i].y());
   }
-  out = QRectF(QPointF(minX, minY), QPointF(maxX, maxY));
+  out = QRectF(QPointF(min_x, min_y), QPointF(max_x, max_y));
   return true;
 }
 
@@ -119,10 +119,10 @@ auto PickingService::pickSingle(
     if (e->hasComponent<Engine::Core::BuildingComponent>()) {
       bool hit = false;
       float pick_dist2 = d2;
-      const float margin_xZ = 1.6F;
+      const float margin_x_z = 1.6F;
       const float margin_y = 1.2F;
-      float const hx = std::max(0.6F, t->scale.x * margin_xZ);
-      float const hz = std::max(0.6F, t->scale.z * margin_xZ);
+      float const hx = std::max(0.6F, t->scale.x * margin_x_z);
+      float const hz = std::max(0.6F, t->scale.z * margin_x_z);
       float const hy = std::max(0.5F, t->scale.y * margin_y);
       QPointF pts[8];
       int ok_count = 0;
@@ -158,24 +158,25 @@ auto PickingService::pickSingle(
           QVector3D(t->position.x - hx, t->position.y + hy, t->position.z + hz),
           pts[7]));
       if (ok_count == 8) {
-        qreal minX = pts[0].x();
-        qreal maxX = pts[0].x();
-        qreal minY = pts[0].y();
-        qreal maxY = pts[0].y();
+        qreal min_x = pts[0].x();
+        qreal max_x = pts[0].x();
+        qreal min_y = pts[0].y();
+        qreal max_y = pts[0].y();
         for (int i = 1; i < 8; ++i) {
-          minX = std::min(minX, pts[i].x());
-          maxX = std::max(maxX, pts[i].x());
-          minY = std::min(minY, pts[i].y());
-          maxY = std::max(maxY, pts[i].y());
+          min_x = std::min(min_x, pts[i].x());
+          max_x = std::max(max_x, pts[i].x());
+          min_y = std::min(min_y, pts[i].y());
+          max_y = std::max(max_y, pts[i].y());
         }
-        if (sx >= minX && sx <= maxX && sy >= minY && sy <= maxY) {
+        if (sx >= min_x && sx <= max_x && sy >= min_y && sy <= max_y) {
           hit = true;
           pick_dist2 = d2;
         }
       }
       if (!hit) {
-        float const scale_xZ = std::max(std::max(t->scale.x, t->scale.z), 1.0F);
-        float const rp = base_building_pick_radius * scale_xZ;
+        float const scale_x_z =
+            std::max(std::max(t->scale.x, t->scale.z), 1.0F);
+        float const rp = base_building_pick_radius * scale_x_z;
         float const r2 = rp * rp;
         if (d2 <= r2) {
           hit = true;
@@ -230,10 +231,10 @@ auto PickingService::pickInRect(
     float x1, float y1, float x2, float y2, Engine::Core::World &world,
     const Render::GL::Camera &camera, int viewW, int viewH,
     int ownerFilter) -> std::vector<Engine::Core::EntityID> {
-  float const minX = std::min(x1, x2);
-  float const maxX = std::max(x1, x2);
-  float const minY = std::min(y1, y2);
-  float const maxY = std::max(y1, y2);
+  float const min_x = std::min(x1, x2);
+  float const max_x = std::max(x1, x2);
+  float const min_y = std::min(y1, y2);
+  float const max_y = std::max(y1, y2);
   std::vector<Engine::Core::EntityID> picked;
   auto ents = world.getEntitiesWith<Engine::Core::TransformComponent>();
   for (auto *e : ents) {
@@ -254,7 +255,8 @@ auto PickingService::pickInRect(
             viewH, sp)) {
       continue;
     }
-    if (sp.x() >= minX && sp.x() <= maxX && sp.y() >= minY && sp.y() <= maxY) {
+    if (sp.x() >= min_x && sp.x() <= max_x && sp.y() >= min_y &&
+        sp.y() <= max_y) {
       picked.push_back(e->getId());
     }
   }

+ 22 - 21
game/systems/save_load_service.cpp

@@ -40,9 +40,9 @@ SaveLoadService::SaveLoadService() {
 SaveLoadService::~SaveLoadService() = default;
 
 auto SaveLoadService::getSavesDirectory() -> QString {
-  QString const savesPath =
+  QString const saves_path =
       QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
-  return savesPath + "/saves";
+  return saves_path + "/saves";
 }
 
 auto SaveLoadService::get_database_path() -> QString {
@@ -50,10 +50,10 @@ auto SaveLoadService::get_database_path() -> QString {
 }
 
 void SaveLoadService::ensureSavesDirectoryExists() {
-  QString const savesDir = getSavesDirectory();
+  QString const saves_dir = getSavesDirectory();
   QDir const dir;
-  if (!dir.exists(savesDir)) {
-    dir.mkpath(savesDir);
+  if (!dir.exists(saves_dir)) {
+    dir.mkpath(saves_dir);
   }
 }
 
@@ -72,30 +72,30 @@ auto SaveLoadService::saveGameToSlot(Engine::Core::World &world,
       return false;
     }
 
-    QJsonDocument const worldDoc =
+    QJsonDocument const world_doc =
         Engine::Core::Serialization::serializeWorld(&world);
-    const QByteArray worldBytes = worldDoc.toJson(QJsonDocument::Compact);
+    const QByteArray world_bytes = world_doc.toJson(QJsonDocument::Compact);
 
-    QJsonObject combinedMetadata = metadata;
-    combinedMetadata["slotName"] = slotName;
-    combinedMetadata["title"] = title;
-    combinedMetadata["timestamp"] =
+    QJsonObject combined_metadata = metadata;
+    combined_metadata["slotName"] = slotName;
+    combined_metadata["title"] = title;
+    combined_metadata["timestamp"] =
         QDateTime::currentDateTimeUtc().toString(Qt::ISODateWithMs);
-    if (!combinedMetadata.contains("map_name")) {
-      combinedMetadata["map_name"] =
+    if (!combined_metadata.contains("map_name")) {
+      combined_metadata["map_name"] =
           map_name.isEmpty() ? QStringLiteral("Unknown Map") : map_name;
     }
-    combinedMetadata["version"] = QStringLiteral("1.0");
+    combined_metadata["version"] = QStringLiteral("1.0");
 
     QString storage_error;
-    if (!m_storage->saveSlot(slotName, title, combinedMetadata, worldBytes,
+    if (!m_storage->saveSlot(slotName, title, combined_metadata, world_bytes,
                              screenshot, &storage_error)) {
       m_last_error = storage_error;
       qWarning() << "SaveLoadService: failed to persist slot" << storage_error;
       return false;
     }
 
-    m_lastMetadata = combinedMetadata;
+    m_lastMetadata = combined_metadata;
     m_lastTitle = title;
     m_lastScreenshot = screenshot;
     m_last_error.clear();
@@ -119,13 +119,13 @@ auto SaveLoadService::loadGameFromSlot(Engine::Core::World &world,
       return false;
     }
 
-    QByteArray worldBytes;
+    QByteArray world_bytes;
     QJsonObject metadata;
     QByteArray screenshot;
     QString title;
 
     QString load_error;
-    if (!m_storage->loadSlot(slotName, worldBytes, metadata, screenshot, title,
+    if (!m_storage->loadSlot(slotName, world_bytes, metadata, screenshot, title,
                              &load_error)) {
       m_last_error = load_error;
       qWarning() << "SaveLoadService: failed to load slot" << load_error;
@@ -133,7 +133,8 @@ auto SaveLoadService::loadGameFromSlot(Engine::Core::World &world,
     }
 
     QJsonParseError parse_error{};
-    QJsonDocument const doc = QJsonDocument::fromJson(worldBytes, &parse_error);
+    QJsonDocument const doc =
+        QJsonDocument::fromJson(world_bytes, &parse_error);
     if (parse_error.error != QJsonParseError::NoError || doc.isNull()) {
       m_last_error = QStringLiteral("Corrupted save data for slot '%1': %2")
                          .arg(slotName, parse_error.errorString());
@@ -163,14 +164,14 @@ auto SaveLoadService::getSaveSlots() const -> QVariantList {
   }
 
   QString list_error;
-  QVariantList slotList = m_storage->listSlots(&list_error);
+  QVariantList slot_list = m_storage->listSlots(&list_error);
   if (!list_error.isEmpty()) {
     m_last_error = list_error;
     qWarning() << "SaveLoadService: failed to enumerate slots" << list_error;
   } else {
     m_last_error.clear();
   }
-  return slotList;
+  return slot_list;
 }
 
 auto SaveLoadService::deleteSaveSlot(const QString &slotName) -> bool {

+ 1 - 2
game/systems/terrain_alignment_system.cpp

@@ -7,8 +7,7 @@
 
 namespace Game::Systems {
 
-void TerrainAlignmentSystem::update(Engine::Core::World *world,
-                                    float deltaTime) {
+void TerrainAlignmentSystem::update(Engine::Core::World *world, float) {
   auto &terrain_service = Game::Map::TerrainService::instance();
 
   if (!terrain_service.isInitialized()) {

+ 1 - 1
game/systems/victory_service.cpp

@@ -85,7 +85,7 @@ void VictoryService::update(Engine::Core::World &world, float deltaTime) {
 void VictoryService::onUnitDied(const Engine::Core::UnitDiedEvent &event) {}
 
 void VictoryService::onBarrackCaptured(
-    const Engine::Core::BarrackCapturedEvent &event) {
+    const Engine::Core::BarrackCapturedEvent &) {
 
   if ((m_worldPtr == nullptr) || !m_victoryState.isEmpty()) {
     return;

+ 1 - 1
game/visuals/visual_catalog.h

@@ -23,7 +23,7 @@ class VisualCatalog {
 public:
   auto loadFromJsonFile(const QString &path,
                         QString *out_error = nullptr) -> bool;
-  auto lookup(const std::string &unit_type, VisualDef &out) const -> bool;
+  auto lookup(const std::string &unitType, VisualDef &out) const -> bool;
 
 private:
   std::unordered_map<std::string, VisualDef> m_units;

+ 6 - 6
main.cpp

@@ -178,7 +178,7 @@ auto main(int argc, char *argv[]) -> int {
   // Setup message handler for debugging
   qInstallMessageHandler([](QtMsgType type, const QMessageLogContext &context,
                             const QString &msg) {
-    QByteArray const localMsg = msg.toLocal8Bit();
+    QByteArray const local_msg = msg.toLocal8Bit();
     const char *file = (context.file != nullptr) ? context.file : "";
     const char *function =
         (context.function != nullptr) ? context.function : "";
@@ -186,14 +186,14 @@ auto main(int argc, char *argv[]) -> int {
     FILE *out = stderr;
     switch (type) {
     case QtDebugMsg:
-      fprintf(out, "[DEBUG] %s (%s:%u, %s)\n", localMsg.constData(), file,
+      fprintf(out, "[DEBUG] %s (%s:%u, %s)\n", local_msg.constData(), file,
               context.line, function);
       break;
     case QtInfoMsg:
-      fprintf(out, "[INFO] %s\n", localMsg.constData());
+      fprintf(out, "[INFO] %s\n", local_msg.constData());
       break;
     case QtWarningMsg:
-      fprintf(out, "[WARNING] %s (%s:%u, %s)\n", localMsg.constData(), file,
+      fprintf(out, "[WARNING] %s (%s:%u, %s)\n", local_msg.constData(), file,
               context.line, function);
       // Check for critical OpenGL warnings
       if (msg.contains("OpenGL", Qt::CaseInsensitive) ||
@@ -204,14 +204,14 @@ auto main(int argc, char *argv[]) -> int {
       }
       break;
     case QtCriticalMsg:
-      fprintf(out, "[CRITICAL] %s (%s:%u, %s)\n", localMsg.constData(), file,
+      fprintf(out, "[CRITICAL] %s (%s:%u, %s)\n", local_msg.constData(), file,
               context.line, function);
       fprintf(
           out,
           "[CRITICAL] Try running with software rendering if this persists\n");
       break;
     case QtFatalMsg:
-      fprintf(out, "[FATAL] %s (%s:%u, %s)\n", localMsg.constData(), file,
+      fprintf(out, "[FATAL] %s (%s:%u, %s)\n", local_msg.constData(), file,
               context.line, function);
       fprintf(out, "[FATAL] === RECOVERY SUGGESTION ===\n");
       fprintf(out, "[FATAL] Run: run_debug_softwaregl.cmd\n");

+ 31 - 31
render/entity/archer_renderer.cpp

@@ -64,14 +64,14 @@ public:
     v.palette = makeHumanoidPalette(team_tint, seed);
   }
 
-  void customizePose(const DrawContext &ctx, const AnimationInputs &anim,
+  void customizePose(const DrawContext &, const AnimationInputs &anim,
                      uint32_t seed, HumanoidPose &pose) const override {
     using HP = HumanProportions;
 
     float const arm_height_jitter = (hash_01(seed ^ 0xABCDU) - 0.5F) * 0.03F;
     float const arm_asymmetry = (hash_01(seed ^ 0xDEF0U) - 0.5F) * 0.04F;
 
-    float const bowX = 0.0F;
+    float const bow_x = 0.0F;
 
     if (anim.isInHoldMode || anim.isExitingHold) {
 
@@ -114,11 +114,11 @@ public:
       pose.neck_base.setZ(pose.neck_base.z() + forward_lean * 0.8F);
       pose.headPos.setZ(pose.headPos.z() + forward_lean * 0.7F);
 
-      QVector3D const hold_hand_l(bowX - 0.15F, pose.shoulderL.y() + 0.30F,
+      QVector3D const hold_hand_l(bow_x - 0.15F, pose.shoulderL.y() + 0.30F,
                                   0.55F);
-      QVector3D const hold_hand_r(bowX + 0.12F, pose.shoulderR.y() + 0.15F,
+      QVector3D const hold_hand_r(bow_x + 0.12F, pose.shoulderR.y() + 0.15F,
                                   0.10F);
-      QVector3D const normal_hand_l(bowX - 0.05F + arm_asymmetry,
+      QVector3D const normal_hand_l(bow_x - 0.05F + arm_asymmetry,
                                     HP::SHOULDER_Y + 0.05F + arm_height_jitter,
                                     0.55F);
       QVector3D const normal_hand_r(
@@ -128,7 +128,7 @@ public:
       pose.handL = normal_hand_l * (1.0F - t) + hold_hand_l * t;
       pose.hand_r = normal_hand_r * (1.0F - t) + hold_hand_r * t;
     } else {
-      pose.handL = QVector3D(bowX - 0.05F + arm_asymmetry,
+      pose.handL = QVector3D(bow_x - 0.05F + arm_asymmetry,
                              HP::SHOULDER_Y + 0.05F + arm_height_jitter, 0.55F);
       pose.hand_r =
           QVector3D(0.15F - arm_asymmetry * 0.5F,
@@ -175,14 +175,14 @@ public:
           float t = attack_phase / 0.20F;
           t = t * t;
           pose.hand_r = aim_pos * (1.0F - t) + draw_pos * t;
-          pose.handL = QVector3D(bowX - 0.05F, HP::SHOULDER_Y + 0.05F, 0.55F);
+          pose.handL = QVector3D(bow_x - 0.05F, HP::SHOULDER_Y + 0.05F, 0.55F);
 
           float const shoulder_twist = t * 0.08F;
           pose.shoulderR.setY(pose.shoulderR.y() + shoulder_twist);
           pose.shoulderL.setY(pose.shoulderL.y() - shoulder_twist * 0.5F);
         } else if (attack_phase < 0.50F) {
           pose.hand_r = draw_pos;
-          pose.handL = QVector3D(bowX - 0.05F, HP::SHOULDER_Y + 0.05F, 0.55F);
+          pose.handL = QVector3D(bow_x - 0.05F, HP::SHOULDER_Y + 0.05F, 0.55F);
 
           float const shoulder_twist = 0.08F;
           pose.shoulderR.setY(pose.shoulderR.y() + shoulder_twist);
@@ -191,7 +191,7 @@ public:
           float t = (attack_phase - 0.50F) / 0.08F;
           t = t * t * t;
           pose.hand_r = draw_pos * (1.0F - t) + release_pos * t;
-          pose.handL = QVector3D(bowX - 0.05F, HP::SHOULDER_Y + 0.05F, 0.55F);
+          pose.handL = QVector3D(bow_x - 0.05F, HP::SHOULDER_Y + 0.05F, 0.55F);
 
           float const shoulder_twist = 0.08F * (1.0F - t * 0.6F);
           pose.shoulderR.setY(pose.shoulderR.y() + shoulder_twist);
@@ -202,7 +202,7 @@ public:
           float t = (attack_phase - 0.58F) / 0.42F;
           t = 1.0F - (1.0F - t) * (1.0F - t);
           pose.hand_r = release_pos * (1.0F - t) + aim_pos * t;
-          pose.handL = QVector3D(bowX - 0.05F, HP::SHOULDER_Y + 0.05F, 0.55F);
+          pose.handL = QVector3D(bow_x - 0.05F, HP::SHOULDER_Y + 0.05F, 0.55F);
 
           float const shoulder_twist = 0.08F * 0.4F * (1.0F - t);
           pose.shoulderR.setY(pose.shoulderR.y() + shoulder_twist);
@@ -358,8 +358,8 @@ public:
 
   void draw_armorOverlay(const DrawContext &ctx, const HumanoidVariant &v,
                          const HumanoidPose &pose, float y_top_cover,
-                         float torso_r, float shoulder_half_span,
-                         float upper_arm_r, const QVector3D &right_axis,
+                         float torso_r, float, float upper_arm_r,
+                         const QVector3D &right_axis,
                          ISubmitter &out) const override {
     using HP = HumanProportions;
 
@@ -379,35 +379,35 @@ public:
     QVector3D const mail_top(0, y_top_cover + 0.01F, 0);
     QVector3D const mail_mid(0, (y_top_cover + waist_y) * 0.5F, 0);
     QVector3D const mail_bot(0, waist_y + 0.08F, 0);
-    float const rTop = torso_r * 1.10F;
-    float const rMid = torso_r * 1.08F;
+    float const r_top = torso_r * 1.10F;
+    float const r_mid = torso_r * 1.08F;
 
     out.mesh(getUnitCylinder(),
-             cylinderBetween(ctx.model, mail_top, mail_mid, rTop), mail_color,
+             cylinderBetween(ctx.model, mail_top, mail_mid, r_top), mail_color,
              nullptr, 1.0F);
 
     out.mesh(getUnitCylinder(),
-             cylinderBetween(ctx.model, mail_mid, mail_bot, rMid),
+             cylinderBetween(ctx.model, mail_mid, mail_bot, r_mid),
              mail_color * 0.95F, nullptr, 1.0F);
 
     for (int i = 0; i < 3; ++i) {
       float const y = mail_top.y() - (i * 0.12F);
-      ring(QVector3D(0, y, 0), rTop * (1.01F + i * 0.005F), 0.012F,
+      ring(QVector3D(0, y, 0), r_top * (1.01F + i * 0.005F), 0.012F,
            leather_trim);
     }
 
     auto draw_pauldron = [&](const QVector3D &shoulder,
                              const QVector3D &outward) {
       for (int i = 0; i < 3; ++i) {
-        float const segY = shoulder.y() + 0.02F - i * 0.035F;
-        float const segR = upper_arm_r * (2.2F - i * 0.15F);
-        QVector3D seg_top(shoulder.x(), segY + 0.025F, shoulder.z());
-        QVector3D seg_bot(shoulder.x(), segY - 0.010F, shoulder.z());
+        float const seg_y = shoulder.y() + 0.02F - i * 0.035F;
+        float const seg_r = upper_arm_r * (2.2F - i * 0.15F);
+        QVector3D seg_top(shoulder.x(), seg_y + 0.025F, shoulder.z());
+        QVector3D seg_bot(shoulder.x(), seg_y - 0.010F, shoulder.z());
 
         seg_top += outward * 0.02F;
         seg_bot += outward * 0.02F;
 
-        out.mesh(getUnitSphere(), sphereAt(ctx.model, seg_top, segR),
+        out.mesh(getUnitSphere(), sphereAt(ctx.model, seg_top, seg_r),
                  mail_color * (1.0F - i * 0.05F), nullptr, 1.0F);
       }
     };
@@ -485,8 +485,8 @@ public:
   }
 
   void drawShoulderDecorations(const DrawContext &ctx, const HumanoidVariant &v,
-                               const HumanoidPose &pose, float y_top_cover,
-                               float y_neck, const QVector3D &right_axis,
+                               const HumanoidPose &pose, float, float y_neck,
+                               const QVector3D &,
                                ISubmitter &out) const override {
     using HP = HumanProportions;
 
@@ -526,27 +526,27 @@ private:
 
     QVector3D const spine_mid = (pose.shoulderL + pose.shoulderR) * 0.5F;
     QVector3D const quiver_offset(-0.08F, 0.10F, -0.25F);
-    QVector3D const qTop = spine_mid + quiver_offset;
-    QVector3D const q_base = qTop + QVector3D(-0.02F, -0.30F, 0.03F);
+    QVector3D const q_top = spine_mid + quiver_offset;
+    QVector3D const q_base = q_top + QVector3D(-0.02F, -0.30F, 0.03F);
 
     float const quiver_r = HP::HEAD_RADIUS * 0.45F;
     out.mesh(getUnitCylinder(),
-             cylinderBetween(ctx.model, q_base, qTop, quiver_r),
+             cylinderBetween(ctx.model, q_base, q_top, quiver_r),
              v.palette.leather, nullptr, 1.0F);
 
     float const j = (hash_01(seed) - 0.5F) * 0.04F;
     float const k =
         (hash_01(seed ^ HashXorShift::k_golden_ratio) - 0.5F) * 0.04F;
 
-    QVector3D const a1 = qTop + QVector3D(0.00F + j, 0.08F, 0.00F + k);
-    out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, qTop, a1, 0.010F),
+    QVector3D const a1 = q_top + QVector3D(0.00F + j, 0.08F, 0.00F + k);
+    out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, q_top, a1, 0.010F),
              v.palette.wood, nullptr, 1.0F);
     out.mesh(getUnitCone(),
              coneFromTo(ctx.model, a1, a1 + QVector3D(0, 0.05F, 0), 0.025F),
              extras.fletch, nullptr, 1.0F);
 
-    QVector3D const a2 = qTop + QVector3D(0.02F - j, 0.07F, 0.02F - k);
-    out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, qTop, a2, 0.010F),
+    QVector3D const a2 = q_top + QVector3D(0.02F - j, 0.07F, 0.02F - k);
+    out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, q_top, a2, 0.010F),
              v.palette.wood, nullptr, 1.0F);
     out.mesh(getUnitCone(),
              coneFromTo(ctx.model, a2, a2 + QVector3D(0, 0.05F, 0), 0.025F),

+ 145 - 140
render/entity/barracks_renderer.cpp

@@ -22,7 +22,6 @@ using Render::Geom::clamp01;
 using Render::Geom::clampVec01;
 using Render::Geom::cylinderBetween;
 using Render::Geom::lerp;
-using Render::Geom::sphereAt;
 
 struct BuildingProportions {
   static constexpr float base_width = 2.4F;
@@ -88,18 +87,18 @@ inline void drawCylinder(ISubmitter &out, const QMatrix4x4 &model,
 inline void unitBox(ISubmitter &out, Mesh *unitMesh, Texture *white,
                     const QMatrix4x4 &model, const QVector3D &t,
                     const QVector3D &s, const QVector3D &color) {
-  QMatrix4x4 M = model;
-  M.translate(t);
-  M.scale(s);
-  out.mesh(unitMesh, M, color, white, 1.0F);
+  QMatrix4x4 m = model;
+  m.translate(t);
+  m.scale(s);
+  out.mesh(unitMesh, m, color, white, 1.0F);
 }
 
 inline void unitBox(ISubmitter &out, Mesh *unitMesh, Texture *white,
                     const QMatrix4x4 &model, const QVector3D &s,
                     const QVector3D &color) {
-  QMatrix4x4 M = model;
-  M.scale(s);
-  out.mesh(unitMesh, M, color, white, 1.0F);
+  QMatrix4x4 m = model;
+  m.scale(s);
+  out.mesh(unitMesh, m, color, white, 1.0F);
 }
 
 inline void drawFoundation(const DrawContext &p, ISubmitter &out, Mesh *unit,
@@ -136,26 +135,26 @@ inline void drawFoundation(const DrawContext &p, ISubmitter &out, Mesh *unit,
 
 inline void drawWalls(const DrawContext &p, ISubmitter &out, Mesh *,
                       Texture *white, const BarracksPalette &C) {
-  constexpr float W = BuildingProportions::base_width;
-  constexpr float D = BuildingProportions::base_depth;
-  constexpr float H = BuildingProportions::base_height;
+  constexpr float w = BuildingProportions::base_width;
+  constexpr float d = BuildingProportions::base_depth;
+  constexpr float h = BuildingProportions::base_height;
 
   const float r = 0.09F;
   const float notch = 0.07F;
 
-  const float left_x = -W * 0.5F;
-  const float right_x = W * 0.5F;
-  const float back_z = -D * 0.5F;
-  const float front_z = D * 0.5F;
+  const float left_x = -w * 0.5F;
+  const float right_x = w * 0.5F;
+  const float back_z = -d * 0.5F;
+  const float front_z = d * 0.5F;
 
-  const int courses = std::max(4, int(H / (2.0F * r)));
+  const int courses = std::max(4, int(h / (2.0F * r)));
   const float y0 = r;
 
-  auto logX = [&](float y, float z, float x0, float x1, const QVector3D &col) {
+  auto log_x = [&](float y, float z, float x0, float x1, const QVector3D &col) {
     drawCylinder(out, p.model, QVector3D(x0 - notch, y, z),
                  QVector3D(x1 + notch, y, z), r, col, white);
   };
-  auto logZ = [&](float y, float x, float z0, float z1, const QVector3D &col) {
+  auto log_z = [&](float y, float x, float z0, float z1, const QVector3D &col) {
     drawCylinder(out, p.model, QVector3D(x, y, z0 - notch),
                  QVector3D(x, y, z1 + notch), r, col, white);
   };
@@ -169,15 +168,15 @@ inline void drawWalls(const DrawContext &p, ISubmitter &out, Mesh *,
     QVector3D const log_col = lerp(C.timber, C.timberLight, (i % 2) * 0.25F);
 
     if (y <= (door_h - 0.5F * r)) {
-      logX(y, front_z, left_x, -gap_half, log_col);
-      logX(y, front_z, +gap_half, right_x, log_col);
+      log_x(y, front_z, left_x, -gap_half, log_col);
+      log_x(y, front_z, +gap_half, right_x, log_col);
     } else {
-      logX(y, front_z, left_x, right_x, log_col);
+      log_x(y, front_z, left_x, right_x, log_col);
     }
 
-    logX(y, back_z, left_x, right_x, log_col);
-    logZ(y, left_x, back_z, front_z, log_col);
-    logZ(y, right_x, back_z, front_z, log_col);
+    log_x(y, back_z, left_x, right_x, log_col);
+    log_z(y, left_x, back_z, front_z, log_col);
+    log_z(y, right_x, back_z, front_z, log_col);
   }
 
   QVector3D const post_col = C.woodDark;
@@ -191,8 +190,8 @@ inline void drawWalls(const DrawContext &p, ISubmitter &out, Mesh *,
                QVector3D(+gap_half, y0 + door_h, front_z), r, C.timberLight,
                white);
 
-  float const brace_y0 = H * 0.35F;
-  float const brace_y1 = H * 0.95F;
+  float const brace_y0 = h * 0.35F;
+  float const brace_y1 = h * 0.95F;
   drawCylinder(out, p.model,
                QVector3D(left_x + 0.08F, brace_y0, back_z + 0.10F),
                QVector3D(left_x + 0.38F, brace_y1, back_z + 0.10F), r * 0.6F,
@@ -222,17 +221,17 @@ struct ChimneyInfo {
 inline auto drawChimney(const DrawContext &p, ISubmitter &out, Mesh *unit,
                         Texture *white,
                         const BarracksPalette &C) -> ChimneyInfo {
-  constexpr float W = BuildingProportions::base_width;
-  constexpr float D = BuildingProportions::base_depth;
-  constexpr float H = BuildingProportions::base_height;
+  constexpr float w = BuildingProportions::base_width;
+  constexpr float d = BuildingProportions::base_depth;
+  constexpr float h = BuildingProportions::base_height;
   constexpr float rise = BuildingProportions::roof_pitch;
 
-  float const x = -W * 0.32F;
-  float const z = -D * 0.5F - 0.06F;
+  float const x = -w * 0.32F;
+  float const z = -d * 0.5F - 0.06F;
 
   float const base_y = 0.18F;
-  float const ridge_y = H + rise;
-  float const topY = ridge_y + 0.35F;
+  float const ridge_y = h + rise;
+  float const top_y = ridge_y + 0.35F;
 
   QVector3D const base_sz(BuildingProportions::chimney_width * 0.65F, 0.16F,
                           BuildingProportions::chimney_width * 0.55F);
@@ -240,7 +239,7 @@ inline auto drawChimney(const DrawContext &p, ISubmitter &out, Mesh *unit,
           base_sz, C.stoneDark);
 
   int const segments = 4;
-  float const segH = (topY - (base_y + base_sz.y() * 2.0F)) / float(segments);
+  float const seg_h = (top_y - (base_y + base_sz.y() * 2.0F)) / float(segments);
   float const w0 = BuildingProportions::chimney_width * 0.55F;
   float const w1 = BuildingProportions::chimney_width * 0.34F;
 
@@ -250,48 +249,48 @@ inline auto drawChimney(const DrawContext &p, ISubmitter &out, Mesh *unit,
     float const hz = wy * 0.85F;
     QVector3D const col =
         (i % 2 == 0) ? C.stone : lerp(C.stone, C.stoneDark, 0.35F);
-    float const yMid = base_y + base_sz.y() * 2.0F + segH * (i + 0.5F);
-    unitBox(out, unit, white, p.model, QVector3D(x, yMid, z),
-            QVector3D(wy, segH * 0.5F, hz), col);
+    float const y_mid = base_y + base_sz.y() * 2.0F + seg_h * (i + 0.5F);
+    unitBox(out, unit, white, p.model, QVector3D(x, y_mid, z),
+            QVector3D(wy, seg_h * 0.5F, hz), col);
   }
 
-  float const corbel_y = topY - 0.14F;
+  float const corbel_y = top_y - 0.14F;
   unitBox(out, unit, white, p.model, QVector3D(x, corbel_y, z),
           QVector3D(w1 * 1.22F, 0.025F, w1 * 1.22F), C.stoneDark);
   unitBox(out, unit, white, p.model, QVector3D(x, corbel_y + 0.05F, z),
           QVector3D(w1 * 1.05F, 0.02F, w1 * 1.05F),
           lerp(C.stone, C.stoneDark, 0.2F));
 
-  float const potH = 0.10F;
-  unitBox(out, unit, white, p.model, QVector3D(x, topY + potH * 0.5F, z),
-          QVector3D(w1 * 0.45F, potH * 0.5F, w1 * 0.45F),
+  float const pot_h = 0.10F;
+  unitBox(out, unit, white, p.model, QVector3D(x, top_y + pot_h * 0.5F, z),
+          QVector3D(w1 * 0.45F, pot_h * 0.5F, w1 * 0.45F),
           lerp(C.stoneDark, QVector3D(0.08F, 0.08F, 0.08F), 0.35F));
 
-  unitBox(out, unit, white, p.model, QVector3D(x, H + rise * 0.55F, z + 0.06F),
+  unitBox(out, unit, white, p.model, QVector3D(x, h + rise * 0.55F, z + 0.06F),
           QVector3D(w1 * 1.35F, 0.01F, 0.04F),
           lerp(C.stoneDark, QVector3D(0.05F, 0.05F, 0.05F), 0.3F));
 
-  return ChimneyInfo{x, z, base_y, topY + potH, 0.28F};
+  return ChimneyInfo{x, z, base_y, top_y + pot_h, 0.28F};
 }
 
 inline void drawRoofs(const DrawContext &p, ISubmitter &out, Mesh *,
                       Texture *white, const BarracksPalette &C,
                       const ChimneyInfo &ch) {
-  constexpr float W = BuildingProportions::base_width;
-  constexpr float D = BuildingProportions::base_depth;
-  constexpr float H = BuildingProportions::base_height;
+  constexpr float w = BuildingProportions::base_width;
+  constexpr float d = BuildingProportions::base_depth;
+  constexpr float h = BuildingProportions::base_height;
   constexpr float rise = BuildingProportions::roof_pitch;
   constexpr float over = BuildingProportions::roof_overhang;
 
   const float r = 0.085F;
 
-  const float left_x = -W * 0.5F;
-  const float right_x = W * 0.5F;
-  const float back_z = -D * 0.5F;
-  const float front_z = D * 0.5F;
+  const float left_x = -w * 0.5F;
+  const float right_x = w * 0.5F;
+  const float back_z = -d * 0.5F;
+  const float front_z = d * 0.5F;
 
-  const float plate_y = H;
-  const float ridge_y = H + rise;
+  const float plate_y = h;
+  const float ridge_y = h + rise;
 
   drawCylinder(out, p.model, QVector3D(left_x - over, plate_y, front_z + over),
                QVector3D(right_x + over, plate_y, front_z + over), r,
@@ -331,11 +330,11 @@ inline void drawRoofs(const DrawContext &p, ISubmitter &out, Mesh *,
   purlin(0.70F, false);
 
   auto split_thatch = [&](float y, float z, float rad, const QVector3D &col) {
-    float const gapL = ch.x - ch.gapRadius;
-    float const gapR = ch.x + ch.gapRadius;
+    float const gap_l = ch.x - ch.gapRadius;
+    float const gap_r = ch.x + ch.gapRadius;
     drawCylinder(out, p.model, QVector3D(left_x - over * 0.35F, y, z),
-                 QVector3D(gapL, y, z), rad, col, white);
-    drawCylinder(out, p.model, QVector3D(gapR, y, z),
+                 QVector3D(gap_l, y, z), rad, col, white);
+    drawCylinder(out, p.model, QVector3D(gap_r, y, z),
                  QVector3D(right_x + over * 0.35F, y, z), rad, col, white);
   };
 
@@ -369,123 +368,129 @@ inline void drawRoofs(const DrawContext &p, ISubmitter &out, Mesh *,
 
 inline void drawDoor(const DrawContext &p, ISubmitter &out, Mesh *unit,
                      Texture *white, const BarracksPalette &C) {
-  constexpr float D = BuildingProportions::base_depth;
-  constexpr float dW = BuildingProportions::door_width;
-  constexpr float dH = BuildingProportions::door_height;
+  constexpr float d = BuildingProportions::base_depth;
+  constexpr float d_w = BuildingProportions::door_width;
+  constexpr float d_h = BuildingProportions::door_height;
 
   const float y0 = 0.09F;
-  const float zf = D * 0.5F;
+  const float zf = d * 0.5F;
 
   QVector3D const frame_col = C.woodDark;
   unitBox(out, unit, white, p.model,
-          QVector3D(0.0F, y0 + dH * 0.5F, zf + 0.015F),
-          QVector3D(dW * 0.5F, dH * 0.5F, 0.02F), C.door);
+          QVector3D(0.0F, y0 + d_h * 0.5F, zf + 0.015F),
+          QVector3D(d_w * 0.5F, d_h * 0.5F, 0.02F), C.door);
 
-  float const plank_w = dW / 6.0F;
+  float const plank_w = d_w / 6.0F;
   for (int i = 0; i < 6; ++i) {
-    float const cx = -dW * 0.5F + plank_w * (i + 0.5F);
+    float const cx = -d_w * 0.5F + plank_w * (i + 0.5F);
     QVector3D const plank_col = lerp(C.door, C.woodDark, 0.15F * (i % 2));
     unitBox(out, unit, white, p.model,
-            QVector3D(cx, y0 + dH * 0.5F, zf + 0.022F),
-            QVector3D(plank_w * 0.48F, dH * 0.48F, 0.006F), plank_col);
+            QVector3D(cx, y0 + d_h * 0.5F, zf + 0.022F),
+            QVector3D(plank_w * 0.48F, d_h * 0.48F, 0.006F), plank_col);
   }
 
   drawCylinder(out, p.model,
-               QVector3D(-dW * 0.45F, y0 + dH * 0.35F, zf + 0.03F),
-               QVector3D(+dW * 0.45F, y0 + dH * 0.35F, zf + 0.03F), 0.02F,
+               QVector3D(-d_w * 0.45F, y0 + d_h * 0.35F, zf + 0.03F),
+               QVector3D(+d_w * 0.45F, y0 + d_h * 0.35F, zf + 0.03F), 0.02F,
                frame_col, white);
 
-  drawCylinder(out, p.model, QVector3D(dW * 0.32F, y0 + dH * 0.45F, zf + 0.04F),
-               QVector3D(dW * 0.42F, y0 + dH * 0.45F, zf + 0.04F), 0.012F,
+  drawCylinder(out, p.model,
+               QVector3D(d_w * 0.32F, y0 + d_h * 0.45F, zf + 0.04F),
+               QVector3D(d_w * 0.42F, y0 + d_h * 0.45F, zf + 0.04F), 0.012F,
                C.timberLight, white);
 
   unitBox(out, unit, white, p.model,
-          QVector3D(0.0F, y0 + dH + 0.10F, zf + 0.02F),
+          QVector3D(0.0F, y0 + d_h + 0.10F, zf + 0.02F),
           QVector3D(0.22F, 0.06F, 0.01F), C.woodDark);
   unitBox(out, unit, white, p.model,
-          QVector3D(0.0F, y0 + dH + 0.10F, zf + 0.025F),
+          QVector3D(0.0F, y0 + d_h + 0.10F, zf + 0.025F),
           QVector3D(0.18F, 0.05F, 0.008F), C.team);
   unitBox(out, unit, white, p.model,
-          QVector3D(0.0F, y0 + dH + 0.10F, zf + 0.03F),
+          QVector3D(0.0F, y0 + d_h + 0.10F, zf + 0.03F),
           QVector3D(0.08F, 0.02F, 0.007F), C.teamTrim);
 }
 
 inline void drawWindows(const DrawContext &p, ISubmitter &out, Mesh *unit,
                         Texture *white, const BarracksPalette &C) {
-  constexpr float W = BuildingProportions::base_width;
-  constexpr float D = BuildingProportions::base_depth;
-  constexpr float H = BuildingProportions::base_height;
+  constexpr float base_w = BuildingProportions::base_width;
+  constexpr float base_d = BuildingProportions::base_depth;
+  constexpr float base_h = BuildingProportions::base_height;
 
-  const float left_x = -W * 0.5F;
-  const float right_x = W * 0.5F;
-  const float back_z = -D * 0.5F;
-  const float front_z = D * 0.5F;
+  const float left_x = -base_w * 0.5F;
+  const float right_x = base_w * 0.5F;
+  const float back_z = -base_d * 0.5F;
+  const float front_z = base_d * 0.5F;
 
-  float w = BuildingProportions::window_width * 0.55F;
-  float h = BuildingProportions::window_height * 0.55F;
-  float frame_t = 0.03F;
+  float const window_w = BuildingProportions::window_width * 0.55F;
+  float const window_h = BuildingProportions::window_height * 0.55F;
+  float const frame_t = 0.03F;
 
   auto framed_window = [&](QVector3D center, bool shutters) {
     unitBox(out, unit, white, p.model, center + QVector3D(0, 0, 0.012F),
-            QVector3D(w * 0.5F, h * 0.5F, 0.008F), C.window);
-    unitBox(out, unit, white, p.model, center + QVector3D(0, 0, 0.016F),
-            QVector3D(w * 0.5F, frame_t, 0.006F), C.timber);
-    unitBox(out, unit, white, p.model, center + QVector3D(0, 0, 0.016F),
-            QVector3D(frame_t, h * 0.5F, 0.006F), C.timber);
+            QVector3D(window_w * 0.5F, window_h * 0.5F, 0.008F), C.window);
+
     unitBox(out, unit, white, p.model, center + QVector3D(0, 0, 0.016F),
-            QVector3D(w * 0.5F, frame_t, 0.006F), C.timber);
+            QVector3D(window_w * 0.5F, frame_t, 0.006F), C.timber);
     unitBox(out, unit, white, p.model, center + QVector3D(0, 0, 0.016F),
-            QVector3D(frame_t, h * 0.5F, 0.006F), C.timber);
+            QVector3D(frame_t, window_h * 0.5F, 0.006F), C.timber);
 
     unitBox(out, unit, white, p.model, center + QVector3D(0, 0, 0.02F),
-            QVector3D(w * 0.02F, h * 0.48F, 0.004F), C.timberLight);
+            QVector3D(window_w * 0.02F, window_h * 0.48F, 0.004F),
+            C.timberLight);
     unitBox(out, unit, white, p.model, center + QVector3D(0, 0, 0.02F),
-            QVector3D(w * 0.48F, h * 0.02F, 0.004F), C.timberLight);
+            QVector3D(window_w * 0.48F, window_h * 0.02F, 0.004F),
+            C.timberLight);
 
     if (shutters) {
       unitBox(out, unit, white, p.model,
-              center + QVector3D(-w * 0.65F, 0, 0.018F),
-              QVector3D(w * 0.30F, h * 0.55F, 0.004F), C.woodDark);
+              center + QVector3D(-window_w * 0.65F, 0, 0.018F),
+              QVector3D(window_w * 0.30F, window_h * 0.55F, 0.004F),
+              C.woodDark);
       unitBox(out, unit, white, p.model,
-              center + QVector3D(+w * 0.65F, 0, 0.018F),
-              QVector3D(w * 0.30F, h * 0.55F, 0.004F), C.woodDark);
+              center + QVector3D(+window_w * 0.65F, 0, 0.018F),
+              QVector3D(window_w * 0.30F, window_h * 0.55F, 0.004F),
+              C.woodDark);
     }
   };
 
   framed_window(QVector3D(-0.65F, 0.95F, front_z + 0.01F), true);
   framed_window(QVector3D(+0.65F, 0.95F, front_z + 0.01F), true);
+  framed_window(QVector3D(0.0F, 1.00F, back_z - 0.01F), true);
+
   framed_window(QVector3D(left_x + 0.06F, 0.85F, 0.0F), false);
   framed_window(QVector3D(right_x - 0.06F, 0.85F, 0.0F), false);
-  framed_window(QVector3D(0.0F, 1.00F, back_z - 0.01F), true);
 }
 
 inline void drawAnnex(const DrawContext &p, ISubmitter &out, Mesh *unit,
                       Texture *white, const BarracksPalette &C) {
-  constexpr float W = BuildingProportions::base_width;
-  constexpr float D = BuildingProportions::base_depth;
-  constexpr float h = BuildingProportions::annex_height;
-  constexpr float w = BuildingProportions::annex_width;
-  constexpr float d = BuildingProportions::annex_depth;
+  constexpr float base_w = BuildingProportions::base_width;
+  constexpr float base_d = BuildingProportions::base_depth;
+  constexpr float annex_h = BuildingProportions::annex_height;
+  constexpr float annex_w = BuildingProportions::annex_width;
+  constexpr float annex_d = BuildingProportions::annex_depth;
 
-  float const x = W * 0.5F + w * 0.5F - 0.05F;
+  float const x = base_w * 0.5F + annex_w * 0.5F - 0.05F;
   float const z = 0.05F;
 
-  unitBox(out, unit, white, p.model, QVector3D(x, h * 0.5F, z),
-          QVector3D(w * 0.5F, h * 0.5F, d * 0.5F), C.plasterShade);
+  unitBox(out, unit, white, p.model, QVector3D(x, annex_h * 0.5F, z),
+          QVector3D(annex_w * 0.5F, annex_h * 0.5F, annex_d * 0.5F),
+          C.plasterShade);
 
-  unitBox(out, unit, white, p.model, QVector3D(x, h + 0.02F, z),
-          QVector3D(w * 0.55F, 0.02F, d * 0.55F), C.woodDark);
+  unitBox(out, unit, white, p.model, QVector3D(x, annex_h + 0.02F, z),
+          QVector3D(annex_w * 0.55F, 0.02F, annex_d * 0.55F), C.woodDark);
 
-  float const plate_y = h;
-  float const front_z = z + d * 0.5F;
-  float const back_z = z - d * 0.5F;
-  drawCylinder(out, p.model, QVector3D(x - w * 0.52F, plate_y, back_z - 0.12F),
-               QVector3D(x + w * 0.52F, plate_y, back_z - 0.12F), 0.05F,
+  float const plate_y = annex_h;
+  float const front_z = z + annex_d * 0.5F;
+  float const back_z = z - annex_d * 0.5F;
+  drawCylinder(out, p.model,
+               QVector3D(x - annex_w * 0.52F, plate_y, back_z - 0.12F),
+               QVector3D(x + annex_w * 0.52F, plate_y, back_z - 0.12F), 0.05F,
                C.woodDark, white);
 
-  float const ridge_y = h + BuildingProportions::annex_roof_height;
-  drawCylinder(out, p.model, QVector3D(x - w * 0.50F, ridge_y, back_z - 0.02F),
-               QVector3D(x + w * 0.50F, ridge_y, back_z - 0.02F), 0.05F,
+  float const ridge_y = annex_h + BuildingProportions::annex_roof_height;
+  drawCylinder(out, p.model,
+               QVector3D(x - annex_w * 0.50F, ridge_y, back_z - 0.02F),
+               QVector3D(x + annex_w * 0.50F, ridge_y, back_z - 0.02F), 0.05F,
                C.timberLight, white);
 
   int const rows = 6;
@@ -495,13 +500,13 @@ inline void drawAnnex(const DrawContext &p, ISubmitter &out, Mesh *unit,
     float const zrow = back_z - 0.02F - 0.10F * (1.0F - t);
     QVector3D const col =
         lerp(C.thatchDark, C.thatch, 0.5F + 0.4F * (1.0F - t));
-    drawCylinder(out, p.model, QVector3D(x - w * 0.55F, y, zrow),
-                 QVector3D(x + w * 0.55F, y, zrow), 0.06F * (1.15F - 0.6F * t),
-                 col, white);
+    drawCylinder(out, p.model, QVector3D(x - annex_w * 0.55F, y, zrow),
+                 QVector3D(x + annex_w * 0.55F, y, zrow),
+                 0.06F * (1.15F - 0.6F * t), col, white);
   }
 
   unitBox(out, unit, white, p.model,
-          QVector3D(x + w * 0.01F, 0.55F, front_z + 0.01F),
+          QVector3D(x + annex_w * 0.01F, 0.55F, front_z + 0.01F),
           QVector3D(0.20F, 0.18F, 0.01F), C.door);
 }
 
@@ -632,14 +637,14 @@ inline void drawHealthBar(const DrawContext &p, ISubmitter &out, Mesh *unit,
   constexpr float base_height = BuildingProportions::base_height;
   constexpr float roof_pitch = BuildingProportions::roof_pitch;
   float const roof_peak = base_height + roof_pitch;
-  float const barY = roof_peak + 0.12F;
+  float const bar_y = roof_peak + 0.12F;
 
   constexpr float bar_width = BuildingProportions::base_width * 0.9F;
   constexpr float bar_height = 0.08F;
   constexpr float bar_depth = 0.12F;
 
   QVector3D const bg_color(0.06F, 0.06F, 0.06F);
-  unitBox(out, unit, white, p.model, QVector3D(0.0F, barY, 0.0F),
+  unitBox(out, unit, white, p.model, QVector3D(0.0F, bar_y, 0.0F),
           QVector3D(bar_width / 2.0F, bar_height / 2.0F, bar_depth / 2.0F),
           bg_color);
 
@@ -650,21 +655,21 @@ inline void drawHealthBar(const DrawContext &p, ISubmitter &out, Mesh *unit,
   QVector3D const green(0.22F, 0.78F, 0.22F);
   QVector3D const fg_color = green * ratio + red * (1.0F - ratio);
 
-  unitBox(out, unit, white, p.model, QVector3D(fill_x, barY + 0.005F, 0.0F),
+  unitBox(out, unit, white, p.model, QVector3D(fill_x, bar_y + 0.005F, 0.0F),
           QVector3D(fill_width / 2.0F, (bar_height / 2.0F) * 0.9F,
                     (bar_depth / 2.0F) * 0.95F),
           fg_color);
 }
 
 inline void drawSelectionFX(const DrawContext &p, ISubmitter &out) {
-  QMatrix4x4 M;
+  QMatrix4x4 m;
   QVector3D const pos = p.model.column(3).toVector3D();
-  M.translate(pos.x(), 0.0F, pos.z());
-  M.scale(2.2F, 1.0F, 2.0F);
+  m.translate(pos.x(), 0.0F, pos.z());
+  m.scale(2.2F, 1.0F, 2.0F);
   if (p.selected) {
-    out.selectionSmoke(M, QVector3D(0.2F, 0.85F, 0.2F), 0.35F);
+    out.selectionSmoke(m, QVector3D(0.2F, 0.85F, 0.2F), 0.35F);
   } else if (p.hovered) {
-    out.selectionSmoke(M, QVector3D(0.95F, 0.92F, 0.25F), 0.22F);
+    out.selectionSmoke(m, QVector3D(0.95F, 0.92F, 0.25F), 0.22F);
   }
 }
 
@@ -683,19 +688,19 @@ void drawBarracks(const DrawContext &p, ISubmitter &out) {
   Texture *white = p.resources->white();
 
   QVector3D const team(r->color[0], r->color[1], r->color[2]);
-  BarracksPalette const C = makePalette(team);
-
-  drawFoundation(p, out, unit, white, C);
-  drawAnnex(p, out, unit, white, C);
-  drawWalls(p, out, unit, white, C);
-  ChimneyInfo const ch = drawChimney(p, out, unit, white, C);
-  drawRoofs(p, out, unit, white, C, ch);
-  drawDoor(p, out, unit, white, C);
-  drawWindows(p, out, unit, white, C);
-  drawBannerAndPole(p, out, unit, white, C);
-  drawProps(p, out, unit, white, C);
-
-  drawRallyFlagIfAny(p, out, white, C);
+  BarracksPalette const c = makePalette(team);
+
+  drawFoundation(p, out, unit, white, c);
+  drawAnnex(p, out, unit, white, c);
+  drawWalls(p, out, unit, white, c);
+  ChimneyInfo const ch = drawChimney(p, out, unit, white, c);
+  drawRoofs(p, out, unit, white, c, ch);
+  drawDoor(p, out, unit, white, c);
+  drawWindows(p, out, unit, white, c);
+  drawBannerAndPole(p, out, unit, white, c);
+  drawProps(p, out, unit, white, c);
+
+  drawRallyFlagIfAny(p, out, white, c);
   drawHealthBar(p, out, unit, white);
   drawSelectionFX(p, out);
 }

+ 13 - 13
render/entity/horse_renderer.cpp

@@ -26,7 +26,7 @@ using Render::Geom::smoothstep;
 
 namespace {
 
-constexpr float kPi = std::numbers::pi_v<float>;
+constexpr float k_pi = std::numbers::pi_v<float>;
 
 constexpr int k_hash_shift_16 = 16;
 constexpr int k_hash_shift_15 = 15;
@@ -242,14 +242,14 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
   if (anim.isMoving) {
     float const cycle = std::max(0.20F, g.cycleTime);
     phase = std::fmod(anim.time / cycle, 1.0F);
-    bob = std::sin(phase * 2.0F * kPi) * d.moveBobAmplitude;
+    bob = std::sin(phase * 2.0F * k_pi) * d.moveBobAmplitude;
   } else {
     phase = std::fmod(anim.time * 0.25F, 1.0F);
-    bob = std::sin(phase * 2.0F * kPi) * d.idleBobAmplitude;
+    bob = std::sin(phase * 2.0F * k_pi) * d.idleBobAmplitude;
   }
 
   float const head_nod = anim.isMoving
-                             ? std::sin((phase + 0.25F) * 2.0F * kPi) * 0.04F
+                             ? std::sin((phase + 0.25F) * 2.0F * k_pi) * 0.04F
                              : std::sin(anim.time * 1.5F) * 0.01F;
 
   uint32_t const vhash = colorHash(v.coatColor);
@@ -611,7 +611,7 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     QVector3D seg_start = lerp(mane_root, neck_base, t);
     seg_start.setY(seg_start.y() + (0.07F - t * 0.05F));
     float const sway =
-        (anim.isMoving ? std::sin((phase + t * 0.15F) * 2.0F * kPi) * 0.04F
+        (anim.isMoving ? std::sin((phase + t * 0.15F) * 2.0F * k_pi) * 0.04F
                        : std::sin((anim.time * 0.8F + t * 2.3F)) * 0.02F);
     QVector3D const seg_end =
         seg_start + QVector3D(sway, 0.07F - t * 0.05F, -0.05F - t * 0.03F);
@@ -650,8 +650,8 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     float const t = static_cast<float>(i) / 8.0F;
     QVector3D p = bezier(tail_base, tail_ctrl, tail_end, t);
     float const swing =
-        (anim.isMoving ? std::sin((phase + t * 0.12F) * 2.0F * kPi)
-                       : std::sin((phase * 0.7F + t * 0.3F) * 2.0F * kPi)) *
+        (anim.isMoving ? std::sin((phase + t * 0.12F) * 2.0F * k_pi)
+                       : std::sin((phase * 0.7F + t * 0.3F) * 2.0F * k_pi)) *
         (0.04F + 0.015F * (1.0F - t));
     p.setX(p.x() + swing);
     float const radius = d.bodyWidth * (0.20F - 0.018F * i);
@@ -717,13 +717,13 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     float lift = 0.0F;
 
     if (anim.isMoving) {
-      float const angle = leg_phase * 2.0F * kPi;
+      float const angle = leg_phase * 2.0F * k_pi;
       stride = std::sin(angle) * g.strideSwing * 0.75F + forwardBias;
       float const lift_raw = std::sin(angle);
       lift = lift_raw > 0.0F ? lift_raw * g.strideLift
                              : lift_raw * g.strideLift * 0.22F;
     } else {
-      float const idle = std::sin(leg_phase * 2.0F * kPi);
+      float const idle = std::sin(leg_phase * 2.0F * k_pi);
       stride = idle * g.strideSwing * 0.06F + forwardBias;
       lift = idle * d.idleBobAmplitude * 2.0F;
     }
@@ -734,7 +734,7 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
                                             0.05F + lift * 0.05F, stride);
     bool const is_rear = (forwardBias < 0.0F);
 
-    float const gallop_angle = leg_phase * 2.0F * kPi;
+    float const gallop_angle = leg_phase * 2.0F * k_pi;
     float const hip_swing = anim.isMoving ? std::sin(gallop_angle) : 0.0F;
     float const lift_factor =
         anim.isMoving
@@ -798,8 +798,8 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
             : 0.32F;
 
     float const forearm_length = d.legLength * 0.30F;
-    float const bend_cos = std::cos(knee_flex * kPi * 0.5F);
-    float const bend_sin = std::sin(knee_flex * kPi * 0.5F);
+    float const bend_cos = std::cos(knee_flex * k_pi * 0.5F);
+    float const bend_sin = std::sin(knee_flex * k_pi * 0.5F);
     QVector3D forearm_dir(0.0F, -bend_cos,
                           (is_rear ? -1.0F : 1.0F) * bend_sin * 0.85F);
     if (forearm_dir.lengthSquared() < 1e-6F) {
@@ -813,7 +813,7 @@ void HorseRenderer::render(const DrawContext &ctx, const AnimationInputs &anim,
     QVector3D const fetlock = cannon + QVector3D(0.0F, -pastern_length, 0.0F);
 
     float const hoof_pitch =
-        anim.isMoving ? (-0.20F + std::sin(leg_phase * 2.0F * kPi +
+        anim.isMoving ? (-0.20F + std::sin(leg_phase * 2.0F * k_pi +
                                            (is_rear ? 0.2F : -0.1F)) *
                                       0.10F)
                       : 0.0F;

+ 44 - 43
render/entity/knight_renderer.cpp

@@ -68,7 +68,7 @@ public:
     v.palette = makeHumanoidPalette(team_tint, seed);
   }
 
-  void customizePose(const DrawContext &ctx, const AnimationInputs &anim,
+  void customizePose(const DrawContext &, const AnimationInputs &anim,
                      uint32_t seed, HumanoidPose &pose) const override {
     using HP = HumanProportions;
 
@@ -245,8 +245,8 @@ public:
 
   void draw_armorOverlay(const DrawContext &ctx, const HumanoidVariant &v,
                          const HumanoidPose &pose, float y_top_cover,
-                         float torso_r, float shoulder_half_span,
-                         float upper_arm_r, const QVector3D &right_axis,
+                         float torso_r, float, float upper_arm_r,
+                         const QVector3D &right_axis,
                          ISubmitter &out) const override {
     using HP = HumanProportions;
 
@@ -272,12 +272,12 @@ public:
              cylinderBetween(ctx.model, bp_top, bp_mid, r_chest), steel_color,
              nullptr, 1.0F);
 
-    QVector3D const bp_midLow(0, (bp_mid.y() + bp_bot.y()) * 0.5F, 0);
+    QVector3D const bp_mid_low(0, (bp_mid.y() + bp_bot.y()) * 0.5F, 0);
     out.mesh(getUnitCylinder(),
-             cylinderBetween(ctx.model, bp_mid, bp_midLow, r_chest * 0.98F),
+             cylinderBetween(ctx.model, bp_mid, bp_mid_low, r_chest * 0.98F),
              steel_color * 0.99F, nullptr, 1.0F);
 
-    out.mesh(getUnitCone(), coneFromTo(ctx.model, bp_bot, bp_midLow, r_waist),
+    out.mesh(getUnitCone(), coneFromTo(ctx.model, bp_bot, bp_mid_low, r_waist),
              steel_color * 0.98F, nullptr, 1.0F);
 
     auto draw_rivet = [&](const QVector3D &pos) {
@@ -297,12 +297,12 @@ public:
     auto draw_pauldron = [&](const QVector3D &shoulder,
                              const QVector3D &outward) {
       for (int i = 0; i < 4; ++i) {
-        float const segY = shoulder.y() + 0.04F - i * 0.045F;
-        float const segR = upper_arm_r * (2.5F - i * 0.12F);
+        float const seg_y = shoulder.y() + 0.04F - i * 0.045F;
+        float const seg_r = upper_arm_r * (2.5F - i * 0.12F);
         QVector3D seg_pos = shoulder + outward * (0.02F + i * 0.008F);
-        seg_pos.setY(segY);
+        seg_pos.setY(seg_y);
 
-        out.mesh(getUnitSphere(), sphereAt(ctx.model, seg_pos, segR),
+        out.mesh(getUnitSphere(), sphereAt(ctx.model, seg_pos, seg_r),
                  i == 0 ? steel_color * 1.05F
                         : steel_color * (1.0F - i * 0.03F),
                  nullptr, 1.0F);
@@ -412,12 +412,12 @@ public:
       QVector3D current_pos = startPos;
       for (int i = 0; i < 4; ++i) {
         float const seg_len = 0.035F - i * 0.005F;
-        float const segR = 0.020F - i * 0.003F;
+        float const seg_r = 0.020F - i * 0.003F;
         QVector3D next_pos = current_pos + direction * seg_len;
         next_pos.setY(next_pos.y() - 0.025F);
 
         out.mesh(getUnitCylinder(),
-                 cylinderBetween(ctx.model, current_pos, next_pos, segR),
+                 cylinderBetween(ctx.model, current_pos, next_pos, seg_r),
                  mantling_color * (1.1F - i * 0.06F), nullptr, 1.0F);
 
         current_pos = next_pos;
@@ -430,19 +430,19 @@ public:
     draw_mantling(mantling_start - right_axis * HP::HEAD_RADIUS * 0.95F,
                   -right_axis * 0.5F + QVector3D(0, -0.1F, -0.3F));
 
-    auto draw_pauldronRivet = [&](const QVector3D &shoulder,
-                                  const QVector3D &outward) {
+    auto draw_pauldron_rivet = [&](const QVector3D &shoulder,
+                                   const QVector3D &outward) {
       for (int i = 0; i < 3; ++i) {
-        float const segY = shoulder.y() + 0.025F - i * 0.045F;
+        float const seg_y = shoulder.y() + 0.025F - i * 0.045F;
         QVector3D rivet_pos = shoulder + outward * (0.04F + i * 0.008F);
-        rivet_pos.setY(segY);
+        rivet_pos.setY(seg_y);
 
         draw_stud(rivet_pos);
       }
     };
 
-    draw_pauldronRivet(pose.shoulderL, -right_axis);
-    draw_pauldronRivet(pose.shoulderR, right_axis);
+    draw_pauldron_rivet(pose.shoulderL, -right_axis);
+    draw_pauldron_rivet(pose.shoulderR, right_axis);
 
     QVector3D const gorget_top(0, y_top_cover + 0.045F, 0);
     for (int i = 0; i < 6; ++i) {
@@ -513,12 +513,12 @@ private:
     QVector3D const grip_pos = pose.hand_r;
 
     constexpr float k_sword_yaw_deg = 25.0F;
-    QMatrix4x4 yawM;
-    yawM.rotate(k_sword_yaw_deg, 0.0F, 1.0F, 0.0F);
+    QMatrix4x4 yaw_m;
+    yaw_m.rotate(k_sword_yaw_deg, 0.0F, 1.0F, 0.0F);
 
-    QVector3D upish = yawM.map(QVector3D(0.05F, 1.0F, 0.15F));
-    QVector3D midish = yawM.map(QVector3D(0.08F, 0.20F, 1.0F));
-    QVector3D downish = yawM.map(QVector3D(0.10F, -1.0F, 0.25F));
+    QVector3D upish = yaw_m.map(QVector3D(0.05F, 1.0F, 0.15F));
+    QVector3D midish = yaw_m.map(QVector3D(0.08F, 0.20F, 1.0F));
+    QVector3D downish = yaw_m.map(QVector3D(0.10F, -1.0F, 0.25F));
     if (upish.lengthSquared() > 1e-6F) {
       upish.normalize();
     }
@@ -592,16 +592,16 @@ private:
     gr.scale(0.018F);
     out.mesh(getUnitSphere(), gr, extras.metalColor, nullptr, 1.0F);
 
-    float const L = extras.swordLength;
+    float const l = extras.swordLength;
     float const base_w = extras.swordWidth;
     float blade_thickness = base_w * 0.15F;
 
-    float const ricasso_len = clampf(extras.bladeRicasso, 0.10F, L * 0.30F);
+    float const ricasso_len = clampf(extras.bladeRicasso, 0.10F, l * 0.30F);
     QVector3D const ricasso_end = blade_base + sword_dir * ricasso_len;
 
-    float const midW = base_w * 0.95F;
-    float const tipW = base_w * 0.28F;
-    float const tip_start_dist = lerp(ricasso_len, L, 0.70F);
+    float const mid_w = base_w * 0.95F;
+    float const tip_w = base_w * 0.28F;
+    float const tip_start_dist = lerp(ricasso_len, l, 0.70F);
     QVector3D const tip_start = blade_base + sword_dir * tip_start_dist;
 
     auto draw_flat_section = [&](const QVector3D &start, const QVector3D &end,
@@ -631,7 +631,7 @@ private:
 
     draw_flat_section(blade_base, ricasso_end, base_w, extras.metalColor);
 
-    draw_flat_section(ricasso_end, tip_start, midW, extras.metalColor);
+    draw_flat_section(ricasso_end, tip_start, mid_w, extras.metalColor);
 
     int const tip_segments = 3;
     for (int i = 0; i < tip_segments; ++i) {
@@ -641,7 +641,7 @@ private:
           tip_start + sword_dir * ((blade_tip - tip_start).length() * t0);
       QVector3D const seg_end =
           tip_start + sword_dir * ((blade_tip - tip_start).length() * t1);
-      float const w = lerp(midW, tipW, t1);
+      float const w = lerp(mid_w, tip_w, t1);
       out.mesh(getUnitCylinder(),
                cylinderBetween(ctx.model, seg_start, seg_end, blade_thickness),
                extras.metalColor * (1.0F - i * 0.03F), nullptr, 1.0F);
@@ -678,16 +678,16 @@ private:
                               const HumanoidVariant &v, ISubmitter &out) {
 
     QVector3D const accent = v.palette.cloth * 1.2F;
-    float const barR = radius * 0.10F;
+    float const bar_r = radius * 0.10F;
 
     QVector3D const top = center + QVector3D(0.0F, radius * 0.95F, 0.0F);
     QVector3D const bot = center - QVector3D(0.0F, radius * 0.95F, 0.0F);
-    out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, top, bot, barR),
+    out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, top, bot, bar_r),
              accent, nullptr, 1.0F);
 
     QVector3D const left = center + QVector3D(-radius * 0.95F, 0.0F, 0.0F);
     QVector3D const right = center + QVector3D(radius * 0.95F, 0.0F, 0.0F);
-    out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, left, right, barR),
+    out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, left, right, bar_r),
              accent, nullptr, 1.0F);
   }
 
@@ -715,7 +715,7 @@ private:
                          ISubmitter &out) {
 
     const float scale_factor = 2.5F;
-    const float R = extras.shieldRadius * scale_factor;
+    const float r = extras.shieldRadius * scale_factor;
 
     constexpr float k_shield_yaw_degrees = -70.0F;
     QMatrix4x4 rot;
@@ -726,7 +726,7 @@ private:
     const QVector3D axis_y = rot.map(QVector3D(0.0F, 1.0F, 0.0F));
 
     QVector3D shield_center =
-        pose.handL + axis_x * (-R * 0.35F) + axis_y * (-0.05F) + n * (0.06F);
+        pose.handL + axis_x * (-r * 0.35F) + axis_y * (-0.05F) + n * (0.06F);
 
     const float plate_half = 0.0015F;
     const float plate_full = plate_half * 2.0F;
@@ -735,7 +735,7 @@ private:
       QMatrix4x4 m = ctx.model;
       m.translate(shield_center + n * plate_half);
       m.rotate(k_shield_yaw_degrees, 0.0F, 1.0F, 0.0F);
-      m.scale(R, R, plate_full);
+      m.scale(r, r, plate_full);
       out.mesh(getUnitCylinder(), m, extras.shieldColor, nullptr, 1.0F);
     }
 
@@ -743,7 +743,7 @@ private:
       QMatrix4x4 m = ctx.model;
       m.translate(shield_center - n * plate_half);
       m.rotate(k_shield_yaw_degrees, 0.0F, 1.0F, 0.0F);
-      m.scale(R * 0.985F, R * 0.985F, plate_full);
+      m.scale(r * 0.985F, r * 0.985F, plate_full);
       out.mesh(getUnitCylinder(), m, v.palette.leather * 0.8F, nullptr, 1.0F);
     }
 
@@ -770,8 +770,8 @@ private:
       }
     };
 
-    draw_ring_rotated(R, 0.010F * scale_factor, extras.metalColor * 0.95F);
-    draw_ring_rotated(R * 0.72F, 0.006F * scale_factor,
+    draw_ring_rotated(r, 0.010F * scale_factor, extras.metalColor * 0.95F);
+    draw_ring_rotated(r * 0.72F, 0.006F * scale_factor,
                       v.palette.leather * 0.90F);
 
     {
@@ -791,20 +791,21 @@ private:
     }
 
     if (extras.shieldCrossDecal && (extras.shieldColor != extras.metalColor)) {
-      float const decal_r = R * 0.85F;
-      float const barR = decal_r * 0.10F;
+      float const decal_r = r * 0.85F;
+      float const bar_r = decal_r * 0.10F;
 
       QVector3D const center_front =
           shield_center + n * (plate_full * 0.5F + 0.0015F);
 
       QVector3D const top = center_front + axis_y * (decal_r * 0.95F);
       QVector3D const bot = center_front - axis_y * (decal_r * 0.95F);
-      out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, top, bot, barR),
+      out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, top, bot, bar_r),
                v.palette.cloth * 1.2F, nullptr, 1.0F);
 
       QVector3D const left = center_front - axis_x * (decal_r * 0.95F);
       QVector3D const right = center_front + axis_x * (decal_r * 0.95F);
-      out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, left, right, barR),
+      out.mesh(getUnitCylinder(),
+               cylinderBetween(ctx.model, left, right, bar_r),
                v.palette.cloth * 1.2F, nullptr, 1.0F);
     }
   }

+ 29 - 32
render/entity/mounted_knight_renderer.cpp

@@ -29,12 +29,9 @@
 namespace Render::GL {
 
 using Render::Geom::clamp01;
-using Render::Geom::clampf;
 using Render::Geom::coneFromTo;
 using Render::Geom::cylinderBetween;
 using Render::Geom::easeInOutCubic;
-using Render::Geom::lerp;
-using Render::Geom::nlerp;
 using Render::Geom::smoothstep;
 using Render::Geom::sphereAt;
 
@@ -321,8 +318,8 @@ public:
 
   void draw_armorOverlay(const DrawContext &ctx, const HumanoidVariant &v,
                          const HumanoidPose &pose, float y_top_cover,
-                         float torso_r, float shoulder_half_span,
-                         float upper_arm_r, const QVector3D &right_axis,
+                         float torso_r, float, float upper_arm_r,
+                         const QVector3D &right_axis,
                          ISubmitter &out) const override {
     using HP = HumanProportions;
 
@@ -349,12 +346,12 @@ public:
              cylinderBetween(ctx.model, bp_top, bp_mid, r_chest), steel_color,
              nullptr, 1.0F);
 
-    QVector3D const bp_midLow(0, (bp_mid.y() + bp_bot.y()) * 0.5F, 0);
+    QVector3D const bp_mid_low(0, (bp_mid.y() + bp_bot.y()) * 0.5F, 0);
     out.mesh(getUnitCylinder(),
-             cylinderBetween(ctx.model, bp_mid, bp_midLow, r_chest * 0.98F),
+             cylinderBetween(ctx.model, bp_mid, bp_mid_low, r_chest * 0.98F),
              steel_color * 0.99F, nullptr, 1.0F);
 
-    out.mesh(getUnitCone(), coneFromTo(ctx.model, bp_bot, bp_midLow, r_waist),
+    out.mesh(getUnitCone(), coneFromTo(ctx.model, bp_bot, bp_mid_low, r_waist),
              steel_color * 0.98F, nullptr, 1.0F);
 
     auto draw_rivet = [&](const QVector3D &pos) {
@@ -374,12 +371,12 @@ public:
     auto draw_pauldron = [&](const QVector3D &shoulder,
                              const QVector3D &outward) {
       for (int i = 0; i < 4; ++i) {
-        float const segY = shoulder.y() + 0.04F - i * 0.045F;
-        float const segR = upper_arm_r * (2.5F - i * 0.12F);
+        float const seg_y = shoulder.y() + 0.04F - i * 0.045F;
+        float const seg_r = upper_arm_r * (2.5F - i * 0.12F);
         QVector3D seg_pos = shoulder + outward * (0.02F + i * 0.008F);
-        seg_pos.setY(segY);
+        seg_pos.setY(seg_y);
 
-        out.mesh(getUnitSphere(), sphereAt(ctx.model, seg_pos, segR),
+        out.mesh(getUnitSphere(), sphereAt(ctx.model, seg_pos, seg_r),
                  i == 0 ? steel_color * 1.05F
                         : steel_color * (1.0F - i * 0.03F),
                  nullptr, 1.0F);
@@ -432,8 +429,8 @@ public:
   }
 
   void drawShoulderDecorations(const DrawContext &ctx, const HumanoidVariant &v,
-                               const HumanoidPose &pose, float y_top_cover,
-                               float y_neck, const QVector3D &right_axis,
+                               const HumanoidPose &, float, float y_neck,
+                               const QVector3D &,
                                ISubmitter &out) const override {
     using HP = HumanProportions;
 
@@ -555,10 +552,10 @@ private:
       QVector3D const a = grip_a + sword_dir * (grip_len * t0);
       QVector3D const b = grip_a + sword_dir * (grip_len * t1);
 
-      float const rMid =
+      float const r_mid =
           grip_rad *
           (0.96F + 0.08F * std::sin((t0 + t1) * std::numbers::pi_v<float>));
-      out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, a, b, rMid),
+      out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, a, b, r_mid),
                leather * 0.98F, nullptr, 1.0F);
     }
 
@@ -577,16 +574,16 @@ private:
         prev = p;
       }
 
-      QVector3D const Lend =
+      QVector3D const lend =
           guard_center - right_axis * guard_half + (-up_axis * guard_curve);
-      QVector3D const Rend =
+      QVector3D const rend =
           guard_center + right_axis * guard_half + (-up_axis * guard_curve);
       out.mesh(getUnitCone(),
-               coneFromTo(ctx.model, Lend - right_axis * 0.030F, Lend,
+               coneFromTo(ctx.model, lend - right_axis * 0.030F, lend,
                           guard_rad * 1.12F),
                steel_hi, nullptr, 1.0F);
       out.mesh(getUnitCone(),
-               coneFromTo(ctx.model, Rend + right_axis * 0.030F, Rend,
+               coneFromTo(ctx.model, rend + right_axis * 0.030F, rend,
                           guard_rad * 1.12F),
                steel_hi, nullptr, 1.0F);
 
@@ -613,7 +610,7 @@ private:
              steel_lo, nullptr, 1.0F);
 
     const float base_r = extras.swordWidth * 0.26F;
-    const float midR = extras.swordWidth * 0.16F;
+    const float mid_r = extras.swordWidth * 0.16F;
     const float pre_tip_r = extras.swordWidth * 0.09F;
 
     QVector3D const s0 = ricasso_end;
@@ -622,17 +619,17 @@ private:
 
     out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, s0, s1, base_r),
              steel_hi, nullptr, 1.0F);
-    out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, s1, s2, midR),
+    out.mesh(getUnitCylinder(), cylinderBetween(ctx.model, s1, s2, mid_r),
              steel_hi, nullptr, 1.0F);
 
     {
       float const edge_r = extras.swordWidth * 0.03F;
-      QVector3D const eA = blade_root + sword_dir * (blade_len * 0.10F);
-      QVector3D const eB = blade_tip - sword_dir * (blade_len * 0.06F);
-      QVector3D const left_edge_a = eA + right_axis * (base_r * 0.95F);
-      QVector3D const left_edge_b = eB + right_axis * (pre_tip_r * 0.95F);
-      QVector3D const right_edge_a = eA - right_axis * (base_r * 0.95F);
-      QVector3D const right_edge_b = eB - right_axis * (pre_tip_r * 0.95F);
+      QVector3D const e_a = blade_root + sword_dir * (blade_len * 0.10F);
+      QVector3D const e_b = blade_tip - sword_dir * (blade_len * 0.06F);
+      QVector3D const left_edge_a = e_a + right_axis * (base_r * 0.95F);
+      QVector3D const left_edge_b = e_b + right_axis * (pre_tip_r * 0.95F);
+      QVector3D const right_edge_a = e_a - right_axis * (base_r * 0.95F);
+      QVector3D const right_edge_b = e_b - right_axis * (pre_tip_r * 0.95F);
       out.mesh(getUnitCylinder(),
                cylinderBetween(ctx.model, left_edge_a, left_edge_b, edge_r),
                steel * 1.08F, nullptr, 1.0F);
@@ -687,7 +684,7 @@ private:
                                 const MountedKnightExtras &extras,
                                 ISubmitter &out) {
     const float scale_factor = 2.0F;
-    const float R = 0.15F * scale_factor;
+    const float r = 0.15F * scale_factor;
 
     constexpr float k_mounted_shield_yaw_degrees = -70.0F;
     QMatrix4x4 rot;
@@ -698,7 +695,7 @@ private:
     const QVector3D axis_y = rot.map(QVector3D(0.0F, 1.0F, 0.0F));
 
     QVector3D const shield_center =
-        pose.handL + axis_x * (-R * 0.30F) + axis_y * (-0.05F) + n * (0.05F);
+        pose.handL + axis_x * (-r * 0.30F) + axis_y * (-0.05F) + n * (0.05F);
 
     const float plate_half = 0.0012F;
     const float plate_full = plate_half * 2.0F;
@@ -707,7 +704,7 @@ private:
       QMatrix4x4 m = ctx.model;
       m.translate(shield_center + n * plate_half);
       m.rotate(k_mounted_shield_yaw_degrees, 0.0F, 1.0F, 0.0F);
-      m.scale(R, R, plate_full);
+      m.scale(r, r, plate_full);
       out.mesh(getUnitCylinder(), m, v.palette.cloth * 1.15F, nullptr, 1.0F);
     }
 
@@ -715,7 +712,7 @@ private:
       QMatrix4x4 m = ctx.model;
       m.translate(shield_center - n * plate_half);
       m.rotate(k_mounted_shield_yaw_degrees, 0.0F, 1.0F, 0.0F);
-      m.scale(R * 0.985F, R * 0.985F, plate_full);
+      m.scale(r * 0.985F, r * 0.985F, plate_full);
       out.mesh(getUnitCylinder(), m, v.palette.leather * 0.8F, nullptr, 1.0F);
     }
 

+ 7 - 9
render/entity/spearman_renderer.cpp

@@ -24,8 +24,6 @@
 
 namespace Render::GL {
 
-using Render::Geom::clamp01;
-using Render::Geom::clampf;
 using Render::Geom::coneFromTo;
 using Render::Geom::cylinderBetween;
 using Render::Geom::easeInOutCubic;
@@ -57,7 +55,7 @@ public:
     v.palette = makeHumanoidPalette(team_tint, seed);
   }
 
-  void customizePose(const DrawContext &ctx, const AnimationInputs &anim,
+  void customizePose(const DrawContext &, const AnimationInputs &anim,
                      uint32_t seed, HumanoidPose &pose) const override {
     using HP = HumanProportions;
 
@@ -270,8 +268,8 @@ public:
 
   void draw_armorOverlay(const DrawContext &ctx, const HumanoidVariant &v,
                          const HumanoidPose &pose, float y_top_cover,
-                         float torso_r, float shoulder_half_span,
-                         float upper_arm_r, const QVector3D &right_axis,
+                         float torso_r, float, float upper_arm_r,
+                         const QVector3D &right_axis,
                          ISubmitter &out) const override {
     using HP = HumanProportions;
 
@@ -289,12 +287,12 @@ public:
     auto draw_pauldron = [&](const QVector3D &shoulder,
                              const QVector3D &outward) {
       for (int i = 0; i < 3; ++i) {
-        float const segY = shoulder.y() + 0.03F - i * 0.040F;
-        float const segR = upper_arm_r * (2.2F - i * 0.10F);
+        float const seg_y = shoulder.y() + 0.03F - i * 0.040F;
+        float const seg_r = upper_arm_r * (2.2F - i * 0.10F);
         QVector3D seg_pos = shoulder + outward * (0.015F + i * 0.006F);
-        seg_pos.setY(segY);
+        seg_pos.setY(seg_y);
 
-        out.mesh(getUnitSphere(), sphereAt(ctx.model, seg_pos, segR),
+        out.mesh(getUnitSphere(), sphereAt(ctx.model, seg_pos, seg_r),
                  i == 0 ? iron_color * 1.04F : iron_color * (1.0F - i * 0.02F),
                  nullptr, 1.0F);
       }

+ 2 - 2
render/geom/arrow.cpp

@@ -26,7 +26,7 @@ static auto createArrowMesh() -> GL::Mesh * {
   const float shaft_radius = 0.05F;
   const float shaft_len = 0.85F;
   const float tip_len = 0.15F;
-  const float tip_startZ = shaft_len;
+  const float tip_start_z = shaft_len;
   const float tip_end_z = shaft_len + tip_len;
 
   int const base_index = 0;
@@ -65,7 +65,7 @@ static auto createArrowMesh() -> GL::Mesh * {
     float y = std::sin(a) * shaft_radius * 1.4F;
     QVector3D n(x, y, 0.2F);
     n.normalize();
-    verts.push_back({{x, y, tip_startZ},
+    verts.push_back({{x, y, tip_start_z},
                      {n.x(), n.y(), n.z()},
                      {float(i) / k_arrow_radial_segments, 0.0F}});
   }

+ 27 - 27
render/geom/transforms.cpp

@@ -10,7 +10,7 @@ namespace {
 const QVector3D k_yaxis(0, 1, 0);
 const float k_rad_to_deg = 57.2957795131F;
 const float k_epsilon = 1e-6F;
-const float k_epsilonSq = k_epsilon * k_epsilon;
+const float k_epsilon_sq = k_epsilon * k_epsilon;
 constexpr float k_flip_rotation_degrees = 180.0F;
 } // namespace
 
@@ -22,12 +22,12 @@ auto cylinderBetween(const QVector3D &a, const QVector3D &b,
   const float dz = b.z() - a.z();
   const float len_sq = dx * dx + dy * dy + dz * dz;
 
-  QMatrix4x4 M;
+  QMatrix4x4 m;
 
-  M.translate((a.x() + b.x()) * 0.5F, (a.y() + b.y()) * 0.5F,
+  m.translate((a.x() + b.x()) * 0.5F, (a.y() + b.y()) * 0.5F,
               (a.z() + b.z()) * 0.5F);
 
-  if (len_sq > k_epsilonSq) {
+  if (len_sq > k_epsilon_sq) {
     const float len = std::sqrt(len_sq);
 
     const float inv_len = 1.0F / len;
@@ -42,36 +42,36 @@ auto cylinderBetween(const QVector3D &a, const QVector3D &b,
     const float axis_z = -ndx;
     const float axis_len_sq = axis_x * axis_x + axis_z * axis_z;
 
-    if (axis_len_sq < k_epsilonSq) {
+    if (axis_len_sq < k_epsilon_sq) {
 
       if (dot < 0.0F) {
-        M.rotate(k_flip_rotation_degrees, 1.0F, 0.0F, 0.0F);
+        m.rotate(k_flip_rotation_degrees, 1.0F, 0.0F, 0.0F);
       }
     } else {
 
       const float axis_inv_len = 1.0F / std::sqrt(axis_len_sq);
-      M.rotate(angle_deg, axis_x * axis_inv_len, 0.0F, axis_z * axis_inv_len);
+      m.rotate(angle_deg, axis_x * axis_inv_len, 0.0F, axis_z * axis_inv_len);
     }
-    M.scale(radius, len, radius);
+    m.scale(radius, len, radius);
   } else {
-    M.scale(radius, 1.0F, radius);
+    m.scale(radius, 1.0F, radius);
   }
-  return M;
+  return m;
 }
 
 auto sphereAt(const QVector3D &pos, float radius) -> QMatrix4x4 {
-  QMatrix4x4 M;
-  M.translate(pos);
-  M.scale(radius, radius, radius);
-  return M;
+  QMatrix4x4 m;
+  m.translate(pos);
+  m.scale(radius, radius, radius);
+  return m;
 }
 
 auto sphereAt(const QMatrix4x4 &parent, const QVector3D &pos,
               float radius) -> QMatrix4x4 {
-  QMatrix4x4 M = parent;
-  M.translate(pos);
-  M.scale(radius, radius, radius);
-  return M;
+  QMatrix4x4 m = parent;
+  m.translate(pos);
+  m.scale(radius, radius, radius);
+  return m;
 }
 
 auto cylinderBetween(const QMatrix4x4 &parent, const QVector3D &a,
@@ -82,12 +82,12 @@ auto cylinderBetween(const QMatrix4x4 &parent, const QVector3D &a,
   const float dz = b.z() - a.z();
   const float len_sq = dx * dx + dy * dy + dz * dz;
 
-  QMatrix4x4 M = parent;
+  QMatrix4x4 m = parent;
 
-  M.translate((a.x() + b.x()) * 0.5F, (a.y() + b.y()) * 0.5F,
+  m.translate((a.x() + b.x()) * 0.5F, (a.y() + b.y()) * 0.5F,
               (a.z() + b.z()) * 0.5F);
 
-  if (len_sq > k_epsilonSq) {
+  if (len_sq > k_epsilon_sq) {
     const float len = std::sqrt(len_sq);
 
     const float inv_len = 1.0F / len;
@@ -102,21 +102,21 @@ auto cylinderBetween(const QMatrix4x4 &parent, const QVector3D &a,
     const float axis_z = -ndx;
     const float axis_len_sq = axis_x * axis_x + axis_z * axis_z;
 
-    if (axis_len_sq < k_epsilonSq) {
+    if (axis_len_sq < k_epsilon_sq) {
 
       if (dot < 0.0F) {
-        M.rotate(k_flip_rotation_degrees, 1.0F, 0.0F, 0.0F);
+        m.rotate(k_flip_rotation_degrees, 1.0F, 0.0F, 0.0F);
       }
     } else {
 
       const float axis_inv_len = 1.0F / std::sqrt(axis_len_sq);
-      M.rotate(angle_deg, axis_x * axis_inv_len, 0.0F, axis_z * axis_inv_len);
+      m.rotate(angle_deg, axis_x * axis_inv_len, 0.0F, axis_z * axis_inv_len);
     }
-    M.scale(radius, len, radius);
+    m.scale(radius, len, radius);
   } else {
-    M.scale(radius, 1.0F, radius);
+    m.scale(radius, 1.0F, radius);
   }
-  return M;
+  return m;
 }
 
 auto coneFromTo(const QVector3D &base_center, const QVector3D &apex,

+ 56 - 54
render/gl/backend.cpp

@@ -29,6 +29,7 @@
 #include <memory>
 #include <qglobal.h>
 #include <qmatrix4x4.h>
+#include <qopenglcontext.h>
 #include <qstringliteral.h>
 #include <qvectornd.h>
 #include <vector>
@@ -216,15 +217,15 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
         if (glIsEnabled(GL_POLYGON_OFFSET_FILL) != 0U) {
           glDisable(GL_POLYGON_OFFSET_FILL);
         }
-        Shader *cylinderShader = m_cylinderPipeline->cylinderShader();
-        if (m_lastBoundShader != cylinderShader) {
-          cylinderShader->use();
-          m_lastBoundShader = cylinderShader;
+        Shader *cylinder_shader = m_cylinderPipeline->cylinderShader();
+        if (m_lastBoundShader != cylinder_shader) {
+          cylinder_shader->use();
+          m_lastBoundShader = cylinder_shader;
           m_lastBoundTexture = nullptr;
         }
         if (m_cylinderPipeline->m_cylinderUniforms.view_proj !=
             Shader::InvalidUniform) {
-          cylinderShader->setUniform(
+          cylinder_shader->setUniform(
               m_cylinderPipeline->m_cylinderUniforms.view_proj, view_proj);
         }
         m_cylinderPipeline->uploadCylinderInstances(instance_count);
@@ -255,16 +256,16 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
         if (glIsEnabled(GL_POLYGON_OFFSET_FILL) != 0U) {
           glDisable(GL_POLYGON_OFFSET_FILL);
         }
-        Shader *fogShader = m_cylinderPipeline->fogShader();
-        if (m_lastBoundShader != fogShader) {
-          fogShader->use();
-          m_lastBoundShader = fogShader;
+        Shader *fog_shader = m_cylinderPipeline->fogShader();
+        if (m_lastBoundShader != fog_shader) {
+          fog_shader->use();
+          m_lastBoundShader = fog_shader;
           m_lastBoundTexture = nullptr;
         }
         if (m_cylinderPipeline->m_fogUniforms.view_proj !=
             Shader::InvalidUniform) {
-          fogShader->setUniform(m_cylinderPipeline->m_fogUniforms.view_proj,
-                                view_proj);
+          fog_shader->setUniform(m_cylinderPipeline->m_fogUniforms.view_proj,
+                                 view_proj);
         }
         m_cylinderPipeline->uploadFogInstances(instance_count);
         m_cylinderPipeline->drawFog(instance_count);
@@ -373,17 +374,17 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
       DepthMaskScope const depth_mask(true);
       BlendScope const blend(false);
 
-      Shader *stoneShader = m_vegetationPipeline->stoneShader();
-      if (m_lastBoundShader != stoneShader) {
-        stoneShader->use();
-        m_lastBoundShader = stoneShader;
+      Shader *stone_shader = m_vegetationPipeline->stoneShader();
+      if (m_lastBoundShader != stone_shader) {
+        stone_shader->use();
+        m_lastBoundShader = stone_shader;
         m_lastBoundTexture = nullptr;
       }
 
       if (m_vegetationPipeline->m_stoneUniforms.view_proj !=
           Shader::InvalidUniform) {
-        stoneShader->setUniform(m_vegetationPipeline->m_stoneUniforms.view_proj,
-                                view_proj);
+        stone_shader->setUniform(
+            m_vegetationPipeline->m_stoneUniforms.view_proj, view_proj);
       }
       if (m_vegetationPipeline->m_stoneUniforms.light_direction !=
           Shader::InvalidUniform) {
@@ -391,7 +392,7 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
         if (!light_dir.isNull()) {
           light_dir.normalize();
         }
-        stoneShader->setUniform(
+        stone_shader->setUniform(
             m_vegetationPipeline->m_stoneUniforms.light_direction, light_dir);
       }
 
@@ -438,33 +439,34 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
         glDisable(GL_CULL_FACE);
       }
 
-      Shader *plantShader = m_vegetationPipeline->plantShader();
-      if (m_lastBoundShader != plantShader) {
-        plantShader->use();
-        m_lastBoundShader = plantShader;
+      Shader *plant_shader = m_vegetationPipeline->plantShader();
+      if (m_lastBoundShader != plant_shader) {
+        plant_shader->use();
+        m_lastBoundShader = plant_shader;
         m_lastBoundTexture = nullptr;
       }
 
       if (m_vegetationPipeline->m_plantUniforms.view_proj !=
           Shader::InvalidUniform) {
-        plantShader->setUniform(m_vegetationPipeline->m_plantUniforms.view_proj,
-                                view_proj);
+        plant_shader->setUniform(
+            m_vegetationPipeline->m_plantUniforms.view_proj, view_proj);
       }
       if (m_vegetationPipeline->m_plantUniforms.time !=
           Shader::InvalidUniform) {
-        plantShader->setUniform(m_vegetationPipeline->m_plantUniforms.time,
-                                plant.params.time);
+        plant_shader->setUniform(m_vegetationPipeline->m_plantUniforms.time,
+                                 plant.params.time);
       }
       if (m_vegetationPipeline->m_plantUniforms.windStrength !=
           Shader::InvalidUniform) {
-        plantShader->setUniform(
+        plant_shader->setUniform(
             m_vegetationPipeline->m_plantUniforms.windStrength,
             plant.params.windStrength);
       }
       if (m_vegetationPipeline->m_plantUniforms.windSpeed !=
           Shader::InvalidUniform) {
-        plantShader->setUniform(m_vegetationPipeline->m_plantUniforms.windSpeed,
-                                plant.params.windSpeed);
+        plant_shader->setUniform(
+            m_vegetationPipeline->m_plantUniforms.windSpeed,
+            plant.params.windSpeed);
       }
       if (m_vegetationPipeline->m_plantUniforms.light_direction !=
           Shader::InvalidUniform) {
@@ -472,7 +474,7 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
         if (!light_dir.isNull()) {
           light_dir.normalize();
         }
-        plantShader->setUniform(
+        plant_shader->setUniform(
             m_vegetationPipeline->m_plantUniforms.light_direction, light_dir);
       }
 
@@ -525,32 +527,32 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
         glDisable(GL_CULL_FACE);
       }
 
-      Shader *pineShader = m_vegetationPipeline->pineShader();
-      if (m_lastBoundShader != pineShader) {
-        pineShader->use();
-        m_lastBoundShader = pineShader;
+      Shader *pine_shader = m_vegetationPipeline->pineShader();
+      if (m_lastBoundShader != pine_shader) {
+        pine_shader->use();
+        m_lastBoundShader = pine_shader;
         m_lastBoundTexture = nullptr;
       }
 
       if (m_vegetationPipeline->m_pineUniforms.view_proj !=
           Shader::InvalidUniform) {
-        pineShader->setUniform(m_vegetationPipeline->m_pineUniforms.view_proj,
-                               view_proj);
+        pine_shader->setUniform(m_vegetationPipeline->m_pineUniforms.view_proj,
+                                view_proj);
       }
       if (m_vegetationPipeline->m_pineUniforms.time != Shader::InvalidUniform) {
-        pineShader->setUniform(m_vegetationPipeline->m_pineUniforms.time,
-                               pine.params.time);
+        pine_shader->setUniform(m_vegetationPipeline->m_pineUniforms.time,
+                                pine.params.time);
       }
       if (m_vegetationPipeline->m_pineUniforms.windStrength !=
           Shader::InvalidUniform) {
-        pineShader->setUniform(
+        pine_shader->setUniform(
             m_vegetationPipeline->m_pineUniforms.windStrength,
             pine.params.windStrength);
       }
       if (m_vegetationPipeline->m_pineUniforms.windSpeed !=
           Shader::InvalidUniform) {
-        pineShader->setUniform(m_vegetationPipeline->m_pineUniforms.windSpeed,
-                               pine.params.windSpeed);
+        pine_shader->setUniform(m_vegetationPipeline->m_pineUniforms.windSpeed,
+                                pine.params.windSpeed);
       }
       if (m_vegetationPipeline->m_pineUniforms.light_direction !=
           Shader::InvalidUniform) {
@@ -558,7 +560,7 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
         if (!light_dir.isNull()) {
           light_dir.normalize();
         }
-        pineShader->setUniform(
+        pine_shader->setUniform(
             m_vegetationPipeline->m_pineUniforms.light_direction, light_dir);
       }
 
@@ -612,39 +614,39 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
         glDisable(GL_CULL_FACE);
       }
 
-      Shader *firecampShader = m_vegetationPipeline->firecampShader();
-      if (m_lastBoundShader != firecampShader) {
-        firecampShader->use();
-        m_lastBoundShader = firecampShader;
+      Shader *firecamp_shader = m_vegetationPipeline->firecampShader();
+      if (m_lastBoundShader != firecamp_shader) {
+        firecamp_shader->use();
+        m_lastBoundShader = firecamp_shader;
         m_lastBoundTexture = nullptr;
       }
 
       if (m_vegetationPipeline->m_firecampUniforms.view_proj !=
           Shader::InvalidUniform) {
-        firecampShader->setUniform(
+        firecamp_shader->setUniform(
             m_vegetationPipeline->m_firecampUniforms.view_proj, view_proj);
       }
       if (m_vegetationPipeline->m_firecampUniforms.time !=
           Shader::InvalidUniform) {
-        firecampShader->setUniform(
+        firecamp_shader->setUniform(
             m_vegetationPipeline->m_firecampUniforms.time,
             firecamp.params.time);
       }
       if (m_vegetationPipeline->m_firecampUniforms.flickerSpeed !=
           Shader::InvalidUniform) {
-        firecampShader->setUniform(
+        firecamp_shader->setUniform(
             m_vegetationPipeline->m_firecampUniforms.flickerSpeed,
             firecamp.params.flickerSpeed);
       }
       if (m_vegetationPipeline->m_firecampUniforms.flickerAmount !=
           Shader::InvalidUniform) {
-        firecampShader->setUniform(
+        firecamp_shader->setUniform(
             m_vegetationPipeline->m_firecampUniforms.flickerAmount,
             firecamp.params.flickerAmount);
       }
       if (m_vegetationPipeline->m_firecampUniforms.glowStrength !=
           Shader::InvalidUniform) {
-        firecampShader->setUniform(
+        firecamp_shader->setUniform(
             m_vegetationPipeline->m_firecampUniforms.glowStrength,
             firecamp.params.glowStrength);
       }
@@ -656,7 +658,7 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
         } else {
           camera_right.normalize();
         }
-        firecampShader->setUniform(
+        firecamp_shader->setUniform(
             m_vegetationPipeline->m_firecampUniforms.camera_right,
             camera_right);
       }
@@ -668,7 +670,7 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
         } else {
           camera_forward.normalize();
         }
-        firecampShader->setUniform(
+        firecamp_shader->setUniform(
             m_vegetationPipeline->m_firecampUniforms.camera_forward,
             camera_forward);
       }
@@ -677,7 +679,7 @@ void Backend::execute(const DrawQueue &queue, const Camera &cam) {
           Shader::InvalidUniform) {
         if (m_resources && (m_resources->white() != nullptr)) {
           m_resources->white()->bind(0);
-          firecampShader->setUniform(
+          firecamp_shader->setUniform(
               m_vegetationPipeline->m_firecampUniforms.fireTexture, 0);
         }
       }

+ 1 - 0
render/gl/backend/cylinder_pipeline.cpp

@@ -8,6 +8,7 @@
 #include <QOpenGLContext>
 #include <algorithm>
 #include <cstddef>
+#include <qopenglcontext.h>
 #include <qopenglext.h>
 #include <qstringliteral.h>
 

+ 1 - 0
render/gl/backend/vegetation_pipeline.cpp

@@ -8,6 +8,7 @@
 #include <cstddef>
 #include <cstdint>
 #include <qglobal.h>
+#include <qopenglcontext.h>
 #include <qopenglext.h>
 #include <qstringliteral.h>
 #include <qvectornd.h>

+ 27 - 26
render/gl/camera.cpp

@@ -16,7 +16,7 @@ namespace Render::GL {
 using namespace Render::GL::FrustumPlane;
 
 namespace {
-constexpr float kEps = 1e-6F;
+constexpr float k_eps = 1e-6F;
 constexpr float k_tiny = 1e-4F;
 constexpr float k_min_dist = 1.0F;
 constexpr float k_max_dist = 200.0F;
@@ -54,7 +54,7 @@ inline auto finite(const QVector3D &v) -> bool {
 inline auto finite(float v) -> bool { return qIsFinite(v); }
 
 inline auto safeNormalize(const QVector3D &v, const QVector3D &fallback,
-                          float eps = kEps) -> QVector3D {
+                          float eps = k_eps) -> QVector3D {
   if (!finite(v)) {
     return fallback;
   }
@@ -74,7 +74,7 @@ inline void orthonormalize(const QVector3D &frontIn, QVector3D &frontOut,
                     ? QVector3D(0, 0, 1)
                     : world_up;
   QVector3D r = QVector3D::crossProduct(f, u);
-  if (r.lengthSquared() < kEps) {
+  if (r.lengthSquared() < k_eps) {
     r = QVector3D(1, 0, 0);
   }
   r = r.normalized();
@@ -148,9 +148,10 @@ void Camera::setTarget(const QVector3D &target) {
   applySoftBoundaries();
 
   QVector3D dir = (m_target - m_position);
-  if (dir.lengthSquared() < kEps) {
-    m_target = m_position +
-               (m_front.lengthSquared() < kEps ? QVector3D(0, 0, -1) : m_front);
+  if (dir.lengthSquared() < k_eps) {
+    m_target =
+        m_position +
+        (m_front.lengthSquared() < k_eps ? QVector3D(0, 0, -1) : m_front);
     dir = (m_target - m_position);
   }
   orthonormalize(dir, m_front, m_right, m_up);
@@ -160,9 +161,9 @@ void Camera::setUp(const QVector3D &up) {
   if (!finite(up)) {
     return;
   }
-  QVector3D upN = up;
-  if (upN.lengthSquared() < kEps) {
-    upN = QVector3D(0, 1, 0);
+  QVector3D up_n = up;
+  if (up_n.lengthSquared() < k_eps) {
+    up_n = QVector3D(0, 1, 0);
   }
 
   orthonormalize(m_target - m_position, m_front, m_right, m_up);
@@ -179,7 +180,7 @@ void Camera::lookAt(const QVector3D &position, const QVector3D &target,
   applySoftBoundaries();
 
   QVector3D const f = (m_target - m_position);
-  m_up = up.lengthSquared() < kEps ? QVector3D(0, 1, 0) : up.normalized();
+  m_up = up.lengthSquared() < k_eps ? QVector3D(0, 1, 0) : up.normalized();
   orthonormalize(f, m_front, m_right, m_up);
 }
 
@@ -281,9 +282,9 @@ void Camera::zoomDistance(float delta) {
   }
   factor = std::clamp(factor, k_zoom_factor_min, k_zoom_factor_max);
 
-  float const newR = std::clamp(r * factor, k_min_dist, k_max_dist);
+  float const new_r = std::clamp(r * factor, k_min_dist, k_max_dist);
   QVector3D const dir = safeNormalize(offset, QVector3D(0, 0, 1));
-  QVector3D const new_pos = m_target + dir * newR;
+  QVector3D const new_pos = m_target + dir * new_r;
 
   m_position = new_pos;
 
@@ -421,7 +422,7 @@ auto Camera::screenToGround(qreal sx, qreal sy, qreal screenW, qreal screenH,
   QVector4D const near_world4 = inv_vp * near_clip;
   QVector4D const far_world4 = inv_vp * far_clip;
 
-  if (std::abs(near_world4.w()) < kEps || std::abs(far_world4.w()) < kEps) {
+  if (std::abs(near_world4.w()) < k_eps || std::abs(far_world4.w()) < k_eps) {
     return false;
   }
 
@@ -433,7 +434,7 @@ auto Camera::screenToGround(qreal sx, qreal sy, qreal screenW, qreal screenH,
 
   QVector3D const ray_dir =
       safeNormalize(ray_end - ray_origin, QVector3D(0, -1, 0));
-  if (std::abs(ray_dir.y()) < kEps) {
+  if (std::abs(ray_dir.y()) < k_eps) {
     return false;
   }
 
@@ -457,7 +458,7 @@ auto Camera::worldToScreen(const QVector3D &world, qreal screenW, qreal screenH,
 
   QVector4D const clip =
       getProjectionMatrix() * getViewMatrix() * QVector4D(world, 1.0F);
-  if (std::abs(clip.w()) < kEps) {
+  if (std::abs(clip.w()) < k_eps) {
     return false;
   }
 
@@ -642,7 +643,7 @@ void Camera::applySoftBoundaries(bool isPanning) {
   float const ext_max_z = map_max_z + margin_z;
 
   QVector3D const target_to_pos = m_position - m_target;
-  float const target_to_posDist = target_to_pos.length();
+  float const target_to_pos_dist = target_to_pos.length();
 
   QVector3D position_adjustment(0, 0, 0);
   QVector3D target_adjustment(0, 0, 0);
@@ -694,9 +695,9 @@ void Camera::applySoftBoundaries(bool isPanning) {
     m_target += target_adjustment * (isPanning ? k_boundary_panning_smoothness
                                                : k_boundary_smoothness);
 
-    if (target_to_posDist > k_tiny) {
+    if (target_to_pos_dist > k_tiny) {
       QVector3D const dir = target_to_pos.normalized();
-      m_position = m_target + dir * target_to_posDist;
+      m_position = m_target + dir * target_to_pos_dist;
     }
   }
 
@@ -750,17 +751,17 @@ auto Camera::isInFrustum(const QVector3D &center, float radius) const -> bool {
                            m[Index11] + m[Index9]);
   float const bottom_d = m[15] + m[13];
 
-  QVector3D const topN(m[Index3] - m[Index1], m[Index7] - m[Index5],
-                       m[Index11] - m[Index9]);
-  float const topD = m[15] - m[13];
+  QVector3D const top_n(m[Index3] - m[Index1], m[Index7] - m[Index5],
+                        m[Index11] - m[Index9]);
+  float const top_d = m[15] - m[13];
 
   QVector3D const near_n(m[Index3] + m[Index2], m[Index7] + m[Index6],
                          m[Index11] + m[Index10]);
   float const near_d = m[15] + m[14];
 
-  QVector3D const farN(m[Index3] - m[Index2], m[Index7] - m[Index6],
-                       m[Index11] - m[Index10]);
-  float const farD = m[15] - m[14];
+  QVector3D const far_n(m[Index3] - m[Index2], m[Index7] - m[Index6],
+                        m[Index11] - m[Index10]);
+  float const far_d = m[15] - m[14];
 
   auto test_plane = [&center, radius](const QVector3D &n, float d) -> bool {
     float const len = n.length();
@@ -772,8 +773,8 @@ auto Camera::isInFrustum(const QVector3D &center, float radius) const -> bool {
   };
 
   return test_plane(left_n, left_d) && test_plane(right_n, right_d) &&
-         test_plane(bottom_n, bottom_d) && test_plane(topN, topD) &&
-         test_plane(near_n, near_d) && test_plane(farN, farD);
+         test_plane(bottom_n, bottom_d) && test_plane(top_n, top_d) &&
+         test_plane(near_n, near_d) && test_plane(far_n, far_d);
 }
 
 } // namespace Render::GL

+ 3 - 3
render/gl/mesh.cpp

@@ -99,11 +99,11 @@ auto createPlaneMesh(float width, float height, int subdivisions) -> Mesh * {
 
   for (int z = 0; z <= subdivisions; ++z) {
     for (int x = 0; x <= subdivisions; ++x) {
-      float xPos = (x / static_cast<float>(subdivisions)) * width - half_width;
-      float zPos =
+      float x_pos = (x / static_cast<float>(subdivisions)) * width - half_width;
+      float z_pos =
           (z / static_cast<float>(subdivisions)) * height - half_height;
 
-      vertices.push_back({{xPos, 0.0F, zPos},
+      vertices.push_back({{x_pos, 0.0F, z_pos},
                           {0.0F, 1.0F, 0.0F},
                           {x / static_cast<float>(subdivisions),
                            z / static_cast<float>(subdivisions)}});

+ 22 - 22
render/gl/primitives.cpp

@@ -12,7 +12,7 @@ namespace Render::GL {
 
 namespace {
 
-constexpr float kPi = std::numbers::pi_v<float>;
+constexpr float k_pi = std::numbers::pi_v<float>;
 constexpr float k_two_pi = 6.28318530718F;
 constexpr float k_half_scalar = 0.5F;
 constexpr float k_unit_radius = 1.0F;
@@ -104,7 +104,7 @@ auto createUnitSphereMesh(int latSegments, int lonSegments) -> Mesh * {
 
   for (int y = 0; y <= latSegments; ++y) {
     float vy = float(y) / float(latSegments);
-    float const phi = vy * kPi;
+    float const phi = vy * k_pi;
     float py = r * std::cos(phi);
     float const pr = r * std::sin(phi);
 
@@ -412,22 +412,22 @@ auto createUnitTorsoMesh(int radialSegments, int heightSegments) -> Mesh * {
 
   auto theta_scale = [&](float t, float ang) {
     float s = 0.0F;
-    float const sinA = std::sin(ang);
-    float const cosA = std::cos(ang);
-    float const cos2 = cosA * cosA;
+    float const sin_a = std::sin(ang);
+    float const cos_a = std::cos(ang);
+    float const cos2 = cos_a * cos_a;
     s += k_theta_sin_pos_amp *
          smooth_band(t, k_theta_sin_pos_start, k_theta_sin_pos_end) *
-         std::max(0.0F, sinA);
+         std::max(0.0F, sin_a);
     s += k_theta_sin_neg_amp *
          smooth_band(t, k_theta_sin_neg_start, k_theta_sin_neg_end) *
-         std::max(0.0F, -sinA);
+         std::max(0.0F, -sin_a);
     s += k_theta_cos_sq_amp *
          smooth_band(t, k_theta_cos_sq_start, k_theta_cos_sq_end) * cos2;
     s += k_theta_cos_sq_neg_amp *
          smooth_band(t, k_theta_cos_sq_neg_start, k_theta_cos_sq_neg_end) *
          cos2;
     s += k_theta_cos_amp * smooth_band(t, k_theta_cos_start, k_theta_cos_end) *
-         cosA;
+         cos_a;
     return 1.0F + s;
   };
 
@@ -439,13 +439,13 @@ auto createUnitTorsoMesh(int radialSegments, int heightSegments) -> Mesh * {
   auto sample_pos = [&](float t, float ang) -> QVector3D {
     float const ts = invert_profile ? (1.0F - t) : t;
 
-    Axes const A = sample_axes(ts);
+    Axes const a = sample_axes(ts);
     float const twist = twist_at(ts);
     float const th = ang + twist;
 
-    float const R = ellipse_radius(A.ax, A.az, th);
-    float const S = theta_scale(ts, th);
-    float const r = R * S;
+    float const radius = ellipse_radius(a.ax, a.az, th);
+    float const s = theta_scale(ts, th);
+    float const r = radius * s;
 
     float px = r * std::cos(th);
     float pz = r * std::sin(th);
@@ -517,16 +517,16 @@ auto createUnitTorsoMesh(int radialSegments, int heightSegments) -> Mesh * {
   {
 
     int base_top = (int)v.size();
-    float const tTop = 1.0F;
-    float const t_top_s = invert_profile ? (1.0F - tTop) : tTop;
-    QVector3D const cTop(x_offset_at(t_top_s), half_h, z_offset_at(t_top_s));
-    v.push_back({{cTop.x(), cTop.y(), cTop.z()},
+    float const t_top = 1.0F;
+    float const t_top_s = invert_profile ? (1.0F - t_top) : t_top;
+    QVector3D const c_top(x_offset_at(t_top_s), half_h, z_offset_at(t_top_s));
+    v.push_back({{c_top.x(), c_top.y(), c_top.z()},
                  {0, 1, 0},
                  {k_uv_center, k_uv_center}});
     for (int i = 0; i <= radialSegments; ++i) {
       float const u = float(i) / float(radialSegments);
       float const ang = u * k_two_pi;
-      QVector3D const p = sample_pos(tTop, ang);
+      QVector3D const p = sample_pos(t_top, ang);
       v.push_back({{p.x(), p.y(), p.z()},
                    {0, 1, 0},
                    {k_uv_center + k_uv_scale * std::cos(ang),
@@ -541,16 +541,16 @@ auto createUnitTorsoMesh(int radialSegments, int heightSegments) -> Mesh * {
   {
 
     int base_bot = (int)v.size();
-    float const tBot = 0.0F;
-    float const t_bot_s = invert_profile ? (1.0F - tBot) : tBot;
-    QVector3D const cBot(x_offset_at(t_bot_s), -half_h, z_offset_at(t_bot_s));
-    v.push_back({{cBot.x(), cBot.y(), cBot.z()},
+    float const t_bot = 0.0F;
+    float const t_bot_s = invert_profile ? (1.0F - t_bot) : t_bot;
+    QVector3D const c_bot(x_offset_at(t_bot_s), -half_h, z_offset_at(t_bot_s));
+    v.push_back({{c_bot.x(), c_bot.y(), c_bot.z()},
                  {0, -1, 0},
                  {k_uv_center, k_uv_center}});
     for (int i = 0; i <= radialSegments; ++i) {
       float const u = float(i) / float(radialSegments);
       float const ang = u * k_two_pi;
-      QVector3D const p = sample_pos(tBot, ang);
+      QVector3D const p = sample_pos(t_bot, ang);
       v.push_back({{p.x(), p.y(), p.z()},
                    {0, -1, 0},
                    {k_uv_center + k_uv_scale * std::cos(ang),

+ 14 - 13
render/ground/biome_renderer.cpp

@@ -12,6 +12,7 @@
 #include <QVector2D>
 #include <algorithm>
 #include <cmath>
+#include <cstddef>
 #include <cstdint>
 #include <memory>
 #include <optional>
@@ -144,7 +145,7 @@ void BiomeRenderer::generateGrassInstances() {
   const float edge_margin_x = static_cast<float>(m_width) * edge_padding;
   const float edge_margin_z = static_cast<float>(m_height) * edge_padding;
 
-  std::vector<QVector3D> normals(m_width * m_height,
+  std::vector<QVector3D> normals(static_cast<qsizetype>(m_width * m_height),
                                  QVector3D(0.0F, 1.0F, 0.0F));
 
   auto sample_height_at = [&](float gx, float gz) -> float {
@@ -173,13 +174,13 @@ void BiomeRenderer::generateGrassInstances() {
       float const gz0 = std::clamp(float(z) - 1.0F, 0.0F, float(m_height - 1));
       float const gz1 = std::clamp(float(z) + 1.0F, 0.0F, float(m_height - 1));
 
-      float const hL = sample_height_at(gx0, float(z));
-      float const hR = sample_height_at(gx1, float(z));
-      float const hD = sample_height_at(float(x), gz0);
-      float const hU = sample_height_at(float(x), gz1);
+      float const h_l = sample_height_at(gx0, float(z));
+      float const h_r = sample_height_at(gx1, float(z));
+      float const h_d = sample_height_at(float(x), gz0);
+      float const h_u = sample_height_at(float(x), gz1);
 
-      QVector3D const dx(2.0F * m_tile_size, hR - hL, 0.0F);
-      QVector3D const dz(0.0F, hU - hD, 2.0F * m_tile_size);
+      QVector3D const dx(2.0F * m_tile_size, h_r - h_l, 0.0F);
+      QVector3D const dz(0.0F, h_u - h_d, 2.0F * m_tile_size);
       QVector3D n = QVector3D::crossProduct(dz, dx);
       if (n.lengthSquared() > 0.0F) {
         n.normalize();
@@ -222,8 +223,8 @@ void BiomeRenderer::generateGrassInstances() {
         int const nx = ix + dx;
         int const nz = iz + dz;
         if (nx >= 0 && nx < m_width && nz >= 0 && nz < m_height) {
-          int const nIdx = nz * m_width + nx;
-          if (m_terrain_types[nIdx] == Game::Map::TerrainType::River) {
+          int const n_idx = nz * m_width + nx;
+          if (m_terrain_types[n_idx] == Game::Map::TerrainType::River) {
             near_river_count++;
           }
         }
@@ -344,10 +345,10 @@ void BiomeRenderer::generateGrassInstances() {
                                     0.25F;
           chunk_height_sum += quad_height;
 
-          float const nY = (normals[idx0].y() + normals[idx1].y() +
-                            normals[idx2].y() + normals[idx3].y()) *
-                           0.25F;
-          chunk_slope_sum += 1.0F - std::clamp(nY, 0.0F, 1.0F);
+          float const n_y = (normals[idx0].y() + normals[idx1].y() +
+                             normals[idx2].y() + normals[idx3].y()) *
+                            0.25F;
+          chunk_slope_sum += 1.0F - std::clamp(n_y, 0.0F, 1.0F);
           sample_count++;
         }
       }

+ 14 - 14
render/ground/bridge_renderer.cpp

@@ -137,20 +137,20 @@ void BridgeRenderer::buildMeshes() {
 
       float const tex_u0 = 0.0F;
       float const tex_u1 = 1.0F;
-      float const texV = t * length * 0.4F;
-
-      add_vertex(top_left, QVector3D(0.0F, 1.0F, 0.0F), tex_u0, texV);
-      add_vertex(top_right, QVector3D(0.0F, 1.0F, 0.0F), tex_u1, texV);
-      add_vertex(bottom_left, QVector3D(0.0F, -1.0F, 0.0F), tex_u0, texV);
-      add_vertex(bottom_right, QVector3D(0.0F, -1.0F, 0.0F), tex_u1, texV);
-      add_vertex(side_left_top, left_normal, tex_u0, texV);
-      add_vertex(side_left_bottom, left_normal, tex_u0, texV);
-      add_vertex(side_right_top, right_normal, tex_u1, texV);
-      add_vertex(side_right_bottom, right_normal, tex_u1, texV);
-      add_vertex(parapet_left_top, left_normal, tex_u0, texV);
-      add_vertex(parapet_left_bottom, left_normal, tex_u0, texV);
-      add_vertex(parapet_right_top, right_normal, tex_u1, texV);
-      add_vertex(parapet_right_bottom, right_normal, tex_u1, texV);
+      float const tex_v = t * length * 0.4F;
+
+      add_vertex(top_left, QVector3D(0.0F, 1.0F, 0.0F), tex_u0, tex_v);
+      add_vertex(top_right, QVector3D(0.0F, 1.0F, 0.0F), tex_u1, tex_v);
+      add_vertex(bottom_left, QVector3D(0.0F, -1.0F, 0.0F), tex_u0, tex_v);
+      add_vertex(bottom_right, QVector3D(0.0F, -1.0F, 0.0F), tex_u1, tex_v);
+      add_vertex(side_left_top, left_normal, tex_u0, tex_v);
+      add_vertex(side_left_bottom, left_normal, tex_u0, tex_v);
+      add_vertex(side_right_top, right_normal, tex_u1, tex_v);
+      add_vertex(side_right_bottom, right_normal, tex_u1, tex_v);
+      add_vertex(parapet_left_top, left_normal, tex_u0, tex_v);
+      add_vertex(parapet_left_bottom, left_normal, tex_u0, tex_v);
+      add_vertex(parapet_right_top, right_normal, tex_u1, tex_v);
+      add_vertex(parapet_right_bottom, right_normal, tex_u1, tex_v);
 
       if (i < length_segments) {
         auto const base_idx =

+ 7 - 6
render/ground/firecamp_renderer.cpp

@@ -248,16 +248,17 @@ void FireCampRenderer::generateFireCampInstances() {
 
   float const fire_camp_density = 0.02F;
 
-  std::vector<QVector3D> normals(m_width * m_height, QVector3D(0, 1, 0));
+  std::vector<QVector3D> normals(static_cast<qsizetype>(m_width * m_height),
+                                 QVector3D(0, 1, 0));
   for (int z = 1; z < m_height - 1; ++z) {
     for (int x = 1; x < m_width - 1; ++x) {
       int const idx = z * m_width + x;
-      float const hL = m_heightData[(z)*m_width + (x - 1)];
-      float const hR = m_heightData[(z)*m_width + (x + 1)];
-      float const hD = m_heightData[(z - 1) * m_width + (x)];
-      float const hU = m_heightData[(z + 1) * m_width + (x)];
+      float const h_l = m_heightData[(z)*m_width + (x - 1)];
+      float const h_r = m_heightData[(z)*m_width + (x + 1)];
+      float const h_d = m_heightData[(z - 1) * m_width + (x)];
+      float const h_u = m_heightData[(z + 1) * m_width + (x)];
 
-      QVector3D n = QVector3D(hL - hR, 2.0F * tile_safe, hD - hU);
+      QVector3D n = QVector3D(h_l - h_r, 2.0F * tile_safe, h_d - h_u);
       if (n.lengthSquared() > 0.0F) {
         n.normalize();
       } else {

+ 2 - 2
render/ground/ground_renderer.cpp

@@ -111,8 +111,8 @@ auto GroundRenderer::buildParams() const -> TerrainChunkParams {
 
   params.rockDetailStrength = m_biomeSettings.terrainRockDetailStrength * 0.18F;
 
-  QVector3D const L(0.35F, 0.85F, 0.42F);
-  params.light_direction = L.normalized();
+  QVector3D const l(0.35F, 0.85F, 0.42F);
+  params.light_direction = l.normalized();
 
   params.isGroundPlane = true;
 

+ 8 - 6
render/ground/pine_renderer.cpp

@@ -11,6 +11,7 @@
 #include <QVector2D>
 #include <algorithm>
 #include <cmath>
+#include <cstddef>
 #include <cstdint>
 #include <memory>
 #include <vector>
@@ -139,16 +140,17 @@ void PineRenderer::generatePineInstances() {
     pine_density = m_biomeSettings.plant_density * 0.3F;
   }
 
-  std::vector<QVector3D> normals(m_width * m_height, QVector3D(0, 1, 0));
+  std::vector<QVector3D> normals(static_cast<qsizetype>(m_width * m_height),
+                                 QVector3D(0, 1, 0));
   for (int z = 1; z < m_height - 1; ++z) {
     for (int x = 1; x < m_width - 1; ++x) {
       int const idx = z * m_width + x;
-      float const hL = m_heightData[(z)*m_width + (x - 1)];
-      float const hR = m_heightData[(z)*m_width + (x + 1)];
-      float const hD = m_heightData[(z - 1) * m_width + (x)];
-      float const hU = m_heightData[(z + 1) * m_width + (x)];
+      float const h_l = m_heightData[(z)*m_width + (x - 1)];
+      float const h_r = m_heightData[(z)*m_width + (x + 1)];
+      float const h_d = m_heightData[(z - 1) * m_width + (x)];
+      float const h_u = m_heightData[(z + 1) * m_width + (x)];
 
-      QVector3D n = QVector3D(hL - hR, 2.0F * tile_safe, hD - hU);
+      QVector3D n = QVector3D(h_l - h_r, 2.0F * tile_safe, h_d - h_u);
       if (n.lengthSquared() > 0.0F) {
         n.normalize();
       } else {

+ 10 - 9
render/ground/plant_renderer.cpp

@@ -11,6 +11,7 @@
 #include <QVector2D>
 #include <algorithm>
 #include <cmath>
+#include <cstddef>
 #include <cstdint>
 #include <memory>
 #include <vector>
@@ -161,7 +162,7 @@ void PlantRenderer::generatePlantInstances() {
   const float edge_margin_x = static_cast<float>(m_width) * edge_padding;
   const float edge_margin_z = static_cast<float>(m_height) * edge_padding;
 
-  std::vector<QVector3D> normals(m_width * m_height,
+  std::vector<QVector3D> normals(static_cast<qsizetype>(m_width * m_height),
                                  QVector3D(0.0F, 1.0F, 0.0F));
 
   auto sample_height_at = [&](float gx, float gz) -> float {
@@ -190,13 +191,13 @@ void PlantRenderer::generatePlantInstances() {
       float const gz0 = std::clamp(float(z) - 1.0F, 0.0F, float(m_height - 1));
       float const gz1 = std::clamp(float(z) + 1.0F, 0.0F, float(m_height - 1));
 
-      float const hL = sample_height_at(gx0, float(z));
-      float const hR = sample_height_at(gx1, float(z));
-      float const hD = sample_height_at(float(x), gz0);
-      float const hU = sample_height_at(float(x), gz1);
+      float const h_l = sample_height_at(gx0, float(z));
+      float const h_r = sample_height_at(gx1, float(z));
+      float const h_d = sample_height_at(float(x), gz0);
+      float const h_u = sample_height_at(float(x), gz1);
 
-      QVector3D const dx(2.0F * m_tile_size, hR - hL, 0.0F);
-      QVector3D const dz(0.0F, hU - hD, 2.0F * m_tile_size);
+      QVector3D const dx(2.0F * m_tile_size, h_r - h_l, 0.0F);
+      QVector3D const dz(0.0F, h_u - h_d, 2.0F * m_tile_size);
       QVector3D n = QVector3D::crossProduct(dz, dx);
       if (n.lengthSquared() > 0.0F) {
         n.normalize();
@@ -237,8 +238,8 @@ void PlantRenderer::generatePlantInstances() {
         int const nx = ix + dx;
         int const nz = iz + dz;
         if (nx >= 0 && nx < m_width && nz >= 0 && nz < m_height) {
-          int const nIdx = nz * m_width + nx;
-          if (m_terrain_types[nIdx] == Game::Map::TerrainType::River) {
+          int const n_idx = nz * m_width + nx;
+          if (m_terrain_types[n_idx] == Game::Map::TerrainType::River) {
             return false;
           }
         }

+ 1 - 2
render/ground/riverbank_asset_renderer.cpp

@@ -68,8 +68,7 @@ void RiverbankAssetRenderer::configure(
   generateAssetInstances();
 }
 
-void RiverbankAssetRenderer::submit(Renderer &renderer,
-                                    ResourceManager *resources) {
+void RiverbankAssetRenderer::submit(Renderer &, ResourceManager *resources) {
   Q_UNUSED(resources);
 
   if (m_assetInstanceCount == 0) {

+ 10 - 9
render/ground/stone_renderer.cpp

@@ -12,6 +12,7 @@
 #include <QVector2D>
 #include <algorithm>
 #include <cmath>
+#include <cstddef>
 #include <cstdint>
 #include <memory>
 #include <qelapsedtimer.h>
@@ -114,7 +115,7 @@ void StoneRenderer::generateStoneInstances() {
   const float edge_margin_x = static_cast<float>(m_width) * edge_padding;
   const float edge_margin_z = static_cast<float>(m_height) * edge_padding;
 
-  std::vector<QVector3D> normals(m_width * m_height,
+  std::vector<QVector3D> normals(static_cast<qsizetype>(m_width * m_height),
                                  QVector3D(0.0F, 1.0F, 0.0F));
 
   auto sample_height_at = [&](float gx, float gz) -> float {
@@ -143,13 +144,13 @@ void StoneRenderer::generateStoneInstances() {
       float const gz0 = std::clamp(float(z) - 1.0F, 0.0F, float(m_height - 1));
       float const gz1 = std::clamp(float(z) + 1.0F, 0.0F, float(m_height - 1));
 
-      float const hL = sample_height_at(gx0, float(z));
-      float const hR = sample_height_at(gx1, float(z));
-      float const hD = sample_height_at(float(x), gz0);
-      float const hU = sample_height_at(float(x), gz1);
+      float const h_l = sample_height_at(gx0, float(z));
+      float const h_r = sample_height_at(gx1, float(z));
+      float const h_d = sample_height_at(float(x), gz0);
+      float const h_u = sample_height_at(float(x), gz1);
 
-      QVector3D const dx(2.0F * m_tile_size, hR - hL, 0.0F);
-      QVector3D const dz(0.0F, hU - hD, 2.0F * m_tile_size);
+      QVector3D const dx(2.0F * m_tile_size, h_r - h_l, 0.0F);
+      QVector3D const dz(0.0F, h_u - h_d, 2.0F * m_tile_size);
       QVector3D n = QVector3D::crossProduct(dz, dx);
       if (n.lengthSquared() > 0.0F) {
         n.normalize();
@@ -183,8 +184,8 @@ void StoneRenderer::generateStoneInstances() {
         int const nx = ix + dx;
         int const nz = iz + dz;
         if (nx >= 0 && nx < m_width && nz >= 0 && nz < m_height) {
-          int const nIdx = nz * m_width + nx;
-          if (m_terrain_types[nIdx] == Game::Map::TerrainType::River) {
+          int const n_idx = nz * m_width + nx;
+          if (m_terrain_types[n_idx] == Game::Map::TerrainType::River) {
             return false;
           }
         }

+ 35 - 35
render/ground/terrain_renderer.cpp

@@ -207,12 +207,12 @@ void TerrainRenderer::buildMeshes() {
     float const gx1 = std::clamp(gx + 1.0F, 0.0F, float(m_width - 1));
     float const gz0 = std::clamp(gz - 1.0F, 0.0F, float(m_height - 1));
     float const gz1 = std::clamp(gz + 1.0F, 0.0F, float(m_height - 1));
-    float const hL = sample_height_at(gx0, gz);
-    float const hR = sample_height_at(gx1, gz);
-    float const hD = sample_height_at(gx, gz0);
-    float const hU = sample_height_at(gx, gz1);
-    QVector3D const dx(2.0F * m_tile_size, hR - hL, 0.0F);
-    QVector3D const dz(0.0F, hU - hD, 2.0F * m_tile_size);
+    float const h_l = sample_height_at(gx0, gz);
+    float const h_r = sample_height_at(gx1, gz);
+    float const h_d = sample_height_at(gx, gz0);
+    float const h_u = sample_height_at(gx, gz1);
+    QVector3D const dx(2.0F * m_tile_size, h_r - h_l, 0.0F);
+    QVector3D const dz(0.0F, h_u - h_d, 2.0F * m_tile_size);
     QVector3D n = QVector3D::crossProduct(dz, dx);
     if (n.lengthSquared() > 0.0F) {
       n.normalize();
@@ -241,7 +241,7 @@ void TerrainRenderer::buildMeshes() {
 
   {
     std::vector<QVector3D> filtered = normals;
-    auto getN = [&](int x, int z) -> QVector3D & {
+    auto get_n = [&](int x, int z) -> QVector3D & {
       return normals[z * m_width + x];
     };
 
@@ -251,11 +251,11 @@ void TerrainRenderer::buildMeshes() {
         const float h0 = m_heightData[idx];
         const float nh = (h0 - min_h) / height_range;
 
-        const float hL = m_heightData[z * m_width + (x - 1)];
-        const float hR = m_heightData[z * m_width + (x + 1)];
-        const float hD = m_heightData[(z - 1) * m_width + x];
-        const float hU = m_heightData[(z + 1) * m_width + x];
-        const float avg_nbr = 0.25F * (hL + hR + hD + hU);
+        const float h_l = m_heightData[z * m_width + (x - 1)];
+        const float h_r = m_heightData[z * m_width + (x + 1)];
+        const float h_d = m_heightData[(z - 1) * m_width + x];
+        const float h_u = m_heightData[(z + 1) * m_width + x];
+        const float avg_nbr = 0.25F * (h_l + h_r + h_d + h_u);
         const float convexity = h0 - avg_nbr;
 
         const QVector3D n0 = normals[idx];
@@ -273,10 +273,10 @@ void TerrainRenderer::buildMeshes() {
           for (int dx = -1; dx <= 1; ++dx) {
             const int nx = x + dx;
             const int nz = z + dz;
-            const int nIdx = nz * m_width + nx;
+            const int n_idx = nz * m_width + nx;
 
-            const float dh = std::abs(m_heightData[nIdx] - h0);
-            const QVector3D nn = getN(nx, nz);
+            const float dh = std::abs(m_heightData[n_idx] - h0);
+            const QVector3D nn = get_n(nx, nz);
             const float ndot = std::max(0.0F, QVector3D::dotProduct(n0, nn));
 
             const float w_h = 1.0F / (1.0F + 2.0F * dh);
@@ -456,10 +456,10 @@ void TerrainRenderer::buildMeshes() {
             section.heightSum += quad_height;
             section.heightCount += 1;
 
-            float const nY = (normals[idx0].y() + normals[idx1].y() +
-                              normals[idx2].y() + normals[idx3].y()) *
-                             0.25F;
-            float const slope = 1.0F - std::clamp(nY, 0.0F, 1.0F);
+            float const n_y = (normals[idx0].y() + normals[idx1].y() +
+                               normals[idx2].y() + normals[idx3].y()) *
+                              0.25F;
+            float const slope = 1.0F - std::clamp(n_y, 0.0F, 1.0F);
             section.slopeSum += slope;
 
             float const hmin =
@@ -471,19 +471,19 @@ void TerrainRenderer::buildMeshes() {
             section.heightVarSum += (hmax - hmin);
             section.statCount += 1;
 
-            auto H = [&](int gx, int gz) {
+            auto h = [&](int gx, int gz) {
               gx = std::clamp(gx, 0, m_width - 1);
               gz = std::clamp(gz, 0, m_height - 1);
               return m_heightData[gz * m_width + gx];
             };
             int const cx = x;
             int const cz = z;
-            float const hC = quad_height;
+            float const h_c = quad_height;
             float ao = 0.0F;
-            ao += std::max(0.0F, H(cx - 1, cz) - hC);
-            ao += std::max(0.0F, H(cx + 1, cz) - hC);
-            ao += std::max(0.0F, H(cx, cz - 1) - hC);
-            ao += std::max(0.0F, H(cx, cz + 1) - hC);
+            ao += std::max(0.0F, h(cx - 1, cz) - h_c);
+            ao += std::max(0.0F, h(cx + 1, cz) - h_c);
+            ao += std::max(0.0F, h(cx, cz - 1) - h_c);
+            ao += std::max(0.0F, h(cx, cz + 1) - h_c);
             ao = std::clamp(ao * 0.15F, 0.0F, 1.0F);
             section.aoSum += ao;
             section.aoCount += 1;
@@ -535,12 +535,12 @@ void TerrainRenderer::buildMeshes() {
         };
         const int cxi = int(center_gx);
         const int czi = int(center_gz);
-        const float hC = hgrid(cxi, czi);
-        const float hL = hgrid(cxi - 1, czi);
-        const float hR = hgrid(cxi + 1, czi);
-        const float hD = hgrid(cxi, czi - 1);
-        const float hU = hgrid(cxi, czi + 1);
-        const float convexity = hC - 0.25F * (hL + hR + hD + hU);
+        const float h_c = hgrid(cxi, czi);
+        const float h_l = hgrid(cxi - 1, czi);
+        const float h_r = hgrid(cxi + 1, czi);
+        const float h_d = hgrid(cxi, czi - 1);
+        const float h_u = hgrid(cxi, czi + 1);
+        const float convexity = h_c - 0.25F * (h_l + h_r + h_d + h_u);
 
         const float edge_factor = smooth(0.25F, 0.55F, avg_slope);
         const float entrance_factor =
@@ -576,13 +576,13 @@ void TerrainRenderer::buildMeshes() {
                                  : 0.0F;
         float const ao_shade = 1.0F - 0.35F * ao_avg;
 
-        QVector3D avgN = section.normalSum;
-        if (avgN.lengthSquared() > 0.0F) {
-          avgN.normalize();
+        QVector3D avg_n = section.normalSum;
+        if (avg_n.lengthSquared() > 0.0F) {
+          avg_n.normalize();
         }
         QVector3D const north(0, 0, 1);
         float const northness = std::clamp(
-            QVector3D::dotProduct(avgN, north) * 0.5F + 0.5F, 0.0F, 1.0F);
+            QVector3D::dotProduct(avg_n, north) * 0.5F + 0.5F, 0.0F, 1.0F);
         QVector3D const cool_tint(0.96F, 1.02F, 1.04F);
         QVector3D const warm_tint(1.03F, 1.0F, 0.97F);
         QVector3D const aspect_tint =

+ 45 - 49
render/humanoid_base.cpp

@@ -25,10 +25,6 @@
 namespace Render::GL {
 
 using namespace Render::GL::Geometry;
-using Render::Geom::clamp01;
-using Render::Geom::clampf;
-using Render::Geom::clampVec01;
-using Render::Geom::coneFromTo;
 using Render::Geom::cylinderBetween;
 using Render::Geom::sphereAt;
 
@@ -323,15 +319,15 @@ void HumanoidRendererBase::drawCommonBody(const DrawContext &ctx,
            v.palette.skin, nullptr, 1.0F);
 
   QVector3D const iris(0.06F, 0.06F, 0.07F);
-  float const eyeZ = pose.headR * head_scale * 0.7F;
-  float const eyeY = pose.headPos.y() + pose.headR * head_scale * 0.1F;
+  float const eye_z = pose.headR * head_scale * 0.7F;
+  float const eye_y = pose.headPos.y() + pose.headR * head_scale * 0.1F;
   float const eye_spacing = pose.headR * head_scale * 0.35F;
   out.mesh(getUnitSphere(),
-           ctx.model * sphereAt(QVector3D(-eye_spacing, eyeY, eyeZ),
+           ctx.model * sphereAt(QVector3D(-eye_spacing, eye_y, eye_z),
                                 pose.headR * head_scale * 0.15F),
            iris, nullptr, 1.0F);
   out.mesh(getUnitSphere(),
-           ctx.model * sphereAt(QVector3D(eye_spacing, eyeY, eyeZ),
+           ctx.model * sphereAt(QVector3D(eye_spacing, eye_y, eye_z),
                                 pose.headR * head_scale * 0.15F),
            iris, nullptr, 1.0F);
 
@@ -373,25 +369,25 @@ void HumanoidRendererBase::drawCommonBody(const DrawContext &ctx,
   const float knee_forward = 0.15F;
   const float knee_drop = 0.02F * HP::LOWER_LEG_LEN;
 
-  const QVector3D FWD(0.F, 0.F, 1.F);
+  const QVector3D fwd(0.F, 0.F, 1.F);
 
   const float upper_r = HP::UPPER_LEG_R * upper_scale;
   const float lower_r = HP::LOWER_LEG_R * lower_scale;
   const float foot_r = lower_r * foot_rad_mul;
 
-  constexpr float DEG = std::numbers::pi_v<float> / 180.F;
+  constexpr float deg = std::numbers::pi_v<float> / 180.F;
 
-  const QVector3D hipL = pose.pelvisPos + QVector3D(-hip_half, 0.F, 0.F);
-  const QVector3D hipR = pose.pelvisPos + QVector3D(+hip_half, 0.F, 0.F);
-  const float midX = 0.5F * (hipL.x() + hipR.x());
+  const QVector3D hip_l = pose.pelvisPos + QVector3D(-hip_half, 0.F, 0.F);
+  const QVector3D hip_r = pose.pelvisPos + QVector3D(+hip_half, 0.F, 0.F);
+  const float mid_x = 0.5F * (hip_l.x() + hip_r.x());
 
   auto clamp_x = [&](const QVector3D &v, float mid) {
     const float dx = v.x() - mid;
     const float mag = std::min(std::abs(dx), max_stance);
     return QVector3D(mid + (dx < 0 ? -mag : mag), v.y(), v.z());
   };
-  const QVector3D plant_l = clamp_x(pose.footL, midX);
-  const QVector3D plant_r = clamp_x(pose.foot_r, midX);
+  const QVector3D plant_l = clamp_x(pose.footL, mid_x);
+  const QVector3D plant_r = clamp_x(pose.foot_r, mid_x);
 
   const float foot_len = foot_len_mul * lower_r;
   const float heel_back_frac = 0.15F;
@@ -402,10 +398,10 @@ void HumanoidRendererBase::drawCommonBody(const DrawContext &ctx,
   const float ankle_up_frac = 0.50F;
   const float toe_splay_frac = 0.06F;
 
-  const QVector3D fwdL = rotY(FWD, -k_foot_yaw_out_degrees * DEG);
-  const QVector3D fwdR = rotY(FWD, +k_foot_yaw_out_degrees * DEG);
-  const QVector3D right_l = rightOf(fwdL);
-  const QVector3D right_r = rightOf(fwdR);
+  const QVector3D fwd_l = rotY(fwd, -k_foot_yaw_out_degrees * deg);
+  const QVector3D fwd_r = rotY(fwd, +k_foot_yaw_out_degrees * deg);
+  const QVector3D right_l = rightOf(fwd_l);
+  const QVector3D right_r = rightOf(fwd_r);
 
   const float foot_cly_l = plant_l.y() + foot_r;
   const float foot_cly_r = plant_r.y() + foot_r;
@@ -413,13 +409,13 @@ void HumanoidRendererBase::drawCommonBody(const DrawContext &ctx,
   QVector3D heel_cen_l(plant_l.x(), foot_cly_l, plant_l.z());
   QVector3D heel_cen_r(plant_r.x(), foot_cly_r, plant_r.z());
 
-  QVector3D ankle_l = heel_cen_l + fwdL * (ankle_fwd_frac * foot_len);
-  QVector3D ankle_r = heel_cen_r + fwdR * (ankle_fwd_frac * foot_len);
+  QVector3D ankle_l = heel_cen_l + fwd_l * (ankle_fwd_frac * foot_len);
+  QVector3D ankle_r = heel_cen_r + fwd_r * (ankle_fwd_frac * foot_len);
   ankle_l.setY(heel_cen_l.y() + ankle_up_frac * foot_r);
   ankle_r.setY(heel_cen_r.y() + ankle_up_frac * foot_r);
 
-  const float knee_forwardPush = HP::LOWER_LEG_LEN * knee_forward;
-  const float knee_dropAbs = knee_drop;
+  const float knee_forward_push = HP::LOWER_LEG_LEN * knee_forward;
+  const float knee_drop_abs = knee_drop;
 
   QVector3D knee_l;
   QVector3D knee_r;
@@ -433,42 +429,42 @@ void HumanoidRendererBase::drawCommonBody(const DrawContext &ctx,
     auto compute_knee = [&](const QVector3D &hip, const QVector3D &ankle) {
       QVector3D const dir = ankle - hip;
       QVector3D knee = hip + 0.5F * dir;
-      knee += QVector3D(0, 0, 1) * knee_forwardPush;
-      knee.setY(knee.y() - knee_dropAbs);
+      knee += QVector3D(0, 0, 1) * knee_forward_push;
+      knee.setY(knee.y() - knee_drop_abs);
       knee.setX((hip.x() + ankle.x()) * 0.5F);
       return knee;
     };
-    knee_l = compute_knee(hipL, ankle_l);
-    knee_r = compute_knee(hipR, ankle_r);
+    knee_l = compute_knee(hip_l, ankle_l);
+    knee_r = compute_knee(hip_r, ankle_r);
   }
 
   const float heel_back = heel_back_frac * foot_len;
   const float ball_len = ball_frac * foot_len;
   const float toe_len = (1.0F - ball_frac) * foot_len;
 
-  QVector3D const ball_l = heel_cen_l + fwdL * ball_len;
-  QVector3D const ball_r = heel_cen_r + fwdR * ball_len;
+  QVector3D const ball_l = heel_cen_l + fwd_l * ball_len;
+  QVector3D const ball_r = heel_cen_r + fwd_r * ball_len;
 
   const float toe_up_l = toe_up_frac * foot_len;
   const float toe_up_r = toe_up_frac * foot_len;
   const float toe_splay = toe_splay_frac * foot_len;
 
-  QVector3D toeL = ball_l + fwdL * toe_len - right_l * toe_splay;
-  QVector3D toeR = ball_r + fwdR * toe_len + right_r * toe_splay;
-  toeL.setY(ball_l.y() + toe_up_l);
-  toeR.setY(ball_r.y() + toe_up_r);
+  QVector3D toe_l = ball_l + fwd_l * toe_len - right_l * toe_splay;
+  QVector3D toe_r = ball_r + fwd_r * toe_len + right_r * toe_splay;
+  toe_l.setY(ball_l.y() + toe_up_l);
+  toe_r.setY(ball_r.y() + toe_up_r);
 
-  heel_cen_l -= fwdL * heel_back;
-  heel_cen_r -= fwdR * heel_back;
+  heel_cen_l -= fwd_l * heel_back;
+  heel_cen_r -= fwd_r * heel_back;
 
   const float heel_rad = foot_r * 1.05F;
   const float toe_rad = foot_r * 0.85F;
 
   out.mesh(getUnitCapsule(DefaultCapsuleSegments, 1),
-           Render::Geom::capsuleBetween(ctx.model, hipL, knee_l, upper_r),
+           Render::Geom::capsuleBetween(ctx.model, hip_l, knee_l, upper_r),
            v.palette.leather, nullptr, 1.0F);
   out.mesh(getUnitCapsule(DefaultCapsuleSegments, 1),
-           Render::Geom::capsuleBetween(ctx.model, hipR, knee_r, upper_r),
+           Render::Geom::capsuleBetween(ctx.model, hip_r, knee_r, upper_r),
            v.palette.leather, nullptr, 1.0F);
 
   out.mesh(getUnitCapsule(DefaultCapsuleSegments, 1),
@@ -488,10 +484,10 @@ void HumanoidRendererBase::drawCommonBody(const DrawContext &ctx,
       v.palette.leatherDark, nullptr, 1.0F);
 
   out.mesh(getUnitCapsule(DefaultCapsuleSegments, 1),
-           Render::Geom::capsuleBetween(ctx.model, ball_l, toeL, toe_rad),
+           Render::Geom::capsuleBetween(ctx.model, ball_l, toe_l, toe_rad),
            v.palette.leatherDark, nullptr, 1.0F);
   out.mesh(getUnitCapsule(DefaultCapsuleSegments, 1),
-           Render::Geom::capsuleBetween(ctx.model, ball_r, toeR, toe_rad),
+           Render::Geom::capsuleBetween(ctx.model, ball_r, toe_r, toe_rad),
            v.palette.leatherDark, nullptr, 1.0F);
 
   drawHelmet(ctx, v, pose, out);
@@ -508,8 +504,8 @@ void HumanoidRendererBase::drawHelmet(const DrawContext &ctx,
                                       ISubmitter &out) const {
 
   using HP = HumanProportions;
-  QVector3D const capC = pose.headPos + QVector3D(0, pose.headR * 0.8F, 0);
-  out.mesh(getUnitSphere(), sphereAt(ctx.model, capC, pose.headR * 0.85F),
+  QVector3D const cap_c = pose.headPos + QVector3D(0, pose.headR * 0.8F, 0);
+  out.mesh(getUnitSphere(), sphereAt(ctx.model, cap_c, pose.headR * 0.85F),
            v.palette.cloth * 0.9F, nullptr, 1.0F);
 }
 
@@ -592,16 +588,16 @@ void HumanoidRendererBase::render(const DrawContext &ctx,
 
     QMatrix4x4 inst_model;
     if (ctx.entity != nullptr) {
-      if (auto *entT =
+      if (auto *ent_t =
               ctx.entity->getComponent<Engine::Core::TransformComponent>()) {
-        QMatrix4x4 M = k_identity_matrix;
-        M.translate(entT->position.x, entT->position.y, entT->position.z);
-        float const base_yaw = entT->rotation.y;
+        QMatrix4x4 m = k_identity_matrix;
+        m.translate(ent_t->position.x, ent_t->position.y, ent_t->position.z);
+        float const base_yaw = ent_t->rotation.y;
         float const applied_yaw = base_yaw + yaw_offset;
-        M.rotate(applied_yaw, 0.0F, 1.0F, 0.0F);
-        M.scale(entT->scale.x, entT->scale.y, entT->scale.z);
-        M.translate(offset_x, vertical_jitter, offset_z);
-        inst_model = M;
+        m.rotate(applied_yaw, 0.0F, 1.0F, 0.0F);
+        m.scale(ent_t->scale.x, ent_t->scale.y, ent_t->scale.z);
+        m.translate(offset_x, vertical_jitter, offset_z);
+        inst_model = m;
       } else {
         inst_model = ctx.model;
         inst_model.rotate(yaw_offset, 0.0F, 1.0F, 0.0F);

+ 0 - 1
render/palette.cpp

@@ -6,7 +6,6 @@
 
 namespace Render::GL {
 
-using Render::Geom::clamp01;
 using Render::Geom::clampVec01;
 
 auto makeHumanoidPalette(const QVector3D &team_tint,

+ 6 - 6
ui/theme.cpp

@@ -42,12 +42,12 @@ QVariantList Theme::teamIcons() {
 }
 
 QVariantList Theme::factions() {
-  QVariantList factionsData;
-  factionsData.append(QVariantMap{{"id", 0}, {"name", "Standard"}});
-  factionsData.append(QVariantMap{{"id", 1}, {"name", "Romans"}});
-  factionsData.append(QVariantMap{{"id", 2}, {"name", "Egyptians"}});
-  factionsData.append(QVariantMap{{"id", 3}, {"name", "Barbarians"}});
-  return factionsData;
+  QVariantList factions_data;
+  factions_data.append(QVariantMap{{"id", 0}, {"name", "Standard"}});
+  factions_data.append(QVariantMap{{"id", 1}, {"name", "Romans"}});
+  factions_data.append(QVariantMap{{"id", 2}, {"name", "Egyptians"}});
+  factions_data.append(QVariantMap{{"id", 3}, {"name", "Barbarians"}});
+  return factions_data;
 }
 
 QVariantMap Theme::unitIcons() {