Skip to content

Commit

Permalink
Support overlays
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Aug 8, 2024
1 parent 7db7b34 commit 9cb3870
Show file tree
Hide file tree
Showing 30 changed files with 70 additions and 0 deletions.
28 changes: 28 additions & 0 deletions data-with-overlays/challenging/bounds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"xMin": 31744,
"xMax": 34048,
"yMin": 30976,
"yMax": 32768,
"zMin": 0,
"zMax": 15,
"width": 2560,
"height": 2048,
"floorIDs": [
"00",
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"09",
"10",
"11",
"12",
"13",
"14",
"15"
]
}
Binary file added data-with-overlays/challenging/floor-00-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-01-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-03-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-04-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-05-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-06-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-07-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-08-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-09-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-10-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-11-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-12-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-13-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-14-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data-with-overlays/challenging/floor-15-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added overlays/challenging/floor-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added overlays/challenging/floor-04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added overlays/challenging/floor-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added overlays/challenging/floor-07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added overlays/challenging/floor-08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added overlays/challenging/floor-09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added overlays/challenging/floor-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added overlays/challenging/floor-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added overlays/challenging/floor-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added overlays/challenging/floor-13.png
Binary file added overlays/challenging/floor-14.png
Binary file added overlays/challenging/floor-15.png
42 changes: 42 additions & 0 deletions scripts/apply-overlay.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash

# Navigate to the root of the repository.
cd "$(dirname "${BASH_SOURCE}")/..";

# Ensure `tibia-maps` is in the PATH on CI.
PATH="${PATH}:$(pwd)/node_modules/.bin";

if [ -z "${1}" ]; then
echo 'No argument supplied. Example usage:';
echo '';
echo 'scripts/apply-overlay.sh challenging';
exit 0;
fi;

if [ 'challenging' != "${1}" ]; then
echo "Invalid argument. Try 'challenging'.";
exit 0;
fi;

overlayID="${1}";
for floorID in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15; do
echo "Processing ${floorID}...";
input_path="./data/floor-${floorID}-map.png";
overlay_path="./overlays/${overlayID}/floor-${floorID}.png";
mkdir -p "./data-with-overlays/${overlayID}";
output_path="./data-with-overlays/${overlayID}/floor-${floorID}-map.png";
if [ -f "${overlay_path}" ]; then
magick "${input_path}" \
\( -clone 0 -fill black -colorize 60% \) \
-compose over -gravity center -composite \
"${overlay_path}" -gravity center -compose over -composite \
"${output_path}";
else
# No overlay image; only apply the darkening.
magick "${input_path}" \
\( -clone 0 -fill black -colorize 60% \) \
-compose over -gravity center -composite \
"${output_path}";
fi;
done;
cp ./data/bounds.json "./data-with-overlays/${overlayID}/bounds.json";

0 comments on commit 9cb3870

Please sign in to comment.