about summary refs log tree commit diff stats
path: root/Archipelago/vendor
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-11-29 13:01:15 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2023-11-29 13:01:15 -0500
commitb02f3e471a0c4d2e332889faea33f05f1a9125cc (patch)
tree8b013d5ad722926b62b01ba28a682143fbebaf0b /Archipelago/vendor
parent59e44bbb2a89dd2228b6f39e6964f8dd456d33c9 (diff)
downloadlingo-archipelago-b02f3e471a0c4d2e332889faea33f05f1a9125cc.tar.gz
lingo-archipelago-b02f3e471a0c4d2e332889faea33f05f1a9125cc.tar.bz2
lingo-archipelago-b02f3e471a0c4d2e332889faea33f05f1a9125cc.zip
Multiplayer shows slot name above players
Diffstat (limited to 'Archipelago/vendor')
0 files changed, 0 insertions, 0 deletions
ight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#include "map.h"
#include <tmxlite/Map.hpp>
#include <tmxlite/Layer.hpp>
#include <tmxlite/TileLayer.hpp>
#include <tmxlite/Tileset.hpp>
#include "renderer.h"

Map::Map(std::string_view filename, Renderer& renderer) {
  tmx::Map mapfile;
  if (!mapfile.load(filename.data())) {
    throw std::invalid_argument("Could not find map file: " + std::string(filename));
  }

  const tmx::Vector2u& mapSize = mapfile.getTileCount();
  mapSize_.x() = mapSize.x;
  mapSize_.y() = mapSize.y;

  const tmx::Vector2u& tileSize = mapfile.getTileSize();
  tileSize_.x() = tileSize.x;
  tileSize_.y() = tileSize.y;

  int firstGID = 0;
  // There should only be one tileset.
  for (const tmx::Tileset& tileset : mapfile.getTilesets()) {
    firstGID = tileset.getFirstGID();
    tilesetTextureId_ = renderer.loadImageFromFile(tileset.getImagePath());
    tilesetColumns_ = tileset.getColumnCount();
  }

  for (const auto& layer : mapfile.getLayers()) {
    if (layer->getType() == tmx::Layer::Type::Tile) {
      const auto& tileLayer = layer->getLayerAs<tmx::TileLayer>();

      std::vector<Tile> tilesToStore;

      for (const auto& maptile : tileLayer.getTiles()) {
        tilesToStore.push_back(Tile {
          .id = maptile.ID - firstGID,
          .flipHorizontal = (maptile.flipFlags & tmx::TileLayer::Horizontal) != 0,
          .flipVertical = (maptile.flipFlags & tmx::TileLayer::Vertical) != 0 });
      }

      layers_.push_back(std::move(tilesToStore));
    }
  }
}