#!/usr/bin/env bash
# GL screenshots of the real game for the web site (run from the repository root: games/rob-revisited/tools/site/shots.sh)
# The headless GL window is 640x480 unless the engine's Sdl.php opens it at 4x (1280x960): for sharp site images run this from
# a copy of the repository whose engine/src/Renderer/Sdl.php has `new Window($width * 4, $height * 4, ...)` in its headless-GL branch
# (SITE_SHOTS_NOTE: the Xvfb screen of docker/ext/jumphp-xvfb is 1280x1024, big enough).
set -e
cd "$(dirname "$0")/../../../.."
OUT=games/rob-revisited/var/screenshots
mkdir -p "$OUT"
shot() { # name frames params   (ONLY="s-a s-b" retakes some)
  [ -z "$ONLY" ] || [[ " $ONLY " == *" $1 "* ]] || return 0
  JUMPHP_GL=1 JUMPHP_SCENE='App\Scene\RevisitedScene' JUMPHP_SCENE_PARAMS="$3" \
    bin/jumphp shot rob-revisited "$2" "var/screenshots/$1.png"
}
B='"seed":7,"new":true,"help":false'
shot s-valley   90 "{$B,\"zone\":\"valley\",\"minutes\":120,\"yaw\":0.4}"
shot s-canyon   90 "{$B,\"zone\":\"canyon\",\"at\":\"campfire\",\"dist\":14,\"minutes\":240}"
shot s-jungle   90 "{$B,\"zone\":\"jungle\",\"x\":195,\"z\":282,\"yaw\":1.57,\"pitch\":0.06,\"minutes\":180}"
shot s-marsh    90 "{$B,\"zone\":\"marsh\",\"at\":\"stilt_hut\",\"dist\":18,\"minutes\":200,\"weather\":\"fog\",\"amount\":0.7}"
shot s-plateau  90 "{$B,\"zone\":\"plateau\",\"at\":\"relay_mast\",\"dist\":25,\"minutes\":240,\"weather\":\"snow\",\"amount\":0.5}"
shot s-coast    90 "{$B,\"zone\":\"coast\",\"at\":\"shuttle\",\"dist\":30,\"minutes\":600}"
shot s-sunset   90 "{$B,\"zone\":\"valley\",\"minutes\":650,\"yaw\":3.6}"
shot s-night    90 "{$B,\"zone\":\"canyon\",\"at\":\"campfire\",\"dist\":6,\"minutes\":850}"
shot s-rain     420 "{$B,\"zone\":\"valley\",\"minutes\":300,\"weather\":\"storm\",\"amount\":1}"
shot s-body     60 "{$B,\"screen\":\"body\",\"endurance\":0.5,\"force\":0.3}"
shot s-scanner  60 "{$B,\"screen\":\"scanner\"}"
shot s-talk     60 "{$B,\"zone\":\"canyon\",\"talk\":\"maeva\",\"minutes\":240}"
shot s-craft    60 "{$B,\"screen\":\"craft\"}"
# new in the reborn version
shot s-caves    100 "{$B,\"zone\":\"caves1\",\"hold\":\"torch,spear\",\"beast\":\"crawler\",\"beast_dist\":6}"
shot s-hands    60 "{$B,\"zone\":\"canyon\",\"at\":\"campfire\",\"dist\":14,\"minutes\":240,\"hold\":\"torch,spear\",\"yaw\":0.4}"
shot s-inventory 60 "{$B,\"screen\":\"inventory\",\"hold\":\"torch,spear\"}"
shot s-chest    60 "{$B,\"zone\":\"canyon\",\"minutes\":240,\"chest\":\"chest_wood\",\"menu\":\"chest\"}"
shot s-saves    60 "{$B,\"zone\":\"canyon\",\"demo_saves\":6,\"saves\":\"load\"}"
shot s-waterfall 90 "{$B,\"zone\":\"valley\",\"at\":\"waterfall\",\"dist\":22,\"minutes\":200,\"pitch\":0.12}"
